@limetech/lime-elements 37.1.0-next.66 → 37.1.0-next.68

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 (81) hide show
  1. package/dist/cjs/{component-9c3fa668.js → component-66df95e7.js} +935 -12
  2. package/dist/cjs/component-66df95e7.js.map +1 -0
  3. package/dist/cjs/index.es-75b5e7c4.js +222 -0
  4. package/dist/cjs/index.es-75b5e7c4.js.map +1 -0
  5. package/dist/cjs/lime-elements.cjs.js +1 -1
  6. package/dist/cjs/limel-breadcrumbs_3.cjs.entry.js +147 -28
  7. package/dist/cjs/limel-breadcrumbs_3.cjs.entry.js.map +1 -1
  8. package/dist/cjs/{limel-list.cjs.entry.js → limel-input-field_3.cjs.entry.js} +820 -4
  9. package/dist/cjs/limel-input-field_3.cjs.entry.js.map +1 -0
  10. package/dist/cjs/limel-picker.cjs.entry.js +2 -218
  11. package/dist/cjs/limel-picker.cjs.entry.js.map +1 -1
  12. package/dist/cjs/limel-select.cjs.entry.js +8 -0
  13. package/dist/cjs/limel-select.cjs.entry.js.map +1 -1
  14. package/dist/cjs/loader.cjs.js +1 -1
  15. package/dist/collection/components/menu/menu.js +178 -16
  16. package/dist/collection/components/menu/menu.js.map +1 -1
  17. package/dist/collection/components/menu/menu.types.js.map +1 -1
  18. package/dist/collection/components/select/select.template.js +8 -0
  19. package/dist/collection/components/select/select.template.js.map +1 -1
  20. package/dist/esm/{component-0be247ac.js → component-fffa3419.js} +934 -13
  21. package/dist/esm/component-fffa3419.js.map +1 -0
  22. package/dist/esm/index.es-61c13ecf.js +220 -0
  23. package/dist/esm/index.es-61c13ecf.js.map +1 -0
  24. package/dist/esm/lime-elements.js +1 -1
  25. package/dist/esm/limel-breadcrumbs_3.entry.js +137 -18
  26. package/dist/esm/limel-breadcrumbs_3.entry.js.map +1 -1
  27. package/dist/esm/{limel-list.entry.js → limel-input-field_3.entry.js} +818 -4
  28. package/dist/esm/limel-input-field_3.entry.js.map +1 -0
  29. package/dist/esm/limel-picker.entry.js +1 -217
  30. package/dist/esm/limel-picker.entry.js.map +1 -1
  31. package/dist/esm/limel-select.entry.js +8 -0
  32. package/dist/esm/limel-select.entry.js.map +1 -1
  33. package/dist/esm/loader.js +1 -1
  34. package/dist/lime-elements/lime-elements.esm.js +1 -1
  35. package/dist/lime-elements/lime-elements.esm.js.map +1 -1
  36. package/dist/lime-elements/p-0bbfc036.entry.js +82 -0
  37. package/dist/lime-elements/{p-4db3e907.entry.js.map → p-0bbfc036.entry.js.map} +1 -1
  38. package/dist/lime-elements/p-78a442a0.entry.js +2 -0
  39. package/dist/lime-elements/p-78a442a0.entry.js.map +1 -0
  40. package/dist/lime-elements/p-97107e34.js +16 -0
  41. package/dist/lime-elements/p-97107e34.js.map +1 -0
  42. package/dist/lime-elements/{p-2ce8168b.entry.js → p-ade5366a.entry.js} +6 -6
  43. package/dist/lime-elements/p-ade5366a.entry.js.map +1 -0
  44. package/dist/lime-elements/p-dfba92de.js +206 -0
  45. package/dist/lime-elements/p-dfba92de.js.map +1 -0
  46. package/dist/lime-elements/p-dfc927a3.entry.js +2 -0
  47. package/dist/lime-elements/p-dfc927a3.entry.js.map +1 -0
  48. package/dist/types/components/menu/menu.d.ts +27 -7
  49. package/dist/types/components/menu/menu.types.d.ts +8 -0
  50. package/dist/types/components.d.ts +22 -2
  51. package/package.json +2 -2
  52. package/dist/cjs/component-9c3fa668.js.map +0 -1
  53. package/dist/cjs/component-a0124759.js +0 -929
  54. package/dist/cjs/component-a0124759.js.map +0 -1
  55. package/dist/cjs/limel-input-field.cjs.entry.js +0 -707
  56. package/dist/cjs/limel-input-field.cjs.entry.js.map +0 -1
  57. package/dist/cjs/limel-list.cjs.entry.js.map +0 -1
  58. package/dist/cjs/limel-menu-surface.cjs.entry.js +0 -130
  59. package/dist/cjs/limel-menu-surface.cjs.entry.js.map +0 -1
  60. package/dist/esm/component-0be247ac.js.map +0 -1
  61. package/dist/esm/component-6d079abe.js +0 -926
  62. package/dist/esm/component-6d079abe.js.map +0 -1
  63. package/dist/esm/limel-input-field.entry.js +0 -703
  64. package/dist/esm/limel-input-field.entry.js.map +0 -1
  65. package/dist/esm/limel-list.entry.js.map +0 -1
  66. package/dist/esm/limel-menu-surface.entry.js +0 -126
  67. package/dist/esm/limel-menu-surface.entry.js.map +0 -1
  68. package/dist/lime-elements/p-2ce8168b.entry.js.map +0 -1
  69. package/dist/lime-elements/p-32ff1b76.entry.js +0 -2
  70. package/dist/lime-elements/p-32ff1b76.entry.js.map +0 -1
  71. package/dist/lime-elements/p-3efb6ac5.entry.js +0 -2
  72. package/dist/lime-elements/p-3efb6ac5.entry.js.map +0 -1
  73. package/dist/lime-elements/p-4db3e907.entry.js +0 -82
  74. package/dist/lime-elements/p-5dd6d677.js +0 -82
  75. package/dist/lime-elements/p-5dd6d677.js.map +0 -1
  76. package/dist/lime-elements/p-99b26036.entry.js +0 -2
  77. package/dist/lime-elements/p-99b26036.entry.js.map +0 -1
  78. package/dist/lime-elements/p-bbf317b8.entry.js +0 -16
  79. package/dist/lime-elements/p-bbf317b8.entry.js.map +0 -1
  80. package/dist/lime-elements/p-e3b16b61.js +0 -126
  81. package/dist/lime-elements/p-e3b16b61.js.map +0 -1
@@ -1,926 +0,0 @@
1
- import { M as MDCFoundation, a as MDCComponent } from './component-410aad5a.js';
2
- import { g as getCorrectPropertyName } from './util-f1bde91c.js';
3
-
4
- /**
5
- * @license
6
- * Copyright 2018 Google Inc.
7
- *
8
- * Permission is hereby granted, free of charge, to any person obtaining a copy
9
- * of this software and associated documentation files (the "Software"), to deal
10
- * in the Software without restriction, including without limitation the rights
11
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
- * copies of the Software, and to permit persons to whom the Software is
13
- * furnished to do so, subject to the following conditions:
14
- *
15
- * The above copyright notice and this permission notice shall be included in
16
- * all copies or substantial portions of the Software.
17
- *
18
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24
- * THE SOFTWARE.
25
- */
26
- var cssClasses = {
27
- ANCHOR: 'mdc-menu-surface--anchor',
28
- ANIMATING_CLOSED: 'mdc-menu-surface--animating-closed',
29
- ANIMATING_OPEN: 'mdc-menu-surface--animating-open',
30
- FIXED: 'mdc-menu-surface--fixed',
31
- IS_OPEN_BELOW: 'mdc-menu-surface--is-open-below',
32
- OPEN: 'mdc-menu-surface--open',
33
- ROOT: 'mdc-menu-surface',
34
- };
35
- // tslint:disable:object-literal-sort-keys
36
- var strings = {
37
- CLOSED_EVENT: 'MDCMenuSurface:closed',
38
- CLOSING_EVENT: 'MDCMenuSurface:closing',
39
- OPENED_EVENT: 'MDCMenuSurface:opened',
40
- FOCUSABLE_ELEMENTS: [
41
- 'button:not(:disabled)',
42
- '[href]:not([aria-disabled="true"])',
43
- 'input:not(:disabled)',
44
- 'select:not(:disabled)',
45
- 'textarea:not(:disabled)',
46
- '[tabindex]:not([tabindex="-1"]):not([aria-disabled="true"])',
47
- ].join(', '),
48
- };
49
- // tslint:enable:object-literal-sort-keys
50
- var numbers = {
51
- /** Total duration of menu-surface open animation. */
52
- TRANSITION_OPEN_DURATION: 120,
53
- /** Total duration of menu-surface close animation. */
54
- TRANSITION_CLOSE_DURATION: 75,
55
- /**
56
- * Margin left to the edge of the viewport when menu-surface is at maximum
57
- * possible height. Also used as a viewport margin.
58
- */
59
- MARGIN_TO_EDGE: 32,
60
- /**
61
- * Ratio of anchor width to menu-surface width for switching from corner
62
- * positioning to center positioning.
63
- */
64
- ANCHOR_TO_MENU_SURFACE_WIDTH_RATIO: 0.67,
65
- /**
66
- * Amount of time to wait before restoring focus when closing the menu
67
- * surface. This is important because if a touch event triggered the menu
68
- * close, and the subsequent mouse event occurs after focus is restored, then
69
- * the restored focus would be lost.
70
- */
71
- TOUCH_EVENT_WAIT_MS: 30,
72
- };
73
- /**
74
- * Enum for bits in the {@see Corner) bitmap.
75
- */
76
- var CornerBit;
77
- (function (CornerBit) {
78
- CornerBit[CornerBit["BOTTOM"] = 1] = "BOTTOM";
79
- CornerBit[CornerBit["CENTER"] = 2] = "CENTER";
80
- CornerBit[CornerBit["RIGHT"] = 4] = "RIGHT";
81
- CornerBit[CornerBit["FLIP_RTL"] = 8] = "FLIP_RTL";
82
- })(CornerBit || (CornerBit = {}));
83
- /**
84
- * Enum for representing an element corner for positioning the menu-surface.
85
- *
86
- * The START constants map to LEFT if element directionality is left
87
- * to right and RIGHT if the directionality is right to left.
88
- * Likewise END maps to RIGHT or LEFT depending on the directionality.
89
- */
90
- var Corner;
91
- (function (Corner) {
92
- Corner[Corner["TOP_LEFT"] = 0] = "TOP_LEFT";
93
- Corner[Corner["TOP_RIGHT"] = 4] = "TOP_RIGHT";
94
- Corner[Corner["BOTTOM_LEFT"] = 1] = "BOTTOM_LEFT";
95
- Corner[Corner["BOTTOM_RIGHT"] = 5] = "BOTTOM_RIGHT";
96
- Corner[Corner["TOP_START"] = 8] = "TOP_START";
97
- Corner[Corner["TOP_END"] = 12] = "TOP_END";
98
- Corner[Corner["BOTTOM_START"] = 9] = "BOTTOM_START";
99
- Corner[Corner["BOTTOM_END"] = 13] = "BOTTOM_END";
100
- })(Corner || (Corner = {}));
101
-
102
- /*! *****************************************************************************
103
- Copyright (c) Microsoft Corporation.
104
-
105
- Permission to use, copy, modify, and/or distribute this software for any
106
- purpose with or without fee is hereby granted.
107
-
108
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
109
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
110
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
111
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
112
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
113
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
114
- PERFORMANCE OF THIS SOFTWARE.
115
- ***************************************************************************** */
116
- /* global Reflect, Promise */
117
-
118
- var extendStatics = function(d, b) {
119
- extendStatics = Object.setPrototypeOf ||
120
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
121
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
122
- return extendStatics(d, b);
123
- };
124
-
125
- function __extends(d, b) {
126
- if (typeof b !== "function" && b !== null)
127
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
128
- extendStatics(d, b);
129
- function __() { this.constructor = d; }
130
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
131
- }
132
-
133
- var __assign = function() {
134
- __assign = Object.assign || function __assign(t) {
135
- for (var s, i = 1, n = arguments.length; i < n; i++) {
136
- s = arguments[i];
137
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
138
- }
139
- return t;
140
- };
141
- return __assign.apply(this, arguments);
142
- };
143
-
144
- function __values(o) {
145
- var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
146
- if (m) return m.call(o);
147
- if (o && typeof o.length === "number") return {
148
- next: function () {
149
- if (o && i >= o.length) o = void 0;
150
- return { value: o && o[i++], done: !o };
151
- }
152
- };
153
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
154
- }
155
-
156
- /**
157
- * @license
158
- * Copyright 2018 Google Inc.
159
- *
160
- * Permission is hereby granted, free of charge, to any person obtaining a copy
161
- * of this software and associated documentation files (the "Software"), to deal
162
- * in the Software without restriction, including without limitation the rights
163
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
164
- * copies of the Software, and to permit persons to whom the Software is
165
- * furnished to do so, subject to the following conditions:
166
- *
167
- * The above copyright notice and this permission notice shall be included in
168
- * all copies or substantial portions of the Software.
169
- *
170
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
171
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
172
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
173
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
174
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
175
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
176
- * THE SOFTWARE.
177
- */
178
- var MDCMenuSurfaceFoundation = /** @class */ (function (_super) {
179
- __extends(MDCMenuSurfaceFoundation, _super);
180
- function MDCMenuSurfaceFoundation(adapter) {
181
- var _this = _super.call(this, __assign(__assign({}, MDCMenuSurfaceFoundation.defaultAdapter), adapter)) || this;
182
- _this.isSurfaceOpen = false;
183
- _this.isQuickOpen = false;
184
- _this.isHoistedElement = false;
185
- _this.isFixedPosition = false;
186
- _this.isHorizontallyCenteredOnViewport = false;
187
- _this.maxHeight = 0;
188
- _this.openAnimationEndTimerId = 0;
189
- _this.closeAnimationEndTimerId = 0;
190
- _this.animationRequestId = 0;
191
- _this.anchorCorner = Corner.TOP_START;
192
- /**
193
- * Corner of the menu surface to which menu surface is attached to anchor.
194
- *
195
- * Anchor corner --->+----------+
196
- * | ANCHOR |
197
- * +----------+
198
- * Origin corner --->+--------------+
199
- * | |
200
- * | |
201
- * | MENU SURFACE |
202
- * | |
203
- * | |
204
- * +--------------+
205
- */
206
- _this.originCorner = Corner.TOP_START;
207
- _this.anchorMargin = { top: 0, right: 0, bottom: 0, left: 0 };
208
- _this.position = { x: 0, y: 0 };
209
- return _this;
210
- }
211
- Object.defineProperty(MDCMenuSurfaceFoundation, "cssClasses", {
212
- get: function () {
213
- return cssClasses;
214
- },
215
- enumerable: false,
216
- configurable: true
217
- });
218
- Object.defineProperty(MDCMenuSurfaceFoundation, "strings", {
219
- get: function () {
220
- return strings;
221
- },
222
- enumerable: false,
223
- configurable: true
224
- });
225
- Object.defineProperty(MDCMenuSurfaceFoundation, "numbers", {
226
- get: function () {
227
- return numbers;
228
- },
229
- enumerable: false,
230
- configurable: true
231
- });
232
- Object.defineProperty(MDCMenuSurfaceFoundation, "Corner", {
233
- get: function () {
234
- return Corner;
235
- },
236
- enumerable: false,
237
- configurable: true
238
- });
239
- Object.defineProperty(MDCMenuSurfaceFoundation, "defaultAdapter", {
240
- /**
241
- * @see {@link MDCMenuSurfaceAdapter} for typing information on parameters and return types.
242
- */
243
- get: function () {
244
- // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
245
- return {
246
- addClass: function () { return undefined; },
247
- removeClass: function () { return undefined; },
248
- hasClass: function () { return false; },
249
- hasAnchor: function () { return false; },
250
- isElementInContainer: function () { return false; },
251
- isFocused: function () { return false; },
252
- isRtl: function () { return false; },
253
- getInnerDimensions: function () { return ({ height: 0, width: 0 }); },
254
- getAnchorDimensions: function () { return null; },
255
- getWindowDimensions: function () { return ({ height: 0, width: 0 }); },
256
- getBodyDimensions: function () { return ({ height: 0, width: 0 }); },
257
- getWindowScroll: function () { return ({ x: 0, y: 0 }); },
258
- setPosition: function () { return undefined; },
259
- setMaxHeight: function () { return undefined; },
260
- setTransformOrigin: function () { return undefined; },
261
- saveFocus: function () { return undefined; },
262
- restoreFocus: function () { return undefined; },
263
- notifyClose: function () { return undefined; },
264
- notifyOpen: function () { return undefined; },
265
- notifyClosing: function () { return undefined; },
266
- };
267
- // tslint:enable:object-literal-sort-keys
268
- },
269
- enumerable: false,
270
- configurable: true
271
- });
272
- MDCMenuSurfaceFoundation.prototype.init = function () {
273
- var _a = MDCMenuSurfaceFoundation.cssClasses, ROOT = _a.ROOT, OPEN = _a.OPEN;
274
- if (!this.adapter.hasClass(ROOT)) {
275
- throw new Error(ROOT + " class required in root element.");
276
- }
277
- if (this.adapter.hasClass(OPEN)) {
278
- this.isSurfaceOpen = true;
279
- }
280
- };
281
- MDCMenuSurfaceFoundation.prototype.destroy = function () {
282
- clearTimeout(this.openAnimationEndTimerId);
283
- clearTimeout(this.closeAnimationEndTimerId);
284
- // Cancel any currently running animations.
285
- cancelAnimationFrame(this.animationRequestId);
286
- };
287
- /**
288
- * @param corner Default anchor corner alignment of top-left menu surface
289
- * corner.
290
- */
291
- MDCMenuSurfaceFoundation.prototype.setAnchorCorner = function (corner) {
292
- this.anchorCorner = corner;
293
- };
294
- /**
295
- * Flip menu corner horizontally.
296
- */
297
- MDCMenuSurfaceFoundation.prototype.flipCornerHorizontally = function () {
298
- this.originCorner = this.originCorner ^ CornerBit.RIGHT;
299
- };
300
- /**
301
- * @param margin Set of margin values from anchor.
302
- */
303
- MDCMenuSurfaceFoundation.prototype.setAnchorMargin = function (margin) {
304
- this.anchorMargin.top = margin.top || 0;
305
- this.anchorMargin.right = margin.right || 0;
306
- this.anchorMargin.bottom = margin.bottom || 0;
307
- this.anchorMargin.left = margin.left || 0;
308
- };
309
- /** Used to indicate if the menu-surface is hoisted to the body. */
310
- MDCMenuSurfaceFoundation.prototype.setIsHoisted = function (isHoisted) {
311
- this.isHoistedElement = isHoisted;
312
- };
313
- /**
314
- * Used to set the menu-surface calculations based on a fixed position menu.
315
- */
316
- MDCMenuSurfaceFoundation.prototype.setFixedPosition = function (isFixedPosition) {
317
- this.isFixedPosition = isFixedPosition;
318
- };
319
- /**
320
- * @return Returns true if menu is in fixed (`position: fixed`) position.
321
- */
322
- MDCMenuSurfaceFoundation.prototype.isFixed = function () {
323
- return this.isFixedPosition;
324
- };
325
- /** Sets the menu-surface position on the page. */
326
- MDCMenuSurfaceFoundation.prototype.setAbsolutePosition = function (x, y) {
327
- this.position.x = this.isFinite(x) ? x : 0;
328
- this.position.y = this.isFinite(y) ? y : 0;
329
- };
330
- /** Sets whether menu-surface should be horizontally centered to viewport. */
331
- MDCMenuSurfaceFoundation.prototype.setIsHorizontallyCenteredOnViewport = function (isCentered) {
332
- this.isHorizontallyCenteredOnViewport = isCentered;
333
- };
334
- MDCMenuSurfaceFoundation.prototype.setQuickOpen = function (quickOpen) {
335
- this.isQuickOpen = quickOpen;
336
- };
337
- /**
338
- * Sets maximum menu-surface height on open.
339
- * @param maxHeight The desired max-height. Set to 0 (default) to
340
- * automatically calculate max height based on available viewport space.
341
- */
342
- MDCMenuSurfaceFoundation.prototype.setMaxHeight = function (maxHeight) {
343
- this.maxHeight = maxHeight;
344
- };
345
- MDCMenuSurfaceFoundation.prototype.isOpen = function () {
346
- return this.isSurfaceOpen;
347
- };
348
- /**
349
- * Open the menu surface.
350
- */
351
- MDCMenuSurfaceFoundation.prototype.open = function () {
352
- var _this = this;
353
- if (this.isSurfaceOpen) {
354
- return;
355
- }
356
- this.adapter.saveFocus();
357
- if (this.isQuickOpen) {
358
- this.isSurfaceOpen = true;
359
- this.adapter.addClass(MDCMenuSurfaceFoundation.cssClasses.OPEN);
360
- this.dimensions = this.adapter.getInnerDimensions();
361
- this.autoposition();
362
- this.adapter.notifyOpen();
363
- }
364
- else {
365
- this.adapter.addClass(MDCMenuSurfaceFoundation.cssClasses.ANIMATING_OPEN);
366
- this.animationRequestId = requestAnimationFrame(function () {
367
- _this.dimensions = _this.adapter.getInnerDimensions();
368
- _this.autoposition();
369
- _this.adapter.addClass(MDCMenuSurfaceFoundation.cssClasses.OPEN);
370
- _this.openAnimationEndTimerId = setTimeout(function () {
371
- _this.openAnimationEndTimerId = 0;
372
- _this.adapter.removeClass(MDCMenuSurfaceFoundation.cssClasses.ANIMATING_OPEN);
373
- _this.adapter.notifyOpen();
374
- }, numbers.TRANSITION_OPEN_DURATION);
375
- });
376
- this.isSurfaceOpen = true;
377
- }
378
- };
379
- /**
380
- * Closes the menu surface.
381
- */
382
- MDCMenuSurfaceFoundation.prototype.close = function (skipRestoreFocus) {
383
- var _this = this;
384
- if (skipRestoreFocus === void 0) { skipRestoreFocus = false; }
385
- if (!this.isSurfaceOpen) {
386
- return;
387
- }
388
- this.adapter.notifyClosing();
389
- if (this.isQuickOpen) {
390
- this.isSurfaceOpen = false;
391
- if (!skipRestoreFocus) {
392
- this.maybeRestoreFocus();
393
- }
394
- this.adapter.removeClass(MDCMenuSurfaceFoundation.cssClasses.OPEN);
395
- this.adapter.removeClass(MDCMenuSurfaceFoundation.cssClasses.IS_OPEN_BELOW);
396
- this.adapter.notifyClose();
397
- return;
398
- }
399
- this.adapter.addClass(MDCMenuSurfaceFoundation.cssClasses.ANIMATING_CLOSED);
400
- requestAnimationFrame(function () {
401
- _this.adapter.removeClass(MDCMenuSurfaceFoundation.cssClasses.OPEN);
402
- _this.adapter.removeClass(MDCMenuSurfaceFoundation.cssClasses.IS_OPEN_BELOW);
403
- _this.closeAnimationEndTimerId = setTimeout(function () {
404
- _this.closeAnimationEndTimerId = 0;
405
- _this.adapter.removeClass(MDCMenuSurfaceFoundation.cssClasses.ANIMATING_CLOSED);
406
- _this.adapter.notifyClose();
407
- }, numbers.TRANSITION_CLOSE_DURATION);
408
- });
409
- this.isSurfaceOpen = false;
410
- if (!skipRestoreFocus) {
411
- this.maybeRestoreFocus();
412
- }
413
- };
414
- /** Handle clicks and close if not within menu-surface element. */
415
- MDCMenuSurfaceFoundation.prototype.handleBodyClick = function (evt) {
416
- var el = evt.target;
417
- if (this.adapter.isElementInContainer(el)) {
418
- return;
419
- }
420
- this.close();
421
- };
422
- /** Handle keys that close the surface. */
423
- MDCMenuSurfaceFoundation.prototype.handleKeydown = function (evt) {
424
- var keyCode = evt.keyCode, key = evt.key;
425
- var isEscape = key === 'Escape' || keyCode === 27;
426
- if (isEscape) {
427
- this.close();
428
- }
429
- };
430
- MDCMenuSurfaceFoundation.prototype.autoposition = function () {
431
- var _a;
432
- // Compute measurements for autoposition methods reuse.
433
- this.measurements = this.getAutoLayoutmeasurements();
434
- var corner = this.getoriginCorner();
435
- var maxMenuSurfaceHeight = this.getMenuSurfaceMaxHeight(corner);
436
- var verticalAlignment = this.hasBit(corner, CornerBit.BOTTOM) ? 'bottom' : 'top';
437
- var horizontalAlignment = this.hasBit(corner, CornerBit.RIGHT) ? 'right' : 'left';
438
- var horizontalOffset = this.getHorizontalOriginOffset(corner);
439
- var verticalOffset = this.getVerticalOriginOffset(corner);
440
- var _b = this.measurements, anchorSize = _b.anchorSize, surfaceSize = _b.surfaceSize;
441
- var position = (_a = {},
442
- _a[horizontalAlignment] = horizontalOffset,
443
- _a[verticalAlignment] = verticalOffset,
444
- _a);
445
- // Center align when anchor width is comparable or greater than menu
446
- // surface, otherwise keep corner.
447
- if (anchorSize.width / surfaceSize.width >
448
- numbers.ANCHOR_TO_MENU_SURFACE_WIDTH_RATIO) {
449
- horizontalAlignment = 'center';
450
- }
451
- // If the menu-surface has been hoisted to the body, it's no longer relative
452
- // to the anchor element
453
- if (this.isHoistedElement || this.isFixedPosition) {
454
- this.adjustPositionForHoistedElement(position);
455
- }
456
- this.adapter.setTransformOrigin(horizontalAlignment + " " + verticalAlignment);
457
- this.adapter.setPosition(position);
458
- this.adapter.setMaxHeight(maxMenuSurfaceHeight ? maxMenuSurfaceHeight + 'px' : '');
459
- // If it is opened from the top then add is-open-below class
460
- if (!this.hasBit(corner, CornerBit.BOTTOM)) {
461
- this.adapter.addClass(MDCMenuSurfaceFoundation.cssClasses.IS_OPEN_BELOW);
462
- }
463
- };
464
- /**
465
- * @return Measurements used to position menu surface popup.
466
- */
467
- MDCMenuSurfaceFoundation.prototype.getAutoLayoutmeasurements = function () {
468
- var anchorRect = this.adapter.getAnchorDimensions();
469
- var bodySize = this.adapter.getBodyDimensions();
470
- var viewportSize = this.adapter.getWindowDimensions();
471
- var windowScroll = this.adapter.getWindowScroll();
472
- if (!anchorRect) {
473
- // tslint:disable:object-literal-sort-keys Positional properties are more readable when they're grouped together
474
- anchorRect = {
475
- top: this.position.y,
476
- right: this.position.x,
477
- bottom: this.position.y,
478
- left: this.position.x,
479
- width: 0,
480
- height: 0,
481
- };
482
- // tslint:enable:object-literal-sort-keys
483
- }
484
- return {
485
- anchorSize: anchorRect,
486
- bodySize: bodySize,
487
- surfaceSize: this.dimensions,
488
- viewportDistance: {
489
- // tslint:disable:object-literal-sort-keys Positional properties are more readable when they're grouped together
490
- top: anchorRect.top,
491
- right: viewportSize.width - anchorRect.right,
492
- bottom: viewportSize.height - anchorRect.bottom,
493
- left: anchorRect.left,
494
- // tslint:enable:object-literal-sort-keys
495
- },
496
- viewportSize: viewportSize,
497
- windowScroll: windowScroll,
498
- };
499
- };
500
- /**
501
- * Computes the corner of the anchor from which to animate and position the
502
- * menu surface.
503
- *
504
- * Only LEFT or RIGHT bit is used to position the menu surface ignoring RTL
505
- * context. E.g., menu surface will be positioned from right side on TOP_END.
506
- */
507
- MDCMenuSurfaceFoundation.prototype.getoriginCorner = function () {
508
- var corner = this.originCorner;
509
- var _a = this.measurements, viewportDistance = _a.viewportDistance, anchorSize = _a.anchorSize, surfaceSize = _a.surfaceSize;
510
- var MARGIN_TO_EDGE = MDCMenuSurfaceFoundation.numbers.MARGIN_TO_EDGE;
511
- var isAnchoredToBottom = this.hasBit(this.anchorCorner, CornerBit.BOTTOM);
512
- var availableTop;
513
- var availableBottom;
514
- if (isAnchoredToBottom) {
515
- availableTop =
516
- viewportDistance.top - MARGIN_TO_EDGE + this.anchorMargin.bottom;
517
- availableBottom =
518
- viewportDistance.bottom - MARGIN_TO_EDGE - this.anchorMargin.bottom;
519
- }
520
- else {
521
- availableTop =
522
- viewportDistance.top - MARGIN_TO_EDGE + this.anchorMargin.top;
523
- availableBottom = viewportDistance.bottom - MARGIN_TO_EDGE +
524
- anchorSize.height - this.anchorMargin.top;
525
- }
526
- var isAvailableBottom = availableBottom - surfaceSize.height > 0;
527
- if (!isAvailableBottom && availableTop > availableBottom) {
528
- // Attach bottom side of surface to the anchor.
529
- corner = this.setBit(corner, CornerBit.BOTTOM);
530
- }
531
- var isRtl = this.adapter.isRtl();
532
- var isFlipRtl = this.hasBit(this.anchorCorner, CornerBit.FLIP_RTL);
533
- var hasRightBit = this.hasBit(this.anchorCorner, CornerBit.RIGHT) ||
534
- this.hasBit(corner, CornerBit.RIGHT);
535
- // Whether surface attached to right side of anchor element.
536
- var isAnchoredToRight = false;
537
- // Anchored to start
538
- if (isRtl && isFlipRtl) {
539
- isAnchoredToRight = !hasRightBit;
540
- }
541
- else {
542
- // Anchored to right
543
- isAnchoredToRight = hasRightBit;
544
- }
545
- var availableLeft;
546
- var availableRight;
547
- if (isAnchoredToRight) {
548
- availableLeft =
549
- viewportDistance.left + anchorSize.width + this.anchorMargin.right;
550
- availableRight = viewportDistance.right - this.anchorMargin.right;
551
- }
552
- else {
553
- availableLeft = viewportDistance.left + this.anchorMargin.left;
554
- availableRight =
555
- viewportDistance.right + anchorSize.width - this.anchorMargin.left;
556
- }
557
- var isAvailableLeft = availableLeft - surfaceSize.width > 0;
558
- var isAvailableRight = availableRight - surfaceSize.width > 0;
559
- var isOriginCornerAlignedToEnd = this.hasBit(corner, CornerBit.FLIP_RTL) &&
560
- this.hasBit(corner, CornerBit.RIGHT);
561
- if (isAvailableRight && isOriginCornerAlignedToEnd && isRtl ||
562
- !isAvailableLeft && isOriginCornerAlignedToEnd) {
563
- // Attach left side of surface to the anchor.
564
- corner = this.unsetBit(corner, CornerBit.RIGHT);
565
- }
566
- else if (isAvailableLeft && isAnchoredToRight && isRtl ||
567
- (isAvailableLeft && !isAnchoredToRight && hasRightBit) ||
568
- (!isAvailableRight && availableLeft >= availableRight)) {
569
- // Attach right side of surface to the anchor.
570
- corner = this.setBit(corner, CornerBit.RIGHT);
571
- }
572
- return corner;
573
- };
574
- /**
575
- * @param corner Origin corner of the menu surface.
576
- * @return Maximum height of the menu surface, based on available space. 0
577
- * indicates should not be set.
578
- */
579
- MDCMenuSurfaceFoundation.prototype.getMenuSurfaceMaxHeight = function (corner) {
580
- if (this.maxHeight > 0) {
581
- return this.maxHeight;
582
- }
583
- var viewportDistance = this.measurements.viewportDistance;
584
- var maxHeight = 0;
585
- var isBottomAligned = this.hasBit(corner, CornerBit.BOTTOM);
586
- var isBottomAnchored = this.hasBit(this.anchorCorner, CornerBit.BOTTOM);
587
- var MARGIN_TO_EDGE = MDCMenuSurfaceFoundation.numbers.MARGIN_TO_EDGE;
588
- // When maximum height is not specified, it is handled from CSS.
589
- if (isBottomAligned) {
590
- maxHeight = viewportDistance.top + this.anchorMargin.top - MARGIN_TO_EDGE;
591
- if (!isBottomAnchored) {
592
- maxHeight += this.measurements.anchorSize.height;
593
- }
594
- }
595
- else {
596
- maxHeight = viewportDistance.bottom - this.anchorMargin.bottom +
597
- this.measurements.anchorSize.height - MARGIN_TO_EDGE;
598
- if (isBottomAnchored) {
599
- maxHeight -= this.measurements.anchorSize.height;
600
- }
601
- }
602
- return maxHeight;
603
- };
604
- /**
605
- * @param corner Origin corner of the menu surface.
606
- * @return Horizontal offset of menu surface origin corner from corresponding
607
- * anchor corner.
608
- */
609
- MDCMenuSurfaceFoundation.prototype.getHorizontalOriginOffset = function (corner) {
610
- var anchorSize = this.measurements.anchorSize;
611
- // isRightAligned corresponds to using the 'right' property on the surface.
612
- var isRightAligned = this.hasBit(corner, CornerBit.RIGHT);
613
- var avoidHorizontalOverlap = this.hasBit(this.anchorCorner, CornerBit.RIGHT);
614
- if (isRightAligned) {
615
- var rightOffset = avoidHorizontalOverlap ?
616
- anchorSize.width - this.anchorMargin.left :
617
- this.anchorMargin.right;
618
- // For hoisted or fixed elements, adjust the offset by the difference
619
- // between viewport width and body width so when we calculate the right
620
- // value (`adjustPositionForHoistedElement`) based on the element
621
- // position, the right property is correct.
622
- if (this.isHoistedElement || this.isFixedPosition) {
623
- return rightOffset -
624
- (this.measurements.viewportSize.width -
625
- this.measurements.bodySize.width);
626
- }
627
- return rightOffset;
628
- }
629
- return avoidHorizontalOverlap ? anchorSize.width - this.anchorMargin.right :
630
- this.anchorMargin.left;
631
- };
632
- /**
633
- * @param corner Origin corner of the menu surface.
634
- * @return Vertical offset of menu surface origin corner from corresponding
635
- * anchor corner.
636
- */
637
- MDCMenuSurfaceFoundation.prototype.getVerticalOriginOffset = function (corner) {
638
- var anchorSize = this.measurements.anchorSize;
639
- var isBottomAligned = this.hasBit(corner, CornerBit.BOTTOM);
640
- var avoidVerticalOverlap = this.hasBit(this.anchorCorner, CornerBit.BOTTOM);
641
- var y = 0;
642
- if (isBottomAligned) {
643
- y = avoidVerticalOverlap ? anchorSize.height - this.anchorMargin.top :
644
- -this.anchorMargin.bottom;
645
- }
646
- else {
647
- y = avoidVerticalOverlap ?
648
- (anchorSize.height + this.anchorMargin.bottom) :
649
- this.anchorMargin.top;
650
- }
651
- return y;
652
- };
653
- /**
654
- * Calculates the offsets for positioning the menu-surface when the
655
- * menu-surface has been hoisted to the body.
656
- */
657
- MDCMenuSurfaceFoundation.prototype.adjustPositionForHoistedElement = function (position) {
658
- var e_1, _a;
659
- var _b = this.measurements, windowScroll = _b.windowScroll, viewportDistance = _b.viewportDistance, surfaceSize = _b.surfaceSize, viewportSize = _b.viewportSize;
660
- var props = Object.keys(position);
661
- try {
662
- for (var props_1 = __values(props), props_1_1 = props_1.next(); !props_1_1.done; props_1_1 = props_1.next()) {
663
- var prop = props_1_1.value;
664
- var value = position[prop] || 0;
665
- if (this.isHorizontallyCenteredOnViewport &&
666
- (prop === 'left' || prop === 'right')) {
667
- position[prop] = (viewportSize.width - surfaceSize.width) / 2;
668
- continue;
669
- }
670
- // Hoisted surfaces need to have the anchor elements location on the page
671
- // added to the position properties for proper alignment on the body.
672
- value += viewportDistance[prop];
673
- // Surfaces that are absolutely positioned need to have additional
674
- // calculations for scroll and bottom positioning.
675
- if (!this.isFixedPosition) {
676
- if (prop === 'top') {
677
- value += windowScroll.y;
678
- }
679
- else if (prop === 'bottom') {
680
- value -= windowScroll.y;
681
- }
682
- else if (prop === 'left') {
683
- value += windowScroll.x;
684
- }
685
- else { // prop === 'right'
686
- value -= windowScroll.x;
687
- }
688
- }
689
- position[prop] = value;
690
- }
691
- }
692
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
693
- finally {
694
- try {
695
- if (props_1_1 && !props_1_1.done && (_a = props_1.return)) _a.call(props_1);
696
- }
697
- finally { if (e_1) throw e_1.error; }
698
- }
699
- };
700
- /**
701
- * The last focused element when the menu surface was opened should regain
702
- * focus, if the user is focused on or within the menu surface when it is
703
- * closed.
704
- */
705
- MDCMenuSurfaceFoundation.prototype.maybeRestoreFocus = function () {
706
- var _this = this;
707
- var isRootFocused = this.adapter.isFocused();
708
- var childHasFocus = document.activeElement &&
709
- this.adapter.isElementInContainer(document.activeElement);
710
- if (isRootFocused || childHasFocus) {
711
- // Wait before restoring focus when closing the menu surface. This is
712
- // important because if a touch event triggered the menu close, and the
713
- // subsequent mouse event occurs after focus is restored, then the
714
- // restored focus would be lost.
715
- setTimeout(function () {
716
- _this.adapter.restoreFocus();
717
- }, numbers.TOUCH_EVENT_WAIT_MS);
718
- }
719
- };
720
- MDCMenuSurfaceFoundation.prototype.hasBit = function (corner, bit) {
721
- return Boolean(corner & bit); // tslint:disable-line:no-bitwise
722
- };
723
- MDCMenuSurfaceFoundation.prototype.setBit = function (corner, bit) {
724
- return corner | bit; // tslint:disable-line:no-bitwise
725
- };
726
- MDCMenuSurfaceFoundation.prototype.unsetBit = function (corner, bit) {
727
- return corner ^ bit;
728
- };
729
- /**
730
- * isFinite that doesn't force conversion to number type.
731
- * Equivalent to Number.isFinite in ES2015, which is not supported in IE.
732
- */
733
- MDCMenuSurfaceFoundation.prototype.isFinite = function (num) {
734
- return typeof num === 'number' && isFinite(num);
735
- };
736
- return MDCMenuSurfaceFoundation;
737
- }(MDCFoundation));
738
-
739
- /**
740
- * @license
741
- * Copyright 2018 Google Inc.
742
- *
743
- * Permission is hereby granted, free of charge, to any person obtaining a copy
744
- * of this software and associated documentation files (the "Software"), to deal
745
- * in the Software without restriction, including without limitation the rights
746
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
747
- * copies of the Software, and to permit persons to whom the Software is
748
- * furnished to do so, subject to the following conditions:
749
- *
750
- * The above copyright notice and this permission notice shall be included in
751
- * all copies or substantial portions of the Software.
752
- *
753
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
754
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
755
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
756
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
757
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
758
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
759
- * THE SOFTWARE.
760
- */
761
- var MDCMenuSurface = /** @class */ (function (_super) {
762
- __extends(MDCMenuSurface, _super);
763
- function MDCMenuSurface() {
764
- return _super !== null && _super.apply(this, arguments) || this;
765
- }
766
- MDCMenuSurface.attachTo = function (root) {
767
- return new MDCMenuSurface(root);
768
- };
769
- MDCMenuSurface.prototype.initialSyncWithDOM = function () {
770
- var _this = this;
771
- var parentEl = this.root.parentElement;
772
- this.anchorElement = parentEl && parentEl.classList.contains(cssClasses.ANCHOR) ? parentEl : null;
773
- if (this.root.classList.contains(cssClasses.FIXED)) {
774
- this.setFixedPosition(true);
775
- }
776
- this.handleKeydown = function (event) {
777
- _this.foundation.handleKeydown(event);
778
- };
779
- this.handleBodyClick = function (event) {
780
- _this.foundation.handleBodyClick(event);
781
- };
782
- // capture so that no race between handleBodyClick and quickOpen when
783
- // menusurface opened on button click which registers this listener
784
- this.registerBodyClickListener = function () {
785
- document.body.addEventListener('click', _this.handleBodyClick, { capture: true });
786
- };
787
- this.deregisterBodyClickListener = function () {
788
- document.body.removeEventListener('click', _this.handleBodyClick, { capture: true });
789
- };
790
- this.listen('keydown', this.handleKeydown);
791
- this.listen(strings.OPENED_EVENT, this.registerBodyClickListener);
792
- this.listen(strings.CLOSED_EVENT, this.deregisterBodyClickListener);
793
- };
794
- MDCMenuSurface.prototype.destroy = function () {
795
- this.unlisten('keydown', this.handleKeydown);
796
- this.unlisten(strings.OPENED_EVENT, this.registerBodyClickListener);
797
- this.unlisten(strings.CLOSED_EVENT, this.deregisterBodyClickListener);
798
- _super.prototype.destroy.call(this);
799
- };
800
- MDCMenuSurface.prototype.isOpen = function () {
801
- return this.foundation.isOpen();
802
- };
803
- MDCMenuSurface.prototype.open = function () {
804
- this.foundation.open();
805
- };
806
- MDCMenuSurface.prototype.close = function (skipRestoreFocus) {
807
- if (skipRestoreFocus === void 0) { skipRestoreFocus = false; }
808
- this.foundation.close(skipRestoreFocus);
809
- };
810
- Object.defineProperty(MDCMenuSurface.prototype, "quickOpen", {
811
- set: function (quickOpen) {
812
- this.foundation.setQuickOpen(quickOpen);
813
- },
814
- enumerable: false,
815
- configurable: true
816
- });
817
- /** Sets the foundation to use page offsets for an positioning when the menu is hoisted to the body. */
818
- MDCMenuSurface.prototype.setIsHoisted = function (isHoisted) {
819
- this.foundation.setIsHoisted(isHoisted);
820
- };
821
- /** Sets the element that the menu-surface is anchored to. */
822
- MDCMenuSurface.prototype.setMenuSurfaceAnchorElement = function (element) {
823
- this.anchorElement = element;
824
- };
825
- /** Sets the menu-surface to position: fixed. */
826
- MDCMenuSurface.prototype.setFixedPosition = function (isFixed) {
827
- if (isFixed) {
828
- this.root.classList.add(cssClasses.FIXED);
829
- }
830
- else {
831
- this.root.classList.remove(cssClasses.FIXED);
832
- }
833
- this.foundation.setFixedPosition(isFixed);
834
- };
835
- /** Sets the absolute x/y position to position based on. Requires the menu to be hoisted. */
836
- MDCMenuSurface.prototype.setAbsolutePosition = function (x, y) {
837
- this.foundation.setAbsolutePosition(x, y);
838
- this.setIsHoisted(true);
839
- };
840
- /**
841
- * @param corner Default anchor corner alignment of top-left surface corner.
842
- */
843
- MDCMenuSurface.prototype.setAnchorCorner = function (corner) {
844
- this.foundation.setAnchorCorner(corner);
845
- };
846
- MDCMenuSurface.prototype.setAnchorMargin = function (margin) {
847
- this.foundation.setAnchorMargin(margin);
848
- };
849
- MDCMenuSurface.prototype.getDefaultFoundation = function () {
850
- var _this = this;
851
- // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
852
- // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
853
- // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
854
- var adapter = {
855
- addClass: function (className) { return _this.root.classList.add(className); },
856
- removeClass: function (className) { return _this.root.classList.remove(className); },
857
- hasClass: function (className) { return _this.root.classList.contains(className); },
858
- hasAnchor: function () { return !!_this.anchorElement; },
859
- notifyClose: function () {
860
- return _this.emit(MDCMenuSurfaceFoundation.strings.CLOSED_EVENT, {});
861
- },
862
- notifyClosing: function () {
863
- _this.emit(MDCMenuSurfaceFoundation.strings.CLOSING_EVENT, {});
864
- },
865
- notifyOpen: function () {
866
- return _this.emit(MDCMenuSurfaceFoundation.strings.OPENED_EVENT, {});
867
- },
868
- isElementInContainer: function (el) { return _this.root.contains(el); },
869
- isRtl: function () {
870
- return getComputedStyle(_this.root).getPropertyValue('direction') === 'rtl';
871
- },
872
- setTransformOrigin: function (origin) {
873
- var propertyName = getCorrectPropertyName(window, 'transform') + "-origin";
874
- _this.root.style.setProperty(propertyName, origin);
875
- },
876
- isFocused: function () { return document.activeElement === _this.root; },
877
- saveFocus: function () {
878
- _this.previousFocus =
879
- document.activeElement;
880
- },
881
- restoreFocus: function () {
882
- if (_this.root.contains(document.activeElement)) {
883
- if (_this.previousFocus && _this.previousFocus.focus) {
884
- _this.previousFocus.focus();
885
- }
886
- }
887
- },
888
- getInnerDimensions: function () {
889
- return {
890
- width: _this.root.offsetWidth,
891
- height: _this.root.offsetHeight
892
- };
893
- },
894
- getAnchorDimensions: function () { return _this.anchorElement ?
895
- _this.anchorElement.getBoundingClientRect() :
896
- null; },
897
- getWindowDimensions: function () {
898
- return { width: window.innerWidth, height: window.innerHeight };
899
- },
900
- getBodyDimensions: function () {
901
- return { width: document.body.clientWidth, height: document.body.clientHeight };
902
- },
903
- getWindowScroll: function () {
904
- return { x: window.pageXOffset, y: window.pageYOffset };
905
- },
906
- setPosition: function (position) {
907
- var rootHTML = _this.root;
908
- rootHTML.style.left = 'left' in position ? position.left + "px" : '';
909
- rootHTML.style.right = 'right' in position ? position.right + "px" : '';
910
- rootHTML.style.top = 'top' in position ? position.top + "px" : '';
911
- rootHTML.style.bottom =
912
- 'bottom' in position ? position.bottom + "px" : '';
913
- },
914
- setMaxHeight: function (height) {
915
- _this.root.style.maxHeight = height;
916
- },
917
- };
918
- // tslint:enable:object-literal-sort-keys
919
- return new MDCMenuSurfaceFoundation(adapter);
920
- };
921
- return MDCMenuSurface;
922
- }(MDCComponent));
923
-
924
- export { Corner as C, MDCMenuSurfaceFoundation as M, MDCMenuSurface as a };
925
-
926
- //# sourceMappingURL=component-6d079abe.js.map