@sme.up/ketchup 5.0.0 → 5.2.1-SNAPSHOT

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 (224) hide show
  1. package/README.md +1 -1
  2. package/dist/cjs/{cell-utils-720be0c8.js → cell-utils-d96b2993.js} +4 -4
  3. package/dist/cjs/{f-button-dbf3cd3a.js → f-button-2b9b99b1.js} +2 -2
  4. package/dist/cjs/{f-cell-93d984ad.js → f-cell-8351cb84.js} +8 -96
  5. package/dist/cjs/{f-chip-438213eb.js → f-chip-df59e1b0.js} +3 -3
  6. package/dist/cjs/{f-image-21865ab7.js → f-image-12bab3b5.js} +2 -2
  7. package/dist/cjs/f-text-field-e7c35b5b.js +94 -0
  8. package/dist/cjs/f-text-field-mdc-a67f5dfe.js +2852 -0
  9. package/dist/cjs/{index-ab119fad.js → index-eb556444.js} +6 -1
  10. package/dist/cjs/ketchup.cjs.js +3 -3
  11. package/dist/cjs/kup-accordion.cjs.entry.js +5 -5
  12. package/dist/cjs/kup-autocomplete_27.cjs.entry.js +641 -3331
  13. package/dist/cjs/kup-calendar.cjs.entry.js +8 -8
  14. package/dist/cjs/kup-cell.cjs.entry.js +9 -8
  15. package/dist/cjs/kup-dash-list.cjs.entry.js +5 -5
  16. package/dist/cjs/kup-dash_2.cjs.entry.js +5 -5
  17. package/dist/cjs/kup-drawer.cjs.entry.js +8 -5
  18. package/dist/cjs/kup-echart.cjs.entry.js +210 -60
  19. package/dist/cjs/kup-field.cjs.entry.js +3 -3
  20. package/dist/cjs/kup-iframe.cjs.entry.js +4 -4
  21. package/dist/cjs/kup-lazy.cjs.entry.js +4 -4
  22. package/dist/cjs/kup-magic-box.cjs.entry.js +7 -7
  23. package/dist/cjs/{kup-manager-09c0c1fc.js → kup-manager-5c03da64.js} +3061 -2642
  24. package/dist/cjs/kup-nav-bar.cjs.entry.js +6 -6
  25. package/dist/cjs/kup-numeric-picker.cjs.entry.js +423 -0
  26. package/dist/cjs/kup-photo-frame.cjs.entry.js +179 -0
  27. package/dist/cjs/kup-probe.cjs.entry.js +3 -3
  28. package/dist/cjs/kup-qlik.cjs.entry.js +3 -3
  29. package/dist/cjs/kup-snackbar.cjs.entry.js +6 -6
  30. package/dist/cjs/loader.cjs.js +3 -3
  31. package/dist/cjs/{utils-a60ab5fa.js → utils-e99921c1.js} +4 -38
  32. package/dist/collection/assets/card.js +30 -30
  33. package/dist/collection/assets/data-table.js +24 -74
  34. package/dist/collection/assets/echart.js +481 -0
  35. package/dist/collection/assets/index.js +87 -79
  36. package/dist/collection/assets/kupdata.js +29 -41
  37. package/dist/collection/assets/kuptooltip.js +608 -0
  38. package/dist/collection/assets/list.js +6 -6
  39. package/dist/collection/assets/nav-bar.js +4 -4
  40. package/dist/collection/assets/probe.js +18 -18
  41. package/dist/collection/collection-manifest.json +3 -1
  42. package/dist/collection/components/kup-autocomplete/kup-autocomplete.js +4 -4
  43. package/dist/collection/components/kup-box/kup-box.js +9 -9
  44. package/dist/collection/components/kup-button-list/kup-button-list.js +4 -4
  45. package/dist/collection/components/kup-card/built-in/kup-card-built-in.js +10 -0
  46. package/dist/collection/components/kup-card/built-in/kup-card-column-drop-menu.js +20 -20
  47. package/dist/collection/components/kup-card/built-in/kup-card-numeric.js +153 -0
  48. package/dist/collection/components/kup-card/kup-card.css +35 -0
  49. package/dist/collection/components/kup-card/kup-card.js +1 -0
  50. package/dist/collection/components/kup-chip/kup-chip.js +4 -4
  51. package/dist/collection/components/kup-combobox/kup-combobox.js +5 -5
  52. package/dist/collection/components/kup-data-table/kup-data-table-declarations.js +0 -2
  53. package/dist/collection/components/kup-data-table/kup-data-table-helper.js +31 -32
  54. package/dist/collection/components/kup-data-table/kup-data-table-state.js +1 -1
  55. package/dist/collection/components/kup-data-table/kup-data-table.js +112 -159
  56. package/dist/collection/components/kup-date-picker/kup-date-picker.js +1 -1
  57. package/dist/collection/components/kup-drawer/kup-drawer.js +4 -1
  58. package/dist/collection/components/kup-dropdown-button/kup-dropdown-button.css +3 -3
  59. package/dist/collection/components/kup-dropdown-button/kup-dropdown-button.js +14 -14
  60. package/dist/collection/components/kup-echart/kup-echart-declarations.js +3 -0
  61. package/dist/collection/components/kup-echart/kup-echart.js +246 -58
  62. package/dist/collection/components/kup-image/assets/svg/instagram.svg +1 -0
  63. package/dist/collection/components/kup-image/assets/svg/pinterest.svg +1 -0
  64. package/dist/collection/components/kup-image/assets/svg/reddit.svg +1 -0
  65. package/dist/collection/components/kup-list/kup-list-helper.js +26 -26
  66. package/dist/collection/components/kup-list/kup-list.css +35 -3
  67. package/dist/collection/components/kup-list/kup-list.js +52 -44
  68. package/dist/collection/components/kup-magic-box/kup-magic-box.js +3 -3
  69. package/dist/collection/components/kup-nav-bar/kup-nav-bar.js +2 -2
  70. package/dist/collection/components/kup-numeric-picker/kup-numeric-picker-declarations.js +16 -0
  71. package/dist/collection/components/kup-numeric-picker/kup-numeric-picker.css +50 -0
  72. package/dist/collection/components/kup-numeric-picker/kup-numeric-picker.js +895 -0
  73. package/dist/collection/components/kup-photo-frame/kup-photo-frame-declarations.js +10 -0
  74. package/dist/collection/components/kup-photo-frame/kup-photo-frame.css +70 -0
  75. package/dist/collection/components/kup-photo-frame/kup-photo-frame.js +382 -0
  76. package/dist/collection/components/kup-tab-bar/kup-tab-bar.css +1 -1
  77. package/dist/collection/components/kup-time-picker/kup-time-picker.js +8 -8
  78. package/dist/collection/components/kup-tree/kup-tree.js +25 -38
  79. package/dist/collection/f-components/f-paginator/f-paginator.js +6 -6
  80. package/dist/collection/managers/kup-data/kup-data-cell-helper.js +2 -2
  81. package/dist/collection/managers/kup-data/kup-data-column-helper.js +27 -3
  82. package/dist/collection/managers/kup-data/kup-data-declarations.js +2 -1
  83. package/dist/collection/managers/kup-data/kup-data-node-helper.js +1 -1
  84. package/dist/collection/managers/kup-data/kup-data-row-helper.js +2 -2
  85. package/dist/collection/managers/kup-data/kup-data.js +337 -155
  86. package/dist/collection/managers/kup-dates/kup-dates.js +2 -2
  87. package/dist/collection/managers/kup-debug/kup-debug.js +7 -6
  88. package/dist/collection/managers/kup-dynamic-position/kup-dynamic-position.js +1 -1
  89. package/dist/collection/managers/kup-language/kup-language.js +2 -2
  90. package/dist/collection/managers/kup-manager/kup-manager.js +25 -1
  91. package/dist/collection/managers/kup-math/kup-math-declarations.js +13 -0
  92. package/dist/collection/managers/kup-math/kup-math-helper.js +39 -0
  93. package/dist/collection/managers/kup-math/kup-math.js +161 -0
  94. package/dist/collection/managers/kup-objects/kup-objects.js +48 -1
  95. package/dist/collection/managers/kup-theme/kup-theme-declarations.js +1 -0
  96. package/dist/collection/managers/kup-theme/kup-theme.js +2 -2
  97. package/dist/collection/managers/kup-tooltip/kup-tooltip-declarations.js +1 -0
  98. package/dist/collection/managers/kup-tooltip/kup-tooltip.js +191 -0
  99. package/dist/collection/types/GenericTypes.js +1 -0
  100. package/dist/collection/utils/cell-utils.js +2 -3
  101. package/dist/collection/utils/kup-column-menu/kup-column-menu.js +1 -1
  102. package/dist/collection/utils/utils.js +3 -74
  103. package/dist/esm/{cell-utils-b80ccb8c.js → cell-utils-f4bdbbc8.js} +4 -4
  104. package/dist/esm/{f-button-9e835467.js → f-button-54a49fd8.js} +2 -2
  105. package/dist/esm/{f-cell-f8bb2e04.js → f-cell-d5dac50b.js} +8 -95
  106. package/dist/esm/{f-chip-953c6915.js → f-chip-a3035b4b.js} +3 -3
  107. package/dist/esm/{f-image-78c5265e.js → f-image-d32465e3.js} +2 -2
  108. package/dist/esm/f-text-field-c25cc63f.js +92 -0
  109. package/dist/esm/f-text-field-mdc-9fbbefc3.js +2850 -0
  110. package/dist/esm/{index-78f3699d.js → index-baeab1ac.js} +6 -2
  111. package/dist/esm/ketchup.js +3 -3
  112. package/dist/esm/kup-accordion.entry.js +5 -5
  113. package/dist/esm/kup-autocomplete_27.entry.js +625 -3315
  114. package/dist/esm/kup-calendar.entry.js +8 -8
  115. package/dist/esm/kup-cell.entry.js +9 -8
  116. package/dist/esm/kup-dash-list.entry.js +5 -5
  117. package/dist/esm/kup-dash_2.entry.js +5 -5
  118. package/dist/esm/kup-drawer.entry.js +8 -5
  119. package/dist/esm/kup-echart.entry.js +210 -60
  120. package/dist/esm/kup-field.entry.js +3 -3
  121. package/dist/esm/kup-iframe.entry.js +4 -4
  122. package/dist/esm/kup-lazy.entry.js +4 -4
  123. package/dist/esm/kup-magic-box.entry.js +7 -7
  124. package/dist/esm/{kup-manager-bba62291.js → kup-manager-9316a184.js} +3062 -2642
  125. package/dist/esm/kup-nav-bar.entry.js +6 -6
  126. package/dist/esm/kup-numeric-picker.entry.js +419 -0
  127. package/dist/esm/kup-photo-frame.entry.js +175 -0
  128. package/dist/esm/kup-probe.entry.js +3 -3
  129. package/dist/esm/kup-qlik.entry.js +3 -3
  130. package/dist/esm/kup-snackbar.entry.js +6 -6
  131. package/dist/esm/loader.js +3 -3
  132. package/dist/esm/{utils-d1569956.js → utils-f24319a0.js} +5 -37
  133. package/dist/ketchup/assets/svg/instagram.svg +1 -0
  134. package/dist/ketchup/assets/svg/pinterest.svg +1 -0
  135. package/dist/ketchup/assets/svg/reddit.svg +1 -0
  136. package/dist/ketchup/ketchup.esm.js +1 -1
  137. package/dist/ketchup/p-09d708c4.entry.js +1 -0
  138. package/dist/ketchup/p-11e72a8c.entry.js +1 -0
  139. package/dist/ketchup/p-12773ca8.js +9 -0
  140. package/dist/ketchup/p-203d6295.entry.js +1 -0
  141. package/dist/ketchup/p-34748c91.js +1 -0
  142. package/dist/ketchup/p-34b74425.js +1 -0
  143. package/dist/ketchup/p-40f97429.js +1 -0
  144. package/dist/ketchup/p-4173422f.entry.js +1 -0
  145. package/dist/ketchup/p-41741c28.entry.js +1 -0
  146. package/dist/ketchup/p-44192f30.entry.js +1 -0
  147. package/dist/ketchup/{p-ebf4cf56.js → p-44f8da2a.js} +1 -1
  148. package/dist/ketchup/{p-fa540f82.js → p-4f56932b.js} +1 -1
  149. package/dist/ketchup/p-669bde31.js +1 -0
  150. package/dist/ketchup/p-67842f1e.entry.js +1 -0
  151. package/dist/ketchup/{p-f993f813.js → p-7a74ad17.js} +1 -1
  152. package/dist/ketchup/p-7ba8fa4a.entry.js +39 -0
  153. package/dist/ketchup/p-7de0d7e1.js +1 -0
  154. package/dist/ketchup/p-8418e8fa.entry.js +1 -0
  155. package/dist/ketchup/p-96bf19aa.entry.js +1 -0
  156. package/dist/ketchup/p-9a61d8dc.entry.js +1 -0
  157. package/dist/ketchup/p-b0ddcce9.entry.js +9 -0
  158. package/dist/ketchup/{p-aa27f9f7.entry.js → p-b6c21223.entry.js} +2 -2
  159. package/dist/ketchup/p-bb8844bf.entry.js +1 -0
  160. package/dist/ketchup/p-c58a2a81.entry.js +1 -0
  161. package/dist/ketchup/p-ca3d585b.entry.js +1 -0
  162. package/dist/ketchup/p-e6709c26.entry.js +1 -0
  163. package/dist/ketchup/p-e8e3c9da.entry.js +1 -0
  164. package/dist/ketchup/p-ecb7069b.js +135 -0
  165. package/dist/types/components/kup-button-list/kup-button-list-declarations.d.ts +2 -1
  166. package/dist/types/components/kup-card/built-in/kup-card-built-in.d.ts +7 -0
  167. package/dist/types/components/kup-card/built-in/kup-card-numeric.d.ts +2 -0
  168. package/dist/types/components/kup-card/kup-card-declarations.d.ts +26 -1
  169. package/dist/types/components/kup-data-table/kup-data-table-declarations.d.ts +2 -2
  170. package/dist/types/components/kup-data-table/kup-data-table-state.d.ts +1 -1
  171. package/dist/types/components/kup-data-table/kup-data-table.d.ts +7 -15
  172. package/dist/types/components/kup-dropdown-button/kup-dropdown-button.d.ts +1 -1
  173. package/dist/types/components/kup-echart/kup-echart-declarations.d.ts +3 -0
  174. package/dist/types/components/kup-echart/kup-echart.d.ts +12 -1
  175. package/dist/types/components/kup-list/kup-list-declarations.d.ts +3 -7
  176. package/dist/types/components/kup-list/kup-list-helper.d.ts +6 -6
  177. package/dist/types/components/kup-list/kup-list.d.ts +2 -2
  178. package/dist/types/components/kup-numeric-picker/kup-numeric-picker-declarations.d.ts +19 -0
  179. package/dist/types/components/kup-numeric-picker/kup-numeric-picker.d.ts +121 -0
  180. package/dist/types/components/kup-photo-frame/kup-photo-frame-declarations.d.ts +9 -0
  181. package/dist/types/components/kup-photo-frame/kup-photo-frame.d.ts +61 -0
  182. package/dist/types/components.d.ts +249 -28
  183. package/dist/types/managers/kup-data/kup-data-column-helper.d.ts +9 -1
  184. package/dist/types/managers/kup-data/kup-data-declarations.d.ts +4 -25
  185. package/dist/types/managers/kup-data/kup-data-node-helper.d.ts +1 -1
  186. package/dist/types/managers/kup-data/kup-data.d.ts +63 -27
  187. package/dist/types/managers/kup-manager/kup-manager-declarations.d.ts +21 -0
  188. package/dist/types/managers/kup-manager/kup-manager.d.ts +4 -0
  189. package/dist/types/managers/kup-math/kup-math-declarations.d.ts +27 -0
  190. package/dist/types/managers/kup-math/kup-math-helper.d.ts +17 -0
  191. package/dist/types/managers/kup-math/kup-math.d.ts +61 -0
  192. package/dist/types/managers/kup-objects/kup-objects.d.ts +22 -0
  193. package/dist/types/managers/kup-tooltip/kup-tooltip-declarations.d.ts +8 -0
  194. package/dist/types/managers/kup-tooltip/kup-tooltip.d.ts +40 -0
  195. package/dist/types/types/GenericTypes.d.ts +1 -0
  196. package/dist/types/utils/utils.d.ts +0 -18
  197. package/package.json +3 -3
  198. package/CHANGELOG.md +0 -5
  199. package/dist/collection/managers/kup-data/kup-data-dataset-helper.js +0 -262
  200. package/dist/collection/managers/kup-data/kup-data-helper.js +0 -61
  201. package/dist/collection/utils/state-utils.js +0 -9
  202. package/dist/ketchup/p-0032a782.entry.js +0 -1
  203. package/dist/ketchup/p-18c4d083.entry.js +0 -1
  204. package/dist/ketchup/p-199c972e.entry.js +0 -1
  205. package/dist/ketchup/p-29800a2e.js +0 -1
  206. package/dist/ketchup/p-34aa8d8a.entry.js +0 -1
  207. package/dist/ketchup/p-542279e9.entry.js +0 -1
  208. package/dist/ketchup/p-5b26a7a8.entry.js +0 -39
  209. package/dist/ketchup/p-5c97e7ab.js +0 -1
  210. package/dist/ketchup/p-6817ca85.entry.js +0 -1
  211. package/dist/ketchup/p-76e674ca.entry.js +0 -1
  212. package/dist/ketchup/p-78aa6f1b.js +0 -1
  213. package/dist/ketchup/p-842b66aa.entry.js +0 -1
  214. package/dist/ketchup/p-894981c0.entry.js +0 -143
  215. package/dist/ketchup/p-8ac2fa75.entry.js +0 -1
  216. package/dist/ketchup/p-907c9e11.entry.js +0 -1
  217. package/dist/ketchup/p-9ae9149b.entry.js +0 -1
  218. package/dist/ketchup/p-b0d1bdd8.js +0 -9
  219. package/dist/ketchup/p-e1e4c951.entry.js +0 -1
  220. package/dist/ketchup/p-eba369d9.entry.js +0 -1
  221. package/dist/ketchup/p-ed0b8666.js +0 -1
  222. package/dist/types/managers/kup-data/kup-data-dataset-helper.d.ts +0 -42
  223. package/dist/types/managers/kup-data/kup-data-helper.d.ts +0 -11
  224. package/dist/types/utils/state-utils.d.ts +0 -1
@@ -0,0 +1,2852 @@
1
+ 'use strict';
2
+
3
+ const tslib_es6 = require('./tslib.es6-0ee02c67.js');
4
+ const component = require('./component-d1496215.js');
5
+
6
+ /**
7
+ * @license
8
+ * Copyright 2016 Google Inc.
9
+ *
10
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ * of this software and associated documentation files (the "Software"), to deal
12
+ * in the Software without restriction, including without limitation the rights
13
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ * copies of the Software, and to permit persons to whom the Software is
15
+ * furnished to do so, subject to the following conditions:
16
+ *
17
+ * The above copyright notice and this permission notice shall be included in
18
+ * all copies or substantial portions of the Software.
19
+ *
20
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
26
+ * THE SOFTWARE.
27
+ */
28
+ var MDCFoundation = /** @class */ (function () {
29
+ function MDCFoundation(adapter) {
30
+ if (adapter === void 0) { adapter = {}; }
31
+ this.adapter = adapter;
32
+ }
33
+ Object.defineProperty(MDCFoundation, "cssClasses", {
34
+ get: function () {
35
+ // Classes extending MDCFoundation should implement this method to return an object which exports every
36
+ // CSS class the foundation class needs as a property. e.g. {ACTIVE: 'mdc-component--active'}
37
+ return {};
38
+ },
39
+ enumerable: false,
40
+ configurable: true
41
+ });
42
+ Object.defineProperty(MDCFoundation, "strings", {
43
+ get: function () {
44
+ // Classes extending MDCFoundation should implement this method to return an object which exports all
45
+ // semantic strings as constants. e.g. {ARIA_ROLE: 'tablist'}
46
+ return {};
47
+ },
48
+ enumerable: false,
49
+ configurable: true
50
+ });
51
+ Object.defineProperty(MDCFoundation, "numbers", {
52
+ get: function () {
53
+ // Classes extending MDCFoundation should implement this method to return an object which exports all
54
+ // of its semantic numbers as constants. e.g. {ANIMATION_DELAY_MS: 350}
55
+ return {};
56
+ },
57
+ enumerable: false,
58
+ configurable: true
59
+ });
60
+ Object.defineProperty(MDCFoundation, "defaultAdapter", {
61
+ get: function () {
62
+ // Classes extending MDCFoundation may choose to implement this getter in order to provide a convenient
63
+ // way of viewing the necessary methods of an adapter. In the future, this could also be used for adapter
64
+ // validation.
65
+ return {};
66
+ },
67
+ enumerable: false,
68
+ configurable: true
69
+ });
70
+ MDCFoundation.prototype.init = function () {
71
+ // Subclasses should override this method to perform initialization routines (registering events, etc.)
72
+ };
73
+ MDCFoundation.prototype.destroy = function () {
74
+ // Subclasses should override this method to perform de-initialization routines (de-registering events, etc.)
75
+ };
76
+ return MDCFoundation;
77
+ }());
78
+
79
+ /**
80
+ * @license
81
+ * Copyright 2016 Google Inc.
82
+ *
83
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
84
+ * of this software and associated documentation files (the "Software"), to deal
85
+ * in the Software without restriction, including without limitation the rights
86
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
87
+ * copies of the Software, and to permit persons to whom the Software is
88
+ * furnished to do so, subject to the following conditions:
89
+ *
90
+ * The above copyright notice and this permission notice shall be included in
91
+ * all copies or substantial portions of the Software.
92
+ *
93
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
94
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
95
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
96
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
97
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
98
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
99
+ * THE SOFTWARE.
100
+ */
101
+ var MDCComponent = /** @class */ (function () {
102
+ function MDCComponent(root, foundation) {
103
+ var args = [];
104
+ for (var _i = 2; _i < arguments.length; _i++) {
105
+ args[_i - 2] = arguments[_i];
106
+ }
107
+ this.root = root;
108
+ this.initialize.apply(this, tslib_es6.__spreadArray([], tslib_es6.__read(args)));
109
+ // Note that we initialize foundation here and not within the constructor's
110
+ // default param so that this.root is defined and can be used within the
111
+ // foundation class.
112
+ this.foundation =
113
+ foundation === undefined ? this.getDefaultFoundation() : foundation;
114
+ this.foundation.init();
115
+ this.initialSyncWithDOM();
116
+ }
117
+ MDCComponent.attachTo = function (root) {
118
+ // Subclasses which extend MDCBase should provide an attachTo() method that takes a root element and
119
+ // returns an instantiated component with its root set to that element. Also note that in the cases of
120
+ // subclasses, an explicit foundation class will not have to be passed in; it will simply be initialized
121
+ // from getDefaultFoundation().
122
+ return new MDCComponent(root, new MDCFoundation({}));
123
+ };
124
+ /* istanbul ignore next: method param only exists for typing purposes; it does not need to be unit tested */
125
+ MDCComponent.prototype.initialize = function () {
126
+ var _args = [];
127
+ for (var _i = 0; _i < arguments.length; _i++) {
128
+ _args[_i] = arguments[_i];
129
+ }
130
+ // Subclasses can override this to do any additional setup work that would be considered part of a
131
+ // "constructor". Essentially, it is a hook into the parent constructor before the foundation is
132
+ // initialized. Any additional arguments besides root and foundation will be passed in here.
133
+ };
134
+ MDCComponent.prototype.getDefaultFoundation = function () {
135
+ // Subclasses must override this method to return a properly configured foundation class for the
136
+ // component.
137
+ throw new Error('Subclasses must override getDefaultFoundation to return a properly configured ' +
138
+ 'foundation class');
139
+ };
140
+ MDCComponent.prototype.initialSyncWithDOM = function () {
141
+ // Subclasses should override this method if they need to perform work to synchronize with a host DOM
142
+ // object. An example of this would be a form control wrapper that needs to synchronize its internal state
143
+ // to some property or attribute of the host DOM. Please note: this is *not* the place to perform DOM
144
+ // reads/writes that would cause layout / paint, as this is called synchronously from within the constructor.
145
+ };
146
+ MDCComponent.prototype.destroy = function () {
147
+ // Subclasses may implement this method to release any resources / deregister any listeners they have
148
+ // attached. An example of this might be deregistering a resize event from the window object.
149
+ this.foundation.destroy();
150
+ };
151
+ MDCComponent.prototype.listen = function (evtType, handler, options) {
152
+ this.root.addEventListener(evtType, handler, options);
153
+ };
154
+ MDCComponent.prototype.unlisten = function (evtType, handler, options) {
155
+ this.root.removeEventListener(evtType, handler, options);
156
+ };
157
+ /**
158
+ * Fires a cross-browser-compatible custom event from the component root of the given type, with the given data.
159
+ */
160
+ MDCComponent.prototype.emit = function (evtType, evtData, shouldBubble) {
161
+ if (shouldBubble === void 0) { shouldBubble = false; }
162
+ var evt;
163
+ if (typeof CustomEvent === 'function') {
164
+ evt = new CustomEvent(evtType, {
165
+ bubbles: shouldBubble,
166
+ detail: evtData,
167
+ });
168
+ }
169
+ else {
170
+ evt = document.createEvent('CustomEvent');
171
+ evt.initCustomEvent(evtType, shouldBubble, false, evtData);
172
+ }
173
+ this.root.dispatchEvent(evt);
174
+ };
175
+ return MDCComponent;
176
+ }());
177
+
178
+ /**
179
+ * @license
180
+ * Copyright 2019 Google Inc.
181
+ *
182
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
183
+ * of this software and associated documentation files (the "Software"), to deal
184
+ * in the Software without restriction, including without limitation the rights
185
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
186
+ * copies of the Software, and to permit persons to whom the Software is
187
+ * furnished to do so, subject to the following conditions:
188
+ *
189
+ * The above copyright notice and this permission notice shall be included in
190
+ * all copies or substantial portions of the Software.
191
+ *
192
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
193
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
194
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
195
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
196
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
197
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
198
+ * THE SOFTWARE.
199
+ */
200
+ /**
201
+ * Determine whether the current browser supports passive event listeners, and
202
+ * if so, use them.
203
+ */
204
+ function applyPassive(globalObj) {
205
+ if (globalObj === void 0) { globalObj = window; }
206
+ return supportsPassiveOption(globalObj) ?
207
+ { passive: true } :
208
+ false;
209
+ }
210
+ function supportsPassiveOption(globalObj) {
211
+ if (globalObj === void 0) { globalObj = window; }
212
+ // See
213
+ // https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener
214
+ var passiveSupported = false;
215
+ try {
216
+ var options = {
217
+ // This function will be called when the browser
218
+ // attempts to access the passive property.
219
+ get passive() {
220
+ passiveSupported = true;
221
+ return false;
222
+ }
223
+ };
224
+ var handler = function () { };
225
+ globalObj.document.addEventListener('test', handler, options);
226
+ globalObj.document.removeEventListener('test', handler, options);
227
+ }
228
+ catch (err) {
229
+ passiveSupported = false;
230
+ }
231
+ return passiveSupported;
232
+ }
233
+
234
+ /**
235
+ * @license
236
+ * Copyright 2018 Google Inc.
237
+ *
238
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
239
+ * of this software and associated documentation files (the "Software"), to deal
240
+ * in the Software without restriction, including without limitation the rights
241
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
242
+ * copies of the Software, and to permit persons to whom the Software is
243
+ * furnished to do so, subject to the following conditions:
244
+ *
245
+ * The above copyright notice and this permission notice shall be included in
246
+ * all copies or substantial portions of the Software.
247
+ *
248
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
249
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
250
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
251
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
252
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
253
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
254
+ * THE SOFTWARE.
255
+ */
256
+ function matches(element, selector) {
257
+ var nativeMatches = element.matches
258
+ || element.webkitMatchesSelector
259
+ || element.msMatchesSelector;
260
+ return nativeMatches.call(element, selector);
261
+ }
262
+ /**
263
+ * Used to compute the estimated scroll width of elements. When an element is
264
+ * hidden due to display: none; being applied to a parent element, the width is
265
+ * returned as 0. However, the element will have a true width once no longer
266
+ * inside a display: none context. This method computes an estimated width when
267
+ * the element is hidden or returns the true width when the element is visble.
268
+ * @param {Element} element the element whose width to estimate
269
+ */
270
+ function estimateScrollWidth(element) {
271
+ // Check the offsetParent. If the element inherits display: none from any
272
+ // parent, the offsetParent property will be null (see
273
+ // https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/offsetParent).
274
+ // This check ensures we only clone the node when necessary.
275
+ var htmlEl = element;
276
+ if (htmlEl.offsetParent !== null) {
277
+ return htmlEl.scrollWidth;
278
+ }
279
+ var clone = htmlEl.cloneNode(true);
280
+ clone.style.setProperty('position', 'absolute');
281
+ clone.style.setProperty('transform', 'translate(-9999px, -9999px)');
282
+ document.documentElement.appendChild(clone);
283
+ var scrollWidth = clone.scrollWidth;
284
+ document.documentElement.removeChild(clone);
285
+ return scrollWidth;
286
+ }
287
+
288
+ /**
289
+ * @license
290
+ * Copyright 2016 Google Inc.
291
+ *
292
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
293
+ * of this software and associated documentation files (the "Software"), to deal
294
+ * in the Software without restriction, including without limitation the rights
295
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
296
+ * copies of the Software, and to permit persons to whom the Software is
297
+ * furnished to do so, subject to the following conditions:
298
+ *
299
+ * The above copyright notice and this permission notice shall be included in
300
+ * all copies or substantial portions of the Software.
301
+ *
302
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
303
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
304
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
305
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
306
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
307
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
308
+ * THE SOFTWARE.
309
+ */
310
+ var cssClasses$7 = {
311
+ LABEL_FLOAT_ABOVE: 'mdc-floating-label--float-above',
312
+ LABEL_REQUIRED: 'mdc-floating-label--required',
313
+ LABEL_SHAKE: 'mdc-floating-label--shake',
314
+ ROOT: 'mdc-floating-label',
315
+ };
316
+
317
+ /**
318
+ * @license
319
+ * Copyright 2016 Google Inc.
320
+ *
321
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
322
+ * of this software and associated documentation files (the "Software"), to deal
323
+ * in the Software without restriction, including without limitation the rights
324
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
325
+ * copies of the Software, and to permit persons to whom the Software is
326
+ * furnished to do so, subject to the following conditions:
327
+ *
328
+ * The above copyright notice and this permission notice shall be included in
329
+ * all copies or substantial portions of the Software.
330
+ *
331
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
332
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
333
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
334
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
335
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
336
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
337
+ * THE SOFTWARE.
338
+ */
339
+ var MDCFloatingLabelFoundation = /** @class */ (function (_super) {
340
+ tslib_es6.__extends(MDCFloatingLabelFoundation, _super);
341
+ function MDCFloatingLabelFoundation(adapter) {
342
+ var _this = _super.call(this, tslib_es6.__assign(tslib_es6.__assign({}, MDCFloatingLabelFoundation.defaultAdapter), adapter)) || this;
343
+ _this.shakeAnimationEndHandler = function () {
344
+ _this.handleShakeAnimationEnd();
345
+ };
346
+ return _this;
347
+ }
348
+ Object.defineProperty(MDCFloatingLabelFoundation, "cssClasses", {
349
+ get: function () {
350
+ return cssClasses$7;
351
+ },
352
+ enumerable: false,
353
+ configurable: true
354
+ });
355
+ Object.defineProperty(MDCFloatingLabelFoundation, "defaultAdapter", {
356
+ /**
357
+ * See {@link MDCFloatingLabelAdapter} for typing information on parameters and return types.
358
+ */
359
+ get: function () {
360
+ // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
361
+ return {
362
+ addClass: function () { return undefined; },
363
+ removeClass: function () { return undefined; },
364
+ getWidth: function () { return 0; },
365
+ registerInteractionHandler: function () { return undefined; },
366
+ deregisterInteractionHandler: function () { return undefined; },
367
+ };
368
+ // tslint:enable:object-literal-sort-keys
369
+ },
370
+ enumerable: false,
371
+ configurable: true
372
+ });
373
+ MDCFloatingLabelFoundation.prototype.init = function () {
374
+ this.adapter.registerInteractionHandler('animationend', this.shakeAnimationEndHandler);
375
+ };
376
+ MDCFloatingLabelFoundation.prototype.destroy = function () {
377
+ this.adapter.deregisterInteractionHandler('animationend', this.shakeAnimationEndHandler);
378
+ };
379
+ /**
380
+ * Returns the width of the label element.
381
+ */
382
+ MDCFloatingLabelFoundation.prototype.getWidth = function () {
383
+ return this.adapter.getWidth();
384
+ };
385
+ /**
386
+ * Styles the label to produce a shake animation to indicate an error.
387
+ * @param shouldShake If true, adds the shake CSS class; otherwise, removes shake class.
388
+ */
389
+ MDCFloatingLabelFoundation.prototype.shake = function (shouldShake) {
390
+ var LABEL_SHAKE = MDCFloatingLabelFoundation.cssClasses.LABEL_SHAKE;
391
+ if (shouldShake) {
392
+ this.adapter.addClass(LABEL_SHAKE);
393
+ }
394
+ else {
395
+ this.adapter.removeClass(LABEL_SHAKE);
396
+ }
397
+ };
398
+ /**
399
+ * Styles the label to float or dock.
400
+ * @param shouldFloat If true, adds the float CSS class; otherwise, removes float and shake classes to dock the label.
401
+ */
402
+ MDCFloatingLabelFoundation.prototype.float = function (shouldFloat) {
403
+ var _a = MDCFloatingLabelFoundation.cssClasses, LABEL_FLOAT_ABOVE = _a.LABEL_FLOAT_ABOVE, LABEL_SHAKE = _a.LABEL_SHAKE;
404
+ if (shouldFloat) {
405
+ this.adapter.addClass(LABEL_FLOAT_ABOVE);
406
+ }
407
+ else {
408
+ this.adapter.removeClass(LABEL_FLOAT_ABOVE);
409
+ this.adapter.removeClass(LABEL_SHAKE);
410
+ }
411
+ };
412
+ /**
413
+ * Styles the label as required.
414
+ * @param isRequired If true, adds an asterisk to the label, indicating that it is required.
415
+ */
416
+ MDCFloatingLabelFoundation.prototype.setRequired = function (isRequired) {
417
+ var LABEL_REQUIRED = MDCFloatingLabelFoundation.cssClasses.LABEL_REQUIRED;
418
+ if (isRequired) {
419
+ this.adapter.addClass(LABEL_REQUIRED);
420
+ }
421
+ else {
422
+ this.adapter.removeClass(LABEL_REQUIRED);
423
+ }
424
+ };
425
+ MDCFloatingLabelFoundation.prototype.handleShakeAnimationEnd = function () {
426
+ var LABEL_SHAKE = MDCFloatingLabelFoundation.cssClasses.LABEL_SHAKE;
427
+ this.adapter.removeClass(LABEL_SHAKE);
428
+ };
429
+ return MDCFloatingLabelFoundation;
430
+ }(MDCFoundation));
431
+
432
+ /**
433
+ * @license
434
+ * Copyright 2016 Google Inc.
435
+ *
436
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
437
+ * of this software and associated documentation files (the "Software"), to deal
438
+ * in the Software without restriction, including without limitation the rights
439
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
440
+ * copies of the Software, and to permit persons to whom the Software is
441
+ * furnished to do so, subject to the following conditions:
442
+ *
443
+ * The above copyright notice and this permission notice shall be included in
444
+ * all copies or substantial portions of the Software.
445
+ *
446
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
447
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
448
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
449
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
450
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
451
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
452
+ * THE SOFTWARE.
453
+ */
454
+ var MDCFloatingLabel = /** @class */ (function (_super) {
455
+ tslib_es6.__extends(MDCFloatingLabel, _super);
456
+ function MDCFloatingLabel() {
457
+ return _super !== null && _super.apply(this, arguments) || this;
458
+ }
459
+ MDCFloatingLabel.attachTo = function (root) {
460
+ return new MDCFloatingLabel(root);
461
+ };
462
+ /**
463
+ * Styles the label to produce the label shake for errors.
464
+ * @param shouldShake If true, shakes the label by adding a CSS class; otherwise, stops shaking by removing the class.
465
+ */
466
+ MDCFloatingLabel.prototype.shake = function (shouldShake) {
467
+ this.foundation.shake(shouldShake);
468
+ };
469
+ /**
470
+ * Styles the label to float/dock.
471
+ * @param shouldFloat If true, floats the label by adding a CSS class; otherwise, docks it by removing the class.
472
+ */
473
+ MDCFloatingLabel.prototype.float = function (shouldFloat) {
474
+ this.foundation.float(shouldFloat);
475
+ };
476
+ /**
477
+ * Styles the label as required.
478
+ * @param isRequired If true, adds an asterisk to the label, indicating that it is required.
479
+ */
480
+ MDCFloatingLabel.prototype.setRequired = function (isRequired) {
481
+ this.foundation.setRequired(isRequired);
482
+ };
483
+ MDCFloatingLabel.prototype.getWidth = function () {
484
+ return this.foundation.getWidth();
485
+ };
486
+ MDCFloatingLabel.prototype.getDefaultFoundation = function () {
487
+ var _this = this;
488
+ // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
489
+ // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
490
+ // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
491
+ var adapter = {
492
+ addClass: function (className) { return _this.root.classList.add(className); },
493
+ removeClass: function (className) { return _this.root.classList.remove(className); },
494
+ getWidth: function () { return estimateScrollWidth(_this.root); },
495
+ registerInteractionHandler: function (evtType, handler) {
496
+ return _this.listen(evtType, handler);
497
+ },
498
+ deregisterInteractionHandler: function (evtType, handler) {
499
+ return _this.unlisten(evtType, handler);
500
+ },
501
+ };
502
+ // tslint:enable:object-literal-sort-keys
503
+ return new MDCFloatingLabelFoundation(adapter);
504
+ };
505
+ return MDCFloatingLabel;
506
+ }(MDCComponent));
507
+
508
+ /**
509
+ * @license
510
+ * Copyright 2018 Google Inc.
511
+ *
512
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
513
+ * of this software and associated documentation files (the "Software"), to deal
514
+ * in the Software without restriction, including without limitation the rights
515
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
516
+ * copies of the Software, and to permit persons to whom the Software is
517
+ * furnished to do so, subject to the following conditions:
518
+ *
519
+ * The above copyright notice and this permission notice shall be included in
520
+ * all copies or substantial portions of the Software.
521
+ *
522
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
523
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
524
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
525
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
526
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
527
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
528
+ * THE SOFTWARE.
529
+ */
530
+ var cssClasses$6 = {
531
+ LINE_RIPPLE_ACTIVE: 'mdc-line-ripple--active',
532
+ LINE_RIPPLE_DEACTIVATING: 'mdc-line-ripple--deactivating',
533
+ };
534
+
535
+ /**
536
+ * @license
537
+ * Copyright 2018 Google Inc.
538
+ *
539
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
540
+ * of this software and associated documentation files (the "Software"), to deal
541
+ * in the Software without restriction, including without limitation the rights
542
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
543
+ * copies of the Software, and to permit persons to whom the Software is
544
+ * furnished to do so, subject to the following conditions:
545
+ *
546
+ * The above copyright notice and this permission notice shall be included in
547
+ * all copies or substantial portions of the Software.
548
+ *
549
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
550
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
551
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
552
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
553
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
554
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
555
+ * THE SOFTWARE.
556
+ */
557
+ var MDCLineRippleFoundation = /** @class */ (function (_super) {
558
+ tslib_es6.__extends(MDCLineRippleFoundation, _super);
559
+ function MDCLineRippleFoundation(adapter) {
560
+ var _this = _super.call(this, tslib_es6.__assign(tslib_es6.__assign({}, MDCLineRippleFoundation.defaultAdapter), adapter)) || this;
561
+ _this.transitionEndHandler = function (evt) {
562
+ _this.handleTransitionEnd(evt);
563
+ };
564
+ return _this;
565
+ }
566
+ Object.defineProperty(MDCLineRippleFoundation, "cssClasses", {
567
+ get: function () {
568
+ return cssClasses$6;
569
+ },
570
+ enumerable: false,
571
+ configurable: true
572
+ });
573
+ Object.defineProperty(MDCLineRippleFoundation, "defaultAdapter", {
574
+ /**
575
+ * See {@link MDCLineRippleAdapter} for typing information on parameters and return types.
576
+ */
577
+ get: function () {
578
+ // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
579
+ return {
580
+ addClass: function () { return undefined; },
581
+ removeClass: function () { return undefined; },
582
+ hasClass: function () { return false; },
583
+ setStyle: function () { return undefined; },
584
+ registerEventHandler: function () { return undefined; },
585
+ deregisterEventHandler: function () { return undefined; },
586
+ };
587
+ // tslint:enable:object-literal-sort-keys
588
+ },
589
+ enumerable: false,
590
+ configurable: true
591
+ });
592
+ MDCLineRippleFoundation.prototype.init = function () {
593
+ this.adapter.registerEventHandler('transitionend', this.transitionEndHandler);
594
+ };
595
+ MDCLineRippleFoundation.prototype.destroy = function () {
596
+ this.adapter.deregisterEventHandler('transitionend', this.transitionEndHandler);
597
+ };
598
+ MDCLineRippleFoundation.prototype.activate = function () {
599
+ this.adapter.removeClass(cssClasses$6.LINE_RIPPLE_DEACTIVATING);
600
+ this.adapter.addClass(cssClasses$6.LINE_RIPPLE_ACTIVE);
601
+ };
602
+ MDCLineRippleFoundation.prototype.setRippleCenter = function (xCoordinate) {
603
+ this.adapter.setStyle('transform-origin', xCoordinate + "px center");
604
+ };
605
+ MDCLineRippleFoundation.prototype.deactivate = function () {
606
+ this.adapter.addClass(cssClasses$6.LINE_RIPPLE_DEACTIVATING);
607
+ };
608
+ MDCLineRippleFoundation.prototype.handleTransitionEnd = function (evt) {
609
+ // Wait for the line ripple to be either transparent or opaque
610
+ // before emitting the animation end event
611
+ var isDeactivating = this.adapter.hasClass(cssClasses$6.LINE_RIPPLE_DEACTIVATING);
612
+ if (evt.propertyName === 'opacity') {
613
+ if (isDeactivating) {
614
+ this.adapter.removeClass(cssClasses$6.LINE_RIPPLE_ACTIVE);
615
+ this.adapter.removeClass(cssClasses$6.LINE_RIPPLE_DEACTIVATING);
616
+ }
617
+ }
618
+ };
619
+ return MDCLineRippleFoundation;
620
+ }(MDCFoundation));
621
+
622
+ /**
623
+ * @license
624
+ * Copyright 2018 Google Inc.
625
+ *
626
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
627
+ * of this software and associated documentation files (the "Software"), to deal
628
+ * in the Software without restriction, including without limitation the rights
629
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
630
+ * copies of the Software, and to permit persons to whom the Software is
631
+ * furnished to do so, subject to the following conditions:
632
+ *
633
+ * The above copyright notice and this permission notice shall be included in
634
+ * all copies or substantial portions of the Software.
635
+ *
636
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
637
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
638
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
639
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
640
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
641
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
642
+ * THE SOFTWARE.
643
+ */
644
+ var MDCLineRipple = /** @class */ (function (_super) {
645
+ tslib_es6.__extends(MDCLineRipple, _super);
646
+ function MDCLineRipple() {
647
+ return _super !== null && _super.apply(this, arguments) || this;
648
+ }
649
+ MDCLineRipple.attachTo = function (root) {
650
+ return new MDCLineRipple(root);
651
+ };
652
+ /**
653
+ * Activates the line ripple
654
+ */
655
+ MDCLineRipple.prototype.activate = function () {
656
+ this.foundation.activate();
657
+ };
658
+ /**
659
+ * Deactivates the line ripple
660
+ */
661
+ MDCLineRipple.prototype.deactivate = function () {
662
+ this.foundation.deactivate();
663
+ };
664
+ /**
665
+ * Sets the transform origin given a user's click location.
666
+ * The `rippleCenter` is the x-coordinate of the middle of the ripple.
667
+ */
668
+ MDCLineRipple.prototype.setRippleCenter = function (xCoordinate) {
669
+ this.foundation.setRippleCenter(xCoordinate);
670
+ };
671
+ MDCLineRipple.prototype.getDefaultFoundation = function () {
672
+ var _this = this;
673
+ // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
674
+ // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
675
+ // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
676
+ var adapter = {
677
+ addClass: function (className) { return _this.root.classList.add(className); },
678
+ removeClass: function (className) { return _this.root.classList.remove(className); },
679
+ hasClass: function (className) { return _this.root.classList.contains(className); },
680
+ setStyle: function (propertyName, value) { return _this.root.style.setProperty(propertyName, value); },
681
+ registerEventHandler: function (evtType, handler) { return _this.listen(evtType, handler); },
682
+ deregisterEventHandler: function (evtType, handler) { return _this.unlisten(evtType, handler); },
683
+ };
684
+ // tslint:enable:object-literal-sort-keys
685
+ return new MDCLineRippleFoundation(adapter);
686
+ };
687
+ return MDCLineRipple;
688
+ }(MDCComponent));
689
+
690
+ /**
691
+ * @license
692
+ * Copyright 2018 Google Inc.
693
+ *
694
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
695
+ * of this software and associated documentation files (the "Software"), to deal
696
+ * in the Software without restriction, including without limitation the rights
697
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
698
+ * copies of the Software, and to permit persons to whom the Software is
699
+ * furnished to do so, subject to the following conditions:
700
+ *
701
+ * The above copyright notice and this permission notice shall be included in
702
+ * all copies or substantial portions of the Software.
703
+ *
704
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
705
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
706
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
707
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
708
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
709
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
710
+ * THE SOFTWARE.
711
+ */
712
+ var strings$5 = {
713
+ NOTCH_ELEMENT_SELECTOR: '.mdc-notched-outline__notch',
714
+ };
715
+ var numbers$1 = {
716
+ // This should stay in sync with $mdc-notched-outline-padding * 2.
717
+ NOTCH_ELEMENT_PADDING: 8,
718
+ };
719
+ var cssClasses$5 = {
720
+ NO_LABEL: 'mdc-notched-outline--no-label',
721
+ OUTLINE_NOTCHED: 'mdc-notched-outline--notched',
722
+ OUTLINE_UPGRADED: 'mdc-notched-outline--upgraded',
723
+ };
724
+
725
+ /**
726
+ * @license
727
+ * Copyright 2017 Google Inc.
728
+ *
729
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
730
+ * of this software and associated documentation files (the "Software"), to deal
731
+ * in the Software without restriction, including without limitation the rights
732
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
733
+ * copies of the Software, and to permit persons to whom the Software is
734
+ * furnished to do so, subject to the following conditions:
735
+ *
736
+ * The above copyright notice and this permission notice shall be included in
737
+ * all copies or substantial portions of the Software.
738
+ *
739
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
740
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
741
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
742
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
743
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
744
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
745
+ * THE SOFTWARE.
746
+ */
747
+ var MDCNotchedOutlineFoundation = /** @class */ (function (_super) {
748
+ tslib_es6.__extends(MDCNotchedOutlineFoundation, _super);
749
+ function MDCNotchedOutlineFoundation(adapter) {
750
+ return _super.call(this, tslib_es6.__assign(tslib_es6.__assign({}, MDCNotchedOutlineFoundation.defaultAdapter), adapter)) || this;
751
+ }
752
+ Object.defineProperty(MDCNotchedOutlineFoundation, "strings", {
753
+ get: function () {
754
+ return strings$5;
755
+ },
756
+ enumerable: false,
757
+ configurable: true
758
+ });
759
+ Object.defineProperty(MDCNotchedOutlineFoundation, "cssClasses", {
760
+ get: function () {
761
+ return cssClasses$5;
762
+ },
763
+ enumerable: false,
764
+ configurable: true
765
+ });
766
+ Object.defineProperty(MDCNotchedOutlineFoundation, "numbers", {
767
+ get: function () {
768
+ return numbers$1;
769
+ },
770
+ enumerable: false,
771
+ configurable: true
772
+ });
773
+ Object.defineProperty(MDCNotchedOutlineFoundation, "defaultAdapter", {
774
+ /**
775
+ * See {@link MDCNotchedOutlineAdapter} for typing information on parameters and return types.
776
+ */
777
+ get: function () {
778
+ // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
779
+ return {
780
+ addClass: function () { return undefined; },
781
+ removeClass: function () { return undefined; },
782
+ setNotchWidthProperty: function () { return undefined; },
783
+ removeNotchWidthProperty: function () { return undefined; },
784
+ };
785
+ // tslint:enable:object-literal-sort-keys
786
+ },
787
+ enumerable: false,
788
+ configurable: true
789
+ });
790
+ /**
791
+ * Adds the outline notched selector and updates the notch width calculated based off of notchWidth.
792
+ */
793
+ MDCNotchedOutlineFoundation.prototype.notch = function (notchWidth) {
794
+ var OUTLINE_NOTCHED = MDCNotchedOutlineFoundation.cssClasses.OUTLINE_NOTCHED;
795
+ if (notchWidth > 0) {
796
+ notchWidth += numbers$1.NOTCH_ELEMENT_PADDING; // Add padding from left/right.
797
+ }
798
+ this.adapter.setNotchWidthProperty(notchWidth);
799
+ this.adapter.addClass(OUTLINE_NOTCHED);
800
+ };
801
+ /**
802
+ * Removes notched outline selector to close the notch in the outline.
803
+ */
804
+ MDCNotchedOutlineFoundation.prototype.closeNotch = function () {
805
+ var OUTLINE_NOTCHED = MDCNotchedOutlineFoundation.cssClasses.OUTLINE_NOTCHED;
806
+ this.adapter.removeClass(OUTLINE_NOTCHED);
807
+ this.adapter.removeNotchWidthProperty();
808
+ };
809
+ return MDCNotchedOutlineFoundation;
810
+ }(MDCFoundation));
811
+
812
+ /**
813
+ * @license
814
+ * Copyright 2017 Google Inc.
815
+ *
816
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
817
+ * of this software and associated documentation files (the "Software"), to deal
818
+ * in the Software without restriction, including without limitation the rights
819
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
820
+ * copies of the Software, and to permit persons to whom the Software is
821
+ * furnished to do so, subject to the following conditions:
822
+ *
823
+ * The above copyright notice and this permission notice shall be included in
824
+ * all copies or substantial portions of the Software.
825
+ *
826
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
827
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
828
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
829
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
830
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
831
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
832
+ * THE SOFTWARE.
833
+ */
834
+ var MDCNotchedOutline = /** @class */ (function (_super) {
835
+ tslib_es6.__extends(MDCNotchedOutline, _super);
836
+ function MDCNotchedOutline() {
837
+ return _super !== null && _super.apply(this, arguments) || this;
838
+ }
839
+ MDCNotchedOutline.attachTo = function (root) {
840
+ return new MDCNotchedOutline(root);
841
+ };
842
+ MDCNotchedOutline.prototype.initialSyncWithDOM = function () {
843
+ this.notchElement =
844
+ this.root.querySelector(strings$5.NOTCH_ELEMENT_SELECTOR);
845
+ var label = this.root.querySelector('.' + MDCFloatingLabelFoundation.cssClasses.ROOT);
846
+ if (label) {
847
+ label.style.transitionDuration = '0s';
848
+ this.root.classList.add(cssClasses$5.OUTLINE_UPGRADED);
849
+ requestAnimationFrame(function () {
850
+ label.style.transitionDuration = '';
851
+ });
852
+ }
853
+ else {
854
+ this.root.classList.add(cssClasses$5.NO_LABEL);
855
+ }
856
+ };
857
+ /**
858
+ * Updates classes and styles to open the notch to the specified width.
859
+ * @param notchWidth The notch width in the outline.
860
+ */
861
+ MDCNotchedOutline.prototype.notch = function (notchWidth) {
862
+ this.foundation.notch(notchWidth);
863
+ };
864
+ /**
865
+ * Updates classes and styles to close the notch.
866
+ */
867
+ MDCNotchedOutline.prototype.closeNotch = function () {
868
+ this.foundation.closeNotch();
869
+ };
870
+ MDCNotchedOutline.prototype.getDefaultFoundation = function () {
871
+ var _this = this;
872
+ // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
873
+ // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
874
+ // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
875
+ var adapter = {
876
+ addClass: function (className) { return _this.root.classList.add(className); },
877
+ removeClass: function (className) { return _this.root.classList.remove(className); },
878
+ setNotchWidthProperty: function (width) {
879
+ _this.notchElement.style.setProperty('width', width + 'px');
880
+ },
881
+ removeNotchWidthProperty: function () {
882
+ _this.notchElement.style.removeProperty('width');
883
+ },
884
+ };
885
+ // tslint:enable:object-literal-sort-keys
886
+ return new MDCNotchedOutlineFoundation(adapter);
887
+ };
888
+ return MDCNotchedOutline;
889
+ }(MDCComponent));
890
+
891
+ /**
892
+ * @license
893
+ * Copyright 2019 Google Inc.
894
+ *
895
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
896
+ * of this software and associated documentation files (the "Software"), to deal
897
+ * in the Software without restriction, including without limitation the rights
898
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
899
+ * copies of the Software, and to permit persons to whom the Software is
900
+ * furnished to do so, subject to the following conditions:
901
+ *
902
+ * The above copyright notice and this permission notice shall be included in
903
+ * all copies or substantial portions of the Software.
904
+ *
905
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
906
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
907
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
908
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
909
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
910
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
911
+ * THE SOFTWARE.
912
+ */
913
+ var cssClasses$4 = {
914
+ ROOT: 'mdc-text-field-character-counter',
915
+ };
916
+ var strings$4 = {
917
+ ROOT_SELECTOR: "." + cssClasses$4.ROOT,
918
+ };
919
+
920
+ /**
921
+ * @license
922
+ * Copyright 2019 Google Inc.
923
+ *
924
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
925
+ * of this software and associated documentation files (the "Software"), to deal
926
+ * in the Software without restriction, including without limitation the rights
927
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
928
+ * copies of the Software, and to permit persons to whom the Software is
929
+ * furnished to do so, subject to the following conditions:
930
+ *
931
+ * The above copyright notice and this permission notice shall be included in
932
+ * all copies or substantial portions of the Software.
933
+ *
934
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
935
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
936
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
937
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
938
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
939
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
940
+ * THE SOFTWARE.
941
+ */
942
+ var MDCTextFieldCharacterCounterFoundation = /** @class */ (function (_super) {
943
+ tslib_es6.__extends(MDCTextFieldCharacterCounterFoundation, _super);
944
+ function MDCTextFieldCharacterCounterFoundation(adapter) {
945
+ return _super.call(this, tslib_es6.__assign(tslib_es6.__assign({}, MDCTextFieldCharacterCounterFoundation.defaultAdapter), adapter)) || this;
946
+ }
947
+ Object.defineProperty(MDCTextFieldCharacterCounterFoundation, "cssClasses", {
948
+ get: function () {
949
+ return cssClasses$4;
950
+ },
951
+ enumerable: false,
952
+ configurable: true
953
+ });
954
+ Object.defineProperty(MDCTextFieldCharacterCounterFoundation, "strings", {
955
+ get: function () {
956
+ return strings$4;
957
+ },
958
+ enumerable: false,
959
+ configurable: true
960
+ });
961
+ Object.defineProperty(MDCTextFieldCharacterCounterFoundation, "defaultAdapter", {
962
+ /**
963
+ * See {@link MDCTextFieldCharacterCounterAdapter} for typing information on parameters and return types.
964
+ */
965
+ get: function () {
966
+ return {
967
+ setContent: function () { return undefined; },
968
+ };
969
+ },
970
+ enumerable: false,
971
+ configurable: true
972
+ });
973
+ MDCTextFieldCharacterCounterFoundation.prototype.setCounterValue = function (currentLength, maxLength) {
974
+ currentLength = Math.min(currentLength, maxLength);
975
+ this.adapter.setContent(currentLength + " / " + maxLength);
976
+ };
977
+ return MDCTextFieldCharacterCounterFoundation;
978
+ }(MDCFoundation));
979
+
980
+ /**
981
+ * @license
982
+ * Copyright 2019 Google Inc.
983
+ *
984
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
985
+ * of this software and associated documentation files (the "Software"), to deal
986
+ * in the Software without restriction, including without limitation the rights
987
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
988
+ * copies of the Software, and to permit persons to whom the Software is
989
+ * furnished to do so, subject to the following conditions:
990
+ *
991
+ * The above copyright notice and this permission notice shall be included in
992
+ * all copies or substantial portions of the Software.
993
+ *
994
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
995
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
996
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
997
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
998
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
999
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
1000
+ * THE SOFTWARE.
1001
+ */
1002
+ var MDCTextFieldCharacterCounter = /** @class */ (function (_super) {
1003
+ tslib_es6.__extends(MDCTextFieldCharacterCounter, _super);
1004
+ function MDCTextFieldCharacterCounter() {
1005
+ return _super !== null && _super.apply(this, arguments) || this;
1006
+ }
1007
+ MDCTextFieldCharacterCounter.attachTo = function (root) {
1008
+ return new MDCTextFieldCharacterCounter(root);
1009
+ };
1010
+ Object.defineProperty(MDCTextFieldCharacterCounter.prototype, "foundationForTextField", {
1011
+ // Provided for access by MDCTextField component
1012
+ get: function () {
1013
+ return this.foundation;
1014
+ },
1015
+ enumerable: false,
1016
+ configurable: true
1017
+ });
1018
+ MDCTextFieldCharacterCounter.prototype.getDefaultFoundation = function () {
1019
+ var _this = this;
1020
+ // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
1021
+ // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
1022
+ var adapter = {
1023
+ setContent: function (content) {
1024
+ _this.root.textContent = content;
1025
+ },
1026
+ };
1027
+ return new MDCTextFieldCharacterCounterFoundation(adapter);
1028
+ };
1029
+ return MDCTextFieldCharacterCounter;
1030
+ }(MDCComponent));
1031
+
1032
+ /**
1033
+ * @license
1034
+ * Copyright 2016 Google Inc.
1035
+ *
1036
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
1037
+ * of this software and associated documentation files (the "Software"), to deal
1038
+ * in the Software without restriction, including without limitation the rights
1039
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1040
+ * copies of the Software, and to permit persons to whom the Software is
1041
+ * furnished to do so, subject to the following conditions:
1042
+ *
1043
+ * The above copyright notice and this permission notice shall be included in
1044
+ * all copies or substantial portions of the Software.
1045
+ *
1046
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1047
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1048
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1049
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1050
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1051
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
1052
+ * THE SOFTWARE.
1053
+ */
1054
+ var strings$3 = {
1055
+ ARIA_CONTROLS: 'aria-controls',
1056
+ ARIA_DESCRIBEDBY: 'aria-describedby',
1057
+ INPUT_SELECTOR: '.mdc-text-field__input',
1058
+ LABEL_SELECTOR: '.mdc-floating-label',
1059
+ LEADING_ICON_SELECTOR: '.mdc-text-field__icon--leading',
1060
+ LINE_RIPPLE_SELECTOR: '.mdc-line-ripple',
1061
+ OUTLINE_SELECTOR: '.mdc-notched-outline',
1062
+ PREFIX_SELECTOR: '.mdc-text-field__affix--prefix',
1063
+ SUFFIX_SELECTOR: '.mdc-text-field__affix--suffix',
1064
+ TRAILING_ICON_SELECTOR: '.mdc-text-field__icon--trailing'
1065
+ };
1066
+ var cssClasses$3 = {
1067
+ DISABLED: 'mdc-text-field--disabled',
1068
+ FOCUSED: 'mdc-text-field--focused',
1069
+ HELPER_LINE: 'mdc-text-field-helper-line',
1070
+ INVALID: 'mdc-text-field--invalid',
1071
+ LABEL_FLOATING: 'mdc-text-field--label-floating',
1072
+ NO_LABEL: 'mdc-text-field--no-label',
1073
+ OUTLINED: 'mdc-text-field--outlined',
1074
+ ROOT: 'mdc-text-field',
1075
+ TEXTAREA: 'mdc-text-field--textarea',
1076
+ WITH_LEADING_ICON: 'mdc-text-field--with-leading-icon',
1077
+ WITH_TRAILING_ICON: 'mdc-text-field--with-trailing-icon',
1078
+ WITH_INTERNAL_COUNTER: 'mdc-text-field--with-internal-counter',
1079
+ };
1080
+ var numbers = {
1081
+ LABEL_SCALE: 0.75,
1082
+ };
1083
+ /**
1084
+ * Whitelist based off of
1085
+ * https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/HTML5/Constraint_validation
1086
+ * under the "Validation-related attributes" section.
1087
+ */
1088
+ var VALIDATION_ATTR_WHITELIST = [
1089
+ 'pattern',
1090
+ 'min',
1091
+ 'max',
1092
+ 'required',
1093
+ 'step',
1094
+ 'minlength',
1095
+ 'maxlength',
1096
+ ];
1097
+ /**
1098
+ * Label should always float for these types as they show some UI even if value
1099
+ * is empty.
1100
+ */
1101
+ var ALWAYS_FLOAT_TYPES = [
1102
+ 'color',
1103
+ 'date',
1104
+ 'datetime-local',
1105
+ 'month',
1106
+ 'range',
1107
+ 'time',
1108
+ 'week',
1109
+ ];
1110
+
1111
+ /**
1112
+ * @license
1113
+ * Copyright 2016 Google Inc.
1114
+ *
1115
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
1116
+ * of this software and associated documentation files (the "Software"), to deal
1117
+ * in the Software without restriction, including without limitation the rights
1118
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1119
+ * copies of the Software, and to permit persons to whom the Software is
1120
+ * furnished to do so, subject to the following conditions:
1121
+ *
1122
+ * The above copyright notice and this permission notice shall be included in
1123
+ * all copies or substantial portions of the Software.
1124
+ *
1125
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1126
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1127
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1128
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1129
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1130
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
1131
+ * THE SOFTWARE.
1132
+ */
1133
+ var POINTERDOWN_EVENTS = ['mousedown', 'touchstart'];
1134
+ var INTERACTION_EVENTS$1 = ['click', 'keydown'];
1135
+ var MDCTextFieldFoundation = /** @class */ (function (_super) {
1136
+ tslib_es6.__extends(MDCTextFieldFoundation, _super);
1137
+ /**
1138
+ * @param adapter
1139
+ * @param foundationMap Map from subcomponent names to their subfoundations.
1140
+ */
1141
+ function MDCTextFieldFoundation(adapter, foundationMap) {
1142
+ if (foundationMap === void 0) { foundationMap = {}; }
1143
+ var _this = _super.call(this, tslib_es6.__assign(tslib_es6.__assign({}, MDCTextFieldFoundation.defaultAdapter), adapter)) || this;
1144
+ _this.isFocused = false;
1145
+ _this.receivedUserInput = false;
1146
+ _this.valid = true;
1147
+ _this.useNativeValidation = true;
1148
+ _this.validateOnValueChange = true;
1149
+ _this.helperText = foundationMap.helperText;
1150
+ _this.characterCounter = foundationMap.characterCounter;
1151
+ _this.leadingIcon = foundationMap.leadingIcon;
1152
+ _this.trailingIcon = foundationMap.trailingIcon;
1153
+ _this.inputFocusHandler = function () {
1154
+ _this.activateFocus();
1155
+ };
1156
+ _this.inputBlurHandler = function () {
1157
+ _this.deactivateFocus();
1158
+ };
1159
+ _this.inputInputHandler = function () {
1160
+ _this.handleInput();
1161
+ };
1162
+ _this.setPointerXOffset = function (evt) {
1163
+ _this.setTransformOrigin(evt);
1164
+ };
1165
+ _this.textFieldInteractionHandler = function () {
1166
+ _this.handleTextFieldInteraction();
1167
+ };
1168
+ _this.validationAttributeChangeHandler = function (attributesList) {
1169
+ _this.handleValidationAttributeChange(attributesList);
1170
+ };
1171
+ return _this;
1172
+ }
1173
+ Object.defineProperty(MDCTextFieldFoundation, "cssClasses", {
1174
+ get: function () {
1175
+ return cssClasses$3;
1176
+ },
1177
+ enumerable: false,
1178
+ configurable: true
1179
+ });
1180
+ Object.defineProperty(MDCTextFieldFoundation, "strings", {
1181
+ get: function () {
1182
+ return strings$3;
1183
+ },
1184
+ enumerable: false,
1185
+ configurable: true
1186
+ });
1187
+ Object.defineProperty(MDCTextFieldFoundation, "numbers", {
1188
+ get: function () {
1189
+ return numbers;
1190
+ },
1191
+ enumerable: false,
1192
+ configurable: true
1193
+ });
1194
+ Object.defineProperty(MDCTextFieldFoundation.prototype, "shouldAlwaysFloat", {
1195
+ get: function () {
1196
+ var type = this.getNativeInput().type;
1197
+ return ALWAYS_FLOAT_TYPES.indexOf(type) >= 0;
1198
+ },
1199
+ enumerable: false,
1200
+ configurable: true
1201
+ });
1202
+ Object.defineProperty(MDCTextFieldFoundation.prototype, "shouldFloat", {
1203
+ get: function () {
1204
+ return this.shouldAlwaysFloat || this.isFocused || !!this.getValue() ||
1205
+ this.isBadInput();
1206
+ },
1207
+ enumerable: false,
1208
+ configurable: true
1209
+ });
1210
+ Object.defineProperty(MDCTextFieldFoundation.prototype, "shouldShake", {
1211
+ get: function () {
1212
+ return !this.isFocused && !this.isValid() && !!this.getValue();
1213
+ },
1214
+ enumerable: false,
1215
+ configurable: true
1216
+ });
1217
+ Object.defineProperty(MDCTextFieldFoundation, "defaultAdapter", {
1218
+ /**
1219
+ * See {@link MDCTextFieldAdapter} for typing information on parameters and
1220
+ * return types.
1221
+ */
1222
+ get: function () {
1223
+ // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
1224
+ return {
1225
+ addClass: function () { return undefined; },
1226
+ removeClass: function () { return undefined; },
1227
+ hasClass: function () { return true; },
1228
+ setInputAttr: function () { return undefined; },
1229
+ removeInputAttr: function () { return undefined; },
1230
+ registerTextFieldInteractionHandler: function () { return undefined; },
1231
+ deregisterTextFieldInteractionHandler: function () { return undefined; },
1232
+ registerInputInteractionHandler: function () { return undefined; },
1233
+ deregisterInputInteractionHandler: function () { return undefined; },
1234
+ registerValidationAttributeChangeHandler: function () {
1235
+ return new MutationObserver(function () { return undefined; });
1236
+ },
1237
+ deregisterValidationAttributeChangeHandler: function () { return undefined; },
1238
+ getNativeInput: function () { return null; },
1239
+ isFocused: function () { return false; },
1240
+ activateLineRipple: function () { return undefined; },
1241
+ deactivateLineRipple: function () { return undefined; },
1242
+ setLineRippleTransformOrigin: function () { return undefined; },
1243
+ shakeLabel: function () { return undefined; },
1244
+ floatLabel: function () { return undefined; },
1245
+ setLabelRequired: function () { return undefined; },
1246
+ hasLabel: function () { return false; },
1247
+ getLabelWidth: function () { return 0; },
1248
+ hasOutline: function () { return false; },
1249
+ notchOutline: function () { return undefined; },
1250
+ closeOutline: function () { return undefined; },
1251
+ };
1252
+ // tslint:enable:object-literal-sort-keys
1253
+ },
1254
+ enumerable: false,
1255
+ configurable: true
1256
+ });
1257
+ MDCTextFieldFoundation.prototype.init = function () {
1258
+ var e_1, _a, e_2, _b;
1259
+ if (this.adapter.hasLabel() && this.getNativeInput().required) {
1260
+ this.adapter.setLabelRequired(true);
1261
+ }
1262
+ if (this.adapter.isFocused()) {
1263
+ this.inputFocusHandler();
1264
+ }
1265
+ else if (this.adapter.hasLabel() && this.shouldFloat) {
1266
+ this.notchOutline(true);
1267
+ this.adapter.floatLabel(true);
1268
+ this.styleFloating(true);
1269
+ }
1270
+ this.adapter.registerInputInteractionHandler('focus', this.inputFocusHandler);
1271
+ this.adapter.registerInputInteractionHandler('blur', this.inputBlurHandler);
1272
+ this.adapter.registerInputInteractionHandler('input', this.inputInputHandler);
1273
+ try {
1274
+ for (var POINTERDOWN_EVENTS_1 = tslib_es6.__values(POINTERDOWN_EVENTS), POINTERDOWN_EVENTS_1_1 = POINTERDOWN_EVENTS_1.next(); !POINTERDOWN_EVENTS_1_1.done; POINTERDOWN_EVENTS_1_1 = POINTERDOWN_EVENTS_1.next()) {
1275
+ var evtType = POINTERDOWN_EVENTS_1_1.value;
1276
+ this.adapter.registerInputInteractionHandler(evtType, this.setPointerXOffset);
1277
+ }
1278
+ }
1279
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
1280
+ finally {
1281
+ try {
1282
+ if (POINTERDOWN_EVENTS_1_1 && !POINTERDOWN_EVENTS_1_1.done && (_a = POINTERDOWN_EVENTS_1.return)) _a.call(POINTERDOWN_EVENTS_1);
1283
+ }
1284
+ finally { if (e_1) throw e_1.error; }
1285
+ }
1286
+ try {
1287
+ for (var INTERACTION_EVENTS_1 = tslib_es6.__values(INTERACTION_EVENTS$1), INTERACTION_EVENTS_1_1 = INTERACTION_EVENTS_1.next(); !INTERACTION_EVENTS_1_1.done; INTERACTION_EVENTS_1_1 = INTERACTION_EVENTS_1.next()) {
1288
+ var evtType = INTERACTION_EVENTS_1_1.value;
1289
+ this.adapter.registerTextFieldInteractionHandler(evtType, this.textFieldInteractionHandler);
1290
+ }
1291
+ }
1292
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
1293
+ finally {
1294
+ try {
1295
+ if (INTERACTION_EVENTS_1_1 && !INTERACTION_EVENTS_1_1.done && (_b = INTERACTION_EVENTS_1.return)) _b.call(INTERACTION_EVENTS_1);
1296
+ }
1297
+ finally { if (e_2) throw e_2.error; }
1298
+ }
1299
+ this.validationObserver =
1300
+ this.adapter.registerValidationAttributeChangeHandler(this.validationAttributeChangeHandler);
1301
+ this.setcharacterCounter(this.getValue().length);
1302
+ };
1303
+ MDCTextFieldFoundation.prototype.destroy = function () {
1304
+ var e_3, _a, e_4, _b;
1305
+ this.adapter.deregisterInputInteractionHandler('focus', this.inputFocusHandler);
1306
+ this.adapter.deregisterInputInteractionHandler('blur', this.inputBlurHandler);
1307
+ this.adapter.deregisterInputInteractionHandler('input', this.inputInputHandler);
1308
+ try {
1309
+ for (var POINTERDOWN_EVENTS_2 = tslib_es6.__values(POINTERDOWN_EVENTS), POINTERDOWN_EVENTS_2_1 = POINTERDOWN_EVENTS_2.next(); !POINTERDOWN_EVENTS_2_1.done; POINTERDOWN_EVENTS_2_1 = POINTERDOWN_EVENTS_2.next()) {
1310
+ var evtType = POINTERDOWN_EVENTS_2_1.value;
1311
+ this.adapter.deregisterInputInteractionHandler(evtType, this.setPointerXOffset);
1312
+ }
1313
+ }
1314
+ catch (e_3_1) { e_3 = { error: e_3_1 }; }
1315
+ finally {
1316
+ try {
1317
+ if (POINTERDOWN_EVENTS_2_1 && !POINTERDOWN_EVENTS_2_1.done && (_a = POINTERDOWN_EVENTS_2.return)) _a.call(POINTERDOWN_EVENTS_2);
1318
+ }
1319
+ finally { if (e_3) throw e_3.error; }
1320
+ }
1321
+ try {
1322
+ for (var INTERACTION_EVENTS_2 = tslib_es6.__values(INTERACTION_EVENTS$1), INTERACTION_EVENTS_2_1 = INTERACTION_EVENTS_2.next(); !INTERACTION_EVENTS_2_1.done; INTERACTION_EVENTS_2_1 = INTERACTION_EVENTS_2.next()) {
1323
+ var evtType = INTERACTION_EVENTS_2_1.value;
1324
+ this.adapter.deregisterTextFieldInteractionHandler(evtType, this.textFieldInteractionHandler);
1325
+ }
1326
+ }
1327
+ catch (e_4_1) { e_4 = { error: e_4_1 }; }
1328
+ finally {
1329
+ try {
1330
+ if (INTERACTION_EVENTS_2_1 && !INTERACTION_EVENTS_2_1.done && (_b = INTERACTION_EVENTS_2.return)) _b.call(INTERACTION_EVENTS_2);
1331
+ }
1332
+ finally { if (e_4) throw e_4.error; }
1333
+ }
1334
+ this.adapter.deregisterValidationAttributeChangeHandler(this.validationObserver);
1335
+ };
1336
+ /**
1337
+ * Handles user interactions with the Text Field.
1338
+ */
1339
+ MDCTextFieldFoundation.prototype.handleTextFieldInteraction = function () {
1340
+ var nativeInput = this.adapter.getNativeInput();
1341
+ if (nativeInput && nativeInput.disabled) {
1342
+ return;
1343
+ }
1344
+ this.receivedUserInput = true;
1345
+ };
1346
+ /**
1347
+ * Handles validation attribute changes
1348
+ */
1349
+ MDCTextFieldFoundation.prototype.handleValidationAttributeChange = function (attributesList) {
1350
+ var _this = this;
1351
+ attributesList.some(function (attributeName) {
1352
+ if (VALIDATION_ATTR_WHITELIST.indexOf(attributeName) > -1) {
1353
+ _this.styleValidity(true);
1354
+ _this.adapter.setLabelRequired(_this.getNativeInput().required);
1355
+ return true;
1356
+ }
1357
+ return false;
1358
+ });
1359
+ if (attributesList.indexOf('maxlength') > -1) {
1360
+ this.setcharacterCounter(this.getValue().length);
1361
+ }
1362
+ };
1363
+ /**
1364
+ * Opens/closes the notched outline.
1365
+ */
1366
+ MDCTextFieldFoundation.prototype.notchOutline = function (openNotch) {
1367
+ if (!this.adapter.hasOutline() || !this.adapter.hasLabel()) {
1368
+ return;
1369
+ }
1370
+ if (openNotch) {
1371
+ var labelWidth = this.adapter.getLabelWidth() * numbers.LABEL_SCALE;
1372
+ this.adapter.notchOutline(labelWidth);
1373
+ }
1374
+ else {
1375
+ this.adapter.closeOutline();
1376
+ }
1377
+ };
1378
+ /**
1379
+ * Activates the text field focus state.
1380
+ */
1381
+ MDCTextFieldFoundation.prototype.activateFocus = function () {
1382
+ this.isFocused = true;
1383
+ this.styleFocused(this.isFocused);
1384
+ this.adapter.activateLineRipple();
1385
+ if (this.adapter.hasLabel()) {
1386
+ this.notchOutline(this.shouldFloat);
1387
+ this.adapter.floatLabel(this.shouldFloat);
1388
+ this.styleFloating(this.shouldFloat);
1389
+ this.adapter.shakeLabel(this.shouldShake);
1390
+ }
1391
+ if (this.helperText &&
1392
+ (this.helperText.isPersistent() || !this.helperText.isValidation() ||
1393
+ !this.valid)) {
1394
+ this.helperText.showToScreenReader();
1395
+ }
1396
+ };
1397
+ /**
1398
+ * Sets the line ripple's transform origin, so that the line ripple activate
1399
+ * animation will animate out from the user's click location.
1400
+ */
1401
+ MDCTextFieldFoundation.prototype.setTransformOrigin = function (evt) {
1402
+ if (this.isDisabled() || this.adapter.hasOutline()) {
1403
+ return;
1404
+ }
1405
+ var touches = evt.touches;
1406
+ var targetEvent = touches ? touches[0] : evt;
1407
+ var targetClientRect = targetEvent.target.getBoundingClientRect();
1408
+ var normalizedX = targetEvent.clientX - targetClientRect.left;
1409
+ this.adapter.setLineRippleTransformOrigin(normalizedX);
1410
+ };
1411
+ /**
1412
+ * Handles input change of text input and text area.
1413
+ */
1414
+ MDCTextFieldFoundation.prototype.handleInput = function () {
1415
+ this.autoCompleteFocus();
1416
+ this.setcharacterCounter(this.getValue().length);
1417
+ };
1418
+ /**
1419
+ * Activates the Text Field's focus state in cases when the input value
1420
+ * changes without user input (e.g. programmatically).
1421
+ */
1422
+ MDCTextFieldFoundation.prototype.autoCompleteFocus = function () {
1423
+ if (!this.receivedUserInput) {
1424
+ this.activateFocus();
1425
+ }
1426
+ };
1427
+ /**
1428
+ * Deactivates the Text Field's focus state.
1429
+ */
1430
+ MDCTextFieldFoundation.prototype.deactivateFocus = function () {
1431
+ this.isFocused = false;
1432
+ this.adapter.deactivateLineRipple();
1433
+ var isValid = this.isValid();
1434
+ this.styleValidity(isValid);
1435
+ this.styleFocused(this.isFocused);
1436
+ if (this.adapter.hasLabel()) {
1437
+ this.notchOutline(this.shouldFloat);
1438
+ this.adapter.floatLabel(this.shouldFloat);
1439
+ this.styleFloating(this.shouldFloat);
1440
+ this.adapter.shakeLabel(this.shouldShake);
1441
+ }
1442
+ if (!this.shouldFloat) {
1443
+ this.receivedUserInput = false;
1444
+ }
1445
+ };
1446
+ MDCTextFieldFoundation.prototype.getValue = function () {
1447
+ return this.getNativeInput().value;
1448
+ };
1449
+ /**
1450
+ * @param value The value to set on the input Element.
1451
+ */
1452
+ MDCTextFieldFoundation.prototype.setValue = function (value) {
1453
+ // Prevent Safari from moving the caret to the end of the input when the
1454
+ // value has not changed.
1455
+ if (this.getValue() !== value) {
1456
+ this.getNativeInput().value = value;
1457
+ }
1458
+ this.setcharacterCounter(value.length);
1459
+ if (this.validateOnValueChange) {
1460
+ var isValid = this.isValid();
1461
+ this.styleValidity(isValid);
1462
+ }
1463
+ if (this.adapter.hasLabel()) {
1464
+ this.notchOutline(this.shouldFloat);
1465
+ this.adapter.floatLabel(this.shouldFloat);
1466
+ this.styleFloating(this.shouldFloat);
1467
+ if (this.validateOnValueChange) {
1468
+ this.adapter.shakeLabel(this.shouldShake);
1469
+ }
1470
+ }
1471
+ };
1472
+ /**
1473
+ * @return The custom validity state, if set; otherwise, the result of a
1474
+ * native validity check.
1475
+ */
1476
+ MDCTextFieldFoundation.prototype.isValid = function () {
1477
+ return this.useNativeValidation ? this.isNativeInputValid() : this.valid;
1478
+ };
1479
+ /**
1480
+ * @param isValid Sets the custom validity state of the Text Field.
1481
+ */
1482
+ MDCTextFieldFoundation.prototype.setValid = function (isValid) {
1483
+ this.valid = isValid;
1484
+ this.styleValidity(isValid);
1485
+ var shouldShake = !isValid && !this.isFocused && !!this.getValue();
1486
+ if (this.adapter.hasLabel()) {
1487
+ this.adapter.shakeLabel(shouldShake);
1488
+ }
1489
+ };
1490
+ /**
1491
+ * @param shouldValidate Whether or not validity should be updated on
1492
+ * value change.
1493
+ */
1494
+ MDCTextFieldFoundation.prototype.setValidateOnValueChange = function (shouldValidate) {
1495
+ this.validateOnValueChange = shouldValidate;
1496
+ };
1497
+ /**
1498
+ * @return Whether or not validity should be updated on value change. `true`
1499
+ * by default.
1500
+ */
1501
+ MDCTextFieldFoundation.prototype.getValidateOnValueChange = function () {
1502
+ return this.validateOnValueChange;
1503
+ };
1504
+ /**
1505
+ * Enables or disables the use of native validation. Use this for custom
1506
+ * validation.
1507
+ * @param useNativeValidation Set this to false to ignore native input
1508
+ * validation.
1509
+ */
1510
+ MDCTextFieldFoundation.prototype.setUseNativeValidation = function (useNativeValidation) {
1511
+ this.useNativeValidation = useNativeValidation;
1512
+ };
1513
+ MDCTextFieldFoundation.prototype.isDisabled = function () {
1514
+ return this.getNativeInput().disabled;
1515
+ };
1516
+ /**
1517
+ * @param disabled Sets the text-field disabled or enabled.
1518
+ */
1519
+ MDCTextFieldFoundation.prototype.setDisabled = function (disabled) {
1520
+ this.getNativeInput().disabled = disabled;
1521
+ this.styleDisabled(disabled);
1522
+ };
1523
+ /**
1524
+ * @param content Sets the content of the helper text.
1525
+ */
1526
+ MDCTextFieldFoundation.prototype.setHelperTextContent = function (content) {
1527
+ if (this.helperText) {
1528
+ this.helperText.setContent(content);
1529
+ }
1530
+ };
1531
+ /**
1532
+ * Sets the aria label of the leading icon.
1533
+ */
1534
+ MDCTextFieldFoundation.prototype.setLeadingIconAriaLabel = function (label) {
1535
+ if (this.leadingIcon) {
1536
+ this.leadingIcon.setAriaLabel(label);
1537
+ }
1538
+ };
1539
+ /**
1540
+ * Sets the text content of the leading icon.
1541
+ */
1542
+ MDCTextFieldFoundation.prototype.setLeadingIconContent = function (content) {
1543
+ if (this.leadingIcon) {
1544
+ this.leadingIcon.setContent(content);
1545
+ }
1546
+ };
1547
+ /**
1548
+ * Sets the aria label of the trailing icon.
1549
+ */
1550
+ MDCTextFieldFoundation.prototype.setTrailingIconAriaLabel = function (label) {
1551
+ if (this.trailingIcon) {
1552
+ this.trailingIcon.setAriaLabel(label);
1553
+ }
1554
+ };
1555
+ /**
1556
+ * Sets the text content of the trailing icon.
1557
+ */
1558
+ MDCTextFieldFoundation.prototype.setTrailingIconContent = function (content) {
1559
+ if (this.trailingIcon) {
1560
+ this.trailingIcon.setContent(content);
1561
+ }
1562
+ };
1563
+ /**
1564
+ * Sets character counter values that shows characters used and the total
1565
+ * character limit.
1566
+ */
1567
+ MDCTextFieldFoundation.prototype.setcharacterCounter = function (currentLength) {
1568
+ if (!this.characterCounter) {
1569
+ return;
1570
+ }
1571
+ var maxLength = this.getNativeInput().maxLength;
1572
+ if (maxLength === -1) {
1573
+ throw new Error('MDCTextFieldFoundation: Expected maxlength html property on text input or textarea.');
1574
+ }
1575
+ this.characterCounter.setCounterValue(currentLength, maxLength);
1576
+ };
1577
+ /**
1578
+ * @return True if the Text Field input fails in converting the user-supplied
1579
+ * value.
1580
+ */
1581
+ MDCTextFieldFoundation.prototype.isBadInput = function () {
1582
+ // The badInput property is not supported in IE 11 💩.
1583
+ return this.getNativeInput().validity.badInput || false;
1584
+ };
1585
+ /**
1586
+ * @return The result of native validity checking (ValidityState.valid).
1587
+ */
1588
+ MDCTextFieldFoundation.prototype.isNativeInputValid = function () {
1589
+ return this.getNativeInput().validity.valid;
1590
+ };
1591
+ /**
1592
+ * Styles the component based on the validity state.
1593
+ */
1594
+ MDCTextFieldFoundation.prototype.styleValidity = function (isValid) {
1595
+ var INVALID = MDCTextFieldFoundation.cssClasses.INVALID;
1596
+ if (isValid) {
1597
+ this.adapter.removeClass(INVALID);
1598
+ }
1599
+ else {
1600
+ this.adapter.addClass(INVALID);
1601
+ }
1602
+ if (this.helperText) {
1603
+ this.helperText.setValidity(isValid);
1604
+ // We dynamically set or unset aria-describedby for validation helper text
1605
+ // only, based on whether the field is valid
1606
+ var helperTextValidation = this.helperText.isValidation();
1607
+ if (!helperTextValidation) {
1608
+ return;
1609
+ }
1610
+ var helperTextVisible = this.helperText.isVisible();
1611
+ var helperTextId = this.helperText.getId();
1612
+ if (helperTextVisible && helperTextId) {
1613
+ this.adapter.setInputAttr(strings$3.ARIA_DESCRIBEDBY, helperTextId);
1614
+ }
1615
+ else {
1616
+ this.adapter.removeInputAttr(strings$3.ARIA_DESCRIBEDBY);
1617
+ }
1618
+ }
1619
+ };
1620
+ /**
1621
+ * Styles the component based on the focused state.
1622
+ */
1623
+ MDCTextFieldFoundation.prototype.styleFocused = function (isFocused) {
1624
+ var FOCUSED = MDCTextFieldFoundation.cssClasses.FOCUSED;
1625
+ if (isFocused) {
1626
+ this.adapter.addClass(FOCUSED);
1627
+ }
1628
+ else {
1629
+ this.adapter.removeClass(FOCUSED);
1630
+ }
1631
+ };
1632
+ /**
1633
+ * Styles the component based on the disabled state.
1634
+ */
1635
+ MDCTextFieldFoundation.prototype.styleDisabled = function (isDisabled) {
1636
+ var _a = MDCTextFieldFoundation.cssClasses, DISABLED = _a.DISABLED, INVALID = _a.INVALID;
1637
+ if (isDisabled) {
1638
+ this.adapter.addClass(DISABLED);
1639
+ this.adapter.removeClass(INVALID);
1640
+ }
1641
+ else {
1642
+ this.adapter.removeClass(DISABLED);
1643
+ }
1644
+ if (this.leadingIcon) {
1645
+ this.leadingIcon.setDisabled(isDisabled);
1646
+ }
1647
+ if (this.trailingIcon) {
1648
+ this.trailingIcon.setDisabled(isDisabled);
1649
+ }
1650
+ };
1651
+ /**
1652
+ * Styles the component based on the label floating state.
1653
+ */
1654
+ MDCTextFieldFoundation.prototype.styleFloating = function (isFloating) {
1655
+ var LABEL_FLOATING = MDCTextFieldFoundation.cssClasses.LABEL_FLOATING;
1656
+ if (isFloating) {
1657
+ this.adapter.addClass(LABEL_FLOATING);
1658
+ }
1659
+ else {
1660
+ this.adapter.removeClass(LABEL_FLOATING);
1661
+ }
1662
+ };
1663
+ /**
1664
+ * @return The native text input element from the host environment, or an
1665
+ * object with the same shape for unit tests.
1666
+ */
1667
+ MDCTextFieldFoundation.prototype.getNativeInput = function () {
1668
+ // this.adapter may be undefined in foundation unit tests. This happens when
1669
+ // testdouble is creating a mock object and invokes the
1670
+ // shouldShake/shouldFloat getters (which in turn call getValue(), which
1671
+ // calls this method) before init() has been called from the MDCTextField
1672
+ // constructor. To work around that issue, we return a dummy object.
1673
+ var nativeInput = this.adapter ? this.adapter.getNativeInput() : null;
1674
+ return nativeInput || {
1675
+ disabled: false,
1676
+ maxLength: -1,
1677
+ required: false,
1678
+ type: 'input',
1679
+ validity: {
1680
+ badInput: false,
1681
+ valid: true,
1682
+ },
1683
+ value: '',
1684
+ };
1685
+ };
1686
+ return MDCTextFieldFoundation;
1687
+ }(MDCFoundation));
1688
+
1689
+ /**
1690
+ * @license
1691
+ * Copyright 2016 Google Inc.
1692
+ *
1693
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
1694
+ * of this software and associated documentation files (the "Software"), to deal
1695
+ * in the Software without restriction, including without limitation the rights
1696
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1697
+ * copies of the Software, and to permit persons to whom the Software is
1698
+ * furnished to do so, subject to the following conditions:
1699
+ *
1700
+ * The above copyright notice and this permission notice shall be included in
1701
+ * all copies or substantial portions of the Software.
1702
+ *
1703
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1704
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1705
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1706
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1707
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1708
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
1709
+ * THE SOFTWARE.
1710
+ */
1711
+ var cssClasses$2 = {
1712
+ HELPER_TEXT_PERSISTENT: 'mdc-text-field-helper-text--persistent',
1713
+ HELPER_TEXT_VALIDATION_MSG: 'mdc-text-field-helper-text--validation-msg',
1714
+ ROOT: 'mdc-text-field-helper-text',
1715
+ };
1716
+ var strings$2 = {
1717
+ ARIA_HIDDEN: 'aria-hidden',
1718
+ ROLE: 'role',
1719
+ ROOT_SELECTOR: "." + cssClasses$2.ROOT,
1720
+ };
1721
+
1722
+ /**
1723
+ * @license
1724
+ * Copyright 2017 Google Inc.
1725
+ *
1726
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
1727
+ * of this software and associated documentation files (the "Software"), to deal
1728
+ * in the Software without restriction, including without limitation the rights
1729
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1730
+ * copies of the Software, and to permit persons to whom the Software is
1731
+ * furnished to do so, subject to the following conditions:
1732
+ *
1733
+ * The above copyright notice and this permission notice shall be included in
1734
+ * all copies or substantial portions of the Software.
1735
+ *
1736
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1737
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1738
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1739
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1740
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1741
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
1742
+ * THE SOFTWARE.
1743
+ */
1744
+ var MDCTextFieldHelperTextFoundation = /** @class */ (function (_super) {
1745
+ tslib_es6.__extends(MDCTextFieldHelperTextFoundation, _super);
1746
+ function MDCTextFieldHelperTextFoundation(adapter) {
1747
+ return _super.call(this, tslib_es6.__assign(tslib_es6.__assign({}, MDCTextFieldHelperTextFoundation.defaultAdapter), adapter)) || this;
1748
+ }
1749
+ Object.defineProperty(MDCTextFieldHelperTextFoundation, "cssClasses", {
1750
+ get: function () {
1751
+ return cssClasses$2;
1752
+ },
1753
+ enumerable: false,
1754
+ configurable: true
1755
+ });
1756
+ Object.defineProperty(MDCTextFieldHelperTextFoundation, "strings", {
1757
+ get: function () {
1758
+ return strings$2;
1759
+ },
1760
+ enumerable: false,
1761
+ configurable: true
1762
+ });
1763
+ Object.defineProperty(MDCTextFieldHelperTextFoundation, "defaultAdapter", {
1764
+ /**
1765
+ * See {@link MDCTextFieldHelperTextAdapter} for typing information on parameters and return types.
1766
+ */
1767
+ get: function () {
1768
+ // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
1769
+ return {
1770
+ addClass: function () { return undefined; },
1771
+ removeClass: function () { return undefined; },
1772
+ hasClass: function () { return false; },
1773
+ getAttr: function () { return null; },
1774
+ setAttr: function () { return undefined; },
1775
+ removeAttr: function () { return undefined; },
1776
+ setContent: function () { return undefined; },
1777
+ };
1778
+ // tslint:enable:object-literal-sort-keys
1779
+ },
1780
+ enumerable: false,
1781
+ configurable: true
1782
+ });
1783
+ MDCTextFieldHelperTextFoundation.prototype.getId = function () {
1784
+ return this.adapter.getAttr('id');
1785
+ };
1786
+ MDCTextFieldHelperTextFoundation.prototype.isVisible = function () {
1787
+ return this.adapter.getAttr(strings$2.ARIA_HIDDEN) !== 'true';
1788
+ };
1789
+ /**
1790
+ * Sets the content of the helper text field.
1791
+ */
1792
+ MDCTextFieldHelperTextFoundation.prototype.setContent = function (content) {
1793
+ this.adapter.setContent(content);
1794
+ };
1795
+ MDCTextFieldHelperTextFoundation.prototype.isPersistent = function () {
1796
+ return this.adapter.hasClass(cssClasses$2.HELPER_TEXT_PERSISTENT);
1797
+ };
1798
+ /**
1799
+ * @param isPersistent Sets the persistency of the helper text.
1800
+ */
1801
+ MDCTextFieldHelperTextFoundation.prototype.setPersistent = function (isPersistent) {
1802
+ if (isPersistent) {
1803
+ this.adapter.addClass(cssClasses$2.HELPER_TEXT_PERSISTENT);
1804
+ }
1805
+ else {
1806
+ this.adapter.removeClass(cssClasses$2.HELPER_TEXT_PERSISTENT);
1807
+ }
1808
+ };
1809
+ /**
1810
+ * @return whether the helper text acts as an error validation message.
1811
+ */
1812
+ MDCTextFieldHelperTextFoundation.prototype.isValidation = function () {
1813
+ return this.adapter.hasClass(cssClasses$2.HELPER_TEXT_VALIDATION_MSG);
1814
+ };
1815
+ /**
1816
+ * @param isValidation True to make the helper text act as an error validation message.
1817
+ */
1818
+ MDCTextFieldHelperTextFoundation.prototype.setValidation = function (isValidation) {
1819
+ if (isValidation) {
1820
+ this.adapter.addClass(cssClasses$2.HELPER_TEXT_VALIDATION_MSG);
1821
+ }
1822
+ else {
1823
+ this.adapter.removeClass(cssClasses$2.HELPER_TEXT_VALIDATION_MSG);
1824
+ }
1825
+ };
1826
+ /**
1827
+ * Makes the helper text visible to the screen reader.
1828
+ */
1829
+ MDCTextFieldHelperTextFoundation.prototype.showToScreenReader = function () {
1830
+ this.adapter.removeAttr(strings$2.ARIA_HIDDEN);
1831
+ };
1832
+ /**
1833
+ * Sets the validity of the helper text based on the input validity.
1834
+ */
1835
+ MDCTextFieldHelperTextFoundation.prototype.setValidity = function (inputIsValid) {
1836
+ var helperTextIsPersistent = this.adapter.hasClass(cssClasses$2.HELPER_TEXT_PERSISTENT);
1837
+ var helperTextIsValidationMsg = this.adapter.hasClass(cssClasses$2.HELPER_TEXT_VALIDATION_MSG);
1838
+ var validationMsgNeedsDisplay = helperTextIsValidationMsg && !inputIsValid;
1839
+ if (validationMsgNeedsDisplay) {
1840
+ this.showToScreenReader();
1841
+ // If role is already alert, refresh it to trigger another announcement
1842
+ // from screenreader.
1843
+ if (this.adapter.getAttr(strings$2.ROLE) === 'alert') {
1844
+ this.refreshAlertRole();
1845
+ }
1846
+ else {
1847
+ this.adapter.setAttr(strings$2.ROLE, 'alert');
1848
+ }
1849
+ }
1850
+ else {
1851
+ this.adapter.removeAttr(strings$2.ROLE);
1852
+ }
1853
+ if (!helperTextIsPersistent && !validationMsgNeedsDisplay) {
1854
+ this.hide();
1855
+ }
1856
+ };
1857
+ /**
1858
+ * Hides the help text from screen readers.
1859
+ */
1860
+ MDCTextFieldHelperTextFoundation.prototype.hide = function () {
1861
+ this.adapter.setAttr(strings$2.ARIA_HIDDEN, 'true');
1862
+ };
1863
+ MDCTextFieldHelperTextFoundation.prototype.refreshAlertRole = function () {
1864
+ var _this = this;
1865
+ this.adapter.removeAttr(strings$2.ROLE);
1866
+ requestAnimationFrame(function () {
1867
+ _this.adapter.setAttr(strings$2.ROLE, 'alert');
1868
+ });
1869
+ };
1870
+ return MDCTextFieldHelperTextFoundation;
1871
+ }(MDCFoundation));
1872
+
1873
+ /**
1874
+ * @license
1875
+ * Copyright 2017 Google Inc.
1876
+ *
1877
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
1878
+ * of this software and associated documentation files (the "Software"), to deal
1879
+ * in the Software without restriction, including without limitation the rights
1880
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1881
+ * copies of the Software, and to permit persons to whom the Software is
1882
+ * furnished to do so, subject to the following conditions:
1883
+ *
1884
+ * The above copyright notice and this permission notice shall be included in
1885
+ * all copies or substantial portions of the Software.
1886
+ *
1887
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1888
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1889
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1890
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1891
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1892
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
1893
+ * THE SOFTWARE.
1894
+ */
1895
+ var MDCTextFieldHelperText = /** @class */ (function (_super) {
1896
+ tslib_es6.__extends(MDCTextFieldHelperText, _super);
1897
+ function MDCTextFieldHelperText() {
1898
+ return _super !== null && _super.apply(this, arguments) || this;
1899
+ }
1900
+ MDCTextFieldHelperText.attachTo = function (root) {
1901
+ return new MDCTextFieldHelperText(root);
1902
+ };
1903
+ Object.defineProperty(MDCTextFieldHelperText.prototype, "foundationForTextField", {
1904
+ // Provided for access by MDCTextField component
1905
+ get: function () {
1906
+ return this.foundation;
1907
+ },
1908
+ enumerable: false,
1909
+ configurable: true
1910
+ });
1911
+ MDCTextFieldHelperText.prototype.getDefaultFoundation = function () {
1912
+ var _this = this;
1913
+ // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
1914
+ // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
1915
+ // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
1916
+ var adapter = {
1917
+ addClass: function (className) { return _this.root.classList.add(className); },
1918
+ removeClass: function (className) { return _this.root.classList.remove(className); },
1919
+ hasClass: function (className) { return _this.root.classList.contains(className); },
1920
+ getAttr: function (attr) { return _this.root.getAttribute(attr); },
1921
+ setAttr: function (attr, value) { return _this.root.setAttribute(attr, value); },
1922
+ removeAttr: function (attr) { return _this.root.removeAttribute(attr); },
1923
+ setContent: function (content) {
1924
+ _this.root.textContent = content;
1925
+ },
1926
+ };
1927
+ // tslint:enable:object-literal-sort-keys
1928
+ return new MDCTextFieldHelperTextFoundation(adapter);
1929
+ };
1930
+ return MDCTextFieldHelperText;
1931
+ }(MDCComponent));
1932
+
1933
+ /**
1934
+ * @license
1935
+ * Copyright 2016 Google Inc.
1936
+ *
1937
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
1938
+ * of this software and associated documentation files (the "Software"), to deal
1939
+ * in the Software without restriction, including without limitation the rights
1940
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1941
+ * copies of the Software, and to permit persons to whom the Software is
1942
+ * furnished to do so, subject to the following conditions:
1943
+ *
1944
+ * The above copyright notice and this permission notice shall be included in
1945
+ * all copies or substantial portions of the Software.
1946
+ *
1947
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1948
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1949
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1950
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1951
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1952
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
1953
+ * THE SOFTWARE.
1954
+ */
1955
+ var strings$1 = {
1956
+ ICON_EVENT: 'MDCTextField:icon',
1957
+ ICON_ROLE: 'button',
1958
+ };
1959
+ var cssClasses$1 = {
1960
+ ROOT: 'mdc-text-field__icon',
1961
+ };
1962
+
1963
+ /**
1964
+ * @license
1965
+ * Copyright 2017 Google Inc.
1966
+ *
1967
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
1968
+ * of this software and associated documentation files (the "Software"), to deal
1969
+ * in the Software without restriction, including without limitation the rights
1970
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1971
+ * copies of the Software, and to permit persons to whom the Software is
1972
+ * furnished to do so, subject to the following conditions:
1973
+ *
1974
+ * The above copyright notice and this permission notice shall be included in
1975
+ * all copies or substantial portions of the Software.
1976
+ *
1977
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1978
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1979
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1980
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1981
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1982
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
1983
+ * THE SOFTWARE.
1984
+ */
1985
+ var INTERACTION_EVENTS = ['click', 'keydown'];
1986
+ var MDCTextFieldIconFoundation = /** @class */ (function (_super) {
1987
+ tslib_es6.__extends(MDCTextFieldIconFoundation, _super);
1988
+ function MDCTextFieldIconFoundation(adapter) {
1989
+ var _this = _super.call(this, tslib_es6.__assign(tslib_es6.__assign({}, MDCTextFieldIconFoundation.defaultAdapter), adapter)) || this;
1990
+ _this.savedTabIndex = null;
1991
+ _this.interactionHandler = function (evt) {
1992
+ _this.handleInteraction(evt);
1993
+ };
1994
+ return _this;
1995
+ }
1996
+ Object.defineProperty(MDCTextFieldIconFoundation, "strings", {
1997
+ get: function () {
1998
+ return strings$1;
1999
+ },
2000
+ enumerable: false,
2001
+ configurable: true
2002
+ });
2003
+ Object.defineProperty(MDCTextFieldIconFoundation, "cssClasses", {
2004
+ get: function () {
2005
+ return cssClasses$1;
2006
+ },
2007
+ enumerable: false,
2008
+ configurable: true
2009
+ });
2010
+ Object.defineProperty(MDCTextFieldIconFoundation, "defaultAdapter", {
2011
+ /**
2012
+ * See {@link MDCTextFieldIconAdapter} for typing information on parameters and return types.
2013
+ */
2014
+ get: function () {
2015
+ // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
2016
+ return {
2017
+ getAttr: function () { return null; },
2018
+ setAttr: function () { return undefined; },
2019
+ removeAttr: function () { return undefined; },
2020
+ setContent: function () { return undefined; },
2021
+ registerInteractionHandler: function () { return undefined; },
2022
+ deregisterInteractionHandler: function () { return undefined; },
2023
+ notifyIconAction: function () { return undefined; },
2024
+ };
2025
+ // tslint:enable:object-literal-sort-keys
2026
+ },
2027
+ enumerable: false,
2028
+ configurable: true
2029
+ });
2030
+ MDCTextFieldIconFoundation.prototype.init = function () {
2031
+ var e_1, _a;
2032
+ this.savedTabIndex = this.adapter.getAttr('tabindex');
2033
+ try {
2034
+ for (var INTERACTION_EVENTS_1 = tslib_es6.__values(INTERACTION_EVENTS), INTERACTION_EVENTS_1_1 = INTERACTION_EVENTS_1.next(); !INTERACTION_EVENTS_1_1.done; INTERACTION_EVENTS_1_1 = INTERACTION_EVENTS_1.next()) {
2035
+ var evtType = INTERACTION_EVENTS_1_1.value;
2036
+ this.adapter.registerInteractionHandler(evtType, this.interactionHandler);
2037
+ }
2038
+ }
2039
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
2040
+ finally {
2041
+ try {
2042
+ if (INTERACTION_EVENTS_1_1 && !INTERACTION_EVENTS_1_1.done && (_a = INTERACTION_EVENTS_1.return)) _a.call(INTERACTION_EVENTS_1);
2043
+ }
2044
+ finally { if (e_1) throw e_1.error; }
2045
+ }
2046
+ };
2047
+ MDCTextFieldIconFoundation.prototype.destroy = function () {
2048
+ var e_2, _a;
2049
+ try {
2050
+ for (var INTERACTION_EVENTS_2 = tslib_es6.__values(INTERACTION_EVENTS), INTERACTION_EVENTS_2_1 = INTERACTION_EVENTS_2.next(); !INTERACTION_EVENTS_2_1.done; INTERACTION_EVENTS_2_1 = INTERACTION_EVENTS_2.next()) {
2051
+ var evtType = INTERACTION_EVENTS_2_1.value;
2052
+ this.adapter.deregisterInteractionHandler(evtType, this.interactionHandler);
2053
+ }
2054
+ }
2055
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
2056
+ finally {
2057
+ try {
2058
+ if (INTERACTION_EVENTS_2_1 && !INTERACTION_EVENTS_2_1.done && (_a = INTERACTION_EVENTS_2.return)) _a.call(INTERACTION_EVENTS_2);
2059
+ }
2060
+ finally { if (e_2) throw e_2.error; }
2061
+ }
2062
+ };
2063
+ MDCTextFieldIconFoundation.prototype.setDisabled = function (disabled) {
2064
+ if (!this.savedTabIndex) {
2065
+ return;
2066
+ }
2067
+ if (disabled) {
2068
+ this.adapter.setAttr('tabindex', '-1');
2069
+ this.adapter.removeAttr('role');
2070
+ }
2071
+ else {
2072
+ this.adapter.setAttr('tabindex', this.savedTabIndex);
2073
+ this.adapter.setAttr('role', strings$1.ICON_ROLE);
2074
+ }
2075
+ };
2076
+ MDCTextFieldIconFoundation.prototype.setAriaLabel = function (label) {
2077
+ this.adapter.setAttr('aria-label', label);
2078
+ };
2079
+ MDCTextFieldIconFoundation.prototype.setContent = function (content) {
2080
+ this.adapter.setContent(content);
2081
+ };
2082
+ MDCTextFieldIconFoundation.prototype.handleInteraction = function (evt) {
2083
+ var isEnterKey = evt.key === 'Enter' || evt.keyCode === 13;
2084
+ if (evt.type === 'click' || isEnterKey) {
2085
+ evt.preventDefault(); // stop click from causing host label to focus
2086
+ // input
2087
+ this.adapter.notifyIconAction();
2088
+ }
2089
+ };
2090
+ return MDCTextFieldIconFoundation;
2091
+ }(MDCFoundation));
2092
+
2093
+ /**
2094
+ * @license
2095
+ * Copyright 2017 Google Inc.
2096
+ *
2097
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
2098
+ * of this software and associated documentation files (the "Software"), to deal
2099
+ * in the Software without restriction, including without limitation the rights
2100
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
2101
+ * copies of the Software, and to permit persons to whom the Software is
2102
+ * furnished to do so, subject to the following conditions:
2103
+ *
2104
+ * The above copyright notice and this permission notice shall be included in
2105
+ * all copies or substantial portions of the Software.
2106
+ *
2107
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
2108
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
2109
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
2110
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
2111
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2112
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2113
+ * THE SOFTWARE.
2114
+ */
2115
+ var MDCTextFieldIcon = /** @class */ (function (_super) {
2116
+ tslib_es6.__extends(MDCTextFieldIcon, _super);
2117
+ function MDCTextFieldIcon() {
2118
+ return _super !== null && _super.apply(this, arguments) || this;
2119
+ }
2120
+ MDCTextFieldIcon.attachTo = function (root) {
2121
+ return new MDCTextFieldIcon(root);
2122
+ };
2123
+ Object.defineProperty(MDCTextFieldIcon.prototype, "foundationForTextField", {
2124
+ // Provided for access by MDCTextField component
2125
+ get: function () {
2126
+ return this.foundation;
2127
+ },
2128
+ enumerable: false,
2129
+ configurable: true
2130
+ });
2131
+ MDCTextFieldIcon.prototype.getDefaultFoundation = function () {
2132
+ var _this = this;
2133
+ // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
2134
+ // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
2135
+ // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
2136
+ var adapter = {
2137
+ getAttr: function (attr) { return _this.root.getAttribute(attr); },
2138
+ setAttr: function (attr, value) { return _this.root.setAttribute(attr, value); },
2139
+ removeAttr: function (attr) { return _this.root.removeAttribute(attr); },
2140
+ setContent: function (content) {
2141
+ _this.root.textContent = content;
2142
+ },
2143
+ registerInteractionHandler: function (evtType, handler) { return _this.listen(evtType, handler); },
2144
+ deregisterInteractionHandler: function (evtType, handler) { return _this.unlisten(evtType, handler); },
2145
+ notifyIconAction: function () { return _this.emit(MDCTextFieldIconFoundation.strings.ICON_EVENT, {} /* evtData */, true /* shouldBubble */); },
2146
+ };
2147
+ // tslint:enable:object-literal-sort-keys
2148
+ return new MDCTextFieldIconFoundation(adapter);
2149
+ };
2150
+ return MDCTextFieldIcon;
2151
+ }(MDCComponent));
2152
+
2153
+ /**
2154
+ * @license
2155
+ * Copyright 2016 Google Inc.
2156
+ *
2157
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
2158
+ * of this software and associated documentation files (the "Software"), to deal
2159
+ * in the Software without restriction, including without limitation the rights
2160
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
2161
+ * copies of the Software, and to permit persons to whom the Software is
2162
+ * furnished to do so, subject to the following conditions:
2163
+ *
2164
+ * The above copyright notice and this permission notice shall be included in
2165
+ * all copies or substantial portions of the Software.
2166
+ *
2167
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
2168
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
2169
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
2170
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
2171
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2172
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2173
+ * THE SOFTWARE.
2174
+ */
2175
+ var MDCTextField = /** @class */ (function (_super) {
2176
+ tslib_es6.__extends(MDCTextField, _super);
2177
+ function MDCTextField() {
2178
+ return _super !== null && _super.apply(this, arguments) || this;
2179
+ }
2180
+ MDCTextField.attachTo = function (root) {
2181
+ return new MDCTextField(root);
2182
+ };
2183
+ MDCTextField.prototype.initialize = function (rippleFactory, lineRippleFactory, helperTextFactory, characterCounterFactory, iconFactory, labelFactory, outlineFactory) {
2184
+ if (rippleFactory === void 0) { rippleFactory = function (el, foundation) { return new component.MDCRipple(el, foundation); }; }
2185
+ if (lineRippleFactory === void 0) { lineRippleFactory = function (el) { return new MDCLineRipple(el); }; }
2186
+ if (helperTextFactory === void 0) { helperTextFactory = function (el) {
2187
+ return new MDCTextFieldHelperText(el);
2188
+ }; }
2189
+ if (characterCounterFactory === void 0) { characterCounterFactory = function (el) {
2190
+ return new MDCTextFieldCharacterCounter(el);
2191
+ }; }
2192
+ if (iconFactory === void 0) { iconFactory = function (el) { return new MDCTextFieldIcon(el); }; }
2193
+ if (labelFactory === void 0) { labelFactory = function (el) { return new MDCFloatingLabel(el); }; }
2194
+ if (outlineFactory === void 0) { outlineFactory = function (el) { return new MDCNotchedOutline(el); }; }
2195
+ this.input =
2196
+ this.root.querySelector(strings$3.INPUT_SELECTOR);
2197
+ var labelElement = this.root.querySelector(strings$3.LABEL_SELECTOR);
2198
+ this.label = labelElement ? labelFactory(labelElement) : null;
2199
+ var lineRippleElement = this.root.querySelector(strings$3.LINE_RIPPLE_SELECTOR);
2200
+ this.lineRipple =
2201
+ lineRippleElement ? lineRippleFactory(lineRippleElement) : null;
2202
+ var outlineElement = this.root.querySelector(strings$3.OUTLINE_SELECTOR);
2203
+ this.outline = outlineElement ? outlineFactory(outlineElement) : null;
2204
+ // Helper text
2205
+ var helperTextStrings = MDCTextFieldHelperTextFoundation.strings;
2206
+ var nextElementSibling = this.root.nextElementSibling;
2207
+ var hasHelperLine = (nextElementSibling && nextElementSibling.classList.contains(cssClasses$3.HELPER_LINE));
2208
+ var helperTextEl = hasHelperLine && nextElementSibling && nextElementSibling.querySelector(helperTextStrings.ROOT_SELECTOR);
2209
+ this.helperText = helperTextEl ? helperTextFactory(helperTextEl) : null;
2210
+ // Character counter
2211
+ var characterCounterStrings = MDCTextFieldCharacterCounterFoundation.strings;
2212
+ var characterCounterEl = this.root.querySelector(characterCounterStrings.ROOT_SELECTOR);
2213
+ // If character counter is not found in root element search in sibling element.
2214
+ if (!characterCounterEl && hasHelperLine && nextElementSibling) {
2215
+ characterCounterEl = nextElementSibling.querySelector(characterCounterStrings.ROOT_SELECTOR);
2216
+ }
2217
+ this.characterCounter =
2218
+ characterCounterEl ? characterCounterFactory(characterCounterEl) : null;
2219
+ // Leading icon
2220
+ var leadingIconEl = this.root.querySelector(strings$3.LEADING_ICON_SELECTOR);
2221
+ this.leadingIcon = leadingIconEl ? iconFactory(leadingIconEl) : null;
2222
+ // Trailing icon
2223
+ var trailingIconEl = this.root.querySelector(strings$3.TRAILING_ICON_SELECTOR);
2224
+ this.trailingIcon = trailingIconEl ? iconFactory(trailingIconEl) : null;
2225
+ // Prefix and Suffix
2226
+ this.prefix = this.root.querySelector(strings$3.PREFIX_SELECTOR);
2227
+ this.suffix = this.root.querySelector(strings$3.SUFFIX_SELECTOR);
2228
+ this.ripple = this.createRipple(rippleFactory);
2229
+ };
2230
+ MDCTextField.prototype.destroy = function () {
2231
+ if (this.ripple) {
2232
+ this.ripple.destroy();
2233
+ }
2234
+ if (this.lineRipple) {
2235
+ this.lineRipple.destroy();
2236
+ }
2237
+ if (this.helperText) {
2238
+ this.helperText.destroy();
2239
+ }
2240
+ if (this.characterCounter) {
2241
+ this.characterCounter.destroy();
2242
+ }
2243
+ if (this.leadingIcon) {
2244
+ this.leadingIcon.destroy();
2245
+ }
2246
+ if (this.trailingIcon) {
2247
+ this.trailingIcon.destroy();
2248
+ }
2249
+ if (this.label) {
2250
+ this.label.destroy();
2251
+ }
2252
+ if (this.outline) {
2253
+ this.outline.destroy();
2254
+ }
2255
+ _super.prototype.destroy.call(this);
2256
+ };
2257
+ /**
2258
+ * Initializes the Text Field's internal state based on the environment's
2259
+ * state.
2260
+ */
2261
+ MDCTextField.prototype.initialSyncWithDOM = function () {
2262
+ this.disabled = this.input.disabled;
2263
+ };
2264
+ Object.defineProperty(MDCTextField.prototype, "value", {
2265
+ get: function () {
2266
+ return this.foundation.getValue();
2267
+ },
2268
+ /**
2269
+ * @param value The value to set on the input.
2270
+ */
2271
+ set: function (value) {
2272
+ this.foundation.setValue(value);
2273
+ },
2274
+ enumerable: false,
2275
+ configurable: true
2276
+ });
2277
+ Object.defineProperty(MDCTextField.prototype, "disabled", {
2278
+ get: function () {
2279
+ return this.foundation.isDisabled();
2280
+ },
2281
+ /**
2282
+ * @param disabled Sets the Text Field disabled or enabled.
2283
+ */
2284
+ set: function (disabled) {
2285
+ this.foundation.setDisabled(disabled);
2286
+ },
2287
+ enumerable: false,
2288
+ configurable: true
2289
+ });
2290
+ Object.defineProperty(MDCTextField.prototype, "valid", {
2291
+ get: function () {
2292
+ return this.foundation.isValid();
2293
+ },
2294
+ /**
2295
+ * @param valid Sets the Text Field valid or invalid.
2296
+ */
2297
+ set: function (valid) {
2298
+ this.foundation.setValid(valid);
2299
+ },
2300
+ enumerable: false,
2301
+ configurable: true
2302
+ });
2303
+ Object.defineProperty(MDCTextField.prototype, "required", {
2304
+ get: function () {
2305
+ return this.input.required;
2306
+ },
2307
+ /**
2308
+ * @param required Sets the Text Field to required.
2309
+ */
2310
+ set: function (required) {
2311
+ this.input.required = required;
2312
+ },
2313
+ enumerable: false,
2314
+ configurable: true
2315
+ });
2316
+ Object.defineProperty(MDCTextField.prototype, "pattern", {
2317
+ get: function () {
2318
+ return this.input.pattern;
2319
+ },
2320
+ /**
2321
+ * @param pattern Sets the input element's validation pattern.
2322
+ */
2323
+ set: function (pattern) {
2324
+ this.input.pattern = pattern;
2325
+ },
2326
+ enumerable: false,
2327
+ configurable: true
2328
+ });
2329
+ Object.defineProperty(MDCTextField.prototype, "minLength", {
2330
+ get: function () {
2331
+ return this.input.minLength;
2332
+ },
2333
+ /**
2334
+ * @param minLength Sets the input element's minLength.
2335
+ */
2336
+ set: function (minLength) {
2337
+ this.input.minLength = minLength;
2338
+ },
2339
+ enumerable: false,
2340
+ configurable: true
2341
+ });
2342
+ Object.defineProperty(MDCTextField.prototype, "maxLength", {
2343
+ get: function () {
2344
+ return this.input.maxLength;
2345
+ },
2346
+ /**
2347
+ * @param maxLength Sets the input element's maxLength.
2348
+ */
2349
+ set: function (maxLength) {
2350
+ // Chrome throws exception if maxLength is set to a value less than zero
2351
+ if (maxLength < 0) {
2352
+ this.input.removeAttribute('maxLength');
2353
+ }
2354
+ else {
2355
+ this.input.maxLength = maxLength;
2356
+ }
2357
+ },
2358
+ enumerable: false,
2359
+ configurable: true
2360
+ });
2361
+ Object.defineProperty(MDCTextField.prototype, "min", {
2362
+ get: function () {
2363
+ return this.input.min;
2364
+ },
2365
+ /**
2366
+ * @param min Sets the input element's min.
2367
+ */
2368
+ set: function (min) {
2369
+ this.input.min = min;
2370
+ },
2371
+ enumerable: false,
2372
+ configurable: true
2373
+ });
2374
+ Object.defineProperty(MDCTextField.prototype, "max", {
2375
+ get: function () {
2376
+ return this.input.max;
2377
+ },
2378
+ /**
2379
+ * @param max Sets the input element's max.
2380
+ */
2381
+ set: function (max) {
2382
+ this.input.max = max;
2383
+ },
2384
+ enumerable: false,
2385
+ configurable: true
2386
+ });
2387
+ Object.defineProperty(MDCTextField.prototype, "step", {
2388
+ get: function () {
2389
+ return this.input.step;
2390
+ },
2391
+ /**
2392
+ * @param step Sets the input element's step.
2393
+ */
2394
+ set: function (step) {
2395
+ this.input.step = step;
2396
+ },
2397
+ enumerable: false,
2398
+ configurable: true
2399
+ });
2400
+ Object.defineProperty(MDCTextField.prototype, "helperTextContent", {
2401
+ /**
2402
+ * Sets the helper text element content.
2403
+ */
2404
+ set: function (content) {
2405
+ this.foundation.setHelperTextContent(content);
2406
+ },
2407
+ enumerable: false,
2408
+ configurable: true
2409
+ });
2410
+ Object.defineProperty(MDCTextField.prototype, "leadingIconAriaLabel", {
2411
+ /**
2412
+ * Sets the aria label of the leading icon.
2413
+ */
2414
+ set: function (label) {
2415
+ this.foundation.setLeadingIconAriaLabel(label);
2416
+ },
2417
+ enumerable: false,
2418
+ configurable: true
2419
+ });
2420
+ Object.defineProperty(MDCTextField.prototype, "leadingIconContent", {
2421
+ /**
2422
+ * Sets the text content of the leading icon.
2423
+ */
2424
+ set: function (content) {
2425
+ this.foundation.setLeadingIconContent(content);
2426
+ },
2427
+ enumerable: false,
2428
+ configurable: true
2429
+ });
2430
+ Object.defineProperty(MDCTextField.prototype, "trailingIconAriaLabel", {
2431
+ /**
2432
+ * Sets the aria label of the trailing icon.
2433
+ */
2434
+ set: function (label) {
2435
+ this.foundation.setTrailingIconAriaLabel(label);
2436
+ },
2437
+ enumerable: false,
2438
+ configurable: true
2439
+ });
2440
+ Object.defineProperty(MDCTextField.prototype, "trailingIconContent", {
2441
+ /**
2442
+ * Sets the text content of the trailing icon.
2443
+ */
2444
+ set: function (content) {
2445
+ this.foundation.setTrailingIconContent(content);
2446
+ },
2447
+ enumerable: false,
2448
+ configurable: true
2449
+ });
2450
+ Object.defineProperty(MDCTextField.prototype, "useNativeValidation", {
2451
+ /**
2452
+ * Enables or disables the use of native validation. Use this for custom validation.
2453
+ * @param useNativeValidation Set this to false to ignore native input validation.
2454
+ */
2455
+ set: function (useNativeValidation) {
2456
+ this.foundation.setUseNativeValidation(useNativeValidation);
2457
+ },
2458
+ enumerable: false,
2459
+ configurable: true
2460
+ });
2461
+ Object.defineProperty(MDCTextField.prototype, "prefixText", {
2462
+ /**
2463
+ * Gets the text content of the prefix, or null if it does not exist.
2464
+ */
2465
+ get: function () {
2466
+ return this.prefix ? this.prefix.textContent : null;
2467
+ },
2468
+ /**
2469
+ * Sets the text content of the prefix, if it exists.
2470
+ */
2471
+ set: function (prefixText) {
2472
+ if (this.prefix) {
2473
+ this.prefix.textContent = prefixText;
2474
+ }
2475
+ },
2476
+ enumerable: false,
2477
+ configurable: true
2478
+ });
2479
+ Object.defineProperty(MDCTextField.prototype, "suffixText", {
2480
+ /**
2481
+ * Gets the text content of the suffix, or null if it does not exist.
2482
+ */
2483
+ get: function () {
2484
+ return this.suffix ? this.suffix.textContent : null;
2485
+ },
2486
+ /**
2487
+ * Sets the text content of the suffix, if it exists.
2488
+ */
2489
+ set: function (suffixText) {
2490
+ if (this.suffix) {
2491
+ this.suffix.textContent = suffixText;
2492
+ }
2493
+ },
2494
+ enumerable: false,
2495
+ configurable: true
2496
+ });
2497
+ /**
2498
+ * Focuses the input element.
2499
+ */
2500
+ MDCTextField.prototype.focus = function () {
2501
+ this.input.focus();
2502
+ };
2503
+ /**
2504
+ * Recomputes the outline SVG path for the outline element.
2505
+ */
2506
+ MDCTextField.prototype.layout = function () {
2507
+ var openNotch = this.foundation.shouldFloat;
2508
+ this.foundation.notchOutline(openNotch);
2509
+ };
2510
+ MDCTextField.prototype.getDefaultFoundation = function () {
2511
+ // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
2512
+ // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
2513
+ // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
2514
+ var adapter = tslib_es6.__assign(tslib_es6.__assign(tslib_es6.__assign(tslib_es6.__assign(tslib_es6.__assign({}, this.getRootAdapterMethods()), this.getInputAdapterMethods()), this.getLabelAdapterMethods()), this.getLineRippleAdapterMethods()), this.getOutlineAdapterMethods());
2515
+ // tslint:enable:object-literal-sort-keys
2516
+ return new MDCTextFieldFoundation(adapter, this.getFoundationMap());
2517
+ };
2518
+ MDCTextField.prototype.getRootAdapterMethods = function () {
2519
+ var _this = this;
2520
+ // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
2521
+ return {
2522
+ addClass: function (className) { return _this.root.classList.add(className); },
2523
+ removeClass: function (className) { return _this.root.classList.remove(className); },
2524
+ hasClass: function (className) { return _this.root.classList.contains(className); },
2525
+ registerTextFieldInteractionHandler: function (evtType, handler) {
2526
+ _this.listen(evtType, handler);
2527
+ },
2528
+ deregisterTextFieldInteractionHandler: function (evtType, handler) {
2529
+ _this.unlisten(evtType, handler);
2530
+ },
2531
+ registerValidationAttributeChangeHandler: function (handler) {
2532
+ var getAttributesList = function (mutationsList) {
2533
+ return mutationsList
2534
+ .map(function (mutation) { return mutation.attributeName; })
2535
+ .filter(function (attributeName) { return attributeName; });
2536
+ };
2537
+ var observer = new MutationObserver(function (mutationsList) { return handler(getAttributesList(mutationsList)); });
2538
+ var config = { attributes: true };
2539
+ observer.observe(_this.input, config);
2540
+ return observer;
2541
+ },
2542
+ deregisterValidationAttributeChangeHandler: function (observer) {
2543
+ observer.disconnect();
2544
+ },
2545
+ };
2546
+ // tslint:enable:object-literal-sort-keys
2547
+ };
2548
+ MDCTextField.prototype.getInputAdapterMethods = function () {
2549
+ var _this = this;
2550
+ // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
2551
+ return {
2552
+ getNativeInput: function () { return _this.input; },
2553
+ setInputAttr: function (attr, value) {
2554
+ _this.input.setAttribute(attr, value);
2555
+ },
2556
+ removeInputAttr: function (attr) {
2557
+ _this.input.removeAttribute(attr);
2558
+ },
2559
+ isFocused: function () { return document.activeElement === _this.input; },
2560
+ registerInputInteractionHandler: function (evtType, handler) {
2561
+ _this.input.addEventListener(evtType, handler, applyPassive());
2562
+ },
2563
+ deregisterInputInteractionHandler: function (evtType, handler) {
2564
+ _this.input.removeEventListener(evtType, handler, applyPassive());
2565
+ },
2566
+ };
2567
+ // tslint:enable:object-literal-sort-keys
2568
+ };
2569
+ MDCTextField.prototype.getLabelAdapterMethods = function () {
2570
+ var _this = this;
2571
+ return {
2572
+ floatLabel: function (shouldFloat) {
2573
+ _this.label && _this.label.float(shouldFloat);
2574
+ },
2575
+ getLabelWidth: function () { return _this.label ? _this.label.getWidth() : 0; },
2576
+ hasLabel: function () { return Boolean(_this.label); },
2577
+ shakeLabel: function (shouldShake) {
2578
+ _this.label && _this.label.shake(shouldShake);
2579
+ },
2580
+ setLabelRequired: function (isRequired) {
2581
+ _this.label && _this.label.setRequired(isRequired);
2582
+ },
2583
+ };
2584
+ };
2585
+ MDCTextField.prototype.getLineRippleAdapterMethods = function () {
2586
+ var _this = this;
2587
+ return {
2588
+ activateLineRipple: function () {
2589
+ if (_this.lineRipple) {
2590
+ _this.lineRipple.activate();
2591
+ }
2592
+ },
2593
+ deactivateLineRipple: function () {
2594
+ if (_this.lineRipple) {
2595
+ _this.lineRipple.deactivate();
2596
+ }
2597
+ },
2598
+ setLineRippleTransformOrigin: function (normalizedX) {
2599
+ if (_this.lineRipple) {
2600
+ _this.lineRipple.setRippleCenter(normalizedX);
2601
+ }
2602
+ },
2603
+ };
2604
+ };
2605
+ MDCTextField.prototype.getOutlineAdapterMethods = function () {
2606
+ var _this = this;
2607
+ return {
2608
+ closeOutline: function () {
2609
+ _this.outline && _this.outline.closeNotch();
2610
+ },
2611
+ hasOutline: function () { return Boolean(_this.outline); },
2612
+ notchOutline: function (labelWidth) {
2613
+ _this.outline && _this.outline.notch(labelWidth);
2614
+ },
2615
+ };
2616
+ };
2617
+ /**
2618
+ * @return A map of all subcomponents to subfoundations.
2619
+ */
2620
+ MDCTextField.prototype.getFoundationMap = function () {
2621
+ return {
2622
+ characterCounter: this.characterCounter ?
2623
+ this.characterCounter.foundationForTextField :
2624
+ undefined,
2625
+ helperText: this.helperText ? this.helperText.foundationForTextField :
2626
+ undefined,
2627
+ leadingIcon: this.leadingIcon ? this.leadingIcon.foundationForTextField :
2628
+ undefined,
2629
+ trailingIcon: this.trailingIcon ?
2630
+ this.trailingIcon.foundationForTextField :
2631
+ undefined,
2632
+ };
2633
+ };
2634
+ MDCTextField.prototype.createRipple = function (rippleFactory) {
2635
+ var _this = this;
2636
+ var isTextArea = this.root.classList.contains(cssClasses$3.TEXTAREA);
2637
+ var isOutlined = this.root.classList.contains(cssClasses$3.OUTLINED);
2638
+ if (isTextArea || isOutlined) {
2639
+ return null;
2640
+ }
2641
+ // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
2642
+ // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
2643
+ // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
2644
+ var adapter = tslib_es6.__assign(tslib_es6.__assign({}, component.MDCRipple.createAdapter(this)), { isSurfaceActive: function () { return matches(_this.input, ':active'); }, registerInteractionHandler: function (evtType, handler) {
2645
+ _this.input.addEventListener(evtType, handler, applyPassive());
2646
+ }, deregisterInteractionHandler: function (evtType, handler) {
2647
+ _this.input.removeEventListener(evtType, handler, applyPassive());
2648
+ } });
2649
+ // tslint:enable:object-literal-sort-keys
2650
+ return rippleFactory(this.root, new component.MDCRippleFoundation(adapter));
2651
+ };
2652
+ return MDCTextField;
2653
+ }(MDCComponent));
2654
+
2655
+ /**
2656
+ * @license
2657
+ * Copyright 2017 Google Inc.
2658
+ *
2659
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
2660
+ * of this software and associated documentation files (the "Software"), to deal
2661
+ * in the Software without restriction, including without limitation the rights
2662
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
2663
+ * copies of the Software, and to permit persons to whom the Software is
2664
+ * furnished to do so, subject to the following conditions:
2665
+ *
2666
+ * The above copyright notice and this permission notice shall be included in
2667
+ * all copies or substantial portions of the Software.
2668
+ *
2669
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
2670
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
2671
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
2672
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
2673
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2674
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2675
+ * THE SOFTWARE.
2676
+ */
2677
+ var cssClasses = {
2678
+ ROOT: 'mdc-form-field',
2679
+ };
2680
+ var strings = {
2681
+ LABEL_SELECTOR: '.mdc-form-field > label',
2682
+ };
2683
+
2684
+ /**
2685
+ * @license
2686
+ * Copyright 2017 Google Inc.
2687
+ *
2688
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
2689
+ * of this software and associated documentation files (the "Software"), to deal
2690
+ * in the Software without restriction, including without limitation the rights
2691
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
2692
+ * copies of the Software, and to permit persons to whom the Software is
2693
+ * furnished to do so, subject to the following conditions:
2694
+ *
2695
+ * The above copyright notice and this permission notice shall be included in
2696
+ * all copies or substantial portions of the Software.
2697
+ *
2698
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
2699
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
2700
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
2701
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
2702
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2703
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2704
+ * THE SOFTWARE.
2705
+ */
2706
+ var MDCFormFieldFoundation = /** @class */ (function (_super) {
2707
+ tslib_es6.__extends(MDCFormFieldFoundation, _super);
2708
+ function MDCFormFieldFoundation(adapter) {
2709
+ var _this = _super.call(this, tslib_es6.__assign(tslib_es6.__assign({}, MDCFormFieldFoundation.defaultAdapter), adapter)) || this;
2710
+ _this.click = function () {
2711
+ _this.handleClick();
2712
+ };
2713
+ return _this;
2714
+ }
2715
+ Object.defineProperty(MDCFormFieldFoundation, "cssClasses", {
2716
+ get: function () {
2717
+ return cssClasses;
2718
+ },
2719
+ enumerable: false,
2720
+ configurable: true
2721
+ });
2722
+ Object.defineProperty(MDCFormFieldFoundation, "strings", {
2723
+ get: function () {
2724
+ return strings;
2725
+ },
2726
+ enumerable: false,
2727
+ configurable: true
2728
+ });
2729
+ Object.defineProperty(MDCFormFieldFoundation, "defaultAdapter", {
2730
+ get: function () {
2731
+ return {
2732
+ activateInputRipple: function () { return undefined; },
2733
+ deactivateInputRipple: function () { return undefined; },
2734
+ deregisterInteractionHandler: function () { return undefined; },
2735
+ registerInteractionHandler: function () { return undefined; },
2736
+ };
2737
+ },
2738
+ enumerable: false,
2739
+ configurable: true
2740
+ });
2741
+ MDCFormFieldFoundation.prototype.init = function () {
2742
+ this.adapter.registerInteractionHandler('click', this.click);
2743
+ };
2744
+ MDCFormFieldFoundation.prototype.destroy = function () {
2745
+ this.adapter.deregisterInteractionHandler('click', this.click);
2746
+ };
2747
+ MDCFormFieldFoundation.prototype.handleClick = function () {
2748
+ var _this = this;
2749
+ this.adapter.activateInputRipple();
2750
+ requestAnimationFrame(function () {
2751
+ _this.adapter.deactivateInputRipple();
2752
+ });
2753
+ };
2754
+ return MDCFormFieldFoundation;
2755
+ }(MDCFoundation));
2756
+
2757
+ /**
2758
+ * @license
2759
+ * Copyright 2017 Google Inc.
2760
+ *
2761
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
2762
+ * of this software and associated documentation files (the "Software"), to deal
2763
+ * in the Software without restriction, including without limitation the rights
2764
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
2765
+ * copies of the Software, and to permit persons to whom the Software is
2766
+ * furnished to do so, subject to the following conditions:
2767
+ *
2768
+ * The above copyright notice and this permission notice shall be included in
2769
+ * all copies or substantial portions of the Software.
2770
+ *
2771
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
2772
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
2773
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
2774
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
2775
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2776
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2777
+ * THE SOFTWARE.
2778
+ */
2779
+ var MDCFormField = /** @class */ (function (_super) {
2780
+ tslib_es6.__extends(MDCFormField, _super);
2781
+ function MDCFormField() {
2782
+ return _super !== null && _super.apply(this, arguments) || this;
2783
+ }
2784
+ MDCFormField.attachTo = function (root) {
2785
+ return new MDCFormField(root);
2786
+ };
2787
+ MDCFormField.prototype.labelEl = function () {
2788
+ var LABEL_SELECTOR = MDCFormFieldFoundation.strings.LABEL_SELECTOR;
2789
+ return this.root.querySelector(LABEL_SELECTOR);
2790
+ };
2791
+ MDCFormField.prototype.getDefaultFoundation = function () {
2792
+ var _this = this;
2793
+ // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
2794
+ // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
2795
+ var adapter = {
2796
+ activateInputRipple: function () {
2797
+ if (_this.input && _this.input.ripple) {
2798
+ _this.input.ripple.activate();
2799
+ }
2800
+ },
2801
+ deactivateInputRipple: function () {
2802
+ if (_this.input && _this.input.ripple) {
2803
+ _this.input.ripple.deactivate();
2804
+ }
2805
+ },
2806
+ deregisterInteractionHandler: function (evtType, handler) {
2807
+ var labelEl = _this.labelEl();
2808
+ if (labelEl) {
2809
+ labelEl.removeEventListener(evtType, handler);
2810
+ }
2811
+ },
2812
+ registerInteractionHandler: function (evtType, handler) {
2813
+ var labelEl = _this.labelEl();
2814
+ if (labelEl) {
2815
+ labelEl.addEventListener(evtType, handler);
2816
+ }
2817
+ },
2818
+ };
2819
+ return new MDCFormFieldFoundation(adapter);
2820
+ };
2821
+ return MDCFormField;
2822
+ }(MDCComponent));
2823
+
2824
+ /**
2825
+ * Instantiates Material Design text field component.
2826
+ * @param el - Must be the f-component wrapper (.f-text-field)
2827
+ * @see https://material-components.github.io/material-components-web-catalog/#/component/text-field
2828
+ */
2829
+ function FTextFieldMDC(el) {
2830
+ const component = new MDCTextField(el.querySelector('.mdc-text-field'));
2831
+ const form = el.querySelector('.mdc-form-field');
2832
+ const helper = el.querySelector('.mdc-text-field-helper-text');
2833
+ const counter = el.querySelector('.mdc-text-field-character-counter');
2834
+ const icon = el.querySelector('.mdc-text-field-icon');
2835
+ if (form) {
2836
+ const formField = MDCFormField.attachTo(form);
2837
+ if (formField) {
2838
+ formField.input = component;
2839
+ }
2840
+ }
2841
+ if (helper) {
2842
+ new MDCTextFieldHelperText(helper);
2843
+ }
2844
+ if (counter) {
2845
+ new MDCTextFieldCharacterCounter(counter);
2846
+ }
2847
+ if (icon) {
2848
+ new MDCTextFieldIcon(icon);
2849
+ }
2850
+ }
2851
+
2852
+ exports.FTextFieldMDC = FTextFieldMDC;