@sme.up/ketchup 5.2.0-SNAPSHOT → 5.2.1-SNAPSHOT

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