wcs-core 2.5.4 → 2.6.0

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 (221) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/README.md +1 -1
  3. package/dist/cjs/component-fc28ed16.js +1074 -0
  4. package/dist/cjs/helpers-d9aaa8c4.js +81 -0
  5. package/dist/cjs/{index-e05c3e1f.js → index-3cb9d725.js} +165 -87
  6. package/dist/cjs/loader.cjs.js +3 -3
  7. package/dist/{esm/wcs-action-bar_47.entry.js → cjs/lodash-776d6f03.js} +12499 -22628
  8. package/dist/cjs/select-arrow-76ccf86d.js +36 -0
  9. package/dist/cjs/wcs-action-bar.cjs.entry.js +24 -0
  10. package/dist/cjs/wcs-app.cjs.entry.js +2 -2
  11. package/dist/cjs/wcs-badge.cjs.entry.js +27 -0
  12. package/dist/cjs/wcs-button.cjs.entry.js +86 -0
  13. package/dist/cjs/wcs-card-body.cjs.entry.js +19 -0
  14. package/dist/cjs/wcs-card.cjs.entry.js +20 -0
  15. package/dist/cjs/wcs-checkbox.cjs.entry.js +43 -0
  16. package/dist/cjs/wcs-com-nav-category.cjs.entry.js +63 -0
  17. package/dist/cjs/wcs-com-nav-submenu.cjs.entry.js +69 -0
  18. package/dist/cjs/wcs-com-nav.cjs.entry.js +19 -0
  19. package/dist/cjs/wcs-divider.cjs.entry.js +19 -0
  20. package/dist/cjs/wcs-dropdown-item.cjs.entry.js +23 -0
  21. package/dist/cjs/wcs-dropdown.cjs.entry.js +57 -0
  22. package/dist/cjs/wcs-editable-field.cjs.entry.js +225 -0
  23. package/dist/cjs/wcs-error_2.cjs.entry.js +137 -0
  24. package/dist/cjs/wcs-field-content.cjs.entry.js +16 -0
  25. package/dist/cjs/wcs-field-label.cjs.entry.js +16 -0
  26. package/dist/cjs/wcs-field.cjs.entry.js +19 -0
  27. package/dist/cjs/wcs-footer.cjs.entry.js +19 -0
  28. package/dist/cjs/wcs-galactic-menu.cjs.entry.js +1785 -0
  29. package/dist/cjs/wcs-galactic.cjs.entry.js +41 -0
  30. package/dist/cjs/wcs-grid-column.cjs.entry.js +73 -0
  31. package/dist/cjs/wcs-grid-custom-cell.cjs.entry.js +16 -0
  32. package/dist/cjs/wcs-grid-pagination.cjs.entry.js +4 -4
  33. package/dist/cjs/wcs-grid.cjs.entry.js +309 -0
  34. package/dist/cjs/wcs-header.cjs.entry.js +25 -0
  35. package/dist/cjs/wcs-hint.cjs.entry.js +20 -0
  36. package/dist/cjs/wcs-horizontal-stepper.cjs.entry.js +114 -0
  37. package/dist/cjs/wcs-icon.cjs.entry.js +2 -2
  38. package/dist/cjs/wcs-input.cjs.entry.js +228 -0
  39. package/dist/cjs/wcs-label.cjs.entry.js +20 -0
  40. package/dist/cjs/wcs-list-item-properties.cjs.entry.js +19 -0
  41. package/dist/cjs/wcs-list-item-property.cjs.entry.js +19 -0
  42. package/dist/cjs/wcs-list-item.cjs.entry.js +23 -0
  43. package/dist/cjs/wcs-mat-icon.cjs.entry.js +73 -0
  44. package/dist/cjs/wcs-modal.cjs.entry.js +45 -0
  45. package/dist/cjs/wcs-nav-item.cjs.entry.js +23 -0
  46. package/dist/cjs/wcs-nav.cjs.entry.js +19 -0
  47. package/dist/cjs/wcs-progress-bar.cjs.entry.js +47 -0
  48. package/dist/cjs/wcs-progress-radial.cjs.entry.js +30 -0
  49. package/dist/cjs/wcs-radio-group.cjs.entry.js +65 -0
  50. package/dist/cjs/wcs-radio.cjs.entry.js +49 -0
  51. package/dist/cjs/wcs-select_2.cjs.entry.js +4916 -0
  52. package/dist/cjs/wcs-spinner.cjs.entry.js +21 -0
  53. package/dist/cjs/wcs-switch.cjs.entry.js +34 -0
  54. package/dist/cjs/wcs-tab.cjs.entry.js +20 -0
  55. package/dist/cjs/wcs-tabs.cjs.entry.js +159 -0
  56. package/dist/cjs/wcs-textarea.cjs.entry.js +224 -0
  57. package/dist/cjs/wcs-tooltip.cjs.entry.js +129 -0
  58. package/dist/cjs/wcs.cjs.js +3 -3
  59. package/dist/collection/collection-manifest.json +3 -2
  60. package/dist/collection/components/button/button.css +79 -75
  61. package/dist/collection/components/button/button.js +23 -11
  62. package/dist/collection/components/com-nav/com-nav.css +1 -2
  63. package/dist/collection/components/com-nav-category/com-nav-category.css +5 -6
  64. package/dist/collection/components/com-nav-category/com-nav-category.js +31 -1
  65. package/dist/collection/components/com-nav-submenu/com-nav-submenu.css +1 -2
  66. package/dist/collection/components/com-nav-submenu/com-nav-submenu.js +21 -1
  67. package/dist/collection/components/footer/footer.css +1 -1
  68. package/dist/collection/components/grid/grid.js +47 -8
  69. package/dist/collection/components/grid-column/grid-column.css +5 -0
  70. package/dist/collection/components/grid-column/grid-column.js +62 -2
  71. package/dist/collection/components/grid-custom-cell/grid-custom-cell.js +45 -0
  72. package/dist/collection/components/grid-pagination/grid-pagination.js +4 -4
  73. package/dist/collection/components/header/header.css +1 -1
  74. package/dist/collection/components/input/input.js +2 -2
  75. package/dist/collection/components/select/select.css +81 -77
  76. package/dist/collection/components/select/select.js +2 -2
  77. package/dist/collection/components/select-option/select-option.css +79 -75
  78. package/dist/collection/components/select-option/select-option.js +6 -7
  79. package/dist/collection/components/tab/tab.js +4 -4
  80. package/dist/collection/components/tabs/tabs.js +1 -1
  81. package/dist/collection/components/textarea/textarea.js +2 -2
  82. package/dist/collection/components/tooltip/tooltip.js +2 -2
  83. package/dist/esm/component-6b4d470f.js +1072 -0
  84. package/dist/esm/helpers-50436c51.js +73 -0
  85. package/dist/esm/{index-c619b1fa.js → index-b982604a.js} +165 -88
  86. package/dist/esm/loader.js +3 -3
  87. package/dist/{cjs/wcs-action-bar_47.cjs.entry.js → esm/lodash-d6d9d079.js} +12610 -22791
  88. package/dist/esm/select-arrow-73ac4016.js +34 -0
  89. package/dist/esm/wcs-action-bar.entry.js +20 -0
  90. package/dist/esm/wcs-app.entry.js +2 -2
  91. package/dist/esm/wcs-badge.entry.js +23 -0
  92. package/dist/esm/wcs-button.entry.js +82 -0
  93. package/dist/esm/wcs-card-body.entry.js +15 -0
  94. package/dist/esm/wcs-card.entry.js +16 -0
  95. package/dist/esm/wcs-checkbox.entry.js +39 -0
  96. package/dist/esm/wcs-com-nav-category.entry.js +59 -0
  97. package/dist/esm/wcs-com-nav-submenu.entry.js +65 -0
  98. package/dist/esm/wcs-com-nav.entry.js +15 -0
  99. package/dist/esm/wcs-divider.entry.js +15 -0
  100. package/dist/esm/wcs-dropdown-item.entry.js +19 -0
  101. package/dist/esm/wcs-dropdown.entry.js +53 -0
  102. package/dist/esm/wcs-editable-field.entry.js +221 -0
  103. package/dist/esm/wcs-error_2.entry.js +132 -0
  104. package/dist/esm/wcs-field-content.entry.js +12 -0
  105. package/dist/esm/wcs-field-label.entry.js +12 -0
  106. package/dist/esm/wcs-field.entry.js +15 -0
  107. package/dist/esm/wcs-footer.entry.js +15 -0
  108. package/dist/esm/wcs-galactic-menu.entry.js +1781 -0
  109. package/dist/esm/wcs-galactic.entry.js +37 -0
  110. package/dist/esm/wcs-grid-column.entry.js +69 -0
  111. package/dist/esm/wcs-grid-custom-cell.entry.js +12 -0
  112. package/dist/esm/wcs-grid-pagination.entry.js +4 -4
  113. package/dist/esm/wcs-grid.entry.js +305 -0
  114. package/dist/esm/wcs-header.entry.js +21 -0
  115. package/dist/esm/wcs-hint.entry.js +16 -0
  116. package/dist/esm/wcs-horizontal-stepper.entry.js +110 -0
  117. package/dist/esm/wcs-icon.entry.js +2 -2
  118. package/dist/esm/wcs-input.entry.js +224 -0
  119. package/dist/esm/wcs-label.entry.js +16 -0
  120. package/dist/esm/wcs-list-item-properties.entry.js +15 -0
  121. package/dist/esm/wcs-list-item-property.entry.js +15 -0
  122. package/dist/esm/wcs-list-item.entry.js +19 -0
  123. package/dist/esm/wcs-mat-icon.entry.js +69 -0
  124. package/dist/esm/wcs-modal.entry.js +41 -0
  125. package/dist/esm/wcs-nav-item.entry.js +19 -0
  126. package/dist/esm/wcs-nav.entry.js +15 -0
  127. package/dist/esm/wcs-progress-bar.entry.js +43 -0
  128. package/dist/esm/wcs-progress-radial.entry.js +26 -0
  129. package/dist/esm/wcs-radio-group.entry.js +61 -0
  130. package/dist/esm/wcs-radio.entry.js +45 -0
  131. package/dist/esm/wcs-select_2.entry.js +4911 -0
  132. package/dist/esm/wcs-spinner.entry.js +17 -0
  133. package/dist/esm/wcs-switch.entry.js +30 -0
  134. package/dist/esm/wcs-tab.entry.js +16 -0
  135. package/dist/esm/wcs-tabs.entry.js +155 -0
  136. package/dist/esm/wcs-textarea.entry.js +220 -0
  137. package/dist/esm/wcs-tooltip.entry.js +125 -0
  138. package/dist/esm/wcs.js +3 -3
  139. package/dist/types/components/button/button.d.ts +7 -3
  140. package/dist/types/components/com-nav-category/com-nav-category.d.ts +7 -0
  141. package/dist/types/components/com-nav-submenu/com-nav-submenu.d.ts +7 -0
  142. package/dist/types/components/grid/grid.d.ts +7 -0
  143. package/dist/types/components/grid-column/grid-column.d.ts +4 -0
  144. package/dist/types/components/grid-custom-cell/grid-custom-cell.d.ts +12 -0
  145. package/dist/types/components/select-option/select-option.d.ts +2 -0
  146. package/dist/types/components.d.ts +43 -0
  147. package/dist/types/stencil-public-runtime.d.ts +183 -182
  148. package/dist/wcs/p-03b2e238.entry.js +1 -0
  149. package/dist/wcs/p-0fbe574e.entry.js +1 -0
  150. package/dist/wcs/p-15008e35.entry.js +1 -0
  151. package/dist/wcs/p-16dfbae8.js +127 -0
  152. package/dist/wcs/p-17c6db7f.entry.js +1 -0
  153. package/dist/wcs/p-1dce7e63.entry.js +1 -0
  154. package/dist/wcs/p-1f5aed36.entry.js +1 -0
  155. package/dist/wcs/p-214236db.entry.js +1 -0
  156. package/dist/wcs/p-26b5c0a3.entry.js +1 -0
  157. package/dist/wcs/p-2e6265dc.entry.js +1 -0
  158. package/dist/wcs/p-356a8e3b.entry.js +1 -0
  159. package/dist/wcs/p-3d10b02a.entry.js +15 -0
  160. package/dist/wcs/p-4338f140.entry.js +1 -0
  161. package/dist/wcs/p-474d6601.entry.js +1 -0
  162. package/dist/wcs/p-55fdc284.entry.js +1 -0
  163. package/dist/wcs/p-5b35b232.entry.js +1 -0
  164. package/dist/wcs/p-600a9cc0.entry.js +1 -0
  165. package/dist/wcs/p-60b51967.entry.js +1 -0
  166. package/dist/wcs/p-62f7ab6d.entry.js +1 -0
  167. package/dist/wcs/p-64523291.entry.js +1 -0
  168. package/dist/wcs/p-65c5ccc5.entry.js +1 -0
  169. package/dist/wcs/p-688fea65.entry.js +1 -0
  170. package/dist/wcs/p-716d5921.entry.js +1 -0
  171. package/dist/wcs/p-7219c04b.js +1 -0
  172. package/dist/wcs/p-8137f075.entry.js +1 -0
  173. package/dist/wcs/p-83f1ad32.js +1 -0
  174. package/dist/wcs/p-8864a491.entry.js +1 -0
  175. package/dist/wcs/p-8f0f9868.entry.js +1 -0
  176. package/dist/wcs/p-91a2de07.entry.js +1 -0
  177. package/dist/wcs/p-94a31f64.entry.js +1 -0
  178. package/dist/wcs/p-979dfd78.entry.js +1 -0
  179. package/dist/wcs/p-9ba52bc4.entry.js +1 -0
  180. package/dist/wcs/p-a1ee1551.entry.js +1 -0
  181. package/dist/wcs/p-a5a1b27c.entry.js +1 -0
  182. package/dist/wcs/p-adef7aaf.js +1 -0
  183. package/dist/wcs/p-af1a5e52.entry.js +1 -0
  184. package/dist/wcs/p-b7184d59.entry.js +1 -0
  185. package/dist/wcs/p-bef44630.entry.js +1 -0
  186. package/dist/wcs/p-d59b4495.entry.js +1 -0
  187. package/dist/wcs/p-db68379f.entry.js +1 -0
  188. package/dist/wcs/p-dbbc3f58.entry.js +1 -0
  189. package/dist/wcs/p-dc817204.entry.js +1 -0
  190. package/dist/wcs/p-dd300dea.entry.js +1 -0
  191. package/dist/wcs/p-e0163de8.entry.js +1 -0
  192. package/dist/wcs/p-e4236d32.entry.js +1 -0
  193. package/dist/wcs/p-e43358e4.entry.js +1 -0
  194. package/dist/wcs/p-e486647c.entry.js +1 -0
  195. package/dist/wcs/p-e9ce507c.entry.js +1 -0
  196. package/dist/wcs/p-ed6e8541.entry.js +1 -0
  197. package/dist/wcs/p-f46e6c3c.js +1 -0
  198. package/dist/wcs/p-f9944bde.entry.js +1 -0
  199. package/dist/wcs/p-fa173947.entry.js +1 -0
  200. package/dist/wcs/p-fb1577b5.entry.js +1 -0
  201. package/dist/wcs/p-febe9ccc.entry.js +1 -0
  202. package/dist/wcs/wcs.esm.js +1 -1
  203. package/loader/index.d.ts +0 -1
  204. package/package.json +22 -20
  205. package/dist/wcs/p-16dca526.entry.js +0 -1
  206. package/dist/wcs/p-4f228fcb.entry.js +0 -134
  207. package/dist/wcs/p-66520e5a.entry.js +0 -1
  208. package/dist/wcs/p-d31287c6.entry.js +0 -1
  209. package/dist/wcs/p-f73f235b.js +0 -1
  210. package/schematics/.gitignore +0 -18
  211. package/schematics/.npmignore +0 -4
  212. package/schematics/collection.json +0 -9
  213. package/schematics/src/ng-add/files/fonts/avenir-black.woff +0 -0
  214. package/schematics/src/ng-add/files/fonts/avenir-book.woff +0 -0
  215. package/schematics/src/ng-add/files/fonts/avenir-lighter.woff +0 -0
  216. package/schematics/src/ng-add/files/fonts/avenir-medium.woff +0 -0
  217. package/schematics/src/ng-add/files/sncf-logo.png +0 -0
  218. package/schematics/src/ng-add/index.d.ts +0 -3
  219. package/schematics/src/ng-add/index.js +0 -119
  220. package/schematics/src/ng-add/index.js.map +0 -1
  221. package/schematics/src/ng-add/schema.json +0 -5
@@ -0,0 +1,1074 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * Stores result from supportsCssVariables to avoid redundant processing to
5
+ * detect CSS custom variable support.
6
+ */
7
+ var supportsCssVariables_;
8
+ function supportsCssVariables(windowObj, forceRefresh) {
9
+ if (forceRefresh === void 0) { forceRefresh = false; }
10
+ var CSS = windowObj.CSS;
11
+ var supportsCssVars = supportsCssVariables_;
12
+ if (typeof supportsCssVariables_ === 'boolean' && !forceRefresh) {
13
+ return supportsCssVariables_;
14
+ }
15
+ var supportsFunctionPresent = CSS && typeof CSS.supports === 'function';
16
+ if (!supportsFunctionPresent) {
17
+ return false;
18
+ }
19
+ var explicitlySupportsCssVars = CSS.supports('--css-vars', 'yes');
20
+ // See: https://bugs.webkit.org/show_bug.cgi?id=154669
21
+ // See: README section on Safari
22
+ var weAreFeatureDetectingSafari10plus = (CSS.supports('(--css-vars: yes)') &&
23
+ CSS.supports('color', '#00000000'));
24
+ supportsCssVars =
25
+ explicitlySupportsCssVars || weAreFeatureDetectingSafari10plus;
26
+ if (!forceRefresh) {
27
+ supportsCssVariables_ = supportsCssVars;
28
+ }
29
+ return supportsCssVars;
30
+ }
31
+ function getNormalizedEventCoords(evt, pageOffset, clientRect) {
32
+ if (!evt) {
33
+ return { x: 0, y: 0 };
34
+ }
35
+ var x = pageOffset.x, y = pageOffset.y;
36
+ var documentX = x + clientRect.left;
37
+ var documentY = y + clientRect.top;
38
+ var normalizedX;
39
+ var normalizedY;
40
+ // Determine touch point relative to the ripple container.
41
+ if (evt.type === 'touchstart') {
42
+ var touchEvent = evt;
43
+ normalizedX = touchEvent.changedTouches[0].pageX - documentX;
44
+ normalizedY = touchEvent.changedTouches[0].pageY - documentY;
45
+ }
46
+ else {
47
+ var mouseEvent = evt;
48
+ normalizedX = mouseEvent.pageX - documentX;
49
+ normalizedY = mouseEvent.pageY - documentY;
50
+ }
51
+ return { x: normalizedX, y: normalizedY };
52
+ }
53
+
54
+ /*! *****************************************************************************
55
+ Copyright (c) Microsoft Corporation.
56
+
57
+ Permission to use, copy, modify, and/or distribute this software for any
58
+ purpose with or without fee is hereby granted.
59
+
60
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
61
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
62
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
63
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
64
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
65
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
66
+ PERFORMANCE OF THIS SOFTWARE.
67
+ ***************************************************************************** */
68
+ /* global Reflect, Promise */
69
+
70
+ var extendStatics = function(d, b) {
71
+ extendStatics = Object.setPrototypeOf ||
72
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
73
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
74
+ return extendStatics(d, b);
75
+ };
76
+
77
+ function __extends(d, b) {
78
+ if (typeof b !== "function" && b !== null)
79
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
80
+ extendStatics(d, b);
81
+ function __() { this.constructor = d; }
82
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
83
+ }
84
+
85
+ var __assign = function() {
86
+ __assign = Object.assign || function __assign(t) {
87
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
88
+ s = arguments[i];
89
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
90
+ }
91
+ return t;
92
+ };
93
+ return __assign.apply(this, arguments);
94
+ };
95
+
96
+ function __values(o) {
97
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
98
+ if (m) return m.call(o);
99
+ if (o && typeof o.length === "number") return {
100
+ next: function () {
101
+ if (o && i >= o.length) o = void 0;
102
+ return { value: o && o[i++], done: !o };
103
+ }
104
+ };
105
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
106
+ }
107
+
108
+ function __read(o, n) {
109
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
110
+ if (!m) return o;
111
+ var i = m.call(o), r, ar = [], e;
112
+ try {
113
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
114
+ }
115
+ catch (error) { e = { error: error }; }
116
+ finally {
117
+ try {
118
+ if (r && !r.done && (m = i["return"])) m.call(i);
119
+ }
120
+ finally { if (e) throw e.error; }
121
+ }
122
+ return ar;
123
+ }
124
+
125
+ function __spreadArray(to, from, pack) {
126
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
127
+ if (ar || !(i in from)) {
128
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
129
+ ar[i] = from[i];
130
+ }
131
+ }
132
+ return to.concat(ar || Array.prototype.slice.call(from));
133
+ }
134
+
135
+ /**
136
+ * @license
137
+ * Copyright 2016 Google Inc.
138
+ *
139
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
140
+ * of this software and associated documentation files (the "Software"), to deal
141
+ * in the Software without restriction, including without limitation the rights
142
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
143
+ * copies of the Software, and to permit persons to whom the Software is
144
+ * furnished to do so, subject to the following conditions:
145
+ *
146
+ * The above copyright notice and this permission notice shall be included in
147
+ * all copies or substantial portions of the Software.
148
+ *
149
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
150
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
151
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
152
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
153
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
154
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
155
+ * THE SOFTWARE.
156
+ */
157
+ var MDCFoundation = /** @class */ (function () {
158
+ function MDCFoundation(adapter) {
159
+ if (adapter === void 0) { adapter = {}; }
160
+ this.adapter = adapter;
161
+ }
162
+ Object.defineProperty(MDCFoundation, "cssClasses", {
163
+ get: function () {
164
+ // Classes extending MDCFoundation should implement this method to return an object which exports every
165
+ // CSS class the foundation class needs as a property. e.g. {ACTIVE: 'mdc-component--active'}
166
+ return {};
167
+ },
168
+ enumerable: false,
169
+ configurable: true
170
+ });
171
+ Object.defineProperty(MDCFoundation, "strings", {
172
+ get: function () {
173
+ // Classes extending MDCFoundation should implement this method to return an object which exports all
174
+ // semantic strings as constants. e.g. {ARIA_ROLE: 'tablist'}
175
+ return {};
176
+ },
177
+ enumerable: false,
178
+ configurable: true
179
+ });
180
+ Object.defineProperty(MDCFoundation, "numbers", {
181
+ get: function () {
182
+ // Classes extending MDCFoundation should implement this method to return an object which exports all
183
+ // of its semantic numbers as constants. e.g. {ANIMATION_DELAY_MS: 350}
184
+ return {};
185
+ },
186
+ enumerable: false,
187
+ configurable: true
188
+ });
189
+ Object.defineProperty(MDCFoundation, "defaultAdapter", {
190
+ get: function () {
191
+ // Classes extending MDCFoundation may choose to implement this getter in order to provide a convenient
192
+ // way of viewing the necessary methods of an adapter. In the future, this could also be used for adapter
193
+ // validation.
194
+ return {};
195
+ },
196
+ enumerable: false,
197
+ configurable: true
198
+ });
199
+ MDCFoundation.prototype.init = function () {
200
+ // Subclasses should override this method to perform initialization routines (registering events, etc.)
201
+ };
202
+ MDCFoundation.prototype.destroy = function () {
203
+ // Subclasses should override this method to perform de-initialization routines (de-registering events, etc.)
204
+ };
205
+ return MDCFoundation;
206
+ }());
207
+
208
+ /**
209
+ * @license
210
+ * Copyright 2016 Google Inc.
211
+ *
212
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
213
+ * of this software and associated documentation files (the "Software"), to deal
214
+ * in the Software without restriction, including without limitation the rights
215
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
216
+ * copies of the Software, and to permit persons to whom the Software is
217
+ * furnished to do so, subject to the following conditions:
218
+ *
219
+ * The above copyright notice and this permission notice shall be included in
220
+ * all copies or substantial portions of the Software.
221
+ *
222
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
223
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
224
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
225
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
226
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
227
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
228
+ * THE SOFTWARE.
229
+ */
230
+ var MDCComponent = /** @class */ (function () {
231
+ function MDCComponent(root, foundation) {
232
+ var args = [];
233
+ for (var _i = 2; _i < arguments.length; _i++) {
234
+ args[_i - 2] = arguments[_i];
235
+ }
236
+ this.root = root;
237
+ this.initialize.apply(this, __spreadArray([], __read(args)));
238
+ // Note that we initialize foundation here and not within the constructor's
239
+ // default param so that this.root is defined and can be used within the
240
+ // foundation class.
241
+ this.foundation =
242
+ foundation === undefined ? this.getDefaultFoundation() : foundation;
243
+ this.foundation.init();
244
+ this.initialSyncWithDOM();
245
+ }
246
+ MDCComponent.attachTo = function (root) {
247
+ // Subclasses which extend MDCBase should provide an attachTo() method that takes a root element and
248
+ // returns an instantiated component with its root set to that element. Also note that in the cases of
249
+ // subclasses, an explicit foundation class will not have to be passed in; it will simply be initialized
250
+ // from getDefaultFoundation().
251
+ return new MDCComponent(root, new MDCFoundation({}));
252
+ };
253
+ /* istanbul ignore next: method param only exists for typing purposes; it does not need to be unit tested */
254
+ MDCComponent.prototype.initialize = function () {
255
+ var _args = [];
256
+ for (var _i = 0; _i < arguments.length; _i++) {
257
+ _args[_i] = arguments[_i];
258
+ }
259
+ // Subclasses can override this to do any additional setup work that would be considered part of a
260
+ // "constructor". Essentially, it is a hook into the parent constructor before the foundation is
261
+ // initialized. Any additional arguments besides root and foundation will be passed in here.
262
+ };
263
+ MDCComponent.prototype.getDefaultFoundation = function () {
264
+ // Subclasses must override this method to return a properly configured foundation class for the
265
+ // component.
266
+ throw new Error('Subclasses must override getDefaultFoundation to return a properly configured ' +
267
+ 'foundation class');
268
+ };
269
+ MDCComponent.prototype.initialSyncWithDOM = function () {
270
+ // Subclasses should override this method if they need to perform work to synchronize with a host DOM
271
+ // object. An example of this would be a form control wrapper that needs to synchronize its internal state
272
+ // to some property or attribute of the host DOM. Please note: this is *not* the place to perform DOM
273
+ // reads/writes that would cause layout / paint, as this is called synchronously from within the constructor.
274
+ };
275
+ MDCComponent.prototype.destroy = function () {
276
+ // Subclasses may implement this method to release any resources / deregister any listeners they have
277
+ // attached. An example of this might be deregistering a resize event from the window object.
278
+ this.foundation.destroy();
279
+ };
280
+ MDCComponent.prototype.listen = function (evtType, handler, options) {
281
+ this.root.addEventListener(evtType, handler, options);
282
+ };
283
+ MDCComponent.prototype.unlisten = function (evtType, handler, options) {
284
+ this.root.removeEventListener(evtType, handler, options);
285
+ };
286
+ /**
287
+ * Fires a cross-browser-compatible custom event from the component root of the given type, with the given data.
288
+ */
289
+ MDCComponent.prototype.emit = function (evtType, evtData, shouldBubble) {
290
+ if (shouldBubble === void 0) { shouldBubble = false; }
291
+ var evt;
292
+ if (typeof CustomEvent === 'function') {
293
+ evt = new CustomEvent(evtType, {
294
+ bubbles: shouldBubble,
295
+ detail: evtData,
296
+ });
297
+ }
298
+ else {
299
+ evt = document.createEvent('CustomEvent');
300
+ evt.initCustomEvent(evtType, shouldBubble, false, evtData);
301
+ }
302
+ this.root.dispatchEvent(evt);
303
+ };
304
+ return MDCComponent;
305
+ }());
306
+
307
+ /**
308
+ * @license
309
+ * Copyright 2019 Google Inc.
310
+ *
311
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
312
+ * of this software and associated documentation files (the "Software"), to deal
313
+ * in the Software without restriction, including without limitation the rights
314
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
315
+ * copies of the Software, and to permit persons to whom the Software is
316
+ * furnished to do so, subject to the following conditions:
317
+ *
318
+ * The above copyright notice and this permission notice shall be included in
319
+ * all copies or substantial portions of the Software.
320
+ *
321
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
322
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
323
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
324
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
325
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
326
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
327
+ * THE SOFTWARE.
328
+ */
329
+ /**
330
+ * Determine whether the current browser supports passive event listeners, and
331
+ * if so, use them.
332
+ */
333
+ function applyPassive(globalObj) {
334
+ if (globalObj === void 0) { globalObj = window; }
335
+ return supportsPassiveOption(globalObj) ?
336
+ { passive: true } :
337
+ false;
338
+ }
339
+ function supportsPassiveOption(globalObj) {
340
+ if (globalObj === void 0) { globalObj = window; }
341
+ // See
342
+ // https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener
343
+ var passiveSupported = false;
344
+ try {
345
+ var options = {
346
+ // This function will be called when the browser
347
+ // attempts to access the passive property.
348
+ get passive() {
349
+ passiveSupported = true;
350
+ return false;
351
+ }
352
+ };
353
+ var handler = function () { };
354
+ globalObj.document.addEventListener('test', handler, options);
355
+ globalObj.document.removeEventListener('test', handler, options);
356
+ }
357
+ catch (err) {
358
+ passiveSupported = false;
359
+ }
360
+ return passiveSupported;
361
+ }
362
+
363
+ /**
364
+ * @license
365
+ * Copyright 2018 Google Inc.
366
+ *
367
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
368
+ * of this software and associated documentation files (the "Software"), to deal
369
+ * in the Software without restriction, including without limitation the rights
370
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
371
+ * copies of the Software, and to permit persons to whom the Software is
372
+ * furnished to do so, subject to the following conditions:
373
+ *
374
+ * The above copyright notice and this permission notice shall be included in
375
+ * all copies or substantial portions of the Software.
376
+ *
377
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
378
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
379
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
380
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
381
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
382
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
383
+ * THE SOFTWARE.
384
+ */
385
+ function matches(element, selector) {
386
+ var nativeMatches = element.matches
387
+ || element.webkitMatchesSelector
388
+ || element.msMatchesSelector;
389
+ return nativeMatches.call(element, selector);
390
+ }
391
+
392
+ /**
393
+ * @license
394
+ * Copyright 2016 Google Inc.
395
+ *
396
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
397
+ * of this software and associated documentation files (the "Software"), to deal
398
+ * in the Software without restriction, including without limitation the rights
399
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
400
+ * copies of the Software, and to permit persons to whom the Software is
401
+ * furnished to do so, subject to the following conditions:
402
+ *
403
+ * The above copyright notice and this permission notice shall be included in
404
+ * all copies or substantial portions of the Software.
405
+ *
406
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
407
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
408
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
409
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
410
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
411
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
412
+ * THE SOFTWARE.
413
+ */
414
+ var cssClasses = {
415
+ // Ripple is a special case where the "root" component is really a "mixin" of sorts,
416
+ // given that it's an 'upgrade' to an existing component. That being said it is the root
417
+ // CSS class that all other CSS classes derive from.
418
+ BG_FOCUSED: 'mdc-ripple-upgraded--background-focused',
419
+ FG_ACTIVATION: 'mdc-ripple-upgraded--foreground-activation',
420
+ FG_DEACTIVATION: 'mdc-ripple-upgraded--foreground-deactivation',
421
+ ROOT: 'mdc-ripple-upgraded',
422
+ UNBOUNDED: 'mdc-ripple-upgraded--unbounded',
423
+ };
424
+ var strings = {
425
+ VAR_FG_SCALE: '--mdc-ripple-fg-scale',
426
+ VAR_FG_SIZE: '--mdc-ripple-fg-size',
427
+ VAR_FG_TRANSLATE_END: '--mdc-ripple-fg-translate-end',
428
+ VAR_FG_TRANSLATE_START: '--mdc-ripple-fg-translate-start',
429
+ VAR_LEFT: '--mdc-ripple-left',
430
+ VAR_TOP: '--mdc-ripple-top',
431
+ };
432
+ var numbers = {
433
+ DEACTIVATION_TIMEOUT_MS: 225,
434
+ FG_DEACTIVATION_MS: 150,
435
+ INITIAL_ORIGIN_SCALE: 0.6,
436
+ PADDING: 10,
437
+ TAP_DELAY_MS: 300, // Delay between touch and simulated mouse events on touch devices
438
+ };
439
+
440
+ /**
441
+ * @license
442
+ * Copyright 2016 Google Inc.
443
+ *
444
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
445
+ * of this software and associated documentation files (the "Software"), to deal
446
+ * in the Software without restriction, including without limitation the rights
447
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
448
+ * copies of the Software, and to permit persons to whom the Software is
449
+ * furnished to do so, subject to the following conditions:
450
+ *
451
+ * The above copyright notice and this permission notice shall be included in
452
+ * all copies or substantial portions of the Software.
453
+ *
454
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
455
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
456
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
457
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
458
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
459
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
460
+ * THE SOFTWARE.
461
+ */
462
+ // Activation events registered on the root element of each instance for activation
463
+ var ACTIVATION_EVENT_TYPES = [
464
+ 'touchstart', 'pointerdown', 'mousedown', 'keydown',
465
+ ];
466
+ // Deactivation events registered on documentElement when a pointer-related down event occurs
467
+ var POINTER_DEACTIVATION_EVENT_TYPES = [
468
+ 'touchend', 'pointerup', 'mouseup', 'contextmenu',
469
+ ];
470
+ // simultaneous nested activations
471
+ var activatedTargets = [];
472
+ var MDCRippleFoundation = /** @class */ (function (_super) {
473
+ __extends(MDCRippleFoundation, _super);
474
+ function MDCRippleFoundation(adapter) {
475
+ var _this = _super.call(this, __assign(__assign({}, MDCRippleFoundation.defaultAdapter), adapter)) || this;
476
+ _this.activationAnimationHasEnded = false;
477
+ _this.activationTimer = 0;
478
+ _this.fgDeactivationRemovalTimer = 0;
479
+ _this.fgScale = '0';
480
+ _this.frame = { width: 0, height: 0 };
481
+ _this.initialSize = 0;
482
+ _this.layoutFrame = 0;
483
+ _this.maxRadius = 0;
484
+ _this.unboundedCoords = { left: 0, top: 0 };
485
+ _this.activationState = _this.defaultActivationState();
486
+ _this.activationTimerCallback = function () {
487
+ _this.activationAnimationHasEnded = true;
488
+ _this.runDeactivationUXLogicIfReady();
489
+ };
490
+ _this.activateHandler = function (e) {
491
+ _this.activateImpl(e);
492
+ };
493
+ _this.deactivateHandler = function () {
494
+ _this.deactivateImpl();
495
+ };
496
+ _this.focusHandler = function () {
497
+ _this.handleFocus();
498
+ };
499
+ _this.blurHandler = function () {
500
+ _this.handleBlur();
501
+ };
502
+ _this.resizeHandler = function () {
503
+ _this.layout();
504
+ };
505
+ return _this;
506
+ }
507
+ Object.defineProperty(MDCRippleFoundation, "cssClasses", {
508
+ get: function () {
509
+ return cssClasses;
510
+ },
511
+ enumerable: false,
512
+ configurable: true
513
+ });
514
+ Object.defineProperty(MDCRippleFoundation, "strings", {
515
+ get: function () {
516
+ return strings;
517
+ },
518
+ enumerable: false,
519
+ configurable: true
520
+ });
521
+ Object.defineProperty(MDCRippleFoundation, "numbers", {
522
+ get: function () {
523
+ return numbers;
524
+ },
525
+ enumerable: false,
526
+ configurable: true
527
+ });
528
+ Object.defineProperty(MDCRippleFoundation, "defaultAdapter", {
529
+ get: function () {
530
+ return {
531
+ addClass: function () { return undefined; },
532
+ browserSupportsCssVars: function () { return true; },
533
+ computeBoundingRect: function () {
534
+ return ({ top: 0, right: 0, bottom: 0, left: 0, width: 0, height: 0 });
535
+ },
536
+ containsEventTarget: function () { return true; },
537
+ deregisterDocumentInteractionHandler: function () { return undefined; },
538
+ deregisterInteractionHandler: function () { return undefined; },
539
+ deregisterResizeHandler: function () { return undefined; },
540
+ getWindowPageOffset: function () { return ({ x: 0, y: 0 }); },
541
+ isSurfaceActive: function () { return true; },
542
+ isSurfaceDisabled: function () { return true; },
543
+ isUnbounded: function () { return true; },
544
+ registerDocumentInteractionHandler: function () { return undefined; },
545
+ registerInteractionHandler: function () { return undefined; },
546
+ registerResizeHandler: function () { return undefined; },
547
+ removeClass: function () { return undefined; },
548
+ updateCssVariable: function () { return undefined; },
549
+ };
550
+ },
551
+ enumerable: false,
552
+ configurable: true
553
+ });
554
+ MDCRippleFoundation.prototype.init = function () {
555
+ var _this = this;
556
+ var supportsPressRipple = this.supportsPressRipple();
557
+ this.registerRootHandlers(supportsPressRipple);
558
+ if (supportsPressRipple) {
559
+ var _a = MDCRippleFoundation.cssClasses, ROOT_1 = _a.ROOT, UNBOUNDED_1 = _a.UNBOUNDED;
560
+ requestAnimationFrame(function () {
561
+ _this.adapter.addClass(ROOT_1);
562
+ if (_this.adapter.isUnbounded()) {
563
+ _this.adapter.addClass(UNBOUNDED_1);
564
+ // Unbounded ripples need layout logic applied immediately to set coordinates for both shade and ripple
565
+ _this.layoutInternal();
566
+ }
567
+ });
568
+ }
569
+ };
570
+ MDCRippleFoundation.prototype.destroy = function () {
571
+ var _this = this;
572
+ if (this.supportsPressRipple()) {
573
+ if (this.activationTimer) {
574
+ clearTimeout(this.activationTimer);
575
+ this.activationTimer = 0;
576
+ this.adapter.removeClass(MDCRippleFoundation.cssClasses.FG_ACTIVATION);
577
+ }
578
+ if (this.fgDeactivationRemovalTimer) {
579
+ clearTimeout(this.fgDeactivationRemovalTimer);
580
+ this.fgDeactivationRemovalTimer = 0;
581
+ this.adapter.removeClass(MDCRippleFoundation.cssClasses.FG_DEACTIVATION);
582
+ }
583
+ var _a = MDCRippleFoundation.cssClasses, ROOT_2 = _a.ROOT, UNBOUNDED_2 = _a.UNBOUNDED;
584
+ requestAnimationFrame(function () {
585
+ _this.adapter.removeClass(ROOT_2);
586
+ _this.adapter.removeClass(UNBOUNDED_2);
587
+ _this.removeCssVars();
588
+ });
589
+ }
590
+ this.deregisterRootHandlers();
591
+ this.deregisterDeactivationHandlers();
592
+ };
593
+ /**
594
+ * @param evt Optional event containing position information.
595
+ */
596
+ MDCRippleFoundation.prototype.activate = function (evt) {
597
+ this.activateImpl(evt);
598
+ };
599
+ MDCRippleFoundation.prototype.deactivate = function () {
600
+ this.deactivateImpl();
601
+ };
602
+ MDCRippleFoundation.prototype.layout = function () {
603
+ var _this = this;
604
+ if (this.layoutFrame) {
605
+ cancelAnimationFrame(this.layoutFrame);
606
+ }
607
+ this.layoutFrame = requestAnimationFrame(function () {
608
+ _this.layoutInternal();
609
+ _this.layoutFrame = 0;
610
+ });
611
+ };
612
+ MDCRippleFoundation.prototype.setUnbounded = function (unbounded) {
613
+ var UNBOUNDED = MDCRippleFoundation.cssClasses.UNBOUNDED;
614
+ if (unbounded) {
615
+ this.adapter.addClass(UNBOUNDED);
616
+ }
617
+ else {
618
+ this.adapter.removeClass(UNBOUNDED);
619
+ }
620
+ };
621
+ MDCRippleFoundation.prototype.handleFocus = function () {
622
+ var _this = this;
623
+ requestAnimationFrame(function () { return _this.adapter.addClass(MDCRippleFoundation.cssClasses.BG_FOCUSED); });
624
+ };
625
+ MDCRippleFoundation.prototype.handleBlur = function () {
626
+ var _this = this;
627
+ requestAnimationFrame(function () { return _this.adapter.removeClass(MDCRippleFoundation.cssClasses.BG_FOCUSED); });
628
+ };
629
+ /**
630
+ * We compute this property so that we are not querying information about the client
631
+ * until the point in time where the foundation requests it. This prevents scenarios where
632
+ * client-side feature-detection may happen too early, such as when components are rendered on the server
633
+ * and then initialized at mount time on the client.
634
+ */
635
+ MDCRippleFoundation.prototype.supportsPressRipple = function () {
636
+ return this.adapter.browserSupportsCssVars();
637
+ };
638
+ MDCRippleFoundation.prototype.defaultActivationState = function () {
639
+ return {
640
+ activationEvent: undefined,
641
+ hasDeactivationUXRun: false,
642
+ isActivated: false,
643
+ isProgrammatic: false,
644
+ wasActivatedByPointer: false,
645
+ wasElementMadeActive: false,
646
+ };
647
+ };
648
+ /**
649
+ * supportsPressRipple Passed from init to save a redundant function call
650
+ */
651
+ MDCRippleFoundation.prototype.registerRootHandlers = function (supportsPressRipple) {
652
+ var e_1, _a;
653
+ if (supportsPressRipple) {
654
+ try {
655
+ for (var ACTIVATION_EVENT_TYPES_1 = __values(ACTIVATION_EVENT_TYPES), ACTIVATION_EVENT_TYPES_1_1 = ACTIVATION_EVENT_TYPES_1.next(); !ACTIVATION_EVENT_TYPES_1_1.done; ACTIVATION_EVENT_TYPES_1_1 = ACTIVATION_EVENT_TYPES_1.next()) {
656
+ var evtType = ACTIVATION_EVENT_TYPES_1_1.value;
657
+ this.adapter.registerInteractionHandler(evtType, this.activateHandler);
658
+ }
659
+ }
660
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
661
+ finally {
662
+ try {
663
+ if (ACTIVATION_EVENT_TYPES_1_1 && !ACTIVATION_EVENT_TYPES_1_1.done && (_a = ACTIVATION_EVENT_TYPES_1.return)) _a.call(ACTIVATION_EVENT_TYPES_1);
664
+ }
665
+ finally { if (e_1) throw e_1.error; }
666
+ }
667
+ if (this.adapter.isUnbounded()) {
668
+ this.adapter.registerResizeHandler(this.resizeHandler);
669
+ }
670
+ }
671
+ this.adapter.registerInteractionHandler('focus', this.focusHandler);
672
+ this.adapter.registerInteractionHandler('blur', this.blurHandler);
673
+ };
674
+ MDCRippleFoundation.prototype.registerDeactivationHandlers = function (evt) {
675
+ var e_2, _a;
676
+ if (evt.type === 'keydown') {
677
+ this.adapter.registerInteractionHandler('keyup', this.deactivateHandler);
678
+ }
679
+ else {
680
+ try {
681
+ for (var POINTER_DEACTIVATION_EVENT_TYPES_1 = __values(POINTER_DEACTIVATION_EVENT_TYPES), POINTER_DEACTIVATION_EVENT_TYPES_1_1 = POINTER_DEACTIVATION_EVENT_TYPES_1.next(); !POINTER_DEACTIVATION_EVENT_TYPES_1_1.done; POINTER_DEACTIVATION_EVENT_TYPES_1_1 = POINTER_DEACTIVATION_EVENT_TYPES_1.next()) {
682
+ var evtType = POINTER_DEACTIVATION_EVENT_TYPES_1_1.value;
683
+ this.adapter.registerDocumentInteractionHandler(evtType, this.deactivateHandler);
684
+ }
685
+ }
686
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
687
+ finally {
688
+ try {
689
+ if (POINTER_DEACTIVATION_EVENT_TYPES_1_1 && !POINTER_DEACTIVATION_EVENT_TYPES_1_1.done && (_a = POINTER_DEACTIVATION_EVENT_TYPES_1.return)) _a.call(POINTER_DEACTIVATION_EVENT_TYPES_1);
690
+ }
691
+ finally { if (e_2) throw e_2.error; }
692
+ }
693
+ }
694
+ };
695
+ MDCRippleFoundation.prototype.deregisterRootHandlers = function () {
696
+ var e_3, _a;
697
+ try {
698
+ for (var ACTIVATION_EVENT_TYPES_2 = __values(ACTIVATION_EVENT_TYPES), ACTIVATION_EVENT_TYPES_2_1 = ACTIVATION_EVENT_TYPES_2.next(); !ACTIVATION_EVENT_TYPES_2_1.done; ACTIVATION_EVENT_TYPES_2_1 = ACTIVATION_EVENT_TYPES_2.next()) {
699
+ var evtType = ACTIVATION_EVENT_TYPES_2_1.value;
700
+ this.adapter.deregisterInteractionHandler(evtType, this.activateHandler);
701
+ }
702
+ }
703
+ catch (e_3_1) { e_3 = { error: e_3_1 }; }
704
+ finally {
705
+ try {
706
+ if (ACTIVATION_EVENT_TYPES_2_1 && !ACTIVATION_EVENT_TYPES_2_1.done && (_a = ACTIVATION_EVENT_TYPES_2.return)) _a.call(ACTIVATION_EVENT_TYPES_2);
707
+ }
708
+ finally { if (e_3) throw e_3.error; }
709
+ }
710
+ this.adapter.deregisterInteractionHandler('focus', this.focusHandler);
711
+ this.adapter.deregisterInteractionHandler('blur', this.blurHandler);
712
+ if (this.adapter.isUnbounded()) {
713
+ this.adapter.deregisterResizeHandler(this.resizeHandler);
714
+ }
715
+ };
716
+ MDCRippleFoundation.prototype.deregisterDeactivationHandlers = function () {
717
+ var e_4, _a;
718
+ this.adapter.deregisterInteractionHandler('keyup', this.deactivateHandler);
719
+ try {
720
+ for (var POINTER_DEACTIVATION_EVENT_TYPES_2 = __values(POINTER_DEACTIVATION_EVENT_TYPES), POINTER_DEACTIVATION_EVENT_TYPES_2_1 = POINTER_DEACTIVATION_EVENT_TYPES_2.next(); !POINTER_DEACTIVATION_EVENT_TYPES_2_1.done; POINTER_DEACTIVATION_EVENT_TYPES_2_1 = POINTER_DEACTIVATION_EVENT_TYPES_2.next()) {
721
+ var evtType = POINTER_DEACTIVATION_EVENT_TYPES_2_1.value;
722
+ this.adapter.deregisterDocumentInteractionHandler(evtType, this.deactivateHandler);
723
+ }
724
+ }
725
+ catch (e_4_1) { e_4 = { error: e_4_1 }; }
726
+ finally {
727
+ try {
728
+ if (POINTER_DEACTIVATION_EVENT_TYPES_2_1 && !POINTER_DEACTIVATION_EVENT_TYPES_2_1.done && (_a = POINTER_DEACTIVATION_EVENT_TYPES_2.return)) _a.call(POINTER_DEACTIVATION_EVENT_TYPES_2);
729
+ }
730
+ finally { if (e_4) throw e_4.error; }
731
+ }
732
+ };
733
+ MDCRippleFoundation.prototype.removeCssVars = function () {
734
+ var _this = this;
735
+ var rippleStrings = MDCRippleFoundation.strings;
736
+ var keys = Object.keys(rippleStrings);
737
+ keys.forEach(function (key) {
738
+ if (key.indexOf('VAR_') === 0) {
739
+ _this.adapter.updateCssVariable(rippleStrings[key], null);
740
+ }
741
+ });
742
+ };
743
+ MDCRippleFoundation.prototype.activateImpl = function (evt) {
744
+ var _this = this;
745
+ if (this.adapter.isSurfaceDisabled()) {
746
+ return;
747
+ }
748
+ var activationState = this.activationState;
749
+ if (activationState.isActivated) {
750
+ return;
751
+ }
752
+ // Avoid reacting to follow-on events fired by touch device after an already-processed user interaction
753
+ var previousActivationEvent = this.previousActivationEvent;
754
+ var isSameInteraction = previousActivationEvent && evt !== undefined && previousActivationEvent.type !== evt.type;
755
+ if (isSameInteraction) {
756
+ return;
757
+ }
758
+ activationState.isActivated = true;
759
+ activationState.isProgrammatic = evt === undefined;
760
+ activationState.activationEvent = evt;
761
+ activationState.wasActivatedByPointer = activationState.isProgrammatic ? false : evt !== undefined && (evt.type === 'mousedown' || evt.type === 'touchstart' || evt.type === 'pointerdown');
762
+ var hasActivatedChild = evt !== undefined &&
763
+ activatedTargets.length > 0 &&
764
+ activatedTargets.some(function (target) { return _this.adapter.containsEventTarget(target); });
765
+ if (hasActivatedChild) {
766
+ // Immediately reset activation state, while preserving logic that prevents touch follow-on events
767
+ this.resetActivationState();
768
+ return;
769
+ }
770
+ if (evt !== undefined) {
771
+ activatedTargets.push(evt.target);
772
+ this.registerDeactivationHandlers(evt);
773
+ }
774
+ activationState.wasElementMadeActive = this.checkElementMadeActive(evt);
775
+ if (activationState.wasElementMadeActive) {
776
+ this.animateActivation();
777
+ }
778
+ requestAnimationFrame(function () {
779
+ // Reset array on next frame after the current event has had a chance to bubble to prevent ancestor ripples
780
+ activatedTargets = [];
781
+ if (!activationState.wasElementMadeActive
782
+ && evt !== undefined
783
+ && (evt.key === ' ' || evt.keyCode === 32)) {
784
+ // If space was pressed, try again within an rAF call to detect :active, because different UAs report
785
+ // active states inconsistently when they're called within event handling code:
786
+ // - https://bugs.chromium.org/p/chromium/issues/detail?id=635971
787
+ // - https://bugzilla.mozilla.org/show_bug.cgi?id=1293741
788
+ // We try first outside rAF to support Edge, which does not exhibit this problem, but will crash if a CSS
789
+ // variable is set within a rAF callback for a submit button interaction (#2241).
790
+ activationState.wasElementMadeActive = _this.checkElementMadeActive(evt);
791
+ if (activationState.wasElementMadeActive) {
792
+ _this.animateActivation();
793
+ }
794
+ }
795
+ if (!activationState.wasElementMadeActive) {
796
+ // Reset activation state immediately if element was not made active.
797
+ _this.activationState = _this.defaultActivationState();
798
+ }
799
+ });
800
+ };
801
+ MDCRippleFoundation.prototype.checkElementMadeActive = function (evt) {
802
+ return (evt !== undefined && evt.type === 'keydown') ?
803
+ this.adapter.isSurfaceActive() :
804
+ true;
805
+ };
806
+ MDCRippleFoundation.prototype.animateActivation = function () {
807
+ var _this = this;
808
+ var _a = MDCRippleFoundation.strings, VAR_FG_TRANSLATE_START = _a.VAR_FG_TRANSLATE_START, VAR_FG_TRANSLATE_END = _a.VAR_FG_TRANSLATE_END;
809
+ var _b = MDCRippleFoundation.cssClasses, FG_DEACTIVATION = _b.FG_DEACTIVATION, FG_ACTIVATION = _b.FG_ACTIVATION;
810
+ var DEACTIVATION_TIMEOUT_MS = MDCRippleFoundation.numbers.DEACTIVATION_TIMEOUT_MS;
811
+ this.layoutInternal();
812
+ var translateStart = '';
813
+ var translateEnd = '';
814
+ if (!this.adapter.isUnbounded()) {
815
+ var _c = this.getFgTranslationCoordinates(), startPoint = _c.startPoint, endPoint = _c.endPoint;
816
+ translateStart = startPoint.x + "px, " + startPoint.y + "px";
817
+ translateEnd = endPoint.x + "px, " + endPoint.y + "px";
818
+ }
819
+ this.adapter.updateCssVariable(VAR_FG_TRANSLATE_START, translateStart);
820
+ this.adapter.updateCssVariable(VAR_FG_TRANSLATE_END, translateEnd);
821
+ // Cancel any ongoing activation/deactivation animations
822
+ clearTimeout(this.activationTimer);
823
+ clearTimeout(this.fgDeactivationRemovalTimer);
824
+ this.rmBoundedActivationClasses();
825
+ this.adapter.removeClass(FG_DEACTIVATION);
826
+ // Force layout in order to re-trigger the animation.
827
+ this.adapter.computeBoundingRect();
828
+ this.adapter.addClass(FG_ACTIVATION);
829
+ this.activationTimer = setTimeout(function () {
830
+ _this.activationTimerCallback();
831
+ }, DEACTIVATION_TIMEOUT_MS);
832
+ };
833
+ MDCRippleFoundation.prototype.getFgTranslationCoordinates = function () {
834
+ var _a = this.activationState, activationEvent = _a.activationEvent, wasActivatedByPointer = _a.wasActivatedByPointer;
835
+ var startPoint;
836
+ if (wasActivatedByPointer) {
837
+ startPoint = getNormalizedEventCoords(activationEvent, this.adapter.getWindowPageOffset(), this.adapter.computeBoundingRect());
838
+ }
839
+ else {
840
+ startPoint = {
841
+ x: this.frame.width / 2,
842
+ y: this.frame.height / 2,
843
+ };
844
+ }
845
+ // Center the element around the start point.
846
+ startPoint = {
847
+ x: startPoint.x - (this.initialSize / 2),
848
+ y: startPoint.y - (this.initialSize / 2),
849
+ };
850
+ var endPoint = {
851
+ x: (this.frame.width / 2) - (this.initialSize / 2),
852
+ y: (this.frame.height / 2) - (this.initialSize / 2),
853
+ };
854
+ return { startPoint: startPoint, endPoint: endPoint };
855
+ };
856
+ MDCRippleFoundation.prototype.runDeactivationUXLogicIfReady = function () {
857
+ var _this = this;
858
+ // This method is called both when a pointing device is released, and when the activation animation ends.
859
+ // The deactivation animation should only run after both of those occur.
860
+ var FG_DEACTIVATION = MDCRippleFoundation.cssClasses.FG_DEACTIVATION;
861
+ var _a = this.activationState, hasDeactivationUXRun = _a.hasDeactivationUXRun, isActivated = _a.isActivated;
862
+ var activationHasEnded = hasDeactivationUXRun || !isActivated;
863
+ if (activationHasEnded && this.activationAnimationHasEnded) {
864
+ this.rmBoundedActivationClasses();
865
+ this.adapter.addClass(FG_DEACTIVATION);
866
+ this.fgDeactivationRemovalTimer = setTimeout(function () {
867
+ _this.adapter.removeClass(FG_DEACTIVATION);
868
+ }, numbers.FG_DEACTIVATION_MS);
869
+ }
870
+ };
871
+ MDCRippleFoundation.prototype.rmBoundedActivationClasses = function () {
872
+ var FG_ACTIVATION = MDCRippleFoundation.cssClasses.FG_ACTIVATION;
873
+ this.adapter.removeClass(FG_ACTIVATION);
874
+ this.activationAnimationHasEnded = false;
875
+ this.adapter.computeBoundingRect();
876
+ };
877
+ MDCRippleFoundation.prototype.resetActivationState = function () {
878
+ var _this = this;
879
+ this.previousActivationEvent = this.activationState.activationEvent;
880
+ this.activationState = this.defaultActivationState();
881
+ // Touch devices may fire additional events for the same interaction within a short time.
882
+ // Store the previous event until it's safe to assume that subsequent events are for new interactions.
883
+ setTimeout(function () { return _this.previousActivationEvent = undefined; }, MDCRippleFoundation.numbers.TAP_DELAY_MS);
884
+ };
885
+ MDCRippleFoundation.prototype.deactivateImpl = function () {
886
+ var _this = this;
887
+ var activationState = this.activationState;
888
+ // This can happen in scenarios such as when you have a keyup event that blurs the element.
889
+ if (!activationState.isActivated) {
890
+ return;
891
+ }
892
+ var state = __assign({}, activationState);
893
+ if (activationState.isProgrammatic) {
894
+ requestAnimationFrame(function () {
895
+ _this.animateDeactivation(state);
896
+ });
897
+ this.resetActivationState();
898
+ }
899
+ else {
900
+ this.deregisterDeactivationHandlers();
901
+ requestAnimationFrame(function () {
902
+ _this.activationState.hasDeactivationUXRun = true;
903
+ _this.animateDeactivation(state);
904
+ _this.resetActivationState();
905
+ });
906
+ }
907
+ };
908
+ MDCRippleFoundation.prototype.animateDeactivation = function (_a) {
909
+ var wasActivatedByPointer = _a.wasActivatedByPointer, wasElementMadeActive = _a.wasElementMadeActive;
910
+ if (wasActivatedByPointer || wasElementMadeActive) {
911
+ this.runDeactivationUXLogicIfReady();
912
+ }
913
+ };
914
+ MDCRippleFoundation.prototype.layoutInternal = function () {
915
+ var _this = this;
916
+ this.frame = this.adapter.computeBoundingRect();
917
+ var maxDim = Math.max(this.frame.height, this.frame.width);
918
+ // Surface diameter is treated differently for unbounded vs. bounded ripples.
919
+ // Unbounded ripple diameter is calculated smaller since the surface is expected to already be padded appropriately
920
+ // to extend the hitbox, and the ripple is expected to meet the edges of the padded hitbox (which is typically
921
+ // square). Bounded ripples, on the other hand, are fully expected to expand beyond the surface's longest diameter
922
+ // (calculated based on the diagonal plus a constant padding), and are clipped at the surface's border via
923
+ // `overflow: hidden`.
924
+ var getBoundedRadius = function () {
925
+ var hypotenuse = Math.sqrt(Math.pow(_this.frame.width, 2) + Math.pow(_this.frame.height, 2));
926
+ return hypotenuse + MDCRippleFoundation.numbers.PADDING;
927
+ };
928
+ this.maxRadius = this.adapter.isUnbounded() ? maxDim : getBoundedRadius();
929
+ // Ripple is sized as a fraction of the largest dimension of the surface, then scales up using a CSS scale transform
930
+ var initialSize = Math.floor(maxDim * MDCRippleFoundation.numbers.INITIAL_ORIGIN_SCALE);
931
+ // Unbounded ripple size should always be even number to equally center align.
932
+ if (this.adapter.isUnbounded() && initialSize % 2 !== 0) {
933
+ this.initialSize = initialSize - 1;
934
+ }
935
+ else {
936
+ this.initialSize = initialSize;
937
+ }
938
+ this.fgScale = "" + this.maxRadius / this.initialSize;
939
+ this.updateLayoutCssVars();
940
+ };
941
+ MDCRippleFoundation.prototype.updateLayoutCssVars = function () {
942
+ var _a = MDCRippleFoundation.strings, VAR_FG_SIZE = _a.VAR_FG_SIZE, VAR_LEFT = _a.VAR_LEFT, VAR_TOP = _a.VAR_TOP, VAR_FG_SCALE = _a.VAR_FG_SCALE;
943
+ this.adapter.updateCssVariable(VAR_FG_SIZE, this.initialSize + "px");
944
+ this.adapter.updateCssVariable(VAR_FG_SCALE, this.fgScale);
945
+ if (this.adapter.isUnbounded()) {
946
+ this.unboundedCoords = {
947
+ left: Math.round((this.frame.width / 2) - (this.initialSize / 2)),
948
+ top: Math.round((this.frame.height / 2) - (this.initialSize / 2)),
949
+ };
950
+ this.adapter.updateCssVariable(VAR_LEFT, this.unboundedCoords.left + "px");
951
+ this.adapter.updateCssVariable(VAR_TOP, this.unboundedCoords.top + "px");
952
+ }
953
+ };
954
+ return MDCRippleFoundation;
955
+ }(MDCFoundation));
956
+
957
+ /**
958
+ * @license
959
+ * Copyright 2016 Google Inc.
960
+ *
961
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
962
+ * of this software and associated documentation files (the "Software"), to deal
963
+ * in the Software without restriction, including without limitation the rights
964
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
965
+ * copies of the Software, and to permit persons to whom the Software is
966
+ * furnished to do so, subject to the following conditions:
967
+ *
968
+ * The above copyright notice and this permission notice shall be included in
969
+ * all copies or substantial portions of the Software.
970
+ *
971
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
972
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
973
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
974
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
975
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
976
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
977
+ * THE SOFTWARE.
978
+ */
979
+ var MDCRipple = /** @class */ (function (_super) {
980
+ __extends(MDCRipple, _super);
981
+ function MDCRipple() {
982
+ var _this = _super !== null && _super.apply(this, arguments) || this;
983
+ _this.disabled = false;
984
+ return _this;
985
+ }
986
+ MDCRipple.attachTo = function (root, opts) {
987
+ if (opts === void 0) { opts = {
988
+ isUnbounded: undefined
989
+ }; }
990
+ var ripple = new MDCRipple(root);
991
+ // Only override unbounded behavior if option is explicitly specified
992
+ if (opts.isUnbounded !== undefined) {
993
+ ripple.unbounded = opts.isUnbounded;
994
+ }
995
+ return ripple;
996
+ };
997
+ MDCRipple.createAdapter = function (instance) {
998
+ return {
999
+ addClass: function (className) { return instance.root.classList.add(className); },
1000
+ browserSupportsCssVars: function () { return supportsCssVariables(window); },
1001
+ computeBoundingRect: function () { return instance.root.getBoundingClientRect(); },
1002
+ containsEventTarget: function (target) { return instance.root.contains(target); },
1003
+ deregisterDocumentInteractionHandler: function (evtType, handler) {
1004
+ return document.documentElement.removeEventListener(evtType, handler, applyPassive());
1005
+ },
1006
+ deregisterInteractionHandler: function (evtType, handler) {
1007
+ return instance.root
1008
+ .removeEventListener(evtType, handler, applyPassive());
1009
+ },
1010
+ deregisterResizeHandler: function (handler) {
1011
+ return window.removeEventListener('resize', handler);
1012
+ },
1013
+ getWindowPageOffset: function () {
1014
+ return ({ x: window.pageXOffset, y: window.pageYOffset });
1015
+ },
1016
+ isSurfaceActive: function () { return matches(instance.root, ':active'); },
1017
+ isSurfaceDisabled: function () { return Boolean(instance.disabled); },
1018
+ isUnbounded: function () { return Boolean(instance.unbounded); },
1019
+ registerDocumentInteractionHandler: function (evtType, handler) {
1020
+ return document.documentElement.addEventListener(evtType, handler, applyPassive());
1021
+ },
1022
+ registerInteractionHandler: function (evtType, handler) {
1023
+ return instance.root
1024
+ .addEventListener(evtType, handler, applyPassive());
1025
+ },
1026
+ registerResizeHandler: function (handler) {
1027
+ return window.addEventListener('resize', handler);
1028
+ },
1029
+ removeClass: function (className) { return instance.root.classList.remove(className); },
1030
+ updateCssVariable: function (varName, value) {
1031
+ return instance.root.style.setProperty(varName, value);
1032
+ },
1033
+ };
1034
+ };
1035
+ Object.defineProperty(MDCRipple.prototype, "unbounded", {
1036
+ get: function () {
1037
+ return Boolean(this.isUnbounded);
1038
+ },
1039
+ set: function (unbounded) {
1040
+ this.isUnbounded = Boolean(unbounded);
1041
+ this.setUnbounded();
1042
+ },
1043
+ enumerable: false,
1044
+ configurable: true
1045
+ });
1046
+ MDCRipple.prototype.activate = function () {
1047
+ this.foundation.activate();
1048
+ };
1049
+ MDCRipple.prototype.deactivate = function () {
1050
+ this.foundation.deactivate();
1051
+ };
1052
+ MDCRipple.prototype.layout = function () {
1053
+ this.foundation.layout();
1054
+ };
1055
+ MDCRipple.prototype.getDefaultFoundation = function () {
1056
+ return new MDCRippleFoundation(MDCRipple.createAdapter(this));
1057
+ };
1058
+ MDCRipple.prototype.initialSyncWithDOM = function () {
1059
+ var root = this.root;
1060
+ this.isUnbounded = 'mdcRippleIsUnbounded' in root.dataset;
1061
+ };
1062
+ /**
1063
+ * Closure Compiler throws an access control error when directly accessing a
1064
+ * protected or private property inside a getter/setter, like unbounded above.
1065
+ * By accessing the protected property inside a method, we solve that problem.
1066
+ * That's why this function exists.
1067
+ */
1068
+ MDCRipple.prototype.setUnbounded = function () {
1069
+ this.foundation.setUnbounded(Boolean(this.isUnbounded));
1070
+ };
1071
+ return MDCRipple;
1072
+ }(MDCComponent));
1073
+
1074
+ exports.MDCRipple = MDCRipple;