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