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