@covalent/components 6.0.1 → 6.0.3

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 (193) hide show
  1. package/action-ribbon.mjs +9 -7
  2. package/alert.mjs +13 -11
  3. package/app-shell.mjs +10 -4
  4. package/aria-property.mjs +41 -0
  5. package/base-element.mjs +28 -0
  6. package/button.mjs +180 -13
  7. package/card.mjs +3 -3
  8. package/check-list-item.mjs +92 -14
  9. package/checkbox.mjs +26 -14
  10. package/circular-progress.mjs +144 -10
  11. package/class-map.mjs +62 -0
  12. package/code-snippet.mjs +6 -5
  13. package/covalent.mjs +2 -2
  14. package/covalent.umd.js +3339 -137
  15. package/dialog.mjs +750 -15
  16. package/directive-helpers.mjs +11 -0
  17. package/drawer.mjs +26 -15
  18. package/empty-state.mjs +4 -4
  19. package/event-options.mjs +14 -0
  20. package/form-element.mjs +50 -0
  21. package/foundation.mjs +152 -0
  22. package/foundation2.mjs +60 -0
  23. package/icon-button.mjs +130 -15
  24. package/icon-check-toggle.mjs +18 -8
  25. package/icon-radio-toggle.mjs +29 -18
  26. package/icon.mjs +19 -13
  27. package/if-defined.mjs +10 -0
  28. package/inert.esm.mjs +640 -0
  29. package/linear-progress.mjs +178 -15
  30. package/list-expansion.mjs +33 -22
  31. package/list-item.mjs +19 -20
  32. package/list.mjs +26 -13
  33. package/menu.mjs +32 -13
  34. package/mwc-checkbox-base.mjs +198 -0
  35. package/mwc-checkbox.css.mjs +10 -0
  36. package/mwc-drawer-base.mjs +335 -0
  37. package/mwc-icon.mjs +26 -0
  38. package/mwc-line-ripple-directive.mjs +653 -0
  39. package/mwc-list-base.mjs +840 -0
  40. package/mwc-list-item-base.mjs +202 -0
  41. package/mwc-list-item.css.mjs +17 -0
  42. package/mwc-menu-base.mjs +1145 -0
  43. package/mwc-radio-base.mjs +528 -0
  44. package/mwc-radio.css.mjs +10 -0
  45. package/mwc-slider.css.mjs +956 -0
  46. package/mwc-tab-base.mjs +694 -0
  47. package/mwc-top-app-bar-base.mjs +380 -0
  48. package/nav-list-item.mjs +28 -20
  49. package/observer.mjs +32 -0
  50. package/package.json +9 -2
  51. package/property.mjs +20 -0
  52. package/query-assigned-elements.mjs +615 -0
  53. package/query-assigned-nodes.mjs +17 -0
  54. package/query.mjs +25 -0
  55. package/radio-list-item.mjs +93 -12
  56. package/radio.mjs +28 -15
  57. package/ripple-handlers.mjs +761 -0
  58. package/select.mjs +1257 -15
  59. package/side-sheet.mjs +21 -16
  60. package/slider-range.mjs +438 -11
  61. package/slider.mjs +253 -13
  62. package/snackbar.mjs +456 -15
  63. package/src/action-ribbon/action-ribbon-base.d.ts +30 -0
  64. package/src/action-ribbon/action-ribbon-base.d.ts.map +1 -0
  65. package/src/action-ribbon/action-ribbon.d.ts +15 -0
  66. package/src/action-ribbon/action-ribbon.d.ts.map +1 -0
  67. package/src/alert/alert-base.d.ts +31 -0
  68. package/src/alert/alert-base.d.ts.map +1 -0
  69. package/src/alert/alert.d.ts +15 -0
  70. package/src/alert/alert.d.ts.map +1 -0
  71. package/src/app-shell/app-shell.d.ts +26 -0
  72. package/src/app-shell/app-shell.d.ts.map +1 -0
  73. package/src/button/button.d.ts +10 -0
  74. package/src/button/button.d.ts.map +1 -0
  75. package/src/card/card-base.d.ts +25 -0
  76. package/src/card/card-base.d.ts.map +1 -0
  77. package/src/card/card.d.ts +10 -0
  78. package/src/card/card.d.ts.map +1 -0
  79. package/src/checkbox/checkbox.d.ts +10 -0
  80. package/src/checkbox/checkbox.d.ts.map +1 -0
  81. package/src/chips/chip-base.d.ts +52 -0
  82. package/src/chips/chip-base.d.ts.map +1 -0
  83. package/src/chips/chip-set-base.d.ts +33 -0
  84. package/src/chips/chip-set-base.d.ts.map +1 -0
  85. package/src/chips/chip-set.d.ts +15 -0
  86. package/src/chips/chip-set.d.ts.map +1 -0
  87. package/src/chips/chip.d.ts +15 -0
  88. package/src/chips/chip.d.ts.map +1 -0
  89. package/src/chips/foundation.d.ts +60 -0
  90. package/src/chips/foundation.d.ts.map +1 -0
  91. package/src/circular-progress/circular-progress.d.ts +10 -0
  92. package/src/circular-progress/circular-progress.d.ts.map +1 -0
  93. package/src/code-snippet/code-snippet.d.ts +21 -0
  94. package/src/code-snippet/code-snippet.d.ts.map +1 -0
  95. package/src/dialog/dialog.d.ts +10 -0
  96. package/src/dialog/dialog.d.ts.map +1 -0
  97. package/src/drawer/drawer.d.ts +10 -0
  98. package/src/drawer/drawer.d.ts.map +1 -0
  99. package/src/empty-state/empty-state.d.ts +16 -0
  100. package/src/empty-state/empty-state.d.ts.map +1 -0
  101. package/src/formfield/formfield.d.ts +10 -0
  102. package/src/formfield/formfield.d.ts.map +1 -0
  103. package/src/icon/icon.d.ts +10 -0
  104. package/src/icon/icon.d.ts.map +1 -0
  105. package/src/icon-button/icon-button.d.ts +10 -0
  106. package/src/icon-button/icon-button.d.ts.map +1 -0
  107. package/src/icon-checkbox/icon-check-toggle.d.ts +15 -0
  108. package/src/icon-checkbox/icon-check-toggle.d.ts.map +1 -0
  109. package/src/icon-radio/icon-radio-toggle.d.ts +14 -0
  110. package/src/icon-radio/icon-radio-toggle.d.ts.map +1 -0
  111. package/src/index.d.ts +3 -0
  112. package/src/index.d.ts.map +1 -0
  113. package/src/linear-progress/linear-progress.d.ts +10 -0
  114. package/src/linear-progress/linear-progress.d.ts.map +1 -0
  115. package/src/list/check-list-item.d.ts +10 -0
  116. package/src/list/check-list-item.d.ts.map +1 -0
  117. package/src/list/list-expansion.d.ts +18 -0
  118. package/src/list/list-expansion.d.ts.map +1 -0
  119. package/src/list/list-item.d.ts +12 -0
  120. package/src/list/list-item.d.ts.map +1 -0
  121. package/src/list/list.d.ts +10 -0
  122. package/src/list/list.d.ts.map +1 -0
  123. package/src/list/nav-list-item.d.ts +12 -0
  124. package/src/list/nav-list-item.d.ts.map +1 -0
  125. package/src/list/radio-list-item.d.ts +10 -0
  126. package/src/list/radio-list-item.d.ts.map +1 -0
  127. package/src/menu/menu.d.ts +10 -0
  128. package/src/menu/menu.d.ts.map +1 -0
  129. package/src/radio/radio.d.ts +10 -0
  130. package/src/radio/radio.d.ts.map +1 -0
  131. package/src/select/select.d.ts +10 -0
  132. package/src/select/select.d.ts.map +1 -0
  133. package/src/side-sheet/side-sheet.d.ts +18 -0
  134. package/src/side-sheet/side-sheet.d.ts.map +1 -0
  135. package/src/slider/slider-range.d.ts +10 -0
  136. package/src/slider/slider-range.d.ts.map +1 -0
  137. package/src/slider/slider.d.ts +10 -0
  138. package/src/slider/slider.d.ts.map +1 -0
  139. package/src/snackbar/snackbar.d.ts +10 -0
  140. package/src/snackbar/snackbar.d.ts.map +1 -0
  141. package/src/status-header/status-header-base.d.ts +9 -0
  142. package/src/status-header/status-header-base.d.ts.map +1 -0
  143. package/src/status-header/status-header-item.d.ts +17 -0
  144. package/src/status-header/status-header-item.d.ts.map +1 -0
  145. package/src/status-header/status-header.d.ts +15 -0
  146. package/src/status-header/status-header.d.ts.map +1 -0
  147. package/src/switch/switch.d.ts +10 -0
  148. package/src/switch/switch.d.ts.map +1 -0
  149. package/src/tab/tab-bar.d.ts +10 -0
  150. package/src/tab/tab-bar.d.ts.map +1 -0
  151. package/src/tab/tab.d.ts +10 -0
  152. package/src/tab/tab.d.ts.map +1 -0
  153. package/src/text-lockup/text-lockup.d.ts +17 -0
  154. package/src/text-lockup/text-lockup.d.ts.map +1 -0
  155. package/src/textarea/textarea.d.ts +10 -0
  156. package/src/textarea/textarea.d.ts.map +1 -0
  157. package/src/textfield/textfield.d.ts +10 -0
  158. package/src/textfield/textfield.d.ts.map +1 -0
  159. package/src/toolbar/toolbar.d.ts +10 -0
  160. package/src/toolbar/toolbar.d.ts.map +1 -0
  161. package/src/tooltip/tooltip.d.ts +27 -0
  162. package/src/tooltip/tooltip.d.ts.map +1 -0
  163. package/src/top-app-bar/top-app-bar-fixed.d.ts +10 -0
  164. package/src/top-app-bar/top-app-bar-fixed.d.ts.map +1 -0
  165. package/src/top-app-bar/top-app-bar.d.ts +10 -0
  166. package/src/top-app-bar/top-app-bar.d.ts.map +1 -0
  167. package/src/tree-list/tree-list-item.d.ts +16 -0
  168. package/src/tree-list/tree-list-item.d.ts.map +1 -0
  169. package/src/tree-list/tree-list.d.ts +11 -0
  170. package/src/tree-list/tree-list.d.ts.map +1 -0
  171. package/src/typography/typography.d.ts +12 -0
  172. package/src/typography/typography.d.ts.map +1 -0
  173. package/state.mjs +12 -0
  174. package/status-header-item.mjs +16 -16
  175. package/status-header.mjs +5 -5
  176. package/style-map.mjs +40 -0
  177. package/switch.mjs +531 -15
  178. package/tab-bar.mjs +1030 -13
  179. package/tab.mjs +29 -15
  180. package/text-lockup.mjs +8 -8
  181. package/textarea.mjs +111 -16
  182. package/textfield.mjs +34 -18
  183. package/textfield2.mjs +929 -2
  184. package/toolbar.mjs +8 -3
  185. package/tooltip.mjs +1153 -96
  186. package/top-app-bar-fixed.mjs +78 -18
  187. package/top-app-bar.mjs +19 -15
  188. package/top-app-bar2.mjs +9 -2
  189. package/tree-list-item.mjs +3 -3
  190. package/tree-list.mjs +6 -7
  191. package/tslib.es6.mjs +82 -0
  192. package/typography.mjs +8 -8
  193. package/utils.mjs +52 -0
@@ -0,0 +1,840 @@
1
+ import { b as p } from "./tslib.es6.mjs";
2
+ import { i as z, e as B, y as P } from "./query-assigned-elements.mjs";
3
+ import { L as H } from "./mwc-list-item-base.mjs";
4
+ import { B as K } from "./base-element.mjs";
5
+ import { o as L } from "./observer.mjs";
6
+ import { i as V, d as X, b as G } from "./utils.mjs";
7
+ import { e as I } from "./property.mjs";
8
+ import { i as $ } from "./query.mjs";
9
+ import { o as k } from "./query-assigned-nodes.mjs";
10
+ import { l as U } from "./if-defined.mjs";
11
+ /**
12
+ * @license
13
+ * Copyright 2021 Google LLC
14
+ * SPDX-LIcense-Identifier: Apache-2.0
15
+ */
16
+ const j = z`:host{cursor:pointer;user-select:none;-webkit-tap-highlight-color:transparent;height:48px;display:flex;position:relative;align-items:center;justify-content:flex-start;overflow:hidden;padding:0;padding-left:var(--mdc-list-side-padding, 16px);padding-right:var(--mdc-list-side-padding, 16px);outline:none;height:48px;color:rgba(0,0,0,.87);color:var(--mdc-theme-text-primary-on-background, rgba(0, 0, 0, 0.87))}:host:focus{outline:none}:host([activated]){color:#6200ee;color:var(--mdc-theme-primary, #6200ee);--mdc-ripple-color: var( --mdc-theme-primary, #6200ee )}:host([activated]) .mdc-deprecated-list-item__graphic{color:#6200ee;color:var(--mdc-theme-primary, #6200ee)}:host([activated]) .fake-activated-ripple::before{position:absolute;display:block;top:0;bottom:0;left:0;right:0;width:100%;height:100%;pointer-events:none;z-index:1;content:"";opacity:0.12;opacity:var(--mdc-ripple-activated-opacity, 0.12);background-color:#6200ee;background-color:var(--mdc-ripple-color, var(--mdc-theme-primary, #6200ee))}.mdc-deprecated-list-item__graphic{flex-shrink:0;align-items:center;justify-content:center;fill:currentColor;display:inline-flex}.mdc-deprecated-list-item__graphic ::slotted(*){flex-shrink:0;align-items:center;justify-content:center;fill:currentColor;width:100%;height:100%;text-align:center}.mdc-deprecated-list-item__meta{width:var(--mdc-list-item-meta-size, 24px);height:var(--mdc-list-item-meta-size, 24px);margin-left:auto;margin-right:0;color:rgba(0, 0, 0, 0.38);color:var(--mdc-theme-text-hint-on-background, rgba(0, 0, 0, 0.38))}.mdc-deprecated-list-item__meta.multi{width:auto}.mdc-deprecated-list-item__meta ::slotted(*){width:var(--mdc-list-item-meta-size, 24px);line-height:var(--mdc-list-item-meta-size, 24px)}.mdc-deprecated-list-item__meta ::slotted(.material-icons),.mdc-deprecated-list-item__meta ::slotted(mwc-icon){line-height:var(--mdc-list-item-meta-size, 24px) !important}.mdc-deprecated-list-item__meta ::slotted(:not(.material-icons):not(mwc-icon)){-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;font-family:Roboto, sans-serif;font-family:var(--mdc-typography-caption-font-family, var(--mdc-typography-font-family, Roboto, sans-serif));font-size:0.75rem;font-size:var(--mdc-typography-caption-font-size, 0.75rem);line-height:1.25rem;line-height:var(--mdc-typography-caption-line-height, 1.25rem);font-weight:400;font-weight:var(--mdc-typography-caption-font-weight, 400);letter-spacing:0.0333333333em;letter-spacing:var(--mdc-typography-caption-letter-spacing, 0.0333333333em);text-decoration:inherit;text-decoration:var(--mdc-typography-caption-text-decoration, inherit);text-transform:inherit;text-transform:var(--mdc-typography-caption-text-transform, inherit)}[dir=rtl] .mdc-deprecated-list-item__meta,.mdc-deprecated-list-item__meta[dir=rtl]{margin-left:0;margin-right:auto}.mdc-deprecated-list-item__meta ::slotted(*){width:100%;height:100%}.mdc-deprecated-list-item__text{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.mdc-deprecated-list-item__text ::slotted([for]),.mdc-deprecated-list-item__text[for]{pointer-events:none}.mdc-deprecated-list-item__primary-text{text-overflow:ellipsis;white-space:nowrap;overflow:hidden;display:block;margin-top:0;line-height:normal;margin-bottom:-20px;display:block}.mdc-deprecated-list-item__primary-text::before{display:inline-block;width:0;height:32px;content:"";vertical-align:0}.mdc-deprecated-list-item__primary-text::after{display:inline-block;width:0;height:20px;content:"";vertical-align:-20px}.mdc-deprecated-list-item__secondary-text{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;font-family:Roboto, sans-serif;font-family:var(--mdc-typography-body2-font-family, var(--mdc-typography-font-family, Roboto, sans-serif));font-size:0.875rem;font-size:var(--mdc-typography-body2-font-size, 0.875rem);line-height:1.25rem;line-height:var(--mdc-typography-body2-line-height, 1.25rem);font-weight:400;font-weight:var(--mdc-typography-body2-font-weight, 400);letter-spacing:0.0178571429em;letter-spacing:var(--mdc-typography-body2-letter-spacing, 0.0178571429em);text-decoration:inherit;text-decoration:var(--mdc-typography-body2-text-decoration, inherit);text-transform:inherit;text-transform:var(--mdc-typography-body2-text-transform, inherit);text-overflow:ellipsis;white-space:nowrap;overflow:hidden;display:block;margin-top:0;line-height:normal;display:block}.mdc-deprecated-list-item__secondary-text::before{display:inline-block;width:0;height:20px;content:"";vertical-align:0}.mdc-deprecated-list--dense .mdc-deprecated-list-item__secondary-text{font-size:inherit}* ::slotted(a),a{color:inherit;text-decoration:none}:host([twoline]){height:72px}:host([twoline]) .mdc-deprecated-list-item__text{align-self:flex-start}:host([disabled]),:host([noninteractive]){cursor:default;pointer-events:none}:host([disabled]) .mdc-deprecated-list-item__text ::slotted(*){opacity:.38}:host([disabled]) .mdc-deprecated-list-item__text ::slotted(*),:host([disabled]) .mdc-deprecated-list-item__primary-text ::slotted(*),:host([disabled]) .mdc-deprecated-list-item__secondary-text ::slotted(*){color:#000;color:var(--mdc-theme-on-surface, #000)}.mdc-deprecated-list-item__secondary-text ::slotted(*){color:rgba(0, 0, 0, 0.54);color:var(--mdc-theme-text-secondary-on-background, rgba(0, 0, 0, 0.54))}.mdc-deprecated-list-item__graphic ::slotted(*){background-color:transparent;color:rgba(0, 0, 0, 0.38);color:var(--mdc-theme-text-icon-on-background, rgba(0, 0, 0, 0.38))}.mdc-deprecated-list-group__subheader ::slotted(*){color:rgba(0, 0, 0, 0.87);color:var(--mdc-theme-text-primary-on-background, rgba(0, 0, 0, 0.87))}:host([graphic=avatar]) .mdc-deprecated-list-item__graphic{width:var(--mdc-list-item-graphic-size, 40px);height:var(--mdc-list-item-graphic-size, 40px)}:host([graphic=avatar]) .mdc-deprecated-list-item__graphic.multi{width:auto}:host([graphic=avatar]) .mdc-deprecated-list-item__graphic ::slotted(*){width:var(--mdc-list-item-graphic-size, 40px);line-height:var(--mdc-list-item-graphic-size, 40px)}:host([graphic=avatar]) .mdc-deprecated-list-item__graphic ::slotted(.material-icons),:host([graphic=avatar]) .mdc-deprecated-list-item__graphic ::slotted(mwc-icon){line-height:var(--mdc-list-item-graphic-size, 40px) !important}:host([graphic=avatar]) .mdc-deprecated-list-item__graphic ::slotted(*){border-radius:50%}:host([graphic=avatar]) .mdc-deprecated-list-item__graphic,:host([graphic=medium]) .mdc-deprecated-list-item__graphic,:host([graphic=large]) .mdc-deprecated-list-item__graphic,:host([graphic=control]) .mdc-deprecated-list-item__graphic{margin-left:0;margin-right:var(--mdc-list-item-graphic-margin, 16px)}[dir=rtl] :host([graphic=avatar]) .mdc-deprecated-list-item__graphic,[dir=rtl] :host([graphic=medium]) .mdc-deprecated-list-item__graphic,[dir=rtl] :host([graphic=large]) .mdc-deprecated-list-item__graphic,[dir=rtl] :host([graphic=control]) .mdc-deprecated-list-item__graphic,:host([graphic=avatar]) .mdc-deprecated-list-item__graphic[dir=rtl],:host([graphic=medium]) .mdc-deprecated-list-item__graphic[dir=rtl],:host([graphic=large]) .mdc-deprecated-list-item__graphic[dir=rtl],:host([graphic=control]) .mdc-deprecated-list-item__graphic[dir=rtl]{margin-left:var(--mdc-list-item-graphic-margin, 16px);margin-right:0}:host([graphic=icon]) .mdc-deprecated-list-item__graphic{width:var(--mdc-list-item-graphic-size, 24px);height:var(--mdc-list-item-graphic-size, 24px);margin-left:0;margin-right:var(--mdc-list-item-graphic-margin, 32px)}:host([graphic=icon]) .mdc-deprecated-list-item__graphic.multi{width:auto}:host([graphic=icon]) .mdc-deprecated-list-item__graphic ::slotted(*){width:var(--mdc-list-item-graphic-size, 24px);line-height:var(--mdc-list-item-graphic-size, 24px)}:host([graphic=icon]) .mdc-deprecated-list-item__graphic ::slotted(.material-icons),:host([graphic=icon]) .mdc-deprecated-list-item__graphic ::slotted(mwc-icon){line-height:var(--mdc-list-item-graphic-size, 24px) !important}[dir=rtl] :host([graphic=icon]) .mdc-deprecated-list-item__graphic,:host([graphic=icon]) .mdc-deprecated-list-item__graphic[dir=rtl]{margin-left:var(--mdc-list-item-graphic-margin, 32px);margin-right:0}:host([graphic=avatar]:not([twoLine])),:host([graphic=icon]:not([twoLine])){height:56px}:host([graphic=medium]:not([twoLine])),:host([graphic=large]:not([twoLine])){height:72px}:host([graphic=medium]) .mdc-deprecated-list-item__graphic,:host([graphic=large]) .mdc-deprecated-list-item__graphic{width:var(--mdc-list-item-graphic-size, 56px);height:var(--mdc-list-item-graphic-size, 56px)}:host([graphic=medium]) .mdc-deprecated-list-item__graphic.multi,:host([graphic=large]) .mdc-deprecated-list-item__graphic.multi{width:auto}:host([graphic=medium]) .mdc-deprecated-list-item__graphic ::slotted(*),:host([graphic=large]) .mdc-deprecated-list-item__graphic ::slotted(*){width:var(--mdc-list-item-graphic-size, 56px);line-height:var(--mdc-list-item-graphic-size, 56px)}:host([graphic=medium]) .mdc-deprecated-list-item__graphic ::slotted(.material-icons),:host([graphic=medium]) .mdc-deprecated-list-item__graphic ::slotted(mwc-icon),:host([graphic=large]) .mdc-deprecated-list-item__graphic ::slotted(.material-icons),:host([graphic=large]) .mdc-deprecated-list-item__graphic ::slotted(mwc-icon){line-height:var(--mdc-list-item-graphic-size, 56px) !important}:host([graphic=large]){padding-left:0px}`;
17
+ /**
18
+ * @license
19
+ * Copyright 2020 Google LLC
20
+ * SPDX-License-Identifier: Apache-2.0
21
+ */
22
+ let F = class extends H {
23
+ };
24
+ F.styles = [j];
25
+ F = p([
26
+ B("mwc-list-item")
27
+ ], F);
28
+ /**
29
+ * @license
30
+ * Copyright 2016 Google Inc.
31
+ *
32
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
33
+ * of this software and associated documentation files (the "Software"), to deal
34
+ * in the Software without restriction, including without limitation the rights
35
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
36
+ * copies of the Software, and to permit persons to whom the Software is
37
+ * furnished to do so, subject to the following conditions:
38
+ *
39
+ * The above copyright notice and this permission notice shall be included in
40
+ * all copies or substantial portions of the Software.
41
+ *
42
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
43
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
44
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
45
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
46
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
47
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
48
+ * THE SOFTWARE.
49
+ */
50
+ var Y = (
51
+ /** @class */
52
+ function() {
53
+ function r(e) {
54
+ e === void 0 && (e = {}), this.adapter = e;
55
+ }
56
+ return Object.defineProperty(r, "cssClasses", {
57
+ get: function() {
58
+ return {};
59
+ },
60
+ enumerable: !1,
61
+ configurable: !0
62
+ }), Object.defineProperty(r, "strings", {
63
+ get: function() {
64
+ return {};
65
+ },
66
+ enumerable: !1,
67
+ configurable: !0
68
+ }), Object.defineProperty(r, "numbers", {
69
+ get: function() {
70
+ return {};
71
+ },
72
+ enumerable: !1,
73
+ configurable: !0
74
+ }), Object.defineProperty(r, "defaultAdapter", {
75
+ get: function() {
76
+ return {};
77
+ },
78
+ enumerable: !1,
79
+ configurable: !0
80
+ }), r.prototype.init = function() {
81
+ }, r.prototype.destroy = function() {
82
+ }, r;
83
+ }()
84
+ );
85
+ /**
86
+ * @license
87
+ * Copyright 2020 Google Inc.
88
+ *
89
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
90
+ * of this software and associated documentation files (the "Software"), to deal
91
+ * in the Software without restriction, including without limitation the rights
92
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
93
+ * copies of the Software, and to permit persons to whom the Software is
94
+ * furnished to do so, subject to the following conditions:
95
+ *
96
+ * The above copyright notice and this permission notice shall be included in
97
+ * all copies or substantial portions of the Software.
98
+ *
99
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
100
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
101
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
102
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
103
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
104
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
105
+ * THE SOFTWARE.
106
+ */
107
+ var a = {
108
+ UNKNOWN: "Unknown",
109
+ BACKSPACE: "Backspace",
110
+ ENTER: "Enter",
111
+ SPACEBAR: "Spacebar",
112
+ PAGE_UP: "PageUp",
113
+ PAGE_DOWN: "PageDown",
114
+ END: "End",
115
+ HOME: "Home",
116
+ ARROW_LEFT: "ArrowLeft",
117
+ ARROW_UP: "ArrowUp",
118
+ ARROW_RIGHT: "ArrowRight",
119
+ ARROW_DOWN: "ArrowDown",
120
+ DELETE: "Delete",
121
+ ESCAPE: "Escape",
122
+ TAB: "Tab"
123
+ }, c = /* @__PURE__ */ new Set();
124
+ c.add(a.BACKSPACE);
125
+ c.add(a.ENTER);
126
+ c.add(a.SPACEBAR);
127
+ c.add(a.PAGE_UP);
128
+ c.add(a.PAGE_DOWN);
129
+ c.add(a.END);
130
+ c.add(a.HOME);
131
+ c.add(a.ARROW_LEFT);
132
+ c.add(a.ARROW_UP);
133
+ c.add(a.ARROW_RIGHT);
134
+ c.add(a.ARROW_DOWN);
135
+ c.add(a.DELETE);
136
+ c.add(a.ESCAPE);
137
+ c.add(a.TAB);
138
+ var h = {
139
+ BACKSPACE: 8,
140
+ ENTER: 13,
141
+ SPACEBAR: 32,
142
+ PAGE_UP: 33,
143
+ PAGE_DOWN: 34,
144
+ END: 35,
145
+ HOME: 36,
146
+ ARROW_LEFT: 37,
147
+ ARROW_UP: 38,
148
+ ARROW_RIGHT: 39,
149
+ ARROW_DOWN: 40,
150
+ DELETE: 46,
151
+ ESCAPE: 27,
152
+ TAB: 9
153
+ }, l = /* @__PURE__ */ new Map();
154
+ l.set(h.BACKSPACE, a.BACKSPACE);
155
+ l.set(h.ENTER, a.ENTER);
156
+ l.set(h.SPACEBAR, a.SPACEBAR);
157
+ l.set(h.PAGE_UP, a.PAGE_UP);
158
+ l.set(h.PAGE_DOWN, a.PAGE_DOWN);
159
+ l.set(h.END, a.END);
160
+ l.set(h.HOME, a.HOME);
161
+ l.set(h.ARROW_LEFT, a.ARROW_LEFT);
162
+ l.set(h.ARROW_UP, a.ARROW_UP);
163
+ l.set(h.ARROW_RIGHT, a.ARROW_RIGHT);
164
+ l.set(h.ARROW_DOWN, a.ARROW_DOWN);
165
+ l.set(h.DELETE, a.DELETE);
166
+ l.set(h.ESCAPE, a.ESCAPE);
167
+ l.set(h.TAB, a.TAB);
168
+ var S = /* @__PURE__ */ new Set();
169
+ S.add(a.PAGE_UP);
170
+ S.add(a.PAGE_DOWN);
171
+ S.add(a.END);
172
+ S.add(a.HOME);
173
+ S.add(a.ARROW_LEFT);
174
+ S.add(a.ARROW_UP);
175
+ S.add(a.ARROW_RIGHT);
176
+ S.add(a.ARROW_DOWN);
177
+ function A(r) {
178
+ var e = r.key;
179
+ if (c.has(e))
180
+ return e;
181
+ var t = l.get(r.keyCode);
182
+ return t || a.UNKNOWN;
183
+ }
184
+ /**
185
+ * @license
186
+ * Copyright 2018 Google Inc.
187
+ *
188
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
189
+ * of this software and associated documentation files (the "Software"), to deal
190
+ * in the Software without restriction, including without limitation the rights
191
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
192
+ * copies of the Software, and to permit persons to whom the Software is
193
+ * furnished to do so, subject to the following conditions:
194
+ *
195
+ * The above copyright notice and this permission notice shall be included in
196
+ * all copies or substantial portions of the Software.
197
+ *
198
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
199
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
200
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
201
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
202
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
203
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
204
+ * THE SOFTWARE.
205
+ */
206
+ var x, E, n = {
207
+ LIST_ITEM_ACTIVATED_CLASS: "mdc-list-item--activated",
208
+ LIST_ITEM_CLASS: "mdc-list-item",
209
+ LIST_ITEM_DISABLED_CLASS: "mdc-list-item--disabled",
210
+ LIST_ITEM_SELECTED_CLASS: "mdc-list-item--selected",
211
+ LIST_ITEM_TEXT_CLASS: "mdc-list-item__text",
212
+ LIST_ITEM_PRIMARY_TEXT_CLASS: "mdc-list-item__primary-text",
213
+ ROOT: "mdc-list"
214
+ };
215
+ x = {}, x["" + n.LIST_ITEM_ACTIVATED_CLASS] = "mdc-list-item--activated", x["" + n.LIST_ITEM_CLASS] = "mdc-list-item", x["" + n.LIST_ITEM_DISABLED_CLASS] = "mdc-list-item--disabled", x["" + n.LIST_ITEM_SELECTED_CLASS] = "mdc-list-item--selected", x["" + n.LIST_ITEM_PRIMARY_TEXT_CLASS] = "mdc-list-item__primary-text", x["" + n.ROOT] = "mdc-list";
216
+ var v = (E = {}, E["" + n.LIST_ITEM_ACTIVATED_CLASS] = "mdc-deprecated-list-item--activated", E["" + n.LIST_ITEM_CLASS] = "mdc-deprecated-list-item", E["" + n.LIST_ITEM_DISABLED_CLASS] = "mdc-deprecated-list-item--disabled", E["" + n.LIST_ITEM_SELECTED_CLASS] = "mdc-deprecated-list-item--selected", E["" + n.LIST_ITEM_TEXT_CLASS] = "mdc-deprecated-list-item__text", E["" + n.LIST_ITEM_PRIMARY_TEXT_CLASS] = "mdc-deprecated-list-item__primary-text", E["" + n.ROOT] = "mdc-deprecated-list", E), C = {
217
+ ACTION_EVENT: "MDCList:action",
218
+ SELECTION_CHANGE_EVENT: "MDCList:selectionChange",
219
+ ARIA_CHECKED: "aria-checked",
220
+ ARIA_CHECKED_CHECKBOX_SELECTOR: '[role="checkbox"][aria-checked="true"]',
221
+ ARIA_CHECKED_RADIO_SELECTOR: '[role="radio"][aria-checked="true"]',
222
+ ARIA_CURRENT: "aria-current",
223
+ ARIA_DISABLED: "aria-disabled",
224
+ ARIA_ORIENTATION: "aria-orientation",
225
+ ARIA_ORIENTATION_HORIZONTAL: "horizontal",
226
+ ARIA_ROLE_CHECKBOX_SELECTOR: '[role="checkbox"]',
227
+ ARIA_SELECTED: "aria-selected",
228
+ ARIA_INTERACTIVE_ROLES_SELECTOR: '[role="listbox"], [role="menu"]',
229
+ ARIA_MULTI_SELECTABLE_SELECTOR: '[aria-multiselectable="true"]',
230
+ CHECKBOX_RADIO_SELECTOR: 'input[type="checkbox"], input[type="radio"]',
231
+ CHECKBOX_SELECTOR: 'input[type="checkbox"]',
232
+ CHILD_ELEMENTS_TO_TOGGLE_TABINDEX: `
233
+ .` + n.LIST_ITEM_CLASS + ` button:not(:disabled),
234
+ .` + n.LIST_ITEM_CLASS + ` a,
235
+ .` + v[n.LIST_ITEM_CLASS] + ` button:not(:disabled),
236
+ .` + v[n.LIST_ITEM_CLASS] + ` a
237
+ `,
238
+ DEPRECATED_SELECTOR: ".mdc-deprecated-list",
239
+ FOCUSABLE_CHILD_ELEMENTS: `
240
+ .` + n.LIST_ITEM_CLASS + ` button:not(:disabled),
241
+ .` + n.LIST_ITEM_CLASS + ` a,
242
+ .` + n.LIST_ITEM_CLASS + ` input[type="radio"]:not(:disabled),
243
+ .` + n.LIST_ITEM_CLASS + ` input[type="checkbox"]:not(:disabled),
244
+ .` + v[n.LIST_ITEM_CLASS] + ` button:not(:disabled),
245
+ .` + v[n.LIST_ITEM_CLASS] + ` a,
246
+ .` + v[n.LIST_ITEM_CLASS] + ` input[type="radio"]:not(:disabled),
247
+ .` + v[n.LIST_ITEM_CLASS] + ` input[type="checkbox"]:not(:disabled)
248
+ `,
249
+ RADIO_SELECTOR: 'input[type="radio"]',
250
+ SELECTED_ITEM_SELECTOR: '[aria-selected="true"], [aria-current="true"]'
251
+ }, m = {
252
+ UNSET_INDEX: -1,
253
+ TYPEAHEAD_BUFFER_CLEAR_TIMEOUT_MS: 300
254
+ };
255
+ /**
256
+ * @license
257
+ * Copyright 2020 Google LLC
258
+ * SPDX-License-Identifier: Apache-2.0
259
+ */
260
+ const D = (r, e) => r - e, q = (r, e) => {
261
+ const t = Array.from(r), i = Array.from(e), s = { added: [], removed: [] }, d = t.sort(D), o = i.sort(D);
262
+ let _ = 0, b = 0;
263
+ for (; _ < d.length || b < o.length; ) {
264
+ const f = d[_], g = o[b];
265
+ if (f === g) {
266
+ _++, b++;
267
+ continue;
268
+ }
269
+ if (f !== void 0 && (g === void 0 || f < g)) {
270
+ s.removed.push(f), _++;
271
+ continue;
272
+ }
273
+ if (g !== void 0 && (f === void 0 || g < f)) {
274
+ s.added.push(g), b++;
275
+ continue;
276
+ }
277
+ }
278
+ return s;
279
+ }, Z = ["input", "button", "textarea", "select"];
280
+ function R(r) {
281
+ return r instanceof Set;
282
+ }
283
+ const O = (r) => {
284
+ const e = r === m.UNSET_INDEX ? /* @__PURE__ */ new Set() : r;
285
+ return R(e) ? new Set(e) : /* @__PURE__ */ new Set([e]);
286
+ };
287
+ class N extends Y {
288
+ constructor(e) {
289
+ super(Object.assign(Object.assign({}, N.defaultAdapter), e)), this.isMulti_ = !1, this.wrapFocus_ = !1, this.isVertical_ = !0, this.selectedIndex_ = m.UNSET_INDEX, this.focusedItemIndex_ = m.UNSET_INDEX, this.useActivatedClass_ = !1, this.ariaCurrentAttrValue_ = null;
290
+ }
291
+ static get strings() {
292
+ return C;
293
+ }
294
+ static get numbers() {
295
+ return m;
296
+ }
297
+ static get defaultAdapter() {
298
+ return {
299
+ focusItemAtIndex: () => {
300
+ },
301
+ getFocusedElementIndex: () => 0,
302
+ getListItemCount: () => 0,
303
+ isFocusInsideList: () => !1,
304
+ isRootFocused: () => !1,
305
+ notifyAction: () => {
306
+ },
307
+ notifySelected: () => {
308
+ },
309
+ getSelectedStateForElementIndex: () => !1,
310
+ setDisabledStateForElementIndex: () => {
311
+ },
312
+ getDisabledStateForElementIndex: () => !1,
313
+ setSelectedStateForElementIndex: () => {
314
+ },
315
+ setActivatedStateForElementIndex: () => {
316
+ },
317
+ setTabIndexForElementIndex: () => {
318
+ },
319
+ setAttributeForElementIndex: () => {
320
+ },
321
+ getAttributeForElementIndex: () => null
322
+ };
323
+ }
324
+ /**
325
+ * Sets the private wrapFocus_ variable.
326
+ */
327
+ setWrapFocus(e) {
328
+ this.wrapFocus_ = e;
329
+ }
330
+ /**
331
+ * Sets the private wrapFocus_ variable.
332
+ */
333
+ setMulti(e) {
334
+ this.isMulti_ = e;
335
+ const t = this.selectedIndex_;
336
+ if (e) {
337
+ if (!R(t)) {
338
+ const i = t === m.UNSET_INDEX;
339
+ this.selectedIndex_ = i ? /* @__PURE__ */ new Set() : /* @__PURE__ */ new Set([t]);
340
+ }
341
+ } else if (R(t))
342
+ if (t.size) {
343
+ const i = Array.from(t).sort(D);
344
+ this.selectedIndex_ = i[0];
345
+ } else
346
+ this.selectedIndex_ = m.UNSET_INDEX;
347
+ }
348
+ /**
349
+ * Sets the isVertical_ private variable.
350
+ */
351
+ setVerticalOrientation(e) {
352
+ this.isVertical_ = e;
353
+ }
354
+ /**
355
+ * Sets the useActivatedClass_ private variable.
356
+ */
357
+ setUseActivatedClass(e) {
358
+ this.useActivatedClass_ = e;
359
+ }
360
+ getSelectedIndex() {
361
+ return this.selectedIndex_;
362
+ }
363
+ setSelectedIndex(e) {
364
+ this.isIndexValid_(e) && (this.isMulti_ ? this.setMultiSelectionAtIndex_(O(e)) : this.setSingleSelectionAtIndex_(e));
365
+ }
366
+ /**
367
+ * Focus in handler for the list items.
368
+ */
369
+ handleFocusIn(e, t) {
370
+ t >= 0 && this.adapter.setTabIndexForElementIndex(t, 0);
371
+ }
372
+ /**
373
+ * Focus out handler for the list items.
374
+ */
375
+ handleFocusOut(e, t) {
376
+ t >= 0 && this.adapter.setTabIndexForElementIndex(t, -1), setTimeout(() => {
377
+ this.adapter.isFocusInsideList() || this.setTabindexToFirstSelectedItem_();
378
+ }, 0);
379
+ }
380
+ /**
381
+ * Key handler for the list.
382
+ */
383
+ handleKeydown(e, t, i) {
384
+ const s = A(e) === "ArrowLeft", d = A(e) === "ArrowUp", o = A(e) === "ArrowRight", _ = A(e) === "ArrowDown", b = A(e) === "Home", f = A(e) === "End", g = A(e) === "Enter", W = A(e) === "Spacebar";
385
+ if (this.adapter.isRootFocused()) {
386
+ d || f ? (e.preventDefault(), this.focusLastElement()) : (_ || b) && (e.preventDefault(), this.focusFirstElement());
387
+ return;
388
+ }
389
+ let T = this.adapter.getFocusedElementIndex();
390
+ if (T === -1 && (T = i, T < 0))
391
+ return;
392
+ let y;
393
+ if (this.isVertical_ && _ || !this.isVertical_ && o)
394
+ this.preventDefaultEvent(e), y = this.focusNextElement(T);
395
+ else if (this.isVertical_ && d || !this.isVertical_ && s)
396
+ this.preventDefaultEvent(e), y = this.focusPrevElement(T);
397
+ else if (b)
398
+ this.preventDefaultEvent(e), y = this.focusFirstElement();
399
+ else if (f)
400
+ this.preventDefaultEvent(e), y = this.focusLastElement();
401
+ else if ((g || W) && t) {
402
+ const M = e.target;
403
+ if (M && M.tagName === "A" && g)
404
+ return;
405
+ this.preventDefaultEvent(e), this.setSelectedIndexOnAction_(T, !0);
406
+ }
407
+ this.focusedItemIndex_ = T, y !== void 0 && (this.setTabindexAtIndex_(y), this.focusedItemIndex_ = y);
408
+ }
409
+ /**
410
+ * Click handler for the list.
411
+ */
412
+ handleSingleSelection(e, t, i) {
413
+ e !== m.UNSET_INDEX && (this.setSelectedIndexOnAction_(e, t, i), this.setTabindexAtIndex_(e), this.focusedItemIndex_ = e);
414
+ }
415
+ /**
416
+ * Focuses the next element on the list.
417
+ */
418
+ focusNextElement(e) {
419
+ const t = this.adapter.getListItemCount();
420
+ let i = e + 1;
421
+ if (i >= t)
422
+ if (this.wrapFocus_)
423
+ i = 0;
424
+ else
425
+ return e;
426
+ return this.adapter.focusItemAtIndex(i), i;
427
+ }
428
+ /**
429
+ * Focuses the previous element on the list.
430
+ */
431
+ focusPrevElement(e) {
432
+ let t = e - 1;
433
+ if (t < 0)
434
+ if (this.wrapFocus_)
435
+ t = this.adapter.getListItemCount() - 1;
436
+ else
437
+ return e;
438
+ return this.adapter.focusItemAtIndex(t), t;
439
+ }
440
+ focusFirstElement() {
441
+ return this.adapter.focusItemAtIndex(0), 0;
442
+ }
443
+ focusLastElement() {
444
+ const e = this.adapter.getListItemCount() - 1;
445
+ return this.adapter.focusItemAtIndex(e), e;
446
+ }
447
+ /**
448
+ * @param itemIndex Index of the list item
449
+ * @param isEnabled Sets the list item to enabled or disabled.
450
+ */
451
+ setEnabled(e, t) {
452
+ this.isIndexValid_(e) && this.adapter.setDisabledStateForElementIndex(e, !t);
453
+ }
454
+ /**
455
+ * Ensures that preventDefault is only called if the containing element
456
+ * doesn't consume the event, and it will cause an unintended scroll.
457
+ */
458
+ preventDefaultEvent(e) {
459
+ const i = `${e.target.tagName}`.toLowerCase();
460
+ Z.indexOf(i) === -1 && e.preventDefault();
461
+ }
462
+ setSingleSelectionAtIndex_(e, t = !0) {
463
+ this.selectedIndex_ !== e && (this.selectedIndex_ !== m.UNSET_INDEX && (this.adapter.setSelectedStateForElementIndex(this.selectedIndex_, !1), this.useActivatedClass_ && this.adapter.setActivatedStateForElementIndex(this.selectedIndex_, !1)), t && this.adapter.setSelectedStateForElementIndex(e, !0), this.useActivatedClass_ && this.adapter.setActivatedStateForElementIndex(e, !0), this.setAriaForSingleSelectionAtIndex_(e), this.selectedIndex_ = e, this.adapter.notifySelected(e));
464
+ }
465
+ setMultiSelectionAtIndex_(e, t = !0) {
466
+ const i = O(this.selectedIndex_), s = q(i, e);
467
+ if (!(!s.removed.length && !s.added.length)) {
468
+ for (const d of s.removed)
469
+ t && this.adapter.setSelectedStateForElementIndex(d, !1), this.useActivatedClass_ && this.adapter.setActivatedStateForElementIndex(d, !1);
470
+ for (const d of s.added)
471
+ t && this.adapter.setSelectedStateForElementIndex(d, !0), this.useActivatedClass_ && this.adapter.setActivatedStateForElementIndex(d, !0);
472
+ this.selectedIndex_ = e, this.adapter.notifySelected(e, s);
473
+ }
474
+ }
475
+ /**
476
+ * Sets aria attribute for single selection at given index.
477
+ */
478
+ setAriaForSingleSelectionAtIndex_(e) {
479
+ this.selectedIndex_ === m.UNSET_INDEX && (this.ariaCurrentAttrValue_ = this.adapter.getAttributeForElementIndex(e, C.ARIA_CURRENT));
480
+ const t = this.ariaCurrentAttrValue_ !== null, i = t ? C.ARIA_CURRENT : C.ARIA_SELECTED;
481
+ this.selectedIndex_ !== m.UNSET_INDEX && this.adapter.setAttributeForElementIndex(this.selectedIndex_, i, "false");
482
+ const s = t ? this.ariaCurrentAttrValue_ : "true";
483
+ this.adapter.setAttributeForElementIndex(e, i, s);
484
+ }
485
+ setTabindexAtIndex_(e) {
486
+ this.focusedItemIndex_ === m.UNSET_INDEX && e !== 0 ? this.adapter.setTabIndexForElementIndex(0, -1) : this.focusedItemIndex_ >= 0 && this.focusedItemIndex_ !== e && this.adapter.setTabIndexForElementIndex(this.focusedItemIndex_, -1), this.adapter.setTabIndexForElementIndex(e, 0);
487
+ }
488
+ setTabindexToFirstSelectedItem_() {
489
+ let e = 0;
490
+ typeof this.selectedIndex_ == "number" && this.selectedIndex_ !== m.UNSET_INDEX ? e = this.selectedIndex_ : R(this.selectedIndex_) && this.selectedIndex_.size > 0 && (e = Math.min(...this.selectedIndex_)), this.setTabindexAtIndex_(e);
491
+ }
492
+ isIndexValid_(e) {
493
+ if (e instanceof Set) {
494
+ if (!this.isMulti_)
495
+ throw new Error("MDCListFoundation: Array of index is only supported for checkbox based list");
496
+ if (e.size === 0)
497
+ return !0;
498
+ {
499
+ let t = !1;
500
+ for (const i of e)
501
+ if (t = this.isIndexInRange_(i), t)
502
+ break;
503
+ return t;
504
+ }
505
+ } else if (typeof e == "number") {
506
+ if (this.isMulti_)
507
+ throw new Error("MDCListFoundation: Expected array of index for checkbox based list but got number: " + e);
508
+ return e === m.UNSET_INDEX || this.isIndexInRange_(e);
509
+ } else
510
+ return !1;
511
+ }
512
+ isIndexInRange_(e) {
513
+ const t = this.adapter.getListItemCount();
514
+ return e >= 0 && e < t;
515
+ }
516
+ /**
517
+ * Sets selected index on user action, toggles checkbox / radio based on
518
+ * toggleCheckbox value. User interaction should not toggle list item(s) when
519
+ * disabled.
520
+ */
521
+ setSelectedIndexOnAction_(e, t, i) {
522
+ if (this.adapter.getDisabledStateForElementIndex(e))
523
+ return;
524
+ let s = e;
525
+ this.isMulti_ && (s = /* @__PURE__ */ new Set([e])), this.isIndexValid_(s) && (this.isMulti_ ? this.toggleMultiAtIndex(e, i, t) : t || i ? this.setSingleSelectionAtIndex_(e, t) : this.selectedIndex_ === e && this.setSingleSelectionAtIndex_(m.UNSET_INDEX), t && this.adapter.notifyAction(e));
526
+ }
527
+ toggleMultiAtIndex(e, t, i = !0) {
528
+ let s = !1;
529
+ t === void 0 ? s = !this.adapter.getSelectedStateForElementIndex(e) : s = t;
530
+ const d = O(this.selectedIndex_);
531
+ s ? d.add(e) : d.delete(e), this.setMultiSelectionAtIndex_(d, i);
532
+ }
533
+ }
534
+ /**
535
+ * @license
536
+ * Copyright 2020 Google LLC
537
+ * SPDX-License-Identifier: Apache-2.0
538
+ */
539
+ function J(r, e = 50) {
540
+ let t;
541
+ return function(i = !0) {
542
+ clearTimeout(t), t = setTimeout(() => {
543
+ r(i);
544
+ }, e);
545
+ };
546
+ }
547
+ const w = (r) => r.hasAttribute("mwc-list-item");
548
+ function Q() {
549
+ const r = this.itemsReadyResolver;
550
+ this.itemsReady = new Promise((e) => this.itemsReadyResolver = e), r();
551
+ }
552
+ class u extends K {
553
+ constructor() {
554
+ super(), this.mdcAdapter = null, this.mdcFoundationClass = N, this.activatable = !1, this.multi = !1, this.wrapFocus = !1, this.itemRoles = null, this.innerRole = null, this.innerAriaLabel = null, this.rootTabbable = !1, this.previousTabindex = null, this.noninteractive = !1, this.itemsReadyResolver = () => {
555
+ }, this.itemsReady = Promise.resolve([]), this.items_ = [];
556
+ const e = J(this.layout.bind(this));
557
+ this.debouncedLayout = (t = !0) => {
558
+ Q.call(this), e(t);
559
+ };
560
+ }
561
+ // tslint:disable:ban-ts-ignore
562
+ async getUpdateComplete() {
563
+ const e = await super.getUpdateComplete();
564
+ return await this.itemsReady, e;
565
+ }
566
+ get items() {
567
+ return this.items_;
568
+ }
569
+ updateItems() {
570
+ var e;
571
+ const t = (e = this.assignedElements) !== null && e !== void 0 ? e : [], i = [];
572
+ for (const o of t)
573
+ w(o) && (i.push(o), o._managingList = this), o.hasAttribute("divider") && !o.hasAttribute("role") && o.setAttribute("role", "separator");
574
+ this.items_ = i;
575
+ const s = /* @__PURE__ */ new Set();
576
+ if (this.items_.forEach((o, _) => {
577
+ this.itemRoles ? o.setAttribute("role", this.itemRoles) : o.removeAttribute("role"), o.selected && s.add(_);
578
+ }), this.multi)
579
+ this.select(s);
580
+ else {
581
+ const o = s.size ? s.entries().next().value[1] : -1;
582
+ this.select(o);
583
+ }
584
+ const d = new Event("items-updated", { bubbles: !0, composed: !0 });
585
+ this.dispatchEvent(d);
586
+ }
587
+ get selected() {
588
+ const e = this.index;
589
+ if (!R(e))
590
+ return e === -1 ? null : this.items[e];
591
+ const t = [];
592
+ for (const i of e)
593
+ t.push(this.items[i]);
594
+ return t;
595
+ }
596
+ get index() {
597
+ return this.mdcFoundation ? this.mdcFoundation.getSelectedIndex() : -1;
598
+ }
599
+ render() {
600
+ const e = this.innerRole === null ? void 0 : this.innerRole, t = this.innerAriaLabel === null ? void 0 : this.innerAriaLabel, i = this.rootTabbable ? "0" : "-1";
601
+ return P`
602
+ <!-- @ts-ignore -->
603
+ <ul
604
+ tabindex=${i}
605
+ role="${U(e)}"
606
+ aria-label="${U(t)}"
607
+ class="mdc-deprecated-list"
608
+ @keydown=${this.onKeydown}
609
+ @focusin=${this.onFocusIn}
610
+ @focusout=${this.onFocusOut}
611
+ @request-selected=${this.onRequestSelected}
612
+ @list-item-rendered=${this.onListItemConnected}>
613
+ <slot></slot>
614
+ ${this.renderPlaceholder()}
615
+ </ul>
616
+ `;
617
+ }
618
+ renderPlaceholder() {
619
+ var e;
620
+ const t = (e = this.assignedElements) !== null && e !== void 0 ? e : [];
621
+ return this.emptyMessage !== void 0 && t.length === 0 ? P`
622
+ <mwc-list-item noninteractive>${this.emptyMessage}</mwc-list-item>
623
+ ` : null;
624
+ }
625
+ firstUpdated() {
626
+ super.firstUpdated(), this.items.length || (this.mdcFoundation.setMulti(this.multi), this.layout());
627
+ }
628
+ onFocusIn(e) {
629
+ if (this.mdcFoundation && this.mdcRoot) {
630
+ const t = this.getIndexOfTarget(e);
631
+ this.mdcFoundation.handleFocusIn(e, t);
632
+ }
633
+ }
634
+ onFocusOut(e) {
635
+ if (this.mdcFoundation && this.mdcRoot) {
636
+ const t = this.getIndexOfTarget(e);
637
+ this.mdcFoundation.handleFocusOut(e, t);
638
+ }
639
+ }
640
+ onKeydown(e) {
641
+ if (this.mdcFoundation && this.mdcRoot) {
642
+ const t = this.getIndexOfTarget(e), i = e.target, s = w(i);
643
+ this.mdcFoundation.handleKeydown(e, s, t);
644
+ }
645
+ }
646
+ onRequestSelected(e) {
647
+ if (this.mdcFoundation) {
648
+ let t = this.getIndexOfTarget(e);
649
+ if (t === -1 && (this.layout(), t = this.getIndexOfTarget(e), t === -1) || this.items[t].disabled)
650
+ return;
651
+ const s = e.detail.selected, d = e.detail.source;
652
+ this.mdcFoundation.handleSingleSelection(t, d === "interaction", s), e.stopPropagation();
653
+ }
654
+ }
655
+ getIndexOfTarget(e) {
656
+ const t = this.items, i = e.composedPath();
657
+ for (const s of i) {
658
+ let d = -1;
659
+ if (V(s) && w(s) && (d = t.indexOf(s)), d !== -1)
660
+ return d;
661
+ }
662
+ return -1;
663
+ }
664
+ createAdapter() {
665
+ return this.mdcAdapter = {
666
+ getListItemCount: () => this.mdcRoot ? this.items.length : 0,
667
+ getFocusedElementIndex: this.getFocusedItemIndex,
668
+ getAttributeForElementIndex: (e, t) => {
669
+ if (!this.mdcRoot)
670
+ return "";
671
+ const s = this.items[e];
672
+ return s ? s.getAttribute(t) : "";
673
+ },
674
+ setAttributeForElementIndex: (e, t, i) => {
675
+ if (!this.mdcRoot)
676
+ return;
677
+ const s = this.items[e];
678
+ s && s.setAttribute(t, i);
679
+ },
680
+ focusItemAtIndex: (e) => {
681
+ const t = this.items[e];
682
+ t && t.focus();
683
+ },
684
+ setTabIndexForElementIndex: (e, t) => {
685
+ const i = this.items[e];
686
+ i && (i.tabindex = t);
687
+ },
688
+ notifyAction: (e) => {
689
+ const t = { bubbles: !0, composed: !0 };
690
+ t.detail = { index: e };
691
+ const i = new CustomEvent("action", t);
692
+ this.dispatchEvent(i);
693
+ },
694
+ notifySelected: (e, t) => {
695
+ const i = { bubbles: !0, composed: !0 };
696
+ i.detail = { index: e, diff: t };
697
+ const s = new CustomEvent("selected", i);
698
+ this.dispatchEvent(s);
699
+ },
700
+ isFocusInsideList: () => X(this),
701
+ isRootFocused: () => {
702
+ const e = this.mdcRoot;
703
+ return e.getRootNode().activeElement === e;
704
+ },
705
+ setDisabledStateForElementIndex: (e, t) => {
706
+ const i = this.items[e];
707
+ i && (i.disabled = t);
708
+ },
709
+ getDisabledStateForElementIndex: (e) => {
710
+ const t = this.items[e];
711
+ return t ? t.disabled : !1;
712
+ },
713
+ setSelectedStateForElementIndex: (e, t) => {
714
+ const i = this.items[e];
715
+ i && (i.selected = t);
716
+ },
717
+ getSelectedStateForElementIndex: (e) => {
718
+ const t = this.items[e];
719
+ return t ? t.selected : !1;
720
+ },
721
+ setActivatedStateForElementIndex: (e, t) => {
722
+ const i = this.items[e];
723
+ i && (i.activated = t);
724
+ }
725
+ }, this.mdcAdapter;
726
+ }
727
+ selectUi(e, t = !1) {
728
+ const i = this.items[e];
729
+ i && (i.selected = !0, i.activated = t);
730
+ }
731
+ deselectUi(e) {
732
+ const t = this.items[e];
733
+ t && (t.selected = !1, t.activated = !1);
734
+ }
735
+ select(e) {
736
+ this.mdcFoundation && this.mdcFoundation.setSelectedIndex(e);
737
+ }
738
+ toggle(e, t) {
739
+ this.multi && this.mdcFoundation.toggleMultiAtIndex(e, t);
740
+ }
741
+ onListItemConnected(e) {
742
+ const t = e.target;
743
+ this.layout(this.items.indexOf(t) === -1);
744
+ }
745
+ layout(e = !0) {
746
+ e && this.updateItems();
747
+ const t = this.items[0];
748
+ for (const i of this.items)
749
+ i.tabindex = -1;
750
+ t && (this.noninteractive ? this.previousTabindex || (this.previousTabindex = t) : t.tabindex = 0), this.itemsReadyResolver();
751
+ }
752
+ getFocusedItemIndex() {
753
+ if (!this.mdcRoot || !this.items.length)
754
+ return -1;
755
+ const e = G();
756
+ if (!e.length)
757
+ return -1;
758
+ for (let t = e.length - 1; t >= 0; t--) {
759
+ const i = e[t];
760
+ if (w(i))
761
+ return this.items.indexOf(i);
762
+ }
763
+ return -1;
764
+ }
765
+ focusItemAtIndex(e) {
766
+ for (const t of this.items)
767
+ if (t.tabindex === 0) {
768
+ t.tabindex = -1;
769
+ break;
770
+ }
771
+ this.items[e].tabindex = 0, this.items[e].focus();
772
+ }
773
+ focus() {
774
+ const e = this.mdcRoot;
775
+ e && e.focus();
776
+ }
777
+ blur() {
778
+ const e = this.mdcRoot;
779
+ e && e.blur();
780
+ }
781
+ }
782
+ p([
783
+ I({ type: String })
784
+ ], u.prototype, "emptyMessage", void 0);
785
+ p([
786
+ $(".mdc-deprecated-list")
787
+ ], u.prototype, "mdcRoot", void 0);
788
+ p([
789
+ k("", !0, "*")
790
+ ], u.prototype, "assignedElements", void 0);
791
+ p([
792
+ k("", !0, '[tabindex="0"]')
793
+ ], u.prototype, "tabbableElements", void 0);
794
+ p([
795
+ I({ type: Boolean }),
796
+ L(function(r) {
797
+ this.mdcFoundation && this.mdcFoundation.setUseActivatedClass(r);
798
+ })
799
+ ], u.prototype, "activatable", void 0);
800
+ p([
801
+ I({ type: Boolean }),
802
+ L(function(r, e) {
803
+ this.mdcFoundation && this.mdcFoundation.setMulti(r), e !== void 0 && this.layout();
804
+ })
805
+ ], u.prototype, "multi", void 0);
806
+ p([
807
+ I({ type: Boolean }),
808
+ L(function(r) {
809
+ this.mdcFoundation && this.mdcFoundation.setWrapFocus(r);
810
+ })
811
+ ], u.prototype, "wrapFocus", void 0);
812
+ p([
813
+ I({ type: String }),
814
+ L(function(r, e) {
815
+ e !== void 0 && this.updateItems();
816
+ })
817
+ ], u.prototype, "itemRoles", void 0);
818
+ p([
819
+ I({ type: String })
820
+ ], u.prototype, "innerRole", void 0);
821
+ p([
822
+ I({ type: String })
823
+ ], u.prototype, "innerAriaLabel", void 0);
824
+ p([
825
+ I({ type: Boolean })
826
+ ], u.prototype, "rootTabbable", void 0);
827
+ p([
828
+ I({ type: Boolean, reflect: !0 }),
829
+ L(function(r) {
830
+ var e, t;
831
+ if (r) {
832
+ const i = (t = (e = this.tabbableElements) === null || e === void 0 ? void 0 : e[0]) !== null && t !== void 0 ? t : null;
833
+ this.previousTabindex = i, i && i.setAttribute("tabindex", "-1");
834
+ } else
835
+ !r && this.previousTabindex && (this.previousTabindex.setAttribute("tabindex", "0"), this.previousTabindex = null);
836
+ })
837
+ ], u.prototype, "noninteractive", void 0);
838
+ export {
839
+ u as L
840
+ };