1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 | (function webpackUniversalModuleDefinition(root, factory) {
|
9 | if(typeof exports === 'object' && typeof module === 'object')
|
10 | module.exports = factory();
|
11 | else if(typeof define === 'function' && define.amd)
|
12 | define("material-components-web", [], factory);
|
13 | else if(typeof exports === 'object')
|
14 | exports["mdc"] = factory();
|
15 | else
|
16 | root["mdc"] = factory();
|
17 | })(this, function() {
|
18 | return (function(modules) {
|
19 |
|
20 | var installedModules = {};
|
21 |
|
22 |
|
23 | function __webpack_require__(moduleId) {
|
24 |
|
25 |
|
26 | if(installedModules[moduleId]) {
|
27 | return installedModules[moduleId].exports;
|
28 | }
|
29 |
|
30 | var module = installedModules[moduleId] = {
|
31 | i: moduleId,
|
32 | l: false,
|
33 | exports: {}
|
34 | };
|
35 |
|
36 |
|
37 | modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
38 |
|
39 |
|
40 | module.l = true;
|
41 |
|
42 |
|
43 | return module.exports;
|
44 | }
|
45 |
|
46 |
|
47 |
|
48 | __webpack_require__.m = modules;
|
49 |
|
50 |
|
51 | __webpack_require__.c = installedModules;
|
52 |
|
53 |
|
54 | __webpack_require__.d = function(exports, name, getter) {
|
55 | if(!__webpack_require__.o(exports, name)) {
|
56 | Object.defineProperty(exports, name, { enumerable: true, get: getter });
|
57 | }
|
58 | };
|
59 |
|
60 |
|
61 | __webpack_require__.r = function(exports) {
|
62 | if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
63 | Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
64 | }
|
65 | Object.defineProperty(exports, '__esModule', { value: true });
|
66 | };
|
67 |
|
68 |
|
69 |
|
70 |
|
71 |
|
72 |
|
73 | __webpack_require__.t = function(value, mode) {
|
74 | if(mode & 1) value = __webpack_require__(value);
|
75 | if(mode & 8) return value;
|
76 | if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
|
77 | var ns = Object.create(null);
|
78 | __webpack_require__.r(ns);
|
79 | Object.defineProperty(ns, 'default', { enumerable: true, value: value });
|
80 | if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
|
81 | return ns;
|
82 | };
|
83 |
|
84 |
|
85 | __webpack_require__.n = function(module) {
|
86 | var getter = module && module.__esModule ?
|
87 | function getDefault() { return module['default']; } :
|
88 | function getModuleExports() { return module; };
|
89 | __webpack_require__.d(getter, 'a', getter);
|
90 | return getter;
|
91 | };
|
92 |
|
93 |
|
94 | __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
95 |
|
96 |
|
97 | __webpack_require__.p = "";
|
98 |
|
99 |
|
100 |
|
101 | return __webpack_require__(__webpack_require__.s = "./packages/material-components-web/index.ts");
|
102 | })
|
103 |
|
104 | ({
|
105 |
|
106 | "./packages/material-components-web/index.ts":
|
107 |
|
108 |
|
109 |
|
110 |
|
111 | (function(module, exports, __webpack_require__) {
|
112 |
|
113 | "use strict";
|
114 |
|
115 |
|
116 |
|
117 |
|
118 |
|
119 |
|
120 |
|
121 |
|
122 |
|
123 |
|
124 |
|
125 |
|
126 |
|
127 |
|
128 |
|
129 |
|
130 |
|
131 |
|
132 |
|
133 |
|
134 |
|
135 |
|
136 |
|
137 |
|
138 | var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
|
139 | if (k2 === undefined) k2 = k;
|
140 | Object.defineProperty(o, k2, { enumerable: true, get: function get() {
|
141 | return m[k];
|
142 | } });
|
143 | } : function (o, m, k, k2) {
|
144 | if (k2 === undefined) k2 = k;
|
145 | o[k2] = m[k];
|
146 | });
|
147 | var __setModuleDefault = this && this.__setModuleDefault || (Object.create ? function (o, v) {
|
148 | Object.defineProperty(o, "default", { enumerable: true, value: v });
|
149 | } : function (o, v) {
|
150 | o["default"] = v;
|
151 | });
|
152 | var __importStar = this && this.__importStar || function (mod) {
|
153 | if (mod && mod.__esModule) return mod;
|
154 | var result = {};
|
155 | if (mod != null) for (var k in mod) {
|
156 | if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
157 | }__setModuleDefault(result, mod);
|
158 | return result;
|
159 | };
|
160 | var __importDefault = this && this.__importDefault || function (mod) {
|
161 | return mod && mod.__esModule ? mod : { "default": mod };
|
162 | };
|
163 | Object.defineProperty(exports, "__esModule", { value: true });
|
164 | exports.topAppBar = exports.tooltip = exports.textField = exports.tabScroller = exports.tabIndicator = exports.tabBar = exports.tab = exports.switchControl = exports.snackbar = exports.slider = exports.select = exports.segmentedButton = exports.ripple = exports.radio = exports.notchedOutline = exports.menuSurface = exports.menu = exports.list = exports.linearProgress = exports.lineRipple = exports.iconButton = exports.formField = exports.floatingLabel = exports.drawer = exports.dom = exports.dialog = exports.dataTable = exports.circularProgress = exports.chips = exports.checkbox = exports.base = exports.banner = exports.autoInit = void 0;
|
165 | var index_1 = __importDefault(__webpack_require__( "./packages/mdc-auto-init/index.ts"));
|
166 | exports.autoInit = index_1.default;
|
167 | var banner = __importStar(__webpack_require__( "./packages/mdc-banner/index.ts"));
|
168 | exports.banner = banner;
|
169 | var base = __importStar(__webpack_require__( "./packages/mdc-base/index.ts"));
|
170 | exports.base = base;
|
171 | var checkbox = __importStar(__webpack_require__( "./packages/mdc-checkbox/index.ts"));
|
172 | exports.checkbox = checkbox;
|
173 | var chips = __importStar(__webpack_require__( "./packages/mdc-chips/deprecated/index.ts"));
|
174 | exports.chips = chips;
|
175 | var circularProgress = __importStar(__webpack_require__( "./packages/mdc-circular-progress/index.ts"));
|
176 | exports.circularProgress = circularProgress;
|
177 | var dataTable = __importStar(__webpack_require__( "./packages/mdc-data-table/index.ts"));
|
178 | exports.dataTable = dataTable;
|
179 | var dialog = __importStar(__webpack_require__( "./packages/mdc-dialog/index.ts"));
|
180 | exports.dialog = dialog;
|
181 | var dom = __importStar(__webpack_require__( "./packages/mdc-dom/index.ts"));
|
182 | exports.dom = dom;
|
183 | var drawer = __importStar(__webpack_require__( "./packages/mdc-drawer/index.ts"));
|
184 | exports.drawer = drawer;
|
185 | var floatingLabel = __importStar(__webpack_require__( "./packages/mdc-floating-label/index.ts"));
|
186 | exports.floatingLabel = floatingLabel;
|
187 | var formField = __importStar(__webpack_require__( "./packages/mdc-form-field/index.ts"));
|
188 | exports.formField = formField;
|
189 | var iconButton = __importStar(__webpack_require__( "./packages/mdc-icon-button/index.ts"));
|
190 | exports.iconButton = iconButton;
|
191 | var lineRipple = __importStar(__webpack_require__( "./packages/mdc-line-ripple/index.ts"));
|
192 | exports.lineRipple = lineRipple;
|
193 | var linearProgress = __importStar(__webpack_require__( "./packages/mdc-linear-progress/index.ts"));
|
194 | exports.linearProgress = linearProgress;
|
195 | var list = __importStar(__webpack_require__( "./packages/mdc-list/index.ts"));
|
196 | exports.list = list;
|
197 | var menuSurface = __importStar(__webpack_require__( "./packages/mdc-menu-surface/index.ts"));
|
198 | exports.menuSurface = menuSurface;
|
199 | var menu = __importStar(__webpack_require__( "./packages/mdc-menu/index.ts"));
|
200 | exports.menu = menu;
|
201 | var notchedOutline = __importStar(__webpack_require__( "./packages/mdc-notched-outline/index.ts"));
|
202 | exports.notchedOutline = notchedOutline;
|
203 | var radio = __importStar(__webpack_require__( "./packages/mdc-radio/index.ts"));
|
204 | exports.radio = radio;
|
205 | var ripple = __importStar(__webpack_require__( "./packages/mdc-ripple/index.ts"));
|
206 | exports.ripple = ripple;
|
207 | var segmentedButton = __importStar(__webpack_require__( "./packages/mdc-segmented-button/index.ts"));
|
208 | exports.segmentedButton = segmentedButton;
|
209 | var select = __importStar(__webpack_require__( "./packages/mdc-select/index.ts"));
|
210 | exports.select = select;
|
211 | var slider = __importStar(__webpack_require__( "./packages/mdc-slider/index.ts"));
|
212 | exports.slider = slider;
|
213 | var snackbar = __importStar(__webpack_require__( "./packages/mdc-snackbar/index.ts"));
|
214 | exports.snackbar = snackbar;
|
215 | var switchControl = __importStar(__webpack_require__( "./packages/mdc-switch/index.ts"));
|
216 | exports.switchControl = switchControl;
|
217 | var tabBar = __importStar(__webpack_require__( "./packages/mdc-tab-bar/index.ts"));
|
218 | exports.tabBar = tabBar;
|
219 | var tabIndicator = __importStar(__webpack_require__( "./packages/mdc-tab-indicator/index.ts"));
|
220 | exports.tabIndicator = tabIndicator;
|
221 | var tabScroller = __importStar(__webpack_require__( "./packages/mdc-tab-scroller/index.ts"));
|
222 | exports.tabScroller = tabScroller;
|
223 | var tab = __importStar(__webpack_require__( "./packages/mdc-tab/index.ts"));
|
224 | exports.tab = tab;
|
225 | var textField = __importStar(__webpack_require__( "./packages/mdc-textfield/index.ts"));
|
226 | exports.textField = textField;
|
227 | var tooltip = __importStar(__webpack_require__( "./packages/mdc-tooltip/index.ts"));
|
228 | exports.tooltip = tooltip;
|
229 | var topAppBar = __importStar(__webpack_require__( "./packages/mdc-top-app-bar/index.ts"));
|
230 | exports.topAppBar = topAppBar;
|
231 |
|
232 | index_1.default.register('MDCBanner', banner.MDCBanner);
|
233 | index_1.default.register('MDCCheckbox', checkbox.MDCCheckbox);
|
234 | index_1.default.register('MDCChip', chips.MDCChip);
|
235 | index_1.default.register('MDCChipSet', chips.MDCChipSet);
|
236 | index_1.default.register('MDCCircularProgress', circularProgress.MDCCircularProgress);
|
237 | index_1.default.register('MDCDataTable', dataTable.MDCDataTable);
|
238 | index_1.default.register('MDCDialog', dialog.MDCDialog);
|
239 | index_1.default.register('MDCDrawer', drawer.MDCDrawer);
|
240 | index_1.default.register('MDCFloatingLabel', floatingLabel.MDCFloatingLabel);
|
241 | index_1.default.register('MDCFormField', formField.MDCFormField);
|
242 | index_1.default.register('MDCIconButtonToggle', iconButton.MDCIconButtonToggle);
|
243 | index_1.default.register('MDCLineRipple', lineRipple.MDCLineRipple);
|
244 | index_1.default.register('MDCLinearProgress', linearProgress.MDCLinearProgress);
|
245 | index_1.default.register('MDCList', list.MDCList);
|
246 | index_1.default.register('MDCMenu', menu.MDCMenu);
|
247 | index_1.default.register('MDCMenuSurface', menuSurface.MDCMenuSurface);
|
248 | index_1.default.register('MDCNotchedOutline', notchedOutline.MDCNotchedOutline);
|
249 | index_1.default.register('MDCRadio', radio.MDCRadio);
|
250 | index_1.default.register('MDCRipple', ripple.MDCRipple);
|
251 | index_1.default.register('MDCSegmentedButton', segmentedButton.MDCSegmentedButton);
|
252 | index_1.default.register('MDCSelect', select.MDCSelect);
|
253 | index_1.default.register('MDCSlider', slider.MDCSlider);
|
254 | index_1.default.register('MDCSnackbar', snackbar.MDCSnackbar);
|
255 | index_1.default.register('MDCSwitch', switchControl.MDCSwitch);
|
256 | index_1.default.register('MDCTabBar', tabBar.MDCTabBar);
|
257 | index_1.default.register('MDCTextField', textField.MDCTextField);
|
258 | index_1.default.register('MDCTooltip', tooltip.MDCTooltip);
|
259 | index_1.default.register('MDCTopAppBar', topAppBar.MDCTopAppBar);
|
260 |
|
261 | }),
|
262 |
|
263 | "./packages/mdc-animation/animationframe.ts":
|
264 |
|
265 |
|
266 |
|
267 |
|
268 | (function(module, exports, __webpack_require__) {
|
269 |
|
270 | "use strict";
|
271 |
|
272 |
|
273 |
|
274 |
|
275 |
|
276 |
|
277 |
|
278 |
|
279 |
|
280 |
|
281 |
|
282 |
|
283 |
|
284 |
|
285 |
|
286 |
|
287 |
|
288 |
|
289 |
|
290 |
|
291 |
|
292 |
|
293 |
|
294 |
|
295 | Object.defineProperty(exports, "__esModule", { value: true });
|
296 | exports.AnimationFrame = void 0;
|
297 |
|
298 |
|
299 |
|
300 |
|
301 | var AnimationFrame = function () {
|
302 | function AnimationFrame() {
|
303 | this.rafIDs = new Map();
|
304 | }
|
305 | |
306 |
|
307 |
|
308 |
|
309 |
|
310 | AnimationFrame.prototype.request = function (key, callback) {
|
311 | var _this = this;
|
312 | this.cancel(key);
|
313 | var frameID = requestAnimationFrame(function (frame) {
|
314 | _this.rafIDs.delete(key);
|
315 |
|
316 |
|
317 | callback(frame);
|
318 | });
|
319 | this.rafIDs.set(key, frameID);
|
320 | };
|
321 | |
322 |
|
323 |
|
324 |
|
325 | AnimationFrame.prototype.cancel = function (key) {
|
326 | var rafID = this.rafIDs.get(key);
|
327 | if (rafID) {
|
328 | cancelAnimationFrame(rafID);
|
329 | this.rafIDs.delete(key);
|
330 | }
|
331 | };
|
332 | |
333 |
|
334 |
|
335 | AnimationFrame.prototype.cancelAll = function () {
|
336 | var _this = this;
|
337 |
|
338 |
|
339 |
|
340 | this.rafIDs.forEach(function (_, key) {
|
341 | _this.cancel(key);
|
342 | });
|
343 | };
|
344 | |
345 |
|
346 |
|
347 | AnimationFrame.prototype.getQueue = function () {
|
348 | var queue = [];
|
349 |
|
350 |
|
351 |
|
352 | this.rafIDs.forEach(function (_, key) {
|
353 | queue.push(key);
|
354 | });
|
355 | return queue;
|
356 | };
|
357 | return AnimationFrame;
|
358 | }();
|
359 | exports.AnimationFrame = AnimationFrame;
|
360 |
|
361 | }),
|
362 |
|
363 | "./packages/mdc-animation/util.ts":
|
364 |
|
365 |
|
366 |
|
367 |
|
368 | (function(module, exports, __webpack_require__) {
|
369 |
|
370 | "use strict";
|
371 |
|
372 |
|
373 |
|
374 |
|
375 |
|
376 |
|
377 |
|
378 |
|
379 |
|
380 |
|
381 |
|
382 |
|
383 |
|
384 |
|
385 |
|
386 |
|
387 |
|
388 |
|
389 |
|
390 |
|
391 |
|
392 |
|
393 |
|
394 |
|
395 | Object.defineProperty(exports, "__esModule", { value: true });
|
396 | exports.getCorrectEventName = exports.getCorrectPropertyName = void 0;
|
397 | var cssPropertyNameMap = {
|
398 | animation: {
|
399 | prefixed: '-webkit-animation',
|
400 | standard: 'animation'
|
401 | },
|
402 | transform: {
|
403 | prefixed: '-webkit-transform',
|
404 | standard: 'transform'
|
405 | },
|
406 | transition: {
|
407 | prefixed: '-webkit-transition',
|
408 | standard: 'transition'
|
409 | }
|
410 | };
|
411 | var jsEventTypeMap = {
|
412 | animationend: {
|
413 | cssProperty: 'animation',
|
414 | prefixed: 'webkitAnimationEnd',
|
415 | standard: 'animationend'
|
416 | },
|
417 | animationiteration: {
|
418 | cssProperty: 'animation',
|
419 | prefixed: 'webkitAnimationIteration',
|
420 | standard: 'animationiteration'
|
421 | },
|
422 | animationstart: {
|
423 | cssProperty: 'animation',
|
424 | prefixed: 'webkitAnimationStart',
|
425 | standard: 'animationstart'
|
426 | },
|
427 | transitionend: {
|
428 | cssProperty: 'transition',
|
429 | prefixed: 'webkitTransitionEnd',
|
430 | standard: 'transitionend'
|
431 | }
|
432 | };
|
433 | function isWindow(windowObj) {
|
434 | return Boolean(windowObj.document) && typeof windowObj.document.createElement === 'function';
|
435 | }
|
436 | function getCorrectPropertyName(windowObj, cssProperty) {
|
437 | if (isWindow(windowObj) && cssProperty in cssPropertyNameMap) {
|
438 | var el = windowObj.document.createElement('div');
|
439 | var _a = cssPropertyNameMap[cssProperty],
|
440 | standard = _a.standard,
|
441 | prefixed = _a.prefixed;
|
442 | var isStandard = standard in el.style;
|
443 | return isStandard ? standard : prefixed;
|
444 | }
|
445 | return cssProperty;
|
446 | }
|
447 | exports.getCorrectPropertyName = getCorrectPropertyName;
|
448 | function getCorrectEventName(windowObj, eventType) {
|
449 | if (isWindow(windowObj) && eventType in jsEventTypeMap) {
|
450 | var el = windowObj.document.createElement('div');
|
451 | var _a = jsEventTypeMap[eventType],
|
452 | standard = _a.standard,
|
453 | prefixed = _a.prefixed,
|
454 | cssProperty = _a.cssProperty;
|
455 | var isStandard = cssProperty in el.style;
|
456 | return isStandard ? standard : prefixed;
|
457 | }
|
458 | return eventType;
|
459 | }
|
460 | exports.getCorrectEventName = getCorrectEventName;
|
461 |
|
462 | }),
|
463 |
|
464 | "./packages/mdc-auto-init/constants.ts":
|
465 |
|
466 |
|
467 |
|
468 |
|
469 | (function(module, exports, __webpack_require__) {
|
470 |
|
471 | "use strict";
|
472 |
|
473 |
|
474 |
|
475 |
|
476 |
|
477 |
|
478 |
|
479 |
|
480 |
|
481 |
|
482 |
|
483 |
|
484 |
|
485 |
|
486 |
|
487 |
|
488 |
|
489 |
|
490 |
|
491 |
|
492 |
|
493 |
|
494 |
|
495 |
|
496 | Object.defineProperty(exports, "__esModule", { value: true });
|
497 | exports.strings = void 0;
|
498 | exports.strings = {
|
499 | AUTO_INIT_ATTR: 'data-mdc-auto-init',
|
500 | AUTO_INIT_STATE_ATTR: 'data-mdc-auto-init-state',
|
501 | INITIALIZED_STATE: 'initialized'
|
502 | };
|
503 |
|
504 | }),
|
505 |
|
506 | "./packages/mdc-auto-init/index.ts":
|
507 |
|
508 |
|
509 |
|
510 |
|
511 | (function(module, exports, __webpack_require__) {
|
512 |
|
513 | "use strict";
|
514 |
|
515 |
|
516 |
|
517 |
|
518 |
|
519 |
|
520 |
|
521 |
|
522 |
|
523 |
|
524 |
|
525 |
|
526 |
|
527 |
|
528 |
|
529 |
|
530 |
|
531 |
|
532 |
|
533 |
|
534 |
|
535 |
|
536 |
|
537 |
|
538 | var __values = this && this.__values || function (o) {
|
539 | var s = typeof Symbol === "function" && Symbol.iterator,
|
540 | m = s && o[s],
|
541 | i = 0;
|
542 | if (m) return m.call(o);
|
543 | if (o && typeof o.length === "number") return {
|
544 | next: function next() {
|
545 | if (o && i >= o.length) o = void 0;
|
546 | return { value: o && o[i++], done: !o };
|
547 | }
|
548 | };
|
549 | throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
550 | };
|
551 | Object.defineProperty(exports, "__esModule", { value: true });
|
552 | exports.mdcAutoInit = void 0;
|
553 | var constants_1 = __webpack_require__( "./packages/mdc-auto-init/constants.ts");
|
554 | var AUTO_INIT_ATTR = constants_1.strings.AUTO_INIT_ATTR,
|
555 | AUTO_INIT_STATE_ATTR = constants_1.strings.AUTO_INIT_STATE_ATTR,
|
556 | INITIALIZED_STATE = constants_1.strings.INITIALIZED_STATE;
|
557 | var registry = {};
|
558 | var CONSOLE_WARN = console.warn.bind(console);
|
559 | function emit(evtType, evtData, shouldBubble) {
|
560 | if (shouldBubble === void 0) {
|
561 | shouldBubble = false;
|
562 | }
|
563 | var evt;
|
564 | if (typeof CustomEvent === 'function') {
|
565 | evt = new CustomEvent(evtType, {
|
566 | bubbles: shouldBubble,
|
567 | detail: evtData
|
568 | });
|
569 | } else {
|
570 | evt = document.createEvent('CustomEvent');
|
571 | evt.initCustomEvent(evtType, shouldBubble, false, evtData);
|
572 | }
|
573 | document.dispatchEvent(evt);
|
574 | }
|
575 |
|
576 |
|
577 |
|
578 |
|
579 | function mdcAutoInit(root) {
|
580 | var e_1, _a;
|
581 | if (root === void 0) {
|
582 | root = document;
|
583 | }
|
584 | var components = [];
|
585 | var nodes = [].slice.call(root.querySelectorAll("[" + AUTO_INIT_ATTR + "]"));
|
586 | nodes = nodes.filter(function (node) {
|
587 | return node.getAttribute(AUTO_INIT_STATE_ATTR) !== INITIALIZED_STATE;
|
588 | });
|
589 | try {
|
590 | for (var nodes_1 = __values(nodes), nodes_1_1 = nodes_1.next(); !nodes_1_1.done; nodes_1_1 = nodes_1.next()) {
|
591 | var node = nodes_1_1.value;
|
592 | var ctorName = node.getAttribute(AUTO_INIT_ATTR);
|
593 | if (!ctorName) {
|
594 | throw new Error('(mdc-auto-init) Constructor name must be given.');
|
595 | }
|
596 | var Constructor = registry[ctorName];
|
597 | if (typeof Constructor !== 'function') {
|
598 | throw new Error("(mdc-auto-init) Could not find constructor in registry for " + ctorName);
|
599 | }
|
600 |
|
601 |
|
602 | var component = Constructor.attachTo(node);
|
603 | Object.defineProperty(node, ctorName, {
|
604 | configurable: true,
|
605 | enumerable: false,
|
606 | value: component,
|
607 | writable: false
|
608 | });
|
609 | components.push(component);
|
610 | node.setAttribute(AUTO_INIT_STATE_ATTR, INITIALIZED_STATE);
|
611 | }
|
612 | } catch (e_1_1) {
|
613 | e_1 = { error: e_1_1 };
|
614 | } finally {
|
615 | try {
|
616 | if (nodes_1_1 && !nodes_1_1.done && (_a = nodes_1.return)) _a.call(nodes_1);
|
617 | } finally {
|
618 | if (e_1) throw e_1.error;
|
619 | }
|
620 | }
|
621 | emit('MDCAutoInit:End', {});
|
622 | return components;
|
623 | }
|
624 | exports.mdcAutoInit = mdcAutoInit;
|
625 |
|
626 |
|
627 | mdcAutoInit.register = function (componentName, Constructor, warn) {
|
628 | if (warn === void 0) {
|
629 | warn = CONSOLE_WARN;
|
630 | }
|
631 | if (typeof Constructor !== 'function') {
|
632 | throw new Error("(mdc-auto-init) Invalid Constructor value: " + Constructor + ". Expected function.");
|
633 | }
|
634 | var registryValue = registry[componentName];
|
635 | if (registryValue) {
|
636 | warn("(mdc-auto-init) Overriding registration for " + componentName + " with " + Constructor + ". Was: " + registryValue);
|
637 | }
|
638 | registry[componentName] = Constructor;
|
639 | };
|
640 | mdcAutoInit.deregister = function (componentName) {
|
641 | delete registry[componentName];
|
642 | };
|
643 |
|
644 | mdcAutoInit.deregisterAll = function () {
|
645 | var keys = Object.keys(registry);
|
646 | keys.forEach(this.deregister, this);
|
647 | };
|
648 |
|
649 | exports.default = mdcAutoInit;
|
650 |
|
651 | }),
|
652 |
|
653 | "./packages/mdc-banner/adapter.ts":
|
654 |
|
655 |
|
656 |
|
657 |
|
658 | (function(module, exports, __webpack_require__) {
|
659 |
|
660 | "use strict";
|
661 |
|
662 |
|
663 |
|
664 |
|
665 |
|
666 |
|
667 |
|
668 |
|
669 |
|
670 |
|
671 |
|
672 |
|
673 |
|
674 |
|
675 |
|
676 |
|
677 |
|
678 |
|
679 |
|
680 |
|
681 |
|
682 |
|
683 |
|
684 |
|
685 | Object.defineProperty(exports, "__esModule", { value: true });
|
686 |
|
687 | }),
|
688 |
|
689 | "./packages/mdc-banner/component.ts":
|
690 |
|
691 |
|
692 |
|
693 |
|
694 | (function(module, exports, __webpack_require__) {
|
695 |
|
696 | "use strict";
|
697 |
|
698 |
|
699 |
|
700 |
|
701 |
|
702 |
|
703 |
|
704 |
|
705 |
|
706 |
|
707 |
|
708 |
|
709 |
|
710 |
|
711 |
|
712 |
|
713 |
|
714 |
|
715 |
|
716 |
|
717 |
|
718 |
|
719 |
|
720 |
|
721 | var __extends = this && this.__extends || function () {
|
722 | var _extendStatics = function extendStatics(d, b) {
|
723 | _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
|
724 | d.__proto__ = b;
|
725 | } || function (d, b) {
|
726 | for (var p in b) {
|
727 | if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
728 | }
|
729 | };
|
730 | return _extendStatics(d, b);
|
731 | };
|
732 | return function (d, b) {
|
733 | if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
734 | _extendStatics(d, b);
|
735 | function __() {
|
736 | this.constructor = d;
|
737 | }
|
738 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
739 | };
|
740 | }();
|
741 | Object.defineProperty(exports, "__esModule", { value: true });
|
742 | exports.MDCBanner = void 0;
|
743 | var component_1 = __webpack_require__( "./packages/mdc-base/component.ts");
|
744 | var focus_trap_1 = __webpack_require__( "./packages/mdc-dom/focus-trap.ts");
|
745 | var ponyfill_1 = __webpack_require__( "./packages/mdc-dom/ponyfill.ts");
|
746 | var constants_1 = __webpack_require__( "./packages/mdc-banner/constants.ts");
|
747 | var foundation_1 = __webpack_require__( "./packages/mdc-banner/foundation.ts");
|
748 |
|
749 | var MDCBanner = function (_super) {
|
750 | __extends(MDCBanner, _super);
|
751 | function MDCBanner() {
|
752 | return _super !== null && _super.apply(this, arguments) || this;
|
753 | }
|
754 | MDCBanner.attachTo = function (root) {
|
755 | return new MDCBanner(root);
|
756 | };
|
757 | MDCBanner.prototype.initialize = function (focusTrapFactory) {
|
758 | var _this = this;
|
759 | if (focusTrapFactory === void 0) {
|
760 | focusTrapFactory = function focusTrapFactory(el, focusOptions) {
|
761 | return new focus_trap_1.FocusTrap(el, focusOptions);
|
762 | };
|
763 | }
|
764 | this.contentEl = this.root.querySelector(constants_1.selectors.CONTENT);
|
765 | this.textEl = this.root.querySelector(constants_1.selectors.TEXT);
|
766 | this.primaryActionEl = this.root.querySelector(constants_1.selectors.PRIMARY_ACTION);
|
767 | this.secondaryActionEl = this.root.querySelector(constants_1.selectors.SECONDARY_ACTION);
|
768 | this.focusTrapFactory = focusTrapFactory;
|
769 | this.handleContentClick = function (evt) {
|
770 | var target = evt.target;
|
771 | if (ponyfill_1.closest(target, constants_1.selectors.PRIMARY_ACTION)) {
|
772 | _this.foundation.handlePrimaryActionClick();
|
773 | } else if (ponyfill_1.closest(target, constants_1.selectors.SECONDARY_ACTION)) {
|
774 | _this.foundation.handleSecondaryActionClick();
|
775 | }
|
776 | };
|
777 | };
|
778 | MDCBanner.prototype.initialSyncWithDOM = function () {
|
779 | this.registerContentClickHandler(this.handleContentClick);
|
780 | this.focusTrap = this.focusTrapFactory(this.root, { initialFocusEl: this.primaryActionEl });
|
781 | };
|
782 | MDCBanner.prototype.destroy = function () {
|
783 | _super.prototype.destroy.call(this);
|
784 | this.deregisterContentClickHandler(this.handleContentClick);
|
785 | };
|
786 | MDCBanner.prototype.layout = function () {
|
787 | this.foundation.layout();
|
788 | };
|
789 | |
790 |
|
791 |
|
792 |
|
793 | MDCBanner.prototype.open = function () {
|
794 | this.foundation.open();
|
795 | };
|
796 | |
797 |
|
798 |
|
799 |
|
800 |
|
801 |
|
802 |
|
803 |
|
804 |
|
805 | MDCBanner.prototype.close = function (reason) {
|
806 | this.foundation.close(reason);
|
807 | };
|
808 | MDCBanner.prototype.getDefaultFoundation = function () {
|
809 | var _this = this;
|
810 |
|
811 |
|
812 |
|
813 | var adapter = {
|
814 | addClass: function addClass(className) {
|
815 | _this.root.classList.add(className);
|
816 | },
|
817 | getContentHeight: function getContentHeight() {
|
818 | return _this.contentEl.offsetHeight;
|
819 | },
|
820 | notifyClosed: function notifyClosed(reason) {
|
821 | _this.emit(constants_1.events.CLOSED, { reason: reason });
|
822 | },
|
823 | notifyClosing: function notifyClosing(reason) {
|
824 | _this.emit(constants_1.events.CLOSING, { reason: reason });
|
825 | },
|
826 | notifyOpened: function notifyOpened() {
|
827 | _this.emit(constants_1.events.OPENED, {});
|
828 | },
|
829 | notifyOpening: function notifyOpening() {
|
830 | _this.emit(constants_1.events.OPENING, {});
|
831 | },
|
832 | releaseFocus: function releaseFocus() {
|
833 | _this.focusTrap.releaseFocus();
|
834 | },
|
835 | removeClass: function removeClass(className) {
|
836 | _this.root.classList.remove(className);
|
837 | },
|
838 | setStyleProperty: function setStyleProperty(propertyName, value) {
|
839 | _this.root.style.setProperty(propertyName, value);
|
840 | },
|
841 | trapFocus: function trapFocus() {
|
842 | _this.focusTrap.trapFocus();
|
843 | }
|
844 | };
|
845 | return new foundation_1.MDCBannerFoundation(adapter);
|
846 | };
|
847 | Object.defineProperty(MDCBanner.prototype, "isOpen", {
|
848 | get: function get() {
|
849 | return this.foundation.isOpen();
|
850 | },
|
851 | enumerable: false,
|
852 | configurable: true
|
853 | });
|
854 | MDCBanner.prototype.getText = function () {
|
855 | return this.textEl.textContent || '';
|
856 | };
|
857 | MDCBanner.prototype.setText = function (text) {
|
858 | this.textEl.textContent = text;
|
859 | };
|
860 | MDCBanner.prototype.getPrimaryActionText = function () {
|
861 | return this.primaryActionEl.textContent || '';
|
862 | };
|
863 | MDCBanner.prototype.setPrimaryActionText = function (actionButtonText) {
|
864 | this.primaryActionEl.textContent = actionButtonText;
|
865 | };
|
866 |
|
867 | MDCBanner.prototype.getSecondaryActionText = function () {
|
868 | return this.secondaryActionEl ? this.secondaryActionEl.textContent || '' : null;
|
869 | };
|
870 | MDCBanner.prototype.setSecondaryActionText = function (actionButtonText) {
|
871 | if (this.secondaryActionEl) {
|
872 | this.secondaryActionEl.textContent = actionButtonText;
|
873 | }
|
874 | };
|
875 | MDCBanner.prototype.registerContentClickHandler = function (handler) {
|
876 | this.contentEl.addEventListener('click', handler);
|
877 | };
|
878 | MDCBanner.prototype.deregisterContentClickHandler = function (handler) {
|
879 | this.contentEl.removeEventListener('click', handler);
|
880 | };
|
881 | return MDCBanner;
|
882 | }(component_1.MDCComponent);
|
883 | exports.MDCBanner = MDCBanner;
|
884 |
|
885 | }),
|
886 |
|
887 | "./packages/mdc-banner/constants.ts":
|
888 |
|
889 |
|
890 |
|
891 |
|
892 | (function(module, exports, __webpack_require__) {
|
893 |
|
894 | "use strict";
|
895 |
|
896 |
|
897 |
|
898 |
|
899 |
|
900 |
|
901 |
|
902 |
|
903 |
|
904 |
|
905 |
|
906 |
|
907 |
|
908 |
|
909 |
|
910 |
|
911 |
|
912 |
|
913 |
|
914 |
|
915 |
|
916 |
|
917 |
|
918 |
|
919 | Object.defineProperty(exports, "__esModule", { value: true });
|
920 | exports.CloseReason = exports.selectors = exports.events = exports.numbers = exports.cssClasses = void 0;
|
921 |
|
922 | exports.cssClasses = {
|
923 | CLOSING: 'mdc-banner--closing',
|
924 | OPEN: 'mdc-banner--open',
|
925 | OPENING: 'mdc-banner--opening'
|
926 | };
|
927 |
|
928 | exports.numbers = {
|
929 | BANNER_ANIMATION_CLOSE_TIME_MS: 250,
|
930 | BANNER_ANIMATION_OPEN_TIME_MS: 300
|
931 | };
|
932 |
|
933 | exports.events = {
|
934 | CLOSED: 'MDCBanner:closed',
|
935 | CLOSING: 'MDCBanner:closing',
|
936 | OPENED: 'MDCBanner:opened',
|
937 | OPENING: 'MDCBanner:opening'
|
938 | };
|
939 |
|
940 | exports.selectors = {
|
941 | CONTENT: '.mdc-banner__content',
|
942 | PRIMARY_ACTION: '.mdc-banner__primary-action',
|
943 | SECONDARY_ACTION: '.mdc-banner__secondary-action',
|
944 | TEXT: '.mdc-banner__text'
|
945 | };
|
946 |
|
947 | var CloseReason;
|
948 | (function (CloseReason) {
|
949 |
|
950 | CloseReason[CloseReason["PRIMARY"] = 0] = "PRIMARY";
|
951 |
|
952 | CloseReason[CloseReason["SECONDARY"] = 1] = "SECONDARY";
|
953 |
|
954 |
|
955 | CloseReason[CloseReason["UNSPECIFIED"] = 2] = "UNSPECIFIED";
|
956 | })(CloseReason = exports.CloseReason || (exports.CloseReason = {}));
|
957 |
|
958 | }),
|
959 |
|
960 | "./packages/mdc-banner/foundation.ts":
|
961 |
|
962 |
|
963 |
|
964 |
|
965 | (function(module, exports, __webpack_require__) {
|
966 |
|
967 | "use strict";
|
968 |
|
969 |
|
970 |
|
971 |
|
972 |
|
973 |
|
974 |
|
975 |
|
976 |
|
977 |
|
978 |
|
979 |
|
980 |
|
981 |
|
982 |
|
983 |
|
984 |
|
985 |
|
986 |
|
987 |
|
988 |
|
989 |
|
990 |
|
991 |
|
992 | var __extends = this && this.__extends || function () {
|
993 | var _extendStatics = function extendStatics(d, b) {
|
994 | _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
|
995 | d.__proto__ = b;
|
996 | } || function (d, b) {
|
997 | for (var p in b) {
|
998 | if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
999 | }
|
1000 | };
|
1001 | return _extendStatics(d, b);
|
1002 | };
|
1003 | return function (d, b) {
|
1004 | if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
1005 | _extendStatics(d, b);
|
1006 | function __() {
|
1007 | this.constructor = d;
|
1008 | }
|
1009 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
1010 | };
|
1011 | }();
|
1012 | var __assign = this && this.__assign || function () {
|
1013 | __assign = Object.assign || function (t) {
|
1014 | for (var s, i = 1, n = arguments.length; i < n; i++) {
|
1015 | s = arguments[i];
|
1016 | for (var p in s) {
|
1017 | if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
1018 | }
|
1019 | }
|
1020 | return t;
|
1021 | };
|
1022 | return __assign.apply(this, arguments);
|
1023 | };
|
1024 | Object.defineProperty(exports, "__esModule", { value: true });
|
1025 | exports.MDCBannerFoundation = void 0;
|
1026 | var foundation_1 = __webpack_require__( "./packages/mdc-base/foundation.ts");
|
1027 | var constants_1 = __webpack_require__( "./packages/mdc-banner/constants.ts");
|
1028 | var OPENING = constants_1.cssClasses.OPENING,
|
1029 | OPEN = constants_1.cssClasses.OPEN,
|
1030 | CLOSING = constants_1.cssClasses.CLOSING;
|
1031 |
|
1032 |
|
1033 |
|
1034 |
|
1035 | var MDCBannerFoundation = function (_super) {
|
1036 | __extends(MDCBannerFoundation, _super);
|
1037 | function MDCBannerFoundation(adapter) {
|
1038 | var _this = _super.call(this, __assign(__assign({}, MDCBannerFoundation.defaultAdapter), adapter)) || this;
|
1039 | _this.isOpened = false;
|
1040 |
|
1041 |
|
1042 | _this.animationFrame = 0;
|
1043 |
|
1044 |
|
1045 | _this.animationTimer = 0;
|
1046 | return _this;
|
1047 | }
|
1048 | Object.defineProperty(MDCBannerFoundation, "defaultAdapter", {
|
1049 | get: function get() {
|
1050 | return {
|
1051 | addClass: function addClass() {
|
1052 | return undefined;
|
1053 | },
|
1054 | getContentHeight: function getContentHeight() {
|
1055 | return 0;
|
1056 | },
|
1057 | notifyClosed: function notifyClosed() {
|
1058 | return undefined;
|
1059 | },
|
1060 | notifyClosing: function notifyClosing() {
|
1061 | return undefined;
|
1062 | },
|
1063 | notifyOpened: function notifyOpened() {
|
1064 | return undefined;
|
1065 | },
|
1066 | notifyOpening: function notifyOpening() {
|
1067 | return undefined;
|
1068 | },
|
1069 | releaseFocus: function releaseFocus() {
|
1070 | return undefined;
|
1071 | },
|
1072 | removeClass: function removeClass() {
|
1073 | return undefined;
|
1074 | },
|
1075 | setStyleProperty: function setStyleProperty() {
|
1076 | return undefined;
|
1077 | },
|
1078 | trapFocus: function trapFocus() {
|
1079 | return undefined;
|
1080 | }
|
1081 | };
|
1082 | },
|
1083 | enumerable: false,
|
1084 | configurable: true
|
1085 | });
|
1086 | MDCBannerFoundation.prototype.destroy = function () {
|
1087 | cancelAnimationFrame(this.animationFrame);
|
1088 | this.animationFrame = 0;
|
1089 | clearTimeout(this.animationTimer);
|
1090 | this.animationTimer = 0;
|
1091 | };
|
1092 | MDCBannerFoundation.prototype.open = function () {
|
1093 | var _this = this;
|
1094 | this.isOpened = true;
|
1095 | this.adapter.notifyOpening();
|
1096 | this.adapter.removeClass(CLOSING);
|
1097 | this.adapter.addClass(OPENING);
|
1098 | var contentHeight = this.adapter.getContentHeight();
|
1099 | this.animationFrame = requestAnimationFrame(function () {
|
1100 | _this.adapter.addClass(OPEN);
|
1101 | _this.adapter.setStyleProperty('height', contentHeight + "px");
|
1102 | _this.animationTimer = setTimeout(function () {
|
1103 | _this.handleAnimationTimerEnd();
|
1104 | _this.adapter.trapFocus();
|
1105 | _this.adapter.notifyOpened();
|
1106 | }, constants_1.numbers.BANNER_ANIMATION_OPEN_TIME_MS);
|
1107 | });
|
1108 | };
|
1109 | |
1110 |
|
1111 |
|
1112 |
|
1113 |
|
1114 |
|
1115 |
|
1116 | MDCBannerFoundation.prototype.close = function (reason) {
|
1117 | var _this = this;
|
1118 | if (!this.isOpened) {
|
1119 |
|
1120 |
|
1121 | return;
|
1122 | }
|
1123 | cancelAnimationFrame(this.animationFrame);
|
1124 | this.animationFrame = 0;
|
1125 | this.isOpened = false;
|
1126 | this.adapter.notifyClosing(reason);
|
1127 | this.adapter.addClass(CLOSING);
|
1128 | this.adapter.setStyleProperty('height', '0');
|
1129 | this.adapter.removeClass(OPEN);
|
1130 | this.adapter.removeClass(OPENING);
|
1131 | clearTimeout(this.animationTimer);
|
1132 | this.animationTimer = setTimeout(function () {
|
1133 | _this.adapter.releaseFocus();
|
1134 | _this.handleAnimationTimerEnd();
|
1135 | _this.adapter.notifyClosed(reason);
|
1136 | }, constants_1.numbers.BANNER_ANIMATION_CLOSE_TIME_MS);
|
1137 | };
|
1138 | MDCBannerFoundation.prototype.isOpen = function () {
|
1139 | return this.isOpened;
|
1140 | };
|
1141 | MDCBannerFoundation.prototype.handlePrimaryActionClick = function () {
|
1142 | this.close(constants_1.CloseReason.PRIMARY);
|
1143 | };
|
1144 | MDCBannerFoundation.prototype.handleSecondaryActionClick = function () {
|
1145 | this.close(constants_1.CloseReason.SECONDARY);
|
1146 | };
|
1147 | MDCBannerFoundation.prototype.layout = function () {
|
1148 | var contentHeight = this.adapter.getContentHeight();
|
1149 | this.adapter.setStyleProperty('height', contentHeight + "px");
|
1150 | };
|
1151 | MDCBannerFoundation.prototype.handleAnimationTimerEnd = function () {
|
1152 | this.animationTimer = 0;
|
1153 | this.adapter.removeClass(OPENING);
|
1154 | this.adapter.removeClass(CLOSING);
|
1155 | };
|
1156 | return MDCBannerFoundation;
|
1157 | }(foundation_1.MDCFoundation);
|
1158 | exports.MDCBannerFoundation = MDCBannerFoundation;
|
1159 |
|
1160 | }),
|
1161 |
|
1162 | "./packages/mdc-banner/index.ts":
|
1163 |
|
1164 |
|
1165 |
|
1166 |
|
1167 | (function(module, exports, __webpack_require__) {
|
1168 |
|
1169 | "use strict";
|
1170 |
|
1171 |
|
1172 |
|
1173 |
|
1174 |
|
1175 |
|
1176 |
|
1177 |
|
1178 |
|
1179 |
|
1180 |
|
1181 |
|
1182 |
|
1183 |
|
1184 |
|
1185 |
|
1186 |
|
1187 |
|
1188 |
|
1189 |
|
1190 |
|
1191 |
|
1192 |
|
1193 |
|
1194 | var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
|
1195 | if (k2 === undefined) k2 = k;
|
1196 | Object.defineProperty(o, k2, { enumerable: true, get: function get() {
|
1197 | return m[k];
|
1198 | } });
|
1199 | } : function (o, m, k, k2) {
|
1200 | if (k2 === undefined) k2 = k;
|
1201 | o[k2] = m[k];
|
1202 | });
|
1203 | var __exportStar = this && this.__exportStar || function (m, exports) {
|
1204 | for (var p in m) {
|
1205 | if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
1206 | }
|
1207 | };
|
1208 | Object.defineProperty(exports, "__esModule", { value: true });
|
1209 | __exportStar(__webpack_require__( "./packages/mdc-banner/adapter.ts"), exports);
|
1210 | __exportStar(__webpack_require__( "./packages/mdc-banner/component.ts"), exports);
|
1211 | __exportStar(__webpack_require__( "./packages/mdc-banner/constants.ts"), exports);
|
1212 | __exportStar(__webpack_require__( "./packages/mdc-banner/foundation.ts"), exports);
|
1213 |
|
1214 | }),
|
1215 |
|
1216 | "./packages/mdc-base/component.ts":
|
1217 |
|
1218 |
|
1219 |
|
1220 |
|
1221 | (function(module, exports, __webpack_require__) {
|
1222 |
|
1223 | "use strict";
|
1224 |
|
1225 |
|
1226 |
|
1227 |
|
1228 |
|
1229 |
|
1230 |
|
1231 |
|
1232 |
|
1233 |
|
1234 |
|
1235 |
|
1236 |
|
1237 |
|
1238 |
|
1239 |
|
1240 |
|
1241 |
|
1242 |
|
1243 |
|
1244 |
|
1245 |
|
1246 |
|
1247 |
|
1248 | var __read = this && this.__read || function (o, n) {
|
1249 | var m = typeof Symbol === "function" && o[Symbol.iterator];
|
1250 | if (!m) return o;
|
1251 | var i = m.call(o),
|
1252 | r,
|
1253 | ar = [],
|
1254 | e;
|
1255 | try {
|
1256 | while ((n === void 0 || n-- > 0) && !(r = i.next()).done) {
|
1257 | ar.push(r.value);
|
1258 | }
|
1259 | } catch (error) {
|
1260 | e = { error: error };
|
1261 | } finally {
|
1262 | try {
|
1263 | if (r && !r.done && (m = i["return"])) m.call(i);
|
1264 | } finally {
|
1265 | if (e) throw e.error;
|
1266 | }
|
1267 | }
|
1268 | return ar;
|
1269 | };
|
1270 | var __spreadArray = this && this.__spreadArray || function (to, from) {
|
1271 | for (var i = 0, il = from.length, j = to.length; i < il; i++, j++) {
|
1272 | to[j] = from[i];
|
1273 | }return to;
|
1274 | };
|
1275 | Object.defineProperty(exports, "__esModule", { value: true });
|
1276 | exports.MDCComponent = void 0;
|
1277 | var foundation_1 = __webpack_require__( "./packages/mdc-base/foundation.ts");
|
1278 | var MDCComponent = function () {
|
1279 | function MDCComponent(root, foundation) {
|
1280 | var args = [];
|
1281 | for (var _i = 2; _i < arguments.length; _i++) {
|
1282 | args[_i - 2] = arguments[_i];
|
1283 | }
|
1284 | this.root = root;
|
1285 | this.initialize.apply(this, __spreadArray([], __read(args)));
|
1286 |
|
1287 |
|
1288 |
|
1289 | this.foundation = foundation === undefined ? this.getDefaultFoundation() : foundation;
|
1290 | this.foundation.init();
|
1291 | this.initialSyncWithDOM();
|
1292 | }
|
1293 | MDCComponent.attachTo = function (root) {
|
1294 |
|
1295 |
|
1296 |
|
1297 |
|
1298 | return new MDCComponent(root, new foundation_1.MDCFoundation({}));
|
1299 | };
|
1300 |
|
1301 | MDCComponent.prototype.initialize = function () {
|
1302 | var _args = [];
|
1303 | for (var _i = 0; _i < arguments.length; _i++) {
|
1304 | _args[_i] = arguments[_i];
|
1305 | }
|
1306 |
|
1307 |
|
1308 |
|
1309 | };
|
1310 | MDCComponent.prototype.getDefaultFoundation = function () {
|
1311 |
|
1312 |
|
1313 | throw new Error('Subclasses must override getDefaultFoundation to return a properly configured ' + 'foundation class');
|
1314 | };
|
1315 | MDCComponent.prototype.initialSyncWithDOM = function () {
|
1316 |
|
1317 |
|
1318 |
|
1319 |
|
1320 | };
|
1321 | MDCComponent.prototype.destroy = function () {
|
1322 |
|
1323 |
|
1324 | this.foundation.destroy();
|
1325 | };
|
1326 | MDCComponent.prototype.listen = function (evtType, handler, options) {
|
1327 | this.root.addEventListener(evtType, handler, options);
|
1328 | };
|
1329 | MDCComponent.prototype.unlisten = function (evtType, handler, options) {
|
1330 | this.root.removeEventListener(evtType, handler, options);
|
1331 | };
|
1332 | |
1333 |
|
1334 |
|
1335 | MDCComponent.prototype.emit = function (evtType, evtData, shouldBubble) {
|
1336 | if (shouldBubble === void 0) {
|
1337 | shouldBubble = false;
|
1338 | }
|
1339 | var evt;
|
1340 | if (typeof CustomEvent === 'function') {
|
1341 | evt = new CustomEvent(evtType, {
|
1342 | bubbles: shouldBubble,
|
1343 | detail: evtData
|
1344 | });
|
1345 | } else {
|
1346 | evt = document.createEvent('CustomEvent');
|
1347 | evt.initCustomEvent(evtType, shouldBubble, false, evtData);
|
1348 | }
|
1349 | this.root.dispatchEvent(evt);
|
1350 | };
|
1351 | return MDCComponent;
|
1352 | }();
|
1353 | exports.MDCComponent = MDCComponent;
|
1354 |
|
1355 | exports.default = MDCComponent;
|
1356 |
|
1357 | }),
|
1358 |
|
1359 | "./packages/mdc-base/foundation.ts":
|
1360 |
|
1361 |
|
1362 |
|
1363 |
|
1364 | (function(module, exports, __webpack_require__) {
|
1365 |
|
1366 | "use strict";
|
1367 |
|
1368 |
|
1369 |
|
1370 |
|
1371 |
|
1372 |
|
1373 |
|
1374 |
|
1375 |
|
1376 |
|
1377 |
|
1378 |
|
1379 |
|
1380 |
|
1381 |
|
1382 |
|
1383 |
|
1384 |
|
1385 |
|
1386 |
|
1387 |
|
1388 |
|
1389 |
|
1390 |
|
1391 | Object.defineProperty(exports, "__esModule", { value: true });
|
1392 | exports.MDCFoundation = void 0;
|
1393 | var MDCFoundation = function () {
|
1394 | function MDCFoundation(adapter) {
|
1395 | if (adapter === void 0) {
|
1396 | adapter = {};
|
1397 | }
|
1398 | this.adapter = adapter;
|
1399 | }
|
1400 | Object.defineProperty(MDCFoundation, "cssClasses", {
|
1401 | get: function get() {
|
1402 |
|
1403 |
|
1404 | return {};
|
1405 | },
|
1406 | enumerable: false,
|
1407 | configurable: true
|
1408 | });
|
1409 | Object.defineProperty(MDCFoundation, "strings", {
|
1410 | get: function get() {
|
1411 |
|
1412 |
|
1413 | return {};
|
1414 | },
|
1415 | enumerable: false,
|
1416 | configurable: true
|
1417 | });
|
1418 | Object.defineProperty(MDCFoundation, "numbers", {
|
1419 | get: function get() {
|
1420 |
|
1421 |
|
1422 | return {};
|
1423 | },
|
1424 | enumerable: false,
|
1425 | configurable: true
|
1426 | });
|
1427 | Object.defineProperty(MDCFoundation, "defaultAdapter", {
|
1428 | get: function get() {
|
1429 |
|
1430 |
|
1431 |
|
1432 | return {};
|
1433 | },
|
1434 | enumerable: false,
|
1435 | configurable: true
|
1436 | });
|
1437 | MDCFoundation.prototype.init = function () {
|
1438 |
|
1439 | };
|
1440 | MDCFoundation.prototype.destroy = function () {
|
1441 |
|
1442 | };
|
1443 | return MDCFoundation;
|
1444 | }();
|
1445 | exports.MDCFoundation = MDCFoundation;
|
1446 |
|
1447 | exports.default = MDCFoundation;
|
1448 |
|
1449 | }),
|
1450 |
|
1451 | "./packages/mdc-base/index.ts":
|
1452 |
|
1453 |
|
1454 |
|
1455 |
|
1456 | (function(module, exports, __webpack_require__) {
|
1457 |
|
1458 | "use strict";
|
1459 |
|
1460 |
|
1461 |
|
1462 |
|
1463 |
|
1464 |
|
1465 |
|
1466 |
|
1467 |
|
1468 |
|
1469 |
|
1470 |
|
1471 |
|
1472 |
|
1473 |
|
1474 |
|
1475 |
|
1476 |
|
1477 |
|
1478 |
|
1479 |
|
1480 |
|
1481 |
|
1482 |
|
1483 | var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
|
1484 | if (k2 === undefined) k2 = k;
|
1485 | Object.defineProperty(o, k2, { enumerable: true, get: function get() {
|
1486 | return m[k];
|
1487 | } });
|
1488 | } : function (o, m, k, k2) {
|
1489 | if (k2 === undefined) k2 = k;
|
1490 | o[k2] = m[k];
|
1491 | });
|
1492 | var __exportStar = this && this.__exportStar || function (m, exports) {
|
1493 | for (var p in m) {
|
1494 | if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
1495 | }
|
1496 | };
|
1497 | Object.defineProperty(exports, "__esModule", { value: true });
|
1498 | __exportStar(__webpack_require__( "./packages/mdc-base/component.ts"), exports);
|
1499 | __exportStar(__webpack_require__( "./packages/mdc-base/foundation.ts"), exports);
|
1500 | __exportStar(__webpack_require__( "./packages/mdc-base/types.ts"), exports);
|
1501 |
|
1502 | }),
|
1503 |
|
1504 | "./packages/mdc-base/observer-foundation.ts":
|
1505 |
|
1506 |
|
1507 |
|
1508 |
|
1509 | (function(module, exports, __webpack_require__) {
|
1510 |
|
1511 | "use strict";
|
1512 |
|
1513 |
|
1514 |
|
1515 |
|
1516 |
|
1517 |
|
1518 |
|
1519 |
|
1520 |
|
1521 |
|
1522 |
|
1523 |
|
1524 |
|
1525 |
|
1526 |
|
1527 |
|
1528 |
|
1529 |
|
1530 |
|
1531 |
|
1532 |
|
1533 |
|
1534 |
|
1535 |
|
1536 | var __extends = this && this.__extends || function () {
|
1537 | var _extendStatics = function extendStatics(d, b) {
|
1538 | _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
|
1539 | d.__proto__ = b;
|
1540 | } || function (d, b) {
|
1541 | for (var p in b) {
|
1542 | if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
1543 | }
|
1544 | };
|
1545 | return _extendStatics(d, b);
|
1546 | };
|
1547 | return function (d, b) {
|
1548 | if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
1549 | _extendStatics(d, b);
|
1550 | function __() {
|
1551 | this.constructor = d;
|
1552 | }
|
1553 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
1554 | };
|
1555 | }();
|
1556 | var __values = this && this.__values || function (o) {
|
1557 | var s = typeof Symbol === "function" && Symbol.iterator,
|
1558 | m = s && o[s],
|
1559 | i = 0;
|
1560 | if (m) return m.call(o);
|
1561 | if (o && typeof o.length === "number") return {
|
1562 | next: function next() {
|
1563 | if (o && i >= o.length) o = void 0;
|
1564 | return { value: o && o[i++], done: !o };
|
1565 | }
|
1566 | };
|
1567 | throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
1568 | };
|
1569 | var __read = this && this.__read || function (o, n) {
|
1570 | var m = typeof Symbol === "function" && o[Symbol.iterator];
|
1571 | if (!m) return o;
|
1572 | var i = m.call(o),
|
1573 | r,
|
1574 | ar = [],
|
1575 | e;
|
1576 | try {
|
1577 | while ((n === void 0 || n-- > 0) && !(r = i.next()).done) {
|
1578 | ar.push(r.value);
|
1579 | }
|
1580 | } catch (error) {
|
1581 | e = { error: error };
|
1582 | } finally {
|
1583 | try {
|
1584 | if (r && !r.done && (m = i["return"])) m.call(i);
|
1585 | } finally {
|
1586 | if (e) throw e.error;
|
1587 | }
|
1588 | }
|
1589 | return ar;
|
1590 | };
|
1591 | var __spreadArray = this && this.__spreadArray || function (to, from) {
|
1592 | for (var i = 0, il = from.length, j = to.length; i < il; i++, j++) {
|
1593 | to[j] = from[i];
|
1594 | }return to;
|
1595 | };
|
1596 | Object.defineProperty(exports, "__esModule", { value: true });
|
1597 | exports.MDCObserverFoundation = void 0;
|
1598 | var foundation_1 = __webpack_require__( "./packages/mdc-base/foundation.ts");
|
1599 | var observer_1 = __webpack_require__( "./packages/mdc-base/observer.ts");
|
1600 | var MDCObserverFoundation = function (_super) {
|
1601 | __extends(MDCObserverFoundation, _super);
|
1602 | function MDCObserverFoundation(adapter) {
|
1603 | var _this = _super.call(this, adapter) || this;
|
1604 |
|
1605 | _this.unobserves = new Set();
|
1606 | return _this;
|
1607 | }
|
1608 | MDCObserverFoundation.prototype.destroy = function () {
|
1609 | _super.prototype.destroy.call(this);
|
1610 | this.unobserve();
|
1611 | };
|
1612 | |
1613 |
|
1614 |
|
1615 |
|
1616 |
|
1617 |
|
1618 |
|
1619 |
|
1620 |
|
1621 |
|
1622 |
|
1623 |
|
1624 | MDCObserverFoundation.prototype.observe = function (target, observers) {
|
1625 | var e_1, _a;
|
1626 | var _this = this;
|
1627 | var cleanup = [];
|
1628 | try {
|
1629 | for (var _b = __values(Object.keys(observers)), _c = _b.next(); !_c.done; _c = _b.next()) {
|
1630 | var property = _c.value;
|
1631 | var observer = observers[property].bind(this);
|
1632 | cleanup.push(this.observeProperty(target, property, observer));
|
1633 | }
|
1634 | } catch (e_1_1) {
|
1635 | e_1 = { error: e_1_1 };
|
1636 | } finally {
|
1637 | try {
|
1638 | if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
1639 | } finally {
|
1640 | if (e_1) throw e_1.error;
|
1641 | }
|
1642 | }
|
1643 | var unobserve = function unobserve() {
|
1644 | var e_2, _a;
|
1645 | try {
|
1646 | for (var cleanup_1 = __values(cleanup), cleanup_1_1 = cleanup_1.next(); !cleanup_1_1.done; cleanup_1_1 = cleanup_1.next()) {
|
1647 | var cleanupFn = cleanup_1_1.value;
|
1648 | cleanupFn();
|
1649 | }
|
1650 | } catch (e_2_1) {
|
1651 | e_2 = { error: e_2_1 };
|
1652 | } finally {
|
1653 | try {
|
1654 | if (cleanup_1_1 && !cleanup_1_1.done && (_a = cleanup_1.return)) _a.call(cleanup_1);
|
1655 | } finally {
|
1656 | if (e_2) throw e_2.error;
|
1657 | }
|
1658 | }
|
1659 | _this.unobserves.delete(unobserve);
|
1660 | };
|
1661 | this.unobserves.add(unobserve);
|
1662 | return unobserve;
|
1663 | };
|
1664 | |
1665 |
|
1666 |
|
1667 |
|
1668 |
|
1669 |
|
1670 |
|
1671 |
|
1672 |
|
1673 |
|
1674 |
|
1675 |
|
1676 |
|
1677 |
|
1678 |
|
1679 |
|
1680 |
|
1681 | MDCObserverFoundation.prototype.observeProperty = function (target, property, observer) {
|
1682 | return observer_1.observeProperty(target, property, observer);
|
1683 | };
|
1684 | |
1685 |
|
1686 |
|
1687 |
|
1688 |
|
1689 |
|
1690 |
|
1691 | MDCObserverFoundation.prototype.setObserversEnabled = function (target, enabled) {
|
1692 | observer_1.setObserversEnabled(target, enabled);
|
1693 | };
|
1694 | |
1695 |
|
1696 |
|
1697 | MDCObserverFoundation.prototype.unobserve = function () {
|
1698 | var e_3, _a;
|
1699 | try {
|
1700 |
|
1701 | for (var _b = __values(__spreadArray([], __read(this.unobserves))), _c = _b.next(); !_c.done; _c = _b.next()) {
|
1702 | var unobserve = _c.value;
|
1703 | unobserve();
|
1704 | }
|
1705 | } catch (e_3_1) {
|
1706 | e_3 = { error: e_3_1 };
|
1707 | } finally {
|
1708 | try {
|
1709 | if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
1710 | } finally {
|
1711 | if (e_3) throw e_3.error;
|
1712 | }
|
1713 | }
|
1714 | };
|
1715 | return MDCObserverFoundation;
|
1716 | }(foundation_1.MDCFoundation);
|
1717 | exports.MDCObserverFoundation = MDCObserverFoundation;
|
1718 |
|
1719 | }),
|
1720 |
|
1721 | "./packages/mdc-base/observer.ts":
|
1722 |
|
1723 |
|
1724 |
|
1725 |
|
1726 | (function(module, exports, __webpack_require__) {
|
1727 |
|
1728 | "use strict";
|
1729 |
|
1730 |
|
1731 |
|
1732 |
|
1733 |
|
1734 |
|
1735 |
|
1736 |
|
1737 |
|
1738 |
|
1739 |
|
1740 |
|
1741 |
|
1742 |
|
1743 |
|
1744 |
|
1745 |
|
1746 |
|
1747 |
|
1748 |
|
1749 |
|
1750 |
|
1751 |
|
1752 |
|
1753 | var __extends = this && this.__extends || function () {
|
1754 | var _extendStatics = function extendStatics(d, b) {
|
1755 | _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
|
1756 | d.__proto__ = b;
|
1757 | } || function (d, b) {
|
1758 | for (var p in b) {
|
1759 | if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
1760 | }
|
1761 | };
|
1762 | return _extendStatics(d, b);
|
1763 | };
|
1764 | return function (d, b) {
|
1765 | if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
1766 | _extendStatics(d, b);
|
1767 | function __() {
|
1768 | this.constructor = d;
|
1769 | }
|
1770 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
1771 | };
|
1772 | }();
|
1773 | var __assign = this && this.__assign || function () {
|
1774 | __assign = Object.assign || function (t) {
|
1775 | for (var s, i = 1, n = arguments.length; i < n; i++) {
|
1776 | s = arguments[i];
|
1777 | for (var p in s) {
|
1778 | if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
1779 | }
|
1780 | }
|
1781 | return t;
|
1782 | };
|
1783 | return __assign.apply(this, arguments);
|
1784 | };
|
1785 | var __values = this && this.__values || function (o) {
|
1786 | var s = typeof Symbol === "function" && Symbol.iterator,
|
1787 | m = s && o[s],
|
1788 | i = 0;
|
1789 | if (m) return m.call(o);
|
1790 | if (o && typeof o.length === "number") return {
|
1791 | next: function next() {
|
1792 | if (o && i >= o.length) o = void 0;
|
1793 | return { value: o && o[i++], done: !o };
|
1794 | }
|
1795 | };
|
1796 | throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
1797 | };
|
1798 | var __read = this && this.__read || function (o, n) {
|
1799 | var m = typeof Symbol === "function" && o[Symbol.iterator];
|
1800 | if (!m) return o;
|
1801 | var i = m.call(o),
|
1802 | r,
|
1803 | ar = [],
|
1804 | e;
|
1805 | try {
|
1806 | while ((n === void 0 || n-- > 0) && !(r = i.next()).done) {
|
1807 | ar.push(r.value);
|
1808 | }
|
1809 | } catch (error) {
|
1810 | e = { error: error };
|
1811 | } finally {
|
1812 | try {
|
1813 | if (r && !r.done && (m = i["return"])) m.call(i);
|
1814 | } finally {
|
1815 | if (e) throw e.error;
|
1816 | }
|
1817 | }
|
1818 | return ar;
|
1819 | };
|
1820 | var __spreadArray = this && this.__spreadArray || function (to, from) {
|
1821 | for (var i = 0, il = from.length, j = to.length; i < il; i++, j++) {
|
1822 | to[j] = from[i];
|
1823 | }return to;
|
1824 | };
|
1825 | Object.defineProperty(exports, "__esModule", { value: true });
|
1826 | exports.setObserversEnabled = exports.getDescriptor = exports.observeProperty = exports.mdcObserver = void 0;
|
1827 |
|
1828 |
|
1829 |
|
1830 |
|
1831 |
|
1832 |
|
1833 |
|
1834 |
|
1835 |
|
1836 | function mdcObserver(baseClass) {
|
1837 | if (baseClass === void 0) {
|
1838 | baseClass = function () {
|
1839 | function class_1() {}
|
1840 | return class_1;
|
1841 | }();
|
1842 | }
|
1843 |
|
1844 |
|
1845 | var unobserveMap = new WeakMap();
|
1846 | return (function (_super) {
|
1847 | __extends(MDCObserver, _super);
|
1848 | function MDCObserver() {
|
1849 | return _super !== null && _super.apply(this, arguments) || this;
|
1850 | }
|
1851 | MDCObserver.prototype.observe = function (target, observers) {
|
1852 | var e_1, _a;
|
1853 | var _this = this;
|
1854 | var cleanup = [];
|
1855 | try {
|
1856 | for (var _b = __values(Object.keys(observers)), _c = _b.next(); !_c.done; _c = _b.next()) {
|
1857 | var property = _c.value;
|
1858 | var observer = observers[property].bind(this);
|
1859 | cleanup.push(observeProperty(target, property, observer));
|
1860 | }
|
1861 | } catch (e_1_1) {
|
1862 | e_1 = { error: e_1_1 };
|
1863 | } finally {
|
1864 | try {
|
1865 | if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
1866 | } finally {
|
1867 | if (e_1) throw e_1.error;
|
1868 | }
|
1869 | }
|
1870 | var unobserve = function unobserve() {
|
1871 | var e_2, _a;
|
1872 | try {
|
1873 | for (var cleanup_1 = __values(cleanup), cleanup_1_1 = cleanup_1.next(); !cleanup_1_1.done; cleanup_1_1 = cleanup_1.next()) {
|
1874 | var cleanupFn = cleanup_1_1.value;
|
1875 | cleanupFn();
|
1876 | }
|
1877 | } catch (e_2_1) {
|
1878 | e_2 = { error: e_2_1 };
|
1879 | } finally {
|
1880 | try {
|
1881 | if (cleanup_1_1 && !cleanup_1_1.done && (_a = cleanup_1.return)) _a.call(cleanup_1);
|
1882 | } finally {
|
1883 | if (e_2) throw e_2.error;
|
1884 | }
|
1885 | }
|
1886 | var unobserves = unobserveMap.get(_this) || [];
|
1887 | var index = unobserves.indexOf(unobserve);
|
1888 | if (index > -1) {
|
1889 | unobserves.splice(index, 1);
|
1890 | }
|
1891 | };
|
1892 | var unobserves = unobserveMap.get(this);
|
1893 | if (!unobserves) {
|
1894 | unobserves = [];
|
1895 | unobserveMap.set(this, unobserves);
|
1896 | }
|
1897 | unobserves.push(unobserve);
|
1898 | return unobserve;
|
1899 | };
|
1900 | MDCObserver.prototype.setObserversEnabled = function (target, enabled) {
|
1901 | setObserversEnabled(target, enabled);
|
1902 | };
|
1903 | MDCObserver.prototype.unobserve = function () {
|
1904 | var e_3, _a;
|
1905 |
|
1906 |
|
1907 | var unobserves = unobserveMap.get(this) || [];
|
1908 | try {
|
1909 | for (var _b = __values(__spreadArray([], __read(unobserves))), _c = _b.next(); !_c.done; _c = _b.next()) {
|
1910 | var unobserve = _c.value;
|
1911 | unobserve();
|
1912 | }
|
1913 | } catch (e_3_1) {
|
1914 | e_3 = { error: e_3_1 };
|
1915 | } finally {
|
1916 | try {
|
1917 | if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
1918 | } finally {
|
1919 | if (e_3) throw e_3.error;
|
1920 | }
|
1921 | }
|
1922 | };
|
1923 | return MDCObserver;
|
1924 | }(baseClass)
|
1925 | );
|
1926 | }
|
1927 | exports.mdcObserver = mdcObserver;
|
1928 |
|
1929 |
|
1930 |
|
1931 |
|
1932 |
|
1933 |
|
1934 |
|
1935 |
|
1936 |
|
1937 |
|
1938 |
|
1939 |
|
1940 |
|
1941 |
|
1942 |
|
1943 |
|
1944 |
|
1945 | function observeProperty(target, property, observer) {
|
1946 | var targetObservers = installObserver(target, property);
|
1947 | var observers = targetObservers.getObservers(property);
|
1948 | observers.push(observer);
|
1949 | return function () {
|
1950 | observers.splice(observers.indexOf(observer), 1);
|
1951 | };
|
1952 | }
|
1953 | exports.observeProperty = observeProperty;
|
1954 |
|
1955 |
|
1956 |
|
1957 | var allTargetObservers = new WeakMap();
|
1958 |
|
1959 |
|
1960 |
|
1961 |
|
1962 |
|
1963 |
|
1964 |
|
1965 |
|
1966 |
|
1967 |
|
1968 |
|
1969 |
|
1970 |
|
1971 |
|
1972 | function installObserver(target, property) {
|
1973 | var observersMap = new Map();
|
1974 | if (!allTargetObservers.has(target)) {
|
1975 | allTargetObservers.set(target, {
|
1976 | isEnabled: true,
|
1977 | getObservers: function getObservers(key) {
|
1978 | var observers = observersMap.get(key) || [];
|
1979 | if (!observersMap.has(key)) {
|
1980 | observersMap.set(key, observers);
|
1981 | }
|
1982 | return observers;
|
1983 | },
|
1984 | installedProperties: new Set()
|
1985 | });
|
1986 | }
|
1987 | var targetObservers = allTargetObservers.get(target);
|
1988 | if (targetObservers.installedProperties.has(property)) {
|
1989 |
|
1990 | return targetObservers;
|
1991 | }
|
1992 |
|
1993 |
|
1994 | var descriptor = getDescriptor(target, property) || {
|
1995 | configurable: true,
|
1996 | enumerable: true,
|
1997 | value: target[property],
|
1998 | writable: true
|
1999 | };
|
2000 |
|
2001 | var observedDescriptor = __assign({}, descriptor);
|
2002 | var descGet = descriptor.get,
|
2003 | descSet = descriptor.set;
|
2004 | if ('value' in descriptor) {
|
2005 |
|
2006 |
|
2007 |
|
2008 |
|
2009 | delete observedDescriptor.value;
|
2010 | delete observedDescriptor.writable;
|
2011 |
|
2012 | var value_1 = descriptor.value;
|
2013 | descGet = function descGet() {
|
2014 | return value_1;
|
2015 | };
|
2016 |
|
2017 | if (descriptor.writable) {
|
2018 | descSet = function descSet(newValue) {
|
2019 | value_1 = newValue;
|
2020 | };
|
2021 | }
|
2022 | }
|
2023 | if (descGet) {
|
2024 | observedDescriptor.get = function () {
|
2025 |
|
2026 | return descGet.call(this);
|
2027 | };
|
2028 | }
|
2029 | if (descSet) {
|
2030 | observedDescriptor.set = function (newValue) {
|
2031 | var e_4, _a;
|
2032 |
|
2033 | var previous = descGet ? descGet.call(this) : newValue;
|
2034 | descSet.call(this, newValue);
|
2035 | if (targetObservers.isEnabled && (!descGet || newValue !== previous)) {
|
2036 | try {
|
2037 | for (var _b = __values(targetObservers.getObservers(property)), _c = _b.next(); !_c.done; _c = _b.next()) {
|
2038 | var observer = _c.value;
|
2039 | observer(newValue, previous);
|
2040 | }
|
2041 | } catch (e_4_1) {
|
2042 | e_4 = { error: e_4_1 };
|
2043 | } finally {
|
2044 | try {
|
2045 | if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
2046 | } finally {
|
2047 | if (e_4) throw e_4.error;
|
2048 | }
|
2049 | }
|
2050 | }
|
2051 | };
|
2052 | }
|
2053 | targetObservers.installedProperties.add(property);
|
2054 | Object.defineProperty(target, property, observedDescriptor);
|
2055 | return targetObservers;
|
2056 | }
|
2057 |
|
2058 |
|
2059 |
|
2060 |
|
2061 |
|
2062 |
|
2063 |
|
2064 |
|
2065 |
|
2066 |
|
2067 |
|
2068 |
|
2069 | function getDescriptor(target, property) {
|
2070 | var descriptorTarget = target;
|
2071 | var descriptor;
|
2072 | while (descriptorTarget) {
|
2073 | descriptor = Object.getOwnPropertyDescriptor(descriptorTarget, property);
|
2074 | if (descriptor) {
|
2075 | break;
|
2076 | }
|
2077 |
|
2078 |
|
2079 | descriptorTarget = Object.getPrototypeOf(descriptorTarget);
|
2080 | }
|
2081 | return descriptor;
|
2082 | }
|
2083 | exports.getDescriptor = getDescriptor;
|
2084 |
|
2085 |
|
2086 |
|
2087 |
|
2088 |
|
2089 |
|
2090 |
|
2091 |
|
2092 | function setObserversEnabled(target, enabled) {
|
2093 | var targetObservers = allTargetObservers.get(target);
|
2094 | if (targetObservers) {
|
2095 | targetObservers.isEnabled = enabled;
|
2096 | }
|
2097 | }
|
2098 | exports.setObserversEnabled = setObserversEnabled;
|
2099 |
|
2100 | }),
|
2101 |
|
2102 | "./packages/mdc-base/types.ts":
|
2103 |
|
2104 |
|
2105 |
|
2106 |
|
2107 | (function(module, exports, __webpack_require__) {
|
2108 |
|
2109 | "use strict";
|
2110 |
|
2111 |
|
2112 |
|
2113 |
|
2114 |
|
2115 |
|
2116 |
|
2117 |
|
2118 |
|
2119 |
|
2120 |
|
2121 |
|
2122 |
|
2123 |
|
2124 |
|
2125 |
|
2126 |
|
2127 |
|
2128 |
|
2129 |
|
2130 |
|
2131 |
|
2132 |
|
2133 |
|
2134 | Object.defineProperty(exports, "__esModule", { value: true });
|
2135 |
|
2136 |
|
2137 | }),
|
2138 |
|
2139 | "./packages/mdc-checkbox/adapter.ts":
|
2140 |
|
2141 |
|
2142 |
|
2143 |
|
2144 | (function(module, exports, __webpack_require__) {
|
2145 |
|
2146 | "use strict";
|
2147 |
|
2148 |
|
2149 |
|
2150 |
|
2151 |
|
2152 |
|
2153 |
|
2154 |
|
2155 |
|
2156 |
|
2157 |
|
2158 |
|
2159 |
|
2160 |
|
2161 |
|
2162 |
|
2163 |
|
2164 |
|
2165 |
|
2166 |
|
2167 |
|
2168 |
|
2169 |
|
2170 |
|
2171 | Object.defineProperty(exports, "__esModule", { value: true });
|
2172 |
|
2173 | }),
|
2174 |
|
2175 | "./packages/mdc-checkbox/component.ts":
|
2176 |
|
2177 |
|
2178 |
|
2179 |
|
2180 | (function(module, exports, __webpack_require__) {
|
2181 |
|
2182 | "use strict";
|
2183 |
|
2184 |
|
2185 |
|
2186 |
|
2187 |
|
2188 |
|
2189 |
|
2190 |
|
2191 |
|
2192 |
|
2193 |
|
2194 |
|
2195 |
|
2196 |
|
2197 |
|
2198 |
|
2199 |
|
2200 |
|
2201 |
|
2202 |
|
2203 |
|
2204 |
|
2205 |
|
2206 |
|
2207 | var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
|
2208 |
|
2209 | var __extends = this && this.__extends || function () {
|
2210 | var _extendStatics = function extendStatics(d, b) {
|
2211 | _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
|
2212 | d.__proto__ = b;
|
2213 | } || function (d, b) {
|
2214 | for (var p in b) {
|
2215 | if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
2216 | }
|
2217 | };
|
2218 | return _extendStatics(d, b);
|
2219 | };
|
2220 | return function (d, b) {
|
2221 | if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
2222 | _extendStatics(d, b);
|
2223 | function __() {
|
2224 | this.constructor = d;
|
2225 | }
|
2226 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
2227 | };
|
2228 | }();
|
2229 | var __assign = this && this.__assign || function () {
|
2230 | __assign = Object.assign || function (t) {
|
2231 | for (var s, i = 1, n = arguments.length; i < n; i++) {
|
2232 | s = arguments[i];
|
2233 | for (var p in s) {
|
2234 | if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
2235 | }
|
2236 | }
|
2237 | return t;
|
2238 | };
|
2239 | return __assign.apply(this, arguments);
|
2240 | };
|
2241 | var __values = this && this.__values || function (o) {
|
2242 | var s = typeof Symbol === "function" && Symbol.iterator,
|
2243 | m = s && o[s],
|
2244 | i = 0;
|
2245 | if (m) return m.call(o);
|
2246 | if (o && typeof o.length === "number") return {
|
2247 | next: function next() {
|
2248 | if (o && i >= o.length) o = void 0;
|
2249 | return { value: o && o[i++], done: !o };
|
2250 | }
|
2251 | };
|
2252 | throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
2253 | };
|
2254 | Object.defineProperty(exports, "__esModule", { value: true });
|
2255 | exports.MDCCheckbox = void 0;
|
2256 | var util_1 = __webpack_require__( "./packages/mdc-animation/util.ts");
|
2257 | var component_1 = __webpack_require__( "./packages/mdc-base/component.ts");
|
2258 | var events_1 = __webpack_require__( "./packages/mdc-dom/events.ts");
|
2259 | var ponyfill_1 = __webpack_require__( "./packages/mdc-dom/ponyfill.ts");
|
2260 | var component_2 = __webpack_require__( "./packages/mdc-ripple/component.ts");
|
2261 | var foundation_1 = __webpack_require__( "./packages/mdc-ripple/foundation.ts");
|
2262 | var constants_1 = __webpack_require__( "./packages/mdc-checkbox/constants.ts");
|
2263 | var foundation_2 = __webpack_require__( "./packages/mdc-checkbox/foundation.ts");
|
2264 | var CB_PROTO_PROPS = ['checked', 'indeterminate'];
|
2265 | var MDCCheckbox = function (_super) {
|
2266 | __extends(MDCCheckbox, _super);
|
2267 | function MDCCheckbox() {
|
2268 | var _this = _super !== null && _super.apply(this, arguments) || this;
|
2269 | _this.rippleSurface = _this.createRipple();
|
2270 | return _this;
|
2271 | }
|
2272 | MDCCheckbox.attachTo = function (root) {
|
2273 | return new MDCCheckbox(root);
|
2274 | };
|
2275 | Object.defineProperty(MDCCheckbox.prototype, "ripple", {
|
2276 | get: function get() {
|
2277 | return this.rippleSurface;
|
2278 | },
|
2279 | enumerable: false,
|
2280 | configurable: true
|
2281 | });
|
2282 | Object.defineProperty(MDCCheckbox.prototype, "checked", {
|
2283 | get: function get() {
|
2284 | return this.getNativeControl().checked;
|
2285 | },
|
2286 | set: function set(checked) {
|
2287 | this.getNativeControl().checked = checked;
|
2288 | },
|
2289 | enumerable: false,
|
2290 | configurable: true
|
2291 | });
|
2292 | Object.defineProperty(MDCCheckbox.prototype, "indeterminate", {
|
2293 | get: function get() {
|
2294 | return this.getNativeControl().indeterminate;
|
2295 | },
|
2296 | set: function set(indeterminate) {
|
2297 | this.getNativeControl().indeterminate = indeterminate;
|
2298 | },
|
2299 | enumerable: false,
|
2300 | configurable: true
|
2301 | });
|
2302 | Object.defineProperty(MDCCheckbox.prototype, "disabled", {
|
2303 | get: function get() {
|
2304 | return this.getNativeControl().disabled;
|
2305 | },
|
2306 | set: function set(disabled) {
|
2307 | this.foundation.setDisabled(disabled);
|
2308 | },
|
2309 | enumerable: false,
|
2310 | configurable: true
|
2311 | });
|
2312 | Object.defineProperty(MDCCheckbox.prototype, "value", {
|
2313 | get: function get() {
|
2314 | return this.getNativeControl().value;
|
2315 | },
|
2316 | set: function set(value) {
|
2317 | this.getNativeControl().value = value;
|
2318 | },
|
2319 | enumerable: false,
|
2320 | configurable: true
|
2321 | });
|
2322 | MDCCheckbox.prototype.initialize = function () {
|
2323 | var DATA_INDETERMINATE_ATTR = constants_1.strings.DATA_INDETERMINATE_ATTR;
|
2324 | this.getNativeControl().indeterminate = this.getNativeControl().getAttribute(DATA_INDETERMINATE_ATTR) === 'true';
|
2325 | this.getNativeControl().removeAttribute(DATA_INDETERMINATE_ATTR);
|
2326 | };
|
2327 | MDCCheckbox.prototype.initialSyncWithDOM = function () {
|
2328 | var _this = this;
|
2329 | this.handleChange = function () {
|
2330 | _this.foundation.handleChange();
|
2331 | };
|
2332 | this.handleAnimationEnd = function () {
|
2333 | _this.foundation.handleAnimationEnd();
|
2334 | };
|
2335 | this.getNativeControl().addEventListener('change', this.handleChange);
|
2336 | this.listen(util_1.getCorrectEventName(window, 'animationend'), this.handleAnimationEnd);
|
2337 | this.installPropertyChangeHooks();
|
2338 | };
|
2339 | MDCCheckbox.prototype.destroy = function () {
|
2340 | this.rippleSurface.destroy();
|
2341 | this.getNativeControl().removeEventListener('change', this.handleChange);
|
2342 | this.unlisten(util_1.getCorrectEventName(window, 'animationend'), this.handleAnimationEnd);
|
2343 | this.uninstallPropertyChangeHooks();
|
2344 | _super.prototype.destroy.call(this);
|
2345 | };
|
2346 | MDCCheckbox.prototype.getDefaultFoundation = function () {
|
2347 | var _this = this;
|
2348 |
|
2349 |
|
2350 | var adapter = {
|
2351 | addClass: function addClass(className) {
|
2352 | return _this.root.classList.add(className);
|
2353 | },
|
2354 | forceLayout: function forceLayout() {
|
2355 | return _this.root.offsetWidth;
|
2356 | },
|
2357 | hasNativeControl: function hasNativeControl() {
|
2358 | return !!_this.getNativeControl();
|
2359 | },
|
2360 | isAttachedToDOM: function isAttachedToDOM() {
|
2361 | return Boolean(_this.root.parentNode);
|
2362 | },
|
2363 | isChecked: function isChecked() {
|
2364 | return _this.checked;
|
2365 | },
|
2366 | isIndeterminate: function isIndeterminate() {
|
2367 | return _this.indeterminate;
|
2368 | },
|
2369 | removeClass: function removeClass(className) {
|
2370 | _this.root.classList.remove(className);
|
2371 | },
|
2372 | removeNativeControlAttr: function removeNativeControlAttr(attr) {
|
2373 | _this.getNativeControl().removeAttribute(attr);
|
2374 | },
|
2375 | setNativeControlAttr: function setNativeControlAttr(attr, value) {
|
2376 | _this.getNativeControl().setAttribute(attr, value);
|
2377 | },
|
2378 | setNativeControlDisabled: function setNativeControlDisabled(disabled) {
|
2379 | _this.getNativeControl().disabled = disabled;
|
2380 | }
|
2381 | };
|
2382 | return new foundation_2.MDCCheckboxFoundation(adapter);
|
2383 | };
|
2384 | MDCCheckbox.prototype.createRipple = function () {
|
2385 | var _this = this;
|
2386 |
|
2387 |
|
2388 | var adapter = __assign(__assign({}, component_2.MDCRipple.createAdapter(this)), { deregisterInteractionHandler: function deregisterInteractionHandler(evtType, handler) {
|
2389 | _this.getNativeControl().removeEventListener(evtType, handler, events_1.applyPassive());
|
2390 | }, isSurfaceActive: function isSurfaceActive() {
|
2391 | return ponyfill_1.matches(_this.getNativeControl(), ':active');
|
2392 | }, isUnbounded: function isUnbounded() {
|
2393 | return true;
|
2394 | }, registerInteractionHandler: function registerInteractionHandler(evtType, handler) {
|
2395 | _this.getNativeControl().addEventListener(evtType, handler, events_1.applyPassive());
|
2396 | } });
|
2397 | return new component_2.MDCRipple(this.root, new foundation_1.MDCRippleFoundation(adapter));
|
2398 | };
|
2399 | MDCCheckbox.prototype.installPropertyChangeHooks = function () {
|
2400 | var e_1, _a;
|
2401 | var _this = this;
|
2402 | var nativeCb = this.getNativeControl();
|
2403 | var cbProto = Object.getPrototypeOf(nativeCb);
|
2404 | var _loop_1 = function _loop_1(controlState) {
|
2405 | var desc = Object.getOwnPropertyDescriptor(cbProto, controlState);
|
2406 |
|
2407 |
|
2408 | if (!validDescriptor(desc)) {
|
2409 | return { value: void 0 };
|
2410 | }
|
2411 |
|
2412 | var nativeGetter = desc.get;
|
2413 | var nativeCbDesc = {
|
2414 | configurable: desc.configurable,
|
2415 | enumerable: desc.enumerable,
|
2416 | get: nativeGetter,
|
2417 | set: function set(state) {
|
2418 | desc.set.call(nativeCb, state);
|
2419 | _this.foundation.handleChange();
|
2420 | }
|
2421 | };
|
2422 | Object.defineProperty(nativeCb, controlState, nativeCbDesc);
|
2423 | };
|
2424 | try {
|
2425 | for (var CB_PROTO_PROPS_1 = __values(CB_PROTO_PROPS), CB_PROTO_PROPS_1_1 = CB_PROTO_PROPS_1.next(); !CB_PROTO_PROPS_1_1.done; CB_PROTO_PROPS_1_1 = CB_PROTO_PROPS_1.next()) {
|
2426 | var controlState = CB_PROTO_PROPS_1_1.value;
|
2427 | var state_1 = _loop_1(controlState);
|
2428 | if ((typeof state_1 === "undefined" ? "undefined" : _typeof(state_1)) === "object") return state_1.value;
|
2429 | }
|
2430 | } catch (e_1_1) {
|
2431 | e_1 = { error: e_1_1 };
|
2432 | } finally {
|
2433 | try {
|
2434 | if (CB_PROTO_PROPS_1_1 && !CB_PROTO_PROPS_1_1.done && (_a = CB_PROTO_PROPS_1.return)) _a.call(CB_PROTO_PROPS_1);
|
2435 | } finally {
|
2436 | if (e_1) throw e_1.error;
|
2437 | }
|
2438 | }
|
2439 | };
|
2440 | MDCCheckbox.prototype.uninstallPropertyChangeHooks = function () {
|
2441 | var e_2, _a;
|
2442 | var nativeCb = this.getNativeControl();
|
2443 | var cbProto = Object.getPrototypeOf(nativeCb);
|
2444 | try {
|
2445 | for (var CB_PROTO_PROPS_2 = __values(CB_PROTO_PROPS), CB_PROTO_PROPS_2_1 = CB_PROTO_PROPS_2.next(); !CB_PROTO_PROPS_2_1.done; CB_PROTO_PROPS_2_1 = CB_PROTO_PROPS_2.next()) {
|
2446 | var controlState = CB_PROTO_PROPS_2_1.value;
|
2447 | var desc = Object.getOwnPropertyDescriptor(cbProto, controlState);
|
2448 | if (!validDescriptor(desc)) {
|
2449 | return;
|
2450 | }
|
2451 | Object.defineProperty(nativeCb, controlState, desc);
|
2452 | }
|
2453 | } catch (e_2_1) {
|
2454 | e_2 = { error: e_2_1 };
|
2455 | } finally {
|
2456 | try {
|
2457 | if (CB_PROTO_PROPS_2_1 && !CB_PROTO_PROPS_2_1.done && (_a = CB_PROTO_PROPS_2.return)) _a.call(CB_PROTO_PROPS_2);
|
2458 | } finally {
|
2459 | if (e_2) throw e_2.error;
|
2460 | }
|
2461 | }
|
2462 | };
|
2463 | MDCCheckbox.prototype.getNativeControl = function () {
|
2464 | var NATIVE_CONTROL_SELECTOR = constants_1.strings.NATIVE_CONTROL_SELECTOR;
|
2465 | var el = this.root.querySelector(NATIVE_CONTROL_SELECTOR);
|
2466 | if (!el) {
|
2467 | throw new Error("Checkbox component requires a " + NATIVE_CONTROL_SELECTOR + " element");
|
2468 | }
|
2469 | return el;
|
2470 | };
|
2471 | return MDCCheckbox;
|
2472 | }(component_1.MDCComponent);
|
2473 | exports.MDCCheckbox = MDCCheckbox;
|
2474 | function validDescriptor(inputPropDesc) {
|
2475 | return !!inputPropDesc && typeof inputPropDesc.set === 'function';
|
2476 | }
|
2477 |
|
2478 | }),
|
2479 |
|
2480 | "./packages/mdc-checkbox/constants.ts":
|
2481 |
|
2482 |
|
2483 |
|
2484 |
|
2485 | (function(module, exports, __webpack_require__) {
|
2486 |
|
2487 | "use strict";
|
2488 |
|
2489 |
|
2490 |
|
2491 |
|
2492 |
|
2493 |
|
2494 |
|
2495 |
|
2496 |
|
2497 |
|
2498 |
|
2499 |
|
2500 |
|
2501 |
|
2502 |
|
2503 |
|
2504 |
|
2505 |
|
2506 |
|
2507 |
|
2508 |
|
2509 |
|
2510 |
|
2511 |
|
2512 | Object.defineProperty(exports, "__esModule", { value: true });
|
2513 | exports.numbers = exports.strings = exports.cssClasses = void 0;
|
2514 | exports.cssClasses = {
|
2515 | ANIM_CHECKED_INDETERMINATE: 'mdc-checkbox--anim-checked-indeterminate',
|
2516 | ANIM_CHECKED_UNCHECKED: 'mdc-checkbox--anim-checked-unchecked',
|
2517 | ANIM_INDETERMINATE_CHECKED: 'mdc-checkbox--anim-indeterminate-checked',
|
2518 | ANIM_INDETERMINATE_UNCHECKED: 'mdc-checkbox--anim-indeterminate-unchecked',
|
2519 | ANIM_UNCHECKED_CHECKED: 'mdc-checkbox--anim-unchecked-checked',
|
2520 | ANIM_UNCHECKED_INDETERMINATE: 'mdc-checkbox--anim-unchecked-indeterminate',
|
2521 | BACKGROUND: 'mdc-checkbox__background',
|
2522 | CHECKED: 'mdc-checkbox--checked',
|
2523 | CHECKMARK: 'mdc-checkbox__checkmark',
|
2524 | CHECKMARK_PATH: 'mdc-checkbox__checkmark-path',
|
2525 | DISABLED: 'mdc-checkbox--disabled',
|
2526 | INDETERMINATE: 'mdc-checkbox--indeterminate',
|
2527 | MIXEDMARK: 'mdc-checkbox__mixedmark',
|
2528 | NATIVE_CONTROL: 'mdc-checkbox__native-control',
|
2529 | ROOT: 'mdc-checkbox',
|
2530 | SELECTED: 'mdc-checkbox--selected',
|
2531 | UPGRADED: 'mdc-checkbox--upgraded'
|
2532 | };
|
2533 | exports.strings = {
|
2534 | ARIA_CHECKED_ATTR: 'aria-checked',
|
2535 | ARIA_CHECKED_INDETERMINATE_VALUE: 'mixed',
|
2536 | DATA_INDETERMINATE_ATTR: 'data-indeterminate',
|
2537 | NATIVE_CONTROL_SELECTOR: '.mdc-checkbox__native-control',
|
2538 | TRANSITION_STATE_CHECKED: 'checked',
|
2539 | TRANSITION_STATE_INDETERMINATE: 'indeterminate',
|
2540 | TRANSITION_STATE_INIT: 'init',
|
2541 | TRANSITION_STATE_UNCHECKED: 'unchecked'
|
2542 | };
|
2543 | exports.numbers = {
|
2544 | ANIM_END_LATCH_MS: 250
|
2545 | };
|
2546 |
|
2547 | }),
|
2548 |
|
2549 | "./packages/mdc-checkbox/foundation.ts":
|
2550 |
|
2551 |
|
2552 |
|
2553 |
|
2554 | (function(module, exports, __webpack_require__) {
|
2555 |
|
2556 | "use strict";
|
2557 |
|
2558 |
|
2559 |
|
2560 |
|
2561 |
|
2562 |
|
2563 |
|
2564 |
|
2565 |
|
2566 |
|
2567 |
|
2568 |
|
2569 |
|
2570 |
|
2571 |
|
2572 |
|
2573 |
|
2574 |
|
2575 |
|
2576 |
|
2577 |
|
2578 |
|
2579 |
|
2580 |
|
2581 | var __extends = this && this.__extends || function () {
|
2582 | var _extendStatics = function extendStatics(d, b) {
|
2583 | _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
|
2584 | d.__proto__ = b;
|
2585 | } || function (d, b) {
|
2586 | for (var p in b) {
|
2587 | if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
2588 | }
|
2589 | };
|
2590 | return _extendStatics(d, b);
|
2591 | };
|
2592 | return function (d, b) {
|
2593 | if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
2594 | _extendStatics(d, b);
|
2595 | function __() {
|
2596 | this.constructor = d;
|
2597 | }
|
2598 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
2599 | };
|
2600 | }();
|
2601 | var __assign = this && this.__assign || function () {
|
2602 | __assign = Object.assign || function (t) {
|
2603 | for (var s, i = 1, n = arguments.length; i < n; i++) {
|
2604 | s = arguments[i];
|
2605 | for (var p in s) {
|
2606 | if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
2607 | }
|
2608 | }
|
2609 | return t;
|
2610 | };
|
2611 | return __assign.apply(this, arguments);
|
2612 | };
|
2613 | Object.defineProperty(exports, "__esModule", { value: true });
|
2614 | exports.MDCCheckboxFoundation = void 0;
|
2615 | var foundation_1 = __webpack_require__( "./packages/mdc-base/foundation.ts");
|
2616 | var constants_1 = __webpack_require__( "./packages/mdc-checkbox/constants.ts");
|
2617 | var MDCCheckboxFoundation = function (_super) {
|
2618 | __extends(MDCCheckboxFoundation, _super);
|
2619 | function MDCCheckboxFoundation(adapter) {
|
2620 | var _this = _super.call(this, __assign(__assign({}, MDCCheckboxFoundation.defaultAdapter), adapter)) || this;
|
2621 | _this.currentCheckState = constants_1.strings.TRANSITION_STATE_INIT;
|
2622 | _this.currentAnimationClass = '';
|
2623 | _this.animEndLatchTimer = 0;
|
2624 | _this.enableAnimationEndHandler = false;
|
2625 | return _this;
|
2626 | }
|
2627 | Object.defineProperty(MDCCheckboxFoundation, "cssClasses", {
|
2628 | get: function get() {
|
2629 | return constants_1.cssClasses;
|
2630 | },
|
2631 | enumerable: false,
|
2632 | configurable: true
|
2633 | });
|
2634 | Object.defineProperty(MDCCheckboxFoundation, "strings", {
|
2635 | get: function get() {
|
2636 | return constants_1.strings;
|
2637 | },
|
2638 | enumerable: false,
|
2639 | configurable: true
|
2640 | });
|
2641 | Object.defineProperty(MDCCheckboxFoundation, "numbers", {
|
2642 | get: function get() {
|
2643 | return constants_1.numbers;
|
2644 | },
|
2645 | enumerable: false,
|
2646 | configurable: true
|
2647 | });
|
2648 | Object.defineProperty(MDCCheckboxFoundation, "defaultAdapter", {
|
2649 | get: function get() {
|
2650 | return {
|
2651 | addClass: function addClass() {
|
2652 | return undefined;
|
2653 | },
|
2654 | forceLayout: function forceLayout() {
|
2655 | return undefined;
|
2656 | },
|
2657 | hasNativeControl: function hasNativeControl() {
|
2658 | return false;
|
2659 | },
|
2660 | isAttachedToDOM: function isAttachedToDOM() {
|
2661 | return false;
|
2662 | },
|
2663 | isChecked: function isChecked() {
|
2664 | return false;
|
2665 | },
|
2666 | isIndeterminate: function isIndeterminate() {
|
2667 | return false;
|
2668 | },
|
2669 | removeClass: function removeClass() {
|
2670 | return undefined;
|
2671 | },
|
2672 | removeNativeControlAttr: function removeNativeControlAttr() {
|
2673 | return undefined;
|
2674 | },
|
2675 | setNativeControlAttr: function setNativeControlAttr() {
|
2676 | return undefined;
|
2677 | },
|
2678 | setNativeControlDisabled: function setNativeControlDisabled() {
|
2679 | return undefined;
|
2680 | }
|
2681 | };
|
2682 | },
|
2683 | enumerable: false,
|
2684 | configurable: true
|
2685 | });
|
2686 | MDCCheckboxFoundation.prototype.init = function () {
|
2687 | this.currentCheckState = this.determineCheckState();
|
2688 | this.updateAriaChecked();
|
2689 | this.adapter.addClass(constants_1.cssClasses.UPGRADED);
|
2690 | };
|
2691 | MDCCheckboxFoundation.prototype.destroy = function () {
|
2692 | clearTimeout(this.animEndLatchTimer);
|
2693 | };
|
2694 | MDCCheckboxFoundation.prototype.setDisabled = function (disabled) {
|
2695 | this.adapter.setNativeControlDisabled(disabled);
|
2696 | if (disabled) {
|
2697 | this.adapter.addClass(constants_1.cssClasses.DISABLED);
|
2698 | } else {
|
2699 | this.adapter.removeClass(constants_1.cssClasses.DISABLED);
|
2700 | }
|
2701 | };
|
2702 | |
2703 |
|
2704 |
|
2705 | MDCCheckboxFoundation.prototype.handleAnimationEnd = function () {
|
2706 | var _this = this;
|
2707 | if (!this.enableAnimationEndHandler) {
|
2708 | return;
|
2709 | }
|
2710 | clearTimeout(this.animEndLatchTimer);
|
2711 | this.animEndLatchTimer = setTimeout(function () {
|
2712 | _this.adapter.removeClass(_this.currentAnimationClass);
|
2713 | _this.enableAnimationEndHandler = false;
|
2714 | }, constants_1.numbers.ANIM_END_LATCH_MS);
|
2715 | };
|
2716 | |
2717 |
|
2718 |
|
2719 | MDCCheckboxFoundation.prototype.handleChange = function () {
|
2720 | this.transitionCheckState();
|
2721 | };
|
2722 | MDCCheckboxFoundation.prototype.transitionCheckState = function () {
|
2723 | if (!this.adapter.hasNativeControl()) {
|
2724 | return;
|
2725 | }
|
2726 | var oldState = this.currentCheckState;
|
2727 | var newState = this.determineCheckState();
|
2728 | if (oldState === newState) {
|
2729 | return;
|
2730 | }
|
2731 | this.updateAriaChecked();
|
2732 | var TRANSITION_STATE_UNCHECKED = constants_1.strings.TRANSITION_STATE_UNCHECKED;
|
2733 | var SELECTED = constants_1.cssClasses.SELECTED;
|
2734 | if (newState === TRANSITION_STATE_UNCHECKED) {
|
2735 | this.adapter.removeClass(SELECTED);
|
2736 | } else {
|
2737 | this.adapter.addClass(SELECTED);
|
2738 | }
|
2739 |
|
2740 |
|
2741 | if (this.currentAnimationClass.length > 0) {
|
2742 | clearTimeout(this.animEndLatchTimer);
|
2743 | this.adapter.forceLayout();
|
2744 | this.adapter.removeClass(this.currentAnimationClass);
|
2745 | }
|
2746 | this.currentAnimationClass = this.getTransitionAnimationClass(oldState, newState);
|
2747 | this.currentCheckState = newState;
|
2748 |
|
2749 |
|
2750 | if (this.adapter.isAttachedToDOM() && this.currentAnimationClass.length > 0) {
|
2751 | this.adapter.addClass(this.currentAnimationClass);
|
2752 | this.enableAnimationEndHandler = true;
|
2753 | }
|
2754 | };
|
2755 | MDCCheckboxFoundation.prototype.determineCheckState = function () {
|
2756 | var TRANSITION_STATE_INDETERMINATE = constants_1.strings.TRANSITION_STATE_INDETERMINATE,
|
2757 | TRANSITION_STATE_CHECKED = constants_1.strings.TRANSITION_STATE_CHECKED,
|
2758 | TRANSITION_STATE_UNCHECKED = constants_1.strings.TRANSITION_STATE_UNCHECKED;
|
2759 | if (this.adapter.isIndeterminate()) {
|
2760 | return TRANSITION_STATE_INDETERMINATE;
|
2761 | }
|
2762 | return this.adapter.isChecked() ? TRANSITION_STATE_CHECKED : TRANSITION_STATE_UNCHECKED;
|
2763 | };
|
2764 | MDCCheckboxFoundation.prototype.getTransitionAnimationClass = function (oldState, newState) {
|
2765 | var TRANSITION_STATE_INIT = constants_1.strings.TRANSITION_STATE_INIT,
|
2766 | TRANSITION_STATE_CHECKED = constants_1.strings.TRANSITION_STATE_CHECKED,
|
2767 | TRANSITION_STATE_UNCHECKED = constants_1.strings.TRANSITION_STATE_UNCHECKED;
|
2768 | var _a = MDCCheckboxFoundation.cssClasses,
|
2769 | ANIM_UNCHECKED_CHECKED = _a.ANIM_UNCHECKED_CHECKED,
|
2770 | ANIM_UNCHECKED_INDETERMINATE = _a.ANIM_UNCHECKED_INDETERMINATE,
|
2771 | ANIM_CHECKED_UNCHECKED = _a.ANIM_CHECKED_UNCHECKED,
|
2772 | ANIM_CHECKED_INDETERMINATE = _a.ANIM_CHECKED_INDETERMINATE,
|
2773 | ANIM_INDETERMINATE_CHECKED = _a.ANIM_INDETERMINATE_CHECKED,
|
2774 | ANIM_INDETERMINATE_UNCHECKED = _a.ANIM_INDETERMINATE_UNCHECKED;
|
2775 | switch (oldState) {
|
2776 | case TRANSITION_STATE_INIT:
|
2777 | if (newState === TRANSITION_STATE_UNCHECKED) {
|
2778 | return '';
|
2779 | }
|
2780 | return newState === TRANSITION_STATE_CHECKED ? ANIM_INDETERMINATE_CHECKED : ANIM_INDETERMINATE_UNCHECKED;
|
2781 | case TRANSITION_STATE_UNCHECKED:
|
2782 | return newState === TRANSITION_STATE_CHECKED ? ANIM_UNCHECKED_CHECKED : ANIM_UNCHECKED_INDETERMINATE;
|
2783 | case TRANSITION_STATE_CHECKED:
|
2784 | return newState === TRANSITION_STATE_UNCHECKED ? ANIM_CHECKED_UNCHECKED : ANIM_CHECKED_INDETERMINATE;
|
2785 | default:
|
2786 |
|
2787 | return newState === TRANSITION_STATE_CHECKED ? ANIM_INDETERMINATE_CHECKED : ANIM_INDETERMINATE_UNCHECKED;
|
2788 | }
|
2789 | };
|
2790 | MDCCheckboxFoundation.prototype.updateAriaChecked = function () {
|
2791 |
|
2792 | if (this.adapter.isIndeterminate()) {
|
2793 | this.adapter.setNativeControlAttr(constants_1.strings.ARIA_CHECKED_ATTR, constants_1.strings.ARIA_CHECKED_INDETERMINATE_VALUE);
|
2794 | } else {
|
2795 |
|
2796 |
|
2797 | this.adapter.removeNativeControlAttr(constants_1.strings.ARIA_CHECKED_ATTR);
|
2798 | }
|
2799 | };
|
2800 | return MDCCheckboxFoundation;
|
2801 | }(foundation_1.MDCFoundation);
|
2802 | exports.MDCCheckboxFoundation = MDCCheckboxFoundation;
|
2803 |
|
2804 | exports.default = MDCCheckboxFoundation;
|
2805 |
|
2806 | }),
|
2807 |
|
2808 | "./packages/mdc-checkbox/index.ts":
|
2809 |
|
2810 |
|
2811 |
|
2812 |
|
2813 | (function(module, exports, __webpack_require__) {
|
2814 |
|
2815 | "use strict";
|
2816 |
|
2817 |
|
2818 |
|
2819 |
|
2820 |
|
2821 |
|
2822 |
|
2823 |
|
2824 |
|
2825 |
|
2826 |
|
2827 |
|
2828 |
|
2829 |
|
2830 |
|
2831 |
|
2832 |
|
2833 |
|
2834 |
|
2835 |
|
2836 |
|
2837 |
|
2838 |
|
2839 |
|
2840 | var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
|
2841 | if (k2 === undefined) k2 = k;
|
2842 | Object.defineProperty(o, k2, { enumerable: true, get: function get() {
|
2843 | return m[k];
|
2844 | } });
|
2845 | } : function (o, m, k, k2) {
|
2846 | if (k2 === undefined) k2 = k;
|
2847 | o[k2] = m[k];
|
2848 | });
|
2849 | var __exportStar = this && this.__exportStar || function (m, exports) {
|
2850 | for (var p in m) {
|
2851 | if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
2852 | }
|
2853 | };
|
2854 | Object.defineProperty(exports, "__esModule", { value: true });
|
2855 | __exportStar(__webpack_require__( "./packages/mdc-checkbox/adapter.ts"), exports);
|
2856 | __exportStar(__webpack_require__( "./packages/mdc-checkbox/component.ts"), exports);
|
2857 | __exportStar(__webpack_require__( "./packages/mdc-checkbox/constants.ts"), exports);
|
2858 | __exportStar(__webpack_require__( "./packages/mdc-checkbox/foundation.ts"), exports);
|
2859 |
|
2860 | }),
|
2861 |
|
2862 | "./packages/mdc-chips/deprecated/chip-set/adapter.ts":
|
2863 |
|
2864 |
|
2865 |
|
2866 |
|
2867 | (function(module, exports, __webpack_require__) {
|
2868 |
|
2869 | "use strict";
|
2870 |
|
2871 |
|
2872 |
|
2873 |
|
2874 |
|
2875 |
|
2876 |
|
2877 |
|
2878 |
|
2879 |
|
2880 |
|
2881 |
|
2882 |
|
2883 |
|
2884 |
|
2885 |
|
2886 |
|
2887 |
|
2888 |
|
2889 |
|
2890 |
|
2891 |
|
2892 |
|
2893 |
|
2894 | Object.defineProperty(exports, "__esModule", { value: true });
|
2895 |
|
2896 | }),
|
2897 |
|
2898 | "./packages/mdc-chips/deprecated/chip-set/component.ts":
|
2899 |
|
2900 |
|
2901 |
|
2902 |
|
2903 | (function(module, exports, __webpack_require__) {
|
2904 |
|
2905 | "use strict";
|
2906 |
|
2907 |
|
2908 |
|
2909 |
|
2910 |
|
2911 |
|
2912 |
|
2913 |
|
2914 |
|
2915 |
|
2916 |
|
2917 |
|
2918 |
|
2919 |
|
2920 |
|
2921 |
|
2922 |
|
2923 |
|
2924 |
|
2925 |
|
2926 |
|
2927 |
|
2928 |
|
2929 |
|
2930 | var __extends = this && this.__extends || function () {
|
2931 | var _extendStatics = function extendStatics(d, b) {
|
2932 | _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
|
2933 | d.__proto__ = b;
|
2934 | } || function (d, b) {
|
2935 | for (var p in b) {
|
2936 | if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
2937 | }
|
2938 | };
|
2939 | return _extendStatics(d, b);
|
2940 | };
|
2941 | return function (d, b) {
|
2942 | if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
2943 | _extendStatics(d, b);
|
2944 | function __() {
|
2945 | this.constructor = d;
|
2946 | }
|
2947 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
2948 | };
|
2949 | }();
|
2950 | var __values = this && this.__values || function (o) {
|
2951 | var s = typeof Symbol === "function" && Symbol.iterator,
|
2952 | m = s && o[s],
|
2953 | i = 0;
|
2954 | if (m) return m.call(o);
|
2955 | if (o && typeof o.length === "number") return {
|
2956 | next: function next() {
|
2957 | if (o && i >= o.length) o = void 0;
|
2958 | return { value: o && o[i++], done: !o };
|
2959 | }
|
2960 | };
|
2961 | throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
2962 | };
|
2963 | Object.defineProperty(exports, "__esModule", { value: true });
|
2964 | exports.MDCChipSet = void 0;
|
2965 | var component_1 = __webpack_require__( "./packages/mdc-base/component.ts");
|
2966 | var announce_1 = __webpack_require__( "./packages/mdc-dom/announce.ts");
|
2967 | var component_2 = __webpack_require__( "./packages/mdc-chips/deprecated/chip/component.ts");
|
2968 | var foundation_1 = __webpack_require__( "./packages/mdc-chips/deprecated/chip/foundation.ts");
|
2969 | var foundation_2 = __webpack_require__( "./packages/mdc-chips/deprecated/chip-set/foundation.ts");
|
2970 | var _a = foundation_1.MDCChipFoundation.strings,
|
2971 | INTERACTION_EVENT = _a.INTERACTION_EVENT,
|
2972 | SELECTION_EVENT = _a.SELECTION_EVENT,
|
2973 | REMOVAL_EVENT = _a.REMOVAL_EVENT,
|
2974 | NAVIGATION_EVENT = _a.NAVIGATION_EVENT;
|
2975 | var CHIP_SELECTOR = foundation_2.MDCChipSetFoundation.strings.CHIP_SELECTOR;
|
2976 | var idCounter = 0;
|
2977 | var MDCChipSet = function (_super) {
|
2978 | __extends(MDCChipSet, _super);
|
2979 | function MDCChipSet() {
|
2980 | return _super !== null && _super.apply(this, arguments) || this;
|
2981 | }
|
2982 | MDCChipSet.attachTo = function (root) {
|
2983 | return new MDCChipSet(root);
|
2984 | };
|
2985 | Object.defineProperty(MDCChipSet.prototype, "chips", {
|
2986 | get: function get() {
|
2987 | return this.chipsList.slice();
|
2988 | },
|
2989 | enumerable: false,
|
2990 | configurable: true
|
2991 | });
|
2992 | Object.defineProperty(MDCChipSet.prototype, "selectedChipIds", {
|
2993 | |
2994 |
|
2995 |
|
2996 | get: function get() {
|
2997 | return this.foundation.getSelectedChipIds();
|
2998 | },
|
2999 | enumerable: false,
|
3000 | configurable: true
|
3001 | });
|
3002 | |
3003 |
|
3004 |
|
3005 | MDCChipSet.prototype.initialize = function (chipFactory) {
|
3006 | if (chipFactory === void 0) {
|
3007 | chipFactory = function chipFactory(el) {
|
3008 | return new component_2.MDCChip(el);
|
3009 | };
|
3010 | }
|
3011 | this.chipFactory = chipFactory;
|
3012 | this.chipsList = this.instantiateChips(this.chipFactory);
|
3013 | };
|
3014 | MDCChipSet.prototype.initialSyncWithDOM = function () {
|
3015 | var e_1, _a;
|
3016 | var _this = this;
|
3017 | try {
|
3018 | for (var _b = __values(this.chipsList), _c = _b.next(); !_c.done; _c = _b.next()) {
|
3019 | var chip = _c.value;
|
3020 | if (chip.id && chip.selected) {
|
3021 | this.foundation.select(chip.id);
|
3022 | }
|
3023 | }
|
3024 | } catch (e_1_1) {
|
3025 | e_1 = { error: e_1_1 };
|
3026 | } finally {
|
3027 | try {
|
3028 | if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
3029 | } finally {
|
3030 | if (e_1) throw e_1.error;
|
3031 | }
|
3032 | }
|
3033 | this.handleChipInteraction = function (evt) {
|
3034 | return _this.foundation.handleChipInteraction(evt.detail);
|
3035 | };
|
3036 | this.handleChipSelection = function (evt) {
|
3037 | return _this.foundation.handleChipSelection(evt.detail);
|
3038 | };
|
3039 | this.handleChipRemoval = function (evt) {
|
3040 | return _this.foundation.handleChipRemoval(evt.detail);
|
3041 | };
|
3042 | this.handleChipNavigation = function (evt) {
|
3043 | return _this.foundation.handleChipNavigation(evt.detail);
|
3044 | };
|
3045 | this.listen(INTERACTION_EVENT, this.handleChipInteraction);
|
3046 | this.listen(SELECTION_EVENT, this.handleChipSelection);
|
3047 | this.listen(REMOVAL_EVENT, this.handleChipRemoval);
|
3048 | this.listen(NAVIGATION_EVENT, this.handleChipNavigation);
|
3049 | };
|
3050 | MDCChipSet.prototype.destroy = function () {
|
3051 | var e_2, _a;
|
3052 | try {
|
3053 | for (var _b = __values(this.chipsList), _c = _b.next(); !_c.done; _c = _b.next()) {
|
3054 | var chip = _c.value;
|
3055 | chip.destroy();
|
3056 | }
|
3057 | } catch (e_2_1) {
|
3058 | e_2 = { error: e_2_1 };
|
3059 | } finally {
|
3060 | try {
|
3061 | if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
3062 | } finally {
|
3063 | if (e_2) throw e_2.error;
|
3064 | }
|
3065 | }
|
3066 | this.unlisten(INTERACTION_EVENT, this.handleChipInteraction);
|
3067 | this.unlisten(SELECTION_EVENT, this.handleChipSelection);
|
3068 | this.unlisten(REMOVAL_EVENT, this.handleChipRemoval);
|
3069 | this.unlisten(NAVIGATION_EVENT, this.handleChipNavigation);
|
3070 | _super.prototype.destroy.call(this);
|
3071 | };
|
3072 | |
3073 |
|
3074 |
|
3075 | MDCChipSet.prototype.addChip = function (chipEl) {
|
3076 | chipEl.id = chipEl.id || "mdc-chip-" + ++idCounter;
|
3077 | this.chipsList.push(this.chipFactory(chipEl));
|
3078 | };
|
3079 | MDCChipSet.prototype.getDefaultFoundation = function () {
|
3080 | var _this = this;
|
3081 |
|
3082 |
|
3083 | var adapter = {
|
3084 | announceMessage: function announceMessage(message) {
|
3085 | announce_1.announce(message);
|
3086 | },
|
3087 | focusChipPrimaryActionAtIndex: function focusChipPrimaryActionAtIndex(index) {
|
3088 | _this.chipsList[index].focusPrimaryAction();
|
3089 | },
|
3090 | focusChipTrailingActionAtIndex: function focusChipTrailingActionAtIndex(index) {
|
3091 | _this.chipsList[index].focusTrailingAction();
|
3092 | },
|
3093 | getChipListCount: function getChipListCount() {
|
3094 | return _this.chips.length;
|
3095 | },
|
3096 | getIndexOfChipById: function getIndexOfChipById(chipId) {
|
3097 | return _this.findChipIndex(chipId);
|
3098 | },
|
3099 | hasClass: function hasClass(className) {
|
3100 | return _this.root.classList.contains(className);
|
3101 | },
|
3102 | isRTL: function isRTL() {
|
3103 | return window.getComputedStyle(_this.root).getPropertyValue('direction') === 'rtl';
|
3104 | },
|
3105 | removeChipAtIndex: function removeChipAtIndex(index) {
|
3106 | if (index >= 0 && index < _this.chips.length) {
|
3107 | _this.chipsList[index].destroy();
|
3108 | _this.chipsList[index].remove();
|
3109 | _this.chipsList.splice(index, 1);
|
3110 | }
|
3111 | },
|
3112 | removeFocusFromChipAtIndex: function removeFocusFromChipAtIndex(index) {
|
3113 | _this.chipsList[index].removeFocus();
|
3114 | },
|
3115 | selectChipAtIndex: function selectChipAtIndex(index, selected, shouldNotifyClients) {
|
3116 | if (index >= 0 && index < _this.chips.length) {
|
3117 | _this.chipsList[index].setSelectedFromChipSet(selected, shouldNotifyClients);
|
3118 | }
|
3119 | }
|
3120 | };
|
3121 | return new foundation_2.MDCChipSetFoundation(adapter);
|
3122 | };
|
3123 | |
3124 |
|
3125 |
|
3126 | MDCChipSet.prototype.instantiateChips = function (chipFactory) {
|
3127 | var chipElements = [].slice.call(this.root.querySelectorAll(CHIP_SELECTOR));
|
3128 | return chipElements.map(function (el) {
|
3129 | el.id = el.id || "mdc-chip-" + ++idCounter;
|
3130 | return chipFactory(el);
|
3131 | });
|
3132 | };
|
3133 | |
3134 |
|
3135 |
|
3136 | MDCChipSet.prototype.findChipIndex = function (chipId) {
|
3137 | for (var i = 0; i < this.chips.length; i++) {
|
3138 | if (this.chipsList[i].id === chipId) {
|
3139 | return i;
|
3140 | }
|
3141 | }
|
3142 | return -1;
|
3143 | };
|
3144 | return MDCChipSet;
|
3145 | }(component_1.MDCComponent);
|
3146 | exports.MDCChipSet = MDCChipSet;
|
3147 |
|
3148 | }),
|
3149 |
|
3150 | "./packages/mdc-chips/deprecated/chip-set/constants.ts":
|
3151 |
|
3152 |
|
3153 |
|
3154 |
|
3155 | (function(module, exports, __webpack_require__) {
|
3156 |
|
3157 | "use strict";
|
3158 |
|
3159 |
|
3160 |
|
3161 |
|
3162 |
|
3163 |
|
3164 |
|
3165 |
|
3166 |
|
3167 |
|
3168 |
|
3169 |
|
3170 |
|
3171 |
|
3172 |
|
3173 |
|
3174 |
|
3175 |
|
3176 |
|
3177 |
|
3178 |
|
3179 |
|
3180 |
|
3181 |
|
3182 | Object.defineProperty(exports, "__esModule", { value: true });
|
3183 | exports.cssClasses = exports.strings = void 0;
|
3184 | exports.strings = {
|
3185 | CHIP_SELECTOR: '.mdc-chip'
|
3186 | };
|
3187 | exports.cssClasses = {
|
3188 | CHOICE: 'mdc-chip-set--choice',
|
3189 | FILTER: 'mdc-chip-set--filter'
|
3190 | };
|
3191 |
|
3192 | }),
|
3193 |
|
3194 | "./packages/mdc-chips/deprecated/chip-set/foundation.ts":
|
3195 |
|
3196 |
|
3197 |
|
3198 |
|
3199 | (function(module, exports, __webpack_require__) {
|
3200 |
|
3201 | "use strict";
|
3202 |
|
3203 |
|
3204 |
|
3205 |
|
3206 |
|
3207 |
|
3208 |
|
3209 |
|
3210 |
|
3211 |
|
3212 |
|
3213 |
|
3214 |
|
3215 |
|
3216 |
|
3217 |
|
3218 |
|
3219 |
|
3220 |
|
3221 |
|
3222 |
|
3223 |
|
3224 |
|
3225 |
|
3226 | var __extends = this && this.__extends || function () {
|
3227 | var _extendStatics = function extendStatics(d, b) {
|
3228 | _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
|
3229 | d.__proto__ = b;
|
3230 | } || function (d, b) {
|
3231 | for (var p in b) {
|
3232 | if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
3233 | }
|
3234 | };
|
3235 | return _extendStatics(d, b);
|
3236 | };
|
3237 | return function (d, b) {
|
3238 | if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
3239 | _extendStatics(d, b);
|
3240 | function __() {
|
3241 | this.constructor = d;
|
3242 | }
|
3243 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
3244 | };
|
3245 | }();
|
3246 | var __assign = this && this.__assign || function () {
|
3247 | __assign = Object.assign || function (t) {
|
3248 | for (var s, i = 1, n = arguments.length; i < n; i++) {
|
3249 | s = arguments[i];
|
3250 | for (var p in s) {
|
3251 | if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
3252 | }
|
3253 | }
|
3254 | return t;
|
3255 | };
|
3256 | return __assign.apply(this, arguments);
|
3257 | };
|
3258 | Object.defineProperty(exports, "__esModule", { value: true });
|
3259 | exports.MDCChipSetFoundation = void 0;
|
3260 | var foundation_1 = __webpack_require__( "./packages/mdc-base/foundation.ts");
|
3261 | var constants_1 = __webpack_require__( "./packages/mdc-chips/deprecated/chip/constants.ts");
|
3262 | var constants_2 = __webpack_require__( "./packages/mdc-chips/deprecated/chip-set/constants.ts");
|
3263 | var MDCChipSetFoundation = function (_super) {
|
3264 | __extends(MDCChipSetFoundation, _super);
|
3265 | function MDCChipSetFoundation(adapter) {
|
3266 | var _this = _super.call(this, __assign(__assign({}, MDCChipSetFoundation.defaultAdapter), adapter)) || this;
|
3267 | |
3268 |
|
3269 |
|
3270 | _this.selectedChipIds = [];
|
3271 | return _this;
|
3272 | }
|
3273 | Object.defineProperty(MDCChipSetFoundation, "strings", {
|
3274 | get: function get() {
|
3275 | return constants_2.strings;
|
3276 | },
|
3277 | enumerable: false,
|
3278 | configurable: true
|
3279 | });
|
3280 | Object.defineProperty(MDCChipSetFoundation, "cssClasses", {
|
3281 | get: function get() {
|
3282 | return constants_2.cssClasses;
|
3283 | },
|
3284 | enumerable: false,
|
3285 | configurable: true
|
3286 | });
|
3287 | Object.defineProperty(MDCChipSetFoundation, "defaultAdapter", {
|
3288 | get: function get() {
|
3289 | return {
|
3290 | announceMessage: function announceMessage() {
|
3291 | return undefined;
|
3292 | },
|
3293 | focusChipPrimaryActionAtIndex: function focusChipPrimaryActionAtIndex() {
|
3294 | return undefined;
|
3295 | },
|
3296 | focusChipTrailingActionAtIndex: function focusChipTrailingActionAtIndex() {
|
3297 | return undefined;
|
3298 | },
|
3299 | getChipListCount: function getChipListCount() {
|
3300 | return -1;
|
3301 | },
|
3302 | getIndexOfChipById: function getIndexOfChipById() {
|
3303 | return -1;
|
3304 | },
|
3305 | hasClass: function hasClass() {
|
3306 | return false;
|
3307 | },
|
3308 | isRTL: function isRTL() {
|
3309 | return false;
|
3310 | },
|
3311 | removeChipAtIndex: function removeChipAtIndex() {
|
3312 | return undefined;
|
3313 | },
|
3314 | removeFocusFromChipAtIndex: function removeFocusFromChipAtIndex() {
|
3315 | return undefined;
|
3316 | },
|
3317 | selectChipAtIndex: function selectChipAtIndex() {
|
3318 | return undefined;
|
3319 | }
|
3320 | };
|
3321 | },
|
3322 | enumerable: false,
|
3323 | configurable: true
|
3324 | });
|
3325 | |
3326 |
|
3327 |
|
3328 | MDCChipSetFoundation.prototype.getSelectedChipIds = function () {
|
3329 | return this.selectedChipIds.slice();
|
3330 | };
|
3331 | |
3332 |
|
3333 |
|
3334 |
|
3335 | MDCChipSetFoundation.prototype.select = function (chipId) {
|
3336 | this.selectImpl(chipId, false);
|
3337 | };
|
3338 | |
3339 |
|
3340 |
|
3341 | MDCChipSetFoundation.prototype.handleChipInteraction = function (_a) {
|
3342 | var chipId = _a.chipId;
|
3343 | var index = this.adapter.getIndexOfChipById(chipId);
|
3344 | this.removeFocusFromChipsExcept(index);
|
3345 | if (this.adapter.hasClass(constants_2.cssClasses.CHOICE) || this.adapter.hasClass(constants_2.cssClasses.FILTER)) {
|
3346 | this.toggleSelect(chipId);
|
3347 | }
|
3348 | };
|
3349 | |
3350 |
|
3351 |
|
3352 | MDCChipSetFoundation.prototype.handleChipSelection = function (_a) {
|
3353 | var chipId = _a.chipId,
|
3354 | selected = _a.selected,
|
3355 | shouldIgnore = _a.shouldIgnore;
|
3356 |
|
3357 | if (shouldIgnore) {
|
3358 | return;
|
3359 | }
|
3360 | var chipIsSelected = this.selectedChipIds.indexOf(chipId) >= 0;
|
3361 | if (selected && !chipIsSelected) {
|
3362 | this.select(chipId);
|
3363 | } else if (!selected && chipIsSelected) {
|
3364 | this.deselectImpl(chipId);
|
3365 | }
|
3366 | };
|
3367 | |
3368 |
|
3369 |
|
3370 | MDCChipSetFoundation.prototype.handleChipRemoval = function (_a) {
|
3371 | var chipId = _a.chipId,
|
3372 | removedAnnouncement = _a.removedAnnouncement;
|
3373 | if (removedAnnouncement) {
|
3374 | this.adapter.announceMessage(removedAnnouncement);
|
3375 | }
|
3376 | var index = this.adapter.getIndexOfChipById(chipId);
|
3377 | this.deselectAndNotifyClients(chipId);
|
3378 | this.adapter.removeChipAtIndex(index);
|
3379 | var maxIndex = this.adapter.getChipListCount() - 1;
|
3380 | if (maxIndex < 0) {
|
3381 | return;
|
3382 | }
|
3383 | var nextIndex = Math.min(index, maxIndex);
|
3384 | this.removeFocusFromChipsExcept(nextIndex);
|
3385 |
|
3386 | this.adapter.focusChipTrailingActionAtIndex(nextIndex);
|
3387 | };
|
3388 | |
3389 |
|
3390 |
|
3391 | MDCChipSetFoundation.prototype.handleChipNavigation = function (_a) {
|
3392 | var chipId = _a.chipId,
|
3393 | key = _a.key,
|
3394 | source = _a.source;
|
3395 | var maxIndex = this.adapter.getChipListCount() - 1;
|
3396 | var index = this.adapter.getIndexOfChipById(chipId);
|
3397 |
|
3398 | if (index === -1 || !constants_1.navigationKeys.has(key)) {
|
3399 | return;
|
3400 | }
|
3401 | var isRTL = this.adapter.isRTL();
|
3402 | var isLeftKey = key === constants_1.strings.ARROW_LEFT_KEY || key === constants_1.strings.IE_ARROW_LEFT_KEY;
|
3403 | var isRightKey = key === constants_1.strings.ARROW_RIGHT_KEY || key === constants_1.strings.IE_ARROW_RIGHT_KEY;
|
3404 | var isDownKey = key === constants_1.strings.ARROW_DOWN_KEY || key === constants_1.strings.IE_ARROW_DOWN_KEY;
|
3405 | var shouldIncrement = !isRTL && isRightKey || isRTL && isLeftKey || isDownKey;
|
3406 | var isHome = key === constants_1.strings.HOME_KEY;
|
3407 | var isEnd = key === constants_1.strings.END_KEY;
|
3408 | if (shouldIncrement) {
|
3409 | index++;
|
3410 | } else if (isHome) {
|
3411 | index = 0;
|
3412 | } else if (isEnd) {
|
3413 | index = maxIndex;
|
3414 | } else {
|
3415 | index--;
|
3416 | }
|
3417 |
|
3418 | if (index < 0 || index > maxIndex) {
|
3419 | return;
|
3420 | }
|
3421 | this.removeFocusFromChipsExcept(index);
|
3422 | this.focusChipAction(index, key, source);
|
3423 | };
|
3424 | MDCChipSetFoundation.prototype.focusChipAction = function (index, key, source) {
|
3425 | var shouldJumpChips = constants_1.jumpChipKeys.has(key);
|
3426 | if (shouldJumpChips && source === constants_1.EventSource.PRIMARY) {
|
3427 | return this.adapter.focusChipPrimaryActionAtIndex(index);
|
3428 | }
|
3429 | if (shouldJumpChips && source === constants_1.EventSource.TRAILING) {
|
3430 | return this.adapter.focusChipTrailingActionAtIndex(index);
|
3431 | }
|
3432 | var dir = this.getDirection(key);
|
3433 | if (dir === constants_1.Direction.LEFT) {
|
3434 | return this.adapter.focusChipTrailingActionAtIndex(index);
|
3435 | }
|
3436 | if (dir === constants_1.Direction.RIGHT) {
|
3437 | return this.adapter.focusChipPrimaryActionAtIndex(index);
|
3438 | }
|
3439 | };
|
3440 | MDCChipSetFoundation.prototype.getDirection = function (key) {
|
3441 | var isRTL = this.adapter.isRTL();
|
3442 | var isLeftKey = key === constants_1.strings.ARROW_LEFT_KEY || key === constants_1.strings.IE_ARROW_LEFT_KEY;
|
3443 | var isRightKey = key === constants_1.strings.ARROW_RIGHT_KEY || key === constants_1.strings.IE_ARROW_RIGHT_KEY;
|
3444 | if (!isRTL && isLeftKey || isRTL && isRightKey) {
|
3445 | return constants_1.Direction.LEFT;
|
3446 | }
|
3447 | return constants_1.Direction.RIGHT;
|
3448 | };
|
3449 | |
3450 |
|
3451 |
|
3452 | MDCChipSetFoundation.prototype.deselectImpl = function (chipId, shouldNotifyClients) {
|
3453 | if (shouldNotifyClients === void 0) {
|
3454 | shouldNotifyClients = false;
|
3455 | }
|
3456 | var index = this.selectedChipIds.indexOf(chipId);
|
3457 | if (index >= 0) {
|
3458 | this.selectedChipIds.splice(index, 1);
|
3459 | var chipIndex = this.adapter.getIndexOfChipById(chipId);
|
3460 | this.adapter.selectChipAtIndex(chipIndex, false, shouldNotifyClients);
|
3461 | }
|
3462 | };
|
3463 | |
3464 |
|
3465 |
|
3466 | MDCChipSetFoundation.prototype.deselectAndNotifyClients = function (chipId) {
|
3467 | this.deselectImpl(chipId, true);
|
3468 | };
|
3469 | |
3470 |
|
3471 |
|
3472 | MDCChipSetFoundation.prototype.toggleSelect = function (chipId) {
|
3473 | if (this.selectedChipIds.indexOf(chipId) >= 0) {
|
3474 | this.deselectAndNotifyClients(chipId);
|
3475 | } else {
|
3476 | this.selectAndNotifyClients(chipId);
|
3477 | }
|
3478 | };
|
3479 | MDCChipSetFoundation.prototype.removeFocusFromChipsExcept = function (index) {
|
3480 | var chipCount = this.adapter.getChipListCount();
|
3481 | for (var i = 0; i < chipCount; i++) {
|
3482 | if (i !== index) {
|
3483 | this.adapter.removeFocusFromChipAtIndex(i);
|
3484 | }
|
3485 | }
|
3486 | };
|
3487 | MDCChipSetFoundation.prototype.selectAndNotifyClients = function (chipId) {
|
3488 | this.selectImpl(chipId, true);
|
3489 | };
|
3490 | MDCChipSetFoundation.prototype.selectImpl = function (chipId, shouldNotifyClients) {
|
3491 | if (this.selectedChipIds.indexOf(chipId) >= 0) {
|
3492 | return;
|
3493 | }
|
3494 | if (this.adapter.hasClass(constants_2.cssClasses.CHOICE) && this.selectedChipIds.length > 0) {
|
3495 | var previouslySelectedChip = this.selectedChipIds[0];
|
3496 | var previouslySelectedIndex = this.adapter.getIndexOfChipById(previouslySelectedChip);
|
3497 | this.selectedChipIds = [];
|
3498 | this.adapter.selectChipAtIndex(previouslySelectedIndex, false, shouldNotifyClients);
|
3499 | }
|
3500 | this.selectedChipIds.push(chipId);
|
3501 | var index = this.adapter.getIndexOfChipById(chipId);
|
3502 | this.adapter.selectChipAtIndex(index, true, shouldNotifyClients);
|
3503 | };
|
3504 | return MDCChipSetFoundation;
|
3505 | }(foundation_1.MDCFoundation);
|
3506 | exports.MDCChipSetFoundation = MDCChipSetFoundation;
|
3507 |
|
3508 | exports.default = MDCChipSetFoundation;
|
3509 |
|
3510 | }),
|
3511 |
|
3512 | "./packages/mdc-chips/deprecated/chip-set/index.ts":
|
3513 |
|
3514 |
|
3515 |
|
3516 |
|
3517 | (function(module, exports, __webpack_require__) {
|
3518 |
|
3519 | "use strict";
|
3520 |
|
3521 |
|
3522 |
|
3523 |
|
3524 |
|
3525 |
|
3526 |
|
3527 |
|
3528 |
|
3529 |
|
3530 |
|
3531 |
|
3532 |
|
3533 |
|
3534 |
|
3535 |
|
3536 |
|
3537 |
|
3538 |
|
3539 |
|
3540 |
|
3541 |
|
3542 |
|
3543 |
|
3544 | var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
|
3545 | if (k2 === undefined) k2 = k;
|
3546 | Object.defineProperty(o, k2, { enumerable: true, get: function get() {
|
3547 | return m[k];
|
3548 | } });
|
3549 | } : function (o, m, k, k2) {
|
3550 | if (k2 === undefined) k2 = k;
|
3551 | o[k2] = m[k];
|
3552 | });
|
3553 | var __exportStar = this && this.__exportStar || function (m, exports) {
|
3554 | for (var p in m) {
|
3555 | if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
3556 | }
|
3557 | };
|
3558 | Object.defineProperty(exports, "__esModule", { value: true });
|
3559 | exports.chipSetStrings = exports.chipSetCssClasses = void 0;
|
3560 | __exportStar(__webpack_require__( "./packages/mdc-chips/deprecated/chip-set/adapter.ts"), exports);
|
3561 | __exportStar(__webpack_require__( "./packages/mdc-chips/deprecated/chip-set/component.ts"), exports);
|
3562 | __exportStar(__webpack_require__( "./packages/mdc-chips/deprecated/chip-set/foundation.ts"), exports);
|
3563 | var constants_1 = __webpack_require__( "./packages/mdc-chips/deprecated/chip-set/constants.ts");
|
3564 | Object.defineProperty(exports, "chipSetCssClasses", { enumerable: true, get: function get() {
|
3565 | return constants_1.cssClasses;
|
3566 | } });
|
3567 | Object.defineProperty(exports, "chipSetStrings", { enumerable: true, get: function get() {
|
3568 | return constants_1.strings;
|
3569 | } });
|
3570 |
|
3571 | }),
|
3572 |
|
3573 | "./packages/mdc-chips/deprecated/chip/adapter.ts":
|
3574 |
|
3575 |
|
3576 |
|
3577 |
|
3578 | (function(module, exports, __webpack_require__) {
|
3579 |
|
3580 | "use strict";
|
3581 |
|
3582 |
|
3583 |
|
3584 |
|
3585 |
|
3586 |
|
3587 |
|
3588 |
|
3589 |
|
3590 |
|
3591 |
|
3592 |
|
3593 |
|
3594 |
|
3595 |
|
3596 |
|
3597 |
|
3598 |
|
3599 |
|
3600 |
|
3601 |
|
3602 |
|
3603 |
|
3604 |
|
3605 | Object.defineProperty(exports, "__esModule", { value: true });
|
3606 |
|
3607 | }),
|
3608 |
|
3609 | "./packages/mdc-chips/deprecated/chip/component.ts":
|
3610 |
|
3611 |
|
3612 |
|
3613 |
|
3614 | (function(module, exports, __webpack_require__) {
|
3615 |
|
3616 | "use strict";
|
3617 |
|
3618 |
|
3619 |
|
3620 |
|
3621 |
|
3622 |
|
3623 |
|
3624 |
|
3625 |
|
3626 |
|
3627 |
|
3628 |
|
3629 |
|
3630 |
|
3631 |
|
3632 |
|
3633 |
|
3634 |
|
3635 |
|
3636 |
|
3637 |
|
3638 |
|
3639 |
|
3640 |
|
3641 | var __extends = this && this.__extends || function () {
|
3642 | var _extendStatics = function extendStatics(d, b) {
|
3643 | _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
|
3644 | d.__proto__ = b;
|
3645 | } || function (d, b) {
|
3646 | for (var p in b) {
|
3647 | if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
3648 | }
|
3649 | };
|
3650 | return _extendStatics(d, b);
|
3651 | };
|
3652 | return function (d, b) {
|
3653 | if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
3654 | _extendStatics(d, b);
|
3655 | function __() {
|
3656 | this.constructor = d;
|
3657 | }
|
3658 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
3659 | };
|
3660 | }();
|
3661 | var __assign = this && this.__assign || function () {
|
3662 | __assign = Object.assign || function (t) {
|
3663 | for (var s, i = 1, n = arguments.length; i < n; i++) {
|
3664 | s = arguments[i];
|
3665 | for (var p in s) {
|
3666 | if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
3667 | }
|
3668 | }
|
3669 | return t;
|
3670 | };
|
3671 | return __assign.apply(this, arguments);
|
3672 | };
|
3673 | Object.defineProperty(exports, "__esModule", { value: true });
|
3674 | exports.MDCChip = void 0;
|
3675 | var component_1 = __webpack_require__( "./packages/mdc-base/component.ts");
|
3676 | var component_2 = __webpack_require__( "./packages/mdc-ripple/component.ts");
|
3677 | var foundation_1 = __webpack_require__( "./packages/mdc-ripple/foundation.ts");
|
3678 | var component_3 = __webpack_require__( "./packages/mdc-chips/deprecated/trailingaction/component.ts");
|
3679 | var constants_1 = __webpack_require__( "./packages/mdc-chips/deprecated/trailingaction/constants.ts");
|
3680 | var constants_2 = __webpack_require__( "./packages/mdc-chips/deprecated/chip/constants.ts");
|
3681 | var foundation_2 = __webpack_require__( "./packages/mdc-chips/deprecated/chip/foundation.ts");
|
3682 | var MDCChip = function (_super) {
|
3683 | __extends(MDCChip, _super);
|
3684 | function MDCChip() {
|
3685 | return _super !== null && _super.apply(this, arguments) || this;
|
3686 | }
|
3687 | Object.defineProperty(MDCChip.prototype, "selected", {
|
3688 | |
3689 |
|
3690 |
|
3691 | get: function get() {
|
3692 | return this.foundation.isSelected();
|
3693 | },
|
3694 | |
3695 |
|
3696 |
|
3697 | set: function set(selected) {
|
3698 | this.foundation.setSelected(selected);
|
3699 | },
|
3700 | enumerable: false,
|
3701 | configurable: true
|
3702 | });
|
3703 | Object.defineProperty(MDCChip.prototype, "shouldRemoveOnTrailingIconClick", {
|
3704 | |
3705 |
|
3706 |
|
3707 | get: function get() {
|
3708 | return this.foundation.getShouldRemoveOnTrailingIconClick();
|
3709 | },
|
3710 | |
3711 |
|
3712 |
|
3713 | set: function set(shouldRemove) {
|
3714 | this.foundation.setShouldRemoveOnTrailingIconClick(shouldRemove);
|
3715 | },
|
3716 | enumerable: false,
|
3717 | configurable: true
|
3718 | });
|
3719 | Object.defineProperty(MDCChip.prototype, "setShouldFocusPrimaryActionOnClick", {
|
3720 | |
3721 |
|
3722 |
|
3723 | set: function set(shouldFocus) {
|
3724 | this.foundation.setShouldFocusPrimaryActionOnClick(shouldFocus);
|
3725 | },
|
3726 | enumerable: false,
|
3727 | configurable: true
|
3728 | });
|
3729 | Object.defineProperty(MDCChip.prototype, "ripple", {
|
3730 | get: function get() {
|
3731 | return this.rippleSurface;
|
3732 | },
|
3733 | enumerable: false,
|
3734 | configurable: true
|
3735 | });
|
3736 | Object.defineProperty(MDCChip.prototype, "id", {
|
3737 | get: function get() {
|
3738 | return this.root.id;
|
3739 | },
|
3740 | enumerable: false,
|
3741 | configurable: true
|
3742 | });
|
3743 | MDCChip.attachTo = function (root) {
|
3744 | return new MDCChip(root);
|
3745 | };
|
3746 | MDCChip.prototype.initialize = function (rippleFactory, trailingActionFactory) {
|
3747 | var _this = this;
|
3748 | if (rippleFactory === void 0) {
|
3749 | rippleFactory = function rippleFactory(el, foundation) {
|
3750 | return new component_2.MDCRipple(el, foundation);
|
3751 | };
|
3752 | }
|
3753 | if (trailingActionFactory === void 0) {
|
3754 | trailingActionFactory = function trailingActionFactory(el) {
|
3755 | return new component_3.MDCChipTrailingAction(el);
|
3756 | };
|
3757 | }
|
3758 | this.leadingIcon = this.root.querySelector(constants_2.strings.LEADING_ICON_SELECTOR);
|
3759 | this.checkmark = this.root.querySelector(constants_2.strings.CHECKMARK_SELECTOR);
|
3760 | this.primaryAction = this.root.querySelector(constants_2.strings.PRIMARY_ACTION_SELECTOR);
|
3761 | var trailingActionEl = this.root.querySelector(constants_2.strings.TRAILING_ACTION_SELECTOR);
|
3762 | if (trailingActionEl) {
|
3763 | this.trailingAction = trailingActionFactory(trailingActionEl);
|
3764 | }
|
3765 |
|
3766 |
|
3767 | var rippleAdapter = __assign(__assign({}, component_2.MDCRipple.createAdapter(this)), { computeBoundingRect: function computeBoundingRect() {
|
3768 | return _this.foundation.getDimensions();
|
3769 | } });
|
3770 | this.rippleSurface = rippleFactory(this.root, new foundation_1.MDCRippleFoundation(rippleAdapter));
|
3771 | };
|
3772 | MDCChip.prototype.initialSyncWithDOM = function () {
|
3773 | var _this = this;
|
3774 |
|
3775 | this.handleTrailingActionInteraction = function () {
|
3776 | _this.foundation.handleTrailingActionInteraction();
|
3777 | };
|
3778 | this.handleTrailingActionNavigation = function (evt) {
|
3779 | _this.foundation.handleTrailingActionNavigation(evt);
|
3780 | };
|
3781 |
|
3782 | this.handleClick = function () {
|
3783 | _this.foundation.handleClick();
|
3784 | };
|
3785 | this.handleKeydown = function (evt) {
|
3786 | _this.foundation.handleKeydown(evt);
|
3787 | };
|
3788 | this.handleTransitionEnd = function (evt) {
|
3789 | _this.foundation.handleTransitionEnd(evt);
|
3790 | };
|
3791 | this.handleFocusIn = function (evt) {
|
3792 | _this.foundation.handleFocusIn(evt);
|
3793 | };
|
3794 | this.handleFocusOut = function (evt) {
|
3795 | _this.foundation.handleFocusOut(evt);
|
3796 | };
|
3797 | this.listen('transitionend', this.handleTransitionEnd);
|
3798 | this.listen('click', this.handleClick);
|
3799 | this.listen('keydown', this.handleKeydown);
|
3800 | this.listen('focusin', this.handleFocusIn);
|
3801 | this.listen('focusout', this.handleFocusOut);
|
3802 | if (this.trailingAction) {
|
3803 | this.listen(constants_1.strings.INTERACTION_EVENT, this.handleTrailingActionInteraction);
|
3804 | this.listen(constants_1.strings.NAVIGATION_EVENT, this.handleTrailingActionNavigation);
|
3805 | }
|
3806 | };
|
3807 | MDCChip.prototype.destroy = function () {
|
3808 | this.rippleSurface.destroy();
|
3809 | this.unlisten('transitionend', this.handleTransitionEnd);
|
3810 | this.unlisten('keydown', this.handleKeydown);
|
3811 | this.unlisten('click', this.handleClick);
|
3812 | this.unlisten('focusin', this.handleFocusIn);
|
3813 | this.unlisten('focusout', this.handleFocusOut);
|
3814 | if (this.trailingAction) {
|
3815 | this.unlisten(constants_1.strings.INTERACTION_EVENT, this.handleTrailingActionInteraction);
|
3816 | this.unlisten(constants_1.strings.NAVIGATION_EVENT, this.handleTrailingActionNavigation);
|
3817 | }
|
3818 | _super.prototype.destroy.call(this);
|
3819 | };
|
3820 | |
3821 |
|
3822 |
|
3823 | MDCChip.prototype.beginExit = function () {
|
3824 | this.foundation.beginExit();
|
3825 | };
|
3826 | MDCChip.prototype.getDefaultFoundation = function () {
|
3827 | var _this = this;
|
3828 |
|
3829 |
|
3830 | var adapter = {
|
3831 | addClass: function addClass(className) {
|
3832 | return _this.root.classList.add(className);
|
3833 | },
|
3834 | addClassToLeadingIcon: function addClassToLeadingIcon(className) {
|
3835 | if (_this.leadingIcon) {
|
3836 | _this.leadingIcon.classList.add(className);
|
3837 | }
|
3838 | },
|
3839 | eventTargetHasClass: function eventTargetHasClass(target, className) {
|
3840 | return target ? target.classList.contains(className) : false;
|
3841 | },
|
3842 | focusPrimaryAction: function focusPrimaryAction() {
|
3843 | if (_this.primaryAction) {
|
3844 | _this.primaryAction.focus();
|
3845 | }
|
3846 | },
|
3847 | focusTrailingAction: function focusTrailingAction() {
|
3848 | if (_this.trailingAction) {
|
3849 | _this.trailingAction.focus();
|
3850 | }
|
3851 | },
|
3852 | getAttribute: function getAttribute(attr) {
|
3853 | return _this.root.getAttribute(attr);
|
3854 | },
|
3855 | getCheckmarkBoundingClientRect: function getCheckmarkBoundingClientRect() {
|
3856 | return _this.checkmark ? _this.checkmark.getBoundingClientRect() : null;
|
3857 | },
|
3858 | getComputedStyleValue: function getComputedStyleValue(propertyName) {
|
3859 | return window.getComputedStyle(_this.root).getPropertyValue(propertyName);
|
3860 | },
|
3861 | getRootBoundingClientRect: function getRootBoundingClientRect() {
|
3862 | return _this.root.getBoundingClientRect();
|
3863 | },
|
3864 | hasClass: function hasClass(className) {
|
3865 | return _this.root.classList.contains(className);
|
3866 | },
|
3867 | hasLeadingIcon: function hasLeadingIcon() {
|
3868 | return !!_this.leadingIcon;
|
3869 | },
|
3870 | isRTL: function isRTL() {
|
3871 | return window.getComputedStyle(_this.root).getPropertyValue('direction') === 'rtl';
|
3872 | },
|
3873 | isTrailingActionNavigable: function isTrailingActionNavigable() {
|
3874 | if (_this.trailingAction) {
|
3875 | return _this.trailingAction.isNavigable();
|
3876 | }
|
3877 | return false;
|
3878 | },
|
3879 | notifyInteraction: function notifyInteraction() {
|
3880 | return _this.emit(constants_2.strings.INTERACTION_EVENT, { chipId: _this.id }, true );
|
3881 | },
|
3882 | notifyNavigation: function notifyNavigation(key, source) {
|
3883 | return _this.emit(constants_2.strings.NAVIGATION_EVENT, { chipId: _this.id, key: key, source: source }, true );
|
3884 | },
|
3885 | notifyRemoval: function notifyRemoval(removedAnnouncement) {
|
3886 | _this.emit(constants_2.strings.REMOVAL_EVENT, { chipId: _this.id, removedAnnouncement: removedAnnouncement }, true );
|
3887 | },
|
3888 | notifySelection: function notifySelection(selected, shouldIgnore) {
|
3889 | return _this.emit(constants_2.strings.SELECTION_EVENT, { chipId: _this.id, selected: selected, shouldIgnore: shouldIgnore }, true );
|
3890 | },
|
3891 | notifyTrailingIconInteraction: function notifyTrailingIconInteraction() {
|
3892 | return _this.emit(constants_2.strings.TRAILING_ICON_INTERACTION_EVENT, { chipId: _this.id }, true );
|
3893 | },
|
3894 | notifyEditStart: function notifyEditStart() {},
|
3895 | notifyEditFinish: function notifyEditFinish() {},
|
3896 | removeClass: function removeClass(className) {
|
3897 | return _this.root.classList.remove(className);
|
3898 | },
|
3899 | removeClassFromLeadingIcon: function removeClassFromLeadingIcon(className) {
|
3900 | if (_this.leadingIcon) {
|
3901 | _this.leadingIcon.classList.remove(className);
|
3902 | }
|
3903 | },
|
3904 | removeTrailingActionFocus: function removeTrailingActionFocus() {
|
3905 | if (_this.trailingAction) {
|
3906 | _this.trailingAction.removeFocus();
|
3907 | }
|
3908 | },
|
3909 | setPrimaryActionAttr: function setPrimaryActionAttr(attr, value) {
|
3910 | if (_this.primaryAction) {
|
3911 | _this.primaryAction.setAttribute(attr, value);
|
3912 | }
|
3913 | },
|
3914 | setStyleProperty: function setStyleProperty(propertyName, value) {
|
3915 | return _this.root.style.setProperty(propertyName, value);
|
3916 | }
|
3917 | };
|
3918 | return new foundation_2.MDCChipFoundation(adapter);
|
3919 | };
|
3920 | MDCChip.prototype.setSelectedFromChipSet = function (selected, shouldNotifyClients) {
|
3921 | this.foundation.setSelectedFromChipSet(selected, shouldNotifyClients);
|
3922 | };
|
3923 | MDCChip.prototype.focusPrimaryAction = function () {
|
3924 | this.foundation.focusPrimaryAction();
|
3925 | };
|
3926 | MDCChip.prototype.focusTrailingAction = function () {
|
3927 | this.foundation.focusTrailingAction();
|
3928 | };
|
3929 | MDCChip.prototype.removeFocus = function () {
|
3930 | this.foundation.removeFocus();
|
3931 | };
|
3932 | MDCChip.prototype.remove = function () {
|
3933 | var parent = this.root.parentNode;
|
3934 | if (parent !== null) {
|
3935 | parent.removeChild(this.root);
|
3936 | }
|
3937 | };
|
3938 | return MDCChip;
|
3939 | }(component_1.MDCComponent);
|
3940 | exports.MDCChip = MDCChip;
|
3941 |
|
3942 | }),
|
3943 |
|
3944 | "./packages/mdc-chips/deprecated/chip/constants.ts":
|
3945 |
|
3946 |
|
3947 |
|
3948 |
|
3949 | (function(module, exports, __webpack_require__) {
|
3950 |
|
3951 | "use strict";
|
3952 |
|
3953 |
|
3954 |
|
3955 |
|
3956 |
|
3957 |
|
3958 |
|
3959 |
|
3960 |
|
3961 |
|
3962 |
|
3963 |
|
3964 |
|
3965 |
|
3966 |
|
3967 |
|
3968 |
|
3969 |
|
3970 |
|
3971 |
|
3972 |
|
3973 |
|
3974 |
|
3975 |
|
3976 | Object.defineProperty(exports, "__esModule", { value: true });
|
3977 | exports.jumpChipKeys = exports.navigationKeys = exports.cssClasses = exports.strings = exports.EventSource = exports.Direction = void 0;
|
3978 | var Direction;
|
3979 | (function (Direction) {
|
3980 | Direction["LEFT"] = "left";
|
3981 | Direction["RIGHT"] = "right";
|
3982 | })(Direction = exports.Direction || (exports.Direction = {}));
|
3983 | var EventSource;
|
3984 | (function (EventSource) {
|
3985 | EventSource["PRIMARY"] = "primary";
|
3986 | EventSource["TRAILING"] = "trailing";
|
3987 | EventSource["NONE"] = "none";
|
3988 | })(EventSource = exports.EventSource || (exports.EventSource = {}));
|
3989 | exports.strings = {
|
3990 | ADDED_ANNOUNCEMENT_ATTRIBUTE: 'data-mdc-chip-added-announcement',
|
3991 | ARIA_CHECKED: 'aria-checked',
|
3992 | ARROW_DOWN_KEY: 'ArrowDown',
|
3993 | ARROW_LEFT_KEY: 'ArrowLeft',
|
3994 | ARROW_RIGHT_KEY: 'ArrowRight',
|
3995 | ARROW_UP_KEY: 'ArrowUp',
|
3996 | BACKSPACE_KEY: 'Backspace',
|
3997 | CHECKMARK_SELECTOR: '.mdc-chip__checkmark',
|
3998 | DELETE_KEY: 'Delete',
|
3999 | END_KEY: 'End',
|
4000 | ENTER_KEY: 'Enter',
|
4001 | ENTRY_ANIMATION_NAME: 'mdc-chip-entry',
|
4002 | HOME_KEY: 'Home',
|
4003 | IE_ARROW_DOWN_KEY: 'Down',
|
4004 | IE_ARROW_LEFT_KEY: 'Left',
|
4005 | IE_ARROW_RIGHT_KEY: 'Right',
|
4006 | IE_ARROW_UP_KEY: 'Up',
|
4007 | IE_DELETE_KEY: 'Del',
|
4008 | INTERACTION_EVENT: 'MDCChip:interaction',
|
4009 | LEADING_ICON_SELECTOR: '.mdc-chip__icon--leading',
|
4010 | NAVIGATION_EVENT: 'MDCChip:navigation',
|
4011 | PRIMARY_ACTION_SELECTOR: '.mdc-chip__primary-action',
|
4012 | REMOVED_ANNOUNCEMENT_ATTRIBUTE: 'data-mdc-chip-removed-announcement',
|
4013 | REMOVAL_EVENT: 'MDCChip:removal',
|
4014 | SELECTION_EVENT: 'MDCChip:selection',
|
4015 | SPACEBAR_KEY: ' ',
|
4016 | TAB_INDEX: 'tabindex',
|
4017 | TRAILING_ACTION_SELECTOR: '.mdc-chip-trailing-action',
|
4018 | TRAILING_ICON_INTERACTION_EVENT: 'MDCChip:trailingIconInteraction',
|
4019 | TRAILING_ICON_SELECTOR: '.mdc-chip__icon--trailing'
|
4020 | };
|
4021 | exports.cssClasses = {
|
4022 | CHECKMARK: 'mdc-chip__checkmark',
|
4023 | CHIP_EXIT: 'mdc-chip--exit',
|
4024 | DELETABLE: 'mdc-chip--deletable',
|
4025 | EDITABLE: 'mdc-chip--editable',
|
4026 | EDITING: 'mdc-chip--editing',
|
4027 | HIDDEN_LEADING_ICON: 'mdc-chip__icon--leading-hidden',
|
4028 | LEADING_ICON: 'mdc-chip__icon--leading',
|
4029 | PRIMARY_ACTION: 'mdc-chip__primary-action',
|
4030 | PRIMARY_ACTION_FOCUSED: 'mdc-chip--primary-action-focused',
|
4031 | SELECTED: 'mdc-chip--selected',
|
4032 | TEXT: 'mdc-chip__text',
|
4033 | TRAILING_ACTION: 'mdc-chip__trailing-action',
|
4034 | TRAILING_ICON: 'mdc-chip__icon--trailing'
|
4035 | };
|
4036 | exports.navigationKeys = new Set();
|
4037 |
|
4038 | exports.navigationKeys.add(exports.strings.ARROW_LEFT_KEY);
|
4039 | exports.navigationKeys.add(exports.strings.ARROW_RIGHT_KEY);
|
4040 | exports.navigationKeys.add(exports.strings.ARROW_DOWN_KEY);
|
4041 | exports.navigationKeys.add(exports.strings.ARROW_UP_KEY);
|
4042 | exports.navigationKeys.add(exports.strings.END_KEY);
|
4043 | exports.navigationKeys.add(exports.strings.HOME_KEY);
|
4044 | exports.navigationKeys.add(exports.strings.IE_ARROW_LEFT_KEY);
|
4045 | exports.navigationKeys.add(exports.strings.IE_ARROW_RIGHT_KEY);
|
4046 | exports.navigationKeys.add(exports.strings.IE_ARROW_DOWN_KEY);
|
4047 | exports.navigationKeys.add(exports.strings.IE_ARROW_UP_KEY);
|
4048 | exports.jumpChipKeys = new Set();
|
4049 |
|
4050 | exports.jumpChipKeys.add(exports.strings.ARROW_UP_KEY);
|
4051 | exports.jumpChipKeys.add(exports.strings.ARROW_DOWN_KEY);
|
4052 | exports.jumpChipKeys.add(exports.strings.HOME_KEY);
|
4053 | exports.jumpChipKeys.add(exports.strings.END_KEY);
|
4054 | exports.jumpChipKeys.add(exports.strings.IE_ARROW_UP_KEY);
|
4055 | exports.jumpChipKeys.add(exports.strings.IE_ARROW_DOWN_KEY);
|
4056 |
|
4057 | }),
|
4058 |
|
4059 | "./packages/mdc-chips/deprecated/chip/foundation.ts":
|
4060 |
|
4061 |
|
4062 |
|
4063 |
|
4064 | (function(module, exports, __webpack_require__) {
|
4065 |
|
4066 | "use strict";
|
4067 |
|
4068 |
|
4069 |
|
4070 |
|
4071 |
|
4072 |
|
4073 |
|
4074 |
|
4075 |
|
4076 |
|
4077 |
|
4078 |
|
4079 |
|
4080 |
|
4081 |
|
4082 |
|
4083 |
|
4084 |
|
4085 |
|
4086 |
|
4087 |
|
4088 |
|
4089 |
|
4090 |
|
4091 | var __extends = this && this.__extends || function () {
|
4092 | var _extendStatics = function extendStatics(d, b) {
|
4093 | _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
|
4094 | d.__proto__ = b;
|
4095 | } || function (d, b) {
|
4096 | for (var p in b) {
|
4097 | if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
4098 | }
|
4099 | };
|
4100 | return _extendStatics(d, b);
|
4101 | };
|
4102 | return function (d, b) {
|
4103 | if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
4104 | _extendStatics(d, b);
|
4105 | function __() {
|
4106 | this.constructor = d;
|
4107 | }
|
4108 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
4109 | };
|
4110 | }();
|
4111 | var __assign = this && this.__assign || function () {
|
4112 | __assign = Object.assign || function (t) {
|
4113 | for (var s, i = 1, n = arguments.length; i < n; i++) {
|
4114 | s = arguments[i];
|
4115 | for (var p in s) {
|
4116 | if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
4117 | }
|
4118 | }
|
4119 | return t;
|
4120 | };
|
4121 | return __assign.apply(this, arguments);
|
4122 | };
|
4123 | Object.defineProperty(exports, "__esModule", { value: true });
|
4124 | exports.MDCChipFoundation = void 0;
|
4125 | var foundation_1 = __webpack_require__( "./packages/mdc-base/foundation.ts");
|
4126 | var constants_1 = __webpack_require__( "./packages/mdc-chips/deprecated/chip/constants.ts");
|
4127 | var emptyClientRect = {
|
4128 | bottom: 0,
|
4129 | height: 0,
|
4130 | left: 0,
|
4131 | right: 0,
|
4132 | top: 0,
|
4133 | width: 0
|
4134 | };
|
4135 | var FocusBehavior;
|
4136 | (function (FocusBehavior) {
|
4137 | FocusBehavior[FocusBehavior["SHOULD_FOCUS"] = 0] = "SHOULD_FOCUS";
|
4138 | FocusBehavior[FocusBehavior["SHOULD_NOT_FOCUS"] = 1] = "SHOULD_NOT_FOCUS";
|
4139 | })(FocusBehavior || (FocusBehavior = {}));
|
4140 | var MDCChipFoundation = function (_super) {
|
4141 | __extends(MDCChipFoundation, _super);
|
4142 | function MDCChipFoundation(adapter) {
|
4143 | var _this = _super.call(this, __assign(__assign({}, MDCChipFoundation.defaultAdapter), adapter)) || this;
|
4144 |
|
4145 | _this.shouldRemoveOnTrailingIconClick = true;
|
4146 | |
4147 |
|
4148 |
|
4149 |
|
4150 |
|
4151 | _this.shouldFocusPrimaryActionOnClick = true;
|
4152 | return _this;
|
4153 | }
|
4154 | Object.defineProperty(MDCChipFoundation, "strings", {
|
4155 | get: function get() {
|
4156 | return constants_1.strings;
|
4157 | },
|
4158 | enumerable: false,
|
4159 | configurable: true
|
4160 | });
|
4161 | Object.defineProperty(MDCChipFoundation, "cssClasses", {
|
4162 | get: function get() {
|
4163 | return constants_1.cssClasses;
|
4164 | },
|
4165 | enumerable: false,
|
4166 | configurable: true
|
4167 | });
|
4168 | Object.defineProperty(MDCChipFoundation, "defaultAdapter", {
|
4169 | get: function get() {
|
4170 | return {
|
4171 | addClass: function addClass() {
|
4172 | return undefined;
|
4173 | },
|
4174 | addClassToLeadingIcon: function addClassToLeadingIcon() {
|
4175 | return undefined;
|
4176 | },
|
4177 | eventTargetHasClass: function eventTargetHasClass() {
|
4178 | return false;
|
4179 | },
|
4180 | focusPrimaryAction: function focusPrimaryAction() {
|
4181 | return undefined;
|
4182 | },
|
4183 | focusTrailingAction: function focusTrailingAction() {
|
4184 | return undefined;
|
4185 | },
|
4186 | getAttribute: function getAttribute() {
|
4187 | return null;
|
4188 | },
|
4189 | getCheckmarkBoundingClientRect: function getCheckmarkBoundingClientRect() {
|
4190 | return emptyClientRect;
|
4191 | },
|
4192 | getComputedStyleValue: function getComputedStyleValue() {
|
4193 | return '';
|
4194 | },
|
4195 | getRootBoundingClientRect: function getRootBoundingClientRect() {
|
4196 | return emptyClientRect;
|
4197 | },
|
4198 | hasClass: function hasClass() {
|
4199 | return false;
|
4200 | },
|
4201 | hasLeadingIcon: function hasLeadingIcon() {
|
4202 | return false;
|
4203 | },
|
4204 | isRTL: function isRTL() {
|
4205 | return false;
|
4206 | },
|
4207 | isTrailingActionNavigable: function isTrailingActionNavigable() {
|
4208 | return false;
|
4209 | },
|
4210 | notifyEditFinish: function notifyEditFinish() {
|
4211 | return undefined;
|
4212 | },
|
4213 | notifyEditStart: function notifyEditStart() {
|
4214 | return undefined;
|
4215 | },
|
4216 | notifyInteraction: function notifyInteraction() {
|
4217 | return undefined;
|
4218 | },
|
4219 | notifyNavigation: function notifyNavigation() {
|
4220 | return undefined;
|
4221 | },
|
4222 | notifyRemoval: function notifyRemoval() {
|
4223 | return undefined;
|
4224 | },
|
4225 | notifySelection: function notifySelection() {
|
4226 | return undefined;
|
4227 | },
|
4228 | notifyTrailingIconInteraction: function notifyTrailingIconInteraction() {
|
4229 | return undefined;
|
4230 | },
|
4231 | removeClass: function removeClass() {
|
4232 | return undefined;
|
4233 | },
|
4234 | removeClassFromLeadingIcon: function removeClassFromLeadingIcon() {
|
4235 | return undefined;
|
4236 | },
|
4237 | removeTrailingActionFocus: function removeTrailingActionFocus() {
|
4238 | return undefined;
|
4239 | },
|
4240 | setPrimaryActionAttr: function setPrimaryActionAttr() {
|
4241 | return undefined;
|
4242 | },
|
4243 | setStyleProperty: function setStyleProperty() {
|
4244 | return undefined;
|
4245 | }
|
4246 | };
|
4247 | },
|
4248 | enumerable: false,
|
4249 | configurable: true
|
4250 | });
|
4251 | MDCChipFoundation.prototype.isSelected = function () {
|
4252 | return this.adapter.hasClass(constants_1.cssClasses.SELECTED);
|
4253 | };
|
4254 | MDCChipFoundation.prototype.isEditable = function () {
|
4255 | return this.adapter.hasClass(constants_1.cssClasses.EDITABLE);
|
4256 | };
|
4257 | MDCChipFoundation.prototype.isEditing = function () {
|
4258 | return this.adapter.hasClass(constants_1.cssClasses.EDITING);
|
4259 | };
|
4260 | MDCChipFoundation.prototype.setSelected = function (selected) {
|
4261 | this.setSelectedImpl(selected);
|
4262 | this.notifySelection(selected);
|
4263 | };
|
4264 | MDCChipFoundation.prototype.setSelectedFromChipSet = function (selected, shouldNotifyClients) {
|
4265 | this.setSelectedImpl(selected);
|
4266 | if (shouldNotifyClients) {
|
4267 | this.notifyIgnoredSelection(selected);
|
4268 | }
|
4269 | };
|
4270 | MDCChipFoundation.prototype.getShouldRemoveOnTrailingIconClick = function () {
|
4271 | return this.shouldRemoveOnTrailingIconClick;
|
4272 | };
|
4273 | MDCChipFoundation.prototype.setShouldRemoveOnTrailingIconClick = function (shouldRemove) {
|
4274 | this.shouldRemoveOnTrailingIconClick = shouldRemove;
|
4275 | };
|
4276 | MDCChipFoundation.prototype.setShouldFocusPrimaryActionOnClick = function (shouldFocus) {
|
4277 | this.shouldFocusPrimaryActionOnClick = shouldFocus;
|
4278 | };
|
4279 | MDCChipFoundation.prototype.getDimensions = function () {
|
4280 | var _this = this;
|
4281 | var getRootRect = function getRootRect() {
|
4282 | return _this.adapter.getRootBoundingClientRect();
|
4283 | };
|
4284 | var getCheckmarkRect = function getCheckmarkRect() {
|
4285 | return _this.adapter.getCheckmarkBoundingClientRect();
|
4286 | };
|
4287 |
|
4288 |
|
4289 | if (!this.adapter.hasLeadingIcon()) {
|
4290 | var checkmarkRect = getCheckmarkRect();
|
4291 | if (checkmarkRect) {
|
4292 | var rootRect = getRootRect();
|
4293 |
|
4294 |
|
4295 |
|
4296 |
|
4297 | return {
|
4298 | bottom: rootRect.bottom,
|
4299 | height: rootRect.height,
|
4300 | left: rootRect.left,
|
4301 | right: rootRect.right,
|
4302 | top: rootRect.top,
|
4303 | width: rootRect.width + checkmarkRect.height
|
4304 | };
|
4305 | }
|
4306 | }
|
4307 | return getRootRect();
|
4308 | };
|
4309 | |
4310 |
|
4311 |
|
4312 | MDCChipFoundation.prototype.beginExit = function () {
|
4313 | this.adapter.addClass(constants_1.cssClasses.CHIP_EXIT);
|
4314 | };
|
4315 | MDCChipFoundation.prototype.handleClick = function () {
|
4316 | this.adapter.notifyInteraction();
|
4317 | this.setPrimaryActionFocusable(this.getFocusBehavior());
|
4318 | };
|
4319 | MDCChipFoundation.prototype.handleDoubleClick = function () {
|
4320 | if (this.isEditable()) {
|
4321 | this.startEditing();
|
4322 | }
|
4323 | };
|
4324 | |
4325 |
|
4326 |
|
4327 | MDCChipFoundation.prototype.handleTransitionEnd = function (evt) {
|
4328 | var _this = this;
|
4329 |
|
4330 | var shouldHandle = this.adapter.eventTargetHasClass(evt.target, constants_1.cssClasses.CHIP_EXIT);
|
4331 | var widthIsAnimating = evt.propertyName === 'width';
|
4332 | var opacityIsAnimating = evt.propertyName === 'opacity';
|
4333 | if (shouldHandle && opacityIsAnimating) {
|
4334 |
|
4335 | var chipWidth_1 = this.adapter.getComputedStyleValue('width');
|
4336 |
|
4337 |
|
4338 | requestAnimationFrame(function () {
|
4339 | _this.adapter.setStyleProperty('width', chipWidth_1);
|
4340 |
|
4341 | _this.adapter.setStyleProperty('padding', '0');
|
4342 | _this.adapter.setStyleProperty('margin', '0');
|
4343 |
|
4344 | requestAnimationFrame(function () {
|
4345 | _this.adapter.setStyleProperty('width', '0');
|
4346 | });
|
4347 | });
|
4348 | return;
|
4349 | }
|
4350 | if (shouldHandle && widthIsAnimating) {
|
4351 | this.removeFocus();
|
4352 | var removedAnnouncement = this.adapter.getAttribute(constants_1.strings.REMOVED_ANNOUNCEMENT_ATTRIBUTE);
|
4353 | this.adapter.notifyRemoval(removedAnnouncement);
|
4354 | }
|
4355 |
|
4356 | if (!opacityIsAnimating) {
|
4357 | return;
|
4358 | }
|
4359 | var shouldHideLeadingIcon = this.adapter.eventTargetHasClass(evt.target, constants_1.cssClasses.LEADING_ICON) && this.adapter.hasClass(constants_1.cssClasses.SELECTED);
|
4360 | var shouldShowLeadingIcon = this.adapter.eventTargetHasClass(evt.target, constants_1.cssClasses.CHECKMARK) && !this.adapter.hasClass(constants_1.cssClasses.SELECTED);
|
4361 | if (shouldHideLeadingIcon) {
|
4362 | this.adapter.addClassToLeadingIcon(constants_1.cssClasses.HIDDEN_LEADING_ICON);
|
4363 | return;
|
4364 | }
|
4365 | if (shouldShowLeadingIcon) {
|
4366 | this.adapter.removeClassFromLeadingIcon(constants_1.cssClasses.HIDDEN_LEADING_ICON);
|
4367 | return;
|
4368 | }
|
4369 | };
|
4370 | MDCChipFoundation.prototype.handleFocusIn = function (evt) {
|
4371 |
|
4372 | if (!this.eventFromPrimaryAction(evt)) {
|
4373 | return;
|
4374 | }
|
4375 | this.adapter.addClass(constants_1.cssClasses.PRIMARY_ACTION_FOCUSED);
|
4376 | };
|
4377 | MDCChipFoundation.prototype.handleFocusOut = function (evt) {
|
4378 |
|
4379 | if (!this.eventFromPrimaryAction(evt)) {
|
4380 | return;
|
4381 | }
|
4382 | if (this.isEditing()) {
|
4383 | this.finishEditing();
|
4384 | }
|
4385 | this.adapter.removeClass(constants_1.cssClasses.PRIMARY_ACTION_FOCUSED);
|
4386 | };
|
4387 | |
4388 |
|
4389 |
|
4390 |
|
4391 | MDCChipFoundation.prototype.handleTrailingActionInteraction = function () {
|
4392 | this.adapter.notifyTrailingIconInteraction();
|
4393 | this.removeChip();
|
4394 | };
|
4395 | |
4396 |
|
4397 |
|
4398 | MDCChipFoundation.prototype.handleKeydown = function (evt) {
|
4399 | if (this.isEditing()) {
|
4400 | if (this.shouldFinishEditing(evt)) {
|
4401 | evt.preventDefault();
|
4402 | this.finishEditing();
|
4403 | }
|
4404 |
|
4405 |
|
4406 | return;
|
4407 | }
|
4408 | if (this.isEditable()) {
|
4409 | if (this.shouldStartEditing(evt)) {
|
4410 | evt.preventDefault();
|
4411 | this.startEditing();
|
4412 | }
|
4413 | }
|
4414 | if (this.shouldNotifyInteraction(evt)) {
|
4415 | this.adapter.notifyInteraction();
|
4416 | this.setPrimaryActionFocusable(this.getFocusBehavior());
|
4417 | return;
|
4418 | }
|
4419 | if (this.isDeleteAction(evt)) {
|
4420 | evt.preventDefault();
|
4421 | this.removeChip();
|
4422 | return;
|
4423 | }
|
4424 |
|
4425 | if (!constants_1.navigationKeys.has(evt.key)) {
|
4426 | return;
|
4427 | }
|
4428 |
|
4429 | evt.preventDefault();
|
4430 | this.focusNextAction(evt.key, constants_1.EventSource.PRIMARY);
|
4431 | };
|
4432 | MDCChipFoundation.prototype.handleTrailingActionNavigation = function (evt) {
|
4433 | this.focusNextAction(evt.detail.key, constants_1.EventSource.TRAILING);
|
4434 | };
|
4435 | |
4436 |
|
4437 |
|
4438 | MDCChipFoundation.prototype.removeFocus = function () {
|
4439 | this.adapter.setPrimaryActionAttr(constants_1.strings.TAB_INDEX, '-1');
|
4440 | this.adapter.removeTrailingActionFocus();
|
4441 | };
|
4442 | |
4443 |
|
4444 |
|
4445 |
|
4446 | MDCChipFoundation.prototype.focusPrimaryAction = function () {
|
4447 | this.setPrimaryActionFocusable(FocusBehavior.SHOULD_FOCUS);
|
4448 | };
|
4449 | |
4450 |
|
4451 |
|
4452 |
|
4453 | MDCChipFoundation.prototype.focusTrailingAction = function () {
|
4454 | var trailingActionIsNavigable = this.adapter.isTrailingActionNavigable();
|
4455 | if (trailingActionIsNavigable) {
|
4456 | this.adapter.setPrimaryActionAttr(constants_1.strings.TAB_INDEX, '-1');
|
4457 | this.adapter.focusTrailingAction();
|
4458 | return;
|
4459 | }
|
4460 | this.focusPrimaryAction();
|
4461 | };
|
4462 | MDCChipFoundation.prototype.setPrimaryActionFocusable = function (focusBehavior) {
|
4463 | this.adapter.setPrimaryActionAttr(constants_1.strings.TAB_INDEX, '0');
|
4464 | if (focusBehavior === FocusBehavior.SHOULD_FOCUS) {
|
4465 | this.adapter.focusPrimaryAction();
|
4466 | }
|
4467 | this.adapter.removeTrailingActionFocus();
|
4468 | };
|
4469 | MDCChipFoundation.prototype.getFocusBehavior = function () {
|
4470 | if (this.shouldFocusPrimaryActionOnClick) {
|
4471 | return FocusBehavior.SHOULD_FOCUS;
|
4472 | }
|
4473 | return FocusBehavior.SHOULD_NOT_FOCUS;
|
4474 | };
|
4475 | MDCChipFoundation.prototype.focusNextAction = function (key, source) {
|
4476 | var isTrailingActionNavigable = this.adapter.isTrailingActionNavigable();
|
4477 | var dir = this.getDirection(key);
|
4478 |
|
4479 | if (constants_1.jumpChipKeys.has(key) || !isTrailingActionNavigable) {
|
4480 | this.adapter.notifyNavigation(key, source);
|
4481 | return;
|
4482 | }
|
4483 | if (source === constants_1.EventSource.PRIMARY && dir === constants_1.Direction.RIGHT) {
|
4484 | this.focusTrailingAction();
|
4485 | return;
|
4486 | }
|
4487 | if (source === constants_1.EventSource.TRAILING && dir === constants_1.Direction.LEFT) {
|
4488 | this.focusPrimaryAction();
|
4489 | return;
|
4490 | }
|
4491 | this.adapter.notifyNavigation(key, constants_1.EventSource.NONE);
|
4492 | };
|
4493 | MDCChipFoundation.prototype.getDirection = function (key) {
|
4494 | var isRTL = this.adapter.isRTL();
|
4495 | var isLeftKey = key === constants_1.strings.ARROW_LEFT_KEY || key === constants_1.strings.IE_ARROW_LEFT_KEY;
|
4496 | var isRightKey = key === constants_1.strings.ARROW_RIGHT_KEY || key === constants_1.strings.IE_ARROW_RIGHT_KEY;
|
4497 | if (!isRTL && isLeftKey || isRTL && isRightKey) {
|
4498 | return constants_1.Direction.LEFT;
|
4499 | }
|
4500 | return constants_1.Direction.RIGHT;
|
4501 | };
|
4502 | MDCChipFoundation.prototype.removeChip = function () {
|
4503 | if (this.shouldRemoveOnTrailingIconClick) {
|
4504 | this.beginExit();
|
4505 | }
|
4506 | };
|
4507 | MDCChipFoundation.prototype.shouldStartEditing = function (evt) {
|
4508 | return this.eventFromPrimaryAction(evt) && evt.key === constants_1.strings.ENTER_KEY;
|
4509 | };
|
4510 | MDCChipFoundation.prototype.shouldFinishEditing = function (evt) {
|
4511 | return evt.key === constants_1.strings.ENTER_KEY;
|
4512 | };
|
4513 | MDCChipFoundation.prototype.shouldNotifyInteraction = function (evt) {
|
4514 | return evt.key === constants_1.strings.ENTER_KEY || evt.key === constants_1.strings.SPACEBAR_KEY;
|
4515 | };
|
4516 | MDCChipFoundation.prototype.isDeleteAction = function (evt) {
|
4517 | var isDeletable = this.adapter.hasClass(constants_1.cssClasses.DELETABLE);
|
4518 | return isDeletable && (evt.key === constants_1.strings.BACKSPACE_KEY || evt.key === constants_1.strings.DELETE_KEY || evt.key === constants_1.strings.IE_DELETE_KEY);
|
4519 | };
|
4520 | MDCChipFoundation.prototype.setSelectedImpl = function (selected) {
|
4521 | if (selected) {
|
4522 | this.adapter.addClass(constants_1.cssClasses.SELECTED);
|
4523 | this.adapter.setPrimaryActionAttr(constants_1.strings.ARIA_CHECKED, 'true');
|
4524 | } else {
|
4525 | this.adapter.removeClass(constants_1.cssClasses.SELECTED);
|
4526 | this.adapter.setPrimaryActionAttr(constants_1.strings.ARIA_CHECKED, 'false');
|
4527 | }
|
4528 | };
|
4529 | MDCChipFoundation.prototype.notifySelection = function (selected) {
|
4530 | this.adapter.notifySelection(selected, false);
|
4531 | };
|
4532 | MDCChipFoundation.prototype.notifyIgnoredSelection = function (selected) {
|
4533 | this.adapter.notifySelection(selected, true);
|
4534 | };
|
4535 | MDCChipFoundation.prototype.eventFromPrimaryAction = function (evt) {
|
4536 | return this.adapter.eventTargetHasClass(evt.target, constants_1.cssClasses.PRIMARY_ACTION);
|
4537 | };
|
4538 | MDCChipFoundation.prototype.startEditing = function () {
|
4539 | this.adapter.addClass(constants_1.cssClasses.EDITING);
|
4540 | this.adapter.notifyEditStart();
|
4541 | };
|
4542 | MDCChipFoundation.prototype.finishEditing = function () {
|
4543 | this.adapter.removeClass(constants_1.cssClasses.EDITING);
|
4544 | this.adapter.notifyEditFinish();
|
4545 | };
|
4546 | return MDCChipFoundation;
|
4547 | }(foundation_1.MDCFoundation);
|
4548 | exports.MDCChipFoundation = MDCChipFoundation;
|
4549 |
|
4550 | exports.default = MDCChipFoundation;
|
4551 |
|
4552 | }),
|
4553 |
|
4554 | "./packages/mdc-chips/deprecated/chip/index.ts":
|
4555 |
|
4556 |
|
4557 |
|
4558 |
|
4559 | (function(module, exports, __webpack_require__) {
|
4560 |
|
4561 | "use strict";
|
4562 |
|
4563 |
|
4564 |
|
4565 |
|
4566 |
|
4567 |
|
4568 |
|
4569 |
|
4570 |
|
4571 |
|
4572 |
|
4573 |
|
4574 |
|
4575 |
|
4576 |
|
4577 |
|
4578 |
|
4579 |
|
4580 |
|
4581 |
|
4582 |
|
4583 |
|
4584 |
|
4585 |
|
4586 | var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
|
4587 | if (k2 === undefined) k2 = k;
|
4588 | Object.defineProperty(o, k2, { enumerable: true, get: function get() {
|
4589 | return m[k];
|
4590 | } });
|
4591 | } : function (o, m, k, k2) {
|
4592 | if (k2 === undefined) k2 = k;
|
4593 | o[k2] = m[k];
|
4594 | });
|
4595 | var __exportStar = this && this.__exportStar || function (m, exports) {
|
4596 | for (var p in m) {
|
4597 | if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
4598 | }
|
4599 | };
|
4600 | Object.defineProperty(exports, "__esModule", { value: true });
|
4601 | exports.chipStrings = exports.chipCssClasses = void 0;
|
4602 | __exportStar(__webpack_require__( "./packages/mdc-chips/deprecated/chip/adapter.ts"), exports);
|
4603 | __exportStar(__webpack_require__( "./packages/mdc-chips/deprecated/chip/component.ts"), exports);
|
4604 | __exportStar(__webpack_require__( "./packages/mdc-chips/deprecated/chip/foundation.ts"), exports);
|
4605 | __exportStar(__webpack_require__( "./packages/mdc-chips/deprecated/chip/types.ts"), exports);
|
4606 | var constants_1 = __webpack_require__( "./packages/mdc-chips/deprecated/chip/constants.ts");
|
4607 | Object.defineProperty(exports, "chipCssClasses", { enumerable: true, get: function get() {
|
4608 | return constants_1.cssClasses;
|
4609 | } });
|
4610 | Object.defineProperty(exports, "chipStrings", { enumerable: true, get: function get() {
|
4611 | return constants_1.strings;
|
4612 | } });
|
4613 |
|
4614 | }),
|
4615 |
|
4616 | "./packages/mdc-chips/deprecated/chip/types.ts":
|
4617 |
|
4618 |
|
4619 |
|
4620 |
|
4621 | (function(module, exports, __webpack_require__) {
|
4622 |
|
4623 | "use strict";
|
4624 |
|
4625 |
|
4626 |
|
4627 |
|
4628 |
|
4629 |
|
4630 |
|
4631 |
|
4632 |
|
4633 |
|
4634 |
|
4635 |
|
4636 |
|
4637 |
|
4638 |
|
4639 |
|
4640 |
|
4641 |
|
4642 |
|
4643 |
|
4644 |
|
4645 |
|
4646 |
|
4647 |
|
4648 | Object.defineProperty(exports, "__esModule", { value: true });
|
4649 |
|
4650 | }),
|
4651 |
|
4652 | "./packages/mdc-chips/deprecated/index.ts":
|
4653 |
|
4654 |
|
4655 |
|
4656 |
|
4657 | (function(module, exports, __webpack_require__) {
|
4658 |
|
4659 | "use strict";
|
4660 |
|
4661 |
|
4662 |
|
4663 |
|
4664 |
|
4665 |
|
4666 |
|
4667 |
|
4668 |
|
4669 |
|
4670 |
|
4671 |
|
4672 |
|
4673 |
|
4674 |
|
4675 |
|
4676 |
|
4677 |
|
4678 |
|
4679 |
|
4680 |
|
4681 |
|
4682 |
|
4683 |
|
4684 | var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
|
4685 | if (k2 === undefined) k2 = k;
|
4686 | Object.defineProperty(o, k2, { enumerable: true, get: function get() {
|
4687 | return m[k];
|
4688 | } });
|
4689 | } : function (o, m, k, k2) {
|
4690 | if (k2 === undefined) k2 = k;
|
4691 | o[k2] = m[k];
|
4692 | });
|
4693 | var __exportStar = this && this.__exportStar || function (m, exports) {
|
4694 | for (var p in m) {
|
4695 | if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
4696 | }
|
4697 | };
|
4698 | Object.defineProperty(exports, "__esModule", { value: true });
|
4699 | __exportStar(__webpack_require__( "./packages/mdc-chips/deprecated/trailingaction/index.ts"), exports);
|
4700 | __exportStar(__webpack_require__( "./packages/mdc-chips/deprecated/chip/index.ts"), exports);
|
4701 | __exportStar(__webpack_require__( "./packages/mdc-chips/deprecated/chip-set/index.ts"), exports);
|
4702 |
|
4703 | }),
|
4704 |
|
4705 | "./packages/mdc-chips/deprecated/trailingaction/adapter.ts":
|
4706 |
|
4707 |
|
4708 |
|
4709 |
|
4710 | (function(module, exports, __webpack_require__) {
|
4711 |
|
4712 | "use strict";
|
4713 |
|
4714 |
|
4715 |
|
4716 |
|
4717 |
|
4718 |
|
4719 |
|
4720 |
|
4721 |
|
4722 |
|
4723 |
|
4724 |
|
4725 |
|
4726 |
|
4727 |
|
4728 |
|
4729 |
|
4730 |
|
4731 |
|
4732 |
|
4733 |
|
4734 |
|
4735 |
|
4736 |
|
4737 | Object.defineProperty(exports, "__esModule", { value: true });
|
4738 |
|
4739 | }),
|
4740 |
|
4741 | "./packages/mdc-chips/deprecated/trailingaction/component.ts":
|
4742 |
|
4743 |
|
4744 |
|
4745 |
|
4746 | (function(module, exports, __webpack_require__) {
|
4747 |
|
4748 | "use strict";
|
4749 |
|
4750 |
|
4751 |
|
4752 |
|
4753 |
|
4754 |
|
4755 |
|
4756 |
|
4757 |
|
4758 |
|
4759 |
|
4760 |
|
4761 |
|
4762 |
|
4763 |
|
4764 |
|
4765 |
|
4766 |
|
4767 |
|
4768 |
|
4769 |
|
4770 |
|
4771 |
|
4772 |
|
4773 | var __extends = this && this.__extends || function () {
|
4774 | var _extendStatics = function extendStatics(d, b) {
|
4775 | _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
|
4776 | d.__proto__ = b;
|
4777 | } || function (d, b) {
|
4778 | for (var p in b) {
|
4779 | if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
4780 | }
|
4781 | };
|
4782 | return _extendStatics(d, b);
|
4783 | };
|
4784 | return function (d, b) {
|
4785 | if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
4786 | _extendStatics(d, b);
|
4787 | function __() {
|
4788 | this.constructor = d;
|
4789 | }
|
4790 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
4791 | };
|
4792 | }();
|
4793 | Object.defineProperty(exports, "__esModule", { value: true });
|
4794 | exports.MDCChipTrailingAction = void 0;
|
4795 | var component_1 = __webpack_require__( "./packages/mdc-base/component.ts");
|
4796 | var component_2 = __webpack_require__( "./packages/mdc-ripple/component.ts");
|
4797 | var foundation_1 = __webpack_require__( "./packages/mdc-ripple/foundation.ts");
|
4798 | var constants_1 = __webpack_require__( "./packages/mdc-chips/deprecated/trailingaction/constants.ts");
|
4799 | var foundation_2 = __webpack_require__( "./packages/mdc-chips/deprecated/trailingaction/foundation.ts");
|
4800 | var MDCChipTrailingAction = function (_super) {
|
4801 | __extends(MDCChipTrailingAction, _super);
|
4802 | function MDCChipTrailingAction() {
|
4803 | return _super !== null && _super.apply(this, arguments) || this;
|
4804 | }
|
4805 | Object.defineProperty(MDCChipTrailingAction.prototype, "ripple", {
|
4806 | get: function get() {
|
4807 | return this.rippleSurface;
|
4808 | },
|
4809 | enumerable: false,
|
4810 | configurable: true
|
4811 | });
|
4812 | MDCChipTrailingAction.attachTo = function (root) {
|
4813 | return new MDCChipTrailingAction(root);
|
4814 | };
|
4815 | MDCChipTrailingAction.prototype.initialize = function (rippleFactory) {
|
4816 | if (rippleFactory === void 0) {
|
4817 | rippleFactory = function rippleFactory(el, foundation) {
|
4818 | return new component_2.MDCRipple(el, foundation);
|
4819 | };
|
4820 | }
|
4821 |
|
4822 |
|
4823 |
|
4824 | var rippleAdapter = component_2.MDCRipple.createAdapter(this);
|
4825 | this.rippleSurface = rippleFactory(this.root, new foundation_1.MDCRippleFoundation(rippleAdapter));
|
4826 | };
|
4827 | MDCChipTrailingAction.prototype.initialSyncWithDOM = function () {
|
4828 | var _this = this;
|
4829 | this.handleClick = function (evt) {
|
4830 | _this.foundation.handleClick(evt);
|
4831 | };
|
4832 | this.handleKeydown = function (evt) {
|
4833 | _this.foundation.handleKeydown(evt);
|
4834 | };
|
4835 | this.listen('click', this.handleClick);
|
4836 | this.listen('keydown', this.handleKeydown);
|
4837 | };
|
4838 | MDCChipTrailingAction.prototype.destroy = function () {
|
4839 | this.rippleSurface.destroy();
|
4840 | this.unlisten('click', this.handleClick);
|
4841 | this.unlisten('keydown', this.handleKeydown);
|
4842 | _super.prototype.destroy.call(this);
|
4843 | };
|
4844 | MDCChipTrailingAction.prototype.getDefaultFoundation = function () {
|
4845 | var _this = this;
|
4846 |
|
4847 |
|
4848 |
|
4849 | var adapter = {
|
4850 | focus: function focus() {
|
4851 |
|
4852 | _this.root.focus();
|
4853 | },
|
4854 | getAttribute: function getAttribute(attr) {
|
4855 | return _this.root.getAttribute(attr);
|
4856 | },
|
4857 | notifyInteraction: function notifyInteraction(trigger) {
|
4858 | return _this.emit(constants_1.strings.INTERACTION_EVENT, { trigger: trigger }, true );
|
4859 | },
|
4860 | notifyNavigation: function notifyNavigation(key) {
|
4861 | _this.emit(constants_1.strings.NAVIGATION_EVENT, { key: key }, true );
|
4862 | },
|
4863 | setAttribute: function setAttribute(attr, value) {
|
4864 | _this.root.setAttribute(attr, value);
|
4865 | }
|
4866 | };
|
4867 | return new foundation_2.MDCChipTrailingActionFoundation(adapter);
|
4868 | };
|
4869 | MDCChipTrailingAction.prototype.isNavigable = function () {
|
4870 | return this.foundation.isNavigable();
|
4871 | };
|
4872 | MDCChipTrailingAction.prototype.focus = function () {
|
4873 | this.foundation.focus();
|
4874 | };
|
4875 | MDCChipTrailingAction.prototype.removeFocus = function () {
|
4876 | this.foundation.removeFocus();
|
4877 | };
|
4878 | return MDCChipTrailingAction;
|
4879 | }(component_1.MDCComponent);
|
4880 | exports.MDCChipTrailingAction = MDCChipTrailingAction;
|
4881 |
|
4882 | }),
|
4883 |
|
4884 | "./packages/mdc-chips/deprecated/trailingaction/constants.ts":
|
4885 |
|
4886 |
|
4887 |
|
4888 |
|
4889 | (function(module, exports, __webpack_require__) {
|
4890 |
|
4891 | "use strict";
|
4892 |
|
4893 |
|
4894 |
|
4895 |
|
4896 |
|
4897 |
|
4898 |
|
4899 |
|
4900 |
|
4901 |
|
4902 |
|
4903 |
|
4904 |
|
4905 |
|
4906 |
|
4907 |
|
4908 |
|
4909 |
|
4910 |
|
4911 |
|
4912 |
|
4913 |
|
4914 |
|
4915 |
|
4916 | Object.defineProperty(exports, "__esModule", { value: true });
|
4917 | exports.strings = exports.InteractionTrigger = void 0;
|
4918 | var InteractionTrigger;
|
4919 | (function (InteractionTrigger) {
|
4920 | InteractionTrigger[InteractionTrigger["UNSPECIFIED"] = 0] = "UNSPECIFIED";
|
4921 | InteractionTrigger[InteractionTrigger["CLICK"] = 1] = "CLICK";
|
4922 | InteractionTrigger[InteractionTrigger["BACKSPACE_KEY"] = 2] = "BACKSPACE_KEY";
|
4923 | InteractionTrigger[InteractionTrigger["DELETE_KEY"] = 3] = "DELETE_KEY";
|
4924 | InteractionTrigger[InteractionTrigger["SPACEBAR_KEY"] = 4] = "SPACEBAR_KEY";
|
4925 | InteractionTrigger[InteractionTrigger["ENTER_KEY"] = 5] = "ENTER_KEY";
|
4926 | })(InteractionTrigger = exports.InteractionTrigger || (exports.InteractionTrigger = {}));
|
4927 | exports.strings = {
|
4928 | ARIA_HIDDEN: 'aria-hidden',
|
4929 | INTERACTION_EVENT: 'MDCChipTrailingAction:interaction',
|
4930 | NAVIGATION_EVENT: 'MDCChipTrailingAction:navigation',
|
4931 | TAB_INDEX: 'tabindex'
|
4932 | };
|
4933 |
|
4934 | }),
|
4935 |
|
4936 | "./packages/mdc-chips/deprecated/trailingaction/foundation.ts":
|
4937 |
|
4938 |
|
4939 |
|
4940 |
|
4941 | (function(module, exports, __webpack_require__) {
|
4942 |
|
4943 | "use strict";
|
4944 |
|
4945 |
|
4946 |
|
4947 |
|
4948 |
|
4949 |
|
4950 |
|
4951 |
|
4952 |
|
4953 |
|
4954 |
|
4955 |
|
4956 |
|
4957 |
|
4958 |
|
4959 |
|
4960 |
|
4961 |
|
4962 |
|
4963 |
|
4964 |
|
4965 |
|
4966 |
|
4967 |
|
4968 | var __extends = this && this.__extends || function () {
|
4969 | var _extendStatics = function extendStatics(d, b) {
|
4970 | _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
|
4971 | d.__proto__ = b;
|
4972 | } || function (d, b) {
|
4973 | for (var p in b) {
|
4974 | if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
4975 | }
|
4976 | };
|
4977 | return _extendStatics(d, b);
|
4978 | };
|
4979 | return function (d, b) {
|
4980 | if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
4981 | _extendStatics(d, b);
|
4982 | function __() {
|
4983 | this.constructor = d;
|
4984 | }
|
4985 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
4986 | };
|
4987 | }();
|
4988 | var __assign = this && this.__assign || function () {
|
4989 | __assign = Object.assign || function (t) {
|
4990 | for (var s, i = 1, n = arguments.length; i < n; i++) {
|
4991 | s = arguments[i];
|
4992 | for (var p in s) {
|
4993 | if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
4994 | }
|
4995 | }
|
4996 | return t;
|
4997 | };
|
4998 | return __assign.apply(this, arguments);
|
4999 | };
|
5000 | Object.defineProperty(exports, "__esModule", { value: true });
|
5001 | exports.MDCChipTrailingActionFoundation = void 0;
|
5002 | var foundation_1 = __webpack_require__( "./packages/mdc-base/foundation.ts");
|
5003 | var keyboard_1 = __webpack_require__( "./packages/mdc-dom/keyboard.ts");
|
5004 | var constants_1 = __webpack_require__( "./packages/mdc-chips/deprecated/trailingaction/constants.ts");
|
5005 | var MDCChipTrailingActionFoundation = function (_super) {
|
5006 | __extends(MDCChipTrailingActionFoundation, _super);
|
5007 | function MDCChipTrailingActionFoundation(adapter) {
|
5008 | return _super.call(this, __assign(__assign({}, MDCChipTrailingActionFoundation.defaultAdapter), adapter)) || this;
|
5009 | }
|
5010 | Object.defineProperty(MDCChipTrailingActionFoundation, "strings", {
|
5011 | get: function get() {
|
5012 | return constants_1.strings;
|
5013 | },
|
5014 | enumerable: false,
|
5015 | configurable: true
|
5016 | });
|
5017 | Object.defineProperty(MDCChipTrailingActionFoundation, "defaultAdapter", {
|
5018 | get: function get() {
|
5019 | return {
|
5020 | focus: function focus() {
|
5021 | return undefined;
|
5022 | },
|
5023 | getAttribute: function getAttribute() {
|
5024 | return null;
|
5025 | },
|
5026 | setAttribute: function setAttribute() {
|
5027 | return undefined;
|
5028 | },
|
5029 | notifyInteraction: function notifyInteraction() {
|
5030 | return undefined;
|
5031 | },
|
5032 | notifyNavigation: function notifyNavigation() {
|
5033 | return undefined;
|
5034 | }
|
5035 | };
|
5036 | },
|
5037 | enumerable: false,
|
5038 | configurable: true
|
5039 | });
|
5040 | MDCChipTrailingActionFoundation.prototype.handleClick = function (evt) {
|
5041 | evt.stopPropagation();
|
5042 | this.adapter.notifyInteraction(constants_1.InteractionTrigger.CLICK);
|
5043 | };
|
5044 | MDCChipTrailingActionFoundation.prototype.handleKeydown = function (evt) {
|
5045 | evt.stopPropagation();
|
5046 | var key = keyboard_1.normalizeKey(evt);
|
5047 | if (this.shouldNotifyInteractionFromKey(key)) {
|
5048 | var trigger = this.getTriggerFromKey(key);
|
5049 | this.adapter.notifyInteraction(trigger);
|
5050 | return;
|
5051 | }
|
5052 | if (keyboard_1.isNavigationEvent(evt)) {
|
5053 | this.adapter.notifyNavigation(key);
|
5054 | return;
|
5055 | }
|
5056 | };
|
5057 | MDCChipTrailingActionFoundation.prototype.removeFocus = function () {
|
5058 | this.adapter.setAttribute(constants_1.strings.TAB_INDEX, '-1');
|
5059 | };
|
5060 | MDCChipTrailingActionFoundation.prototype.focus = function () {
|
5061 | this.adapter.setAttribute(constants_1.strings.TAB_INDEX, '0');
|
5062 | this.adapter.focus();
|
5063 | };
|
5064 | MDCChipTrailingActionFoundation.prototype.isNavigable = function () {
|
5065 | return this.adapter.getAttribute(constants_1.strings.ARIA_HIDDEN) !== 'true';
|
5066 | };
|
5067 | MDCChipTrailingActionFoundation.prototype.shouldNotifyInteractionFromKey = function (key) {
|
5068 | var isFromActionKey = key === keyboard_1.KEY.ENTER || key === keyboard_1.KEY.SPACEBAR;
|
5069 | var isFromDeleteKey = key === keyboard_1.KEY.BACKSPACE || key === keyboard_1.KEY.DELETE;
|
5070 | return isFromActionKey || isFromDeleteKey;
|
5071 | };
|
5072 | MDCChipTrailingActionFoundation.prototype.getTriggerFromKey = function (key) {
|
5073 | if (key === keyboard_1.KEY.SPACEBAR) {
|
5074 | return constants_1.InteractionTrigger.SPACEBAR_KEY;
|
5075 | }
|
5076 | if (key === keyboard_1.KEY.ENTER) {
|
5077 | return constants_1.InteractionTrigger.ENTER_KEY;
|
5078 | }
|
5079 | if (key === keyboard_1.KEY.DELETE) {
|
5080 | return constants_1.InteractionTrigger.DELETE_KEY;
|
5081 | }
|
5082 | if (key === keyboard_1.KEY.BACKSPACE) {
|
5083 | return constants_1.InteractionTrigger.BACKSPACE_KEY;
|
5084 | }
|
5085 |
|
5086 | return constants_1.InteractionTrigger.UNSPECIFIED;
|
5087 | };
|
5088 | return MDCChipTrailingActionFoundation;
|
5089 | }(foundation_1.MDCFoundation);
|
5090 | exports.MDCChipTrailingActionFoundation = MDCChipTrailingActionFoundation;
|
5091 |
|
5092 | exports.default = MDCChipTrailingActionFoundation;
|
5093 |
|
5094 | }),
|
5095 |
|
5096 | "./packages/mdc-chips/deprecated/trailingaction/index.ts":
|
5097 |
|
5098 |
|
5099 |
|
5100 |
|
5101 | (function(module, exports, __webpack_require__) {
|
5102 |
|
5103 | "use strict";
|
5104 |
|
5105 |
|
5106 |
|
5107 |
|
5108 |
|
5109 |
|
5110 |
|
5111 |
|
5112 |
|
5113 |
|
5114 |
|
5115 |
|
5116 |
|
5117 |
|
5118 |
|
5119 |
|
5120 |
|
5121 |
|
5122 |
|
5123 |
|
5124 |
|
5125 |
|
5126 |
|
5127 |
|
5128 | var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
|
5129 | if (k2 === undefined) k2 = k;
|
5130 | Object.defineProperty(o, k2, { enumerable: true, get: function get() {
|
5131 | return m[k];
|
5132 | } });
|
5133 | } : function (o, m, k, k2) {
|
5134 | if (k2 === undefined) k2 = k;
|
5135 | o[k2] = m[k];
|
5136 | });
|
5137 | var __exportStar = this && this.__exportStar || function (m, exports) {
|
5138 | for (var p in m) {
|
5139 | if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
5140 | }
|
5141 | };
|
5142 | Object.defineProperty(exports, "__esModule", { value: true });
|
5143 | exports.trailingActionStrings = void 0;
|
5144 | __exportStar(__webpack_require__( "./packages/mdc-chips/deprecated/trailingaction/adapter.ts"), exports);
|
5145 | __exportStar(__webpack_require__( "./packages/mdc-chips/deprecated/trailingaction/component.ts"), exports);
|
5146 | __exportStar(__webpack_require__( "./packages/mdc-chips/deprecated/trailingaction/foundation.ts"), exports);
|
5147 | __exportStar(__webpack_require__( "./packages/mdc-chips/deprecated/trailingaction/types.ts"), exports);
|
5148 | var constants_1 = __webpack_require__( "./packages/mdc-chips/deprecated/trailingaction/constants.ts");
|
5149 | Object.defineProperty(exports, "trailingActionStrings", { enumerable: true, get: function get() {
|
5150 | return constants_1.strings;
|
5151 | } });
|
5152 |
|
5153 | }),
|
5154 |
|
5155 | "./packages/mdc-chips/deprecated/trailingaction/types.ts":
|
5156 |
|
5157 |
|
5158 |
|
5159 |
|
5160 | (function(module, exports, __webpack_require__) {
|
5161 |
|
5162 | "use strict";
|
5163 |
|
5164 |
|
5165 |
|
5166 |
|
5167 |
|
5168 |
|
5169 |
|
5170 |
|
5171 |
|
5172 |
|
5173 |
|
5174 |
|
5175 |
|
5176 |
|
5177 |
|
5178 |
|
5179 |
|
5180 |
|
5181 |
|
5182 |
|
5183 |
|
5184 |
|
5185 |
|
5186 |
|
5187 | Object.defineProperty(exports, "__esModule", { value: true });
|
5188 |
|
5189 | }),
|
5190 |
|
5191 | "./packages/mdc-circular-progress/adapter.ts":
|
5192 |
|
5193 |
|
5194 |
|
5195 |
|
5196 | (function(module, exports, __webpack_require__) {
|
5197 |
|
5198 | "use strict";
|
5199 |
|
5200 |
|
5201 |
|
5202 |
|
5203 |
|
5204 |
|
5205 |
|
5206 |
|
5207 |
|
5208 |
|
5209 |
|
5210 |
|
5211 |
|
5212 |
|
5213 |
|
5214 |
|
5215 |
|
5216 |
|
5217 |
|
5218 |
|
5219 |
|
5220 |
|
5221 |
|
5222 |
|
5223 | Object.defineProperty(exports, "__esModule", { value: true });
|
5224 |
|
5225 | }),
|
5226 |
|
5227 | "./packages/mdc-circular-progress/component.ts":
|
5228 |
|
5229 |
|
5230 |
|
5231 |
|
5232 | (function(module, exports, __webpack_require__) {
|
5233 |
|
5234 | "use strict";
|
5235 |
|
5236 |
|
5237 |
|
5238 |
|
5239 |
|
5240 |
|
5241 |
|
5242 |
|
5243 |
|
5244 |
|
5245 |
|
5246 |
|
5247 |
|
5248 |
|
5249 |
|
5250 |
|
5251 |
|
5252 |
|
5253 |
|
5254 |
|
5255 |
|
5256 |
|
5257 |
|
5258 |
|
5259 | var __extends = this && this.__extends || function () {
|
5260 | var _extendStatics = function extendStatics(d, b) {
|
5261 | _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
|
5262 | d.__proto__ = b;
|
5263 | } || function (d, b) {
|
5264 | for (var p in b) {
|
5265 | if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
5266 | }
|
5267 | };
|
5268 | return _extendStatics(d, b);
|
5269 | };
|
5270 | return function (d, b) {
|
5271 | if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
5272 | _extendStatics(d, b);
|
5273 | function __() {
|
5274 | this.constructor = d;
|
5275 | }
|
5276 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
5277 | };
|
5278 | }();
|
5279 | Object.defineProperty(exports, "__esModule", { value: true });
|
5280 | exports.MDCCircularProgress = void 0;
|
5281 | var component_1 = __webpack_require__( "./packages/mdc-base/component.ts");
|
5282 | var foundation_1 = __webpack_require__( "./packages/mdc-circular-progress/foundation.ts");
|
5283 | var MDCCircularProgress = function (_super) {
|
5284 | __extends(MDCCircularProgress, _super);
|
5285 | function MDCCircularProgress() {
|
5286 | return _super !== null && _super.apply(this, arguments) || this;
|
5287 | }
|
5288 | MDCCircularProgress.prototype.initialize = function () {
|
5289 | this.determinateCircle = this.root.querySelector(foundation_1.MDCCircularProgressFoundation.strings.DETERMINATE_CIRCLE_SELECTOR);
|
5290 | };
|
5291 | MDCCircularProgress.attachTo = function (root) {
|
5292 | return new MDCCircularProgress(root);
|
5293 | };
|
5294 | Object.defineProperty(MDCCircularProgress.prototype, "determinate", {
|
5295 | |
5296 |
|
5297 |
|
5298 |
|
5299 | set: function set(value) {
|
5300 | this.foundation.setDeterminate(value);
|
5301 | },
|
5302 | enumerable: false,
|
5303 | configurable: true
|
5304 | });
|
5305 | Object.defineProperty(MDCCircularProgress.prototype, "progress", {
|
5306 | |
5307 |
|
5308 |
|
5309 |
|
5310 |
|
5311 |
|
5312 | set: function set(value) {
|
5313 | this.foundation.setProgress(value);
|
5314 | },
|
5315 | enumerable: false,
|
5316 | configurable: true
|
5317 | });
|
5318 | Object.defineProperty(MDCCircularProgress.prototype, "isClosed", {
|
5319 | |
5320 |
|
5321 |
|
5322 | get: function get() {
|
5323 | return this.foundation.isClosed();
|
5324 | },
|
5325 | enumerable: false,
|
5326 | configurable: true
|
5327 | });
|
5328 | |
5329 |
|
5330 |
|
5331 | MDCCircularProgress.prototype.open = function () {
|
5332 | this.foundation.open();
|
5333 | };
|
5334 | |
5335 |
|
5336 |
|
5337 | MDCCircularProgress.prototype.close = function () {
|
5338 | this.foundation.close();
|
5339 | };
|
5340 | MDCCircularProgress.prototype.getDefaultFoundation = function () {
|
5341 | var _this = this;
|
5342 |
|
5343 |
|
5344 |
|
5345 | var adapter = {
|
5346 | addClass: function addClass(className) {
|
5347 | _this.root.classList.add(className);
|
5348 | },
|
5349 | getDeterminateCircleAttribute: function getDeterminateCircleAttribute(attributeName) {
|
5350 | return _this.determinateCircle.getAttribute(attributeName);
|
5351 | },
|
5352 | hasClass: function hasClass(className) {
|
5353 | return _this.root.classList.contains(className);
|
5354 | },
|
5355 | removeClass: function removeClass(className) {
|
5356 | _this.root.classList.remove(className);
|
5357 | },
|
5358 | removeAttribute: function removeAttribute(attributeName) {
|
5359 | _this.root.removeAttribute(attributeName);
|
5360 | },
|
5361 | setAttribute: function setAttribute(attributeName, value) {
|
5362 | _this.root.setAttribute(attributeName, value);
|
5363 | },
|
5364 | setDeterminateCircleAttribute: function setDeterminateCircleAttribute(attributeName, value) {
|
5365 | _this.determinateCircle.setAttribute(attributeName, value);
|
5366 | }
|
5367 | };
|
5368 | return new foundation_1.MDCCircularProgressFoundation(adapter);
|
5369 | };
|
5370 | return MDCCircularProgress;
|
5371 | }(component_1.MDCComponent);
|
5372 | exports.MDCCircularProgress = MDCCircularProgress;
|
5373 |
|
5374 | }),
|
5375 |
|
5376 | "./packages/mdc-circular-progress/constants.ts":
|
5377 |
|
5378 |
|
5379 |
|
5380 |
|
5381 | (function(module, exports, __webpack_require__) {
|
5382 |
|
5383 | "use strict";
|
5384 |
|
5385 |
|
5386 |
|
5387 |
|
5388 |
|
5389 |
|
5390 |
|
5391 |
|
5392 |
|
5393 |
|
5394 |
|
5395 |
|
5396 |
|
5397 |
|
5398 |
|
5399 |
|
5400 |
|
5401 |
|
5402 |
|
5403 |
|
5404 |
|
5405 |
|
5406 |
|
5407 |
|
5408 | Object.defineProperty(exports, "__esModule", { value: true });
|
5409 | exports.strings = exports.cssClasses = void 0;
|
5410 |
|
5411 |
|
5412 |
|
5413 | exports.cssClasses = {
|
5414 | INDETERMINATE_CLASS: 'mdc-circular-progress--indeterminate',
|
5415 | CLOSED_CLASS: 'mdc-circular-progress--closed'
|
5416 | };
|
5417 |
|
5418 |
|
5419 |
|
5420 | exports.strings = {
|
5421 | ARIA_HIDDEN: 'aria-hidden',
|
5422 | ARIA_VALUENOW: 'aria-valuenow',
|
5423 | DETERMINATE_CIRCLE_SELECTOR: '.mdc-circular-progress__determinate-circle',
|
5424 | RADIUS: 'r',
|
5425 | STROKE_DASHOFFSET: 'stroke-dashoffset'
|
5426 | };
|
5427 |
|
5428 | }),
|
5429 |
|
5430 | "./packages/mdc-circular-progress/foundation.ts":
|
5431 |
|
5432 |
|
5433 |
|
5434 |
|
5435 | (function(module, exports, __webpack_require__) {
|
5436 |
|
5437 | "use strict";
|
5438 |
|
5439 |
|
5440 |
|
5441 |
|
5442 |
|
5443 |
|
5444 |
|
5445 |
|
5446 |
|
5447 |
|
5448 |
|
5449 |
|
5450 |
|
5451 |
|
5452 |
|
5453 |
|
5454 |
|
5455 |
|
5456 |
|
5457 |
|
5458 |
|
5459 |
|
5460 |
|
5461 |
|
5462 | var __extends = this && this.__extends || function () {
|
5463 | var _extendStatics = function extendStatics(d, b) {
|
5464 | _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
|
5465 | d.__proto__ = b;
|
5466 | } || function (d, b) {
|
5467 | for (var p in b) {
|
5468 | if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
5469 | }
|
5470 | };
|
5471 | return _extendStatics(d, b);
|
5472 | };
|
5473 | return function (d, b) {
|
5474 | if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
5475 | _extendStatics(d, b);
|
5476 | function __() {
|
5477 | this.constructor = d;
|
5478 | }
|
5479 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
5480 | };
|
5481 | }();
|
5482 | var __assign = this && this.__assign || function () {
|
5483 | __assign = Object.assign || function (t) {
|
5484 | for (var s, i = 1, n = arguments.length; i < n; i++) {
|
5485 | s = arguments[i];
|
5486 | for (var p in s) {
|
5487 | if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
5488 | }
|
5489 | }
|
5490 | return t;
|
5491 | };
|
5492 | return __assign.apply(this, arguments);
|
5493 | };
|
5494 | Object.defineProperty(exports, "__esModule", { value: true });
|
5495 | exports.MDCCircularProgressFoundation = void 0;
|
5496 | var foundation_1 = __webpack_require__( "./packages/mdc-base/foundation.ts");
|
5497 | var constants_1 = __webpack_require__( "./packages/mdc-circular-progress/constants.ts");
|
5498 | var MDCCircularProgressFoundation = function (_super) {
|
5499 | __extends(MDCCircularProgressFoundation, _super);
|
5500 | function MDCCircularProgressFoundation(adapter) {
|
5501 | return _super.call(this, __assign(__assign({}, MDCCircularProgressFoundation.defaultAdapter), adapter)) || this;
|
5502 | }
|
5503 | Object.defineProperty(MDCCircularProgressFoundation, "cssClasses", {
|
5504 | get: function get() {
|
5505 | return constants_1.cssClasses;
|
5506 | },
|
5507 | enumerable: false,
|
5508 | configurable: true
|
5509 | });
|
5510 | Object.defineProperty(MDCCircularProgressFoundation, "strings", {
|
5511 | get: function get() {
|
5512 | return constants_1.strings;
|
5513 | },
|
5514 | enumerable: false,
|
5515 | configurable: true
|
5516 | });
|
5517 | Object.defineProperty(MDCCircularProgressFoundation, "defaultAdapter", {
|
5518 | get: function get() {
|
5519 | return {
|
5520 | addClass: function addClass() {
|
5521 | return undefined;
|
5522 | },
|
5523 | getDeterminateCircleAttribute: function getDeterminateCircleAttribute() {
|
5524 | return null;
|
5525 | },
|
5526 | hasClass: function hasClass() {
|
5527 | return false;
|
5528 | },
|
5529 | removeClass: function removeClass() {
|
5530 | return undefined;
|
5531 | },
|
5532 | removeAttribute: function removeAttribute() {
|
5533 | return undefined;
|
5534 | },
|
5535 | setAttribute: function setAttribute() {
|
5536 | return undefined;
|
5537 | },
|
5538 | setDeterminateCircleAttribute: function setDeterminateCircleAttribute() {
|
5539 | return undefined;
|
5540 | }
|
5541 | };
|
5542 | },
|
5543 | enumerable: false,
|
5544 | configurable: true
|
5545 | });
|
5546 | MDCCircularProgressFoundation.prototype.init = function () {
|
5547 | this.closed = this.adapter.hasClass(constants_1.cssClasses.CLOSED_CLASS);
|
5548 | this.determinate = !this.adapter.hasClass(constants_1.cssClasses.INDETERMINATE_CLASS);
|
5549 | this.progress = 0;
|
5550 | if (this.determinate) {
|
5551 | this.adapter.setAttribute(constants_1.strings.ARIA_VALUENOW, this.progress.toString());
|
5552 | }
|
5553 | this.radius = Number(this.adapter.getDeterminateCircleAttribute(constants_1.strings.RADIUS));
|
5554 | };
|
5555 | |
5556 |
|
5557 |
|
5558 |
|
5559 | MDCCircularProgressFoundation.prototype.setDeterminate = function (determinate) {
|
5560 | this.determinate = determinate;
|
5561 | if (this.determinate) {
|
5562 | this.adapter.removeClass(constants_1.cssClasses.INDETERMINATE_CLASS);
|
5563 | this.setProgress(this.progress);
|
5564 | } else {
|
5565 | this.adapter.addClass(constants_1.cssClasses.INDETERMINATE_CLASS);
|
5566 | this.adapter.removeAttribute(constants_1.strings.ARIA_VALUENOW);
|
5567 | }
|
5568 | };
|
5569 | MDCCircularProgressFoundation.prototype.isDeterminate = function () {
|
5570 | return this.determinate;
|
5571 | };
|
5572 | |
5573 |
|
5574 |
|
5575 |
|
5576 |
|
5577 |
|
5578 | MDCCircularProgressFoundation.prototype.setProgress = function (value) {
|
5579 | this.progress = value;
|
5580 | if (this.determinate) {
|
5581 | var unfilledArcLength = (1 - this.progress) * (2 * Math.PI * this.radius);
|
5582 | this.adapter.setDeterminateCircleAttribute(constants_1.strings.STROKE_DASHOFFSET, "" + unfilledArcLength);
|
5583 | this.adapter.setAttribute(constants_1.strings.ARIA_VALUENOW, this.progress.toString());
|
5584 | }
|
5585 | };
|
5586 | MDCCircularProgressFoundation.prototype.getProgress = function () {
|
5587 | return this.progress;
|
5588 | };
|
5589 | |
5590 |
|
5591 |
|
5592 | MDCCircularProgressFoundation.prototype.open = function () {
|
5593 | this.closed = false;
|
5594 | this.adapter.removeClass(constants_1.cssClasses.CLOSED_CLASS);
|
5595 | this.adapter.removeAttribute(constants_1.strings.ARIA_HIDDEN);
|
5596 | };
|
5597 | |
5598 |
|
5599 |
|
5600 | MDCCircularProgressFoundation.prototype.close = function () {
|
5601 | this.closed = true;
|
5602 | this.adapter.addClass(constants_1.cssClasses.CLOSED_CLASS);
|
5603 | this.adapter.setAttribute(constants_1.strings.ARIA_HIDDEN, 'true');
|
5604 | };
|
5605 | |
5606 |
|
5607 |
|
5608 | MDCCircularProgressFoundation.prototype.isClosed = function () {
|
5609 | return this.closed;
|
5610 | };
|
5611 | return MDCCircularProgressFoundation;
|
5612 | }(foundation_1.MDCFoundation);
|
5613 | exports.MDCCircularProgressFoundation = MDCCircularProgressFoundation;
|
5614 |
|
5615 | exports.default = MDCCircularProgressFoundation;
|
5616 |
|
5617 | }),
|
5618 |
|
5619 | "./packages/mdc-circular-progress/index.ts":
|
5620 |
|
5621 |
|
5622 |
|
5623 |
|
5624 | (function(module, exports, __webpack_require__) {
|
5625 |
|
5626 | "use strict";
|
5627 |
|
5628 |
|
5629 |
|
5630 |
|
5631 |
|
5632 |
|
5633 |
|
5634 |
|
5635 |
|
5636 |
|
5637 |
|
5638 |
|
5639 |
|
5640 |
|
5641 |
|
5642 |
|
5643 |
|
5644 |
|
5645 |
|
5646 |
|
5647 |
|
5648 |
|
5649 |
|
5650 |
|
5651 | var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
|
5652 | if (k2 === undefined) k2 = k;
|
5653 | Object.defineProperty(o, k2, { enumerable: true, get: function get() {
|
5654 | return m[k];
|
5655 | } });
|
5656 | } : function (o, m, k, k2) {
|
5657 | if (k2 === undefined) k2 = k;
|
5658 | o[k2] = m[k];
|
5659 | });
|
5660 | var __exportStar = this && this.__exportStar || function (m, exports) {
|
5661 | for (var p in m) {
|
5662 | if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
5663 | }
|
5664 | };
|
5665 | Object.defineProperty(exports, "__esModule", { value: true });
|
5666 | __exportStar(__webpack_require__( "./packages/mdc-circular-progress/adapter.ts"), exports);
|
5667 | __exportStar(__webpack_require__( "./packages/mdc-circular-progress/component.ts"), exports);
|
5668 | __exportStar(__webpack_require__( "./packages/mdc-circular-progress/constants.ts"), exports);
|
5669 | __exportStar(__webpack_require__( "./packages/mdc-circular-progress/foundation.ts"), exports);
|
5670 |
|
5671 | }),
|
5672 |
|
5673 | "./packages/mdc-data-table/adapter.ts":
|
5674 |
|
5675 |
|
5676 |
|
5677 |
|
5678 | (function(module, exports, __webpack_require__) {
|
5679 |
|
5680 | "use strict";
|
5681 |
|
5682 |
|
5683 |
|
5684 |
|
5685 |
|
5686 |
|
5687 |
|
5688 |
|
5689 |
|
5690 |
|
5691 |
|
5692 |
|
5693 |
|
5694 |
|
5695 |
|
5696 |
|
5697 |
|
5698 |
|
5699 |
|
5700 |
|
5701 |
|
5702 |
|
5703 |
|
5704 |
|
5705 | Object.defineProperty(exports, "__esModule", { value: true });
|
5706 |
|
5707 | }),
|
5708 |
|
5709 | "./packages/mdc-data-table/component.ts":
|
5710 |
|
5711 |
|
5712 |
|
5713 |
|
5714 | (function(module, exports, __webpack_require__) {
|
5715 |
|
5716 | "use strict";
|
5717 |
|
5718 |
|
5719 |
|
5720 |
|
5721 |
|
5722 |
|
5723 |
|
5724 |
|
5725 |
|
5726 |
|
5727 |
|
5728 |
|
5729 |
|
5730 |
|
5731 |
|
5732 |
|
5733 |
|
5734 |
|
5735 |
|
5736 |
|
5737 |
|
5738 |
|
5739 |
|
5740 |
|
5741 | var __extends = this && this.__extends || function () {
|
5742 | var _extendStatics = function extendStatics(d, b) {
|
5743 | _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
|
5744 | d.__proto__ = b;
|
5745 | } || function (d, b) {
|
5746 | for (var p in b) {
|
5747 | if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
5748 | }
|
5749 | };
|
5750 | return _extendStatics(d, b);
|
5751 | };
|
5752 | return function (d, b) {
|
5753 | if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
5754 | _extendStatics(d, b);
|
5755 | function __() {
|
5756 | this.constructor = d;
|
5757 | }
|
5758 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
5759 | };
|
5760 | }();
|
5761 | var __values = this && this.__values || function (o) {
|
5762 | var s = typeof Symbol === "function" && Symbol.iterator,
|
5763 | m = s && o[s],
|
5764 | i = 0;
|
5765 | if (m) return m.call(o);
|
5766 | if (o && typeof o.length === "number") return {
|
5767 | next: function next() {
|
5768 | if (o && i >= o.length) o = void 0;
|
5769 | return { value: o && o[i++], done: !o };
|
5770 | }
|
5771 | };
|
5772 | throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
5773 | };
|
5774 | Object.defineProperty(exports, "__esModule", { value: true });
|
5775 | exports.MDCDataTable = void 0;
|
5776 | var component_1 = __webpack_require__( "./packages/mdc-base/component.ts");
|
5777 | var component_2 = __webpack_require__( "./packages/mdc-checkbox/component.ts");
|
5778 | var ponyfill_1 = __webpack_require__( "./packages/mdc-dom/ponyfill.ts");
|
5779 | var component_3 = __webpack_require__( "./packages/mdc-linear-progress/component.ts");
|
5780 | var constants_1 = __webpack_require__( "./packages/mdc-data-table/constants.ts");
|
5781 | var foundation_1 = __webpack_require__( "./packages/mdc-data-table/foundation.ts");
|
5782 |
|
5783 |
|
5784 |
|
5785 | var MDCDataTable = function (_super) {
|
5786 | __extends(MDCDataTable, _super);
|
5787 | function MDCDataTable() {
|
5788 | return _super !== null && _super.apply(this, arguments) || this;
|
5789 | }
|
5790 | MDCDataTable.attachTo = function (root) {
|
5791 | return new MDCDataTable(root);
|
5792 | };
|
5793 | MDCDataTable.prototype.initialize = function (checkboxFactory) {
|
5794 | if (checkboxFactory === void 0) {
|
5795 | checkboxFactory = function checkboxFactory(el) {
|
5796 | return new component_2.MDCCheckbox(el);
|
5797 | };
|
5798 | }
|
5799 | this.checkboxFactory = checkboxFactory;
|
5800 | };
|
5801 | MDCDataTable.prototype.initialSyncWithDOM = function () {
|
5802 | var _this = this;
|
5803 | this.headerRow = this.root.querySelector("." + constants_1.cssClasses.HEADER_ROW);
|
5804 | this.handleHeaderRowCheckboxChange = function () {
|
5805 | _this.foundation.handleHeaderRowCheckboxChange();
|
5806 | };
|
5807 | this.headerRow.addEventListener('change', this.handleHeaderRowCheckboxChange);
|
5808 | this.headerRowClickListener = function (event) {
|
5809 | _this.handleHeaderRowClick(event);
|
5810 | };
|
5811 | this.headerRow.addEventListener('click', this.headerRowClickListener);
|
5812 | this.content = this.root.querySelector("." + constants_1.cssClasses.CONTENT);
|
5813 | this.handleContentClick = function (event) {
|
5814 | var dataRowEl = ponyfill_1.closest(event.target, constants_1.selectors.ROW);
|
5815 | if (!dataRowEl) return;
|
5816 | _this.foundation.handleRowClick({
|
5817 | rowId: _this.getRowIdByRowElement(dataRowEl),
|
5818 | row: dataRowEl
|
5819 | });
|
5820 | };
|
5821 | this.content.addEventListener('click', this.handleContentClick);
|
5822 | this.handleRowCheckboxChange = function (event) {
|
5823 | _this.foundation.handleRowCheckboxChange(event);
|
5824 | };
|
5825 | this.content.addEventListener('change', this.handleRowCheckboxChange);
|
5826 | this.layout();
|
5827 | };
|
5828 | |
5829 |
|
5830 |
|
5831 |
|
5832 | MDCDataTable.prototype.layout = function () {
|
5833 | this.foundation.layout();
|
5834 | };
|
5835 | |
5836 |
|
5837 |
|
5838 | MDCDataTable.prototype.getHeaderCells = function () {
|
5839 | return [].slice.call(this.root.querySelectorAll(constants_1.selectors.HEADER_CELL));
|
5840 | };
|
5841 | |
5842 |
|
5843 |
|
5844 | MDCDataTable.prototype.getRows = function () {
|
5845 | return this.foundation.getRows();
|
5846 | };
|
5847 | |
5848 |
|
5849 |
|
5850 | MDCDataTable.prototype.getSelectedRowIds = function () {
|
5851 | return this.foundation.getSelectedRowIds();
|
5852 | };
|
5853 | |
5854 |
|
5855 |
|
5856 |
|
5857 | MDCDataTable.prototype.setSelectedRowIds = function (rowIds) {
|
5858 | this.foundation.setSelectedRowIds(rowIds);
|
5859 | };
|
5860 | |
5861 |
|
5862 |
|
5863 | MDCDataTable.prototype.showProgress = function () {
|
5864 | this.getLinearProgress().open();
|
5865 | this.foundation.showProgress();
|
5866 | };
|
5867 | |
5868 |
|
5869 |
|
5870 | MDCDataTable.prototype.hideProgress = function () {
|
5871 | this.foundation.hideProgress();
|
5872 | this.getLinearProgress().close();
|
5873 | };
|
5874 | MDCDataTable.prototype.destroy = function () {
|
5875 | var e_1, _a;
|
5876 | if (this.handleHeaderRowCheckboxChange) {
|
5877 | this.headerRow.removeEventListener('change', this.handleHeaderRowCheckboxChange);
|
5878 | }
|
5879 | if (this.headerRowClickListener) {
|
5880 | this.headerRow.removeEventListener('click', this.headerRowClickListener);
|
5881 | }
|
5882 | if (this.handleRowCheckboxChange) {
|
5883 | this.content.removeEventListener('change', this.handleRowCheckboxChange);
|
5884 | }
|
5885 | if (this.headerRowCheckbox) {
|
5886 | this.headerRowCheckbox.destroy();
|
5887 | }
|
5888 | if (this.rowCheckboxList) {
|
5889 | try {
|
5890 | for (var _b = __values(this.rowCheckboxList), _c = _b.next(); !_c.done; _c = _b.next()) {
|
5891 | var checkbox = _c.value;
|
5892 | checkbox.destroy();
|
5893 | }
|
5894 | } catch (e_1_1) {
|
5895 | e_1 = { error: e_1_1 };
|
5896 | } finally {
|
5897 | try {
|
5898 | if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
5899 | } finally {
|
5900 | if (e_1) throw e_1.error;
|
5901 | }
|
5902 | }
|
5903 | }
|
5904 | if (this.handleContentClick) {
|
5905 | this.content.removeEventListener('click', this.handleContentClick);
|
5906 | }
|
5907 | };
|
5908 | MDCDataTable.prototype.getDefaultFoundation = function () {
|
5909 | var _this = this;
|
5910 |
|
5911 |
|
5912 |
|
5913 |
|
5914 | var adapter = {
|
5915 | addClass: function addClass(className) {
|
5916 | _this.root.classList.add(className);
|
5917 | },
|
5918 | removeClass: function removeClass(className) {
|
5919 | _this.root.classList.remove(className);
|
5920 | },
|
5921 | getHeaderCellElements: function getHeaderCellElements() {
|
5922 | return _this.getHeaderCells();
|
5923 | },
|
5924 | getHeaderCellCount: function getHeaderCellCount() {
|
5925 | return _this.getHeaderCells().length;
|
5926 | },
|
5927 | getAttributeByHeaderCellIndex: function getAttributeByHeaderCellIndex(index, attribute) {
|
5928 | return _this.getHeaderCells()[index].getAttribute(attribute);
|
5929 | },
|
5930 | setAttributeByHeaderCellIndex: function setAttributeByHeaderCellIndex(index, attribute, value) {
|
5931 | _this.getHeaderCells()[index].setAttribute(attribute, value);
|
5932 | },
|
5933 | setClassNameByHeaderCellIndex: function setClassNameByHeaderCellIndex(index, className) {
|
5934 | _this.getHeaderCells()[index].classList.add(className);
|
5935 | },
|
5936 | removeClassNameByHeaderCellIndex: function removeClassNameByHeaderCellIndex(index, className) {
|
5937 | _this.getHeaderCells()[index].classList.remove(className);
|
5938 | },
|
5939 | notifySortAction: function notifySortAction(data) {
|
5940 | _this.emit(constants_1.events.SORTED, data, true);
|
5941 | },
|
5942 | getTableContainerHeight: function getTableContainerHeight() {
|
5943 | var tableContainer = _this.root.querySelector("." + constants_1.cssClasses.TABLE_CONTAINER);
|
5944 | if (!tableContainer) {
|
5945 | throw new Error('MDCDataTable: Table container element not found.');
|
5946 | }
|
5947 | return tableContainer.getBoundingClientRect().height;
|
5948 | },
|
5949 | getTableHeaderHeight: function getTableHeaderHeight() {
|
5950 | var tableHeader = _this.root.querySelector(constants_1.selectors.HEADER_ROW);
|
5951 | if (!tableHeader) {
|
5952 | throw new Error('MDCDataTable: Table header element not found.');
|
5953 | }
|
5954 | return tableHeader.getBoundingClientRect().height;
|
5955 | },
|
5956 | setProgressIndicatorStyles: function setProgressIndicatorStyles(styles) {
|
5957 | var progressIndicator = _this.root.querySelector(constants_1.selectors.PROGRESS_INDICATOR);
|
5958 | if (!progressIndicator) {
|
5959 | throw new Error('MDCDataTable: Progress indicator element not found.');
|
5960 | }
|
5961 | progressIndicator.style.setProperty('height', styles.height);
|
5962 | progressIndicator.style.setProperty('top', styles.top);
|
5963 | },
|
5964 | addClassAtRowIndex: function addClassAtRowIndex(rowIndex, className) {
|
5965 | _this.getRows()[rowIndex].classList.add(className);
|
5966 | },
|
5967 | getRowCount: function getRowCount() {
|
5968 | return _this.getRows().length;
|
5969 | },
|
5970 | getRowElements: function getRowElements() {
|
5971 | return [].slice.call(_this.root.querySelectorAll(constants_1.selectors.ROW));
|
5972 | },
|
5973 | getRowIdAtIndex: function getRowIdAtIndex(rowIndex) {
|
5974 | return _this.getRows()[rowIndex].getAttribute(constants_1.dataAttributes.ROW_ID);
|
5975 | },
|
5976 | getRowIndexByChildElement: function getRowIndexByChildElement(el) {
|
5977 | return _this.getRows().indexOf(ponyfill_1.closest(el, constants_1.selectors.ROW));
|
5978 | },
|
5979 | getSelectedRowCount: function getSelectedRowCount() {
|
5980 | return _this.root.querySelectorAll(constants_1.selectors.ROW_SELECTED).length;
|
5981 | },
|
5982 | isCheckboxAtRowIndexChecked: function isCheckboxAtRowIndexChecked(rowIndex) {
|
5983 | return _this.rowCheckboxList[rowIndex].checked;
|
5984 | },
|
5985 | isHeaderRowCheckboxChecked: function isHeaderRowCheckboxChecked() {
|
5986 | return _this.headerRowCheckbox.checked;
|
5987 | },
|
5988 | isRowsSelectable: function isRowsSelectable() {
|
5989 | return !!_this.root.querySelector(constants_1.selectors.ROW_CHECKBOX) || !!_this.root.querySelector(constants_1.selectors.HEADER_ROW_CHECKBOX);
|
5990 | },
|
5991 | notifyRowSelectionChanged: function notifyRowSelectionChanged(data) {
|
5992 | _this.emit(constants_1.events.ROW_SELECTION_CHANGED, {
|
5993 | row: _this.getRowByIndex(data.rowIndex),
|
5994 | rowId: _this.getRowIdByIndex(data.rowIndex),
|
5995 | rowIndex: data.rowIndex,
|
5996 | selected: data.selected
|
5997 | },
|
5998 | true);
|
5999 | },
|
6000 | notifySelectedAll: function notifySelectedAll() {
|
6001 | _this.emit(constants_1.events.SELECTED_ALL, {}, true);
|
6002 | },
|
6003 | notifyUnselectedAll: function notifyUnselectedAll() {
|
6004 | _this.emit(constants_1.events.UNSELECTED_ALL, {}, true);
|
6005 | },
|
6006 | notifyRowClick: function notifyRowClick(data) {
|
6007 | _this.emit(constants_1.events.ROW_CLICK, data, true);
|
6008 | },
|
6009 | registerHeaderRowCheckbox: function registerHeaderRowCheckbox() {
|
6010 | if (_this.headerRowCheckbox) {
|
6011 | _this.headerRowCheckbox.destroy();
|
6012 | }
|
6013 | var checkboxEl = _this.root.querySelector(constants_1.selectors.HEADER_ROW_CHECKBOX);
|
6014 | _this.headerRowCheckbox = _this.checkboxFactory(checkboxEl);
|
6015 | },
|
6016 | registerRowCheckboxes: function registerRowCheckboxes() {
|
6017 | if (_this.rowCheckboxList) {
|
6018 | _this.rowCheckboxList.forEach(function (checkbox) {
|
6019 | checkbox.destroy();
|
6020 | });
|
6021 | }
|
6022 | _this.rowCheckboxList = [];
|
6023 | _this.getRows().forEach(function (rowEl) {
|
6024 | var checkbox = _this.checkboxFactory(rowEl.querySelector(constants_1.selectors.ROW_CHECKBOX));
|
6025 | _this.rowCheckboxList.push(checkbox);
|
6026 | });
|
6027 | },
|
6028 | removeClassAtRowIndex: function removeClassAtRowIndex(rowIndex, className) {
|
6029 | _this.getRows()[rowIndex].classList.remove(className);
|
6030 | },
|
6031 | setAttributeAtRowIndex: function setAttributeAtRowIndex(rowIndex, attr, value) {
|
6032 | _this.getRows()[rowIndex].setAttribute(attr, value);
|
6033 | },
|
6034 | setHeaderRowCheckboxChecked: function setHeaderRowCheckboxChecked(checked) {
|
6035 | _this.headerRowCheckbox.checked = checked;
|
6036 | },
|
6037 | setHeaderRowCheckboxIndeterminate: function setHeaderRowCheckboxIndeterminate(indeterminate) {
|
6038 | _this.headerRowCheckbox.indeterminate = indeterminate;
|
6039 | },
|
6040 | setRowCheckboxCheckedAtIndex: function setRowCheckboxCheckedAtIndex(rowIndex, checked) {
|
6041 | _this.rowCheckboxList[rowIndex].checked = checked;
|
6042 | },
|
6043 | setSortStatusLabelByHeaderCellIndex: function setSortStatusLabelByHeaderCellIndex(columnIndex, sortValue) {
|
6044 | var headerCell = _this.getHeaderCells()[columnIndex];
|
6045 | var sortStatusLabel = headerCell.querySelector(constants_1.selectors.SORT_STATUS_LABEL);
|
6046 | if (!sortStatusLabel) return;
|
6047 | sortStatusLabel.textContent = _this.getSortStatusMessageBySortValue(sortValue);
|
6048 | }
|
6049 | };
|
6050 | return new foundation_1.MDCDataTableFoundation(adapter);
|
6051 | };
|
6052 | MDCDataTable.prototype.getRowByIndex = function (index) {
|
6053 | return this.getRows()[index];
|
6054 | };
|
6055 | MDCDataTable.prototype.getRowIdByIndex = function (index) {
|
6056 | return this.getRowByIndex(index).getAttribute(constants_1.dataAttributes.ROW_ID);
|
6057 | };
|
6058 | MDCDataTable.prototype.handleHeaderRowClick = function (event) {
|
6059 | var headerCell = ponyfill_1.closest(event.target, constants_1.selectors.HEADER_CELL_WITH_SORT);
|
6060 | if (!headerCell) {
|
6061 | return;
|
6062 | }
|
6063 | var columnId = headerCell.getAttribute(constants_1.dataAttributes.COLUMN_ID);
|
6064 | var columnIndex = this.getHeaderCells().indexOf(headerCell);
|
6065 | if (columnIndex === -1) {
|
6066 | return;
|
6067 | }
|
6068 | this.foundation.handleSortAction({ columnId: columnId, columnIndex: columnIndex, headerCell: headerCell });
|
6069 | };
|
6070 | MDCDataTable.prototype.getSortStatusMessageBySortValue = function (sortValue) {
|
6071 | switch (sortValue) {
|
6072 | case constants_1.SortValue.ASCENDING:
|
6073 | return constants_1.messages.SORTED_IN_ASCENDING;
|
6074 | case constants_1.SortValue.DESCENDING:
|
6075 | return constants_1.messages.SORTED_IN_DESCENDING;
|
6076 | default:
|
6077 | return '';
|
6078 | }
|
6079 | };
|
6080 | MDCDataTable.prototype.getLinearProgressElement = function () {
|
6081 | var el = this.root.querySelector("." + constants_1.cssClasses.LINEAR_PROGRESS);
|
6082 | if (!el) {
|
6083 | throw new Error('MDCDataTable: linear progress element is not found.');
|
6084 | }
|
6085 | return el;
|
6086 | };
|
6087 | MDCDataTable.prototype.getLinearProgress = function () {
|
6088 | if (!this.linearProgress) {
|
6089 | var el = this.getLinearProgressElement();
|
6090 | this.linearProgress = new component_3.MDCLinearProgress(el);
|
6091 | }
|
6092 | return this.linearProgress;
|
6093 | };
|
6094 | MDCDataTable.prototype.getRowIdByRowElement = function (rowElement) {
|
6095 | return rowElement.getAttribute(constants_1.dataAttributes.ROW_ID);
|
6096 | };
|
6097 | return MDCDataTable;
|
6098 | }(component_1.MDCComponent);
|
6099 | exports.MDCDataTable = MDCDataTable;
|
6100 |
|
6101 | }),
|
6102 |
|
6103 | "./packages/mdc-data-table/constants.ts":
|
6104 |
|
6105 |
|
6106 |
|
6107 |
|
6108 | (function(module, exports, __webpack_require__) {
|
6109 |
|
6110 | "use strict";
|
6111 |
|
6112 |
|
6113 |
|
6114 |
|
6115 |
|
6116 |
|
6117 |
|
6118 |
|
6119 |
|
6120 |
|
6121 |
|
6122 |
|
6123 |
|
6124 |
|
6125 |
|
6126 |
|
6127 |
|
6128 |
|
6129 |
|
6130 |
|
6131 |
|
6132 |
|
6133 |
|
6134 |
|
6135 | Object.defineProperty(exports, "__esModule", { value: true });
|
6136 | exports.events = exports.SortValue = exports.strings = exports.messages = exports.selectors = exports.dataAttributes = exports.attributes = exports.cssClasses = void 0;
|
6137 |
|
6138 |
|
6139 |
|
6140 | exports.cssClasses = {
|
6141 | CELL: 'mdc-data-table__cell',
|
6142 | CELL_NUMERIC: 'mdc-data-table__cell--numeric',
|
6143 | CONTENT: 'mdc-data-table__content',
|
6144 | HEADER_CELL: 'mdc-data-table__header-cell',
|
6145 | HEADER_CELL_LABEL: 'mdc-data-table__header-cell-label',
|
6146 | HEADER_CELL_SORTED: 'mdc-data-table__header-cell--sorted',
|
6147 | HEADER_CELL_SORTED_DESCENDING: 'mdc-data-table__header-cell--sorted-descending',
|
6148 | HEADER_CELL_WITH_SORT: 'mdc-data-table__header-cell--with-sort',
|
6149 | HEADER_CELL_WRAPPER: 'mdc-data-table__header-cell-wrapper',
|
6150 | HEADER_ROW: 'mdc-data-table__header-row',
|
6151 | HEADER_ROW_CHECKBOX: 'mdc-data-table__header-row-checkbox',
|
6152 | IN_PROGRESS: 'mdc-data-table--in-progress',
|
6153 | LINEAR_PROGRESS: 'mdc-data-table__linear-progress',
|
6154 | PAGINATION_ROWS_PER_PAGE_LABEL: 'mdc-data-table__pagination-rows-per-page-label',
|
6155 | PAGINATION_ROWS_PER_PAGE_SELECT: 'mdc-data-table__pagination-rows-per-page-select',
|
6156 | PROGRESS_INDICATOR: 'mdc-data-table__progress-indicator',
|
6157 | ROOT: 'mdc-data-table',
|
6158 | ROW: 'mdc-data-table__row',
|
6159 | ROW_CHECKBOX: 'mdc-data-table__row-checkbox',
|
6160 | ROW_SELECTED: 'mdc-data-table__row--selected',
|
6161 | SORT_ICON_BUTTON: 'mdc-data-table__sort-icon-button',
|
6162 | SORT_STATUS_LABEL: 'mdc-data-table__sort-status-label',
|
6163 | TABLE_CONTAINER: 'mdc-data-table__table-container'
|
6164 | };
|
6165 |
|
6166 |
|
6167 |
|
6168 | exports.attributes = {
|
6169 | ARIA_SELECTED: 'aria-selected',
|
6170 | ARIA_SORT: 'aria-sort'
|
6171 | };
|
6172 |
|
6173 |
|
6174 |
|
6175 | exports.dataAttributes = {
|
6176 | COLUMN_ID: 'data-column-id',
|
6177 | ROW_ID: 'data-row-id'
|
6178 | };
|
6179 |
|
6180 |
|
6181 |
|
6182 | exports.selectors = {
|
6183 | CONTENT: "." + exports.cssClasses.CONTENT,
|
6184 | HEADER_CELL: "." + exports.cssClasses.HEADER_CELL,
|
6185 | HEADER_CELL_WITH_SORT: "." + exports.cssClasses.HEADER_CELL_WITH_SORT,
|
6186 | HEADER_ROW: "." + exports.cssClasses.HEADER_ROW,
|
6187 | HEADER_ROW_CHECKBOX: "." + exports.cssClasses.HEADER_ROW_CHECKBOX,
|
6188 | PROGRESS_INDICATOR: "." + exports.cssClasses.PROGRESS_INDICATOR,
|
6189 | ROW: "." + exports.cssClasses.ROW,
|
6190 | ROW_CHECKBOX: "." + exports.cssClasses.ROW_CHECKBOX,
|
6191 | ROW_SELECTED: "." + exports.cssClasses.ROW_SELECTED,
|
6192 | SORT_ICON_BUTTON: "." + exports.cssClasses.SORT_ICON_BUTTON,
|
6193 | SORT_STATUS_LABEL: "." + exports.cssClasses.SORT_STATUS_LABEL
|
6194 | };
|
6195 |
|
6196 |
|
6197 |
|
6198 | exports.messages = {
|
6199 | SORTED_IN_DESCENDING: 'Sorted in descending order',
|
6200 | SORTED_IN_ASCENDING: 'Sorted in ascending order'
|
6201 | };
|
6202 |
|
6203 |
|
6204 |
|
6205 |
|
6206 | exports.strings = {
|
6207 | ARIA_SELECTED: exports.attributes.ARIA_SELECTED,
|
6208 | ARIA_SORT: exports.attributes.ARIA_SORT,
|
6209 | DATA_ROW_ID_ATTR: exports.dataAttributes.ROW_ID,
|
6210 | HEADER_ROW_CHECKBOX_SELECTOR: exports.selectors.HEADER_ROW_CHECKBOX,
|
6211 | ROW_CHECKBOX_SELECTOR: exports.selectors.ROW_CHECKBOX,
|
6212 | ROW_SELECTED_SELECTOR: exports.selectors.ROW_SELECTED,
|
6213 | ROW_SELECTOR: exports.selectors.ROW
|
6214 | };
|
6215 |
|
6216 |
|
6217 |
|
6218 |
|
6219 | var SortValue;
|
6220 | (function (SortValue) {
|
6221 |
|
6222 | SortValue["ASCENDING"] = "ascending";
|
6223 |
|
6224 | SortValue["DESCENDING"] = "descending";
|
6225 |
|
6226 | SortValue["NONE"] = "none";
|
6227 |
|
6228 | SortValue["OTHER"] = "other";
|
6229 | })(SortValue = exports.SortValue || (exports.SortValue = {}));
|
6230 |
|
6231 |
|
6232 |
|
6233 | exports.events = {
|
6234 | ROW_CLICK: 'MDCDataTable:rowClick',
|
6235 | ROW_SELECTION_CHANGED: 'MDCDataTable:rowSelectionChanged',
|
6236 | SELECTED_ALL: 'MDCDataTable:selectedAll',
|
6237 | SORTED: 'MDCDataTable:sorted',
|
6238 | UNSELECTED_ALL: 'MDCDataTable:unselectedAll'
|
6239 | };
|
6240 |
|
6241 | }),
|
6242 |
|
6243 | "./packages/mdc-data-table/foundation.ts":
|
6244 |
|
6245 |
|
6246 |
|
6247 |
|
6248 | (function(module, exports, __webpack_require__) {
|
6249 |
|
6250 | "use strict";
|
6251 |
|
6252 |
|
6253 |
|
6254 |
|
6255 |
|
6256 |
|
6257 |
|
6258 |
|
6259 |
|
6260 |
|
6261 |
|
6262 |
|
6263 |
|
6264 |
|
6265 |
|
6266 |
|
6267 |
|
6268 |
|
6269 |
|
6270 |
|
6271 |
|
6272 |
|
6273 |
|
6274 |
|
6275 | var __extends = this && this.__extends || function () {
|
6276 | var _extendStatics = function extendStatics(d, b) {
|
6277 | _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
|
6278 | d.__proto__ = b;
|
6279 | } || function (d, b) {
|
6280 | for (var p in b) {
|
6281 | if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
6282 | }
|
6283 | };
|
6284 | return _extendStatics(d, b);
|
6285 | };
|
6286 | return function (d, b) {
|
6287 | if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
6288 | _extendStatics(d, b);
|
6289 | function __() {
|
6290 | this.constructor = d;
|
6291 | }
|
6292 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
6293 | };
|
6294 | }();
|
6295 | var __assign = this && this.__assign || function () {
|
6296 | __assign = Object.assign || function (t) {
|
6297 | for (var s, i = 1, n = arguments.length; i < n; i++) {
|
6298 | s = arguments[i];
|
6299 | for (var p in s) {
|
6300 | if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
6301 | }
|
6302 | }
|
6303 | return t;
|
6304 | };
|
6305 | return __assign.apply(this, arguments);
|
6306 | };
|
6307 | var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {
|
6308 | function adopt(value) {
|
6309 | return value instanceof P ? value : new P(function (resolve) {
|
6310 | resolve(value);
|
6311 | });
|
6312 | }
|
6313 | return new (P || (P = Promise))(function (resolve, reject) {
|
6314 | function fulfilled(value) {
|
6315 | try {
|
6316 | step(generator.next(value));
|
6317 | } catch (e) {
|
6318 | reject(e);
|
6319 | }
|
6320 | }
|
6321 | function rejected(value) {
|
6322 | try {
|
6323 | step(generator["throw"](value));
|
6324 | } catch (e) {
|
6325 | reject(e);
|
6326 | }
|
6327 | }
|
6328 | function step(result) {
|
6329 | result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
6330 | }
|
6331 | step((generator = generator.apply(thisArg, _arguments || [])).next());
|
6332 | });
|
6333 | };
|
6334 | var __generator = this && this.__generator || function (thisArg, body) {
|
6335 | var _ = { label: 0, sent: function sent() {
|
6336 | if (t[0] & 1) throw t[1];return t[1];
|
6337 | }, trys: [], ops: [] },
|
6338 | f,
|
6339 | y,
|
6340 | t,
|
6341 | g;
|
6342 | return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
|
6343 | return this;
|
6344 | }), g;
|
6345 | function verb(n) {
|
6346 | return function (v) {
|
6347 | return step([n, v]);
|
6348 | };
|
6349 | }
|
6350 | function step(op) {
|
6351 | if (f) throw new TypeError("Generator is already executing.");
|
6352 | while (_) {
|
6353 | try {
|
6354 | if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
6355 | if (y = 0, t) op = [op[0] & 2, t.value];
|
6356 | switch (op[0]) {
|
6357 | case 0:case 1:
|
6358 | t = op;break;
|
6359 | case 4:
|
6360 | _.label++;return { value: op[1], done: false };
|
6361 | case 5:
|
6362 | _.label++;y = op[1];op = [0];continue;
|
6363 | case 7:
|
6364 | op = _.ops.pop();_.trys.pop();continue;
|
6365 | default:
|
6366 | if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
6367 | _ = 0;continue;
|
6368 | }
|
6369 | if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
6370 | _.label = op[1];break;
|
6371 | }
|
6372 | if (op[0] === 6 && _.label < t[1]) {
|
6373 | _.label = t[1];t = op;break;
|
6374 | }
|
6375 | if (t && _.label < t[2]) {
|
6376 | _.label = t[2];_.ops.push(op);break;
|
6377 | }
|
6378 | if (t[2]) _.ops.pop();
|
6379 | _.trys.pop();continue;
|
6380 | }
|
6381 | op = body.call(thisArg, _);
|
6382 | } catch (e) {
|
6383 | op = [6, e];y = 0;
|
6384 | } finally {
|
6385 | f = t = 0;
|
6386 | }
|
6387 | }if (op[0] & 5) throw op[1];return { value: op[0] ? op[1] : void 0, done: true };
|
6388 | }
|
6389 | };
|
6390 | Object.defineProperty(exports, "__esModule", { value: true });
|
6391 | exports.MDCDataTableFoundation = void 0;
|
6392 | var foundation_1 = __webpack_require__( "./packages/mdc-base/foundation.ts");
|
6393 | var constants_1 = __webpack_require__( "./packages/mdc-data-table/constants.ts");
|
6394 |
|
6395 |
|
6396 |
|
6397 |
|
6398 | var MDCDataTableFoundation = function (_super) {
|
6399 | __extends(MDCDataTableFoundation, _super);
|
6400 | function MDCDataTableFoundation(adapter) {
|
6401 | return _super.call(this, __assign(__assign({}, MDCDataTableFoundation.defaultAdapter), adapter)) || this;
|
6402 | }
|
6403 | Object.defineProperty(MDCDataTableFoundation, "defaultAdapter", {
|
6404 | get: function get() {
|
6405 | return {
|
6406 | addClass: function addClass() {
|
6407 | return undefined;
|
6408 | },
|
6409 | addClassAtRowIndex: function addClassAtRowIndex() {
|
6410 | return undefined;
|
6411 | },
|
6412 | getAttributeByHeaderCellIndex: function getAttributeByHeaderCellIndex() {
|
6413 | return '';
|
6414 | },
|
6415 | getHeaderCellCount: function getHeaderCellCount() {
|
6416 | return 0;
|
6417 | },
|
6418 | getHeaderCellElements: function getHeaderCellElements() {
|
6419 | return [];
|
6420 | },
|
6421 | getRowCount: function getRowCount() {
|
6422 | return 0;
|
6423 | },
|
6424 | getRowElements: function getRowElements() {
|
6425 | return [];
|
6426 | },
|
6427 | getRowIdAtIndex: function getRowIdAtIndex() {
|
6428 | return '';
|
6429 | },
|
6430 | getRowIndexByChildElement: function getRowIndexByChildElement() {
|
6431 | return 0;
|
6432 | },
|
6433 | getSelectedRowCount: function getSelectedRowCount() {
|
6434 | return 0;
|
6435 | },
|
6436 | getTableContainerHeight: function getTableContainerHeight() {
|
6437 | return 0;
|
6438 | },
|
6439 | getTableHeaderHeight: function getTableHeaderHeight() {
|
6440 | return 0;
|
6441 | },
|
6442 | isCheckboxAtRowIndexChecked: function isCheckboxAtRowIndexChecked() {
|
6443 | return false;
|
6444 | },
|
6445 | isHeaderRowCheckboxChecked: function isHeaderRowCheckboxChecked() {
|
6446 | return false;
|
6447 | },
|
6448 | isRowsSelectable: function isRowsSelectable() {
|
6449 | return false;
|
6450 | },
|
6451 | notifyRowSelectionChanged: function notifyRowSelectionChanged() {
|
6452 | return undefined;
|
6453 | },
|
6454 | notifySelectedAll: function notifySelectedAll() {
|
6455 | return undefined;
|
6456 | },
|
6457 | notifySortAction: function notifySortAction() {
|
6458 | return undefined;
|
6459 | },
|
6460 | notifyUnselectedAll: function notifyUnselectedAll() {
|
6461 | return undefined;
|
6462 | },
|
6463 | notifyRowClick: function notifyRowClick() {
|
6464 | return undefined;
|
6465 | },
|
6466 | registerHeaderRowCheckbox: function registerHeaderRowCheckbox() {
|
6467 | return undefined;
|
6468 | },
|
6469 | registerRowCheckboxes: function registerRowCheckboxes() {
|
6470 | return undefined;
|
6471 | },
|
6472 | removeClass: function removeClass() {
|
6473 | return undefined;
|
6474 | },
|
6475 | removeClassAtRowIndex: function removeClassAtRowIndex() {
|
6476 | return undefined;
|
6477 | },
|
6478 | removeClassNameByHeaderCellIndex: function removeClassNameByHeaderCellIndex() {
|
6479 | return undefined;
|
6480 | },
|
6481 | setAttributeAtRowIndex: function setAttributeAtRowIndex() {
|
6482 | return undefined;
|
6483 | },
|
6484 | setAttributeByHeaderCellIndex: function setAttributeByHeaderCellIndex() {
|
6485 | return undefined;
|
6486 | },
|
6487 | setClassNameByHeaderCellIndex: function setClassNameByHeaderCellIndex() {
|
6488 | return undefined;
|
6489 | },
|
6490 | setHeaderRowCheckboxChecked: function setHeaderRowCheckboxChecked() {
|
6491 | return undefined;
|
6492 | },
|
6493 | setHeaderRowCheckboxIndeterminate: function setHeaderRowCheckboxIndeterminate() {
|
6494 | return undefined;
|
6495 | },
|
6496 | setProgressIndicatorStyles: function setProgressIndicatorStyles() {
|
6497 | return undefined;
|
6498 | },
|
6499 | setRowCheckboxCheckedAtIndex: function setRowCheckboxCheckedAtIndex() {
|
6500 | return undefined;
|
6501 | },
|
6502 | setSortStatusLabelByHeaderCellIndex: function setSortStatusLabelByHeaderCellIndex() {
|
6503 | return undefined;
|
6504 | }
|
6505 | };
|
6506 | },
|
6507 | enumerable: false,
|
6508 | configurable: true
|
6509 | });
|
6510 | |
6511 |
|
6512 |
|
6513 |
|
6514 |
|
6515 | MDCDataTableFoundation.prototype.layout = function () {
|
6516 | if (this.adapter.isRowsSelectable()) {
|
6517 | this.adapter.registerHeaderRowCheckbox();
|
6518 | this.adapter.registerRowCheckboxes();
|
6519 | this.setHeaderRowCheckboxState();
|
6520 | }
|
6521 | };
|
6522 | |
6523 |
|
6524 |
|
6525 |
|
6526 |
|
6527 | MDCDataTableFoundation.prototype.layoutAsync = function () {
|
6528 | return __awaiter(this, void 0, void 0, function () {
|
6529 | return __generator(this, function (_a) {
|
6530 | switch (_a.label) {
|
6531 | case 0:
|
6532 | if (!this.adapter.isRowsSelectable()) return [3 , 3];
|
6533 | return [4 , this.adapter.registerHeaderRowCheckbox()];
|
6534 | case 1:
|
6535 | _a.sent();
|
6536 | return [4 , this.adapter.registerRowCheckboxes()];
|
6537 | case 2:
|
6538 | _a.sent();
|
6539 | this.setHeaderRowCheckboxState();
|
6540 | _a.label = 3;
|
6541 | case 3:
|
6542 | return [2 ];
|
6543 | }
|
6544 | });
|
6545 | });
|
6546 | };
|
6547 | |
6548 |
|
6549 |
|
6550 | MDCDataTableFoundation.prototype.getRows = function () {
|
6551 | return this.adapter.getRowElements();
|
6552 | };
|
6553 | |
6554 |
|
6555 |
|
6556 | MDCDataTableFoundation.prototype.getHeaderCells = function () {
|
6557 | return this.adapter.getHeaderCellElements();
|
6558 | };
|
6559 | |
6560 |
|
6561 |
|
6562 |
|
6563 | MDCDataTableFoundation.prototype.setSelectedRowIds = function (rowIds) {
|
6564 | for (var rowIndex = 0; rowIndex < this.adapter.getRowCount(); rowIndex++) {
|
6565 | var rowId = this.adapter.getRowIdAtIndex(rowIndex);
|
6566 | var isSelected = false;
|
6567 | if (rowId && rowIds.indexOf(rowId) >= 0) {
|
6568 | isSelected = true;
|
6569 | }
|
6570 | this.adapter.setRowCheckboxCheckedAtIndex(rowIndex, isSelected);
|
6571 | this.selectRowAtIndex(rowIndex, isSelected);
|
6572 | }
|
6573 | this.setHeaderRowCheckboxState();
|
6574 | };
|
6575 | |
6576 |
|
6577 |
|
6578 | MDCDataTableFoundation.prototype.getRowIds = function () {
|
6579 | var rowIds = [];
|
6580 | for (var rowIndex = 0; rowIndex < this.adapter.getRowCount(); rowIndex++) {
|
6581 | rowIds.push(this.adapter.getRowIdAtIndex(rowIndex));
|
6582 | }
|
6583 | return rowIds;
|
6584 | };
|
6585 | |
6586 |
|
6587 |
|
6588 | MDCDataTableFoundation.prototype.getSelectedRowIds = function () {
|
6589 | var selectedRowIds = [];
|
6590 | for (var rowIndex = 0; rowIndex < this.adapter.getRowCount(); rowIndex++) {
|
6591 | if (this.adapter.isCheckboxAtRowIndexChecked(rowIndex)) {
|
6592 | selectedRowIds.push(this.adapter.getRowIdAtIndex(rowIndex));
|
6593 | }
|
6594 | }
|
6595 | return selectedRowIds;
|
6596 | };
|
6597 | |
6598 |
|
6599 |
|
6600 | MDCDataTableFoundation.prototype.handleHeaderRowCheckboxChange = function () {
|
6601 | var isHeaderChecked = this.adapter.isHeaderRowCheckboxChecked();
|
6602 | for (var rowIndex = 0; rowIndex < this.adapter.getRowCount(); rowIndex++) {
|
6603 | this.adapter.setRowCheckboxCheckedAtIndex(rowIndex, isHeaderChecked);
|
6604 | this.selectRowAtIndex(rowIndex, isHeaderChecked);
|
6605 | }
|
6606 | if (isHeaderChecked) {
|
6607 | this.adapter.notifySelectedAll();
|
6608 | } else {
|
6609 | this.adapter.notifyUnselectedAll();
|
6610 | }
|
6611 | };
|
6612 | |
6613 |
|
6614 |
|
6615 | MDCDataTableFoundation.prototype.handleRowCheckboxChange = function (event) {
|
6616 | var rowIndex = this.adapter.getRowIndexByChildElement(event.target);
|
6617 | if (rowIndex === -1) {
|
6618 | return;
|
6619 | }
|
6620 | var selected = this.adapter.isCheckboxAtRowIndexChecked(rowIndex);
|
6621 | this.selectRowAtIndex(rowIndex, selected);
|
6622 | this.setHeaderRowCheckboxState();
|
6623 | var rowId = this.adapter.getRowIdAtIndex(rowIndex);
|
6624 | this.adapter.notifyRowSelectionChanged({ rowId: rowId, rowIndex: rowIndex, selected: selected });
|
6625 | };
|
6626 | |
6627 |
|
6628 |
|
6629 | MDCDataTableFoundation.prototype.handleSortAction = function (eventData) {
|
6630 | var columnId = eventData.columnId,
|
6631 | columnIndex = eventData.columnIndex,
|
6632 | headerCell = eventData.headerCell;
|
6633 |
|
6634 | for (var index = 0; index < this.adapter.getHeaderCellCount(); index++) {
|
6635 | if (index === columnIndex) {
|
6636 | continue;
|
6637 | }
|
6638 | this.adapter.removeClassNameByHeaderCellIndex(index, constants_1.cssClasses.HEADER_CELL_SORTED);
|
6639 | this.adapter.removeClassNameByHeaderCellIndex(index, constants_1.cssClasses.HEADER_CELL_SORTED_DESCENDING);
|
6640 | this.adapter.setAttributeByHeaderCellIndex(index, constants_1.strings.ARIA_SORT, constants_1.SortValue.NONE);
|
6641 | this.adapter.setSortStatusLabelByHeaderCellIndex(index, constants_1.SortValue.NONE);
|
6642 | }
|
6643 |
|
6644 | this.adapter.setClassNameByHeaderCellIndex(columnIndex, constants_1.cssClasses.HEADER_CELL_SORTED);
|
6645 | var currentSortValue = this.adapter.getAttributeByHeaderCellIndex(columnIndex, constants_1.strings.ARIA_SORT);
|
6646 | var sortValue = constants_1.SortValue.NONE;
|
6647 |
|
6648 | if (currentSortValue === constants_1.SortValue.ASCENDING) {
|
6649 | this.adapter.setClassNameByHeaderCellIndex(columnIndex, constants_1.cssClasses.HEADER_CELL_SORTED_DESCENDING);
|
6650 | this.adapter.setAttributeByHeaderCellIndex(columnIndex, constants_1.strings.ARIA_SORT, constants_1.SortValue.DESCENDING);
|
6651 | sortValue = constants_1.SortValue.DESCENDING;
|
6652 |
|
6653 | } else if (currentSortValue === constants_1.SortValue.DESCENDING) {
|
6654 | this.adapter.removeClassNameByHeaderCellIndex(columnIndex, constants_1.cssClasses.HEADER_CELL_SORTED_DESCENDING);
|
6655 | this.adapter.setAttributeByHeaderCellIndex(columnIndex, constants_1.strings.ARIA_SORT, constants_1.SortValue.ASCENDING);
|
6656 | sortValue = constants_1.SortValue.ASCENDING;
|
6657 | } else {
|
6658 |
|
6659 | this.adapter.setAttributeByHeaderCellIndex(columnIndex, constants_1.strings.ARIA_SORT, constants_1.SortValue.ASCENDING);
|
6660 | sortValue = constants_1.SortValue.ASCENDING;
|
6661 | }
|
6662 | this.adapter.setSortStatusLabelByHeaderCellIndex(columnIndex, sortValue);
|
6663 | this.adapter.notifySortAction({
|
6664 | columnId: columnId,
|
6665 | columnIndex: columnIndex,
|
6666 | headerCell: headerCell,
|
6667 | sortValue: sortValue
|
6668 | });
|
6669 | };
|
6670 | |
6671 |
|
6672 |
|
6673 | MDCDataTableFoundation.prototype.handleRowClick = function (_a) {
|
6674 | var rowId = _a.rowId,
|
6675 | row = _a.row;
|
6676 | this.adapter.notifyRowClick({
|
6677 | rowId: rowId,
|
6678 | row: row
|
6679 | });
|
6680 | };
|
6681 | |
6682 |
|
6683 |
|
6684 |
|
6685 | MDCDataTableFoundation.prototype.showProgress = function () {
|
6686 | var tableHeaderHeight = this.adapter.getTableHeaderHeight();
|
6687 |
|
6688 |
|
6689 | var height = this.adapter.getTableContainerHeight() - tableHeaderHeight;
|
6690 | var top = tableHeaderHeight;
|
6691 | this.adapter.setProgressIndicatorStyles({
|
6692 | height: height + "px",
|
6693 | top: top + "px"
|
6694 | });
|
6695 | this.adapter.addClass(constants_1.cssClasses.IN_PROGRESS);
|
6696 | };
|
6697 | |
6698 |
|
6699 |
|
6700 | MDCDataTableFoundation.prototype.hideProgress = function () {
|
6701 | this.adapter.removeClass(constants_1.cssClasses.IN_PROGRESS);
|
6702 | };
|
6703 | |
6704 |
|
6705 |
|
6706 | MDCDataTableFoundation.prototype.setHeaderRowCheckboxState = function () {
|
6707 | if (this.adapter.getSelectedRowCount() === 0) {
|
6708 | this.adapter.setHeaderRowCheckboxChecked(false);
|
6709 | this.adapter.setHeaderRowCheckboxIndeterminate(false);
|
6710 | } else if (this.adapter.getSelectedRowCount() === this.adapter.getRowCount()) {
|
6711 | this.adapter.setHeaderRowCheckboxChecked(true);
|
6712 | this.adapter.setHeaderRowCheckboxIndeterminate(false);
|
6713 | } else {
|
6714 | this.adapter.setHeaderRowCheckboxIndeterminate(true);
|
6715 | this.adapter.setHeaderRowCheckboxChecked(false);
|
6716 | }
|
6717 | };
|
6718 | |
6719 |
|
6720 |
|
6721 | MDCDataTableFoundation.prototype.selectRowAtIndex = function (rowIndex, selected) {
|
6722 | if (selected) {
|
6723 | this.adapter.addClassAtRowIndex(rowIndex, constants_1.cssClasses.ROW_SELECTED);
|
6724 | this.adapter.setAttributeAtRowIndex(rowIndex, constants_1.strings.ARIA_SELECTED, 'true');
|
6725 | } else {
|
6726 | this.adapter.removeClassAtRowIndex(rowIndex, constants_1.cssClasses.ROW_SELECTED);
|
6727 | this.adapter.setAttributeAtRowIndex(rowIndex, constants_1.strings.ARIA_SELECTED, 'false');
|
6728 | }
|
6729 | };
|
6730 | return MDCDataTableFoundation;
|
6731 | }(foundation_1.MDCFoundation);
|
6732 | exports.MDCDataTableFoundation = MDCDataTableFoundation;
|
6733 |
|
6734 | }),
|
6735 |
|
6736 | "./packages/mdc-data-table/index.ts":
|
6737 |
|
6738 |
|
6739 |
|
6740 |
|
6741 | (function(module, exports, __webpack_require__) {
|
6742 |
|
6743 | "use strict";
|
6744 |
|
6745 |
|
6746 |
|
6747 |
|
6748 |
|
6749 |
|
6750 |
|
6751 |
|
6752 |
|
6753 |
|
6754 |
|
6755 |
|
6756 |
|
6757 |
|
6758 |
|
6759 |
|
6760 |
|
6761 |
|
6762 |
|
6763 |
|
6764 |
|
6765 |
|
6766 |
|
6767 |
|
6768 | var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
|
6769 | if (k2 === undefined) k2 = k;
|
6770 | Object.defineProperty(o, k2, { enumerable: true, get: function get() {
|
6771 | return m[k];
|
6772 | } });
|
6773 | } : function (o, m, k, k2) {
|
6774 | if (k2 === undefined) k2 = k;
|
6775 | o[k2] = m[k];
|
6776 | });
|
6777 | var __exportStar = this && this.__exportStar || function (m, exports) {
|
6778 | for (var p in m) {
|
6779 | if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
6780 | }
|
6781 | };
|
6782 | Object.defineProperty(exports, "__esModule", { value: true });
|
6783 | __exportStar(__webpack_require__( "./packages/mdc-data-table/adapter.ts"), exports);
|
6784 | __exportStar(__webpack_require__( "./packages/mdc-data-table/component.ts"), exports);
|
6785 | __exportStar(__webpack_require__( "./packages/mdc-data-table/foundation.ts"), exports);
|
6786 | __exportStar(__webpack_require__( "./packages/mdc-data-table/constants.ts"), exports);
|
6787 | __exportStar(__webpack_require__( "./packages/mdc-data-table/types.ts"), exports);
|
6788 |
|
6789 | }),
|
6790 |
|
6791 | "./packages/mdc-data-table/types.ts":
|
6792 |
|
6793 |
|
6794 |
|
6795 |
|
6796 | (function(module, exports, __webpack_require__) {
|
6797 |
|
6798 | "use strict";
|
6799 |
|
6800 |
|
6801 |
|
6802 |
|
6803 |
|
6804 |
|
6805 |
|
6806 |
|
6807 |
|
6808 |
|
6809 |
|
6810 |
|
6811 |
|
6812 |
|
6813 |
|
6814 |
|
6815 |
|
6816 |
|
6817 |
|
6818 |
|
6819 |
|
6820 |
|
6821 |
|
6822 |
|
6823 | Object.defineProperty(exports, "__esModule", { value: true });
|
6824 | ;
|
6825 |
|
6826 | }),
|
6827 |
|
6828 | "./packages/mdc-dialog/adapter.ts":
|
6829 |
|
6830 |
|
6831 |
|
6832 |
|
6833 | (function(module, exports, __webpack_require__) {
|
6834 |
|
6835 | "use strict";
|
6836 |
|
6837 |
|
6838 |
|
6839 |
|
6840 |
|
6841 |
|
6842 |
|
6843 |
|
6844 |
|
6845 |
|
6846 |
|
6847 |
|
6848 |
|
6849 |
|
6850 |
|
6851 |
|
6852 |
|
6853 |
|
6854 |
|
6855 |
|
6856 |
|
6857 |
|
6858 |
|
6859 |
|
6860 | Object.defineProperty(exports, "__esModule", { value: true });
|
6861 |
|
6862 | }),
|
6863 |
|
6864 | "./packages/mdc-dialog/component.ts":
|
6865 |
|
6866 |
|
6867 |
|
6868 |
|
6869 | (function(module, exports, __webpack_require__) {
|
6870 |
|
6871 | "use strict";
|
6872 |
|
6873 |
|
6874 |
|
6875 |
|
6876 |
|
6877 |
|
6878 |
|
6879 |
|
6880 |
|
6881 |
|
6882 |
|
6883 |
|
6884 |
|
6885 |
|
6886 |
|
6887 |
|
6888 |
|
6889 |
|
6890 |
|
6891 |
|
6892 |
|
6893 |
|
6894 |
|
6895 |
|
6896 | var __extends = this && this.__extends || function () {
|
6897 | var _extendStatics = function extendStatics(d, b) {
|
6898 | _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
|
6899 | d.__proto__ = b;
|
6900 | } || function (d, b) {
|
6901 | for (var p in b) {
|
6902 | if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
6903 | }
|
6904 | };
|
6905 | return _extendStatics(d, b);
|
6906 | };
|
6907 | return function (d, b) {
|
6908 | if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
6909 | _extendStatics(d, b);
|
6910 | function __() {
|
6911 | this.constructor = d;
|
6912 | }
|
6913 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
6914 | };
|
6915 | }();
|
6916 | var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
|
6917 | if (k2 === undefined) k2 = k;
|
6918 | Object.defineProperty(o, k2, { enumerable: true, get: function get() {
|
6919 | return m[k];
|
6920 | } });
|
6921 | } : function (o, m, k, k2) {
|
6922 | if (k2 === undefined) k2 = k;
|
6923 | o[k2] = m[k];
|
6924 | });
|
6925 | var __setModuleDefault = this && this.__setModuleDefault || (Object.create ? function (o, v) {
|
6926 | Object.defineProperty(o, "default", { enumerable: true, value: v });
|
6927 | } : function (o, v) {
|
6928 | o["default"] = v;
|
6929 | });
|
6930 | var __importStar = this && this.__importStar || function (mod) {
|
6931 | if (mod && mod.__esModule) return mod;
|
6932 | var result = {};
|
6933 | if (mod != null) for (var k in mod) {
|
6934 | if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
6935 | }__setModuleDefault(result, mod);
|
6936 | return result;
|
6937 | };
|
6938 | var __values = this && this.__values || function (o) {
|
6939 | var s = typeof Symbol === "function" && Symbol.iterator,
|
6940 | m = s && o[s],
|
6941 | i = 0;
|
6942 | if (m) return m.call(o);
|
6943 | if (o && typeof o.length === "number") return {
|
6944 | next: function next() {
|
6945 | if (o && i >= o.length) o = void 0;
|
6946 | return { value: o && o[i++], done: !o };
|
6947 | }
|
6948 | };
|
6949 | throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
6950 | };
|
6951 | Object.defineProperty(exports, "__esModule", { value: true });
|
6952 | exports.MDCDialog = void 0;
|
6953 | var component_1 = __webpack_require__( "./packages/mdc-base/component.ts");
|
6954 | var focus_trap_1 = __webpack_require__( "./packages/mdc-dom/focus-trap.ts");
|
6955 | var ponyfill_1 = __webpack_require__( "./packages/mdc-dom/ponyfill.ts");
|
6956 | var component_2 = __webpack_require__( "./packages/mdc-ripple/component.ts");
|
6957 | var foundation_1 = __webpack_require__( "./packages/mdc-dialog/foundation.ts");
|
6958 | var util = __importStar(__webpack_require__( "./packages/mdc-dialog/util.ts"));
|
6959 | var strings = foundation_1.MDCDialogFoundation.strings;
|
6960 | var MDCDialog = function (_super) {
|
6961 | __extends(MDCDialog, _super);
|
6962 | function MDCDialog() {
|
6963 | return _super !== null && _super.apply(this, arguments) || this;
|
6964 | }
|
6965 | Object.defineProperty(MDCDialog.prototype, "isOpen", {
|
6966 | get: function get() {
|
6967 | return this.foundation.isOpen();
|
6968 | },
|
6969 | enumerable: false,
|
6970 | configurable: true
|
6971 | });
|
6972 | Object.defineProperty(MDCDialog.prototype, "escapeKeyAction", {
|
6973 | get: function get() {
|
6974 | return this.foundation.getEscapeKeyAction();
|
6975 | },
|
6976 | set: function set(action) {
|
6977 | this.foundation.setEscapeKeyAction(action);
|
6978 | },
|
6979 | enumerable: false,
|
6980 | configurable: true
|
6981 | });
|
6982 | Object.defineProperty(MDCDialog.prototype, "scrimClickAction", {
|
6983 | get: function get() {
|
6984 | return this.foundation.getScrimClickAction();
|
6985 | },
|
6986 | set: function set(action) {
|
6987 | this.foundation.setScrimClickAction(action);
|
6988 | },
|
6989 | enumerable: false,
|
6990 | configurable: true
|
6991 | });
|
6992 | Object.defineProperty(MDCDialog.prototype, "autoStackButtons", {
|
6993 | get: function get() {
|
6994 | return this.foundation.getAutoStackButtons();
|
6995 | },
|
6996 | set: function set(autoStack) {
|
6997 | this.foundation.setAutoStackButtons(autoStack);
|
6998 | },
|
6999 | enumerable: false,
|
7000 | configurable: true
|
7001 | });
|
7002 | MDCDialog.attachTo = function (root) {
|
7003 | return new MDCDialog(root);
|
7004 | };
|
7005 | MDCDialog.prototype.initialize = function (focusTrapFactory) {
|
7006 | var e_1, _a;
|
7007 | if (focusTrapFactory === void 0) {
|
7008 | focusTrapFactory = function focusTrapFactory(el, focusOptions) {
|
7009 | return new focus_trap_1.FocusTrap(el, focusOptions);
|
7010 | };
|
7011 | }
|
7012 | var container = this.root.querySelector(strings.CONTAINER_SELECTOR);
|
7013 | if (!container) {
|
7014 | throw new Error("Dialog component requires a " + strings.CONTAINER_SELECTOR + " container element");
|
7015 | }
|
7016 | this.container = container;
|
7017 | this.content = this.root.querySelector(strings.CONTENT_SELECTOR);
|
7018 | this.buttons = [].slice.call(this.root.querySelectorAll(strings.BUTTON_SELECTOR));
|
7019 | this.defaultButton = this.root.querySelector("[" + strings.BUTTON_DEFAULT_ATTRIBUTE + "]");
|
7020 | this.focusTrapFactory = focusTrapFactory;
|
7021 | this.buttonRipples = [];
|
7022 | try {
|
7023 | for (var _b = __values(this.buttons), _c = _b.next(); !_c.done; _c = _b.next()) {
|
7024 | var buttonEl = _c.value;
|
7025 | this.buttonRipples.push(new component_2.MDCRipple(buttonEl));
|
7026 | }
|
7027 | } catch (e_1_1) {
|
7028 | e_1 = { error: e_1_1 };
|
7029 | } finally {
|
7030 | try {
|
7031 | if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
7032 | } finally {
|
7033 | if (e_1) throw e_1.error;
|
7034 | }
|
7035 | }
|
7036 | };
|
7037 | MDCDialog.prototype.initialSyncWithDOM = function () {
|
7038 | var _this = this;
|
7039 | this.focusTrap = util.createFocusTrapInstance(this.container, this.focusTrapFactory, this.getInitialFocusEl() || undefined);
|
7040 | this.handleClick = this.foundation.handleClick.bind(this.foundation);
|
7041 | this.handleKeydown = this.foundation.handleKeydown.bind(this.foundation);
|
7042 | this.handleDocumentKeydown = this.foundation.handleDocumentKeydown.bind(this.foundation);
|
7043 |
|
7044 | this.handleOpening = function () {
|
7045 | document.addEventListener('keydown', _this.handleDocumentKeydown);
|
7046 | };
|
7047 | this.handleClosing = function () {
|
7048 | document.removeEventListener('keydown', _this.handleDocumentKeydown);
|
7049 | };
|
7050 | this.listen('click', this.handleClick);
|
7051 | this.listen('keydown', this.handleKeydown);
|
7052 | this.listen(strings.OPENING_EVENT, this.handleOpening);
|
7053 | this.listen(strings.CLOSING_EVENT, this.handleClosing);
|
7054 | };
|
7055 | MDCDialog.prototype.destroy = function () {
|
7056 | this.unlisten('click', this.handleClick);
|
7057 | this.unlisten('keydown', this.handleKeydown);
|
7058 | this.unlisten(strings.OPENING_EVENT, this.handleOpening);
|
7059 | this.unlisten(strings.CLOSING_EVENT, this.handleClosing);
|
7060 | this.handleClosing();
|
7061 | this.buttonRipples.forEach(function (ripple) {
|
7062 | ripple.destroy();
|
7063 | });
|
7064 | _super.prototype.destroy.call(this);
|
7065 | };
|
7066 | MDCDialog.prototype.layout = function () {
|
7067 | this.foundation.layout();
|
7068 | };
|
7069 | MDCDialog.prototype.open = function () {
|
7070 | this.foundation.open();
|
7071 | };
|
7072 | MDCDialog.prototype.close = function (action) {
|
7073 | if (action === void 0) {
|
7074 | action = '';
|
7075 | }
|
7076 | this.foundation.close(action);
|
7077 | };
|
7078 | MDCDialog.prototype.getDefaultFoundation = function () {
|
7079 | var _this = this;
|
7080 |
|
7081 |
|
7082 | var adapter = {
|
7083 | addBodyClass: function addBodyClass(className) {
|
7084 | return document.body.classList.add(className);
|
7085 | },
|
7086 | addClass: function addClass(className) {
|
7087 | return _this.root.classList.add(className);
|
7088 | },
|
7089 | areButtonsStacked: function areButtonsStacked() {
|
7090 | return util.areTopsMisaligned(_this.buttons);
|
7091 | },
|
7092 | clickDefaultButton: function clickDefaultButton() {
|
7093 | if (_this.defaultButton && !_this.defaultButton.disabled) {
|
7094 | _this.defaultButton.click();
|
7095 | }
|
7096 | },
|
7097 | eventTargetMatches: function eventTargetMatches(target, selector) {
|
7098 | return target ? ponyfill_1.matches(target, selector) : false;
|
7099 | },
|
7100 | getActionFromEvent: function getActionFromEvent(evt) {
|
7101 | if (!evt.target) {
|
7102 | return '';
|
7103 | }
|
7104 | var element = ponyfill_1.closest(evt.target, "[" + strings.ACTION_ATTRIBUTE + "]");
|
7105 | return element && element.getAttribute(strings.ACTION_ATTRIBUTE);
|
7106 | },
|
7107 | getInitialFocusEl: function getInitialFocusEl() {
|
7108 | return _this.getInitialFocusEl();
|
7109 | },
|
7110 | hasClass: function hasClass(className) {
|
7111 | return _this.root.classList.contains(className);
|
7112 | },
|
7113 | isContentScrollable: function isContentScrollable() {
|
7114 | return util.isScrollable(_this.content);
|
7115 | },
|
7116 | notifyClosed: function notifyClosed(action) {
|
7117 | return _this.emit(strings.CLOSED_EVENT, action ? { action: action } : {});
|
7118 | },
|
7119 | notifyClosing: function notifyClosing(action) {
|
7120 | return _this.emit(strings.CLOSING_EVENT, action ? { action: action } : {});
|
7121 | },
|
7122 | notifyOpened: function notifyOpened() {
|
7123 | return _this.emit(strings.OPENED_EVENT, {});
|
7124 | },
|
7125 | notifyOpening: function notifyOpening() {
|
7126 | return _this.emit(strings.OPENING_EVENT, {});
|
7127 | },
|
7128 | releaseFocus: function releaseFocus() {
|
7129 | _this.focusTrap.releaseFocus();
|
7130 | },
|
7131 | removeBodyClass: function removeBodyClass(className) {
|
7132 | return document.body.classList.remove(className);
|
7133 | },
|
7134 | removeClass: function removeClass(className) {
|
7135 | return _this.root.classList.remove(className);
|
7136 | },
|
7137 | reverseButtons: function reverseButtons() {
|
7138 | _this.buttons.reverse();
|
7139 | _this.buttons.forEach(function (button) {
|
7140 | button.parentElement.appendChild(button);
|
7141 | });
|
7142 | },
|
7143 | trapFocus: function trapFocus() {
|
7144 | _this.focusTrap.trapFocus();
|
7145 | },
|
7146 | registerContentEventHandler: function registerContentEventHandler(evt, handler) {
|
7147 | if (_this.content instanceof HTMLElement) {
|
7148 | _this.content.addEventListener(evt, handler);
|
7149 | }
|
7150 | },
|
7151 | deregisterContentEventHandler: function deregisterContentEventHandler(evt, handler) {
|
7152 | if (_this.content instanceof HTMLElement) {
|
7153 | _this.content.removeEventListener(evt, handler);
|
7154 | }
|
7155 | },
|
7156 | isScrollableContentAtTop: function isScrollableContentAtTop() {
|
7157 | return util.isScrollAtTop(_this.content);
|
7158 | },
|
7159 | isScrollableContentAtBottom: function isScrollableContentAtBottom() {
|
7160 | return util.isScrollAtBottom(_this.content);
|
7161 | },
|
7162 | registerWindowEventHandler: function registerWindowEventHandler(evt, handler) {
|
7163 | window.addEventListener(evt, handler);
|
7164 | },
|
7165 | deregisterWindowEventHandler: function deregisterWindowEventHandler(evt, handler) {
|
7166 | window.removeEventListener(evt, handler);
|
7167 | }
|
7168 | };
|
7169 | return new foundation_1.MDCDialogFoundation(adapter);
|
7170 | };
|
7171 | MDCDialog.prototype.getInitialFocusEl = function () {
|
7172 | return this.root.querySelector("[" + strings.INITIAL_FOCUS_ATTRIBUTE + "]");
|
7173 | };
|
7174 | return MDCDialog;
|
7175 | }(component_1.MDCComponent);
|
7176 | exports.MDCDialog = MDCDialog;
|
7177 |
|
7178 | }),
|
7179 |
|
7180 | "./packages/mdc-dialog/constants.ts":
|
7181 |
|
7182 |
|
7183 |
|
7184 |
|
7185 | (function(module, exports, __webpack_require__) {
|
7186 |
|
7187 | "use strict";
|
7188 |
|
7189 |
|
7190 |
|
7191 |
|
7192 |
|
7193 |
|
7194 |
|
7195 |
|
7196 |
|
7197 |
|
7198 |
|
7199 |
|
7200 |
|
7201 |
|
7202 |
|
7203 |
|
7204 |
|
7205 |
|
7206 |
|
7207 |
|
7208 |
|
7209 |
|
7210 |
|
7211 |
|
7212 | Object.defineProperty(exports, "__esModule", { value: true });
|
7213 | exports.numbers = exports.strings = exports.cssClasses = void 0;
|
7214 | exports.cssClasses = {
|
7215 | CLOSING: 'mdc-dialog--closing',
|
7216 | OPEN: 'mdc-dialog--open',
|
7217 | OPENING: 'mdc-dialog--opening',
|
7218 | SCROLLABLE: 'mdc-dialog--scrollable',
|
7219 | SCROLL_LOCK: 'mdc-dialog-scroll-lock',
|
7220 | STACKED: 'mdc-dialog--stacked',
|
7221 | FULLSCREEN: 'mdc-dialog--fullscreen',
|
7222 |
|
7223 |
|
7224 |
|
7225 | SCROLL_DIVIDER_HEADER: 'mdc-dialog-scroll-divider-header',
|
7226 |
|
7227 |
|
7228 |
|
7229 | SCROLL_DIVIDER_FOOTER: 'mdc-dialog-scroll-divider-footer',
|
7230 |
|
7231 |
|
7232 |
|
7233 |
|
7234 |
|
7235 |
|
7236 |
|
7237 | SURFACE_SCRIM_SHOWN: 'mdc-dialog__surface-scrim--shown',
|
7238 |
|
7239 | SURFACE_SCRIM_SHOWING: 'mdc-dialog__surface-scrim--showing',
|
7240 |
|
7241 | SURFACE_SCRIM_HIDING: 'mdc-dialog__surface-scrim--hiding',
|
7242 |
|
7243 |
|
7244 |
|
7245 |
|
7246 | SCRIM_HIDDEN: 'mdc-dialog__scrim--hidden'
|
7247 | };
|
7248 | exports.strings = {
|
7249 | ACTION_ATTRIBUTE: 'data-mdc-dialog-action',
|
7250 | BUTTON_DEFAULT_ATTRIBUTE: 'data-mdc-dialog-button-default',
|
7251 | BUTTON_SELECTOR: '.mdc-dialog__button',
|
7252 | CLOSED_EVENT: 'MDCDialog:closed',
|
7253 | CLOSE_ACTION: 'close',
|
7254 | CLOSING_EVENT: 'MDCDialog:closing',
|
7255 | CONTAINER_SELECTOR: '.mdc-dialog__container',
|
7256 | CONTENT_SELECTOR: '.mdc-dialog__content',
|
7257 | DESTROY_ACTION: 'destroy',
|
7258 | INITIAL_FOCUS_ATTRIBUTE: 'data-mdc-dialog-initial-focus',
|
7259 | OPENED_EVENT: 'MDCDialog:opened',
|
7260 | OPENING_EVENT: 'MDCDialog:opening',
|
7261 | SCRIM_SELECTOR: '.mdc-dialog__scrim',
|
7262 | SUPPRESS_DEFAULT_PRESS_SELECTOR: ['textarea', '.mdc-menu .mdc-list-item', '.mdc-menu .mdc-deprecated-list-item'].join(', '),
|
7263 | SURFACE_SELECTOR: '.mdc-dialog__surface'
|
7264 | };
|
7265 | exports.numbers = {
|
7266 | DIALOG_ANIMATION_CLOSE_TIME_MS: 75,
|
7267 | DIALOG_ANIMATION_OPEN_TIME_MS: 150
|
7268 | };
|
7269 |
|
7270 | }),
|
7271 |
|
7272 | "./packages/mdc-dialog/foundation.ts":
|
7273 |
|
7274 |
|
7275 |
|
7276 |
|
7277 | (function(module, exports, __webpack_require__) {
|
7278 |
|
7279 | "use strict";
|
7280 |
|
7281 |
|
7282 |
|
7283 |
|
7284 |
|
7285 |
|
7286 |
|
7287 |
|
7288 |
|
7289 |
|
7290 |
|
7291 |
|
7292 |
|
7293 |
|
7294 |
|
7295 |
|
7296 |
|
7297 |
|
7298 |
|
7299 |
|
7300 |
|
7301 |
|
7302 |
|
7303 |
|
7304 | var __extends = this && this.__extends || function () {
|
7305 | var _extendStatics = function extendStatics(d, b) {
|
7306 | _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
|
7307 | d.__proto__ = b;
|
7308 | } || function (d, b) {
|
7309 | for (var p in b) {
|
7310 | if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
7311 | }
|
7312 | };
|
7313 | return _extendStatics(d, b);
|
7314 | };
|
7315 | return function (d, b) {
|
7316 | if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
7317 | _extendStatics(d, b);
|
7318 | function __() {
|
7319 | this.constructor = d;
|
7320 | }
|
7321 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
7322 | };
|
7323 | }();
|
7324 | var __assign = this && this.__assign || function () {
|
7325 | __assign = Object.assign || function (t) {
|
7326 | for (var s, i = 1, n = arguments.length; i < n; i++) {
|
7327 | s = arguments[i];
|
7328 | for (var p in s) {
|
7329 | if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
7330 | }
|
7331 | }
|
7332 | return t;
|
7333 | };
|
7334 | return __assign.apply(this, arguments);
|
7335 | };
|
7336 | Object.defineProperty(exports, "__esModule", { value: true });
|
7337 | exports.MDCDialogFoundation = void 0;
|
7338 | var animationframe_1 = __webpack_require__( "./packages/mdc-animation/animationframe.ts");
|
7339 | var foundation_1 = __webpack_require__( "./packages/mdc-base/foundation.ts");
|
7340 | var constants_1 = __webpack_require__( "./packages/mdc-dialog/constants.ts");
|
7341 | var AnimationKeys;
|
7342 | (function (AnimationKeys) {
|
7343 | AnimationKeys["POLL_SCROLL_POS"] = "poll_scroll_position";
|
7344 | AnimationKeys["POLL_LAYOUT_CHANGE"] = "poll_layout_change";
|
7345 | })(AnimationKeys || (AnimationKeys = {}));
|
7346 | var MDCDialogFoundation = function (_super) {
|
7347 | __extends(MDCDialogFoundation, _super);
|
7348 | function MDCDialogFoundation(adapter) {
|
7349 | var _this = _super.call(this, __assign(__assign({}, MDCDialogFoundation.defaultAdapter), adapter)) || this;
|
7350 | _this.dialogOpen = false;
|
7351 | _this.isFullscreen = false;
|
7352 | _this.animationFrame = 0;
|
7353 | _this.animationTimer = 0;
|
7354 | _this.escapeKeyAction = constants_1.strings.CLOSE_ACTION;
|
7355 | _this.scrimClickAction = constants_1.strings.CLOSE_ACTION;
|
7356 | _this.autoStackButtons = true;
|
7357 | _this.areButtonsStacked = false;
|
7358 | _this.suppressDefaultPressSelector = constants_1.strings.SUPPRESS_DEFAULT_PRESS_SELECTOR;
|
7359 | _this.animFrame = new animationframe_1.AnimationFrame();
|
7360 | _this.contentScrollHandler = function () {
|
7361 | _this.handleScrollEvent();
|
7362 | };
|
7363 | _this.windowResizeHandler = function () {
|
7364 | _this.layout();
|
7365 | };
|
7366 | _this.windowOrientationChangeHandler = function () {
|
7367 | _this.layout();
|
7368 | };
|
7369 | return _this;
|
7370 | }
|
7371 | Object.defineProperty(MDCDialogFoundation, "cssClasses", {
|
7372 | get: function get() {
|
7373 | return constants_1.cssClasses;
|
7374 | },
|
7375 | enumerable: false,
|
7376 | configurable: true
|
7377 | });
|
7378 | Object.defineProperty(MDCDialogFoundation, "strings", {
|
7379 | get: function get() {
|
7380 | return constants_1.strings;
|
7381 | },
|
7382 | enumerable: false,
|
7383 | configurable: true
|
7384 | });
|
7385 | Object.defineProperty(MDCDialogFoundation, "numbers", {
|
7386 | get: function get() {
|
7387 | return constants_1.numbers;
|
7388 | },
|
7389 | enumerable: false,
|
7390 | configurable: true
|
7391 | });
|
7392 | Object.defineProperty(MDCDialogFoundation, "defaultAdapter", {
|
7393 | get: function get() {
|
7394 | return {
|
7395 | addBodyClass: function addBodyClass() {
|
7396 | return undefined;
|
7397 | },
|
7398 | addClass: function addClass() {
|
7399 | return undefined;
|
7400 | },
|
7401 | areButtonsStacked: function areButtonsStacked() {
|
7402 | return false;
|
7403 | },
|
7404 | clickDefaultButton: function clickDefaultButton() {
|
7405 | return undefined;
|
7406 | },
|
7407 | eventTargetMatches: function eventTargetMatches() {
|
7408 | return false;
|
7409 | },
|
7410 | getActionFromEvent: function getActionFromEvent() {
|
7411 | return '';
|
7412 | },
|
7413 | getInitialFocusEl: function getInitialFocusEl() {
|
7414 | return null;
|
7415 | },
|
7416 | hasClass: function hasClass() {
|
7417 | return false;
|
7418 | },
|
7419 | isContentScrollable: function isContentScrollable() {
|
7420 | return false;
|
7421 | },
|
7422 | notifyClosed: function notifyClosed() {
|
7423 | return undefined;
|
7424 | },
|
7425 | notifyClosing: function notifyClosing() {
|
7426 | return undefined;
|
7427 | },
|
7428 | notifyOpened: function notifyOpened() {
|
7429 | return undefined;
|
7430 | },
|
7431 | notifyOpening: function notifyOpening() {
|
7432 | return undefined;
|
7433 | },
|
7434 | releaseFocus: function releaseFocus() {
|
7435 | return undefined;
|
7436 | },
|
7437 | removeBodyClass: function removeBodyClass() {
|
7438 | return undefined;
|
7439 | },
|
7440 | removeClass: function removeClass() {
|
7441 | return undefined;
|
7442 | },
|
7443 | reverseButtons: function reverseButtons() {
|
7444 | return undefined;
|
7445 | },
|
7446 | trapFocus: function trapFocus() {
|
7447 | return undefined;
|
7448 | },
|
7449 | registerContentEventHandler: function registerContentEventHandler() {
|
7450 | return undefined;
|
7451 | },
|
7452 | deregisterContentEventHandler: function deregisterContentEventHandler() {
|
7453 | return undefined;
|
7454 | },
|
7455 | isScrollableContentAtTop: function isScrollableContentAtTop() {
|
7456 | return false;
|
7457 | },
|
7458 | isScrollableContentAtBottom: function isScrollableContentAtBottom() {
|
7459 | return false;
|
7460 | },
|
7461 | registerWindowEventHandler: function registerWindowEventHandler() {
|
7462 | return undefined;
|
7463 | },
|
7464 | deregisterWindowEventHandler: function deregisterWindowEventHandler() {
|
7465 | return undefined;
|
7466 | }
|
7467 | };
|
7468 | },
|
7469 | enumerable: false,
|
7470 | configurable: true
|
7471 | });
|
7472 | MDCDialogFoundation.prototype.init = function () {
|
7473 | if (this.adapter.hasClass(constants_1.cssClasses.STACKED)) {
|
7474 | this.setAutoStackButtons(false);
|
7475 | }
|
7476 | this.isFullscreen = this.adapter.hasClass(constants_1.cssClasses.FULLSCREEN);
|
7477 | };
|
7478 | MDCDialogFoundation.prototype.destroy = function () {
|
7479 | if (this.animationTimer) {
|
7480 | clearTimeout(this.animationTimer);
|
7481 | this.handleAnimationTimerEnd();
|
7482 | }
|
7483 | if (this.isFullscreen) {
|
7484 | this.adapter.deregisterContentEventHandler('scroll', this.contentScrollHandler);
|
7485 | }
|
7486 | this.animFrame.cancelAll();
|
7487 | this.adapter.deregisterWindowEventHandler('resize', this.windowResizeHandler);
|
7488 | this.adapter.deregisterWindowEventHandler('orientationchange', this.windowOrientationChangeHandler);
|
7489 | };
|
7490 | MDCDialogFoundation.prototype.open = function (dialogOptions) {
|
7491 | var _this = this;
|
7492 | this.dialogOpen = true;
|
7493 | this.adapter.notifyOpening();
|
7494 | this.adapter.addClass(constants_1.cssClasses.OPENING);
|
7495 | if (this.isFullscreen) {
|
7496 |
|
7497 |
|
7498 |
|
7499 | this.adapter.registerContentEventHandler('scroll', this.contentScrollHandler);
|
7500 | }
|
7501 | if (dialogOptions && dialogOptions.isAboveFullscreenDialog) {
|
7502 | this.adapter.addClass(constants_1.cssClasses.SCRIM_HIDDEN);
|
7503 | }
|
7504 | this.adapter.registerWindowEventHandler('resize', this.windowResizeHandler);
|
7505 | this.adapter.registerWindowEventHandler('orientationchange', this.windowOrientationChangeHandler);
|
7506 |
|
7507 |
|
7508 | this.runNextAnimationFrame(function () {
|
7509 | _this.adapter.addClass(constants_1.cssClasses.OPEN);
|
7510 | _this.adapter.addBodyClass(constants_1.cssClasses.SCROLL_LOCK);
|
7511 | _this.layout();
|
7512 | _this.animationTimer = setTimeout(function () {
|
7513 | _this.handleAnimationTimerEnd();
|
7514 | _this.adapter.trapFocus(_this.adapter.getInitialFocusEl());
|
7515 | _this.adapter.notifyOpened();
|
7516 | }, constants_1.numbers.DIALOG_ANIMATION_OPEN_TIME_MS);
|
7517 | });
|
7518 | };
|
7519 | MDCDialogFoundation.prototype.close = function (action) {
|
7520 | var _this = this;
|
7521 | if (action === void 0) {
|
7522 | action = '';
|
7523 | }
|
7524 | if (!this.dialogOpen) {
|
7525 |
|
7526 |
|
7527 | return;
|
7528 | }
|
7529 | this.dialogOpen = false;
|
7530 | this.adapter.notifyClosing(action);
|
7531 | this.adapter.addClass(constants_1.cssClasses.CLOSING);
|
7532 | this.adapter.removeClass(constants_1.cssClasses.OPEN);
|
7533 | this.adapter.removeBodyClass(constants_1.cssClasses.SCROLL_LOCK);
|
7534 | if (this.isFullscreen) {
|
7535 | this.adapter.deregisterContentEventHandler('scroll', this.contentScrollHandler);
|
7536 | }
|
7537 | this.adapter.deregisterWindowEventHandler('resize', this.windowResizeHandler);
|
7538 | this.adapter.deregisterWindowEventHandler('orientationchange', this.windowOrientationChangeHandler);
|
7539 | cancelAnimationFrame(this.animationFrame);
|
7540 | this.animationFrame = 0;
|
7541 | clearTimeout(this.animationTimer);
|
7542 | this.animationTimer = setTimeout(function () {
|
7543 | _this.adapter.releaseFocus();
|
7544 | _this.handleAnimationTimerEnd();
|
7545 | _this.adapter.notifyClosed(action);
|
7546 | }, constants_1.numbers.DIALOG_ANIMATION_CLOSE_TIME_MS);
|
7547 | };
|
7548 | |
7549 |
|
7550 |
|
7551 |
|
7552 | MDCDialogFoundation.prototype.showSurfaceScrim = function () {
|
7553 | var _this = this;
|
7554 | this.adapter.addClass(constants_1.cssClasses.SURFACE_SCRIM_SHOWING);
|
7555 | this.runNextAnimationFrame(function () {
|
7556 | _this.adapter.addClass(constants_1.cssClasses.SURFACE_SCRIM_SHOWN);
|
7557 | });
|
7558 | };
|
7559 | |
7560 |
|
7561 |
|
7562 |
|
7563 | MDCDialogFoundation.prototype.hideSurfaceScrim = function () {
|
7564 | this.adapter.removeClass(constants_1.cssClasses.SURFACE_SCRIM_SHOWN);
|
7565 | this.adapter.addClass(constants_1.cssClasses.SURFACE_SCRIM_HIDING);
|
7566 | };
|
7567 | |
7568 |
|
7569 |
|
7570 |
|
7571 | MDCDialogFoundation.prototype.handleSurfaceScrimTransitionEnd = function () {
|
7572 | this.adapter.removeClass(constants_1.cssClasses.SURFACE_SCRIM_HIDING);
|
7573 | this.adapter.removeClass(constants_1.cssClasses.SURFACE_SCRIM_SHOWING);
|
7574 | };
|
7575 | MDCDialogFoundation.prototype.isOpen = function () {
|
7576 | return this.dialogOpen;
|
7577 | };
|
7578 | MDCDialogFoundation.prototype.getEscapeKeyAction = function () {
|
7579 | return this.escapeKeyAction;
|
7580 | };
|
7581 | MDCDialogFoundation.prototype.setEscapeKeyAction = function (action) {
|
7582 | this.escapeKeyAction = action;
|
7583 | };
|
7584 | MDCDialogFoundation.prototype.getScrimClickAction = function () {
|
7585 | return this.scrimClickAction;
|
7586 | };
|
7587 | MDCDialogFoundation.prototype.setScrimClickAction = function (action) {
|
7588 | this.scrimClickAction = action;
|
7589 | };
|
7590 | MDCDialogFoundation.prototype.getAutoStackButtons = function () {
|
7591 | return this.autoStackButtons;
|
7592 | };
|
7593 | MDCDialogFoundation.prototype.setAutoStackButtons = function (autoStack) {
|
7594 | this.autoStackButtons = autoStack;
|
7595 | };
|
7596 | MDCDialogFoundation.prototype.getSuppressDefaultPressSelector = function () {
|
7597 | return this.suppressDefaultPressSelector;
|
7598 | };
|
7599 | MDCDialogFoundation.prototype.setSuppressDefaultPressSelector = function (selector) {
|
7600 | this.suppressDefaultPressSelector = selector;
|
7601 | };
|
7602 | MDCDialogFoundation.prototype.layout = function () {
|
7603 | var _this = this;
|
7604 | this.animFrame.request(AnimationKeys.POLL_LAYOUT_CHANGE, function () {
|
7605 | _this.layoutInternal();
|
7606 | });
|
7607 | };
|
7608 |
|
7609 | MDCDialogFoundation.prototype.handleClick = function (evt) {
|
7610 | var isScrim = this.adapter.eventTargetMatches(evt.target, constants_1.strings.SCRIM_SELECTOR);
|
7611 |
|
7612 | if (isScrim && this.scrimClickAction !== '') {
|
7613 | this.close(this.scrimClickAction);
|
7614 | } else {
|
7615 | var action = this.adapter.getActionFromEvent(evt);
|
7616 | if (action) {
|
7617 | this.close(action);
|
7618 | }
|
7619 | }
|
7620 | };
|
7621 |
|
7622 | MDCDialogFoundation.prototype.handleKeydown = function (evt) {
|
7623 | var isEnter = evt.key === 'Enter' || evt.keyCode === 13;
|
7624 | if (!isEnter) {
|
7625 | return;
|
7626 | }
|
7627 | var action = this.adapter.getActionFromEvent(evt);
|
7628 | if (action) {
|
7629 |
|
7630 |
|
7631 | return;
|
7632 | }
|
7633 |
|
7634 |
|
7635 |
|
7636 |
|
7637 |
|
7638 |
|
7639 |
|
7640 |
|
7641 |
|
7642 |
|
7643 |
|
7644 |
|
7645 |
|
7646 | var target = evt.composedPath ? evt.composedPath()[0] : evt.target;
|
7647 | var isDefault = this.suppressDefaultPressSelector ? !this.adapter.eventTargetMatches(target, this.suppressDefaultPressSelector) : true;
|
7648 | if (isEnter && isDefault) {
|
7649 | this.adapter.clickDefaultButton();
|
7650 | }
|
7651 | };
|
7652 |
|
7653 | MDCDialogFoundation.prototype.handleDocumentKeydown = function (evt) {
|
7654 | var isEscape = evt.key === 'Escape' || evt.keyCode === 27;
|
7655 | if (isEscape && this.escapeKeyAction !== '') {
|
7656 | this.close(this.escapeKeyAction);
|
7657 | }
|
7658 | };
|
7659 | |
7660 |
|
7661 |
|
7662 |
|
7663 |
|
7664 | MDCDialogFoundation.prototype.handleScrollEvent = function () {
|
7665 | var _this = this;
|
7666 |
|
7667 |
|
7668 | this.animFrame.request(AnimationKeys.POLL_SCROLL_POS, function () {
|
7669 | _this.toggleScrollDividerHeader();
|
7670 | _this.toggleScrollDividerFooter();
|
7671 | });
|
7672 | };
|
7673 | MDCDialogFoundation.prototype.layoutInternal = function () {
|
7674 | if (this.autoStackButtons) {
|
7675 | this.detectStackedButtons();
|
7676 | }
|
7677 | this.toggleScrollableClasses();
|
7678 | };
|
7679 | MDCDialogFoundation.prototype.handleAnimationTimerEnd = function () {
|
7680 | this.animationTimer = 0;
|
7681 | this.adapter.removeClass(constants_1.cssClasses.OPENING);
|
7682 | this.adapter.removeClass(constants_1.cssClasses.CLOSING);
|
7683 | };
|
7684 | |
7685 |
|
7686 |
|
7687 |
|
7688 | MDCDialogFoundation.prototype.runNextAnimationFrame = function (callback) {
|
7689 | var _this = this;
|
7690 | cancelAnimationFrame(this.animationFrame);
|
7691 | this.animationFrame = requestAnimationFrame(function () {
|
7692 | _this.animationFrame = 0;
|
7693 | clearTimeout(_this.animationTimer);
|
7694 | _this.animationTimer = setTimeout(callback, 0);
|
7695 | });
|
7696 | };
|
7697 | MDCDialogFoundation.prototype.detectStackedButtons = function () {
|
7698 |
|
7699 | this.adapter.removeClass(constants_1.cssClasses.STACKED);
|
7700 | var areButtonsStacked = this.adapter.areButtonsStacked();
|
7701 | if (areButtonsStacked) {
|
7702 | this.adapter.addClass(constants_1.cssClasses.STACKED);
|
7703 | }
|
7704 | if (areButtonsStacked !== this.areButtonsStacked) {
|
7705 | this.adapter.reverseButtons();
|
7706 | this.areButtonsStacked = areButtonsStacked;
|
7707 | }
|
7708 | };
|
7709 | MDCDialogFoundation.prototype.toggleScrollableClasses = function () {
|
7710 |
|
7711 |
|
7712 | this.adapter.removeClass(constants_1.cssClasses.SCROLLABLE);
|
7713 | if (this.adapter.isContentScrollable()) {
|
7714 | this.adapter.addClass(constants_1.cssClasses.SCROLLABLE);
|
7715 | if (this.isFullscreen) {
|
7716 |
|
7717 |
|
7718 | this.toggleScrollDividerHeader();
|
7719 | this.toggleScrollDividerFooter();
|
7720 | }
|
7721 | }
|
7722 | };
|
7723 | MDCDialogFoundation.prototype.toggleScrollDividerHeader = function () {
|
7724 | if (!this.adapter.isScrollableContentAtTop()) {
|
7725 | this.adapter.addClass(constants_1.cssClasses.SCROLL_DIVIDER_HEADER);
|
7726 | } else if (this.adapter.hasClass(constants_1.cssClasses.SCROLL_DIVIDER_HEADER)) {
|
7727 | this.adapter.removeClass(constants_1.cssClasses.SCROLL_DIVIDER_HEADER);
|
7728 | }
|
7729 | };
|
7730 | MDCDialogFoundation.prototype.toggleScrollDividerFooter = function () {
|
7731 | if (!this.adapter.isScrollableContentAtBottom()) {
|
7732 | this.adapter.addClass(constants_1.cssClasses.SCROLL_DIVIDER_FOOTER);
|
7733 | } else if (this.adapter.hasClass(constants_1.cssClasses.SCROLL_DIVIDER_FOOTER)) {
|
7734 | this.adapter.removeClass(constants_1.cssClasses.SCROLL_DIVIDER_FOOTER);
|
7735 | }
|
7736 | };
|
7737 | return MDCDialogFoundation;
|
7738 | }(foundation_1.MDCFoundation);
|
7739 | exports.MDCDialogFoundation = MDCDialogFoundation;
|
7740 |
|
7741 | exports.default = MDCDialogFoundation;
|
7742 |
|
7743 | }),
|
7744 |
|
7745 | "./packages/mdc-dialog/index.ts":
|
7746 |
|
7747 |
|
7748 |
|
7749 |
|
7750 | (function(module, exports, __webpack_require__) {
|
7751 |
|
7752 | "use strict";
|
7753 |
|
7754 |
|
7755 |
|
7756 |
|
7757 |
|
7758 |
|
7759 |
|
7760 |
|
7761 |
|
7762 |
|
7763 |
|
7764 |
|
7765 |
|
7766 |
|
7767 |
|
7768 |
|
7769 |
|
7770 |
|
7771 |
|
7772 |
|
7773 |
|
7774 |
|
7775 |
|
7776 |
|
7777 | var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
|
7778 | if (k2 === undefined) k2 = k;
|
7779 | Object.defineProperty(o, k2, { enumerable: true, get: function get() {
|
7780 | return m[k];
|
7781 | } });
|
7782 | } : function (o, m, k, k2) {
|
7783 | if (k2 === undefined) k2 = k;
|
7784 | o[k2] = m[k];
|
7785 | });
|
7786 | var __setModuleDefault = this && this.__setModuleDefault || (Object.create ? function (o, v) {
|
7787 | Object.defineProperty(o, "default", { enumerable: true, value: v });
|
7788 | } : function (o, v) {
|
7789 | o["default"] = v;
|
7790 | });
|
7791 | var __importStar = this && this.__importStar || function (mod) {
|
7792 | if (mod && mod.__esModule) return mod;
|
7793 | var result = {};
|
7794 | if (mod != null) for (var k in mod) {
|
7795 | if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
7796 | }__setModuleDefault(result, mod);
|
7797 | return result;
|
7798 | };
|
7799 | var __exportStar = this && this.__exportStar || function (m, exports) {
|
7800 | for (var p in m) {
|
7801 | if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
7802 | }
|
7803 | };
|
7804 | Object.defineProperty(exports, "__esModule", { value: true });
|
7805 | exports.util = void 0;
|
7806 | var util = __importStar(__webpack_require__( "./packages/mdc-dialog/util.ts"));
|
7807 | exports.util = util;
|
7808 | __exportStar(__webpack_require__( "./packages/mdc-dialog/adapter.ts"), exports);
|
7809 | __exportStar(__webpack_require__( "./packages/mdc-dialog/component.ts"), exports);
|
7810 | __exportStar(__webpack_require__( "./packages/mdc-dialog/constants.ts"), exports);
|
7811 | __exportStar(__webpack_require__( "./packages/mdc-dialog/foundation.ts"), exports);
|
7812 | __exportStar(__webpack_require__( "./packages/mdc-dialog/types.ts"), exports);
|
7813 |
|
7814 | }),
|
7815 |
|
7816 | "./packages/mdc-dialog/types.ts":
|
7817 |
|
7818 |
|
7819 |
|
7820 |
|
7821 | (function(module, exports, __webpack_require__) {
|
7822 |
|
7823 | "use strict";
|
7824 |
|
7825 |
|
7826 |
|
7827 |
|
7828 |
|
7829 |
|
7830 |
|
7831 |
|
7832 |
|
7833 |
|
7834 |
|
7835 |
|
7836 |
|
7837 |
|
7838 |
|
7839 |
|
7840 |
|
7841 |
|
7842 |
|
7843 |
|
7844 |
|
7845 |
|
7846 |
|
7847 |
|
7848 | Object.defineProperty(exports, "__esModule", { value: true });
|
7849 |
|
7850 | }),
|
7851 |
|
7852 | "./packages/mdc-dialog/util.ts":
|
7853 |
|
7854 |
|
7855 |
|
7856 |
|
7857 | (function(module, exports, __webpack_require__) {
|
7858 |
|
7859 | "use strict";
|
7860 |
|
7861 |
|
7862 |
|
7863 |
|
7864 |
|
7865 |
|
7866 |
|
7867 |
|
7868 |
|
7869 |
|
7870 |
|
7871 |
|
7872 |
|
7873 |
|
7874 |
|
7875 |
|
7876 |
|
7877 |
|
7878 |
|
7879 |
|
7880 |
|
7881 |
|
7882 |
|
7883 |
|
7884 | Object.defineProperty(exports, "__esModule", { value: true });
|
7885 | exports.areTopsMisaligned = exports.isScrollAtBottom = exports.isScrollAtTop = exports.isScrollable = exports.createFocusTrapInstance = void 0;
|
7886 | function createFocusTrapInstance(surfaceEl, focusTrapFactory, initialFocusEl) {
|
7887 | return focusTrapFactory(surfaceEl, { initialFocusEl: initialFocusEl });
|
7888 | }
|
7889 | exports.createFocusTrapInstance = createFocusTrapInstance;
|
7890 | function isScrollable(el) {
|
7891 | return el ? el.scrollHeight > el.offsetHeight : false;
|
7892 | }
|
7893 | exports.isScrollable = isScrollable;
|
7894 |
|
7895 |
|
7896 |
|
7897 |
|
7898 |
|
7899 |
|
7900 | function isScrollAtTop(el) {
|
7901 | return el ? el.scrollTop === 0 : false;
|
7902 | }
|
7903 | exports.isScrollAtTop = isScrollAtTop;
|
7904 |
|
7905 |
|
7906 |
|
7907 |
|
7908 |
|
7909 |
|
7910 | function isScrollAtBottom(el) {
|
7911 | return el ? Math.ceil(el.scrollHeight - el.scrollTop) === el.clientHeight : false;
|
7912 | }
|
7913 | exports.isScrollAtBottom = isScrollAtBottom;
|
7914 | function areTopsMisaligned(els) {
|
7915 | var tops = new Set();
|
7916 | [].forEach.call(els, function (el) {
|
7917 | return tops.add(el.offsetTop);
|
7918 | });
|
7919 | return tops.size > 1;
|
7920 | }
|
7921 | exports.areTopsMisaligned = areTopsMisaligned;
|
7922 |
|
7923 | }),
|
7924 |
|
7925 | "./packages/mdc-dom/announce.ts":
|
7926 |
|
7927 |
|
7928 |
|
7929 |
|
7930 | (function(module, exports, __webpack_require__) {
|
7931 |
|
7932 | "use strict";
|
7933 |
|
7934 |
|
7935 |
|
7936 |
|
7937 |
|
7938 |
|
7939 |
|
7940 |
|
7941 |
|
7942 |
|
7943 |
|
7944 |
|
7945 |
|
7946 |
|
7947 |
|
7948 |
|
7949 |
|
7950 |
|
7951 |
|
7952 |
|
7953 |
|
7954 |
|
7955 |
|
7956 |
|
7957 | Object.defineProperty(exports, "__esModule", { value: true });
|
7958 | exports.announce = exports.DATA_MDC_DOM_ANNOUNCE = exports.AnnouncerPriority = void 0;
|
7959 |
|
7960 |
|
7961 |
|
7962 | var AnnouncerPriority;
|
7963 | (function (AnnouncerPriority) {
|
7964 | AnnouncerPriority["POLITE"] = "polite";
|
7965 | AnnouncerPriority["ASSERTIVE"] = "assertive";
|
7966 | })(AnnouncerPriority = exports.AnnouncerPriority || (exports.AnnouncerPriority = {}));
|
7967 |
|
7968 |
|
7969 |
|
7970 | exports.DATA_MDC_DOM_ANNOUNCE = 'data-mdc-dom-announce';
|
7971 |
|
7972 |
|
7973 |
|
7974 | function announce(message, options) {
|
7975 | Announcer.getInstance().say(message, options);
|
7976 | }
|
7977 | exports.announce = announce;
|
7978 | var Announcer = function () {
|
7979 |
|
7980 | function Announcer() {
|
7981 | this.liveRegions = new Map();
|
7982 | }
|
7983 | Announcer.getInstance = function () {
|
7984 | if (!Announcer.instance) {
|
7985 | Announcer.instance = new Announcer();
|
7986 | }
|
7987 | return Announcer.instance;
|
7988 | };
|
7989 | Announcer.prototype.say = function (message, options) {
|
7990 | var _a, _b;
|
7991 | var priority = (_a = options === null || options === void 0 ? void 0 : options.priority) !== null && _a !== void 0 ? _a : AnnouncerPriority.POLITE;
|
7992 | var ownerDocument = (_b = options === null || options === void 0 ? void 0 : options.ownerDocument) !== null && _b !== void 0 ? _b : document;
|
7993 | var liveRegion = this.getLiveRegion(priority, ownerDocument);
|
7994 |
|
7995 |
|
7996 | liveRegion.textContent = '';
|
7997 |
|
7998 | setTimeout(function () {
|
7999 | liveRegion.textContent = message;
|
8000 | ownerDocument.addEventListener('click', clearLiveRegion);
|
8001 | }, 1);
|
8002 | function clearLiveRegion() {
|
8003 | liveRegion.textContent = '';
|
8004 | ownerDocument.removeEventListener('click', clearLiveRegion);
|
8005 | }
|
8006 | };
|
8007 | Announcer.prototype.getLiveRegion = function (priority, ownerDocument) {
|
8008 | var documentLiveRegions = this.liveRegions.get(ownerDocument);
|
8009 | if (!documentLiveRegions) {
|
8010 | documentLiveRegions = new Map();
|
8011 | this.liveRegions.set(ownerDocument, documentLiveRegions);
|
8012 | }
|
8013 | var existingLiveRegion = documentLiveRegions.get(priority);
|
8014 | if (existingLiveRegion && ownerDocument.body.contains(existingLiveRegion)) {
|
8015 | return existingLiveRegion;
|
8016 | }
|
8017 | var liveRegion = this.createLiveRegion(priority, ownerDocument);
|
8018 | documentLiveRegions.set(priority, liveRegion);
|
8019 | return liveRegion;
|
8020 | };
|
8021 | Announcer.prototype.createLiveRegion = function (priority, ownerDocument) {
|
8022 | var el = ownerDocument.createElement('div');
|
8023 | el.style.position = 'absolute';
|
8024 | el.style.top = '-9999px';
|
8025 | el.style.left = '-9999px';
|
8026 | el.style.height = '1px';
|
8027 | el.style.overflow = 'hidden';
|
8028 | el.setAttribute('aria-atomic', 'true');
|
8029 | el.setAttribute('aria-live', priority);
|
8030 | el.setAttribute(exports.DATA_MDC_DOM_ANNOUNCE, 'true');
|
8031 | ownerDocument.body.appendChild(el);
|
8032 | return el;
|
8033 | };
|
8034 | return Announcer;
|
8035 | }();
|
8036 |
|
8037 | }),
|
8038 |
|
8039 | "./packages/mdc-dom/events.ts":
|
8040 |
|
8041 |
|
8042 |
|
8043 |
|
8044 | (function(module, exports, __webpack_require__) {
|
8045 |
|
8046 | "use strict";
|
8047 |
|
8048 |
|
8049 |
|
8050 |
|
8051 |
|
8052 |
|
8053 |
|
8054 |
|
8055 |
|
8056 |
|
8057 |
|
8058 |
|
8059 |
|
8060 |
|
8061 |
|
8062 |
|
8063 |
|
8064 |
|
8065 |
|
8066 |
|
8067 |
|
8068 |
|
8069 |
|
8070 |
|
8071 | Object.defineProperty(exports, "__esModule", { value: true });
|
8072 | exports.applyPassive = void 0;
|
8073 |
|
8074 |
|
8075 |
|
8076 |
|
8077 | function applyPassive(globalObj) {
|
8078 | if (globalObj === void 0) {
|
8079 | globalObj = window;
|
8080 | }
|
8081 | return supportsPassiveOption(globalObj) ? { passive: true } : false;
|
8082 | }
|
8083 | exports.applyPassive = applyPassive;
|
8084 | function supportsPassiveOption(globalObj) {
|
8085 | if (globalObj === void 0) {
|
8086 | globalObj = window;
|
8087 | }
|
8088 |
|
8089 |
|
8090 | var passiveSupported = false;
|
8091 | try {
|
8092 | var options = {
|
8093 |
|
8094 |
|
8095 | get passive() {
|
8096 | passiveSupported = true;
|
8097 | return false;
|
8098 | }
|
8099 | };
|
8100 | var handler = function handler() {};
|
8101 | globalObj.document.addEventListener('test', handler, options);
|
8102 | globalObj.document.removeEventListener('test', handler, options);
|
8103 | } catch (err) {
|
8104 | passiveSupported = false;
|
8105 | }
|
8106 | return passiveSupported;
|
8107 | }
|
8108 |
|
8109 | }),
|
8110 |
|
8111 | "./packages/mdc-dom/focus-trap.ts":
|
8112 |
|
8113 |
|
8114 |
|
8115 |
|
8116 | (function(module, exports, __webpack_require__) {
|
8117 |
|
8118 | "use strict";
|
8119 |
|
8120 |
|
8121 |
|
8122 |
|
8123 |
|
8124 |
|
8125 |
|
8126 |
|
8127 |
|
8128 |
|
8129 |
|
8130 |
|
8131 |
|
8132 |
|
8133 |
|
8134 |
|
8135 |
|
8136 |
|
8137 |
|
8138 |
|
8139 |
|
8140 |
|
8141 |
|
8142 |
|
8143 | Object.defineProperty(exports, "__esModule", { value: true });
|
8144 | exports.FocusTrap = void 0;
|
8145 | var FOCUS_SENTINEL_CLASS = 'mdc-dom-focus-sentinel';
|
8146 |
|
8147 |
|
8148 |
|
8149 |
|
8150 |
|
8151 |
|
8152 |
|
8153 | var FocusTrap = function () {
|
8154 | function FocusTrap(root, options) {
|
8155 | if (options === void 0) {
|
8156 | options = {};
|
8157 | }
|
8158 | this.root = root;
|
8159 | this.options = options;
|
8160 |
|
8161 | this.elFocusedBeforeTrapFocus = null;
|
8162 | }
|
8163 | |
8164 |
|
8165 |
|
8166 |
|
8167 | FocusTrap.prototype.trapFocus = function () {
|
8168 | var focusableEls = this.getFocusableElements(this.root);
|
8169 | if (focusableEls.length === 0) {
|
8170 | throw new Error('FocusTrap: Element must have at least one focusable child.');
|
8171 | }
|
8172 | this.elFocusedBeforeTrapFocus = document.activeElement instanceof HTMLElement ? document.activeElement : null;
|
8173 | this.wrapTabFocus(this.root);
|
8174 | if (!this.options.skipInitialFocus) {
|
8175 | this.focusInitialElement(focusableEls, this.options.initialFocusEl);
|
8176 | }
|
8177 | };
|
8178 | |
8179 |
|
8180 |
|
8181 |
|
8182 | FocusTrap.prototype.releaseFocus = function () {
|
8183 | [].slice.call(this.root.querySelectorAll("." + FOCUS_SENTINEL_CLASS)).forEach(function (sentinelEl) {
|
8184 | sentinelEl.parentElement.removeChild(sentinelEl);
|
8185 | });
|
8186 | if (!this.options.skipRestoreFocus && this.elFocusedBeforeTrapFocus) {
|
8187 | this.elFocusedBeforeTrapFocus.focus();
|
8188 | }
|
8189 | };
|
8190 | |
8191 |
|
8192 |
|
8193 |
|
8194 |
|
8195 |
|
8196 |
|
8197 | FocusTrap.prototype.wrapTabFocus = function (el) {
|
8198 | var _this = this;
|
8199 | var sentinelStart = this.createSentinel();
|
8200 | var sentinelEnd = this.createSentinel();
|
8201 | sentinelStart.addEventListener('focus', function () {
|
8202 | var focusableEls = _this.getFocusableElements(el);
|
8203 | if (focusableEls.length > 0) {
|
8204 | focusableEls[focusableEls.length - 1].focus();
|
8205 | }
|
8206 | });
|
8207 | sentinelEnd.addEventListener('focus', function () {
|
8208 | var focusableEls = _this.getFocusableElements(el);
|
8209 | if (focusableEls.length > 0) {
|
8210 | focusableEls[0].focus();
|
8211 | }
|
8212 | });
|
8213 | el.insertBefore(sentinelStart, el.children[0]);
|
8214 | el.appendChild(sentinelEnd);
|
8215 | };
|
8216 | |
8217 |
|
8218 |
|
8219 |
|
8220 | FocusTrap.prototype.focusInitialElement = function (focusableEls, initialFocusEl) {
|
8221 | var focusIndex = 0;
|
8222 | if (initialFocusEl) {
|
8223 | focusIndex = Math.max(focusableEls.indexOf(initialFocusEl), 0);
|
8224 | }
|
8225 | focusableEls[focusIndex].focus();
|
8226 | };
|
8227 | FocusTrap.prototype.getFocusableElements = function (root) {
|
8228 | var focusableEls = [].slice.call(root.querySelectorAll('[autofocus], [tabindex], a, input, textarea, select, button'));
|
8229 | return focusableEls.filter(function (el) {
|
8230 | var isDisabledOrHidden = el.getAttribute('aria-disabled') === 'true' || el.getAttribute('disabled') != null || el.getAttribute('hidden') != null || el.getAttribute('aria-hidden') === 'true';
|
8231 | var isTabbableAndVisible = el.tabIndex >= 0 && el.getBoundingClientRect().width > 0 && !el.classList.contains(FOCUS_SENTINEL_CLASS) && !isDisabledOrHidden;
|
8232 | var isProgrammaticallyHidden = false;
|
8233 | if (isTabbableAndVisible) {
|
8234 | var style = getComputedStyle(el);
|
8235 | isProgrammaticallyHidden = style.display === 'none' || style.visibility === 'hidden';
|
8236 | }
|
8237 | return isTabbableAndVisible && !isProgrammaticallyHidden;
|
8238 | });
|
8239 | };
|
8240 | FocusTrap.prototype.createSentinel = function () {
|
8241 | var sentinel = document.createElement('div');
|
8242 | sentinel.setAttribute('tabindex', '0');
|
8243 |
|
8244 | sentinel.setAttribute('aria-hidden', 'true');
|
8245 | sentinel.classList.add(FOCUS_SENTINEL_CLASS);
|
8246 | return sentinel;
|
8247 | };
|
8248 | return FocusTrap;
|
8249 | }();
|
8250 | exports.FocusTrap = FocusTrap;
|
8251 |
|
8252 | }),
|
8253 |
|
8254 | "./packages/mdc-dom/index.ts":
|
8255 |
|
8256 |
|
8257 |
|
8258 |
|
8259 | (function(module, exports, __webpack_require__) {
|
8260 |
|
8261 | "use strict";
|
8262 |
|
8263 |
|
8264 |
|
8265 |
|
8266 |
|
8267 |
|
8268 |
|
8269 |
|
8270 |
|
8271 |
|
8272 |
|
8273 |
|
8274 |
|
8275 |
|
8276 |
|
8277 |
|
8278 |
|
8279 |
|
8280 |
|
8281 |
|
8282 |
|
8283 |
|
8284 |
|
8285 |
|
8286 | var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
|
8287 | if (k2 === undefined) k2 = k;
|
8288 | Object.defineProperty(o, k2, { enumerable: true, get: function get() {
|
8289 | return m[k];
|
8290 | } });
|
8291 | } : function (o, m, k, k2) {
|
8292 | if (k2 === undefined) k2 = k;
|
8293 | o[k2] = m[k];
|
8294 | });
|
8295 | var __setModuleDefault = this && this.__setModuleDefault || (Object.create ? function (o, v) {
|
8296 | Object.defineProperty(o, "default", { enumerable: true, value: v });
|
8297 | } : function (o, v) {
|
8298 | o["default"] = v;
|
8299 | });
|
8300 | var __importStar = this && this.__importStar || function (mod) {
|
8301 | if (mod && mod.__esModule) return mod;
|
8302 | var result = {};
|
8303 | if (mod != null) for (var k in mod) {
|
8304 | if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
8305 | }__setModuleDefault(result, mod);
|
8306 | return result;
|
8307 | };
|
8308 | Object.defineProperty(exports, "__esModule", { value: true });
|
8309 | exports.ponyfill = exports.keyboard = exports.focusTrap = exports.events = void 0;
|
8310 | var events = __importStar(__webpack_require__( "./packages/mdc-dom/events.ts"));
|
8311 | exports.events = events;
|
8312 | var focusTrap = __importStar(__webpack_require__( "./packages/mdc-dom/focus-trap.ts"));
|
8313 | exports.focusTrap = focusTrap;
|
8314 | var keyboard = __importStar(__webpack_require__( "./packages/mdc-dom/keyboard.ts"));
|
8315 | exports.keyboard = keyboard;
|
8316 | var ponyfill = __importStar(__webpack_require__( "./packages/mdc-dom/ponyfill.ts"));
|
8317 | exports.ponyfill = ponyfill;
|
8318 |
|
8319 | }),
|
8320 |
|
8321 | "./packages/mdc-dom/keyboard.ts":
|
8322 |
|
8323 |
|
8324 |
|
8325 |
|
8326 | (function(module, exports, __webpack_require__) {
|
8327 |
|
8328 | "use strict";
|
8329 |
|
8330 |
|
8331 |
|
8332 |
|
8333 |
|
8334 |
|
8335 |
|
8336 |
|
8337 |
|
8338 |
|
8339 |
|
8340 |
|
8341 |
|
8342 |
|
8343 |
|
8344 |
|
8345 |
|
8346 |
|
8347 |
|
8348 |
|
8349 |
|
8350 |
|
8351 |
|
8352 |
|
8353 | Object.defineProperty(exports, "__esModule", { value: true });
|
8354 | exports.isNavigationEvent = exports.normalizeKey = exports.KEY = void 0;
|
8355 |
|
8356 |
|
8357 |
|
8358 | exports.KEY = {
|
8359 | UNKNOWN: 'Unknown',
|
8360 | BACKSPACE: 'Backspace',
|
8361 | ENTER: 'Enter',
|
8362 | SPACEBAR: 'Spacebar',
|
8363 | PAGE_UP: 'PageUp',
|
8364 | PAGE_DOWN: 'PageDown',
|
8365 | END: 'End',
|
8366 | HOME: 'Home',
|
8367 | ARROW_LEFT: 'ArrowLeft',
|
8368 | ARROW_UP: 'ArrowUp',
|
8369 | ARROW_RIGHT: 'ArrowRight',
|
8370 | ARROW_DOWN: 'ArrowDown',
|
8371 | DELETE: 'Delete',
|
8372 | ESCAPE: 'Escape',
|
8373 | TAB: 'Tab'
|
8374 | };
|
8375 | var normalizedKeys = new Set();
|
8376 |
|
8377 |
|
8378 | normalizedKeys.add(exports.KEY.BACKSPACE);
|
8379 | normalizedKeys.add(exports.KEY.ENTER);
|
8380 | normalizedKeys.add(exports.KEY.SPACEBAR);
|
8381 | normalizedKeys.add(exports.KEY.PAGE_UP);
|
8382 | normalizedKeys.add(exports.KEY.PAGE_DOWN);
|
8383 | normalizedKeys.add(exports.KEY.END);
|
8384 | normalizedKeys.add(exports.KEY.HOME);
|
8385 | normalizedKeys.add(exports.KEY.ARROW_LEFT);
|
8386 | normalizedKeys.add(exports.KEY.ARROW_UP);
|
8387 | normalizedKeys.add(exports.KEY.ARROW_RIGHT);
|
8388 | normalizedKeys.add(exports.KEY.ARROW_DOWN);
|
8389 | normalizedKeys.add(exports.KEY.DELETE);
|
8390 | normalizedKeys.add(exports.KEY.ESCAPE);
|
8391 | normalizedKeys.add(exports.KEY.TAB);
|
8392 | var KEY_CODE = {
|
8393 | BACKSPACE: 8,
|
8394 | ENTER: 13,
|
8395 | SPACEBAR: 32,
|
8396 | PAGE_UP: 33,
|
8397 | PAGE_DOWN: 34,
|
8398 | END: 35,
|
8399 | HOME: 36,
|
8400 | ARROW_LEFT: 37,
|
8401 | ARROW_UP: 38,
|
8402 | ARROW_RIGHT: 39,
|
8403 | ARROW_DOWN: 40,
|
8404 | DELETE: 46,
|
8405 | ESCAPE: 27,
|
8406 | TAB: 9
|
8407 | };
|
8408 | var mappedKeyCodes = new Map();
|
8409 |
|
8410 |
|
8411 | mappedKeyCodes.set(KEY_CODE.BACKSPACE, exports.KEY.BACKSPACE);
|
8412 | mappedKeyCodes.set(KEY_CODE.ENTER, exports.KEY.ENTER);
|
8413 | mappedKeyCodes.set(KEY_CODE.SPACEBAR, exports.KEY.SPACEBAR);
|
8414 | mappedKeyCodes.set(KEY_CODE.PAGE_UP, exports.KEY.PAGE_UP);
|
8415 | mappedKeyCodes.set(KEY_CODE.PAGE_DOWN, exports.KEY.PAGE_DOWN);
|
8416 | mappedKeyCodes.set(KEY_CODE.END, exports.KEY.END);
|
8417 | mappedKeyCodes.set(KEY_CODE.HOME, exports.KEY.HOME);
|
8418 | mappedKeyCodes.set(KEY_CODE.ARROW_LEFT, exports.KEY.ARROW_LEFT);
|
8419 | mappedKeyCodes.set(KEY_CODE.ARROW_UP, exports.KEY.ARROW_UP);
|
8420 | mappedKeyCodes.set(KEY_CODE.ARROW_RIGHT, exports.KEY.ARROW_RIGHT);
|
8421 | mappedKeyCodes.set(KEY_CODE.ARROW_DOWN, exports.KEY.ARROW_DOWN);
|
8422 | mappedKeyCodes.set(KEY_CODE.DELETE, exports.KEY.DELETE);
|
8423 | mappedKeyCodes.set(KEY_CODE.ESCAPE, exports.KEY.ESCAPE);
|
8424 | mappedKeyCodes.set(KEY_CODE.TAB, exports.KEY.TAB);
|
8425 | var navigationKeys = new Set();
|
8426 |
|
8427 |
|
8428 | navigationKeys.add(exports.KEY.PAGE_UP);
|
8429 | navigationKeys.add(exports.KEY.PAGE_DOWN);
|
8430 | navigationKeys.add(exports.KEY.END);
|
8431 | navigationKeys.add(exports.KEY.HOME);
|
8432 | navigationKeys.add(exports.KEY.ARROW_LEFT);
|
8433 | navigationKeys.add(exports.KEY.ARROW_UP);
|
8434 | navigationKeys.add(exports.KEY.ARROW_RIGHT);
|
8435 | navigationKeys.add(exports.KEY.ARROW_DOWN);
|
8436 |
|
8437 |
|
8438 |
|
8439 | function normalizeKey(evt) {
|
8440 | var key = evt.key;
|
8441 |
|
8442 | if (normalizedKeys.has(key)) {
|
8443 | return key;
|
8444 | }
|
8445 |
|
8446 | var mappedKey = mappedKeyCodes.get(evt.keyCode);
|
8447 | if (mappedKey) {
|
8448 | return mappedKey;
|
8449 | }
|
8450 | return exports.KEY.UNKNOWN;
|
8451 | }
|
8452 | exports.normalizeKey = normalizeKey;
|
8453 |
|
8454 |
|
8455 |
|
8456 | function isNavigationEvent(evt) {
|
8457 | return navigationKeys.has(normalizeKey(evt));
|
8458 | }
|
8459 | exports.isNavigationEvent = isNavigationEvent;
|
8460 |
|
8461 | }),
|
8462 |
|
8463 | "./packages/mdc-dom/ponyfill.ts":
|
8464 |
|
8465 |
|
8466 |
|
8467 |
|
8468 | (function(module, exports, __webpack_require__) {
|
8469 |
|
8470 | "use strict";
|
8471 |
|
8472 |
|
8473 |
|
8474 |
|
8475 |
|
8476 |
|
8477 |
|
8478 |
|
8479 |
|
8480 |
|
8481 |
|
8482 |
|
8483 |
|
8484 |
|
8485 |
|
8486 |
|
8487 |
|
8488 |
|
8489 |
|
8490 |
|
8491 |
|
8492 |
|
8493 |
|
8494 |
|
8495 | Object.defineProperty(exports, "__esModule", { value: true });
|
8496 | exports.estimateScrollWidth = exports.matches = exports.closest = void 0;
|
8497 |
|
8498 |
|
8499 |
|
8500 |
|
8501 | function closest(element, selector) {
|
8502 | if (element.closest) {
|
8503 | return element.closest(selector);
|
8504 | }
|
8505 | var el = element;
|
8506 | while (el) {
|
8507 | if (matches(el, selector)) {
|
8508 | return el;
|
8509 | }
|
8510 | el = el.parentElement;
|
8511 | }
|
8512 | return null;
|
8513 | }
|
8514 | exports.closest = closest;
|
8515 | function matches(element, selector) {
|
8516 | var nativeMatches = element.matches || element.webkitMatchesSelector || element.msMatchesSelector;
|
8517 | return nativeMatches.call(element, selector);
|
8518 | }
|
8519 | exports.matches = matches;
|
8520 |
|
8521 |
|
8522 |
|
8523 |
|
8524 |
|
8525 |
|
8526 |
|
8527 |
|
8528 | function estimateScrollWidth(element) {
|
8529 |
|
8530 |
|
8531 |
|
8532 |
|
8533 | var htmlEl = element;
|
8534 | if (htmlEl.offsetParent !== null) {
|
8535 | return htmlEl.scrollWidth;
|
8536 | }
|
8537 | var clone = htmlEl.cloneNode(true);
|
8538 | clone.style.setProperty('position', 'absolute');
|
8539 | clone.style.setProperty('transform', 'translate(-9999px, -9999px)');
|
8540 | document.documentElement.appendChild(clone);
|
8541 | var scrollWidth = clone.scrollWidth;
|
8542 | document.documentElement.removeChild(clone);
|
8543 | return scrollWidth;
|
8544 | }
|
8545 | exports.estimateScrollWidth = estimateScrollWidth;
|
8546 |
|
8547 | }),
|
8548 |
|
8549 | "./packages/mdc-drawer/adapter.ts":
|
8550 |
|
8551 |
|
8552 |
|
8553 |
|
8554 | (function(module, exports, __webpack_require__) {
|
8555 |
|
8556 | "use strict";
|
8557 |
|
8558 |
|
8559 |
|
8560 |
|
8561 |
|
8562 |
|
8563 |
|
8564 |
|
8565 |
|
8566 |
|
8567 |
|
8568 |
|
8569 |
|
8570 |
|
8571 |
|
8572 |
|
8573 |
|
8574 |
|
8575 |
|
8576 |
|
8577 |
|
8578 |
|
8579 |
|
8580 |
|
8581 | Object.defineProperty(exports, "__esModule", { value: true });
|
8582 |
|
8583 | }),
|
8584 |
|
8585 | "./packages/mdc-drawer/component.ts":
|
8586 |
|
8587 |
|
8588 |
|
8589 |
|
8590 | (function(module, exports, __webpack_require__) {
|
8591 |
|
8592 | "use strict";
|
8593 |
|
8594 |
|
8595 |
|
8596 |
|
8597 |
|
8598 |
|
8599 |
|
8600 |
|
8601 |
|
8602 |
|
8603 |
|
8604 |
|
8605 |
|
8606 |
|
8607 |
|
8608 |
|
8609 |
|
8610 |
|
8611 |
|
8612 |
|
8613 |
|
8614 |
|
8615 |
|
8616 |
|
8617 | var __extends = this && this.__extends || function () {
|
8618 | var _extendStatics = function extendStatics(d, b) {
|
8619 | _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
|
8620 | d.__proto__ = b;
|
8621 | } || function (d, b) {
|
8622 | for (var p in b) {
|
8623 | if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
8624 | }
|
8625 | };
|
8626 | return _extendStatics(d, b);
|
8627 | };
|
8628 | return function (d, b) {
|
8629 | if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
8630 | _extendStatics(d, b);
|
8631 | function __() {
|
8632 | this.constructor = d;
|
8633 | }
|
8634 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
8635 | };
|
8636 | }();
|
8637 | var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
|
8638 | if (k2 === undefined) k2 = k;
|
8639 | Object.defineProperty(o, k2, { enumerable: true, get: function get() {
|
8640 | return m[k];
|
8641 | } });
|
8642 | } : function (o, m, k, k2) {
|
8643 | if (k2 === undefined) k2 = k;
|
8644 | o[k2] = m[k];
|
8645 | });
|
8646 | var __setModuleDefault = this && this.__setModuleDefault || (Object.create ? function (o, v) {
|
8647 | Object.defineProperty(o, "default", { enumerable: true, value: v });
|
8648 | } : function (o, v) {
|
8649 | o["default"] = v;
|
8650 | });
|
8651 | var __importStar = this && this.__importStar || function (mod) {
|
8652 | if (mod && mod.__esModule) return mod;
|
8653 | var result = {};
|
8654 | if (mod != null) for (var k in mod) {
|
8655 | if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
8656 | }__setModuleDefault(result, mod);
|
8657 | return result;
|
8658 | };
|
8659 | Object.defineProperty(exports, "__esModule", { value: true });
|
8660 | exports.MDCDrawer = void 0;
|
8661 | var component_1 = __webpack_require__( "./packages/mdc-base/component.ts");
|
8662 | var focus_trap_1 = __webpack_require__( "./packages/mdc-dom/focus-trap.ts");
|
8663 | var component_2 = __webpack_require__( "./packages/mdc-list/component.ts");
|
8664 | var foundation_1 = __webpack_require__( "./packages/mdc-drawer/dismissible/foundation.ts");
|
8665 | var foundation_2 = __webpack_require__( "./packages/mdc-drawer/modal/foundation.ts");
|
8666 | var util = __importStar(__webpack_require__( "./packages/mdc-drawer/util.ts"));
|
8667 | var cssClasses = foundation_1.MDCDismissibleDrawerFoundation.cssClasses,
|
8668 | strings = foundation_1.MDCDismissibleDrawerFoundation.strings;
|
8669 |
|
8670 |
|
8671 |
|
8672 |
|
8673 | var MDCDrawer = function (_super) {
|
8674 | __extends(MDCDrawer, _super);
|
8675 | function MDCDrawer() {
|
8676 | return _super !== null && _super.apply(this, arguments) || this;
|
8677 | }
|
8678 | MDCDrawer.attachTo = function (root) {
|
8679 | return new MDCDrawer(root);
|
8680 | };
|
8681 | Object.defineProperty(MDCDrawer.prototype, "open", {
|
8682 | |
8683 |
|
8684 |
|
8685 |
|
8686 | get: function get() {
|
8687 | return this.foundation.isOpen();
|
8688 | },
|
8689 | |
8690 |
|
8691 |
|
8692 | set: function set(isOpen) {
|
8693 | if (isOpen) {
|
8694 | this.foundation.open();
|
8695 | } else {
|
8696 | this.foundation.close();
|
8697 | }
|
8698 | },
|
8699 | enumerable: false,
|
8700 | configurable: true
|
8701 | });
|
8702 | Object.defineProperty(MDCDrawer.prototype, "list", {
|
8703 |
|
8704 | get: function get() {
|
8705 | return this.innerList;
|
8706 | },
|
8707 | enumerable: false,
|
8708 | configurable: true
|
8709 | });
|
8710 | MDCDrawer.prototype.initialize = function (focusTrapFactory, listFactory) {
|
8711 | if (focusTrapFactory === void 0) {
|
8712 | focusTrapFactory = function focusTrapFactory(el) {
|
8713 | return new focus_trap_1.FocusTrap(el);
|
8714 | };
|
8715 | }
|
8716 | if (listFactory === void 0) {
|
8717 | listFactory = function listFactory(el) {
|
8718 | return new component_2.MDCList(el);
|
8719 | };
|
8720 | }
|
8721 | var listEl = this.root.querySelector(strings.LIST_SELECTOR);
|
8722 | if (listEl) {
|
8723 | this.innerList = listFactory(listEl);
|
8724 | this.innerList.wrapFocus = true;
|
8725 | }
|
8726 | this.focusTrapFactory = focusTrapFactory;
|
8727 | };
|
8728 | MDCDrawer.prototype.initialSyncWithDOM = function () {
|
8729 | var _this = this;
|
8730 | var MODAL = cssClasses.MODAL;
|
8731 | var SCRIM_SELECTOR = strings.SCRIM_SELECTOR;
|
8732 | this.scrim = this.root.parentNode.querySelector(SCRIM_SELECTOR);
|
8733 | if (this.scrim && this.root.classList.contains(MODAL)) {
|
8734 | this.handleScrimClick = function () {
|
8735 | return _this.foundation.handleScrimClick();
|
8736 | };
|
8737 | this.scrim.addEventListener('click', this.handleScrimClick);
|
8738 | this.focusTrap = util.createFocusTrapInstance(this.root, this.focusTrapFactory);
|
8739 | }
|
8740 | this.handleKeydown = function (evt) {
|
8741 | _this.foundation.handleKeydown(evt);
|
8742 | };
|
8743 | this.handleTransitionEnd = function (evt) {
|
8744 | _this.foundation.handleTransitionEnd(evt);
|
8745 | };
|
8746 | this.listen('keydown', this.handleKeydown);
|
8747 | this.listen('transitionend', this.handleTransitionEnd);
|
8748 | };
|
8749 | MDCDrawer.prototype.destroy = function () {
|
8750 | this.unlisten('keydown', this.handleKeydown);
|
8751 | this.unlisten('transitionend', this.handleTransitionEnd);
|
8752 | if (this.innerList) {
|
8753 | this.innerList.destroy();
|
8754 | }
|
8755 | var MODAL = cssClasses.MODAL;
|
8756 | if (this.scrim && this.handleScrimClick && this.root.classList.contains(MODAL)) {
|
8757 | this.scrim.removeEventListener('click', this.handleScrimClick);
|
8758 |
|
8759 | this.open = false;
|
8760 | }
|
8761 | };
|
8762 | MDCDrawer.prototype.getDefaultFoundation = function () {
|
8763 | var _this = this;
|
8764 |
|
8765 |
|
8766 |
|
8767 |
|
8768 | var adapter = {
|
8769 | addClass: function addClass(className) {
|
8770 | _this.root.classList.add(className);
|
8771 | },
|
8772 | removeClass: function removeClass(className) {
|
8773 | _this.root.classList.remove(className);
|
8774 | },
|
8775 | hasClass: function hasClass(className) {
|
8776 | return _this.root.classList.contains(className);
|
8777 | },
|
8778 | elementHasClass: function elementHasClass(element, className) {
|
8779 | return element.classList.contains(className);
|
8780 | },
|
8781 | saveFocus: function saveFocus() {
|
8782 | _this.previousFocus = document.activeElement;
|
8783 | },
|
8784 | restoreFocus: function restoreFocus() {
|
8785 | var previousFocus = _this.previousFocus;
|
8786 | if (previousFocus && previousFocus.focus && _this.root.contains(document.activeElement)) {
|
8787 | previousFocus.focus();
|
8788 | }
|
8789 | },
|
8790 | focusActiveNavigationItem: function focusActiveNavigationItem() {
|
8791 | var activeNavItemEl = _this.root.querySelector(strings.LIST_ITEM_ACTIVATED_SELECTOR);
|
8792 | if (activeNavItemEl) {
|
8793 | activeNavItemEl.focus();
|
8794 | }
|
8795 | },
|
8796 | notifyClose: function notifyClose() {
|
8797 | _this.emit(strings.CLOSE_EVENT, {}, true );
|
8798 | },
|
8799 | notifyOpen: function notifyOpen() {
|
8800 | _this.emit(strings.OPEN_EVENT, {}, true );
|
8801 | },
|
8802 | trapFocus: function trapFocus() {
|
8803 | _this.focusTrap.trapFocus();
|
8804 | },
|
8805 | releaseFocus: function releaseFocus() {
|
8806 | _this.focusTrap.releaseFocus();
|
8807 | }
|
8808 | };
|
8809 |
|
8810 | var DISMISSIBLE = cssClasses.DISMISSIBLE,
|
8811 | MODAL = cssClasses.MODAL;
|
8812 | if (this.root.classList.contains(DISMISSIBLE)) {
|
8813 | return new foundation_1.MDCDismissibleDrawerFoundation(adapter);
|
8814 | } else if (this.root.classList.contains(MODAL)) {
|
8815 | return new foundation_2.MDCModalDrawerFoundation(adapter);
|
8816 | } else {
|
8817 | throw new Error("MDCDrawer: Failed to instantiate component. Supported variants are " + DISMISSIBLE + " and " + MODAL + ".");
|
8818 | }
|
8819 | };
|
8820 | return MDCDrawer;
|
8821 | }(component_1.MDCComponent);
|
8822 | exports.MDCDrawer = MDCDrawer;
|
8823 |
|
8824 | }),
|
8825 |
|
8826 | "./packages/mdc-drawer/constants.ts":
|
8827 |
|
8828 |
|
8829 |
|
8830 |
|
8831 | (function(module, exports, __webpack_require__) {
|
8832 |
|
8833 | "use strict";
|
8834 |
|
8835 |
|
8836 |
|
8837 |
|
8838 |
|
8839 |
|
8840 |
|
8841 |
|
8842 |
|
8843 |
|
8844 |
|
8845 |
|
8846 |
|
8847 |
|
8848 |
|
8849 |
|
8850 |
|
8851 |
|
8852 |
|
8853 |
|
8854 |
|
8855 |
|
8856 |
|
8857 |
|
8858 | Object.defineProperty(exports, "__esModule", { value: true });
|
8859 | exports.strings = exports.cssClasses = void 0;
|
8860 | var cssClasses = {
|
8861 | ANIMATE: 'mdc-drawer--animate',
|
8862 | CLOSING: 'mdc-drawer--closing',
|
8863 | DISMISSIBLE: 'mdc-drawer--dismissible',
|
8864 | MODAL: 'mdc-drawer--modal',
|
8865 | OPEN: 'mdc-drawer--open',
|
8866 | OPENING: 'mdc-drawer--opening',
|
8867 | ROOT: 'mdc-drawer'
|
8868 | };
|
8869 | exports.cssClasses = cssClasses;
|
8870 | var strings = {
|
8871 | APP_CONTENT_SELECTOR: '.mdc-drawer-app-content',
|
8872 | CLOSE_EVENT: 'MDCDrawer:closed',
|
8873 | OPEN_EVENT: 'MDCDrawer:opened',
|
8874 | SCRIM_SELECTOR: '.mdc-drawer-scrim',
|
8875 | LIST_SELECTOR: '.mdc-list,.mdc-deprecated-list',
|
8876 | LIST_ITEM_ACTIVATED_SELECTOR: '.mdc-list-item--activated,.mdc-deprecated-list-item--activated'
|
8877 | };
|
8878 | exports.strings = strings;
|
8879 |
|
8880 | }),
|
8881 |
|
8882 | "./packages/mdc-drawer/dismissible/foundation.ts":
|
8883 |
|
8884 |
|
8885 |
|
8886 |
|
8887 | (function(module, exports, __webpack_require__) {
|
8888 |
|
8889 | "use strict";
|
8890 |
|
8891 |
|
8892 |
|
8893 |
|
8894 |
|
8895 |
|
8896 |
|
8897 |
|
8898 |
|
8899 |
|
8900 |
|
8901 |
|
8902 |
|
8903 |
|
8904 |
|
8905 |
|
8906 |
|
8907 |
|
8908 |
|
8909 |
|
8910 |
|
8911 |
|
8912 |
|
8913 |
|
8914 | var __extends = this && this.__extends || function () {
|
8915 | var _extendStatics = function extendStatics(d, b) {
|
8916 | _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
|
8917 | d.__proto__ = b;
|
8918 | } || function (d, b) {
|
8919 | for (var p in b) {
|
8920 | if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
8921 | }
|
8922 | };
|
8923 | return _extendStatics(d, b);
|
8924 | };
|
8925 | return function (d, b) {
|
8926 | if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
8927 | _extendStatics(d, b);
|
8928 | function __() {
|
8929 | this.constructor = d;
|
8930 | }
|
8931 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
8932 | };
|
8933 | }();
|
8934 | var __assign = this && this.__assign || function () {
|
8935 | __assign = Object.assign || function (t) {
|
8936 | for (var s, i = 1, n = arguments.length; i < n; i++) {
|
8937 | s = arguments[i];
|
8938 | for (var p in s) {
|
8939 | if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
8940 | }
|
8941 | }
|
8942 | return t;
|
8943 | };
|
8944 | return __assign.apply(this, arguments);
|
8945 | };
|
8946 | Object.defineProperty(exports, "__esModule", { value: true });
|
8947 | exports.MDCDismissibleDrawerFoundation = void 0;
|
8948 | var foundation_1 = __webpack_require__( "./packages/mdc-base/foundation.ts");
|
8949 | var constants_1 = __webpack_require__( "./packages/mdc-drawer/constants.ts");
|
8950 | var MDCDismissibleDrawerFoundation = function (_super) {
|
8951 | __extends(MDCDismissibleDrawerFoundation, _super);
|
8952 | function MDCDismissibleDrawerFoundation(adapter) {
|
8953 | var _this = _super.call(this, __assign(__assign({}, MDCDismissibleDrawerFoundation.defaultAdapter), adapter)) || this;
|
8954 | _this.animationFrame = 0;
|
8955 | _this.animationTimer = 0;
|
8956 | return _this;
|
8957 | }
|
8958 | Object.defineProperty(MDCDismissibleDrawerFoundation, "strings", {
|
8959 | get: function get() {
|
8960 | return constants_1.strings;
|
8961 | },
|
8962 | enumerable: false,
|
8963 | configurable: true
|
8964 | });
|
8965 | Object.defineProperty(MDCDismissibleDrawerFoundation, "cssClasses", {
|
8966 | get: function get() {
|
8967 | return constants_1.cssClasses;
|
8968 | },
|
8969 | enumerable: false,
|
8970 | configurable: true
|
8971 | });
|
8972 | Object.defineProperty(MDCDismissibleDrawerFoundation, "defaultAdapter", {
|
8973 | get: function get() {
|
8974 |
|
8975 | return {
|
8976 | addClass: function addClass() {
|
8977 | return undefined;
|
8978 | },
|
8979 | removeClass: function removeClass() {
|
8980 | return undefined;
|
8981 | },
|
8982 | hasClass: function hasClass() {
|
8983 | return false;
|
8984 | },
|
8985 | elementHasClass: function elementHasClass() {
|
8986 | return false;
|
8987 | },
|
8988 | notifyClose: function notifyClose() {
|
8989 | return undefined;
|
8990 | },
|
8991 | notifyOpen: function notifyOpen() {
|
8992 | return undefined;
|
8993 | },
|
8994 | saveFocus: function saveFocus() {
|
8995 | return undefined;
|
8996 | },
|
8997 | restoreFocus: function restoreFocus() {
|
8998 | return undefined;
|
8999 | },
|
9000 | focusActiveNavigationItem: function focusActiveNavigationItem() {
|
9001 | return undefined;
|
9002 | },
|
9003 | trapFocus: function trapFocus() {
|
9004 | return undefined;
|
9005 | },
|
9006 | releaseFocus: function releaseFocus() {
|
9007 | return undefined;
|
9008 | }
|
9009 | };
|
9010 |
|
9011 | },
|
9012 | enumerable: false,
|
9013 | configurable: true
|
9014 | });
|
9015 | MDCDismissibleDrawerFoundation.prototype.destroy = function () {
|
9016 | if (this.animationFrame) {
|
9017 | cancelAnimationFrame(this.animationFrame);
|
9018 | }
|
9019 | if (this.animationTimer) {
|
9020 | clearTimeout(this.animationTimer);
|
9021 | }
|
9022 | };
|
9023 | |
9024 |
|
9025 |
|
9026 | MDCDismissibleDrawerFoundation.prototype.open = function () {
|
9027 | var _this = this;
|
9028 | if (this.isOpen() || this.isOpening() || this.isClosing()) {
|
9029 | return;
|
9030 | }
|
9031 | this.adapter.addClass(constants_1.cssClasses.OPEN);
|
9032 | this.adapter.addClass(constants_1.cssClasses.ANIMATE);
|
9033 |
|
9034 | this.runNextAnimationFrame(function () {
|
9035 | _this.adapter.addClass(constants_1.cssClasses.OPENING);
|
9036 | });
|
9037 | this.adapter.saveFocus();
|
9038 | };
|
9039 | |
9040 |
|
9041 |
|
9042 | MDCDismissibleDrawerFoundation.prototype.close = function () {
|
9043 | if (!this.isOpen() || this.isOpening() || this.isClosing()) {
|
9044 | return;
|
9045 | }
|
9046 | this.adapter.addClass(constants_1.cssClasses.CLOSING);
|
9047 | };
|
9048 | |
9049 |
|
9050 |
|
9051 |
|
9052 | MDCDismissibleDrawerFoundation.prototype.isOpen = function () {
|
9053 | return this.adapter.hasClass(constants_1.cssClasses.OPEN);
|
9054 | };
|
9055 | |
9056 |
|
9057 |
|
9058 |
|
9059 | MDCDismissibleDrawerFoundation.prototype.isOpening = function () {
|
9060 | return this.adapter.hasClass(constants_1.cssClasses.OPENING) || this.adapter.hasClass(constants_1.cssClasses.ANIMATE);
|
9061 | };
|
9062 | |
9063 |
|
9064 |
|
9065 |
|
9066 | MDCDismissibleDrawerFoundation.prototype.isClosing = function () {
|
9067 | return this.adapter.hasClass(constants_1.cssClasses.CLOSING);
|
9068 | };
|
9069 | |
9070 |
|
9071 |
|
9072 | MDCDismissibleDrawerFoundation.prototype.handleKeydown = function (evt) {
|
9073 | var keyCode = evt.keyCode,
|
9074 | key = evt.key;
|
9075 | var isEscape = key === 'Escape' || keyCode === 27;
|
9076 | if (isEscape) {
|
9077 | this.close();
|
9078 | }
|
9079 | };
|
9080 | |
9081 |
|
9082 |
|
9083 | MDCDismissibleDrawerFoundation.prototype.handleTransitionEnd = function (evt) {
|
9084 | var OPENING = constants_1.cssClasses.OPENING,
|
9085 | CLOSING = constants_1.cssClasses.CLOSING,
|
9086 | OPEN = constants_1.cssClasses.OPEN,
|
9087 | ANIMATE = constants_1.cssClasses.ANIMATE,
|
9088 | ROOT = constants_1.cssClasses.ROOT;
|
9089 |
|
9090 | var isRootElement = this.isElement(evt.target) && this.adapter.elementHasClass(evt.target, ROOT);
|
9091 | if (!isRootElement) {
|
9092 | return;
|
9093 | }
|
9094 | if (this.isClosing()) {
|
9095 | this.adapter.removeClass(OPEN);
|
9096 | this.closed();
|
9097 | this.adapter.restoreFocus();
|
9098 | this.adapter.notifyClose();
|
9099 | } else {
|
9100 | this.adapter.focusActiveNavigationItem();
|
9101 | this.opened();
|
9102 | this.adapter.notifyOpen();
|
9103 | }
|
9104 | this.adapter.removeClass(ANIMATE);
|
9105 | this.adapter.removeClass(OPENING);
|
9106 | this.adapter.removeClass(CLOSING);
|
9107 | };
|
9108 | |
9109 |
|
9110 |
|
9111 | MDCDismissibleDrawerFoundation.prototype.opened = function () {};
|
9112 | |
9113 |
|
9114 |
|
9115 | MDCDismissibleDrawerFoundation.prototype.closed = function () {};
|
9116 | |
9117 |
|
9118 |
|
9119 | MDCDismissibleDrawerFoundation.prototype.runNextAnimationFrame = function (callback) {
|
9120 | var _this = this;
|
9121 | cancelAnimationFrame(this.animationFrame);
|
9122 | this.animationFrame = requestAnimationFrame(function () {
|
9123 | _this.animationFrame = 0;
|
9124 | clearTimeout(_this.animationTimer);
|
9125 | _this.animationTimer = setTimeout(callback, 0);
|
9126 | });
|
9127 | };
|
9128 | MDCDismissibleDrawerFoundation.prototype.isElement = function (element) {
|
9129 |
|
9130 | return Boolean(element.classList);
|
9131 | };
|
9132 | return MDCDismissibleDrawerFoundation;
|
9133 | }(foundation_1.MDCFoundation);
|
9134 | exports.MDCDismissibleDrawerFoundation = MDCDismissibleDrawerFoundation;
|
9135 |
|
9136 | exports.default = MDCDismissibleDrawerFoundation;
|
9137 |
|
9138 | }),
|
9139 |
|
9140 | "./packages/mdc-drawer/index.ts":
|
9141 |
|
9142 |
|
9143 |
|
9144 |
|
9145 | (function(module, exports, __webpack_require__) {
|
9146 |
|
9147 | "use strict";
|
9148 |
|
9149 |
|
9150 |
|
9151 |
|
9152 |
|
9153 |
|
9154 |
|
9155 |
|
9156 |
|
9157 |
|
9158 |
|
9159 |
|
9160 |
|
9161 |
|
9162 |
|
9163 |
|
9164 |
|
9165 |
|
9166 |
|
9167 |
|
9168 |
|
9169 |
|
9170 |
|
9171 |
|
9172 | var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
|
9173 | if (k2 === undefined) k2 = k;
|
9174 | Object.defineProperty(o, k2, { enumerable: true, get: function get() {
|
9175 | return m[k];
|
9176 | } });
|
9177 | } : function (o, m, k, k2) {
|
9178 | if (k2 === undefined) k2 = k;
|
9179 | o[k2] = m[k];
|
9180 | });
|
9181 | var __setModuleDefault = this && this.__setModuleDefault || (Object.create ? function (o, v) {
|
9182 | Object.defineProperty(o, "default", { enumerable: true, value: v });
|
9183 | } : function (o, v) {
|
9184 | o["default"] = v;
|
9185 | });
|
9186 | var __importStar = this && this.__importStar || function (mod) {
|
9187 | if (mod && mod.__esModule) return mod;
|
9188 | var result = {};
|
9189 | if (mod != null) for (var k in mod) {
|
9190 | if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
9191 | }__setModuleDefault(result, mod);
|
9192 | return result;
|
9193 | };
|
9194 | var __exportStar = this && this.__exportStar || function (m, exports) {
|
9195 | for (var p in m) {
|
9196 | if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
9197 | }
|
9198 | };
|
9199 | Object.defineProperty(exports, "__esModule", { value: true });
|
9200 | exports.util = void 0;
|
9201 | var util = __importStar(__webpack_require__( "./packages/mdc-drawer/util.ts"));
|
9202 | exports.util = util;
|
9203 | __exportStar(__webpack_require__( "./packages/mdc-drawer/adapter.ts"), exports);
|
9204 | __exportStar(__webpack_require__( "./packages/mdc-drawer/component.ts"), exports);
|
9205 | __exportStar(__webpack_require__( "./packages/mdc-drawer/constants.ts"), exports);
|
9206 | __exportStar(__webpack_require__( "./packages/mdc-drawer/dismissible/foundation.ts"), exports);
|
9207 | __exportStar(__webpack_require__( "./packages/mdc-drawer/modal/foundation.ts"), exports);
|
9208 |
|
9209 | }),
|
9210 |
|
9211 | "./packages/mdc-drawer/modal/foundation.ts":
|
9212 |
|
9213 |
|
9214 |
|
9215 |
|
9216 | (function(module, exports, __webpack_require__) {
|
9217 |
|
9218 | "use strict";
|
9219 |
|
9220 |
|
9221 |
|
9222 |
|
9223 |
|
9224 |
|
9225 |
|
9226 |
|
9227 |
|
9228 |
|
9229 |
|
9230 |
|
9231 |
|
9232 |
|
9233 |
|
9234 |
|
9235 |
|
9236 |
|
9237 |
|
9238 |
|
9239 |
|
9240 |
|
9241 |
|
9242 |
|
9243 | var __extends = this && this.__extends || function () {
|
9244 | var _extendStatics = function extendStatics(d, b) {
|
9245 | _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
|
9246 | d.__proto__ = b;
|
9247 | } || function (d, b) {
|
9248 | for (var p in b) {
|
9249 | if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
9250 | }
|
9251 | };
|
9252 | return _extendStatics(d, b);
|
9253 | };
|
9254 | return function (d, b) {
|
9255 | if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
9256 | _extendStatics(d, b);
|
9257 | function __() {
|
9258 | this.constructor = d;
|
9259 | }
|
9260 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
9261 | };
|
9262 | }();
|
9263 | Object.defineProperty(exports, "__esModule", { value: true });
|
9264 | exports.MDCModalDrawerFoundation = void 0;
|
9265 | var foundation_1 = __webpack_require__( "./packages/mdc-drawer/dismissible/foundation.ts");
|
9266 |
|
9267 | var MDCModalDrawerFoundation = function (_super) {
|
9268 | __extends(MDCModalDrawerFoundation, _super);
|
9269 | function MDCModalDrawerFoundation() {
|
9270 | return _super !== null && _super.apply(this, arguments) || this;
|
9271 | }
|
9272 | |
9273 |
|
9274 |
|
9275 | MDCModalDrawerFoundation.prototype.handleScrimClick = function () {
|
9276 | this.close();
|
9277 | };
|
9278 | |
9279 |
|
9280 |
|
9281 | MDCModalDrawerFoundation.prototype.opened = function () {
|
9282 | this.adapter.trapFocus();
|
9283 | };
|
9284 | |
9285 |
|
9286 |
|
9287 | MDCModalDrawerFoundation.prototype.closed = function () {
|
9288 | this.adapter.releaseFocus();
|
9289 | };
|
9290 | return MDCModalDrawerFoundation;
|
9291 | }(foundation_1.MDCDismissibleDrawerFoundation);
|
9292 | exports.MDCModalDrawerFoundation = MDCModalDrawerFoundation;
|
9293 |
|
9294 | exports.default = MDCModalDrawerFoundation;
|
9295 |
|
9296 | }),
|
9297 |
|
9298 | "./packages/mdc-drawer/util.ts":
|
9299 |
|
9300 |
|
9301 |
|
9302 |
|
9303 | (function(module, exports, __webpack_require__) {
|
9304 |
|
9305 | "use strict";
|
9306 |
|
9307 |
|
9308 |
|
9309 |
|
9310 |
|
9311 |
|
9312 |
|
9313 |
|
9314 |
|
9315 |
|
9316 |
|
9317 |
|
9318 |
|
9319 |
|
9320 |
|
9321 |
|
9322 |
|
9323 |
|
9324 |
|
9325 |
|
9326 |
|
9327 |
|
9328 |
|
9329 |
|
9330 | Object.defineProperty(exports, "__esModule", { value: true });
|
9331 | exports.createFocusTrapInstance = void 0;
|
9332 | function createFocusTrapInstance(surfaceEl, focusTrapFactory) {
|
9333 | return focusTrapFactory(surfaceEl, {
|
9334 |
|
9335 | skipInitialFocus: true
|
9336 | });
|
9337 | }
|
9338 | exports.createFocusTrapInstance = createFocusTrapInstance;
|
9339 |
|
9340 | }),
|
9341 |
|
9342 | "./packages/mdc-floating-label/adapter.ts":
|
9343 |
|
9344 |
|
9345 |
|
9346 |
|
9347 | (function(module, exports, __webpack_require__) {
|
9348 |
|
9349 | "use strict";
|
9350 |
|
9351 |
|
9352 |
|
9353 |
|
9354 |
|
9355 |
|
9356 |
|
9357 |
|
9358 |
|
9359 |
|
9360 |
|
9361 |
|
9362 |
|
9363 |
|
9364 |
|
9365 |
|
9366 |
|
9367 |
|
9368 |
|
9369 |
|
9370 |
|
9371 |
|
9372 |
|
9373 |
|
9374 | Object.defineProperty(exports, "__esModule", { value: true });
|
9375 |
|
9376 | }),
|
9377 |
|
9378 | "./packages/mdc-floating-label/component.ts":
|
9379 |
|
9380 |
|
9381 |
|
9382 |
|
9383 | (function(module, exports, __webpack_require__) {
|
9384 |
|
9385 | "use strict";
|
9386 |
|
9387 |
|
9388 |
|
9389 |
|
9390 |
|
9391 |
|
9392 |
|
9393 |
|
9394 |
|
9395 |
|
9396 |
|
9397 |
|
9398 |
|
9399 |
|
9400 |
|
9401 |
|
9402 |
|
9403 |
|
9404 |
|
9405 |
|
9406 |
|
9407 |
|
9408 |
|
9409 |
|
9410 | var __extends = this && this.__extends || function () {
|
9411 | var _extendStatics = function extendStatics(d, b) {
|
9412 | _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
|
9413 | d.__proto__ = b;
|
9414 | } || function (d, b) {
|
9415 | for (var p in b) {
|
9416 | if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
9417 | }
|
9418 | };
|
9419 | return _extendStatics(d, b);
|
9420 | };
|
9421 | return function (d, b) {
|
9422 | if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
9423 | _extendStatics(d, b);
|
9424 | function __() {
|
9425 | this.constructor = d;
|
9426 | }
|
9427 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
9428 | };
|
9429 | }();
|
9430 | Object.defineProperty(exports, "__esModule", { value: true });
|
9431 | exports.MDCFloatingLabel = void 0;
|
9432 | var component_1 = __webpack_require__( "./packages/mdc-base/component.ts");
|
9433 | var ponyfill_1 = __webpack_require__( "./packages/mdc-dom/ponyfill.ts");
|
9434 | var foundation_1 = __webpack_require__( "./packages/mdc-floating-label/foundation.ts");
|
9435 | var MDCFloatingLabel = function (_super) {
|
9436 | __extends(MDCFloatingLabel, _super);
|
9437 | function MDCFloatingLabel() {
|
9438 | return _super !== null && _super.apply(this, arguments) || this;
|
9439 | }
|
9440 | MDCFloatingLabel.attachTo = function (root) {
|
9441 | return new MDCFloatingLabel(root);
|
9442 | };
|
9443 | |
9444 |
|
9445 |
|
9446 |
|
9447 | MDCFloatingLabel.prototype.shake = function (shouldShake) {
|
9448 | this.foundation.shake(shouldShake);
|
9449 | };
|
9450 | |
9451 |
|
9452 |
|
9453 |
|
9454 | MDCFloatingLabel.prototype.float = function (shouldFloat) {
|
9455 | this.foundation.float(shouldFloat);
|
9456 | };
|
9457 | |
9458 |
|
9459 |
|
9460 |
|
9461 | MDCFloatingLabel.prototype.setRequired = function (isRequired) {
|
9462 | this.foundation.setRequired(isRequired);
|
9463 | };
|
9464 | MDCFloatingLabel.prototype.getWidth = function () {
|
9465 | return this.foundation.getWidth();
|
9466 | };
|
9467 | MDCFloatingLabel.prototype.getDefaultFoundation = function () {
|
9468 | var _this = this;
|
9469 |
|
9470 |
|
9471 |
|
9472 | var adapter = {
|
9473 | addClass: function addClass(className) {
|
9474 | return _this.root.classList.add(className);
|
9475 | },
|
9476 | removeClass: function removeClass(className) {
|
9477 | return _this.root.classList.remove(className);
|
9478 | },
|
9479 | getWidth: function getWidth() {
|
9480 | return ponyfill_1.estimateScrollWidth(_this.root);
|
9481 | },
|
9482 | registerInteractionHandler: function registerInteractionHandler(evtType, handler) {
|
9483 | return _this.listen(evtType, handler);
|
9484 | },
|
9485 | deregisterInteractionHandler: function deregisterInteractionHandler(evtType, handler) {
|
9486 | return _this.unlisten(evtType, handler);
|
9487 | }
|
9488 | };
|
9489 |
|
9490 | return new foundation_1.MDCFloatingLabelFoundation(adapter);
|
9491 | };
|
9492 | return MDCFloatingLabel;
|
9493 | }(component_1.MDCComponent);
|
9494 | exports.MDCFloatingLabel = MDCFloatingLabel;
|
9495 |
|
9496 | }),
|
9497 |
|
9498 | "./packages/mdc-floating-label/constants.ts":
|
9499 |
|
9500 |
|
9501 |
|
9502 |
|
9503 | (function(module, exports, __webpack_require__) {
|
9504 |
|
9505 | "use strict";
|
9506 |
|
9507 |
|
9508 |
|
9509 |
|
9510 |
|
9511 |
|
9512 |
|
9513 |
|
9514 |
|
9515 |
|
9516 |
|
9517 |
|
9518 |
|
9519 |
|
9520 |
|
9521 |
|
9522 |
|
9523 |
|
9524 |
|
9525 |
|
9526 |
|
9527 |
|
9528 |
|
9529 |
|
9530 | Object.defineProperty(exports, "__esModule", { value: true });
|
9531 | exports.cssClasses = void 0;
|
9532 | exports.cssClasses = {
|
9533 | LABEL_FLOAT_ABOVE: 'mdc-floating-label--float-above',
|
9534 | LABEL_REQUIRED: 'mdc-floating-label--required',
|
9535 | LABEL_SHAKE: 'mdc-floating-label--shake',
|
9536 | ROOT: 'mdc-floating-label'
|
9537 | };
|
9538 |
|
9539 | }),
|
9540 |
|
9541 | "./packages/mdc-floating-label/foundation.ts":
|
9542 |
|
9543 |
|
9544 |
|
9545 |
|
9546 | (function(module, exports, __webpack_require__) {
|
9547 |
|
9548 | "use strict";
|
9549 |
|
9550 |
|
9551 |
|
9552 |
|
9553 |
|
9554 |
|
9555 |
|
9556 |
|
9557 |
|
9558 |
|
9559 |
|
9560 |
|
9561 |
|
9562 |
|
9563 |
|
9564 |
|
9565 |
|
9566 |
|
9567 |
|
9568 |
|
9569 |
|
9570 |
|
9571 |
|
9572 |
|
9573 | var __extends = this && this.__extends || function () {
|
9574 | var _extendStatics = function extendStatics(d, b) {
|
9575 | _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
|
9576 | d.__proto__ = b;
|
9577 | } || function (d, b) {
|
9578 | for (var p in b) {
|
9579 | if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
9580 | }
|
9581 | };
|
9582 | return _extendStatics(d, b);
|
9583 | };
|
9584 | return function (d, b) {
|
9585 | if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
9586 | _extendStatics(d, b);
|
9587 | function __() {
|
9588 | this.constructor = d;
|
9589 | }
|
9590 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
9591 | };
|
9592 | }();
|
9593 | var __assign = this && this.__assign || function () {
|
9594 | __assign = Object.assign || function (t) {
|
9595 | for (var s, i = 1, n = arguments.length; i < n; i++) {
|
9596 | s = arguments[i];
|
9597 | for (var p in s) {
|
9598 | if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
9599 | }
|
9600 | }
|
9601 | return t;
|
9602 | };
|
9603 | return __assign.apply(this, arguments);
|
9604 | };
|
9605 | Object.defineProperty(exports, "__esModule", { value: true });
|
9606 | exports.MDCFloatingLabelFoundation = void 0;
|
9607 | var foundation_1 = __webpack_require__( "./packages/mdc-base/foundation.ts");
|
9608 | var constants_1 = __webpack_require__( "./packages/mdc-floating-label/constants.ts");
|
9609 | var MDCFloatingLabelFoundation = function (_super) {
|
9610 | __extends(MDCFloatingLabelFoundation, _super);
|
9611 | function MDCFloatingLabelFoundation(adapter) {
|
9612 | var _this = _super.call(this, __assign(__assign({}, MDCFloatingLabelFoundation.defaultAdapter), adapter)) || this;
|
9613 | _this.shakeAnimationEndHandler = function () {
|
9614 | _this.handleShakeAnimationEnd();
|
9615 | };
|
9616 | return _this;
|
9617 | }
|
9618 | Object.defineProperty(MDCFloatingLabelFoundation, "cssClasses", {
|
9619 | get: function get() {
|
9620 | return constants_1.cssClasses;
|
9621 | },
|
9622 | enumerable: false,
|
9623 | configurable: true
|
9624 | });
|
9625 | Object.defineProperty(MDCFloatingLabelFoundation, "defaultAdapter", {
|
9626 | |
9627 |
|
9628 |
|
9629 | get: function get() {
|
9630 |
|
9631 | return {
|
9632 | addClass: function addClass() {
|
9633 | return undefined;
|
9634 | },
|
9635 | removeClass: function removeClass() {
|
9636 | return undefined;
|
9637 | },
|
9638 | getWidth: function getWidth() {
|
9639 | return 0;
|
9640 | },
|
9641 | registerInteractionHandler: function registerInteractionHandler() {
|
9642 | return undefined;
|
9643 | },
|
9644 | deregisterInteractionHandler: function deregisterInteractionHandler() {
|
9645 | return undefined;
|
9646 | }
|
9647 | };
|
9648 |
|
9649 | },
|
9650 | enumerable: false,
|
9651 | configurable: true
|
9652 | });
|
9653 | MDCFloatingLabelFoundation.prototype.init = function () {
|
9654 | this.adapter.registerInteractionHandler('animationend', this.shakeAnimationEndHandler);
|
9655 | };
|
9656 | MDCFloatingLabelFoundation.prototype.destroy = function () {
|
9657 | this.adapter.deregisterInteractionHandler('animationend', this.shakeAnimationEndHandler);
|
9658 | };
|
9659 | |
9660 |
|
9661 |
|
9662 | MDCFloatingLabelFoundation.prototype.getWidth = function () {
|
9663 | return this.adapter.getWidth();
|
9664 | };
|
9665 | |
9666 |
|
9667 |
|
9668 |
|
9669 | MDCFloatingLabelFoundation.prototype.shake = function (shouldShake) {
|
9670 | var LABEL_SHAKE = MDCFloatingLabelFoundation.cssClasses.LABEL_SHAKE;
|
9671 | if (shouldShake) {
|
9672 | this.adapter.addClass(LABEL_SHAKE);
|
9673 | } else {
|
9674 | this.adapter.removeClass(LABEL_SHAKE);
|
9675 | }
|
9676 | };
|
9677 | |
9678 |
|
9679 |
|
9680 |
|
9681 | MDCFloatingLabelFoundation.prototype.float = function (shouldFloat) {
|
9682 | var _a = MDCFloatingLabelFoundation.cssClasses,
|
9683 | LABEL_FLOAT_ABOVE = _a.LABEL_FLOAT_ABOVE,
|
9684 | LABEL_SHAKE = _a.LABEL_SHAKE;
|
9685 | if (shouldFloat) {
|
9686 | this.adapter.addClass(LABEL_FLOAT_ABOVE);
|
9687 | } else {
|
9688 | this.adapter.removeClass(LABEL_FLOAT_ABOVE);
|
9689 | this.adapter.removeClass(LABEL_SHAKE);
|
9690 | }
|
9691 | };
|
9692 | |
9693 |
|
9694 |
|
9695 |
|
9696 | MDCFloatingLabelFoundation.prototype.setRequired = function (isRequired) {
|
9697 | var LABEL_REQUIRED = MDCFloatingLabelFoundation.cssClasses.LABEL_REQUIRED;
|
9698 | if (isRequired) {
|
9699 | this.adapter.addClass(LABEL_REQUIRED);
|
9700 | } else {
|
9701 | this.adapter.removeClass(LABEL_REQUIRED);
|
9702 | }
|
9703 | };
|
9704 | MDCFloatingLabelFoundation.prototype.handleShakeAnimationEnd = function () {
|
9705 | var LABEL_SHAKE = MDCFloatingLabelFoundation.cssClasses.LABEL_SHAKE;
|
9706 | this.adapter.removeClass(LABEL_SHAKE);
|
9707 | };
|
9708 | return MDCFloatingLabelFoundation;
|
9709 | }(foundation_1.MDCFoundation);
|
9710 | exports.MDCFloatingLabelFoundation = MDCFloatingLabelFoundation;
|
9711 |
|
9712 | exports.default = MDCFloatingLabelFoundation;
|
9713 |
|
9714 | }),
|
9715 |
|
9716 | "./packages/mdc-floating-label/index.ts":
|
9717 |
|
9718 |
|
9719 |
|
9720 |
|
9721 | (function(module, exports, __webpack_require__) {
|
9722 |
|
9723 | "use strict";
|
9724 |
|
9725 |
|
9726 |
|
9727 |
|
9728 |
|
9729 |
|
9730 |
|
9731 |
|
9732 |
|
9733 |
|
9734 |
|
9735 |
|
9736 |
|
9737 |
|
9738 |
|
9739 |
|
9740 |
|
9741 |
|
9742 |
|
9743 |
|
9744 |
|
9745 |
|
9746 |
|
9747 |
|
9748 | var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
|
9749 | if (k2 === undefined) k2 = k;
|
9750 | Object.defineProperty(o, k2, { enumerable: true, get: function get() {
|
9751 | return m[k];
|
9752 | } });
|
9753 | } : function (o, m, k, k2) {
|
9754 | if (k2 === undefined) k2 = k;
|
9755 | o[k2] = m[k];
|
9756 | });
|
9757 | var __exportStar = this && this.__exportStar || function (m, exports) {
|
9758 | for (var p in m) {
|
9759 | if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
9760 | }
|
9761 | };
|
9762 | Object.defineProperty(exports, "__esModule", { value: true });
|
9763 | __exportStar(__webpack_require__( "./packages/mdc-floating-label/adapter.ts"), exports);
|
9764 | __exportStar(__webpack_require__( "./packages/mdc-floating-label/component.ts"), exports);
|
9765 | __exportStar(__webpack_require__( "./packages/mdc-floating-label/constants.ts"), exports);
|
9766 | __exportStar(__webpack_require__( "./packages/mdc-floating-label/foundation.ts"), exports);
|
9767 |
|
9768 | }),
|
9769 |
|
9770 | "./packages/mdc-form-field/adapter.ts":
|
9771 |
|
9772 |
|
9773 |
|
9774 |
|
9775 | (function(module, exports, __webpack_require__) {
|
9776 |
|
9777 | "use strict";
|
9778 |
|
9779 |
|
9780 |
|
9781 |
|
9782 |
|
9783 |
|
9784 |
|
9785 |
|
9786 |
|
9787 |
|
9788 |
|
9789 |
|
9790 |
|
9791 |
|
9792 |
|
9793 |
|
9794 |
|
9795 |
|
9796 |
|
9797 |
|
9798 |
|
9799 |
|
9800 |
|
9801 |
|
9802 | Object.defineProperty(exports, "__esModule", { value: true });
|
9803 |
|
9804 | }),
|
9805 |
|
9806 | "./packages/mdc-form-field/component.ts":
|
9807 |
|
9808 |
|
9809 |
|
9810 |
|
9811 | (function(module, exports, __webpack_require__) {
|
9812 |
|
9813 | "use strict";
|
9814 |
|
9815 |
|
9816 |
|
9817 |
|
9818 |
|
9819 |
|
9820 |
|
9821 |
|
9822 |
|
9823 |
|
9824 |
|
9825 |
|
9826 |
|
9827 |
|
9828 |
|
9829 |
|
9830 |
|
9831 |
|
9832 |
|
9833 |
|
9834 |
|
9835 |
|
9836 |
|
9837 |
|
9838 | var __extends = this && this.__extends || function () {
|
9839 | var _extendStatics = function extendStatics(d, b) {
|
9840 | _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
|
9841 | d.__proto__ = b;
|
9842 | } || function (d, b) {
|
9843 | for (var p in b) {
|
9844 | if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
9845 | }
|
9846 | };
|
9847 | return _extendStatics(d, b);
|
9848 | };
|
9849 | return function (d, b) {
|
9850 | if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
9851 | _extendStatics(d, b);
|
9852 | function __() {
|
9853 | this.constructor = d;
|
9854 | }
|
9855 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
9856 | };
|
9857 | }();
|
9858 | Object.defineProperty(exports, "__esModule", { value: true });
|
9859 | exports.MDCFormField = void 0;
|
9860 | var component_1 = __webpack_require__( "./packages/mdc-base/component.ts");
|
9861 | var foundation_1 = __webpack_require__( "./packages/mdc-form-field/foundation.ts");
|
9862 | var MDCFormField = function (_super) {
|
9863 | __extends(MDCFormField, _super);
|
9864 | function MDCFormField() {
|
9865 | return _super !== null && _super.apply(this, arguments) || this;
|
9866 | }
|
9867 | MDCFormField.attachTo = function (root) {
|
9868 | return new MDCFormField(root);
|
9869 | };
|
9870 | MDCFormField.prototype.labelEl = function () {
|
9871 | var LABEL_SELECTOR = foundation_1.MDCFormFieldFoundation.strings.LABEL_SELECTOR;
|
9872 | return this.root.querySelector(LABEL_SELECTOR);
|
9873 | };
|
9874 | MDCFormField.prototype.getDefaultFoundation = function () {
|
9875 | var _this = this;
|
9876 |
|
9877 |
|
9878 | var adapter = {
|
9879 | activateInputRipple: function activateInputRipple() {
|
9880 | if (_this.input && _this.input.ripple) {
|
9881 | _this.input.ripple.activate();
|
9882 | }
|
9883 | },
|
9884 | deactivateInputRipple: function deactivateInputRipple() {
|
9885 | if (_this.input && _this.input.ripple) {
|
9886 | _this.input.ripple.deactivate();
|
9887 | }
|
9888 | },
|
9889 | deregisterInteractionHandler: function deregisterInteractionHandler(evtType, handler) {
|
9890 | var labelEl = _this.labelEl();
|
9891 | if (labelEl) {
|
9892 | labelEl.removeEventListener(evtType, handler);
|
9893 | }
|
9894 | },
|
9895 | registerInteractionHandler: function registerInteractionHandler(evtType, handler) {
|
9896 | var labelEl = _this.labelEl();
|
9897 | if (labelEl) {
|
9898 | labelEl.addEventListener(evtType, handler);
|
9899 | }
|
9900 | }
|
9901 | };
|
9902 | return new foundation_1.MDCFormFieldFoundation(adapter);
|
9903 | };
|
9904 | return MDCFormField;
|
9905 | }(component_1.MDCComponent);
|
9906 | exports.MDCFormField = MDCFormField;
|
9907 |
|
9908 | }),
|
9909 |
|
9910 | "./packages/mdc-form-field/constants.ts":
|
9911 |
|
9912 |
|
9913 |
|
9914 |
|
9915 | (function(module, exports, __webpack_require__) {
|
9916 |
|
9917 | "use strict";
|
9918 |
|
9919 |
|
9920 |
|
9921 |
|
9922 |
|
9923 |
|
9924 |
|
9925 |
|
9926 |
|
9927 |
|
9928 |
|
9929 |
|
9930 |
|
9931 |
|
9932 |
|
9933 |
|
9934 |
|
9935 |
|
9936 |
|
9937 |
|
9938 |
|
9939 |
|
9940 |
|
9941 |
|
9942 | Object.defineProperty(exports, "__esModule", { value: true });
|
9943 | exports.strings = exports.cssClasses = void 0;
|
9944 | exports.cssClasses = {
|
9945 | ROOT: 'mdc-form-field'
|
9946 | };
|
9947 | exports.strings = {
|
9948 | LABEL_SELECTOR: '.mdc-form-field > label'
|
9949 | };
|
9950 |
|
9951 | }),
|
9952 |
|
9953 | "./packages/mdc-form-field/foundation.ts":
|
9954 |
|
9955 |
|
9956 |
|
9957 |
|
9958 | (function(module, exports, __webpack_require__) {
|
9959 |
|
9960 | "use strict";
|
9961 |
|
9962 |
|
9963 |
|
9964 |
|
9965 |
|
9966 |
|
9967 |
|
9968 |
|
9969 |
|
9970 |
|
9971 |
|
9972 |
|
9973 |
|
9974 |
|
9975 |
|
9976 |
|
9977 |
|
9978 |
|
9979 |
|
9980 |
|
9981 |
|
9982 |
|
9983 |
|
9984 |
|
9985 | var __extends = this && this.__extends || function () {
|
9986 | var _extendStatics = function extendStatics(d, b) {
|
9987 | _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
|
9988 | d.__proto__ = b;
|
9989 | } || function (d, b) {
|
9990 | for (var p in b) {
|
9991 | if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
9992 | }
|
9993 | };
|
9994 | return _extendStatics(d, b);
|
9995 | };
|
9996 | return function (d, b) {
|
9997 | if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
9998 | _extendStatics(d, b);
|
9999 | function __() {
|
10000 | this.constructor = d;
|
10001 | }
|
10002 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
10003 | };
|
10004 | }();
|
10005 | var __assign = this && this.__assign || function () {
|
10006 | __assign = Object.assign || function (t) {
|
10007 | for (var s, i = 1, n = arguments.length; i < n; i++) {
|
10008 | s = arguments[i];
|
10009 | for (var p in s) {
|
10010 | if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
10011 | }
|
10012 | }
|
10013 | return t;
|
10014 | };
|
10015 | return __assign.apply(this, arguments);
|
10016 | };
|
10017 | Object.defineProperty(exports, "__esModule", { value: true });
|
10018 | exports.MDCFormFieldFoundation = void 0;
|
10019 | var foundation_1 = __webpack_require__( "./packages/mdc-base/foundation.ts");
|
10020 | var constants_1 = __webpack_require__( "./packages/mdc-form-field/constants.ts");
|
10021 | var MDCFormFieldFoundation = function (_super) {
|
10022 | __extends(MDCFormFieldFoundation, _super);
|
10023 | function MDCFormFieldFoundation(adapter) {
|
10024 | var _this = _super.call(this, __assign(__assign({}, MDCFormFieldFoundation.defaultAdapter), adapter)) || this;
|
10025 | _this.click = function () {
|
10026 | _this.handleClick();
|
10027 | };
|
10028 | return _this;
|
10029 | }
|
10030 | Object.defineProperty(MDCFormFieldFoundation, "cssClasses", {
|
10031 | get: function get() {
|
10032 | return constants_1.cssClasses;
|
10033 | },
|
10034 | enumerable: false,
|
10035 | configurable: true
|
10036 | });
|
10037 | Object.defineProperty(MDCFormFieldFoundation, "strings", {
|
10038 | get: function get() {
|
10039 | return constants_1.strings;
|
10040 | },
|
10041 | enumerable: false,
|
10042 | configurable: true
|
10043 | });
|
10044 | Object.defineProperty(MDCFormFieldFoundation, "defaultAdapter", {
|
10045 | get: function get() {
|
10046 | return {
|
10047 | activateInputRipple: function activateInputRipple() {
|
10048 | return undefined;
|
10049 | },
|
10050 | deactivateInputRipple: function deactivateInputRipple() {
|
10051 | return undefined;
|
10052 | },
|
10053 | deregisterInteractionHandler: function deregisterInteractionHandler() {
|
10054 | return undefined;
|
10055 | },
|
10056 | registerInteractionHandler: function registerInteractionHandler() {
|
10057 | return undefined;
|
10058 | }
|
10059 | };
|
10060 | },
|
10061 | enumerable: false,
|
10062 | configurable: true
|
10063 | });
|
10064 | MDCFormFieldFoundation.prototype.init = function () {
|
10065 | this.adapter.registerInteractionHandler('click', this.click);
|
10066 | };
|
10067 | MDCFormFieldFoundation.prototype.destroy = function () {
|
10068 | this.adapter.deregisterInteractionHandler('click', this.click);
|
10069 | };
|
10070 | MDCFormFieldFoundation.prototype.handleClick = function () {
|
10071 | var _this = this;
|
10072 | this.adapter.activateInputRipple();
|
10073 | requestAnimationFrame(function () {
|
10074 | _this.adapter.deactivateInputRipple();
|
10075 | });
|
10076 | };
|
10077 | return MDCFormFieldFoundation;
|
10078 | }(foundation_1.MDCFoundation);
|
10079 | exports.MDCFormFieldFoundation = MDCFormFieldFoundation;
|
10080 |
|
10081 | exports.default = MDCFormFieldFoundation;
|
10082 |
|
10083 | }),
|
10084 |
|
10085 | "./packages/mdc-form-field/index.ts":
|
10086 |
|
10087 |
|
10088 |
|
10089 |
|
10090 | (function(module, exports, __webpack_require__) {
|
10091 |
|
10092 | "use strict";
|
10093 |
|
10094 |
|
10095 |
|
10096 |
|
10097 |
|
10098 |
|
10099 |
|
10100 |
|
10101 |
|
10102 |
|
10103 |
|
10104 |
|
10105 |
|
10106 |
|
10107 |
|
10108 |
|
10109 |
|
10110 |
|
10111 |
|
10112 |
|
10113 |
|
10114 |
|
10115 |
|
10116 |
|
10117 | var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
|
10118 | if (k2 === undefined) k2 = k;
|
10119 | Object.defineProperty(o, k2, { enumerable: true, get: function get() {
|
10120 | return m[k];
|
10121 | } });
|
10122 | } : function (o, m, k, k2) {
|
10123 | if (k2 === undefined) k2 = k;
|
10124 | o[k2] = m[k];
|
10125 | });
|
10126 | var __exportStar = this && this.__exportStar || function (m, exports) {
|
10127 | for (var p in m) {
|
10128 | if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
10129 | }
|
10130 | };
|
10131 | Object.defineProperty(exports, "__esModule", { value: true });
|
10132 | __exportStar(__webpack_require__( "./packages/mdc-form-field/adapter.ts"), exports);
|
10133 | __exportStar(__webpack_require__( "./packages/mdc-form-field/component.ts"), exports);
|
10134 | __exportStar(__webpack_require__( "./packages/mdc-form-field/constants.ts"), exports);
|
10135 | __exportStar(__webpack_require__( "./packages/mdc-form-field/foundation.ts"), exports);
|
10136 |
|
10137 | }),
|
10138 |
|
10139 | "./packages/mdc-icon-button/adapter.ts":
|
10140 |
|
10141 |
|
10142 |
|
10143 |
|
10144 | (function(module, exports, __webpack_require__) {
|
10145 |
|
10146 | "use strict";
|
10147 |
|
10148 |
|
10149 |
|
10150 |
|
10151 |
|
10152 |
|
10153 |
|
10154 |
|
10155 |
|
10156 |
|
10157 |
|
10158 |
|
10159 |
|
10160 |
|
10161 |
|
10162 |
|
10163 |
|
10164 |
|
10165 |
|
10166 |
|
10167 |
|
10168 |
|
10169 |
|
10170 |
|
10171 | Object.defineProperty(exports, "__esModule", { value: true });
|
10172 |
|
10173 | }),
|
10174 |
|
10175 | "./packages/mdc-icon-button/component.ts":
|
10176 |
|
10177 |
|
10178 |
|
10179 |
|
10180 | (function(module, exports, __webpack_require__) {
|
10181 |
|
10182 | "use strict";
|
10183 |
|
10184 |
|
10185 |
|
10186 |
|
10187 |
|
10188 |
|
10189 |
|
10190 |
|
10191 |
|
10192 |
|
10193 |
|
10194 |
|
10195 |
|
10196 |
|
10197 |
|
10198 |
|
10199 |
|
10200 |
|
10201 |
|
10202 |
|
10203 |
|
10204 |
|
10205 |
|
10206 |
|
10207 | var __extends = this && this.__extends || function () {
|
10208 | var _extendStatics = function extendStatics(d, b) {
|
10209 | _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
|
10210 | d.__proto__ = b;
|
10211 | } || function (d, b) {
|
10212 | for (var p in b) {
|
10213 | if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
10214 | }
|
10215 | };
|
10216 | return _extendStatics(d, b);
|
10217 | };
|
10218 | return function (d, b) {
|
10219 | if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
10220 | _extendStatics(d, b);
|
10221 | function __() {
|
10222 | this.constructor = d;
|
10223 | }
|
10224 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
10225 | };
|
10226 | }();
|
10227 | Object.defineProperty(exports, "__esModule", { value: true });
|
10228 | exports.MDCIconButtonToggle = void 0;
|
10229 | var component_1 = __webpack_require__( "./packages/mdc-base/component.ts");
|
10230 | var component_2 = __webpack_require__( "./packages/mdc-ripple/component.ts");
|
10231 | var foundation_1 = __webpack_require__( "./packages/mdc-icon-button/foundation.ts");
|
10232 | var strings = foundation_1.MDCIconButtonToggleFoundation.strings;
|
10233 | var MDCIconButtonToggle = function (_super) {
|
10234 | __extends(MDCIconButtonToggle, _super);
|
10235 | function MDCIconButtonToggle() {
|
10236 | var _this = _super !== null && _super.apply(this, arguments) || this;
|
10237 | _this.rippleComponent = _this.createRipple();
|
10238 | return _this;
|
10239 | }
|
10240 | MDCIconButtonToggle.attachTo = function (root) {
|
10241 | return new MDCIconButtonToggle(root);
|
10242 | };
|
10243 | MDCIconButtonToggle.prototype.initialSyncWithDOM = function () {
|
10244 | var _this = this;
|
10245 | this.handleClick = function () {
|
10246 | _this.foundation.handleClick();
|
10247 | };
|
10248 | this.listen('click', this.handleClick);
|
10249 | };
|
10250 | MDCIconButtonToggle.prototype.destroy = function () {
|
10251 | this.unlisten('click', this.handleClick);
|
10252 | this.ripple.destroy();
|
10253 | _super.prototype.destroy.call(this);
|
10254 | };
|
10255 | MDCIconButtonToggle.prototype.getDefaultFoundation = function () {
|
10256 | var _this = this;
|
10257 |
|
10258 |
|
10259 | var adapter = {
|
10260 | addClass: function addClass(className) {
|
10261 | return _this.root.classList.add(className);
|
10262 | },
|
10263 | hasClass: function hasClass(className) {
|
10264 | return _this.root.classList.contains(className);
|
10265 | },
|
10266 | notifyChange: function notifyChange(evtData) {
|
10267 | _this.emit(strings.CHANGE_EVENT, evtData);
|
10268 | },
|
10269 | removeClass: function removeClass(className) {
|
10270 | return _this.root.classList.remove(className);
|
10271 | },
|
10272 | getAttr: function getAttr(attrName) {
|
10273 | return _this.root.getAttribute(attrName);
|
10274 | },
|
10275 | setAttr: function setAttr(attrName, attrValue) {
|
10276 | return _this.root.setAttribute(attrName, attrValue);
|
10277 | }
|
10278 | };
|
10279 | return new foundation_1.MDCIconButtonToggleFoundation(adapter);
|
10280 | };
|
10281 | Object.defineProperty(MDCIconButtonToggle.prototype, "ripple", {
|
10282 | get: function get() {
|
10283 | return this.rippleComponent;
|
10284 | },
|
10285 | enumerable: false,
|
10286 | configurable: true
|
10287 | });
|
10288 | Object.defineProperty(MDCIconButtonToggle.prototype, "on", {
|
10289 | get: function get() {
|
10290 | return this.foundation.isOn();
|
10291 | },
|
10292 | set: function set(isOn) {
|
10293 | this.foundation.toggle(isOn);
|
10294 | },
|
10295 | enumerable: false,
|
10296 | configurable: true
|
10297 | });
|
10298 | MDCIconButtonToggle.prototype.createRipple = function () {
|
10299 | var ripple = new component_2.MDCRipple(this.root);
|
10300 | ripple.unbounded = true;
|
10301 | return ripple;
|
10302 | };
|
10303 | return MDCIconButtonToggle;
|
10304 | }(component_1.MDCComponent);
|
10305 | exports.MDCIconButtonToggle = MDCIconButtonToggle;
|
10306 |
|
10307 | }),
|
10308 |
|
10309 | "./packages/mdc-icon-button/constants.ts":
|
10310 |
|
10311 |
|
10312 |
|
10313 |
|
10314 | (function(module, exports, __webpack_require__) {
|
10315 |
|
10316 | "use strict";
|
10317 |
|
10318 |
|
10319 |
|
10320 |
|
10321 |
|
10322 |
|
10323 |
|
10324 |
|
10325 |
|
10326 |
|
10327 |
|
10328 |
|
10329 |
|
10330 |
|
10331 |
|
10332 |
|
10333 |
|
10334 |
|
10335 |
|
10336 |
|
10337 |
|
10338 |
|
10339 |
|
10340 |
|
10341 | Object.defineProperty(exports, "__esModule", { value: true });
|
10342 | exports.strings = exports.cssClasses = void 0;
|
10343 | exports.cssClasses = {
|
10344 | ICON_BUTTON_ON: 'mdc-icon-button--on',
|
10345 | ROOT: 'mdc-icon-button'
|
10346 | };
|
10347 | exports.strings = {
|
10348 | ARIA_LABEL: 'aria-label',
|
10349 | ARIA_PRESSED: 'aria-pressed',
|
10350 | DATA_ARIA_LABEL_OFF: 'data-aria-label-off',
|
10351 | DATA_ARIA_LABEL_ON: 'data-aria-label-on',
|
10352 | CHANGE_EVENT: 'MDCIconButtonToggle:change'
|
10353 | };
|
10354 |
|
10355 | }),
|
10356 |
|
10357 | "./packages/mdc-icon-button/foundation.ts":
|
10358 |
|
10359 |
|
10360 |
|
10361 |
|
10362 | (function(module, exports, __webpack_require__) {
|
10363 |
|
10364 | "use strict";
|
10365 |
|
10366 |
|
10367 |
|
10368 |
|
10369 |
|
10370 |
|
10371 |
|
10372 |
|
10373 |
|
10374 |
|
10375 |
|
10376 |
|
10377 |
|
10378 |
|
10379 |
|
10380 |
|
10381 |
|
10382 |
|
10383 |
|
10384 |
|
10385 |
|
10386 |
|
10387 |
|
10388 |
|
10389 | var __extends = this && this.__extends || function () {
|
10390 | var _extendStatics = function extendStatics(d, b) {
|
10391 | _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
|
10392 | d.__proto__ = b;
|
10393 | } || function (d, b) {
|
10394 | for (var p in b) {
|
10395 | if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
10396 | }
|
10397 | };
|
10398 | return _extendStatics(d, b);
|
10399 | };
|
10400 | return function (d, b) {
|
10401 | if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
10402 | _extendStatics(d, b);
|
10403 | function __() {
|
10404 | this.constructor = d;
|
10405 | }
|
10406 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
10407 | };
|
10408 | }();
|
10409 | var __assign = this && this.__assign || function () {
|
10410 | __assign = Object.assign || function (t) {
|
10411 | for (var s, i = 1, n = arguments.length; i < n; i++) {
|
10412 | s = arguments[i];
|
10413 | for (var p in s) {
|
10414 | if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
10415 | }
|
10416 | }
|
10417 | return t;
|
10418 | };
|
10419 | return __assign.apply(this, arguments);
|
10420 | };
|
10421 | Object.defineProperty(exports, "__esModule", { value: true });
|
10422 | exports.MDCIconButtonToggleFoundation = void 0;
|
10423 | var foundation_1 = __webpack_require__( "./packages/mdc-base/foundation.ts");
|
10424 | var constants_1 = __webpack_require__( "./packages/mdc-icon-button/constants.ts");
|
10425 | var MDCIconButtonToggleFoundation = function (_super) {
|
10426 | __extends(MDCIconButtonToggleFoundation, _super);
|
10427 | function MDCIconButtonToggleFoundation(adapter) {
|
10428 | var _this = _super.call(this, __assign(__assign({}, MDCIconButtonToggleFoundation.defaultAdapter), adapter)) || this;
|
10429 | |
10430 |
|
10431 |
|
10432 |
|
10433 | _this.hasToggledAriaLabel = false;
|
10434 | return _this;
|
10435 | }
|
10436 | Object.defineProperty(MDCIconButtonToggleFoundation, "cssClasses", {
|
10437 | get: function get() {
|
10438 | return constants_1.cssClasses;
|
10439 | },
|
10440 | enumerable: false,
|
10441 | configurable: true
|
10442 | });
|
10443 | Object.defineProperty(MDCIconButtonToggleFoundation, "strings", {
|
10444 | get: function get() {
|
10445 | return constants_1.strings;
|
10446 | },
|
10447 | enumerable: false,
|
10448 | configurable: true
|
10449 | });
|
10450 | Object.defineProperty(MDCIconButtonToggleFoundation, "defaultAdapter", {
|
10451 | get: function get() {
|
10452 | return {
|
10453 | addClass: function addClass() {
|
10454 | return undefined;
|
10455 | },
|
10456 | hasClass: function hasClass() {
|
10457 | return false;
|
10458 | },
|
10459 | notifyChange: function notifyChange() {
|
10460 | return undefined;
|
10461 | },
|
10462 | removeClass: function removeClass() {
|
10463 | return undefined;
|
10464 | },
|
10465 | getAttr: function getAttr() {
|
10466 | return null;
|
10467 | },
|
10468 | setAttr: function setAttr() {
|
10469 | return undefined;
|
10470 | }
|
10471 | };
|
10472 | },
|
10473 | enumerable: false,
|
10474 | configurable: true
|
10475 | });
|
10476 | MDCIconButtonToggleFoundation.prototype.init = function () {
|
10477 | var ariaLabelOn = this.adapter.getAttr(constants_1.strings.DATA_ARIA_LABEL_ON);
|
10478 | var ariaLabelOff = this.adapter.getAttr(constants_1.strings.DATA_ARIA_LABEL_OFF);
|
10479 | if (ariaLabelOn && ariaLabelOff) {
|
10480 | if (this.adapter.getAttr(constants_1.strings.ARIA_PRESSED) !== null) {
|
10481 | throw new Error('MDCIconButtonToggleFoundation: Button should not set ' + '`aria-pressed` if it has a toggled aria label.');
|
10482 | }
|
10483 | this.hasToggledAriaLabel = true;
|
10484 | } else {
|
10485 | this.adapter.setAttr(constants_1.strings.ARIA_PRESSED, String(this.isOn()));
|
10486 | }
|
10487 | };
|
10488 | MDCIconButtonToggleFoundation.prototype.handleClick = function () {
|
10489 | this.toggle();
|
10490 | this.adapter.notifyChange({ isOn: this.isOn() });
|
10491 | };
|
10492 | MDCIconButtonToggleFoundation.prototype.isOn = function () {
|
10493 | return this.adapter.hasClass(constants_1.cssClasses.ICON_BUTTON_ON);
|
10494 | };
|
10495 | MDCIconButtonToggleFoundation.prototype.toggle = function (isOn) {
|
10496 | if (isOn === void 0) {
|
10497 | isOn = !this.isOn();
|
10498 | }
|
10499 |
|
10500 | if (isOn) {
|
10501 | this.adapter.addClass(constants_1.cssClasses.ICON_BUTTON_ON);
|
10502 | } else {
|
10503 | this.adapter.removeClass(constants_1.cssClasses.ICON_BUTTON_ON);
|
10504 | }
|
10505 |
|
10506 | if (this.hasToggledAriaLabel) {
|
10507 | var ariaLabel = isOn ? this.adapter.getAttr(constants_1.strings.DATA_ARIA_LABEL_ON) : this.adapter.getAttr(constants_1.strings.DATA_ARIA_LABEL_OFF);
|
10508 | this.adapter.setAttr(constants_1.strings.ARIA_LABEL, ariaLabel || '');
|
10509 | } else {
|
10510 | this.adapter.setAttr(constants_1.strings.ARIA_PRESSED, "" + isOn);
|
10511 | }
|
10512 | };
|
10513 | return MDCIconButtonToggleFoundation;
|
10514 | }(foundation_1.MDCFoundation);
|
10515 | exports.MDCIconButtonToggleFoundation = MDCIconButtonToggleFoundation;
|
10516 |
|
10517 | exports.default = MDCIconButtonToggleFoundation;
|
10518 |
|
10519 | }),
|
10520 |
|
10521 | "./packages/mdc-icon-button/index.ts":
|
10522 |
|
10523 |
|
10524 |
|
10525 |
|
10526 | (function(module, exports, __webpack_require__) {
|
10527 |
|
10528 | "use strict";
|
10529 |
|
10530 |
|
10531 |
|
10532 |
|
10533 |
|
10534 |
|
10535 |
|
10536 |
|
10537 |
|
10538 |
|
10539 |
|
10540 |
|
10541 |
|
10542 |
|
10543 |
|
10544 |
|
10545 |
|
10546 |
|
10547 |
|
10548 |
|
10549 |
|
10550 |
|
10551 |
|
10552 |
|
10553 | var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
|
10554 | if (k2 === undefined) k2 = k;
|
10555 | Object.defineProperty(o, k2, { enumerable: true, get: function get() {
|
10556 | return m[k];
|
10557 | } });
|
10558 | } : function (o, m, k, k2) {
|
10559 | if (k2 === undefined) k2 = k;
|
10560 | o[k2] = m[k];
|
10561 | });
|
10562 | var __exportStar = this && this.__exportStar || function (m, exports) {
|
10563 | for (var p in m) {
|
10564 | if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
10565 | }
|
10566 | };
|
10567 | Object.defineProperty(exports, "__esModule", { value: true });
|
10568 | __exportStar(__webpack_require__( "./packages/mdc-icon-button/adapter.ts"), exports);
|
10569 | __exportStar(__webpack_require__( "./packages/mdc-icon-button/component.ts"), exports);
|
10570 | __exportStar(__webpack_require__( "./packages/mdc-icon-button/constants.ts"), exports);
|
10571 | __exportStar(__webpack_require__( "./packages/mdc-icon-button/foundation.ts"), exports);
|
10572 | __exportStar(__webpack_require__( "./packages/mdc-icon-button/types.ts"), exports);
|
10573 |
|
10574 | }),
|
10575 |
|
10576 | "./packages/mdc-icon-button/types.ts":
|
10577 |
|
10578 |
|
10579 |
|
10580 |
|
10581 | (function(module, exports, __webpack_require__) {
|
10582 |
|
10583 | "use strict";
|
10584 |
|
10585 |
|
10586 |
|
10587 |
|
10588 |
|
10589 |
|
10590 |
|
10591 |
|
10592 |
|
10593 |
|
10594 |
|
10595 |
|
10596 |
|
10597 |
|
10598 |
|
10599 |
|
10600 |
|
10601 |
|
10602 |
|
10603 |
|
10604 |
|
10605 |
|
10606 |
|
10607 |
|
10608 | Object.defineProperty(exports, "__esModule", { value: true });
|
10609 |
|
10610 | }),
|
10611 |
|
10612 | "./packages/mdc-line-ripple/adapter.ts":
|
10613 |
|
10614 |
|
10615 |
|
10616 |
|
10617 | (function(module, exports, __webpack_require__) {
|
10618 |
|
10619 | "use strict";
|
10620 |
|
10621 |
|
10622 |
|
10623 |
|
10624 |
|
10625 |
|
10626 |
|
10627 |
|
10628 |
|
10629 |
|
10630 |
|
10631 |
|
10632 |
|
10633 |
|
10634 |
|
10635 |
|
10636 |
|
10637 |
|
10638 |
|
10639 |
|
10640 |
|
10641 |
|
10642 |
|
10643 |
|
10644 | Object.defineProperty(exports, "__esModule", { value: true });
|
10645 |
|
10646 | }),
|
10647 |
|
10648 | "./packages/mdc-line-ripple/component.ts":
|
10649 |
|
10650 |
|
10651 |
|
10652 |
|
10653 | (function(module, exports, __webpack_require__) {
|
10654 |
|
10655 | "use strict";
|
10656 |
|
10657 |
|
10658 |
|
10659 |
|
10660 |
|
10661 |
|
10662 |
|
10663 |
|
10664 |
|
10665 |
|
10666 |
|
10667 |
|
10668 |
|
10669 |
|
10670 |
|
10671 |
|
10672 |
|
10673 |
|
10674 |
|
10675 |
|
10676 |
|
10677 |
|
10678 |
|
10679 |
|
10680 | var __extends = this && this.__extends || function () {
|
10681 | var _extendStatics = function extendStatics(d, b) {
|
10682 | _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
|
10683 | d.__proto__ = b;
|
10684 | } || function (d, b) {
|
10685 | for (var p in b) {
|
10686 | if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
10687 | }
|
10688 | };
|
10689 | return _extendStatics(d, b);
|
10690 | };
|
10691 | return function (d, b) {
|
10692 | if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
10693 | _extendStatics(d, b);
|
10694 | function __() {
|
10695 | this.constructor = d;
|
10696 | }
|
10697 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
10698 | };
|
10699 | }();
|
10700 | Object.defineProperty(exports, "__esModule", { value: true });
|
10701 | exports.MDCLineRipple = void 0;
|
10702 | var component_1 = __webpack_require__( "./packages/mdc-base/component.ts");
|
10703 | var foundation_1 = __webpack_require__( "./packages/mdc-line-ripple/foundation.ts");
|
10704 | var MDCLineRipple = function (_super) {
|
10705 | __extends(MDCLineRipple, _super);
|
10706 | function MDCLineRipple() {
|
10707 | return _super !== null && _super.apply(this, arguments) || this;
|
10708 | }
|
10709 | MDCLineRipple.attachTo = function (root) {
|
10710 | return new MDCLineRipple(root);
|
10711 | };
|
10712 | |
10713 |
|
10714 |
|
10715 | MDCLineRipple.prototype.activate = function () {
|
10716 | this.foundation.activate();
|
10717 | };
|
10718 | |
10719 |
|
10720 |
|
10721 | MDCLineRipple.prototype.deactivate = function () {
|
10722 | this.foundation.deactivate();
|
10723 | };
|
10724 | |
10725 |
|
10726 |
|
10727 |
|
10728 | MDCLineRipple.prototype.setRippleCenter = function (xCoordinate) {
|
10729 | this.foundation.setRippleCenter(xCoordinate);
|
10730 | };
|
10731 | MDCLineRipple.prototype.getDefaultFoundation = function () {
|
10732 | var _this = this;
|
10733 |
|
10734 |
|
10735 |
|
10736 | var adapter = {
|
10737 | addClass: function addClass(className) {
|
10738 | return _this.root.classList.add(className);
|
10739 | },
|
10740 | removeClass: function removeClass(className) {
|
10741 | return _this.root.classList.remove(className);
|
10742 | },
|
10743 | hasClass: function hasClass(className) {
|
10744 | return _this.root.classList.contains(className);
|
10745 | },
|
10746 | setStyle: function setStyle(propertyName, value) {
|
10747 | return _this.root.style.setProperty(propertyName, value);
|
10748 | },
|
10749 | registerEventHandler: function registerEventHandler(evtType, handler) {
|
10750 | return _this.listen(evtType, handler);
|
10751 | },
|
10752 | deregisterEventHandler: function deregisterEventHandler(evtType, handler) {
|
10753 | return _this.unlisten(evtType, handler);
|
10754 | }
|
10755 | };
|
10756 |
|
10757 | return new foundation_1.MDCLineRippleFoundation(adapter);
|
10758 | };
|
10759 | return MDCLineRipple;
|
10760 | }(component_1.MDCComponent);
|
10761 | exports.MDCLineRipple = MDCLineRipple;
|
10762 |
|
10763 | }),
|
10764 |
|
10765 | "./packages/mdc-line-ripple/constants.ts":
|
10766 |
|
10767 |
|
10768 |
|
10769 |
|
10770 | (function(module, exports, __webpack_require__) {
|
10771 |
|
10772 | "use strict";
|
10773 |
|
10774 |
|
10775 |
|
10776 |
|
10777 |
|
10778 |
|
10779 |
|
10780 |
|
10781 |
|
10782 |
|
10783 |
|
10784 |
|
10785 |
|
10786 |
|
10787 |
|
10788 |
|
10789 |
|
10790 |
|
10791 |
|
10792 |
|
10793 |
|
10794 |
|
10795 |
|
10796 |
|
10797 | Object.defineProperty(exports, "__esModule", { value: true });
|
10798 | exports.cssClasses = void 0;
|
10799 | var cssClasses = {
|
10800 | LINE_RIPPLE_ACTIVE: 'mdc-line-ripple--active',
|
10801 | LINE_RIPPLE_DEACTIVATING: 'mdc-line-ripple--deactivating'
|
10802 | };
|
10803 | exports.cssClasses = cssClasses;
|
10804 |
|
10805 | }),
|
10806 |
|
10807 | "./packages/mdc-line-ripple/foundation.ts":
|
10808 |
|
10809 |
|
10810 |
|
10811 |
|
10812 | (function(module, exports, __webpack_require__) {
|
10813 |
|
10814 | "use strict";
|
10815 |
|
10816 |
|
10817 |
|
10818 |
|
10819 |
|
10820 |
|
10821 |
|
10822 |
|
10823 |
|
10824 |
|
10825 |
|
10826 |
|
10827 |
|
10828 |
|
10829 |
|
10830 |
|
10831 |
|
10832 |
|
10833 |
|
10834 |
|
10835 |
|
10836 |
|
10837 |
|
10838 |
|
10839 | var __extends = this && this.__extends || function () {
|
10840 | var _extendStatics = function extendStatics(d, b) {
|
10841 | _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
|
10842 | d.__proto__ = b;
|
10843 | } || function (d, b) {
|
10844 | for (var p in b) {
|
10845 | if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
10846 | }
|
10847 | };
|
10848 | return _extendStatics(d, b);
|
10849 | };
|
10850 | return function (d, b) {
|
10851 | if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
10852 | _extendStatics(d, b);
|
10853 | function __() {
|
10854 | this.constructor = d;
|
10855 | }
|
10856 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
10857 | };
|
10858 | }();
|
10859 | var __assign = this && this.__assign || function () {
|
10860 | __assign = Object.assign || function (t) {
|
10861 | for (var s, i = 1, n = arguments.length; i < n; i++) {
|
10862 | s = arguments[i];
|
10863 | for (var p in s) {
|
10864 | if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
10865 | }
|
10866 | }
|
10867 | return t;
|
10868 | };
|
10869 | return __assign.apply(this, arguments);
|
10870 | };
|
10871 | Object.defineProperty(exports, "__esModule", { value: true });
|
10872 | exports.MDCLineRippleFoundation = void 0;
|
10873 | var foundation_1 = __webpack_require__( "./packages/mdc-base/foundation.ts");
|
10874 | var constants_1 = __webpack_require__( "./packages/mdc-line-ripple/constants.ts");
|
10875 | var MDCLineRippleFoundation = function (_super) {
|
10876 | __extends(MDCLineRippleFoundation, _super);
|
10877 | function MDCLineRippleFoundation(adapter) {
|
10878 | var _this = _super.call(this, __assign(__assign({}, MDCLineRippleFoundation.defaultAdapter), adapter)) || this;
|
10879 | _this.transitionEndHandler = function (evt) {
|
10880 | _this.handleTransitionEnd(evt);
|
10881 | };
|
10882 | return _this;
|
10883 | }
|
10884 | Object.defineProperty(MDCLineRippleFoundation, "cssClasses", {
|
10885 | get: function get() {
|
10886 | return constants_1.cssClasses;
|
10887 | },
|
10888 | enumerable: false,
|
10889 | configurable: true
|
10890 | });
|
10891 | Object.defineProperty(MDCLineRippleFoundation, "defaultAdapter", {
|
10892 | |
10893 |
|
10894 |
|
10895 | get: function get() {
|
10896 |
|
10897 | return {
|
10898 | addClass: function addClass() {
|
10899 | return undefined;
|
10900 | },
|
10901 | removeClass: function removeClass() {
|
10902 | return undefined;
|
10903 | },
|
10904 | hasClass: function hasClass() {
|
10905 | return false;
|
10906 | },
|
10907 | setStyle: function setStyle() {
|
10908 | return undefined;
|
10909 | },
|
10910 | registerEventHandler: function registerEventHandler() {
|
10911 | return undefined;
|
10912 | },
|
10913 | deregisterEventHandler: function deregisterEventHandler() {
|
10914 | return undefined;
|
10915 | }
|
10916 | };
|
10917 |
|
10918 | },
|
10919 | enumerable: false,
|
10920 | configurable: true
|
10921 | });
|
10922 | MDCLineRippleFoundation.prototype.init = function () {
|
10923 | this.adapter.registerEventHandler('transitionend', this.transitionEndHandler);
|
10924 | };
|
10925 | MDCLineRippleFoundation.prototype.destroy = function () {
|
10926 | this.adapter.deregisterEventHandler('transitionend', this.transitionEndHandler);
|
10927 | };
|
10928 | MDCLineRippleFoundation.prototype.activate = function () {
|
10929 | this.adapter.removeClass(constants_1.cssClasses.LINE_RIPPLE_DEACTIVATING);
|
10930 | this.adapter.addClass(constants_1.cssClasses.LINE_RIPPLE_ACTIVE);
|
10931 | };
|
10932 | MDCLineRippleFoundation.prototype.setRippleCenter = function (xCoordinate) {
|
10933 | this.adapter.setStyle('transform-origin', xCoordinate + "px center");
|
10934 | };
|
10935 | MDCLineRippleFoundation.prototype.deactivate = function () {
|
10936 | this.adapter.addClass(constants_1.cssClasses.LINE_RIPPLE_DEACTIVATING);
|
10937 | };
|
10938 | MDCLineRippleFoundation.prototype.handleTransitionEnd = function (evt) {
|
10939 |
|
10940 |
|
10941 | var isDeactivating = this.adapter.hasClass(constants_1.cssClasses.LINE_RIPPLE_DEACTIVATING);
|
10942 | if (evt.propertyName === 'opacity') {
|
10943 | if (isDeactivating) {
|
10944 | this.adapter.removeClass(constants_1.cssClasses.LINE_RIPPLE_ACTIVE);
|
10945 | this.adapter.removeClass(constants_1.cssClasses.LINE_RIPPLE_DEACTIVATING);
|
10946 | }
|
10947 | }
|
10948 | };
|
10949 | return MDCLineRippleFoundation;
|
10950 | }(foundation_1.MDCFoundation);
|
10951 | exports.MDCLineRippleFoundation = MDCLineRippleFoundation;
|
10952 |
|
10953 | exports.default = MDCLineRippleFoundation;
|
10954 |
|
10955 | }),
|
10956 |
|
10957 | "./packages/mdc-line-ripple/index.ts":
|
10958 |
|
10959 |
|
10960 |
|
10961 |
|
10962 | (function(module, exports, __webpack_require__) {
|
10963 |
|
10964 | "use strict";
|
10965 |
|
10966 |
|
10967 |
|
10968 |
|
10969 |
|
10970 |
|
10971 |
|
10972 |
|
10973 |
|
10974 |
|
10975 |
|
10976 |
|
10977 |
|
10978 |
|
10979 |
|
10980 |
|
10981 |
|
10982 |
|
10983 |
|
10984 |
|
10985 |
|
10986 |
|
10987 |
|
10988 |
|
10989 | var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
|
10990 | if (k2 === undefined) k2 = k;
|
10991 | Object.defineProperty(o, k2, { enumerable: true, get: function get() {
|
10992 | return m[k];
|
10993 | } });
|
10994 | } : function (o, m, k, k2) {
|
10995 | if (k2 === undefined) k2 = k;
|
10996 | o[k2] = m[k];
|
10997 | });
|
10998 | var __exportStar = this && this.__exportStar || function (m, exports) {
|
10999 | for (var p in m) {
|
11000 | if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
11001 | }
|
11002 | };
|
11003 | Object.defineProperty(exports, "__esModule", { value: true });
|
11004 | __exportStar(__webpack_require__( "./packages/mdc-line-ripple/adapter.ts"), exports);
|
11005 | __exportStar(__webpack_require__( "./packages/mdc-line-ripple/component.ts"), exports);
|
11006 | __exportStar(__webpack_require__( "./packages/mdc-line-ripple/constants.ts"), exports);
|
11007 | __exportStar(__webpack_require__( "./packages/mdc-line-ripple/foundation.ts"), exports);
|
11008 |
|
11009 | }),
|
11010 |
|
11011 | "./packages/mdc-linear-progress/adapter.ts":
|
11012 |
|
11013 |
|
11014 |
|
11015 |
|
11016 | (function(module, exports, __webpack_require__) {
|
11017 |
|
11018 | "use strict";
|
11019 |
|
11020 |
|
11021 |
|
11022 |
|
11023 |
|
11024 |
|
11025 |
|
11026 |
|
11027 |
|
11028 |
|
11029 |
|
11030 |
|
11031 |
|
11032 |
|
11033 |
|
11034 |
|
11035 |
|
11036 |
|
11037 |
|
11038 |
|
11039 |
|
11040 |
|
11041 |
|
11042 |
|
11043 | Object.defineProperty(exports, "__esModule", { value: true });
|
11044 |
|
11045 | }),
|
11046 |
|
11047 | "./packages/mdc-linear-progress/component.ts":
|
11048 |
|
11049 |
|
11050 |
|
11051 |
|
11052 | (function(module, exports, __webpack_require__) {
|
11053 |
|
11054 | "use strict";
|
11055 |
|
11056 |
|
11057 |
|
11058 |
|
11059 |
|
11060 |
|
11061 |
|
11062 |
|
11063 |
|
11064 |
|
11065 |
|
11066 |
|
11067 |
|
11068 |
|
11069 |
|
11070 |
|
11071 |
|
11072 |
|
11073 |
|
11074 |
|
11075 |
|
11076 |
|
11077 |
|
11078 |
|
11079 | var __extends = this && this.__extends || function () {
|
11080 | var _extendStatics = function extendStatics(d, b) {
|
11081 | _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
|
11082 | d.__proto__ = b;
|
11083 | } || function (d, b) {
|
11084 | for (var p in b) {
|
11085 | if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
11086 | }
|
11087 | };
|
11088 | return _extendStatics(d, b);
|
11089 | };
|
11090 | return function (d, b) {
|
11091 | if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
11092 | _extendStatics(d, b);
|
11093 | function __() {
|
11094 | this.constructor = d;
|
11095 | }
|
11096 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
11097 | };
|
11098 | }();
|
11099 | Object.defineProperty(exports, "__esModule", { value: true });
|
11100 | exports.MDCLinearProgress = void 0;
|
11101 | var component_1 = __webpack_require__( "./packages/mdc-base/component.ts");
|
11102 | var foundation_1 = __webpack_require__( "./packages/mdc-linear-progress/foundation.ts");
|
11103 | var MDCLinearProgress = function (_super) {
|
11104 | __extends(MDCLinearProgress, _super);
|
11105 | function MDCLinearProgress() {
|
11106 | return _super !== null && _super.apply(this, arguments) || this;
|
11107 | }
|
11108 | MDCLinearProgress.attachTo = function (root) {
|
11109 | return new MDCLinearProgress(root);
|
11110 | };
|
11111 | Object.defineProperty(MDCLinearProgress.prototype, "determinate", {
|
11112 | set: function set(value) {
|
11113 | this.foundation.setDeterminate(value);
|
11114 | },
|
11115 | enumerable: false,
|
11116 | configurable: true
|
11117 | });
|
11118 | Object.defineProperty(MDCLinearProgress.prototype, "progress", {
|
11119 | set: function set(value) {
|
11120 | this.foundation.setProgress(value);
|
11121 | },
|
11122 | enumerable: false,
|
11123 | configurable: true
|
11124 | });
|
11125 | Object.defineProperty(MDCLinearProgress.prototype, "buffer", {
|
11126 | set: function set(value) {
|
11127 | this.foundation.setBuffer(value);
|
11128 | },
|
11129 | enumerable: false,
|
11130 | configurable: true
|
11131 | });
|
11132 | MDCLinearProgress.prototype.open = function () {
|
11133 | this.foundation.open();
|
11134 | };
|
11135 | MDCLinearProgress.prototype.close = function () {
|
11136 | this.foundation.close();
|
11137 | };
|
11138 | MDCLinearProgress.prototype.initialSyncWithDOM = function () {
|
11139 | var _this = this;
|
11140 | this.root.addEventListener('transitionend', function () {
|
11141 | _this.foundation.handleTransitionEnd();
|
11142 | });
|
11143 | };
|
11144 | MDCLinearProgress.prototype.getDefaultFoundation = function () {
|
11145 | var _this = this;
|
11146 |
|
11147 |
|
11148 |
|
11149 | var adapter = {
|
11150 | addClass: function addClass(className) {
|
11151 | _this.root.classList.add(className);
|
11152 | },
|
11153 | forceLayout: function forceLayout() {
|
11154 | _this.root.getBoundingClientRect();
|
11155 | },
|
11156 | setBufferBarStyle: function setBufferBarStyle(styleProperty, value) {
|
11157 | var bufferBar = _this.root.querySelector(foundation_1.MDCLinearProgressFoundation.strings.BUFFER_BAR_SELECTOR);
|
11158 | if (bufferBar) {
|
11159 | bufferBar.style.setProperty(styleProperty, value);
|
11160 | }
|
11161 | },
|
11162 | setPrimaryBarStyle: function setPrimaryBarStyle(styleProperty, value) {
|
11163 | var primaryBar = _this.root.querySelector(foundation_1.MDCLinearProgressFoundation.strings.PRIMARY_BAR_SELECTOR);
|
11164 | if (primaryBar) {
|
11165 | primaryBar.style.setProperty(styleProperty, value);
|
11166 | }
|
11167 | },
|
11168 | hasClass: function hasClass(className) {
|
11169 | return _this.root.classList.contains(className);
|
11170 | },
|
11171 | removeAttribute: function removeAttribute(attributeName) {
|
11172 | _this.root.removeAttribute(attributeName);
|
11173 | },
|
11174 | removeClass: function removeClass(className) {
|
11175 | _this.root.classList.remove(className);
|
11176 | },
|
11177 | setAttribute: function setAttribute(attributeName, value) {
|
11178 | _this.root.setAttribute(attributeName, value);
|
11179 | },
|
11180 | setStyle: function setStyle(name, value) {
|
11181 | _this.root.style.setProperty(name, value);
|
11182 | },
|
11183 | attachResizeObserver: function attachResizeObserver(callback) {
|
11184 | var RO = window.ResizeObserver;
|
11185 | if (RO) {
|
11186 | var ro = new RO(callback);
|
11187 | ro.observe(_this.root);
|
11188 | return ro;
|
11189 | }
|
11190 | return null;
|
11191 | },
|
11192 | getWidth: function getWidth() {
|
11193 | return _this.root.offsetWidth;
|
11194 | }
|
11195 | };
|
11196 | return new foundation_1.MDCLinearProgressFoundation(adapter);
|
11197 | };
|
11198 | return MDCLinearProgress;
|
11199 | }(component_1.MDCComponent);
|
11200 | exports.MDCLinearProgress = MDCLinearProgress;
|
11201 |
|
11202 | }),
|
11203 |
|
11204 | "./packages/mdc-linear-progress/constants.ts":
|
11205 |
|
11206 |
|
11207 |
|
11208 |
|
11209 | (function(module, exports, __webpack_require__) {
|
11210 |
|
11211 | "use strict";
|
11212 |
|
11213 |
|
11214 |
|
11215 |
|
11216 |
|
11217 |
|
11218 |
|
11219 |
|
11220 |
|
11221 |
|
11222 |
|
11223 |
|
11224 |
|
11225 |
|
11226 |
|
11227 |
|
11228 |
|
11229 |
|
11230 |
|
11231 |
|
11232 |
|
11233 |
|
11234 |
|
11235 |
|
11236 | Object.defineProperty(exports, "__esModule", { value: true });
|
11237 | exports.animationDimensionPercentages = exports.strings = exports.cssClasses = void 0;
|
11238 | exports.cssClasses = {
|
11239 | CLOSED_CLASS: 'mdc-linear-progress--closed',
|
11240 | CLOSED_ANIMATION_OFF_CLASS: 'mdc-linear-progress--closed-animation-off',
|
11241 | INDETERMINATE_CLASS: 'mdc-linear-progress--indeterminate',
|
11242 | REVERSED_CLASS: 'mdc-linear-progress--reversed',
|
11243 | ANIMATION_READY_CLASS: 'mdc-linear-progress--animation-ready'
|
11244 | };
|
11245 | exports.strings = {
|
11246 | ARIA_HIDDEN: 'aria-hidden',
|
11247 | ARIA_VALUEMAX: 'aria-valuemax',
|
11248 | ARIA_VALUEMIN: 'aria-valuemin',
|
11249 | ARIA_VALUENOW: 'aria-valuenow',
|
11250 | BUFFER_BAR_SELECTOR: '.mdc-linear-progress__buffer-bar',
|
11251 | FLEX_BASIS: 'flex-basis',
|
11252 | PRIMARY_BAR_SELECTOR: '.mdc-linear-progress__primary-bar'
|
11253 | };
|
11254 |
|
11255 | exports.animationDimensionPercentages = {
|
11256 | PRIMARY_HALF: .8367142,
|
11257 | PRIMARY_FULL: 2.00611057,
|
11258 | SECONDARY_QUARTER: .37651913,
|
11259 | SECONDARY_HALF: .84386165,
|
11260 | SECONDARY_FULL: 1.60277782
|
11261 | };
|
11262 |
|
11263 | }),
|
11264 |
|
11265 | "./packages/mdc-linear-progress/foundation.ts":
|
11266 |
|
11267 |
|
11268 |
|
11269 |
|
11270 | (function(module, exports, __webpack_require__) {
|
11271 |
|
11272 | "use strict";
|
11273 |
|
11274 |
|
11275 |
|
11276 |
|
11277 |
|
11278 |
|
11279 |
|
11280 |
|
11281 |
|
11282 |
|
11283 |
|
11284 |
|
11285 |
|
11286 |
|
11287 |
|
11288 |
|
11289 |
|
11290 |
|
11291 |
|
11292 |
|
11293 |
|
11294 |
|
11295 |
|
11296 |
|
11297 | var __extends = this && this.__extends || function () {
|
11298 | var _extendStatics = function extendStatics(d, b) {
|
11299 | _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
|
11300 | d.__proto__ = b;
|
11301 | } || function (d, b) {
|
11302 | for (var p in b) {
|
11303 | if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
11304 | }
|
11305 | };
|
11306 | return _extendStatics(d, b);
|
11307 | };
|
11308 | return function (d, b) {
|
11309 | if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
11310 | _extendStatics(d, b);
|
11311 | function __() {
|
11312 | this.constructor = d;
|
11313 | }
|
11314 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
11315 | };
|
11316 | }();
|
11317 | var __assign = this && this.__assign || function () {
|
11318 | __assign = Object.assign || function (t) {
|
11319 | for (var s, i = 1, n = arguments.length; i < n; i++) {
|
11320 | s = arguments[i];
|
11321 | for (var p in s) {
|
11322 | if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
11323 | }
|
11324 | }
|
11325 | return t;
|
11326 | };
|
11327 | return __assign.apply(this, arguments);
|
11328 | };
|
11329 | var __values = this && this.__values || function (o) {
|
11330 | var s = typeof Symbol === "function" && Symbol.iterator,
|
11331 | m = s && o[s],
|
11332 | i = 0;
|
11333 | if (m) return m.call(o);
|
11334 | if (o && typeof o.length === "number") return {
|
11335 | next: function next() {
|
11336 | if (o && i >= o.length) o = void 0;
|
11337 | return { value: o && o[i++], done: !o };
|
11338 | }
|
11339 | };
|
11340 | throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
11341 | };
|
11342 | Object.defineProperty(exports, "__esModule", { value: true });
|
11343 | exports.MDCLinearProgressFoundation = void 0;
|
11344 | var util_1 = __webpack_require__( "./packages/mdc-animation/util.ts");
|
11345 | var foundation_1 = __webpack_require__( "./packages/mdc-base/foundation.ts");
|
11346 | var constants_1 = __webpack_require__( "./packages/mdc-linear-progress/constants.ts");
|
11347 | var MDCLinearProgressFoundation = function (_super) {
|
11348 | __extends(MDCLinearProgressFoundation, _super);
|
11349 | function MDCLinearProgressFoundation(adapter) {
|
11350 | var _this = _super.call(this, __assign(__assign({}, MDCLinearProgressFoundation.defaultAdapter), adapter)) || this;
|
11351 | _this.observer = null;
|
11352 | return _this;
|
11353 | }
|
11354 | Object.defineProperty(MDCLinearProgressFoundation, "cssClasses", {
|
11355 | get: function get() {
|
11356 | return constants_1.cssClasses;
|
11357 | },
|
11358 | enumerable: false,
|
11359 | configurable: true
|
11360 | });
|
11361 | Object.defineProperty(MDCLinearProgressFoundation, "strings", {
|
11362 | get: function get() {
|
11363 | return constants_1.strings;
|
11364 | },
|
11365 | enumerable: false,
|
11366 | configurable: true
|
11367 | });
|
11368 | Object.defineProperty(MDCLinearProgressFoundation, "defaultAdapter", {
|
11369 | get: function get() {
|
11370 | return {
|
11371 | addClass: function addClass() {
|
11372 | return undefined;
|
11373 | },
|
11374 | attachResizeObserver: function attachResizeObserver() {
|
11375 | return null;
|
11376 | },
|
11377 | forceLayout: function forceLayout() {
|
11378 | return undefined;
|
11379 | },
|
11380 | getWidth: function getWidth() {
|
11381 | return 0;
|
11382 | },
|
11383 | hasClass: function hasClass() {
|
11384 | return false;
|
11385 | },
|
11386 | setBufferBarStyle: function setBufferBarStyle() {
|
11387 | return null;
|
11388 | },
|
11389 | setPrimaryBarStyle: function setPrimaryBarStyle() {
|
11390 | return null;
|
11391 | },
|
11392 | setStyle: function setStyle() {
|
11393 | return undefined;
|
11394 | },
|
11395 | removeAttribute: function removeAttribute() {
|
11396 | return undefined;
|
11397 | },
|
11398 | removeClass: function removeClass() {
|
11399 | return undefined;
|
11400 | },
|
11401 | setAttribute: function setAttribute() {
|
11402 | return undefined;
|
11403 | }
|
11404 | };
|
11405 | },
|
11406 | enumerable: false,
|
11407 | configurable: true
|
11408 | });
|
11409 | MDCLinearProgressFoundation.prototype.init = function () {
|
11410 | var _this = this;
|
11411 | this.determinate = !this.adapter.hasClass(constants_1.cssClasses.INDETERMINATE_CLASS);
|
11412 | this.adapter.addClass(constants_1.cssClasses.ANIMATION_READY_CLASS);
|
11413 | this.progress = 0;
|
11414 | this.buffer = 1;
|
11415 | this.observer = this.adapter.attachResizeObserver(function (entries) {
|
11416 | var e_1, _a;
|
11417 | if (_this.determinate) {
|
11418 | return;
|
11419 | }
|
11420 | try {
|
11421 | for (var entries_1 = __values(entries), entries_1_1 = entries_1.next(); !entries_1_1.done; entries_1_1 = entries_1.next()) {
|
11422 | var entry = entries_1_1.value;
|
11423 | if (entry.contentRect) {
|
11424 | _this.calculateAndSetDimensions(entry.contentRect.width);
|
11425 | }
|
11426 | }
|
11427 | } catch (e_1_1) {
|
11428 | e_1 = { error: e_1_1 };
|
11429 | } finally {
|
11430 | try {
|
11431 | if (entries_1_1 && !entries_1_1.done && (_a = entries_1.return)) _a.call(entries_1);
|
11432 | } finally {
|
11433 | if (e_1) throw e_1.error;
|
11434 | }
|
11435 | }
|
11436 | });
|
11437 | if (!this.determinate && this.observer) {
|
11438 | this.calculateAndSetDimensions(this.adapter.getWidth());
|
11439 | }
|
11440 | };
|
11441 | MDCLinearProgressFoundation.prototype.setDeterminate = function (isDeterminate) {
|
11442 | this.determinate = isDeterminate;
|
11443 | if (this.determinate) {
|
11444 | this.adapter.removeClass(constants_1.cssClasses.INDETERMINATE_CLASS);
|
11445 | this.adapter.setAttribute(constants_1.strings.ARIA_VALUENOW, this.progress.toString());
|
11446 | this.adapter.setAttribute(constants_1.strings.ARIA_VALUEMAX, '1');
|
11447 | this.adapter.setAttribute(constants_1.strings.ARIA_VALUEMIN, '0');
|
11448 | this.setPrimaryBarProgress(this.progress);
|
11449 | this.setBufferBarProgress(this.buffer);
|
11450 | return;
|
11451 | }
|
11452 | if (this.observer) {
|
11453 | this.calculateAndSetDimensions(this.adapter.getWidth());
|
11454 | }
|
11455 | this.adapter.addClass(constants_1.cssClasses.INDETERMINATE_CLASS);
|
11456 | this.adapter.removeAttribute(constants_1.strings.ARIA_VALUENOW);
|
11457 | this.adapter.removeAttribute(constants_1.strings.ARIA_VALUEMAX);
|
11458 | this.adapter.removeAttribute(constants_1.strings.ARIA_VALUEMIN);
|
11459 | this.setPrimaryBarProgress(1);
|
11460 | this.setBufferBarProgress(1);
|
11461 | };
|
11462 | MDCLinearProgressFoundation.prototype.isDeterminate = function () {
|
11463 | return this.determinate;
|
11464 | };
|
11465 | MDCLinearProgressFoundation.prototype.setProgress = function (value) {
|
11466 | this.progress = value;
|
11467 | if (this.determinate) {
|
11468 | this.setPrimaryBarProgress(value);
|
11469 | this.adapter.setAttribute(constants_1.strings.ARIA_VALUENOW, value.toString());
|
11470 | }
|
11471 | };
|
11472 | MDCLinearProgressFoundation.prototype.getProgress = function () {
|
11473 | return this.progress;
|
11474 | };
|
11475 | MDCLinearProgressFoundation.prototype.setBuffer = function (value) {
|
11476 | this.buffer = value;
|
11477 | if (this.determinate) {
|
11478 | this.setBufferBarProgress(value);
|
11479 | }
|
11480 | };
|
11481 | MDCLinearProgressFoundation.prototype.getBuffer = function () {
|
11482 | return this.buffer;
|
11483 | };
|
11484 | MDCLinearProgressFoundation.prototype.open = function () {
|
11485 | this.adapter.removeClass(constants_1.cssClasses.CLOSED_CLASS);
|
11486 | this.adapter.removeClass(constants_1.cssClasses.CLOSED_ANIMATION_OFF_CLASS);
|
11487 | this.adapter.removeAttribute(constants_1.strings.ARIA_HIDDEN);
|
11488 | };
|
11489 | MDCLinearProgressFoundation.prototype.close = function () {
|
11490 | this.adapter.addClass(constants_1.cssClasses.CLOSED_CLASS);
|
11491 | this.adapter.setAttribute(constants_1.strings.ARIA_HIDDEN, 'true');
|
11492 | };
|
11493 | MDCLinearProgressFoundation.prototype.isClosed = function () {
|
11494 | return this.adapter.hasClass(constants_1.cssClasses.CLOSED_CLASS);
|
11495 | };
|
11496 | |
11497 |
|
11498 |
|
11499 |
|
11500 |
|
11501 | MDCLinearProgressFoundation.prototype.handleTransitionEnd = function () {
|
11502 | if (this.adapter.hasClass(constants_1.cssClasses.CLOSED_CLASS)) {
|
11503 | this.adapter.addClass(constants_1.cssClasses.CLOSED_ANIMATION_OFF_CLASS);
|
11504 | }
|
11505 | };
|
11506 | MDCLinearProgressFoundation.prototype.destroy = function () {
|
11507 | _super.prototype.destroy.call(this);
|
11508 | if (this.observer) {
|
11509 | this.observer.disconnect();
|
11510 | }
|
11511 | };
|
11512 | MDCLinearProgressFoundation.prototype.restartAnimation = function () {
|
11513 | this.adapter.removeClass(constants_1.cssClasses.ANIMATION_READY_CLASS);
|
11514 | this.adapter.forceLayout();
|
11515 | this.adapter.addClass(constants_1.cssClasses.ANIMATION_READY_CLASS);
|
11516 | };
|
11517 | MDCLinearProgressFoundation.prototype.setPrimaryBarProgress = function (progressValue) {
|
11518 | var value = "scaleX(" + progressValue + ")";
|
11519 |
|
11520 |
|
11521 | var transformProp = typeof window !== 'undefined' ? util_1.getCorrectPropertyName(window, 'transform') : 'transform';
|
11522 | this.adapter.setPrimaryBarStyle(transformProp, value);
|
11523 | };
|
11524 | MDCLinearProgressFoundation.prototype.setBufferBarProgress = function (progressValue) {
|
11525 | var value = progressValue * 100 + "%";
|
11526 | this.adapter.setBufferBarStyle(constants_1.strings.FLEX_BASIS, value);
|
11527 | };
|
11528 | MDCLinearProgressFoundation.prototype.calculateAndSetDimensions = function (width) {
|
11529 | var primaryHalf = width * constants_1.animationDimensionPercentages.PRIMARY_HALF;
|
11530 | var primaryFull = width * constants_1.animationDimensionPercentages.PRIMARY_FULL;
|
11531 | var secondaryQuarter = width * constants_1.animationDimensionPercentages.SECONDARY_QUARTER;
|
11532 | var secondaryHalf = width * constants_1.animationDimensionPercentages.SECONDARY_HALF;
|
11533 | var secondaryFull = width * constants_1.animationDimensionPercentages.SECONDARY_FULL;
|
11534 | this.adapter.setStyle('--mdc-linear-progress-primary-half', primaryHalf + "px");
|
11535 | this.adapter.setStyle('--mdc-linear-progress-primary-half-neg', -primaryHalf + "px");
|
11536 | this.adapter.setStyle('--mdc-linear-progress-primary-full', primaryFull + "px");
|
11537 | this.adapter.setStyle('--mdc-linear-progress-primary-full-neg', -primaryFull + "px");
|
11538 | this.adapter.setStyle('--mdc-linear-progress-secondary-quarter', secondaryQuarter + "px");
|
11539 | this.adapter.setStyle('--mdc-linear-progress-secondary-quarter-neg', -secondaryQuarter + "px");
|
11540 | this.adapter.setStyle('--mdc-linear-progress-secondary-half', secondaryHalf + "px");
|
11541 | this.adapter.setStyle('--mdc-linear-progress-secondary-half-neg', -secondaryHalf + "px");
|
11542 | this.adapter.setStyle('--mdc-linear-progress-secondary-full', secondaryFull + "px");
|
11543 | this.adapter.setStyle('--mdc-linear-progress-secondary-full-neg', -secondaryFull + "px");
|
11544 |
|
11545 | this.restartAnimation();
|
11546 | };
|
11547 | return MDCLinearProgressFoundation;
|
11548 | }(foundation_1.MDCFoundation);
|
11549 | exports.MDCLinearProgressFoundation = MDCLinearProgressFoundation;
|
11550 |
|
11551 | exports.default = MDCLinearProgressFoundation;
|
11552 |
|
11553 | }),
|
11554 |
|
11555 | "./packages/mdc-linear-progress/index.ts":
|
11556 |
|
11557 |
|
11558 |
|
11559 |
|
11560 | (function(module, exports, __webpack_require__) {
|
11561 |
|
11562 | "use strict";
|
11563 |
|
11564 |
|
11565 |
|
11566 |
|
11567 |
|
11568 |
|
11569 |
|
11570 |
|
11571 |
|
11572 |
|
11573 |
|
11574 |
|
11575 |
|
11576 |
|
11577 |
|
11578 |
|
11579 |
|
11580 |
|
11581 |
|
11582 |
|
11583 |
|
11584 |
|
11585 |
|
11586 |
|
11587 | var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
|
11588 | if (k2 === undefined) k2 = k;
|
11589 | Object.defineProperty(o, k2, { enumerable: true, get: function get() {
|
11590 | return m[k];
|
11591 | } });
|
11592 | } : function (o, m, k, k2) {
|
11593 | if (k2 === undefined) k2 = k;
|
11594 | o[k2] = m[k];
|
11595 | });
|
11596 | var __exportStar = this && this.__exportStar || function (m, exports) {
|
11597 | for (var p in m) {
|
11598 | if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
11599 | }
|
11600 | };
|
11601 | Object.defineProperty(exports, "__esModule", { value: true });
|
11602 | __exportStar(__webpack_require__( "./packages/mdc-linear-progress/adapter.ts"), exports);
|
11603 | __exportStar(__webpack_require__( "./packages/mdc-linear-progress/component.ts"), exports);
|
11604 | __exportStar(__webpack_require__( "./packages/mdc-linear-progress/constants.ts"), exports);
|
11605 | __exportStar(__webpack_require__( "./packages/mdc-linear-progress/foundation.ts"), exports);
|
11606 | __exportStar(__webpack_require__( "./packages/mdc-linear-progress/types.ts"), exports);
|
11607 |
|
11608 | }),
|
11609 |
|
11610 | "./packages/mdc-linear-progress/types.ts":
|
11611 |
|
11612 |
|
11613 |
|
11614 |
|
11615 | (function(module, exports, __webpack_require__) {
|
11616 |
|
11617 | "use strict";
|
11618 |
|
11619 |
|
11620 |
|
11621 |
|
11622 |
|
11623 |
|
11624 |
|
11625 |
|
11626 |
|
11627 |
|
11628 |
|
11629 |
|
11630 |
|
11631 |
|
11632 |
|
11633 |
|
11634 |
|
11635 |
|
11636 |
|
11637 |
|
11638 |
|
11639 |
|
11640 |
|
11641 |
|
11642 | Object.defineProperty(exports, "__esModule", { value: true });
|
11643 |
|
11644 | }),
|
11645 |
|
11646 | "./packages/mdc-list/adapter.ts":
|
11647 |
|
11648 |
|
11649 |
|
11650 |
|
11651 | (function(module, exports, __webpack_require__) {
|
11652 |
|
11653 | "use strict";
|
11654 |
|
11655 |
|
11656 |
|
11657 |
|
11658 |
|
11659 |
|
11660 |
|
11661 |
|
11662 |
|
11663 |
|
11664 |
|
11665 |
|
11666 |
|
11667 |
|
11668 |
|
11669 |
|
11670 |
|
11671 |
|
11672 |
|
11673 |
|
11674 |
|
11675 |
|
11676 |
|
11677 |
|
11678 | Object.defineProperty(exports, "__esModule", { value: true });
|
11679 |
|
11680 | }),
|
11681 |
|
11682 | "./packages/mdc-list/component.ts":
|
11683 |
|
11684 |
|
11685 |
|
11686 |
|
11687 | (function(module, exports, __webpack_require__) {
|
11688 |
|
11689 | "use strict";
|
11690 |
|
11691 |
|
11692 |
|
11693 |
|
11694 |
|
11695 |
|
11696 |
|
11697 |
|
11698 |
|
11699 |
|
11700 |
|
11701 |
|
11702 |
|
11703 |
|
11704 |
|
11705 |
|
11706 |
|
11707 |
|
11708 |
|
11709 |
|
11710 |
|
11711 |
|
11712 |
|
11713 |
|
11714 | var __extends = this && this.__extends || function () {
|
11715 | var _extendStatics = function extendStatics(d, b) {
|
11716 | _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
|
11717 | d.__proto__ = b;
|
11718 | } || function (d, b) {
|
11719 | for (var p in b) {
|
11720 | if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
11721 | }
|
11722 | };
|
11723 | return _extendStatics(d, b);
|
11724 | };
|
11725 | return function (d, b) {
|
11726 | if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
11727 | _extendStatics(d, b);
|
11728 | function __() {
|
11729 | this.constructor = d;
|
11730 | }
|
11731 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
11732 | };
|
11733 | }();
|
11734 | Object.defineProperty(exports, "__esModule", { value: true });
|
11735 | exports.MDCList = void 0;
|
11736 | var component_1 = __webpack_require__( "./packages/mdc-base/component.ts");
|
11737 | var ponyfill_1 = __webpack_require__( "./packages/mdc-dom/ponyfill.ts");
|
11738 | var constants_1 = __webpack_require__( "./packages/mdc-list/constants.ts");
|
11739 | var foundation_1 = __webpack_require__( "./packages/mdc-list/foundation.ts");
|
11740 | var MDCList = function (_super) {
|
11741 | __extends(MDCList, _super);
|
11742 | function MDCList() {
|
11743 | return _super !== null && _super.apply(this, arguments) || this;
|
11744 | }
|
11745 | Object.defineProperty(MDCList.prototype, "vertical", {
|
11746 | set: function set(value) {
|
11747 | this.foundation.setVerticalOrientation(value);
|
11748 | },
|
11749 | enumerable: false,
|
11750 | configurable: true
|
11751 | });
|
11752 | Object.defineProperty(MDCList.prototype, "listElements", {
|
11753 | get: function get() {
|
11754 | return Array.from(this.root.querySelectorAll("." + this.classNameMap[constants_1.cssClasses.LIST_ITEM_CLASS]));
|
11755 | },
|
11756 | enumerable: false,
|
11757 | configurable: true
|
11758 | });
|
11759 | Object.defineProperty(MDCList.prototype, "wrapFocus", {
|
11760 | set: function set(value) {
|
11761 | this.foundation.setWrapFocus(value);
|
11762 | },
|
11763 | enumerable: false,
|
11764 | configurable: true
|
11765 | });
|
11766 | Object.defineProperty(MDCList.prototype, "typeaheadInProgress", {
|
11767 | |
11768 |
|
11769 |
|
11770 | get: function get() {
|
11771 | return this.foundation.isTypeaheadInProgress();
|
11772 | },
|
11773 | enumerable: false,
|
11774 | configurable: true
|
11775 | });
|
11776 | Object.defineProperty(MDCList.prototype, "hasTypeahead", {
|
11777 | |
11778 |
|
11779 |
|
11780 |
|
11781 | set: function set(hasTypeahead) {
|
11782 | this.foundation.setHasTypeahead(hasTypeahead);
|
11783 | },
|
11784 | enumerable: false,
|
11785 | configurable: true
|
11786 | });
|
11787 | Object.defineProperty(MDCList.prototype, "singleSelection", {
|
11788 | set: function set(isSingleSelectionList) {
|
11789 | this.foundation.setSingleSelection(isSingleSelectionList);
|
11790 | },
|
11791 | enumerable: false,
|
11792 | configurable: true
|
11793 | });
|
11794 | Object.defineProperty(MDCList.prototype, "selectedIndex", {
|
11795 | get: function get() {
|
11796 | return this.foundation.getSelectedIndex();
|
11797 | },
|
11798 | set: function set(index) {
|
11799 | this.foundation.setSelectedIndex(index);
|
11800 | },
|
11801 | enumerable: false,
|
11802 | configurable: true
|
11803 | });
|
11804 | MDCList.attachTo = function (root) {
|
11805 | return new MDCList(root);
|
11806 | };
|
11807 | MDCList.prototype.initialSyncWithDOM = function () {
|
11808 | this.isEvolutionEnabled = constants_1.evolutionAttribute in this.root.dataset;
|
11809 | if (this.isEvolutionEnabled) {
|
11810 | this.classNameMap = constants_1.evolutionClassNameMap;
|
11811 | } else if (ponyfill_1.matches(this.root, constants_1.strings.DEPRECATED_SELECTOR)) {
|
11812 | this.classNameMap = constants_1.deprecatedClassNameMap;
|
11813 | } else {
|
11814 | this.classNameMap = Object.values(constants_1.cssClasses).reduce(function (obj, className) {
|
11815 | obj[className] = className;
|
11816 | return obj;
|
11817 | }, {});
|
11818 | }
|
11819 | this.handleClick = this.handleClickEvent.bind(this);
|
11820 | this.handleKeydown = this.handleKeydownEvent.bind(this);
|
11821 | this.focusInEventListener = this.handleFocusInEvent.bind(this);
|
11822 | this.focusOutEventListener = this.handleFocusOutEvent.bind(this);
|
11823 | this.listen('keydown', this.handleKeydown);
|
11824 | this.listen('click', this.handleClick);
|
11825 | this.listen('focusin', this.focusInEventListener);
|
11826 | this.listen('focusout', this.focusOutEventListener);
|
11827 | this.layout();
|
11828 | this.initializeListType();
|
11829 | this.ensureFocusable();
|
11830 | };
|
11831 | MDCList.prototype.destroy = function () {
|
11832 | this.unlisten('keydown', this.handleKeydown);
|
11833 | this.unlisten('click', this.handleClick);
|
11834 | this.unlisten('focusin', this.focusInEventListener);
|
11835 | this.unlisten('focusout', this.focusOutEventListener);
|
11836 | };
|
11837 | MDCList.prototype.layout = function () {
|
11838 | var direction = this.root.getAttribute(constants_1.strings.ARIA_ORIENTATION);
|
11839 | this.vertical = direction !== constants_1.strings.ARIA_ORIENTATION_HORIZONTAL;
|
11840 | var itemSelector = "." + this.classNameMap[constants_1.cssClasses.LIST_ITEM_CLASS] + ":not([tabindex])";
|
11841 | var childSelector = constants_1.strings.FOCUSABLE_CHILD_ELEMENTS;
|
11842 |
|
11843 | var itemEls = this.root.querySelectorAll(itemSelector);
|
11844 | if (itemEls.length) {
|
11845 | Array.prototype.forEach.call(itemEls, function (el) {
|
11846 | el.setAttribute('tabindex', '-1');
|
11847 | });
|
11848 | }
|
11849 |
|
11850 | var focusableChildEls = this.root.querySelectorAll(childSelector);
|
11851 | if (focusableChildEls.length) {
|
11852 | Array.prototype.forEach.call(focusableChildEls, function (el) {
|
11853 | el.setAttribute('tabindex', '-1');
|
11854 | });
|
11855 | }
|
11856 | if (this.isEvolutionEnabled) {
|
11857 | this.foundation.setUseSelectedAttribute(true);
|
11858 | }
|
11859 | this.foundation.layout();
|
11860 | };
|
11861 | |
11862 |
|
11863 |
|
11864 |
|
11865 |
|
11866 | MDCList.prototype.getPrimaryText = function (item) {
|
11867 | var _a;
|
11868 | var primaryText = item.querySelector("." + this.classNameMap[constants_1.cssClasses.LIST_ITEM_PRIMARY_TEXT_CLASS]);
|
11869 | if (this.isEvolutionEnabled || primaryText) {
|
11870 | return (_a = primaryText === null || primaryText === void 0 ? void 0 : primaryText.textContent) !== null && _a !== void 0 ? _a : '';
|
11871 | }
|
11872 | var singleLineText = item.querySelector("." + this.classNameMap[constants_1.cssClasses.LIST_ITEM_TEXT_CLASS]);
|
11873 | return singleLineText && singleLineText.textContent || '';
|
11874 | };
|
11875 | |
11876 |
|
11877 |
|
11878 | MDCList.prototype.initializeListType = function () {
|
11879 | var _this = this;
|
11880 | this.isInteractive = ponyfill_1.matches(this.root, constants_1.strings.ARIA_INTERACTIVE_ROLES_SELECTOR);
|
11881 | if (this.isEvolutionEnabled && this.isInteractive) {
|
11882 | var selection = Array.from(this.root.querySelectorAll(constants_1.strings.SELECTED_ITEM_SELECTOR), function (listItem) {
|
11883 | return _this.listElements.indexOf(listItem);
|
11884 | });
|
11885 | if (ponyfill_1.matches(this.root, constants_1.strings.ARIA_MULTI_SELECTABLE_SELECTOR)) {
|
11886 | this.selectedIndex = selection;
|
11887 | } else if (selection.length > 0) {
|
11888 | this.selectedIndex = selection[0];
|
11889 | }
|
11890 | return;
|
11891 | }
|
11892 | var checkboxListItems = this.root.querySelectorAll(constants_1.strings.ARIA_ROLE_CHECKBOX_SELECTOR);
|
11893 | var radioSelectedListItem = this.root.querySelector(constants_1.strings.ARIA_CHECKED_RADIO_SELECTOR);
|
11894 | if (checkboxListItems.length) {
|
11895 | var preselectedItems = this.root.querySelectorAll(constants_1.strings.ARIA_CHECKED_CHECKBOX_SELECTOR);
|
11896 | this.selectedIndex = Array.from(preselectedItems, function (listItem) {
|
11897 | return _this.listElements.indexOf(listItem);
|
11898 | });
|
11899 | } else if (radioSelectedListItem) {
|
11900 | this.selectedIndex = this.listElements.indexOf(radioSelectedListItem);
|
11901 | }
|
11902 | };
|
11903 | |
11904 |
|
11905 |
|
11906 |
|
11907 |
|
11908 | MDCList.prototype.setEnabled = function (itemIndex, isEnabled) {
|
11909 | this.foundation.setEnabled(itemIndex, isEnabled);
|
11910 | };
|
11911 | |
11912 |
|
11913 |
|
11914 |
|
11915 |
|
11916 |
|
11917 |
|
11918 |
|
11919 |
|
11920 |
|
11921 | MDCList.prototype.typeaheadMatchItem = function (nextChar, startingIndex) {
|
11922 | return this.foundation.typeaheadMatchItem(nextChar, startingIndex, true);
|
11923 | };
|
11924 | MDCList.prototype.getDefaultFoundation = function () {
|
11925 | var _this = this;
|
11926 |
|
11927 |
|
11928 |
|
11929 | var adapter = {
|
11930 | addClassForElementIndex: function addClassForElementIndex(index, className) {
|
11931 | var element = _this.listElements[index];
|
11932 | if (element) {
|
11933 | element.classList.add(_this.classNameMap[className]);
|
11934 | }
|
11935 | },
|
11936 | focusItemAtIndex: function focusItemAtIndex(index) {
|
11937 | var element = _this.listElements[index];
|
11938 | if (element) {
|
11939 | element.focus();
|
11940 | }
|
11941 | },
|
11942 | getAttributeForElementIndex: function getAttributeForElementIndex(index, attr) {
|
11943 | return _this.listElements[index].getAttribute(attr);
|
11944 | },
|
11945 | getFocusedElementIndex: function getFocusedElementIndex() {
|
11946 | return _this.listElements.indexOf(document.activeElement);
|
11947 | },
|
11948 | getListItemCount: function getListItemCount() {
|
11949 | return _this.listElements.length;
|
11950 | },
|
11951 | getPrimaryTextAtIndex: function getPrimaryTextAtIndex(index) {
|
11952 | return _this.getPrimaryText(_this.listElements[index]);
|
11953 | },
|
11954 | hasCheckboxAtIndex: function hasCheckboxAtIndex(index) {
|
11955 | var listItem = _this.listElements[index];
|
11956 | return !!listItem.querySelector(constants_1.strings.CHECKBOX_SELECTOR);
|
11957 | },
|
11958 | hasRadioAtIndex: function hasRadioAtIndex(index) {
|
11959 | var listItem = _this.listElements[index];
|
11960 | return !!listItem.querySelector(constants_1.strings.RADIO_SELECTOR);
|
11961 | },
|
11962 | isCheckboxCheckedAtIndex: function isCheckboxCheckedAtIndex(index) {
|
11963 | var listItem = _this.listElements[index];
|
11964 | var toggleEl = listItem.querySelector(constants_1.strings.CHECKBOX_SELECTOR);
|
11965 | return toggleEl.checked;
|
11966 | },
|
11967 | isFocusInsideList: function isFocusInsideList() {
|
11968 | return _this.root !== document.activeElement && _this.root.contains(document.activeElement);
|
11969 | },
|
11970 | isRootFocused: function isRootFocused() {
|
11971 | return document.activeElement === _this.root;
|
11972 | },
|
11973 | listItemAtIndexHasClass: function listItemAtIndexHasClass(index, className) {
|
11974 | return _this.listElements[index].classList.contains(_this.classNameMap[className]);
|
11975 | },
|
11976 | notifyAction: function notifyAction(index) {
|
11977 | _this.emit(constants_1.strings.ACTION_EVENT, { index: index }, true);
|
11978 | },
|
11979 | removeClassForElementIndex: function removeClassForElementIndex(index, className) {
|
11980 | var element = _this.listElements[index];
|
11981 | if (element) {
|
11982 | element.classList.remove(_this.classNameMap[className]);
|
11983 | }
|
11984 | },
|
11985 | setAttributeForElementIndex: function setAttributeForElementIndex(index, attr, value) {
|
11986 | var element = _this.listElements[index];
|
11987 | if (element) {
|
11988 | element.setAttribute(attr, value);
|
11989 | }
|
11990 | },
|
11991 | setCheckedCheckboxOrRadioAtIndex: function setCheckedCheckboxOrRadioAtIndex(index, isChecked) {
|
11992 | var listItem = _this.listElements[index];
|
11993 | var toggleEl = listItem.querySelector(constants_1.strings.CHECKBOX_RADIO_SELECTOR);
|
11994 | toggleEl.checked = isChecked;
|
11995 | var event = document.createEvent('Event');
|
11996 | event.initEvent('change', true, true);
|
11997 | toggleEl.dispatchEvent(event);
|
11998 | },
|
11999 | setTabIndexForListItemChildren: function setTabIndexForListItemChildren(listItemIndex, tabIndexValue) {
|
12000 | var element = _this.listElements[listItemIndex];
|
12001 | var selector = constants_1.strings.CHILD_ELEMENTS_TO_TOGGLE_TABINDEX;
|
12002 | Array.prototype.forEach.call(element.querySelectorAll(selector), function (el) {
|
12003 | el.setAttribute('tabindex', tabIndexValue);
|
12004 | });
|
12005 | }
|
12006 | };
|
12007 | return new foundation_1.MDCListFoundation(adapter);
|
12008 | };
|
12009 | |
12010 |
|
12011 |
|
12012 |
|
12013 | MDCList.prototype.ensureFocusable = function () {
|
12014 | if (this.isEvolutionEnabled && this.isInteractive) {
|
12015 | if (!this.root.querySelector("." + this.classNameMap[constants_1.cssClasses.LIST_ITEM_CLASS] + "[tabindex=\"0\"]")) {
|
12016 | var index = this.initialFocusIndex();
|
12017 | if (index !== -1) {
|
12018 | this.listElements[index].tabIndex = 0;
|
12019 | }
|
12020 | }
|
12021 | }
|
12022 | };
|
12023 | MDCList.prototype.initialFocusIndex = function () {
|
12024 | if (this.selectedIndex instanceof Array && this.selectedIndex.length > 0) {
|
12025 | return this.selectedIndex[0];
|
12026 | }
|
12027 | if (typeof this.selectedIndex === 'number' && this.selectedIndex !== constants_1.numbers.UNSET_INDEX) {
|
12028 | return this.selectedIndex;
|
12029 | }
|
12030 | var el = this.root.querySelector("." + this.classNameMap[constants_1.cssClasses.LIST_ITEM_CLASS] + ":not(." + this.classNameMap[constants_1.cssClasses.LIST_ITEM_DISABLED_CLASS] + ")");
|
12031 | if (el === null) {
|
12032 | return -1;
|
12033 | }
|
12034 | return this.getListItemIndex(el);
|
12035 | };
|
12036 | |
12037 |
|
12038 |
|
12039 |
|
12040 | MDCList.prototype.getListItemIndex = function (el) {
|
12041 | var nearestParent = ponyfill_1.closest(el, "." + this.classNameMap[constants_1.cssClasses.LIST_ITEM_CLASS] + ", ." + this.classNameMap[constants_1.cssClasses.ROOT]);
|
12042 |
|
12043 | if (nearestParent && ponyfill_1.matches(nearestParent, "." + this.classNameMap[constants_1.cssClasses.LIST_ITEM_CLASS])) {
|
12044 | return this.listElements.indexOf(nearestParent);
|
12045 | }
|
12046 | return -1;
|
12047 | };
|
12048 | |
12049 |
|
12050 |
|
12051 |
|
12052 | MDCList.prototype.handleFocusInEvent = function (evt) {
|
12053 | var index = this.getListItemIndex(evt.target);
|
12054 | this.foundation.handleFocusIn(index);
|
12055 | };
|
12056 | |
12057 |
|
12058 |
|
12059 |
|
12060 | MDCList.prototype.handleFocusOutEvent = function (evt) {
|
12061 | var index = this.getListItemIndex(evt.target);
|
12062 | this.foundation.handleFocusOut(index);
|
12063 | };
|
12064 | |
12065 |
|
12066 |
|
12067 |
|
12068 | MDCList.prototype.handleKeydownEvent = function (evt) {
|
12069 | var index = this.getListItemIndex(evt.target);
|
12070 | var target = evt.target;
|
12071 | this.foundation.handleKeydown(evt, target.classList.contains(this.classNameMap[constants_1.cssClasses.LIST_ITEM_CLASS]), index);
|
12072 | };
|
12073 | |
12074 |
|
12075 |
|
12076 |
|
12077 | MDCList.prototype.handleClickEvent = function (evt) {
|
12078 | var index = this.getListItemIndex(evt.target);
|
12079 | var target = evt.target;
|
12080 |
|
12081 |
|
12082 | var toggleCheckbox = !ponyfill_1.matches(target, constants_1.strings.CHECKBOX_RADIO_SELECTOR);
|
12083 | this.foundation.handleClick(index, toggleCheckbox);
|
12084 | };
|
12085 | return MDCList;
|
12086 | }(component_1.MDCComponent);
|
12087 | exports.MDCList = MDCList;
|
12088 |
|
12089 | }),
|
12090 |
|
12091 | "./packages/mdc-list/constants.ts":
|
12092 |
|
12093 |
|
12094 |
|
12095 |
|
12096 | (function(module, exports, __webpack_require__) {
|
12097 |
|
12098 | "use strict";
|
12099 |
|
12100 |
|
12101 |
|
12102 |
|
12103 |
|
12104 |
|
12105 |
|
12106 |
|
12107 |
|
12108 |
|
12109 |
|
12110 |
|
12111 |
|
12112 |
|
12113 |
|
12114 |
|
12115 |
|
12116 |
|
12117 |
|
12118 |
|
12119 |
|
12120 |
|
12121 |
|
12122 |
|
12123 | var _a, _b;
|
12124 | Object.defineProperty(exports, "__esModule", { value: true });
|
12125 | exports.evolutionClassNameMap = exports.evolutionAttribute = exports.deprecatedClassNameMap = exports.numbers = exports.cssClasses = exports.strings = void 0;
|
12126 | var cssClasses = {
|
12127 | LIST_ITEM_ACTIVATED_CLASS: 'mdc-list-item--activated',
|
12128 | LIST_ITEM_CLASS: 'mdc-list-item',
|
12129 | LIST_ITEM_DISABLED_CLASS: 'mdc-list-item--disabled',
|
12130 | LIST_ITEM_SELECTED_CLASS: 'mdc-list-item--selected',
|
12131 | LIST_ITEM_TEXT_CLASS: 'mdc-list-item__text',
|
12132 | LIST_ITEM_PRIMARY_TEXT_CLASS: 'mdc-list-item__primary-text',
|
12133 | ROOT: 'mdc-list'
|
12134 | };
|
12135 | exports.cssClasses = cssClasses;
|
12136 | var evolutionClassNameMap = (_a = {}, _a["" + cssClasses.LIST_ITEM_ACTIVATED_CLASS] = 'mdc-list-item--activated', _a["" + cssClasses.LIST_ITEM_CLASS] = 'mdc-list-item', _a["" + cssClasses.LIST_ITEM_DISABLED_CLASS] = 'mdc-list-item--disabled', _a["" + cssClasses.LIST_ITEM_SELECTED_CLASS] = 'mdc-list-item--selected', _a["" + cssClasses.LIST_ITEM_PRIMARY_TEXT_CLASS] = 'mdc-list-item__primary-text', _a["" + cssClasses.ROOT] = 'mdc-list', _a);
|
12137 | exports.evolutionClassNameMap = evolutionClassNameMap;
|
12138 | var deprecatedClassNameMap = (_b = {}, _b["" + cssClasses.LIST_ITEM_ACTIVATED_CLASS] = 'mdc-deprecated-list-item--activated', _b["" + cssClasses.LIST_ITEM_CLASS] = 'mdc-deprecated-list-item', _b["" + cssClasses.LIST_ITEM_DISABLED_CLASS] = 'mdc-deprecated-list-item--disabled', _b["" + cssClasses.LIST_ITEM_SELECTED_CLASS] = 'mdc-deprecated-list-item--selected', _b["" + cssClasses.LIST_ITEM_TEXT_CLASS] = 'mdc-deprecated-list-item__text', _b["" + cssClasses.LIST_ITEM_PRIMARY_TEXT_CLASS] = 'mdc-deprecated-list-item__primary-text', _b["" + cssClasses.ROOT] = 'mdc-deprecated-list', _b);
|
12139 | exports.deprecatedClassNameMap = deprecatedClassNameMap;
|
12140 | var strings = {
|
12141 | ACTION_EVENT: 'MDCList:action',
|
12142 | ARIA_CHECKED: 'aria-checked',
|
12143 | ARIA_CHECKED_CHECKBOX_SELECTOR: '[role="checkbox"][aria-checked="true"]',
|
12144 | ARIA_CHECKED_RADIO_SELECTOR: '[role="radio"][aria-checked="true"]',
|
12145 | ARIA_CURRENT: 'aria-current',
|
12146 | ARIA_DISABLED: 'aria-disabled',
|
12147 | ARIA_ORIENTATION: 'aria-orientation',
|
12148 | ARIA_ORIENTATION_HORIZONTAL: 'horizontal',
|
12149 | ARIA_ROLE_CHECKBOX_SELECTOR: '[role="checkbox"]',
|
12150 | ARIA_SELECTED: 'aria-selected',
|
12151 | ARIA_INTERACTIVE_ROLES_SELECTOR: '[role="listbox"], [role="menu"]',
|
12152 | ARIA_MULTI_SELECTABLE_SELECTOR: '[aria-multiselectable="true"]',
|
12153 | CHECKBOX_RADIO_SELECTOR: 'input[type="checkbox"], input[type="radio"]',
|
12154 | CHECKBOX_SELECTOR: 'input[type="checkbox"]',
|
12155 | CHILD_ELEMENTS_TO_TOGGLE_TABINDEX: "\n ." + cssClasses.LIST_ITEM_CLASS + " button:not(:disabled),\n ." + cssClasses.LIST_ITEM_CLASS + " a,\n ." + deprecatedClassNameMap[cssClasses.LIST_ITEM_CLASS] + " button:not(:disabled),\n ." + deprecatedClassNameMap[cssClasses.LIST_ITEM_CLASS] + " a\n ",
|
12156 | DEPRECATED_SELECTOR: '.mdc-deprecated-list',
|
12157 | FOCUSABLE_CHILD_ELEMENTS: "\n ." + cssClasses.LIST_ITEM_CLASS + " button:not(:disabled),\n ." + cssClasses.LIST_ITEM_CLASS + " a,\n ." + cssClasses.LIST_ITEM_CLASS + " input[type=\"radio\"]:not(:disabled),\n ." + cssClasses.LIST_ITEM_CLASS + " input[type=\"checkbox\"]:not(:disabled),\n ." + deprecatedClassNameMap[cssClasses.LIST_ITEM_CLASS] + " button:not(:disabled),\n ." + deprecatedClassNameMap[cssClasses.LIST_ITEM_CLASS] + " a,\n ." + deprecatedClassNameMap[cssClasses.LIST_ITEM_CLASS] + " input[type=\"radio\"]:not(:disabled),\n ." + deprecatedClassNameMap[cssClasses.LIST_ITEM_CLASS] + " input[type=\"checkbox\"]:not(:disabled)\n ",
|
12158 | RADIO_SELECTOR: 'input[type="radio"]',
|
12159 | SELECTED_ITEM_SELECTOR: '[aria-selected="true"], [aria-current="true"]'
|
12160 | };
|
12161 | exports.strings = strings;
|
12162 | var numbers = {
|
12163 | UNSET_INDEX: -1,
|
12164 | TYPEAHEAD_BUFFER_CLEAR_TIMEOUT_MS: 300
|
12165 | };
|
12166 | exports.numbers = numbers;
|
12167 | var evolutionAttribute = 'evolution';
|
12168 | exports.evolutionAttribute = evolutionAttribute;
|
12169 |
|
12170 | }),
|
12171 |
|
12172 | "./packages/mdc-list/events.ts":
|
12173 |
|
12174 |
|
12175 |
|
12176 |
|
12177 | (function(module, exports, __webpack_require__) {
|
12178 |
|
12179 | "use strict";
|
12180 |
|
12181 |
|
12182 |
|
12183 |
|
12184 |
|
12185 |
|
12186 |
|
12187 |
|
12188 |
|
12189 |
|
12190 |
|
12191 |
|
12192 |
|
12193 |
|
12194 |
|
12195 |
|
12196 |
|
12197 |
|
12198 |
|
12199 |
|
12200 |
|
12201 |
|
12202 |
|
12203 |
|
12204 | Object.defineProperty(exports, "__esModule", { value: true });
|
12205 | exports.preventDefaultEvent = void 0;
|
12206 | var ELEMENTS_KEY_ALLOWED_IN = ['input', 'button', 'textarea', 'select'];
|
12207 |
|
12208 |
|
12209 |
|
12210 |
|
12211 |
|
12212 |
|
12213 | var preventDefaultEvent = function preventDefaultEvent(evt) {
|
12214 | var target = evt.target;
|
12215 | if (!target) {
|
12216 | return;
|
12217 | }
|
12218 | var tagName = ("" + target.tagName).toLowerCase();
|
12219 | if (ELEMENTS_KEY_ALLOWED_IN.indexOf(tagName) === -1) {
|
12220 | evt.preventDefault();
|
12221 | }
|
12222 | };
|
12223 | exports.preventDefaultEvent = preventDefaultEvent;
|
12224 |
|
12225 | }),
|
12226 |
|
12227 | "./packages/mdc-list/foundation.ts":
|
12228 |
|
12229 |
|
12230 |
|
12231 |
|
12232 | (function(module, exports, __webpack_require__) {
|
12233 |
|
12234 | "use strict";
|
12235 |
|
12236 |
|
12237 |
|
12238 |
|
12239 |
|
12240 |
|
12241 |
|
12242 |
|
12243 |
|
12244 |
|
12245 |
|
12246 |
|
12247 |
|
12248 |
|
12249 |
|
12250 |
|
12251 |
|
12252 |
|
12253 |
|
12254 |
|
12255 |
|
12256 |
|
12257 |
|
12258 |
|
12259 | var __extends = this && this.__extends || function () {
|
12260 | var _extendStatics = function extendStatics(d, b) {
|
12261 | _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
|
12262 | d.__proto__ = b;
|
12263 | } || function (d, b) {
|
12264 | for (var p in b) {
|
12265 | if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
12266 | }
|
12267 | };
|
12268 | return _extendStatics(d, b);
|
12269 | };
|
12270 | return function (d, b) {
|
12271 | if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
12272 | _extendStatics(d, b);
|
12273 | function __() {
|
12274 | this.constructor = d;
|
12275 | }
|
12276 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
12277 | };
|
12278 | }();
|
12279 | var __assign = this && this.__assign || function () {
|
12280 | __assign = Object.assign || function (t) {
|
12281 | for (var s, i = 1, n = arguments.length; i < n; i++) {
|
12282 | s = arguments[i];
|
12283 | for (var p in s) {
|
12284 | if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
12285 | }
|
12286 | }
|
12287 | return t;
|
12288 | };
|
12289 | return __assign.apply(this, arguments);
|
12290 | };
|
12291 | var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
|
12292 | if (k2 === undefined) k2 = k;
|
12293 | Object.defineProperty(o, k2, { enumerable: true, get: function get() {
|
12294 | return m[k];
|
12295 | } });
|
12296 | } : function (o, m, k, k2) {
|
12297 | if (k2 === undefined) k2 = k;
|
12298 | o[k2] = m[k];
|
12299 | });
|
12300 | var __setModuleDefault = this && this.__setModuleDefault || (Object.create ? function (o, v) {
|
12301 | Object.defineProperty(o, "default", { enumerable: true, value: v });
|
12302 | } : function (o, v) {
|
12303 | o["default"] = v;
|
12304 | });
|
12305 | var __importStar = this && this.__importStar || function (mod) {
|
12306 | if (mod && mod.__esModule) return mod;
|
12307 | var result = {};
|
12308 | if (mod != null) for (var k in mod) {
|
12309 | if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
12310 | }__setModuleDefault(result, mod);
|
12311 | return result;
|
12312 | };
|
12313 | Object.defineProperty(exports, "__esModule", { value: true });
|
12314 | exports.MDCListFoundation = void 0;
|
12315 | var foundation_1 = __webpack_require__( "./packages/mdc-base/foundation.ts");
|
12316 | var keyboard_1 = __webpack_require__( "./packages/mdc-dom/keyboard.ts");
|
12317 | var constants_1 = __webpack_require__( "./packages/mdc-list/constants.ts");
|
12318 | var events_1 = __webpack_require__( "./packages/mdc-list/events.ts");
|
12319 | var typeahead = __importStar(__webpack_require__( "./packages/mdc-list/typeahead.ts"));
|
12320 | function isNumberArray(selectedIndex) {
|
12321 | return selectedIndex instanceof Array;
|
12322 | }
|
12323 | var MDCListFoundation = function (_super) {
|
12324 | __extends(MDCListFoundation, _super);
|
12325 | function MDCListFoundation(adapter) {
|
12326 | var _this = _super.call(this, __assign(__assign({}, MDCListFoundation.defaultAdapter), adapter)) || this;
|
12327 | _this.wrapFocus = false;
|
12328 | _this.isVertical = true;
|
12329 | _this.isSingleSelectionList = false;
|
12330 | _this.selectedIndex = constants_1.numbers.UNSET_INDEX;
|
12331 | _this.focusedItemIndex = constants_1.numbers.UNSET_INDEX;
|
12332 | _this.useActivatedClass = false;
|
12333 | _this.useSelectedAttr = false;
|
12334 | _this.ariaCurrentAttrValue = null;
|
12335 | _this.isCheckboxList = false;
|
12336 | _this.isRadioList = false;
|
12337 | _this.hasTypeahead = false;
|
12338 |
|
12339 | _this.typeaheadState = typeahead.initState();
|
12340 | _this.sortedIndexByFirstChar = new Map();
|
12341 | return _this;
|
12342 | }
|
12343 | Object.defineProperty(MDCListFoundation, "strings", {
|
12344 | get: function get() {
|
12345 | return constants_1.strings;
|
12346 | },
|
12347 | enumerable: false,
|
12348 | configurable: true
|
12349 | });
|
12350 | Object.defineProperty(MDCListFoundation, "cssClasses", {
|
12351 | get: function get() {
|
12352 | return constants_1.cssClasses;
|
12353 | },
|
12354 | enumerable: false,
|
12355 | configurable: true
|
12356 | });
|
12357 | Object.defineProperty(MDCListFoundation, "numbers", {
|
12358 | get: function get() {
|
12359 | return constants_1.numbers;
|
12360 | },
|
12361 | enumerable: false,
|
12362 | configurable: true
|
12363 | });
|
12364 | Object.defineProperty(MDCListFoundation, "defaultAdapter", {
|
12365 | get: function get() {
|
12366 | return {
|
12367 | addClassForElementIndex: function addClassForElementIndex() {
|
12368 | return undefined;
|
12369 | },
|
12370 | focusItemAtIndex: function focusItemAtIndex() {
|
12371 | return undefined;
|
12372 | },
|
12373 | getAttributeForElementIndex: function getAttributeForElementIndex() {
|
12374 | return null;
|
12375 | },
|
12376 | getFocusedElementIndex: function getFocusedElementIndex() {
|
12377 | return 0;
|
12378 | },
|
12379 | getListItemCount: function getListItemCount() {
|
12380 | return 0;
|
12381 | },
|
12382 | hasCheckboxAtIndex: function hasCheckboxAtIndex() {
|
12383 | return false;
|
12384 | },
|
12385 | hasRadioAtIndex: function hasRadioAtIndex() {
|
12386 | return false;
|
12387 | },
|
12388 | isCheckboxCheckedAtIndex: function isCheckboxCheckedAtIndex() {
|
12389 | return false;
|
12390 | },
|
12391 | isFocusInsideList: function isFocusInsideList() {
|
12392 | return false;
|
12393 | },
|
12394 | isRootFocused: function isRootFocused() {
|
12395 | return false;
|
12396 | },
|
12397 | listItemAtIndexHasClass: function listItemAtIndexHasClass() {
|
12398 | return false;
|
12399 | },
|
12400 | notifyAction: function notifyAction() {
|
12401 | return undefined;
|
12402 | },
|
12403 | removeClassForElementIndex: function removeClassForElementIndex() {
|
12404 | return undefined;
|
12405 | },
|
12406 | setAttributeForElementIndex: function setAttributeForElementIndex() {
|
12407 | return undefined;
|
12408 | },
|
12409 | setCheckedCheckboxOrRadioAtIndex: function setCheckedCheckboxOrRadioAtIndex() {
|
12410 | return undefined;
|
12411 | },
|
12412 | setTabIndexForListItemChildren: function setTabIndexForListItemChildren() {
|
12413 | return undefined;
|
12414 | },
|
12415 | getPrimaryTextAtIndex: function getPrimaryTextAtIndex() {
|
12416 | return '';
|
12417 | }
|
12418 | };
|
12419 | },
|
12420 | enumerable: false,
|
12421 | configurable: true
|
12422 | });
|
12423 | MDCListFoundation.prototype.layout = function () {
|
12424 | if (this.adapter.getListItemCount() === 0) {
|
12425 | return;
|
12426 | }
|
12427 |
|
12428 | if (this.adapter.hasCheckboxAtIndex(0)) {
|
12429 | this.isCheckboxList = true;
|
12430 | } else if (this.adapter.hasRadioAtIndex(0)) {
|
12431 | this.isRadioList = true;
|
12432 | } else {
|
12433 | this.maybeInitializeSingleSelection();
|
12434 | }
|
12435 | if (this.hasTypeahead) {
|
12436 | this.sortedIndexByFirstChar = this.typeaheadInitSortedIndex();
|
12437 | }
|
12438 | };
|
12439 |
|
12440 | MDCListFoundation.prototype.getFocusedItemIndex = function () {
|
12441 | return this.focusedItemIndex;
|
12442 | };
|
12443 |
|
12444 | MDCListFoundation.prototype.setWrapFocus = function (value) {
|
12445 | this.wrapFocus = value;
|
12446 | };
|
12447 | |
12448 |
|
12449 |
|
12450 |
|
12451 | MDCListFoundation.prototype.setVerticalOrientation = function (value) {
|
12452 | this.isVertical = value;
|
12453 | };
|
12454 |
|
12455 | MDCListFoundation.prototype.setSingleSelection = function (value) {
|
12456 | this.isSingleSelectionList = value;
|
12457 | if (value) {
|
12458 | this.maybeInitializeSingleSelection();
|
12459 | this.selectedIndex = this.getSelectedIndexFromDOM();
|
12460 | }
|
12461 | };
|
12462 | |
12463 |
|
12464 |
|
12465 |
|
12466 | MDCListFoundation.prototype.maybeInitializeSingleSelection = function () {
|
12467 | var selectedItemIndex = this.getSelectedIndexFromDOM();
|
12468 | if (selectedItemIndex === constants_1.numbers.UNSET_INDEX) return;
|
12469 | var hasActivatedClass = this.adapter.listItemAtIndexHasClass(selectedItemIndex, constants_1.cssClasses.LIST_ITEM_ACTIVATED_CLASS);
|
12470 | if (hasActivatedClass) {
|
12471 | this.setUseActivatedClass(true);
|
12472 | }
|
12473 | this.isSingleSelectionList = true;
|
12474 | this.selectedIndex = selectedItemIndex;
|
12475 | };
|
12476 |
|
12477 | MDCListFoundation.prototype.getSelectedIndexFromDOM = function () {
|
12478 | var selectedIndex = constants_1.numbers.UNSET_INDEX;
|
12479 | var listItemsCount = this.adapter.getListItemCount();
|
12480 | for (var i = 0; i < listItemsCount; i++) {
|
12481 | var hasSelectedClass = this.adapter.listItemAtIndexHasClass(i, constants_1.cssClasses.LIST_ITEM_SELECTED_CLASS);
|
12482 | var hasActivatedClass = this.adapter.listItemAtIndexHasClass(i, constants_1.cssClasses.LIST_ITEM_ACTIVATED_CLASS);
|
12483 | if (!(hasSelectedClass || hasActivatedClass)) {
|
12484 | continue;
|
12485 | }
|
12486 | selectedIndex = i;
|
12487 | break;
|
12488 | }
|
12489 | return selectedIndex;
|
12490 | };
|
12491 | |
12492 |
|
12493 |
|
12494 |
|
12495 | MDCListFoundation.prototype.setHasTypeahead = function (hasTypeahead) {
|
12496 | this.hasTypeahead = hasTypeahead;
|
12497 | if (hasTypeahead) {
|
12498 | this.sortedIndexByFirstChar = this.typeaheadInitSortedIndex();
|
12499 | }
|
12500 | };
|
12501 | |
12502 |
|
12503 |
|
12504 | MDCListFoundation.prototype.isTypeaheadInProgress = function () {
|
12505 | return this.hasTypeahead && typeahead.isTypingInProgress(this.typeaheadState);
|
12506 | };
|
12507 |
|
12508 | MDCListFoundation.prototype.setUseActivatedClass = function (useActivated) {
|
12509 | this.useActivatedClass = useActivated;
|
12510 | };
|
12511 | |
12512 |
|
12513 |
|
12514 |
|
12515 | MDCListFoundation.prototype.setUseSelectedAttribute = function (useSelected) {
|
12516 | this.useSelectedAttr = useSelected;
|
12517 | };
|
12518 | MDCListFoundation.prototype.getSelectedIndex = function () {
|
12519 | return this.selectedIndex;
|
12520 | };
|
12521 | MDCListFoundation.prototype.setSelectedIndex = function (index, _a) {
|
12522 | var _b = _a === void 0 ? {} : _a,
|
12523 | forceUpdate = _b.forceUpdate;
|
12524 | if (!this.isIndexValid(index)) {
|
12525 | return;
|
12526 | }
|
12527 | if (this.isCheckboxList) {
|
12528 | this.setCheckboxAtIndex(index);
|
12529 | } else if (this.isRadioList) {
|
12530 | this.setRadioAtIndex(index);
|
12531 | } else {
|
12532 | this.setSingleSelectionAtIndex(index, { forceUpdate: forceUpdate });
|
12533 | }
|
12534 | };
|
12535 | |
12536 |
|
12537 |
|
12538 | MDCListFoundation.prototype.handleFocusIn = function (listItemIndex) {
|
12539 | if (listItemIndex >= 0) {
|
12540 | this.focusedItemIndex = listItemIndex;
|
12541 | this.adapter.setAttributeForElementIndex(listItemIndex, 'tabindex', '0');
|
12542 | this.adapter.setTabIndexForListItemChildren(listItemIndex, '0');
|
12543 | }
|
12544 | };
|
12545 | |
12546 |
|
12547 |
|
12548 | MDCListFoundation.prototype.handleFocusOut = function (listItemIndex) {
|
12549 | var _this = this;
|
12550 | if (listItemIndex >= 0) {
|
12551 | this.adapter.setAttributeForElementIndex(listItemIndex, 'tabindex', '-1');
|
12552 | this.adapter.setTabIndexForListItemChildren(listItemIndex, '-1');
|
12553 | }
|
12554 | |
12555 |
|
12556 |
|
12557 |
|
12558 | setTimeout(function () {
|
12559 | if (!_this.adapter.isFocusInsideList()) {
|
12560 | _this.setTabindexToFirstSelectedOrFocusedItem();
|
12561 | }
|
12562 | }, 0);
|
12563 | };
|
12564 | |
12565 |
|
12566 |
|
12567 | MDCListFoundation.prototype.handleKeydown = function (event, isRootListItem, listItemIndex) {
|
12568 | var _this = this;
|
12569 | var isArrowLeft = keyboard_1.normalizeKey(event) === 'ArrowLeft';
|
12570 | var isArrowUp = keyboard_1.normalizeKey(event) === 'ArrowUp';
|
12571 | var isArrowRight = keyboard_1.normalizeKey(event) === 'ArrowRight';
|
12572 | var isArrowDown = keyboard_1.normalizeKey(event) === 'ArrowDown';
|
12573 | var isHome = keyboard_1.normalizeKey(event) === 'Home';
|
12574 | var isEnd = keyboard_1.normalizeKey(event) === 'End';
|
12575 | var isEnter = keyboard_1.normalizeKey(event) === 'Enter';
|
12576 | var isSpace = keyboard_1.normalizeKey(event) === 'Spacebar';
|
12577 |
|
12578 |
|
12579 | var isLetterA = event.key === 'A' || event.key === 'a';
|
12580 | if (this.adapter.isRootFocused()) {
|
12581 | if (isArrowUp || isEnd) {
|
12582 | event.preventDefault();
|
12583 | this.focusLastElement();
|
12584 | } else if (isArrowDown || isHome) {
|
12585 | event.preventDefault();
|
12586 | this.focusFirstElement();
|
12587 | }
|
12588 | if (this.hasTypeahead) {
|
12589 | var handleKeydownOpts = {
|
12590 | event: event,
|
12591 | focusItemAtIndex: function focusItemAtIndex(index) {
|
12592 | _this.focusItemAtIndex(index);
|
12593 | },
|
12594 | focusedItemIndex: -1,
|
12595 | isTargetListItem: isRootListItem,
|
12596 | sortedIndexByFirstChar: this.sortedIndexByFirstChar,
|
12597 | isItemAtIndexDisabled: function isItemAtIndexDisabled(index) {
|
12598 | return _this.adapter.listItemAtIndexHasClass(index, constants_1.cssClasses.LIST_ITEM_DISABLED_CLASS);
|
12599 | }
|
12600 | };
|
12601 | typeahead.handleKeydown(handleKeydownOpts, this.typeaheadState);
|
12602 | }
|
12603 | return;
|
12604 | }
|
12605 | var currentIndex = this.adapter.getFocusedElementIndex();
|
12606 | if (currentIndex === -1) {
|
12607 | currentIndex = listItemIndex;
|
12608 | if (currentIndex < 0) {
|
12609 |
|
12610 |
|
12611 | return;
|
12612 | }
|
12613 | }
|
12614 | if (this.isVertical && isArrowDown || !this.isVertical && isArrowRight) {
|
12615 | events_1.preventDefaultEvent(event);
|
12616 | this.focusNextElement(currentIndex);
|
12617 | } else if (this.isVertical && isArrowUp || !this.isVertical && isArrowLeft) {
|
12618 | events_1.preventDefaultEvent(event);
|
12619 | this.focusPrevElement(currentIndex);
|
12620 | } else if (isHome) {
|
12621 | events_1.preventDefaultEvent(event);
|
12622 | this.focusFirstElement();
|
12623 | } else if (isEnd) {
|
12624 | events_1.preventDefaultEvent(event);
|
12625 | this.focusLastElement();
|
12626 | } else if (isLetterA && event.ctrlKey && this.isCheckboxList) {
|
12627 | event.preventDefault();
|
12628 | this.toggleAll(this.selectedIndex === constants_1.numbers.UNSET_INDEX ? [] : this.selectedIndex);
|
12629 | } else if (isEnter || isSpace) {
|
12630 | if (isRootListItem) {
|
12631 |
|
12632 |
|
12633 | var target = event.target;
|
12634 | if (target && target.tagName === 'A' && isEnter) {
|
12635 | return;
|
12636 | }
|
12637 | events_1.preventDefaultEvent(event);
|
12638 | if (this.adapter.listItemAtIndexHasClass(currentIndex, constants_1.cssClasses.LIST_ITEM_DISABLED_CLASS)) {
|
12639 | return;
|
12640 | }
|
12641 | if (!this.isTypeaheadInProgress()) {
|
12642 | if (this.isSelectableList()) {
|
12643 | this.setSelectedIndexOnAction(currentIndex);
|
12644 | }
|
12645 | this.adapter.notifyAction(currentIndex);
|
12646 | }
|
12647 | }
|
12648 | }
|
12649 | if (this.hasTypeahead) {
|
12650 | var handleKeydownOpts = {
|
12651 | event: event,
|
12652 | focusItemAtIndex: function focusItemAtIndex(index) {
|
12653 | _this.focusItemAtIndex(index);
|
12654 | },
|
12655 | focusedItemIndex: this.focusedItemIndex,
|
12656 | isTargetListItem: isRootListItem,
|
12657 | sortedIndexByFirstChar: this.sortedIndexByFirstChar,
|
12658 | isItemAtIndexDisabled: function isItemAtIndexDisabled(index) {
|
12659 | return _this.adapter.listItemAtIndexHasClass(index, constants_1.cssClasses.LIST_ITEM_DISABLED_CLASS);
|
12660 | }
|
12661 | };
|
12662 | typeahead.handleKeydown(handleKeydownOpts, this.typeaheadState);
|
12663 | }
|
12664 | };
|
12665 | |
12666 |
|
12667 |
|
12668 | MDCListFoundation.prototype.handleClick = function (index, toggleCheckbox) {
|
12669 | if (index === constants_1.numbers.UNSET_INDEX) {
|
12670 | return;
|
12671 | }
|
12672 | if (this.adapter.listItemAtIndexHasClass(index, constants_1.cssClasses.LIST_ITEM_DISABLED_CLASS)) {
|
12673 | return;
|
12674 | }
|
12675 | if (this.isSelectableList()) {
|
12676 | this.setSelectedIndexOnAction(index, toggleCheckbox);
|
12677 | }
|
12678 | this.adapter.notifyAction(index);
|
12679 | };
|
12680 | |
12681 |
|
12682 |
|
12683 | MDCListFoundation.prototype.focusNextElement = function (index) {
|
12684 | var count = this.adapter.getListItemCount();
|
12685 | var nextIndex = index + 1;
|
12686 | if (nextIndex >= count) {
|
12687 | if (this.wrapFocus) {
|
12688 | nextIndex = 0;
|
12689 | } else {
|
12690 |
|
12691 | return index;
|
12692 | }
|
12693 | }
|
12694 | this.focusItemAtIndex(nextIndex);
|
12695 | return nextIndex;
|
12696 | };
|
12697 | |
12698 |
|
12699 |
|
12700 | MDCListFoundation.prototype.focusPrevElement = function (index) {
|
12701 | var prevIndex = index - 1;
|
12702 | if (prevIndex < 0) {
|
12703 | if (this.wrapFocus) {
|
12704 | prevIndex = this.adapter.getListItemCount() - 1;
|
12705 | } else {
|
12706 |
|
12707 | return index;
|
12708 | }
|
12709 | }
|
12710 | this.focusItemAtIndex(prevIndex);
|
12711 | return prevIndex;
|
12712 | };
|
12713 | MDCListFoundation.prototype.focusFirstElement = function () {
|
12714 | this.focusItemAtIndex(0);
|
12715 | return 0;
|
12716 | };
|
12717 | MDCListFoundation.prototype.focusLastElement = function () {
|
12718 | var lastIndex = this.adapter.getListItemCount() - 1;
|
12719 | this.focusItemAtIndex(lastIndex);
|
12720 | return lastIndex;
|
12721 | };
|
12722 | MDCListFoundation.prototype.focusInitialElement = function () {
|
12723 | var initialIndex = this.getFirstSelectedOrFocusedItemIndex();
|
12724 | this.focusItemAtIndex(initialIndex);
|
12725 | return initialIndex;
|
12726 | };
|
12727 | |
12728 |
|
12729 |
|
12730 |
|
12731 | MDCListFoundation.prototype.setEnabled = function (itemIndex, isEnabled) {
|
12732 | if (!this.isIndexValid(itemIndex)) {
|
12733 | return;
|
12734 | }
|
12735 | if (isEnabled) {
|
12736 | this.adapter.removeClassForElementIndex(itemIndex, constants_1.cssClasses.LIST_ITEM_DISABLED_CLASS);
|
12737 | this.adapter.setAttributeForElementIndex(itemIndex, constants_1.strings.ARIA_DISABLED, 'false');
|
12738 | } else {
|
12739 | this.adapter.addClassForElementIndex(itemIndex, constants_1.cssClasses.LIST_ITEM_DISABLED_CLASS);
|
12740 | this.adapter.setAttributeForElementIndex(itemIndex, constants_1.strings.ARIA_DISABLED, 'true');
|
12741 | }
|
12742 | };
|
12743 | MDCListFoundation.prototype.setSingleSelectionAtIndex = function (index, _a) {
|
12744 | var _b = _a === void 0 ? {} : _a,
|
12745 | forceUpdate = _b.forceUpdate;
|
12746 | if (this.selectedIndex === index && !forceUpdate) {
|
12747 | return;
|
12748 | }
|
12749 | var selectedClassName = constants_1.cssClasses.LIST_ITEM_SELECTED_CLASS;
|
12750 | if (this.useActivatedClass) {
|
12751 | selectedClassName = constants_1.cssClasses.LIST_ITEM_ACTIVATED_CLASS;
|
12752 | }
|
12753 | if (this.selectedIndex !== constants_1.numbers.UNSET_INDEX) {
|
12754 | this.adapter.removeClassForElementIndex(this.selectedIndex, selectedClassName);
|
12755 | }
|
12756 | this.setAriaForSingleSelectionAtIndex(index);
|
12757 | this.setTabindexAtIndex(index);
|
12758 | if (index !== constants_1.numbers.UNSET_INDEX) {
|
12759 | this.adapter.addClassForElementIndex(index, selectedClassName);
|
12760 | }
|
12761 | this.selectedIndex = index;
|
12762 | };
|
12763 | |
12764 |
|
12765 |
|
12766 | MDCListFoundation.prototype.setAriaForSingleSelectionAtIndex = function (index) {
|
12767 |
|
12768 |
|
12769 | if (this.selectedIndex === constants_1.numbers.UNSET_INDEX) {
|
12770 | this.ariaCurrentAttrValue = this.adapter.getAttributeForElementIndex(index, constants_1.strings.ARIA_CURRENT);
|
12771 | }
|
12772 | var isAriaCurrent = this.ariaCurrentAttrValue !== null;
|
12773 | var ariaAttribute = isAriaCurrent ? constants_1.strings.ARIA_CURRENT : constants_1.strings.ARIA_SELECTED;
|
12774 | if (this.selectedIndex !== constants_1.numbers.UNSET_INDEX) {
|
12775 | this.adapter.setAttributeForElementIndex(this.selectedIndex, ariaAttribute, 'false');
|
12776 | }
|
12777 | if (index !== constants_1.numbers.UNSET_INDEX) {
|
12778 | var ariaAttributeValue = isAriaCurrent ? this.ariaCurrentAttrValue : 'true';
|
12779 | this.adapter.setAttributeForElementIndex(index, ariaAttribute, ariaAttributeValue);
|
12780 | }
|
12781 | };
|
12782 | |
12783 |
|
12784 |
|
12785 | MDCListFoundation.prototype.getSelectionAttribute = function () {
|
12786 | return this.useSelectedAttr ? constants_1.strings.ARIA_SELECTED : constants_1.strings.ARIA_CHECKED;
|
12787 | };
|
12788 | |
12789 |
|
12790 |
|
12791 |
|
12792 | MDCListFoundation.prototype.setRadioAtIndex = function (index) {
|
12793 | var selectionAttribute = this.getSelectionAttribute();
|
12794 | this.adapter.setCheckedCheckboxOrRadioAtIndex(index, true);
|
12795 | if (this.selectedIndex !== constants_1.numbers.UNSET_INDEX) {
|
12796 | this.adapter.setAttributeForElementIndex(this.selectedIndex, selectionAttribute, 'false');
|
12797 | }
|
12798 | this.adapter.setAttributeForElementIndex(index, selectionAttribute, 'true');
|
12799 | this.selectedIndex = index;
|
12800 | };
|
12801 | MDCListFoundation.prototype.setCheckboxAtIndex = function (index) {
|
12802 | var selectionAttribute = this.getSelectionAttribute();
|
12803 | for (var i = 0; i < this.adapter.getListItemCount(); i++) {
|
12804 | var isChecked = false;
|
12805 | if (index.indexOf(i) >= 0) {
|
12806 | isChecked = true;
|
12807 | }
|
12808 | this.adapter.setCheckedCheckboxOrRadioAtIndex(i, isChecked);
|
12809 | this.adapter.setAttributeForElementIndex(i, selectionAttribute, isChecked ? 'true' : 'false');
|
12810 | }
|
12811 | this.selectedIndex = index;
|
12812 | };
|
12813 | MDCListFoundation.prototype.setTabindexAtIndex = function (index) {
|
12814 | if (this.focusedItemIndex === constants_1.numbers.UNSET_INDEX && index !== 0) {
|
12815 |
|
12816 |
|
12817 |
|
12818 | this.adapter.setAttributeForElementIndex(0, 'tabindex', '-1');
|
12819 | } else if (this.focusedItemIndex >= 0 && this.focusedItemIndex !== index) {
|
12820 | this.adapter.setAttributeForElementIndex(this.focusedItemIndex, 'tabindex', '-1');
|
12821 | }
|
12822 |
|
12823 |
|
12824 |
|
12825 | if (!(this.selectedIndex instanceof Array) && this.selectedIndex !== index) {
|
12826 | this.adapter.setAttributeForElementIndex(this.selectedIndex, 'tabindex', '-1');
|
12827 | }
|
12828 | if (index !== constants_1.numbers.UNSET_INDEX) {
|
12829 | this.adapter.setAttributeForElementIndex(index, 'tabindex', '0');
|
12830 | }
|
12831 | };
|
12832 | |
12833 |
|
12834 |
|
12835 |
|
12836 | MDCListFoundation.prototype.isSelectableList = function () {
|
12837 | return this.isSingleSelectionList || this.isCheckboxList || this.isRadioList;
|
12838 | };
|
12839 | MDCListFoundation.prototype.setTabindexToFirstSelectedOrFocusedItem = function () {
|
12840 | var targetIndex = this.getFirstSelectedOrFocusedItemIndex();
|
12841 | this.setTabindexAtIndex(targetIndex);
|
12842 | };
|
12843 | MDCListFoundation.prototype.getFirstSelectedOrFocusedItemIndex = function () {
|
12844 |
|
12845 | if (!this.isSelectableList()) {
|
12846 | return Math.max(this.focusedItemIndex, 0);
|
12847 | }
|
12848 |
|
12849 | if (typeof this.selectedIndex === 'number' && this.selectedIndex !== constants_1.numbers.UNSET_INDEX) {
|
12850 | return this.selectedIndex;
|
12851 | }
|
12852 |
|
12853 | if (isNumberArray(this.selectedIndex) && this.selectedIndex.length > 0) {
|
12854 | return this.selectedIndex.reduce(function (minIndex, currentIndex) {
|
12855 | return Math.min(minIndex, currentIndex);
|
12856 | });
|
12857 | }
|
12858 |
|
12859 | return 0;
|
12860 | };
|
12861 | MDCListFoundation.prototype.isIndexValid = function (index) {
|
12862 | var _this = this;
|
12863 | if (index instanceof Array) {
|
12864 | if (!this.isCheckboxList) {
|
12865 | throw new Error('MDCListFoundation: Array of index is only supported for checkbox based list');
|
12866 | }
|
12867 | if (index.length === 0) {
|
12868 | return true;
|
12869 | } else {
|
12870 | return index.some(function (i) {
|
12871 | return _this.isIndexInRange(i);
|
12872 | });
|
12873 | }
|
12874 | } else if (typeof index === 'number') {
|
12875 | if (this.isCheckboxList) {
|
12876 | throw new Error("MDCListFoundation: Expected array of index for checkbox based list but got number: " + index);
|
12877 | }
|
12878 | return this.isIndexInRange(index) || this.isSingleSelectionList && index === constants_1.numbers.UNSET_INDEX;
|
12879 | } else {
|
12880 | return false;
|
12881 | }
|
12882 | };
|
12883 | MDCListFoundation.prototype.isIndexInRange = function (index) {
|
12884 | var listSize = this.adapter.getListItemCount();
|
12885 | return index >= 0 && index < listSize;
|
12886 | };
|
12887 | |
12888 |
|
12889 |
|
12890 |
|
12891 |
|
12892 | MDCListFoundation.prototype.setSelectedIndexOnAction = function (index, toggleCheckbox) {
|
12893 | if (toggleCheckbox === void 0) {
|
12894 | toggleCheckbox = true;
|
12895 | }
|
12896 | if (this.isCheckboxList) {
|
12897 | this.toggleCheckboxAtIndex(index, toggleCheckbox);
|
12898 | } else {
|
12899 | this.setSelectedIndex(index);
|
12900 | }
|
12901 | };
|
12902 | MDCListFoundation.prototype.toggleCheckboxAtIndex = function (index, toggleCheckbox) {
|
12903 | var selectionAttribute = this.getSelectionAttribute();
|
12904 | var isChecked = this.adapter.isCheckboxCheckedAtIndex(index);
|
12905 | if (toggleCheckbox) {
|
12906 | isChecked = !isChecked;
|
12907 | this.adapter.setCheckedCheckboxOrRadioAtIndex(index, isChecked);
|
12908 | }
|
12909 | this.adapter.setAttributeForElementIndex(index, selectionAttribute, isChecked ? 'true' : 'false');
|
12910 |
|
12911 |
|
12912 | var selectedIndexes = this.selectedIndex === constants_1.numbers.UNSET_INDEX ? [] : this.selectedIndex.slice();
|
12913 | if (isChecked) {
|
12914 | selectedIndexes.push(index);
|
12915 | } else {
|
12916 | selectedIndexes = selectedIndexes.filter(function (i) {
|
12917 | return i !== index;
|
12918 | });
|
12919 | }
|
12920 | this.selectedIndex = selectedIndexes;
|
12921 | };
|
12922 | MDCListFoundation.prototype.focusItemAtIndex = function (index) {
|
12923 | this.adapter.focusItemAtIndex(index);
|
12924 | this.focusedItemIndex = index;
|
12925 | };
|
12926 | MDCListFoundation.prototype.toggleAll = function (currentlySelectedIndexes) {
|
12927 | var count = this.adapter.getListItemCount();
|
12928 |
|
12929 | if (currentlySelectedIndexes.length === count) {
|
12930 | this.setCheckboxAtIndex([]);
|
12931 | } else {
|
12932 |
|
12933 | var allIndexes = [];
|
12934 | for (var i = 0; i < count; i++) {
|
12935 | if (!this.adapter.listItemAtIndexHasClass(i, constants_1.cssClasses.LIST_ITEM_DISABLED_CLASS) || currentlySelectedIndexes.indexOf(i) > -1) {
|
12936 | allIndexes.push(i);
|
12937 | }
|
12938 | }
|
12939 | this.setCheckboxAtIndex(allIndexes);
|
12940 | }
|
12941 | };
|
12942 | |
12943 |
|
12944 |
|
12945 |
|
12946 |
|
12947 |
|
12948 |
|
12949 |
|
12950 |
|
12951 |
|
12952 |
|
12953 |
|
12954 |
|
12955 | MDCListFoundation.prototype.typeaheadMatchItem = function (nextChar, startingIndex, skipFocus) {
|
12956 | var _this = this;
|
12957 | if (skipFocus === void 0) {
|
12958 | skipFocus = false;
|
12959 | }
|
12960 | var opts = {
|
12961 | focusItemAtIndex: function focusItemAtIndex(index) {
|
12962 | _this.focusItemAtIndex(index);
|
12963 | },
|
12964 | focusedItemIndex: startingIndex ? startingIndex : this.focusedItemIndex,
|
12965 | nextChar: nextChar,
|
12966 | sortedIndexByFirstChar: this.sortedIndexByFirstChar,
|
12967 | skipFocus: skipFocus,
|
12968 | isItemAtIndexDisabled: function isItemAtIndexDisabled(index) {
|
12969 | return _this.adapter.listItemAtIndexHasClass(index, constants_1.cssClasses.LIST_ITEM_DISABLED_CLASS);
|
12970 | }
|
12971 | };
|
12972 | return typeahead.matchItem(opts, this.typeaheadState);
|
12973 | };
|
12974 | |
12975 |
|
12976 |
|
12977 |
|
12978 |
|
12979 |
|
12980 | MDCListFoundation.prototype.typeaheadInitSortedIndex = function () {
|
12981 | return typeahead.initSortedIndex(this.adapter.getListItemCount(), this.adapter.getPrimaryTextAtIndex);
|
12982 | };
|
12983 | |
12984 |
|
12985 |
|
12986 | MDCListFoundation.prototype.clearTypeaheadBuffer = function () {
|
12987 | typeahead.clearBuffer(this.typeaheadState);
|
12988 | };
|
12989 | return MDCListFoundation;
|
12990 | }(foundation_1.MDCFoundation);
|
12991 | exports.MDCListFoundation = MDCListFoundation;
|
12992 |
|
12993 | exports.default = MDCListFoundation;
|
12994 |
|
12995 | }),
|
12996 |
|
12997 | "./packages/mdc-list/index.ts":
|
12998 |
|
12999 |
|
13000 |
|
13001 |
|
13002 | (function(module, exports, __webpack_require__) {
|
13003 |
|
13004 | "use strict";
|
13005 |
|
13006 |
|
13007 |
|
13008 |
|
13009 |
|
13010 |
|
13011 |
|
13012 |
|
13013 |
|
13014 |
|
13015 |
|
13016 |
|
13017 |
|
13018 |
|
13019 |
|
13020 |
|
13021 |
|
13022 |
|
13023 |
|
13024 |
|
13025 |
|
13026 |
|
13027 |
|
13028 |
|
13029 | var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
|
13030 | if (k2 === undefined) k2 = k;
|
13031 | Object.defineProperty(o, k2, { enumerable: true, get: function get() {
|
13032 | return m[k];
|
13033 | } });
|
13034 | } : function (o, m, k, k2) {
|
13035 | if (k2 === undefined) k2 = k;
|
13036 | o[k2] = m[k];
|
13037 | });
|
13038 | var __exportStar = this && this.__exportStar || function (m, exports) {
|
13039 | for (var p in m) {
|
13040 | if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
13041 | }
|
13042 | };
|
13043 | Object.defineProperty(exports, "__esModule", { value: true });
|
13044 | __exportStar(__webpack_require__( "./packages/mdc-list/adapter.ts"), exports);
|
13045 | __exportStar(__webpack_require__( "./packages/mdc-list/component.ts"), exports);
|
13046 | __exportStar(__webpack_require__( "./packages/mdc-list/constants.ts"), exports);
|
13047 | __exportStar(__webpack_require__( "./packages/mdc-list/foundation.ts"), exports);
|
13048 | __exportStar(__webpack_require__( "./packages/mdc-list/types.ts"), exports);
|
13049 |
|
13050 | }),
|
13051 |
|
13052 | "./packages/mdc-list/typeahead.ts":
|
13053 |
|
13054 |
|
13055 |
|
13056 |
|
13057 | (function(module, exports, __webpack_require__) {
|
13058 |
|
13059 | "use strict";
|
13060 |
|
13061 |
|
13062 |
|
13063 |
|
13064 |
|
13065 |
|
13066 |
|
13067 |
|
13068 |
|
13069 |
|
13070 |
|
13071 |
|
13072 |
|
13073 |
|
13074 |
|
13075 |
|
13076 |
|
13077 |
|
13078 |
|
13079 |
|
13080 |
|
13081 |
|
13082 |
|
13083 |
|
13084 | Object.defineProperty(exports, "__esModule", { value: true });
|
13085 | exports.handleKeydown = exports.clearBuffer = exports.isTypingInProgress = exports.matchItem = exports.initSortedIndex = exports.initState = void 0;
|
13086 | var keyboard_1 = __webpack_require__( "./packages/mdc-dom/keyboard.ts");
|
13087 | var constants_1 = __webpack_require__( "./packages/mdc-list/constants.ts");
|
13088 | var events_1 = __webpack_require__( "./packages/mdc-list/events.ts");
|
13089 |
|
13090 |
|
13091 |
|
13092 |
|
13093 |
|
13094 |
|
13095 |
|
13096 |
|
13097 | function initState() {
|
13098 | var state = {
|
13099 | bufferClearTimeout: 0,
|
13100 | currentFirstChar: '',
|
13101 | sortedIndexCursor: 0,
|
13102 | typeaheadBuffer: ''
|
13103 | };
|
13104 | return state;
|
13105 | }
|
13106 | exports.initState = initState;
|
13107 |
|
13108 |
|
13109 |
|
13110 |
|
13111 |
|
13112 |
|
13113 |
|
13114 |
|
13115 |
|
13116 |
|
13117 |
|
13118 | function initSortedIndex(listItemCount, getPrimaryTextByItemIndex) {
|
13119 | var sortedIndexByFirstChar = new Map();
|
13120 |
|
13121 | for (var i = 0; i < listItemCount; i++) {
|
13122 | var primaryText = getPrimaryTextByItemIndex(i).trim();
|
13123 | if (!primaryText) {
|
13124 | continue;
|
13125 | }
|
13126 | var firstChar = primaryText[0].toLowerCase();
|
13127 | if (!sortedIndexByFirstChar.has(firstChar)) {
|
13128 | sortedIndexByFirstChar.set(firstChar, []);
|
13129 | }
|
13130 | sortedIndexByFirstChar.get(firstChar).push({ text: primaryText.toLowerCase(), index: i });
|
13131 | }
|
13132 |
|
13133 |
|
13134 | sortedIndexByFirstChar.forEach(function (values) {
|
13135 | values.sort(function (first, second) {
|
13136 | return first.index - second.index;
|
13137 | });
|
13138 | });
|
13139 | return sortedIndexByFirstChar;
|
13140 | }
|
13141 | exports.initSortedIndex = initSortedIndex;
|
13142 |
|
13143 |
|
13144 |
|
13145 |
|
13146 |
|
13147 |
|
13148 |
|
13149 |
|
13150 |
|
13151 |
|
13152 |
|
13153 |
|
13154 |
|
13155 |
|
13156 |
|
13157 |
|
13158 | function matchItem(opts, state) {
|
13159 | var nextChar = opts.nextChar,
|
13160 | focusItemAtIndex = opts.focusItemAtIndex,
|
13161 | sortedIndexByFirstChar = opts.sortedIndexByFirstChar,
|
13162 | focusedItemIndex = opts.focusedItemIndex,
|
13163 | skipFocus = opts.skipFocus,
|
13164 | isItemAtIndexDisabled = opts.isItemAtIndexDisabled;
|
13165 | clearTimeout(state.bufferClearTimeout);
|
13166 | state.bufferClearTimeout = setTimeout(function () {
|
13167 | clearBuffer(state);
|
13168 | }, constants_1.numbers.TYPEAHEAD_BUFFER_CLEAR_TIMEOUT_MS);
|
13169 | state.typeaheadBuffer = state.typeaheadBuffer + nextChar;
|
13170 | var index;
|
13171 | if (state.typeaheadBuffer.length === 1) {
|
13172 | index = matchFirstChar(sortedIndexByFirstChar, focusedItemIndex, isItemAtIndexDisabled, state);
|
13173 | } else {
|
13174 | index = matchAllChars(sortedIndexByFirstChar, isItemAtIndexDisabled, state);
|
13175 | }
|
13176 | if (index !== -1 && !skipFocus) {
|
13177 | focusItemAtIndex(index);
|
13178 | }
|
13179 | return index;
|
13180 | }
|
13181 | exports.matchItem = matchItem;
|
13182 |
|
13183 |
|
13184 |
|
13185 |
|
13186 |
|
13187 | function matchFirstChar(sortedIndexByFirstChar, focusedItemIndex, isItemAtIndexDisabled, state) {
|
13188 | var firstChar = state.typeaheadBuffer[0];
|
13189 | var itemsMatchingFirstChar = sortedIndexByFirstChar.get(firstChar);
|
13190 | if (!itemsMatchingFirstChar) {
|
13191 | return -1;
|
13192 | }
|
13193 |
|
13194 |
|
13195 |
|
13196 | if (firstChar === state.currentFirstChar && itemsMatchingFirstChar[state.sortedIndexCursor].index === focusedItemIndex) {
|
13197 | state.sortedIndexCursor = (state.sortedIndexCursor + 1) % itemsMatchingFirstChar.length;
|
13198 | var newIndex = itemsMatchingFirstChar[state.sortedIndexCursor].index;
|
13199 | if (!isItemAtIndexDisabled(newIndex)) {
|
13200 | return newIndex;
|
13201 | }
|
13202 | }
|
13203 |
|
13204 |
|
13205 |
|
13206 |
|
13207 | state.currentFirstChar = firstChar;
|
13208 | var newCursorPosition = -1;
|
13209 | var cursorPosition;
|
13210 |
|
13211 | for (cursorPosition = 0; cursorPosition < itemsMatchingFirstChar.length; cursorPosition++) {
|
13212 | if (!isItemAtIndexDisabled(itemsMatchingFirstChar[cursorPosition].index)) {
|
13213 | newCursorPosition = cursorPosition;
|
13214 | break;
|
13215 | }
|
13216 | }
|
13217 |
|
13218 |
|
13219 |
|
13220 | for (; cursorPosition < itemsMatchingFirstChar.length; cursorPosition++) {
|
13221 | if (itemsMatchingFirstChar[cursorPosition].index > focusedItemIndex && !isItemAtIndexDisabled(itemsMatchingFirstChar[cursorPosition].index)) {
|
13222 | newCursorPosition = cursorPosition;
|
13223 | break;
|
13224 | }
|
13225 | }
|
13226 | if (newCursorPosition !== -1) {
|
13227 | state.sortedIndexCursor = newCursorPosition;
|
13228 | return itemsMatchingFirstChar[state.sortedIndexCursor].index;
|
13229 | }
|
13230 | return -1;
|
13231 | }
|
13232 |
|
13233 |
|
13234 |
|
13235 |
|
13236 | function matchAllChars(sortedIndexByFirstChar, isItemAtIndexDisabled, state) {
|
13237 | var firstChar = state.typeaheadBuffer[0];
|
13238 | var itemsMatchingFirstChar = sortedIndexByFirstChar.get(firstChar);
|
13239 | if (!itemsMatchingFirstChar) {
|
13240 | return -1;
|
13241 | }
|
13242 |
|
13243 | var startingItem = itemsMatchingFirstChar[state.sortedIndexCursor];
|
13244 | if (startingItem.text.lastIndexOf(state.typeaheadBuffer, 0) === 0 && !isItemAtIndexDisabled(startingItem.index)) {
|
13245 | return startingItem.index;
|
13246 | }
|
13247 |
|
13248 |
|
13249 | var cursorPosition = (state.sortedIndexCursor + 1) % itemsMatchingFirstChar.length;
|
13250 | var nextCursorPosition = -1;
|
13251 | while (cursorPosition !== state.sortedIndexCursor) {
|
13252 | var currentItem = itemsMatchingFirstChar[cursorPosition];
|
13253 | var matches = currentItem.text.lastIndexOf(state.typeaheadBuffer, 0) === 0;
|
13254 | var isEnabled = !isItemAtIndexDisabled(currentItem.index);
|
13255 | if (matches && isEnabled) {
|
13256 | nextCursorPosition = cursorPosition;
|
13257 | break;
|
13258 | }
|
13259 | cursorPosition = (cursorPosition + 1) % itemsMatchingFirstChar.length;
|
13260 | }
|
13261 | if (nextCursorPosition !== -1) {
|
13262 | state.sortedIndexCursor = nextCursorPosition;
|
13263 | return itemsMatchingFirstChar[state.sortedIndexCursor].index;
|
13264 | }
|
13265 | return -1;
|
13266 | }
|
13267 |
|
13268 |
|
13269 |
|
13270 |
|
13271 |
|
13272 | function isTypingInProgress(state) {
|
13273 | return state.typeaheadBuffer.length > 0;
|
13274 | }
|
13275 | exports.isTypingInProgress = isTypingInProgress;
|
13276 |
|
13277 |
|
13278 |
|
13279 |
|
13280 |
|
13281 |
|
13282 | function clearBuffer(state) {
|
13283 | state.typeaheadBuffer = '';
|
13284 | }
|
13285 | exports.clearBuffer = clearBuffer;
|
13286 |
|
13287 |
|
13288 |
|
13289 |
|
13290 |
|
13291 |
|
13292 |
|
13293 |
|
13294 |
|
13295 |
|
13296 |
|
13297 |
|
13298 |
|
13299 |
|
13300 |
|
13301 |
|
13302 |
|
13303 | function handleKeydown(opts, state) {
|
13304 | var event = opts.event,
|
13305 | isTargetListItem = opts.isTargetListItem,
|
13306 | focusedItemIndex = opts.focusedItemIndex,
|
13307 | focusItemAtIndex = opts.focusItemAtIndex,
|
13308 | sortedIndexByFirstChar = opts.sortedIndexByFirstChar,
|
13309 | isItemAtIndexDisabled = opts.isItemAtIndexDisabled;
|
13310 | var isArrowLeft = keyboard_1.normalizeKey(event) === 'ArrowLeft';
|
13311 | var isArrowUp = keyboard_1.normalizeKey(event) === 'ArrowUp';
|
13312 | var isArrowRight = keyboard_1.normalizeKey(event) === 'ArrowRight';
|
13313 | var isArrowDown = keyboard_1.normalizeKey(event) === 'ArrowDown';
|
13314 | var isHome = keyboard_1.normalizeKey(event) === 'Home';
|
13315 | var isEnd = keyboard_1.normalizeKey(event) === 'End';
|
13316 | var isEnter = keyboard_1.normalizeKey(event) === 'Enter';
|
13317 | var isSpace = keyboard_1.normalizeKey(event) === 'Spacebar';
|
13318 | if (event.ctrlKey || event.metaKey || isArrowLeft || isArrowUp || isArrowRight || isArrowDown || isHome || isEnd || isEnter) {
|
13319 | return -1;
|
13320 | }
|
13321 | var isCharacterKey = !isSpace && event.key.length === 1;
|
13322 | if (isCharacterKey) {
|
13323 | events_1.preventDefaultEvent(event);
|
13324 | var matchItemOpts = {
|
13325 | focusItemAtIndex: focusItemAtIndex,
|
13326 | focusedItemIndex: focusedItemIndex,
|
13327 | nextChar: event.key.toLowerCase(),
|
13328 | sortedIndexByFirstChar: sortedIndexByFirstChar,
|
13329 | skipFocus: false,
|
13330 | isItemAtIndexDisabled: isItemAtIndexDisabled
|
13331 | };
|
13332 | return matchItem(matchItemOpts, state);
|
13333 | }
|
13334 | if (!isSpace) {
|
13335 | return -1;
|
13336 | }
|
13337 | if (isTargetListItem) {
|
13338 | events_1.preventDefaultEvent(event);
|
13339 | }
|
13340 | var typeaheadOnListItem = isTargetListItem && isTypingInProgress(state);
|
13341 | if (typeaheadOnListItem) {
|
13342 | var matchItemOpts = {
|
13343 | focusItemAtIndex: focusItemAtIndex,
|
13344 | focusedItemIndex: focusedItemIndex,
|
13345 | nextChar: ' ',
|
13346 | sortedIndexByFirstChar: sortedIndexByFirstChar,
|
13347 | skipFocus: false,
|
13348 | isItemAtIndexDisabled: isItemAtIndexDisabled
|
13349 | };
|
13350 |
|
13351 | return matchItem(matchItemOpts, state);
|
13352 | }
|
13353 | return -1;
|
13354 | }
|
13355 | exports.handleKeydown = handleKeydown;
|
13356 |
|
13357 | }),
|
13358 |
|
13359 | "./packages/mdc-list/types.ts":
|
13360 |
|
13361 |
|
13362 |
|
13363 |
|
13364 | (function(module, exports, __webpack_require__) {
|
13365 |
|
13366 | "use strict";
|
13367 |
|
13368 |
|
13369 |
|
13370 |
|
13371 |
|
13372 |
|
13373 |
|
13374 |
|
13375 |
|
13376 |
|
13377 |
|
13378 |
|
13379 |
|
13380 |
|
13381 |
|
13382 |
|
13383 |
|
13384 |
|
13385 |
|
13386 |
|
13387 |
|
13388 |
|
13389 |
|
13390 |
|
13391 | Object.defineProperty(exports, "__esModule", { value: true });
|
13392 |
|
13393 | }),
|
13394 |
|
13395 | "./packages/mdc-menu-surface/adapter.ts":
|
13396 |
|
13397 |
|
13398 |
|
13399 |
|
13400 | (function(module, exports, __webpack_require__) {
|
13401 |
|
13402 | "use strict";
|
13403 |
|
13404 |
|
13405 |
|
13406 |
|
13407 |
|
13408 |
|
13409 |
|
13410 |
|
13411 |
|
13412 |
|
13413 |
|
13414 |
|
13415 |
|
13416 |
|
13417 |
|
13418 |
|
13419 |
|
13420 |
|
13421 |
|
13422 |
|
13423 |
|
13424 |
|
13425 |
|
13426 |
|
13427 | Object.defineProperty(exports, "__esModule", { value: true });
|
13428 |
|
13429 | }),
|
13430 |
|
13431 | "./packages/mdc-menu-surface/component.ts":
|
13432 |
|
13433 |
|
13434 |
|
13435 |
|
13436 | (function(module, exports, __webpack_require__) {
|
13437 |
|
13438 | "use strict";
|
13439 |
|
13440 |
|
13441 |
|
13442 |
|
13443 |
|
13444 |
|
13445 |
|
13446 |
|
13447 |
|
13448 |
|
13449 |
|
13450 |
|
13451 |
|
13452 |
|
13453 |
|
13454 |
|
13455 |
|
13456 |
|
13457 |
|
13458 |
|
13459 |
|
13460 |
|
13461 |
|
13462 |
|
13463 | var __extends = this && this.__extends || function () {
|
13464 | var _extendStatics = function extendStatics(d, b) {
|
13465 | _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
|
13466 | d.__proto__ = b;
|
13467 | } || function (d, b) {
|
13468 | for (var p in b) {
|
13469 | if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
13470 | }
|
13471 | };
|
13472 | return _extendStatics(d, b);
|
13473 | };
|
13474 | return function (d, b) {
|
13475 | if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
13476 | _extendStatics(d, b);
|
13477 | function __() {
|
13478 | this.constructor = d;
|
13479 | }
|
13480 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
13481 | };
|
13482 | }();
|
13483 | Object.defineProperty(exports, "__esModule", { value: true });
|
13484 | exports.MDCMenuSurface = void 0;
|
13485 | var component_1 = __webpack_require__( "./packages/mdc-base/component.ts");
|
13486 | var constants_1 = __webpack_require__( "./packages/mdc-menu-surface/constants.ts");
|
13487 | var foundation_1 = __webpack_require__( "./packages/mdc-menu-surface/foundation.ts");
|
13488 | var util_1 = __webpack_require__( "./packages/mdc-animation/util.ts");
|
13489 | var MDCMenuSurface = function (_super) {
|
13490 | __extends(MDCMenuSurface, _super);
|
13491 | function MDCMenuSurface() {
|
13492 | return _super !== null && _super.apply(this, arguments) || this;
|
13493 | }
|
13494 | MDCMenuSurface.attachTo = function (root) {
|
13495 | return new MDCMenuSurface(root);
|
13496 | };
|
13497 | MDCMenuSurface.prototype.initialSyncWithDOM = function () {
|
13498 | var _this = this;
|
13499 | var parentEl = this.root.parentElement;
|
13500 | this.anchorElement = parentEl && parentEl.classList.contains(constants_1.cssClasses.ANCHOR) ? parentEl : null;
|
13501 | if (this.root.classList.contains(constants_1.cssClasses.FIXED)) {
|
13502 | this.setFixedPosition(true);
|
13503 | }
|
13504 | this.handleKeydown = function (event) {
|
13505 | _this.foundation.handleKeydown(event);
|
13506 | };
|
13507 | this.handleBodyClick = function (event) {
|
13508 | _this.foundation.handleBodyClick(event);
|
13509 | };
|
13510 |
|
13511 |
|
13512 | this.registerBodyClickListener = function () {
|
13513 | document.body.addEventListener('click', _this.handleBodyClick, { capture: true });
|
13514 | };
|
13515 | this.deregisterBodyClickListener = function () {
|
13516 | document.body.removeEventListener('click', _this.handleBodyClick, { capture: true });
|
13517 | };
|
13518 | this.listen('keydown', this.handleKeydown);
|
13519 | this.listen(constants_1.strings.OPENED_EVENT, this.registerBodyClickListener);
|
13520 | this.listen(constants_1.strings.CLOSED_EVENT, this.deregisterBodyClickListener);
|
13521 | };
|
13522 | MDCMenuSurface.prototype.destroy = function () {
|
13523 | this.unlisten('keydown', this.handleKeydown);
|
13524 | this.unlisten(constants_1.strings.OPENED_EVENT, this.registerBodyClickListener);
|
13525 | this.unlisten(constants_1.strings.CLOSED_EVENT, this.deregisterBodyClickListener);
|
13526 | _super.prototype.destroy.call(this);
|
13527 | };
|
13528 | MDCMenuSurface.prototype.isOpen = function () {
|
13529 | return this.foundation.isOpen();
|
13530 | };
|
13531 | MDCMenuSurface.prototype.open = function () {
|
13532 | this.foundation.open();
|
13533 | };
|
13534 | MDCMenuSurface.prototype.close = function (skipRestoreFocus) {
|
13535 | if (skipRestoreFocus === void 0) {
|
13536 | skipRestoreFocus = false;
|
13537 | }
|
13538 | this.foundation.close(skipRestoreFocus);
|
13539 | };
|
13540 | Object.defineProperty(MDCMenuSurface.prototype, "quickOpen", {
|
13541 | set: function set(quickOpen) {
|
13542 | this.foundation.setQuickOpen(quickOpen);
|
13543 | },
|
13544 | enumerable: false,
|
13545 | configurable: true
|
13546 | });
|
13547 |
|
13548 | MDCMenuSurface.prototype.setIsHoisted = function (isHoisted) {
|
13549 | this.foundation.setIsHoisted(isHoisted);
|
13550 | };
|
13551 |
|
13552 | MDCMenuSurface.prototype.setMenuSurfaceAnchorElement = function (element) {
|
13553 | this.anchorElement = element;
|
13554 | };
|
13555 |
|
13556 | MDCMenuSurface.prototype.setFixedPosition = function (isFixed) {
|
13557 | if (isFixed) {
|
13558 | this.root.classList.add(constants_1.cssClasses.FIXED);
|
13559 | } else {
|
13560 | this.root.classList.remove(constants_1.cssClasses.FIXED);
|
13561 | }
|
13562 | this.foundation.setFixedPosition(isFixed);
|
13563 | };
|
13564 |
|
13565 | MDCMenuSurface.prototype.setAbsolutePosition = function (x, y) {
|
13566 | this.foundation.setAbsolutePosition(x, y);
|
13567 | this.setIsHoisted(true);
|
13568 | };
|
13569 | |
13570 |
|
13571 |
|
13572 | MDCMenuSurface.prototype.setAnchorCorner = function (corner) {
|
13573 | this.foundation.setAnchorCorner(corner);
|
13574 | };
|
13575 | MDCMenuSurface.prototype.setAnchorMargin = function (margin) {
|
13576 | this.foundation.setAnchorMargin(margin);
|
13577 | };
|
13578 | MDCMenuSurface.prototype.getDefaultFoundation = function () {
|
13579 | var _this = this;
|
13580 |
|
13581 |
|
13582 |
|
13583 | var adapter = {
|
13584 | addClass: function addClass(className) {
|
13585 | return _this.root.classList.add(className);
|
13586 | },
|
13587 | removeClass: function removeClass(className) {
|
13588 | return _this.root.classList.remove(className);
|
13589 | },
|
13590 | hasClass: function hasClass(className) {
|
13591 | return _this.root.classList.contains(className);
|
13592 | },
|
13593 | hasAnchor: function hasAnchor() {
|
13594 | return !!_this.anchorElement;
|
13595 | },
|
13596 | notifyClose: function notifyClose() {
|
13597 | return _this.emit(foundation_1.MDCMenuSurfaceFoundation.strings.CLOSED_EVENT, {});
|
13598 | },
|
13599 | notifyClosing: function notifyClosing() {
|
13600 | _this.emit(foundation_1.MDCMenuSurfaceFoundation.strings.CLOSING_EVENT, {});
|
13601 | },
|
13602 | notifyOpen: function notifyOpen() {
|
13603 | return _this.emit(foundation_1.MDCMenuSurfaceFoundation.strings.OPENED_EVENT, {});
|
13604 | },
|
13605 | isElementInContainer: function isElementInContainer(el) {
|
13606 | return _this.root.contains(el);
|
13607 | },
|
13608 | isRtl: function isRtl() {
|
13609 | return getComputedStyle(_this.root).getPropertyValue('direction') === 'rtl';
|
13610 | },
|
13611 | setTransformOrigin: function setTransformOrigin(origin) {
|
13612 | var propertyName = util_1.getCorrectPropertyName(window, 'transform') + "-origin";
|
13613 | _this.root.style.setProperty(propertyName, origin);
|
13614 | },
|
13615 | isFocused: function isFocused() {
|
13616 | return document.activeElement === _this.root;
|
13617 | },
|
13618 | saveFocus: function saveFocus() {
|
13619 | _this.previousFocus = document.activeElement;
|
13620 | },
|
13621 | restoreFocus: function restoreFocus() {
|
13622 | if (_this.root.contains(document.activeElement)) {
|
13623 | if (_this.previousFocus && _this.previousFocus.focus) {
|
13624 | _this.previousFocus.focus();
|
13625 | }
|
13626 | }
|
13627 | },
|
13628 | getInnerDimensions: function getInnerDimensions() {
|
13629 | return {
|
13630 | width: _this.root.offsetWidth,
|
13631 | height: _this.root.offsetHeight
|
13632 | };
|
13633 | },
|
13634 | getAnchorDimensions: function getAnchorDimensions() {
|
13635 | return _this.anchorElement ? _this.anchorElement.getBoundingClientRect() : null;
|
13636 | },
|
13637 | getWindowDimensions: function getWindowDimensions() {
|
13638 | return { width: window.innerWidth, height: window.innerHeight };
|
13639 | },
|
13640 | getBodyDimensions: function getBodyDimensions() {
|
13641 | return { width: document.body.clientWidth, height: document.body.clientHeight };
|
13642 | },
|
13643 | getWindowScroll: function getWindowScroll() {
|
13644 | return { x: window.pageXOffset, y: window.pageYOffset };
|
13645 | },
|
13646 | setPosition: function setPosition(position) {
|
13647 | var rootHTML = _this.root;
|
13648 | rootHTML.style.left = 'left' in position ? position.left + "px" : '';
|
13649 | rootHTML.style.right = 'right' in position ? position.right + "px" : '';
|
13650 | rootHTML.style.top = 'top' in position ? position.top + "px" : '';
|
13651 | rootHTML.style.bottom = 'bottom' in position ? position.bottom + "px" : '';
|
13652 | },
|
13653 | setMaxHeight: function setMaxHeight(height) {
|
13654 | _this.root.style.maxHeight = height;
|
13655 | }
|
13656 | };
|
13657 |
|
13658 | return new foundation_1.MDCMenuSurfaceFoundation(adapter);
|
13659 | };
|
13660 | return MDCMenuSurface;
|
13661 | }(component_1.MDCComponent);
|
13662 | exports.MDCMenuSurface = MDCMenuSurface;
|
13663 |
|
13664 | }),
|
13665 |
|
13666 | "./packages/mdc-menu-surface/constants.ts":
|
13667 |
|
13668 |
|
13669 |
|
13670 |
|
13671 | (function(module, exports, __webpack_require__) {
|
13672 |
|
13673 | "use strict";
|
13674 |
|
13675 |
|
13676 |
|
13677 |
|
13678 |
|
13679 |
|
13680 |
|
13681 |
|
13682 |
|
13683 |
|
13684 |
|
13685 |
|
13686 |
|
13687 |
|
13688 |
|
13689 |
|
13690 |
|
13691 |
|
13692 |
|
13693 |
|
13694 |
|
13695 |
|
13696 |
|
13697 |
|
13698 | Object.defineProperty(exports, "__esModule", { value: true });
|
13699 | exports.Corner = exports.CornerBit = exports.numbers = exports.strings = exports.cssClasses = void 0;
|
13700 | var cssClasses = {
|
13701 | ANCHOR: 'mdc-menu-surface--anchor',
|
13702 | ANIMATING_CLOSED: 'mdc-menu-surface--animating-closed',
|
13703 | ANIMATING_OPEN: 'mdc-menu-surface--animating-open',
|
13704 | FIXED: 'mdc-menu-surface--fixed',
|
13705 | IS_OPEN_BELOW: 'mdc-menu-surface--is-open-below',
|
13706 | OPEN: 'mdc-menu-surface--open',
|
13707 | ROOT: 'mdc-menu-surface'
|
13708 | };
|
13709 | exports.cssClasses = cssClasses;
|
13710 |
|
13711 | var strings = {
|
13712 | CLOSED_EVENT: 'MDCMenuSurface:closed',
|
13713 | CLOSING_EVENT: 'MDCMenuSurface:closing',
|
13714 | OPENED_EVENT: 'MDCMenuSurface:opened',
|
13715 | FOCUSABLE_ELEMENTS: ['button:not(:disabled)', '[href]:not([aria-disabled="true"])', 'input:not(:disabled)', 'select:not(:disabled)', 'textarea:not(:disabled)', '[tabindex]:not([tabindex="-1"]):not([aria-disabled="true"])'].join(', ')
|
13716 | };
|
13717 | exports.strings = strings;
|
13718 |
|
13719 | var numbers = {
|
13720 |
|
13721 | TRANSITION_OPEN_DURATION: 120,
|
13722 |
|
13723 | TRANSITION_CLOSE_DURATION: 75,
|
13724 | |
13725 |
|
13726 |
|
13727 |
|
13728 | MARGIN_TO_EDGE: 32,
|
13729 | |
13730 |
|
13731 |
|
13732 |
|
13733 | ANCHOR_TO_MENU_SURFACE_WIDTH_RATIO: 0.67,
|
13734 | |
13735 |
|
13736 |
|
13737 |
|
13738 |
|
13739 |
|
13740 | TOUCH_EVENT_WAIT_MS: 30
|
13741 | };
|
13742 | exports.numbers = numbers;
|
13743 |
|
13744 |
|
13745 |
|
13746 | var CornerBit;
|
13747 | (function (CornerBit) {
|
13748 | CornerBit[CornerBit["BOTTOM"] = 1] = "BOTTOM";
|
13749 | CornerBit[CornerBit["CENTER"] = 2] = "CENTER";
|
13750 | CornerBit[CornerBit["RIGHT"] = 4] = "RIGHT";
|
13751 | CornerBit[CornerBit["FLIP_RTL"] = 8] = "FLIP_RTL";
|
13752 | })(CornerBit || (CornerBit = {}));
|
13753 | exports.CornerBit = CornerBit;
|
13754 |
|
13755 |
|
13756 |
|
13757 |
|
13758 |
|
13759 |
|
13760 |
|
13761 | var Corner;
|
13762 | (function (Corner) {
|
13763 | Corner[Corner["TOP_LEFT"] = 0] = "TOP_LEFT";
|
13764 | Corner[Corner["TOP_RIGHT"] = 4] = "TOP_RIGHT";
|
13765 | Corner[Corner["BOTTOM_LEFT"] = 1] = "BOTTOM_LEFT";
|
13766 | Corner[Corner["BOTTOM_RIGHT"] = 5] = "BOTTOM_RIGHT";
|
13767 | Corner[Corner["TOP_START"] = 8] = "TOP_START";
|
13768 | Corner[Corner["TOP_END"] = 12] = "TOP_END";
|
13769 | Corner[Corner["BOTTOM_START"] = 9] = "BOTTOM_START";
|
13770 | Corner[Corner["BOTTOM_END"] = 13] = "BOTTOM_END";
|
13771 | })(Corner || (Corner = {}));
|
13772 | exports.Corner = Corner;
|
13773 |
|
13774 | }),
|
13775 |
|
13776 | "./packages/mdc-menu-surface/foundation.ts":
|
13777 |
|
13778 |
|
13779 |
|
13780 |
|
13781 | (function(module, exports, __webpack_require__) {
|
13782 |
|
13783 | "use strict";
|
13784 |
|
13785 |
|
13786 |
|
13787 |
|
13788 |
|
13789 |
|
13790 |
|
13791 |
|
13792 |
|
13793 |
|
13794 |
|
13795 |
|
13796 |
|
13797 |
|
13798 |
|
13799 |
|
13800 |
|
13801 |
|
13802 |
|
13803 |
|
13804 |
|
13805 |
|
13806 |
|
13807 |
|
13808 | var __extends = this && this.__extends || function () {
|
13809 | var _extendStatics = function extendStatics(d, b) {
|
13810 | _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
|
13811 | d.__proto__ = b;
|
13812 | } || function (d, b) {
|
13813 | for (var p in b) {
|
13814 | if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
13815 | }
|
13816 | };
|
13817 | return _extendStatics(d, b);
|
13818 | };
|
13819 | return function (d, b) {
|
13820 | if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
13821 | _extendStatics(d, b);
|
13822 | function __() {
|
13823 | this.constructor = d;
|
13824 | }
|
13825 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
13826 | };
|
13827 | }();
|
13828 | var __assign = this && this.__assign || function () {
|
13829 | __assign = Object.assign || function (t) {
|
13830 | for (var s, i = 1, n = arguments.length; i < n; i++) {
|
13831 | s = arguments[i];
|
13832 | for (var p in s) {
|
13833 | if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
13834 | }
|
13835 | }
|
13836 | return t;
|
13837 | };
|
13838 | return __assign.apply(this, arguments);
|
13839 | };
|
13840 | var __values = this && this.__values || function (o) {
|
13841 | var s = typeof Symbol === "function" && Symbol.iterator,
|
13842 | m = s && o[s],
|
13843 | i = 0;
|
13844 | if (m) return m.call(o);
|
13845 | if (o && typeof o.length === "number") return {
|
13846 | next: function next() {
|
13847 | if (o && i >= o.length) o = void 0;
|
13848 | return { value: o && o[i++], done: !o };
|
13849 | }
|
13850 | };
|
13851 | throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
13852 | };
|
13853 | Object.defineProperty(exports, "__esModule", { value: true });
|
13854 | exports.MDCMenuSurfaceFoundation = void 0;
|
13855 | var foundation_1 = __webpack_require__( "./packages/mdc-base/foundation.ts");
|
13856 | var constants_1 = __webpack_require__( "./packages/mdc-menu-surface/constants.ts");
|
13857 | var MDCMenuSurfaceFoundation = function (_super) {
|
13858 | __extends(MDCMenuSurfaceFoundation, _super);
|
13859 | function MDCMenuSurfaceFoundation(adapter) {
|
13860 | var _this = _super.call(this, __assign(__assign({}, MDCMenuSurfaceFoundation.defaultAdapter), adapter)) || this;
|
13861 | _this.isSurfaceOpen = false;
|
13862 | _this.isQuickOpen = false;
|
13863 | _this.isHoistedElement = false;
|
13864 | _this.isFixedPosition = false;
|
13865 | _this.isHorizontallyCenteredOnViewport = false;
|
13866 | _this.maxHeight = 0;
|
13867 | _this.openAnimationEndTimerId = 0;
|
13868 | _this.closeAnimationEndTimerId = 0;
|
13869 | _this.animationRequestId = 0;
|
13870 | _this.anchorCorner = constants_1.Corner.TOP_START;
|
13871 | |
13872 |
|
13873 |
|
13874 |
|
13875 |
|
13876 |
|
13877 |
|
13878 |
|
13879 |
|
13880 |
|
13881 |
|
13882 |
|
13883 |
|
13884 |
|
13885 | _this.originCorner = constants_1.Corner.TOP_START;
|
13886 | _this.anchorMargin = { top: 0, right: 0, bottom: 0, left: 0 };
|
13887 | _this.position = { x: 0, y: 0 };
|
13888 | return _this;
|
13889 | }
|
13890 | Object.defineProperty(MDCMenuSurfaceFoundation, "cssClasses", {
|
13891 | get: function get() {
|
13892 | return constants_1.cssClasses;
|
13893 | },
|
13894 | enumerable: false,
|
13895 | configurable: true
|
13896 | });
|
13897 | Object.defineProperty(MDCMenuSurfaceFoundation, "strings", {
|
13898 | get: function get() {
|
13899 | return constants_1.strings;
|
13900 | },
|
13901 | enumerable: false,
|
13902 | configurable: true
|
13903 | });
|
13904 | Object.defineProperty(MDCMenuSurfaceFoundation, "numbers", {
|
13905 | get: function get() {
|
13906 | return constants_1.numbers;
|
13907 | },
|
13908 | enumerable: false,
|
13909 | configurable: true
|
13910 | });
|
13911 | Object.defineProperty(MDCMenuSurfaceFoundation, "Corner", {
|
13912 | get: function get() {
|
13913 | return constants_1.Corner;
|
13914 | },
|
13915 | enumerable: false,
|
13916 | configurable: true
|
13917 | });
|
13918 | Object.defineProperty(MDCMenuSurfaceFoundation, "defaultAdapter", {
|
13919 | |
13920 |
|
13921 |
|
13922 | get: function get() {
|
13923 |
|
13924 | return {
|
13925 | addClass: function addClass() {
|
13926 | return undefined;
|
13927 | },
|
13928 | removeClass: function removeClass() {
|
13929 | return undefined;
|
13930 | },
|
13931 | hasClass: function hasClass() {
|
13932 | return false;
|
13933 | },
|
13934 | hasAnchor: function hasAnchor() {
|
13935 | return false;
|
13936 | },
|
13937 | isElementInContainer: function isElementInContainer() {
|
13938 | return false;
|
13939 | },
|
13940 | isFocused: function isFocused() {
|
13941 | return false;
|
13942 | },
|
13943 | isRtl: function isRtl() {
|
13944 | return false;
|
13945 | },
|
13946 | getInnerDimensions: function getInnerDimensions() {
|
13947 | return { height: 0, width: 0 };
|
13948 | },
|
13949 | getAnchorDimensions: function getAnchorDimensions() {
|
13950 | return null;
|
13951 | },
|
13952 | getWindowDimensions: function getWindowDimensions() {
|
13953 | return { height: 0, width: 0 };
|
13954 | },
|
13955 | getBodyDimensions: function getBodyDimensions() {
|
13956 | return { height: 0, width: 0 };
|
13957 | },
|
13958 | getWindowScroll: function getWindowScroll() {
|
13959 | return { x: 0, y: 0 };
|
13960 | },
|
13961 | setPosition: function setPosition() {
|
13962 | return undefined;
|
13963 | },
|
13964 | setMaxHeight: function setMaxHeight() {
|
13965 | return undefined;
|
13966 | },
|
13967 | setTransformOrigin: function setTransformOrigin() {
|
13968 | return undefined;
|
13969 | },
|
13970 | saveFocus: function saveFocus() {
|
13971 | return undefined;
|
13972 | },
|
13973 | restoreFocus: function restoreFocus() {
|
13974 | return undefined;
|
13975 | },
|
13976 | notifyClose: function notifyClose() {
|
13977 | return undefined;
|
13978 | },
|
13979 | notifyOpen: function notifyOpen() {
|
13980 | return undefined;
|
13981 | },
|
13982 | notifyClosing: function notifyClosing() {
|
13983 | return undefined;
|
13984 | }
|
13985 | };
|
13986 |
|
13987 | },
|
13988 | enumerable: false,
|
13989 | configurable: true
|
13990 | });
|
13991 | MDCMenuSurfaceFoundation.prototype.init = function () {
|
13992 | var _a = MDCMenuSurfaceFoundation.cssClasses,
|
13993 | ROOT = _a.ROOT,
|
13994 | OPEN = _a.OPEN;
|
13995 | if (!this.adapter.hasClass(ROOT)) {
|
13996 | throw new Error(ROOT + " class required in root element.");
|
13997 | }
|
13998 | if (this.adapter.hasClass(OPEN)) {
|
13999 | this.isSurfaceOpen = true;
|
14000 | }
|
14001 | };
|
14002 | MDCMenuSurfaceFoundation.prototype.destroy = function () {
|
14003 | clearTimeout(this.openAnimationEndTimerId);
|
14004 | clearTimeout(this.closeAnimationEndTimerId);
|
14005 |
|
14006 | cancelAnimationFrame(this.animationRequestId);
|
14007 | };
|
14008 | |
14009 |
|
14010 |
|
14011 |
|
14012 | MDCMenuSurfaceFoundation.prototype.setAnchorCorner = function (corner) {
|
14013 | this.anchorCorner = corner;
|
14014 | };
|
14015 | |
14016 |
|
14017 |
|
14018 | MDCMenuSurfaceFoundation.prototype.flipCornerHorizontally = function () {
|
14019 | this.originCorner = this.originCorner ^ constants_1.CornerBit.RIGHT;
|
14020 | };
|
14021 | |
14022 |
|
14023 |
|
14024 | MDCMenuSurfaceFoundation.prototype.setAnchorMargin = function (margin) {
|
14025 | this.anchorMargin.top = margin.top || 0;
|
14026 | this.anchorMargin.right = margin.right || 0;
|
14027 | this.anchorMargin.bottom = margin.bottom || 0;
|
14028 | this.anchorMargin.left = margin.left || 0;
|
14029 | };
|
14030 |
|
14031 | MDCMenuSurfaceFoundation.prototype.setIsHoisted = function (isHoisted) {
|
14032 | this.isHoistedElement = isHoisted;
|
14033 | };
|
14034 | |
14035 |
|
14036 |
|
14037 | MDCMenuSurfaceFoundation.prototype.setFixedPosition = function (isFixedPosition) {
|
14038 | this.isFixedPosition = isFixedPosition;
|
14039 | };
|
14040 | |
14041 |
|
14042 |
|
14043 | MDCMenuSurfaceFoundation.prototype.isFixed = function () {
|
14044 | return this.isFixedPosition;
|
14045 | };
|
14046 |
|
14047 | MDCMenuSurfaceFoundation.prototype.setAbsolutePosition = function (x, y) {
|
14048 | this.position.x = this.isFinite(x) ? x : 0;
|
14049 | this.position.y = this.isFinite(y) ? y : 0;
|
14050 | };
|
14051 |
|
14052 | MDCMenuSurfaceFoundation.prototype.setIsHorizontallyCenteredOnViewport = function (isCentered) {
|
14053 | this.isHorizontallyCenteredOnViewport = isCentered;
|
14054 | };
|
14055 | MDCMenuSurfaceFoundation.prototype.setQuickOpen = function (quickOpen) {
|
14056 | this.isQuickOpen = quickOpen;
|
14057 | };
|
14058 | |
14059 |
|
14060 |
|
14061 |
|
14062 |
|
14063 | MDCMenuSurfaceFoundation.prototype.setMaxHeight = function (maxHeight) {
|
14064 | this.maxHeight = maxHeight;
|
14065 | };
|
14066 | MDCMenuSurfaceFoundation.prototype.isOpen = function () {
|
14067 | return this.isSurfaceOpen;
|
14068 | };
|
14069 | |
14070 |
|
14071 |
|
14072 | MDCMenuSurfaceFoundation.prototype.open = function () {
|
14073 | var _this = this;
|
14074 | if (this.isSurfaceOpen) {
|
14075 | return;
|
14076 | }
|
14077 | this.adapter.saveFocus();
|
14078 | if (this.isQuickOpen) {
|
14079 | this.isSurfaceOpen = true;
|
14080 | this.adapter.addClass(MDCMenuSurfaceFoundation.cssClasses.OPEN);
|
14081 | this.dimensions = this.adapter.getInnerDimensions();
|
14082 | this.autoposition();
|
14083 | this.adapter.notifyOpen();
|
14084 | } else {
|
14085 | this.adapter.addClass(MDCMenuSurfaceFoundation.cssClasses.ANIMATING_OPEN);
|
14086 | this.animationRequestId = requestAnimationFrame(function () {
|
14087 | _this.dimensions = _this.adapter.getInnerDimensions();
|
14088 | _this.autoposition();
|
14089 | _this.adapter.addClass(MDCMenuSurfaceFoundation.cssClasses.OPEN);
|
14090 | _this.openAnimationEndTimerId = setTimeout(function () {
|
14091 | _this.openAnimationEndTimerId = 0;
|
14092 | _this.adapter.removeClass(MDCMenuSurfaceFoundation.cssClasses.ANIMATING_OPEN);
|
14093 | _this.adapter.notifyOpen();
|
14094 | }, constants_1.numbers.TRANSITION_OPEN_DURATION);
|
14095 | });
|
14096 | this.isSurfaceOpen = true;
|
14097 | }
|
14098 | };
|
14099 | |
14100 |
|
14101 |
|
14102 | MDCMenuSurfaceFoundation.prototype.close = function (skipRestoreFocus) {
|
14103 | var _this = this;
|
14104 | if (skipRestoreFocus === void 0) {
|
14105 | skipRestoreFocus = false;
|
14106 | }
|
14107 | if (!this.isSurfaceOpen) {
|
14108 | return;
|
14109 | }
|
14110 | this.adapter.notifyClosing();
|
14111 | if (this.isQuickOpen) {
|
14112 | this.isSurfaceOpen = false;
|
14113 | if (!skipRestoreFocus) {
|
14114 | this.maybeRestoreFocus();
|
14115 | }
|
14116 | this.adapter.removeClass(MDCMenuSurfaceFoundation.cssClasses.OPEN);
|
14117 | this.adapter.removeClass(MDCMenuSurfaceFoundation.cssClasses.IS_OPEN_BELOW);
|
14118 | this.adapter.notifyClose();
|
14119 | return;
|
14120 | }
|
14121 | this.adapter.addClass(MDCMenuSurfaceFoundation.cssClasses.ANIMATING_CLOSED);
|
14122 | requestAnimationFrame(function () {
|
14123 | _this.adapter.removeClass(MDCMenuSurfaceFoundation.cssClasses.OPEN);
|
14124 | _this.adapter.removeClass(MDCMenuSurfaceFoundation.cssClasses.IS_OPEN_BELOW);
|
14125 | _this.closeAnimationEndTimerId = setTimeout(function () {
|
14126 | _this.closeAnimationEndTimerId = 0;
|
14127 | _this.adapter.removeClass(MDCMenuSurfaceFoundation.cssClasses.ANIMATING_CLOSED);
|
14128 | _this.adapter.notifyClose();
|
14129 | }, constants_1.numbers.TRANSITION_CLOSE_DURATION);
|
14130 | });
|
14131 | this.isSurfaceOpen = false;
|
14132 | if (!skipRestoreFocus) {
|
14133 | this.maybeRestoreFocus();
|
14134 | }
|
14135 | };
|
14136 |
|
14137 | MDCMenuSurfaceFoundation.prototype.handleBodyClick = function (evt) {
|
14138 | var el = evt.target;
|
14139 | if (this.adapter.isElementInContainer(el)) {
|
14140 | return;
|
14141 | }
|
14142 | this.close();
|
14143 | };
|
14144 |
|
14145 | MDCMenuSurfaceFoundation.prototype.handleKeydown = function (evt) {
|
14146 | var keyCode = evt.keyCode,
|
14147 | key = evt.key;
|
14148 | var isEscape = key === 'Escape' || keyCode === 27;
|
14149 | if (isEscape) {
|
14150 | this.close();
|
14151 | }
|
14152 | };
|
14153 | MDCMenuSurfaceFoundation.prototype.autoposition = function () {
|
14154 | var _a;
|
14155 |
|
14156 | this.measurements = this.getAutoLayoutmeasurements();
|
14157 | var corner = this.getoriginCorner();
|
14158 | var maxMenuSurfaceHeight = this.getMenuSurfaceMaxHeight(corner);
|
14159 | var verticalAlignment = this.hasBit(corner, constants_1.CornerBit.BOTTOM) ? 'bottom' : 'top';
|
14160 | var horizontalAlignment = this.hasBit(corner, constants_1.CornerBit.RIGHT) ? 'right' : 'left';
|
14161 | var horizontalOffset = this.getHorizontalOriginOffset(corner);
|
14162 | var verticalOffset = this.getVerticalOriginOffset(corner);
|
14163 | var _b = this.measurements,
|
14164 | anchorSize = _b.anchorSize,
|
14165 | surfaceSize = _b.surfaceSize;
|
14166 | var position = (_a = {}, _a[horizontalAlignment] = horizontalOffset, _a[verticalAlignment] = verticalOffset, _a);
|
14167 |
|
14168 |
|
14169 | if (anchorSize.width / surfaceSize.width > constants_1.numbers.ANCHOR_TO_MENU_SURFACE_WIDTH_RATIO) {
|
14170 | horizontalAlignment = 'center';
|
14171 | }
|
14172 |
|
14173 |
|
14174 | if (this.isHoistedElement || this.isFixedPosition) {
|
14175 | this.adjustPositionForHoistedElement(position);
|
14176 | }
|
14177 | this.adapter.setTransformOrigin(horizontalAlignment + " " + verticalAlignment);
|
14178 | this.adapter.setPosition(position);
|
14179 | this.adapter.setMaxHeight(maxMenuSurfaceHeight ? maxMenuSurfaceHeight + 'px' : '');
|
14180 |
|
14181 | if (!this.hasBit(corner, constants_1.CornerBit.BOTTOM)) {
|
14182 | this.adapter.addClass(MDCMenuSurfaceFoundation.cssClasses.IS_OPEN_BELOW);
|
14183 | }
|
14184 | };
|
14185 | |
14186 |
|
14187 |
|
14188 | MDCMenuSurfaceFoundation.prototype.getAutoLayoutmeasurements = function () {
|
14189 | var anchorRect = this.adapter.getAnchorDimensions();
|
14190 | var bodySize = this.adapter.getBodyDimensions();
|
14191 | var viewportSize = this.adapter.getWindowDimensions();
|
14192 | var windowScroll = this.adapter.getWindowScroll();
|
14193 | if (!anchorRect) {
|
14194 |
|
14195 | anchorRect = {
|
14196 | top: this.position.y,
|
14197 | right: this.position.x,
|
14198 | bottom: this.position.y,
|
14199 | left: this.position.x,
|
14200 | width: 0,
|
14201 | height: 0
|
14202 | };
|
14203 |
|
14204 | }
|
14205 | return {
|
14206 | anchorSize: anchorRect,
|
14207 | bodySize: bodySize,
|
14208 | surfaceSize: this.dimensions,
|
14209 | viewportDistance: {
|
14210 |
|
14211 | top: anchorRect.top,
|
14212 | right: viewportSize.width - anchorRect.right,
|
14213 | bottom: viewportSize.height - anchorRect.bottom,
|
14214 | left: anchorRect.left
|
14215 | },
|
14216 | viewportSize: viewportSize,
|
14217 | windowScroll: windowScroll
|
14218 | };
|
14219 | };
|
14220 | |
14221 |
|
14222 |
|
14223 |
|
14224 |
|
14225 |
|
14226 |
|
14227 | MDCMenuSurfaceFoundation.prototype.getoriginCorner = function () {
|
14228 | var corner = this.originCorner;
|
14229 | var _a = this.measurements,
|
14230 | viewportDistance = _a.viewportDistance,
|
14231 | anchorSize = _a.anchorSize,
|
14232 | surfaceSize = _a.surfaceSize;
|
14233 | var MARGIN_TO_EDGE = MDCMenuSurfaceFoundation.numbers.MARGIN_TO_EDGE;
|
14234 | var isAnchoredToBottom = this.hasBit(this.anchorCorner, constants_1.CornerBit.BOTTOM);
|
14235 | var availableTop;
|
14236 | var availableBottom;
|
14237 | if (isAnchoredToBottom) {
|
14238 | availableTop = viewportDistance.top - MARGIN_TO_EDGE + this.anchorMargin.bottom;
|
14239 | availableBottom = viewportDistance.bottom - MARGIN_TO_EDGE - this.anchorMargin.bottom;
|
14240 | } else {
|
14241 | availableTop = viewportDistance.top - MARGIN_TO_EDGE + this.anchorMargin.top;
|
14242 | availableBottom = viewportDistance.bottom - MARGIN_TO_EDGE + anchorSize.height - this.anchorMargin.top;
|
14243 | }
|
14244 | var isAvailableBottom = availableBottom - surfaceSize.height > 0;
|
14245 | if (!isAvailableBottom && availableTop > availableBottom) {
|
14246 |
|
14247 | corner = this.setBit(corner, constants_1.CornerBit.BOTTOM);
|
14248 | }
|
14249 | var isRtl = this.adapter.isRtl();
|
14250 | var isFlipRtl = this.hasBit(this.anchorCorner, constants_1.CornerBit.FLIP_RTL);
|
14251 | var hasRightBit = this.hasBit(this.anchorCorner, constants_1.CornerBit.RIGHT) || this.hasBit(corner, constants_1.CornerBit.RIGHT);
|
14252 |
|
14253 | var isAnchoredToRight = false;
|
14254 |
|
14255 | if (isRtl && isFlipRtl) {
|
14256 | isAnchoredToRight = !hasRightBit;
|
14257 | } else {
|
14258 |
|
14259 | isAnchoredToRight = hasRightBit;
|
14260 | }
|
14261 | var availableLeft;
|
14262 | var availableRight;
|
14263 | if (isAnchoredToRight) {
|
14264 | availableLeft = viewportDistance.left + anchorSize.width + this.anchorMargin.right;
|
14265 | availableRight = viewportDistance.right - this.anchorMargin.right;
|
14266 | } else {
|
14267 | availableLeft = viewportDistance.left + this.anchorMargin.left;
|
14268 | availableRight = viewportDistance.right + anchorSize.width - this.anchorMargin.left;
|
14269 | }
|
14270 | var isAvailableLeft = availableLeft - surfaceSize.width > 0;
|
14271 | var isAvailableRight = availableRight - surfaceSize.width > 0;
|
14272 | var isOriginCornerAlignedToEnd = this.hasBit(corner, constants_1.CornerBit.FLIP_RTL) && this.hasBit(corner, constants_1.CornerBit.RIGHT);
|
14273 | if (isAvailableRight && isOriginCornerAlignedToEnd && isRtl || !isAvailableLeft && isOriginCornerAlignedToEnd) {
|
14274 |
|
14275 | corner = this.unsetBit(corner, constants_1.CornerBit.RIGHT);
|
14276 | } else if (isAvailableLeft && isAnchoredToRight && isRtl || isAvailableLeft && !isAnchoredToRight && hasRightBit || !isAvailableRight && availableLeft >= availableRight) {
|
14277 |
|
14278 | corner = this.setBit(corner, constants_1.CornerBit.RIGHT);
|
14279 | }
|
14280 | return corner;
|
14281 | };
|
14282 | |
14283 |
|
14284 |
|
14285 |
|
14286 |
|
14287 | MDCMenuSurfaceFoundation.prototype.getMenuSurfaceMaxHeight = function (corner) {
|
14288 | if (this.maxHeight > 0) {
|
14289 | return this.maxHeight;
|
14290 | }
|
14291 | var viewportDistance = this.measurements.viewportDistance;
|
14292 | var maxHeight = 0;
|
14293 | var isBottomAligned = this.hasBit(corner, constants_1.CornerBit.BOTTOM);
|
14294 | var isBottomAnchored = this.hasBit(this.anchorCorner, constants_1.CornerBit.BOTTOM);
|
14295 | var MARGIN_TO_EDGE = MDCMenuSurfaceFoundation.numbers.MARGIN_TO_EDGE;
|
14296 |
|
14297 | if (isBottomAligned) {
|
14298 | maxHeight = viewportDistance.top + this.anchorMargin.top - MARGIN_TO_EDGE;
|
14299 | if (!isBottomAnchored) {
|
14300 | maxHeight += this.measurements.anchorSize.height;
|
14301 | }
|
14302 | } else {
|
14303 | maxHeight = viewportDistance.bottom - this.anchorMargin.bottom + this.measurements.anchorSize.height - MARGIN_TO_EDGE;
|
14304 | if (isBottomAnchored) {
|
14305 | maxHeight -= this.measurements.anchorSize.height;
|
14306 | }
|
14307 | }
|
14308 | return maxHeight;
|
14309 | };
|
14310 | |
14311 |
|
14312 |
|
14313 |
|
14314 |
|
14315 | MDCMenuSurfaceFoundation.prototype.getHorizontalOriginOffset = function (corner) {
|
14316 | var anchorSize = this.measurements.anchorSize;
|
14317 |
|
14318 | var isRightAligned = this.hasBit(corner, constants_1.CornerBit.RIGHT);
|
14319 | var avoidHorizontalOverlap = this.hasBit(this.anchorCorner, constants_1.CornerBit.RIGHT);
|
14320 | if (isRightAligned) {
|
14321 | var rightOffset = avoidHorizontalOverlap ? anchorSize.width - this.anchorMargin.left : this.anchorMargin.right;
|
14322 |
|
14323 |
|
14324 |
|
14325 |
|
14326 | if (this.isHoistedElement || this.isFixedPosition) {
|
14327 | return rightOffset - (this.measurements.viewportSize.width - this.measurements.bodySize.width);
|
14328 | }
|
14329 | return rightOffset;
|
14330 | }
|
14331 | return avoidHorizontalOverlap ? anchorSize.width - this.anchorMargin.right : this.anchorMargin.left;
|
14332 | };
|
14333 | |
14334 |
|
14335 |
|
14336 |
|
14337 |
|
14338 | MDCMenuSurfaceFoundation.prototype.getVerticalOriginOffset = function (corner) {
|
14339 | var anchorSize = this.measurements.anchorSize;
|
14340 | var isBottomAligned = this.hasBit(corner, constants_1.CornerBit.BOTTOM);
|
14341 | var avoidVerticalOverlap = this.hasBit(this.anchorCorner, constants_1.CornerBit.BOTTOM);
|
14342 | var y = 0;
|
14343 | if (isBottomAligned) {
|
14344 | y = avoidVerticalOverlap ? anchorSize.height - this.anchorMargin.top : -this.anchorMargin.bottom;
|
14345 | } else {
|
14346 | y = avoidVerticalOverlap ? anchorSize.height + this.anchorMargin.bottom : this.anchorMargin.top;
|
14347 | }
|
14348 | return y;
|
14349 | };
|
14350 | |
14351 |
|
14352 |
|
14353 |
|
14354 | MDCMenuSurfaceFoundation.prototype.adjustPositionForHoistedElement = function (position) {
|
14355 | var e_1, _a;
|
14356 | var _b = this.measurements,
|
14357 | windowScroll = _b.windowScroll,
|
14358 | viewportDistance = _b.viewportDistance,
|
14359 | surfaceSize = _b.surfaceSize,
|
14360 | viewportSize = _b.viewportSize;
|
14361 | var props = Object.keys(position);
|
14362 | try {
|
14363 | for (var props_1 = __values(props), props_1_1 = props_1.next(); !props_1_1.done; props_1_1 = props_1.next()) {
|
14364 | var prop = props_1_1.value;
|
14365 | var value = position[prop] || 0;
|
14366 | if (this.isHorizontallyCenteredOnViewport && (prop === 'left' || prop === 'right')) {
|
14367 | position[prop] = (viewportSize.width - surfaceSize.width) / 2;
|
14368 | continue;
|
14369 | }
|
14370 |
|
14371 |
|
14372 | value += viewportDistance[prop];
|
14373 |
|
14374 |
|
14375 | if (!this.isFixedPosition) {
|
14376 | if (prop === 'top') {
|
14377 | value += windowScroll.y;
|
14378 | } else if (prop === 'bottom') {
|
14379 | value -= windowScroll.y;
|
14380 | } else if (prop === 'left') {
|
14381 | value += windowScroll.x;
|
14382 | } else {
|
14383 |
|
14384 | value -= windowScroll.x;
|
14385 | }
|
14386 | }
|
14387 | position[prop] = value;
|
14388 | }
|
14389 | } catch (e_1_1) {
|
14390 | e_1 = { error: e_1_1 };
|
14391 | } finally {
|
14392 | try {
|
14393 | if (props_1_1 && !props_1_1.done && (_a = props_1.return)) _a.call(props_1);
|
14394 | } finally {
|
14395 | if (e_1) throw e_1.error;
|
14396 | }
|
14397 | }
|
14398 | };
|
14399 | |
14400 |
|
14401 |
|
14402 |
|
14403 |
|
14404 | MDCMenuSurfaceFoundation.prototype.maybeRestoreFocus = function () {
|
14405 | var _this = this;
|
14406 | var isRootFocused = this.adapter.isFocused();
|
14407 | var childHasFocus = document.activeElement && this.adapter.isElementInContainer(document.activeElement);
|
14408 | if (isRootFocused || childHasFocus) {
|
14409 |
|
14410 |
|
14411 |
|
14412 |
|
14413 | setTimeout(function () {
|
14414 | _this.adapter.restoreFocus();
|
14415 | }, constants_1.numbers.TOUCH_EVENT_WAIT_MS);
|
14416 | }
|
14417 | };
|
14418 | MDCMenuSurfaceFoundation.prototype.hasBit = function (corner, bit) {
|
14419 | return Boolean(corner & bit);
|
14420 | };
|
14421 | MDCMenuSurfaceFoundation.prototype.setBit = function (corner, bit) {
|
14422 | return corner | bit;
|
14423 | };
|
14424 | MDCMenuSurfaceFoundation.prototype.unsetBit = function (corner, bit) {
|
14425 | return corner ^ bit;
|
14426 | };
|
14427 | |
14428 |
|
14429 |
|
14430 |
|
14431 | MDCMenuSurfaceFoundation.prototype.isFinite = function (num) {
|
14432 | return typeof num === 'number' && isFinite(num);
|
14433 | };
|
14434 | return MDCMenuSurfaceFoundation;
|
14435 | }(foundation_1.MDCFoundation);
|
14436 | exports.MDCMenuSurfaceFoundation = MDCMenuSurfaceFoundation;
|
14437 |
|
14438 | exports.default = MDCMenuSurfaceFoundation;
|
14439 |
|
14440 | }),
|
14441 |
|
14442 | "./packages/mdc-menu-surface/index.ts":
|
14443 |
|
14444 |
|
14445 |
|
14446 |
|
14447 | (function(module, exports, __webpack_require__) {
|
14448 |
|
14449 | "use strict";
|
14450 |
|
14451 |
|
14452 |
|
14453 |
|
14454 |
|
14455 |
|
14456 |
|
14457 |
|
14458 |
|
14459 |
|
14460 |
|
14461 |
|
14462 |
|
14463 |
|
14464 |
|
14465 |
|
14466 |
|
14467 |
|
14468 |
|
14469 |
|
14470 |
|
14471 |
|
14472 |
|
14473 |
|
14474 | var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
|
14475 | if (k2 === undefined) k2 = k;
|
14476 | Object.defineProperty(o, k2, { enumerable: true, get: function get() {
|
14477 | return m[k];
|
14478 | } });
|
14479 | } : function (o, m, k, k2) {
|
14480 | if (k2 === undefined) k2 = k;
|
14481 | o[k2] = m[k];
|
14482 | });
|
14483 | var __exportStar = this && this.__exportStar || function (m, exports) {
|
14484 | for (var p in m) {
|
14485 | if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
14486 | }
|
14487 | };
|
14488 | Object.defineProperty(exports, "__esModule", { value: true });
|
14489 | __exportStar(__webpack_require__( "./packages/mdc-menu-surface/adapter.ts"), exports);
|
14490 | __exportStar(__webpack_require__( "./packages/mdc-menu-surface/component.ts"), exports);
|
14491 | __exportStar(__webpack_require__( "./packages/mdc-menu-surface/constants.ts"), exports);
|
14492 | __exportStar(__webpack_require__( "./packages/mdc-menu-surface/foundation.ts"), exports);
|
14493 | __exportStar(__webpack_require__( "./packages/mdc-menu-surface/types.ts"), exports);
|
14494 |
|
14495 | }),
|
14496 |
|
14497 | "./packages/mdc-menu-surface/types.ts":
|
14498 |
|
14499 |
|
14500 |
|
14501 |
|
14502 | (function(module, exports, __webpack_require__) {
|
14503 |
|
14504 | "use strict";
|
14505 |
|
14506 |
|
14507 |
|
14508 |
|
14509 |
|
14510 |
|
14511 |
|
14512 |
|
14513 |
|
14514 |
|
14515 |
|
14516 |
|
14517 |
|
14518 |
|
14519 |
|
14520 |
|
14521 |
|
14522 |
|
14523 |
|
14524 |
|
14525 |
|
14526 |
|
14527 |
|
14528 |
|
14529 | Object.defineProperty(exports, "__esModule", { value: true });
|
14530 |
|
14531 | }),
|
14532 |
|
14533 | "./packages/mdc-menu/adapter.ts":
|
14534 |
|
14535 |
|
14536 |
|
14537 |
|
14538 | (function(module, exports, __webpack_require__) {
|
14539 |
|
14540 | "use strict";
|
14541 |
|
14542 |
|
14543 |
|
14544 |
|
14545 |
|
14546 |
|
14547 |
|
14548 |
|
14549 |
|
14550 |
|
14551 |
|
14552 |
|
14553 |
|
14554 |
|
14555 |
|
14556 |
|
14557 |
|
14558 |
|
14559 |
|
14560 |
|
14561 |
|
14562 |
|
14563 |
|
14564 |
|
14565 | Object.defineProperty(exports, "__esModule", { value: true });
|
14566 |
|
14567 | }),
|
14568 |
|
14569 | "./packages/mdc-menu/component.ts":
|
14570 |
|
14571 |
|
14572 |
|
14573 |
|
14574 | (function(module, exports, __webpack_require__) {
|
14575 |
|
14576 | "use strict";
|
14577 |
|
14578 |
|
14579 |
|
14580 |
|
14581 |
|
14582 |
|
14583 |
|
14584 |
|
14585 |
|
14586 |
|
14587 |
|
14588 |
|
14589 |
|
14590 |
|
14591 |
|
14592 |
|
14593 |
|
14594 |
|
14595 |
|
14596 |
|
14597 |
|
14598 |
|
14599 |
|
14600 |
|
14601 | var __extends = this && this.__extends || function () {
|
14602 | var _extendStatics = function extendStatics(d, b) {
|
14603 | _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
|
14604 | d.__proto__ = b;
|
14605 | } || function (d, b) {
|
14606 | for (var p in b) {
|
14607 | if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
14608 | }
|
14609 | };
|
14610 | return _extendStatics(d, b);
|
14611 | };
|
14612 | return function (d, b) {
|
14613 | if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
14614 | _extendStatics(d, b);
|
14615 | function __() {
|
14616 | this.constructor = d;
|
14617 | }
|
14618 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
14619 | };
|
14620 | }();
|
14621 | Object.defineProperty(exports, "__esModule", { value: true });
|
14622 | exports.MDCMenu = void 0;
|
14623 | var component_1 = __webpack_require__( "./packages/mdc-base/component.ts");
|
14624 | var ponyfill_1 = __webpack_require__( "./packages/mdc-dom/ponyfill.ts");
|
14625 | var component_2 = __webpack_require__( "./packages/mdc-list/component.ts");
|
14626 | var constants_1 = __webpack_require__( "./packages/mdc-list/constants.ts");
|
14627 | var foundation_1 = __webpack_require__( "./packages/mdc-list/foundation.ts");
|
14628 | var component_3 = __webpack_require__( "./packages/mdc-menu-surface/component.ts");
|
14629 | var foundation_2 = __webpack_require__( "./packages/mdc-menu-surface/foundation.ts");
|
14630 | var constants_2 = __webpack_require__( "./packages/mdc-menu/constants.ts");
|
14631 | var foundation_3 = __webpack_require__( "./packages/mdc-menu/foundation.ts");
|
14632 | var MDCMenu = function (_super) {
|
14633 | __extends(MDCMenu, _super);
|
14634 | function MDCMenu() {
|
14635 | return _super !== null && _super.apply(this, arguments) || this;
|
14636 | }
|
14637 | MDCMenu.attachTo = function (root) {
|
14638 | return new MDCMenu(root);
|
14639 | };
|
14640 | MDCMenu.prototype.initialize = function (menuSurfaceFactory, listFactory) {
|
14641 | if (menuSurfaceFactory === void 0) {
|
14642 | menuSurfaceFactory = function menuSurfaceFactory(el) {
|
14643 | return new component_3.MDCMenuSurface(el);
|
14644 | };
|
14645 | }
|
14646 | if (listFactory === void 0) {
|
14647 | listFactory = function listFactory(el) {
|
14648 | return new component_2.MDCList(el);
|
14649 | };
|
14650 | }
|
14651 | this.menuSurfaceFactory = menuSurfaceFactory;
|
14652 | this.listFactory = listFactory;
|
14653 | };
|
14654 | MDCMenu.prototype.initialSyncWithDOM = function () {
|
14655 | var _this = this;
|
14656 | this.menuSurface = this.menuSurfaceFactory(this.root);
|
14657 | var list = this.root.querySelector(constants_2.strings.LIST_SELECTOR);
|
14658 | if (list) {
|
14659 | this.list = this.listFactory(list);
|
14660 | this.list.wrapFocus = true;
|
14661 | } else {
|
14662 | this.list = null;
|
14663 | }
|
14664 | this.handleKeydown = function (evt) {
|
14665 | _this.foundation.handleKeydown(evt);
|
14666 | };
|
14667 | this.handleItemAction = function (evt) {
|
14668 | _this.foundation.handleItemAction(_this.items[evt.detail.index]);
|
14669 | };
|
14670 | this.handleMenuSurfaceOpened = function () {
|
14671 | _this.foundation.handleMenuSurfaceOpened();
|
14672 | };
|
14673 | this.menuSurface.listen(foundation_2.MDCMenuSurfaceFoundation.strings.OPENED_EVENT, this.handleMenuSurfaceOpened);
|
14674 | this.listen('keydown', this.handleKeydown);
|
14675 | this.listen(foundation_1.MDCListFoundation.strings.ACTION_EVENT, this.handleItemAction);
|
14676 | };
|
14677 | MDCMenu.prototype.destroy = function () {
|
14678 | if (this.list) {
|
14679 | this.list.destroy();
|
14680 | }
|
14681 | this.menuSurface.destroy();
|
14682 | this.menuSurface.unlisten(foundation_2.MDCMenuSurfaceFoundation.strings.OPENED_EVENT, this.handleMenuSurfaceOpened);
|
14683 | this.unlisten('keydown', this.handleKeydown);
|
14684 | this.unlisten(foundation_1.MDCListFoundation.strings.ACTION_EVENT, this.handleItemAction);
|
14685 | _super.prototype.destroy.call(this);
|
14686 | };
|
14687 | Object.defineProperty(MDCMenu.prototype, "open", {
|
14688 | get: function get() {
|
14689 | return this.menuSurface.isOpen();
|
14690 | },
|
14691 | set: function set(value) {
|
14692 | if (value) {
|
14693 | this.menuSurface.open();
|
14694 | } else {
|
14695 | this.menuSurface.close();
|
14696 | }
|
14697 | },
|
14698 | enumerable: false,
|
14699 | configurable: true
|
14700 | });
|
14701 | Object.defineProperty(MDCMenu.prototype, "wrapFocus", {
|
14702 | get: function get() {
|
14703 | return this.list ? this.list.wrapFocus : false;
|
14704 | },
|
14705 | set: function set(value) {
|
14706 | if (this.list) {
|
14707 | this.list.wrapFocus = value;
|
14708 | }
|
14709 | },
|
14710 | enumerable: false,
|
14711 | configurable: true
|
14712 | });
|
14713 | Object.defineProperty(MDCMenu.prototype, "hasTypeahead", {
|
14714 | |
14715 |
|
14716 |
|
14717 |
|
14718 | set: function set(value) {
|
14719 | if (this.list) {
|
14720 | this.list.hasTypeahead = value;
|
14721 | }
|
14722 | },
|
14723 | enumerable: false,
|
14724 | configurable: true
|
14725 | });
|
14726 | Object.defineProperty(MDCMenu.prototype, "typeaheadInProgress", {
|
14727 | |
14728 |
|
14729 |
|
14730 | get: function get() {
|
14731 | return this.list ? this.list.typeaheadInProgress : false;
|
14732 | },
|
14733 | enumerable: false,
|
14734 | configurable: true
|
14735 | });
|
14736 | |
14737 |
|
14738 |
|
14739 |
|
14740 |
|
14741 |
|
14742 |
|
14743 |
|
14744 |
|
14745 |
|
14746 |
|
14747 |
|
14748 |
|
14749 | MDCMenu.prototype.typeaheadMatchItem = function (nextChar, startingIndex) {
|
14750 | if (this.list) {
|
14751 | return this.list.typeaheadMatchItem(nextChar, startingIndex);
|
14752 | }
|
14753 | return -1;
|
14754 | };
|
14755 | |
14756 |
|
14757 |
|
14758 |
|
14759 | MDCMenu.prototype.layout = function () {
|
14760 | if (this.list) {
|
14761 | this.list.layout();
|
14762 | }
|
14763 | };
|
14764 | Object.defineProperty(MDCMenu.prototype, "items", {
|
14765 | |
14766 |
|
14767 |
|
14768 |
|
14769 |
|
14770 | get: function get() {
|
14771 | return this.list ? this.list.listElements : [];
|
14772 | },
|
14773 | enumerable: false,
|
14774 | configurable: true
|
14775 | });
|
14776 | Object.defineProperty(MDCMenu.prototype, "singleSelection", {
|
14777 | |
14778 |
|
14779 |
|
14780 |
|
14781 |
|
14782 |
|
14783 | set: function set(singleSelection) {
|
14784 | if (this.list) {
|
14785 | this.list.singleSelection = singleSelection;
|
14786 | }
|
14787 | },
|
14788 | enumerable: false,
|
14789 | configurable: true
|
14790 | });
|
14791 | Object.defineProperty(MDCMenu.prototype, "selectedIndex", {
|
14792 | |
14793 |
|
14794 |
|
14795 |
|
14796 |
|
14797 | get: function get() {
|
14798 | return this.list ? this.list.selectedIndex : constants_1.numbers.UNSET_INDEX;
|
14799 | },
|
14800 | |
14801 |
|
14802 |
|
14803 |
|
14804 |
|
14805 | set: function set(index) {
|
14806 | if (this.list) {
|
14807 | this.list.selectedIndex = index;
|
14808 | }
|
14809 | },
|
14810 | enumerable: false,
|
14811 | configurable: true
|
14812 | });
|
14813 | Object.defineProperty(MDCMenu.prototype, "quickOpen", {
|
14814 | set: function set(quickOpen) {
|
14815 | this.menuSurface.quickOpen = quickOpen;
|
14816 | },
|
14817 | enumerable: false,
|
14818 | configurable: true
|
14819 | });
|
14820 | |
14821 |
|
14822 |
|
14823 |
|
14824 |
|
14825 |
|
14826 | MDCMenu.prototype.setDefaultFocusState = function (focusState) {
|
14827 | this.foundation.setDefaultFocusState(focusState);
|
14828 | };
|
14829 | |
14830 |
|
14831 |
|
14832 | MDCMenu.prototype.setAnchorCorner = function (corner) {
|
14833 | this.menuSurface.setAnchorCorner(corner);
|
14834 | };
|
14835 | MDCMenu.prototype.setAnchorMargin = function (margin) {
|
14836 | this.menuSurface.setAnchorMargin(margin);
|
14837 | };
|
14838 | |
14839 |
|
14840 |
|
14841 |
|
14842 | MDCMenu.prototype.setSelectedIndex = function (index) {
|
14843 | this.foundation.setSelectedIndex(index);
|
14844 | };
|
14845 | |
14846 |
|
14847 |
|
14848 |
|
14849 |
|
14850 | MDCMenu.prototype.setEnabled = function (index, isEnabled) {
|
14851 | this.foundation.setEnabled(index, isEnabled);
|
14852 | };
|
14853 | |
14854 |
|
14855 |
|
14856 | MDCMenu.prototype.getOptionByIndex = function (index) {
|
14857 | var items = this.items;
|
14858 | if (index < items.length) {
|
14859 | return this.items[index];
|
14860 | } else {
|
14861 | return null;
|
14862 | }
|
14863 | };
|
14864 | |
14865 |
|
14866 |
|
14867 |
|
14868 | MDCMenu.prototype.getPrimaryTextAtIndex = function (index) {
|
14869 | var item = this.getOptionByIndex(index);
|
14870 | if (item && this.list) {
|
14871 | return this.list.getPrimaryText(item) || '';
|
14872 | }
|
14873 | return '';
|
14874 | };
|
14875 | MDCMenu.prototype.setFixedPosition = function (isFixed) {
|
14876 | this.menuSurface.setFixedPosition(isFixed);
|
14877 | };
|
14878 | MDCMenu.prototype.setIsHoisted = function (isHoisted) {
|
14879 | this.menuSurface.setIsHoisted(isHoisted);
|
14880 | };
|
14881 | MDCMenu.prototype.setAbsolutePosition = function (x, y) {
|
14882 | this.menuSurface.setAbsolutePosition(x, y);
|
14883 | };
|
14884 | |
14885 |
|
14886 |
|
14887 | MDCMenu.prototype.setAnchorElement = function (element) {
|
14888 | this.menuSurface.anchorElement = element;
|
14889 | };
|
14890 | MDCMenu.prototype.getDefaultFoundation = function () {
|
14891 | var _this = this;
|
14892 |
|
14893 |
|
14894 |
|
14895 | var adapter = {
|
14896 | addClassToElementAtIndex: function addClassToElementAtIndex(index, className) {
|
14897 | var list = _this.items;
|
14898 | list[index].classList.add(className);
|
14899 | },
|
14900 | removeClassFromElementAtIndex: function removeClassFromElementAtIndex(index, className) {
|
14901 | var list = _this.items;
|
14902 | list[index].classList.remove(className);
|
14903 | },
|
14904 | addAttributeToElementAtIndex: function addAttributeToElementAtIndex(index, attr, value) {
|
14905 | var list = _this.items;
|
14906 | list[index].setAttribute(attr, value);
|
14907 | },
|
14908 | removeAttributeFromElementAtIndex: function removeAttributeFromElementAtIndex(index, attr) {
|
14909 | var list = _this.items;
|
14910 | list[index].removeAttribute(attr);
|
14911 | },
|
14912 | getAttributeFromElementAtIndex: function getAttributeFromElementAtIndex(index, attr) {
|
14913 | var list = _this.items;
|
14914 | return list[index].getAttribute(attr);
|
14915 | },
|
14916 | elementContainsClass: function elementContainsClass(element, className) {
|
14917 | return element.classList.contains(className);
|
14918 | },
|
14919 | closeSurface: function closeSurface(skipRestoreFocus) {
|
14920 | _this.menuSurface.close(skipRestoreFocus);
|
14921 | },
|
14922 | getElementIndex: function getElementIndex(element) {
|
14923 | return _this.items.indexOf(element);
|
14924 | },
|
14925 | notifySelected: function notifySelected(evtData) {
|
14926 | _this.emit(constants_2.strings.SELECTED_EVENT, {
|
14927 | index: evtData.index,
|
14928 | item: _this.items[evtData.index]
|
14929 | });
|
14930 | },
|
14931 | getMenuItemCount: function getMenuItemCount() {
|
14932 | return _this.items.length;
|
14933 | },
|
14934 | focusItemAtIndex: function focusItemAtIndex(index) {
|
14935 | _this.items[index].focus();
|
14936 | },
|
14937 | focusListRoot: function focusListRoot() {
|
14938 | _this.root.querySelector(constants_2.strings.LIST_SELECTOR).focus();
|
14939 | },
|
14940 | isSelectableItemAtIndex: function isSelectableItemAtIndex(index) {
|
14941 | return !!ponyfill_1.closest(_this.items[index], "." + constants_2.cssClasses.MENU_SELECTION_GROUP);
|
14942 | },
|
14943 | getSelectedSiblingOfItemAtIndex: function getSelectedSiblingOfItemAtIndex(index) {
|
14944 | var selectionGroupEl = ponyfill_1.closest(_this.items[index], "." + constants_2.cssClasses.MENU_SELECTION_GROUP);
|
14945 | var selectedItemEl = selectionGroupEl.querySelector("." + constants_2.cssClasses.MENU_SELECTED_LIST_ITEM);
|
14946 | return selectedItemEl ? _this.items.indexOf(selectedItemEl) : -1;
|
14947 | }
|
14948 | };
|
14949 |
|
14950 | return new foundation_3.MDCMenuFoundation(adapter);
|
14951 | };
|
14952 | return MDCMenu;
|
14953 | }(component_1.MDCComponent);
|
14954 | exports.MDCMenu = MDCMenu;
|
14955 |
|
14956 | }),
|
14957 |
|
14958 | "./packages/mdc-menu/constants.ts":
|
14959 |
|
14960 |
|
14961 |
|
14962 |
|
14963 | (function(module, exports, __webpack_require__) {
|
14964 |
|
14965 | "use strict";
|
14966 |
|
14967 |
|
14968 |
|
14969 |
|
14970 |
|
14971 |
|
14972 |
|
14973 |
|
14974 |
|
14975 |
|
14976 |
|
14977 |
|
14978 |
|
14979 |
|
14980 |
|
14981 |
|
14982 |
|
14983 |
|
14984 |
|
14985 |
|
14986 |
|
14987 |
|
14988 |
|
14989 |
|
14990 | Object.defineProperty(exports, "__esModule", { value: true });
|
14991 | exports.DefaultFocusState = exports.numbers = exports.strings = exports.cssClasses = void 0;
|
14992 | var cssClasses = {
|
14993 | MENU_SELECTED_LIST_ITEM: 'mdc-menu-item--selected',
|
14994 | MENU_SELECTION_GROUP: 'mdc-menu__selection-group',
|
14995 | ROOT: 'mdc-menu'
|
14996 | };
|
14997 | exports.cssClasses = cssClasses;
|
14998 | var strings = {
|
14999 | ARIA_CHECKED_ATTR: 'aria-checked',
|
15000 | ARIA_DISABLED_ATTR: 'aria-disabled',
|
15001 | CHECKBOX_SELECTOR: 'input[type="checkbox"]',
|
15002 | LIST_SELECTOR: '.mdc-list,.mdc-deprecated-list',
|
15003 | SELECTED_EVENT: 'MDCMenu:selected',
|
15004 | SKIP_RESTORE_FOCUS: 'data-menu-item-skip-restore-focus'
|
15005 | };
|
15006 | exports.strings = strings;
|
15007 | var numbers = {
|
15008 | FOCUS_ROOT_INDEX: -1
|
15009 | };
|
15010 | exports.numbers = numbers;
|
15011 | var DefaultFocusState;
|
15012 | (function (DefaultFocusState) {
|
15013 | DefaultFocusState[DefaultFocusState["NONE"] = 0] = "NONE";
|
15014 | DefaultFocusState[DefaultFocusState["LIST_ROOT"] = 1] = "LIST_ROOT";
|
15015 | DefaultFocusState[DefaultFocusState["FIRST_ITEM"] = 2] = "FIRST_ITEM";
|
15016 | DefaultFocusState[DefaultFocusState["LAST_ITEM"] = 3] = "LAST_ITEM";
|
15017 | })(DefaultFocusState || (DefaultFocusState = {}));
|
15018 | exports.DefaultFocusState = DefaultFocusState;
|
15019 |
|
15020 | }),
|
15021 |
|
15022 | "./packages/mdc-menu/foundation.ts":
|
15023 |
|
15024 |
|
15025 |
|
15026 |
|
15027 | (function(module, exports, __webpack_require__) {
|
15028 |
|
15029 | "use strict";
|
15030 |
|
15031 |
|
15032 |
|
15033 |
|
15034 |
|
15035 |
|
15036 |
|
15037 |
|
15038 |
|
15039 |
|
15040 |
|
15041 |
|
15042 |
|
15043 |
|
15044 |
|
15045 |
|
15046 |
|
15047 |
|
15048 |
|
15049 |
|
15050 |
|
15051 |
|
15052 |
|
15053 |
|
15054 | var __extends = this && this.__extends || function () {
|
15055 | var _extendStatics = function extendStatics(d, b) {
|
15056 | _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
|
15057 | d.__proto__ = b;
|
15058 | } || function (d, b) {
|
15059 | for (var p in b) {
|
15060 | if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
15061 | }
|
15062 | };
|
15063 | return _extendStatics(d, b);
|
15064 | };
|
15065 | return function (d, b) {
|
15066 | if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
15067 | _extendStatics(d, b);
|
15068 | function __() {
|
15069 | this.constructor = d;
|
15070 | }
|
15071 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
15072 | };
|
15073 | }();
|
15074 | var __assign = this && this.__assign || function () {
|
15075 | __assign = Object.assign || function (t) {
|
15076 | for (var s, i = 1, n = arguments.length; i < n; i++) {
|
15077 | s = arguments[i];
|
15078 | for (var p in s) {
|
15079 | if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
15080 | }
|
15081 | }
|
15082 | return t;
|
15083 | };
|
15084 | return __assign.apply(this, arguments);
|
15085 | };
|
15086 | Object.defineProperty(exports, "__esModule", { value: true });
|
15087 | exports.MDCMenuFoundation = void 0;
|
15088 | var foundation_1 = __webpack_require__( "./packages/mdc-base/foundation.ts");
|
15089 | var constants_1 = __webpack_require__( "./packages/mdc-list/constants.ts");
|
15090 | var foundation_2 = __webpack_require__( "./packages/mdc-menu-surface/foundation.ts");
|
15091 | var constants_2 = __webpack_require__( "./packages/mdc-menu/constants.ts");
|
15092 | var MDCMenuFoundation = function (_super) {
|
15093 | __extends(MDCMenuFoundation, _super);
|
15094 | function MDCMenuFoundation(adapter) {
|
15095 | var _this = _super.call(this, __assign(__assign({}, MDCMenuFoundation.defaultAdapter), adapter)) || this;
|
15096 | _this.closeAnimationEndTimerId = 0;
|
15097 | _this.defaultFocusState = constants_2.DefaultFocusState.LIST_ROOT;
|
15098 | _this.selectedIndex = -1;
|
15099 | return _this;
|
15100 | }
|
15101 | Object.defineProperty(MDCMenuFoundation, "cssClasses", {
|
15102 | get: function get() {
|
15103 | return constants_2.cssClasses;
|
15104 | },
|
15105 | enumerable: false,
|
15106 | configurable: true
|
15107 | });
|
15108 | Object.defineProperty(MDCMenuFoundation, "strings", {
|
15109 | get: function get() {
|
15110 | return constants_2.strings;
|
15111 | },
|
15112 | enumerable: false,
|
15113 | configurable: true
|
15114 | });
|
15115 | Object.defineProperty(MDCMenuFoundation, "numbers", {
|
15116 | get: function get() {
|
15117 | return constants_2.numbers;
|
15118 | },
|
15119 | enumerable: false,
|
15120 | configurable: true
|
15121 | });
|
15122 | Object.defineProperty(MDCMenuFoundation, "defaultAdapter", {
|
15123 | |
15124 |
|
15125 |
|
15126 | get: function get() {
|
15127 |
|
15128 | return {
|
15129 | addClassToElementAtIndex: function addClassToElementAtIndex() {
|
15130 | return undefined;
|
15131 | },
|
15132 | removeClassFromElementAtIndex: function removeClassFromElementAtIndex() {
|
15133 | return undefined;
|
15134 | },
|
15135 | addAttributeToElementAtIndex: function addAttributeToElementAtIndex() {
|
15136 | return undefined;
|
15137 | },
|
15138 | removeAttributeFromElementAtIndex: function removeAttributeFromElementAtIndex() {
|
15139 | return undefined;
|
15140 | },
|
15141 | getAttributeFromElementAtIndex: function getAttributeFromElementAtIndex() {
|
15142 | return null;
|
15143 | },
|
15144 | elementContainsClass: function elementContainsClass() {
|
15145 | return false;
|
15146 | },
|
15147 | closeSurface: function closeSurface() {
|
15148 | return undefined;
|
15149 | },
|
15150 | getElementIndex: function getElementIndex() {
|
15151 | return -1;
|
15152 | },
|
15153 | notifySelected: function notifySelected() {
|
15154 | return undefined;
|
15155 | },
|
15156 | getMenuItemCount: function getMenuItemCount() {
|
15157 | return 0;
|
15158 | },
|
15159 | focusItemAtIndex: function focusItemAtIndex() {
|
15160 | return undefined;
|
15161 | },
|
15162 | focusListRoot: function focusListRoot() {
|
15163 | return undefined;
|
15164 | },
|
15165 | getSelectedSiblingOfItemAtIndex: function getSelectedSiblingOfItemAtIndex() {
|
15166 | return -1;
|
15167 | },
|
15168 | isSelectableItemAtIndex: function isSelectableItemAtIndex() {
|
15169 | return false;
|
15170 | }
|
15171 | };
|
15172 |
|
15173 | },
|
15174 | enumerable: false,
|
15175 | configurable: true
|
15176 | });
|
15177 | MDCMenuFoundation.prototype.destroy = function () {
|
15178 | if (this.closeAnimationEndTimerId) {
|
15179 | clearTimeout(this.closeAnimationEndTimerId);
|
15180 | }
|
15181 | this.adapter.closeSurface();
|
15182 | };
|
15183 | MDCMenuFoundation.prototype.handleKeydown = function (evt) {
|
15184 | var key = evt.key,
|
15185 | keyCode = evt.keyCode;
|
15186 | var isTab = key === 'Tab' || keyCode === 9;
|
15187 | if (isTab) {
|
15188 | this.adapter.closeSurface( true);
|
15189 | }
|
15190 | };
|
15191 | MDCMenuFoundation.prototype.handleItemAction = function (listItem) {
|
15192 | var _this = this;
|
15193 | var index = this.adapter.getElementIndex(listItem);
|
15194 | if (index < 0) {
|
15195 | return;
|
15196 | }
|
15197 | this.adapter.notifySelected({ index: index });
|
15198 | var skipRestoreFocus = this.adapter.getAttributeFromElementAtIndex(index, constants_2.strings.SKIP_RESTORE_FOCUS) === 'true';
|
15199 | this.adapter.closeSurface(skipRestoreFocus);
|
15200 |
|
15201 | this.closeAnimationEndTimerId = setTimeout(function () {
|
15202 |
|
15203 | var recomputedIndex = _this.adapter.getElementIndex(listItem);
|
15204 | if (recomputedIndex >= 0 && _this.adapter.isSelectableItemAtIndex(recomputedIndex)) {
|
15205 | _this.setSelectedIndex(recomputedIndex);
|
15206 | }
|
15207 | }, foundation_2.MDCMenuSurfaceFoundation.numbers.TRANSITION_CLOSE_DURATION);
|
15208 | };
|
15209 | MDCMenuFoundation.prototype.handleMenuSurfaceOpened = function () {
|
15210 | switch (this.defaultFocusState) {
|
15211 | case constants_2.DefaultFocusState.FIRST_ITEM:
|
15212 | this.adapter.focusItemAtIndex(0);
|
15213 | break;
|
15214 | case constants_2.DefaultFocusState.LAST_ITEM:
|
15215 | this.adapter.focusItemAtIndex(this.adapter.getMenuItemCount() - 1);
|
15216 | break;
|
15217 | case constants_2.DefaultFocusState.NONE:
|
15218 |
|
15219 | break;
|
15220 | default:
|
15221 | this.adapter.focusListRoot();
|
15222 | break;
|
15223 | }
|
15224 | };
|
15225 | |
15226 |
|
15227 |
|
15228 |
|
15229 |
|
15230 | MDCMenuFoundation.prototype.setDefaultFocusState = function (focusState) {
|
15231 | this.defaultFocusState = focusState;
|
15232 | };
|
15233 |
|
15234 | MDCMenuFoundation.prototype.getSelectedIndex = function () {
|
15235 | return this.selectedIndex;
|
15236 | };
|
15237 | |
15238 |
|
15239 |
|
15240 |
|
15241 | MDCMenuFoundation.prototype.setSelectedIndex = function (index) {
|
15242 | this.validatedIndex(index);
|
15243 | if (!this.adapter.isSelectableItemAtIndex(index)) {
|
15244 | throw new Error('MDCMenuFoundation: No selection group at specified index.');
|
15245 | }
|
15246 | var prevSelectedIndex = this.adapter.getSelectedSiblingOfItemAtIndex(index);
|
15247 | if (prevSelectedIndex >= 0) {
|
15248 | this.adapter.removeAttributeFromElementAtIndex(prevSelectedIndex, constants_2.strings.ARIA_CHECKED_ATTR);
|
15249 | this.adapter.removeClassFromElementAtIndex(prevSelectedIndex, constants_2.cssClasses.MENU_SELECTED_LIST_ITEM);
|
15250 | }
|
15251 | this.adapter.addClassToElementAtIndex(index, constants_2.cssClasses.MENU_SELECTED_LIST_ITEM);
|
15252 | this.adapter.addAttributeToElementAtIndex(index, constants_2.strings.ARIA_CHECKED_ATTR, 'true');
|
15253 | this.selectedIndex = index;
|
15254 | };
|
15255 | |
15256 |
|
15257 |
|
15258 |
|
15259 |
|
15260 | MDCMenuFoundation.prototype.setEnabled = function (index, isEnabled) {
|
15261 | this.validatedIndex(index);
|
15262 | if (isEnabled) {
|
15263 | this.adapter.removeClassFromElementAtIndex(index, constants_1.cssClasses.LIST_ITEM_DISABLED_CLASS);
|
15264 | this.adapter.addAttributeToElementAtIndex(index, constants_2.strings.ARIA_DISABLED_ATTR, 'false');
|
15265 | } else {
|
15266 | this.adapter.addClassToElementAtIndex(index, constants_1.cssClasses.LIST_ITEM_DISABLED_CLASS);
|
15267 | this.adapter.addAttributeToElementAtIndex(index, constants_2.strings.ARIA_DISABLED_ATTR, 'true');
|
15268 | }
|
15269 | };
|
15270 | MDCMenuFoundation.prototype.validatedIndex = function (index) {
|
15271 | var menuSize = this.adapter.getMenuItemCount();
|
15272 | var isIndexInRange = index >= 0 && index < menuSize;
|
15273 | if (!isIndexInRange) {
|
15274 | throw new Error('MDCMenuFoundation: No list item at specified index.');
|
15275 | }
|
15276 | };
|
15277 | return MDCMenuFoundation;
|
15278 | }(foundation_1.MDCFoundation);
|
15279 | exports.MDCMenuFoundation = MDCMenuFoundation;
|
15280 |
|
15281 | exports.default = MDCMenuFoundation;
|
15282 |
|
15283 | }),
|
15284 |
|
15285 | "./packages/mdc-menu/index.ts":
|
15286 |
|
15287 |
|
15288 |
|
15289 |
|
15290 | (function(module, exports, __webpack_require__) {
|
15291 |
|
15292 | "use strict";
|
15293 |
|
15294 |
|
15295 |
|
15296 |
|
15297 |
|
15298 |
|
15299 |
|
15300 |
|
15301 |
|
15302 |
|
15303 |
|
15304 |
|
15305 |
|
15306 |
|
15307 |
|
15308 |
|
15309 |
|
15310 |
|
15311 |
|
15312 |
|
15313 |
|
15314 |
|
15315 |
|
15316 |
|
15317 | var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
|
15318 | if (k2 === undefined) k2 = k;
|
15319 | Object.defineProperty(o, k2, { enumerable: true, get: function get() {
|
15320 | return m[k];
|
15321 | } });
|
15322 | } : function (o, m, k, k2) {
|
15323 | if (k2 === undefined) k2 = k;
|
15324 | o[k2] = m[k];
|
15325 | });
|
15326 | var __exportStar = this && this.__exportStar || function (m, exports) {
|
15327 | for (var p in m) {
|
15328 | if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
15329 | }
|
15330 | };
|
15331 | Object.defineProperty(exports, "__esModule", { value: true });
|
15332 | exports.Corner = void 0;
|
15333 | var constants_1 = __webpack_require__( "./packages/mdc-menu-surface/constants.ts");
|
15334 | Object.defineProperty(exports, "Corner", { enumerable: true, get: function get() {
|
15335 | return constants_1.Corner;
|
15336 | } });
|
15337 | __exportStar(__webpack_require__( "./packages/mdc-menu/adapter.ts"), exports);
|
15338 | __exportStar(__webpack_require__( "./packages/mdc-menu/component.ts"), exports);
|
15339 | __exportStar(__webpack_require__( "./packages/mdc-menu/constants.ts"), exports);
|
15340 | __exportStar(__webpack_require__( "./packages/mdc-menu/foundation.ts"), exports);
|
15341 | __exportStar(__webpack_require__( "./packages/mdc-menu/types.ts"), exports);
|
15342 |
|
15343 | }),
|
15344 |
|
15345 | "./packages/mdc-menu/types.ts":
|
15346 |
|
15347 |
|
15348 |
|
15349 |
|
15350 | (function(module, exports, __webpack_require__) {
|
15351 |
|
15352 | "use strict";
|
15353 |
|
15354 |
|
15355 |
|
15356 |
|
15357 |
|
15358 |
|
15359 |
|
15360 |
|
15361 |
|
15362 |
|
15363 |
|
15364 |
|
15365 |
|
15366 |
|
15367 |
|
15368 |
|
15369 |
|
15370 |
|
15371 |
|
15372 |
|
15373 |
|
15374 |
|
15375 |
|
15376 |
|
15377 | Object.defineProperty(exports, "__esModule", { value: true });
|
15378 |
|
15379 | }),
|
15380 |
|
15381 | "./packages/mdc-notched-outline/adapter.ts":
|
15382 |
|
15383 |
|
15384 |
|
15385 |
|
15386 | (function(module, exports, __webpack_require__) {
|
15387 |
|
15388 | "use strict";
|
15389 |
|
15390 |
|
15391 |
|
15392 |
|
15393 |
|
15394 |
|
15395 |
|
15396 |
|
15397 |
|
15398 |
|
15399 |
|
15400 |
|
15401 |
|
15402 |
|
15403 |
|
15404 |
|
15405 |
|
15406 |
|
15407 |
|
15408 |
|
15409 |
|
15410 |
|
15411 |
|
15412 |
|
15413 | Object.defineProperty(exports, "__esModule", { value: true });
|
15414 |
|
15415 | }),
|
15416 |
|
15417 | "./packages/mdc-notched-outline/component.ts":
|
15418 |
|
15419 |
|
15420 |
|
15421 |
|
15422 | (function(module, exports, __webpack_require__) {
|
15423 |
|
15424 | "use strict";
|
15425 |
|
15426 |
|
15427 |
|
15428 |
|
15429 |
|
15430 |
|
15431 |
|
15432 |
|
15433 |
|
15434 |
|
15435 |
|
15436 |
|
15437 |
|
15438 |
|
15439 |
|
15440 |
|
15441 |
|
15442 |
|
15443 |
|
15444 |
|
15445 |
|
15446 |
|
15447 |
|
15448 |
|
15449 | var __extends = this && this.__extends || function () {
|
15450 | var _extendStatics = function extendStatics(d, b) {
|
15451 | _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
|
15452 | d.__proto__ = b;
|
15453 | } || function (d, b) {
|
15454 | for (var p in b) {
|
15455 | if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
15456 | }
|
15457 | };
|
15458 | return _extendStatics(d, b);
|
15459 | };
|
15460 | return function (d, b) {
|
15461 | if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
15462 | _extendStatics(d, b);
|
15463 | function __() {
|
15464 | this.constructor = d;
|
15465 | }
|
15466 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
15467 | };
|
15468 | }();
|
15469 | Object.defineProperty(exports, "__esModule", { value: true });
|
15470 | exports.MDCNotchedOutline = void 0;
|
15471 | var component_1 = __webpack_require__( "./packages/mdc-base/component.ts");
|
15472 | var foundation_1 = __webpack_require__( "./packages/mdc-floating-label/foundation.ts");
|
15473 | var constants_1 = __webpack_require__( "./packages/mdc-notched-outline/constants.ts");
|
15474 | var foundation_2 = __webpack_require__( "./packages/mdc-notched-outline/foundation.ts");
|
15475 | var MDCNotchedOutline = function (_super) {
|
15476 | __extends(MDCNotchedOutline, _super);
|
15477 | function MDCNotchedOutline() {
|
15478 | return _super !== null && _super.apply(this, arguments) || this;
|
15479 | }
|
15480 | MDCNotchedOutline.attachTo = function (root) {
|
15481 | return new MDCNotchedOutline(root);
|
15482 | };
|
15483 | MDCNotchedOutline.prototype.initialSyncWithDOM = function () {
|
15484 | this.notchElement = this.root.querySelector(constants_1.strings.NOTCH_ELEMENT_SELECTOR);
|
15485 | var label = this.root.querySelector('.' + foundation_1.MDCFloatingLabelFoundation.cssClasses.ROOT);
|
15486 | if (label) {
|
15487 | label.style.transitionDuration = '0s';
|
15488 | this.root.classList.add(constants_1.cssClasses.OUTLINE_UPGRADED);
|
15489 | requestAnimationFrame(function () {
|
15490 | label.style.transitionDuration = '';
|
15491 | });
|
15492 | } else {
|
15493 | this.root.classList.add(constants_1.cssClasses.NO_LABEL);
|
15494 | }
|
15495 | };
|
15496 | |
15497 |
|
15498 |
|
15499 |
|
15500 | MDCNotchedOutline.prototype.notch = function (notchWidth) {
|
15501 | this.foundation.notch(notchWidth);
|
15502 | };
|
15503 | |
15504 |
|
15505 |
|
15506 | MDCNotchedOutline.prototype.closeNotch = function () {
|
15507 | this.foundation.closeNotch();
|
15508 | };
|
15509 | MDCNotchedOutline.prototype.getDefaultFoundation = function () {
|
15510 | var _this = this;
|
15511 |
|
15512 |
|
15513 |
|
15514 | var adapter = {
|
15515 | addClass: function addClass(className) {
|
15516 | return _this.root.classList.add(className);
|
15517 | },
|
15518 | removeClass: function removeClass(className) {
|
15519 | return _this.root.classList.remove(className);
|
15520 | },
|
15521 | setNotchWidthProperty: function setNotchWidthProperty(width) {
|
15522 | _this.notchElement.style.setProperty('width', width + 'px');
|
15523 | },
|
15524 | removeNotchWidthProperty: function removeNotchWidthProperty() {
|
15525 | _this.notchElement.style.removeProperty('width');
|
15526 | }
|
15527 | };
|
15528 |
|
15529 | return new foundation_2.MDCNotchedOutlineFoundation(adapter);
|
15530 | };
|
15531 | return MDCNotchedOutline;
|
15532 | }(component_1.MDCComponent);
|
15533 | exports.MDCNotchedOutline = MDCNotchedOutline;
|
15534 |
|
15535 | }),
|
15536 |
|
15537 | "./packages/mdc-notched-outline/constants.ts":
|
15538 |
|
15539 |
|
15540 |
|
15541 |
|
15542 | (function(module, exports, __webpack_require__) {
|
15543 |
|
15544 | "use strict";
|
15545 |
|
15546 |
|
15547 |
|
15548 |
|
15549 |
|
15550 |
|
15551 |
|
15552 |
|
15553 |
|
15554 |
|
15555 |
|
15556 |
|
15557 |
|
15558 |
|
15559 |
|
15560 |
|
15561 |
|
15562 |
|
15563 |
|
15564 |
|
15565 |
|
15566 |
|
15567 |
|
15568 |
|
15569 | Object.defineProperty(exports, "__esModule", { value: true });
|
15570 | exports.strings = exports.numbers = exports.cssClasses = void 0;
|
15571 | var strings = {
|
15572 | NOTCH_ELEMENT_SELECTOR: '.mdc-notched-outline__notch'
|
15573 | };
|
15574 | exports.strings = strings;
|
15575 | var numbers = {
|
15576 |
|
15577 | NOTCH_ELEMENT_PADDING: 8
|
15578 | };
|
15579 | exports.numbers = numbers;
|
15580 | var cssClasses = {
|
15581 | NO_LABEL: 'mdc-notched-outline--no-label',
|
15582 | OUTLINE_NOTCHED: 'mdc-notched-outline--notched',
|
15583 | OUTLINE_UPGRADED: 'mdc-notched-outline--upgraded'
|
15584 | };
|
15585 | exports.cssClasses = cssClasses;
|
15586 |
|
15587 | }),
|
15588 |
|
15589 | "./packages/mdc-notched-outline/foundation.ts":
|
15590 |
|
15591 |
|
15592 |
|
15593 |
|
15594 | (function(module, exports, __webpack_require__) {
|
15595 |
|
15596 | "use strict";
|
15597 |
|
15598 |
|
15599 |
|
15600 |
|
15601 |
|
15602 |
|
15603 |
|
15604 |
|
15605 |
|
15606 |
|
15607 |
|
15608 |
|
15609 |
|
15610 |
|
15611 |
|
15612 |
|
15613 |
|
15614 |
|
15615 |
|
15616 |
|
15617 |
|
15618 |
|
15619 |
|
15620 |
|
15621 | var __extends = this && this.__extends || function () {
|
15622 | var _extendStatics = function extendStatics(d, b) {
|
15623 | _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
|
15624 | d.__proto__ = b;
|
15625 | } || function (d, b) {
|
15626 | for (var p in b) {
|
15627 | if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
15628 | }
|
15629 | };
|
15630 | return _extendStatics(d, b);
|
15631 | };
|
15632 | return function (d, b) {
|
15633 | if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
15634 | _extendStatics(d, b);
|
15635 | function __() {
|
15636 | this.constructor = d;
|
15637 | }
|
15638 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
15639 | };
|
15640 | }();
|
15641 | var __assign = this && this.__assign || function () {
|
15642 | __assign = Object.assign || function (t) {
|
15643 | for (var s, i = 1, n = arguments.length; i < n; i++) {
|
15644 | s = arguments[i];
|
15645 | for (var p in s) {
|
15646 | if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
15647 | }
|
15648 | }
|
15649 | return t;
|
15650 | };
|
15651 | return __assign.apply(this, arguments);
|
15652 | };
|
15653 | Object.defineProperty(exports, "__esModule", { value: true });
|
15654 | exports.MDCNotchedOutlineFoundation = void 0;
|
15655 | var foundation_1 = __webpack_require__( "./packages/mdc-base/foundation.ts");
|
15656 | var constants_1 = __webpack_require__( "./packages/mdc-notched-outline/constants.ts");
|
15657 | var MDCNotchedOutlineFoundation = function (_super) {
|
15658 | __extends(MDCNotchedOutlineFoundation, _super);
|
15659 | function MDCNotchedOutlineFoundation(adapter) {
|
15660 | return _super.call(this, __assign(__assign({}, MDCNotchedOutlineFoundation.defaultAdapter), adapter)) || this;
|
15661 | }
|
15662 | Object.defineProperty(MDCNotchedOutlineFoundation, "strings", {
|
15663 | get: function get() {
|
15664 | return constants_1.strings;
|
15665 | },
|
15666 | enumerable: false,
|
15667 | configurable: true
|
15668 | });
|
15669 | Object.defineProperty(MDCNotchedOutlineFoundation, "cssClasses", {
|
15670 | get: function get() {
|
15671 | return constants_1.cssClasses;
|
15672 | },
|
15673 | enumerable: false,
|
15674 | configurable: true
|
15675 | });
|
15676 | Object.defineProperty(MDCNotchedOutlineFoundation, "numbers", {
|
15677 | get: function get() {
|
15678 | return constants_1.numbers;
|
15679 | },
|
15680 | enumerable: false,
|
15681 | configurable: true
|
15682 | });
|
15683 | Object.defineProperty(MDCNotchedOutlineFoundation, "defaultAdapter", {
|
15684 | |
15685 |
|
15686 |
|
15687 | get: function get() {
|
15688 |
|
15689 | return {
|
15690 | addClass: function addClass() {
|
15691 | return undefined;
|
15692 | },
|
15693 | removeClass: function removeClass() {
|
15694 | return undefined;
|
15695 | },
|
15696 | setNotchWidthProperty: function setNotchWidthProperty() {
|
15697 | return undefined;
|
15698 | },
|
15699 | removeNotchWidthProperty: function removeNotchWidthProperty() {
|
15700 | return undefined;
|
15701 | }
|
15702 | };
|
15703 |
|
15704 | },
|
15705 | enumerable: false,
|
15706 | configurable: true
|
15707 | });
|
15708 | |
15709 |
|
15710 |
|
15711 | MDCNotchedOutlineFoundation.prototype.notch = function (notchWidth) {
|
15712 | var OUTLINE_NOTCHED = MDCNotchedOutlineFoundation.cssClasses.OUTLINE_NOTCHED;
|
15713 | if (notchWidth > 0) {
|
15714 | notchWidth += constants_1.numbers.NOTCH_ELEMENT_PADDING;
|
15715 | }
|
15716 | this.adapter.setNotchWidthProperty(notchWidth);
|
15717 | this.adapter.addClass(OUTLINE_NOTCHED);
|
15718 | };
|
15719 | |
15720 |
|
15721 |
|
15722 | MDCNotchedOutlineFoundation.prototype.closeNotch = function () {
|
15723 | var OUTLINE_NOTCHED = MDCNotchedOutlineFoundation.cssClasses.OUTLINE_NOTCHED;
|
15724 | this.adapter.removeClass(OUTLINE_NOTCHED);
|
15725 | this.adapter.removeNotchWidthProperty();
|
15726 | };
|
15727 | return MDCNotchedOutlineFoundation;
|
15728 | }(foundation_1.MDCFoundation);
|
15729 | exports.MDCNotchedOutlineFoundation = MDCNotchedOutlineFoundation;
|
15730 |
|
15731 | exports.default = MDCNotchedOutlineFoundation;
|
15732 |
|
15733 | }),
|
15734 |
|
15735 | "./packages/mdc-notched-outline/index.ts":
|
15736 |
|
15737 |
|
15738 |
|
15739 |
|
15740 | (function(module, exports, __webpack_require__) {
|
15741 |
|
15742 | "use strict";
|
15743 |
|
15744 |
|
15745 |
|
15746 |
|
15747 |
|
15748 |
|
15749 |
|
15750 |
|
15751 |
|
15752 |
|
15753 |
|
15754 |
|
15755 |
|
15756 |
|
15757 |
|
15758 |
|
15759 |
|
15760 |
|
15761 |
|
15762 |
|
15763 |
|
15764 |
|
15765 |
|
15766 |
|
15767 | var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
|
15768 | if (k2 === undefined) k2 = k;
|
15769 | Object.defineProperty(o, k2, { enumerable: true, get: function get() {
|
15770 | return m[k];
|
15771 | } });
|
15772 | } : function (o, m, k, k2) {
|
15773 | if (k2 === undefined) k2 = k;
|
15774 | o[k2] = m[k];
|
15775 | });
|
15776 | var __exportStar = this && this.__exportStar || function (m, exports) {
|
15777 | for (var p in m) {
|
15778 | if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
15779 | }
|
15780 | };
|
15781 | Object.defineProperty(exports, "__esModule", { value: true });
|
15782 | __exportStar(__webpack_require__( "./packages/mdc-notched-outline/adapter.ts"), exports);
|
15783 | __exportStar(__webpack_require__( "./packages/mdc-notched-outline/component.ts"), exports);
|
15784 | __exportStar(__webpack_require__( "./packages/mdc-notched-outline/constants.ts"), exports);
|
15785 | __exportStar(__webpack_require__( "./packages/mdc-notched-outline/foundation.ts"), exports);
|
15786 |
|
15787 | }),
|
15788 |
|
15789 | "./packages/mdc-radio/adapter.ts":
|
15790 |
|
15791 |
|
15792 |
|
15793 |
|
15794 | (function(module, exports, __webpack_require__) {
|
15795 |
|
15796 | "use strict";
|
15797 |
|
15798 |
|
15799 |
|
15800 |
|
15801 |
|
15802 |
|
15803 |
|
15804 |
|
15805 |
|
15806 |
|
15807 |
|
15808 |
|
15809 |
|
15810 |
|
15811 |
|
15812 |
|
15813 |
|
15814 |
|
15815 |
|
15816 |
|
15817 |
|
15818 |
|
15819 |
|
15820 |
|
15821 | Object.defineProperty(exports, "__esModule", { value: true });
|
15822 |
|
15823 | }),
|
15824 |
|
15825 | "./packages/mdc-radio/component.ts":
|
15826 |
|
15827 |
|
15828 |
|
15829 |
|
15830 | (function(module, exports, __webpack_require__) {
|
15831 |
|
15832 | "use strict";
|
15833 |
|
15834 |
|
15835 |
|
15836 |
|
15837 |
|
15838 |
|
15839 |
|
15840 |
|
15841 |
|
15842 |
|
15843 |
|
15844 |
|
15845 |
|
15846 |
|
15847 |
|
15848 |
|
15849 |
|
15850 |
|
15851 |
|
15852 |
|
15853 |
|
15854 |
|
15855 |
|
15856 |
|
15857 | var __extends = this && this.__extends || function () {
|
15858 | var _extendStatics = function extendStatics(d, b) {
|
15859 | _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
|
15860 | d.__proto__ = b;
|
15861 | } || function (d, b) {
|
15862 | for (var p in b) {
|
15863 | if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
15864 | }
|
15865 | };
|
15866 | return _extendStatics(d, b);
|
15867 | };
|
15868 | return function (d, b) {
|
15869 | if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
15870 | _extendStatics(d, b);
|
15871 | function __() {
|
15872 | this.constructor = d;
|
15873 | }
|
15874 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
15875 | };
|
15876 | }();
|
15877 | var __assign = this && this.__assign || function () {
|
15878 | __assign = Object.assign || function (t) {
|
15879 | for (var s, i = 1, n = arguments.length; i < n; i++) {
|
15880 | s = arguments[i];
|
15881 | for (var p in s) {
|
15882 | if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
15883 | }
|
15884 | }
|
15885 | return t;
|
15886 | };
|
15887 | return __assign.apply(this, arguments);
|
15888 | };
|
15889 | Object.defineProperty(exports, "__esModule", { value: true });
|
15890 | exports.MDCRadio = void 0;
|
15891 | var component_1 = __webpack_require__( "./packages/mdc-base/component.ts");
|
15892 | var events_1 = __webpack_require__( "./packages/mdc-dom/events.ts");
|
15893 | var component_2 = __webpack_require__( "./packages/mdc-ripple/component.ts");
|
15894 | var foundation_1 = __webpack_require__( "./packages/mdc-ripple/foundation.ts");
|
15895 | var foundation_2 = __webpack_require__( "./packages/mdc-radio/foundation.ts");
|
15896 | var MDCRadio = function (_super) {
|
15897 | __extends(MDCRadio, _super);
|
15898 | function MDCRadio() {
|
15899 | var _this = _super !== null && _super.apply(this, arguments) || this;
|
15900 | _this.rippleSurface = _this.createRipple();
|
15901 | return _this;
|
15902 | }
|
15903 | MDCRadio.attachTo = function (root) {
|
15904 | return new MDCRadio(root);
|
15905 | };
|
15906 | Object.defineProperty(MDCRadio.prototype, "checked", {
|
15907 | get: function get() {
|
15908 | return this.nativeControl.checked;
|
15909 | },
|
15910 | set: function set(checked) {
|
15911 | this.nativeControl.checked = checked;
|
15912 | },
|
15913 | enumerable: false,
|
15914 | configurable: true
|
15915 | });
|
15916 | Object.defineProperty(MDCRadio.prototype, "disabled", {
|
15917 | get: function get() {
|
15918 | return this.nativeControl.disabled;
|
15919 | },
|
15920 | set: function set(disabled) {
|
15921 | this.foundation.setDisabled(disabled);
|
15922 | },
|
15923 | enumerable: false,
|
15924 | configurable: true
|
15925 | });
|
15926 | Object.defineProperty(MDCRadio.prototype, "value", {
|
15927 | get: function get() {
|
15928 | return this.nativeControl.value;
|
15929 | },
|
15930 | set: function set(value) {
|
15931 | this.nativeControl.value = value;
|
15932 | },
|
15933 | enumerable: false,
|
15934 | configurable: true
|
15935 | });
|
15936 | Object.defineProperty(MDCRadio.prototype, "ripple", {
|
15937 | get: function get() {
|
15938 | return this.rippleSurface;
|
15939 | },
|
15940 | enumerable: false,
|
15941 | configurable: true
|
15942 | });
|
15943 | MDCRadio.prototype.destroy = function () {
|
15944 | this.rippleSurface.destroy();
|
15945 | _super.prototype.destroy.call(this);
|
15946 | };
|
15947 | MDCRadio.prototype.getDefaultFoundation = function () {
|
15948 | var _this = this;
|
15949 |
|
15950 |
|
15951 | var adapter = {
|
15952 | addClass: function addClass(className) {
|
15953 | return _this.root.classList.add(className);
|
15954 | },
|
15955 | removeClass: function removeClass(className) {
|
15956 | return _this.root.classList.remove(className);
|
15957 | },
|
15958 | setNativeControlDisabled: function setNativeControlDisabled(disabled) {
|
15959 | return _this.nativeControl.disabled = disabled;
|
15960 | }
|
15961 | };
|
15962 | return new foundation_2.MDCRadioFoundation(adapter);
|
15963 | };
|
15964 | MDCRadio.prototype.createRipple = function () {
|
15965 | var _this = this;
|
15966 |
|
15967 |
|
15968 |
|
15969 | var adapter = __assign(__assign({}, component_2.MDCRipple.createAdapter(this)), { registerInteractionHandler: function registerInteractionHandler(evtType, handler) {
|
15970 | _this.nativeControl.addEventListener(evtType, handler, events_1.applyPassive());
|
15971 | }, deregisterInteractionHandler: function deregisterInteractionHandler(evtType, handler) {
|
15972 | _this.nativeControl.removeEventListener(evtType, handler, events_1.applyPassive());
|
15973 | },
|
15974 |
|
15975 |
|
15976 | isSurfaceActive: function isSurfaceActive() {
|
15977 | return false;
|
15978 | }, isUnbounded: function isUnbounded() {
|
15979 | return true;
|
15980 | } });
|
15981 |
|
15982 | return new component_2.MDCRipple(this.root, new foundation_1.MDCRippleFoundation(adapter));
|
15983 | };
|
15984 | Object.defineProperty(MDCRadio.prototype, "nativeControl", {
|
15985 | get: function get() {
|
15986 | var NATIVE_CONTROL_SELECTOR = foundation_2.MDCRadioFoundation.strings.NATIVE_CONTROL_SELECTOR;
|
15987 | var el = this.root.querySelector(NATIVE_CONTROL_SELECTOR);
|
15988 | if (!el) {
|
15989 | throw new Error("Radio component requires a " + NATIVE_CONTROL_SELECTOR + " element");
|
15990 | }
|
15991 | return el;
|
15992 | },
|
15993 | enumerable: false,
|
15994 | configurable: true
|
15995 | });
|
15996 | return MDCRadio;
|
15997 | }(component_1.MDCComponent);
|
15998 | exports.MDCRadio = MDCRadio;
|
15999 |
|
16000 | }),
|
16001 |
|
16002 | "./packages/mdc-radio/constants.ts":
|
16003 |
|
16004 |
|
16005 |
|
16006 |
|
16007 | (function(module, exports, __webpack_require__) {
|
16008 |
|
16009 | "use strict";
|
16010 |
|
16011 |
|
16012 |
|
16013 |
|
16014 |
|
16015 |
|
16016 |
|
16017 |
|
16018 |
|
16019 |
|
16020 |
|
16021 |
|
16022 |
|
16023 |
|
16024 |
|
16025 |
|
16026 |
|
16027 |
|
16028 |
|
16029 |
|
16030 |
|
16031 |
|
16032 |
|
16033 |
|
16034 | Object.defineProperty(exports, "__esModule", { value: true });
|
16035 | exports.cssClasses = exports.strings = void 0;
|
16036 | var strings = {
|
16037 | NATIVE_CONTROL_SELECTOR: '.mdc-radio__native-control'
|
16038 | };
|
16039 | exports.strings = strings;
|
16040 | var cssClasses = {
|
16041 | DISABLED: 'mdc-radio--disabled',
|
16042 | ROOT: 'mdc-radio'
|
16043 | };
|
16044 | exports.cssClasses = cssClasses;
|
16045 |
|
16046 | }),
|
16047 |
|
16048 | "./packages/mdc-radio/foundation.ts":
|
16049 |
|
16050 |
|
16051 |
|
16052 |
|
16053 | (function(module, exports, __webpack_require__) {
|
16054 |
|
16055 | "use strict";
|
16056 |
|
16057 |
|
16058 |
|
16059 |
|
16060 |
|
16061 |
|
16062 |
|
16063 |
|
16064 |
|
16065 |
|
16066 |
|
16067 |
|
16068 |
|
16069 |
|
16070 |
|
16071 |
|
16072 |
|
16073 |
|
16074 |
|
16075 |
|
16076 |
|
16077 |
|
16078 |
|
16079 |
|
16080 | var __extends = this && this.__extends || function () {
|
16081 | var _extendStatics = function extendStatics(d, b) {
|
16082 | _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
|
16083 | d.__proto__ = b;
|
16084 | } || function (d, b) {
|
16085 | for (var p in b) {
|
16086 | if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
16087 | }
|
16088 | };
|
16089 | return _extendStatics(d, b);
|
16090 | };
|
16091 | return function (d, b) {
|
16092 | if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
16093 | _extendStatics(d, b);
|
16094 | function __() {
|
16095 | this.constructor = d;
|
16096 | }
|
16097 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
16098 | };
|
16099 | }();
|
16100 | var __assign = this && this.__assign || function () {
|
16101 | __assign = Object.assign || function (t) {
|
16102 | for (var s, i = 1, n = arguments.length; i < n; i++) {
|
16103 | s = arguments[i];
|
16104 | for (var p in s) {
|
16105 | if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
16106 | }
|
16107 | }
|
16108 | return t;
|
16109 | };
|
16110 | return __assign.apply(this, arguments);
|
16111 | };
|
16112 | Object.defineProperty(exports, "__esModule", { value: true });
|
16113 | exports.MDCRadioFoundation = void 0;
|
16114 | var foundation_1 = __webpack_require__( "./packages/mdc-base/foundation.ts");
|
16115 | var constants_1 = __webpack_require__( "./packages/mdc-radio/constants.ts");
|
16116 | var MDCRadioFoundation = function (_super) {
|
16117 | __extends(MDCRadioFoundation, _super);
|
16118 | function MDCRadioFoundation(adapter) {
|
16119 | return _super.call(this, __assign(__assign({}, MDCRadioFoundation.defaultAdapter), adapter)) || this;
|
16120 | }
|
16121 | Object.defineProperty(MDCRadioFoundation, "cssClasses", {
|
16122 | get: function get() {
|
16123 | return constants_1.cssClasses;
|
16124 | },
|
16125 | enumerable: false,
|
16126 | configurable: true
|
16127 | });
|
16128 | Object.defineProperty(MDCRadioFoundation, "strings", {
|
16129 | get: function get() {
|
16130 | return constants_1.strings;
|
16131 | },
|
16132 | enumerable: false,
|
16133 | configurable: true
|
16134 | });
|
16135 | Object.defineProperty(MDCRadioFoundation, "defaultAdapter", {
|
16136 | get: function get() {
|
16137 | return {
|
16138 | addClass: function addClass() {
|
16139 | return undefined;
|
16140 | },
|
16141 | removeClass: function removeClass() {
|
16142 | return undefined;
|
16143 | },
|
16144 | setNativeControlDisabled: function setNativeControlDisabled() {
|
16145 | return undefined;
|
16146 | }
|
16147 | };
|
16148 | },
|
16149 | enumerable: false,
|
16150 | configurable: true
|
16151 | });
|
16152 | MDCRadioFoundation.prototype.setDisabled = function (disabled) {
|
16153 | var DISABLED = MDCRadioFoundation.cssClasses.DISABLED;
|
16154 | this.adapter.setNativeControlDisabled(disabled);
|
16155 | if (disabled) {
|
16156 | this.adapter.addClass(DISABLED);
|
16157 | } else {
|
16158 | this.adapter.removeClass(DISABLED);
|
16159 | }
|
16160 | };
|
16161 | return MDCRadioFoundation;
|
16162 | }(foundation_1.MDCFoundation);
|
16163 | exports.MDCRadioFoundation = MDCRadioFoundation;
|
16164 |
|
16165 | exports.default = MDCRadioFoundation;
|
16166 |
|
16167 | }),
|
16168 |
|
16169 | "./packages/mdc-radio/index.ts":
|
16170 |
|
16171 |
|
16172 |
|
16173 |
|
16174 | (function(module, exports, __webpack_require__) {
|
16175 |
|
16176 | "use strict";
|
16177 |
|
16178 |
|
16179 |
|
16180 |
|
16181 |
|
16182 |
|
16183 |
|
16184 |
|
16185 |
|
16186 |
|
16187 |
|
16188 |
|
16189 |
|
16190 |
|
16191 |
|
16192 |
|
16193 |
|
16194 |
|
16195 |
|
16196 |
|
16197 |
|
16198 |
|
16199 |
|
16200 |
|
16201 | var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
|
16202 | if (k2 === undefined) k2 = k;
|
16203 | Object.defineProperty(o, k2, { enumerable: true, get: function get() {
|
16204 | return m[k];
|
16205 | } });
|
16206 | } : function (o, m, k, k2) {
|
16207 | if (k2 === undefined) k2 = k;
|
16208 | o[k2] = m[k];
|
16209 | });
|
16210 | var __exportStar = this && this.__exportStar || function (m, exports) {
|
16211 | for (var p in m) {
|
16212 | if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
16213 | }
|
16214 | };
|
16215 | Object.defineProperty(exports, "__esModule", { value: true });
|
16216 | __exportStar(__webpack_require__( "./packages/mdc-radio/adapter.ts"), exports);
|
16217 | __exportStar(__webpack_require__( "./packages/mdc-radio/component.ts"), exports);
|
16218 | __exportStar(__webpack_require__( "./packages/mdc-radio/constants.ts"), exports);
|
16219 | __exportStar(__webpack_require__( "./packages/mdc-radio/foundation.ts"), exports);
|
16220 |
|
16221 | }),
|
16222 |
|
16223 | "./packages/mdc-ripple/adapter.ts":
|
16224 |
|
16225 |
|
16226 |
|
16227 |
|
16228 | (function(module, exports, __webpack_require__) {
|
16229 |
|
16230 | "use strict";
|
16231 |
|
16232 |
|
16233 |
|
16234 |
|
16235 |
|
16236 |
|
16237 |
|
16238 |
|
16239 |
|
16240 |
|
16241 |
|
16242 |
|
16243 |
|
16244 |
|
16245 |
|
16246 |
|
16247 |
|
16248 |
|
16249 |
|
16250 |
|
16251 |
|
16252 |
|
16253 |
|
16254 |
|
16255 | Object.defineProperty(exports, "__esModule", { value: true });
|
16256 |
|
16257 | }),
|
16258 |
|
16259 | "./packages/mdc-ripple/component.ts":
|
16260 |
|
16261 |
|
16262 |
|
16263 |
|
16264 | (function(module, exports, __webpack_require__) {
|
16265 |
|
16266 | "use strict";
|
16267 |
|
16268 |
|
16269 |
|
16270 |
|
16271 |
|
16272 |
|
16273 |
|
16274 |
|
16275 |
|
16276 |
|
16277 |
|
16278 |
|
16279 |
|
16280 |
|
16281 |
|
16282 |
|
16283 |
|
16284 |
|
16285 |
|
16286 |
|
16287 |
|
16288 |
|
16289 |
|
16290 |
|
16291 | var __extends = this && this.__extends || function () {
|
16292 | var _extendStatics = function extendStatics(d, b) {
|
16293 | _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
|
16294 | d.__proto__ = b;
|
16295 | } || function (d, b) {
|
16296 | for (var p in b) {
|
16297 | if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
16298 | }
|
16299 | };
|
16300 | return _extendStatics(d, b);
|
16301 | };
|
16302 | return function (d, b) {
|
16303 | if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
16304 | _extendStatics(d, b);
|
16305 | function __() {
|
16306 | this.constructor = d;
|
16307 | }
|
16308 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
16309 | };
|
16310 | }();
|
16311 | var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
|
16312 | if (k2 === undefined) k2 = k;
|
16313 | Object.defineProperty(o, k2, { enumerable: true, get: function get() {
|
16314 | return m[k];
|
16315 | } });
|
16316 | } : function (o, m, k, k2) {
|
16317 | if (k2 === undefined) k2 = k;
|
16318 | o[k2] = m[k];
|
16319 | });
|
16320 | var __setModuleDefault = this && this.__setModuleDefault || (Object.create ? function (o, v) {
|
16321 | Object.defineProperty(o, "default", { enumerable: true, value: v });
|
16322 | } : function (o, v) {
|
16323 | o["default"] = v;
|
16324 | });
|
16325 | var __importStar = this && this.__importStar || function (mod) {
|
16326 | if (mod && mod.__esModule) return mod;
|
16327 | var result = {};
|
16328 | if (mod != null) for (var k in mod) {
|
16329 | if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
16330 | }__setModuleDefault(result, mod);
|
16331 | return result;
|
16332 | };
|
16333 | Object.defineProperty(exports, "__esModule", { value: true });
|
16334 | exports.MDCRipple = void 0;
|
16335 | var component_1 = __webpack_require__( "./packages/mdc-base/component.ts");
|
16336 | var events_1 = __webpack_require__( "./packages/mdc-dom/events.ts");
|
16337 | var ponyfill_1 = __webpack_require__( "./packages/mdc-dom/ponyfill.ts");
|
16338 | var foundation_1 = __webpack_require__( "./packages/mdc-ripple/foundation.ts");
|
16339 | var util = __importStar(__webpack_require__( "./packages/mdc-ripple/util.ts"));
|
16340 | var MDCRipple = function (_super) {
|
16341 | __extends(MDCRipple, _super);
|
16342 | function MDCRipple() {
|
16343 | var _this = _super !== null && _super.apply(this, arguments) || this;
|
16344 | _this.disabled = false;
|
16345 | return _this;
|
16346 | }
|
16347 | MDCRipple.attachTo = function (root, opts) {
|
16348 | if (opts === void 0) {
|
16349 | opts = {
|
16350 | isUnbounded: undefined
|
16351 | };
|
16352 | }
|
16353 | var ripple = new MDCRipple(root);
|
16354 |
|
16355 | if (opts.isUnbounded !== undefined) {
|
16356 | ripple.unbounded = opts.isUnbounded;
|
16357 | }
|
16358 | return ripple;
|
16359 | };
|
16360 | MDCRipple.createAdapter = function (instance) {
|
16361 | return {
|
16362 | addClass: function addClass(className) {
|
16363 | return instance.root.classList.add(className);
|
16364 | },
|
16365 | browserSupportsCssVars: function browserSupportsCssVars() {
|
16366 | return util.supportsCssVariables(window);
|
16367 | },
|
16368 | computeBoundingRect: function computeBoundingRect() {
|
16369 | return instance.root.getBoundingClientRect();
|
16370 | },
|
16371 | containsEventTarget: function containsEventTarget(target) {
|
16372 | return instance.root.contains(target);
|
16373 | },
|
16374 | deregisterDocumentInteractionHandler: function deregisterDocumentInteractionHandler(evtType, handler) {
|
16375 | return document.documentElement.removeEventListener(evtType, handler, events_1.applyPassive());
|
16376 | },
|
16377 | deregisterInteractionHandler: function deregisterInteractionHandler(evtType, handler) {
|
16378 | return instance.root.removeEventListener(evtType, handler, events_1.applyPassive());
|
16379 | },
|
16380 | deregisterResizeHandler: function deregisterResizeHandler(handler) {
|
16381 | return window.removeEventListener('resize', handler);
|
16382 | },
|
16383 | getWindowPageOffset: function getWindowPageOffset() {
|
16384 | return { x: window.pageXOffset, y: window.pageYOffset };
|
16385 | },
|
16386 | isSurfaceActive: function isSurfaceActive() {
|
16387 | return ponyfill_1.matches(instance.root, ':active');
|
16388 | },
|
16389 | isSurfaceDisabled: function isSurfaceDisabled() {
|
16390 | return Boolean(instance.disabled);
|
16391 | },
|
16392 | isUnbounded: function isUnbounded() {
|
16393 | return Boolean(instance.unbounded);
|
16394 | },
|
16395 | registerDocumentInteractionHandler: function registerDocumentInteractionHandler(evtType, handler) {
|
16396 | return document.documentElement.addEventListener(evtType, handler, events_1.applyPassive());
|
16397 | },
|
16398 | registerInteractionHandler: function registerInteractionHandler(evtType, handler) {
|
16399 | return instance.root.addEventListener(evtType, handler, events_1.applyPassive());
|
16400 | },
|
16401 | registerResizeHandler: function registerResizeHandler(handler) {
|
16402 | return window.addEventListener('resize', handler);
|
16403 | },
|
16404 | removeClass: function removeClass(className) {
|
16405 | return instance.root.classList.remove(className);
|
16406 | },
|
16407 | updateCssVariable: function updateCssVariable(varName, value) {
|
16408 | return instance.root.style.setProperty(varName, value);
|
16409 | }
|
16410 | };
|
16411 | };
|
16412 | Object.defineProperty(MDCRipple.prototype, "unbounded", {
|
16413 | get: function get() {
|
16414 | return Boolean(this.isUnbounded);
|
16415 | },
|
16416 | set: function set(unbounded) {
|
16417 | this.isUnbounded = Boolean(unbounded);
|
16418 | this.setUnbounded();
|
16419 | },
|
16420 | enumerable: false,
|
16421 | configurable: true
|
16422 | });
|
16423 | MDCRipple.prototype.activate = function () {
|
16424 | this.foundation.activate();
|
16425 | };
|
16426 | MDCRipple.prototype.deactivate = function () {
|
16427 | this.foundation.deactivate();
|
16428 | };
|
16429 | MDCRipple.prototype.layout = function () {
|
16430 | this.foundation.layout();
|
16431 | };
|
16432 | MDCRipple.prototype.getDefaultFoundation = function () {
|
16433 | return new foundation_1.MDCRippleFoundation(MDCRipple.createAdapter(this));
|
16434 | };
|
16435 | MDCRipple.prototype.initialSyncWithDOM = function () {
|
16436 | var root = this.root;
|
16437 | this.isUnbounded = 'mdcRippleIsUnbounded' in root.dataset;
|
16438 | };
|
16439 | |
16440 |
|
16441 |
|
16442 |
|
16443 |
|
16444 |
|
16445 | MDCRipple.prototype.setUnbounded = function () {
|
16446 | this.foundation.setUnbounded(Boolean(this.isUnbounded));
|
16447 | };
|
16448 | return MDCRipple;
|
16449 | }(component_1.MDCComponent);
|
16450 | exports.MDCRipple = MDCRipple;
|
16451 |
|
16452 | }),
|
16453 |
|
16454 | "./packages/mdc-ripple/constants.ts":
|
16455 |
|
16456 |
|
16457 |
|
16458 |
|
16459 | (function(module, exports, __webpack_require__) {
|
16460 |
|
16461 | "use strict";
|
16462 |
|
16463 |
|
16464 |
|
16465 |
|
16466 |
|
16467 |
|
16468 |
|
16469 |
|
16470 |
|
16471 |
|
16472 |
|
16473 |
|
16474 |
|
16475 |
|
16476 |
|
16477 |
|
16478 |
|
16479 |
|
16480 |
|
16481 |
|
16482 |
|
16483 |
|
16484 |
|
16485 |
|
16486 | Object.defineProperty(exports, "__esModule", { value: true });
|
16487 | exports.numbers = exports.strings = exports.cssClasses = void 0;
|
16488 | exports.cssClasses = {
|
16489 |
|
16490 |
|
16491 |
|
16492 | BG_FOCUSED: 'mdc-ripple-upgraded--background-focused',
|
16493 | FG_ACTIVATION: 'mdc-ripple-upgraded--foreground-activation',
|
16494 | FG_DEACTIVATION: 'mdc-ripple-upgraded--foreground-deactivation',
|
16495 | ROOT: 'mdc-ripple-upgraded',
|
16496 | UNBOUNDED: 'mdc-ripple-upgraded--unbounded'
|
16497 | };
|
16498 | exports.strings = {
|
16499 | VAR_FG_SCALE: '--mdc-ripple-fg-scale',
|
16500 | VAR_FG_SIZE: '--mdc-ripple-fg-size',
|
16501 | VAR_FG_TRANSLATE_END: '--mdc-ripple-fg-translate-end',
|
16502 | VAR_FG_TRANSLATE_START: '--mdc-ripple-fg-translate-start',
|
16503 | VAR_LEFT: '--mdc-ripple-left',
|
16504 | VAR_TOP: '--mdc-ripple-top'
|
16505 | };
|
16506 | exports.numbers = {
|
16507 | DEACTIVATION_TIMEOUT_MS: 225,
|
16508 | FG_DEACTIVATION_MS: 150,
|
16509 | INITIAL_ORIGIN_SCALE: 0.6,
|
16510 | PADDING: 10,
|
16511 | TAP_DELAY_MS: 300 };
|
16512 |
|
16513 | }),
|
16514 |
|
16515 | "./packages/mdc-ripple/foundation.ts":
|
16516 |
|
16517 |
|
16518 |
|
16519 |
|
16520 | (function(module, exports, __webpack_require__) {
|
16521 |
|
16522 | "use strict";
|
16523 |
|
16524 |
|
16525 |
|
16526 |
|
16527 |
|
16528 |
|
16529 |
|
16530 |
|
16531 |
|
16532 |
|
16533 |
|
16534 |
|
16535 |
|
16536 |
|
16537 |
|
16538 |
|
16539 |
|
16540 |
|
16541 |
|
16542 |
|
16543 |
|
16544 |
|
16545 |
|
16546 |
|
16547 | var __extends = this && this.__extends || function () {
|
16548 | var _extendStatics = function extendStatics(d, b) {
|
16549 | _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
|
16550 | d.__proto__ = b;
|
16551 | } || function (d, b) {
|
16552 | for (var p in b) {
|
16553 | if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
16554 | }
|
16555 | };
|
16556 | return _extendStatics(d, b);
|
16557 | };
|
16558 | return function (d, b) {
|
16559 | if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
16560 | _extendStatics(d, b);
|
16561 | function __() {
|
16562 | this.constructor = d;
|
16563 | }
|
16564 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
16565 | };
|
16566 | }();
|
16567 | var __assign = this && this.__assign || function () {
|
16568 | __assign = Object.assign || function (t) {
|
16569 | for (var s, i = 1, n = arguments.length; i < n; i++) {
|
16570 | s = arguments[i];
|
16571 | for (var p in s) {
|
16572 | if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
16573 | }
|
16574 | }
|
16575 | return t;
|
16576 | };
|
16577 | return __assign.apply(this, arguments);
|
16578 | };
|
16579 | var __values = this && this.__values || function (o) {
|
16580 | var s = typeof Symbol === "function" && Symbol.iterator,
|
16581 | m = s && o[s],
|
16582 | i = 0;
|
16583 | if (m) return m.call(o);
|
16584 | if (o && typeof o.length === "number") return {
|
16585 | next: function next() {
|
16586 | if (o && i >= o.length) o = void 0;
|
16587 | return { value: o && o[i++], done: !o };
|
16588 | }
|
16589 | };
|
16590 | throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
16591 | };
|
16592 | Object.defineProperty(exports, "__esModule", { value: true });
|
16593 | exports.MDCRippleFoundation = void 0;
|
16594 | var foundation_1 = __webpack_require__( "./packages/mdc-base/foundation.ts");
|
16595 | var constants_1 = __webpack_require__( "./packages/mdc-ripple/constants.ts");
|
16596 | var util_1 = __webpack_require__( "./packages/mdc-ripple/util.ts");
|
16597 |
|
16598 | var ACTIVATION_EVENT_TYPES = ['touchstart', 'pointerdown', 'mousedown', 'keydown'];
|
16599 |
|
16600 | var POINTER_DEACTIVATION_EVENT_TYPES = ['touchend', 'pointerup', 'mouseup', 'contextmenu'];
|
16601 |
|
16602 | var activatedTargets = [];
|
16603 | var MDCRippleFoundation = function (_super) {
|
16604 | __extends(MDCRippleFoundation, _super);
|
16605 | function MDCRippleFoundation(adapter) {
|
16606 | var _this = _super.call(this, __assign(__assign({}, MDCRippleFoundation.defaultAdapter), adapter)) || this;
|
16607 | _this.activationAnimationHasEnded = false;
|
16608 | _this.activationTimer = 0;
|
16609 | _this.fgDeactivationRemovalTimer = 0;
|
16610 | _this.fgScale = '0';
|
16611 | _this.frame = { width: 0, height: 0 };
|
16612 | _this.initialSize = 0;
|
16613 | _this.layoutFrame = 0;
|
16614 | _this.maxRadius = 0;
|
16615 | _this.unboundedCoords = { left: 0, top: 0 };
|
16616 | _this.activationState = _this.defaultActivationState();
|
16617 | _this.activationTimerCallback = function () {
|
16618 | _this.activationAnimationHasEnded = true;
|
16619 | _this.runDeactivationUXLogicIfReady();
|
16620 | };
|
16621 | _this.activateHandler = function (e) {
|
16622 | _this.activateImpl(e);
|
16623 | };
|
16624 | _this.deactivateHandler = function () {
|
16625 | _this.deactivateImpl();
|
16626 | };
|
16627 | _this.focusHandler = function () {
|
16628 | _this.handleFocus();
|
16629 | };
|
16630 | _this.blurHandler = function () {
|
16631 | _this.handleBlur();
|
16632 | };
|
16633 | _this.resizeHandler = function () {
|
16634 | _this.layout();
|
16635 | };
|
16636 | return _this;
|
16637 | }
|
16638 | Object.defineProperty(MDCRippleFoundation, "cssClasses", {
|
16639 | get: function get() {
|
16640 | return constants_1.cssClasses;
|
16641 | },
|
16642 | enumerable: false,
|
16643 | configurable: true
|
16644 | });
|
16645 | Object.defineProperty(MDCRippleFoundation, "strings", {
|
16646 | get: function get() {
|
16647 | return constants_1.strings;
|
16648 | },
|
16649 | enumerable: false,
|
16650 | configurable: true
|
16651 | });
|
16652 | Object.defineProperty(MDCRippleFoundation, "numbers", {
|
16653 | get: function get() {
|
16654 | return constants_1.numbers;
|
16655 | },
|
16656 | enumerable: false,
|
16657 | configurable: true
|
16658 | });
|
16659 | Object.defineProperty(MDCRippleFoundation, "defaultAdapter", {
|
16660 | get: function get() {
|
16661 | return {
|
16662 | addClass: function addClass() {
|
16663 | return undefined;
|
16664 | },
|
16665 | browserSupportsCssVars: function browserSupportsCssVars() {
|
16666 | return true;
|
16667 | },
|
16668 | computeBoundingRect: function computeBoundingRect() {
|
16669 | return { top: 0, right: 0, bottom: 0, left: 0, width: 0, height: 0 };
|
16670 | },
|
16671 | containsEventTarget: function containsEventTarget() {
|
16672 | return true;
|
16673 | },
|
16674 | deregisterDocumentInteractionHandler: function deregisterDocumentInteractionHandler() {
|
16675 | return undefined;
|
16676 | },
|
16677 | deregisterInteractionHandler: function deregisterInteractionHandler() {
|
16678 | return undefined;
|
16679 | },
|
16680 | deregisterResizeHandler: function deregisterResizeHandler() {
|
16681 | return undefined;
|
16682 | },
|
16683 | getWindowPageOffset: function getWindowPageOffset() {
|
16684 | return { x: 0, y: 0 };
|
16685 | },
|
16686 | isSurfaceActive: function isSurfaceActive() {
|
16687 | return true;
|
16688 | },
|
16689 | isSurfaceDisabled: function isSurfaceDisabled() {
|
16690 | return true;
|
16691 | },
|
16692 | isUnbounded: function isUnbounded() {
|
16693 | return true;
|
16694 | },
|
16695 | registerDocumentInteractionHandler: function registerDocumentInteractionHandler() {
|
16696 | return undefined;
|
16697 | },
|
16698 | registerInteractionHandler: function registerInteractionHandler() {
|
16699 | return undefined;
|
16700 | },
|
16701 | registerResizeHandler: function registerResizeHandler() {
|
16702 | return undefined;
|
16703 | },
|
16704 | removeClass: function removeClass() {
|
16705 | return undefined;
|
16706 | },
|
16707 | updateCssVariable: function updateCssVariable() {
|
16708 | return undefined;
|
16709 | }
|
16710 | };
|
16711 | },
|
16712 | enumerable: false,
|
16713 | configurable: true
|
16714 | });
|
16715 | MDCRippleFoundation.prototype.init = function () {
|
16716 | var _this = this;
|
16717 | var supportsPressRipple = this.supportsPressRipple();
|
16718 | this.registerRootHandlers(supportsPressRipple);
|
16719 | if (supportsPressRipple) {
|
16720 | var _a = MDCRippleFoundation.cssClasses,
|
16721 | ROOT_1 = _a.ROOT,
|
16722 | UNBOUNDED_1 = _a.UNBOUNDED;
|
16723 | requestAnimationFrame(function () {
|
16724 | _this.adapter.addClass(ROOT_1);
|
16725 | if (_this.adapter.isUnbounded()) {
|
16726 | _this.adapter.addClass(UNBOUNDED_1);
|
16727 |
|
16728 | _this.layoutInternal();
|
16729 | }
|
16730 | });
|
16731 | }
|
16732 | };
|
16733 | MDCRippleFoundation.prototype.destroy = function () {
|
16734 | var _this = this;
|
16735 | if (this.supportsPressRipple()) {
|
16736 | if (this.activationTimer) {
|
16737 | clearTimeout(this.activationTimer);
|
16738 | this.activationTimer = 0;
|
16739 | this.adapter.removeClass(MDCRippleFoundation.cssClasses.FG_ACTIVATION);
|
16740 | }
|
16741 | if (this.fgDeactivationRemovalTimer) {
|
16742 | clearTimeout(this.fgDeactivationRemovalTimer);
|
16743 | this.fgDeactivationRemovalTimer = 0;
|
16744 | this.adapter.removeClass(MDCRippleFoundation.cssClasses.FG_DEACTIVATION);
|
16745 | }
|
16746 | var _a = MDCRippleFoundation.cssClasses,
|
16747 | ROOT_2 = _a.ROOT,
|
16748 | UNBOUNDED_2 = _a.UNBOUNDED;
|
16749 | requestAnimationFrame(function () {
|
16750 | _this.adapter.removeClass(ROOT_2);
|
16751 | _this.adapter.removeClass(UNBOUNDED_2);
|
16752 | _this.removeCssVars();
|
16753 | });
|
16754 | }
|
16755 | this.deregisterRootHandlers();
|
16756 | this.deregisterDeactivationHandlers();
|
16757 | };
|
16758 | |
16759 |
|
16760 |
|
16761 | MDCRippleFoundation.prototype.activate = function (evt) {
|
16762 | this.activateImpl(evt);
|
16763 | };
|
16764 | MDCRippleFoundation.prototype.deactivate = function () {
|
16765 | this.deactivateImpl();
|
16766 | };
|
16767 | MDCRippleFoundation.prototype.layout = function () {
|
16768 | var _this = this;
|
16769 | if (this.layoutFrame) {
|
16770 | cancelAnimationFrame(this.layoutFrame);
|
16771 | }
|
16772 | this.layoutFrame = requestAnimationFrame(function () {
|
16773 | _this.layoutInternal();
|
16774 | _this.layoutFrame = 0;
|
16775 | });
|
16776 | };
|
16777 | MDCRippleFoundation.prototype.setUnbounded = function (unbounded) {
|
16778 | var UNBOUNDED = MDCRippleFoundation.cssClasses.UNBOUNDED;
|
16779 | if (unbounded) {
|
16780 | this.adapter.addClass(UNBOUNDED);
|
16781 | } else {
|
16782 | this.adapter.removeClass(UNBOUNDED);
|
16783 | }
|
16784 | };
|
16785 | MDCRippleFoundation.prototype.handleFocus = function () {
|
16786 | var _this = this;
|
16787 | requestAnimationFrame(function () {
|
16788 | return _this.adapter.addClass(MDCRippleFoundation.cssClasses.BG_FOCUSED);
|
16789 | });
|
16790 | };
|
16791 | MDCRippleFoundation.prototype.handleBlur = function () {
|
16792 | var _this = this;
|
16793 | requestAnimationFrame(function () {
|
16794 | return _this.adapter.removeClass(MDCRippleFoundation.cssClasses.BG_FOCUSED);
|
16795 | });
|
16796 | };
|
16797 | |
16798 |
|
16799 |
|
16800 |
|
16801 |
|
16802 |
|
16803 | MDCRippleFoundation.prototype.supportsPressRipple = function () {
|
16804 | return this.adapter.browserSupportsCssVars();
|
16805 | };
|
16806 | MDCRippleFoundation.prototype.defaultActivationState = function () {
|
16807 | return {
|
16808 | activationEvent: undefined,
|
16809 | hasDeactivationUXRun: false,
|
16810 | isActivated: false,
|
16811 | isProgrammatic: false,
|
16812 | wasActivatedByPointer: false,
|
16813 | wasElementMadeActive: false
|
16814 | };
|
16815 | };
|
16816 | |
16817 |
|
16818 |
|
16819 | MDCRippleFoundation.prototype.registerRootHandlers = function (supportsPressRipple) {
|
16820 | var e_1, _a;
|
16821 | if (supportsPressRipple) {
|
16822 | try {
|
16823 | 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()) {
|
16824 | var evtType = ACTIVATION_EVENT_TYPES_1_1.value;
|
16825 | this.adapter.registerInteractionHandler(evtType, this.activateHandler);
|
16826 | }
|
16827 | } catch (e_1_1) {
|
16828 | e_1 = { error: e_1_1 };
|
16829 | } finally {
|
16830 | try {
|
16831 | if (ACTIVATION_EVENT_TYPES_1_1 && !ACTIVATION_EVENT_TYPES_1_1.done && (_a = ACTIVATION_EVENT_TYPES_1.return)) _a.call(ACTIVATION_EVENT_TYPES_1);
|
16832 | } finally {
|
16833 | if (e_1) throw e_1.error;
|
16834 | }
|
16835 | }
|
16836 | if (this.adapter.isUnbounded()) {
|
16837 | this.adapter.registerResizeHandler(this.resizeHandler);
|
16838 | }
|
16839 | }
|
16840 | this.adapter.registerInteractionHandler('focus', this.focusHandler);
|
16841 | this.adapter.registerInteractionHandler('blur', this.blurHandler);
|
16842 | };
|
16843 | MDCRippleFoundation.prototype.registerDeactivationHandlers = function (evt) {
|
16844 | var e_2, _a;
|
16845 | if (evt.type === 'keydown') {
|
16846 | this.adapter.registerInteractionHandler('keyup', this.deactivateHandler);
|
16847 | } else {
|
16848 | try {
|
16849 | 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()) {
|
16850 | var evtType = POINTER_DEACTIVATION_EVENT_TYPES_1_1.value;
|
16851 | this.adapter.registerDocumentInteractionHandler(evtType, this.deactivateHandler);
|
16852 | }
|
16853 | } catch (e_2_1) {
|
16854 | e_2 = { error: e_2_1 };
|
16855 | } finally {
|
16856 | try {
|
16857 | 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);
|
16858 | } finally {
|
16859 | if (e_2) throw e_2.error;
|
16860 | }
|
16861 | }
|
16862 | }
|
16863 | };
|
16864 | MDCRippleFoundation.prototype.deregisterRootHandlers = function () {
|
16865 | var e_3, _a;
|
16866 | try {
|
16867 | 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()) {
|
16868 | var evtType = ACTIVATION_EVENT_TYPES_2_1.value;
|
16869 | this.adapter.deregisterInteractionHandler(evtType, this.activateHandler);
|
16870 | }
|
16871 | } catch (e_3_1) {
|
16872 | e_3 = { error: e_3_1 };
|
16873 | } finally {
|
16874 | try {
|
16875 | if (ACTIVATION_EVENT_TYPES_2_1 && !ACTIVATION_EVENT_TYPES_2_1.done && (_a = ACTIVATION_EVENT_TYPES_2.return)) _a.call(ACTIVATION_EVENT_TYPES_2);
|
16876 | } finally {
|
16877 | if (e_3) throw e_3.error;
|
16878 | }
|
16879 | }
|
16880 | this.adapter.deregisterInteractionHandler('focus', this.focusHandler);
|
16881 | this.adapter.deregisterInteractionHandler('blur', this.blurHandler);
|
16882 | if (this.adapter.isUnbounded()) {
|
16883 | this.adapter.deregisterResizeHandler(this.resizeHandler);
|
16884 | }
|
16885 | };
|
16886 | MDCRippleFoundation.prototype.deregisterDeactivationHandlers = function () {
|
16887 | var e_4, _a;
|
16888 | this.adapter.deregisterInteractionHandler('keyup', this.deactivateHandler);
|
16889 | try {
|
16890 | 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()) {
|
16891 | var evtType = POINTER_DEACTIVATION_EVENT_TYPES_2_1.value;
|
16892 | this.adapter.deregisterDocumentInteractionHandler(evtType, this.deactivateHandler);
|
16893 | }
|
16894 | } catch (e_4_1) {
|
16895 | e_4 = { error: e_4_1 };
|
16896 | } finally {
|
16897 | try {
|
16898 | 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);
|
16899 | } finally {
|
16900 | if (e_4) throw e_4.error;
|
16901 | }
|
16902 | }
|
16903 | };
|
16904 | MDCRippleFoundation.prototype.removeCssVars = function () {
|
16905 | var _this = this;
|
16906 | var rippleStrings = MDCRippleFoundation.strings;
|
16907 | var keys = Object.keys(rippleStrings);
|
16908 | keys.forEach(function (key) {
|
16909 | if (key.indexOf('VAR_') === 0) {
|
16910 | _this.adapter.updateCssVariable(rippleStrings[key], null);
|
16911 | }
|
16912 | });
|
16913 | };
|
16914 | MDCRippleFoundation.prototype.activateImpl = function (evt) {
|
16915 | var _this = this;
|
16916 | if (this.adapter.isSurfaceDisabled()) {
|
16917 | return;
|
16918 | }
|
16919 | var activationState = this.activationState;
|
16920 | if (activationState.isActivated) {
|
16921 | return;
|
16922 | }
|
16923 |
|
16924 | var previousActivationEvent = this.previousActivationEvent;
|
16925 | var isSameInteraction = previousActivationEvent && evt !== undefined && previousActivationEvent.type !== evt.type;
|
16926 | if (isSameInteraction) {
|
16927 | return;
|
16928 | }
|
16929 | activationState.isActivated = true;
|
16930 | activationState.isProgrammatic = evt === undefined;
|
16931 | activationState.activationEvent = evt;
|
16932 | activationState.wasActivatedByPointer = activationState.isProgrammatic ? false : evt !== undefined && (evt.type === 'mousedown' || evt.type === 'touchstart' || evt.type === 'pointerdown');
|
16933 | var hasActivatedChild = evt !== undefined && activatedTargets.length > 0 && activatedTargets.some(function (target) {
|
16934 | return _this.adapter.containsEventTarget(target);
|
16935 | });
|
16936 | if (hasActivatedChild) {
|
16937 |
|
16938 | this.resetActivationState();
|
16939 | return;
|
16940 | }
|
16941 | if (evt !== undefined) {
|
16942 | activatedTargets.push(evt.target);
|
16943 | this.registerDeactivationHandlers(evt);
|
16944 | }
|
16945 | activationState.wasElementMadeActive = this.checkElementMadeActive(evt);
|
16946 | if (activationState.wasElementMadeActive) {
|
16947 | this.animateActivation();
|
16948 | }
|
16949 | requestAnimationFrame(function () {
|
16950 |
|
16951 | activatedTargets = [];
|
16952 | if (!activationState.wasElementMadeActive && evt !== undefined && (evt.key === ' ' || evt.keyCode === 32)) {
|
16953 |
|
16954 |
|
16955 |
|
16956 |
|
16957 |
|
16958 |
|
16959 | activationState.wasElementMadeActive = _this.checkElementMadeActive(evt);
|
16960 | if (activationState.wasElementMadeActive) {
|
16961 | _this.animateActivation();
|
16962 | }
|
16963 | }
|
16964 | if (!activationState.wasElementMadeActive) {
|
16965 |
|
16966 | _this.activationState = _this.defaultActivationState();
|
16967 | }
|
16968 | });
|
16969 | };
|
16970 | MDCRippleFoundation.prototype.checkElementMadeActive = function (evt) {
|
16971 | return evt !== undefined && evt.type === 'keydown' ? this.adapter.isSurfaceActive() : true;
|
16972 | };
|
16973 | MDCRippleFoundation.prototype.animateActivation = function () {
|
16974 | var _this = this;
|
16975 | var _a = MDCRippleFoundation.strings,
|
16976 | VAR_FG_TRANSLATE_START = _a.VAR_FG_TRANSLATE_START,
|
16977 | VAR_FG_TRANSLATE_END = _a.VAR_FG_TRANSLATE_END;
|
16978 | var _b = MDCRippleFoundation.cssClasses,
|
16979 | FG_DEACTIVATION = _b.FG_DEACTIVATION,
|
16980 | FG_ACTIVATION = _b.FG_ACTIVATION;
|
16981 | var DEACTIVATION_TIMEOUT_MS = MDCRippleFoundation.numbers.DEACTIVATION_TIMEOUT_MS;
|
16982 | this.layoutInternal();
|
16983 | var translateStart = '';
|
16984 | var translateEnd = '';
|
16985 | if (!this.adapter.isUnbounded()) {
|
16986 | var _c = this.getFgTranslationCoordinates(),
|
16987 | startPoint = _c.startPoint,
|
16988 | endPoint = _c.endPoint;
|
16989 | translateStart = startPoint.x + "px, " + startPoint.y + "px";
|
16990 | translateEnd = endPoint.x + "px, " + endPoint.y + "px";
|
16991 | }
|
16992 | this.adapter.updateCssVariable(VAR_FG_TRANSLATE_START, translateStart);
|
16993 | this.adapter.updateCssVariable(VAR_FG_TRANSLATE_END, translateEnd);
|
16994 |
|
16995 | clearTimeout(this.activationTimer);
|
16996 | clearTimeout(this.fgDeactivationRemovalTimer);
|
16997 | this.rmBoundedActivationClasses();
|
16998 | this.adapter.removeClass(FG_DEACTIVATION);
|
16999 |
|
17000 | this.adapter.computeBoundingRect();
|
17001 | this.adapter.addClass(FG_ACTIVATION);
|
17002 | this.activationTimer = setTimeout(function () {
|
17003 | _this.activationTimerCallback();
|
17004 | }, DEACTIVATION_TIMEOUT_MS);
|
17005 | };
|
17006 | MDCRippleFoundation.prototype.getFgTranslationCoordinates = function () {
|
17007 | var _a = this.activationState,
|
17008 | activationEvent = _a.activationEvent,
|
17009 | wasActivatedByPointer = _a.wasActivatedByPointer;
|
17010 | var startPoint;
|
17011 | if (wasActivatedByPointer) {
|
17012 | startPoint = util_1.getNormalizedEventCoords(activationEvent, this.adapter.getWindowPageOffset(), this.adapter.computeBoundingRect());
|
17013 | } else {
|
17014 | startPoint = {
|
17015 | x: this.frame.width / 2,
|
17016 | y: this.frame.height / 2
|
17017 | };
|
17018 | }
|
17019 |
|
17020 | startPoint = {
|
17021 | x: startPoint.x - this.initialSize / 2,
|
17022 | y: startPoint.y - this.initialSize / 2
|
17023 | };
|
17024 | var endPoint = {
|
17025 | x: this.frame.width / 2 - this.initialSize / 2,
|
17026 | y: this.frame.height / 2 - this.initialSize / 2
|
17027 | };
|
17028 | return { startPoint: startPoint, endPoint: endPoint };
|
17029 | };
|
17030 | MDCRippleFoundation.prototype.runDeactivationUXLogicIfReady = function () {
|
17031 | var _this = this;
|
17032 |
|
17033 |
|
17034 | var FG_DEACTIVATION = MDCRippleFoundation.cssClasses.FG_DEACTIVATION;
|
17035 | var _a = this.activationState,
|
17036 | hasDeactivationUXRun = _a.hasDeactivationUXRun,
|
17037 | isActivated = _a.isActivated;
|
17038 | var activationHasEnded = hasDeactivationUXRun || !isActivated;
|
17039 | if (activationHasEnded && this.activationAnimationHasEnded) {
|
17040 | this.rmBoundedActivationClasses();
|
17041 | this.adapter.addClass(FG_DEACTIVATION);
|
17042 | this.fgDeactivationRemovalTimer = setTimeout(function () {
|
17043 | _this.adapter.removeClass(FG_DEACTIVATION);
|
17044 | }, constants_1.numbers.FG_DEACTIVATION_MS);
|
17045 | }
|
17046 | };
|
17047 | MDCRippleFoundation.prototype.rmBoundedActivationClasses = function () {
|
17048 | var FG_ACTIVATION = MDCRippleFoundation.cssClasses.FG_ACTIVATION;
|
17049 | this.adapter.removeClass(FG_ACTIVATION);
|
17050 | this.activationAnimationHasEnded = false;
|
17051 | this.adapter.computeBoundingRect();
|
17052 | };
|
17053 | MDCRippleFoundation.prototype.resetActivationState = function () {
|
17054 | var _this = this;
|
17055 | this.previousActivationEvent = this.activationState.activationEvent;
|
17056 | this.activationState = this.defaultActivationState();
|
17057 |
|
17058 |
|
17059 | setTimeout(function () {
|
17060 | return _this.previousActivationEvent = undefined;
|
17061 | }, MDCRippleFoundation.numbers.TAP_DELAY_MS);
|
17062 | };
|
17063 | MDCRippleFoundation.prototype.deactivateImpl = function () {
|
17064 | var _this = this;
|
17065 | var activationState = this.activationState;
|
17066 |
|
17067 | if (!activationState.isActivated) {
|
17068 | return;
|
17069 | }
|
17070 | var state = __assign({}, activationState);
|
17071 | if (activationState.isProgrammatic) {
|
17072 | requestAnimationFrame(function () {
|
17073 | _this.animateDeactivation(state);
|
17074 | });
|
17075 | this.resetActivationState();
|
17076 | } else {
|
17077 | this.deregisterDeactivationHandlers();
|
17078 | requestAnimationFrame(function () {
|
17079 | _this.activationState.hasDeactivationUXRun = true;
|
17080 | _this.animateDeactivation(state);
|
17081 | _this.resetActivationState();
|
17082 | });
|
17083 | }
|
17084 | };
|
17085 | MDCRippleFoundation.prototype.animateDeactivation = function (_a) {
|
17086 | var wasActivatedByPointer = _a.wasActivatedByPointer,
|
17087 | wasElementMadeActive = _a.wasElementMadeActive;
|
17088 | if (wasActivatedByPointer || wasElementMadeActive) {
|
17089 | this.runDeactivationUXLogicIfReady();
|
17090 | }
|
17091 | };
|
17092 | MDCRippleFoundation.prototype.layoutInternal = function () {
|
17093 | var _this = this;
|
17094 | this.frame = this.adapter.computeBoundingRect();
|
17095 | var maxDim = Math.max(this.frame.height, this.frame.width);
|
17096 |
|
17097 |
|
17098 |
|
17099 |
|
17100 |
|
17101 |
|
17102 | var getBoundedRadius = function getBoundedRadius() {
|
17103 | var hypotenuse = Math.sqrt(Math.pow(_this.frame.width, 2) + Math.pow(_this.frame.height, 2));
|
17104 | return hypotenuse + MDCRippleFoundation.numbers.PADDING;
|
17105 | };
|
17106 | this.maxRadius = this.adapter.isUnbounded() ? maxDim : getBoundedRadius();
|
17107 |
|
17108 | var initialSize = Math.floor(maxDim * MDCRippleFoundation.numbers.INITIAL_ORIGIN_SCALE);
|
17109 |
|
17110 | if (this.adapter.isUnbounded() && initialSize % 2 !== 0) {
|
17111 | this.initialSize = initialSize - 1;
|
17112 | } else {
|
17113 | this.initialSize = initialSize;
|
17114 | }
|
17115 | this.fgScale = "" + this.maxRadius / this.initialSize;
|
17116 | this.updateLayoutCssVars();
|
17117 | };
|
17118 | MDCRippleFoundation.prototype.updateLayoutCssVars = function () {
|
17119 | var _a = MDCRippleFoundation.strings,
|
17120 | VAR_FG_SIZE = _a.VAR_FG_SIZE,
|
17121 | VAR_LEFT = _a.VAR_LEFT,
|
17122 | VAR_TOP = _a.VAR_TOP,
|
17123 | VAR_FG_SCALE = _a.VAR_FG_SCALE;
|
17124 | this.adapter.updateCssVariable(VAR_FG_SIZE, this.initialSize + "px");
|
17125 | this.adapter.updateCssVariable(VAR_FG_SCALE, this.fgScale);
|
17126 | if (this.adapter.isUnbounded()) {
|
17127 | this.unboundedCoords = {
|
17128 | left: Math.round(this.frame.width / 2 - this.initialSize / 2),
|
17129 | top: Math.round(this.frame.height / 2 - this.initialSize / 2)
|
17130 | };
|
17131 | this.adapter.updateCssVariable(VAR_LEFT, this.unboundedCoords.left + "px");
|
17132 | this.adapter.updateCssVariable(VAR_TOP, this.unboundedCoords.top + "px");
|
17133 | }
|
17134 | };
|
17135 | return MDCRippleFoundation;
|
17136 | }(foundation_1.MDCFoundation);
|
17137 | exports.MDCRippleFoundation = MDCRippleFoundation;
|
17138 |
|
17139 | exports.default = MDCRippleFoundation;
|
17140 |
|
17141 | }),
|
17142 |
|
17143 | "./packages/mdc-ripple/index.ts":
|
17144 |
|
17145 |
|
17146 |
|
17147 |
|
17148 | (function(module, exports, __webpack_require__) {
|
17149 |
|
17150 | "use strict";
|
17151 |
|
17152 |
|
17153 |
|
17154 |
|
17155 |
|
17156 |
|
17157 |
|
17158 |
|
17159 |
|
17160 |
|
17161 |
|
17162 |
|
17163 |
|
17164 |
|
17165 |
|
17166 |
|
17167 |
|
17168 |
|
17169 |
|
17170 |
|
17171 |
|
17172 |
|
17173 |
|
17174 |
|
17175 | var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
|
17176 | if (k2 === undefined) k2 = k;
|
17177 | Object.defineProperty(o, k2, { enumerable: true, get: function get() {
|
17178 | return m[k];
|
17179 | } });
|
17180 | } : function (o, m, k, k2) {
|
17181 | if (k2 === undefined) k2 = k;
|
17182 | o[k2] = m[k];
|
17183 | });
|
17184 | var __setModuleDefault = this && this.__setModuleDefault || (Object.create ? function (o, v) {
|
17185 | Object.defineProperty(o, "default", { enumerable: true, value: v });
|
17186 | } : function (o, v) {
|
17187 | o["default"] = v;
|
17188 | });
|
17189 | var __importStar = this && this.__importStar || function (mod) {
|
17190 | if (mod && mod.__esModule) return mod;
|
17191 | var result = {};
|
17192 | if (mod != null) for (var k in mod) {
|
17193 | if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
17194 | }__setModuleDefault(result, mod);
|
17195 | return result;
|
17196 | };
|
17197 | var __exportStar = this && this.__exportStar || function (m, exports) {
|
17198 | for (var p in m) {
|
17199 | if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
17200 | }
|
17201 | };
|
17202 | Object.defineProperty(exports, "__esModule", { value: true });
|
17203 | exports.util = void 0;
|
17204 | var util = __importStar(__webpack_require__( "./packages/mdc-ripple/util.ts"));
|
17205 | exports.util = util;
|
17206 | __exportStar(__webpack_require__( "./packages/mdc-ripple/adapter.ts"), exports);
|
17207 | __exportStar(__webpack_require__( "./packages/mdc-ripple/component.ts"), exports);
|
17208 | __exportStar(__webpack_require__( "./packages/mdc-ripple/constants.ts"), exports);
|
17209 | __exportStar(__webpack_require__( "./packages/mdc-ripple/foundation.ts"), exports);
|
17210 | __exportStar(__webpack_require__( "./packages/mdc-ripple/types.ts"), exports);
|
17211 |
|
17212 | }),
|
17213 |
|
17214 | "./packages/mdc-ripple/types.ts":
|
17215 |
|
17216 |
|
17217 |
|
17218 |
|
17219 | (function(module, exports, __webpack_require__) {
|
17220 |
|
17221 | "use strict";
|
17222 |
|
17223 |
|
17224 |
|
17225 |
|
17226 |
|
17227 |
|
17228 |
|
17229 |
|
17230 |
|
17231 |
|
17232 |
|
17233 |
|
17234 |
|
17235 |
|
17236 |
|
17237 |
|
17238 |
|
17239 |
|
17240 |
|
17241 |
|
17242 |
|
17243 |
|
17244 |
|
17245 |
|
17246 | Object.defineProperty(exports, "__esModule", { value: true });
|
17247 |
|
17248 | }),
|
17249 |
|
17250 | "./packages/mdc-ripple/util.ts":
|
17251 |
|
17252 |
|
17253 |
|
17254 |
|
17255 | (function(module, exports, __webpack_require__) {
|
17256 |
|
17257 | "use strict";
|
17258 |
|
17259 |
|
17260 | Object.defineProperty(exports, "__esModule", { value: true });
|
17261 | exports.getNormalizedEventCoords = exports.supportsCssVariables = void 0;
|
17262 |
|
17263 |
|
17264 |
|
17265 |
|
17266 | var supportsCssVariables_;
|
17267 | function supportsCssVariables(windowObj, forceRefresh) {
|
17268 | if (forceRefresh === void 0) {
|
17269 | forceRefresh = false;
|
17270 | }
|
17271 | var CSS = windowObj.CSS;
|
17272 | var supportsCssVars = supportsCssVariables_;
|
17273 | if (typeof supportsCssVariables_ === 'boolean' && !forceRefresh) {
|
17274 | return supportsCssVariables_;
|
17275 | }
|
17276 | var supportsFunctionPresent = CSS && typeof CSS.supports === 'function';
|
17277 | if (!supportsFunctionPresent) {
|
17278 | return false;
|
17279 | }
|
17280 | var explicitlySupportsCssVars = CSS.supports('--css-vars', 'yes');
|
17281 |
|
17282 |
|
17283 | var weAreFeatureDetectingSafari10plus = CSS.supports('(--css-vars: yes)') && CSS.supports('color', '#00000000');
|
17284 | supportsCssVars = explicitlySupportsCssVars || weAreFeatureDetectingSafari10plus;
|
17285 | if (!forceRefresh) {
|
17286 | supportsCssVariables_ = supportsCssVars;
|
17287 | }
|
17288 | return supportsCssVars;
|
17289 | }
|
17290 | exports.supportsCssVariables = supportsCssVariables;
|
17291 | function getNormalizedEventCoords(evt, pageOffset, clientRect) {
|
17292 | if (!evt) {
|
17293 | return { x: 0, y: 0 };
|
17294 | }
|
17295 | var x = pageOffset.x,
|
17296 | y = pageOffset.y;
|
17297 | var documentX = x + clientRect.left;
|
17298 | var documentY = y + clientRect.top;
|
17299 | var normalizedX;
|
17300 | var normalizedY;
|
17301 |
|
17302 | if (evt.type === 'touchstart') {
|
17303 | var touchEvent = evt;
|
17304 | normalizedX = touchEvent.changedTouches[0].pageX - documentX;
|
17305 | normalizedY = touchEvent.changedTouches[0].pageY - documentY;
|
17306 | } else {
|
17307 | var mouseEvent = evt;
|
17308 | normalizedX = mouseEvent.pageX - documentX;
|
17309 | normalizedY = mouseEvent.pageY - documentY;
|
17310 | }
|
17311 | return { x: normalizedX, y: normalizedY };
|
17312 | }
|
17313 | exports.getNormalizedEventCoords = getNormalizedEventCoords;
|
17314 |
|
17315 | }),
|
17316 |
|
17317 | "./packages/mdc-segmented-button/index.ts":
|
17318 |
|
17319 |
|
17320 |
|
17321 |
|
17322 | (function(module, exports, __webpack_require__) {
|
17323 |
|
17324 | "use strict";
|
17325 |
|
17326 |
|
17327 |
|
17328 |
|
17329 |
|
17330 |
|
17331 |
|
17332 |
|
17333 |
|
17334 |
|
17335 |
|
17336 |
|
17337 |
|
17338 |
|
17339 |
|
17340 |
|
17341 |
|
17342 |
|
17343 |
|
17344 |
|
17345 |
|
17346 |
|
17347 |
|
17348 |
|
17349 | var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
|
17350 | if (k2 === undefined) k2 = k;
|
17351 | Object.defineProperty(o, k2, { enumerable: true, get: function get() {
|
17352 | return m[k];
|
17353 | } });
|
17354 | } : function (o, m, k, k2) {
|
17355 | if (k2 === undefined) k2 = k;
|
17356 | o[k2] = m[k];
|
17357 | });
|
17358 | var __exportStar = this && this.__exportStar || function (m, exports) {
|
17359 | for (var p in m) {
|
17360 | if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
17361 | }
|
17362 | };
|
17363 | Object.defineProperty(exports, "__esModule", { value: true });
|
17364 | __exportStar(__webpack_require__( "./packages/mdc-segmented-button/segmented-button/index.ts"), exports);
|
17365 | __exportStar(__webpack_require__( "./packages/mdc-segmented-button/segment/index.ts"), exports);
|
17366 | __exportStar(__webpack_require__( "./packages/mdc-segmented-button/types.ts"), exports);
|
17367 |
|
17368 | }),
|
17369 |
|
17370 | "./packages/mdc-segmented-button/segment/adapter.ts":
|
17371 |
|
17372 |
|
17373 |
|
17374 |
|
17375 | (function(module, exports, __webpack_require__) {
|
17376 |
|
17377 | "use strict";
|
17378 |
|
17379 |
|
17380 |
|
17381 |
|
17382 |
|
17383 |
|
17384 |
|
17385 |
|
17386 |
|
17387 |
|
17388 |
|
17389 |
|
17390 |
|
17391 |
|
17392 |
|
17393 |
|
17394 |
|
17395 |
|
17396 |
|
17397 |
|
17398 |
|
17399 |
|
17400 |
|
17401 |
|
17402 | Object.defineProperty(exports, "__esModule", { value: true });
|
17403 |
|
17404 | }),
|
17405 |
|
17406 | "./packages/mdc-segmented-button/segment/component.ts":
|
17407 |
|
17408 |
|
17409 |
|
17410 |
|
17411 | (function(module, exports, __webpack_require__) {
|
17412 |
|
17413 | "use strict";
|
17414 |
|
17415 |
|
17416 |
|
17417 |
|
17418 |
|
17419 |
|
17420 |
|
17421 |
|
17422 |
|
17423 |
|
17424 |
|
17425 |
|
17426 |
|
17427 |
|
17428 |
|
17429 |
|
17430 |
|
17431 |
|
17432 |
|
17433 |
|
17434 |
|
17435 |
|
17436 |
|
17437 |
|
17438 | var __extends = this && this.__extends || function () {
|
17439 | var _extendStatics = function extendStatics(d, b) {
|
17440 | _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
|
17441 | d.__proto__ = b;
|
17442 | } || function (d, b) {
|
17443 | for (var p in b) {
|
17444 | if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
17445 | }
|
17446 | };
|
17447 | return _extendStatics(d, b);
|
17448 | };
|
17449 | return function (d, b) {
|
17450 | if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
17451 | _extendStatics(d, b);
|
17452 | function __() {
|
17453 | this.constructor = d;
|
17454 | }
|
17455 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
17456 | };
|
17457 | }();
|
17458 | var __assign = this && this.__assign || function () {
|
17459 | __assign = Object.assign || function (t) {
|
17460 | for (var s, i = 1, n = arguments.length; i < n; i++) {
|
17461 | s = arguments[i];
|
17462 | for (var p in s) {
|
17463 | if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
17464 | }
|
17465 | }
|
17466 | return t;
|
17467 | };
|
17468 | return __assign.apply(this, arguments);
|
17469 | };
|
17470 | Object.defineProperty(exports, "__esModule", { value: true });
|
17471 | exports.MDCSegmentedButtonSegment = void 0;
|
17472 | var component_1 = __webpack_require__( "./packages/mdc-base/component.ts");
|
17473 | var component_2 = __webpack_require__( "./packages/mdc-ripple/component.ts");
|
17474 | var foundation_1 = __webpack_require__( "./packages/mdc-ripple/foundation.ts");
|
17475 | var constants_1 = __webpack_require__( "./packages/mdc-segmented-button/segment/constants.ts");
|
17476 | var foundation_2 = __webpack_require__( "./packages/mdc-segmented-button/segment/foundation.ts");
|
17477 |
|
17478 |
|
17479 |
|
17480 | var MDCSegmentedButtonSegment = function (_super) {
|
17481 | __extends(MDCSegmentedButtonSegment, _super);
|
17482 | function MDCSegmentedButtonSegment() {
|
17483 | return _super !== null && _super.apply(this, arguments) || this;
|
17484 | }
|
17485 | Object.defineProperty(MDCSegmentedButtonSegment.prototype, "ripple", {
|
17486 | get: function get() {
|
17487 | return this.rippleComponent;
|
17488 | },
|
17489 | enumerable: false,
|
17490 | configurable: true
|
17491 | });
|
17492 | MDCSegmentedButtonSegment.attachTo = function (root) {
|
17493 | return new MDCSegmentedButtonSegment(root);
|
17494 | };
|
17495 | MDCSegmentedButtonSegment.prototype.initialize = function (rippleFactory) {
|
17496 | var _this = this;
|
17497 | if (rippleFactory === void 0) {
|
17498 | rippleFactory = function rippleFactory(el, foundation) {
|
17499 | return new component_2.MDCRipple(el, foundation);
|
17500 | };
|
17501 | }
|
17502 | var rippleAdapter = __assign(__assign({}, component_2.MDCRipple.createAdapter(this)), { computeBoundingRect: function computeBoundingRect() {
|
17503 | return _this.foundation.getDimensions();
|
17504 | } });
|
17505 | this.rippleComponent = rippleFactory(this.root, new foundation_1.MDCRippleFoundation(rippleAdapter));
|
17506 | };
|
17507 | MDCSegmentedButtonSegment.prototype.initialSyncWithDOM = function () {
|
17508 | var _this = this;
|
17509 | this.handleClick = function () {
|
17510 | _this.foundation.handleClick();
|
17511 | };
|
17512 | this.listen(constants_1.events.CLICK, this.handleClick);
|
17513 | };
|
17514 | MDCSegmentedButtonSegment.prototype.destroy = function () {
|
17515 | this.ripple.destroy();
|
17516 | this.unlisten(constants_1.events.CLICK, this.handleClick);
|
17517 | _super.prototype.destroy.call(this);
|
17518 | };
|
17519 | MDCSegmentedButtonSegment.prototype.getDefaultFoundation = function () {
|
17520 | var _this = this;
|
17521 |
|
17522 |
|
17523 |
|
17524 |
|
17525 | var adapter = {
|
17526 | isSingleSelect: function isSingleSelect() {
|
17527 | return _this.isSingleSelect;
|
17528 | },
|
17529 | getAttr: function getAttr(attrName) {
|
17530 | return _this.root.getAttribute(attrName);
|
17531 | },
|
17532 | setAttr: function setAttr(attrName, value) {
|
17533 | _this.root.setAttribute(attrName, value);
|
17534 | },
|
17535 | addClass: function addClass(className) {
|
17536 | _this.root.classList.add(className);
|
17537 | },
|
17538 | removeClass: function removeClass(className) {
|
17539 | _this.root.classList.remove(className);
|
17540 | },
|
17541 | hasClass: function hasClass(className) {
|
17542 | return _this.root.classList.contains(className);
|
17543 | },
|
17544 | notifySelectedChange: function notifySelectedChange(selected) {
|
17545 | _this.emit(constants_1.events.SELECTED, {
|
17546 | index: _this.index,
|
17547 | selected: selected,
|
17548 | segmentId: _this.getSegmentId()
|
17549 | }, true );
|
17550 | },
|
17551 | getRootBoundingClientRect: function getRootBoundingClientRect() {
|
17552 | return _this.root.getBoundingClientRect();
|
17553 | }
|
17554 | };
|
17555 | return new foundation_2.MDCSegmentedButtonSegmentFoundation(adapter);
|
17556 | };
|
17557 | |
17558 |
|
17559 |
|
17560 |
|
17561 |
|
17562 | MDCSegmentedButtonSegment.prototype.setIndex = function (index) {
|
17563 | this.index = index;
|
17564 | };
|
17565 | |
17566 |
|
17567 |
|
17568 |
|
17569 |
|
17570 | MDCSegmentedButtonSegment.prototype.setIsSingleSelect = function (isSingleSelect) {
|
17571 | this.isSingleSelect = isSingleSelect;
|
17572 | };
|
17573 | |
17574 |
|
17575 |
|
17576 |
|
17577 | MDCSegmentedButtonSegment.prototype.isSelected = function () {
|
17578 | return this.foundation.isSelected();
|
17579 | };
|
17580 | |
17581 |
|
17582 |
|
17583 | MDCSegmentedButtonSegment.prototype.setSelected = function () {
|
17584 | this.foundation.setSelected();
|
17585 | };
|
17586 | |
17587 |
|
17588 |
|
17589 | MDCSegmentedButtonSegment.prototype.setUnselected = function () {
|
17590 | this.foundation.setUnselected();
|
17591 | };
|
17592 | |
17593 |
|
17594 |
|
17595 | MDCSegmentedButtonSegment.prototype.getSegmentId = function () {
|
17596 | return this.foundation.getSegmentId();
|
17597 | };
|
17598 | return MDCSegmentedButtonSegment;
|
17599 | }(component_1.MDCComponent);
|
17600 | exports.MDCSegmentedButtonSegment = MDCSegmentedButtonSegment;
|
17601 |
|
17602 | }),
|
17603 |
|
17604 | "./packages/mdc-segmented-button/segment/constants.ts":
|
17605 |
|
17606 |
|
17607 |
|
17608 |
|
17609 | (function(module, exports, __webpack_require__) {
|
17610 |
|
17611 | "use strict";
|
17612 |
|
17613 |
|
17614 |
|
17615 |
|
17616 |
|
17617 |
|
17618 |
|
17619 |
|
17620 |
|
17621 |
|
17622 |
|
17623 |
|
17624 |
|
17625 |
|
17626 |
|
17627 |
|
17628 |
|
17629 |
|
17630 |
|
17631 |
|
17632 |
|
17633 |
|
17634 |
|
17635 |
|
17636 | Object.defineProperty(exports, "__esModule", { value: true });
|
17637 | exports.cssClasses = exports.events = exports.attributes = exports.booleans = void 0;
|
17638 |
|
17639 |
|
17640 |
|
17641 | exports.booleans = {
|
17642 | TRUE: 'true',
|
17643 | FALSE: 'false'
|
17644 | };
|
17645 |
|
17646 |
|
17647 |
|
17648 | exports.attributes = {
|
17649 | ARIA_CHECKED: 'aria-checked',
|
17650 | ARIA_PRESSED: 'aria-pressed',
|
17651 | DATA_SEGMENT_ID: 'data-segment-id'
|
17652 | };
|
17653 |
|
17654 |
|
17655 |
|
17656 | exports.events = {
|
17657 | CLICK: 'click',
|
17658 | SELECTED: 'selected'
|
17659 | };
|
17660 |
|
17661 |
|
17662 |
|
17663 | exports.cssClasses = {
|
17664 | SELECTED: 'mdc-segmented-button__segment--selected'
|
17665 | };
|
17666 |
|
17667 | }),
|
17668 |
|
17669 | "./packages/mdc-segmented-button/segment/foundation.ts":
|
17670 |
|
17671 |
|
17672 |
|
17673 |
|
17674 | (function(module, exports, __webpack_require__) {
|
17675 |
|
17676 | "use strict";
|
17677 |
|
17678 |
|
17679 |
|
17680 |
|
17681 |
|
17682 |
|
17683 |
|
17684 |
|
17685 |
|
17686 |
|
17687 |
|
17688 |
|
17689 |
|
17690 |
|
17691 |
|
17692 |
|
17693 |
|
17694 |
|
17695 |
|
17696 |
|
17697 |
|
17698 |
|
17699 |
|
17700 |
|
17701 | var __extends = this && this.__extends || function () {
|
17702 | var _extendStatics = function extendStatics(d, b) {
|
17703 | _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
|
17704 | d.__proto__ = b;
|
17705 | } || function (d, b) {
|
17706 | for (var p in b) {
|
17707 | if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
17708 | }
|
17709 | };
|
17710 | return _extendStatics(d, b);
|
17711 | };
|
17712 | return function (d, b) {
|
17713 | if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
17714 | _extendStatics(d, b);
|
17715 | function __() {
|
17716 | this.constructor = d;
|
17717 | }
|
17718 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
17719 | };
|
17720 | }();
|
17721 | var __assign = this && this.__assign || function () {
|
17722 | __assign = Object.assign || function (t) {
|
17723 | for (var s, i = 1, n = arguments.length; i < n; i++) {
|
17724 | s = arguments[i];
|
17725 | for (var p in s) {
|
17726 | if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
17727 | }
|
17728 | }
|
17729 | return t;
|
17730 | };
|
17731 | return __assign.apply(this, arguments);
|
17732 | };
|
17733 | Object.defineProperty(exports, "__esModule", { value: true });
|
17734 | exports.MDCSegmentedButtonSegmentFoundation = void 0;
|
17735 | var foundation_1 = __webpack_require__( "./packages/mdc-base/foundation.ts");
|
17736 | var constants_1 = __webpack_require__( "./packages/mdc-segmented-button/segment/constants.ts");
|
17737 | var emptyClientRect = {
|
17738 | bottom: 0,
|
17739 | height: 0,
|
17740 | left: 0,
|
17741 | right: 0,
|
17742 | top: 0,
|
17743 | width: 0
|
17744 | };
|
17745 | var MDCSegmentedButtonSegmentFoundation = function (_super) {
|
17746 | __extends(MDCSegmentedButtonSegmentFoundation, _super);
|
17747 | function MDCSegmentedButtonSegmentFoundation(adapter) {
|
17748 | return _super.call(this, __assign(__assign({}, MDCSegmentedButtonSegmentFoundation.defaultAdapter), adapter)) || this;
|
17749 | }
|
17750 | Object.defineProperty(MDCSegmentedButtonSegmentFoundation, "defaultAdapter", {
|
17751 | get: function get() {
|
17752 | return {
|
17753 | isSingleSelect: function isSingleSelect() {
|
17754 | return false;
|
17755 | }, getAttr: function getAttr() {
|
17756 | return '';
|
17757 | }, setAttr: function setAttr() {
|
17758 | return undefined;
|
17759 | },
|
17760 | addClass: function addClass() {
|
17761 | return undefined;
|
17762 | }, removeClass: function removeClass() {
|
17763 | return undefined;
|
17764 | },
|
17765 | hasClass: function hasClass() {
|
17766 | return false;
|
17767 | },
|
17768 | notifySelectedChange: function notifySelectedChange() {
|
17769 | return undefined;
|
17770 | },
|
17771 | getRootBoundingClientRect: function getRootBoundingClientRect() {
|
17772 | return emptyClientRect;
|
17773 | }
|
17774 | };
|
17775 | },
|
17776 | enumerable: false,
|
17777 | configurable: true
|
17778 | });
|
17779 | |
17780 |
|
17781 |
|
17782 |
|
17783 | MDCSegmentedButtonSegmentFoundation.prototype.isSelected = function () {
|
17784 | return this.adapter.hasClass(constants_1.cssClasses.SELECTED);
|
17785 | };
|
17786 | |
17787 |
|
17788 |
|
17789 | MDCSegmentedButtonSegmentFoundation.prototype.setSelected = function () {
|
17790 | this.adapter.addClass(constants_1.cssClasses.SELECTED);
|
17791 | this.setAriaAttr(constants_1.booleans.TRUE);
|
17792 | };
|
17793 | |
17794 |
|
17795 |
|
17796 | MDCSegmentedButtonSegmentFoundation.prototype.setUnselected = function () {
|
17797 | this.adapter.removeClass(constants_1.cssClasses.SELECTED);
|
17798 | this.setAriaAttr(constants_1.booleans.FALSE);
|
17799 | };
|
17800 | |
17801 |
|
17802 |
|
17803 | MDCSegmentedButtonSegmentFoundation.prototype.getSegmentId = function () {
|
17804 | var _a;
|
17805 | return (_a = this.adapter.getAttr(constants_1.attributes.DATA_SEGMENT_ID)) !== null && _a !== void 0 ? _a : undefined;
|
17806 | };
|
17807 | |
17808 |
|
17809 |
|
17810 |
|
17811 |
|
17812 |
|
17813 |
|
17814 |
|
17815 | MDCSegmentedButtonSegmentFoundation.prototype.handleClick = function () {
|
17816 | if (this.adapter.isSingleSelect()) {
|
17817 | this.setSelected();
|
17818 | } else {
|
17819 | this.toggleSelection();
|
17820 | }
|
17821 | this.adapter.notifySelectedChange(this.isSelected());
|
17822 | };
|
17823 | |
17824 |
|
17825 |
|
17826 | MDCSegmentedButtonSegmentFoundation.prototype.getDimensions = function () {
|
17827 | return this.adapter.getRootBoundingClientRect();
|
17828 | };
|
17829 | |
17830 |
|
17831 |
|
17832 | MDCSegmentedButtonSegmentFoundation.prototype.toggleSelection = function () {
|
17833 | if (this.isSelected()) {
|
17834 | this.setUnselected();
|
17835 | } else {
|
17836 | this.setSelected();
|
17837 | }
|
17838 | };
|
17839 | |
17840 |
|
17841 |
|
17842 |
|
17843 |
|
17844 |
|
17845 | MDCSegmentedButtonSegmentFoundation.prototype.setAriaAttr = function (value) {
|
17846 | if (this.adapter.isSingleSelect()) {
|
17847 | this.adapter.setAttr(constants_1.attributes.ARIA_CHECKED, value);
|
17848 | } else {
|
17849 | this.adapter.setAttr(constants_1.attributes.ARIA_PRESSED, value);
|
17850 | }
|
17851 | };
|
17852 | return MDCSegmentedButtonSegmentFoundation;
|
17853 | }(foundation_1.MDCFoundation);
|
17854 | exports.MDCSegmentedButtonSegmentFoundation = MDCSegmentedButtonSegmentFoundation;
|
17855 |
|
17856 | }),
|
17857 |
|
17858 | "./packages/mdc-segmented-button/segment/index.ts":
|
17859 |
|
17860 |
|
17861 |
|
17862 |
|
17863 | (function(module, exports, __webpack_require__) {
|
17864 |
|
17865 | "use strict";
|
17866 |
|
17867 |
|
17868 |
|
17869 |
|
17870 |
|
17871 |
|
17872 |
|
17873 |
|
17874 |
|
17875 |
|
17876 |
|
17877 |
|
17878 |
|
17879 |
|
17880 |
|
17881 |
|
17882 |
|
17883 |
|
17884 |
|
17885 |
|
17886 |
|
17887 |
|
17888 |
|
17889 |
|
17890 | var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
|
17891 | if (k2 === undefined) k2 = k;
|
17892 | Object.defineProperty(o, k2, { enumerable: true, get: function get() {
|
17893 | return m[k];
|
17894 | } });
|
17895 | } : function (o, m, k, k2) {
|
17896 | if (k2 === undefined) k2 = k;
|
17897 | o[k2] = m[k];
|
17898 | });
|
17899 | var __exportStar = this && this.__exportStar || function (m, exports) {
|
17900 | for (var p in m) {
|
17901 | if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
17902 | }
|
17903 | };
|
17904 | Object.defineProperty(exports, "__esModule", { value: true });
|
17905 | __exportStar(__webpack_require__( "./packages/mdc-segmented-button/segment/adapter.ts"), exports);
|
17906 | __exportStar(__webpack_require__( "./packages/mdc-segmented-button/segment/foundation.ts"), exports);
|
17907 | __exportStar(__webpack_require__( "./packages/mdc-segmented-button/segment/component.ts"), exports);
|
17908 |
|
17909 | }),
|
17910 |
|
17911 | "./packages/mdc-segmented-button/segmented-button/adapter.ts":
|
17912 |
|
17913 |
|
17914 |
|
17915 |
|
17916 | (function(module, exports, __webpack_require__) {
|
17917 |
|
17918 | "use strict";
|
17919 |
|
17920 |
|
17921 |
|
17922 |
|
17923 |
|
17924 |
|
17925 |
|
17926 |
|
17927 |
|
17928 |
|
17929 |
|
17930 |
|
17931 |
|
17932 |
|
17933 |
|
17934 |
|
17935 |
|
17936 |
|
17937 |
|
17938 |
|
17939 |
|
17940 |
|
17941 |
|
17942 |
|
17943 | Object.defineProperty(exports, "__esModule", { value: true });
|
17944 |
|
17945 | }),
|
17946 |
|
17947 | "./packages/mdc-segmented-button/segmented-button/component.ts":
|
17948 |
|
17949 |
|
17950 |
|
17951 |
|
17952 | (function(module, exports, __webpack_require__) {
|
17953 |
|
17954 | "use strict";
|
17955 |
|
17956 |
|
17957 |
|
17958 |
|
17959 |
|
17960 |
|
17961 |
|
17962 |
|
17963 |
|
17964 |
|
17965 |
|
17966 |
|
17967 |
|
17968 |
|
17969 |
|
17970 |
|
17971 |
|
17972 |
|
17973 |
|
17974 |
|
17975 |
|
17976 |
|
17977 |
|
17978 |
|
17979 | var __extends = this && this.__extends || function () {
|
17980 | var _extendStatics = function extendStatics(d, b) {
|
17981 | _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
|
17982 | d.__proto__ = b;
|
17983 | } || function (d, b) {
|
17984 | for (var p in b) {
|
17985 | if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
17986 | }
|
17987 | };
|
17988 | return _extendStatics(d, b);
|
17989 | };
|
17990 | return function (d, b) {
|
17991 | if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
17992 | _extendStatics(d, b);
|
17993 | function __() {
|
17994 | this.constructor = d;
|
17995 | }
|
17996 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
17997 | };
|
17998 | }();
|
17999 | var __values = this && this.__values || function (o) {
|
18000 | var s = typeof Symbol === "function" && Symbol.iterator,
|
18001 | m = s && o[s],
|
18002 | i = 0;
|
18003 | if (m) return m.call(o);
|
18004 | if (o && typeof o.length === "number") return {
|
18005 | next: function next() {
|
18006 | if (o && i >= o.length) o = void 0;
|
18007 | return { value: o && o[i++], done: !o };
|
18008 | }
|
18009 | };
|
18010 | throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
18011 | };
|
18012 | Object.defineProperty(exports, "__esModule", { value: true });
|
18013 | exports.MDCSegmentedButton = void 0;
|
18014 | var component_1 = __webpack_require__( "./packages/mdc-base/component.ts");
|
18015 | var component_2 = __webpack_require__( "./packages/mdc-segmented-button/segment/component.ts");
|
18016 | var constants_1 = __webpack_require__( "./packages/mdc-segmented-button/segmented-button/constants.ts");
|
18017 | var foundation_1 = __webpack_require__( "./packages/mdc-segmented-button/segmented-button/foundation.ts");
|
18018 | var MDCSegmentedButton = function (_super) {
|
18019 | __extends(MDCSegmentedButton, _super);
|
18020 | function MDCSegmentedButton() {
|
18021 | return _super !== null && _super.apply(this, arguments) || this;
|
18022 | }
|
18023 | MDCSegmentedButton.attachTo = function (root) {
|
18024 | return new MDCSegmentedButton(root);
|
18025 | };
|
18026 | Object.defineProperty(MDCSegmentedButton.prototype, "segments", {
|
18027 | get: function get() {
|
18028 | return this.segmentsList.slice();
|
18029 | },
|
18030 | enumerable: false,
|
18031 | configurable: true
|
18032 | });
|
18033 |
|
18034 | MDCSegmentedButton.prototype.initialize = function (segmentFactory) {
|
18035 | if (segmentFactory === void 0) {
|
18036 | segmentFactory = function segmentFactory(el) {
|
18037 | return new component_2.MDCSegmentedButtonSegment(el);
|
18038 | };
|
18039 | }
|
18040 | this.segmentFactory = segmentFactory;
|
18041 | this.segmentsList = this.instantiateSegments(this.segmentFactory);
|
18042 | };
|
18043 | |
18044 |
|
18045 |
|
18046 |
|
18047 | MDCSegmentedButton.prototype.instantiateSegments = function (segmentFactory) {
|
18048 | var segmentElements = [].slice.call(this.root.querySelectorAll(constants_1.selectors.SEGMENT));
|
18049 | return segmentElements.map(function (el) {
|
18050 | return segmentFactory(el);
|
18051 | });
|
18052 | };
|
18053 | MDCSegmentedButton.prototype.initialSyncWithDOM = function () {
|
18054 | var _this = this;
|
18055 | this.handleSelected = function (event) {
|
18056 | _this.foundation.handleSelected(event.detail);
|
18057 | };
|
18058 | this.listen(constants_1.events.SELECTED, this.handleSelected);
|
18059 | var isSingleSelect = this.foundation.isSingleSelect();
|
18060 | for (var i = 0; i < this.segmentsList.length; i++) {
|
18061 | var segment = this.segmentsList[i];
|
18062 | segment.setIndex(i);
|
18063 | segment.setIsSingleSelect(isSingleSelect);
|
18064 | }
|
18065 | var selectedSegments = this.segmentsList.filter(function (segment) {
|
18066 | return segment.isSelected();
|
18067 | });
|
18068 | if (isSingleSelect && selectedSegments.length === 0 && this.segmentsList.length > 0) {
|
18069 | throw new Error('No segment selected in singleSelect mdc-segmented-button');
|
18070 | } else if (isSingleSelect && selectedSegments.length > 1) {
|
18071 | throw new Error('Multiple segments selected in singleSelect mdc-segmented-button');
|
18072 | }
|
18073 | };
|
18074 | MDCSegmentedButton.prototype.destroy = function () {
|
18075 | var e_1, _a;
|
18076 | try {
|
18077 | for (var _b = __values(this.segmentsList), _c = _b.next(); !_c.done; _c = _b.next()) {
|
18078 | var segment = _c.value;
|
18079 | segment.destroy();
|
18080 | }
|
18081 | } catch (e_1_1) {
|
18082 | e_1 = { error: e_1_1 };
|
18083 | } finally {
|
18084 | try {
|
18085 | if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
18086 | } finally {
|
18087 | if (e_1) throw e_1.error;
|
18088 | }
|
18089 | }
|
18090 | this.unlisten(constants_1.events.SELECTED, this.handleSelected);
|
18091 | _super.prototype.destroy.call(this);
|
18092 | };
|
18093 | MDCSegmentedButton.prototype.getDefaultFoundation = function () {
|
18094 | var _this = this;
|
18095 | var adapter = {
|
18096 | hasClass: function hasClass(className) {
|
18097 | return _this.root.classList.contains(className);
|
18098 | },
|
18099 | getSegments: function getSegments() {
|
18100 | return _this.mappedSegments();
|
18101 | },
|
18102 | selectSegment: function selectSegment(indexOrSegmentId) {
|
18103 | var segmentDetail = _this.mappedSegments().find(function (detail) {
|
18104 | return detail.index === indexOrSegmentId || detail.segmentId === indexOrSegmentId;
|
18105 | });
|
18106 | if (segmentDetail) {
|
18107 | _this.segmentsList[segmentDetail.index].setSelected();
|
18108 | }
|
18109 | },
|
18110 | unselectSegment: function unselectSegment(indexOrSegmentId) {
|
18111 | var segmentDetail = _this.mappedSegments().find(function (detail) {
|
18112 | return detail.index === indexOrSegmentId || detail.segmentId === indexOrSegmentId;
|
18113 | });
|
18114 | if (segmentDetail) {
|
18115 | _this.segmentsList[segmentDetail.index].setUnselected();
|
18116 | }
|
18117 | },
|
18118 | notifySelectedChange: function notifySelectedChange(detail) {
|
18119 | _this.emit(constants_1.events.CHANGE, detail, true );
|
18120 | }
|
18121 | };
|
18122 | return new foundation_1.MDCSegmentedButtonFoundation(adapter);
|
18123 | };
|
18124 | |
18125 |
|
18126 |
|
18127 | MDCSegmentedButton.prototype.getSelectedSegments = function () {
|
18128 | return this.foundation.getSelectedSegments();
|
18129 | };
|
18130 | |
18131 |
|
18132 |
|
18133 |
|
18134 |
|
18135 |
|
18136 | MDCSegmentedButton.prototype.selectSegment = function (indexOrSegmentId) {
|
18137 | this.foundation.selectSegment(indexOrSegmentId);
|
18138 | };
|
18139 | |
18140 |
|
18141 |
|
18142 |
|
18143 |
|
18144 |
|
18145 | MDCSegmentedButton.prototype.unselectSegment = function (indexOrSegmentId) {
|
18146 | this.foundation.unselectSegment(indexOrSegmentId);
|
18147 | };
|
18148 | |
18149 |
|
18150 |
|
18151 |
|
18152 |
|
18153 |
|
18154 | MDCSegmentedButton.prototype.isSegmentSelected = function (indexOrSegmentId) {
|
18155 | return this.foundation.isSegmentSelected(indexOrSegmentId);
|
18156 | };
|
18157 | |
18158 |
|
18159 |
|
18160 | MDCSegmentedButton.prototype.mappedSegments = function () {
|
18161 | return this.segmentsList.map(function (segment, index) {
|
18162 | return {
|
18163 | index: index,
|
18164 | selected: segment.isSelected(),
|
18165 | segmentId: segment.getSegmentId()
|
18166 | };
|
18167 | });
|
18168 | };
|
18169 | return MDCSegmentedButton;
|
18170 | }(component_1.MDCComponent);
|
18171 | exports.MDCSegmentedButton = MDCSegmentedButton;
|
18172 |
|
18173 | }),
|
18174 |
|
18175 | "./packages/mdc-segmented-button/segmented-button/constants.ts":
|
18176 |
|
18177 |
|
18178 |
|
18179 |
|
18180 | (function(module, exports, __webpack_require__) {
|
18181 |
|
18182 | "use strict";
|
18183 |
|
18184 |
|
18185 |
|
18186 |
|
18187 |
|
18188 |
|
18189 |
|
18190 |
|
18191 |
|
18192 |
|
18193 |
|
18194 |
|
18195 |
|
18196 |
|
18197 |
|
18198 |
|
18199 |
|
18200 |
|
18201 |
|
18202 |
|
18203 |
|
18204 |
|
18205 |
|
18206 |
|
18207 | Object.defineProperty(exports, "__esModule", { value: true });
|
18208 | exports.cssClasses = exports.events = exports.selectors = void 0;
|
18209 |
|
18210 |
|
18211 |
|
18212 | exports.selectors = {
|
18213 | SEGMENT: '.mdc-segmented-button__segment'
|
18214 | };
|
18215 |
|
18216 |
|
18217 |
|
18218 | exports.events = {
|
18219 | SELECTED: 'selected',
|
18220 | CHANGE: 'change'
|
18221 | };
|
18222 |
|
18223 |
|
18224 |
|
18225 | exports.cssClasses = {
|
18226 | SINGLE_SELECT: 'mdc-segmented-button--single-select'
|
18227 | };
|
18228 |
|
18229 | }),
|
18230 |
|
18231 | "./packages/mdc-segmented-button/segmented-button/foundation.ts":
|
18232 |
|
18233 |
|
18234 |
|
18235 |
|
18236 | (function(module, exports, __webpack_require__) {
|
18237 |
|
18238 | "use strict";
|
18239 |
|
18240 |
|
18241 |
|
18242 |
|
18243 |
|
18244 |
|
18245 |
|
18246 |
|
18247 |
|
18248 |
|
18249 |
|
18250 |
|
18251 |
|
18252 |
|
18253 |
|
18254 |
|
18255 |
|
18256 |
|
18257 |
|
18258 |
|
18259 |
|
18260 |
|
18261 |
|
18262 |
|
18263 | var __extends = this && this.__extends || function () {
|
18264 | var _extendStatics = function extendStatics(d, b) {
|
18265 | _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
|
18266 | d.__proto__ = b;
|
18267 | } || function (d, b) {
|
18268 | for (var p in b) {
|
18269 | if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
18270 | }
|
18271 | };
|
18272 | return _extendStatics(d, b);
|
18273 | };
|
18274 | return function (d, b) {
|
18275 | if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
18276 | _extendStatics(d, b);
|
18277 | function __() {
|
18278 | this.constructor = d;
|
18279 | }
|
18280 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
18281 | };
|
18282 | }();
|
18283 | var __assign = this && this.__assign || function () {
|
18284 | __assign = Object.assign || function (t) {
|
18285 | for (var s, i = 1, n = arguments.length; i < n; i++) {
|
18286 | s = arguments[i];
|
18287 | for (var p in s) {
|
18288 | if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
18289 | }
|
18290 | }
|
18291 | return t;
|
18292 | };
|
18293 | return __assign.apply(this, arguments);
|
18294 | };
|
18295 | var __values = this && this.__values || function (o) {
|
18296 | var s = typeof Symbol === "function" && Symbol.iterator,
|
18297 | m = s && o[s],
|
18298 | i = 0;
|
18299 | if (m) return m.call(o);
|
18300 | if (o && typeof o.length === "number") return {
|
18301 | next: function next() {
|
18302 | if (o && i >= o.length) o = void 0;
|
18303 | return { value: o && o[i++], done: !o };
|
18304 | }
|
18305 | };
|
18306 | throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
18307 | };
|
18308 | Object.defineProperty(exports, "__esModule", { value: true });
|
18309 | exports.MDCSegmentedButtonFoundation = void 0;
|
18310 | var foundation_1 = __webpack_require__( "./packages/mdc-base/foundation.ts");
|
18311 | var constants_1 = __webpack_require__( "./packages/mdc-segmented-button/segmented-button/constants.ts");
|
18312 | var MDCSegmentedButtonFoundation = function (_super) {
|
18313 | __extends(MDCSegmentedButtonFoundation, _super);
|
18314 | function MDCSegmentedButtonFoundation(adapter) {
|
18315 | return _super.call(this, __assign(__assign({}, MDCSegmentedButtonFoundation.defaultAdapter), adapter)) || this;
|
18316 | }
|
18317 | Object.defineProperty(MDCSegmentedButtonFoundation, "defaultAdapter", {
|
18318 | get: function get() {
|
18319 | return {
|
18320 | hasClass: function hasClass() {
|
18321 | return false;
|
18322 | }, getSegments: function getSegments() {
|
18323 | return [];
|
18324 | },
|
18325 | selectSegment: function selectSegment() {
|
18326 | return undefined;
|
18327 | },
|
18328 | unselectSegment: function unselectSegment() {
|
18329 | return undefined;
|
18330 | },
|
18331 | notifySelectedChange: function notifySelectedChange() {
|
18332 | return undefined;
|
18333 | }
|
18334 | };
|
18335 | },
|
18336 | enumerable: false,
|
18337 | configurable: true
|
18338 | });
|
18339 | |
18340 |
|
18341 |
|
18342 |
|
18343 |
|
18344 |
|
18345 | MDCSegmentedButtonFoundation.prototype.selectSegment = function (indexOrSegmentId) {
|
18346 | this.adapter.selectSegment(indexOrSegmentId);
|
18347 | };
|
18348 | |
18349 |
|
18350 |
|
18351 |
|
18352 |
|
18353 |
|
18354 | MDCSegmentedButtonFoundation.prototype.unselectSegment = function (indexOrSegmentId) {
|
18355 | this.adapter.unselectSegment(indexOrSegmentId);
|
18356 | };
|
18357 | |
18358 |
|
18359 |
|
18360 |
|
18361 | MDCSegmentedButtonFoundation.prototype.getSelectedSegments = function () {
|
18362 | return this.adapter.getSegments().filter(function (segmentDetail) {
|
18363 | return segmentDetail.selected;
|
18364 | });
|
18365 | };
|
18366 | |
18367 |
|
18368 |
|
18369 |
|
18370 |
|
18371 |
|
18372 | MDCSegmentedButtonFoundation.prototype.isSegmentSelected = function (indexOrSegmentId) {
|
18373 | return this.adapter.getSegments().some(function (segmentDetail) {
|
18374 | return (segmentDetail.index === indexOrSegmentId || segmentDetail.segmentId === indexOrSegmentId) && segmentDetail.selected;
|
18375 | });
|
18376 | };
|
18377 | |
18378 |
|
18379 |
|
18380 |
|
18381 | MDCSegmentedButtonFoundation.prototype.isSingleSelect = function () {
|
18382 | return this.adapter.hasClass(constants_1.cssClasses.SINGLE_SELECT);
|
18383 | };
|
18384 | |
18385 |
|
18386 |
|
18387 |
|
18388 |
|
18389 |
|
18390 |
|
18391 |
|
18392 | MDCSegmentedButtonFoundation.prototype.handleSelected = function (detail) {
|
18393 | if (this.isSingleSelect()) {
|
18394 | this.unselectPrevSelected(detail.index);
|
18395 | }
|
18396 | this.adapter.notifySelectedChange(detail);
|
18397 | };
|
18398 | |
18399 |
|
18400 |
|
18401 |
|
18402 |
|
18403 |
|
18404 | MDCSegmentedButtonFoundation.prototype.unselectPrevSelected = function (index) {
|
18405 | var e_1, _a;
|
18406 | try {
|
18407 | for (var _b = __values(this.getSelectedSegments()), _c = _b.next(); !_c.done; _c = _b.next()) {
|
18408 | var selectedSegment = _c.value;
|
18409 | if (selectedSegment.index !== index) {
|
18410 | this.unselectSegment(selectedSegment.index);
|
18411 | }
|
18412 | }
|
18413 | } catch (e_1_1) {
|
18414 | e_1 = { error: e_1_1 };
|
18415 | } finally {
|
18416 | try {
|
18417 | if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
18418 | } finally {
|
18419 | if (e_1) throw e_1.error;
|
18420 | }
|
18421 | }
|
18422 | };
|
18423 | return MDCSegmentedButtonFoundation;
|
18424 | }(foundation_1.MDCFoundation);
|
18425 | exports.MDCSegmentedButtonFoundation = MDCSegmentedButtonFoundation;
|
18426 |
|
18427 | }),
|
18428 |
|
18429 | "./packages/mdc-segmented-button/segmented-button/index.ts":
|
18430 |
|
18431 |
|
18432 |
|
18433 |
|
18434 | (function(module, exports, __webpack_require__) {
|
18435 |
|
18436 | "use strict";
|
18437 |
|
18438 |
|
18439 |
|
18440 |
|
18441 |
|
18442 |
|
18443 |
|
18444 |
|
18445 |
|
18446 |
|
18447 |
|
18448 |
|
18449 |
|
18450 |
|
18451 |
|
18452 |
|
18453 |
|
18454 |
|
18455 |
|
18456 |
|
18457 |
|
18458 |
|
18459 |
|
18460 |
|
18461 | var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
|
18462 | if (k2 === undefined) k2 = k;
|
18463 | Object.defineProperty(o, k2, { enumerable: true, get: function get() {
|
18464 | return m[k];
|
18465 | } });
|
18466 | } : function (o, m, k, k2) {
|
18467 | if (k2 === undefined) k2 = k;
|
18468 | o[k2] = m[k];
|
18469 | });
|
18470 | var __exportStar = this && this.__exportStar || function (m, exports) {
|
18471 | for (var p in m) {
|
18472 | if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
18473 | }
|
18474 | };
|
18475 | Object.defineProperty(exports, "__esModule", { value: true });
|
18476 | __exportStar(__webpack_require__( "./packages/mdc-segmented-button/segmented-button/adapter.ts"), exports);
|
18477 | __exportStar(__webpack_require__( "./packages/mdc-segmented-button/segmented-button/foundation.ts"), exports);
|
18478 | __exportStar(__webpack_require__( "./packages/mdc-segmented-button/segmented-button/component.ts"), exports);
|
18479 |
|
18480 | }),
|
18481 |
|
18482 | "./packages/mdc-segmented-button/types.ts":
|
18483 |
|
18484 |
|
18485 |
|
18486 |
|
18487 | (function(module, exports, __webpack_require__) {
|
18488 |
|
18489 | "use strict";
|
18490 |
|
18491 |
|
18492 |
|
18493 |
|
18494 |
|
18495 |
|
18496 |
|
18497 |
|
18498 |
|
18499 |
|
18500 |
|
18501 |
|
18502 |
|
18503 |
|
18504 |
|
18505 |
|
18506 |
|
18507 |
|
18508 |
|
18509 |
|
18510 |
|
18511 |
|
18512 |
|
18513 |
|
18514 | Object.defineProperty(exports, "__esModule", { value: true });
|
18515 |
|
18516 | }),
|
18517 |
|
18518 | "./packages/mdc-select/adapter.ts":
|
18519 |
|
18520 |
|
18521 |
|
18522 |
|
18523 | (function(module, exports, __webpack_require__) {
|
18524 |
|
18525 | "use strict";
|
18526 |
|
18527 |
|
18528 |
|
18529 |
|
18530 |
|
18531 |
|
18532 |
|
18533 |
|
18534 |
|
18535 |
|
18536 |
|
18537 |
|
18538 |
|
18539 |
|
18540 |
|
18541 |
|
18542 |
|
18543 |
|
18544 |
|
18545 |
|
18546 |
|
18547 |
|
18548 |
|
18549 |
|
18550 | Object.defineProperty(exports, "__esModule", { value: true });
|
18551 |
|
18552 | }),
|
18553 |
|
18554 | "./packages/mdc-select/component.ts":
|
18555 |
|
18556 |
|
18557 |
|
18558 |
|
18559 | (function(module, exports, __webpack_require__) {
|
18560 |
|
18561 | "use strict";
|
18562 |
|
18563 |
|
18564 |
|
18565 |
|
18566 |
|
18567 |
|
18568 |
|
18569 |
|
18570 |
|
18571 |
|
18572 |
|
18573 |
|
18574 |
|
18575 |
|
18576 |
|
18577 |
|
18578 |
|
18579 |
|
18580 |
|
18581 |
|
18582 |
|
18583 |
|
18584 |
|
18585 |
|
18586 | var __extends = this && this.__extends || function () {
|
18587 | var _extendStatics = function extendStatics(d, b) {
|
18588 | _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
|
18589 | d.__proto__ = b;
|
18590 | } || function (d, b) {
|
18591 | for (var p in b) {
|
18592 | if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
18593 | }
|
18594 | };
|
18595 | return _extendStatics(d, b);
|
18596 | };
|
18597 | return function (d, b) {
|
18598 | if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
18599 | _extendStatics(d, b);
|
18600 | function __() {
|
18601 | this.constructor = d;
|
18602 | }
|
18603 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
18604 | };
|
18605 | }();
|
18606 | var __assign = this && this.__assign || function () {
|
18607 | __assign = Object.assign || function (t) {
|
18608 | for (var s, i = 1, n = arguments.length; i < n; i++) {
|
18609 | s = arguments[i];
|
18610 | for (var p in s) {
|
18611 | if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
18612 | }
|
18613 | }
|
18614 | return t;
|
18615 | };
|
18616 | return __assign.apply(this, arguments);
|
18617 | };
|
18618 | var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
|
18619 | if (k2 === undefined) k2 = k;
|
18620 | Object.defineProperty(o, k2, { enumerable: true, get: function get() {
|
18621 | return m[k];
|
18622 | } });
|
18623 | } : function (o, m, k, k2) {
|
18624 | if (k2 === undefined) k2 = k;
|
18625 | o[k2] = m[k];
|
18626 | });
|
18627 | var __setModuleDefault = this && this.__setModuleDefault || (Object.create ? function (o, v) {
|
18628 | Object.defineProperty(o, "default", { enumerable: true, value: v });
|
18629 | } : function (o, v) {
|
18630 | o["default"] = v;
|
18631 | });
|
18632 | var __importStar = this && this.__importStar || function (mod) {
|
18633 | if (mod && mod.__esModule) return mod;
|
18634 | var result = {};
|
18635 | if (mod != null) for (var k in mod) {
|
18636 | if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
18637 | }__setModuleDefault(result, mod);
|
18638 | return result;
|
18639 | };
|
18640 | Object.defineProperty(exports, "__esModule", { value: true });
|
18641 | exports.MDCSelect = void 0;
|
18642 | var component_1 = __webpack_require__( "./packages/mdc-base/component.ts");
|
18643 | var component_2 = __webpack_require__( "./packages/mdc-floating-label/component.ts");
|
18644 | var component_3 = __webpack_require__( "./packages/mdc-line-ripple/component.ts");
|
18645 | var menuSurfaceConstants = __importStar(__webpack_require__( "./packages/mdc-menu-surface/constants.ts"));
|
18646 | var component_4 = __webpack_require__( "./packages/mdc-menu/component.ts");
|
18647 | var menuConstants = __importStar(__webpack_require__( "./packages/mdc-menu/constants.ts"));
|
18648 | var component_5 = __webpack_require__( "./packages/mdc-notched-outline/component.ts");
|
18649 | var component_6 = __webpack_require__( "./packages/mdc-ripple/component.ts");
|
18650 | var foundation_1 = __webpack_require__( "./packages/mdc-ripple/foundation.ts");
|
18651 | var constants_1 = __webpack_require__( "./packages/mdc-select/constants.ts");
|
18652 | var foundation_2 = __webpack_require__( "./packages/mdc-select/foundation.ts");
|
18653 | var component_7 = __webpack_require__( "./packages/mdc-select/helper-text/component.ts");
|
18654 | var component_8 = __webpack_require__( "./packages/mdc-select/icon/component.ts");
|
18655 | var MDCSelect = function (_super) {
|
18656 | __extends(MDCSelect, _super);
|
18657 | function MDCSelect() {
|
18658 | return _super !== null && _super.apply(this, arguments) || this;
|
18659 | }
|
18660 | MDCSelect.attachTo = function (root) {
|
18661 | return new MDCSelect(root);
|
18662 | };
|
18663 | MDCSelect.prototype.initialize = function (labelFactory, lineRippleFactory, outlineFactory, menuFactory, iconFactory, helperTextFactory) {
|
18664 | if (labelFactory === void 0) {
|
18665 | labelFactory = function labelFactory(el) {
|
18666 | return new component_2.MDCFloatingLabel(el);
|
18667 | };
|
18668 | }
|
18669 | if (lineRippleFactory === void 0) {
|
18670 | lineRippleFactory = function lineRippleFactory(el) {
|
18671 | return new component_3.MDCLineRipple(el);
|
18672 | };
|
18673 | }
|
18674 | if (outlineFactory === void 0) {
|
18675 | outlineFactory = function outlineFactory(el) {
|
18676 | return new component_5.MDCNotchedOutline(el);
|
18677 | };
|
18678 | }
|
18679 | if (menuFactory === void 0) {
|
18680 | menuFactory = function menuFactory(el) {
|
18681 | return new component_4.MDCMenu(el);
|
18682 | };
|
18683 | }
|
18684 | if (iconFactory === void 0) {
|
18685 | iconFactory = function iconFactory(el) {
|
18686 | return new component_8.MDCSelectIcon(el);
|
18687 | };
|
18688 | }
|
18689 | if (helperTextFactory === void 0) {
|
18690 | helperTextFactory = function helperTextFactory(el) {
|
18691 | return new component_7.MDCSelectHelperText(el);
|
18692 | };
|
18693 | }
|
18694 | this.selectAnchor = this.root.querySelector(constants_1.strings.SELECT_ANCHOR_SELECTOR);
|
18695 | this.selectedText = this.root.querySelector(constants_1.strings.SELECTED_TEXT_SELECTOR);
|
18696 | this.hiddenInput = this.root.querySelector(constants_1.strings.HIDDEN_INPUT_SELECTOR);
|
18697 | if (!this.selectedText) {
|
18698 | throw new Error('MDCSelect: Missing required element: The following selector must be present: ' + ("'" + constants_1.strings.SELECTED_TEXT_SELECTOR + "'"));
|
18699 | }
|
18700 | if (this.selectAnchor.hasAttribute(constants_1.strings.ARIA_CONTROLS)) {
|
18701 | var helperTextElement = document.getElementById(this.selectAnchor.getAttribute(constants_1.strings.ARIA_CONTROLS));
|
18702 | if (helperTextElement) {
|
18703 | this.helperText = helperTextFactory(helperTextElement);
|
18704 | }
|
18705 | }
|
18706 | this.menuSetup(menuFactory);
|
18707 | var labelElement = this.root.querySelector(constants_1.strings.LABEL_SELECTOR);
|
18708 | this.label = labelElement ? labelFactory(labelElement) : null;
|
18709 | var lineRippleElement = this.root.querySelector(constants_1.strings.LINE_RIPPLE_SELECTOR);
|
18710 | this.lineRipple = lineRippleElement ? lineRippleFactory(lineRippleElement) : null;
|
18711 | var outlineElement = this.root.querySelector(constants_1.strings.OUTLINE_SELECTOR);
|
18712 | this.outline = outlineElement ? outlineFactory(outlineElement) : null;
|
18713 | var leadingIcon = this.root.querySelector(constants_1.strings.LEADING_ICON_SELECTOR);
|
18714 | if (leadingIcon) {
|
18715 | this.leadingIcon = iconFactory(leadingIcon);
|
18716 | }
|
18717 | if (!this.root.classList.contains(constants_1.cssClasses.OUTLINED)) {
|
18718 | this.ripple = this.createRipple();
|
18719 | }
|
18720 | };
|
18721 | |
18722 |
|
18723 |
|
18724 |
|
18725 | MDCSelect.prototype.initialSyncWithDOM = function () {
|
18726 | var _this = this;
|
18727 | this.handleFocus = function () {
|
18728 | _this.foundation.handleFocus();
|
18729 | };
|
18730 | this.handleBlur = function () {
|
18731 | _this.foundation.handleBlur();
|
18732 | };
|
18733 | this.handleClick = function (evt) {
|
18734 | _this.selectAnchor.focus();
|
18735 | _this.foundation.handleClick(_this.getNormalizedXCoordinate(evt));
|
18736 | };
|
18737 | this.handleKeydown = function (evt) {
|
18738 | _this.foundation.handleKeydown(evt);
|
18739 | };
|
18740 | this.handleMenuItemAction = function (evt) {
|
18741 | _this.foundation.handleMenuItemAction(evt.detail.index);
|
18742 | };
|
18743 | this.handleMenuOpened = function () {
|
18744 | _this.foundation.handleMenuOpened();
|
18745 | };
|
18746 | this.handleMenuClosed = function () {
|
18747 | _this.foundation.handleMenuClosed();
|
18748 | };
|
18749 | this.handleMenuClosing = function () {
|
18750 | _this.foundation.handleMenuClosing();
|
18751 | };
|
18752 | this.selectAnchor.addEventListener('focus', this.handleFocus);
|
18753 | this.selectAnchor.addEventListener('blur', this.handleBlur);
|
18754 | this.selectAnchor.addEventListener('click', this.handleClick);
|
18755 | this.selectAnchor.addEventListener('keydown', this.handleKeydown);
|
18756 | this.menu.listen(menuSurfaceConstants.strings.CLOSED_EVENT, this.handleMenuClosed);
|
18757 | this.menu.listen(menuSurfaceConstants.strings.CLOSING_EVENT, this.handleMenuClosing);
|
18758 | this.menu.listen(menuSurfaceConstants.strings.OPENED_EVENT, this.handleMenuOpened);
|
18759 | this.menu.listen(menuConstants.strings.SELECTED_EVENT, this.handleMenuItemAction);
|
18760 | if (this.hiddenInput) {
|
18761 | if (this.hiddenInput.value) {
|
18762 |
|
18763 |
|
18764 |
|
18765 | this.foundation.setValue(this.hiddenInput.value, true);
|
18766 | this.foundation.layout();
|
18767 | return;
|
18768 | }
|
18769 | this.hiddenInput.value = this.value;
|
18770 | }
|
18771 | };
|
18772 | MDCSelect.prototype.destroy = function () {
|
18773 | this.selectAnchor.removeEventListener('focus', this.handleFocus);
|
18774 | this.selectAnchor.removeEventListener('blur', this.handleBlur);
|
18775 | this.selectAnchor.removeEventListener('keydown', this.handleKeydown);
|
18776 | this.selectAnchor.removeEventListener('click', this.handleClick);
|
18777 | this.menu.unlisten(menuSurfaceConstants.strings.CLOSED_EVENT, this.handleMenuClosed);
|
18778 | this.menu.unlisten(menuSurfaceConstants.strings.OPENED_EVENT, this.handleMenuOpened);
|
18779 | this.menu.unlisten(menuConstants.strings.SELECTED_EVENT, this.handleMenuItemAction);
|
18780 | this.menu.destroy();
|
18781 | if (this.ripple) {
|
18782 | this.ripple.destroy();
|
18783 | }
|
18784 | if (this.outline) {
|
18785 | this.outline.destroy();
|
18786 | }
|
18787 | if (this.leadingIcon) {
|
18788 | this.leadingIcon.destroy();
|
18789 | }
|
18790 | if (this.helperText) {
|
18791 | this.helperText.destroy();
|
18792 | }
|
18793 | _super.prototype.destroy.call(this);
|
18794 | };
|
18795 | Object.defineProperty(MDCSelect.prototype, "value", {
|
18796 | get: function get() {
|
18797 | return this.foundation.getValue();
|
18798 | },
|
18799 | set: function set(value) {
|
18800 | this.foundation.setValue(value);
|
18801 | },
|
18802 | enumerable: false,
|
18803 | configurable: true
|
18804 | });
|
18805 | MDCSelect.prototype.setValue = function (value, skipNotify) {
|
18806 | if (skipNotify === void 0) {
|
18807 | skipNotify = false;
|
18808 | }
|
18809 | this.foundation.setValue(value, skipNotify);
|
18810 | };
|
18811 | Object.defineProperty(MDCSelect.prototype, "selectedIndex", {
|
18812 | get: function get() {
|
18813 | return this.foundation.getSelectedIndex();
|
18814 | },
|
18815 | set: function set(selectedIndex) {
|
18816 | this.foundation.setSelectedIndex(selectedIndex, true);
|
18817 | },
|
18818 | enumerable: false,
|
18819 | configurable: true
|
18820 | });
|
18821 | MDCSelect.prototype.setSelectedIndex = function (selectedIndex, skipNotify) {
|
18822 | if (skipNotify === void 0) {
|
18823 | skipNotify = false;
|
18824 | }
|
18825 | this.foundation.setSelectedIndex(selectedIndex, true, skipNotify);
|
18826 | };
|
18827 | Object.defineProperty(MDCSelect.prototype, "disabled", {
|
18828 | get: function get() {
|
18829 | return this.foundation.getDisabled();
|
18830 | },
|
18831 | set: function set(disabled) {
|
18832 | this.foundation.setDisabled(disabled);
|
18833 | if (this.hiddenInput) {
|
18834 | this.hiddenInput.disabled = disabled;
|
18835 | }
|
18836 | },
|
18837 | enumerable: false,
|
18838 | configurable: true
|
18839 | });
|
18840 | Object.defineProperty(MDCSelect.prototype, "leadingIconAriaLabel", {
|
18841 | set: function set(label) {
|
18842 | this.foundation.setLeadingIconAriaLabel(label);
|
18843 | },
|
18844 | enumerable: false,
|
18845 | configurable: true
|
18846 | });
|
18847 | Object.defineProperty(MDCSelect.prototype, "leadingIconContent", {
|
18848 | |
18849 |
|
18850 |
|
18851 | set: function set(content) {
|
18852 | this.foundation.setLeadingIconContent(content);
|
18853 | },
|
18854 | enumerable: false,
|
18855 | configurable: true
|
18856 | });
|
18857 | Object.defineProperty(MDCSelect.prototype, "helperTextContent", {
|
18858 | |
18859 |
|
18860 |
|
18861 | set: function set(content) {
|
18862 | this.foundation.setHelperTextContent(content);
|
18863 | },
|
18864 | enumerable: false,
|
18865 | configurable: true
|
18866 | });
|
18867 | Object.defineProperty(MDCSelect.prototype, "useDefaultValidation", {
|
18868 | |
18869 |
|
18870 |
|
18871 |
|
18872 |
|
18873 |
|
18874 | set: function set(useDefaultValidation) {
|
18875 | this.foundation.setUseDefaultValidation(useDefaultValidation);
|
18876 | },
|
18877 | enumerable: false,
|
18878 | configurable: true
|
18879 | });
|
18880 | Object.defineProperty(MDCSelect.prototype, "valid", {
|
18881 | |
18882 |
|
18883 |
|
18884 | get: function get() {
|
18885 | return this.foundation.isValid();
|
18886 | },
|
18887 | |
18888 |
|
18889 |
|
18890 | set: function set(isValid) {
|
18891 | this.foundation.setValid(isValid);
|
18892 | },
|
18893 | enumerable: false,
|
18894 | configurable: true
|
18895 | });
|
18896 | Object.defineProperty(MDCSelect.prototype, "required", {
|
18897 | |
18898 |
|
18899 |
|
18900 | get: function get() {
|
18901 | return this.foundation.getRequired();
|
18902 | },
|
18903 | |
18904 |
|
18905 |
|
18906 | set: function set(isRequired) {
|
18907 | this.foundation.setRequired(isRequired);
|
18908 | },
|
18909 | enumerable: false,
|
18910 | configurable: true
|
18911 | });
|
18912 | |
18913 |
|
18914 |
|
18915 |
|
18916 | MDCSelect.prototype.layout = function () {
|
18917 | this.foundation.layout();
|
18918 | };
|
18919 | |
18920 |
|
18921 |
|
18922 |
|
18923 | MDCSelect.prototype.layoutOptions = function () {
|
18924 | this.foundation.layoutOptions();
|
18925 | this.menu.layout();
|
18926 |
|
18927 | this.menuItemValues = this.menu.items.map(function (el) {
|
18928 | return el.getAttribute(constants_1.strings.VALUE_ATTR) || '';
|
18929 | });
|
18930 | if (this.hiddenInput) {
|
18931 | this.hiddenInput.value = this.value;
|
18932 | }
|
18933 | };
|
18934 | MDCSelect.prototype.getDefaultFoundation = function () {
|
18935 |
|
18936 |
|
18937 | var adapter = __assign(__assign(__assign(__assign({}, this.getSelectAdapterMethods()), this.getCommonAdapterMethods()), this.getOutlineAdapterMethods()), this.getLabelAdapterMethods());
|
18938 | return new foundation_2.MDCSelectFoundation(adapter, this.getFoundationMap());
|
18939 | };
|
18940 | |
18941 |
|
18942 |
|
18943 | MDCSelect.prototype.menuSetup = function (menuFactory) {
|
18944 | this.menuElement = this.root.querySelector(constants_1.strings.MENU_SELECTOR);
|
18945 | this.menu = menuFactory(this.menuElement);
|
18946 | this.menu.hasTypeahead = true;
|
18947 | this.menu.singleSelection = true;
|
18948 | this.menuItemValues = this.menu.items.map(function (el) {
|
18949 | return el.getAttribute(constants_1.strings.VALUE_ATTR) || '';
|
18950 | });
|
18951 | };
|
18952 | MDCSelect.prototype.createRipple = function () {
|
18953 | var _this = this;
|
18954 |
|
18955 |
|
18956 |
|
18957 | var adapter = __assign(__assign({}, component_6.MDCRipple.createAdapter({ root: this.selectAnchor })), { registerInteractionHandler: function registerInteractionHandler(evtType, handler) {
|
18958 | _this.selectAnchor.addEventListener(evtType, handler);
|
18959 | }, deregisterInteractionHandler: function deregisterInteractionHandler(evtType, handler) {
|
18960 | _this.selectAnchor.removeEventListener(evtType, handler);
|
18961 | } });
|
18962 |
|
18963 | return new component_6.MDCRipple(this.selectAnchor, new foundation_1.MDCRippleFoundation(adapter));
|
18964 | };
|
18965 | MDCSelect.prototype.getSelectAdapterMethods = function () {
|
18966 | var _this = this;
|
18967 |
|
18968 | return {
|
18969 | getMenuItemAttr: function getMenuItemAttr(menuItem, attr) {
|
18970 | return menuItem.getAttribute(attr);
|
18971 | },
|
18972 | setSelectedText: function setSelectedText(text) {
|
18973 | _this.selectedText.textContent = text;
|
18974 | },
|
18975 | isSelectAnchorFocused: function isSelectAnchorFocused() {
|
18976 | return document.activeElement === _this.selectAnchor;
|
18977 | },
|
18978 | getSelectAnchorAttr: function getSelectAnchorAttr(attr) {
|
18979 | return _this.selectAnchor.getAttribute(attr);
|
18980 | },
|
18981 | setSelectAnchorAttr: function setSelectAnchorAttr(attr, value) {
|
18982 | _this.selectAnchor.setAttribute(attr, value);
|
18983 | },
|
18984 | removeSelectAnchorAttr: function removeSelectAnchorAttr(attr) {
|
18985 | _this.selectAnchor.removeAttribute(attr);
|
18986 | },
|
18987 | addMenuClass: function addMenuClass(className) {
|
18988 | _this.menuElement.classList.add(className);
|
18989 | },
|
18990 | removeMenuClass: function removeMenuClass(className) {
|
18991 | _this.menuElement.classList.remove(className);
|
18992 | },
|
18993 | openMenu: function openMenu() {
|
18994 | _this.menu.open = true;
|
18995 | },
|
18996 | closeMenu: function closeMenu() {
|
18997 | _this.menu.open = false;
|
18998 | },
|
18999 | getAnchorElement: function getAnchorElement() {
|
19000 | return _this.root.querySelector(constants_1.strings.SELECT_ANCHOR_SELECTOR);
|
19001 | },
|
19002 | setMenuAnchorElement: function setMenuAnchorElement(anchorEl) {
|
19003 | _this.menu.setAnchorElement(anchorEl);
|
19004 | },
|
19005 | setMenuAnchorCorner: function setMenuAnchorCorner(anchorCorner) {
|
19006 | _this.menu.setAnchorCorner(anchorCorner);
|
19007 | },
|
19008 | setMenuWrapFocus: function setMenuWrapFocus(wrapFocus) {
|
19009 | _this.menu.wrapFocus = wrapFocus;
|
19010 | },
|
19011 | getSelectedIndex: function getSelectedIndex() {
|
19012 | var index = _this.menu.selectedIndex;
|
19013 | return index instanceof Array ? index[0] : index;
|
19014 | },
|
19015 | setSelectedIndex: function setSelectedIndex(index) {
|
19016 | _this.menu.selectedIndex = index;
|
19017 | },
|
19018 | focusMenuItemAtIndex: function focusMenuItemAtIndex(index) {
|
19019 | _this.menu.items[index].focus();
|
19020 | },
|
19021 | getMenuItemCount: function getMenuItemCount() {
|
19022 | return _this.menu.items.length;
|
19023 | },
|
19024 |
|
19025 | getMenuItemValues: function getMenuItemValues() {
|
19026 | return _this.menuItemValues;
|
19027 | },
|
19028 | getMenuItemTextAtIndex: function getMenuItemTextAtIndex(index) {
|
19029 | return _this.menu.getPrimaryTextAtIndex(index);
|
19030 | },
|
19031 | isTypeaheadInProgress: function isTypeaheadInProgress() {
|
19032 | return _this.menu.typeaheadInProgress;
|
19033 | },
|
19034 | typeaheadMatchItem: function typeaheadMatchItem(nextChar, startingIndex) {
|
19035 | return _this.menu.typeaheadMatchItem(nextChar, startingIndex);
|
19036 | }
|
19037 | };
|
19038 |
|
19039 | };
|
19040 | MDCSelect.prototype.getCommonAdapterMethods = function () {
|
19041 | var _this = this;
|
19042 |
|
19043 | return {
|
19044 | addClass: function addClass(className) {
|
19045 | _this.root.classList.add(className);
|
19046 | },
|
19047 | removeClass: function removeClass(className) {
|
19048 | _this.root.classList.remove(className);
|
19049 | },
|
19050 | hasClass: function hasClass(className) {
|
19051 | return _this.root.classList.contains(className);
|
19052 | },
|
19053 | setRippleCenter: function setRippleCenter(normalizedX) {
|
19054 | _this.lineRipple && _this.lineRipple.setRippleCenter(normalizedX);
|
19055 | },
|
19056 | activateBottomLine: function activateBottomLine() {
|
19057 | _this.lineRipple && _this.lineRipple.activate();
|
19058 | },
|
19059 | deactivateBottomLine: function deactivateBottomLine() {
|
19060 | _this.lineRipple && _this.lineRipple.deactivate();
|
19061 | },
|
19062 | notifyChange: function notifyChange(value) {
|
19063 | if (_this.hiddenInput) {
|
19064 | _this.hiddenInput.value = value;
|
19065 | }
|
19066 | var index = _this.selectedIndex;
|
19067 | _this.emit(constants_1.strings.CHANGE_EVENT, { value: value, index: index }, true );
|
19068 | }
|
19069 | };
|
19070 |
|
19071 | };
|
19072 | MDCSelect.prototype.getOutlineAdapterMethods = function () {
|
19073 | var _this = this;
|
19074 |
|
19075 | return {
|
19076 | hasOutline: function hasOutline() {
|
19077 | return Boolean(_this.outline);
|
19078 | },
|
19079 | notchOutline: function notchOutline(labelWidth) {
|
19080 | _this.outline && _this.outline.notch(labelWidth);
|
19081 | },
|
19082 | closeOutline: function closeOutline() {
|
19083 | _this.outline && _this.outline.closeNotch();
|
19084 | }
|
19085 | };
|
19086 |
|
19087 | };
|
19088 | MDCSelect.prototype.getLabelAdapterMethods = function () {
|
19089 | var _this = this;
|
19090 |
|
19091 | return {
|
19092 | hasLabel: function hasLabel() {
|
19093 | return !!_this.label;
|
19094 | },
|
19095 | floatLabel: function floatLabel(shouldFloat) {
|
19096 | _this.label && _this.label.float(shouldFloat);
|
19097 | },
|
19098 | getLabelWidth: function getLabelWidth() {
|
19099 | return _this.label ? _this.label.getWidth() : 0;
|
19100 | },
|
19101 | setLabelRequired: function setLabelRequired(isRequired) {
|
19102 | _this.label && _this.label.setRequired(isRequired);
|
19103 | }
|
19104 | };
|
19105 |
|
19106 | };
|
19107 | |
19108 |
|
19109 |
|
19110 | MDCSelect.prototype.getNormalizedXCoordinate = function (evt) {
|
19111 | var targetClientRect = evt.target.getBoundingClientRect();
|
19112 | var xCoordinate = this.isTouchEvent(evt) ? evt.touches[0].clientX : evt.clientX;
|
19113 | return xCoordinate - targetClientRect.left;
|
19114 | };
|
19115 | MDCSelect.prototype.isTouchEvent = function (evt) {
|
19116 | return Boolean(evt.touches);
|
19117 | };
|
19118 | |
19119 |
|
19120 |
|
19121 | MDCSelect.prototype.getFoundationMap = function () {
|
19122 | return {
|
19123 | helperText: this.helperText ? this.helperText.foundationForSelect : undefined,
|
19124 | leadingIcon: this.leadingIcon ? this.leadingIcon.foundationForSelect : undefined
|
19125 | };
|
19126 | };
|
19127 | return MDCSelect;
|
19128 | }(component_1.MDCComponent);
|
19129 | exports.MDCSelect = MDCSelect;
|
19130 |
|
19131 | }),
|
19132 |
|
19133 | "./packages/mdc-select/constants.ts":
|
19134 |
|
19135 |
|
19136 |
|
19137 |
|
19138 | (function(module, exports, __webpack_require__) {
|
19139 |
|
19140 | "use strict";
|
19141 |
|
19142 |
|
19143 |
|
19144 |
|
19145 |
|
19146 |
|
19147 |
|
19148 |
|
19149 |
|
19150 |
|
19151 |
|
19152 |
|
19153 |
|
19154 |
|
19155 |
|
19156 |
|
19157 |
|
19158 |
|
19159 |
|
19160 |
|
19161 |
|
19162 |
|
19163 |
|
19164 |
|
19165 | Object.defineProperty(exports, "__esModule", { value: true });
|
19166 | exports.numbers = exports.strings = exports.cssClasses = void 0;
|
19167 | var cssClasses = {
|
19168 | ACTIVATED: 'mdc-select--activated',
|
19169 | DISABLED: 'mdc-select--disabled',
|
19170 | FOCUSED: 'mdc-select--focused',
|
19171 | INVALID: 'mdc-select--invalid',
|
19172 | MENU_INVALID: 'mdc-select__menu--invalid',
|
19173 | OUTLINED: 'mdc-select--outlined',
|
19174 | REQUIRED: 'mdc-select--required',
|
19175 | ROOT: 'mdc-select',
|
19176 | WITH_LEADING_ICON: 'mdc-select--with-leading-icon'
|
19177 | };
|
19178 | exports.cssClasses = cssClasses;
|
19179 | var strings = {
|
19180 | ARIA_CONTROLS: 'aria-controls',
|
19181 | ARIA_DESCRIBEDBY: 'aria-describedby',
|
19182 | ARIA_SELECTED_ATTR: 'aria-selected',
|
19183 | CHANGE_EVENT: 'MDCSelect:change',
|
19184 | HIDDEN_INPUT_SELECTOR: 'input[type="hidden"]',
|
19185 | LABEL_SELECTOR: '.mdc-floating-label',
|
19186 | LEADING_ICON_SELECTOR: '.mdc-select__icon',
|
19187 | LINE_RIPPLE_SELECTOR: '.mdc-line-ripple',
|
19188 | MENU_SELECTOR: '.mdc-select__menu',
|
19189 | OUTLINE_SELECTOR: '.mdc-notched-outline',
|
19190 | SELECTED_TEXT_SELECTOR: '.mdc-select__selected-text',
|
19191 | SELECT_ANCHOR_SELECTOR: '.mdc-select__anchor',
|
19192 | VALUE_ATTR: 'data-value'
|
19193 | };
|
19194 | exports.strings = strings;
|
19195 | var numbers = {
|
19196 | LABEL_SCALE: 0.75,
|
19197 | UNSET_INDEX: -1,
|
19198 | CLICK_DEBOUNCE_TIMEOUT_MS: 330
|
19199 | };
|
19200 | exports.numbers = numbers;
|
19201 |
|
19202 | }),
|
19203 |
|
19204 | "./packages/mdc-select/foundation.ts":
|
19205 |
|
19206 |
|
19207 |
|
19208 |
|
19209 | (function(module, exports, __webpack_require__) {
|
19210 |
|
19211 | "use strict";
|
19212 |
|
19213 |
|
19214 |
|
19215 |
|
19216 |
|
19217 |
|
19218 |
|
19219 |
|
19220 |
|
19221 |
|
19222 |
|
19223 |
|
19224 |
|
19225 |
|
19226 |
|
19227 |
|
19228 |
|
19229 |
|
19230 |
|
19231 |
|
19232 |
|
19233 |
|
19234 |
|
19235 |
|
19236 | var __extends = this && this.__extends || function () {
|
19237 | var _extendStatics = function extendStatics(d, b) {
|
19238 | _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
|
19239 | d.__proto__ = b;
|
19240 | } || function (d, b) {
|
19241 | for (var p in b) {
|
19242 | if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
19243 | }
|
19244 | };
|
19245 | return _extendStatics(d, b);
|
19246 | };
|
19247 | return function (d, b) {
|
19248 | if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
19249 | _extendStatics(d, b);
|
19250 | function __() {
|
19251 | this.constructor = d;
|
19252 | }
|
19253 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
19254 | };
|
19255 | }();
|
19256 | var __assign = this && this.__assign || function () {
|
19257 | __assign = Object.assign || function (t) {
|
19258 | for (var s, i = 1, n = arguments.length; i < n; i++) {
|
19259 | s = arguments[i];
|
19260 | for (var p in s) {
|
19261 | if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
19262 | }
|
19263 | }
|
19264 | return t;
|
19265 | };
|
19266 | return __assign.apply(this, arguments);
|
19267 | };
|
19268 | Object.defineProperty(exports, "__esModule", { value: true });
|
19269 | exports.MDCSelectFoundation = void 0;
|
19270 | var foundation_1 = __webpack_require__( "./packages/mdc-base/foundation.ts");
|
19271 | var keyboard_1 = __webpack_require__( "./packages/mdc-dom/keyboard.ts");
|
19272 | var constants_1 = __webpack_require__( "./packages/mdc-menu-surface/constants.ts");
|
19273 | var constants_2 = __webpack_require__( "./packages/mdc-select/constants.ts");
|
19274 | var MDCSelectFoundation = function (_super) {
|
19275 | __extends(MDCSelectFoundation, _super);
|
19276 |
|
19277 | |
19278 |
|
19279 |
|
19280 |
|
19281 | function MDCSelectFoundation(adapter, foundationMap) {
|
19282 | if (foundationMap === void 0) {
|
19283 | foundationMap = {};
|
19284 | }
|
19285 | var _this = _super.call(this, __assign(__assign({}, MDCSelectFoundation.defaultAdapter), adapter)) || this;
|
19286 |
|
19287 | _this.disabled = false;
|
19288 |
|
19289 |
|
19290 |
|
19291 |
|
19292 | _this.isMenuOpen = false;
|
19293 |
|
19294 | _this.useDefaultValidation = true;
|
19295 | _this.customValidity = true;
|
19296 | _this.lastSelectedIndex = constants_2.numbers.UNSET_INDEX;
|
19297 | _this.clickDebounceTimeout = 0;
|
19298 | _this.recentlyClicked = false;
|
19299 | _this.leadingIcon = foundationMap.leadingIcon;
|
19300 | _this.helperText = foundationMap.helperText;
|
19301 | return _this;
|
19302 | }
|
19303 | Object.defineProperty(MDCSelectFoundation, "cssClasses", {
|
19304 | get: function get() {
|
19305 | return constants_2.cssClasses;
|
19306 | },
|
19307 | enumerable: false,
|
19308 | configurable: true
|
19309 | });
|
19310 | Object.defineProperty(MDCSelectFoundation, "numbers", {
|
19311 | get: function get() {
|
19312 | return constants_2.numbers;
|
19313 | },
|
19314 | enumerable: false,
|
19315 | configurable: true
|
19316 | });
|
19317 | Object.defineProperty(MDCSelectFoundation, "strings", {
|
19318 | get: function get() {
|
19319 | return constants_2.strings;
|
19320 | },
|
19321 | enumerable: false,
|
19322 | configurable: true
|
19323 | });
|
19324 | Object.defineProperty(MDCSelectFoundation, "defaultAdapter", {
|
19325 | |
19326 |
|
19327 |
|
19328 | get: function get() {
|
19329 |
|
19330 | return {
|
19331 | addClass: function addClass() {
|
19332 | return undefined;
|
19333 | },
|
19334 | removeClass: function removeClass() {
|
19335 | return undefined;
|
19336 | },
|
19337 | hasClass: function hasClass() {
|
19338 | return false;
|
19339 | },
|
19340 | activateBottomLine: function activateBottomLine() {
|
19341 | return undefined;
|
19342 | },
|
19343 | deactivateBottomLine: function deactivateBottomLine() {
|
19344 | return undefined;
|
19345 | },
|
19346 | getSelectedIndex: function getSelectedIndex() {
|
19347 | return -1;
|
19348 | },
|
19349 | setSelectedIndex: function setSelectedIndex() {
|
19350 | return undefined;
|
19351 | },
|
19352 | hasLabel: function hasLabel() {
|
19353 | return false;
|
19354 | },
|
19355 | floatLabel: function floatLabel() {
|
19356 | return undefined;
|
19357 | },
|
19358 | getLabelWidth: function getLabelWidth() {
|
19359 | return 0;
|
19360 | },
|
19361 | setLabelRequired: function setLabelRequired() {
|
19362 | return undefined;
|
19363 | },
|
19364 | hasOutline: function hasOutline() {
|
19365 | return false;
|
19366 | },
|
19367 | notchOutline: function notchOutline() {
|
19368 | return undefined;
|
19369 | },
|
19370 | closeOutline: function closeOutline() {
|
19371 | return undefined;
|
19372 | },
|
19373 | setRippleCenter: function setRippleCenter() {
|
19374 | return undefined;
|
19375 | },
|
19376 | notifyChange: function notifyChange() {
|
19377 | return undefined;
|
19378 | },
|
19379 | setSelectedText: function setSelectedText() {
|
19380 | return undefined;
|
19381 | },
|
19382 | isSelectAnchorFocused: function isSelectAnchorFocused() {
|
19383 | return false;
|
19384 | },
|
19385 | getSelectAnchorAttr: function getSelectAnchorAttr() {
|
19386 | return '';
|
19387 | },
|
19388 | setSelectAnchorAttr: function setSelectAnchorAttr() {
|
19389 | return undefined;
|
19390 | },
|
19391 | removeSelectAnchorAttr: function removeSelectAnchorAttr() {
|
19392 | return undefined;
|
19393 | },
|
19394 | addMenuClass: function addMenuClass() {
|
19395 | return undefined;
|
19396 | },
|
19397 | removeMenuClass: function removeMenuClass() {
|
19398 | return undefined;
|
19399 | },
|
19400 | openMenu: function openMenu() {
|
19401 | return undefined;
|
19402 | },
|
19403 | closeMenu: function closeMenu() {
|
19404 | return undefined;
|
19405 | },
|
19406 | getAnchorElement: function getAnchorElement() {
|
19407 | return null;
|
19408 | },
|
19409 | setMenuAnchorElement: function setMenuAnchorElement() {
|
19410 | return undefined;
|
19411 | },
|
19412 | setMenuAnchorCorner: function setMenuAnchorCorner() {
|
19413 | return undefined;
|
19414 | },
|
19415 | setMenuWrapFocus: function setMenuWrapFocus() {
|
19416 | return undefined;
|
19417 | },
|
19418 | focusMenuItemAtIndex: function focusMenuItemAtIndex() {
|
19419 | return undefined;
|
19420 | },
|
19421 | getMenuItemCount: function getMenuItemCount() {
|
19422 | return 0;
|
19423 | },
|
19424 | getMenuItemValues: function getMenuItemValues() {
|
19425 | return [];
|
19426 | },
|
19427 | getMenuItemTextAtIndex: function getMenuItemTextAtIndex() {
|
19428 | return '';
|
19429 | },
|
19430 | isTypeaheadInProgress: function isTypeaheadInProgress() {
|
19431 | return false;
|
19432 | },
|
19433 | typeaheadMatchItem: function typeaheadMatchItem() {
|
19434 | return -1;
|
19435 | }
|
19436 | };
|
19437 |
|
19438 | },
|
19439 | enumerable: false,
|
19440 | configurable: true
|
19441 | });
|
19442 |
|
19443 | MDCSelectFoundation.prototype.getSelectedIndex = function () {
|
19444 | return this.adapter.getSelectedIndex();
|
19445 | };
|
19446 | MDCSelectFoundation.prototype.setSelectedIndex = function (index, closeMenu, skipNotify) {
|
19447 | if (closeMenu === void 0) {
|
19448 | closeMenu = false;
|
19449 | }
|
19450 | if (skipNotify === void 0) {
|
19451 | skipNotify = false;
|
19452 | }
|
19453 | if (index >= this.adapter.getMenuItemCount()) {
|
19454 | return;
|
19455 | }
|
19456 | if (index === constants_2.numbers.UNSET_INDEX) {
|
19457 | this.adapter.setSelectedText('');
|
19458 | } else {
|
19459 | this.adapter.setSelectedText(this.adapter.getMenuItemTextAtIndex(index).trim());
|
19460 | }
|
19461 | this.adapter.setSelectedIndex(index);
|
19462 | if (closeMenu) {
|
19463 | this.adapter.closeMenu();
|
19464 | }
|
19465 | if (!skipNotify && this.lastSelectedIndex !== index) {
|
19466 | this.handleChange();
|
19467 | }
|
19468 | this.lastSelectedIndex = index;
|
19469 | };
|
19470 | MDCSelectFoundation.prototype.setValue = function (value, skipNotify) {
|
19471 | if (skipNotify === void 0) {
|
19472 | skipNotify = false;
|
19473 | }
|
19474 | var index = this.adapter.getMenuItemValues().indexOf(value);
|
19475 | this.setSelectedIndex(index, false, skipNotify);
|
19476 | };
|
19477 | MDCSelectFoundation.prototype.getValue = function () {
|
19478 | var index = this.adapter.getSelectedIndex();
|
19479 | var menuItemValues = this.adapter.getMenuItemValues();
|
19480 | return index !== constants_2.numbers.UNSET_INDEX ? menuItemValues[index] : '';
|
19481 | };
|
19482 | MDCSelectFoundation.prototype.getDisabled = function () {
|
19483 | return this.disabled;
|
19484 | };
|
19485 | MDCSelectFoundation.prototype.setDisabled = function (isDisabled) {
|
19486 | this.disabled = isDisabled;
|
19487 | if (this.disabled) {
|
19488 | this.adapter.addClass(constants_2.cssClasses.DISABLED);
|
19489 | this.adapter.closeMenu();
|
19490 | } else {
|
19491 | this.adapter.removeClass(constants_2.cssClasses.DISABLED);
|
19492 | }
|
19493 | if (this.leadingIcon) {
|
19494 | this.leadingIcon.setDisabled(this.disabled);
|
19495 | }
|
19496 | if (this.disabled) {
|
19497 |
|
19498 |
|
19499 | this.adapter.removeSelectAnchorAttr('tabindex');
|
19500 | } else {
|
19501 | this.adapter.setSelectAnchorAttr('tabindex', '0');
|
19502 | }
|
19503 | this.adapter.setSelectAnchorAttr('aria-disabled', this.disabled.toString());
|
19504 | };
|
19505 |
|
19506 | MDCSelectFoundation.prototype.openMenu = function () {
|
19507 | this.adapter.addClass(constants_2.cssClasses.ACTIVATED);
|
19508 | this.adapter.openMenu();
|
19509 | this.isMenuOpen = true;
|
19510 | this.adapter.setSelectAnchorAttr('aria-expanded', 'true');
|
19511 | };
|
19512 | |
19513 |
|
19514 |
|
19515 | MDCSelectFoundation.prototype.setHelperTextContent = function (content) {
|
19516 | if (this.helperText) {
|
19517 | this.helperText.setContent(content);
|
19518 | }
|
19519 | };
|
19520 | |
19521 |
|
19522 |
|
19523 |
|
19524 | MDCSelectFoundation.prototype.layout = function () {
|
19525 | if (this.adapter.hasLabel()) {
|
19526 | var optionHasValue = this.getValue().length > 0;
|
19527 | var isFocused = this.adapter.hasClass(constants_2.cssClasses.FOCUSED);
|
19528 | var shouldFloatAndNotch = optionHasValue || isFocused;
|
19529 | var isRequired = this.adapter.hasClass(constants_2.cssClasses.REQUIRED);
|
19530 | this.notchOutline(shouldFloatAndNotch);
|
19531 | this.adapter.floatLabel(shouldFloatAndNotch);
|
19532 | this.adapter.setLabelRequired(isRequired);
|
19533 | }
|
19534 | };
|
19535 | |
19536 |
|
19537 |
|
19538 |
|
19539 | MDCSelectFoundation.prototype.layoutOptions = function () {
|
19540 | var menuItemValues = this.adapter.getMenuItemValues();
|
19541 | var selectedIndex = menuItemValues.indexOf(this.getValue());
|
19542 | this.setSelectedIndex(selectedIndex, false, true);
|
19543 | };
|
19544 | MDCSelectFoundation.prototype.handleMenuOpened = function () {
|
19545 | if (this.adapter.getMenuItemValues().length === 0) {
|
19546 | return;
|
19547 | }
|
19548 |
|
19549 | var selectedIndex = this.getSelectedIndex();
|
19550 | var focusItemIndex = selectedIndex >= 0 ? selectedIndex : 0;
|
19551 | this.adapter.focusMenuItemAtIndex(focusItemIndex);
|
19552 | };
|
19553 | MDCSelectFoundation.prototype.handleMenuClosing = function () {
|
19554 | this.adapter.setSelectAnchorAttr('aria-expanded', 'false');
|
19555 | };
|
19556 | MDCSelectFoundation.prototype.handleMenuClosed = function () {
|
19557 | this.adapter.removeClass(constants_2.cssClasses.ACTIVATED);
|
19558 | this.isMenuOpen = false;
|
19559 |
|
19560 | if (!this.adapter.isSelectAnchorFocused()) {
|
19561 | this.blur();
|
19562 | }
|
19563 | };
|
19564 | |
19565 |
|
19566 |
|
19567 | MDCSelectFoundation.prototype.handleChange = function () {
|
19568 | this.layout();
|
19569 | this.adapter.notifyChange(this.getValue());
|
19570 | var isRequired = this.adapter.hasClass(constants_2.cssClasses.REQUIRED);
|
19571 | if (isRequired && this.useDefaultValidation) {
|
19572 | this.setValid(this.isValid());
|
19573 | }
|
19574 | };
|
19575 | MDCSelectFoundation.prototype.handleMenuItemAction = function (index) {
|
19576 | this.setSelectedIndex(index, true);
|
19577 | };
|
19578 | |
19579 |
|
19580 |
|
19581 | MDCSelectFoundation.prototype.handleFocus = function () {
|
19582 | this.adapter.addClass(constants_2.cssClasses.FOCUSED);
|
19583 | this.layout();
|
19584 | this.adapter.activateBottomLine();
|
19585 | };
|
19586 | |
19587 |
|
19588 |
|
19589 | MDCSelectFoundation.prototype.handleBlur = function () {
|
19590 | if (this.isMenuOpen) {
|
19591 | return;
|
19592 | }
|
19593 | this.blur();
|
19594 | };
|
19595 | MDCSelectFoundation.prototype.handleClick = function (normalizedX) {
|
19596 | if (this.disabled || this.recentlyClicked) {
|
19597 | return;
|
19598 | }
|
19599 | this.setClickDebounceTimeout();
|
19600 | if (this.isMenuOpen) {
|
19601 | this.adapter.closeMenu();
|
19602 | return;
|
19603 | }
|
19604 | this.adapter.setRippleCenter(normalizedX);
|
19605 | this.openMenu();
|
19606 | };
|
19607 | |
19608 |
|
19609 |
|
19610 |
|
19611 | MDCSelectFoundation.prototype.handleKeydown = function (event) {
|
19612 | if (this.isMenuOpen || !this.adapter.hasClass(constants_2.cssClasses.FOCUSED)) {
|
19613 | return;
|
19614 | }
|
19615 | var isEnter = keyboard_1.normalizeKey(event) === keyboard_1.KEY.ENTER;
|
19616 | var isSpace = keyboard_1.normalizeKey(event) === keyboard_1.KEY.SPACEBAR;
|
19617 | var arrowUp = keyboard_1.normalizeKey(event) === keyboard_1.KEY.ARROW_UP;
|
19618 | var arrowDown = keyboard_1.normalizeKey(event) === keyboard_1.KEY.ARROW_DOWN;
|
19619 | var isModifier = event.ctrlKey || event.metaKey;
|
19620 |
|
19621 | if (!isModifier && (!isSpace && event.key && event.key.length === 1 || isSpace && this.adapter.isTypeaheadInProgress())) {
|
19622 | var key = isSpace ? ' ' : event.key;
|
19623 | var typeaheadNextIndex = this.adapter.typeaheadMatchItem(key, this.getSelectedIndex());
|
19624 | if (typeaheadNextIndex >= 0) {
|
19625 | this.setSelectedIndex(typeaheadNextIndex);
|
19626 | }
|
19627 | event.preventDefault();
|
19628 | return;
|
19629 | }
|
19630 | if (!isEnter && !isSpace && !arrowUp && !arrowDown) {
|
19631 | return;
|
19632 | }
|
19633 |
|
19634 | if (arrowUp && this.getSelectedIndex() > 0) {
|
19635 | this.setSelectedIndex(this.getSelectedIndex() - 1);
|
19636 | } else if (arrowDown && this.getSelectedIndex() < this.adapter.getMenuItemCount() - 1) {
|
19637 | this.setSelectedIndex(this.getSelectedIndex() + 1);
|
19638 | }
|
19639 | this.openMenu();
|
19640 | event.preventDefault();
|
19641 | };
|
19642 | |
19643 |
|
19644 |
|
19645 | MDCSelectFoundation.prototype.notchOutline = function (openNotch) {
|
19646 | if (!this.adapter.hasOutline()) {
|
19647 | return;
|
19648 | }
|
19649 | var isFocused = this.adapter.hasClass(constants_2.cssClasses.FOCUSED);
|
19650 | if (openNotch) {
|
19651 | var labelScale = constants_2.numbers.LABEL_SCALE;
|
19652 | var labelWidth = this.adapter.getLabelWidth() * labelScale;
|
19653 | this.adapter.notchOutline(labelWidth);
|
19654 | } else if (!isFocused) {
|
19655 | this.adapter.closeOutline();
|
19656 | }
|
19657 | };
|
19658 | |
19659 |
|
19660 |
|
19661 | MDCSelectFoundation.prototype.setLeadingIconAriaLabel = function (label) {
|
19662 | if (this.leadingIcon) {
|
19663 | this.leadingIcon.setAriaLabel(label);
|
19664 | }
|
19665 | };
|
19666 | |
19667 |
|
19668 |
|
19669 | MDCSelectFoundation.prototype.setLeadingIconContent = function (content) {
|
19670 | if (this.leadingIcon) {
|
19671 | this.leadingIcon.setContent(content);
|
19672 | }
|
19673 | };
|
19674 | MDCSelectFoundation.prototype.getUseDefaultValidation = function () {
|
19675 | return this.useDefaultValidation;
|
19676 | };
|
19677 | MDCSelectFoundation.prototype.setUseDefaultValidation = function (useDefaultValidation) {
|
19678 | this.useDefaultValidation = useDefaultValidation;
|
19679 | };
|
19680 | MDCSelectFoundation.prototype.setValid = function (isValid) {
|
19681 | if (!this.useDefaultValidation) {
|
19682 | this.customValidity = isValid;
|
19683 | }
|
19684 | this.adapter.setSelectAnchorAttr('aria-invalid', (!isValid).toString());
|
19685 | if (isValid) {
|
19686 | this.adapter.removeClass(constants_2.cssClasses.INVALID);
|
19687 | this.adapter.removeMenuClass(constants_2.cssClasses.MENU_INVALID);
|
19688 | } else {
|
19689 | this.adapter.addClass(constants_2.cssClasses.INVALID);
|
19690 | this.adapter.addMenuClass(constants_2.cssClasses.MENU_INVALID);
|
19691 | }
|
19692 | this.syncHelperTextValidity(isValid);
|
19693 | };
|
19694 | MDCSelectFoundation.prototype.isValid = function () {
|
19695 | if (this.useDefaultValidation && this.adapter.hasClass(constants_2.cssClasses.REQUIRED) && !this.adapter.hasClass(constants_2.cssClasses.DISABLED)) {
|
19696 |
|
19697 |
|
19698 | return this.getSelectedIndex() !== constants_2.numbers.UNSET_INDEX && (this.getSelectedIndex() !== 0 || Boolean(this.getValue()));
|
19699 | }
|
19700 | return this.customValidity;
|
19701 | };
|
19702 | MDCSelectFoundation.prototype.setRequired = function (isRequired) {
|
19703 | if (isRequired) {
|
19704 | this.adapter.addClass(constants_2.cssClasses.REQUIRED);
|
19705 | } else {
|
19706 | this.adapter.removeClass(constants_2.cssClasses.REQUIRED);
|
19707 | }
|
19708 | this.adapter.setSelectAnchorAttr('aria-required', isRequired.toString());
|
19709 | this.adapter.setLabelRequired(isRequired);
|
19710 | };
|
19711 | MDCSelectFoundation.prototype.getRequired = function () {
|
19712 | return this.adapter.getSelectAnchorAttr('aria-required') === 'true';
|
19713 | };
|
19714 | MDCSelectFoundation.prototype.init = function () {
|
19715 | var anchorEl = this.adapter.getAnchorElement();
|
19716 | if (anchorEl) {
|
19717 | this.adapter.setMenuAnchorElement(anchorEl);
|
19718 | this.adapter.setMenuAnchorCorner(constants_1.Corner.BOTTOM_START);
|
19719 | }
|
19720 | this.adapter.setMenuWrapFocus(false);
|
19721 | this.setDisabled(this.adapter.hasClass(constants_2.cssClasses.DISABLED));
|
19722 | this.syncHelperTextValidity(!this.adapter.hasClass(constants_2.cssClasses.INVALID));
|
19723 | this.layout();
|
19724 | this.layoutOptions();
|
19725 | };
|
19726 | |
19727 |
|
19728 |
|
19729 | MDCSelectFoundation.prototype.blur = function () {
|
19730 | this.adapter.removeClass(constants_2.cssClasses.FOCUSED);
|
19731 | this.layout();
|
19732 | this.adapter.deactivateBottomLine();
|
19733 | var isRequired = this.adapter.hasClass(constants_2.cssClasses.REQUIRED);
|
19734 | if (isRequired && this.useDefaultValidation) {
|
19735 | this.setValid(this.isValid());
|
19736 | }
|
19737 | };
|
19738 | MDCSelectFoundation.prototype.syncHelperTextValidity = function (isValid) {
|
19739 | if (!this.helperText) {
|
19740 | return;
|
19741 | }
|
19742 | this.helperText.setValidity(isValid);
|
19743 | var helperTextVisible = this.helperText.isVisible();
|
19744 | var helperTextId = this.helperText.getId();
|
19745 | if (helperTextVisible && helperTextId) {
|
19746 | this.adapter.setSelectAnchorAttr(constants_2.strings.ARIA_DESCRIBEDBY, helperTextId);
|
19747 | } else {
|
19748 |
|
19749 |
|
19750 | this.adapter.removeSelectAnchorAttr(constants_2.strings.ARIA_DESCRIBEDBY);
|
19751 | }
|
19752 | };
|
19753 | MDCSelectFoundation.prototype.setClickDebounceTimeout = function () {
|
19754 | var _this = this;
|
19755 | clearTimeout(this.clickDebounceTimeout);
|
19756 | this.clickDebounceTimeout = setTimeout(function () {
|
19757 | _this.recentlyClicked = false;
|
19758 | }, constants_2.numbers.CLICK_DEBOUNCE_TIMEOUT_MS);
|
19759 | this.recentlyClicked = true;
|
19760 | };
|
19761 | return MDCSelectFoundation;
|
19762 | }(foundation_1.MDCFoundation);
|
19763 | exports.MDCSelectFoundation = MDCSelectFoundation;
|
19764 |
|
19765 | exports.default = MDCSelectFoundation;
|
19766 |
|
19767 | }),
|
19768 |
|
19769 | "./packages/mdc-select/helper-text/adapter.ts":
|
19770 |
|
19771 |
|
19772 |
|
19773 |
|
19774 | (function(module, exports, __webpack_require__) {
|
19775 |
|
19776 | "use strict";
|
19777 |
|
19778 |
|
19779 |
|
19780 |
|
19781 |
|
19782 |
|
19783 |
|
19784 |
|
19785 |
|
19786 |
|
19787 |
|
19788 |
|
19789 |
|
19790 |
|
19791 |
|
19792 |
|
19793 |
|
19794 |
|
19795 |
|
19796 |
|
19797 |
|
19798 |
|
19799 |
|
19800 |
|
19801 | Object.defineProperty(exports, "__esModule", { value: true });
|
19802 |
|
19803 | }),
|
19804 |
|
19805 | "./packages/mdc-select/helper-text/component.ts":
|
19806 |
|
19807 |
|
19808 |
|
19809 |
|
19810 | (function(module, exports, __webpack_require__) {
|
19811 |
|
19812 | "use strict";
|
19813 |
|
19814 |
|
19815 |
|
19816 |
|
19817 |
|
19818 |
|
19819 |
|
19820 |
|
19821 |
|
19822 |
|
19823 |
|
19824 |
|
19825 |
|
19826 |
|
19827 |
|
19828 |
|
19829 |
|
19830 |
|
19831 |
|
19832 |
|
19833 |
|
19834 |
|
19835 |
|
19836 |
|
19837 | var __extends = this && this.__extends || function () {
|
19838 | var _extendStatics = function extendStatics(d, b) {
|
19839 | _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
|
19840 | d.__proto__ = b;
|
19841 | } || function (d, b) {
|
19842 | for (var p in b) {
|
19843 | if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
19844 | }
|
19845 | };
|
19846 | return _extendStatics(d, b);
|
19847 | };
|
19848 | return function (d, b) {
|
19849 | if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
19850 | _extendStatics(d, b);
|
19851 | function __() {
|
19852 | this.constructor = d;
|
19853 | }
|
19854 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
19855 | };
|
19856 | }();
|
19857 | Object.defineProperty(exports, "__esModule", { value: true });
|
19858 | exports.MDCSelectHelperText = void 0;
|
19859 | var component_1 = __webpack_require__( "./packages/mdc-base/component.ts");
|
19860 | var foundation_1 = __webpack_require__( "./packages/mdc-select/helper-text/foundation.ts");
|
19861 | var MDCSelectHelperText = function (_super) {
|
19862 | __extends(MDCSelectHelperText, _super);
|
19863 | function MDCSelectHelperText() {
|
19864 | return _super !== null && _super.apply(this, arguments) || this;
|
19865 | }
|
19866 | MDCSelectHelperText.attachTo = function (root) {
|
19867 | return new MDCSelectHelperText(root);
|
19868 | };
|
19869 | Object.defineProperty(MDCSelectHelperText.prototype, "foundationForSelect", {
|
19870 |
|
19871 | get: function get() {
|
19872 | return this.foundation;
|
19873 | },
|
19874 | enumerable: false,
|
19875 | configurable: true
|
19876 | });
|
19877 | MDCSelectHelperText.prototype.getDefaultFoundation = function () {
|
19878 | var _this = this;
|
19879 |
|
19880 |
|
19881 |
|
19882 | var adapter = {
|
19883 | addClass: function addClass(className) {
|
19884 | return _this.root.classList.add(className);
|
19885 | },
|
19886 | removeClass: function removeClass(className) {
|
19887 | return _this.root.classList.remove(className);
|
19888 | },
|
19889 | hasClass: function hasClass(className) {
|
19890 | return _this.root.classList.contains(className);
|
19891 | },
|
19892 | getAttr: function getAttr(attr) {
|
19893 | return _this.root.getAttribute(attr);
|
19894 | },
|
19895 | setAttr: function setAttr(attr, value) {
|
19896 | return _this.root.setAttribute(attr, value);
|
19897 | },
|
19898 | removeAttr: function removeAttr(attr) {
|
19899 | return _this.root.removeAttribute(attr);
|
19900 | },
|
19901 | setContent: function setContent(content) {
|
19902 | _this.root.textContent = content;
|
19903 | }
|
19904 | };
|
19905 |
|
19906 | return new foundation_1.MDCSelectHelperTextFoundation(adapter);
|
19907 | };
|
19908 | return MDCSelectHelperText;
|
19909 | }(component_1.MDCComponent);
|
19910 | exports.MDCSelectHelperText = MDCSelectHelperText;
|
19911 |
|
19912 | }),
|
19913 |
|
19914 | "./packages/mdc-select/helper-text/constants.ts":
|
19915 |
|
19916 |
|
19917 |
|
19918 |
|
19919 | (function(module, exports, __webpack_require__) {
|
19920 |
|
19921 | "use strict";
|
19922 |
|
19923 |
|
19924 |
|
19925 |
|
19926 |
|
19927 |
|
19928 |
|
19929 |
|
19930 |
|
19931 |
|
19932 |
|
19933 |
|
19934 |
|
19935 |
|
19936 |
|
19937 |
|
19938 |
|
19939 |
|
19940 |
|
19941 |
|
19942 |
|
19943 |
|
19944 |
|
19945 |
|
19946 | Object.defineProperty(exports, "__esModule", { value: true });
|
19947 | exports.cssClasses = exports.strings = void 0;
|
19948 | var strings = {
|
19949 | ARIA_HIDDEN: 'aria-hidden',
|
19950 | ROLE: 'role'
|
19951 | };
|
19952 | exports.strings = strings;
|
19953 | var cssClasses = {
|
19954 | HELPER_TEXT_VALIDATION_MSG: 'mdc-select-helper-text--validation-msg',
|
19955 | HELPER_TEXT_VALIDATION_MSG_PERSISTENT: 'mdc-select-helper-text--validation-msg-persistent'
|
19956 | };
|
19957 | exports.cssClasses = cssClasses;
|
19958 |
|
19959 | }),
|
19960 |
|
19961 | "./packages/mdc-select/helper-text/foundation.ts":
|
19962 |
|
19963 |
|
19964 |
|
19965 |
|
19966 | (function(module, exports, __webpack_require__) {
|
19967 |
|
19968 | "use strict";
|
19969 |
|
19970 |
|
19971 |
|
19972 |
|
19973 |
|
19974 |
|
19975 |
|
19976 |
|
19977 |
|
19978 |
|
19979 |
|
19980 |
|
19981 |
|
19982 |
|
19983 |
|
19984 |
|
19985 |
|
19986 |
|
19987 |
|
19988 |
|
19989 |
|
19990 |
|
19991 |
|
19992 |
|
19993 | var __extends = this && this.__extends || function () {
|
19994 | var _extendStatics = function extendStatics(d, b) {
|
19995 | _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
|
19996 | d.__proto__ = b;
|
19997 | } || function (d, b) {
|
19998 | for (var p in b) {
|
19999 | if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
20000 | }
|
20001 | };
|
20002 | return _extendStatics(d, b);
|
20003 | };
|
20004 | return function (d, b) {
|
20005 | if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
20006 | _extendStatics(d, b);
|
20007 | function __() {
|
20008 | this.constructor = d;
|
20009 | }
|
20010 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
20011 | };
|
20012 | }();
|
20013 | var __assign = this && this.__assign || function () {
|
20014 | __assign = Object.assign || function (t) {
|
20015 | for (var s, i = 1, n = arguments.length; i < n; i++) {
|
20016 | s = arguments[i];
|
20017 | for (var p in s) {
|
20018 | if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
20019 | }
|
20020 | }
|
20021 | return t;
|
20022 | };
|
20023 | return __assign.apply(this, arguments);
|
20024 | };
|
20025 | Object.defineProperty(exports, "__esModule", { value: true });
|
20026 | exports.MDCSelectHelperTextFoundation = void 0;
|
20027 | var foundation_1 = __webpack_require__( "./packages/mdc-base/foundation.ts");
|
20028 | var constants_1 = __webpack_require__( "./packages/mdc-select/helper-text/constants.ts");
|
20029 | var MDCSelectHelperTextFoundation = function (_super) {
|
20030 | __extends(MDCSelectHelperTextFoundation, _super);
|
20031 | function MDCSelectHelperTextFoundation(adapter) {
|
20032 | return _super.call(this, __assign(__assign({}, MDCSelectHelperTextFoundation.defaultAdapter), adapter)) || this;
|
20033 | }
|
20034 | Object.defineProperty(MDCSelectHelperTextFoundation, "cssClasses", {
|
20035 | get: function get() {
|
20036 | return constants_1.cssClasses;
|
20037 | },
|
20038 | enumerable: false,
|
20039 | configurable: true
|
20040 | });
|
20041 | Object.defineProperty(MDCSelectHelperTextFoundation, "strings", {
|
20042 | get: function get() {
|
20043 | return constants_1.strings;
|
20044 | },
|
20045 | enumerable: false,
|
20046 | configurable: true
|
20047 | });
|
20048 | Object.defineProperty(MDCSelectHelperTextFoundation, "defaultAdapter", {
|
20049 | |
20050 |
|
20051 |
|
20052 | get: function get() {
|
20053 |
|
20054 | return {
|
20055 | addClass: function addClass() {
|
20056 | return undefined;
|
20057 | },
|
20058 | removeClass: function removeClass() {
|
20059 | return undefined;
|
20060 | },
|
20061 | hasClass: function hasClass() {
|
20062 | return false;
|
20063 | },
|
20064 | setAttr: function setAttr() {
|
20065 | return undefined;
|
20066 | },
|
20067 | getAttr: function getAttr() {
|
20068 | return null;
|
20069 | },
|
20070 | removeAttr: function removeAttr() {
|
20071 | return undefined;
|
20072 | },
|
20073 | setContent: function setContent() {
|
20074 | return undefined;
|
20075 | }
|
20076 | };
|
20077 |
|
20078 | },
|
20079 | enumerable: false,
|
20080 | configurable: true
|
20081 | });
|
20082 | |
20083 |
|
20084 |
|
20085 | MDCSelectHelperTextFoundation.prototype.getId = function () {
|
20086 | return this.adapter.getAttr('id');
|
20087 | };
|
20088 | |
20089 |
|
20090 |
|
20091 | MDCSelectHelperTextFoundation.prototype.isVisible = function () {
|
20092 | return this.adapter.getAttr(constants_1.strings.ARIA_HIDDEN) !== 'true';
|
20093 | };
|
20094 | |
20095 |
|
20096 |
|
20097 | MDCSelectHelperTextFoundation.prototype.setContent = function (content) {
|
20098 | this.adapter.setContent(content);
|
20099 | };
|
20100 | |
20101 |
|
20102 |
|
20103 |
|
20104 |
|
20105 |
|
20106 |
|
20107 |
|
20108 | MDCSelectHelperTextFoundation.prototype.setValidation = function (isValidation) {
|
20109 | if (isValidation) {
|
20110 | this.adapter.addClass(constants_1.cssClasses.HELPER_TEXT_VALIDATION_MSG);
|
20111 | } else {
|
20112 | this.adapter.removeClass(constants_1.cssClasses.HELPER_TEXT_VALIDATION_MSG);
|
20113 | }
|
20114 | };
|
20115 | |
20116 |
|
20117 |
|
20118 |
|
20119 |
|
20120 | MDCSelectHelperTextFoundation.prototype.setValidationMsgPersistent = function (isPersistent) {
|
20121 | if (isPersistent) {
|
20122 | this.adapter.addClass(constants_1.cssClasses.HELPER_TEXT_VALIDATION_MSG_PERSISTENT);
|
20123 | } else {
|
20124 | this.adapter.removeClass(constants_1.cssClasses.HELPER_TEXT_VALIDATION_MSG_PERSISTENT);
|
20125 | }
|
20126 | };
|
20127 | |
20128 |
|
20129 |
|
20130 |
|
20131 | MDCSelectHelperTextFoundation.prototype.setValidity = function (selectIsValid) {
|
20132 | var isValidationMsg = this.adapter.hasClass(constants_1.cssClasses.HELPER_TEXT_VALIDATION_MSG);
|
20133 | if (!isValidationMsg) {
|
20134 |
|
20135 |
|
20136 | return;
|
20137 | }
|
20138 | var isPersistentValidationMsg = this.adapter.hasClass(constants_1.cssClasses.HELPER_TEXT_VALIDATION_MSG_PERSISTENT);
|
20139 |
|
20140 |
|
20141 | var msgShouldDisplay = !selectIsValid || isPersistentValidationMsg;
|
20142 | if (msgShouldDisplay) {
|
20143 | this.showToScreenReader();
|
20144 |
|
20145 |
|
20146 | if (!selectIsValid) {
|
20147 | this.adapter.setAttr(constants_1.strings.ROLE, 'alert');
|
20148 | } else {
|
20149 | this.adapter.removeAttr(constants_1.strings.ROLE);
|
20150 | }
|
20151 | return;
|
20152 | }
|
20153 |
|
20154 | this.adapter.removeAttr(constants_1.strings.ROLE);
|
20155 | this.hide();
|
20156 | };
|
20157 | |
20158 |
|
20159 |
|
20160 | MDCSelectHelperTextFoundation.prototype.showToScreenReader = function () {
|
20161 | this.adapter.removeAttr(constants_1.strings.ARIA_HIDDEN);
|
20162 | };
|
20163 | |
20164 |
|
20165 |
|
20166 | MDCSelectHelperTextFoundation.prototype.hide = function () {
|
20167 | this.adapter.setAttr(constants_1.strings.ARIA_HIDDEN, 'true');
|
20168 | };
|
20169 | return MDCSelectHelperTextFoundation;
|
20170 | }(foundation_1.MDCFoundation);
|
20171 | exports.MDCSelectHelperTextFoundation = MDCSelectHelperTextFoundation;
|
20172 |
|
20173 | exports.default = MDCSelectHelperTextFoundation;
|
20174 |
|
20175 | }),
|
20176 |
|
20177 | "./packages/mdc-select/helper-text/index.ts":
|
20178 |
|
20179 |
|
20180 |
|
20181 |
|
20182 | (function(module, exports, __webpack_require__) {
|
20183 |
|
20184 | "use strict";
|
20185 |
|
20186 |
|
20187 |
|
20188 |
|
20189 |
|
20190 |
|
20191 |
|
20192 |
|
20193 |
|
20194 |
|
20195 |
|
20196 |
|
20197 |
|
20198 |
|
20199 |
|
20200 |
|
20201 |
|
20202 |
|
20203 |
|
20204 |
|
20205 |
|
20206 |
|
20207 |
|
20208 |
|
20209 | var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
|
20210 | if (k2 === undefined) k2 = k;
|
20211 | Object.defineProperty(o, k2, { enumerable: true, get: function get() {
|
20212 | return m[k];
|
20213 | } });
|
20214 | } : function (o, m, k, k2) {
|
20215 | if (k2 === undefined) k2 = k;
|
20216 | o[k2] = m[k];
|
20217 | });
|
20218 | var __exportStar = this && this.__exportStar || function (m, exports) {
|
20219 | for (var p in m) {
|
20220 | if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
20221 | }
|
20222 | };
|
20223 | Object.defineProperty(exports, "__esModule", { value: true });
|
20224 | exports.helperTextStrings = exports.helperTextCssClasses = void 0;
|
20225 | __exportStar(__webpack_require__( "./packages/mdc-select/helper-text/adapter.ts"), exports);
|
20226 | __exportStar(__webpack_require__( "./packages/mdc-select/helper-text/component.ts"), exports);
|
20227 | __exportStar(__webpack_require__( "./packages/mdc-select/helper-text/foundation.ts"), exports);
|
20228 | var constants_1 = __webpack_require__( "./packages/mdc-select/helper-text/constants.ts");
|
20229 | Object.defineProperty(exports, "helperTextCssClasses", { enumerable: true, get: function get() {
|
20230 | return constants_1.cssClasses;
|
20231 | } });
|
20232 | Object.defineProperty(exports, "helperTextStrings", { enumerable: true, get: function get() {
|
20233 | return constants_1.strings;
|
20234 | } });
|
20235 |
|
20236 | }),
|
20237 |
|
20238 | "./packages/mdc-select/icon/adapter.ts":
|
20239 |
|
20240 |
|
20241 |
|
20242 |
|
20243 | (function(module, exports, __webpack_require__) {
|
20244 |
|
20245 | "use strict";
|
20246 |
|
20247 |
|
20248 |
|
20249 |
|
20250 |
|
20251 |
|
20252 |
|
20253 |
|
20254 |
|
20255 |
|
20256 |
|
20257 |
|
20258 |
|
20259 |
|
20260 |
|
20261 |
|
20262 |
|
20263 |
|
20264 |
|
20265 |
|
20266 |
|
20267 |
|
20268 |
|
20269 |
|
20270 | Object.defineProperty(exports, "__esModule", { value: true });
|
20271 |
|
20272 | }),
|
20273 |
|
20274 | "./packages/mdc-select/icon/component.ts":
|
20275 |
|
20276 |
|
20277 |
|
20278 |
|
20279 | (function(module, exports, __webpack_require__) {
|
20280 |
|
20281 | "use strict";
|
20282 |
|
20283 |
|
20284 |
|
20285 |
|
20286 |
|
20287 |
|
20288 |
|
20289 |
|
20290 |
|
20291 |
|
20292 |
|
20293 |
|
20294 |
|
20295 |
|
20296 |
|
20297 |
|
20298 |
|
20299 |
|
20300 |
|
20301 |
|
20302 |
|
20303 |
|
20304 |
|
20305 |
|
20306 | var __extends = this && this.__extends || function () {
|
20307 | var _extendStatics = function extendStatics(d, b) {
|
20308 | _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
|
20309 | d.__proto__ = b;
|
20310 | } || function (d, b) {
|
20311 | for (var p in b) {
|
20312 | if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
20313 | }
|
20314 | };
|
20315 | return _extendStatics(d, b);
|
20316 | };
|
20317 | return function (d, b) {
|
20318 | if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
20319 | _extendStatics(d, b);
|
20320 | function __() {
|
20321 | this.constructor = d;
|
20322 | }
|
20323 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
20324 | };
|
20325 | }();
|
20326 | Object.defineProperty(exports, "__esModule", { value: true });
|
20327 | exports.MDCSelectIcon = void 0;
|
20328 | var component_1 = __webpack_require__( "./packages/mdc-base/component.ts");
|
20329 | var foundation_1 = __webpack_require__( "./packages/mdc-select/icon/foundation.ts");
|
20330 | var MDCSelectIcon = function (_super) {
|
20331 | __extends(MDCSelectIcon, _super);
|
20332 | function MDCSelectIcon() {
|
20333 | return _super !== null && _super.apply(this, arguments) || this;
|
20334 | }
|
20335 | MDCSelectIcon.attachTo = function (root) {
|
20336 | return new MDCSelectIcon(root);
|
20337 | };
|
20338 | Object.defineProperty(MDCSelectIcon.prototype, "foundationForSelect", {
|
20339 |
|
20340 | get: function get() {
|
20341 | return this.foundation;
|
20342 | },
|
20343 | enumerable: false,
|
20344 | configurable: true
|
20345 | });
|
20346 | MDCSelectIcon.prototype.getDefaultFoundation = function () {
|
20347 | var _this = this;
|
20348 |
|
20349 |
|
20350 |
|
20351 | var adapter = {
|
20352 | getAttr: function getAttr(attr) {
|
20353 | return _this.root.getAttribute(attr);
|
20354 | },
|
20355 | setAttr: function setAttr(attr, value) {
|
20356 | return _this.root.setAttribute(attr, value);
|
20357 | },
|
20358 | removeAttr: function removeAttr(attr) {
|
20359 | return _this.root.removeAttribute(attr);
|
20360 | },
|
20361 | setContent: function setContent(content) {
|
20362 | _this.root.textContent = content;
|
20363 | },
|
20364 | registerInteractionHandler: function registerInteractionHandler(evtType, handler) {
|
20365 | return _this.listen(evtType, handler);
|
20366 | },
|
20367 | deregisterInteractionHandler: function deregisterInteractionHandler(evtType, handler) {
|
20368 | return _this.unlisten(evtType, handler);
|
20369 | },
|
20370 | notifyIconAction: function notifyIconAction() {
|
20371 | return _this.emit(foundation_1.MDCSelectIconFoundation.strings.ICON_EVENT, {} , true );
|
20372 | }
|
20373 | };
|
20374 |
|
20375 | return new foundation_1.MDCSelectIconFoundation(adapter);
|
20376 | };
|
20377 | return MDCSelectIcon;
|
20378 | }(component_1.MDCComponent);
|
20379 | exports.MDCSelectIcon = MDCSelectIcon;
|
20380 |
|
20381 | }),
|
20382 |
|
20383 | "./packages/mdc-select/icon/constants.ts":
|
20384 |
|
20385 |
|
20386 |
|
20387 |
|
20388 | (function(module, exports, __webpack_require__) {
|
20389 |
|
20390 | "use strict";
|
20391 |
|
20392 |
|
20393 |
|
20394 |
|
20395 |
|
20396 |
|
20397 |
|
20398 |
|
20399 |
|
20400 |
|
20401 |
|
20402 |
|
20403 |
|
20404 |
|
20405 |
|
20406 |
|
20407 |
|
20408 |
|
20409 |
|
20410 |
|
20411 |
|
20412 |
|
20413 |
|
20414 |
|
20415 | Object.defineProperty(exports, "__esModule", { value: true });
|
20416 | exports.strings = void 0;
|
20417 | var strings = {
|
20418 | ICON_EVENT: 'MDCSelect:icon',
|
20419 | ICON_ROLE: 'button'
|
20420 | };
|
20421 | exports.strings = strings;
|
20422 |
|
20423 | }),
|
20424 |
|
20425 | "./packages/mdc-select/icon/foundation.ts":
|
20426 |
|
20427 |
|
20428 |
|
20429 |
|
20430 | (function(module, exports, __webpack_require__) {
|
20431 |
|
20432 | "use strict";
|
20433 |
|
20434 |
|
20435 |
|
20436 |
|
20437 |
|
20438 |
|
20439 |
|
20440 |
|
20441 |
|
20442 |
|
20443 |
|
20444 |
|
20445 |
|
20446 |
|
20447 |
|
20448 |
|
20449 |
|
20450 |
|
20451 |
|
20452 |
|
20453 |
|
20454 |
|
20455 |
|
20456 |
|
20457 | var __extends = this && this.__extends || function () {
|
20458 | var _extendStatics = function extendStatics(d, b) {
|
20459 | _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
|
20460 | d.__proto__ = b;
|
20461 | } || function (d, b) {
|
20462 | for (var p in b) {
|
20463 | if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
20464 | }
|
20465 | };
|
20466 | return _extendStatics(d, b);
|
20467 | };
|
20468 | return function (d, b) {
|
20469 | if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
20470 | _extendStatics(d, b);
|
20471 | function __() {
|
20472 | this.constructor = d;
|
20473 | }
|
20474 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
20475 | };
|
20476 | }();
|
20477 | var __assign = this && this.__assign || function () {
|
20478 | __assign = Object.assign || function (t) {
|
20479 | for (var s, i = 1, n = arguments.length; i < n; i++) {
|
20480 | s = arguments[i];
|
20481 | for (var p in s) {
|
20482 | if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
20483 | }
|
20484 | }
|
20485 | return t;
|
20486 | };
|
20487 | return __assign.apply(this, arguments);
|
20488 | };
|
20489 | var __values = this && this.__values || function (o) {
|
20490 | var s = typeof Symbol === "function" && Symbol.iterator,
|
20491 | m = s && o[s],
|
20492 | i = 0;
|
20493 | if (m) return m.call(o);
|
20494 | if (o && typeof o.length === "number") return {
|
20495 | next: function next() {
|
20496 | if (o && i >= o.length) o = void 0;
|
20497 | return { value: o && o[i++], done: !o };
|
20498 | }
|
20499 | };
|
20500 | throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
20501 | };
|
20502 | Object.defineProperty(exports, "__esModule", { value: true });
|
20503 | exports.MDCSelectIconFoundation = void 0;
|
20504 | var foundation_1 = __webpack_require__( "./packages/mdc-base/foundation.ts");
|
20505 | var constants_1 = __webpack_require__( "./packages/mdc-select/icon/constants.ts");
|
20506 | var INTERACTION_EVENTS = ['click', 'keydown'];
|
20507 | var MDCSelectIconFoundation = function (_super) {
|
20508 | __extends(MDCSelectIconFoundation, _super);
|
20509 | function MDCSelectIconFoundation(adapter) {
|
20510 | var _this = _super.call(this, __assign(__assign({}, MDCSelectIconFoundation.defaultAdapter), adapter)) || this;
|
20511 | _this.savedTabIndex = null;
|
20512 | _this.interactionHandler = function (evt) {
|
20513 | _this.handleInteraction(evt);
|
20514 | };
|
20515 | return _this;
|
20516 | }
|
20517 | Object.defineProperty(MDCSelectIconFoundation, "strings", {
|
20518 | get: function get() {
|
20519 | return constants_1.strings;
|
20520 | },
|
20521 | enumerable: false,
|
20522 | configurable: true
|
20523 | });
|
20524 | Object.defineProperty(MDCSelectIconFoundation, "defaultAdapter", {
|
20525 | |
20526 |
|
20527 |
|
20528 | get: function get() {
|
20529 |
|
20530 | return {
|
20531 | getAttr: function getAttr() {
|
20532 | return null;
|
20533 | },
|
20534 | setAttr: function setAttr() {
|
20535 | return undefined;
|
20536 | },
|
20537 | removeAttr: function removeAttr() {
|
20538 | return undefined;
|
20539 | },
|
20540 | setContent: function setContent() {
|
20541 | return undefined;
|
20542 | },
|
20543 | registerInteractionHandler: function registerInteractionHandler() {
|
20544 | return undefined;
|
20545 | },
|
20546 | deregisterInteractionHandler: function deregisterInteractionHandler() {
|
20547 | return undefined;
|
20548 | },
|
20549 | notifyIconAction: function notifyIconAction() {
|
20550 | return undefined;
|
20551 | }
|
20552 | };
|
20553 |
|
20554 | },
|
20555 | enumerable: false,
|
20556 | configurable: true
|
20557 | });
|
20558 | MDCSelectIconFoundation.prototype.init = function () {
|
20559 | var e_1, _a;
|
20560 | this.savedTabIndex = this.adapter.getAttr('tabindex');
|
20561 | try {
|
20562 | for (var INTERACTION_EVENTS_1 = __values(INTERACTION_EVENTS), INTERACTION_EVENTS_1_1 = INTERACTION_EVENTS_1.next(); !INTERACTION_EVENTS_1_1.done; INTERACTION_EVENTS_1_1 = INTERACTION_EVENTS_1.next()) {
|
20563 | var evtType = INTERACTION_EVENTS_1_1.value;
|
20564 | this.adapter.registerInteractionHandler(evtType, this.interactionHandler);
|
20565 | }
|
20566 | } catch (e_1_1) {
|
20567 | e_1 = { error: e_1_1 };
|
20568 | } finally {
|
20569 | try {
|
20570 | if (INTERACTION_EVENTS_1_1 && !INTERACTION_EVENTS_1_1.done && (_a = INTERACTION_EVENTS_1.return)) _a.call(INTERACTION_EVENTS_1);
|
20571 | } finally {
|
20572 | if (e_1) throw e_1.error;
|
20573 | }
|
20574 | }
|
20575 | };
|
20576 | MDCSelectIconFoundation.prototype.destroy = function () {
|
20577 | var e_2, _a;
|
20578 | try {
|
20579 | for (var INTERACTION_EVENTS_2 = __values(INTERACTION_EVENTS), INTERACTION_EVENTS_2_1 = INTERACTION_EVENTS_2.next(); !INTERACTION_EVENTS_2_1.done; INTERACTION_EVENTS_2_1 = INTERACTION_EVENTS_2.next()) {
|
20580 | var evtType = INTERACTION_EVENTS_2_1.value;
|
20581 | this.adapter.deregisterInteractionHandler(evtType, this.interactionHandler);
|
20582 | }
|
20583 | } catch (e_2_1) {
|
20584 | e_2 = { error: e_2_1 };
|
20585 | } finally {
|
20586 | try {
|
20587 | if (INTERACTION_EVENTS_2_1 && !INTERACTION_EVENTS_2_1.done && (_a = INTERACTION_EVENTS_2.return)) _a.call(INTERACTION_EVENTS_2);
|
20588 | } finally {
|
20589 | if (e_2) throw e_2.error;
|
20590 | }
|
20591 | }
|
20592 | };
|
20593 | MDCSelectIconFoundation.prototype.setDisabled = function (disabled) {
|
20594 | if (!this.savedTabIndex) {
|
20595 | return;
|
20596 | }
|
20597 | if (disabled) {
|
20598 | this.adapter.setAttr('tabindex', '-1');
|
20599 | this.adapter.removeAttr('role');
|
20600 | } else {
|
20601 | this.adapter.setAttr('tabindex', this.savedTabIndex);
|
20602 | this.adapter.setAttr('role', constants_1.strings.ICON_ROLE);
|
20603 | }
|
20604 | };
|
20605 | MDCSelectIconFoundation.prototype.setAriaLabel = function (label) {
|
20606 | this.adapter.setAttr('aria-label', label);
|
20607 | };
|
20608 | MDCSelectIconFoundation.prototype.setContent = function (content) {
|
20609 | this.adapter.setContent(content);
|
20610 | };
|
20611 | MDCSelectIconFoundation.prototype.handleInteraction = function (evt) {
|
20612 | var isEnterKey = evt.key === 'Enter' || evt.keyCode === 13;
|
20613 | if (evt.type === 'click' || isEnterKey) {
|
20614 | this.adapter.notifyIconAction();
|
20615 | }
|
20616 | };
|
20617 | return MDCSelectIconFoundation;
|
20618 | }(foundation_1.MDCFoundation);
|
20619 | exports.MDCSelectIconFoundation = MDCSelectIconFoundation;
|
20620 |
|
20621 | exports.default = MDCSelectIconFoundation;
|
20622 |
|
20623 | }),
|
20624 |
|
20625 | "./packages/mdc-select/icon/index.ts":
|
20626 |
|
20627 |
|
20628 |
|
20629 |
|
20630 | (function(module, exports, __webpack_require__) {
|
20631 |
|
20632 | "use strict";
|
20633 |
|
20634 |
|
20635 |
|
20636 |
|
20637 |
|
20638 |
|
20639 |
|
20640 |
|
20641 |
|
20642 |
|
20643 |
|
20644 |
|
20645 |
|
20646 |
|
20647 |
|
20648 |
|
20649 |
|
20650 |
|
20651 |
|
20652 |
|
20653 |
|
20654 |
|
20655 |
|
20656 |
|
20657 | var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
|
20658 | if (k2 === undefined) k2 = k;
|
20659 | Object.defineProperty(o, k2, { enumerable: true, get: function get() {
|
20660 | return m[k];
|
20661 | } });
|
20662 | } : function (o, m, k, k2) {
|
20663 | if (k2 === undefined) k2 = k;
|
20664 | o[k2] = m[k];
|
20665 | });
|
20666 | var __exportStar = this && this.__exportStar || function (m, exports) {
|
20667 | for (var p in m) {
|
20668 | if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
20669 | }
|
20670 | };
|
20671 | Object.defineProperty(exports, "__esModule", { value: true });
|
20672 | exports.iconStrings = void 0;
|
20673 | __exportStar(__webpack_require__( "./packages/mdc-select/icon/adapter.ts"), exports);
|
20674 | __exportStar(__webpack_require__( "./packages/mdc-select/icon/component.ts"), exports);
|
20675 | __exportStar(__webpack_require__( "./packages/mdc-select/icon/foundation.ts"), exports);
|
20676 | var constants_1 = __webpack_require__( "./packages/mdc-select/icon/constants.ts");
|
20677 | Object.defineProperty(exports, "iconStrings", { enumerable: true, get: function get() {
|
20678 | return constants_1.strings;
|
20679 | } });
|
20680 |
|
20681 | }),
|
20682 |
|
20683 | "./packages/mdc-select/index.ts":
|
20684 |
|
20685 |
|
20686 |
|
20687 |
|
20688 | (function(module, exports, __webpack_require__) {
|
20689 |
|
20690 | "use strict";
|
20691 |
|
20692 |
|
20693 |
|
20694 |
|
20695 |
|
20696 |
|
20697 |
|
20698 |
|
20699 |
|
20700 |
|
20701 |
|
20702 |
|
20703 |
|
20704 |
|
20705 |
|
20706 |
|
20707 |
|
20708 |
|
20709 |
|
20710 |
|
20711 |
|
20712 |
|
20713 |
|
20714 |
|
20715 | var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
|
20716 | if (k2 === undefined) k2 = k;
|
20717 | Object.defineProperty(o, k2, { enumerable: true, get: function get() {
|
20718 | return m[k];
|
20719 | } });
|
20720 | } : function (o, m, k, k2) {
|
20721 | if (k2 === undefined) k2 = k;
|
20722 | o[k2] = m[k];
|
20723 | });
|
20724 | var __exportStar = this && this.__exportStar || function (m, exports) {
|
20725 | for (var p in m) {
|
20726 | if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
20727 | }
|
20728 | };
|
20729 | Object.defineProperty(exports, "__esModule", { value: true });
|
20730 | __exportStar(__webpack_require__( "./packages/mdc-select/adapter.ts"), exports);
|
20731 | __exportStar(__webpack_require__( "./packages/mdc-select/component.ts"), exports);
|
20732 | __exportStar(__webpack_require__( "./packages/mdc-select/constants.ts"), exports);
|
20733 | __exportStar(__webpack_require__( "./packages/mdc-select/foundation.ts"), exports);
|
20734 | __exportStar(__webpack_require__( "./packages/mdc-select/types.ts"), exports);
|
20735 | __exportStar(__webpack_require__( "./packages/mdc-select/helper-text/index.ts"), exports);
|
20736 | __exportStar(__webpack_require__( "./packages/mdc-select/icon/index.ts"), exports);
|
20737 |
|
20738 | }),
|
20739 |
|
20740 | "./packages/mdc-select/types.ts":
|
20741 |
|
20742 |
|
20743 |
|
20744 |
|
20745 | (function(module, exports, __webpack_require__) {
|
20746 |
|
20747 | "use strict";
|
20748 |
|
20749 |
|
20750 |
|
20751 |
|
20752 |
|
20753 |
|
20754 |
|
20755 |
|
20756 |
|
20757 |
|
20758 |
|
20759 |
|
20760 |
|
20761 |
|
20762 |
|
20763 |
|
20764 |
|
20765 |
|
20766 |
|
20767 |
|
20768 |
|
20769 |
|
20770 |
|
20771 |
|
20772 | Object.defineProperty(exports, "__esModule", { value: true });
|
20773 |
|
20774 | }),
|
20775 |
|
20776 | "./packages/mdc-slider/adapter.ts":
|
20777 |
|
20778 |
|
20779 |
|
20780 |
|
20781 | (function(module, exports, __webpack_require__) {
|
20782 |
|
20783 | "use strict";
|
20784 |
|
20785 |
|
20786 |
|
20787 |
|
20788 |
|
20789 |
|
20790 |
|
20791 |
|
20792 |
|
20793 |
|
20794 |
|
20795 |
|
20796 |
|
20797 |
|
20798 |
|
20799 |
|
20800 |
|
20801 |
|
20802 |
|
20803 |
|
20804 |
|
20805 |
|
20806 |
|
20807 |
|
20808 | Object.defineProperty(exports, "__esModule", { value: true });
|
20809 |
|
20810 | }),
|
20811 |
|
20812 | "./packages/mdc-slider/component.ts":
|
20813 |
|
20814 |
|
20815 |
|
20816 |
|
20817 | (function(module, exports, __webpack_require__) {
|
20818 |
|
20819 | "use strict";
|
20820 |
|
20821 |
|
20822 |
|
20823 |
|
20824 |
|
20825 |
|
20826 |
|
20827 |
|
20828 |
|
20829 |
|
20830 |
|
20831 |
|
20832 |
|
20833 |
|
20834 |
|
20835 |
|
20836 |
|
20837 |
|
20838 |
|
20839 |
|
20840 |
|
20841 |
|
20842 |
|
20843 |
|
20844 | var __extends = this && this.__extends || function () {
|
20845 | var _extendStatics = function extendStatics(d, b) {
|
20846 | _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
|
20847 | d.__proto__ = b;
|
20848 | } || function (d, b) {
|
20849 | for (var p in b) {
|
20850 | if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
20851 | }
|
20852 | };
|
20853 | return _extendStatics(d, b);
|
20854 | };
|
20855 | return function (d, b) {
|
20856 | if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
20857 | _extendStatics(d, b);
|
20858 | function __() {
|
20859 | this.constructor = d;
|
20860 | }
|
20861 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
20862 | };
|
20863 | }();
|
20864 | var __assign = this && this.__assign || function () {
|
20865 | __assign = Object.assign || function (t) {
|
20866 | for (var s, i = 1, n = arguments.length; i < n; i++) {
|
20867 | s = arguments[i];
|
20868 | for (var p in s) {
|
20869 | if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
20870 | }
|
20871 | }
|
20872 | return t;
|
20873 | };
|
20874 | return __assign.apply(this, arguments);
|
20875 | };
|
20876 | Object.defineProperty(exports, "__esModule", { value: true });
|
20877 | exports.MDCSlider = void 0;
|
20878 | var component_1 = __webpack_require__( "./packages/mdc-base/component.ts");
|
20879 | var events_1 = __webpack_require__( "./packages/mdc-dom/events.ts");
|
20880 | var ponyfill_1 = __webpack_require__( "./packages/mdc-dom/ponyfill.ts");
|
20881 | var component_2 = __webpack_require__( "./packages/mdc-ripple/component.ts");
|
20882 | var foundation_1 = __webpack_require__( "./packages/mdc-ripple/foundation.ts");
|
20883 | var constants_1 = __webpack_require__( "./packages/mdc-slider/constants.ts");
|
20884 | var foundation_2 = __webpack_require__( "./packages/mdc-slider/foundation.ts");
|
20885 | var types_1 = __webpack_require__( "./packages/mdc-slider/types.ts");
|
20886 |
|
20887 | var MDCSlider = function (_super) {
|
20888 | __extends(MDCSlider, _super);
|
20889 | function MDCSlider() {
|
20890 | var _this = _super !== null && _super.apply(this, arguments) || this;
|
20891 | _this.skipInitialUIUpdate = false;
|
20892 |
|
20893 |
|
20894 | _this.valueToAriaValueTextFn = null;
|
20895 | return _this;
|
20896 | }
|
20897 | MDCSlider.attachTo = function (root, options) {
|
20898 | if (options === void 0) {
|
20899 | options = {};
|
20900 | }
|
20901 | return new MDCSlider(root, undefined, options);
|
20902 | };
|
20903 | MDCSlider.prototype.getDefaultFoundation = function () {
|
20904 | var _this = this;
|
20905 |
|
20906 |
|
20907 | var adapter = {
|
20908 | hasClass: function hasClass(className) {
|
20909 | return _this.root.classList.contains(className);
|
20910 | },
|
20911 | addClass: function addClass(className) {
|
20912 | _this.root.classList.add(className);
|
20913 | },
|
20914 | removeClass: function removeClass(className) {
|
20915 | _this.root.classList.remove(className);
|
20916 | },
|
20917 | addThumbClass: function addThumbClass(className, thumb) {
|
20918 | _this.getThumbEl(thumb).classList.add(className);
|
20919 | },
|
20920 | removeThumbClass: function removeThumbClass(className, thumb) {
|
20921 | _this.getThumbEl(thumb).classList.remove(className);
|
20922 | },
|
20923 | getAttribute: function getAttribute(attribute) {
|
20924 | return _this.root.getAttribute(attribute);
|
20925 | },
|
20926 | getInputValue: function getInputValue(thumb) {
|
20927 | return _this.getInput(thumb).value;
|
20928 | },
|
20929 | setInputValue: function setInputValue(value, thumb) {
|
20930 | _this.getInput(thumb).value = value;
|
20931 | },
|
20932 | getInputAttribute: function getInputAttribute(attribute, thumb) {
|
20933 | return _this.getInput(thumb).getAttribute(attribute);
|
20934 | },
|
20935 | setInputAttribute: function setInputAttribute(attribute, value, thumb) {
|
20936 | _this.getInput(thumb).setAttribute(attribute, value);
|
20937 | },
|
20938 | removeInputAttribute: function removeInputAttribute(attribute, thumb) {
|
20939 | _this.getInput(thumb).removeAttribute(attribute);
|
20940 | },
|
20941 | focusInput: function focusInput(thumb) {
|
20942 | _this.getInput(thumb).focus();
|
20943 | },
|
20944 | isInputFocused: function isInputFocused(thumb) {
|
20945 | return _this.getInput(thumb) === document.activeElement;
|
20946 | },
|
20947 | getThumbKnobWidth: function getThumbKnobWidth(thumb) {
|
20948 | return _this.getThumbEl(thumb).querySelector("." + constants_1.cssClasses.THUMB_KNOB).getBoundingClientRect().width;
|
20949 | },
|
20950 | getThumbBoundingClientRect: function getThumbBoundingClientRect(thumb) {
|
20951 | return _this.getThumbEl(thumb).getBoundingClientRect();
|
20952 | },
|
20953 | getBoundingClientRect: function getBoundingClientRect() {
|
20954 | return _this.root.getBoundingClientRect();
|
20955 | },
|
20956 | isRTL: function isRTL() {
|
20957 | return getComputedStyle(_this.root).direction === 'rtl';
|
20958 | },
|
20959 | setThumbStyleProperty: function setThumbStyleProperty(propertyName, value, thumb) {
|
20960 | _this.getThumbEl(thumb).style.setProperty(propertyName, value);
|
20961 | },
|
20962 | removeThumbStyleProperty: function removeThumbStyleProperty(propertyName, thumb) {
|
20963 | _this.getThumbEl(thumb).style.removeProperty(propertyName);
|
20964 | },
|
20965 | setTrackActiveStyleProperty: function setTrackActiveStyleProperty(propertyName, value) {
|
20966 | _this.trackActive.style.setProperty(propertyName, value);
|
20967 | },
|
20968 | removeTrackActiveStyleProperty: function removeTrackActiveStyleProperty(propertyName) {
|
20969 | _this.trackActive.style.removeProperty(propertyName);
|
20970 | },
|
20971 | setValueIndicatorText: function setValueIndicatorText(value, thumb) {
|
20972 | var valueIndicatorEl = _this.getThumbEl(thumb).querySelector("." + constants_1.cssClasses.VALUE_INDICATOR_TEXT);
|
20973 | valueIndicatorEl.textContent = String(value);
|
20974 | },
|
20975 | getValueToAriaValueTextFn: function getValueToAriaValueTextFn() {
|
20976 | return _this.valueToAriaValueTextFn;
|
20977 | },
|
20978 | updateTickMarks: function updateTickMarks(tickMarks) {
|
20979 | var tickMarksContainer = _this.root.querySelector("." + constants_1.cssClasses.TICK_MARKS_CONTAINER);
|
20980 | if (!tickMarksContainer) {
|
20981 | tickMarksContainer = document.createElement('div');
|
20982 | tickMarksContainer.classList.add(constants_1.cssClasses.TICK_MARKS_CONTAINER);
|
20983 | var track = _this.root.querySelector("." + constants_1.cssClasses.TRACK);
|
20984 | track.appendChild(tickMarksContainer);
|
20985 | }
|
20986 | if (tickMarks.length !== tickMarksContainer.children.length) {
|
20987 | while (tickMarksContainer.firstChild) {
|
20988 | tickMarksContainer.removeChild(tickMarksContainer.firstChild);
|
20989 | }
|
20990 | _this.addTickMarks(tickMarksContainer, tickMarks);
|
20991 | } else {
|
20992 | _this.updateTickMarks(tickMarksContainer, tickMarks);
|
20993 | }
|
20994 | },
|
20995 | setPointerCapture: function setPointerCapture(pointerId) {
|
20996 | _this.root.setPointerCapture(pointerId);
|
20997 | },
|
20998 | emitChangeEvent: function emitChangeEvent(value, thumb) {
|
20999 | _this.emit(constants_1.events.CHANGE, { value: value, thumb: thumb });
|
21000 | },
|
21001 | emitInputEvent: function emitInputEvent(value, thumb) {
|
21002 | _this.emit(constants_1.events.INPUT, { value: value, thumb: thumb });
|
21003 | },
|
21004 | emitDragStartEvent: function emitDragStartEvent(_, thumb) {
|
21005 |
|
21006 |
|
21007 | _this.getRipple(thumb).activate();
|
21008 | },
|
21009 | emitDragEndEvent: function emitDragEndEvent(_, thumb) {
|
21010 |
|
21011 |
|
21012 | _this.getRipple(thumb).deactivate();
|
21013 | },
|
21014 | registerEventHandler: function registerEventHandler(evtType, handler) {
|
21015 | _this.listen(evtType, handler);
|
21016 | },
|
21017 | deregisterEventHandler: function deregisterEventHandler(evtType, handler) {
|
21018 | _this.unlisten(evtType, handler);
|
21019 | },
|
21020 | registerThumbEventHandler: function registerThumbEventHandler(thumb, evtType, handler) {
|
21021 | _this.getThumbEl(thumb).addEventListener(evtType, handler);
|
21022 | },
|
21023 | deregisterThumbEventHandler: function deregisterThumbEventHandler(thumb, evtType, handler) {
|
21024 | _this.getThumbEl(thumb).removeEventListener(evtType, handler);
|
21025 | },
|
21026 | registerInputEventHandler: function registerInputEventHandler(thumb, evtType, handler) {
|
21027 | _this.getInput(thumb).addEventListener(evtType, handler);
|
21028 | },
|
21029 | deregisterInputEventHandler: function deregisterInputEventHandler(thumb, evtType, handler) {
|
21030 | _this.getInput(thumb).removeEventListener(evtType, handler);
|
21031 | },
|
21032 | registerBodyEventHandler: function registerBodyEventHandler(evtType, handler) {
|
21033 | document.body.addEventListener(evtType, handler);
|
21034 | },
|
21035 | deregisterBodyEventHandler: function deregisterBodyEventHandler(evtType, handler) {
|
21036 | document.body.removeEventListener(evtType, handler);
|
21037 | },
|
21038 | registerWindowEventHandler: function registerWindowEventHandler(evtType, handler) {
|
21039 | window.addEventListener(evtType, handler);
|
21040 | },
|
21041 | deregisterWindowEventHandler: function deregisterWindowEventHandler(evtType, handler) {
|
21042 | window.removeEventListener(evtType, handler);
|
21043 | }
|
21044 | };
|
21045 | return new foundation_2.MDCSliderFoundation(adapter);
|
21046 | };
|
21047 | |
21048 |
|
21049 |
|
21050 |
|
21051 |
|
21052 |
|
21053 | MDCSlider.prototype.initialize = function (_a) {
|
21054 | var _b = _a === void 0 ? {} : _a,
|
21055 | skipInitialUIUpdate = _b.skipInitialUIUpdate;
|
21056 | this.inputs = [].slice.call(this.root.querySelectorAll("." + constants_1.cssClasses.INPUT));
|
21057 | this.thumbs = [].slice.call(this.root.querySelectorAll("." + constants_1.cssClasses.THUMB));
|
21058 | this.trackActive = this.root.querySelector("." + constants_1.cssClasses.TRACK_ACTIVE);
|
21059 | this.ripples = this.createRipples();
|
21060 | if (skipInitialUIUpdate) {
|
21061 | this.skipInitialUIUpdate = true;
|
21062 | }
|
21063 | };
|
21064 | MDCSlider.prototype.initialSyncWithDOM = function () {
|
21065 | this.foundation.layout({ skipUpdateUI: this.skipInitialUIUpdate });
|
21066 | };
|
21067 |
|
21068 | MDCSlider.prototype.layout = function () {
|
21069 | this.foundation.layout();
|
21070 | };
|
21071 | MDCSlider.prototype.getValueStart = function () {
|
21072 | return this.foundation.getValueStart();
|
21073 | };
|
21074 | MDCSlider.prototype.setValueStart = function (valueStart) {
|
21075 | this.foundation.setValueStart(valueStart);
|
21076 | };
|
21077 | MDCSlider.prototype.getValue = function () {
|
21078 | return this.foundation.getValue();
|
21079 | };
|
21080 | MDCSlider.prototype.setValue = function (value) {
|
21081 | this.foundation.setValue(value);
|
21082 | };
|
21083 |
|
21084 | MDCSlider.prototype.getDisabled = function () {
|
21085 | return this.foundation.getDisabled();
|
21086 | };
|
21087 |
|
21088 | MDCSlider.prototype.setDisabled = function (disabled) {
|
21089 | this.foundation.setDisabled(disabled);
|
21090 | };
|
21091 | |
21092 |
|
21093 |
|
21094 |
|
21095 | MDCSlider.prototype.setValueToAriaValueTextFn = function (mapFn) {
|
21096 | this.valueToAriaValueTextFn = mapFn;
|
21097 | };
|
21098 | MDCSlider.prototype.getThumbEl = function (thumb) {
|
21099 | return thumb === types_1.Thumb.END ? this.thumbs[this.thumbs.length - 1] : this.thumbs[0];
|
21100 | };
|
21101 | MDCSlider.prototype.getInput = function (thumb) {
|
21102 | return thumb === types_1.Thumb.END ? this.inputs[this.inputs.length - 1] : this.inputs[0];
|
21103 | };
|
21104 | MDCSlider.prototype.getRipple = function (thumb) {
|
21105 | return thumb === types_1.Thumb.END ? this.ripples[this.ripples.length - 1] : this.ripples[0];
|
21106 | };
|
21107 |
|
21108 | MDCSlider.prototype.addTickMarks = function (tickMarkContainer, tickMarks) {
|
21109 | var fragment = document.createDocumentFragment();
|
21110 | for (var i = 0; i < tickMarks.length; i++) {
|
21111 | var div = document.createElement('div');
|
21112 | var tickMarkClass = tickMarks[i] === types_1.TickMark.ACTIVE ? constants_1.cssClasses.TICK_MARK_ACTIVE : constants_1.cssClasses.TICK_MARK_INACTIVE;
|
21113 | div.classList.add(tickMarkClass);
|
21114 | fragment.appendChild(div);
|
21115 | }
|
21116 | tickMarkContainer.appendChild(fragment);
|
21117 | };
|
21118 |
|
21119 | MDCSlider.prototype.updateTickMarks = function (tickMarkContainer, tickMarks) {
|
21120 | var tickMarkEls = Array.from(tickMarkContainer.children);
|
21121 | for (var i = 0; i < tickMarkEls.length; i++) {
|
21122 | if (tickMarks[i] === types_1.TickMark.ACTIVE) {
|
21123 | tickMarkEls[i].classList.add(constants_1.cssClasses.TICK_MARK_ACTIVE);
|
21124 | tickMarkEls[i].classList.remove(constants_1.cssClasses.TICK_MARK_INACTIVE);
|
21125 | } else {
|
21126 | tickMarkEls[i].classList.add(constants_1.cssClasses.TICK_MARK_INACTIVE);
|
21127 | tickMarkEls[i].classList.remove(constants_1.cssClasses.TICK_MARK_ACTIVE);
|
21128 | }
|
21129 | }
|
21130 | };
|
21131 |
|
21132 | MDCSlider.prototype.createRipples = function () {
|
21133 | var ripples = [];
|
21134 | var rippleSurfaces = [].slice.call(this.root.querySelectorAll("." + constants_1.cssClasses.THUMB));
|
21135 | var _loop_1 = function _loop_1(i) {
|
21136 | var rippleSurface = rippleSurfaces[i];
|
21137 |
|
21138 |
|
21139 | var input = this_1.inputs[i];
|
21140 | var adapter = __assign(__assign({}, component_2.MDCRipple.createAdapter(this_1)), { addClass: function addClass(className) {
|
21141 | rippleSurface.classList.add(className);
|
21142 | }, computeBoundingRect: function computeBoundingRect() {
|
21143 | return rippleSurface.getBoundingClientRect();
|
21144 | }, deregisterInteractionHandler: function deregisterInteractionHandler(evtType, handler) {
|
21145 | input.removeEventListener(evtType, handler);
|
21146 | }, isSurfaceActive: function isSurfaceActive() {
|
21147 | return ponyfill_1.matches(input, ':active');
|
21148 | }, isUnbounded: function isUnbounded() {
|
21149 | return true;
|
21150 | }, registerInteractionHandler: function registerInteractionHandler(evtType, handler) {
|
21151 | input.addEventListener(evtType, handler, events_1.applyPassive());
|
21152 | }, removeClass: function removeClass(className) {
|
21153 | rippleSurface.classList.remove(className);
|
21154 | }, updateCssVariable: function updateCssVariable(varName, value) {
|
21155 | rippleSurface.style.setProperty(varName, value);
|
21156 | } });
|
21157 | var ripple = new component_2.MDCRipple(rippleSurface, new foundation_1.MDCRippleFoundation(adapter));
|
21158 | ripple.unbounded = true;
|
21159 | ripples.push(ripple);
|
21160 | };
|
21161 | var this_1 = this;
|
21162 | for (var i = 0; i < rippleSurfaces.length; i++) {
|
21163 | _loop_1(i);
|
21164 | }
|
21165 | return ripples;
|
21166 | };
|
21167 | return MDCSlider;
|
21168 | }(component_1.MDCComponent);
|
21169 | exports.MDCSlider = MDCSlider;
|
21170 |
|
21171 | }),
|
21172 |
|
21173 | "./packages/mdc-slider/constants.ts":
|
21174 |
|
21175 |
|
21176 |
|
21177 |
|
21178 | (function(module, exports, __webpack_require__) {
|
21179 |
|
21180 | "use strict";
|
21181 |
|
21182 |
|
21183 |
|
21184 |
|
21185 |
|
21186 |
|
21187 |
|
21188 |
|
21189 |
|
21190 |
|
21191 |
|
21192 |
|
21193 |
|
21194 |
|
21195 |
|
21196 |
|
21197 |
|
21198 |
|
21199 |
|
21200 |
|
21201 |
|
21202 |
|
21203 |
|
21204 |
|
21205 | Object.defineProperty(exports, "__esModule", { value: true });
|
21206 | exports.events = exports.attributes = exports.numbers = exports.cssClasses = void 0;
|
21207 |
|
21208 | exports.cssClasses = {
|
21209 | DISABLED: 'mdc-slider--disabled',
|
21210 | DISCRETE: 'mdc-slider--discrete',
|
21211 | INPUT: 'mdc-slider__input',
|
21212 | RANGE: 'mdc-slider--range',
|
21213 | THUMB: 'mdc-slider__thumb',
|
21214 |
|
21215 | THUMB_FOCUSED: 'mdc-slider__thumb--focused',
|
21216 | THUMB_KNOB: 'mdc-slider__thumb-knob',
|
21217 |
|
21218 | THUMB_TOP: 'mdc-slider__thumb--top',
|
21219 | THUMB_WITH_INDICATOR: 'mdc-slider__thumb--with-indicator',
|
21220 | TICK_MARKS: 'mdc-slider--tick-marks',
|
21221 | TICK_MARKS_CONTAINER: 'mdc-slider__tick-marks',
|
21222 | TICK_MARK_ACTIVE: 'mdc-slider__tick-mark--active',
|
21223 | TICK_MARK_INACTIVE: 'mdc-slider__tick-mark--inactive',
|
21224 | TRACK: 'mdc-slider__track',
|
21225 |
|
21226 | TRACK_ACTIVE: 'mdc-slider__track--active_fill',
|
21227 | VALUE_INDICATOR_TEXT: 'mdc-slider__value-indicator-text'
|
21228 | };
|
21229 |
|
21230 | exports.numbers = {
|
21231 |
|
21232 | STEP_SIZE: 1,
|
21233 |
|
21234 |
|
21235 |
|
21236 |
|
21237 | THUMB_UPDATE_MIN_PX: 5
|
21238 | };
|
21239 |
|
21240 | exports.attributes = {
|
21241 | ARIA_VALUETEXT: 'aria-valuetext',
|
21242 | INPUT_DISABLED: 'disabled',
|
21243 | INPUT_MIN: 'min',
|
21244 | INPUT_MAX: 'max',
|
21245 | INPUT_VALUE: 'value',
|
21246 | INPUT_STEP: 'step'
|
21247 | };
|
21248 |
|
21249 | exports.events = {
|
21250 | CHANGE: 'MDCSlider:change',
|
21251 | INPUT: 'MDCSlider:input'
|
21252 | };
|
21253 |
|
21254 | }),
|
21255 |
|
21256 | "./packages/mdc-slider/foundation.ts":
|
21257 |
|
21258 |
|
21259 |
|
21260 |
|
21261 | (function(module, exports, __webpack_require__) {
|
21262 |
|
21263 | "use strict";
|
21264 |
|
21265 |
|
21266 |
|
21267 |
|
21268 |
|
21269 |
|
21270 |
|
21271 |
|
21272 |
|
21273 |
|
21274 |
|
21275 |
|
21276 |
|
21277 |
|
21278 |
|
21279 |
|
21280 |
|
21281 |
|
21282 |
|
21283 |
|
21284 |
|
21285 |
|
21286 |
|
21287 |
|
21288 | var __extends = this && this.__extends || function () {
|
21289 | var _extendStatics = function extendStatics(d, b) {
|
21290 | _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
|
21291 | d.__proto__ = b;
|
21292 | } || function (d, b) {
|
21293 | for (var p in b) {
|
21294 | if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
21295 | }
|
21296 | };
|
21297 | return _extendStatics(d, b);
|
21298 | };
|
21299 | return function (d, b) {
|
21300 | if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
21301 | _extendStatics(d, b);
|
21302 | function __() {
|
21303 | this.constructor = d;
|
21304 | }
|
21305 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
21306 | };
|
21307 | }();
|
21308 | var __assign = this && this.__assign || function () {
|
21309 | __assign = Object.assign || function (t) {
|
21310 | for (var s, i = 1, n = arguments.length; i < n; i++) {
|
21311 | s = arguments[i];
|
21312 | for (var p in s) {
|
21313 | if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
21314 | }
|
21315 | }
|
21316 | return t;
|
21317 | };
|
21318 | return __assign.apply(this, arguments);
|
21319 | };
|
21320 | Object.defineProperty(exports, "__esModule", { value: true });
|
21321 | exports.MDCSliderFoundation = void 0;
|
21322 | var animationframe_1 = __webpack_require__( "./packages/mdc-animation/animationframe.ts");
|
21323 | var util_1 = __webpack_require__( "./packages/mdc-animation/util.ts");
|
21324 | var foundation_1 = __webpack_require__( "./packages/mdc-base/foundation.ts");
|
21325 | var constants_1 = __webpack_require__( "./packages/mdc-slider/constants.ts");
|
21326 | var types_1 = __webpack_require__( "./packages/mdc-slider/types.ts");
|
21327 | var AnimationKeys;
|
21328 | (function (AnimationKeys) {
|
21329 | AnimationKeys["SLIDER_UPDATE"] = "slider_update";
|
21330 | })(AnimationKeys || (AnimationKeys = {}));
|
21331 |
|
21332 | var HAS_WINDOW = typeof window !== 'undefined';
|
21333 |
|
21334 |
|
21335 |
|
21336 |
|
21337 |
|
21338 |
|
21339 | var MDCSliderFoundation = function (_super) {
|
21340 | __extends(MDCSliderFoundation, _super);
|
21341 | function MDCSliderFoundation(adapter) {
|
21342 | var _this = _super.call(this, __assign(__assign({}, MDCSliderFoundation.defaultAdapter), adapter)) || this;
|
21343 |
|
21344 |
|
21345 | _this.initialStylesRemoved = false;
|
21346 | _this.isDisabled = false;
|
21347 | _this.isDiscrete = false;
|
21348 | _this.step = constants_1.numbers.STEP_SIZE;
|
21349 | _this.hasTickMarks = false;
|
21350 |
|
21351 | _this.isRange = false;
|
21352 |
|
21353 |
|
21354 | _this.thumb = null;
|
21355 |
|
21356 |
|
21357 |
|
21358 | _this.downEventClientX = null;
|
21359 |
|
21360 | _this.startThumbKnobWidth = 0;
|
21361 |
|
21362 | _this.endThumbKnobWidth = 0;
|
21363 | _this.animFrame = new animationframe_1.AnimationFrame();
|
21364 | return _this;
|
21365 | }
|
21366 | Object.defineProperty(MDCSliderFoundation, "defaultAdapter", {
|
21367 | get: function get() {
|
21368 |
|
21369 |
|
21370 | return {
|
21371 | hasClass: function hasClass() {
|
21372 | return false;
|
21373 | },
|
21374 | addClass: function addClass() {
|
21375 | return undefined;
|
21376 | },
|
21377 | removeClass: function removeClass() {
|
21378 | return undefined;
|
21379 | },
|
21380 | addThumbClass: function addThumbClass() {
|
21381 | return undefined;
|
21382 | },
|
21383 | removeThumbClass: function removeThumbClass() {
|
21384 | return undefined;
|
21385 | },
|
21386 | getAttribute: function getAttribute() {
|
21387 | return null;
|
21388 | },
|
21389 | getInputValue: function getInputValue() {
|
21390 | return '';
|
21391 | },
|
21392 | setInputValue: function setInputValue() {
|
21393 | return undefined;
|
21394 | },
|
21395 | getInputAttribute: function getInputAttribute() {
|
21396 | return null;
|
21397 | },
|
21398 | setInputAttribute: function setInputAttribute() {
|
21399 | return null;
|
21400 | },
|
21401 | removeInputAttribute: function removeInputAttribute() {
|
21402 | return null;
|
21403 | },
|
21404 | focusInput: function focusInput() {
|
21405 | return undefined;
|
21406 | },
|
21407 | isInputFocused: function isInputFocused() {
|
21408 | return false;
|
21409 | },
|
21410 | getThumbKnobWidth: function getThumbKnobWidth() {
|
21411 | return 0;
|
21412 | },
|
21413 | getThumbBoundingClientRect: function getThumbBoundingClientRect() {
|
21414 | return { top: 0, right: 0, bottom: 0, left: 0, width: 0, height: 0 };
|
21415 | },
|
21416 | getBoundingClientRect: function getBoundingClientRect() {
|
21417 | return { top: 0, right: 0, bottom: 0, left: 0, width: 0, height: 0 };
|
21418 | },
|
21419 | isRTL: function isRTL() {
|
21420 | return false;
|
21421 | },
|
21422 | setThumbStyleProperty: function setThumbStyleProperty() {
|
21423 | return undefined;
|
21424 | },
|
21425 | removeThumbStyleProperty: function removeThumbStyleProperty() {
|
21426 | return undefined;
|
21427 | },
|
21428 | setTrackActiveStyleProperty: function setTrackActiveStyleProperty() {
|
21429 | return undefined;
|
21430 | },
|
21431 | removeTrackActiveStyleProperty: function removeTrackActiveStyleProperty() {
|
21432 | return undefined;
|
21433 | },
|
21434 | setValueIndicatorText: function setValueIndicatorText() {
|
21435 | return undefined;
|
21436 | },
|
21437 | getValueToAriaValueTextFn: function getValueToAriaValueTextFn() {
|
21438 | return null;
|
21439 | },
|
21440 | updateTickMarks: function updateTickMarks() {
|
21441 | return undefined;
|
21442 | },
|
21443 | setPointerCapture: function setPointerCapture() {
|
21444 | return undefined;
|
21445 | },
|
21446 | emitChangeEvent: function emitChangeEvent() {
|
21447 | return undefined;
|
21448 | },
|
21449 | emitInputEvent: function emitInputEvent() {
|
21450 | return undefined;
|
21451 | },
|
21452 | emitDragStartEvent: function emitDragStartEvent() {
|
21453 | return undefined;
|
21454 | },
|
21455 | emitDragEndEvent: function emitDragEndEvent() {
|
21456 | return undefined;
|
21457 | },
|
21458 | registerEventHandler: function registerEventHandler() {
|
21459 | return undefined;
|
21460 | },
|
21461 | deregisterEventHandler: function deregisterEventHandler() {
|
21462 | return undefined;
|
21463 | },
|
21464 | registerThumbEventHandler: function registerThumbEventHandler() {
|
21465 | return undefined;
|
21466 | },
|
21467 | deregisterThumbEventHandler: function deregisterThumbEventHandler() {
|
21468 | return undefined;
|
21469 | },
|
21470 | registerInputEventHandler: function registerInputEventHandler() {
|
21471 | return undefined;
|
21472 | },
|
21473 | deregisterInputEventHandler: function deregisterInputEventHandler() {
|
21474 | return undefined;
|
21475 | },
|
21476 | registerBodyEventHandler: function registerBodyEventHandler() {
|
21477 | return undefined;
|
21478 | },
|
21479 | deregisterBodyEventHandler: function deregisterBodyEventHandler() {
|
21480 | return undefined;
|
21481 | },
|
21482 | registerWindowEventHandler: function registerWindowEventHandler() {
|
21483 | return undefined;
|
21484 | },
|
21485 | deregisterWindowEventHandler: function deregisterWindowEventHandler() {
|
21486 | return undefined;
|
21487 | }
|
21488 | };
|
21489 |
|
21490 | },
|
21491 | enumerable: false,
|
21492 | configurable: true
|
21493 | });
|
21494 | MDCSliderFoundation.prototype.init = function () {
|
21495 | var _this = this;
|
21496 | this.isDisabled = this.adapter.hasClass(constants_1.cssClasses.DISABLED);
|
21497 | this.isDiscrete = this.adapter.hasClass(constants_1.cssClasses.DISCRETE);
|
21498 | this.hasTickMarks = this.adapter.hasClass(constants_1.cssClasses.TICK_MARKS);
|
21499 | this.isRange = this.adapter.hasClass(constants_1.cssClasses.RANGE);
|
21500 | var min = this.convertAttributeValueToNumber(this.adapter.getInputAttribute(constants_1.attributes.INPUT_MIN, this.isRange ? types_1.Thumb.START : types_1.Thumb.END), constants_1.attributes.INPUT_MIN);
|
21501 | var max = this.convertAttributeValueToNumber(this.adapter.getInputAttribute(constants_1.attributes.INPUT_MAX, types_1.Thumb.END), constants_1.attributes.INPUT_MAX);
|
21502 | var value = this.convertAttributeValueToNumber(this.adapter.getInputAttribute(constants_1.attributes.INPUT_VALUE, types_1.Thumb.END), constants_1.attributes.INPUT_VALUE);
|
21503 | var valueStart = this.isRange ? this.convertAttributeValueToNumber(this.adapter.getInputAttribute(constants_1.attributes.INPUT_VALUE, types_1.Thumb.START), constants_1.attributes.INPUT_VALUE) : min;
|
21504 | var stepAttr = this.adapter.getInputAttribute(constants_1.attributes.INPUT_STEP, types_1.Thumb.END);
|
21505 | var step = stepAttr ? this.convertAttributeValueToNumber(stepAttr, constants_1.attributes.INPUT_STEP) : this.step;
|
21506 | this.validateProperties({ min: min, max: max, value: value, valueStart: valueStart, step: step });
|
21507 | this.min = min;
|
21508 | this.max = max;
|
21509 | this.value = value;
|
21510 | this.valueStart = valueStart;
|
21511 | this.step = step;
|
21512 | this.numDecimalPlaces = getNumDecimalPlaces(this.step);
|
21513 | this.valueBeforeDownEvent = value;
|
21514 | this.valueStartBeforeDownEvent = valueStart;
|
21515 | this.mousedownOrTouchstartListener = this.handleMousedownOrTouchstart.bind(this);
|
21516 | this.moveListener = this.handleMove.bind(this);
|
21517 | this.pointerdownListener = this.handlePointerdown.bind(this);
|
21518 | this.pointerupListener = this.handlePointerup.bind(this);
|
21519 | this.thumbMouseenterListener = this.handleThumbMouseenter.bind(this);
|
21520 | this.thumbMouseleaveListener = this.handleThumbMouseleave.bind(this);
|
21521 | this.inputStartChangeListener = function () {
|
21522 | _this.handleInputChange(types_1.Thumb.START);
|
21523 | };
|
21524 | this.inputEndChangeListener = function () {
|
21525 | _this.handleInputChange(types_1.Thumb.END);
|
21526 | };
|
21527 | this.inputStartFocusListener = function () {
|
21528 | _this.handleInputFocus(types_1.Thumb.START);
|
21529 | };
|
21530 | this.inputEndFocusListener = function () {
|
21531 | _this.handleInputFocus(types_1.Thumb.END);
|
21532 | };
|
21533 | this.inputStartBlurListener = function () {
|
21534 | _this.handleInputBlur(types_1.Thumb.START);
|
21535 | };
|
21536 | this.inputEndBlurListener = function () {
|
21537 | _this.handleInputBlur(types_1.Thumb.END);
|
21538 | };
|
21539 | this.resizeListener = this.handleResize.bind(this);
|
21540 | this.registerEventHandlers();
|
21541 | };
|
21542 | MDCSliderFoundation.prototype.destroy = function () {
|
21543 | this.deregisterEventHandlers();
|
21544 | };
|
21545 | MDCSliderFoundation.prototype.setMin = function (value) {
|
21546 | this.min = value;
|
21547 | if (!this.isRange) {
|
21548 | this.valueStart = value;
|
21549 | }
|
21550 | this.updateUI();
|
21551 | };
|
21552 | MDCSliderFoundation.prototype.setMax = function (value) {
|
21553 | this.max = value;
|
21554 | this.updateUI();
|
21555 | };
|
21556 | MDCSliderFoundation.prototype.getMin = function () {
|
21557 | return this.min;
|
21558 | };
|
21559 | MDCSliderFoundation.prototype.getMax = function () {
|
21560 | return this.max;
|
21561 | };
|
21562 | |
21563 |
|
21564 |
|
21565 |
|
21566 | MDCSliderFoundation.prototype.getValue = function () {
|
21567 | return this.value;
|
21568 | };
|
21569 | |
21570 |
|
21571 |
|
21572 |
|
21573 | MDCSliderFoundation.prototype.setValue = function (value) {
|
21574 | if (this.isRange && value < this.valueStart) {
|
21575 | throw new Error("end thumb value (" + value + ") must be >= start thumb " + ("value (" + this.valueStart + ")"));
|
21576 | }
|
21577 | this.updateValue(value, types_1.Thumb.END);
|
21578 | };
|
21579 | |
21580 |
|
21581 |
|
21582 |
|
21583 | MDCSliderFoundation.prototype.getValueStart = function () {
|
21584 | if (!this.isRange) {
|
21585 | throw new Error('`valueStart` is only applicable for range sliders.');
|
21586 | }
|
21587 | return this.valueStart;
|
21588 | };
|
21589 | |
21590 |
|
21591 |
|
21592 | MDCSliderFoundation.prototype.setValueStart = function (valueStart) {
|
21593 | if (!this.isRange) {
|
21594 | throw new Error('`valueStart` is only applicable for range sliders.');
|
21595 | }
|
21596 | if (this.isRange && valueStart > this.value) {
|
21597 | throw new Error("start thumb value (" + valueStart + ") must be <= end thumb " + ("value (" + this.value + ")"));
|
21598 | }
|
21599 | this.updateValue(valueStart, types_1.Thumb.START);
|
21600 | };
|
21601 | MDCSliderFoundation.prototype.setStep = function (value) {
|
21602 | this.step = value;
|
21603 | this.numDecimalPlaces = getNumDecimalPlaces(value);
|
21604 | this.updateUI();
|
21605 | };
|
21606 | MDCSliderFoundation.prototype.setIsDiscrete = function (value) {
|
21607 | this.isDiscrete = value;
|
21608 | this.updateValueIndicatorUI();
|
21609 | this.updateTickMarksUI();
|
21610 | };
|
21611 | MDCSliderFoundation.prototype.getStep = function () {
|
21612 | return this.step;
|
21613 | };
|
21614 | MDCSliderFoundation.prototype.setHasTickMarks = function (value) {
|
21615 | this.hasTickMarks = value;
|
21616 | this.updateTickMarksUI();
|
21617 | };
|
21618 | MDCSliderFoundation.prototype.getDisabled = function () {
|
21619 | return this.isDisabled;
|
21620 | };
|
21621 | |
21622 |
|
21623 |
|
21624 | MDCSliderFoundation.prototype.setDisabled = function (disabled) {
|
21625 | this.isDisabled = disabled;
|
21626 | if (disabled) {
|
21627 | this.adapter.addClass(constants_1.cssClasses.DISABLED);
|
21628 | if (this.isRange) {
|
21629 | this.adapter.setInputAttribute(constants_1.attributes.INPUT_DISABLED, '', types_1.Thumb.START);
|
21630 | }
|
21631 | this.adapter.setInputAttribute(constants_1.attributes.INPUT_DISABLED, '', types_1.Thumb.END);
|
21632 | } else {
|
21633 | this.adapter.removeClass(constants_1.cssClasses.DISABLED);
|
21634 | if (this.isRange) {
|
21635 | this.adapter.removeInputAttribute(constants_1.attributes.INPUT_DISABLED, types_1.Thumb.START);
|
21636 | }
|
21637 | this.adapter.removeInputAttribute(constants_1.attributes.INPUT_DISABLED, types_1.Thumb.END);
|
21638 | }
|
21639 | };
|
21640 |
|
21641 | MDCSliderFoundation.prototype.getIsRange = function () {
|
21642 | return this.isRange;
|
21643 | };
|
21644 | |
21645 |
|
21646 |
|
21647 |
|
21648 | MDCSliderFoundation.prototype.layout = function (_a) {
|
21649 | var _b = _a === void 0 ? {} : _a,
|
21650 | skipUpdateUI = _b.skipUpdateUI;
|
21651 | this.rect = this.adapter.getBoundingClientRect();
|
21652 | if (this.isRange) {
|
21653 | this.startThumbKnobWidth = this.adapter.getThumbKnobWidth(types_1.Thumb.START);
|
21654 | this.endThumbKnobWidth = this.adapter.getThumbKnobWidth(types_1.Thumb.END);
|
21655 | }
|
21656 | if (!skipUpdateUI) {
|
21657 | this.updateUI();
|
21658 | }
|
21659 | };
|
21660 |
|
21661 | MDCSliderFoundation.prototype.handleResize = function () {
|
21662 | this.layout();
|
21663 | };
|
21664 | |
21665 |
|
21666 |
|
21667 | MDCSliderFoundation.prototype.handleDown = function (event) {
|
21668 | if (this.isDisabled) return;
|
21669 | this.valueStartBeforeDownEvent = this.valueStart;
|
21670 | this.valueBeforeDownEvent = this.value;
|
21671 | var clientX = event.clientX != null ? event.clientX : event.targetTouches[0].clientX;
|
21672 | this.downEventClientX = clientX;
|
21673 | var value = this.mapClientXOnSliderScale(clientX);
|
21674 | this.thumb = this.getThumbFromDownEvent(clientX, value);
|
21675 | if (this.thumb === null) return;
|
21676 | this.handleDragStart(event, value, this.thumb);
|
21677 | this.updateValue(value, this.thumb, { emitInputEvent: true });
|
21678 | };
|
21679 | |
21680 |
|
21681 |
|
21682 | MDCSliderFoundation.prototype.handleMove = function (event) {
|
21683 | if (this.isDisabled) return;
|
21684 |
|
21685 | event.preventDefault();
|
21686 | var clientX = event.clientX != null ? event.clientX : event.targetTouches[0].clientX;
|
21687 | var dragAlreadyStarted = this.thumb != null;
|
21688 | this.thumb = this.getThumbFromMoveEvent(clientX);
|
21689 | if (this.thumb === null) return;
|
21690 | var value = this.mapClientXOnSliderScale(clientX);
|
21691 | if (!dragAlreadyStarted) {
|
21692 | this.handleDragStart(event, value, this.thumb);
|
21693 | this.adapter.emitDragStartEvent(value, this.thumb);
|
21694 | }
|
21695 | this.updateValue(value, this.thumb, { emitInputEvent: true });
|
21696 | };
|
21697 | |
21698 |
|
21699 |
|
21700 | MDCSliderFoundation.prototype.handleUp = function () {
|
21701 | if (this.isDisabled || this.thumb === null) return;
|
21702 | var oldValue = this.thumb === types_1.Thumb.START ? this.valueStartBeforeDownEvent : this.valueBeforeDownEvent;
|
21703 | var newValue = this.thumb === types_1.Thumb.START ? this.valueStart : this.value;
|
21704 | if (oldValue !== newValue) {
|
21705 | this.adapter.emitChangeEvent(newValue, this.thumb);
|
21706 | }
|
21707 | this.adapter.emitDragEndEvent(newValue, this.thumb);
|
21708 | this.thumb = null;
|
21709 | };
|
21710 | |
21711 |
|
21712 |
|
21713 | MDCSliderFoundation.prototype.handleThumbMouseenter = function () {
|
21714 | if (!this.isDiscrete || !this.isRange) return;
|
21715 | this.adapter.addThumbClass(constants_1.cssClasses.THUMB_WITH_INDICATOR, types_1.Thumb.START);
|
21716 | this.adapter.addThumbClass(constants_1.cssClasses.THUMB_WITH_INDICATOR, types_1.Thumb.END);
|
21717 | };
|
21718 | |
21719 |
|
21720 |
|
21721 | MDCSliderFoundation.prototype.handleThumbMouseleave = function () {
|
21722 | if (!this.isDiscrete || !this.isRange) return;
|
21723 | if (this.adapter.isInputFocused(types_1.Thumb.START) || this.adapter.isInputFocused(types_1.Thumb.END)) {
|
21724 |
|
21725 | return;
|
21726 | }
|
21727 | this.adapter.removeThumbClass(constants_1.cssClasses.THUMB_WITH_INDICATOR, types_1.Thumb.START);
|
21728 | this.adapter.removeThumbClass(constants_1.cssClasses.THUMB_WITH_INDICATOR, types_1.Thumb.END);
|
21729 | };
|
21730 | MDCSliderFoundation.prototype.handleMousedownOrTouchstart = function (event) {
|
21731 | var _this = this;
|
21732 | var moveEventType = event.type === 'mousedown' ? 'mousemove' : 'touchmove';
|
21733 |
|
21734 |
|
21735 |
|
21736 | this.adapter.registerBodyEventHandler(moveEventType, this.moveListener);
|
21737 | var upHandler = function upHandler() {
|
21738 | _this.handleUp();
|
21739 |
|
21740 |
|
21741 | _this.adapter.deregisterBodyEventHandler(moveEventType, _this.moveListener);
|
21742 |
|
21743 | _this.adapter.deregisterEventHandler('mouseup', upHandler);
|
21744 | _this.adapter.deregisterEventHandler('touchend', upHandler);
|
21745 | };
|
21746 | this.adapter.registerBodyEventHandler('mouseup', upHandler);
|
21747 | this.adapter.registerBodyEventHandler('touchend', upHandler);
|
21748 | this.handleDown(event);
|
21749 | };
|
21750 | MDCSliderFoundation.prototype.handlePointerdown = function (event) {
|
21751 | this.adapter.setPointerCapture(event.pointerId);
|
21752 | this.adapter.registerEventHandler('pointermove', this.moveListener);
|
21753 | this.handleDown(event);
|
21754 | };
|
21755 | |
21756 |
|
21757 |
|
21758 |
|
21759 | MDCSliderFoundation.prototype.handleInputChange = function (thumb) {
|
21760 | var value = Number(this.adapter.getInputValue(thumb));
|
21761 | if (thumb === types_1.Thumb.START) {
|
21762 | this.setValueStart(value);
|
21763 | } else {
|
21764 | this.setValue(value);
|
21765 | }
|
21766 | this.adapter.emitChangeEvent(thumb === types_1.Thumb.START ? this.valueStart : this.value, thumb);
|
21767 | this.adapter.emitInputEvent(thumb === types_1.Thumb.START ? this.valueStart : this.value, thumb);
|
21768 | };
|
21769 |
|
21770 | MDCSliderFoundation.prototype.handleInputFocus = function (thumb) {
|
21771 | this.adapter.addThumbClass(constants_1.cssClasses.THUMB_FOCUSED, thumb);
|
21772 | if (!this.isDiscrete) return;
|
21773 | this.adapter.addThumbClass(constants_1.cssClasses.THUMB_WITH_INDICATOR, thumb);
|
21774 | if (this.isRange) {
|
21775 | var otherThumb = thumb === types_1.Thumb.START ? types_1.Thumb.END : types_1.Thumb.START;
|
21776 | this.adapter.addThumbClass(constants_1.cssClasses.THUMB_WITH_INDICATOR, otherThumb);
|
21777 | }
|
21778 | };
|
21779 |
|
21780 | MDCSliderFoundation.prototype.handleInputBlur = function (thumb) {
|
21781 | this.adapter.removeThumbClass(constants_1.cssClasses.THUMB_FOCUSED, thumb);
|
21782 | if (!this.isDiscrete) return;
|
21783 | this.adapter.removeThumbClass(constants_1.cssClasses.THUMB_WITH_INDICATOR, thumb);
|
21784 | if (this.isRange) {
|
21785 | var otherThumb = thumb === types_1.Thumb.START ? types_1.Thumb.END : types_1.Thumb.START;
|
21786 | this.adapter.removeThumbClass(constants_1.cssClasses.THUMB_WITH_INDICATOR, otherThumb);
|
21787 | }
|
21788 | };
|
21789 | |
21790 |
|
21791 |
|
21792 | MDCSliderFoundation.prototype.handleDragStart = function (event, value, thumb) {
|
21793 | this.adapter.emitDragStartEvent(value, thumb);
|
21794 | this.adapter.focusInput(thumb);
|
21795 |
|
21796 | event.preventDefault();
|
21797 | };
|
21798 | |
21799 |
|
21800 |
|
21801 | MDCSliderFoundation.prototype.getThumbFromDownEvent = function (clientX, value) {
|
21802 |
|
21803 |
|
21804 | if (!this.isRange) return types_1.Thumb.END;
|
21805 |
|
21806 | var thumbStartRect = this.adapter.getThumbBoundingClientRect(types_1.Thumb.START);
|
21807 | var thumbEndRect = this.adapter.getThumbBoundingClientRect(types_1.Thumb.END);
|
21808 | var inThumbStartBounds = clientX >= thumbStartRect.left && clientX <= thumbStartRect.right;
|
21809 | var inThumbEndBounds = clientX >= thumbEndRect.left && clientX <= thumbEndRect.right;
|
21810 | if (inThumbStartBounds && inThumbEndBounds) {
|
21811 |
|
21812 | return null;
|
21813 | }
|
21814 |
|
21815 |
|
21816 | if (inThumbStartBounds) {
|
21817 | return types_1.Thumb.START;
|
21818 | }
|
21819 | if (inThumbEndBounds) {
|
21820 | return types_1.Thumb.END;
|
21821 | }
|
21822 |
|
21823 | if (value < this.valueStart) {
|
21824 | return types_1.Thumb.START;
|
21825 | }
|
21826 | if (value > this.value) {
|
21827 | return types_1.Thumb.END;
|
21828 | }
|
21829 |
|
21830 | return value - this.valueStart <= this.value - value ? types_1.Thumb.START : types_1.Thumb.END;
|
21831 | };
|
21832 | |
21833 |
|
21834 |
|
21835 |
|
21836 |
|
21837 | MDCSliderFoundation.prototype.getThumbFromMoveEvent = function (clientX) {
|
21838 |
|
21839 | if (this.thumb !== null) return this.thumb;
|
21840 | if (this.downEventClientX === null) {
|
21841 | throw new Error('`downEventClientX` is null after move event.');
|
21842 | }
|
21843 | var moveDistanceUnderThreshold = Math.abs(this.downEventClientX - clientX) < constants_1.numbers.THUMB_UPDATE_MIN_PX;
|
21844 | if (moveDistanceUnderThreshold) return this.thumb;
|
21845 | var draggedThumbToLeft = clientX < this.downEventClientX;
|
21846 | if (draggedThumbToLeft) {
|
21847 | return this.adapter.isRTL() ? types_1.Thumb.END : types_1.Thumb.START;
|
21848 | } else {
|
21849 | return this.adapter.isRTL() ? types_1.Thumb.START : types_1.Thumb.END;
|
21850 | }
|
21851 | };
|
21852 | |
21853 |
|
21854 |
|
21855 |
|
21856 |
|
21857 | MDCSliderFoundation.prototype.updateUI = function (thumb) {
|
21858 | this.updateThumbAndInputAttributes(thumb);
|
21859 | this.updateThumbAndTrackUI(thumb);
|
21860 | this.updateValueIndicatorUI(thumb);
|
21861 | this.updateTickMarksUI();
|
21862 | };
|
21863 | |
21864 |
|
21865 |
|
21866 |
|
21867 | MDCSliderFoundation.prototype.updateThumbAndInputAttributes = function (thumb) {
|
21868 | if (!thumb) return;
|
21869 | var value = this.isRange && thumb === types_1.Thumb.START ? this.valueStart : this.value;
|
21870 | var valueStr = String(value);
|
21871 | this.adapter.setInputAttribute(constants_1.attributes.INPUT_VALUE, valueStr, thumb);
|
21872 | if (this.isRange && thumb === types_1.Thumb.START) {
|
21873 | this.adapter.setInputAttribute(constants_1.attributes.INPUT_MIN, valueStr, types_1.Thumb.END);
|
21874 | } else if (this.isRange && thumb === types_1.Thumb.END) {
|
21875 | this.adapter.setInputAttribute(constants_1.attributes.INPUT_MAX, valueStr, types_1.Thumb.START);
|
21876 | }
|
21877 |
|
21878 | if (this.adapter.getInputValue(thumb) !== valueStr) {
|
21879 | this.adapter.setInputValue(valueStr, thumb);
|
21880 | }
|
21881 | var valueToAriaValueTextFn = this.adapter.getValueToAriaValueTextFn();
|
21882 | if (valueToAriaValueTextFn) {
|
21883 | this.adapter.setInputAttribute(constants_1.attributes.ARIA_VALUETEXT, valueToAriaValueTextFn(value), thumb);
|
21884 | }
|
21885 | };
|
21886 | |
21887 |
|
21888 |
|
21889 |
|
21890 |
|
21891 | MDCSliderFoundation.prototype.updateValueIndicatorUI = function (thumb) {
|
21892 | if (!this.isDiscrete) return;
|
21893 | var value = this.isRange && thumb === types_1.Thumb.START ? this.valueStart : this.value;
|
21894 | this.adapter.setValueIndicatorText(value, thumb === types_1.Thumb.START ? types_1.Thumb.START : types_1.Thumb.END);
|
21895 | if (!thumb && this.isRange) {
|
21896 | this.adapter.setValueIndicatorText(this.valueStart, types_1.Thumb.START);
|
21897 | }
|
21898 | };
|
21899 | |
21900 |
|
21901 |
|
21902 | MDCSliderFoundation.prototype.updateTickMarksUI = function () {
|
21903 | if (!this.isDiscrete || !this.hasTickMarks) return;
|
21904 | var numTickMarksInactiveStart = (this.valueStart - this.min) / this.step;
|
21905 | var numTickMarksActive = (this.value - this.valueStart) / this.step + 1;
|
21906 | var numTickMarksInactiveEnd = (this.max - this.value) / this.step;
|
21907 | var tickMarksInactiveStart = Array.from({ length: numTickMarksInactiveStart }).fill(types_1.TickMark.INACTIVE);
|
21908 | var tickMarksActive = Array.from({ length: numTickMarksActive }).fill(types_1.TickMark.ACTIVE);
|
21909 | var tickMarksInactiveEnd = Array.from({ length: numTickMarksInactiveEnd }).fill(types_1.TickMark.INACTIVE);
|
21910 | this.adapter.updateTickMarks(tickMarksInactiveStart.concat(tickMarksActive).concat(tickMarksInactiveEnd));
|
21911 | };
|
21912 |
|
21913 | MDCSliderFoundation.prototype.mapClientXOnSliderScale = function (clientX) {
|
21914 | var xPos = clientX - this.rect.left;
|
21915 | var pctComplete = xPos / this.rect.width;
|
21916 | if (this.adapter.isRTL()) {
|
21917 | pctComplete = 1 - pctComplete;
|
21918 | }
|
21919 |
|
21920 |
|
21921 | var value = this.min + pctComplete * (this.max - this.min);
|
21922 | if (value === this.max || value === this.min) {
|
21923 | return value;
|
21924 | }
|
21925 | return Number(this.quantize(value).toFixed(this.numDecimalPlaces));
|
21926 | };
|
21927 |
|
21928 | MDCSliderFoundation.prototype.quantize = function (value) {
|
21929 | var numSteps = Math.round((value - this.min) / this.step);
|
21930 | return this.min + numSteps * this.step;
|
21931 | };
|
21932 | |
21933 |
|
21934 |
|
21935 | MDCSliderFoundation.prototype.updateValue = function (value, thumb, _a) {
|
21936 | var _b = _a === void 0 ? {} : _a,
|
21937 | emitInputEvent = _b.emitInputEvent;
|
21938 | value = this.clampValue(value, thumb);
|
21939 | if (this.isRange && thumb === types_1.Thumb.START) {
|
21940 |
|
21941 | if (this.valueStart === value) return;
|
21942 | this.valueStart = value;
|
21943 | } else {
|
21944 |
|
21945 | if (this.value === value) return;
|
21946 | this.value = value;
|
21947 | }
|
21948 | this.updateUI(thumb);
|
21949 | if (emitInputEvent) {
|
21950 | this.adapter.emitInputEvent(thumb === types_1.Thumb.START ? this.valueStart : this.value, thumb);
|
21951 | }
|
21952 | };
|
21953 | |
21954 |
|
21955 |
|
21956 |
|
21957 |
|
21958 |
|
21959 | MDCSliderFoundation.prototype.clampValue = function (value, thumb) {
|
21960 |
|
21961 | value = Math.min(Math.max(value, this.min), this.max);
|
21962 | var thumbStartMovedPastThumbEnd = this.isRange && thumb === types_1.Thumb.START && value > this.value;
|
21963 | if (thumbStartMovedPastThumbEnd) {
|
21964 | return this.value;
|
21965 | }
|
21966 | var thumbEndMovedPastThumbStart = this.isRange && thumb === types_1.Thumb.END && value < this.valueStart;
|
21967 | if (thumbEndMovedPastThumbStart) {
|
21968 | return this.valueStart;
|
21969 | }
|
21970 | return value;
|
21971 | };
|
21972 | |
21973 |
|
21974 |
|
21975 |
|
21976 | MDCSliderFoundation.prototype.updateThumbAndTrackUI = function (thumb) {
|
21977 | var _this = this;
|
21978 | var _a = this,
|
21979 | max = _a.max,
|
21980 | min = _a.min;
|
21981 | var pctComplete = (this.value - this.valueStart) / (max - min);
|
21982 | var rangePx = pctComplete * this.rect.width;
|
21983 | var isRtl = this.adapter.isRTL();
|
21984 | var transformProp = HAS_WINDOW ? util_1.getCorrectPropertyName(window, 'transform') : 'transform';
|
21985 | if (this.isRange) {
|
21986 | var thumbLeftPos_1 = this.adapter.isRTL() ? (max - this.value) / (max - min) * this.rect.width : (this.valueStart - min) / (max - min) * this.rect.width;
|
21987 | var thumbRightPos_1 = thumbLeftPos_1 + rangePx;
|
21988 | this.animFrame.request(AnimationKeys.SLIDER_UPDATE, function () {
|
21989 |
|
21990 |
|
21991 | var trackAnimatesFromRight = !isRtl && thumb === types_1.Thumb.START || isRtl && thumb !== types_1.Thumb.START;
|
21992 | if (trackAnimatesFromRight) {
|
21993 | _this.adapter.setTrackActiveStyleProperty('transform-origin', 'right');
|
21994 | _this.adapter.setTrackActiveStyleProperty('left', 'unset');
|
21995 | _this.adapter.setTrackActiveStyleProperty('right', _this.rect.width - thumbRightPos_1 + "px");
|
21996 | } else {
|
21997 | _this.adapter.setTrackActiveStyleProperty('transform-origin', 'left');
|
21998 | _this.adapter.setTrackActiveStyleProperty('right', 'unset');
|
21999 | _this.adapter.setTrackActiveStyleProperty('left', thumbLeftPos_1 + "px");
|
22000 | }
|
22001 | _this.adapter.setTrackActiveStyleProperty(transformProp, "scaleX(" + pctComplete + ")");
|
22002 |
|
22003 | var thumbStartPos = isRtl ? thumbRightPos_1 : thumbLeftPos_1;
|
22004 | var thumbEndPos = _this.adapter.isRTL() ? thumbLeftPos_1 : thumbRightPos_1;
|
22005 | if (thumb === types_1.Thumb.START || !thumb || !_this.initialStylesRemoved) {
|
22006 | _this.adapter.setThumbStyleProperty(transformProp, "translateX(" + thumbStartPos + "px)", types_1.Thumb.START);
|
22007 | }
|
22008 | if (thumb === types_1.Thumb.END || !thumb || !_this.initialStylesRemoved) {
|
22009 | _this.adapter.setThumbStyleProperty(transformProp, "translateX(" + thumbEndPos + "px)", types_1.Thumb.END);
|
22010 | }
|
22011 | _this.removeInitialStyles(isRtl);
|
22012 | _this.updateOverlappingThumbsUI(thumbStartPos, thumbEndPos, thumb);
|
22013 | });
|
22014 | } else {
|
22015 | this.animFrame.request(AnimationKeys.SLIDER_UPDATE, function () {
|
22016 | var thumbStartPos = isRtl ? _this.rect.width - rangePx : rangePx;
|
22017 | _this.adapter.setThumbStyleProperty(transformProp, "translateX(" + thumbStartPos + "px)", types_1.Thumb.END);
|
22018 | _this.adapter.setTrackActiveStyleProperty(transformProp, "scaleX(" + pctComplete + ")");
|
22019 | _this.removeInitialStyles(isRtl);
|
22020 | });
|
22021 | }
|
22022 | };
|
22023 | |
22024 |
|
22025 |
|
22026 |
|
22027 |
|
22028 |
|
22029 |
|
22030 |
|
22031 |
|
22032 | MDCSliderFoundation.prototype.removeInitialStyles = function (isRtl) {
|
22033 | if (this.initialStylesRemoved) return;
|
22034 |
|
22035 | var position = isRtl ? 'right' : 'left';
|
22036 | this.adapter.removeThumbStyleProperty(position, types_1.Thumb.END);
|
22037 | if (this.isRange) {
|
22038 | this.adapter.removeThumbStyleProperty(position, types_1.Thumb.START);
|
22039 | }
|
22040 | this.initialStylesRemoved = true;
|
22041 | this.resetTrackAndThumbAnimation();
|
22042 | };
|
22043 | |
22044 |
|
22045 |
|
22046 |
|
22047 | MDCSliderFoundation.prototype.resetTrackAndThumbAnimation = function () {
|
22048 | var _this = this;
|
22049 | if (!this.isDiscrete) return;
|
22050 |
|
22051 |
|
22052 |
|
22053 | var transitionProp = HAS_WINDOW ? util_1.getCorrectPropertyName(window, 'transition') : 'transition';
|
22054 | var transitionDefault = 'all 0s ease 0s';
|
22055 | this.adapter.setThumbStyleProperty(transitionProp, transitionDefault, types_1.Thumb.END);
|
22056 | if (this.isRange) {
|
22057 | this.adapter.setThumbStyleProperty(transitionProp, transitionDefault, types_1.Thumb.START);
|
22058 | }
|
22059 | this.adapter.setTrackActiveStyleProperty(transitionProp, transitionDefault);
|
22060 |
|
22061 |
|
22062 | requestAnimationFrame(function () {
|
22063 | _this.adapter.removeThumbStyleProperty(transitionProp, types_1.Thumb.END);
|
22064 | _this.adapter.removeTrackActiveStyleProperty(transitionProp);
|
22065 | if (_this.isRange) {
|
22066 | _this.adapter.removeThumbStyleProperty(transitionProp, types_1.Thumb.START);
|
22067 | }
|
22068 | });
|
22069 | };
|
22070 | |
22071 |
|
22072 |
|
22073 |
|
22074 |
|
22075 | MDCSliderFoundation.prototype.updateOverlappingThumbsUI = function (thumbStartPos, thumbEndPos, thumb) {
|
22076 | var thumbsOverlap = false;
|
22077 | if (this.adapter.isRTL()) {
|
22078 | var startThumbLeftEdge = thumbStartPos - this.startThumbKnobWidth / 2;
|
22079 | var endThumbRightEdge = thumbEndPos + this.endThumbKnobWidth / 2;
|
22080 | thumbsOverlap = endThumbRightEdge >= startThumbLeftEdge;
|
22081 | } else {
|
22082 | var startThumbRightEdge = thumbStartPos + this.startThumbKnobWidth / 2;
|
22083 | var endThumbLeftEdge = thumbEndPos - this.endThumbKnobWidth / 2;
|
22084 | thumbsOverlap = startThumbRightEdge >= endThumbLeftEdge;
|
22085 | }
|
22086 | if (thumbsOverlap) {
|
22087 | this.adapter.addThumbClass(constants_1.cssClasses.THUMB_TOP,
|
22088 |
|
22089 |
|
22090 | thumb || types_1.Thumb.END);
|
22091 | this.adapter.removeThumbClass(constants_1.cssClasses.THUMB_TOP, thumb === types_1.Thumb.START ? types_1.Thumb.END : types_1.Thumb.START);
|
22092 | } else {
|
22093 | this.adapter.removeThumbClass(constants_1.cssClasses.THUMB_TOP, types_1.Thumb.START);
|
22094 | this.adapter.removeThumbClass(constants_1.cssClasses.THUMB_TOP, types_1.Thumb.END);
|
22095 | }
|
22096 | };
|
22097 | |
22098 |
|
22099 |
|
22100 |
|
22101 |
|
22102 |
|
22103 | MDCSliderFoundation.prototype.convertAttributeValueToNumber = function (attributeValue, attributeName) {
|
22104 | if (attributeValue === null) {
|
22105 | throw new Error("MDCSliderFoundation: `" + attributeName + "` must be non-null.");
|
22106 | }
|
22107 | var value = Number(attributeValue);
|
22108 | if (isNaN(value)) {
|
22109 | throw new Error("MDCSliderFoundation: `" + attributeName + "` value is " + ("`" + attributeValue + "`, but must be a number."));
|
22110 | }
|
22111 | return value;
|
22112 | };
|
22113 |
|
22114 | MDCSliderFoundation.prototype.validateProperties = function (_a) {
|
22115 | var min = _a.min,
|
22116 | max = _a.max,
|
22117 | value = _a.value,
|
22118 | valueStart = _a.valueStart,
|
22119 | step = _a.step;
|
22120 | if (min >= max) {
|
22121 | throw new Error("MDCSliderFoundation: min must be strictly less than max. " + ("Current: [min: " + min + ", max: " + max + "]"));
|
22122 | }
|
22123 | if (step <= 0) {
|
22124 | throw new Error("MDCSliderFoundation: step must be a positive number. " + ("Current step: " + this.step));
|
22125 | }
|
22126 | if (this.isRange) {
|
22127 | if (value < min || value > max || valueStart < min || valueStart > max) {
|
22128 | throw new Error("MDCSliderFoundation: values must be in [min, max] range. " + ("Current values: [start value: " + valueStart + ", end value: " + value + "]"));
|
22129 | }
|
22130 | if (valueStart > value) {
|
22131 | throw new Error("MDCSliderFoundation: start value must be <= end value. " + ("Current values: [start value: " + valueStart + ", end value: " + value + "]"));
|
22132 | }
|
22133 | var numStepsValueStartFromMin = (valueStart - min) / step;
|
22134 | var numStepsValueFromMin = (value - min) / step;
|
22135 | if (numStepsValueStartFromMin % 1 !== 0 || numStepsValueFromMin % 1 !== 0) {
|
22136 | throw new Error("MDCSliderFoundation: Slider values must be valid based on the " + ("step value. Current values: [start value: " + valueStart + ", ") + ("end value: " + value + "]"));
|
22137 | }
|
22138 | } else {
|
22139 |
|
22140 | if (value < min || value > max) {
|
22141 | throw new Error("MDCSliderFoundation: value must be in [min, max] range. " + ("Current value: " + value));
|
22142 | }
|
22143 | var numStepsValueFromMin = (value - min) / step;
|
22144 | if (numStepsValueFromMin % 1 !== 0) {
|
22145 | throw new Error("MDCSliderFoundation: Slider value must be valid based on the " + ("step value. Current value: " + value));
|
22146 | }
|
22147 | }
|
22148 | };
|
22149 | MDCSliderFoundation.prototype.registerEventHandlers = function () {
|
22150 | this.adapter.registerWindowEventHandler('resize', this.resizeListener);
|
22151 | if (MDCSliderFoundation.SUPPORTS_POINTER_EVENTS) {
|
22152 |
|
22153 | this.adapter.registerEventHandler('pointerdown', this.pointerdownListener);
|
22154 | this.adapter.registerEventHandler('pointerup', this.pointerupListener);
|
22155 | } else {
|
22156 |
|
22157 | this.adapter.registerEventHandler('mousedown', this.mousedownOrTouchstartListener);
|
22158 | this.adapter.registerEventHandler('touchstart', this.mousedownOrTouchstartListener);
|
22159 | }
|
22160 | if (this.isRange) {
|
22161 | this.adapter.registerThumbEventHandler(types_1.Thumb.START, 'mouseenter', this.thumbMouseenterListener);
|
22162 | this.adapter.registerThumbEventHandler(types_1.Thumb.START, 'mouseleave', this.thumbMouseleaveListener);
|
22163 | this.adapter.registerInputEventHandler(types_1.Thumb.START, 'change', this.inputStartChangeListener);
|
22164 | this.adapter.registerInputEventHandler(types_1.Thumb.START, 'focus', this.inputStartFocusListener);
|
22165 | this.adapter.registerInputEventHandler(types_1.Thumb.START, 'blur', this.inputStartBlurListener);
|
22166 | }
|
22167 | this.adapter.registerThumbEventHandler(types_1.Thumb.END, 'mouseenter', this.thumbMouseenterListener);
|
22168 | this.adapter.registerThumbEventHandler(types_1.Thumb.END, 'mouseleave', this.thumbMouseleaveListener);
|
22169 | this.adapter.registerInputEventHandler(types_1.Thumb.END, 'change', this.inputEndChangeListener);
|
22170 | this.adapter.registerInputEventHandler(types_1.Thumb.END, 'focus', this.inputEndFocusListener);
|
22171 | this.adapter.registerInputEventHandler(types_1.Thumb.END, 'blur', this.inputEndBlurListener);
|
22172 | };
|
22173 | MDCSliderFoundation.prototype.deregisterEventHandlers = function () {
|
22174 | this.adapter.deregisterWindowEventHandler('resize', this.resizeListener);
|
22175 | if (MDCSliderFoundation.SUPPORTS_POINTER_EVENTS) {
|
22176 | this.adapter.deregisterEventHandler('pointerdown', this.pointerdownListener);
|
22177 | this.adapter.deregisterEventHandler('pointerup', this.pointerupListener);
|
22178 | } else {
|
22179 | this.adapter.deregisterEventHandler('mousedown', this.mousedownOrTouchstartListener);
|
22180 | this.adapter.deregisterEventHandler('touchstart', this.mousedownOrTouchstartListener);
|
22181 | }
|
22182 | if (this.isRange) {
|
22183 | this.adapter.deregisterThumbEventHandler(types_1.Thumb.START, 'mouseenter', this.thumbMouseenterListener);
|
22184 | this.adapter.deregisterThumbEventHandler(types_1.Thumb.START, 'mouseleave', this.thumbMouseleaveListener);
|
22185 | this.adapter.deregisterInputEventHandler(types_1.Thumb.START, 'change', this.inputStartChangeListener);
|
22186 | this.adapter.deregisterInputEventHandler(types_1.Thumb.START, 'focus', this.inputStartFocusListener);
|
22187 | this.adapter.deregisterInputEventHandler(types_1.Thumb.START, 'blur', this.inputStartBlurListener);
|
22188 | }
|
22189 | this.adapter.deregisterThumbEventHandler(types_1.Thumb.END, 'mouseenter', this.thumbMouseenterListener);
|
22190 | this.adapter.deregisterThumbEventHandler(types_1.Thumb.END, 'mouseleave', this.thumbMouseleaveListener);
|
22191 | this.adapter.deregisterInputEventHandler(types_1.Thumb.END, 'change', this.inputEndChangeListener);
|
22192 | this.adapter.deregisterInputEventHandler(types_1.Thumb.END, 'focus', this.inputEndFocusListener);
|
22193 | this.adapter.deregisterInputEventHandler(types_1.Thumb.END, 'blur', this.inputEndBlurListener);
|
22194 | };
|
22195 | MDCSliderFoundation.prototype.handlePointerup = function () {
|
22196 | this.handleUp();
|
22197 | this.adapter.deregisterEventHandler('pointermove', this.moveListener);
|
22198 | };
|
22199 | MDCSliderFoundation.SUPPORTS_POINTER_EVENTS = HAS_WINDOW && Boolean(window.PointerEvent) &&
|
22200 |
|
22201 |
|
22202 |
|
22203 | !isIOS();
|
22204 | return MDCSliderFoundation;
|
22205 | }(foundation_1.MDCFoundation);
|
22206 | exports.MDCSliderFoundation = MDCSliderFoundation;
|
22207 | function isIOS() {
|
22208 |
|
22209 |
|
22210 | return ['iPad Simulator', 'iPhone Simulator', 'iPod Simulator', 'iPad', 'iPhone', 'iPod'].includes(navigator.platform)
|
22211 |
|
22212 | || navigator.userAgent.includes('Mac') && 'ontouchend' in document;
|
22213 | }
|
22214 |
|
22215 |
|
22216 |
|
22217 |
|
22218 |
|
22219 |
|
22220 | function getNumDecimalPlaces(n) {
|
22221 |
|
22222 | var match = /(?:\.(\d+))?(?:[eE]([+\-]?\d+))?$/.exec(String(n));
|
22223 |
|
22224 |
|
22225 | if (!match) return 0;
|
22226 | var fraction = match[1] || '';
|
22227 | var exponent = match[2] || 0;
|
22228 |
|
22229 |
|
22230 |
|
22231 |
|
22232 | return Math.max(0,
|
22233 | (fraction === '0' ? 0 : fraction.length) - Number(exponent));
|
22234 | }
|
22235 |
|
22236 | }),
|
22237 |
|
22238 | "./packages/mdc-slider/index.ts":
|
22239 |
|
22240 |
|
22241 |
|
22242 |
|
22243 | (function(module, exports, __webpack_require__) {
|
22244 |
|
22245 | "use strict";
|
22246 |
|
22247 |
|
22248 |
|
22249 |
|
22250 |
|
22251 |
|
22252 |
|
22253 |
|
22254 |
|
22255 |
|
22256 |
|
22257 |
|
22258 |
|
22259 |
|
22260 |
|
22261 |
|
22262 |
|
22263 |
|
22264 |
|
22265 |
|
22266 |
|
22267 |
|
22268 |
|
22269 |
|
22270 | var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
|
22271 | if (k2 === undefined) k2 = k;
|
22272 | Object.defineProperty(o, k2, { enumerable: true, get: function get() {
|
22273 | return m[k];
|
22274 | } });
|
22275 | } : function (o, m, k, k2) {
|
22276 | if (k2 === undefined) k2 = k;
|
22277 | o[k2] = m[k];
|
22278 | });
|
22279 | var __exportStar = this && this.__exportStar || function (m, exports) {
|
22280 | for (var p in m) {
|
22281 | if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
22282 | }
|
22283 | };
|
22284 | Object.defineProperty(exports, "__esModule", { value: true });
|
22285 | __exportStar(__webpack_require__( "./packages/mdc-slider/adapter.ts"), exports);
|
22286 | __exportStar(__webpack_require__( "./packages/mdc-slider/component.ts"), exports);
|
22287 | __exportStar(__webpack_require__( "./packages/mdc-slider/constants.ts"), exports);
|
22288 | __exportStar(__webpack_require__( "./packages/mdc-slider/foundation.ts"), exports);
|
22289 | __exportStar(__webpack_require__( "./packages/mdc-slider/types.ts"), exports);
|
22290 |
|
22291 | }),
|
22292 |
|
22293 | "./packages/mdc-slider/types.ts":
|
22294 |
|
22295 |
|
22296 |
|
22297 |
|
22298 | (function(module, exports, __webpack_require__) {
|
22299 |
|
22300 | "use strict";
|
22301 |
|
22302 |
|
22303 |
|
22304 |
|
22305 |
|
22306 |
|
22307 |
|
22308 |
|
22309 |
|
22310 |
|
22311 |
|
22312 |
|
22313 |
|
22314 |
|
22315 |
|
22316 |
|
22317 |
|
22318 |
|
22319 |
|
22320 |
|
22321 |
|
22322 |
|
22323 |
|
22324 |
|
22325 | Object.defineProperty(exports, "__esModule", { value: true });
|
22326 | exports.Thumb = exports.TickMark = void 0;
|
22327 |
|
22328 | var TickMark;
|
22329 | (function (TickMark) {
|
22330 | TickMark[TickMark["ACTIVE"] = 0] = "ACTIVE";
|
22331 | TickMark[TickMark["INACTIVE"] = 1] = "INACTIVE";
|
22332 | })(TickMark = exports.TickMark || (exports.TickMark = {}));
|
22333 |
|
22334 |
|
22335 |
|
22336 |
|
22337 | var Thumb;
|
22338 | (function (Thumb) {
|
22339 |
|
22340 | Thumb[Thumb["START"] = 1] = "START";
|
22341 |
|
22342 |
|
22343 | Thumb[Thumb["END"] = 2] = "END";
|
22344 | })(Thumb = exports.Thumb || (exports.Thumb = {}));
|
22345 |
|
22346 | }),
|
22347 |
|
22348 | "./packages/mdc-snackbar/adapter.ts":
|
22349 |
|
22350 |
|
22351 |
|
22352 |
|
22353 | (function(module, exports, __webpack_require__) {
|
22354 |
|
22355 | "use strict";
|
22356 |
|
22357 |
|
22358 |
|
22359 |
|
22360 |
|
22361 |
|
22362 |
|
22363 |
|
22364 |
|
22365 |
|
22366 |
|
22367 |
|
22368 |
|
22369 |
|
22370 |
|
22371 |
|
22372 |
|
22373 |
|
22374 |
|
22375 |
|
22376 |
|
22377 |
|
22378 |
|
22379 |
|
22380 | Object.defineProperty(exports, "__esModule", { value: true });
|
22381 |
|
22382 | }),
|
22383 |
|
22384 | "./packages/mdc-snackbar/component.ts":
|
22385 |
|
22386 |
|
22387 |
|
22388 |
|
22389 | (function(module, exports, __webpack_require__) {
|
22390 |
|
22391 | "use strict";
|
22392 |
|
22393 |
|
22394 |
|
22395 |
|
22396 |
|
22397 |
|
22398 |
|
22399 |
|
22400 |
|
22401 |
|
22402 |
|
22403 |
|
22404 |
|
22405 |
|
22406 |
|
22407 |
|
22408 |
|
22409 |
|
22410 |
|
22411 |
|
22412 |
|
22413 |
|
22414 |
|
22415 |
|
22416 | var __extends = this && this.__extends || function () {
|
22417 | var _extendStatics = function extendStatics(d, b) {
|
22418 | _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
|
22419 | d.__proto__ = b;
|
22420 | } || function (d, b) {
|
22421 | for (var p in b) {
|
22422 | if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
22423 | }
|
22424 | };
|
22425 | return _extendStatics(d, b);
|
22426 | };
|
22427 | return function (d, b) {
|
22428 | if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
22429 | _extendStatics(d, b);
|
22430 | function __() {
|
22431 | this.constructor = d;
|
22432 | }
|
22433 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
22434 | };
|
22435 | }();
|
22436 | var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
|
22437 | if (k2 === undefined) k2 = k;
|
22438 | Object.defineProperty(o, k2, { enumerable: true, get: function get() {
|
22439 | return m[k];
|
22440 | } });
|
22441 | } : function (o, m, k, k2) {
|
22442 | if (k2 === undefined) k2 = k;
|
22443 | o[k2] = m[k];
|
22444 | });
|
22445 | var __setModuleDefault = this && this.__setModuleDefault || (Object.create ? function (o, v) {
|
22446 | Object.defineProperty(o, "default", { enumerable: true, value: v });
|
22447 | } : function (o, v) {
|
22448 | o["default"] = v;
|
22449 | });
|
22450 | var __importStar = this && this.__importStar || function (mod) {
|
22451 | if (mod && mod.__esModule) return mod;
|
22452 | var result = {};
|
22453 | if (mod != null) for (var k in mod) {
|
22454 | if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
22455 | }__setModuleDefault(result, mod);
|
22456 | return result;
|
22457 | };
|
22458 | Object.defineProperty(exports, "__esModule", { value: true });
|
22459 | exports.MDCSnackbar = void 0;
|
22460 | var component_1 = __webpack_require__( "./packages/mdc-base/component.ts");
|
22461 | var ponyfill_1 = __webpack_require__( "./packages/mdc-dom/ponyfill.ts");
|
22462 | var constants_1 = __webpack_require__( "./packages/mdc-snackbar/constants.ts");
|
22463 | var foundation_1 = __webpack_require__( "./packages/mdc-snackbar/foundation.ts");
|
22464 | var util = __importStar(__webpack_require__( "./packages/mdc-snackbar/util.ts"));
|
22465 | var SURFACE_SELECTOR = constants_1.strings.SURFACE_SELECTOR,
|
22466 | LABEL_SELECTOR = constants_1.strings.LABEL_SELECTOR,
|
22467 | ACTION_SELECTOR = constants_1.strings.ACTION_SELECTOR,
|
22468 | DISMISS_SELECTOR = constants_1.strings.DISMISS_SELECTOR,
|
22469 | OPENING_EVENT = constants_1.strings.OPENING_EVENT,
|
22470 | OPENED_EVENT = constants_1.strings.OPENED_EVENT,
|
22471 | CLOSING_EVENT = constants_1.strings.CLOSING_EVENT,
|
22472 | CLOSED_EVENT = constants_1.strings.CLOSED_EVENT;
|
22473 | var MDCSnackbar = function (_super) {
|
22474 | __extends(MDCSnackbar, _super);
|
22475 | function MDCSnackbar() {
|
22476 | return _super !== null && _super.apply(this, arguments) || this;
|
22477 | }
|
22478 | MDCSnackbar.attachTo = function (root) {
|
22479 | return new MDCSnackbar(root);
|
22480 | };
|
22481 | MDCSnackbar.prototype.initialize = function (announcerFactory) {
|
22482 | if (announcerFactory === void 0) {
|
22483 | announcerFactory = function announcerFactory() {
|
22484 | return util.announce;
|
22485 | };
|
22486 | }
|
22487 | this.announce = announcerFactory();
|
22488 | };
|
22489 | MDCSnackbar.prototype.initialSyncWithDOM = function () {
|
22490 | var _this = this;
|
22491 | this.surfaceEl = this.root.querySelector(SURFACE_SELECTOR);
|
22492 | this.labelEl = this.root.querySelector(LABEL_SELECTOR);
|
22493 | this.actionEl = this.root.querySelector(ACTION_SELECTOR);
|
22494 | this.handleKeyDown = function (evt) {
|
22495 | _this.foundation.handleKeyDown(evt);
|
22496 | };
|
22497 | this.handleSurfaceClick = function (evt) {
|
22498 | var target = evt.target;
|
22499 | if (_this.isActionButton(target)) {
|
22500 | _this.foundation.handleActionButtonClick(evt);
|
22501 | } else if (_this.isActionIcon(target)) {
|
22502 | _this.foundation.handleActionIconClick(evt);
|
22503 | }
|
22504 | };
|
22505 | this.registerKeyDownHandler(this.handleKeyDown);
|
22506 | this.registerSurfaceClickHandler(this.handleSurfaceClick);
|
22507 | };
|
22508 | MDCSnackbar.prototype.destroy = function () {
|
22509 | _super.prototype.destroy.call(this);
|
22510 | this.deregisterKeyDownHandler(this.handleKeyDown);
|
22511 | this.deregisterSurfaceClickHandler(this.handleSurfaceClick);
|
22512 | };
|
22513 | MDCSnackbar.prototype.open = function () {
|
22514 | this.foundation.open();
|
22515 | };
|
22516 | |
22517 |
|
22518 |
|
22519 |
|
22520 |
|
22521 | MDCSnackbar.prototype.close = function (reason) {
|
22522 | if (reason === void 0) {
|
22523 | reason = '';
|
22524 | }
|
22525 | this.foundation.close(reason);
|
22526 | };
|
22527 | MDCSnackbar.prototype.getDefaultFoundation = function () {
|
22528 | var _this = this;
|
22529 |
|
22530 |
|
22531 | var adapter = {
|
22532 | addClass: function addClass(className) {
|
22533 | _this.root.classList.add(className);
|
22534 | },
|
22535 | announce: function announce() {
|
22536 | _this.announce(_this.labelEl);
|
22537 | },
|
22538 | notifyClosed: function notifyClosed(reason) {
|
22539 | return _this.emit(CLOSED_EVENT, reason ? { reason: reason } : {});
|
22540 | },
|
22541 | notifyClosing: function notifyClosing(reason) {
|
22542 | return _this.emit(CLOSING_EVENT, reason ? { reason: reason } : {});
|
22543 | },
|
22544 | notifyOpened: function notifyOpened() {
|
22545 | return _this.emit(OPENED_EVENT, {});
|
22546 | },
|
22547 | notifyOpening: function notifyOpening() {
|
22548 | return _this.emit(OPENING_EVENT, {});
|
22549 | },
|
22550 | removeClass: function removeClass(className) {
|
22551 | return _this.root.classList.remove(className);
|
22552 | }
|
22553 | };
|
22554 | return new foundation_1.MDCSnackbarFoundation(adapter);
|
22555 | };
|
22556 | Object.defineProperty(MDCSnackbar.prototype, "timeoutMs", {
|
22557 | get: function get() {
|
22558 | return this.foundation.getTimeoutMs();
|
22559 | },
|
22560 | set: function set(timeoutMs) {
|
22561 | this.foundation.setTimeoutMs(timeoutMs);
|
22562 | },
|
22563 | enumerable: false,
|
22564 | configurable: true
|
22565 | });
|
22566 | Object.defineProperty(MDCSnackbar.prototype, "closeOnEscape", {
|
22567 | get: function get() {
|
22568 | return this.foundation.getCloseOnEscape();
|
22569 | },
|
22570 | set: function set(closeOnEscape) {
|
22571 | this.foundation.setCloseOnEscape(closeOnEscape);
|
22572 | },
|
22573 | enumerable: false,
|
22574 | configurable: true
|
22575 | });
|
22576 | Object.defineProperty(MDCSnackbar.prototype, "isOpen", {
|
22577 | get: function get() {
|
22578 | return this.foundation.isOpen();
|
22579 | },
|
22580 | enumerable: false,
|
22581 | configurable: true
|
22582 | });
|
22583 | Object.defineProperty(MDCSnackbar.prototype, "labelText", {
|
22584 | get: function get() {
|
22585 |
|
22586 |
|
22587 | return this.labelEl.textContent;
|
22588 | },
|
22589 | set: function set(labelText) {
|
22590 | this.labelEl.textContent = labelText;
|
22591 | },
|
22592 | enumerable: false,
|
22593 | configurable: true
|
22594 | });
|
22595 | Object.defineProperty(MDCSnackbar.prototype, "actionButtonText", {
|
22596 | get: function get() {
|
22597 | return this.actionEl.textContent;
|
22598 | },
|
22599 | set: function set(actionButtonText) {
|
22600 | this.actionEl.textContent = actionButtonText;
|
22601 | },
|
22602 | enumerable: false,
|
22603 | configurable: true
|
22604 | });
|
22605 | MDCSnackbar.prototype.registerKeyDownHandler = function (handler) {
|
22606 | this.listen('keydown', handler);
|
22607 | };
|
22608 | MDCSnackbar.prototype.deregisterKeyDownHandler = function (handler) {
|
22609 | this.unlisten('keydown', handler);
|
22610 | };
|
22611 | MDCSnackbar.prototype.registerSurfaceClickHandler = function (handler) {
|
22612 | this.surfaceEl.addEventListener('click', handler);
|
22613 | };
|
22614 | MDCSnackbar.prototype.deregisterSurfaceClickHandler = function (handler) {
|
22615 | this.surfaceEl.removeEventListener('click', handler);
|
22616 | };
|
22617 | MDCSnackbar.prototype.isActionButton = function (target) {
|
22618 | return Boolean(ponyfill_1.closest(target, ACTION_SELECTOR));
|
22619 | };
|
22620 | MDCSnackbar.prototype.isActionIcon = function (target) {
|
22621 | return Boolean(ponyfill_1.closest(target, DISMISS_SELECTOR));
|
22622 | };
|
22623 | return MDCSnackbar;
|
22624 | }(component_1.MDCComponent);
|
22625 | exports.MDCSnackbar = MDCSnackbar;
|
22626 |
|
22627 | }),
|
22628 |
|
22629 | "./packages/mdc-snackbar/constants.ts":
|
22630 |
|
22631 |
|
22632 |
|
22633 |
|
22634 | (function(module, exports, __webpack_require__) {
|
22635 |
|
22636 | "use strict";
|
22637 |
|
22638 |
|
22639 |
|
22640 |
|
22641 |
|
22642 |
|
22643 |
|
22644 |
|
22645 |
|
22646 |
|
22647 |
|
22648 |
|
22649 |
|
22650 |
|
22651 |
|
22652 |
|
22653 |
|
22654 |
|
22655 |
|
22656 |
|
22657 |
|
22658 |
|
22659 |
|
22660 |
|
22661 | Object.defineProperty(exports, "__esModule", { value: true });
|
22662 | exports.numbers = exports.strings = exports.cssClasses = void 0;
|
22663 | var cssClasses = {
|
22664 | CLOSING: 'mdc-snackbar--closing',
|
22665 | OPEN: 'mdc-snackbar--open',
|
22666 | OPENING: 'mdc-snackbar--opening'
|
22667 | };
|
22668 | exports.cssClasses = cssClasses;
|
22669 | var strings = {
|
22670 | ACTION_SELECTOR: '.mdc-snackbar__action',
|
22671 | ARIA_LIVE_LABEL_TEXT_ATTR: 'data-mdc-snackbar-label-text',
|
22672 | CLOSED_EVENT: 'MDCSnackbar:closed',
|
22673 | CLOSING_EVENT: 'MDCSnackbar:closing',
|
22674 | DISMISS_SELECTOR: '.mdc-snackbar__dismiss',
|
22675 | LABEL_SELECTOR: '.mdc-snackbar__label',
|
22676 | OPENED_EVENT: 'MDCSnackbar:opened',
|
22677 | OPENING_EVENT: 'MDCSnackbar:opening',
|
22678 | REASON_ACTION: 'action',
|
22679 | REASON_DISMISS: 'dismiss',
|
22680 | SURFACE_SELECTOR: '.mdc-snackbar__surface'
|
22681 | };
|
22682 | exports.strings = strings;
|
22683 | var numbers = {
|
22684 | DEFAULT_AUTO_DISMISS_TIMEOUT_MS: 5000,
|
22685 | INDETERMINATE: -1,
|
22686 | MAX_AUTO_DISMISS_TIMEOUT_MS: 10000,
|
22687 | MIN_AUTO_DISMISS_TIMEOUT_MS: 4000,
|
22688 |
|
22689 | SNACKBAR_ANIMATION_CLOSE_TIME_MS: 75,
|
22690 | SNACKBAR_ANIMATION_OPEN_TIME_MS: 150,
|
22691 | |
22692 |
|
22693 |
|
22694 |
|
22695 |
|
22696 | ARIA_LIVE_DELAY_MS: 1000
|
22697 | };
|
22698 | exports.numbers = numbers;
|
22699 |
|
22700 | }),
|
22701 |
|
22702 | "./packages/mdc-snackbar/foundation.ts":
|
22703 |
|
22704 |
|
22705 |
|
22706 |
|
22707 | (function(module, exports, __webpack_require__) {
|
22708 |
|
22709 | "use strict";
|
22710 |
|
22711 |
|
22712 |
|
22713 |
|
22714 |
|
22715 |
|
22716 |
|
22717 |
|
22718 |
|
22719 |
|
22720 |
|
22721 |
|
22722 |
|
22723 |
|
22724 |
|
22725 |
|
22726 |
|
22727 |
|
22728 |
|
22729 |
|
22730 |
|
22731 |
|
22732 |
|
22733 |
|
22734 | var __extends = this && this.__extends || function () {
|
22735 | var _extendStatics = function extendStatics(d, b) {
|
22736 | _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
|
22737 | d.__proto__ = b;
|
22738 | } || function (d, b) {
|
22739 | for (var p in b) {
|
22740 | if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
22741 | }
|
22742 | };
|
22743 | return _extendStatics(d, b);
|
22744 | };
|
22745 | return function (d, b) {
|
22746 | if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
22747 | _extendStatics(d, b);
|
22748 | function __() {
|
22749 | this.constructor = d;
|
22750 | }
|
22751 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
22752 | };
|
22753 | }();
|
22754 | var __assign = this && this.__assign || function () {
|
22755 | __assign = Object.assign || function (t) {
|
22756 | for (var s, i = 1, n = arguments.length; i < n; i++) {
|
22757 | s = arguments[i];
|
22758 | for (var p in s) {
|
22759 | if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
22760 | }
|
22761 | }
|
22762 | return t;
|
22763 | };
|
22764 | return __assign.apply(this, arguments);
|
22765 | };
|
22766 | Object.defineProperty(exports, "__esModule", { value: true });
|
22767 | exports.MDCSnackbarFoundation = void 0;
|
22768 | var foundation_1 = __webpack_require__( "./packages/mdc-base/foundation.ts");
|
22769 | var constants_1 = __webpack_require__( "./packages/mdc-snackbar/constants.ts");
|
22770 | var OPENING = constants_1.cssClasses.OPENING,
|
22771 | OPEN = constants_1.cssClasses.OPEN,
|
22772 | CLOSING = constants_1.cssClasses.CLOSING;
|
22773 | var REASON_ACTION = constants_1.strings.REASON_ACTION,
|
22774 | REASON_DISMISS = constants_1.strings.REASON_DISMISS;
|
22775 | var MDCSnackbarFoundation = function (_super) {
|
22776 | __extends(MDCSnackbarFoundation, _super);
|
22777 | function MDCSnackbarFoundation(adapter) {
|
22778 | var _this = _super.call(this, __assign(__assign({}, MDCSnackbarFoundation.defaultAdapter), adapter)) || this;
|
22779 | _this.opened = false;
|
22780 | _this.animationFrame = 0;
|
22781 | _this.animationTimer = 0;
|
22782 | _this.autoDismissTimer = 0;
|
22783 | _this.autoDismissTimeoutMs = constants_1.numbers.DEFAULT_AUTO_DISMISS_TIMEOUT_MS;
|
22784 | _this.closeOnEscape = true;
|
22785 | return _this;
|
22786 | }
|
22787 | Object.defineProperty(MDCSnackbarFoundation, "cssClasses", {
|
22788 | get: function get() {
|
22789 | return constants_1.cssClasses;
|
22790 | },
|
22791 | enumerable: false,
|
22792 | configurable: true
|
22793 | });
|
22794 | Object.defineProperty(MDCSnackbarFoundation, "strings", {
|
22795 | get: function get() {
|
22796 | return constants_1.strings;
|
22797 | },
|
22798 | enumerable: false,
|
22799 | configurable: true
|
22800 | });
|
22801 | Object.defineProperty(MDCSnackbarFoundation, "numbers", {
|
22802 | get: function get() {
|
22803 | return constants_1.numbers;
|
22804 | },
|
22805 | enumerable: false,
|
22806 | configurable: true
|
22807 | });
|
22808 | Object.defineProperty(MDCSnackbarFoundation, "defaultAdapter", {
|
22809 | get: function get() {
|
22810 | return {
|
22811 | addClass: function addClass() {
|
22812 | return undefined;
|
22813 | },
|
22814 | announce: function announce() {
|
22815 | return undefined;
|
22816 | },
|
22817 | notifyClosed: function notifyClosed() {
|
22818 | return undefined;
|
22819 | },
|
22820 | notifyClosing: function notifyClosing() {
|
22821 | return undefined;
|
22822 | },
|
22823 | notifyOpened: function notifyOpened() {
|
22824 | return undefined;
|
22825 | },
|
22826 | notifyOpening: function notifyOpening() {
|
22827 | return undefined;
|
22828 | },
|
22829 | removeClass: function removeClass() {
|
22830 | return undefined;
|
22831 | }
|
22832 | };
|
22833 | },
|
22834 | enumerable: false,
|
22835 | configurable: true
|
22836 | });
|
22837 | MDCSnackbarFoundation.prototype.destroy = function () {
|
22838 | this.clearAutoDismissTimer();
|
22839 | cancelAnimationFrame(this.animationFrame);
|
22840 | this.animationFrame = 0;
|
22841 | clearTimeout(this.animationTimer);
|
22842 | this.animationTimer = 0;
|
22843 | this.adapter.removeClass(OPENING);
|
22844 | this.adapter.removeClass(OPEN);
|
22845 | this.adapter.removeClass(CLOSING);
|
22846 | };
|
22847 | MDCSnackbarFoundation.prototype.open = function () {
|
22848 | var _this = this;
|
22849 | this.clearAutoDismissTimer();
|
22850 | this.opened = true;
|
22851 | this.adapter.notifyOpening();
|
22852 | this.adapter.removeClass(CLOSING);
|
22853 | this.adapter.addClass(OPENING);
|
22854 | this.adapter.announce();
|
22855 |
|
22856 | this.runNextAnimationFrame(function () {
|
22857 | _this.adapter.addClass(OPEN);
|
22858 | _this.animationTimer = setTimeout(function () {
|
22859 | var timeoutMs = _this.getTimeoutMs();
|
22860 | _this.handleAnimationTimerEnd();
|
22861 | _this.adapter.notifyOpened();
|
22862 | if (timeoutMs !== constants_1.numbers.INDETERMINATE) {
|
22863 | _this.autoDismissTimer = setTimeout(function () {
|
22864 | _this.close(REASON_DISMISS);
|
22865 | }, timeoutMs);
|
22866 | }
|
22867 | }, constants_1.numbers.SNACKBAR_ANIMATION_OPEN_TIME_MS);
|
22868 | });
|
22869 | };
|
22870 | |
22871 |
|
22872 |
|
22873 |
|
22874 |
|
22875 | MDCSnackbarFoundation.prototype.close = function (reason) {
|
22876 | var _this = this;
|
22877 | if (reason === void 0) {
|
22878 | reason = '';
|
22879 | }
|
22880 | if (!this.opened) {
|
22881 |
|
22882 | return;
|
22883 | }
|
22884 | cancelAnimationFrame(this.animationFrame);
|
22885 | this.animationFrame = 0;
|
22886 | this.clearAutoDismissTimer();
|
22887 | this.opened = false;
|
22888 | this.adapter.notifyClosing(reason);
|
22889 | this.adapter.addClass(constants_1.cssClasses.CLOSING);
|
22890 | this.adapter.removeClass(constants_1.cssClasses.OPEN);
|
22891 | this.adapter.removeClass(constants_1.cssClasses.OPENING);
|
22892 | clearTimeout(this.animationTimer);
|
22893 | this.animationTimer = setTimeout(function () {
|
22894 | _this.handleAnimationTimerEnd();
|
22895 | _this.adapter.notifyClosed(reason);
|
22896 | }, constants_1.numbers.SNACKBAR_ANIMATION_CLOSE_TIME_MS);
|
22897 | };
|
22898 | MDCSnackbarFoundation.prototype.isOpen = function () {
|
22899 | return this.opened;
|
22900 | };
|
22901 | MDCSnackbarFoundation.prototype.getTimeoutMs = function () {
|
22902 | return this.autoDismissTimeoutMs;
|
22903 | };
|
22904 | MDCSnackbarFoundation.prototype.setTimeoutMs = function (timeoutMs) {
|
22905 |
|
22906 | var minValue = constants_1.numbers.MIN_AUTO_DISMISS_TIMEOUT_MS;
|
22907 | var maxValue = constants_1.numbers.MAX_AUTO_DISMISS_TIMEOUT_MS;
|
22908 | var indeterminateValue = constants_1.numbers.INDETERMINATE;
|
22909 | if (timeoutMs === constants_1.numbers.INDETERMINATE || timeoutMs <= maxValue && timeoutMs >= minValue) {
|
22910 | this.autoDismissTimeoutMs = timeoutMs;
|
22911 | } else {
|
22912 | throw new Error("\n timeoutMs must be an integer in the range " + minValue + "\u2013" + maxValue + "\n (or " + indeterminateValue + " to disable), but got '" + timeoutMs + "'");
|
22913 | }
|
22914 | };
|
22915 | MDCSnackbarFoundation.prototype.getCloseOnEscape = function () {
|
22916 | return this.closeOnEscape;
|
22917 | };
|
22918 | MDCSnackbarFoundation.prototype.setCloseOnEscape = function (closeOnEscape) {
|
22919 | this.closeOnEscape = closeOnEscape;
|
22920 | };
|
22921 | MDCSnackbarFoundation.prototype.handleKeyDown = function (evt) {
|
22922 | var isEscapeKey = evt.key === 'Escape' || evt.keyCode === 27;
|
22923 | if (isEscapeKey && this.getCloseOnEscape()) {
|
22924 | this.close(REASON_DISMISS);
|
22925 | }
|
22926 | };
|
22927 | MDCSnackbarFoundation.prototype.handleActionButtonClick = function (_evt) {
|
22928 | this.close(REASON_ACTION);
|
22929 | };
|
22930 | MDCSnackbarFoundation.prototype.handleActionIconClick = function (_evt) {
|
22931 | this.close(REASON_DISMISS);
|
22932 | };
|
22933 | MDCSnackbarFoundation.prototype.clearAutoDismissTimer = function () {
|
22934 | clearTimeout(this.autoDismissTimer);
|
22935 | this.autoDismissTimer = 0;
|
22936 | };
|
22937 | MDCSnackbarFoundation.prototype.handleAnimationTimerEnd = function () {
|
22938 | this.animationTimer = 0;
|
22939 | this.adapter.removeClass(constants_1.cssClasses.OPENING);
|
22940 | this.adapter.removeClass(constants_1.cssClasses.CLOSING);
|
22941 | };
|
22942 | |
22943 |
|
22944 |
|
22945 | MDCSnackbarFoundation.prototype.runNextAnimationFrame = function (callback) {
|
22946 | var _this = this;
|
22947 | cancelAnimationFrame(this.animationFrame);
|
22948 | this.animationFrame = requestAnimationFrame(function () {
|
22949 | _this.animationFrame = 0;
|
22950 | clearTimeout(_this.animationTimer);
|
22951 | _this.animationTimer = setTimeout(callback, 0);
|
22952 | });
|
22953 | };
|
22954 | return MDCSnackbarFoundation;
|
22955 | }(foundation_1.MDCFoundation);
|
22956 | exports.MDCSnackbarFoundation = MDCSnackbarFoundation;
|
22957 |
|
22958 | exports.default = MDCSnackbarFoundation;
|
22959 |
|
22960 | }),
|
22961 |
|
22962 | "./packages/mdc-snackbar/index.ts":
|
22963 |
|
22964 |
|
22965 |
|
22966 |
|
22967 | (function(module, exports, __webpack_require__) {
|
22968 |
|
22969 | "use strict";
|
22970 |
|
22971 |
|
22972 |
|
22973 |
|
22974 |
|
22975 |
|
22976 |
|
22977 |
|
22978 |
|
22979 |
|
22980 |
|
22981 |
|
22982 |
|
22983 |
|
22984 |
|
22985 |
|
22986 |
|
22987 |
|
22988 |
|
22989 |
|
22990 |
|
22991 |
|
22992 |
|
22993 |
|
22994 | var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
|
22995 | if (k2 === undefined) k2 = k;
|
22996 | Object.defineProperty(o, k2, { enumerable: true, get: function get() {
|
22997 | return m[k];
|
22998 | } });
|
22999 | } : function (o, m, k, k2) {
|
23000 | if (k2 === undefined) k2 = k;
|
23001 | o[k2] = m[k];
|
23002 | });
|
23003 | var __setModuleDefault = this && this.__setModuleDefault || (Object.create ? function (o, v) {
|
23004 | Object.defineProperty(o, "default", { enumerable: true, value: v });
|
23005 | } : function (o, v) {
|
23006 | o["default"] = v;
|
23007 | });
|
23008 | var __importStar = this && this.__importStar || function (mod) {
|
23009 | if (mod && mod.__esModule) return mod;
|
23010 | var result = {};
|
23011 | if (mod != null) for (var k in mod) {
|
23012 | if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
23013 | }__setModuleDefault(result, mod);
|
23014 | return result;
|
23015 | };
|
23016 | var __exportStar = this && this.__exportStar || function (m, exports) {
|
23017 | for (var p in m) {
|
23018 | if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
23019 | }
|
23020 | };
|
23021 | Object.defineProperty(exports, "__esModule", { value: true });
|
23022 | exports.util = void 0;
|
23023 | var util = __importStar(__webpack_require__( "./packages/mdc-snackbar/util.ts"));
|
23024 | exports.util = util;
|
23025 | __exportStar(__webpack_require__( "./packages/mdc-snackbar/adapter.ts"), exports);
|
23026 | __exportStar(__webpack_require__( "./packages/mdc-snackbar/component.ts"), exports);
|
23027 | __exportStar(__webpack_require__( "./packages/mdc-snackbar/constants.ts"), exports);
|
23028 | __exportStar(__webpack_require__( "./packages/mdc-snackbar/foundation.ts"), exports);
|
23029 | __exportStar(__webpack_require__( "./packages/mdc-snackbar/types.ts"), exports);
|
23030 |
|
23031 | }),
|
23032 |
|
23033 | "./packages/mdc-snackbar/types.ts":
|
23034 |
|
23035 |
|
23036 |
|
23037 |
|
23038 | (function(module, exports, __webpack_require__) {
|
23039 |
|
23040 | "use strict";
|
23041 |
|
23042 |
|
23043 |
|
23044 |
|
23045 |
|
23046 |
|
23047 |
|
23048 |
|
23049 |
|
23050 |
|
23051 |
|
23052 |
|
23053 |
|
23054 |
|
23055 |
|
23056 |
|
23057 |
|
23058 |
|
23059 |
|
23060 |
|
23061 |
|
23062 |
|
23063 |
|
23064 |
|
23065 | Object.defineProperty(exports, "__esModule", { value: true });
|
23066 |
|
23067 | }),
|
23068 |
|
23069 | "./packages/mdc-snackbar/util.ts":
|
23070 |
|
23071 |
|
23072 |
|
23073 |
|
23074 | (function(module, exports, __webpack_require__) {
|
23075 |
|
23076 | "use strict";
|
23077 |
|
23078 |
|
23079 |
|
23080 |
|
23081 |
|
23082 |
|
23083 |
|
23084 |
|
23085 |
|
23086 |
|
23087 |
|
23088 |
|
23089 |
|
23090 |
|
23091 |
|
23092 |
|
23093 |
|
23094 |
|
23095 |
|
23096 |
|
23097 |
|
23098 |
|
23099 |
|
23100 |
|
23101 | Object.defineProperty(exports, "__esModule", { value: true });
|
23102 | exports.announce = void 0;
|
23103 | var constants_1 = __webpack_require__( "./packages/mdc-snackbar/constants.ts");
|
23104 | var ARIA_LIVE_DELAY_MS = constants_1.numbers.ARIA_LIVE_DELAY_MS;
|
23105 | var ARIA_LIVE_LABEL_TEXT_ATTR = constants_1.strings.ARIA_LIVE_LABEL_TEXT_ATTR;
|
23106 | function announce(ariaEl, labelEl) {
|
23107 | if (labelEl === void 0) {
|
23108 | labelEl = ariaEl;
|
23109 | }
|
23110 | var priority = ariaEl.getAttribute('aria-live');
|
23111 |
|
23112 |
|
23113 | var labelText = labelEl.textContent.trim();
|
23114 | if (!labelText || !priority) {
|
23115 | return;
|
23116 | }
|
23117 |
|
23118 | ariaEl.setAttribute('aria-live', 'off');
|
23119 |
|
23120 |
|
23121 |
|
23122 |
|
23123 |
|
23124 |
|
23125 |
|
23126 |
|
23127 |
|
23128 |
|
23129 |
|
23130 |
|
23131 |
|
23132 |
|
23133 |
|
23134 |
|
23135 |
|
23136 |
|
23137 |
|
23138 |
|
23139 |
|
23140 |
|
23141 |
|
23142 |
|
23143 |
|
23144 |
|
23145 |
|
23146 | labelEl.textContent = '';
|
23147 | labelEl.innerHTML = '<span style="display: inline-block; width: 0; height: 1px;"> </span>';
|
23148 |
|
23149 |
|
23150 |
|
23151 |
|
23152 | labelEl.setAttribute(ARIA_LIVE_LABEL_TEXT_ATTR, labelText);
|
23153 | setTimeout(function () {
|
23154 |
|
23155 | ariaEl.setAttribute('aria-live', priority);
|
23156 |
|
23157 | labelEl.removeAttribute(ARIA_LIVE_LABEL_TEXT_ATTR);
|
23158 |
|
23159 | labelEl.textContent = labelText;
|
23160 | }, ARIA_LIVE_DELAY_MS);
|
23161 | }
|
23162 | exports.announce = announce;
|
23163 |
|
23164 | }),
|
23165 |
|
23166 | "./packages/mdc-switch/adapter.ts":
|
23167 |
|
23168 |
|
23169 |
|
23170 |
|
23171 | (function(module, exports, __webpack_require__) {
|
23172 |
|
23173 | "use strict";
|
23174 |
|
23175 |
|
23176 |
|
23177 |
|
23178 |
|
23179 |
|
23180 |
|
23181 |
|
23182 |
|
23183 |
|
23184 |
|
23185 |
|
23186 |
|
23187 |
|
23188 |
|
23189 |
|
23190 |
|
23191 |
|
23192 |
|
23193 |
|
23194 |
|
23195 |
|
23196 |
|
23197 |
|
23198 | Object.defineProperty(exports, "__esModule", { value: true });
|
23199 |
|
23200 | }),
|
23201 |
|
23202 | "./packages/mdc-switch/component.ts":
|
23203 |
|
23204 |
|
23205 |
|
23206 |
|
23207 | (function(module, exports, __webpack_require__) {
|
23208 |
|
23209 | "use strict";
|
23210 |
|
23211 |
|
23212 |
|
23213 |
|
23214 |
|
23215 |
|
23216 |
|
23217 |
|
23218 |
|
23219 |
|
23220 |
|
23221 |
|
23222 |
|
23223 |
|
23224 |
|
23225 |
|
23226 |
|
23227 |
|
23228 |
|
23229 |
|
23230 |
|
23231 |
|
23232 |
|
23233 |
|
23234 | var __extends = this && this.__extends || function () {
|
23235 | var _extendStatics = function extendStatics(d, b) {
|
23236 | _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
|
23237 | d.__proto__ = b;
|
23238 | } || function (d, b) {
|
23239 | for (var p in b) {
|
23240 | if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
23241 | }
|
23242 | };
|
23243 | return _extendStatics(d, b);
|
23244 | };
|
23245 | return function (d, b) {
|
23246 | if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
23247 | _extendStatics(d, b);
|
23248 | function __() {
|
23249 | this.constructor = d;
|
23250 | }
|
23251 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
23252 | };
|
23253 | }();
|
23254 | var __assign = this && this.__assign || function () {
|
23255 | __assign = Object.assign || function (t) {
|
23256 | for (var s, i = 1, n = arguments.length; i < n; i++) {
|
23257 | s = arguments[i];
|
23258 | for (var p in s) {
|
23259 | if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
23260 | }
|
23261 | }
|
23262 | return t;
|
23263 | };
|
23264 | return __assign.apply(this, arguments);
|
23265 | };
|
23266 | Object.defineProperty(exports, "__esModule", { value: true });
|
23267 | exports.MDCSwitch = void 0;
|
23268 | var component_1 = __webpack_require__( "./packages/mdc-base/component.ts");
|
23269 | var component_2 = __webpack_require__( "./packages/mdc-ripple/component.ts");
|
23270 | var foundation_1 = __webpack_require__( "./packages/mdc-ripple/foundation.ts");
|
23271 | var constants_1 = __webpack_require__( "./packages/mdc-switch/constants.ts");
|
23272 | var foundation_2 = __webpack_require__( "./packages/mdc-switch/foundation.ts");
|
23273 |
|
23274 |
|
23275 |
|
23276 | var MDCSwitch = function (_super) {
|
23277 | __extends(MDCSwitch, _super);
|
23278 | function MDCSwitch(root, foundation) {
|
23279 | var _this = _super.call(this, root, foundation) || this;
|
23280 | _this.root = root;
|
23281 | return _this;
|
23282 | }
|
23283 | |
23284 |
|
23285 |
|
23286 |
|
23287 |
|
23288 | MDCSwitch.attachTo = function (root) {
|
23289 | return new MDCSwitch(root);
|
23290 | };
|
23291 | MDCSwitch.prototype.initialize = function () {
|
23292 | this.ripple = new component_2.MDCRipple(this.root, this.createRippleFoundation());
|
23293 | };
|
23294 | MDCSwitch.prototype.initialSyncWithDOM = function () {
|
23295 | var rippleElement = this.root.querySelector(constants_1.Selectors.RIPPLE);
|
23296 | if (!rippleElement) {
|
23297 | throw new Error("Switch " + constants_1.Selectors.RIPPLE + " element is required.");
|
23298 | }
|
23299 | this.rippleElement = rippleElement;
|
23300 | this.root.addEventListener('click', this.foundation.handleClick);
|
23301 | this.foundation.initFromDOM();
|
23302 | };
|
23303 | MDCSwitch.prototype.destroy = function () {
|
23304 | _super.prototype.destroy.call(this);
|
23305 | this.ripple.destroy();
|
23306 | this.root.removeEventListener('click', this.foundation.handleClick);
|
23307 | };
|
23308 | MDCSwitch.prototype.getDefaultFoundation = function () {
|
23309 | return new foundation_2.MDCSwitchRenderFoundation(this.createAdapter());
|
23310 | };
|
23311 | MDCSwitch.prototype.createAdapter = function () {
|
23312 | var _this = this;
|
23313 | return {
|
23314 | addClass: function addClass(className) {
|
23315 | _this.root.classList.add(className);
|
23316 | },
|
23317 | hasClass: function hasClass(className) {
|
23318 | return _this.root.classList.contains(className);
|
23319 | },
|
23320 | isDisabled: function isDisabled() {
|
23321 | return _this.root.disabled;
|
23322 | },
|
23323 | removeClass: function removeClass(className) {
|
23324 | _this.root.classList.remove(className);
|
23325 | },
|
23326 | setAriaChecked: function setAriaChecked(ariaChecked) {
|
23327 | return _this.root.setAttribute('aria-checked', ariaChecked);
|
23328 | },
|
23329 | setDisabled: function setDisabled(disabled) {
|
23330 | _this.root.disabled = disabled;
|
23331 | },
|
23332 | state: this
|
23333 | };
|
23334 | };
|
23335 | MDCSwitch.prototype.createRippleFoundation = function () {
|
23336 | return new foundation_1.MDCRippleFoundation(this.createRippleAdapter());
|
23337 | };
|
23338 | MDCSwitch.prototype.createRippleAdapter = function () {
|
23339 | var _this = this;
|
23340 | return __assign(__assign({}, component_2.MDCRipple.createAdapter(this)), { computeBoundingRect: function computeBoundingRect() {
|
23341 | return _this.rippleElement.getBoundingClientRect();
|
23342 | }, isUnbounded: function isUnbounded() {
|
23343 | return true;
|
23344 | } });
|
23345 | };
|
23346 | return MDCSwitch;
|
23347 | }(component_1.MDCComponent);
|
23348 | exports.MDCSwitch = MDCSwitch;
|
23349 |
|
23350 | }),
|
23351 |
|
23352 | "./packages/mdc-switch/constants.ts":
|
23353 |
|
23354 |
|
23355 |
|
23356 |
|
23357 | (function(module, exports, __webpack_require__) {
|
23358 |
|
23359 | "use strict";
|
23360 |
|
23361 |
|
23362 |
|
23363 |
|
23364 |
|
23365 |
|
23366 |
|
23367 |
|
23368 |
|
23369 |
|
23370 |
|
23371 |
|
23372 |
|
23373 |
|
23374 |
|
23375 |
|
23376 |
|
23377 |
|
23378 |
|
23379 |
|
23380 |
|
23381 |
|
23382 |
|
23383 |
|
23384 | Object.defineProperty(exports, "__esModule", { value: true });
|
23385 | exports.Selectors = exports.CssClasses = void 0;
|
23386 |
|
23387 |
|
23388 |
|
23389 | var CssClasses;
|
23390 | (function (CssClasses) {
|
23391 | CssClasses["PROCESSING"] = "mdc-switch--processing";
|
23392 | CssClasses["SELECTED"] = "mdc-switch--selected";
|
23393 | CssClasses["UNSELECTED"] = "mdc-switch--unselected";
|
23394 | })(CssClasses = exports.CssClasses || (exports.CssClasses = {}));
|
23395 |
|
23396 |
|
23397 |
|
23398 | var Selectors;
|
23399 | (function (Selectors) {
|
23400 | Selectors["RIPPLE"] = ".mdc-switch__ripple";
|
23401 | })(Selectors = exports.Selectors || (exports.Selectors = {}));
|
23402 |
|
23403 | }),
|
23404 |
|
23405 | "./packages/mdc-switch/deprecated/adapter.ts":
|
23406 |
|
23407 |
|
23408 |
|
23409 |
|
23410 | (function(module, exports, __webpack_require__) {
|
23411 |
|
23412 | "use strict";
|
23413 |
|
23414 |
|
23415 |
|
23416 |
|
23417 |
|
23418 |
|
23419 |
|
23420 |
|
23421 |
|
23422 |
|
23423 |
|
23424 |
|
23425 |
|
23426 |
|
23427 |
|
23428 |
|
23429 |
|
23430 |
|
23431 |
|
23432 |
|
23433 |
|
23434 |
|
23435 |
|
23436 |
|
23437 | Object.defineProperty(exports, "__esModule", { value: true });
|
23438 |
|
23439 | }),
|
23440 |
|
23441 | "./packages/mdc-switch/deprecated/component.ts":
|
23442 |
|
23443 |
|
23444 |
|
23445 |
|
23446 | (function(module, exports, __webpack_require__) {
|
23447 |
|
23448 | "use strict";
|
23449 |
|
23450 |
|
23451 |
|
23452 |
|
23453 |
|
23454 |
|
23455 |
|
23456 |
|
23457 |
|
23458 |
|
23459 |
|
23460 |
|
23461 |
|
23462 |
|
23463 |
|
23464 |
|
23465 |
|
23466 |
|
23467 |
|
23468 |
|
23469 |
|
23470 |
|
23471 |
|
23472 |
|
23473 | var __extends = this && this.__extends || function () {
|
23474 | var _extendStatics = function extendStatics(d, b) {
|
23475 | _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
|
23476 | d.__proto__ = b;
|
23477 | } || function (d, b) {
|
23478 | for (var p in b) {
|
23479 | if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
23480 | }
|
23481 | };
|
23482 | return _extendStatics(d, b);
|
23483 | };
|
23484 | return function (d, b) {
|
23485 | if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
23486 | _extendStatics(d, b);
|
23487 | function __() {
|
23488 | this.constructor = d;
|
23489 | }
|
23490 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
23491 | };
|
23492 | }();
|
23493 | var __assign = this && this.__assign || function () {
|
23494 | __assign = Object.assign || function (t) {
|
23495 | for (var s, i = 1, n = arguments.length; i < n; i++) {
|
23496 | s = arguments[i];
|
23497 | for (var p in s) {
|
23498 | if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
23499 | }
|
23500 | }
|
23501 | return t;
|
23502 | };
|
23503 | return __assign.apply(this, arguments);
|
23504 | };
|
23505 | var __read = this && this.__read || function (o, n) {
|
23506 | var m = typeof Symbol === "function" && o[Symbol.iterator];
|
23507 | if (!m) return o;
|
23508 | var i = m.call(o),
|
23509 | r,
|
23510 | ar = [],
|
23511 | e;
|
23512 | try {
|
23513 | while ((n === void 0 || n-- > 0) && !(r = i.next()).done) {
|
23514 | ar.push(r.value);
|
23515 | }
|
23516 | } catch (error) {
|
23517 | e = { error: error };
|
23518 | } finally {
|
23519 | try {
|
23520 | if (r && !r.done && (m = i["return"])) m.call(i);
|
23521 | } finally {
|
23522 | if (e) throw e.error;
|
23523 | }
|
23524 | }
|
23525 | return ar;
|
23526 | };
|
23527 | var __spreadArray = this && this.__spreadArray || function (to, from) {
|
23528 | for (var i = 0, il = from.length, j = to.length; i < il; i++, j++) {
|
23529 | to[j] = from[i];
|
23530 | }return to;
|
23531 | };
|
23532 | Object.defineProperty(exports, "__esModule", { value: true });
|
23533 | exports.MDCSwitch = void 0;
|
23534 | var component_1 = __webpack_require__( "./packages/mdc-base/component.ts");
|
23535 | var events_1 = __webpack_require__( "./packages/mdc-dom/events.ts");
|
23536 | var ponyfill_1 = __webpack_require__( "./packages/mdc-dom/ponyfill.ts");
|
23537 | var component_2 = __webpack_require__( "./packages/mdc-ripple/component.ts");
|
23538 | var foundation_1 = __webpack_require__( "./packages/mdc-ripple/foundation.ts");
|
23539 | var foundation_2 = __webpack_require__( "./packages/mdc-switch/deprecated/foundation.ts");
|
23540 | var MDCSwitch = function (_super) {
|
23541 | __extends(MDCSwitch, _super);
|
23542 | function MDCSwitch() {
|
23543 | var _this = _super !== null && _super.apply(this, arguments) || this;
|
23544 | _this.rippleSurface = _this.createRipple();
|
23545 | return _this;
|
23546 | }
|
23547 | MDCSwitch.attachTo = function (root) {
|
23548 | return new MDCSwitch(root);
|
23549 | };
|
23550 | MDCSwitch.prototype.destroy = function () {
|
23551 | _super.prototype.destroy.call(this);
|
23552 | this.rippleSurface.destroy();
|
23553 | this.nativeControl.removeEventListener('change', this.changeHandler);
|
23554 | };
|
23555 | MDCSwitch.prototype.initialSyncWithDOM = function () {
|
23556 | var _this = this;
|
23557 | this.changeHandler = function () {
|
23558 | var _a;
|
23559 | var args = [];
|
23560 | for (var _i = 0; _i < arguments.length; _i++) {
|
23561 | args[_i] = arguments[_i];
|
23562 | }
|
23563 | (_a = _this.foundation).handleChange.apply(_a, __spreadArray([], __read(args)));
|
23564 | };
|
23565 | this.nativeControl.addEventListener('change', this.changeHandler);
|
23566 |
|
23567 |
|
23568 |
|
23569 | this.checked = this.checked;
|
23570 | };
|
23571 | MDCSwitch.prototype.getDefaultFoundation = function () {
|
23572 | var _this = this;
|
23573 |
|
23574 |
|
23575 | var adapter = {
|
23576 | addClass: function addClass(className) {
|
23577 | return _this.root.classList.add(className);
|
23578 | },
|
23579 | removeClass: function removeClass(className) {
|
23580 | return _this.root.classList.remove(className);
|
23581 | },
|
23582 | setNativeControlChecked: function setNativeControlChecked(checked) {
|
23583 | return _this.nativeControl.checked = checked;
|
23584 | },
|
23585 | setNativeControlDisabled: function setNativeControlDisabled(disabled) {
|
23586 | return _this.nativeControl.disabled = disabled;
|
23587 | },
|
23588 | setNativeControlAttr: function setNativeControlAttr(attr, value) {
|
23589 | _this.nativeControl.setAttribute(attr, value);
|
23590 | }
|
23591 | };
|
23592 | return new foundation_2.MDCSwitchFoundation(adapter);
|
23593 | };
|
23594 | Object.defineProperty(MDCSwitch.prototype, "ripple", {
|
23595 | get: function get() {
|
23596 | return this.rippleSurface;
|
23597 | },
|
23598 | enumerable: false,
|
23599 | configurable: true
|
23600 | });
|
23601 | Object.defineProperty(MDCSwitch.prototype, "checked", {
|
23602 | get: function get() {
|
23603 | return this.nativeControl.checked;
|
23604 | },
|
23605 | set: function set(checked) {
|
23606 | this.foundation.setChecked(checked);
|
23607 | },
|
23608 | enumerable: false,
|
23609 | configurable: true
|
23610 | });
|
23611 | Object.defineProperty(MDCSwitch.prototype, "disabled", {
|
23612 | get: function get() {
|
23613 | return this.nativeControl.disabled;
|
23614 | },
|
23615 | set: function set(disabled) {
|
23616 | this.foundation.setDisabled(disabled);
|
23617 | },
|
23618 | enumerable: false,
|
23619 | configurable: true
|
23620 | });
|
23621 | MDCSwitch.prototype.createRipple = function () {
|
23622 | var _this = this;
|
23623 | var RIPPLE_SURFACE_SELECTOR = foundation_2.MDCSwitchFoundation.strings.RIPPLE_SURFACE_SELECTOR;
|
23624 | var rippleSurface = this.root.querySelector(RIPPLE_SURFACE_SELECTOR);
|
23625 |
|
23626 |
|
23627 | var adapter = __assign(__assign({}, component_2.MDCRipple.createAdapter(this)), { addClass: function addClass(className) {
|
23628 | return rippleSurface.classList.add(className);
|
23629 | }, computeBoundingRect: function computeBoundingRect() {
|
23630 | return rippleSurface.getBoundingClientRect();
|
23631 | }, deregisterInteractionHandler: function deregisterInteractionHandler(evtType, handler) {
|
23632 | _this.nativeControl.removeEventListener(evtType, handler, events_1.applyPassive());
|
23633 | }, isSurfaceActive: function isSurfaceActive() {
|
23634 | return ponyfill_1.matches(_this.nativeControl, ':active');
|
23635 | }, isUnbounded: function isUnbounded() {
|
23636 | return true;
|
23637 | }, registerInteractionHandler: function registerInteractionHandler(evtType, handler) {
|
23638 | _this.nativeControl.addEventListener(evtType, handler, events_1.applyPassive());
|
23639 | }, removeClass: function removeClass(className) {
|
23640 | rippleSurface.classList.remove(className);
|
23641 | }, updateCssVariable: function updateCssVariable(varName, value) {
|
23642 | rippleSurface.style.setProperty(varName, value);
|
23643 | } });
|
23644 | return new component_2.MDCRipple(this.root, new foundation_1.MDCRippleFoundation(adapter));
|
23645 | };
|
23646 | Object.defineProperty(MDCSwitch.prototype, "nativeControl", {
|
23647 | get: function get() {
|
23648 | var NATIVE_CONTROL_SELECTOR = foundation_2.MDCSwitchFoundation.strings.NATIVE_CONTROL_SELECTOR;
|
23649 | return this.root.querySelector(NATIVE_CONTROL_SELECTOR);
|
23650 | },
|
23651 | enumerable: false,
|
23652 | configurable: true
|
23653 | });
|
23654 | return MDCSwitch;
|
23655 | }(component_1.MDCComponent);
|
23656 | exports.MDCSwitch = MDCSwitch;
|
23657 |
|
23658 | }),
|
23659 |
|
23660 | "./packages/mdc-switch/deprecated/constants.ts":
|
23661 |
|
23662 |
|
23663 |
|
23664 |
|
23665 | (function(module, exports, __webpack_require__) {
|
23666 |
|
23667 | "use strict";
|
23668 |
|
23669 |
|
23670 |
|
23671 |
|
23672 |
|
23673 |
|
23674 |
|
23675 |
|
23676 |
|
23677 |
|
23678 |
|
23679 |
|
23680 |
|
23681 |
|
23682 |
|
23683 |
|
23684 |
|
23685 |
|
23686 |
|
23687 |
|
23688 |
|
23689 |
|
23690 |
|
23691 |
|
23692 | Object.defineProperty(exports, "__esModule", { value: true });
|
23693 | exports.strings = exports.cssClasses = void 0;
|
23694 |
|
23695 | var cssClasses = {
|
23696 |
|
23697 | CHECKED: 'mdc-switch--checked',
|
23698 |
|
23699 | DISABLED: 'mdc-switch--disabled'
|
23700 | };
|
23701 | exports.cssClasses = cssClasses;
|
23702 |
|
23703 | var strings = {
|
23704 |
|
23705 | ARIA_CHECKED_ATTR: 'aria-checked',
|
23706 |
|
23707 | NATIVE_CONTROL_SELECTOR: '.mdc-switch__native-control',
|
23708 |
|
23709 | RIPPLE_SURFACE_SELECTOR: '.mdc-switch__thumb-underlay'
|
23710 | };
|
23711 | exports.strings = strings;
|
23712 |
|
23713 | }),
|
23714 |
|
23715 | "./packages/mdc-switch/deprecated/foundation.ts":
|
23716 |
|
23717 |
|
23718 |
|
23719 |
|
23720 | (function(module, exports, __webpack_require__) {
|
23721 |
|
23722 | "use strict";
|
23723 |
|
23724 |
|
23725 |
|
23726 |
|
23727 |
|
23728 |
|
23729 |
|
23730 |
|
23731 |
|
23732 |
|
23733 |
|
23734 |
|
23735 |
|
23736 |
|
23737 |
|
23738 |
|
23739 |
|
23740 |
|
23741 |
|
23742 |
|
23743 |
|
23744 |
|
23745 |
|
23746 |
|
23747 | var __extends = this && this.__extends || function () {
|
23748 | var _extendStatics = function extendStatics(d, b) {
|
23749 | _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
|
23750 | d.__proto__ = b;
|
23751 | } || function (d, b) {
|
23752 | for (var p in b) {
|
23753 | if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
23754 | }
|
23755 | };
|
23756 | return _extendStatics(d, b);
|
23757 | };
|
23758 | return function (d, b) {
|
23759 | if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
23760 | _extendStatics(d, b);
|
23761 | function __() {
|
23762 | this.constructor = d;
|
23763 | }
|
23764 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
23765 | };
|
23766 | }();
|
23767 | var __assign = this && this.__assign || function () {
|
23768 | __assign = Object.assign || function (t) {
|
23769 | for (var s, i = 1, n = arguments.length; i < n; i++) {
|
23770 | s = arguments[i];
|
23771 | for (var p in s) {
|
23772 | if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
23773 | }
|
23774 | }
|
23775 | return t;
|
23776 | };
|
23777 | return __assign.apply(this, arguments);
|
23778 | };
|
23779 | Object.defineProperty(exports, "__esModule", { value: true });
|
23780 | exports.MDCSwitchFoundation = void 0;
|
23781 | var foundation_1 = __webpack_require__( "./packages/mdc-base/foundation.ts");
|
23782 | var constants_1 = __webpack_require__( "./packages/mdc-switch/deprecated/constants.ts");
|
23783 | var MDCSwitchFoundation = function (_super) {
|
23784 | __extends(MDCSwitchFoundation, _super);
|
23785 | function MDCSwitchFoundation(adapter) {
|
23786 | return _super.call(this, __assign(__assign({}, MDCSwitchFoundation.defaultAdapter), adapter)) || this;
|
23787 | }
|
23788 | Object.defineProperty(MDCSwitchFoundation, "strings", {
|
23789 |
|
23790 | get: function get() {
|
23791 | return constants_1.strings;
|
23792 | },
|
23793 | enumerable: false,
|
23794 | configurable: true
|
23795 | });
|
23796 | Object.defineProperty(MDCSwitchFoundation, "cssClasses", {
|
23797 |
|
23798 | get: function get() {
|
23799 | return constants_1.cssClasses;
|
23800 | },
|
23801 | enumerable: false,
|
23802 | configurable: true
|
23803 | });
|
23804 | Object.defineProperty(MDCSwitchFoundation, "defaultAdapter", {
|
23805 |
|
23806 | get: function get() {
|
23807 | return {
|
23808 | addClass: function addClass() {
|
23809 | return undefined;
|
23810 | },
|
23811 | removeClass: function removeClass() {
|
23812 | return undefined;
|
23813 | },
|
23814 | setNativeControlChecked: function setNativeControlChecked() {
|
23815 | return undefined;
|
23816 | },
|
23817 | setNativeControlDisabled: function setNativeControlDisabled() {
|
23818 | return undefined;
|
23819 | },
|
23820 | setNativeControlAttr: function setNativeControlAttr() {
|
23821 | return undefined;
|
23822 | }
|
23823 | };
|
23824 | },
|
23825 | enumerable: false,
|
23826 | configurable: true
|
23827 | });
|
23828 |
|
23829 | MDCSwitchFoundation.prototype.setChecked = function (checked) {
|
23830 | this.adapter.setNativeControlChecked(checked);
|
23831 | this.updateAriaChecked(checked);
|
23832 | this.updateCheckedStyling(checked);
|
23833 | };
|
23834 |
|
23835 | MDCSwitchFoundation.prototype.setDisabled = function (disabled) {
|
23836 | this.adapter.setNativeControlDisabled(disabled);
|
23837 | if (disabled) {
|
23838 | this.adapter.addClass(constants_1.cssClasses.DISABLED);
|
23839 | } else {
|
23840 | this.adapter.removeClass(constants_1.cssClasses.DISABLED);
|
23841 | }
|
23842 | };
|
23843 |
|
23844 | MDCSwitchFoundation.prototype.handleChange = function (evt) {
|
23845 | var nativeControl = evt.target;
|
23846 | this.updateAriaChecked(nativeControl.checked);
|
23847 | this.updateCheckedStyling(nativeControl.checked);
|
23848 | };
|
23849 |
|
23850 | MDCSwitchFoundation.prototype.updateCheckedStyling = function (checked) {
|
23851 | if (checked) {
|
23852 | this.adapter.addClass(constants_1.cssClasses.CHECKED);
|
23853 | } else {
|
23854 | this.adapter.removeClass(constants_1.cssClasses.CHECKED);
|
23855 | }
|
23856 | };
|
23857 | MDCSwitchFoundation.prototype.updateAriaChecked = function (checked) {
|
23858 | this.adapter.setNativeControlAttr(constants_1.strings.ARIA_CHECKED_ATTR, "" + !!checked);
|
23859 | };
|
23860 | return MDCSwitchFoundation;
|
23861 | }(foundation_1.MDCFoundation);
|
23862 | exports.MDCSwitchFoundation = MDCSwitchFoundation;
|
23863 |
|
23864 | exports.default = MDCSwitchFoundation;
|
23865 |
|
23866 | }),
|
23867 |
|
23868 | "./packages/mdc-switch/deprecated/index.ts":
|
23869 |
|
23870 |
|
23871 |
|
23872 |
|
23873 | (function(module, exports, __webpack_require__) {
|
23874 |
|
23875 | "use strict";
|
23876 |
|
23877 |
|
23878 |
|
23879 |
|
23880 |
|
23881 |
|
23882 |
|
23883 |
|
23884 |
|
23885 |
|
23886 |
|
23887 |
|
23888 |
|
23889 |
|
23890 |
|
23891 |
|
23892 |
|
23893 |
|
23894 |
|
23895 |
|
23896 |
|
23897 |
|
23898 |
|
23899 |
|
23900 | var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
|
23901 | if (k2 === undefined) k2 = k;
|
23902 | Object.defineProperty(o, k2, { enumerable: true, get: function get() {
|
23903 | return m[k];
|
23904 | } });
|
23905 | } : function (o, m, k, k2) {
|
23906 | if (k2 === undefined) k2 = k;
|
23907 | o[k2] = m[k];
|
23908 | });
|
23909 | var __exportStar = this && this.__exportStar || function (m, exports) {
|
23910 | for (var p in m) {
|
23911 | if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
23912 | }
|
23913 | };
|
23914 | Object.defineProperty(exports, "__esModule", { value: true });
|
23915 | __exportStar(__webpack_require__( "./packages/mdc-switch/deprecated/adapter.ts"), exports);
|
23916 | __exportStar(__webpack_require__( "./packages/mdc-switch/deprecated/component.ts"), exports);
|
23917 | __exportStar(__webpack_require__( "./packages/mdc-switch/deprecated/constants.ts"), exports);
|
23918 | __exportStar(__webpack_require__( "./packages/mdc-switch/deprecated/foundation.ts"), exports);
|
23919 |
|
23920 | }),
|
23921 |
|
23922 | "./packages/mdc-switch/foundation.ts":
|
23923 |
|
23924 |
|
23925 |
|
23926 |
|
23927 | (function(module, exports, __webpack_require__) {
|
23928 |
|
23929 | "use strict";
|
23930 |
|
23931 |
|
23932 |
|
23933 |
|
23934 |
|
23935 |
|
23936 |
|
23937 |
|
23938 |
|
23939 |
|
23940 |
|
23941 |
|
23942 |
|
23943 |
|
23944 |
|
23945 |
|
23946 |
|
23947 |
|
23948 |
|
23949 |
|
23950 |
|
23951 |
|
23952 |
|
23953 |
|
23954 | var __extends = this && this.__extends || function () {
|
23955 | var _extendStatics = function extendStatics(d, b) {
|
23956 | _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
|
23957 | d.__proto__ = b;
|
23958 | } || function (d, b) {
|
23959 | for (var p in b) {
|
23960 | if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
23961 | }
|
23962 | };
|
23963 | return _extendStatics(d, b);
|
23964 | };
|
23965 | return function (d, b) {
|
23966 | if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
23967 | _extendStatics(d, b);
|
23968 | function __() {
|
23969 | this.constructor = d;
|
23970 | }
|
23971 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
23972 | };
|
23973 | }();
|
23974 | Object.defineProperty(exports, "__esModule", { value: true });
|
23975 | exports.MDCSwitchRenderFoundation = exports.MDCSwitchFoundation = void 0;
|
23976 | var observer_foundation_1 = __webpack_require__( "./packages/mdc-base/observer-foundation.ts");
|
23977 | var constants_1 = __webpack_require__( "./packages/mdc-switch/constants.ts");
|
23978 |
|
23979 |
|
23980 |
|
23981 |
|
23982 |
|
23983 |
|
23984 |
|
23985 | var MDCSwitchFoundation = function (_super) {
|
23986 | __extends(MDCSwitchFoundation, _super);
|
23987 | function MDCSwitchFoundation(adapter) {
|
23988 | var _this = _super.call(this, adapter) || this;
|
23989 | _this.handleClick = _this.handleClick.bind(_this);
|
23990 | return _this;
|
23991 | }
|
23992 | |
23993 |
|
23994 |
|
23995 | MDCSwitchFoundation.prototype.init = function () {
|
23996 | this.observe(this.adapter.state, {
|
23997 | disabled: this.stopProcessingIfDisabled,
|
23998 | processing: this.stopProcessingIfDisabled
|
23999 | });
|
24000 | };
|
24001 | |
24002 |
|
24003 |
|
24004 |
|
24005 | MDCSwitchFoundation.prototype.handleClick = function () {
|
24006 | if (this.adapter.state.disabled) {
|
24007 | return;
|
24008 | }
|
24009 | this.adapter.state.selected = !this.adapter.state.selected;
|
24010 | };
|
24011 | MDCSwitchFoundation.prototype.stopProcessingIfDisabled = function () {
|
24012 | if (this.adapter.state.disabled) {
|
24013 | this.adapter.state.processing = false;
|
24014 | }
|
24015 | };
|
24016 | return MDCSwitchFoundation;
|
24017 | }(observer_foundation_1.MDCObserverFoundation);
|
24018 | exports.MDCSwitchFoundation = MDCSwitchFoundation;
|
24019 |
|
24020 |
|
24021 |
|
24022 |
|
24023 |
|
24024 |
|
24025 |
|
24026 |
|
24027 |
|
24028 |
|
24029 | var MDCSwitchRenderFoundation = function (_super) {
|
24030 | __extends(MDCSwitchRenderFoundation, _super);
|
24031 | function MDCSwitchRenderFoundation() {
|
24032 | return _super !== null && _super.apply(this, arguments) || this;
|
24033 | }
|
24034 | |
24035 |
|
24036 |
|
24037 | MDCSwitchRenderFoundation.prototype.init = function () {
|
24038 | _super.prototype.init.call(this);
|
24039 | this.observe(this.adapter.state, {
|
24040 | disabled: this.onDisabledChange,
|
24041 | processing: this.onProcessingChange,
|
24042 | selected: this.onSelectedChange
|
24043 | });
|
24044 | };
|
24045 | |
24046 |
|
24047 |
|
24048 |
|
24049 |
|
24050 |
|
24051 | MDCSwitchRenderFoundation.prototype.initFromDOM = function () {
|
24052 |
|
24053 | this.setObserversEnabled(this.adapter.state, false);
|
24054 | this.adapter.state.selected = this.adapter.hasClass(constants_1.CssClasses.SELECTED);
|
24055 |
|
24056 | this.onSelectedChange();
|
24057 | this.adapter.state.disabled = this.adapter.isDisabled();
|
24058 | this.adapter.state.processing = this.adapter.hasClass(constants_1.CssClasses.PROCESSING);
|
24059 |
|
24060 | this.setObserversEnabled(this.adapter.state, true);
|
24061 | this.stopProcessingIfDisabled();
|
24062 | };
|
24063 | MDCSwitchRenderFoundation.prototype.onDisabledChange = function () {
|
24064 | this.adapter.setDisabled(this.adapter.state.disabled);
|
24065 | };
|
24066 | MDCSwitchRenderFoundation.prototype.onProcessingChange = function () {
|
24067 | this.toggleClass(this.adapter.state.processing, constants_1.CssClasses.PROCESSING);
|
24068 | };
|
24069 | MDCSwitchRenderFoundation.prototype.onSelectedChange = function () {
|
24070 | this.adapter.setAriaChecked(String(this.adapter.state.selected));
|
24071 | this.toggleClass(this.adapter.state.selected, constants_1.CssClasses.SELECTED);
|
24072 | this.toggleClass(!this.adapter.state.selected, constants_1.CssClasses.UNSELECTED);
|
24073 | };
|
24074 | MDCSwitchRenderFoundation.prototype.toggleClass = function (addClass, className) {
|
24075 | if (addClass) {
|
24076 | this.adapter.addClass(className);
|
24077 | } else {
|
24078 | this.adapter.removeClass(className);
|
24079 | }
|
24080 | };
|
24081 | return MDCSwitchRenderFoundation;
|
24082 | }(MDCSwitchFoundation);
|
24083 | exports.MDCSwitchRenderFoundation = MDCSwitchRenderFoundation;
|
24084 |
|
24085 | }),
|
24086 |
|
24087 | "./packages/mdc-switch/index.ts":
|
24088 |
|
24089 |
|
24090 |
|
24091 |
|
24092 | (function(module, exports, __webpack_require__) {
|
24093 |
|
24094 | "use strict";
|
24095 |
|
24096 |
|
24097 |
|
24098 |
|
24099 |
|
24100 |
|
24101 |
|
24102 |
|
24103 |
|
24104 |
|
24105 |
|
24106 |
|
24107 |
|
24108 |
|
24109 |
|
24110 |
|
24111 |
|
24112 |
|
24113 |
|
24114 |
|
24115 |
|
24116 |
|
24117 |
|
24118 |
|
24119 | var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
|
24120 | if (k2 === undefined) k2 = k;
|
24121 | Object.defineProperty(o, k2, { enumerable: true, get: function get() {
|
24122 | return m[k];
|
24123 | } });
|
24124 | } : function (o, m, k, k2) {
|
24125 | if (k2 === undefined) k2 = k;
|
24126 | o[k2] = m[k];
|
24127 | });
|
24128 | var __setModuleDefault = this && this.__setModuleDefault || (Object.create ? function (o, v) {
|
24129 | Object.defineProperty(o, "default", { enumerable: true, value: v });
|
24130 | } : function (o, v) {
|
24131 | o["default"] = v;
|
24132 | });
|
24133 | var __importStar = this && this.__importStar || function (mod) {
|
24134 | if (mod && mod.__esModule) return mod;
|
24135 | var result = {};
|
24136 | if (mod != null) for (var k in mod) {
|
24137 | if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
24138 | }__setModuleDefault(result, mod);
|
24139 | return result;
|
24140 | };
|
24141 | var __exportStar = this && this.__exportStar || function (m, exports) {
|
24142 | for (var p in m) {
|
24143 | if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
24144 | }
|
24145 | };
|
24146 | Object.defineProperty(exports, "__esModule", { value: true });
|
24147 | exports.deprecated = void 0;
|
24148 |
|
24149 | var deprecated = __importStar(__webpack_require__( "./packages/mdc-switch/deprecated/index.ts"));
|
24150 | exports.deprecated = deprecated;
|
24151 | __exportStar(__webpack_require__( "./packages/mdc-switch/adapter.ts"), exports);
|
24152 | __exportStar(__webpack_require__( "./packages/mdc-switch/component.ts"), exports);
|
24153 | __exportStar(__webpack_require__( "./packages/mdc-switch/constants.ts"), exports);
|
24154 | __exportStar(__webpack_require__( "./packages/mdc-switch/foundation.ts"), exports);
|
24155 |
|
24156 | }),
|
24157 |
|
24158 | "./packages/mdc-tab-bar/adapter.ts":
|
24159 |
|
24160 |
|
24161 |
|
24162 |
|
24163 | (function(module, exports, __webpack_require__) {
|
24164 |
|
24165 | "use strict";
|
24166 |
|
24167 |
|
24168 |
|
24169 |
|
24170 |
|
24171 |
|
24172 |
|
24173 |
|
24174 |
|
24175 |
|
24176 |
|
24177 |
|
24178 |
|
24179 |
|
24180 |
|
24181 |
|
24182 |
|
24183 |
|
24184 |
|
24185 |
|
24186 |
|
24187 |
|
24188 |
|
24189 |
|
24190 | Object.defineProperty(exports, "__esModule", { value: true });
|
24191 |
|
24192 | }),
|
24193 |
|
24194 | "./packages/mdc-tab-bar/component.ts":
|
24195 |
|
24196 |
|
24197 |
|
24198 |
|
24199 | (function(module, exports, __webpack_require__) {
|
24200 |
|
24201 | "use strict";
|
24202 |
|
24203 |
|
24204 |
|
24205 |
|
24206 |
|
24207 |
|
24208 |
|
24209 |
|
24210 |
|
24211 |
|
24212 |
|
24213 |
|
24214 |
|
24215 |
|
24216 |
|
24217 |
|
24218 |
|
24219 |
|
24220 |
|
24221 |
|
24222 |
|
24223 |
|
24224 |
|
24225 |
|
24226 | var __extends = this && this.__extends || function () {
|
24227 | var _extendStatics = function extendStatics(d, b) {
|
24228 | _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
|
24229 | d.__proto__ = b;
|
24230 | } || function (d, b) {
|
24231 | for (var p in b) {
|
24232 | if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
24233 | }
|
24234 | };
|
24235 | return _extendStatics(d, b);
|
24236 | };
|
24237 | return function (d, b) {
|
24238 | if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
24239 | _extendStatics(d, b);
|
24240 | function __() {
|
24241 | this.constructor = d;
|
24242 | }
|
24243 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
24244 | };
|
24245 | }();
|
24246 | var __values = this && this.__values || function (o) {
|
24247 | var s = typeof Symbol === "function" && Symbol.iterator,
|
24248 | m = s && o[s],
|
24249 | i = 0;
|
24250 | if (m) return m.call(o);
|
24251 | if (o && typeof o.length === "number") return {
|
24252 | next: function next() {
|
24253 | if (o && i >= o.length) o = void 0;
|
24254 | return { value: o && o[i++], done: !o };
|
24255 | }
|
24256 | };
|
24257 | throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
24258 | };
|
24259 | Object.defineProperty(exports, "__esModule", { value: true });
|
24260 | exports.MDCTabBar = void 0;
|
24261 | var component_1 = __webpack_require__( "./packages/mdc-base/component.ts");
|
24262 | var component_2 = __webpack_require__( "./packages/mdc-tab-scroller/component.ts");
|
24263 | var component_3 = __webpack_require__( "./packages/mdc-tab/component.ts");
|
24264 | var foundation_1 = __webpack_require__( "./packages/mdc-tab/foundation.ts");
|
24265 | var foundation_2 = __webpack_require__( "./packages/mdc-tab-bar/foundation.ts");
|
24266 | var strings = foundation_2.MDCTabBarFoundation.strings;
|
24267 | var tabIdCounter = 0;
|
24268 | var MDCTabBar = function (_super) {
|
24269 | __extends(MDCTabBar, _super);
|
24270 | function MDCTabBar() {
|
24271 | return _super !== null && _super.apply(this, arguments) || this;
|
24272 | }
|
24273 | MDCTabBar.attachTo = function (root) {
|
24274 | return new MDCTabBar(root);
|
24275 | };
|
24276 | Object.defineProperty(MDCTabBar.prototype, "focusOnActivate", {
|
24277 | set: function set(focusOnActivate) {
|
24278 | var e_1, _a;
|
24279 | try {
|
24280 | for (var _b = __values(this.tabList), _c = _b.next(); !_c.done; _c = _b.next()) {
|
24281 | var tab = _c.value;
|
24282 | tab.focusOnActivate = focusOnActivate;
|
24283 | }
|
24284 | } catch (e_1_1) {
|
24285 | e_1 = { error: e_1_1 };
|
24286 | } finally {
|
24287 | try {
|
24288 | if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
24289 | } finally {
|
24290 | if (e_1) throw e_1.error;
|
24291 | }
|
24292 | }
|
24293 | },
|
24294 | enumerable: false,
|
24295 | configurable: true
|
24296 | });
|
24297 | Object.defineProperty(MDCTabBar.prototype, "useAutomaticActivation", {
|
24298 | set: function set(useAutomaticActivation) {
|
24299 | this.foundation.setUseAutomaticActivation(useAutomaticActivation);
|
24300 | },
|
24301 | enumerable: false,
|
24302 | configurable: true
|
24303 | });
|
24304 | MDCTabBar.prototype.initialize = function (tabFactory, tabScrollerFactory) {
|
24305 | if (tabFactory === void 0) {
|
24306 | tabFactory = function tabFactory(el) {
|
24307 | return new component_3.MDCTab(el);
|
24308 | };
|
24309 | }
|
24310 | if (tabScrollerFactory === void 0) {
|
24311 | tabScrollerFactory = function tabScrollerFactory(el) {
|
24312 | return new component_2.MDCTabScroller(el);
|
24313 | };
|
24314 | }
|
24315 | this.tabList = this.instantiateTabs(tabFactory);
|
24316 | this.tabScroller = this.instantiatetabScroller(tabScrollerFactory);
|
24317 | };
|
24318 | MDCTabBar.prototype.initialSyncWithDOM = function () {
|
24319 | var _this = this;
|
24320 | this.handleTabInteraction = function (evt) {
|
24321 | _this.foundation.handleTabInteraction(evt);
|
24322 | };
|
24323 | this.handleKeyDown = function (evt) {
|
24324 | _this.foundation.handleKeyDown(evt);
|
24325 | };
|
24326 | this.listen(foundation_1.MDCTabFoundation.strings.INTERACTED_EVENT, this.handleTabInteraction);
|
24327 | this.listen('keydown', this.handleKeyDown);
|
24328 | for (var i = 0; i < this.tabList.length; i++) {
|
24329 | if (this.tabList[i].active) {
|
24330 | this.scrollIntoView(i);
|
24331 | break;
|
24332 | }
|
24333 | }
|
24334 | };
|
24335 | MDCTabBar.prototype.destroy = function () {
|
24336 | var e_2, _a;
|
24337 | _super.prototype.destroy.call(this);
|
24338 | this.unlisten(foundation_1.MDCTabFoundation.strings.INTERACTED_EVENT, this.handleTabInteraction);
|
24339 | this.unlisten('keydown', this.handleKeyDown);
|
24340 | try {
|
24341 | for (var _b = __values(this.tabList), _c = _b.next(); !_c.done; _c = _b.next()) {
|
24342 | var tab = _c.value;
|
24343 | tab.destroy();
|
24344 | }
|
24345 | } catch (e_2_1) {
|
24346 | e_2 = { error: e_2_1 };
|
24347 | } finally {
|
24348 | try {
|
24349 | if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
24350 | } finally {
|
24351 | if (e_2) throw e_2.error;
|
24352 | }
|
24353 | }
|
24354 | if (this.tabScroller) {
|
24355 | this.tabScroller.destroy();
|
24356 | }
|
24357 | };
|
24358 | MDCTabBar.prototype.getDefaultFoundation = function () {
|
24359 | var _this = this;
|
24360 |
|
24361 |
|
24362 |
|
24363 | var adapter = {
|
24364 | scrollTo: function scrollTo(scrollX) {
|
24365 | _this.tabScroller.scrollTo(scrollX);
|
24366 | },
|
24367 | incrementScroll: function incrementScroll(scrollXIncrement) {
|
24368 | _this.tabScroller.incrementScroll(scrollXIncrement);
|
24369 | },
|
24370 | getScrollPosition: function getScrollPosition() {
|
24371 | return _this.tabScroller.getScrollPosition();
|
24372 | },
|
24373 | getScrollContentWidth: function getScrollContentWidth() {
|
24374 | return _this.tabScroller.getScrollContentWidth();
|
24375 | },
|
24376 | getOffsetWidth: function getOffsetWidth() {
|
24377 | return _this.root.offsetWidth;
|
24378 | },
|
24379 | isRTL: function isRTL() {
|
24380 | return window.getComputedStyle(_this.root).getPropertyValue('direction') === 'rtl';
|
24381 | },
|
24382 | setActiveTab: function setActiveTab(index) {
|
24383 | _this.foundation.activateTab(index);
|
24384 | },
|
24385 | activateTabAtIndex: function activateTabAtIndex(index, clientRect) {
|
24386 | _this.tabList[index].activate(clientRect);
|
24387 | },
|
24388 | deactivateTabAtIndex: function deactivateTabAtIndex(index) {
|
24389 | _this.tabList[index].deactivate();
|
24390 | },
|
24391 | focusTabAtIndex: function focusTabAtIndex(index) {
|
24392 | _this.tabList[index].focus();
|
24393 | },
|
24394 | getTabIndicatorClientRectAtIndex: function getTabIndicatorClientRectAtIndex(index) {
|
24395 | return _this.tabList[index].computeIndicatorClientRect();
|
24396 | },
|
24397 | getTabDimensionsAtIndex: function getTabDimensionsAtIndex(index) {
|
24398 | return _this.tabList[index].computeDimensions();
|
24399 | },
|
24400 | getPreviousActiveTabIndex: function getPreviousActiveTabIndex() {
|
24401 | for (var i = 0; i < _this.tabList.length; i++) {
|
24402 | if (_this.tabList[i].active) {
|
24403 | return i;
|
24404 | }
|
24405 | }
|
24406 | return -1;
|
24407 | },
|
24408 | getFocusedTabIndex: function getFocusedTabIndex() {
|
24409 | var tabElements = _this.getTabElements();
|
24410 | var activeElement = document.activeElement;
|
24411 | return tabElements.indexOf(activeElement);
|
24412 | },
|
24413 | getIndexOfTabById: function getIndexOfTabById(id) {
|
24414 | for (var i = 0; i < _this.tabList.length; i++) {
|
24415 | if (_this.tabList[i].id === id) {
|
24416 | return i;
|
24417 | }
|
24418 | }
|
24419 | return -1;
|
24420 | },
|
24421 | getTabListLength: function getTabListLength() {
|
24422 | return _this.tabList.length;
|
24423 | },
|
24424 | notifyTabActivated: function notifyTabActivated(index) {
|
24425 | return _this.emit(strings.TAB_ACTIVATED_EVENT, { index: index }, true);
|
24426 | }
|
24427 | };
|
24428 |
|
24429 | return new foundation_2.MDCTabBarFoundation(adapter);
|
24430 | };
|
24431 | |
24432 |
|
24433 |
|
24434 |
|
24435 | MDCTabBar.prototype.activateTab = function (index) {
|
24436 | this.foundation.activateTab(index);
|
24437 | };
|
24438 | |
24439 |
|
24440 |
|
24441 |
|
24442 | MDCTabBar.prototype.scrollIntoView = function (index) {
|
24443 | this.foundation.scrollIntoView(index);
|
24444 | };
|
24445 | |
24446 |
|
24447 |
|
24448 | MDCTabBar.prototype.getTabElements = function () {
|
24449 | return [].slice.call(this.root.querySelectorAll(strings.TAB_SELECTOR));
|
24450 | };
|
24451 | |
24452 |
|
24453 |
|
24454 | MDCTabBar.prototype.instantiateTabs = function (tabFactory) {
|
24455 | return this.getTabElements().map(function (el) {
|
24456 | el.id = el.id || "mdc-tab-" + ++tabIdCounter;
|
24457 | return tabFactory(el);
|
24458 | });
|
24459 | };
|
24460 | |
24461 |
|
24462 |
|
24463 | MDCTabBar.prototype.instantiatetabScroller = function (tabScrollerFactory) {
|
24464 | var tabScrollerElement = this.root.querySelector(strings.TAB_SCROLLER_SELECTOR);
|
24465 | if (tabScrollerElement) {
|
24466 | return tabScrollerFactory(tabScrollerElement);
|
24467 | }
|
24468 | return null;
|
24469 | };
|
24470 | return MDCTabBar;
|
24471 | }(component_1.MDCComponent);
|
24472 | exports.MDCTabBar = MDCTabBar;
|
24473 |
|
24474 | }),
|
24475 |
|
24476 | "./packages/mdc-tab-bar/constants.ts":
|
24477 |
|
24478 |
|
24479 |
|
24480 |
|
24481 | (function(module, exports, __webpack_require__) {
|
24482 |
|
24483 | "use strict";
|
24484 |
|
24485 |
|
24486 |
|
24487 |
|
24488 |
|
24489 |
|
24490 |
|
24491 |
|
24492 |
|
24493 |
|
24494 |
|
24495 |
|
24496 |
|
24497 |
|
24498 |
|
24499 |
|
24500 |
|
24501 |
|
24502 |
|
24503 |
|
24504 |
|
24505 |
|
24506 |
|
24507 |
|
24508 | Object.defineProperty(exports, "__esModule", { value: true });
|
24509 | exports.strings = exports.numbers = void 0;
|
24510 | var strings = {
|
24511 | ARROW_LEFT_KEY: 'ArrowLeft',
|
24512 | ARROW_RIGHT_KEY: 'ArrowRight',
|
24513 | END_KEY: 'End',
|
24514 | ENTER_KEY: 'Enter',
|
24515 | HOME_KEY: 'Home',
|
24516 | SPACE_KEY: 'Space',
|
24517 | TAB_ACTIVATED_EVENT: 'MDCTabBar:activated',
|
24518 | TAB_SCROLLER_SELECTOR: '.mdc-tab-scroller',
|
24519 | TAB_SELECTOR: '.mdc-tab'
|
24520 | };
|
24521 | exports.strings = strings;
|
24522 | var numbers = {
|
24523 | ARROW_LEFT_KEYCODE: 37,
|
24524 | ARROW_RIGHT_KEYCODE: 39,
|
24525 | END_KEYCODE: 35,
|
24526 | ENTER_KEYCODE: 13,
|
24527 | EXTRA_SCROLL_AMOUNT: 20,
|
24528 | HOME_KEYCODE: 36,
|
24529 | SPACE_KEYCODE: 32
|
24530 | };
|
24531 | exports.numbers = numbers;
|
24532 |
|
24533 | }),
|
24534 |
|
24535 | "./packages/mdc-tab-bar/foundation.ts":
|
24536 |
|
24537 |
|
24538 |
|
24539 |
|
24540 | (function(module, exports, __webpack_require__) {
|
24541 |
|
24542 | "use strict";
|
24543 |
|
24544 |
|
24545 |
|
24546 |
|
24547 |
|
24548 |
|
24549 |
|
24550 |
|
24551 |
|
24552 |
|
24553 |
|
24554 |
|
24555 |
|
24556 |
|
24557 |
|
24558 |
|
24559 |
|
24560 |
|
24561 |
|
24562 |
|
24563 |
|
24564 |
|
24565 |
|
24566 |
|
24567 | var __extends = this && this.__extends || function () {
|
24568 | var _extendStatics = function extendStatics(d, b) {
|
24569 | _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
|
24570 | d.__proto__ = b;
|
24571 | } || function (d, b) {
|
24572 | for (var p in b) {
|
24573 | if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
24574 | }
|
24575 | };
|
24576 | return _extendStatics(d, b);
|
24577 | };
|
24578 | return function (d, b) {
|
24579 | if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
24580 | _extendStatics(d, b);
|
24581 | function __() {
|
24582 | this.constructor = d;
|
24583 | }
|
24584 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
24585 | };
|
24586 | }();
|
24587 | var __assign = this && this.__assign || function () {
|
24588 | __assign = Object.assign || function (t) {
|
24589 | for (var s, i = 1, n = arguments.length; i < n; i++) {
|
24590 | s = arguments[i];
|
24591 | for (var p in s) {
|
24592 | if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
24593 | }
|
24594 | }
|
24595 | return t;
|
24596 | };
|
24597 | return __assign.apply(this, arguments);
|
24598 | };
|
24599 | Object.defineProperty(exports, "__esModule", { value: true });
|
24600 | exports.MDCTabBarFoundation = void 0;
|
24601 | var foundation_1 = __webpack_require__( "./packages/mdc-base/foundation.ts");
|
24602 | var constants_1 = __webpack_require__( "./packages/mdc-tab-bar/constants.ts");
|
24603 | var ACCEPTABLE_KEYS = new Set();
|
24604 |
|
24605 | ACCEPTABLE_KEYS.add(constants_1.strings.ARROW_LEFT_KEY);
|
24606 | ACCEPTABLE_KEYS.add(constants_1.strings.ARROW_RIGHT_KEY);
|
24607 | ACCEPTABLE_KEYS.add(constants_1.strings.END_KEY);
|
24608 | ACCEPTABLE_KEYS.add(constants_1.strings.HOME_KEY);
|
24609 | ACCEPTABLE_KEYS.add(constants_1.strings.ENTER_KEY);
|
24610 | ACCEPTABLE_KEYS.add(constants_1.strings.SPACE_KEY);
|
24611 | var KEYCODE_MAP = new Map();
|
24612 |
|
24613 | KEYCODE_MAP.set(constants_1.numbers.ARROW_LEFT_KEYCODE, constants_1.strings.ARROW_LEFT_KEY);
|
24614 | KEYCODE_MAP.set(constants_1.numbers.ARROW_RIGHT_KEYCODE, constants_1.strings.ARROW_RIGHT_KEY);
|
24615 | KEYCODE_MAP.set(constants_1.numbers.END_KEYCODE, constants_1.strings.END_KEY);
|
24616 | KEYCODE_MAP.set(constants_1.numbers.HOME_KEYCODE, constants_1.strings.HOME_KEY);
|
24617 | KEYCODE_MAP.set(constants_1.numbers.ENTER_KEYCODE, constants_1.strings.ENTER_KEY);
|
24618 | KEYCODE_MAP.set(constants_1.numbers.SPACE_KEYCODE, constants_1.strings.SPACE_KEY);
|
24619 | var MDCTabBarFoundation = function (_super) {
|
24620 | __extends(MDCTabBarFoundation, _super);
|
24621 | function MDCTabBarFoundation(adapter) {
|
24622 | var _this = _super.call(this, __assign(__assign({}, MDCTabBarFoundation.defaultAdapter), adapter)) || this;
|
24623 | _this.useAutomaticActivation = false;
|
24624 | return _this;
|
24625 | }
|
24626 | Object.defineProperty(MDCTabBarFoundation, "strings", {
|
24627 | get: function get() {
|
24628 | return constants_1.strings;
|
24629 | },
|
24630 | enumerable: false,
|
24631 | configurable: true
|
24632 | });
|
24633 | Object.defineProperty(MDCTabBarFoundation, "numbers", {
|
24634 | get: function get() {
|
24635 | return constants_1.numbers;
|
24636 | },
|
24637 | enumerable: false,
|
24638 | configurable: true
|
24639 | });
|
24640 | Object.defineProperty(MDCTabBarFoundation, "defaultAdapter", {
|
24641 | get: function get() {
|
24642 |
|
24643 | return {
|
24644 | scrollTo: function scrollTo() {
|
24645 | return undefined;
|
24646 | },
|
24647 | incrementScroll: function incrementScroll() {
|
24648 | return undefined;
|
24649 | },
|
24650 | getScrollPosition: function getScrollPosition() {
|
24651 | return 0;
|
24652 | },
|
24653 | getScrollContentWidth: function getScrollContentWidth() {
|
24654 | return 0;
|
24655 | },
|
24656 | getOffsetWidth: function getOffsetWidth() {
|
24657 | return 0;
|
24658 | },
|
24659 | isRTL: function isRTL() {
|
24660 | return false;
|
24661 | },
|
24662 | setActiveTab: function setActiveTab() {
|
24663 | return undefined;
|
24664 | },
|
24665 | activateTabAtIndex: function activateTabAtIndex() {
|
24666 | return undefined;
|
24667 | },
|
24668 | deactivateTabAtIndex: function deactivateTabAtIndex() {
|
24669 | return undefined;
|
24670 | },
|
24671 | focusTabAtIndex: function focusTabAtIndex() {
|
24672 | return undefined;
|
24673 | },
|
24674 | getTabIndicatorClientRectAtIndex: function getTabIndicatorClientRectAtIndex() {
|
24675 | return { top: 0, right: 0, bottom: 0, left: 0, width: 0, height: 0 };
|
24676 | },
|
24677 | getTabDimensionsAtIndex: function getTabDimensionsAtIndex() {
|
24678 | return { rootLeft: 0, rootRight: 0, contentLeft: 0, contentRight: 0 };
|
24679 | },
|
24680 | getPreviousActiveTabIndex: function getPreviousActiveTabIndex() {
|
24681 | return -1;
|
24682 | },
|
24683 | getFocusedTabIndex: function getFocusedTabIndex() {
|
24684 | return -1;
|
24685 | },
|
24686 | getIndexOfTabById: function getIndexOfTabById() {
|
24687 | return -1;
|
24688 | },
|
24689 | getTabListLength: function getTabListLength() {
|
24690 | return 0;
|
24691 | },
|
24692 | notifyTabActivated: function notifyTabActivated() {
|
24693 | return undefined;
|
24694 | }
|
24695 | };
|
24696 |
|
24697 | },
|
24698 | enumerable: false,
|
24699 | configurable: true
|
24700 | });
|
24701 | |
24702 |
|
24703 |
|
24704 |
|
24705 | MDCTabBarFoundation.prototype.setUseAutomaticActivation = function (useAutomaticActivation) {
|
24706 | this.useAutomaticActivation = useAutomaticActivation;
|
24707 | };
|
24708 | MDCTabBarFoundation.prototype.activateTab = function (index) {
|
24709 | var previousActiveIndex = this.adapter.getPreviousActiveTabIndex();
|
24710 | if (!this.indexIsInRange(index) || index === previousActiveIndex) {
|
24711 | return;
|
24712 | }
|
24713 | var previousClientRect;
|
24714 | if (previousActiveIndex !== -1) {
|
24715 | this.adapter.deactivateTabAtIndex(previousActiveIndex);
|
24716 | previousClientRect = this.adapter.getTabIndicatorClientRectAtIndex(previousActiveIndex);
|
24717 | }
|
24718 | this.adapter.activateTabAtIndex(index, previousClientRect);
|
24719 | this.scrollIntoView(index);
|
24720 | this.adapter.notifyTabActivated(index);
|
24721 | };
|
24722 | MDCTabBarFoundation.prototype.handleKeyDown = function (evt) {
|
24723 |
|
24724 | var key = this.getKeyFromEvent(evt);
|
24725 |
|
24726 | if (key === undefined) {
|
24727 | return;
|
24728 | }
|
24729 |
|
24730 | if (!this.isActivationKey(key)) {
|
24731 | evt.preventDefault();
|
24732 | }
|
24733 | if (this.useAutomaticActivation) {
|
24734 | if (this.isActivationKey(key)) {
|
24735 | return;
|
24736 | }
|
24737 | var index = this.determineTargetFromKey(this.adapter.getPreviousActiveTabIndex(), key);
|
24738 | this.adapter.setActiveTab(index);
|
24739 | this.scrollIntoView(index);
|
24740 | } else {
|
24741 | var focusedTabIndex = this.adapter.getFocusedTabIndex();
|
24742 | if (this.isActivationKey(key)) {
|
24743 | this.adapter.setActiveTab(focusedTabIndex);
|
24744 | } else {
|
24745 | var index = this.determineTargetFromKey(focusedTabIndex, key);
|
24746 | this.adapter.focusTabAtIndex(index);
|
24747 | this.scrollIntoView(index);
|
24748 | }
|
24749 | }
|
24750 | };
|
24751 | |
24752 |
|
24753 |
|
24754 | MDCTabBarFoundation.prototype.handleTabInteraction = function (evt) {
|
24755 | this.adapter.setActiveTab(this.adapter.getIndexOfTabById(evt.detail.tabId));
|
24756 | };
|
24757 | |
24758 |
|
24759 |
|
24760 |
|
24761 | MDCTabBarFoundation.prototype.scrollIntoView = function (index) {
|
24762 |
|
24763 | if (!this.indexIsInRange(index)) {
|
24764 | return;
|
24765 | }
|
24766 |
|
24767 | if (index === 0) {
|
24768 | this.adapter.scrollTo(0);
|
24769 | return;
|
24770 | }
|
24771 |
|
24772 |
|
24773 | if (index === this.adapter.getTabListLength() - 1) {
|
24774 | this.adapter.scrollTo(this.adapter.getScrollContentWidth());
|
24775 | return;
|
24776 | }
|
24777 | if (this.isRTL()) {
|
24778 | this.scrollIntoViewImplRTL(index);
|
24779 | return;
|
24780 | }
|
24781 | this.scrollIntoViewImpl(index);
|
24782 | };
|
24783 | |
24784 |
|
24785 |
|
24786 |
|
24787 |
|
24788 | MDCTabBarFoundation.prototype.determineTargetFromKey = function (origin, key) {
|
24789 | var isRTL = this.isRTL();
|
24790 | var maxIndex = this.adapter.getTabListLength() - 1;
|
24791 | var shouldGoToEnd = key === constants_1.strings.END_KEY;
|
24792 | var shouldDecrement = key === constants_1.strings.ARROW_LEFT_KEY && !isRTL || key === constants_1.strings.ARROW_RIGHT_KEY && isRTL;
|
24793 | var shouldIncrement = key === constants_1.strings.ARROW_RIGHT_KEY && !isRTL || key === constants_1.strings.ARROW_LEFT_KEY && isRTL;
|
24794 | var index = origin;
|
24795 | if (shouldGoToEnd) {
|
24796 | index = maxIndex;
|
24797 | } else if (shouldDecrement) {
|
24798 | index -= 1;
|
24799 | } else if (shouldIncrement) {
|
24800 | index += 1;
|
24801 | } else {
|
24802 | index = 0;
|
24803 | }
|
24804 | if (index < 0) {
|
24805 | index = maxIndex;
|
24806 | } else if (index > maxIndex) {
|
24807 | index = 0;
|
24808 | }
|
24809 | return index;
|
24810 | };
|
24811 | |
24812 |
|
24813 |
|
24814 |
|
24815 |
|
24816 |
|
24817 |
|
24818 | MDCTabBarFoundation.prototype.calculateScrollIncrement = function (index, nextIndex, scrollPosition, barWidth) {
|
24819 | var nextTabDimensions = this.adapter.getTabDimensionsAtIndex(nextIndex);
|
24820 | var relativeContentLeft = nextTabDimensions.contentLeft - scrollPosition - barWidth;
|
24821 | var relativeContentRight = nextTabDimensions.contentRight - scrollPosition;
|
24822 | var leftIncrement = relativeContentRight - constants_1.numbers.EXTRA_SCROLL_AMOUNT;
|
24823 | var rightIncrement = relativeContentLeft + constants_1.numbers.EXTRA_SCROLL_AMOUNT;
|
24824 | if (nextIndex < index) {
|
24825 | return Math.min(leftIncrement, 0);
|
24826 | }
|
24827 | return Math.max(rightIncrement, 0);
|
24828 | };
|
24829 | |
24830 |
|
24831 |
|
24832 |
|
24833 |
|
24834 |
|
24835 |
|
24836 |
|
24837 | MDCTabBarFoundation.prototype.calculateScrollIncrementRTL = function (index, nextIndex, scrollPosition, barWidth, scrollContentWidth) {
|
24838 | var nextTabDimensions = this.adapter.getTabDimensionsAtIndex(nextIndex);
|
24839 | var relativeContentLeft = scrollContentWidth - nextTabDimensions.contentLeft - scrollPosition;
|
24840 | var relativeContentRight = scrollContentWidth - nextTabDimensions.contentRight - scrollPosition - barWidth;
|
24841 | var leftIncrement = relativeContentRight + constants_1.numbers.EXTRA_SCROLL_AMOUNT;
|
24842 | var rightIncrement = relativeContentLeft - constants_1.numbers.EXTRA_SCROLL_AMOUNT;
|
24843 | if (nextIndex > index) {
|
24844 | return Math.max(leftIncrement, 0);
|
24845 | }
|
24846 | return Math.min(rightIncrement, 0);
|
24847 | };
|
24848 | |
24849 |
|
24850 |
|
24851 |
|
24852 |
|
24853 |
|
24854 |
|
24855 | MDCTabBarFoundation.prototype.findAdjacentTabIndexClosestToEdge = function (index, tabDimensions, scrollPosition, barWidth) {
|
24856 | |
24857 |
|
24858 |
|
24859 |
|
24860 |
|
24861 |
|
24862 |
|
24863 |
|
24864 |
|
24865 |
|
24866 |
|
24867 |
|
24868 |
|
24869 |
|
24870 |
|
24871 |
|
24872 |
|
24873 |
|
24874 |
|
24875 |
|
24876 |
|
24877 |
|
24878 |
|
24879 |
|
24880 | var relativeRootLeft = tabDimensions.rootLeft - scrollPosition;
|
24881 | var relativeRootRight = tabDimensions.rootRight - scrollPosition - barWidth;
|
24882 | var relativeRootDelta = relativeRootLeft + relativeRootRight;
|
24883 | var leftEdgeIsCloser = relativeRootLeft < 0 || relativeRootDelta < 0;
|
24884 | var rightEdgeIsCloser = relativeRootRight > 0 || relativeRootDelta > 0;
|
24885 | if (leftEdgeIsCloser) {
|
24886 | return index - 1;
|
24887 | }
|
24888 | if (rightEdgeIsCloser) {
|
24889 | return index + 1;
|
24890 | }
|
24891 | return -1;
|
24892 | };
|
24893 | |
24894 |
|
24895 |
|
24896 |
|
24897 |
|
24898 |
|
24899 |
|
24900 |
|
24901 | MDCTabBarFoundation.prototype.findAdjacentTabIndexClosestToEdgeRTL = function (index, tabDimensions, scrollPosition, barWidth, scrollContentWidth) {
|
24902 | var rootLeft = scrollContentWidth - tabDimensions.rootLeft - barWidth - scrollPosition;
|
24903 | var rootRight = scrollContentWidth - tabDimensions.rootRight - scrollPosition;
|
24904 | var rootDelta = rootLeft + rootRight;
|
24905 | var leftEdgeIsCloser = rootLeft > 0 || rootDelta > 0;
|
24906 | var rightEdgeIsCloser = rootRight < 0 || rootDelta < 0;
|
24907 | if (leftEdgeIsCloser) {
|
24908 | return index + 1;
|
24909 | }
|
24910 | if (rightEdgeIsCloser) {
|
24911 | return index - 1;
|
24912 | }
|
24913 | return -1;
|
24914 | };
|
24915 | |
24916 |
|
24917 |
|
24918 |
|
24919 | MDCTabBarFoundation.prototype.getKeyFromEvent = function (evt) {
|
24920 | if (ACCEPTABLE_KEYS.has(evt.key)) {
|
24921 | return evt.key;
|
24922 | }
|
24923 | return KEYCODE_MAP.get(evt.keyCode);
|
24924 | };
|
24925 | MDCTabBarFoundation.prototype.isActivationKey = function (key) {
|
24926 | return key === constants_1.strings.SPACE_KEY || key === constants_1.strings.ENTER_KEY;
|
24927 | };
|
24928 | |
24929 |
|
24930 |
|
24931 |
|
24932 | MDCTabBarFoundation.prototype.indexIsInRange = function (index) {
|
24933 | return index >= 0 && index < this.adapter.getTabListLength();
|
24934 | };
|
24935 | |
24936 |
|
24937 |
|
24938 | MDCTabBarFoundation.prototype.isRTL = function () {
|
24939 | return this.adapter.isRTL();
|
24940 | };
|
24941 | |
24942 |
|
24943 |
|
24944 |
|
24945 | MDCTabBarFoundation.prototype.scrollIntoViewImpl = function (index) {
|
24946 | var scrollPosition = this.adapter.getScrollPosition();
|
24947 | var barWidth = this.adapter.getOffsetWidth();
|
24948 | var tabDimensions = this.adapter.getTabDimensionsAtIndex(index);
|
24949 | var nextIndex = this.findAdjacentTabIndexClosestToEdge(index, tabDimensions, scrollPosition, barWidth);
|
24950 | if (!this.indexIsInRange(nextIndex)) {
|
24951 | return;
|
24952 | }
|
24953 | var scrollIncrement = this.calculateScrollIncrement(index, nextIndex, scrollPosition, barWidth);
|
24954 | this.adapter.incrementScroll(scrollIncrement);
|
24955 | };
|
24956 | |
24957 |
|
24958 |
|
24959 |
|
24960 | MDCTabBarFoundation.prototype.scrollIntoViewImplRTL = function (index) {
|
24961 | var scrollPosition = this.adapter.getScrollPosition();
|
24962 | var barWidth = this.adapter.getOffsetWidth();
|
24963 | var tabDimensions = this.adapter.getTabDimensionsAtIndex(index);
|
24964 | var scrollWidth = this.adapter.getScrollContentWidth();
|
24965 | var nextIndex = this.findAdjacentTabIndexClosestToEdgeRTL(index, tabDimensions, scrollPosition, barWidth, scrollWidth);
|
24966 | if (!this.indexIsInRange(nextIndex)) {
|
24967 | return;
|
24968 | }
|
24969 | var scrollIncrement = this.calculateScrollIncrementRTL(index, nextIndex, scrollPosition, barWidth, scrollWidth);
|
24970 | this.adapter.incrementScroll(scrollIncrement);
|
24971 | };
|
24972 | return MDCTabBarFoundation;
|
24973 | }(foundation_1.MDCFoundation);
|
24974 | exports.MDCTabBarFoundation = MDCTabBarFoundation;
|
24975 |
|
24976 | exports.default = MDCTabBarFoundation;
|
24977 |
|
24978 | }),
|
24979 |
|
24980 | "./packages/mdc-tab-bar/index.ts":
|
24981 |
|
24982 |
|
24983 |
|
24984 |
|
24985 | (function(module, exports, __webpack_require__) {
|
24986 |
|
24987 | "use strict";
|
24988 |
|
24989 |
|
24990 |
|
24991 |
|
24992 |
|
24993 |
|
24994 |
|
24995 |
|
24996 |
|
24997 |
|
24998 |
|
24999 |
|
25000 |
|
25001 |
|
25002 |
|
25003 |
|
25004 |
|
25005 |
|
25006 |
|
25007 |
|
25008 |
|
25009 |
|
25010 |
|
25011 |
|
25012 | var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
|
25013 | if (k2 === undefined) k2 = k;
|
25014 | Object.defineProperty(o, k2, { enumerable: true, get: function get() {
|
25015 | return m[k];
|
25016 | } });
|
25017 | } : function (o, m, k, k2) {
|
25018 | if (k2 === undefined) k2 = k;
|
25019 | o[k2] = m[k];
|
25020 | });
|
25021 | var __exportStar = this && this.__exportStar || function (m, exports) {
|
25022 | for (var p in m) {
|
25023 | if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
25024 | }
|
25025 | };
|
25026 | Object.defineProperty(exports, "__esModule", { value: true });
|
25027 | __exportStar(__webpack_require__( "./packages/mdc-tab-bar/adapter.ts"), exports);
|
25028 | __exportStar(__webpack_require__( "./packages/mdc-tab-bar/component.ts"), exports);
|
25029 | __exportStar(__webpack_require__( "./packages/mdc-tab-bar/constants.ts"), exports);
|
25030 | __exportStar(__webpack_require__( "./packages/mdc-tab-bar/foundation.ts"), exports);
|
25031 | __exportStar(__webpack_require__( "./packages/mdc-tab-bar/types.ts"), exports);
|
25032 |
|
25033 | }),
|
25034 |
|
25035 | "./packages/mdc-tab-bar/types.ts":
|
25036 |
|
25037 |
|
25038 |
|
25039 |
|
25040 | (function(module, exports, __webpack_require__) {
|
25041 |
|
25042 | "use strict";
|
25043 |
|
25044 |
|
25045 |
|
25046 |
|
25047 |
|
25048 |
|
25049 |
|
25050 |
|
25051 |
|
25052 |
|
25053 |
|
25054 |
|
25055 |
|
25056 |
|
25057 |
|
25058 |
|
25059 |
|
25060 |
|
25061 |
|
25062 |
|
25063 |
|
25064 |
|
25065 |
|
25066 |
|
25067 | Object.defineProperty(exports, "__esModule", { value: true });
|
25068 |
|
25069 | }),
|
25070 |
|
25071 | "./packages/mdc-tab-indicator/adapter.ts":
|
25072 |
|
25073 |
|
25074 |
|
25075 |
|
25076 | (function(module, exports, __webpack_require__) {
|
25077 |
|
25078 | "use strict";
|
25079 |
|
25080 |
|
25081 |
|
25082 |
|
25083 |
|
25084 |
|
25085 |
|
25086 |
|
25087 |
|
25088 |
|
25089 |
|
25090 |
|
25091 |
|
25092 |
|
25093 |
|
25094 |
|
25095 |
|
25096 |
|
25097 |
|
25098 |
|
25099 |
|
25100 |
|
25101 |
|
25102 |
|
25103 | Object.defineProperty(exports, "__esModule", { value: true });
|
25104 |
|
25105 | }),
|
25106 |
|
25107 | "./packages/mdc-tab-indicator/component.ts":
|
25108 |
|
25109 |
|
25110 |
|
25111 |
|
25112 | (function(module, exports, __webpack_require__) {
|
25113 |
|
25114 | "use strict";
|
25115 |
|
25116 |
|
25117 |
|
25118 |
|
25119 |
|
25120 |
|
25121 |
|
25122 |
|
25123 |
|
25124 |
|
25125 |
|
25126 |
|
25127 |
|
25128 |
|
25129 |
|
25130 |
|
25131 |
|
25132 |
|
25133 |
|
25134 |
|
25135 |
|
25136 |
|
25137 |
|
25138 |
|
25139 | var __extends = this && this.__extends || function () {
|
25140 | var _extendStatics = function extendStatics(d, b) {
|
25141 | _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
|
25142 | d.__proto__ = b;
|
25143 | } || function (d, b) {
|
25144 | for (var p in b) {
|
25145 | if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
25146 | }
|
25147 | };
|
25148 | return _extendStatics(d, b);
|
25149 | };
|
25150 | return function (d, b) {
|
25151 | if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
25152 | _extendStatics(d, b);
|
25153 | function __() {
|
25154 | this.constructor = d;
|
25155 | }
|
25156 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
25157 | };
|
25158 | }();
|
25159 | Object.defineProperty(exports, "__esModule", { value: true });
|
25160 | exports.MDCTabIndicator = void 0;
|
25161 | var component_1 = __webpack_require__( "./packages/mdc-base/component.ts");
|
25162 | var fading_foundation_1 = __webpack_require__( "./packages/mdc-tab-indicator/fading-foundation.ts");
|
25163 | var foundation_1 = __webpack_require__( "./packages/mdc-tab-indicator/foundation.ts");
|
25164 | var sliding_foundation_1 = __webpack_require__( "./packages/mdc-tab-indicator/sliding-foundation.ts");
|
25165 | var MDCTabIndicator = function (_super) {
|
25166 | __extends(MDCTabIndicator, _super);
|
25167 | function MDCTabIndicator() {
|
25168 | return _super !== null && _super.apply(this, arguments) || this;
|
25169 | }
|
25170 | MDCTabIndicator.attachTo = function (root) {
|
25171 | return new MDCTabIndicator(root);
|
25172 | };
|
25173 | MDCTabIndicator.prototype.initialize = function () {
|
25174 | this.content = this.root.querySelector(foundation_1.MDCTabIndicatorFoundation.strings.CONTENT_SELECTOR);
|
25175 | };
|
25176 | MDCTabIndicator.prototype.computeContentClientRect = function () {
|
25177 | return this.foundation.computeContentClientRect();
|
25178 | };
|
25179 | MDCTabIndicator.prototype.getDefaultFoundation = function () {
|
25180 | var _this = this;
|
25181 |
|
25182 |
|
25183 |
|
25184 | var adapter = {
|
25185 | addClass: function addClass(className) {
|
25186 | return _this.root.classList.add(className);
|
25187 | },
|
25188 | removeClass: function removeClass(className) {
|
25189 | return _this.root.classList.remove(className);
|
25190 | },
|
25191 | computeContentClientRect: function computeContentClientRect() {
|
25192 | return _this.content.getBoundingClientRect();
|
25193 | },
|
25194 | setContentStyleProperty: function setContentStyleProperty(prop, value) {
|
25195 | _this.content.style.setProperty(prop, value);
|
25196 | }
|
25197 | };
|
25198 |
|
25199 | if (this.root.classList.contains(foundation_1.MDCTabIndicatorFoundation.cssClasses.FADE)) {
|
25200 | return new fading_foundation_1.MDCFadingTabIndicatorFoundation(adapter);
|
25201 | }
|
25202 |
|
25203 | return new sliding_foundation_1.MDCSlidingTabIndicatorFoundation(adapter);
|
25204 | };
|
25205 | MDCTabIndicator.prototype.activate = function (previousIndicatorClientRect) {
|
25206 | this.foundation.activate(previousIndicatorClientRect);
|
25207 | };
|
25208 | MDCTabIndicator.prototype.deactivate = function () {
|
25209 | this.foundation.deactivate();
|
25210 | };
|
25211 | return MDCTabIndicator;
|
25212 | }(component_1.MDCComponent);
|
25213 | exports.MDCTabIndicator = MDCTabIndicator;
|
25214 |
|
25215 | }),
|
25216 |
|
25217 | "./packages/mdc-tab-indicator/constants.ts":
|
25218 |
|
25219 |
|
25220 |
|
25221 |
|
25222 | (function(module, exports, __webpack_require__) {
|
25223 |
|
25224 | "use strict";
|
25225 |
|
25226 |
|
25227 |
|
25228 |
|
25229 |
|
25230 |
|
25231 |
|
25232 |
|
25233 |
|
25234 |
|
25235 |
|
25236 |
|
25237 |
|
25238 |
|
25239 |
|
25240 |
|
25241 |
|
25242 |
|
25243 |
|
25244 |
|
25245 |
|
25246 |
|
25247 |
|
25248 |
|
25249 | Object.defineProperty(exports, "__esModule", { value: true });
|
25250 | exports.strings = exports.cssClasses = void 0;
|
25251 | var cssClasses = {
|
25252 | ACTIVE: 'mdc-tab-indicator--active',
|
25253 | FADE: 'mdc-tab-indicator--fade',
|
25254 | NO_TRANSITION: 'mdc-tab-indicator--no-transition'
|
25255 | };
|
25256 | exports.cssClasses = cssClasses;
|
25257 | var strings = {
|
25258 | CONTENT_SELECTOR: '.mdc-tab-indicator__content'
|
25259 | };
|
25260 | exports.strings = strings;
|
25261 |
|
25262 | }),
|
25263 |
|
25264 | "./packages/mdc-tab-indicator/fading-foundation.ts":
|
25265 |
|
25266 |
|
25267 |
|
25268 |
|
25269 | (function(module, exports, __webpack_require__) {
|
25270 |
|
25271 | "use strict";
|
25272 |
|
25273 |
|
25274 |
|
25275 |
|
25276 |
|
25277 |
|
25278 |
|
25279 |
|
25280 |
|
25281 |
|
25282 |
|
25283 |
|
25284 |
|
25285 |
|
25286 |
|
25287 |
|
25288 |
|
25289 |
|
25290 |
|
25291 |
|
25292 |
|
25293 |
|
25294 |
|
25295 |
|
25296 | var __extends = this && this.__extends || function () {
|
25297 | var _extendStatics = function extendStatics(d, b) {
|
25298 | _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
|
25299 | d.__proto__ = b;
|
25300 | } || function (d, b) {
|
25301 | for (var p in b) {
|
25302 | if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
25303 | }
|
25304 | };
|
25305 | return _extendStatics(d, b);
|
25306 | };
|
25307 | return function (d, b) {
|
25308 | if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
25309 | _extendStatics(d, b);
|
25310 | function __() {
|
25311 | this.constructor = d;
|
25312 | }
|
25313 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
25314 | };
|
25315 | }();
|
25316 | Object.defineProperty(exports, "__esModule", { value: true });
|
25317 | exports.MDCFadingTabIndicatorFoundation = void 0;
|
25318 | var foundation_1 = __webpack_require__( "./packages/mdc-tab-indicator/foundation.ts");
|
25319 |
|
25320 | var MDCFadingTabIndicatorFoundation = function (_super) {
|
25321 | __extends(MDCFadingTabIndicatorFoundation, _super);
|
25322 | function MDCFadingTabIndicatorFoundation() {
|
25323 | return _super !== null && _super.apply(this, arguments) || this;
|
25324 | }
|
25325 | MDCFadingTabIndicatorFoundation.prototype.activate = function () {
|
25326 | this.adapter.addClass(foundation_1.MDCTabIndicatorFoundation.cssClasses.ACTIVE);
|
25327 | };
|
25328 | MDCFadingTabIndicatorFoundation.prototype.deactivate = function () {
|
25329 | this.adapter.removeClass(foundation_1.MDCTabIndicatorFoundation.cssClasses.ACTIVE);
|
25330 | };
|
25331 | return MDCFadingTabIndicatorFoundation;
|
25332 | }(foundation_1.MDCTabIndicatorFoundation);
|
25333 | exports.MDCFadingTabIndicatorFoundation = MDCFadingTabIndicatorFoundation;
|
25334 |
|
25335 | exports.default = MDCFadingTabIndicatorFoundation;
|
25336 |
|
25337 | }),
|
25338 |
|
25339 | "./packages/mdc-tab-indicator/foundation.ts":
|
25340 |
|
25341 |
|
25342 |
|
25343 |
|
25344 | (function(module, exports, __webpack_require__) {
|
25345 |
|
25346 | "use strict";
|
25347 |
|
25348 |
|
25349 |
|
25350 |
|
25351 |
|
25352 |
|
25353 |
|
25354 |
|
25355 |
|
25356 |
|
25357 |
|
25358 |
|
25359 |
|
25360 |
|
25361 |
|
25362 |
|
25363 |
|
25364 |
|
25365 |
|
25366 |
|
25367 |
|
25368 |
|
25369 |
|
25370 |
|
25371 | var __extends = this && this.__extends || function () {
|
25372 | var _extendStatics = function extendStatics(d, b) {
|
25373 | _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
|
25374 | d.__proto__ = b;
|
25375 | } || function (d, b) {
|
25376 | for (var p in b) {
|
25377 | if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
25378 | }
|
25379 | };
|
25380 | return _extendStatics(d, b);
|
25381 | };
|
25382 | return function (d, b) {
|
25383 | if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
25384 | _extendStatics(d, b);
|
25385 | function __() {
|
25386 | this.constructor = d;
|
25387 | }
|
25388 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
25389 | };
|
25390 | }();
|
25391 | var __assign = this && this.__assign || function () {
|
25392 | __assign = Object.assign || function (t) {
|
25393 | for (var s, i = 1, n = arguments.length; i < n; i++) {
|
25394 | s = arguments[i];
|
25395 | for (var p in s) {
|
25396 | if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
25397 | }
|
25398 | }
|
25399 | return t;
|
25400 | };
|
25401 | return __assign.apply(this, arguments);
|
25402 | };
|
25403 | Object.defineProperty(exports, "__esModule", { value: true });
|
25404 | exports.MDCTabIndicatorFoundation = void 0;
|
25405 | var foundation_1 = __webpack_require__( "./packages/mdc-base/foundation.ts");
|
25406 | var constants_1 = __webpack_require__( "./packages/mdc-tab-indicator/constants.ts");
|
25407 | var MDCTabIndicatorFoundation = function (_super) {
|
25408 | __extends(MDCTabIndicatorFoundation, _super);
|
25409 | function MDCTabIndicatorFoundation(adapter) {
|
25410 | return _super.call(this, __assign(__assign({}, MDCTabIndicatorFoundation.defaultAdapter), adapter)) || this;
|
25411 | }
|
25412 | Object.defineProperty(MDCTabIndicatorFoundation, "cssClasses", {
|
25413 | get: function get() {
|
25414 | return constants_1.cssClasses;
|
25415 | },
|
25416 | enumerable: false,
|
25417 | configurable: true
|
25418 | });
|
25419 | Object.defineProperty(MDCTabIndicatorFoundation, "strings", {
|
25420 | get: function get() {
|
25421 | return constants_1.strings;
|
25422 | },
|
25423 | enumerable: false,
|
25424 | configurable: true
|
25425 | });
|
25426 | Object.defineProperty(MDCTabIndicatorFoundation, "defaultAdapter", {
|
25427 | get: function get() {
|
25428 |
|
25429 | return {
|
25430 | addClass: function addClass() {
|
25431 | return undefined;
|
25432 | },
|
25433 | removeClass: function removeClass() {
|
25434 | return undefined;
|
25435 | },
|
25436 | computeContentClientRect: function computeContentClientRect() {
|
25437 | return { top: 0, right: 0, bottom: 0, left: 0, width: 0, height: 0 };
|
25438 | },
|
25439 | setContentStyleProperty: function setContentStyleProperty() {
|
25440 | return undefined;
|
25441 | }
|
25442 | };
|
25443 |
|
25444 | },
|
25445 | enumerable: false,
|
25446 | configurable: true
|
25447 | });
|
25448 | MDCTabIndicatorFoundation.prototype.computeContentClientRect = function () {
|
25449 | return this.adapter.computeContentClientRect();
|
25450 | };
|
25451 | return MDCTabIndicatorFoundation;
|
25452 | }(foundation_1.MDCFoundation);
|
25453 | exports.MDCTabIndicatorFoundation = MDCTabIndicatorFoundation;
|
25454 |
|
25455 | exports.default = MDCTabIndicatorFoundation;
|
25456 |
|
25457 | }),
|
25458 |
|
25459 | "./packages/mdc-tab-indicator/index.ts":
|
25460 |
|
25461 |
|
25462 |
|
25463 |
|
25464 | (function(module, exports, __webpack_require__) {
|
25465 |
|
25466 | "use strict";
|
25467 |
|
25468 |
|
25469 |
|
25470 |
|
25471 |
|
25472 |
|
25473 |
|
25474 |
|
25475 |
|
25476 |
|
25477 |
|
25478 |
|
25479 |
|
25480 |
|
25481 |
|
25482 |
|
25483 |
|
25484 |
|
25485 |
|
25486 |
|
25487 |
|
25488 |
|
25489 |
|
25490 |
|
25491 | var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
|
25492 | if (k2 === undefined) k2 = k;
|
25493 | Object.defineProperty(o, k2, { enumerable: true, get: function get() {
|
25494 | return m[k];
|
25495 | } });
|
25496 | } : function (o, m, k, k2) {
|
25497 | if (k2 === undefined) k2 = k;
|
25498 | o[k2] = m[k];
|
25499 | });
|
25500 | var __exportStar = this && this.__exportStar || function (m, exports) {
|
25501 | for (var p in m) {
|
25502 | if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
25503 | }
|
25504 | };
|
25505 | Object.defineProperty(exports, "__esModule", { value: true });
|
25506 | __exportStar(__webpack_require__( "./packages/mdc-tab-indicator/adapter.ts"), exports);
|
25507 | __exportStar(__webpack_require__( "./packages/mdc-tab-indicator/component.ts"), exports);
|
25508 | __exportStar(__webpack_require__( "./packages/mdc-tab-indicator/constants.ts"), exports);
|
25509 | __exportStar(__webpack_require__( "./packages/mdc-tab-indicator/foundation.ts"), exports);
|
25510 | __exportStar(__webpack_require__( "./packages/mdc-tab-indicator/fading-foundation.ts"), exports);
|
25511 | __exportStar(__webpack_require__( "./packages/mdc-tab-indicator/sliding-foundation.ts"), exports);
|
25512 |
|
25513 | }),
|
25514 |
|
25515 | "./packages/mdc-tab-indicator/sliding-foundation.ts":
|
25516 |
|
25517 |
|
25518 |
|
25519 |
|
25520 | (function(module, exports, __webpack_require__) {
|
25521 |
|
25522 | "use strict";
|
25523 |
|
25524 |
|
25525 |
|
25526 |
|
25527 |
|
25528 |
|
25529 |
|
25530 |
|
25531 |
|
25532 |
|
25533 |
|
25534 |
|
25535 |
|
25536 |
|
25537 |
|
25538 |
|
25539 |
|
25540 |
|
25541 |
|
25542 |
|
25543 |
|
25544 |
|
25545 |
|
25546 |
|
25547 | var __extends = this && this.__extends || function () {
|
25548 | var _extendStatics = function extendStatics(d, b) {
|
25549 | _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
|
25550 | d.__proto__ = b;
|
25551 | } || function (d, b) {
|
25552 | for (var p in b) {
|
25553 | if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
25554 | }
|
25555 | };
|
25556 | return _extendStatics(d, b);
|
25557 | };
|
25558 | return function (d, b) {
|
25559 | if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
25560 | _extendStatics(d, b);
|
25561 | function __() {
|
25562 | this.constructor = d;
|
25563 | }
|
25564 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
25565 | };
|
25566 | }();
|
25567 | Object.defineProperty(exports, "__esModule", { value: true });
|
25568 | exports.MDCSlidingTabIndicatorFoundation = void 0;
|
25569 | var foundation_1 = __webpack_require__( "./packages/mdc-tab-indicator/foundation.ts");
|
25570 |
|
25571 | var MDCSlidingTabIndicatorFoundation = function (_super) {
|
25572 | __extends(MDCSlidingTabIndicatorFoundation, _super);
|
25573 | function MDCSlidingTabIndicatorFoundation() {
|
25574 | return _super !== null && _super.apply(this, arguments) || this;
|
25575 | }
|
25576 | MDCSlidingTabIndicatorFoundation.prototype.activate = function (previousIndicatorClientRect) {
|
25577 |
|
25578 |
|
25579 | if (!previousIndicatorClientRect) {
|
25580 | this.adapter.addClass(foundation_1.MDCTabIndicatorFoundation.cssClasses.ACTIVE);
|
25581 | return;
|
25582 | }
|
25583 |
|
25584 |
|
25585 |
|
25586 | var currentClientRect = this.computeContentClientRect();
|
25587 | var widthDelta = previousIndicatorClientRect.width / currentClientRect.width;
|
25588 | var xPosition = previousIndicatorClientRect.left - currentClientRect.left;
|
25589 | this.adapter.addClass(foundation_1.MDCTabIndicatorFoundation.cssClasses.NO_TRANSITION);
|
25590 | this.adapter.setContentStyleProperty('transform', "translateX(" + xPosition + "px) scaleX(" + widthDelta + ")");
|
25591 |
|
25592 | this.computeContentClientRect();
|
25593 | this.adapter.removeClass(foundation_1.MDCTabIndicatorFoundation.cssClasses.NO_TRANSITION);
|
25594 | this.adapter.addClass(foundation_1.MDCTabIndicatorFoundation.cssClasses.ACTIVE);
|
25595 | this.adapter.setContentStyleProperty('transform', '');
|
25596 | };
|
25597 | MDCSlidingTabIndicatorFoundation.prototype.deactivate = function () {
|
25598 | this.adapter.removeClass(foundation_1.MDCTabIndicatorFoundation.cssClasses.ACTIVE);
|
25599 | };
|
25600 | return MDCSlidingTabIndicatorFoundation;
|
25601 | }(foundation_1.MDCTabIndicatorFoundation);
|
25602 | exports.MDCSlidingTabIndicatorFoundation = MDCSlidingTabIndicatorFoundation;
|
25603 |
|
25604 | exports.default = MDCSlidingTabIndicatorFoundation;
|
25605 |
|
25606 | }),
|
25607 |
|
25608 | "./packages/mdc-tab-scroller/adapter.ts":
|
25609 |
|
25610 |
|
25611 |
|
25612 |
|
25613 | (function(module, exports, __webpack_require__) {
|
25614 |
|
25615 | "use strict";
|
25616 |
|
25617 |
|
25618 |
|
25619 |
|
25620 |
|
25621 |
|
25622 |
|
25623 |
|
25624 |
|
25625 |
|
25626 |
|
25627 |
|
25628 |
|
25629 |
|
25630 |
|
25631 |
|
25632 |
|
25633 |
|
25634 |
|
25635 |
|
25636 |
|
25637 |
|
25638 |
|
25639 |
|
25640 | Object.defineProperty(exports, "__esModule", { value: true });
|
25641 |
|
25642 | }),
|
25643 |
|
25644 | "./packages/mdc-tab-scroller/component.ts":
|
25645 |
|
25646 |
|
25647 |
|
25648 |
|
25649 | (function(module, exports, __webpack_require__) {
|
25650 |
|
25651 | "use strict";
|
25652 |
|
25653 |
|
25654 |
|
25655 |
|
25656 |
|
25657 |
|
25658 |
|
25659 |
|
25660 |
|
25661 |
|
25662 |
|
25663 |
|
25664 |
|
25665 |
|
25666 |
|
25667 |
|
25668 |
|
25669 |
|
25670 |
|
25671 |
|
25672 |
|
25673 |
|
25674 |
|
25675 |
|
25676 | var __extends = this && this.__extends || function () {
|
25677 | var _extendStatics = function extendStatics(d, b) {
|
25678 | _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
|
25679 | d.__proto__ = b;
|
25680 | } || function (d, b) {
|
25681 | for (var p in b) {
|
25682 | if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
25683 | }
|
25684 | };
|
25685 | return _extendStatics(d, b);
|
25686 | };
|
25687 | return function (d, b) {
|
25688 | if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
25689 | _extendStatics(d, b);
|
25690 | function __() {
|
25691 | this.constructor = d;
|
25692 | }
|
25693 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
25694 | };
|
25695 | }();
|
25696 | var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
|
25697 | if (k2 === undefined) k2 = k;
|
25698 | Object.defineProperty(o, k2, { enumerable: true, get: function get() {
|
25699 | return m[k];
|
25700 | } });
|
25701 | } : function (o, m, k, k2) {
|
25702 | if (k2 === undefined) k2 = k;
|
25703 | o[k2] = m[k];
|
25704 | });
|
25705 | var __setModuleDefault = this && this.__setModuleDefault || (Object.create ? function (o, v) {
|
25706 | Object.defineProperty(o, "default", { enumerable: true, value: v });
|
25707 | } : function (o, v) {
|
25708 | o["default"] = v;
|
25709 | });
|
25710 | var __importStar = this && this.__importStar || function (mod) {
|
25711 | if (mod && mod.__esModule) return mod;
|
25712 | var result = {};
|
25713 | if (mod != null) for (var k in mod) {
|
25714 | if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
25715 | }__setModuleDefault(result, mod);
|
25716 | return result;
|
25717 | };
|
25718 | Object.defineProperty(exports, "__esModule", { value: true });
|
25719 | exports.MDCTabScroller = void 0;
|
25720 | var component_1 = __webpack_require__( "./packages/mdc-base/component.ts");
|
25721 | var events_1 = __webpack_require__( "./packages/mdc-dom/events.ts");
|
25722 | var ponyfill_1 = __webpack_require__( "./packages/mdc-dom/ponyfill.ts");
|
25723 | var foundation_1 = __webpack_require__( "./packages/mdc-tab-scroller/foundation.ts");
|
25724 | var util = __importStar(__webpack_require__( "./packages/mdc-tab-scroller/util.ts"));
|
25725 | var MDCTabScroller = function (_super) {
|
25726 | __extends(MDCTabScroller, _super);
|
25727 | function MDCTabScroller() {
|
25728 | return _super !== null && _super.apply(this, arguments) || this;
|
25729 | }
|
25730 | MDCTabScroller.attachTo = function (root) {
|
25731 | return new MDCTabScroller(root);
|
25732 | };
|
25733 |
|
25734 | MDCTabScroller.prototype.initialize = function () {
|
25735 | this.area = this.root.querySelector(foundation_1.MDCTabScrollerFoundation.strings.AREA_SELECTOR);
|
25736 | this.content = this.root.querySelector(foundation_1.MDCTabScrollerFoundation.strings.CONTENT_SELECTOR);
|
25737 | };
|
25738 | MDCTabScroller.prototype.initialSyncWithDOM = function () {
|
25739 | var _this = this;
|
25740 | this.handleInteraction = function () {
|
25741 | _this.foundation.handleInteraction();
|
25742 | };
|
25743 | this.handleTransitionEnd = function (evt) {
|
25744 | _this.foundation.handleTransitionEnd(evt);
|
25745 | };
|
25746 | this.area.addEventListener('wheel', this.handleInteraction, events_1.applyPassive());
|
25747 | this.area.addEventListener('touchstart', this.handleInteraction, events_1.applyPassive());
|
25748 | this.area.addEventListener('pointerdown', this.handleInteraction, events_1.applyPassive());
|
25749 | this.area.addEventListener('mousedown', this.handleInteraction, events_1.applyPassive());
|
25750 | this.area.addEventListener('keydown', this.handleInteraction, events_1.applyPassive());
|
25751 | this.content.addEventListener('transitionend', this.handleTransitionEnd);
|
25752 | };
|
25753 | MDCTabScroller.prototype.destroy = function () {
|
25754 | _super.prototype.destroy.call(this);
|
25755 | this.area.removeEventListener('wheel', this.handleInteraction, events_1.applyPassive());
|
25756 | this.area.removeEventListener('touchstart', this.handleInteraction, events_1.applyPassive());
|
25757 | this.area.removeEventListener('pointerdown', this.handleInteraction, events_1.applyPassive());
|
25758 | this.area.removeEventListener('mousedown', this.handleInteraction, events_1.applyPassive());
|
25759 | this.area.removeEventListener('keydown', this.handleInteraction, events_1.applyPassive());
|
25760 | this.content.removeEventListener('transitionend', this.handleTransitionEnd);
|
25761 | };
|
25762 | MDCTabScroller.prototype.getDefaultFoundation = function () {
|
25763 | var _this = this;
|
25764 |
|
25765 |
|
25766 |
|
25767 | var adapter = {
|
25768 | eventTargetMatchesSelector: function eventTargetMatchesSelector(evtTarget, selector) {
|
25769 | return ponyfill_1.matches(evtTarget, selector);
|
25770 | },
|
25771 | addClass: function addClass(className) {
|
25772 | _this.root.classList.add(className);
|
25773 | },
|
25774 | removeClass: function removeClass(className) {
|
25775 | _this.root.classList.remove(className);
|
25776 | },
|
25777 | addScrollAreaClass: function addScrollAreaClass(className) {
|
25778 | _this.area.classList.add(className);
|
25779 | },
|
25780 | setScrollAreaStyleProperty: function setScrollAreaStyleProperty(prop, value) {
|
25781 | _this.area.style.setProperty(prop, value);
|
25782 | },
|
25783 | setScrollContentStyleProperty: function setScrollContentStyleProperty(prop, value) {
|
25784 | _this.content.style.setProperty(prop, value);
|
25785 | },
|
25786 | getScrollContentStyleValue: function getScrollContentStyleValue(propName) {
|
25787 | return window.getComputedStyle(_this.content).getPropertyValue(propName);
|
25788 | },
|
25789 | setScrollAreaScrollLeft: function setScrollAreaScrollLeft(scrollX) {
|
25790 | return _this.area.scrollLeft = scrollX;
|
25791 | },
|
25792 | getScrollAreaScrollLeft: function getScrollAreaScrollLeft() {
|
25793 | return _this.area.scrollLeft;
|
25794 | },
|
25795 | getScrollContentOffsetWidth: function getScrollContentOffsetWidth() {
|
25796 | return _this.content.offsetWidth;
|
25797 | },
|
25798 | getScrollAreaOffsetWidth: function getScrollAreaOffsetWidth() {
|
25799 | return _this.area.offsetWidth;
|
25800 | },
|
25801 | computeScrollAreaClientRect: function computeScrollAreaClientRect() {
|
25802 | return _this.area.getBoundingClientRect();
|
25803 | },
|
25804 | computeScrollContentClientRect: function computeScrollContentClientRect() {
|
25805 | return _this.content.getBoundingClientRect();
|
25806 | },
|
25807 | computeHorizontalScrollbarHeight: function computeHorizontalScrollbarHeight() {
|
25808 | return util.computeHorizontalScrollbarHeight(document);
|
25809 | }
|
25810 | };
|
25811 |
|
25812 | return new foundation_1.MDCTabScrollerFoundation(adapter);
|
25813 | };
|
25814 | |
25815 |
|
25816 |
|
25817 | MDCTabScroller.prototype.getScrollPosition = function () {
|
25818 | return this.foundation.getScrollPosition();
|
25819 | };
|
25820 | |
25821 |
|
25822 |
|
25823 | MDCTabScroller.prototype.getScrollContentWidth = function () {
|
25824 | return this.content.offsetWidth;
|
25825 | };
|
25826 | |
25827 |
|
25828 |
|
25829 |
|
25830 | MDCTabScroller.prototype.incrementScroll = function (scrollXIncrement) {
|
25831 | this.foundation.incrementScroll(scrollXIncrement);
|
25832 | };
|
25833 | |
25834 |
|
25835 |
|
25836 |
|
25837 | MDCTabScroller.prototype.scrollTo = function (scrollX) {
|
25838 | this.foundation.scrollTo(scrollX);
|
25839 | };
|
25840 | return MDCTabScroller;
|
25841 | }(component_1.MDCComponent);
|
25842 | exports.MDCTabScroller = MDCTabScroller;
|
25843 |
|
25844 | }),
|
25845 |
|
25846 | "./packages/mdc-tab-scroller/constants.ts":
|
25847 |
|
25848 |
|
25849 |
|
25850 |
|
25851 | (function(module, exports, __webpack_require__) {
|
25852 |
|
25853 | "use strict";
|
25854 |
|
25855 |
|
25856 |
|
25857 |
|
25858 |
|
25859 |
|
25860 |
|
25861 |
|
25862 |
|
25863 |
|
25864 |
|
25865 |
|
25866 |
|
25867 |
|
25868 |
|
25869 |
|
25870 |
|
25871 |
|
25872 |
|
25873 |
|
25874 |
|
25875 |
|
25876 |
|
25877 |
|
25878 | Object.defineProperty(exports, "__esModule", { value: true });
|
25879 | exports.strings = exports.cssClasses = void 0;
|
25880 | var cssClasses = {
|
25881 | ANIMATING: 'mdc-tab-scroller--animating',
|
25882 | SCROLL_AREA_SCROLL: 'mdc-tab-scroller__scroll-area--scroll',
|
25883 | SCROLL_TEST: 'mdc-tab-scroller__test'
|
25884 | };
|
25885 | exports.cssClasses = cssClasses;
|
25886 | var strings = {
|
25887 | AREA_SELECTOR: '.mdc-tab-scroller__scroll-area',
|
25888 | CONTENT_SELECTOR: '.mdc-tab-scroller__scroll-content'
|
25889 | };
|
25890 | exports.strings = strings;
|
25891 |
|
25892 | }),
|
25893 |
|
25894 | "./packages/mdc-tab-scroller/foundation.ts":
|
25895 |
|
25896 |
|
25897 |
|
25898 |
|
25899 | (function(module, exports, __webpack_require__) {
|
25900 |
|
25901 | "use strict";
|
25902 |
|
25903 |
|
25904 |
|
25905 |
|
25906 |
|
25907 |
|
25908 |
|
25909 |
|
25910 |
|
25911 |
|
25912 |
|
25913 |
|
25914 |
|
25915 |
|
25916 |
|
25917 |
|
25918 |
|
25919 |
|
25920 |
|
25921 |
|
25922 |
|
25923 |
|
25924 |
|
25925 |
|
25926 | var __extends = this && this.__extends || function () {
|
25927 | var _extendStatics = function extendStatics(d, b) {
|
25928 | _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
|
25929 | d.__proto__ = b;
|
25930 | } || function (d, b) {
|
25931 | for (var p in b) {
|
25932 | if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
25933 | }
|
25934 | };
|
25935 | return _extendStatics(d, b);
|
25936 | };
|
25937 | return function (d, b) {
|
25938 | if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
25939 | _extendStatics(d, b);
|
25940 | function __() {
|
25941 | this.constructor = d;
|
25942 | }
|
25943 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
25944 | };
|
25945 | }();
|
25946 | var __assign = this && this.__assign || function () {
|
25947 | __assign = Object.assign || function (t) {
|
25948 | for (var s, i = 1, n = arguments.length; i < n; i++) {
|
25949 | s = arguments[i];
|
25950 | for (var p in s) {
|
25951 | if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
25952 | }
|
25953 | }
|
25954 | return t;
|
25955 | };
|
25956 | return __assign.apply(this, arguments);
|
25957 | };
|
25958 | var __read = this && this.__read || function (o, n) {
|
25959 | var m = typeof Symbol === "function" && o[Symbol.iterator];
|
25960 | if (!m) return o;
|
25961 | var i = m.call(o),
|
25962 | r,
|
25963 | ar = [],
|
25964 | e;
|
25965 | try {
|
25966 | while ((n === void 0 || n-- > 0) && !(r = i.next()).done) {
|
25967 | ar.push(r.value);
|
25968 | }
|
25969 | } catch (error) {
|
25970 | e = { error: error };
|
25971 | } finally {
|
25972 | try {
|
25973 | if (r && !r.done && (m = i["return"])) m.call(i);
|
25974 | } finally {
|
25975 | if (e) throw e.error;
|
25976 | }
|
25977 | }
|
25978 | return ar;
|
25979 | };
|
25980 | Object.defineProperty(exports, "__esModule", { value: true });
|
25981 | exports.MDCTabScrollerFoundation = void 0;
|
25982 | var foundation_1 = __webpack_require__( "./packages/mdc-base/foundation.ts");
|
25983 | var constants_1 = __webpack_require__( "./packages/mdc-tab-scroller/constants.ts");
|
25984 | var rtl_default_scroller_1 = __webpack_require__( "./packages/mdc-tab-scroller/rtl-default-scroller.ts");
|
25985 | var rtl_negative_scroller_1 = __webpack_require__( "./packages/mdc-tab-scroller/rtl-negative-scroller.ts");
|
25986 | var rtl_reverse_scroller_1 = __webpack_require__( "./packages/mdc-tab-scroller/rtl-reverse-scroller.ts");
|
25987 | var MDCTabScrollerFoundation = function (_super) {
|
25988 | __extends(MDCTabScrollerFoundation, _super);
|
25989 | function MDCTabScrollerFoundation(adapter) {
|
25990 | var _this = _super.call(this, __assign(__assign({}, MDCTabScrollerFoundation.defaultAdapter), adapter)) || this;
|
25991 | |
25992 |
|
25993 |
|
25994 | _this.isAnimating = false;
|
25995 | return _this;
|
25996 | }
|
25997 | Object.defineProperty(MDCTabScrollerFoundation, "cssClasses", {
|
25998 | get: function get() {
|
25999 | return constants_1.cssClasses;
|
26000 | },
|
26001 | enumerable: false,
|
26002 | configurable: true
|
26003 | });
|
26004 | Object.defineProperty(MDCTabScrollerFoundation, "strings", {
|
26005 | get: function get() {
|
26006 | return constants_1.strings;
|
26007 | },
|
26008 | enumerable: false,
|
26009 | configurable: true
|
26010 | });
|
26011 | Object.defineProperty(MDCTabScrollerFoundation, "defaultAdapter", {
|
26012 | get: function get() {
|
26013 |
|
26014 | return {
|
26015 | eventTargetMatchesSelector: function eventTargetMatchesSelector() {
|
26016 | return false;
|
26017 | },
|
26018 | addClass: function addClass() {
|
26019 | return undefined;
|
26020 | },
|
26021 | removeClass: function removeClass() {
|
26022 | return undefined;
|
26023 | },
|
26024 | addScrollAreaClass: function addScrollAreaClass() {
|
26025 | return undefined;
|
26026 | },
|
26027 | setScrollAreaStyleProperty: function setScrollAreaStyleProperty() {
|
26028 | return undefined;
|
26029 | },
|
26030 | setScrollContentStyleProperty: function setScrollContentStyleProperty() {
|
26031 | return undefined;
|
26032 | },
|
26033 | getScrollContentStyleValue: function getScrollContentStyleValue() {
|
26034 | return '';
|
26035 | },
|
26036 | setScrollAreaScrollLeft: function setScrollAreaScrollLeft() {
|
26037 | return undefined;
|
26038 | },
|
26039 | getScrollAreaScrollLeft: function getScrollAreaScrollLeft() {
|
26040 | return 0;
|
26041 | },
|
26042 | getScrollContentOffsetWidth: function getScrollContentOffsetWidth() {
|
26043 | return 0;
|
26044 | },
|
26045 | getScrollAreaOffsetWidth: function getScrollAreaOffsetWidth() {
|
26046 | return 0;
|
26047 | },
|
26048 | computeScrollAreaClientRect: function computeScrollAreaClientRect() {
|
26049 | return { top: 0, right: 0, bottom: 0, left: 0, width: 0, height: 0 };
|
26050 | },
|
26051 | computeScrollContentClientRect: function computeScrollContentClientRect() {
|
26052 | return { top: 0, right: 0, bottom: 0, left: 0, width: 0, height: 0 };
|
26053 | },
|
26054 | computeHorizontalScrollbarHeight: function computeHorizontalScrollbarHeight() {
|
26055 | return 0;
|
26056 | }
|
26057 | };
|
26058 |
|
26059 | },
|
26060 | enumerable: false,
|
26061 | configurable: true
|
26062 | });
|
26063 | MDCTabScrollerFoundation.prototype.init = function () {
|
26064 |
|
26065 |
|
26066 | var horizontalScrollbarHeight = this.adapter.computeHorizontalScrollbarHeight();
|
26067 | this.adapter.setScrollAreaStyleProperty('margin-bottom', -horizontalScrollbarHeight + 'px');
|
26068 | this.adapter.addScrollAreaClass(MDCTabScrollerFoundation.cssClasses.SCROLL_AREA_SCROLL);
|
26069 | };
|
26070 | |
26071 |
|
26072 |
|
26073 | MDCTabScrollerFoundation.prototype.getScrollPosition = function () {
|
26074 | if (this.isRTL()) {
|
26075 | return this.computeCurrentScrollPositionRTL();
|
26076 | }
|
26077 | var currentTranslateX = this.calculateCurrentTranslateX();
|
26078 | var scrollLeft = this.adapter.getScrollAreaScrollLeft();
|
26079 | return scrollLeft - currentTranslateX;
|
26080 | };
|
26081 | |
26082 |
|
26083 |
|
26084 | MDCTabScrollerFoundation.prototype.handleInteraction = function () {
|
26085 |
|
26086 | if (!this.isAnimating) {
|
26087 | return;
|
26088 | }
|
26089 |
|
26090 | this.stopScrollAnimation();
|
26091 | };
|
26092 | |
26093 |
|
26094 |
|
26095 | MDCTabScrollerFoundation.prototype.handleTransitionEnd = function (evt) {
|
26096 |
|
26097 | var evtTarget = evt.target;
|
26098 | if (!this.isAnimating || !this.adapter.eventTargetMatchesSelector(evtTarget, MDCTabScrollerFoundation.strings.CONTENT_SELECTOR)) {
|
26099 | return;
|
26100 | }
|
26101 | this.isAnimating = false;
|
26102 | this.adapter.removeClass(MDCTabScrollerFoundation.cssClasses.ANIMATING);
|
26103 | };
|
26104 | |
26105 |
|
26106 |
|
26107 |
|
26108 | MDCTabScrollerFoundation.prototype.incrementScroll = function (scrollXIncrement) {
|
26109 |
|
26110 | if (scrollXIncrement === 0) {
|
26111 | return;
|
26112 | }
|
26113 | this.animate(this.getIncrementScrollOperation(scrollXIncrement));
|
26114 | };
|
26115 | |
26116 |
|
26117 |
|
26118 |
|
26119 | MDCTabScrollerFoundation.prototype.incrementScrollImmediate = function (scrollXIncrement) {
|
26120 |
|
26121 | if (scrollXIncrement === 0) {
|
26122 | return;
|
26123 | }
|
26124 | var operation = this.getIncrementScrollOperation(scrollXIncrement);
|
26125 | if (operation.scrollDelta === 0) {
|
26126 | return;
|
26127 | }
|
26128 | this.stopScrollAnimation();
|
26129 | this.adapter.setScrollAreaScrollLeft(operation.finalScrollPosition);
|
26130 | };
|
26131 | |
26132 |
|
26133 |
|
26134 | MDCTabScrollerFoundation.prototype.scrollTo = function (scrollX) {
|
26135 | if (this.isRTL()) {
|
26136 | this.scrollToImplRTL(scrollX);
|
26137 | return;
|
26138 | }
|
26139 | this.scrollToImpl(scrollX);
|
26140 | };
|
26141 | |
26142 |
|
26143 |
|
26144 | MDCTabScrollerFoundation.prototype.getRTLScroller = function () {
|
26145 | if (!this.rtlScrollerInstance) {
|
26146 | this.rtlScrollerInstance = this.rtlScrollerFactory();
|
26147 | }
|
26148 | return this.rtlScrollerInstance;
|
26149 | };
|
26150 | |
26151 |
|
26152 |
|
26153 | MDCTabScrollerFoundation.prototype.calculateCurrentTranslateX = function () {
|
26154 | var transformValue = this.adapter.getScrollContentStyleValue('transform');
|
26155 |
|
26156 | if (transformValue === 'none') {
|
26157 | return 0;
|
26158 | }
|
26159 |
|
26160 |
|
26161 |
|
26162 |
|
26163 | var match = /\((.+?)\)/.exec(transformValue);
|
26164 | if (!match) {
|
26165 | return 0;
|
26166 | }
|
26167 | var matrixParams = match[1];
|
26168 |
|
26169 |
|
26170 | var _a = __read(matrixParams.split(','), 6),
|
26171 | a = _a[0],
|
26172 | b = _a[1],
|
26173 | c = _a[2],
|
26174 | d = _a[3],
|
26175 | tx = _a[4],
|
26176 | ty = _a[5];
|
26177 | return parseFloat(tx);
|
26178 | };
|
26179 | |
26180 |
|
26181 |
|
26182 |
|
26183 | MDCTabScrollerFoundation.prototype.clampScrollValue = function (scrollX) {
|
26184 | var edges = this.calculateScrollEdges();
|
26185 | return Math.min(Math.max(edges.left, scrollX), edges.right);
|
26186 | };
|
26187 | MDCTabScrollerFoundation.prototype.computeCurrentScrollPositionRTL = function () {
|
26188 | var translateX = this.calculateCurrentTranslateX();
|
26189 | return this.getRTLScroller().getScrollPositionRTL(translateX);
|
26190 | };
|
26191 | MDCTabScrollerFoundation.prototype.calculateScrollEdges = function () {
|
26192 | var contentWidth = this.adapter.getScrollContentOffsetWidth();
|
26193 | var rootWidth = this.adapter.getScrollAreaOffsetWidth();
|
26194 | return {
|
26195 | left: 0,
|
26196 | right: contentWidth - rootWidth
|
26197 | };
|
26198 | };
|
26199 | |
26200 |
|
26201 |
|
26202 |
|
26203 | MDCTabScrollerFoundation.prototype.scrollToImpl = function (scrollX) {
|
26204 | var currentScrollX = this.getScrollPosition();
|
26205 | var safeScrollX = this.clampScrollValue(scrollX);
|
26206 | var scrollDelta = safeScrollX - currentScrollX;
|
26207 | this.animate({
|
26208 | finalScrollPosition: safeScrollX,
|
26209 | scrollDelta: scrollDelta
|
26210 | });
|
26211 | };
|
26212 | |
26213 |
|
26214 |
|
26215 |
|
26216 | MDCTabScrollerFoundation.prototype.scrollToImplRTL = function (scrollX) {
|
26217 | var animation = this.getRTLScroller().scrollToRTL(scrollX);
|
26218 | this.animate(animation);
|
26219 | };
|
26220 | |
26221 |
|
26222 |
|
26223 |
|
26224 |
|
26225 | MDCTabScrollerFoundation.prototype.getIncrementScrollOperation = function (scrollX) {
|
26226 | if (this.isRTL()) {
|
26227 | return this.getRTLScroller().incrementScrollRTL(scrollX);
|
26228 | }
|
26229 | var currentScrollX = this.getScrollPosition();
|
26230 | var targetScrollX = scrollX + currentScrollX;
|
26231 | var safeScrollX = this.clampScrollValue(targetScrollX);
|
26232 | var scrollDelta = safeScrollX - currentScrollX;
|
26233 | return {
|
26234 | finalScrollPosition: safeScrollX,
|
26235 | scrollDelta: scrollDelta
|
26236 | };
|
26237 | };
|
26238 | |
26239 |
|
26240 |
|
26241 |
|
26242 | MDCTabScrollerFoundation.prototype.animate = function (animation) {
|
26243 | var _this = this;
|
26244 |
|
26245 | if (animation.scrollDelta === 0) {
|
26246 | return;
|
26247 | }
|
26248 | this.stopScrollAnimation();
|
26249 |
|
26250 |
|
26251 | this.adapter.setScrollAreaScrollLeft(animation.finalScrollPosition);
|
26252 | this.adapter.setScrollContentStyleProperty('transform', "translateX(" + animation.scrollDelta + "px)");
|
26253 |
|
26254 | this.adapter.computeScrollAreaClientRect();
|
26255 | requestAnimationFrame(function () {
|
26256 | _this.adapter.addClass(MDCTabScrollerFoundation.cssClasses.ANIMATING);
|
26257 | _this.adapter.setScrollContentStyleProperty('transform', 'none');
|
26258 | });
|
26259 | this.isAnimating = true;
|
26260 | };
|
26261 | |
26262 |
|
26263 |
|
26264 | MDCTabScrollerFoundation.prototype.stopScrollAnimation = function () {
|
26265 | this.isAnimating = false;
|
26266 | var currentScrollPosition = this.getAnimatingScrollPosition();
|
26267 | this.adapter.removeClass(MDCTabScrollerFoundation.cssClasses.ANIMATING);
|
26268 | this.adapter.setScrollContentStyleProperty('transform', 'translateX(0px)');
|
26269 | this.adapter.setScrollAreaScrollLeft(currentScrollPosition);
|
26270 | };
|
26271 | |
26272 |
|
26273 |
|
26274 | MDCTabScrollerFoundation.prototype.getAnimatingScrollPosition = function () {
|
26275 | var currentTranslateX = this.calculateCurrentTranslateX();
|
26276 | var scrollLeft = this.adapter.getScrollAreaScrollLeft();
|
26277 | if (this.isRTL()) {
|
26278 | return this.getRTLScroller().getAnimatingScrollPosition(scrollLeft, currentTranslateX);
|
26279 | }
|
26280 | return scrollLeft - currentTranslateX;
|
26281 | };
|
26282 | |
26283 |
|
26284 |
|
26285 | MDCTabScrollerFoundation.prototype.rtlScrollerFactory = function () {
|
26286 |
|
26287 |
|
26288 |
|
26289 |
|
26290 |
|
26291 |
|
26292 |
|
26293 |
|
26294 |
|
26295 |
|
26296 |
|
26297 |
|
26298 |
|
26299 |
|
26300 |
|
26301 |
|
26302 |
|
26303 |
|
26304 | var initialScrollLeft = this.adapter.getScrollAreaScrollLeft();
|
26305 | this.adapter.setScrollAreaScrollLeft(initialScrollLeft - 1);
|
26306 | var newScrollLeft = this.adapter.getScrollAreaScrollLeft();
|
26307 |
|
26308 |
|
26309 |
|
26310 | if (newScrollLeft < 0) {
|
26311 |
|
26312 | this.adapter.setScrollAreaScrollLeft(initialScrollLeft);
|
26313 | return new rtl_negative_scroller_1.MDCTabScrollerRTLNegative(this.adapter);
|
26314 | }
|
26315 | var rootClientRect = this.adapter.computeScrollAreaClientRect();
|
26316 | var contentClientRect = this.adapter.computeScrollContentClientRect();
|
26317 | var rightEdgeDelta = Math.round(contentClientRect.right - rootClientRect.right);
|
26318 |
|
26319 | this.adapter.setScrollAreaScrollLeft(initialScrollLeft);
|
26320 |
|
26321 |
|
26322 |
|
26323 | if (rightEdgeDelta === newScrollLeft) {
|
26324 | return new rtl_reverse_scroller_1.MDCTabScrollerRTLReverse(this.adapter);
|
26325 | }
|
26326 | return new rtl_default_scroller_1.MDCTabScrollerRTLDefault(this.adapter);
|
26327 | };
|
26328 | MDCTabScrollerFoundation.prototype.isRTL = function () {
|
26329 | return this.adapter.getScrollContentStyleValue('direction') === 'rtl';
|
26330 | };
|
26331 | return MDCTabScrollerFoundation;
|
26332 | }(foundation_1.MDCFoundation);
|
26333 | exports.MDCTabScrollerFoundation = MDCTabScrollerFoundation;
|
26334 |
|
26335 | exports.default = MDCTabScrollerFoundation;
|
26336 |
|
26337 | }),
|
26338 |
|
26339 | "./packages/mdc-tab-scroller/index.ts":
|
26340 |
|
26341 |
|
26342 |
|
26343 |
|
26344 | (function(module, exports, __webpack_require__) {
|
26345 |
|
26346 | "use strict";
|
26347 |
|
26348 |
|
26349 |
|
26350 |
|
26351 |
|
26352 |
|
26353 |
|
26354 |
|
26355 |
|
26356 |
|
26357 |
|
26358 |
|
26359 |
|
26360 |
|
26361 |
|
26362 |
|
26363 |
|
26364 |
|
26365 |
|
26366 |
|
26367 |
|
26368 |
|
26369 |
|
26370 |
|
26371 | var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
|
26372 | if (k2 === undefined) k2 = k;
|
26373 | Object.defineProperty(o, k2, { enumerable: true, get: function get() {
|
26374 | return m[k];
|
26375 | } });
|
26376 | } : function (o, m, k, k2) {
|
26377 | if (k2 === undefined) k2 = k;
|
26378 | o[k2] = m[k];
|
26379 | });
|
26380 | var __setModuleDefault = this && this.__setModuleDefault || (Object.create ? function (o, v) {
|
26381 | Object.defineProperty(o, "default", { enumerable: true, value: v });
|
26382 | } : function (o, v) {
|
26383 | o["default"] = v;
|
26384 | });
|
26385 | var __importStar = this && this.__importStar || function (mod) {
|
26386 | if (mod && mod.__esModule) return mod;
|
26387 | var result = {};
|
26388 | if (mod != null) for (var k in mod) {
|
26389 | if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
26390 | }__setModuleDefault(result, mod);
|
26391 | return result;
|
26392 | };
|
26393 | var __exportStar = this && this.__exportStar || function (m, exports) {
|
26394 | for (var p in m) {
|
26395 | if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
26396 | }
|
26397 | };
|
26398 | Object.defineProperty(exports, "__esModule", { value: true });
|
26399 | exports.util = void 0;
|
26400 | var util = __importStar(__webpack_require__( "./packages/mdc-tab-scroller/util.ts"));
|
26401 | exports.util = util;
|
26402 | __exportStar(__webpack_require__( "./packages/mdc-tab-scroller/adapter.ts"), exports);
|
26403 | __exportStar(__webpack_require__( "./packages/mdc-tab-scroller/component.ts"), exports);
|
26404 | __exportStar(__webpack_require__( "./packages/mdc-tab-scroller/constants.ts"), exports);
|
26405 | __exportStar(__webpack_require__( "./packages/mdc-tab-scroller/foundation.ts"), exports);
|
26406 | __exportStar(__webpack_require__( "./packages/mdc-tab-scroller/types.ts"), exports);
|
26407 |
|
26408 | }),
|
26409 |
|
26410 | "./packages/mdc-tab-scroller/rtl-default-scroller.ts":
|
26411 |
|
26412 |
|
26413 |
|
26414 |
|
26415 | (function(module, exports, __webpack_require__) {
|
26416 |
|
26417 | "use strict";
|
26418 |
|
26419 |
|
26420 |
|
26421 |
|
26422 |
|
26423 |
|
26424 |
|
26425 |
|
26426 |
|
26427 |
|
26428 |
|
26429 |
|
26430 |
|
26431 |
|
26432 |
|
26433 |
|
26434 |
|
26435 |
|
26436 |
|
26437 |
|
26438 |
|
26439 |
|
26440 |
|
26441 |
|
26442 | var __extends = this && this.__extends || function () {
|
26443 | var _extendStatics = function extendStatics(d, b) {
|
26444 | _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
|
26445 | d.__proto__ = b;
|
26446 | } || function (d, b) {
|
26447 | for (var p in b) {
|
26448 | if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
26449 | }
|
26450 | };
|
26451 | return _extendStatics(d, b);
|
26452 | };
|
26453 | return function (d, b) {
|
26454 | if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
26455 | _extendStatics(d, b);
|
26456 | function __() {
|
26457 | this.constructor = d;
|
26458 | }
|
26459 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
26460 | };
|
26461 | }();
|
26462 | Object.defineProperty(exports, "__esModule", { value: true });
|
26463 | exports.MDCTabScrollerRTLDefault = void 0;
|
26464 | var rtl_scroller_1 = __webpack_require__( "./packages/mdc-tab-scroller/rtl-scroller.ts");
|
26465 | var MDCTabScrollerRTLDefault = function (_super) {
|
26466 | __extends(MDCTabScrollerRTLDefault, _super);
|
26467 | function MDCTabScrollerRTLDefault() {
|
26468 | return _super !== null && _super.apply(this, arguments) || this;
|
26469 | }
|
26470 | MDCTabScrollerRTLDefault.prototype.getScrollPositionRTL = function () {
|
26471 | var currentScrollLeft = this.adapter.getScrollAreaScrollLeft();
|
26472 | var right = this.calculateScrollEdges().right;
|
26473 |
|
26474 | return Math.round(right - currentScrollLeft);
|
26475 | };
|
26476 | MDCTabScrollerRTLDefault.prototype.scrollToRTL = function (scrollX) {
|
26477 | var edges = this.calculateScrollEdges();
|
26478 | var currentScrollLeft = this.adapter.getScrollAreaScrollLeft();
|
26479 | var clampedScrollLeft = this.clampScrollValue(edges.right - scrollX);
|
26480 | return {
|
26481 | finalScrollPosition: clampedScrollLeft,
|
26482 | scrollDelta: clampedScrollLeft - currentScrollLeft
|
26483 | };
|
26484 | };
|
26485 | MDCTabScrollerRTLDefault.prototype.incrementScrollRTL = function (scrollX) {
|
26486 | var currentScrollLeft = this.adapter.getScrollAreaScrollLeft();
|
26487 | var clampedScrollLeft = this.clampScrollValue(currentScrollLeft - scrollX);
|
26488 | return {
|
26489 | finalScrollPosition: clampedScrollLeft,
|
26490 | scrollDelta: clampedScrollLeft - currentScrollLeft
|
26491 | };
|
26492 | };
|
26493 | MDCTabScrollerRTLDefault.prototype.getAnimatingScrollPosition = function (scrollX) {
|
26494 | return scrollX;
|
26495 | };
|
26496 | MDCTabScrollerRTLDefault.prototype.calculateScrollEdges = function () {
|
26497 | var contentWidth = this.adapter.getScrollContentOffsetWidth();
|
26498 | var rootWidth = this.adapter.getScrollAreaOffsetWidth();
|
26499 | return {
|
26500 | left: 0,
|
26501 | right: contentWidth - rootWidth
|
26502 | };
|
26503 | };
|
26504 | MDCTabScrollerRTLDefault.prototype.clampScrollValue = function (scrollX) {
|
26505 | var edges = this.calculateScrollEdges();
|
26506 | return Math.min(Math.max(edges.left, scrollX), edges.right);
|
26507 | };
|
26508 | return MDCTabScrollerRTLDefault;
|
26509 | }(rtl_scroller_1.MDCTabScrollerRTL);
|
26510 | exports.MDCTabScrollerRTLDefault = MDCTabScrollerRTLDefault;
|
26511 |
|
26512 | exports.default = MDCTabScrollerRTLDefault;
|
26513 |
|
26514 | }),
|
26515 |
|
26516 | "./packages/mdc-tab-scroller/rtl-negative-scroller.ts":
|
26517 |
|
26518 |
|
26519 |
|
26520 |
|
26521 | (function(module, exports, __webpack_require__) {
|
26522 |
|
26523 | "use strict";
|
26524 |
|
26525 |
|
26526 |
|
26527 |
|
26528 |
|
26529 |
|
26530 |
|
26531 |
|
26532 |
|
26533 |
|
26534 |
|
26535 |
|
26536 |
|
26537 |
|
26538 |
|
26539 |
|
26540 |
|
26541 |
|
26542 |
|
26543 |
|
26544 |
|
26545 |
|
26546 |
|
26547 |
|
26548 | var __extends = this && this.__extends || function () {
|
26549 | var _extendStatics = function extendStatics(d, b) {
|
26550 | _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
|
26551 | d.__proto__ = b;
|
26552 | } || function (d, b) {
|
26553 | for (var p in b) {
|
26554 | if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
26555 | }
|
26556 | };
|
26557 | return _extendStatics(d, b);
|
26558 | };
|
26559 | return function (d, b) {
|
26560 | if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
26561 | _extendStatics(d, b);
|
26562 | function __() {
|
26563 | this.constructor = d;
|
26564 | }
|
26565 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
26566 | };
|
26567 | }();
|
26568 | Object.defineProperty(exports, "__esModule", { value: true });
|
26569 | exports.MDCTabScrollerRTLNegative = void 0;
|
26570 | var rtl_scroller_1 = __webpack_require__( "./packages/mdc-tab-scroller/rtl-scroller.ts");
|
26571 | var MDCTabScrollerRTLNegative = function (_super) {
|
26572 | __extends(MDCTabScrollerRTLNegative, _super);
|
26573 | function MDCTabScrollerRTLNegative() {
|
26574 | return _super !== null && _super.apply(this, arguments) || this;
|
26575 | }
|
26576 | MDCTabScrollerRTLNegative.prototype.getScrollPositionRTL = function (translateX) {
|
26577 | var currentScrollLeft = this.adapter.getScrollAreaScrollLeft();
|
26578 | return Math.round(translateX - currentScrollLeft);
|
26579 | };
|
26580 | MDCTabScrollerRTLNegative.prototype.scrollToRTL = function (scrollX) {
|
26581 | var currentScrollLeft = this.adapter.getScrollAreaScrollLeft();
|
26582 | var clampedScrollLeft = this.clampScrollValue(-scrollX);
|
26583 | return {
|
26584 | finalScrollPosition: clampedScrollLeft,
|
26585 | scrollDelta: clampedScrollLeft - currentScrollLeft
|
26586 | };
|
26587 | };
|
26588 | MDCTabScrollerRTLNegative.prototype.incrementScrollRTL = function (scrollX) {
|
26589 | var currentScrollLeft = this.adapter.getScrollAreaScrollLeft();
|
26590 | var clampedScrollLeft = this.clampScrollValue(currentScrollLeft - scrollX);
|
26591 | return {
|
26592 | finalScrollPosition: clampedScrollLeft,
|
26593 | scrollDelta: clampedScrollLeft - currentScrollLeft
|
26594 | };
|
26595 | };
|
26596 | MDCTabScrollerRTLNegative.prototype.getAnimatingScrollPosition = function (scrollX, translateX) {
|
26597 | return scrollX - translateX;
|
26598 | };
|
26599 | MDCTabScrollerRTLNegative.prototype.calculateScrollEdges = function () {
|
26600 | var contentWidth = this.adapter.getScrollContentOffsetWidth();
|
26601 | var rootWidth = this.adapter.getScrollAreaOffsetWidth();
|
26602 | return {
|
26603 | left: rootWidth - contentWidth,
|
26604 | right: 0
|
26605 | };
|
26606 | };
|
26607 | MDCTabScrollerRTLNegative.prototype.clampScrollValue = function (scrollX) {
|
26608 | var edges = this.calculateScrollEdges();
|
26609 | return Math.max(Math.min(edges.right, scrollX), edges.left);
|
26610 | };
|
26611 | return MDCTabScrollerRTLNegative;
|
26612 | }(rtl_scroller_1.MDCTabScrollerRTL);
|
26613 | exports.MDCTabScrollerRTLNegative = MDCTabScrollerRTLNegative;
|
26614 |
|
26615 | exports.default = MDCTabScrollerRTLNegative;
|
26616 |
|
26617 | }),
|
26618 |
|
26619 | "./packages/mdc-tab-scroller/rtl-reverse-scroller.ts":
|
26620 |
|
26621 |
|
26622 |
|
26623 |
|
26624 | (function(module, exports, __webpack_require__) {
|
26625 |
|
26626 | "use strict";
|
26627 |
|
26628 |
|
26629 |
|
26630 |
|
26631 |
|
26632 |
|
26633 |
|
26634 |
|
26635 |
|
26636 |
|
26637 |
|
26638 |
|
26639 |
|
26640 |
|
26641 |
|
26642 |
|
26643 |
|
26644 |
|
26645 |
|
26646 |
|
26647 |
|
26648 |
|
26649 |
|
26650 |
|
26651 | var __extends = this && this.__extends || function () {
|
26652 | var _extendStatics = function extendStatics(d, b) {
|
26653 | _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
|
26654 | d.__proto__ = b;
|
26655 | } || function (d, b) {
|
26656 | for (var p in b) {
|
26657 | if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
26658 | }
|
26659 | };
|
26660 | return _extendStatics(d, b);
|
26661 | };
|
26662 | return function (d, b) {
|
26663 | if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
26664 | _extendStatics(d, b);
|
26665 | function __() {
|
26666 | this.constructor = d;
|
26667 | }
|
26668 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
26669 | };
|
26670 | }();
|
26671 | Object.defineProperty(exports, "__esModule", { value: true });
|
26672 | exports.MDCTabScrollerRTLReverse = void 0;
|
26673 | var rtl_scroller_1 = __webpack_require__( "./packages/mdc-tab-scroller/rtl-scroller.ts");
|
26674 | var MDCTabScrollerRTLReverse = function (_super) {
|
26675 | __extends(MDCTabScrollerRTLReverse, _super);
|
26676 | function MDCTabScrollerRTLReverse() {
|
26677 | return _super !== null && _super.apply(this, arguments) || this;
|
26678 | }
|
26679 | MDCTabScrollerRTLReverse.prototype.getScrollPositionRTL = function (translateX) {
|
26680 | var currentScrollLeft = this.adapter.getScrollAreaScrollLeft();
|
26681 |
|
26682 | return Math.round(currentScrollLeft - translateX);
|
26683 | };
|
26684 | MDCTabScrollerRTLReverse.prototype.scrollToRTL = function (scrollX) {
|
26685 | var currentScrollLeft = this.adapter.getScrollAreaScrollLeft();
|
26686 | var clampedScrollLeft = this.clampScrollValue(scrollX);
|
26687 | return {
|
26688 | finalScrollPosition: clampedScrollLeft,
|
26689 | scrollDelta: currentScrollLeft - clampedScrollLeft
|
26690 | };
|
26691 | };
|
26692 | MDCTabScrollerRTLReverse.prototype.incrementScrollRTL = function (scrollX) {
|
26693 | var currentScrollLeft = this.adapter.getScrollAreaScrollLeft();
|
26694 | var clampedScrollLeft = this.clampScrollValue(currentScrollLeft + scrollX);
|
26695 | return {
|
26696 | finalScrollPosition: clampedScrollLeft,
|
26697 | scrollDelta: currentScrollLeft - clampedScrollLeft
|
26698 | };
|
26699 | };
|
26700 | MDCTabScrollerRTLReverse.prototype.getAnimatingScrollPosition = function (scrollX, translateX) {
|
26701 | return scrollX + translateX;
|
26702 | };
|
26703 | MDCTabScrollerRTLReverse.prototype.calculateScrollEdges = function () {
|
26704 | var contentWidth = this.adapter.getScrollContentOffsetWidth();
|
26705 | var rootWidth = this.adapter.getScrollAreaOffsetWidth();
|
26706 | return {
|
26707 | left: contentWidth - rootWidth,
|
26708 | right: 0
|
26709 | };
|
26710 | };
|
26711 | MDCTabScrollerRTLReverse.prototype.clampScrollValue = function (scrollX) {
|
26712 | var edges = this.calculateScrollEdges();
|
26713 | return Math.min(Math.max(edges.right, scrollX), edges.left);
|
26714 | };
|
26715 | return MDCTabScrollerRTLReverse;
|
26716 | }(rtl_scroller_1.MDCTabScrollerRTL);
|
26717 | exports.MDCTabScrollerRTLReverse = MDCTabScrollerRTLReverse;
|
26718 |
|
26719 | exports.default = MDCTabScrollerRTLReverse;
|
26720 |
|
26721 | }),
|
26722 |
|
26723 | "./packages/mdc-tab-scroller/rtl-scroller.ts":
|
26724 |
|
26725 |
|
26726 |
|
26727 |
|
26728 | (function(module, exports, __webpack_require__) {
|
26729 |
|
26730 | "use strict";
|
26731 |
|
26732 |
|
26733 |
|
26734 |
|
26735 |
|
26736 |
|
26737 |
|
26738 |
|
26739 |
|
26740 |
|
26741 |
|
26742 |
|
26743 |
|
26744 |
|
26745 |
|
26746 |
|
26747 |
|
26748 |
|
26749 |
|
26750 |
|
26751 |
|
26752 |
|
26753 |
|
26754 |
|
26755 | Object.defineProperty(exports, "__esModule", { value: true });
|
26756 | exports.MDCTabScrollerRTL = void 0;
|
26757 | var MDCTabScrollerRTL = function () {
|
26758 | function MDCTabScrollerRTL(adapter) {
|
26759 | this.adapter = adapter;
|
26760 | }
|
26761 | return MDCTabScrollerRTL;
|
26762 | }();
|
26763 | exports.MDCTabScrollerRTL = MDCTabScrollerRTL;
|
26764 |
|
26765 | exports.default = MDCTabScrollerRTL;
|
26766 |
|
26767 | }),
|
26768 |
|
26769 | "./packages/mdc-tab-scroller/types.ts":
|
26770 |
|
26771 |
|
26772 |
|
26773 |
|
26774 | (function(module, exports, __webpack_require__) {
|
26775 |
|
26776 | "use strict";
|
26777 |
|
26778 |
|
26779 |
|
26780 |
|
26781 |
|
26782 |
|
26783 |
|
26784 |
|
26785 |
|
26786 |
|
26787 |
|
26788 |
|
26789 |
|
26790 |
|
26791 |
|
26792 |
|
26793 |
|
26794 |
|
26795 |
|
26796 |
|
26797 |
|
26798 |
|
26799 |
|
26800 |
|
26801 | Object.defineProperty(exports, "__esModule", { value: true });
|
26802 |
|
26803 | }),
|
26804 |
|
26805 | "./packages/mdc-tab-scroller/util.ts":
|
26806 |
|
26807 |
|
26808 |
|
26809 |
|
26810 | (function(module, exports, __webpack_require__) {
|
26811 |
|
26812 | "use strict";
|
26813 |
|
26814 |
|
26815 |
|
26816 |
|
26817 |
|
26818 |
|
26819 |
|
26820 |
|
26821 |
|
26822 |
|
26823 |
|
26824 |
|
26825 |
|
26826 |
|
26827 |
|
26828 |
|
26829 |
|
26830 |
|
26831 |
|
26832 |
|
26833 |
|
26834 |
|
26835 |
|
26836 |
|
26837 | Object.defineProperty(exports, "__esModule", { value: true });
|
26838 | exports.computeHorizontalScrollbarHeight = void 0;
|
26839 | var constants_1 = __webpack_require__( "./packages/mdc-tab-scroller/constants.ts");
|
26840 |
|
26841 |
|
26842 |
|
26843 | var horizontalScrollbarHeight_;
|
26844 |
|
26845 |
|
26846 |
|
26847 |
|
26848 | function computeHorizontalScrollbarHeight(documentObj, shouldCacheResult) {
|
26849 | if (shouldCacheResult === void 0) {
|
26850 | shouldCacheResult = true;
|
26851 | }
|
26852 | if (shouldCacheResult && typeof horizontalScrollbarHeight_ !== 'undefined') {
|
26853 | return horizontalScrollbarHeight_;
|
26854 | }
|
26855 | var el = documentObj.createElement('div');
|
26856 | el.classList.add(constants_1.cssClasses.SCROLL_TEST);
|
26857 | documentObj.body.appendChild(el);
|
26858 | var horizontalScrollbarHeight = el.offsetHeight - el.clientHeight;
|
26859 | documentObj.body.removeChild(el);
|
26860 | if (shouldCacheResult) {
|
26861 | horizontalScrollbarHeight_ = horizontalScrollbarHeight;
|
26862 | }
|
26863 | return horizontalScrollbarHeight;
|
26864 | }
|
26865 | exports.computeHorizontalScrollbarHeight = computeHorizontalScrollbarHeight;
|
26866 |
|
26867 | }),
|
26868 |
|
26869 | "./packages/mdc-tab/adapter.ts":
|
26870 |
|
26871 |
|
26872 |
|
26873 |
|
26874 | (function(module, exports, __webpack_require__) {
|
26875 |
|
26876 | "use strict";
|
26877 |
|
26878 |
|
26879 |
|
26880 |
|
26881 |
|
26882 |
|
26883 |
|
26884 |
|
26885 |
|
26886 |
|
26887 |
|
26888 |
|
26889 |
|
26890 |
|
26891 |
|
26892 |
|
26893 |
|
26894 |
|
26895 |
|
26896 |
|
26897 |
|
26898 |
|
26899 |
|
26900 |
|
26901 | Object.defineProperty(exports, "__esModule", { value: true });
|
26902 |
|
26903 | }),
|
26904 |
|
26905 | "./packages/mdc-tab/component.ts":
|
26906 |
|
26907 |
|
26908 |
|
26909 |
|
26910 | (function(module, exports, __webpack_require__) {
|
26911 |
|
26912 | "use strict";
|
26913 |
|
26914 |
|
26915 |
|
26916 |
|
26917 |
|
26918 |
|
26919 |
|
26920 |
|
26921 |
|
26922 |
|
26923 |
|
26924 |
|
26925 |
|
26926 |
|
26927 |
|
26928 |
|
26929 |
|
26930 |
|
26931 |
|
26932 |
|
26933 |
|
26934 |
|
26935 |
|
26936 |
|
26937 | var __extends = this && this.__extends || function () {
|
26938 | var _extendStatics = function extendStatics(d, b) {
|
26939 | _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
|
26940 | d.__proto__ = b;
|
26941 | } || function (d, b) {
|
26942 | for (var p in b) {
|
26943 | if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
26944 | }
|
26945 | };
|
26946 | return _extendStatics(d, b);
|
26947 | };
|
26948 | return function (d, b) {
|
26949 | if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
26950 | _extendStatics(d, b);
|
26951 | function __() {
|
26952 | this.constructor = d;
|
26953 | }
|
26954 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
26955 | };
|
26956 | }();
|
26957 | Object.defineProperty(exports, "__esModule", { value: true });
|
26958 | exports.MDCTab = void 0;
|
26959 | var component_1 = __webpack_require__( "./packages/mdc-base/component.ts");
|
26960 | var component_2 = __webpack_require__( "./packages/mdc-ripple/component.ts");
|
26961 | var foundation_1 = __webpack_require__( "./packages/mdc-ripple/foundation.ts");
|
26962 | var component_3 = __webpack_require__( "./packages/mdc-tab-indicator/component.ts");
|
26963 | var foundation_2 = __webpack_require__( "./packages/mdc-tab/foundation.ts");
|
26964 | var MDCTab = function (_super) {
|
26965 | __extends(MDCTab, _super);
|
26966 | function MDCTab() {
|
26967 | return _super !== null && _super.apply(this, arguments) || this;
|
26968 | }
|
26969 | MDCTab.attachTo = function (root) {
|
26970 | return new MDCTab(root);
|
26971 | };
|
26972 | MDCTab.prototype.initialize = function (rippleFactory, tabIndicatorFactory) {
|
26973 | if (rippleFactory === void 0) {
|
26974 | rippleFactory = function rippleFactory(el, foundation) {
|
26975 | return new component_2.MDCRipple(el, foundation);
|
26976 | };
|
26977 | }
|
26978 | if (tabIndicatorFactory === void 0) {
|
26979 | tabIndicatorFactory = function tabIndicatorFactory(el) {
|
26980 | return new component_3.MDCTabIndicator(el);
|
26981 | };
|
26982 | }
|
26983 | this.id = this.root.id;
|
26984 | var rippleFoundation = new foundation_1.MDCRippleFoundation(component_2.MDCRipple.createAdapter(this));
|
26985 | this.ripple = rippleFactory(this.root, rippleFoundation);
|
26986 | var tabIndicatorElement = this.root.querySelector(foundation_2.MDCTabFoundation.strings.TAB_INDICATOR_SELECTOR);
|
26987 | this.tabIndicator = tabIndicatorFactory(tabIndicatorElement);
|
26988 | this.content = this.root.querySelector(foundation_2.MDCTabFoundation.strings.CONTENT_SELECTOR);
|
26989 | };
|
26990 | MDCTab.prototype.initialSyncWithDOM = function () {
|
26991 | var _this = this;
|
26992 | this.handleClick = function () {
|
26993 | _this.foundation.handleClick();
|
26994 | };
|
26995 | this.listen('click', this.handleClick);
|
26996 | };
|
26997 | MDCTab.prototype.destroy = function () {
|
26998 | this.unlisten('click', this.handleClick);
|
26999 | this.ripple.destroy();
|
27000 | _super.prototype.destroy.call(this);
|
27001 | };
|
27002 | MDCTab.prototype.getDefaultFoundation = function () {
|
27003 | var _this = this;
|
27004 |
|
27005 |
|
27006 |
|
27007 | var adapter = {
|
27008 | setAttr: function setAttr(attr, value) {
|
27009 | return _this.root.setAttribute(attr, value);
|
27010 | },
|
27011 | addClass: function addClass(className) {
|
27012 | return _this.root.classList.add(className);
|
27013 | },
|
27014 | removeClass: function removeClass(className) {
|
27015 | return _this.root.classList.remove(className);
|
27016 | },
|
27017 | hasClass: function hasClass(className) {
|
27018 | return _this.root.classList.contains(className);
|
27019 | },
|
27020 | activateIndicator: function activateIndicator(previousIndicatorClientRect) {
|
27021 | _this.tabIndicator.activate(previousIndicatorClientRect);
|
27022 | },
|
27023 | deactivateIndicator: function deactivateIndicator() {
|
27024 | _this.tabIndicator.deactivate();
|
27025 | },
|
27026 | notifyInteracted: function notifyInteracted() {
|
27027 | return _this.emit(foundation_2.MDCTabFoundation.strings.INTERACTED_EVENT, { tabId: _this.id }, true );
|
27028 | },
|
27029 | getOffsetLeft: function getOffsetLeft() {
|
27030 | return _this.root.offsetLeft;
|
27031 | },
|
27032 | getOffsetWidth: function getOffsetWidth() {
|
27033 | return _this.root.offsetWidth;
|
27034 | },
|
27035 | getContentOffsetLeft: function getContentOffsetLeft() {
|
27036 | return _this.content.offsetLeft;
|
27037 | },
|
27038 | getContentOffsetWidth: function getContentOffsetWidth() {
|
27039 | return _this.content.offsetWidth;
|
27040 | },
|
27041 | focus: function focus() {
|
27042 | return _this.root.focus();
|
27043 | }
|
27044 | };
|
27045 |
|
27046 | return new foundation_2.MDCTabFoundation(adapter);
|
27047 | };
|
27048 | Object.defineProperty(MDCTab.prototype, "active", {
|
27049 | |
27050 |
|
27051 |
|
27052 | get: function get() {
|
27053 | return this.foundation.isActive();
|
27054 | },
|
27055 | enumerable: false,
|
27056 | configurable: true
|
27057 | });
|
27058 | Object.defineProperty(MDCTab.prototype, "focusOnActivate", {
|
27059 | set: function set(focusOnActivate) {
|
27060 | this.foundation.setFocusOnActivate(focusOnActivate);
|
27061 | },
|
27062 | enumerable: false,
|
27063 | configurable: true
|
27064 | });
|
27065 | |
27066 |
|
27067 |
|
27068 | MDCTab.prototype.activate = function (computeIndicatorClientRect) {
|
27069 | this.foundation.activate(computeIndicatorClientRect);
|
27070 | };
|
27071 | |
27072 |
|
27073 |
|
27074 | MDCTab.prototype.deactivate = function () {
|
27075 | this.foundation.deactivate();
|
27076 | };
|
27077 | |
27078 |
|
27079 |
|
27080 | MDCTab.prototype.computeIndicatorClientRect = function () {
|
27081 | return this.tabIndicator.computeContentClientRect();
|
27082 | };
|
27083 | MDCTab.prototype.computeDimensions = function () {
|
27084 | return this.foundation.computeDimensions();
|
27085 | };
|
27086 | |
27087 |
|
27088 |
|
27089 | MDCTab.prototype.focus = function () {
|
27090 | this.root.focus();
|
27091 | };
|
27092 | return MDCTab;
|
27093 | }(component_1.MDCComponent);
|
27094 | exports.MDCTab = MDCTab;
|
27095 |
|
27096 | }),
|
27097 |
|
27098 | "./packages/mdc-tab/constants.ts":
|
27099 |
|
27100 |
|
27101 |
|
27102 |
|
27103 | (function(module, exports, __webpack_require__) {
|
27104 |
|
27105 | "use strict";
|
27106 |
|
27107 |
|
27108 |
|
27109 |
|
27110 |
|
27111 |
|
27112 |
|
27113 |
|
27114 |
|
27115 |
|
27116 |
|
27117 |
|
27118 |
|
27119 |
|
27120 |
|
27121 |
|
27122 |
|
27123 |
|
27124 |
|
27125 |
|
27126 |
|
27127 |
|
27128 |
|
27129 |
|
27130 | Object.defineProperty(exports, "__esModule", { value: true });
|
27131 | exports.strings = exports.cssClasses = void 0;
|
27132 | var cssClasses = {
|
27133 | ACTIVE: 'mdc-tab--active'
|
27134 | };
|
27135 | exports.cssClasses = cssClasses;
|
27136 | var strings = {
|
27137 | ARIA_SELECTED: 'aria-selected',
|
27138 | CONTENT_SELECTOR: '.mdc-tab__content',
|
27139 | INTERACTED_EVENT: 'MDCTab:interacted',
|
27140 | RIPPLE_SELECTOR: '.mdc-tab__ripple',
|
27141 | TABINDEX: 'tabIndex',
|
27142 | TAB_INDICATOR_SELECTOR: '.mdc-tab-indicator'
|
27143 | };
|
27144 | exports.strings = strings;
|
27145 |
|
27146 | }),
|
27147 |
|
27148 | "./packages/mdc-tab/foundation.ts":
|
27149 |
|
27150 |
|
27151 |
|
27152 |
|
27153 | (function(module, exports, __webpack_require__) {
|
27154 |
|
27155 | "use strict";
|
27156 |
|
27157 |
|
27158 |
|
27159 |
|
27160 |
|
27161 |
|
27162 |
|
27163 |
|
27164 |
|
27165 |
|
27166 |
|
27167 |
|
27168 |
|
27169 |
|
27170 |
|
27171 |
|
27172 |
|
27173 |
|
27174 |
|
27175 |
|
27176 |
|
27177 |
|
27178 |
|
27179 |
|
27180 | var __extends = this && this.__extends || function () {
|
27181 | var _extendStatics = function extendStatics(d, b) {
|
27182 | _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
|
27183 | d.__proto__ = b;
|
27184 | } || function (d, b) {
|
27185 | for (var p in b) {
|
27186 | if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
27187 | }
|
27188 | };
|
27189 | return _extendStatics(d, b);
|
27190 | };
|
27191 | return function (d, b) {
|
27192 | if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
27193 | _extendStatics(d, b);
|
27194 | function __() {
|
27195 | this.constructor = d;
|
27196 | }
|
27197 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
27198 | };
|
27199 | }();
|
27200 | var __assign = this && this.__assign || function () {
|
27201 | __assign = Object.assign || function (t) {
|
27202 | for (var s, i = 1, n = arguments.length; i < n; i++) {
|
27203 | s = arguments[i];
|
27204 | for (var p in s) {
|
27205 | if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
27206 | }
|
27207 | }
|
27208 | return t;
|
27209 | };
|
27210 | return __assign.apply(this, arguments);
|
27211 | };
|
27212 | Object.defineProperty(exports, "__esModule", { value: true });
|
27213 | exports.MDCTabFoundation = void 0;
|
27214 | var foundation_1 = __webpack_require__( "./packages/mdc-base/foundation.ts");
|
27215 | var constants_1 = __webpack_require__( "./packages/mdc-tab/constants.ts");
|
27216 | var MDCTabFoundation = function (_super) {
|
27217 | __extends(MDCTabFoundation, _super);
|
27218 | function MDCTabFoundation(adapter) {
|
27219 | var _this = _super.call(this, __assign(__assign({}, MDCTabFoundation.defaultAdapter), adapter)) || this;
|
27220 | _this.focusOnActivate = true;
|
27221 | return _this;
|
27222 | }
|
27223 | Object.defineProperty(MDCTabFoundation, "cssClasses", {
|
27224 | get: function get() {
|
27225 | return constants_1.cssClasses;
|
27226 | },
|
27227 | enumerable: false,
|
27228 | configurable: true
|
27229 | });
|
27230 | Object.defineProperty(MDCTabFoundation, "strings", {
|
27231 | get: function get() {
|
27232 | return constants_1.strings;
|
27233 | },
|
27234 | enumerable: false,
|
27235 | configurable: true
|
27236 | });
|
27237 | Object.defineProperty(MDCTabFoundation, "defaultAdapter", {
|
27238 | get: function get() {
|
27239 |
|
27240 | return {
|
27241 | addClass: function addClass() {
|
27242 | return undefined;
|
27243 | },
|
27244 | removeClass: function removeClass() {
|
27245 | return undefined;
|
27246 | },
|
27247 | hasClass: function hasClass() {
|
27248 | return false;
|
27249 | },
|
27250 | setAttr: function setAttr() {
|
27251 | return undefined;
|
27252 | },
|
27253 | activateIndicator: function activateIndicator() {
|
27254 | return undefined;
|
27255 | },
|
27256 | deactivateIndicator: function deactivateIndicator() {
|
27257 | return undefined;
|
27258 | },
|
27259 | notifyInteracted: function notifyInteracted() {
|
27260 | return undefined;
|
27261 | },
|
27262 | getOffsetLeft: function getOffsetLeft() {
|
27263 | return 0;
|
27264 | },
|
27265 | getOffsetWidth: function getOffsetWidth() {
|
27266 | return 0;
|
27267 | },
|
27268 | getContentOffsetLeft: function getContentOffsetLeft() {
|
27269 | return 0;
|
27270 | },
|
27271 | getContentOffsetWidth: function getContentOffsetWidth() {
|
27272 | return 0;
|
27273 | },
|
27274 | focus: function focus() {
|
27275 | return undefined;
|
27276 | }
|
27277 | };
|
27278 |
|
27279 | },
|
27280 | enumerable: false,
|
27281 | configurable: true
|
27282 | });
|
27283 | MDCTabFoundation.prototype.handleClick = function () {
|
27284 |
|
27285 |
|
27286 | this.adapter.notifyInteracted();
|
27287 | };
|
27288 | MDCTabFoundation.prototype.isActive = function () {
|
27289 | return this.adapter.hasClass(constants_1.cssClasses.ACTIVE);
|
27290 | };
|
27291 | |
27292 |
|
27293 |
|
27294 | MDCTabFoundation.prototype.setFocusOnActivate = function (focusOnActivate) {
|
27295 | this.focusOnActivate = focusOnActivate;
|
27296 | };
|
27297 | |
27298 |
|
27299 |
|
27300 | MDCTabFoundation.prototype.activate = function (previousIndicatorClientRect) {
|
27301 | this.adapter.addClass(constants_1.cssClasses.ACTIVE);
|
27302 | this.adapter.setAttr(constants_1.strings.ARIA_SELECTED, 'true');
|
27303 | this.adapter.setAttr(constants_1.strings.TABINDEX, '0');
|
27304 | this.adapter.activateIndicator(previousIndicatorClientRect);
|
27305 | if (this.focusOnActivate) {
|
27306 | this.adapter.focus();
|
27307 | }
|
27308 | };
|
27309 | |
27310 |
|
27311 |
|
27312 | MDCTabFoundation.prototype.deactivate = function () {
|
27313 |
|
27314 | if (!this.isActive()) {
|
27315 | return;
|
27316 | }
|
27317 | this.adapter.removeClass(constants_1.cssClasses.ACTIVE);
|
27318 | this.adapter.setAttr(constants_1.strings.ARIA_SELECTED, 'false');
|
27319 | this.adapter.setAttr(constants_1.strings.TABINDEX, '-1');
|
27320 | this.adapter.deactivateIndicator();
|
27321 | };
|
27322 | |
27323 |
|
27324 |
|
27325 | MDCTabFoundation.prototype.computeDimensions = function () {
|
27326 | var rootWidth = this.adapter.getOffsetWidth();
|
27327 | var rootLeft = this.adapter.getOffsetLeft();
|
27328 | var contentWidth = this.adapter.getContentOffsetWidth();
|
27329 | var contentLeft = this.adapter.getContentOffsetLeft();
|
27330 | return {
|
27331 | contentLeft: rootLeft + contentLeft,
|
27332 | contentRight: rootLeft + contentLeft + contentWidth,
|
27333 | rootLeft: rootLeft,
|
27334 | rootRight: rootLeft + rootWidth
|
27335 | };
|
27336 | };
|
27337 | return MDCTabFoundation;
|
27338 | }(foundation_1.MDCFoundation);
|
27339 | exports.MDCTabFoundation = MDCTabFoundation;
|
27340 |
|
27341 | exports.default = MDCTabFoundation;
|
27342 |
|
27343 | }),
|
27344 |
|
27345 | "./packages/mdc-tab/index.ts":
|
27346 |
|
27347 |
|
27348 |
|
27349 |
|
27350 | (function(module, exports, __webpack_require__) {
|
27351 |
|
27352 | "use strict";
|
27353 |
|
27354 |
|
27355 |
|
27356 |
|
27357 |
|
27358 |
|
27359 |
|
27360 |
|
27361 |
|
27362 |
|
27363 |
|
27364 |
|
27365 |
|
27366 |
|
27367 |
|
27368 |
|
27369 |
|
27370 |
|
27371 |
|
27372 |
|
27373 |
|
27374 |
|
27375 |
|
27376 |
|
27377 | var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
|
27378 | if (k2 === undefined) k2 = k;
|
27379 | Object.defineProperty(o, k2, { enumerable: true, get: function get() {
|
27380 | return m[k];
|
27381 | } });
|
27382 | } : function (o, m, k, k2) {
|
27383 | if (k2 === undefined) k2 = k;
|
27384 | o[k2] = m[k];
|
27385 | });
|
27386 | var __exportStar = this && this.__exportStar || function (m, exports) {
|
27387 | for (var p in m) {
|
27388 | if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
27389 | }
|
27390 | };
|
27391 | Object.defineProperty(exports, "__esModule", { value: true });
|
27392 | __exportStar(__webpack_require__( "./packages/mdc-tab/adapter.ts"), exports);
|
27393 | __exportStar(__webpack_require__( "./packages/mdc-tab/component.ts"), exports);
|
27394 | __exportStar(__webpack_require__( "./packages/mdc-tab/constants.ts"), exports);
|
27395 | __exportStar(__webpack_require__( "./packages/mdc-tab/foundation.ts"), exports);
|
27396 | __exportStar(__webpack_require__( "./packages/mdc-tab/types.ts"), exports);
|
27397 |
|
27398 | }),
|
27399 |
|
27400 | "./packages/mdc-tab/types.ts":
|
27401 |
|
27402 |
|
27403 |
|
27404 |
|
27405 | (function(module, exports, __webpack_require__) {
|
27406 |
|
27407 | "use strict";
|
27408 |
|
27409 |
|
27410 |
|
27411 |
|
27412 |
|
27413 |
|
27414 |
|
27415 |
|
27416 |
|
27417 |
|
27418 |
|
27419 |
|
27420 |
|
27421 |
|
27422 |
|
27423 |
|
27424 |
|
27425 |
|
27426 |
|
27427 |
|
27428 |
|
27429 |
|
27430 |
|
27431 |
|
27432 | Object.defineProperty(exports, "__esModule", { value: true });
|
27433 |
|
27434 | }),
|
27435 |
|
27436 | "./packages/mdc-textfield/adapter.ts":
|
27437 |
|
27438 |
|
27439 |
|
27440 |
|
27441 | (function(module, exports, __webpack_require__) {
|
27442 |
|
27443 | "use strict";
|
27444 |
|
27445 |
|
27446 |
|
27447 |
|
27448 |
|
27449 |
|
27450 |
|
27451 |
|
27452 |
|
27453 |
|
27454 |
|
27455 |
|
27456 |
|
27457 |
|
27458 |
|
27459 |
|
27460 |
|
27461 |
|
27462 |
|
27463 |
|
27464 |
|
27465 |
|
27466 |
|
27467 |
|
27468 | Object.defineProperty(exports, "__esModule", { value: true });
|
27469 |
|
27470 | }),
|
27471 |
|
27472 | "./packages/mdc-textfield/character-counter/adapter.ts":
|
27473 |
|
27474 |
|
27475 |
|
27476 |
|
27477 | (function(module, exports, __webpack_require__) {
|
27478 |
|
27479 | "use strict";
|
27480 |
|
27481 |
|
27482 |
|
27483 |
|
27484 |
|
27485 |
|
27486 |
|
27487 |
|
27488 |
|
27489 |
|
27490 |
|
27491 |
|
27492 |
|
27493 |
|
27494 |
|
27495 |
|
27496 |
|
27497 |
|
27498 |
|
27499 |
|
27500 |
|
27501 |
|
27502 |
|
27503 |
|
27504 | Object.defineProperty(exports, "__esModule", { value: true });
|
27505 |
|
27506 | }),
|
27507 |
|
27508 | "./packages/mdc-textfield/character-counter/component.ts":
|
27509 |
|
27510 |
|
27511 |
|
27512 |
|
27513 | (function(module, exports, __webpack_require__) {
|
27514 |
|
27515 | "use strict";
|
27516 |
|
27517 |
|
27518 |
|
27519 |
|
27520 |
|
27521 |
|
27522 |
|
27523 |
|
27524 |
|
27525 |
|
27526 |
|
27527 |
|
27528 |
|
27529 |
|
27530 |
|
27531 |
|
27532 |
|
27533 |
|
27534 |
|
27535 |
|
27536 |
|
27537 |
|
27538 |
|
27539 |
|
27540 | var __extends = this && this.__extends || function () {
|
27541 | var _extendStatics = function extendStatics(d, b) {
|
27542 | _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
|
27543 | d.__proto__ = b;
|
27544 | } || function (d, b) {
|
27545 | for (var p in b) {
|
27546 | if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
27547 | }
|
27548 | };
|
27549 | return _extendStatics(d, b);
|
27550 | };
|
27551 | return function (d, b) {
|
27552 | if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
27553 | _extendStatics(d, b);
|
27554 | function __() {
|
27555 | this.constructor = d;
|
27556 | }
|
27557 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
27558 | };
|
27559 | }();
|
27560 | Object.defineProperty(exports, "__esModule", { value: true });
|
27561 | exports.MDCTextFieldCharacterCounter = void 0;
|
27562 | var component_1 = __webpack_require__( "./packages/mdc-base/component.ts");
|
27563 | var foundation_1 = __webpack_require__( "./packages/mdc-textfield/character-counter/foundation.ts");
|
27564 | var MDCTextFieldCharacterCounter = function (_super) {
|
27565 | __extends(MDCTextFieldCharacterCounter, _super);
|
27566 | function MDCTextFieldCharacterCounter() {
|
27567 | return _super !== null && _super.apply(this, arguments) || this;
|
27568 | }
|
27569 | MDCTextFieldCharacterCounter.attachTo = function (root) {
|
27570 | return new MDCTextFieldCharacterCounter(root);
|
27571 | };
|
27572 | Object.defineProperty(MDCTextFieldCharacterCounter.prototype, "foundationForTextField", {
|
27573 |
|
27574 | get: function get() {
|
27575 | return this.foundation;
|
27576 | },
|
27577 | enumerable: false,
|
27578 | configurable: true
|
27579 | });
|
27580 | MDCTextFieldCharacterCounter.prototype.getDefaultFoundation = function () {
|
27581 | var _this = this;
|
27582 |
|
27583 |
|
27584 | var adapter = {
|
27585 | setContent: function setContent(content) {
|
27586 | _this.root.textContent = content;
|
27587 | }
|
27588 | };
|
27589 | return new foundation_1.MDCTextFieldCharacterCounterFoundation(adapter);
|
27590 | };
|
27591 | return MDCTextFieldCharacterCounter;
|
27592 | }(component_1.MDCComponent);
|
27593 | exports.MDCTextFieldCharacterCounter = MDCTextFieldCharacterCounter;
|
27594 |
|
27595 | }),
|
27596 |
|
27597 | "./packages/mdc-textfield/character-counter/constants.ts":
|
27598 |
|
27599 |
|
27600 |
|
27601 |
|
27602 | (function(module, exports, __webpack_require__) {
|
27603 |
|
27604 | "use strict";
|
27605 |
|
27606 |
|
27607 |
|
27608 |
|
27609 |
|
27610 |
|
27611 |
|
27612 |
|
27613 |
|
27614 |
|
27615 |
|
27616 |
|
27617 |
|
27618 |
|
27619 |
|
27620 |
|
27621 |
|
27622 |
|
27623 |
|
27624 |
|
27625 |
|
27626 |
|
27627 |
|
27628 |
|
27629 | Object.defineProperty(exports, "__esModule", { value: true });
|
27630 | exports.cssClasses = exports.strings = void 0;
|
27631 | var cssClasses = {
|
27632 | ROOT: 'mdc-text-field-character-counter'
|
27633 | };
|
27634 | exports.cssClasses = cssClasses;
|
27635 | var strings = {
|
27636 | ROOT_SELECTOR: "." + cssClasses.ROOT
|
27637 | };
|
27638 | exports.strings = strings;
|
27639 |
|
27640 | }),
|
27641 |
|
27642 | "./packages/mdc-textfield/character-counter/foundation.ts":
|
27643 |
|
27644 |
|
27645 |
|
27646 |
|
27647 | (function(module, exports, __webpack_require__) {
|
27648 |
|
27649 | "use strict";
|
27650 |
|
27651 |
|
27652 |
|
27653 |
|
27654 |
|
27655 |
|
27656 |
|
27657 |
|
27658 |
|
27659 |
|
27660 |
|
27661 |
|
27662 |
|
27663 |
|
27664 |
|
27665 |
|
27666 |
|
27667 |
|
27668 |
|
27669 |
|
27670 |
|
27671 |
|
27672 |
|
27673 |
|
27674 | var __extends = this && this.__extends || function () {
|
27675 | var _extendStatics = function extendStatics(d, b) {
|
27676 | _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
|
27677 | d.__proto__ = b;
|
27678 | } || function (d, b) {
|
27679 | for (var p in b) {
|
27680 | if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
27681 | }
|
27682 | };
|
27683 | return _extendStatics(d, b);
|
27684 | };
|
27685 | return function (d, b) {
|
27686 | if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
27687 | _extendStatics(d, b);
|
27688 | function __() {
|
27689 | this.constructor = d;
|
27690 | }
|
27691 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
27692 | };
|
27693 | }();
|
27694 | var __assign = this && this.__assign || function () {
|
27695 | __assign = Object.assign || function (t) {
|
27696 | for (var s, i = 1, n = arguments.length; i < n; i++) {
|
27697 | s = arguments[i];
|
27698 | for (var p in s) {
|
27699 | if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
27700 | }
|
27701 | }
|
27702 | return t;
|
27703 | };
|
27704 | return __assign.apply(this, arguments);
|
27705 | };
|
27706 | Object.defineProperty(exports, "__esModule", { value: true });
|
27707 | exports.MDCTextFieldCharacterCounterFoundation = void 0;
|
27708 | var foundation_1 = __webpack_require__( "./packages/mdc-base/foundation.ts");
|
27709 | var constants_1 = __webpack_require__( "./packages/mdc-textfield/character-counter/constants.ts");
|
27710 | var MDCTextFieldCharacterCounterFoundation = function (_super) {
|
27711 | __extends(MDCTextFieldCharacterCounterFoundation, _super);
|
27712 | function MDCTextFieldCharacterCounterFoundation(adapter) {
|
27713 | return _super.call(this, __assign(__assign({}, MDCTextFieldCharacterCounterFoundation.defaultAdapter), adapter)) || this;
|
27714 | }
|
27715 | Object.defineProperty(MDCTextFieldCharacterCounterFoundation, "cssClasses", {
|
27716 | get: function get() {
|
27717 | return constants_1.cssClasses;
|
27718 | },
|
27719 | enumerable: false,
|
27720 | configurable: true
|
27721 | });
|
27722 | Object.defineProperty(MDCTextFieldCharacterCounterFoundation, "strings", {
|
27723 | get: function get() {
|
27724 | return constants_1.strings;
|
27725 | },
|
27726 | enumerable: false,
|
27727 | configurable: true
|
27728 | });
|
27729 | Object.defineProperty(MDCTextFieldCharacterCounterFoundation, "defaultAdapter", {
|
27730 | |
27731 |
|
27732 |
|
27733 | get: function get() {
|
27734 | return {
|
27735 | setContent: function setContent() {
|
27736 | return undefined;
|
27737 | }
|
27738 | };
|
27739 | },
|
27740 | enumerable: false,
|
27741 | configurable: true
|
27742 | });
|
27743 | MDCTextFieldCharacterCounterFoundation.prototype.setCounterValue = function (currentLength, maxLength) {
|
27744 | currentLength = Math.min(currentLength, maxLength);
|
27745 | this.adapter.setContent(currentLength + " / " + maxLength);
|
27746 | };
|
27747 | return MDCTextFieldCharacterCounterFoundation;
|
27748 | }(foundation_1.MDCFoundation);
|
27749 | exports.MDCTextFieldCharacterCounterFoundation = MDCTextFieldCharacterCounterFoundation;
|
27750 |
|
27751 | exports.default = MDCTextFieldCharacterCounterFoundation;
|
27752 |
|
27753 | }),
|
27754 |
|
27755 | "./packages/mdc-textfield/character-counter/index.ts":
|
27756 |
|
27757 |
|
27758 |
|
27759 |
|
27760 | (function(module, exports, __webpack_require__) {
|
27761 |
|
27762 | "use strict";
|
27763 |
|
27764 |
|
27765 |
|
27766 |
|
27767 |
|
27768 |
|
27769 |
|
27770 |
|
27771 |
|
27772 |
|
27773 |
|
27774 |
|
27775 |
|
27776 |
|
27777 |
|
27778 |
|
27779 |
|
27780 |
|
27781 |
|
27782 |
|
27783 |
|
27784 |
|
27785 |
|
27786 |
|
27787 | var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
|
27788 | if (k2 === undefined) k2 = k;
|
27789 | Object.defineProperty(o, k2, { enumerable: true, get: function get() {
|
27790 | return m[k];
|
27791 | } });
|
27792 | } : function (o, m, k, k2) {
|
27793 | if (k2 === undefined) k2 = k;
|
27794 | o[k2] = m[k];
|
27795 | });
|
27796 | var __exportStar = this && this.__exportStar || function (m, exports) {
|
27797 | for (var p in m) {
|
27798 | if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
27799 | }
|
27800 | };
|
27801 | Object.defineProperty(exports, "__esModule", { value: true });
|
27802 | exports.characterCountStrings = exports.characterCountCssClasses = void 0;
|
27803 | __exportStar(__webpack_require__( "./packages/mdc-textfield/character-counter/adapter.ts"), exports);
|
27804 | __exportStar(__webpack_require__( "./packages/mdc-textfield/character-counter/component.ts"), exports);
|
27805 | __exportStar(__webpack_require__( "./packages/mdc-textfield/character-counter/foundation.ts"), exports);
|
27806 | var constants_1 = __webpack_require__( "./packages/mdc-textfield/character-counter/constants.ts");
|
27807 | Object.defineProperty(exports, "characterCountCssClasses", { enumerable: true, get: function get() {
|
27808 | return constants_1.cssClasses;
|
27809 | } });
|
27810 | Object.defineProperty(exports, "characterCountStrings", { enumerable: true, get: function get() {
|
27811 | return constants_1.strings;
|
27812 | } });
|
27813 |
|
27814 | }),
|
27815 |
|
27816 | "./packages/mdc-textfield/component.ts":
|
27817 |
|
27818 |
|
27819 |
|
27820 |
|
27821 | (function(module, exports, __webpack_require__) {
|
27822 |
|
27823 | "use strict";
|
27824 |
|
27825 |
|
27826 |
|
27827 |
|
27828 |
|
27829 |
|
27830 |
|
27831 |
|
27832 |
|
27833 |
|
27834 |
|
27835 |
|
27836 |
|
27837 |
|
27838 |
|
27839 |
|
27840 |
|
27841 |
|
27842 |
|
27843 |
|
27844 |
|
27845 |
|
27846 |
|
27847 |
|
27848 | var __extends = this && this.__extends || function () {
|
27849 | var _extendStatics = function extendStatics(d, b) {
|
27850 | _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
|
27851 | d.__proto__ = b;
|
27852 | } || function (d, b) {
|
27853 | for (var p in b) {
|
27854 | if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
27855 | }
|
27856 | };
|
27857 | return _extendStatics(d, b);
|
27858 | };
|
27859 | return function (d, b) {
|
27860 | if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
27861 | _extendStatics(d, b);
|
27862 | function __() {
|
27863 | this.constructor = d;
|
27864 | }
|
27865 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
27866 | };
|
27867 | }();
|
27868 | var __assign = this && this.__assign || function () {
|
27869 | __assign = Object.assign || function (t) {
|
27870 | for (var s, i = 1, n = arguments.length; i < n; i++) {
|
27871 | s = arguments[i];
|
27872 | for (var p in s) {
|
27873 | if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
27874 | }
|
27875 | }
|
27876 | return t;
|
27877 | };
|
27878 | return __assign.apply(this, arguments);
|
27879 | };
|
27880 | var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
|
27881 | if (k2 === undefined) k2 = k;
|
27882 | Object.defineProperty(o, k2, { enumerable: true, get: function get() {
|
27883 | return m[k];
|
27884 | } });
|
27885 | } : function (o, m, k, k2) {
|
27886 | if (k2 === undefined) k2 = k;
|
27887 | o[k2] = m[k];
|
27888 | });
|
27889 | var __setModuleDefault = this && this.__setModuleDefault || (Object.create ? function (o, v) {
|
27890 | Object.defineProperty(o, "default", { enumerable: true, value: v });
|
27891 | } : function (o, v) {
|
27892 | o["default"] = v;
|
27893 | });
|
27894 | var __importStar = this && this.__importStar || function (mod) {
|
27895 | if (mod && mod.__esModule) return mod;
|
27896 | var result = {};
|
27897 | if (mod != null) for (var k in mod) {
|
27898 | if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
27899 | }__setModuleDefault(result, mod);
|
27900 | return result;
|
27901 | };
|
27902 | Object.defineProperty(exports, "__esModule", { value: true });
|
27903 | exports.MDCTextField = void 0;
|
27904 | var component_1 = __webpack_require__( "./packages/mdc-base/component.ts");
|
27905 | var events_1 = __webpack_require__( "./packages/mdc-dom/events.ts");
|
27906 | var ponyfill = __importStar(__webpack_require__( "./packages/mdc-dom/ponyfill.ts"));
|
27907 | var component_2 = __webpack_require__( "./packages/mdc-floating-label/component.ts");
|
27908 | var component_3 = __webpack_require__( "./packages/mdc-line-ripple/component.ts");
|
27909 | var component_4 = __webpack_require__( "./packages/mdc-notched-outline/component.ts");
|
27910 | var component_5 = __webpack_require__( "./packages/mdc-ripple/component.ts");
|
27911 | var foundation_1 = __webpack_require__( "./packages/mdc-ripple/foundation.ts");
|
27912 | var component_6 = __webpack_require__( "./packages/mdc-textfield/character-counter/component.ts");
|
27913 | var foundation_2 = __webpack_require__( "./packages/mdc-textfield/character-counter/foundation.ts");
|
27914 | var constants_1 = __webpack_require__( "./packages/mdc-textfield/constants.ts");
|
27915 | var foundation_3 = __webpack_require__( "./packages/mdc-textfield/foundation.ts");
|
27916 | var component_7 = __webpack_require__( "./packages/mdc-textfield/helper-text/component.ts");
|
27917 | var foundation_4 = __webpack_require__( "./packages/mdc-textfield/helper-text/foundation.ts");
|
27918 | var component_8 = __webpack_require__( "./packages/mdc-textfield/icon/component.ts");
|
27919 | var MDCTextField = function (_super) {
|
27920 | __extends(MDCTextField, _super);
|
27921 | function MDCTextField() {
|
27922 | return _super !== null && _super.apply(this, arguments) || this;
|
27923 | }
|
27924 | MDCTextField.attachTo = function (root) {
|
27925 | return new MDCTextField(root);
|
27926 | };
|
27927 | MDCTextField.prototype.initialize = function (rippleFactory, lineRippleFactory, helperTextFactory, characterCounterFactory, iconFactory, labelFactory, outlineFactory) {
|
27928 | if (rippleFactory === void 0) {
|
27929 | rippleFactory = function rippleFactory(el, foundation) {
|
27930 | return new component_5.MDCRipple(el, foundation);
|
27931 | };
|
27932 | }
|
27933 | if (lineRippleFactory === void 0) {
|
27934 | lineRippleFactory = function lineRippleFactory(el) {
|
27935 | return new component_3.MDCLineRipple(el);
|
27936 | };
|
27937 | }
|
27938 | if (helperTextFactory === void 0) {
|
27939 | helperTextFactory = function helperTextFactory(el) {
|
27940 | return new component_7.MDCTextFieldHelperText(el);
|
27941 | };
|
27942 | }
|
27943 | if (characterCounterFactory === void 0) {
|
27944 | characterCounterFactory = function characterCounterFactory(el) {
|
27945 | return new component_6.MDCTextFieldCharacterCounter(el);
|
27946 | };
|
27947 | }
|
27948 | if (iconFactory === void 0) {
|
27949 | iconFactory = function iconFactory(el) {
|
27950 | return new component_8.MDCTextFieldIcon(el);
|
27951 | };
|
27952 | }
|
27953 | if (labelFactory === void 0) {
|
27954 | labelFactory = function labelFactory(el) {
|
27955 | return new component_2.MDCFloatingLabel(el);
|
27956 | };
|
27957 | }
|
27958 | if (outlineFactory === void 0) {
|
27959 | outlineFactory = function outlineFactory(el) {
|
27960 | return new component_4.MDCNotchedOutline(el);
|
27961 | };
|
27962 | }
|
27963 | this.input = this.root.querySelector(constants_1.strings.INPUT_SELECTOR);
|
27964 | var labelElement = this.root.querySelector(constants_1.strings.LABEL_SELECTOR);
|
27965 | this.label = labelElement ? labelFactory(labelElement) : null;
|
27966 | var lineRippleElement = this.root.querySelector(constants_1.strings.LINE_RIPPLE_SELECTOR);
|
27967 | this.lineRipple = lineRippleElement ? lineRippleFactory(lineRippleElement) : null;
|
27968 | var outlineElement = this.root.querySelector(constants_1.strings.OUTLINE_SELECTOR);
|
27969 | this.outline = outlineElement ? outlineFactory(outlineElement) : null;
|
27970 |
|
27971 | var helperTextStrings = foundation_4.MDCTextFieldHelperTextFoundation.strings;
|
27972 | var nextElementSibling = this.root.nextElementSibling;
|
27973 | var hasHelperLine = nextElementSibling && nextElementSibling.classList.contains(constants_1.cssClasses.HELPER_LINE);
|
27974 | var helperTextEl = hasHelperLine && nextElementSibling && nextElementSibling.querySelector(helperTextStrings.ROOT_SELECTOR);
|
27975 | this.helperText = helperTextEl ? helperTextFactory(helperTextEl) : null;
|
27976 |
|
27977 | var characterCounterStrings = foundation_2.MDCTextFieldCharacterCounterFoundation.strings;
|
27978 | var characterCounterEl = this.root.querySelector(characterCounterStrings.ROOT_SELECTOR);
|
27979 |
|
27980 | if (!characterCounterEl && hasHelperLine && nextElementSibling) {
|
27981 | characterCounterEl = nextElementSibling.querySelector(characterCounterStrings.ROOT_SELECTOR);
|
27982 | }
|
27983 | this.characterCounter = characterCounterEl ? characterCounterFactory(characterCounterEl) : null;
|
27984 |
|
27985 | var leadingIconEl = this.root.querySelector(constants_1.strings.LEADING_ICON_SELECTOR);
|
27986 | this.leadingIcon = leadingIconEl ? iconFactory(leadingIconEl) : null;
|
27987 |
|
27988 | var trailingIconEl = this.root.querySelector(constants_1.strings.TRAILING_ICON_SELECTOR);
|
27989 | this.trailingIcon = trailingIconEl ? iconFactory(trailingIconEl) : null;
|
27990 |
|
27991 | this.prefix = this.root.querySelector(constants_1.strings.PREFIX_SELECTOR);
|
27992 | this.suffix = this.root.querySelector(constants_1.strings.SUFFIX_SELECTOR);
|
27993 | this.ripple = this.createRipple(rippleFactory);
|
27994 | };
|
27995 | MDCTextField.prototype.destroy = function () {
|
27996 | if (this.ripple) {
|
27997 | this.ripple.destroy();
|
27998 | }
|
27999 | if (this.lineRipple) {
|
28000 | this.lineRipple.destroy();
|
28001 | }
|
28002 | if (this.helperText) {
|
28003 | this.helperText.destroy();
|
28004 | }
|
28005 | if (this.characterCounter) {
|
28006 | this.characterCounter.destroy();
|
28007 | }
|
28008 | if (this.leadingIcon) {
|
28009 | this.leadingIcon.destroy();
|
28010 | }
|
28011 | if (this.trailingIcon) {
|
28012 | this.trailingIcon.destroy();
|
28013 | }
|
28014 | if (this.label) {
|
28015 | this.label.destroy();
|
28016 | }
|
28017 | if (this.outline) {
|
28018 | this.outline.destroy();
|
28019 | }
|
28020 | _super.prototype.destroy.call(this);
|
28021 | };
|
28022 | |
28023 |
|
28024 |
|
28025 |
|
28026 | MDCTextField.prototype.initialSyncWithDOM = function () {
|
28027 | this.disabled = this.input.disabled;
|
28028 | };
|
28029 | Object.defineProperty(MDCTextField.prototype, "value", {
|
28030 | get: function get() {
|
28031 | return this.foundation.getValue();
|
28032 | },
|
28033 | |
28034 |
|
28035 |
|
28036 | set: function set(value) {
|
28037 | this.foundation.setValue(value);
|
28038 | },
|
28039 | enumerable: false,
|
28040 | configurable: true
|
28041 | });
|
28042 | Object.defineProperty(MDCTextField.prototype, "disabled", {
|
28043 | get: function get() {
|
28044 | return this.foundation.isDisabled();
|
28045 | },
|
28046 | |
28047 |
|
28048 |
|
28049 | set: function set(disabled) {
|
28050 | this.foundation.setDisabled(disabled);
|
28051 | },
|
28052 | enumerable: false,
|
28053 | configurable: true
|
28054 | });
|
28055 | Object.defineProperty(MDCTextField.prototype, "valid", {
|
28056 | get: function get() {
|
28057 | return this.foundation.isValid();
|
28058 | },
|
28059 | |
28060 |
|
28061 |
|
28062 | set: function set(valid) {
|
28063 | this.foundation.setValid(valid);
|
28064 | },
|
28065 | enumerable: false,
|
28066 | configurable: true
|
28067 | });
|
28068 | Object.defineProperty(MDCTextField.prototype, "required", {
|
28069 | get: function get() {
|
28070 | return this.input.required;
|
28071 | },
|
28072 | |
28073 |
|
28074 |
|
28075 | set: function set(required) {
|
28076 | this.input.required = required;
|
28077 | },
|
28078 | enumerable: false,
|
28079 | configurable: true
|
28080 | });
|
28081 | Object.defineProperty(MDCTextField.prototype, "pattern", {
|
28082 | get: function get() {
|
28083 | return this.input.pattern;
|
28084 | },
|
28085 | |
28086 |
|
28087 |
|
28088 | set: function set(pattern) {
|
28089 | this.input.pattern = pattern;
|
28090 | },
|
28091 | enumerable: false,
|
28092 | configurable: true
|
28093 | });
|
28094 | Object.defineProperty(MDCTextField.prototype, "minLength", {
|
28095 | get: function get() {
|
28096 | return this.input.minLength;
|
28097 | },
|
28098 | |
28099 |
|
28100 |
|
28101 | set: function set(minLength) {
|
28102 | this.input.minLength = minLength;
|
28103 | },
|
28104 | enumerable: false,
|
28105 | configurable: true
|
28106 | });
|
28107 | Object.defineProperty(MDCTextField.prototype, "maxLength", {
|
28108 | get: function get() {
|
28109 | return this.input.maxLength;
|
28110 | },
|
28111 | |
28112 |
|
28113 |
|
28114 | set: function set(maxLength) {
|
28115 |
|
28116 | if (maxLength < 0) {
|
28117 | this.input.removeAttribute('maxLength');
|
28118 | } else {
|
28119 | this.input.maxLength = maxLength;
|
28120 | }
|
28121 | },
|
28122 | enumerable: false,
|
28123 | configurable: true
|
28124 | });
|
28125 | Object.defineProperty(MDCTextField.prototype, "min", {
|
28126 | get: function get() {
|
28127 | return this.input.min;
|
28128 | },
|
28129 | |
28130 |
|
28131 |
|
28132 | set: function set(min) {
|
28133 | this.input.min = min;
|
28134 | },
|
28135 | enumerable: false,
|
28136 | configurable: true
|
28137 | });
|
28138 | Object.defineProperty(MDCTextField.prototype, "max", {
|
28139 | get: function get() {
|
28140 | return this.input.max;
|
28141 | },
|
28142 | |
28143 |
|
28144 |
|
28145 | set: function set(max) {
|
28146 | this.input.max = max;
|
28147 | },
|
28148 | enumerable: false,
|
28149 | configurable: true
|
28150 | });
|
28151 | Object.defineProperty(MDCTextField.prototype, "step", {
|
28152 | get: function get() {
|
28153 | return this.input.step;
|
28154 | },
|
28155 | |
28156 |
|
28157 |
|
28158 | set: function set(step) {
|
28159 | this.input.step = step;
|
28160 | },
|
28161 | enumerable: false,
|
28162 | configurable: true
|
28163 | });
|
28164 | Object.defineProperty(MDCTextField.prototype, "helperTextContent", {
|
28165 | |
28166 |
|
28167 |
|
28168 | set: function set(content) {
|
28169 | this.foundation.setHelperTextContent(content);
|
28170 | },
|
28171 | enumerable: false,
|
28172 | configurable: true
|
28173 | });
|
28174 | Object.defineProperty(MDCTextField.prototype, "leadingIconAriaLabel", {
|
28175 | |
28176 |
|
28177 |
|
28178 | set: function set(label) {
|
28179 | this.foundation.setLeadingIconAriaLabel(label);
|
28180 | },
|
28181 | enumerable: false,
|
28182 | configurable: true
|
28183 | });
|
28184 | Object.defineProperty(MDCTextField.prototype, "leadingIconContent", {
|
28185 | |
28186 |
|
28187 |
|
28188 | set: function set(content) {
|
28189 | this.foundation.setLeadingIconContent(content);
|
28190 | },
|
28191 | enumerable: false,
|
28192 | configurable: true
|
28193 | });
|
28194 | Object.defineProperty(MDCTextField.prototype, "trailingIconAriaLabel", {
|
28195 | |
28196 |
|
28197 |
|
28198 | set: function set(label) {
|
28199 | this.foundation.setTrailingIconAriaLabel(label);
|
28200 | },
|
28201 | enumerable: false,
|
28202 | configurable: true
|
28203 | });
|
28204 | Object.defineProperty(MDCTextField.prototype, "trailingIconContent", {
|
28205 | |
28206 |
|
28207 |
|
28208 | set: function set(content) {
|
28209 | this.foundation.setTrailingIconContent(content);
|
28210 | },
|
28211 | enumerable: false,
|
28212 | configurable: true
|
28213 | });
|
28214 | Object.defineProperty(MDCTextField.prototype, "useNativeValidation", {
|
28215 | |
28216 |
|
28217 |
|
28218 |
|
28219 | set: function set(useNativeValidation) {
|
28220 | this.foundation.setUseNativeValidation(useNativeValidation);
|
28221 | },
|
28222 | enumerable: false,
|
28223 | configurable: true
|
28224 | });
|
28225 | Object.defineProperty(MDCTextField.prototype, "prefixText", {
|
28226 | |
28227 |
|
28228 |
|
28229 | get: function get() {
|
28230 | return this.prefix ? this.prefix.textContent : null;
|
28231 | },
|
28232 | |
28233 |
|
28234 |
|
28235 | set: function set(prefixText) {
|
28236 | if (this.prefix) {
|
28237 | this.prefix.textContent = prefixText;
|
28238 | }
|
28239 | },
|
28240 | enumerable: false,
|
28241 | configurable: true
|
28242 | });
|
28243 | Object.defineProperty(MDCTextField.prototype, "suffixText", {
|
28244 | |
28245 |
|
28246 |
|
28247 | get: function get() {
|
28248 | return this.suffix ? this.suffix.textContent : null;
|
28249 | },
|
28250 | |
28251 |
|
28252 |
|
28253 | set: function set(suffixText) {
|
28254 | if (this.suffix) {
|
28255 | this.suffix.textContent = suffixText;
|
28256 | }
|
28257 | },
|
28258 | enumerable: false,
|
28259 | configurable: true
|
28260 | });
|
28261 | |
28262 |
|
28263 |
|
28264 | MDCTextField.prototype.focus = function () {
|
28265 | this.input.focus();
|
28266 | };
|
28267 | |
28268 |
|
28269 |
|
28270 | MDCTextField.prototype.layout = function () {
|
28271 | var openNotch = this.foundation.shouldFloat;
|
28272 | this.foundation.notchOutline(openNotch);
|
28273 | };
|
28274 | MDCTextField.prototype.getDefaultFoundation = function () {
|
28275 |
|
28276 |
|
28277 |
|
28278 | var adapter = __assign(__assign(__assign(__assign(__assign({}, this.getRootAdapterMethods()), this.getInputAdapterMethods()), this.getLabelAdapterMethods()), this.getLineRippleAdapterMethods()), this.getOutlineAdapterMethods());
|
28279 |
|
28280 | return new foundation_3.MDCTextFieldFoundation(adapter, this.getFoundationMap());
|
28281 | };
|
28282 | MDCTextField.prototype.getRootAdapterMethods = function () {
|
28283 | var _this = this;
|
28284 |
|
28285 | return {
|
28286 | addClass: function addClass(className) {
|
28287 | return _this.root.classList.add(className);
|
28288 | },
|
28289 | removeClass: function removeClass(className) {
|
28290 | return _this.root.classList.remove(className);
|
28291 | },
|
28292 | hasClass: function hasClass(className) {
|
28293 | return _this.root.classList.contains(className);
|
28294 | },
|
28295 | registerTextFieldInteractionHandler: function registerTextFieldInteractionHandler(evtType, handler) {
|
28296 | _this.listen(evtType, handler);
|
28297 | },
|
28298 | deregisterTextFieldInteractionHandler: function deregisterTextFieldInteractionHandler(evtType, handler) {
|
28299 | _this.unlisten(evtType, handler);
|
28300 | },
|
28301 | registerValidationAttributeChangeHandler: function registerValidationAttributeChangeHandler(handler) {
|
28302 | var getAttributesList = function getAttributesList(mutationsList) {
|
28303 | return mutationsList.map(function (mutation) {
|
28304 | return mutation.attributeName;
|
28305 | }).filter(function (attributeName) {
|
28306 | return attributeName;
|
28307 | });
|
28308 | };
|
28309 | var observer = new MutationObserver(function (mutationsList) {
|
28310 | return handler(getAttributesList(mutationsList));
|
28311 | });
|
28312 | var config = { attributes: true };
|
28313 | observer.observe(_this.input, config);
|
28314 | return observer;
|
28315 | },
|
28316 | deregisterValidationAttributeChangeHandler: function deregisterValidationAttributeChangeHandler(observer) {
|
28317 | observer.disconnect();
|
28318 | }
|
28319 | };
|
28320 |
|
28321 | };
|
28322 | MDCTextField.prototype.getInputAdapterMethods = function () {
|
28323 | var _this = this;
|
28324 |
|
28325 | return {
|
28326 | getNativeInput: function getNativeInput() {
|
28327 | return _this.input;
|
28328 | },
|
28329 | setInputAttr: function setInputAttr(attr, value) {
|
28330 | _this.input.setAttribute(attr, value);
|
28331 | },
|
28332 | removeInputAttr: function removeInputAttr(attr) {
|
28333 | _this.input.removeAttribute(attr);
|
28334 | },
|
28335 | isFocused: function isFocused() {
|
28336 | return document.activeElement === _this.input;
|
28337 | },
|
28338 | registerInputInteractionHandler: function registerInputInteractionHandler(evtType, handler) {
|
28339 | _this.input.addEventListener(evtType, handler, events_1.applyPassive());
|
28340 | },
|
28341 | deregisterInputInteractionHandler: function deregisterInputInteractionHandler(evtType, handler) {
|
28342 | _this.input.removeEventListener(evtType, handler, events_1.applyPassive());
|
28343 | }
|
28344 | };
|
28345 |
|
28346 | };
|
28347 | MDCTextField.prototype.getLabelAdapterMethods = function () {
|
28348 | var _this = this;
|
28349 | return {
|
28350 | floatLabel: function floatLabel(shouldFloat) {
|
28351 | _this.label && _this.label.float(shouldFloat);
|
28352 | },
|
28353 | getLabelWidth: function getLabelWidth() {
|
28354 | return _this.label ? _this.label.getWidth() : 0;
|
28355 | },
|
28356 | hasLabel: function hasLabel() {
|
28357 | return Boolean(_this.label);
|
28358 | },
|
28359 | shakeLabel: function shakeLabel(shouldShake) {
|
28360 | _this.label && _this.label.shake(shouldShake);
|
28361 | },
|
28362 | setLabelRequired: function setLabelRequired(isRequired) {
|
28363 | _this.label && _this.label.setRequired(isRequired);
|
28364 | }
|
28365 | };
|
28366 | };
|
28367 | MDCTextField.prototype.getLineRippleAdapterMethods = function () {
|
28368 | var _this = this;
|
28369 | return {
|
28370 | activateLineRipple: function activateLineRipple() {
|
28371 | if (_this.lineRipple) {
|
28372 | _this.lineRipple.activate();
|
28373 | }
|
28374 | },
|
28375 | deactivateLineRipple: function deactivateLineRipple() {
|
28376 | if (_this.lineRipple) {
|
28377 | _this.lineRipple.deactivate();
|
28378 | }
|
28379 | },
|
28380 | setLineRippleTransformOrigin: function setLineRippleTransformOrigin(normalizedX) {
|
28381 | if (_this.lineRipple) {
|
28382 | _this.lineRipple.setRippleCenter(normalizedX);
|
28383 | }
|
28384 | }
|
28385 | };
|
28386 | };
|
28387 | MDCTextField.prototype.getOutlineAdapterMethods = function () {
|
28388 | var _this = this;
|
28389 | return {
|
28390 | closeOutline: function closeOutline() {
|
28391 | _this.outline && _this.outline.closeNotch();
|
28392 | },
|
28393 | hasOutline: function hasOutline() {
|
28394 | return Boolean(_this.outline);
|
28395 | },
|
28396 | notchOutline: function notchOutline(labelWidth) {
|
28397 | _this.outline && _this.outline.notch(labelWidth);
|
28398 | }
|
28399 | };
|
28400 | };
|
28401 | |
28402 |
|
28403 |
|
28404 | MDCTextField.prototype.getFoundationMap = function () {
|
28405 | return {
|
28406 | characterCounter: this.characterCounter ? this.characterCounter.foundationForTextField : undefined,
|
28407 | helperText: this.helperText ? this.helperText.foundationForTextField : undefined,
|
28408 | leadingIcon: this.leadingIcon ? this.leadingIcon.foundationForTextField : undefined,
|
28409 | trailingIcon: this.trailingIcon ? this.trailingIcon.foundationForTextField : undefined
|
28410 | };
|
28411 | };
|
28412 | MDCTextField.prototype.createRipple = function (rippleFactory) {
|
28413 | var _this = this;
|
28414 | var isTextArea = this.root.classList.contains(constants_1.cssClasses.TEXTAREA);
|
28415 | var isOutlined = this.root.classList.contains(constants_1.cssClasses.OUTLINED);
|
28416 | if (isTextArea || isOutlined) {
|
28417 | return null;
|
28418 | }
|
28419 |
|
28420 |
|
28421 |
|
28422 | var adapter = __assign(__assign({}, component_5.MDCRipple.createAdapter(this)), { isSurfaceActive: function isSurfaceActive() {
|
28423 | return ponyfill.matches(_this.input, ':active');
|
28424 | }, registerInteractionHandler: function registerInteractionHandler(evtType, handler) {
|
28425 | _this.input.addEventListener(evtType, handler, events_1.applyPassive());
|
28426 | }, deregisterInteractionHandler: function deregisterInteractionHandler(evtType, handler) {
|
28427 | _this.input.removeEventListener(evtType, handler, events_1.applyPassive());
|
28428 | } });
|
28429 |
|
28430 | return rippleFactory(this.root, new foundation_1.MDCRippleFoundation(adapter));
|
28431 | };
|
28432 | return MDCTextField;
|
28433 | }(component_1.MDCComponent);
|
28434 | exports.MDCTextField = MDCTextField;
|
28435 |
|
28436 | }),
|
28437 |
|
28438 | "./packages/mdc-textfield/constants.ts":
|
28439 |
|
28440 |
|
28441 |
|
28442 |
|
28443 | (function(module, exports, __webpack_require__) {
|
28444 |
|
28445 | "use strict";
|
28446 |
|
28447 |
|
28448 |
|
28449 |
|
28450 |
|
28451 |
|
28452 |
|
28453 |
|
28454 |
|
28455 |
|
28456 |
|
28457 |
|
28458 |
|
28459 |
|
28460 |
|
28461 |
|
28462 |
|
28463 |
|
28464 |
|
28465 |
|
28466 |
|
28467 |
|
28468 |
|
28469 |
|
28470 | Object.defineProperty(exports, "__esModule", { value: true });
|
28471 | exports.ALWAYS_FLOAT_TYPES = exports.VALIDATION_ATTR_WHITELIST = exports.numbers = exports.strings = exports.cssClasses = void 0;
|
28472 | var strings = {
|
28473 | ARIA_CONTROLS: 'aria-controls',
|
28474 | ARIA_DESCRIBEDBY: 'aria-describedby',
|
28475 | INPUT_SELECTOR: '.mdc-text-field__input',
|
28476 | LABEL_SELECTOR: '.mdc-floating-label',
|
28477 | LEADING_ICON_SELECTOR: '.mdc-text-field__icon--leading',
|
28478 | LINE_RIPPLE_SELECTOR: '.mdc-line-ripple',
|
28479 | OUTLINE_SELECTOR: '.mdc-notched-outline',
|
28480 | PREFIX_SELECTOR: '.mdc-text-field__affix--prefix',
|
28481 | SUFFIX_SELECTOR: '.mdc-text-field__affix--suffix',
|
28482 | TRAILING_ICON_SELECTOR: '.mdc-text-field__icon--trailing'
|
28483 | };
|
28484 | exports.strings = strings;
|
28485 | var cssClasses = {
|
28486 | DISABLED: 'mdc-text-field--disabled',
|
28487 | FOCUSED: 'mdc-text-field--focused',
|
28488 | HELPER_LINE: 'mdc-text-field-helper-line',
|
28489 | INVALID: 'mdc-text-field--invalid',
|
28490 | LABEL_FLOATING: 'mdc-text-field--label-floating',
|
28491 | NO_LABEL: 'mdc-text-field--no-label',
|
28492 | OUTLINED: 'mdc-text-field--outlined',
|
28493 | ROOT: 'mdc-text-field',
|
28494 | TEXTAREA: 'mdc-text-field--textarea',
|
28495 | WITH_LEADING_ICON: 'mdc-text-field--with-leading-icon',
|
28496 | WITH_TRAILING_ICON: 'mdc-text-field--with-trailing-icon',
|
28497 | WITH_INTERNAL_COUNTER: 'mdc-text-field--with-internal-counter'
|
28498 | };
|
28499 | exports.cssClasses = cssClasses;
|
28500 | var numbers = {
|
28501 | LABEL_SCALE: 0.75
|
28502 | };
|
28503 | exports.numbers = numbers;
|
28504 |
|
28505 |
|
28506 |
|
28507 |
|
28508 |
|
28509 | var VALIDATION_ATTR_WHITELIST = ['pattern', 'min', 'max', 'required', 'step', 'minlength', 'maxlength'];
|
28510 | exports.VALIDATION_ATTR_WHITELIST = VALIDATION_ATTR_WHITELIST;
|
28511 |
|
28512 |
|
28513 |
|
28514 |
|
28515 | var ALWAYS_FLOAT_TYPES = ['color', 'date', 'datetime-local', 'month', 'range', 'time', 'week'];
|
28516 | exports.ALWAYS_FLOAT_TYPES = ALWAYS_FLOAT_TYPES;
|
28517 |
|
28518 | }),
|
28519 |
|
28520 | "./packages/mdc-textfield/foundation.ts":
|
28521 |
|
28522 |
|
28523 |
|
28524 |
|
28525 | (function(module, exports, __webpack_require__) {
|
28526 |
|
28527 | "use strict";
|
28528 |
|
28529 |
|
28530 |
|
28531 |
|
28532 |
|
28533 |
|
28534 |
|
28535 |
|
28536 |
|
28537 |
|
28538 |
|
28539 |
|
28540 |
|
28541 |
|
28542 |
|
28543 |
|
28544 |
|
28545 |
|
28546 |
|
28547 |
|
28548 |
|
28549 |
|
28550 |
|
28551 |
|
28552 | var __extends = this && this.__extends || function () {
|
28553 | var _extendStatics = function extendStatics(d, b) {
|
28554 | _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
|
28555 | d.__proto__ = b;
|
28556 | } || function (d, b) {
|
28557 | for (var p in b) {
|
28558 | if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
28559 | }
|
28560 | };
|
28561 | return _extendStatics(d, b);
|
28562 | };
|
28563 | return function (d, b) {
|
28564 | if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
28565 | _extendStatics(d, b);
|
28566 | function __() {
|
28567 | this.constructor = d;
|
28568 | }
|
28569 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
28570 | };
|
28571 | }();
|
28572 | var __assign = this && this.__assign || function () {
|
28573 | __assign = Object.assign || function (t) {
|
28574 | for (var s, i = 1, n = arguments.length; i < n; i++) {
|
28575 | s = arguments[i];
|
28576 | for (var p in s) {
|
28577 | if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
28578 | }
|
28579 | }
|
28580 | return t;
|
28581 | };
|
28582 | return __assign.apply(this, arguments);
|
28583 | };
|
28584 | var __values = this && this.__values || function (o) {
|
28585 | var s = typeof Symbol === "function" && Symbol.iterator,
|
28586 | m = s && o[s],
|
28587 | i = 0;
|
28588 | if (m) return m.call(o);
|
28589 | if (o && typeof o.length === "number") return {
|
28590 | next: function next() {
|
28591 | if (o && i >= o.length) o = void 0;
|
28592 | return { value: o && o[i++], done: !o };
|
28593 | }
|
28594 | };
|
28595 | throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
28596 | };
|
28597 | Object.defineProperty(exports, "__esModule", { value: true });
|
28598 | exports.MDCTextFieldFoundation = void 0;
|
28599 | var foundation_1 = __webpack_require__( "./packages/mdc-base/foundation.ts");
|
28600 | var constants_1 = __webpack_require__( "./packages/mdc-textfield/constants.ts");
|
28601 | var POINTERDOWN_EVENTS = ['mousedown', 'touchstart'];
|
28602 | var INTERACTION_EVENTS = ['click', 'keydown'];
|
28603 | var MDCTextFieldFoundation = function (_super) {
|
28604 | __extends(MDCTextFieldFoundation, _super);
|
28605 | |
28606 |
|
28607 |
|
28608 |
|
28609 | function MDCTextFieldFoundation(adapter, foundationMap) {
|
28610 | if (foundationMap === void 0) {
|
28611 | foundationMap = {};
|
28612 | }
|
28613 | var _this = _super.call(this, __assign(__assign({}, MDCTextFieldFoundation.defaultAdapter), adapter)) || this;
|
28614 | _this.isFocused = false;
|
28615 | _this.receivedUserInput = false;
|
28616 | _this.valid = true;
|
28617 | _this.useNativeValidation = true;
|
28618 | _this.validateOnValueChange = true;
|
28619 | _this.helperText = foundationMap.helperText;
|
28620 | _this.characterCounter = foundationMap.characterCounter;
|
28621 | _this.leadingIcon = foundationMap.leadingIcon;
|
28622 | _this.trailingIcon = foundationMap.trailingIcon;
|
28623 | _this.inputFocusHandler = function () {
|
28624 | _this.activateFocus();
|
28625 | };
|
28626 | _this.inputBlurHandler = function () {
|
28627 | _this.deactivateFocus();
|
28628 | };
|
28629 | _this.inputInputHandler = function () {
|
28630 | _this.handleInput();
|
28631 | };
|
28632 | _this.setPointerXOffset = function (evt) {
|
28633 | _this.setTransformOrigin(evt);
|
28634 | };
|
28635 | _this.textFieldInteractionHandler = function () {
|
28636 | _this.handleTextFieldInteraction();
|
28637 | };
|
28638 | _this.validationAttributeChangeHandler = function (attributesList) {
|
28639 | _this.handleValidationAttributeChange(attributesList);
|
28640 | };
|
28641 | return _this;
|
28642 | }
|
28643 | Object.defineProperty(MDCTextFieldFoundation, "cssClasses", {
|
28644 | get: function get() {
|
28645 | return constants_1.cssClasses;
|
28646 | },
|
28647 | enumerable: false,
|
28648 | configurable: true
|
28649 | });
|
28650 | Object.defineProperty(MDCTextFieldFoundation, "strings", {
|
28651 | get: function get() {
|
28652 | return constants_1.strings;
|
28653 | },
|
28654 | enumerable: false,
|
28655 | configurable: true
|
28656 | });
|
28657 | Object.defineProperty(MDCTextFieldFoundation, "numbers", {
|
28658 | get: function get() {
|
28659 | return constants_1.numbers;
|
28660 | },
|
28661 | enumerable: false,
|
28662 | configurable: true
|
28663 | });
|
28664 | Object.defineProperty(MDCTextFieldFoundation.prototype, "shouldAlwaysFloat", {
|
28665 | get: function get() {
|
28666 | var type = this.getNativeInput().type;
|
28667 | return constants_1.ALWAYS_FLOAT_TYPES.indexOf(type) >= 0;
|
28668 | },
|
28669 | enumerable: false,
|
28670 | configurable: true
|
28671 | });
|
28672 | Object.defineProperty(MDCTextFieldFoundation.prototype, "shouldFloat", {
|
28673 | get: function get() {
|
28674 | return this.shouldAlwaysFloat || this.isFocused || !!this.getValue() || this.isBadInput();
|
28675 | },
|
28676 | enumerable: false,
|
28677 | configurable: true
|
28678 | });
|
28679 | Object.defineProperty(MDCTextFieldFoundation.prototype, "shouldShake", {
|
28680 | get: function get() {
|
28681 | return !this.isFocused && !this.isValid() && !!this.getValue();
|
28682 | },
|
28683 | enumerable: false,
|
28684 | configurable: true
|
28685 | });
|
28686 | Object.defineProperty(MDCTextFieldFoundation, "defaultAdapter", {
|
28687 | |
28688 |
|
28689 |
|
28690 |
|
28691 | get: function get() {
|
28692 |
|
28693 | return {
|
28694 | addClass: function addClass() {
|
28695 | return undefined;
|
28696 | },
|
28697 | removeClass: function removeClass() {
|
28698 | return undefined;
|
28699 | },
|
28700 | hasClass: function hasClass() {
|
28701 | return true;
|
28702 | },
|
28703 | setInputAttr: function setInputAttr() {
|
28704 | return undefined;
|
28705 | },
|
28706 | removeInputAttr: function removeInputAttr() {
|
28707 | return undefined;
|
28708 | },
|
28709 | registerTextFieldInteractionHandler: function registerTextFieldInteractionHandler() {
|
28710 | return undefined;
|
28711 | },
|
28712 | deregisterTextFieldInteractionHandler: function deregisterTextFieldInteractionHandler() {
|
28713 | return undefined;
|
28714 | },
|
28715 | registerInputInteractionHandler: function registerInputInteractionHandler() {
|
28716 | return undefined;
|
28717 | },
|
28718 | deregisterInputInteractionHandler: function deregisterInputInteractionHandler() {
|
28719 | return undefined;
|
28720 | },
|
28721 | registerValidationAttributeChangeHandler: function registerValidationAttributeChangeHandler() {
|
28722 | return new MutationObserver(function () {
|
28723 | return undefined;
|
28724 | });
|
28725 | },
|
28726 | deregisterValidationAttributeChangeHandler: function deregisterValidationAttributeChangeHandler() {
|
28727 | return undefined;
|
28728 | },
|
28729 | getNativeInput: function getNativeInput() {
|
28730 | return null;
|
28731 | },
|
28732 | isFocused: function isFocused() {
|
28733 | return false;
|
28734 | },
|
28735 | activateLineRipple: function activateLineRipple() {
|
28736 | return undefined;
|
28737 | },
|
28738 | deactivateLineRipple: function deactivateLineRipple() {
|
28739 | return undefined;
|
28740 | },
|
28741 | setLineRippleTransformOrigin: function setLineRippleTransformOrigin() {
|
28742 | return undefined;
|
28743 | },
|
28744 | shakeLabel: function shakeLabel() {
|
28745 | return undefined;
|
28746 | },
|
28747 | floatLabel: function floatLabel() {
|
28748 | return undefined;
|
28749 | },
|
28750 | setLabelRequired: function setLabelRequired() {
|
28751 | return undefined;
|
28752 | },
|
28753 | hasLabel: function hasLabel() {
|
28754 | return false;
|
28755 | },
|
28756 | getLabelWidth: function getLabelWidth() {
|
28757 | return 0;
|
28758 | },
|
28759 | hasOutline: function hasOutline() {
|
28760 | return false;
|
28761 | },
|
28762 | notchOutline: function notchOutline() {
|
28763 | return undefined;
|
28764 | },
|
28765 | closeOutline: function closeOutline() {
|
28766 | return undefined;
|
28767 | }
|
28768 | };
|
28769 |
|
28770 | },
|
28771 | enumerable: false,
|
28772 | configurable: true
|
28773 | });
|
28774 | MDCTextFieldFoundation.prototype.init = function () {
|
28775 | var e_1, _a, e_2, _b;
|
28776 | if (this.adapter.hasLabel() && this.getNativeInput().required) {
|
28777 | this.adapter.setLabelRequired(true);
|
28778 | }
|
28779 | if (this.adapter.isFocused()) {
|
28780 | this.inputFocusHandler();
|
28781 | } else if (this.adapter.hasLabel() && this.shouldFloat) {
|
28782 | this.notchOutline(true);
|
28783 | this.adapter.floatLabel(true);
|
28784 | this.styleFloating(true);
|
28785 | }
|
28786 | this.adapter.registerInputInteractionHandler('focus', this.inputFocusHandler);
|
28787 | this.adapter.registerInputInteractionHandler('blur', this.inputBlurHandler);
|
28788 | this.adapter.registerInputInteractionHandler('input', this.inputInputHandler);
|
28789 | try {
|
28790 | for (var POINTERDOWN_EVENTS_1 = __values(POINTERDOWN_EVENTS), POINTERDOWN_EVENTS_1_1 = POINTERDOWN_EVENTS_1.next(); !POINTERDOWN_EVENTS_1_1.done; POINTERDOWN_EVENTS_1_1 = POINTERDOWN_EVENTS_1.next()) {
|
28791 | var evtType = POINTERDOWN_EVENTS_1_1.value;
|
28792 | this.adapter.registerInputInteractionHandler(evtType, this.setPointerXOffset);
|
28793 | }
|
28794 | } catch (e_1_1) {
|
28795 | e_1 = { error: e_1_1 };
|
28796 | } finally {
|
28797 | try {
|
28798 | if (POINTERDOWN_EVENTS_1_1 && !POINTERDOWN_EVENTS_1_1.done && (_a = POINTERDOWN_EVENTS_1.return)) _a.call(POINTERDOWN_EVENTS_1);
|
28799 | } finally {
|
28800 | if (e_1) throw e_1.error;
|
28801 | }
|
28802 | }
|
28803 | try {
|
28804 | for (var INTERACTION_EVENTS_1 = __values(INTERACTION_EVENTS), INTERACTION_EVENTS_1_1 = INTERACTION_EVENTS_1.next(); !INTERACTION_EVENTS_1_1.done; INTERACTION_EVENTS_1_1 = INTERACTION_EVENTS_1.next()) {
|
28805 | var evtType = INTERACTION_EVENTS_1_1.value;
|
28806 | this.adapter.registerTextFieldInteractionHandler(evtType, this.textFieldInteractionHandler);
|
28807 | }
|
28808 | } catch (e_2_1) {
|
28809 | e_2 = { error: e_2_1 };
|
28810 | } finally {
|
28811 | try {
|
28812 | if (INTERACTION_EVENTS_1_1 && !INTERACTION_EVENTS_1_1.done && (_b = INTERACTION_EVENTS_1.return)) _b.call(INTERACTION_EVENTS_1);
|
28813 | } finally {
|
28814 | if (e_2) throw e_2.error;
|
28815 | }
|
28816 | }
|
28817 | this.validationObserver = this.adapter.registerValidationAttributeChangeHandler(this.validationAttributeChangeHandler);
|
28818 | this.setcharacterCounter(this.getValue().length);
|
28819 | };
|
28820 | MDCTextFieldFoundation.prototype.destroy = function () {
|
28821 | var e_3, _a, e_4, _b;
|
28822 | this.adapter.deregisterInputInteractionHandler('focus', this.inputFocusHandler);
|
28823 | this.adapter.deregisterInputInteractionHandler('blur', this.inputBlurHandler);
|
28824 | this.adapter.deregisterInputInteractionHandler('input', this.inputInputHandler);
|
28825 | try {
|
28826 | for (var POINTERDOWN_EVENTS_2 = __values(POINTERDOWN_EVENTS), POINTERDOWN_EVENTS_2_1 = POINTERDOWN_EVENTS_2.next(); !POINTERDOWN_EVENTS_2_1.done; POINTERDOWN_EVENTS_2_1 = POINTERDOWN_EVENTS_2.next()) {
|
28827 | var evtType = POINTERDOWN_EVENTS_2_1.value;
|
28828 | this.adapter.deregisterInputInteractionHandler(evtType, this.setPointerXOffset);
|
28829 | }
|
28830 | } catch (e_3_1) {
|
28831 | e_3 = { error: e_3_1 };
|
28832 | } finally {
|
28833 | try {
|
28834 | if (POINTERDOWN_EVENTS_2_1 && !POINTERDOWN_EVENTS_2_1.done && (_a = POINTERDOWN_EVENTS_2.return)) _a.call(POINTERDOWN_EVENTS_2);
|
28835 | } finally {
|
28836 | if (e_3) throw e_3.error;
|
28837 | }
|
28838 | }
|
28839 | try {
|
28840 | for (var INTERACTION_EVENTS_2 = __values(INTERACTION_EVENTS), INTERACTION_EVENTS_2_1 = INTERACTION_EVENTS_2.next(); !INTERACTION_EVENTS_2_1.done; INTERACTION_EVENTS_2_1 = INTERACTION_EVENTS_2.next()) {
|
28841 | var evtType = INTERACTION_EVENTS_2_1.value;
|
28842 | this.adapter.deregisterTextFieldInteractionHandler(evtType, this.textFieldInteractionHandler);
|
28843 | }
|
28844 | } catch (e_4_1) {
|
28845 | e_4 = { error: e_4_1 };
|
28846 | } finally {
|
28847 | try {
|
28848 | if (INTERACTION_EVENTS_2_1 && !INTERACTION_EVENTS_2_1.done && (_b = INTERACTION_EVENTS_2.return)) _b.call(INTERACTION_EVENTS_2);
|
28849 | } finally {
|
28850 | if (e_4) throw e_4.error;
|
28851 | }
|
28852 | }
|
28853 | this.adapter.deregisterValidationAttributeChangeHandler(this.validationObserver);
|
28854 | };
|
28855 | |
28856 |
|
28857 |
|
28858 | MDCTextFieldFoundation.prototype.handleTextFieldInteraction = function () {
|
28859 | var nativeInput = this.adapter.getNativeInput();
|
28860 | if (nativeInput && nativeInput.disabled) {
|
28861 | return;
|
28862 | }
|
28863 | this.receivedUserInput = true;
|
28864 | };
|
28865 | |
28866 |
|
28867 |
|
28868 | MDCTextFieldFoundation.prototype.handleValidationAttributeChange = function (attributesList) {
|
28869 | var _this = this;
|
28870 | attributesList.some(function (attributeName) {
|
28871 | if (constants_1.VALIDATION_ATTR_WHITELIST.indexOf(attributeName) > -1) {
|
28872 | _this.styleValidity(true);
|
28873 | _this.adapter.setLabelRequired(_this.getNativeInput().required);
|
28874 | return true;
|
28875 | }
|
28876 | return false;
|
28877 | });
|
28878 | if (attributesList.indexOf('maxlength') > -1) {
|
28879 | this.setcharacterCounter(this.getValue().length);
|
28880 | }
|
28881 | };
|
28882 | |
28883 |
|
28884 |
|
28885 | MDCTextFieldFoundation.prototype.notchOutline = function (openNotch) {
|
28886 | if (!this.adapter.hasOutline() || !this.adapter.hasLabel()) {
|
28887 | return;
|
28888 | }
|
28889 | if (openNotch) {
|
28890 | var labelWidth = this.adapter.getLabelWidth() * constants_1.numbers.LABEL_SCALE;
|
28891 | this.adapter.notchOutline(labelWidth);
|
28892 | } else {
|
28893 | this.adapter.closeOutline();
|
28894 | }
|
28895 | };
|
28896 | |
28897 |
|
28898 |
|
28899 | MDCTextFieldFoundation.prototype.activateFocus = function () {
|
28900 | this.isFocused = true;
|
28901 | this.styleFocused(this.isFocused);
|
28902 | this.adapter.activateLineRipple();
|
28903 | if (this.adapter.hasLabel()) {
|
28904 | this.notchOutline(this.shouldFloat);
|
28905 | this.adapter.floatLabel(this.shouldFloat);
|
28906 | this.styleFloating(this.shouldFloat);
|
28907 | this.adapter.shakeLabel(this.shouldShake);
|
28908 | }
|
28909 | if (this.helperText && (this.helperText.isPersistent() || !this.helperText.isValidation() || !this.valid)) {
|
28910 | this.helperText.showToScreenReader();
|
28911 | }
|
28912 | };
|
28913 | |
28914 |
|
28915 |
|
28916 |
|
28917 | MDCTextFieldFoundation.prototype.setTransformOrigin = function (evt) {
|
28918 | if (this.isDisabled() || this.adapter.hasOutline()) {
|
28919 | return;
|
28920 | }
|
28921 | var touches = evt.touches;
|
28922 | var targetEvent = touches ? touches[0] : evt;
|
28923 | var targetClientRect = targetEvent.target.getBoundingClientRect();
|
28924 | var normalizedX = targetEvent.clientX - targetClientRect.left;
|
28925 | this.adapter.setLineRippleTransformOrigin(normalizedX);
|
28926 | };
|
28927 | |
28928 |
|
28929 |
|
28930 | MDCTextFieldFoundation.prototype.handleInput = function () {
|
28931 | this.autoCompleteFocus();
|
28932 | this.setcharacterCounter(this.getValue().length);
|
28933 | };
|
28934 | |
28935 |
|
28936 |
|
28937 |
|
28938 | MDCTextFieldFoundation.prototype.autoCompleteFocus = function () {
|
28939 | if (!this.receivedUserInput) {
|
28940 | this.activateFocus();
|
28941 | }
|
28942 | };
|
28943 | |
28944 |
|
28945 |
|
28946 | MDCTextFieldFoundation.prototype.deactivateFocus = function () {
|
28947 | this.isFocused = false;
|
28948 | this.adapter.deactivateLineRipple();
|
28949 | var isValid = this.isValid();
|
28950 | this.styleValidity(isValid);
|
28951 | this.styleFocused(this.isFocused);
|
28952 | if (this.adapter.hasLabel()) {
|
28953 | this.notchOutline(this.shouldFloat);
|
28954 | this.adapter.floatLabel(this.shouldFloat);
|
28955 | this.styleFloating(this.shouldFloat);
|
28956 | this.adapter.shakeLabel(this.shouldShake);
|
28957 | }
|
28958 | if (!this.shouldFloat) {
|
28959 | this.receivedUserInput = false;
|
28960 | }
|
28961 | };
|
28962 | MDCTextFieldFoundation.prototype.getValue = function () {
|
28963 | return this.getNativeInput().value;
|
28964 | };
|
28965 | |
28966 |
|
28967 |
|
28968 | MDCTextFieldFoundation.prototype.setValue = function (value) {
|
28969 |
|
28970 |
|
28971 | if (this.getValue() !== value) {
|
28972 | this.getNativeInput().value = value;
|
28973 | }
|
28974 | this.setcharacterCounter(value.length);
|
28975 | if (this.validateOnValueChange) {
|
28976 | var isValid = this.isValid();
|
28977 | this.styleValidity(isValid);
|
28978 | }
|
28979 | if (this.adapter.hasLabel()) {
|
28980 | this.notchOutline(this.shouldFloat);
|
28981 | this.adapter.floatLabel(this.shouldFloat);
|
28982 | this.styleFloating(this.shouldFloat);
|
28983 | if (this.validateOnValueChange) {
|
28984 | this.adapter.shakeLabel(this.shouldShake);
|
28985 | }
|
28986 | }
|
28987 | };
|
28988 | |
28989 |
|
28990 |
|
28991 |
|
28992 | MDCTextFieldFoundation.prototype.isValid = function () {
|
28993 | return this.useNativeValidation ? this.isNativeInputValid() : this.valid;
|
28994 | };
|
28995 | |
28996 |
|
28997 |
|
28998 | MDCTextFieldFoundation.prototype.setValid = function (isValid) {
|
28999 | this.valid = isValid;
|
29000 | this.styleValidity(isValid);
|
29001 | var shouldShake = !isValid && !this.isFocused && !!this.getValue();
|
29002 | if (this.adapter.hasLabel()) {
|
29003 | this.adapter.shakeLabel(shouldShake);
|
29004 | }
|
29005 | };
|
29006 | |
29007 |
|
29008 |
|
29009 |
|
29010 | MDCTextFieldFoundation.prototype.setValidateOnValueChange = function (shouldValidate) {
|
29011 | this.validateOnValueChange = shouldValidate;
|
29012 | };
|
29013 | |
29014 |
|
29015 |
|
29016 |
|
29017 | MDCTextFieldFoundation.prototype.getValidateOnValueChange = function () {
|
29018 | return this.validateOnValueChange;
|
29019 | };
|
29020 | |
29021 |
|
29022 |
|
29023 |
|
29024 |
|
29025 |
|
29026 | MDCTextFieldFoundation.prototype.setUseNativeValidation = function (useNativeValidation) {
|
29027 | this.useNativeValidation = useNativeValidation;
|
29028 | };
|
29029 | MDCTextFieldFoundation.prototype.isDisabled = function () {
|
29030 | return this.getNativeInput().disabled;
|
29031 | };
|
29032 | |
29033 |
|
29034 |
|
29035 | MDCTextFieldFoundation.prototype.setDisabled = function (disabled) {
|
29036 | this.getNativeInput().disabled = disabled;
|
29037 | this.styleDisabled(disabled);
|
29038 | };
|
29039 | |
29040 |
|
29041 |
|
29042 | MDCTextFieldFoundation.prototype.setHelperTextContent = function (content) {
|
29043 | if (this.helperText) {
|
29044 | this.helperText.setContent(content);
|
29045 | }
|
29046 | };
|
29047 | |
29048 |
|
29049 |
|
29050 | MDCTextFieldFoundation.prototype.setLeadingIconAriaLabel = function (label) {
|
29051 | if (this.leadingIcon) {
|
29052 | this.leadingIcon.setAriaLabel(label);
|
29053 | }
|
29054 | };
|
29055 | |
29056 |
|
29057 |
|
29058 | MDCTextFieldFoundation.prototype.setLeadingIconContent = function (content) {
|
29059 | if (this.leadingIcon) {
|
29060 | this.leadingIcon.setContent(content);
|
29061 | }
|
29062 | };
|
29063 | |
29064 |
|
29065 |
|
29066 | MDCTextFieldFoundation.prototype.setTrailingIconAriaLabel = function (label) {
|
29067 | if (this.trailingIcon) {
|
29068 | this.trailingIcon.setAriaLabel(label);
|
29069 | }
|
29070 | };
|
29071 | |
29072 |
|
29073 |
|
29074 | MDCTextFieldFoundation.prototype.setTrailingIconContent = function (content) {
|
29075 | if (this.trailingIcon) {
|
29076 | this.trailingIcon.setContent(content);
|
29077 | }
|
29078 | };
|
29079 | |
29080 |
|
29081 |
|
29082 |
|
29083 | MDCTextFieldFoundation.prototype.setcharacterCounter = function (currentLength) {
|
29084 | if (!this.characterCounter) {
|
29085 | return;
|
29086 | }
|
29087 | var maxLength = this.getNativeInput().maxLength;
|
29088 | if (maxLength === -1) {
|
29089 | throw new Error('MDCTextFieldFoundation: Expected maxlength html property on text input or textarea.');
|
29090 | }
|
29091 | this.characterCounter.setCounterValue(currentLength, maxLength);
|
29092 | };
|
29093 | |
29094 |
|
29095 |
|
29096 |
|
29097 | MDCTextFieldFoundation.prototype.isBadInput = function () {
|
29098 |
|
29099 | return this.getNativeInput().validity.badInput || false;
|
29100 | };
|
29101 | |
29102 |
|
29103 |
|
29104 | MDCTextFieldFoundation.prototype.isNativeInputValid = function () {
|
29105 | return this.getNativeInput().validity.valid;
|
29106 | };
|
29107 | |
29108 |
|
29109 |
|
29110 | MDCTextFieldFoundation.prototype.styleValidity = function (isValid) {
|
29111 | var INVALID = MDCTextFieldFoundation.cssClasses.INVALID;
|
29112 | if (isValid) {
|
29113 | this.adapter.removeClass(INVALID);
|
29114 | } else {
|
29115 | this.adapter.addClass(INVALID);
|
29116 | }
|
29117 | if (this.helperText) {
|
29118 | this.helperText.setValidity(isValid);
|
29119 |
|
29120 |
|
29121 | var helperTextValidation = this.helperText.isValidation();
|
29122 | if (!helperTextValidation) {
|
29123 | return;
|
29124 | }
|
29125 | var helperTextVisible = this.helperText.isVisible();
|
29126 | var helperTextId = this.helperText.getId();
|
29127 | if (helperTextVisible && helperTextId) {
|
29128 | this.adapter.setInputAttr(constants_1.strings.ARIA_DESCRIBEDBY, helperTextId);
|
29129 | } else {
|
29130 | this.adapter.removeInputAttr(constants_1.strings.ARIA_DESCRIBEDBY);
|
29131 | }
|
29132 | }
|
29133 | };
|
29134 | |
29135 |
|
29136 |
|
29137 | MDCTextFieldFoundation.prototype.styleFocused = function (isFocused) {
|
29138 | var FOCUSED = MDCTextFieldFoundation.cssClasses.FOCUSED;
|
29139 | if (isFocused) {
|
29140 | this.adapter.addClass(FOCUSED);
|
29141 | } else {
|
29142 | this.adapter.removeClass(FOCUSED);
|
29143 | }
|
29144 | };
|
29145 | |
29146 |
|
29147 |
|
29148 | MDCTextFieldFoundation.prototype.styleDisabled = function (isDisabled) {
|
29149 | var _a = MDCTextFieldFoundation.cssClasses,
|
29150 | DISABLED = _a.DISABLED,
|
29151 | INVALID = _a.INVALID;
|
29152 | if (isDisabled) {
|
29153 | this.adapter.addClass(DISABLED);
|
29154 | this.adapter.removeClass(INVALID);
|
29155 | } else {
|
29156 | this.adapter.removeClass(DISABLED);
|
29157 | }
|
29158 | if (this.leadingIcon) {
|
29159 | this.leadingIcon.setDisabled(isDisabled);
|
29160 | }
|
29161 | if (this.trailingIcon) {
|
29162 | this.trailingIcon.setDisabled(isDisabled);
|
29163 | }
|
29164 | };
|
29165 | |
29166 |
|
29167 |
|
29168 | MDCTextFieldFoundation.prototype.styleFloating = function (isFloating) {
|
29169 | var LABEL_FLOATING = MDCTextFieldFoundation.cssClasses.LABEL_FLOATING;
|
29170 | if (isFloating) {
|
29171 | this.adapter.addClass(LABEL_FLOATING);
|
29172 | } else {
|
29173 | this.adapter.removeClass(LABEL_FLOATING);
|
29174 | }
|
29175 | };
|
29176 | |
29177 |
|
29178 |
|
29179 |
|
29180 | MDCTextFieldFoundation.prototype.getNativeInput = function () {
|
29181 |
|
29182 |
|
29183 |
|
29184 |
|
29185 |
|
29186 | var nativeInput = this.adapter ? this.adapter.getNativeInput() : null;
|
29187 | return nativeInput || {
|
29188 | disabled: false,
|
29189 | maxLength: -1,
|
29190 | required: false,
|
29191 | type: 'input',
|
29192 | validity: {
|
29193 | badInput: false,
|
29194 | valid: true
|
29195 | },
|
29196 | value: ''
|
29197 | };
|
29198 | };
|
29199 | return MDCTextFieldFoundation;
|
29200 | }(foundation_1.MDCFoundation);
|
29201 | exports.MDCTextFieldFoundation = MDCTextFieldFoundation;
|
29202 |
|
29203 | exports.default = MDCTextFieldFoundation;
|
29204 |
|
29205 | }),
|
29206 |
|
29207 | "./packages/mdc-textfield/helper-text/adapter.ts":
|
29208 |
|
29209 |
|
29210 |
|
29211 |
|
29212 | (function(module, exports, __webpack_require__) {
|
29213 |
|
29214 | "use strict";
|
29215 |
|
29216 |
|
29217 |
|
29218 |
|
29219 |
|
29220 |
|
29221 |
|
29222 |
|
29223 |
|
29224 |
|
29225 |
|
29226 |
|
29227 |
|
29228 |
|
29229 |
|
29230 |
|
29231 |
|
29232 |
|
29233 |
|
29234 |
|
29235 |
|
29236 |
|
29237 |
|
29238 |
|
29239 | Object.defineProperty(exports, "__esModule", { value: true });
|
29240 |
|
29241 | }),
|
29242 |
|
29243 | "./packages/mdc-textfield/helper-text/component.ts":
|
29244 |
|
29245 |
|
29246 |
|
29247 |
|
29248 | (function(module, exports, __webpack_require__) {
|
29249 |
|
29250 | "use strict";
|
29251 |
|
29252 |
|
29253 |
|
29254 |
|
29255 |
|
29256 |
|
29257 |
|
29258 |
|
29259 |
|
29260 |
|
29261 |
|
29262 |
|
29263 |
|
29264 |
|
29265 |
|
29266 |
|
29267 |
|
29268 |
|
29269 |
|
29270 |
|
29271 |
|
29272 |
|
29273 |
|
29274 |
|
29275 | var __extends = this && this.__extends || function () {
|
29276 | var _extendStatics = function extendStatics(d, b) {
|
29277 | _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
|
29278 | d.__proto__ = b;
|
29279 | } || function (d, b) {
|
29280 | for (var p in b) {
|
29281 | if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
29282 | }
|
29283 | };
|
29284 | return _extendStatics(d, b);
|
29285 | };
|
29286 | return function (d, b) {
|
29287 | if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
29288 | _extendStatics(d, b);
|
29289 | function __() {
|
29290 | this.constructor = d;
|
29291 | }
|
29292 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
29293 | };
|
29294 | }();
|
29295 | Object.defineProperty(exports, "__esModule", { value: true });
|
29296 | exports.MDCTextFieldHelperText = void 0;
|
29297 | var component_1 = __webpack_require__( "./packages/mdc-base/component.ts");
|
29298 | var foundation_1 = __webpack_require__( "./packages/mdc-textfield/helper-text/foundation.ts");
|
29299 | var MDCTextFieldHelperText = function (_super) {
|
29300 | __extends(MDCTextFieldHelperText, _super);
|
29301 | function MDCTextFieldHelperText() {
|
29302 | return _super !== null && _super.apply(this, arguments) || this;
|
29303 | }
|
29304 | MDCTextFieldHelperText.attachTo = function (root) {
|
29305 | return new MDCTextFieldHelperText(root);
|
29306 | };
|
29307 | Object.defineProperty(MDCTextFieldHelperText.prototype, "foundationForTextField", {
|
29308 |
|
29309 | get: function get() {
|
29310 | return this.foundation;
|
29311 | },
|
29312 | enumerable: false,
|
29313 | configurable: true
|
29314 | });
|
29315 | MDCTextFieldHelperText.prototype.getDefaultFoundation = function () {
|
29316 | var _this = this;
|
29317 |
|
29318 |
|
29319 |
|
29320 | var adapter = {
|
29321 | addClass: function addClass(className) {
|
29322 | return _this.root.classList.add(className);
|
29323 | },
|
29324 | removeClass: function removeClass(className) {
|
29325 | return _this.root.classList.remove(className);
|
29326 | },
|
29327 | hasClass: function hasClass(className) {
|
29328 | return _this.root.classList.contains(className);
|
29329 | },
|
29330 | getAttr: function getAttr(attr) {
|
29331 | return _this.root.getAttribute(attr);
|
29332 | },
|
29333 | setAttr: function setAttr(attr, value) {
|
29334 | return _this.root.setAttribute(attr, value);
|
29335 | },
|
29336 | removeAttr: function removeAttr(attr) {
|
29337 | return _this.root.removeAttribute(attr);
|
29338 | },
|
29339 | setContent: function setContent(content) {
|
29340 | _this.root.textContent = content;
|
29341 | }
|
29342 | };
|
29343 |
|
29344 | return new foundation_1.MDCTextFieldHelperTextFoundation(adapter);
|
29345 | };
|
29346 | return MDCTextFieldHelperText;
|
29347 | }(component_1.MDCComponent);
|
29348 | exports.MDCTextFieldHelperText = MDCTextFieldHelperText;
|
29349 |
|
29350 | }),
|
29351 |
|
29352 | "./packages/mdc-textfield/helper-text/constants.ts":
|
29353 |
|
29354 |
|
29355 |
|
29356 |
|
29357 | (function(module, exports, __webpack_require__) {
|
29358 |
|
29359 | "use strict";
|
29360 |
|
29361 |
|
29362 |
|
29363 |
|
29364 |
|
29365 |
|
29366 |
|
29367 |
|
29368 |
|
29369 |
|
29370 |
|
29371 |
|
29372 |
|
29373 |
|
29374 |
|
29375 |
|
29376 |
|
29377 |
|
29378 |
|
29379 |
|
29380 |
|
29381 |
|
29382 |
|
29383 |
|
29384 | Object.defineProperty(exports, "__esModule", { value: true });
|
29385 | exports.cssClasses = exports.strings = void 0;
|
29386 | var cssClasses = {
|
29387 | HELPER_TEXT_PERSISTENT: 'mdc-text-field-helper-text--persistent',
|
29388 | HELPER_TEXT_VALIDATION_MSG: 'mdc-text-field-helper-text--validation-msg',
|
29389 | ROOT: 'mdc-text-field-helper-text'
|
29390 | };
|
29391 | exports.cssClasses = cssClasses;
|
29392 | var strings = {
|
29393 | ARIA_HIDDEN: 'aria-hidden',
|
29394 | ROLE: 'role',
|
29395 | ROOT_SELECTOR: "." + cssClasses.ROOT
|
29396 | };
|
29397 | exports.strings = strings;
|
29398 |
|
29399 | }),
|
29400 |
|
29401 | "./packages/mdc-textfield/helper-text/foundation.ts":
|
29402 |
|
29403 |
|
29404 |
|
29405 |
|
29406 | (function(module, exports, __webpack_require__) {
|
29407 |
|
29408 | "use strict";
|
29409 |
|
29410 |
|
29411 |
|
29412 |
|
29413 |
|
29414 |
|
29415 |
|
29416 |
|
29417 |
|
29418 |
|
29419 |
|
29420 |
|
29421 |
|
29422 |
|
29423 |
|
29424 |
|
29425 |
|
29426 |
|
29427 |
|
29428 |
|
29429 |
|
29430 |
|
29431 |
|
29432 |
|
29433 | var __extends = this && this.__extends || function () {
|
29434 | var _extendStatics = function extendStatics(d, b) {
|
29435 | _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
|
29436 | d.__proto__ = b;
|
29437 | } || function (d, b) {
|
29438 | for (var p in b) {
|
29439 | if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
29440 | }
|
29441 | };
|
29442 | return _extendStatics(d, b);
|
29443 | };
|
29444 | return function (d, b) {
|
29445 | if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
29446 | _extendStatics(d, b);
|
29447 | function __() {
|
29448 | this.constructor = d;
|
29449 | }
|
29450 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
29451 | };
|
29452 | }();
|
29453 | var __assign = this && this.__assign || function () {
|
29454 | __assign = Object.assign || function (t) {
|
29455 | for (var s, i = 1, n = arguments.length; i < n; i++) {
|
29456 | s = arguments[i];
|
29457 | for (var p in s) {
|
29458 | if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
29459 | }
|
29460 | }
|
29461 | return t;
|
29462 | };
|
29463 | return __assign.apply(this, arguments);
|
29464 | };
|
29465 | Object.defineProperty(exports, "__esModule", { value: true });
|
29466 | exports.MDCTextFieldHelperTextFoundation = void 0;
|
29467 | var foundation_1 = __webpack_require__( "./packages/mdc-base/foundation.ts");
|
29468 | var constants_1 = __webpack_require__( "./packages/mdc-textfield/helper-text/constants.ts");
|
29469 | var MDCTextFieldHelperTextFoundation = function (_super) {
|
29470 | __extends(MDCTextFieldHelperTextFoundation, _super);
|
29471 | function MDCTextFieldHelperTextFoundation(adapter) {
|
29472 | return _super.call(this, __assign(__assign({}, MDCTextFieldHelperTextFoundation.defaultAdapter), adapter)) || this;
|
29473 | }
|
29474 | Object.defineProperty(MDCTextFieldHelperTextFoundation, "cssClasses", {
|
29475 | get: function get() {
|
29476 | return constants_1.cssClasses;
|
29477 | },
|
29478 | enumerable: false,
|
29479 | configurable: true
|
29480 | });
|
29481 | Object.defineProperty(MDCTextFieldHelperTextFoundation, "strings", {
|
29482 | get: function get() {
|
29483 | return constants_1.strings;
|
29484 | },
|
29485 | enumerable: false,
|
29486 | configurable: true
|
29487 | });
|
29488 | Object.defineProperty(MDCTextFieldHelperTextFoundation, "defaultAdapter", {
|
29489 | |
29490 |
|
29491 |
|
29492 | get: function get() {
|
29493 |
|
29494 | return {
|
29495 | addClass: function addClass() {
|
29496 | return undefined;
|
29497 | },
|
29498 | removeClass: function removeClass() {
|
29499 | return undefined;
|
29500 | },
|
29501 | hasClass: function hasClass() {
|
29502 | return false;
|
29503 | },
|
29504 | getAttr: function getAttr() {
|
29505 | return null;
|
29506 | },
|
29507 | setAttr: function setAttr() {
|
29508 | return undefined;
|
29509 | },
|
29510 | removeAttr: function removeAttr() {
|
29511 | return undefined;
|
29512 | },
|
29513 | setContent: function setContent() {
|
29514 | return undefined;
|
29515 | }
|
29516 | };
|
29517 |
|
29518 | },
|
29519 | enumerable: false,
|
29520 | configurable: true
|
29521 | });
|
29522 | MDCTextFieldHelperTextFoundation.prototype.getId = function () {
|
29523 | return this.adapter.getAttr('id');
|
29524 | };
|
29525 | MDCTextFieldHelperTextFoundation.prototype.isVisible = function () {
|
29526 | return this.adapter.getAttr(constants_1.strings.ARIA_HIDDEN) !== 'true';
|
29527 | };
|
29528 | |
29529 |
|
29530 |
|
29531 | MDCTextFieldHelperTextFoundation.prototype.setContent = function (content) {
|
29532 | this.adapter.setContent(content);
|
29533 | };
|
29534 | MDCTextFieldHelperTextFoundation.prototype.isPersistent = function () {
|
29535 | return this.adapter.hasClass(constants_1.cssClasses.HELPER_TEXT_PERSISTENT);
|
29536 | };
|
29537 | |
29538 |
|
29539 |
|
29540 | MDCTextFieldHelperTextFoundation.prototype.setPersistent = function (isPersistent) {
|
29541 | if (isPersistent) {
|
29542 | this.adapter.addClass(constants_1.cssClasses.HELPER_TEXT_PERSISTENT);
|
29543 | } else {
|
29544 | this.adapter.removeClass(constants_1.cssClasses.HELPER_TEXT_PERSISTENT);
|
29545 | }
|
29546 | };
|
29547 | |
29548 |
|
29549 |
|
29550 | MDCTextFieldHelperTextFoundation.prototype.isValidation = function () {
|
29551 | return this.adapter.hasClass(constants_1.cssClasses.HELPER_TEXT_VALIDATION_MSG);
|
29552 | };
|
29553 | |
29554 |
|
29555 |
|
29556 | MDCTextFieldHelperTextFoundation.prototype.setValidation = function (isValidation) {
|
29557 | if (isValidation) {
|
29558 | this.adapter.addClass(constants_1.cssClasses.HELPER_TEXT_VALIDATION_MSG);
|
29559 | } else {
|
29560 | this.adapter.removeClass(constants_1.cssClasses.HELPER_TEXT_VALIDATION_MSG);
|
29561 | }
|
29562 | };
|
29563 | |
29564 |
|
29565 |
|
29566 | MDCTextFieldHelperTextFoundation.prototype.showToScreenReader = function () {
|
29567 | this.adapter.removeAttr(constants_1.strings.ARIA_HIDDEN);
|
29568 | };
|
29569 | |
29570 |
|
29571 |
|
29572 | MDCTextFieldHelperTextFoundation.prototype.setValidity = function (inputIsValid) {
|
29573 | var helperTextIsPersistent = this.adapter.hasClass(constants_1.cssClasses.HELPER_TEXT_PERSISTENT);
|
29574 | var helperTextIsValidationMsg = this.adapter.hasClass(constants_1.cssClasses.HELPER_TEXT_VALIDATION_MSG);
|
29575 | var validationMsgNeedsDisplay = helperTextIsValidationMsg && !inputIsValid;
|
29576 | if (validationMsgNeedsDisplay) {
|
29577 | this.showToScreenReader();
|
29578 |
|
29579 |
|
29580 | if (this.adapter.getAttr(constants_1.strings.ROLE) === 'alert') {
|
29581 | this.refreshAlertRole();
|
29582 | } else {
|
29583 | this.adapter.setAttr(constants_1.strings.ROLE, 'alert');
|
29584 | }
|
29585 | } else {
|
29586 | this.adapter.removeAttr(constants_1.strings.ROLE);
|
29587 | }
|
29588 | if (!helperTextIsPersistent && !validationMsgNeedsDisplay) {
|
29589 | this.hide();
|
29590 | }
|
29591 | };
|
29592 | |
29593 |
|
29594 |
|
29595 | MDCTextFieldHelperTextFoundation.prototype.hide = function () {
|
29596 | this.adapter.setAttr(constants_1.strings.ARIA_HIDDEN, 'true');
|
29597 | };
|
29598 | MDCTextFieldHelperTextFoundation.prototype.refreshAlertRole = function () {
|
29599 | var _this = this;
|
29600 | this.adapter.removeAttr(constants_1.strings.ROLE);
|
29601 | requestAnimationFrame(function () {
|
29602 | _this.adapter.setAttr(constants_1.strings.ROLE, 'alert');
|
29603 | });
|
29604 | };
|
29605 | return MDCTextFieldHelperTextFoundation;
|
29606 | }(foundation_1.MDCFoundation);
|
29607 | exports.MDCTextFieldHelperTextFoundation = MDCTextFieldHelperTextFoundation;
|
29608 |
|
29609 | exports.default = MDCTextFieldHelperTextFoundation;
|
29610 |
|
29611 | }),
|
29612 |
|
29613 | "./packages/mdc-textfield/helper-text/index.ts":
|
29614 |
|
29615 |
|
29616 |
|
29617 |
|
29618 | (function(module, exports, __webpack_require__) {
|
29619 |
|
29620 | "use strict";
|
29621 |
|
29622 |
|
29623 |
|
29624 |
|
29625 |
|
29626 |
|
29627 |
|
29628 |
|
29629 |
|
29630 |
|
29631 |
|
29632 |
|
29633 |
|
29634 |
|
29635 |
|
29636 |
|
29637 |
|
29638 |
|
29639 |
|
29640 |
|
29641 |
|
29642 |
|
29643 |
|
29644 |
|
29645 | var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
|
29646 | if (k2 === undefined) k2 = k;
|
29647 | Object.defineProperty(o, k2, { enumerable: true, get: function get() {
|
29648 | return m[k];
|
29649 | } });
|
29650 | } : function (o, m, k, k2) {
|
29651 | if (k2 === undefined) k2 = k;
|
29652 | o[k2] = m[k];
|
29653 | });
|
29654 | var __exportStar = this && this.__exportStar || function (m, exports) {
|
29655 | for (var p in m) {
|
29656 | if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
29657 | }
|
29658 | };
|
29659 | Object.defineProperty(exports, "__esModule", { value: true });
|
29660 | exports.helperTextStrings = exports.helperTextCssClasses = void 0;
|
29661 | __exportStar(__webpack_require__( "./packages/mdc-textfield/helper-text/adapter.ts"), exports);
|
29662 | __exportStar(__webpack_require__( "./packages/mdc-textfield/helper-text/component.ts"), exports);
|
29663 | __exportStar(__webpack_require__( "./packages/mdc-textfield/helper-text/foundation.ts"), exports);
|
29664 | var constants_1 = __webpack_require__( "./packages/mdc-textfield/helper-text/constants.ts");
|
29665 | Object.defineProperty(exports, "helperTextCssClasses", { enumerable: true, get: function get() {
|
29666 | return constants_1.cssClasses;
|
29667 | } });
|
29668 | Object.defineProperty(exports, "helperTextStrings", { enumerable: true, get: function get() {
|
29669 | return constants_1.strings;
|
29670 | } });
|
29671 |
|
29672 | }),
|
29673 |
|
29674 | "./packages/mdc-textfield/icon/adapter.ts":
|
29675 |
|
29676 |
|
29677 |
|
29678 |
|
29679 | (function(module, exports, __webpack_require__) {
|
29680 |
|
29681 | "use strict";
|
29682 |
|
29683 |
|
29684 |
|
29685 |
|
29686 |
|
29687 |
|
29688 |
|
29689 |
|
29690 |
|
29691 |
|
29692 |
|
29693 |
|
29694 |
|
29695 |
|
29696 |
|
29697 |
|
29698 |
|
29699 |
|
29700 |
|
29701 |
|
29702 |
|
29703 |
|
29704 |
|
29705 |
|
29706 | Object.defineProperty(exports, "__esModule", { value: true });
|
29707 |
|
29708 | }),
|
29709 |
|
29710 | "./packages/mdc-textfield/icon/component.ts":
|
29711 |
|
29712 |
|
29713 |
|
29714 |
|
29715 | (function(module, exports, __webpack_require__) {
|
29716 |
|
29717 | "use strict";
|
29718 |
|
29719 |
|
29720 |
|
29721 |
|
29722 |
|
29723 |
|
29724 |
|
29725 |
|
29726 |
|
29727 |
|
29728 |
|
29729 |
|
29730 |
|
29731 |
|
29732 |
|
29733 |
|
29734 |
|
29735 |
|
29736 |
|
29737 |
|
29738 |
|
29739 |
|
29740 |
|
29741 |
|
29742 | var __extends = this && this.__extends || function () {
|
29743 | var _extendStatics = function extendStatics(d, b) {
|
29744 | _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
|
29745 | d.__proto__ = b;
|
29746 | } || function (d, b) {
|
29747 | for (var p in b) {
|
29748 | if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
29749 | }
|
29750 | };
|
29751 | return _extendStatics(d, b);
|
29752 | };
|
29753 | return function (d, b) {
|
29754 | if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
29755 | _extendStatics(d, b);
|
29756 | function __() {
|
29757 | this.constructor = d;
|
29758 | }
|
29759 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
29760 | };
|
29761 | }();
|
29762 | Object.defineProperty(exports, "__esModule", { value: true });
|
29763 | exports.MDCTextFieldIcon = void 0;
|
29764 | var component_1 = __webpack_require__( "./packages/mdc-base/component.ts");
|
29765 | var foundation_1 = __webpack_require__( "./packages/mdc-textfield/icon/foundation.ts");
|
29766 | var MDCTextFieldIcon = function (_super) {
|
29767 | __extends(MDCTextFieldIcon, _super);
|
29768 | function MDCTextFieldIcon() {
|
29769 | return _super !== null && _super.apply(this, arguments) || this;
|
29770 | }
|
29771 | MDCTextFieldIcon.attachTo = function (root) {
|
29772 | return new MDCTextFieldIcon(root);
|
29773 | };
|
29774 | Object.defineProperty(MDCTextFieldIcon.prototype, "foundationForTextField", {
|
29775 |
|
29776 | get: function get() {
|
29777 | return this.foundation;
|
29778 | },
|
29779 | enumerable: false,
|
29780 | configurable: true
|
29781 | });
|
29782 | MDCTextFieldIcon.prototype.getDefaultFoundation = function () {
|
29783 | var _this = this;
|
29784 |
|
29785 |
|
29786 |
|
29787 | var adapter = {
|
29788 | getAttr: function getAttr(attr) {
|
29789 | return _this.root.getAttribute(attr);
|
29790 | },
|
29791 | setAttr: function setAttr(attr, value) {
|
29792 | return _this.root.setAttribute(attr, value);
|
29793 | },
|
29794 | removeAttr: function removeAttr(attr) {
|
29795 | return _this.root.removeAttribute(attr);
|
29796 | },
|
29797 | setContent: function setContent(content) {
|
29798 | _this.root.textContent = content;
|
29799 | },
|
29800 | registerInteractionHandler: function registerInteractionHandler(evtType, handler) {
|
29801 | return _this.listen(evtType, handler);
|
29802 | },
|
29803 | deregisterInteractionHandler: function deregisterInteractionHandler(evtType, handler) {
|
29804 | return _this.unlisten(evtType, handler);
|
29805 | },
|
29806 | notifyIconAction: function notifyIconAction() {
|
29807 | return _this.emit(foundation_1.MDCTextFieldIconFoundation.strings.ICON_EVENT, {} , true );
|
29808 | }
|
29809 | };
|
29810 |
|
29811 | return new foundation_1.MDCTextFieldIconFoundation(adapter);
|
29812 | };
|
29813 | return MDCTextFieldIcon;
|
29814 | }(component_1.MDCComponent);
|
29815 | exports.MDCTextFieldIcon = MDCTextFieldIcon;
|
29816 |
|
29817 | }),
|
29818 |
|
29819 | "./packages/mdc-textfield/icon/constants.ts":
|
29820 |
|
29821 |
|
29822 |
|
29823 |
|
29824 | (function(module, exports, __webpack_require__) {
|
29825 |
|
29826 | "use strict";
|
29827 |
|
29828 |
|
29829 |
|
29830 |
|
29831 |
|
29832 |
|
29833 |
|
29834 |
|
29835 |
|
29836 |
|
29837 |
|
29838 |
|
29839 |
|
29840 |
|
29841 |
|
29842 |
|
29843 |
|
29844 |
|
29845 |
|
29846 |
|
29847 |
|
29848 |
|
29849 |
|
29850 |
|
29851 | Object.defineProperty(exports, "__esModule", { value: true });
|
29852 | exports.cssClasses = exports.strings = void 0;
|
29853 | var strings = {
|
29854 | ICON_EVENT: 'MDCTextField:icon',
|
29855 | ICON_ROLE: 'button'
|
29856 | };
|
29857 | exports.strings = strings;
|
29858 | var cssClasses = {
|
29859 | ROOT: 'mdc-text-field__icon'
|
29860 | };
|
29861 | exports.cssClasses = cssClasses;
|
29862 |
|
29863 | }),
|
29864 |
|
29865 | "./packages/mdc-textfield/icon/foundation.ts":
|
29866 |
|
29867 |
|
29868 |
|
29869 |
|
29870 | (function(module, exports, __webpack_require__) {
|
29871 |
|
29872 | "use strict";
|
29873 |
|
29874 |
|
29875 |
|
29876 |
|
29877 |
|
29878 |
|
29879 |
|
29880 |
|
29881 |
|
29882 |
|
29883 |
|
29884 |
|
29885 |
|
29886 |
|
29887 |
|
29888 |
|
29889 |
|
29890 |
|
29891 |
|
29892 |
|
29893 |
|
29894 |
|
29895 |
|
29896 |
|
29897 | var __extends = this && this.__extends || function () {
|
29898 | var _extendStatics = function extendStatics(d, b) {
|
29899 | _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
|
29900 | d.__proto__ = b;
|
29901 | } || function (d, b) {
|
29902 | for (var p in b) {
|
29903 | if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
29904 | }
|
29905 | };
|
29906 | return _extendStatics(d, b);
|
29907 | };
|
29908 | return function (d, b) {
|
29909 | if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
29910 | _extendStatics(d, b);
|
29911 | function __() {
|
29912 | this.constructor = d;
|
29913 | }
|
29914 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
29915 | };
|
29916 | }();
|
29917 | var __assign = this && this.__assign || function () {
|
29918 | __assign = Object.assign || function (t) {
|
29919 | for (var s, i = 1, n = arguments.length; i < n; i++) {
|
29920 | s = arguments[i];
|
29921 | for (var p in s) {
|
29922 | if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
29923 | }
|
29924 | }
|
29925 | return t;
|
29926 | };
|
29927 | return __assign.apply(this, arguments);
|
29928 | };
|
29929 | var __values = this && this.__values || function (o) {
|
29930 | var s = typeof Symbol === "function" && Symbol.iterator,
|
29931 | m = s && o[s],
|
29932 | i = 0;
|
29933 | if (m) return m.call(o);
|
29934 | if (o && typeof o.length === "number") return {
|
29935 | next: function next() {
|
29936 | if (o && i >= o.length) o = void 0;
|
29937 | return { value: o && o[i++], done: !o };
|
29938 | }
|
29939 | };
|
29940 | throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
29941 | };
|
29942 | Object.defineProperty(exports, "__esModule", { value: true });
|
29943 | exports.MDCTextFieldIconFoundation = void 0;
|
29944 | var foundation_1 = __webpack_require__( "./packages/mdc-base/foundation.ts");
|
29945 | var constants_1 = __webpack_require__( "./packages/mdc-textfield/icon/constants.ts");
|
29946 | var INTERACTION_EVENTS = ['click', 'keydown'];
|
29947 | var MDCTextFieldIconFoundation = function (_super) {
|
29948 | __extends(MDCTextFieldIconFoundation, _super);
|
29949 | function MDCTextFieldIconFoundation(adapter) {
|
29950 | var _this = _super.call(this, __assign(__assign({}, MDCTextFieldIconFoundation.defaultAdapter), adapter)) || this;
|
29951 | _this.savedTabIndex = null;
|
29952 | _this.interactionHandler = function (evt) {
|
29953 | _this.handleInteraction(evt);
|
29954 | };
|
29955 | return _this;
|
29956 | }
|
29957 | Object.defineProperty(MDCTextFieldIconFoundation, "strings", {
|
29958 | get: function get() {
|
29959 | return constants_1.strings;
|
29960 | },
|
29961 | enumerable: false,
|
29962 | configurable: true
|
29963 | });
|
29964 | Object.defineProperty(MDCTextFieldIconFoundation, "cssClasses", {
|
29965 | get: function get() {
|
29966 | return constants_1.cssClasses;
|
29967 | },
|
29968 | enumerable: false,
|
29969 | configurable: true
|
29970 | });
|
29971 | Object.defineProperty(MDCTextFieldIconFoundation, "defaultAdapter", {
|
29972 | |
29973 |
|
29974 |
|
29975 | get: function get() {
|
29976 |
|
29977 | return {
|
29978 | getAttr: function getAttr() {
|
29979 | return null;
|
29980 | },
|
29981 | setAttr: function setAttr() {
|
29982 | return undefined;
|
29983 | },
|
29984 | removeAttr: function removeAttr() {
|
29985 | return undefined;
|
29986 | },
|
29987 | setContent: function setContent() {
|
29988 | return undefined;
|
29989 | },
|
29990 | registerInteractionHandler: function registerInteractionHandler() {
|
29991 | return undefined;
|
29992 | },
|
29993 | deregisterInteractionHandler: function deregisterInteractionHandler() {
|
29994 | return undefined;
|
29995 | },
|
29996 | notifyIconAction: function notifyIconAction() {
|
29997 | return undefined;
|
29998 | }
|
29999 | };
|
30000 |
|
30001 | },
|
30002 | enumerable: false,
|
30003 | configurable: true
|
30004 | });
|
30005 | MDCTextFieldIconFoundation.prototype.init = function () {
|
30006 | var e_1, _a;
|
30007 | this.savedTabIndex = this.adapter.getAttr('tabindex');
|
30008 | try {
|
30009 | for (var INTERACTION_EVENTS_1 = __values(INTERACTION_EVENTS), INTERACTION_EVENTS_1_1 = INTERACTION_EVENTS_1.next(); !INTERACTION_EVENTS_1_1.done; INTERACTION_EVENTS_1_1 = INTERACTION_EVENTS_1.next()) {
|
30010 | var evtType = INTERACTION_EVENTS_1_1.value;
|
30011 | this.adapter.registerInteractionHandler(evtType, this.interactionHandler);
|
30012 | }
|
30013 | } catch (e_1_1) {
|
30014 | e_1 = { error: e_1_1 };
|
30015 | } finally {
|
30016 | try {
|
30017 | if (INTERACTION_EVENTS_1_1 && !INTERACTION_EVENTS_1_1.done && (_a = INTERACTION_EVENTS_1.return)) _a.call(INTERACTION_EVENTS_1);
|
30018 | } finally {
|
30019 | if (e_1) throw e_1.error;
|
30020 | }
|
30021 | }
|
30022 | };
|
30023 | MDCTextFieldIconFoundation.prototype.destroy = function () {
|
30024 | var e_2, _a;
|
30025 | try {
|
30026 | for (var INTERACTION_EVENTS_2 = __values(INTERACTION_EVENTS), INTERACTION_EVENTS_2_1 = INTERACTION_EVENTS_2.next(); !INTERACTION_EVENTS_2_1.done; INTERACTION_EVENTS_2_1 = INTERACTION_EVENTS_2.next()) {
|
30027 | var evtType = INTERACTION_EVENTS_2_1.value;
|
30028 | this.adapter.deregisterInteractionHandler(evtType, this.interactionHandler);
|
30029 | }
|
30030 | } catch (e_2_1) {
|
30031 | e_2 = { error: e_2_1 };
|
30032 | } finally {
|
30033 | try {
|
30034 | if (INTERACTION_EVENTS_2_1 && !INTERACTION_EVENTS_2_1.done && (_a = INTERACTION_EVENTS_2.return)) _a.call(INTERACTION_EVENTS_2);
|
30035 | } finally {
|
30036 | if (e_2) throw e_2.error;
|
30037 | }
|
30038 | }
|
30039 | };
|
30040 | MDCTextFieldIconFoundation.prototype.setDisabled = function (disabled) {
|
30041 | if (!this.savedTabIndex) {
|
30042 | return;
|
30043 | }
|
30044 | if (disabled) {
|
30045 | this.adapter.setAttr('tabindex', '-1');
|
30046 | this.adapter.removeAttr('role');
|
30047 | } else {
|
30048 | this.adapter.setAttr('tabindex', this.savedTabIndex);
|
30049 | this.adapter.setAttr('role', constants_1.strings.ICON_ROLE);
|
30050 | }
|
30051 | };
|
30052 | MDCTextFieldIconFoundation.prototype.setAriaLabel = function (label) {
|
30053 | this.adapter.setAttr('aria-label', label);
|
30054 | };
|
30055 | MDCTextFieldIconFoundation.prototype.setContent = function (content) {
|
30056 | this.adapter.setContent(content);
|
30057 | };
|
30058 | MDCTextFieldIconFoundation.prototype.handleInteraction = function (evt) {
|
30059 | var isEnterKey = evt.key === 'Enter' || evt.keyCode === 13;
|
30060 | if (evt.type === 'click' || isEnterKey) {
|
30061 | evt.preventDefault();
|
30062 |
|
30063 | this.adapter.notifyIconAction();
|
30064 | }
|
30065 | };
|
30066 | return MDCTextFieldIconFoundation;
|
30067 | }(foundation_1.MDCFoundation);
|
30068 | exports.MDCTextFieldIconFoundation = MDCTextFieldIconFoundation;
|
30069 |
|
30070 | exports.default = MDCTextFieldIconFoundation;
|
30071 |
|
30072 | }),
|
30073 |
|
30074 | "./packages/mdc-textfield/icon/index.ts":
|
30075 |
|
30076 |
|
30077 |
|
30078 |
|
30079 | (function(module, exports, __webpack_require__) {
|
30080 |
|
30081 | "use strict";
|
30082 |
|
30083 |
|
30084 |
|
30085 |
|
30086 |
|
30087 |
|
30088 |
|
30089 |
|
30090 |
|
30091 |
|
30092 |
|
30093 |
|
30094 |
|
30095 |
|
30096 |
|
30097 |
|
30098 |
|
30099 |
|
30100 |
|
30101 |
|
30102 |
|
30103 |
|
30104 |
|
30105 |
|
30106 | var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
|
30107 | if (k2 === undefined) k2 = k;
|
30108 | Object.defineProperty(o, k2, { enumerable: true, get: function get() {
|
30109 | return m[k];
|
30110 | } });
|
30111 | } : function (o, m, k, k2) {
|
30112 | if (k2 === undefined) k2 = k;
|
30113 | o[k2] = m[k];
|
30114 | });
|
30115 | var __exportStar = this && this.__exportStar || function (m, exports) {
|
30116 | for (var p in m) {
|
30117 | if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
30118 | }
|
30119 | };
|
30120 | Object.defineProperty(exports, "__esModule", { value: true });
|
30121 | exports.iconStrings = exports.iconCssClasses = void 0;
|
30122 | __exportStar(__webpack_require__( "./packages/mdc-textfield/icon/adapter.ts"), exports);
|
30123 | __exportStar(__webpack_require__( "./packages/mdc-textfield/icon/component.ts"), exports);
|
30124 | __exportStar(__webpack_require__( "./packages/mdc-textfield/icon/foundation.ts"), exports);
|
30125 | var constants_1 = __webpack_require__( "./packages/mdc-textfield/icon/constants.ts");
|
30126 | Object.defineProperty(exports, "iconCssClasses", { enumerable: true, get: function get() {
|
30127 | return constants_1.cssClasses;
|
30128 | } });
|
30129 | Object.defineProperty(exports, "iconStrings", { enumerable: true, get: function get() {
|
30130 | return constants_1.strings;
|
30131 | } });
|
30132 |
|
30133 | }),
|
30134 |
|
30135 | "./packages/mdc-textfield/index.ts":
|
30136 |
|
30137 |
|
30138 |
|
30139 |
|
30140 | (function(module, exports, __webpack_require__) {
|
30141 |
|
30142 | "use strict";
|
30143 |
|
30144 |
|
30145 |
|
30146 |
|
30147 |
|
30148 |
|
30149 |
|
30150 |
|
30151 |
|
30152 |
|
30153 |
|
30154 |
|
30155 |
|
30156 |
|
30157 |
|
30158 |
|
30159 |
|
30160 |
|
30161 |
|
30162 |
|
30163 |
|
30164 |
|
30165 |
|
30166 |
|
30167 | var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
|
30168 | if (k2 === undefined) k2 = k;
|
30169 | Object.defineProperty(o, k2, { enumerable: true, get: function get() {
|
30170 | return m[k];
|
30171 | } });
|
30172 | } : function (o, m, k, k2) {
|
30173 | if (k2 === undefined) k2 = k;
|
30174 | o[k2] = m[k];
|
30175 | });
|
30176 | var __exportStar = this && this.__exportStar || function (m, exports) {
|
30177 | for (var p in m) {
|
30178 | if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
30179 | }
|
30180 | };
|
30181 | Object.defineProperty(exports, "__esModule", { value: true });
|
30182 | __exportStar(__webpack_require__( "./packages/mdc-textfield/adapter.ts"), exports);
|
30183 | __exportStar(__webpack_require__( "./packages/mdc-textfield/component.ts"), exports);
|
30184 | __exportStar(__webpack_require__( "./packages/mdc-textfield/constants.ts"), exports);
|
30185 | __exportStar(__webpack_require__( "./packages/mdc-textfield/foundation.ts"), exports);
|
30186 | __exportStar(__webpack_require__( "./packages/mdc-textfield/types.ts"), exports);
|
30187 | __exportStar(__webpack_require__( "./packages/mdc-textfield/character-counter/index.ts"), exports);
|
30188 | __exportStar(__webpack_require__( "./packages/mdc-textfield/helper-text/index.ts"), exports);
|
30189 | __exportStar(__webpack_require__( "./packages/mdc-textfield/icon/index.ts"), exports);
|
30190 |
|
30191 | }),
|
30192 |
|
30193 | "./packages/mdc-textfield/types.ts":
|
30194 |
|
30195 |
|
30196 |
|
30197 |
|
30198 | (function(module, exports, __webpack_require__) {
|
30199 |
|
30200 | "use strict";
|
30201 |
|
30202 |
|
30203 |
|
30204 |
|
30205 |
|
30206 |
|
30207 |
|
30208 |
|
30209 |
|
30210 |
|
30211 |
|
30212 |
|
30213 |
|
30214 |
|
30215 |
|
30216 |
|
30217 |
|
30218 |
|
30219 |
|
30220 |
|
30221 |
|
30222 |
|
30223 |
|
30224 |
|
30225 | Object.defineProperty(exports, "__esModule", { value: true });
|
30226 |
|
30227 | }),
|
30228 |
|
30229 | "./packages/mdc-tooltip/adapter.ts":
|
30230 |
|
30231 |
|
30232 |
|
30233 |
|
30234 | (function(module, exports, __webpack_require__) {
|
30235 |
|
30236 | "use strict";
|
30237 |
|
30238 |
|
30239 |
|
30240 |
|
30241 |
|
30242 |
|
30243 |
|
30244 |
|
30245 |
|
30246 |
|
30247 |
|
30248 |
|
30249 |
|
30250 |
|
30251 |
|
30252 |
|
30253 |
|
30254 |
|
30255 |
|
30256 |
|
30257 |
|
30258 |
|
30259 |
|
30260 |
|
30261 | Object.defineProperty(exports, "__esModule", { value: true });
|
30262 |
|
30263 | }),
|
30264 |
|
30265 | "./packages/mdc-tooltip/component.ts":
|
30266 |
|
30267 |
|
30268 |
|
30269 |
|
30270 | (function(module, exports, __webpack_require__) {
|
30271 |
|
30272 | "use strict";
|
30273 |
|
30274 |
|
30275 |
|
30276 |
|
30277 |
|
30278 |
|
30279 |
|
30280 |
|
30281 |
|
30282 |
|
30283 |
|
30284 |
|
30285 |
|
30286 |
|
30287 |
|
30288 |
|
30289 |
|
30290 |
|
30291 |
|
30292 |
|
30293 |
|
30294 |
|
30295 |
|
30296 |
|
30297 | var __extends = this && this.__extends || function () {
|
30298 | var _extendStatics = function extendStatics(d, b) {
|
30299 | _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
|
30300 | d.__proto__ = b;
|
30301 | } || function (d, b) {
|
30302 | for (var p in b) {
|
30303 | if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
30304 | }
|
30305 | };
|
30306 | return _extendStatics(d, b);
|
30307 | };
|
30308 | return function (d, b) {
|
30309 | if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
30310 | _extendStatics(d, b);
|
30311 | function __() {
|
30312 | this.constructor = d;
|
30313 | }
|
30314 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
30315 | };
|
30316 | }();
|
30317 | Object.defineProperty(exports, "__esModule", { value: true });
|
30318 | exports.MDCTooltip = void 0;
|
30319 | var component_1 = __webpack_require__( "./packages/mdc-base/component.ts");
|
30320 | var constants_1 = __webpack_require__( "./packages/mdc-tooltip/constants.ts");
|
30321 | var foundation_1 = __webpack_require__( "./packages/mdc-tooltip/foundation.ts");
|
30322 | var MDCTooltip = function (_super) {
|
30323 | __extends(MDCTooltip, _super);
|
30324 | function MDCTooltip() {
|
30325 | return _super !== null && _super.apply(this, arguments) || this;
|
30326 | }
|
30327 | MDCTooltip.attachTo = function (root) {
|
30328 | return new MDCTooltip(root);
|
30329 | };
|
30330 | MDCTooltip.prototype.initialize = function () {
|
30331 | var tooltipId = this.root.getAttribute('id');
|
30332 | if (!tooltipId) {
|
30333 | throw new Error('MDCTooltip: Tooltip component must have an id.');
|
30334 | }
|
30335 | var anchorElem = document.querySelector("[data-tooltip-id=\"" + tooltipId + "\"]") || document.querySelector("[aria-describedby=\"" + tooltipId + "\"]");
|
30336 | if (!anchorElem) {
|
30337 | throw new Error('MDCTooltip: Tooltip component requires an anchor element annotated with [aria-describedby] or [data-tooltip-id].');
|
30338 | }
|
30339 | this.anchorElem = anchorElem;
|
30340 | };
|
30341 | MDCTooltip.prototype.initialSyncWithDOM = function () {
|
30342 | var _this = this;
|
30343 | this.isTooltipRich = this.foundation.isRich();
|
30344 | this.isTooltipPersistent = this.foundation.isPersistent();
|
30345 | this.handleMouseEnter = function () {
|
30346 | _this.foundation.handleAnchorMouseEnter();
|
30347 | };
|
30348 | this.handleFocus = function (evt) {
|
30349 | _this.foundation.handleAnchorFocus(evt);
|
30350 | };
|
30351 | this.handleMouseLeave = function () {
|
30352 | _this.foundation.handleAnchorMouseLeave();
|
30353 | };
|
30354 | this.handleTransitionEnd = function () {
|
30355 | _this.foundation.handleTransitionEnd();
|
30356 | };
|
30357 | this.handleClick = function () {
|
30358 | _this.foundation.handleAnchorClick();
|
30359 | };
|
30360 | this.handleTouchstart = function () {
|
30361 | _this.foundation.handleAnchorTouchstart();
|
30362 | };
|
30363 | this.handleTouchend = function () {
|
30364 | _this.foundation.handleAnchorTouchend();
|
30365 | };
|
30366 | if (this.isTooltipRich && this.isTooltipPersistent) {
|
30367 | this.anchorElem.addEventListener('click', this.handleClick);
|
30368 | } else {
|
30369 | this.anchorElem.addEventListener('mouseenter', this.handleMouseEnter);
|
30370 |
|
30371 | this.anchorElem.addEventListener('focus', this.handleFocus);
|
30372 | this.anchorElem.addEventListener('mouseleave', this.handleMouseLeave);
|
30373 | this.anchorElem.addEventListener('touchstart', this.handleTouchstart);
|
30374 | this.anchorElem.addEventListener('touchend', this.handleTouchend);
|
30375 | }
|
30376 | this.listen('transitionend', this.handleTransitionEnd);
|
30377 | };
|
30378 | MDCTooltip.prototype.destroy = function () {
|
30379 | if (this.anchorElem) {
|
30380 | if (this.isTooltipRich && this.isTooltipPersistent) {
|
30381 | this.anchorElem.removeEventListener('click', this.handleClick);
|
30382 | } else {
|
30383 | this.anchorElem.removeEventListener('mouseenter', this.handleMouseEnter);
|
30384 | this.anchorElem.removeEventListener('focus', this.handleFocus);
|
30385 | this.anchorElem.removeEventListener('mouseleave', this.handleMouseLeave);
|
30386 | this.anchorElem.removeEventListener('touchstart', this.handleTouchstart);
|
30387 | this.anchorElem.removeEventListener('touchend', this.handleTouchend);
|
30388 | }
|
30389 | }
|
30390 | this.unlisten('transitionend', this.handleTransitionEnd);
|
30391 | _super.prototype.destroy.call(this);
|
30392 | };
|
30393 | MDCTooltip.prototype.setTooltipPosition = function (position) {
|
30394 | this.foundation.setTooltipPosition(position);
|
30395 | };
|
30396 | MDCTooltip.prototype.setAnchorBoundaryType = function (type) {
|
30397 | this.foundation.setAnchorBoundaryType(type);
|
30398 | };
|
30399 | MDCTooltip.prototype.setShowDelay = function (delayMs) {
|
30400 | this.foundation.setShowDelay(delayMs);
|
30401 | };
|
30402 | MDCTooltip.prototype.setHideDelay = function (delayMs) {
|
30403 | this.foundation.setHideDelay(delayMs);
|
30404 | };
|
30405 | MDCTooltip.prototype.hide = function () {
|
30406 | this.foundation.hide();
|
30407 | };
|
30408 | MDCTooltip.prototype.isShown = function () {
|
30409 | return this.foundation.isShown();
|
30410 | };
|
30411 | |
30412 |
|
30413 |
|
30414 |
|
30415 |
|
30416 |
|
30417 |
|
30418 | MDCTooltip.prototype.attachScrollHandler = function (addEventListenerFn) {
|
30419 | this.foundation.attachScrollHandler(addEventListenerFn);
|
30420 | };
|
30421 | |
30422 |
|
30423 |
|
30424 |
|
30425 | MDCTooltip.prototype.removeScrollHandler = function (removeEventHandlerFn) {
|
30426 | this.foundation.removeScrollHandler(removeEventHandlerFn);
|
30427 | };
|
30428 | MDCTooltip.prototype.getDefaultFoundation = function () {
|
30429 | var _this = this;
|
30430 | var adapter = {
|
30431 | getAttribute: function getAttribute(attr) {
|
30432 | return _this.root.getAttribute(attr);
|
30433 | },
|
30434 | setAttribute: function setAttribute(attr, value) {
|
30435 | _this.root.setAttribute(attr, value);
|
30436 | },
|
30437 | removeAttribute: function removeAttribute(attr) {
|
30438 | _this.root.removeAttribute(attr);
|
30439 | },
|
30440 | addClass: function addClass(className) {
|
30441 | _this.root.classList.add(className);
|
30442 | },
|
30443 | hasClass: function hasClass(className) {
|
30444 | return _this.root.classList.contains(className);
|
30445 | },
|
30446 | removeClass: function removeClass(className) {
|
30447 | _this.root.classList.remove(className);
|
30448 | },
|
30449 | getComputedStyleProperty: function getComputedStyleProperty(propertyName) {
|
30450 | return window.getComputedStyle(_this.root).getPropertyValue(propertyName);
|
30451 | },
|
30452 | setStyleProperty: function setStyleProperty(propertyName, value) {
|
30453 | _this.root.style.setProperty(propertyName, value);
|
30454 | },
|
30455 | setSurfaceAnimationStyleProperty: function setSurfaceAnimationStyleProperty(propertyName, value) {
|
30456 | var surface = _this.root.querySelector("." + constants_1.CssClasses.SURFACE_ANIMATION);
|
30457 | surface === null || surface === void 0 ? void 0 : surface.style.setProperty(propertyName, value);
|
30458 | },
|
30459 | getViewportWidth: function getViewportWidth() {
|
30460 | return window.innerWidth;
|
30461 | },
|
30462 | getViewportHeight: function getViewportHeight() {
|
30463 | return window.innerHeight;
|
30464 | },
|
30465 | getTooltipSize: function getTooltipSize() {
|
30466 | return {
|
30467 | width: _this.root.offsetWidth,
|
30468 | height: _this.root.offsetHeight
|
30469 | };
|
30470 | },
|
30471 | getAnchorBoundingRect: function getAnchorBoundingRect() {
|
30472 | return _this.anchorElem ? _this.anchorElem.getBoundingClientRect() : null;
|
30473 | },
|
30474 | getParentBoundingRect: function getParentBoundingRect() {
|
30475 | var _a, _b;
|
30476 | return (_b = (_a = _this.root.parentElement) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect()) !== null && _b !== void 0 ? _b : null;
|
30477 | },
|
30478 | getAnchorAttribute: function getAnchorAttribute(attr) {
|
30479 | return _this.anchorElem ? _this.anchorElem.getAttribute(attr) : null;
|
30480 | },
|
30481 | setAnchorAttribute: function setAnchorAttribute(attr, value) {
|
30482 | var _a;
|
30483 | (_a = _this.anchorElem) === null || _a === void 0 ? void 0 : _a.setAttribute(attr, value);
|
30484 | },
|
30485 | isRTL: function isRTL() {
|
30486 | return getComputedStyle(_this.root).direction === 'rtl';
|
30487 | },
|
30488 | anchorContainsElement: function anchorContainsElement(element) {
|
30489 | var _a;
|
30490 | return !!((_a = _this.anchorElem) === null || _a === void 0 ? void 0 : _a.contains(element));
|
30491 | },
|
30492 | tooltipContainsElement: function tooltipContainsElement(element) {
|
30493 | return _this.root.contains(element);
|
30494 | },
|
30495 | focusAnchorElement: function focusAnchorElement() {
|
30496 | var _a;
|
30497 | (_a = _this.anchorElem) === null || _a === void 0 ? void 0 : _a.focus();
|
30498 | },
|
30499 | registerEventHandler: function registerEventHandler(evt, handler) {
|
30500 | if (_this.root instanceof HTMLElement) {
|
30501 | _this.root.addEventListener(evt, handler);
|
30502 | }
|
30503 | },
|
30504 | deregisterEventHandler: function deregisterEventHandler(evt, handler) {
|
30505 | if (_this.root instanceof HTMLElement) {
|
30506 | _this.root.removeEventListener(evt, handler);
|
30507 | }
|
30508 | },
|
30509 | registerAnchorEventHandler: function registerAnchorEventHandler(evt, handler) {
|
30510 | var _a;
|
30511 | (_a = _this.anchorElem) === null || _a === void 0 ? void 0 : _a.addEventListener(evt, handler);
|
30512 | },
|
30513 | deregisterAnchorEventHandler: function deregisterAnchorEventHandler(evt, handler) {
|
30514 | var _a;
|
30515 | (_a = _this.anchorElem) === null || _a === void 0 ? void 0 : _a.removeEventListener(evt, handler);
|
30516 | },
|
30517 | registerDocumentEventHandler: function registerDocumentEventHandler(evt, handler) {
|
30518 | document.body.addEventListener(evt, handler);
|
30519 | },
|
30520 | deregisterDocumentEventHandler: function deregisterDocumentEventHandler(evt, handler) {
|
30521 | document.body.removeEventListener(evt, handler);
|
30522 | },
|
30523 | registerWindowEventHandler: function registerWindowEventHandler(evt, handler) {
|
30524 | window.addEventListener(evt, handler);
|
30525 | },
|
30526 | deregisterWindowEventHandler: function deregisterWindowEventHandler(evt, handler) {
|
30527 | window.removeEventListener(evt, handler);
|
30528 | },
|
30529 | notifyHidden: function notifyHidden() {
|
30530 | _this.emit(constants_1.events.HIDDEN, {});
|
30531 | },
|
30532 | getTooltipCaretBoundingRect: function getTooltipCaretBoundingRect() {
|
30533 | var caret = _this.root.querySelector("." + constants_1.CssClasses.TOOLTIP_CARET_TOP);
|
30534 | if (!caret) {
|
30535 | return null;
|
30536 | }
|
30537 | return caret.getBoundingClientRect();
|
30538 | },
|
30539 | setTooltipCaretStyle: function setTooltipCaretStyle(propertyName, value) {
|
30540 | var topCaret = _this.root.querySelector("." + constants_1.CssClasses.TOOLTIP_CARET_TOP);
|
30541 | var bottomCaret = _this.root.querySelector("." + constants_1.CssClasses.TOOLTIP_CARET_BOTTOM);
|
30542 | if (!topCaret || !bottomCaret) {
|
30543 | return;
|
30544 | }
|
30545 | topCaret.style.setProperty(propertyName, value);
|
30546 | bottomCaret.style.setProperty(propertyName, value);
|
30547 | },
|
30548 | clearTooltipCaretStyles: function clearTooltipCaretStyles() {
|
30549 | var topCaret = _this.root.querySelector("." + constants_1.CssClasses.TOOLTIP_CARET_TOP);
|
30550 | var bottomCaret = _this.root.querySelector("." + constants_1.CssClasses.TOOLTIP_CARET_BOTTOM);
|
30551 | if (!topCaret || !bottomCaret) {
|
30552 | return;
|
30553 | }
|
30554 | topCaret.removeAttribute('style');
|
30555 | bottomCaret.removeAttribute('style');
|
30556 | },
|
30557 | getActiveElement: function getActiveElement() {
|
30558 | return document.activeElement;
|
30559 | }
|
30560 | };
|
30561 |
|
30562 | return new foundation_1.MDCTooltipFoundation(adapter);
|
30563 | };
|
30564 | return MDCTooltip;
|
30565 | }(component_1.MDCComponent);
|
30566 | exports.MDCTooltip = MDCTooltip;
|
30567 |
|
30568 | }),
|
30569 |
|
30570 | "./packages/mdc-tooltip/constants.ts":
|
30571 |
|
30572 |
|
30573 |
|
30574 |
|
30575 | (function(module, exports, __webpack_require__) {
|
30576 |
|
30577 | "use strict";
|
30578 |
|
30579 |
|
30580 |
|
30581 |
|
30582 |
|
30583 |
|
30584 |
|
30585 |
|
30586 |
|
30587 |
|
30588 |
|
30589 |
|
30590 |
|
30591 |
|
30592 |
|
30593 |
|
30594 |
|
30595 |
|
30596 |
|
30597 |
|
30598 |
|
30599 |
|
30600 |
|
30601 |
|
30602 | Object.defineProperty(exports, "__esModule", { value: true });
|
30603 | exports.XPositionWithCaret = exports.YPositionWithCaret = exports.PositionWithCaret = exports.strings = exports.YPosition = exports.AnchorBoundaryType = exports.XPosition = exports.events = exports.attributes = exports.numbers = exports.CssClasses = void 0;
|
30604 | var CssClasses;
|
30605 | (function (CssClasses) {
|
30606 | CssClasses["RICH"] = "mdc-tooltip--rich";
|
30607 | CssClasses["SHOWN"] = "mdc-tooltip--shown";
|
30608 | CssClasses["SHOWING"] = "mdc-tooltip--showing";
|
30609 | CssClasses["SHOWING_TRANSITION"] = "mdc-tooltip--showing-transition";
|
30610 | CssClasses["HIDE"] = "mdc-tooltip--hide";
|
30611 | CssClasses["HIDE_TRANSITION"] = "mdc-tooltip--hide-transition";
|
30612 | CssClasses["MULTILINE_TOOLTIP"] = "mdc-tooltip--multiline";
|
30613 | CssClasses["SURFACE"] = "mdc-tooltip__surface";
|
30614 | CssClasses["SURFACE_ANIMATION"] = "mdc-tooltip__surface-animation";
|
30615 | CssClasses["TOOLTIP_CARET_TOP"] = "mdc-tooltip__caret-surface-top";
|
30616 | CssClasses["TOOLTIP_CARET_BOTTOM"] = "mdc-tooltip__caret-surface-bottom";
|
30617 | })(CssClasses || (CssClasses = {}));
|
30618 | exports.CssClasses = CssClasses;
|
30619 | var numbers = {
|
30620 | BOUNDED_ANCHOR_GAP: 4,
|
30621 | UNBOUNDED_ANCHOR_GAP: 8,
|
30622 | MIN_VIEWPORT_TOOLTIP_THRESHOLD: 8,
|
30623 | HIDE_DELAY_MS: 600,
|
30624 | SHOW_DELAY_MS: 500,
|
30625 |
|
30626 | MIN_HEIGHT: 24,
|
30627 | MAX_WIDTH: 200,
|
30628 |
|
30629 | CARET_INDENTATION: 24,
|
30630 |
|
30631 | ANIMATION_SCALE: 0.8
|
30632 | };
|
30633 | exports.numbers = numbers;
|
30634 | var attributes = {
|
30635 | ARIA_EXPANDED: 'aria-expanded',
|
30636 | ARIA_HASPOPUP: 'aria-haspopup',
|
30637 | PERSISTENT: 'data-mdc-tooltip-persistent',
|
30638 | SCROLLABLE_ANCESTOR: 'tooltip-scrollable-ancestor',
|
30639 | HAS_CARET: 'data-mdc-tooltip-has-caret'
|
30640 | };
|
30641 | exports.attributes = attributes;
|
30642 | var events = {
|
30643 | HIDDEN: 'MDCTooltip:hidden'
|
30644 | };
|
30645 | exports.events = events;
|
30646 |
|
30647 | var XPosition;
|
30648 | (function (XPosition) {
|
30649 | XPosition[XPosition["DETECTED"] = 0] = "DETECTED";
|
30650 | XPosition[XPosition["START"] = 1] = "START";
|
30651 |
|
30652 | XPosition[XPosition["CENTER"] = 2] = "CENTER";
|
30653 | XPosition[XPosition["END"] = 3] = "END";
|
30654 | })(XPosition || (XPosition = {}));
|
30655 | exports.XPosition = XPosition;
|
30656 | var YPosition;
|
30657 | (function (YPosition) {
|
30658 | YPosition[YPosition["DETECTED"] = 0] = "DETECTED";
|
30659 | YPosition[YPosition["ABOVE"] = 1] = "ABOVE";
|
30660 | YPosition[YPosition["BELOW"] = 2] = "BELOW";
|
30661 | })(YPosition || (YPosition = {}));
|
30662 | exports.YPosition = YPosition;
|
30663 |
|
30664 |
|
30665 |
|
30666 |
|
30667 |
|
30668 |
|
30669 | var AnchorBoundaryType;
|
30670 | (function (AnchorBoundaryType) {
|
30671 | AnchorBoundaryType[AnchorBoundaryType["BOUNDED"] = 0] = "BOUNDED";
|
30672 | AnchorBoundaryType[AnchorBoundaryType["UNBOUNDED"] = 1] = "UNBOUNDED";
|
30673 | })(AnchorBoundaryType || (AnchorBoundaryType = {}));
|
30674 | exports.AnchorBoundaryType = AnchorBoundaryType;
|
30675 | var strings = {
|
30676 | LEFT: 'left',
|
30677 | RIGHT: 'right',
|
30678 | CENTER: 'center',
|
30679 | TOP: 'top',
|
30680 | BOTTOM: 'bottom'
|
30681 | };
|
30682 | exports.strings = strings;
|
30683 |
|
30684 |
|
30685 |
|
30686 |
|
30687 |
|
30688 |
|
30689 |
|
30690 | var PositionWithCaret;
|
30691 | (function (PositionWithCaret) {
|
30692 | PositionWithCaret[PositionWithCaret["DETECTED"] = 0] = "DETECTED";
|
30693 | PositionWithCaret[PositionWithCaret["ABOVE_START"] = 1] = "ABOVE_START";
|
30694 | PositionWithCaret[PositionWithCaret["ABOVE_CENTER"] = 2] = "ABOVE_CENTER";
|
30695 | PositionWithCaret[PositionWithCaret["ABOVE_END"] = 3] = "ABOVE_END";
|
30696 | PositionWithCaret[PositionWithCaret["TOP_SIDE_START"] = 4] = "TOP_SIDE_START";
|
30697 | PositionWithCaret[PositionWithCaret["CENTER_SIDE_START"] = 5] = "CENTER_SIDE_START";
|
30698 | PositionWithCaret[PositionWithCaret["BOTTOM_SIDE_START"] = 6] = "BOTTOM_SIDE_START";
|
30699 | PositionWithCaret[PositionWithCaret["TOP_SIDE_END"] = 7] = "TOP_SIDE_END";
|
30700 | PositionWithCaret[PositionWithCaret["CENTER_SIDE_END"] = 8] = "CENTER_SIDE_END";
|
30701 | PositionWithCaret[PositionWithCaret["BOTTOM_SIDE_END"] = 9] = "BOTTOM_SIDE_END";
|
30702 | PositionWithCaret[PositionWithCaret["BELOW_START"] = 10] = "BELOW_START";
|
30703 | PositionWithCaret[PositionWithCaret["BELOW_CENTER"] = 11] = "BELOW_CENTER";
|
30704 | PositionWithCaret[PositionWithCaret["BELOW_END"] = 12] = "BELOW_END";
|
30705 | })(PositionWithCaret || (PositionWithCaret = {}));
|
30706 | exports.PositionWithCaret = PositionWithCaret;
|
30707 | var YPositionWithCaret;
|
30708 | (function (YPositionWithCaret) {
|
30709 | YPositionWithCaret[YPositionWithCaret["ABOVE"] = 1] = "ABOVE";
|
30710 | YPositionWithCaret[YPositionWithCaret["BELOW"] = 2] = "BELOW";
|
30711 | YPositionWithCaret[YPositionWithCaret["SIDE_TOP"] = 3] = "SIDE_TOP";
|
30712 | YPositionWithCaret[YPositionWithCaret["SIDE_CENTER"] = 4] = "SIDE_CENTER";
|
30713 | YPositionWithCaret[YPositionWithCaret["SIDE_BOTTOM"] = 5] = "SIDE_BOTTOM";
|
30714 | })(YPositionWithCaret || (YPositionWithCaret = {}));
|
30715 | exports.YPositionWithCaret = YPositionWithCaret;
|
30716 | var XPositionWithCaret;
|
30717 | (function (XPositionWithCaret) {
|
30718 | XPositionWithCaret[XPositionWithCaret["START"] = 1] = "START";
|
30719 | XPositionWithCaret[XPositionWithCaret["CENTER"] = 2] = "CENTER";
|
30720 | XPositionWithCaret[XPositionWithCaret["END"] = 3] = "END";
|
30721 | XPositionWithCaret[XPositionWithCaret["SIDE_START"] = 4] = "SIDE_START";
|
30722 | XPositionWithCaret[XPositionWithCaret["SIDE_END"] = 5] = "SIDE_END";
|
30723 | })(XPositionWithCaret || (XPositionWithCaret = {}));
|
30724 | exports.XPositionWithCaret = XPositionWithCaret;
|
30725 |
|
30726 | }),
|
30727 |
|
30728 | "./packages/mdc-tooltip/foundation.ts":
|
30729 |
|
30730 |
|
30731 |
|
30732 |
|
30733 | (function(module, exports, __webpack_require__) {
|
30734 |
|
30735 | "use strict";
|
30736 |
|
30737 |
|
30738 |
|
30739 |
|
30740 |
|
30741 |
|
30742 |
|
30743 |
|
30744 |
|
30745 |
|
30746 |
|
30747 |
|
30748 |
|
30749 |
|
30750 |
|
30751 |
|
30752 |
|
30753 |
|
30754 |
|
30755 |
|
30756 |
|
30757 |
|
30758 |
|
30759 |
|
30760 | var __extends = this && this.__extends || function () {
|
30761 | var _extendStatics = function extendStatics(d, b) {
|
30762 | _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
|
30763 | d.__proto__ = b;
|
30764 | } || function (d, b) {
|
30765 | for (var p in b) {
|
30766 | if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
30767 | }
|
30768 | };
|
30769 | return _extendStatics(d, b);
|
30770 | };
|
30771 | return function (d, b) {
|
30772 | if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
30773 | _extendStatics(d, b);
|
30774 | function __() {
|
30775 | this.constructor = d;
|
30776 | }
|
30777 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
30778 | };
|
30779 | }();
|
30780 | var __assign = this && this.__assign || function () {
|
30781 | __assign = Object.assign || function (t) {
|
30782 | for (var s, i = 1, n = arguments.length; i < n; i++) {
|
30783 | s = arguments[i];
|
30784 | for (var p in s) {
|
30785 | if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
30786 | }
|
30787 | }
|
30788 | return t;
|
30789 | };
|
30790 | return __assign.apply(this, arguments);
|
30791 | };
|
30792 | var __values = this && this.__values || function (o) {
|
30793 | var s = typeof Symbol === "function" && Symbol.iterator,
|
30794 | m = s && o[s],
|
30795 | i = 0;
|
30796 | if (m) return m.call(o);
|
30797 | if (o && typeof o.length === "number") return {
|
30798 | next: function next() {
|
30799 | if (o && i >= o.length) o = void 0;
|
30800 | return { value: o && o[i++], done: !o };
|
30801 | }
|
30802 | };
|
30803 | throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
30804 | };
|
30805 | Object.defineProperty(exports, "__esModule", { value: true });
|
30806 | exports.MDCTooltipFoundation = void 0;
|
30807 | var animationframe_1 = __webpack_require__( "./packages/mdc-animation/animationframe.ts");
|
30808 | var util_1 = __webpack_require__( "./packages/mdc-animation/util.ts");
|
30809 | var foundation_1 = __webpack_require__( "./packages/mdc-base/foundation.ts");
|
30810 | var keyboard_1 = __webpack_require__( "./packages/mdc-dom/keyboard.ts");
|
30811 | var constants_1 = __webpack_require__( "./packages/mdc-tooltip/constants.ts");
|
30812 | var RICH = constants_1.CssClasses.RICH,
|
30813 | SHOWN = constants_1.CssClasses.SHOWN,
|
30814 | SHOWING = constants_1.CssClasses.SHOWING,
|
30815 | SHOWING_TRANSITION = constants_1.CssClasses.SHOWING_TRANSITION,
|
30816 | HIDE = constants_1.CssClasses.HIDE,
|
30817 | HIDE_TRANSITION = constants_1.CssClasses.HIDE_TRANSITION,
|
30818 | MULTILINE_TOOLTIP = constants_1.CssClasses.MULTILINE_TOOLTIP;
|
30819 | var AnimationKeys;
|
30820 | (function (AnimationKeys) {
|
30821 | AnimationKeys["POLL_ANCHOR"] = "poll_anchor";
|
30822 | })(AnimationKeys || (AnimationKeys = {}));
|
30823 |
|
30824 | var HAS_WINDOW = typeof window !== 'undefined';
|
30825 | var MDCTooltipFoundation = function (_super) {
|
30826 | __extends(MDCTooltipFoundation, _super);
|
30827 | function MDCTooltipFoundation(adapter) {
|
30828 | var _this = _super.call(this, __assign(__assign({}, MDCTooltipFoundation.defaultAdapter), adapter)) || this;
|
30829 | _this.tooltipShown = false;
|
30830 | _this.anchorGap = constants_1.numbers.BOUNDED_ANCHOR_GAP;
|
30831 | _this.xTooltipPos = constants_1.XPosition.DETECTED;
|
30832 | _this.yTooltipPos = constants_1.YPosition.DETECTED;
|
30833 | _this.tooltipPositionWithCaret = constants_1.PositionWithCaret.DETECTED;
|
30834 |
|
30835 | _this.minViewportTooltipThreshold = constants_1.numbers.MIN_VIEWPORT_TOOLTIP_THRESHOLD;
|
30836 | _this.hideDelayMs = constants_1.numbers.HIDE_DELAY_MS;
|
30837 | _this.showDelayMs = constants_1.numbers.SHOW_DELAY_MS;
|
30838 | _this.anchorRect = null;
|
30839 | _this.parentRect = null;
|
30840 | _this.frameId = null;
|
30841 | _this.hideTimeout = null;
|
30842 | _this.showTimeout = null;
|
30843 | _this.addAncestorScrollEventListeners = new Array();
|
30844 | _this.removeAncestorScrollEventListeners = new Array();
|
30845 | _this.animFrame = new animationframe_1.AnimationFrame();
|
30846 | _this.anchorBlurHandler = function (evt) {
|
30847 | _this.handleAnchorBlur(evt);
|
30848 | };
|
30849 | _this.documentClickHandler = function (evt) {
|
30850 | _this.handleDocumentClick(evt);
|
30851 | };
|
30852 | _this.documentKeydownHandler = function (evt) {
|
30853 | _this.handleKeydown(evt);
|
30854 | };
|
30855 | _this.tooltipMouseEnterHandler = function () {
|
30856 | _this.handleTooltipMouseEnter();
|
30857 | };
|
30858 | _this.tooltipMouseLeaveHandler = function () {
|
30859 | _this.handleTooltipMouseLeave();
|
30860 | };
|
30861 | _this.richTooltipFocusOutHandler = function (evt) {
|
30862 | _this.handleRichTooltipFocusOut(evt);
|
30863 | };
|
30864 | _this.windowScrollHandler = function () {
|
30865 | _this.handleWindowScrollEvent();
|
30866 | };
|
30867 | _this.windowResizeHandler = function () {
|
30868 | _this.handleWindowChangeEvent();
|
30869 | };
|
30870 | return _this;
|
30871 | }
|
30872 | Object.defineProperty(MDCTooltipFoundation, "defaultAdapter", {
|
30873 | get: function get() {
|
30874 | return {
|
30875 | getAttribute: function getAttribute() {
|
30876 | return null;
|
30877 | },
|
30878 | setAttribute: function setAttribute() {
|
30879 | return undefined;
|
30880 | },
|
30881 | removeAttribute: function removeAttribute() {
|
30882 | return undefined;
|
30883 | },
|
30884 | addClass: function addClass() {
|
30885 | return undefined;
|
30886 | },
|
30887 | hasClass: function hasClass() {
|
30888 | return false;
|
30889 | },
|
30890 | removeClass: function removeClass() {
|
30891 | return undefined;
|
30892 | },
|
30893 | getComputedStyleProperty: function getComputedStyleProperty() {
|
30894 | return '';
|
30895 | },
|
30896 | setStyleProperty: function setStyleProperty() {
|
30897 | return undefined;
|
30898 | },
|
30899 | setSurfaceAnimationStyleProperty: function setSurfaceAnimationStyleProperty() {
|
30900 | return undefined;
|
30901 | },
|
30902 | getViewportWidth: function getViewportWidth() {
|
30903 | return 0;
|
30904 | },
|
30905 | getViewportHeight: function getViewportHeight() {
|
30906 | return 0;
|
30907 | },
|
30908 | getTooltipSize: function getTooltipSize() {
|
30909 | return { width: 0, height: 0 };
|
30910 | },
|
30911 | getAnchorBoundingRect: function getAnchorBoundingRect() {
|
30912 | return { top: 0, right: 0, bottom: 0, left: 0, width: 0, height: 0 };
|
30913 | },
|
30914 | getParentBoundingRect: function getParentBoundingRect() {
|
30915 | return { top: 0, right: 0, bottom: 0, left: 0, width: 0, height: 0 };
|
30916 | },
|
30917 | getAnchorAttribute: function getAnchorAttribute() {
|
30918 | return null;
|
30919 | },
|
30920 | setAnchorAttribute: function setAnchorAttribute() {
|
30921 | return null;
|
30922 | },
|
30923 | isRTL: function isRTL() {
|
30924 | return false;
|
30925 | },
|
30926 | anchorContainsElement: function anchorContainsElement() {
|
30927 | return false;
|
30928 | },
|
30929 | tooltipContainsElement: function tooltipContainsElement() {
|
30930 | return false;
|
30931 | },
|
30932 | focusAnchorElement: function focusAnchorElement() {
|
30933 | return undefined;
|
30934 | },
|
30935 | registerEventHandler: function registerEventHandler() {
|
30936 | return undefined;
|
30937 | },
|
30938 | deregisterEventHandler: function deregisterEventHandler() {
|
30939 | return undefined;
|
30940 | },
|
30941 | registerAnchorEventHandler: function registerAnchorEventHandler() {
|
30942 | return undefined;
|
30943 | },
|
30944 | deregisterAnchorEventHandler: function deregisterAnchorEventHandler() {
|
30945 | return undefined;
|
30946 | },
|
30947 | registerDocumentEventHandler: function registerDocumentEventHandler() {
|
30948 | return undefined;
|
30949 | },
|
30950 | deregisterDocumentEventHandler: function deregisterDocumentEventHandler() {
|
30951 | return undefined;
|
30952 | },
|
30953 | registerWindowEventHandler: function registerWindowEventHandler() {
|
30954 | return undefined;
|
30955 | },
|
30956 | deregisterWindowEventHandler: function deregisterWindowEventHandler() {
|
30957 | return undefined;
|
30958 | },
|
30959 | notifyHidden: function notifyHidden() {
|
30960 | return undefined;
|
30961 | },
|
30962 | getTooltipCaretBoundingRect: function getTooltipCaretBoundingRect() {
|
30963 | return { top: 0, right: 0, bottom: 0, left: 0, width: 0, height: 0 };
|
30964 | },
|
30965 | setTooltipCaretStyle: function setTooltipCaretStyle() {
|
30966 | return undefined;
|
30967 | },
|
30968 | clearTooltipCaretStyles: function clearTooltipCaretStyles() {
|
30969 | return undefined;
|
30970 | },
|
30971 | getActiveElement: function getActiveElement() {
|
30972 | return null;
|
30973 | }
|
30974 | };
|
30975 | },
|
30976 | enumerable: false,
|
30977 | configurable: true
|
30978 | });
|
30979 | MDCTooltipFoundation.prototype.init = function () {
|
30980 | this.richTooltip = this.adapter.hasClass(RICH);
|
30981 | this.persistentTooltip = this.adapter.getAttribute(constants_1.attributes.PERSISTENT) === 'true';
|
30982 | this.interactiveTooltip = !!this.adapter.getAnchorAttribute(constants_1.attributes.ARIA_EXPANDED) && this.adapter.getAnchorAttribute(constants_1.attributes.ARIA_HASPOPUP) === 'dialog';
|
30983 | this.hasCaret = this.richTooltip && this.adapter.getAttribute(constants_1.attributes.HAS_CARET) === 'true';
|
30984 | };
|
30985 | MDCTooltipFoundation.prototype.isShown = function () {
|
30986 | return this.tooltipShown;
|
30987 | };
|
30988 | MDCTooltipFoundation.prototype.isRich = function () {
|
30989 | return this.richTooltip;
|
30990 | };
|
30991 | MDCTooltipFoundation.prototype.isPersistent = function () {
|
30992 | return this.persistentTooltip;
|
30993 | };
|
30994 | MDCTooltipFoundation.prototype.handleAnchorMouseEnter = function () {
|
30995 | var _this = this;
|
30996 | if (this.tooltipShown) {
|
30997 |
|
30998 |
|
30999 |
|
31000 |
|
31001 | this.show();
|
31002 | } else {
|
31003 |
|
31004 |
|
31005 |
|
31006 | this.clearHideTimeout();
|
31007 | this.showTimeout = setTimeout(function () {
|
31008 | _this.show();
|
31009 | }, this.showDelayMs);
|
31010 | }
|
31011 | };
|
31012 | MDCTooltipFoundation.prototype.handleAnchorTouchstart = function () {
|
31013 | var _this = this;
|
31014 | this.showTimeout = setTimeout(function () {
|
31015 | _this.show();
|
31016 | }, this.showDelayMs);
|
31017 |
|
31018 |
|
31019 | this.adapter.registerWindowEventHandler('contextmenu', this.preventContextMenuOnLongTouch);
|
31020 | };
|
31021 | MDCTooltipFoundation.prototype.preventContextMenuOnLongTouch = function (evt) {
|
31022 | evt.preventDefault();
|
31023 | };
|
31024 | MDCTooltipFoundation.prototype.handleAnchorTouchend = function () {
|
31025 | this.clearShowTimeout();
|
31026 |
|
31027 |
|
31028 | if (!this.isShown()) {
|
31029 | this.adapter.deregisterWindowEventHandler('contextmenu', this.preventContextMenuOnLongTouch);
|
31030 | }
|
31031 | };
|
31032 | MDCTooltipFoundation.prototype.handleAnchorFocus = function (evt) {
|
31033 | var _this = this;
|
31034 |
|
31035 |
|
31036 |
|
31037 | var relatedTarget = evt.relatedTarget;
|
31038 | var tooltipContainsRelatedTarget = relatedTarget instanceof HTMLElement && this.adapter.tooltipContainsElement(relatedTarget);
|
31039 |
|
31040 |
|
31041 |
|
31042 | if (tooltipContainsRelatedTarget) {
|
31043 | return;
|
31044 | }
|
31045 | this.showTimeout = setTimeout(function () {
|
31046 | _this.show();
|
31047 | }, this.showDelayMs);
|
31048 | };
|
31049 | MDCTooltipFoundation.prototype.handleAnchorMouseLeave = function () {
|
31050 | var _this = this;
|
31051 | this.clearShowTimeout();
|
31052 | this.hideTimeout = setTimeout(function () {
|
31053 | _this.hide();
|
31054 | }, this.hideDelayMs);
|
31055 | };
|
31056 | MDCTooltipFoundation.prototype.handleAnchorClick = function () {
|
31057 | if (this.tooltipShown) {
|
31058 | this.hide();
|
31059 | } else {
|
31060 | this.show();
|
31061 | }
|
31062 | };
|
31063 | MDCTooltipFoundation.prototype.handleDocumentClick = function (evt) {
|
31064 | var anchorOrTooltipContainsTargetElement = evt.target instanceof HTMLElement && (this.adapter.anchorContainsElement(evt.target) || this.adapter.tooltipContainsElement(evt.target));
|
31065 |
|
31066 |
|
31067 |
|
31068 |
|
31069 |
|
31070 |
|
31071 |
|
31072 | if (this.richTooltip && this.persistentTooltip && anchorOrTooltipContainsTargetElement) {
|
31073 | return;
|
31074 | }
|
31075 |
|
31076 | this.hide();
|
31077 | };
|
31078 | MDCTooltipFoundation.prototype.handleKeydown = function (evt) {
|
31079 |
|
31080 | var key = keyboard_1.normalizeKey(evt);
|
31081 | if (key === keyboard_1.KEY.ESCAPE) {
|
31082 | var activeElement = this.adapter.getActiveElement();
|
31083 | var tooltipContainsActiveElement = activeElement instanceof HTMLElement && this.adapter.tooltipContainsElement(activeElement);
|
31084 | if (tooltipContainsActiveElement) {
|
31085 | this.adapter.focusAnchorElement();
|
31086 | }
|
31087 | this.hide();
|
31088 | }
|
31089 | };
|
31090 | MDCTooltipFoundation.prototype.handleAnchorBlur = function (evt) {
|
31091 | if (this.richTooltip) {
|
31092 | var tooltipContainsRelatedTargetElement = evt.relatedTarget instanceof HTMLElement && this.adapter.tooltipContainsElement(evt.relatedTarget);
|
31093 |
|
31094 | if (tooltipContainsRelatedTargetElement) {
|
31095 | return;
|
31096 | }
|
31097 | if (evt.relatedTarget === null && this.interactiveTooltip) {
|
31098 |
|
31099 |
|
31100 |
|
31101 |
|
31102 |
|
31103 |
|
31104 |
|
31105 | return;
|
31106 | }
|
31107 | }
|
31108 |
|
31109 | this.hide();
|
31110 | };
|
31111 | MDCTooltipFoundation.prototype.handleTooltipMouseEnter = function () {
|
31112 | this.show();
|
31113 | };
|
31114 | MDCTooltipFoundation.prototype.handleTooltipMouseLeave = function () {
|
31115 | var _this = this;
|
31116 | this.clearShowTimeout();
|
31117 | this.hideTimeout = setTimeout(function () {
|
31118 | _this.hide();
|
31119 | }, this.hideDelayMs);
|
31120 | };
|
31121 | MDCTooltipFoundation.prototype.handleRichTooltipFocusOut = function (evt) {
|
31122 | var anchorOrTooltipContainsRelatedTargetElement = evt.relatedTarget instanceof HTMLElement && (this.adapter.anchorContainsElement(evt.relatedTarget) || this.adapter.tooltipContainsElement(evt.relatedTarget));
|
31123 |
|
31124 |
|
31125 | if (anchorOrTooltipContainsRelatedTargetElement) {
|
31126 | return;
|
31127 | }
|
31128 | if (evt.relatedTarget === null && this.interactiveTooltip) {
|
31129 |
|
31130 |
|
31131 |
|
31132 |
|
31133 |
|
31134 |
|
31135 |
|
31136 | return;
|
31137 | }
|
31138 | this.hide();
|
31139 | };
|
31140 | MDCTooltipFoundation.prototype.handleWindowScrollEvent = function () {
|
31141 | if (this.persistentTooltip) {
|
31142 |
|
31143 |
|
31144 |
|
31145 | this.handleWindowChangeEvent();
|
31146 | return;
|
31147 | }
|
31148 | this.hide();
|
31149 | };
|
31150 | |
31151 |
|
31152 |
|
31153 |
|
31154 | MDCTooltipFoundation.prototype.handleWindowChangeEvent = function () {
|
31155 | var _this = this;
|
31156 |
|
31157 |
|
31158 |
|
31159 | this.animFrame.request(AnimationKeys.POLL_ANCHOR, function () {
|
31160 | _this.repositionTooltipOnAnchorMove();
|
31161 | });
|
31162 | };
|
31163 | MDCTooltipFoundation.prototype.show = function () {
|
31164 | var e_1, _a;
|
31165 | var _this = this;
|
31166 | this.clearHideTimeout();
|
31167 | this.clearShowTimeout();
|
31168 | if (this.tooltipShown) {
|
31169 | return;
|
31170 | }
|
31171 | this.tooltipShown = true;
|
31172 | this.adapter.removeAttribute('aria-hidden');
|
31173 | if (this.richTooltip) {
|
31174 | if (this.interactiveTooltip) {
|
31175 | this.adapter.setAnchorAttribute('aria-expanded', 'true');
|
31176 | }
|
31177 | this.adapter.registerEventHandler('focusout', this.richTooltipFocusOutHandler);
|
31178 | }
|
31179 | if (!this.persistentTooltip) {
|
31180 | this.adapter.registerEventHandler('mouseenter', this.tooltipMouseEnterHandler);
|
31181 | this.adapter.registerEventHandler('mouseleave', this.tooltipMouseLeaveHandler);
|
31182 | }
|
31183 | this.adapter.removeClass(HIDE);
|
31184 | this.adapter.addClass(SHOWING);
|
31185 | if (this.isTooltipMultiline() && !this.richTooltip) {
|
31186 | this.adapter.addClass(MULTILINE_TOOLTIP);
|
31187 | }
|
31188 | this.anchorRect = this.adapter.getAnchorBoundingRect();
|
31189 | this.parentRect = this.adapter.getParentBoundingRect();
|
31190 | this.richTooltip ? this.positionRichTooltip() : this.positionPlainTooltip();
|
31191 | this.adapter.registerAnchorEventHandler('blur', this.anchorBlurHandler);
|
31192 | this.adapter.registerDocumentEventHandler('click', this.documentClickHandler);
|
31193 | this.adapter.registerDocumentEventHandler('keydown', this.documentKeydownHandler);
|
31194 | this.adapter.registerWindowEventHandler('scroll', this.windowScrollHandler);
|
31195 | this.adapter.registerWindowEventHandler('resize', this.windowResizeHandler);
|
31196 | try {
|
31197 |
|
31198 | for (var _b = __values(this.addAncestorScrollEventListeners), _c = _b.next(); !_c.done; _c = _b.next()) {
|
31199 | var fn = _c.value;
|
31200 | fn();
|
31201 | }
|
31202 | } catch (e_1_1) {
|
31203 | e_1 = { error: e_1_1 };
|
31204 | } finally {
|
31205 | try {
|
31206 | if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
31207 | } finally {
|
31208 | if (e_1) throw e_1.error;
|
31209 | }
|
31210 | }
|
31211 | this.frameId = requestAnimationFrame(function () {
|
31212 | _this.clearAllAnimationClasses();
|
31213 | _this.adapter.addClass(SHOWN);
|
31214 | _this.adapter.addClass(SHOWING_TRANSITION);
|
31215 | });
|
31216 | };
|
31217 | MDCTooltipFoundation.prototype.hide = function () {
|
31218 | var e_2, _a;
|
31219 | this.clearHideTimeout();
|
31220 | this.clearShowTimeout();
|
31221 | if (!this.tooltipShown) {
|
31222 | return;
|
31223 | }
|
31224 | if (this.frameId) {
|
31225 | cancelAnimationFrame(this.frameId);
|
31226 | }
|
31227 | this.tooltipShown = false;
|
31228 | this.adapter.setAttribute('aria-hidden', 'true');
|
31229 | this.adapter.deregisterEventHandler('focusout', this.richTooltipFocusOutHandler);
|
31230 | if (this.richTooltip) {
|
31231 | if (this.interactiveTooltip) {
|
31232 | this.adapter.setAnchorAttribute('aria-expanded', 'false');
|
31233 | }
|
31234 | }
|
31235 | if (!this.persistentTooltip) {
|
31236 | this.adapter.deregisterEventHandler('mouseenter', this.tooltipMouseEnterHandler);
|
31237 | this.adapter.deregisterEventHandler('mouseleave', this.tooltipMouseLeaveHandler);
|
31238 | }
|
31239 | this.clearAllAnimationClasses();
|
31240 | this.adapter.addClass(HIDE);
|
31241 | this.adapter.addClass(HIDE_TRANSITION);
|
31242 | this.adapter.removeClass(SHOWN);
|
31243 | this.adapter.deregisterAnchorEventHandler('blur', this.anchorBlurHandler);
|
31244 | this.adapter.deregisterDocumentEventHandler('click', this.documentClickHandler);
|
31245 | this.adapter.deregisterDocumentEventHandler('keydown', this.documentKeydownHandler);
|
31246 | this.adapter.deregisterWindowEventHandler('scroll', this.windowScrollHandler);
|
31247 | this.adapter.deregisterWindowEventHandler('resize', this.windowResizeHandler);
|
31248 | this.adapter.deregisterWindowEventHandler('contextmenu', this.preventContextMenuOnLongTouch);
|
31249 | try {
|
31250 |
|
31251 | for (var _b = __values(this.removeAncestorScrollEventListeners), _c = _b.next(); !_c.done; _c = _b.next()) {
|
31252 | var fn = _c.value;
|
31253 | fn();
|
31254 | }
|
31255 | } catch (e_2_1) {
|
31256 | e_2 = { error: e_2_1 };
|
31257 | } finally {
|
31258 | try {
|
31259 | if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
31260 | } finally {
|
31261 | if (e_2) throw e_2.error;
|
31262 | }
|
31263 | }
|
31264 | };
|
31265 | MDCTooltipFoundation.prototype.handleTransitionEnd = function () {
|
31266 | var isHidingTooltip = this.adapter.hasClass(HIDE);
|
31267 | this.adapter.removeClass(SHOWING);
|
31268 | this.adapter.removeClass(SHOWING_TRANSITION);
|
31269 | this.adapter.removeClass(HIDE);
|
31270 | this.adapter.removeClass(HIDE_TRANSITION);
|
31271 |
|
31272 |
|
31273 |
|
31274 |
|
31275 | if (isHidingTooltip) {
|
31276 | this.adapter.notifyHidden();
|
31277 | }
|
31278 | };
|
31279 | MDCTooltipFoundation.prototype.clearAllAnimationClasses = function () {
|
31280 | this.adapter.removeClass(SHOWING_TRANSITION);
|
31281 | this.adapter.removeClass(HIDE_TRANSITION);
|
31282 | };
|
31283 | MDCTooltipFoundation.prototype.setTooltipPosition = function (position) {
|
31284 | var xPos = position.xPos,
|
31285 | yPos = position.yPos,
|
31286 | withCaretPos = position.withCaretPos;
|
31287 | if (this.hasCaret && withCaretPos) {
|
31288 | this.tooltipPositionWithCaret = withCaretPos;
|
31289 | return;
|
31290 | }
|
31291 | if (xPos) {
|
31292 | this.xTooltipPos = xPos;
|
31293 | }
|
31294 | if (yPos) {
|
31295 | this.yTooltipPos = yPos;
|
31296 | }
|
31297 | };
|
31298 | MDCTooltipFoundation.prototype.setAnchorBoundaryType = function (type) {
|
31299 | if (type === constants_1.AnchorBoundaryType.UNBOUNDED) {
|
31300 | this.anchorGap = constants_1.numbers.UNBOUNDED_ANCHOR_GAP;
|
31301 | } else {
|
31302 | this.anchorGap = constants_1.numbers.BOUNDED_ANCHOR_GAP;
|
31303 | }
|
31304 | };
|
31305 | MDCTooltipFoundation.prototype.setShowDelay = function (delayMs) {
|
31306 | this.showDelayMs = delayMs;
|
31307 | };
|
31308 | MDCTooltipFoundation.prototype.setHideDelay = function (delayMs) {
|
31309 | this.hideDelayMs = delayMs;
|
31310 | };
|
31311 | MDCTooltipFoundation.prototype.isTooltipMultiline = function () {
|
31312 | var tooltipSize = this.adapter.getTooltipSize();
|
31313 | return tooltipSize.height > constants_1.numbers.MIN_HEIGHT && tooltipSize.width >= constants_1.numbers.MAX_WIDTH;
|
31314 | };
|
31315 | MDCTooltipFoundation.prototype.positionPlainTooltip = function () {
|
31316 |
|
31317 |
|
31318 |
|
31319 | var _a = this.calculateTooltipStyles(this.anchorRect),
|
31320 | top = _a.top,
|
31321 | yTransformOrigin = _a.yTransformOrigin,
|
31322 | left = _a.left,
|
31323 | xTransformOrigin = _a.xTransformOrigin;
|
31324 | var transformProperty = HAS_WINDOW ? util_1.getCorrectPropertyName(window, 'transform') : 'transform';
|
31325 | this.adapter.setSurfaceAnimationStyleProperty(transformProperty + "-origin", xTransformOrigin + " " + yTransformOrigin);
|
31326 | this.adapter.setStyleProperty('top', top + "px");
|
31327 | this.adapter.setStyleProperty('left', left + "px");
|
31328 | };
|
31329 | MDCTooltipFoundation.prototype.positionRichTooltip = function () {
|
31330 |
|
31331 |
|
31332 | var _a, _b, _c, _d;
|
31333 |
|
31334 |
|
31335 |
|
31336 |
|
31337 | var width = this.adapter.getComputedStyleProperty('width');
|
31338 |
|
31339 |
|
31340 |
|
31341 | this.adapter.setStyleProperty('width', width);
|
31342 | var _e = this.hasCaret ? this.calculateTooltipWithCaretStyles(this.anchorRect) : this.calculateTooltipStyles(this.anchorRect),
|
31343 | top = _e.top,
|
31344 | yTransformOrigin = _e.yTransformOrigin,
|
31345 | left = _e.left,
|
31346 | xTransformOrigin = _e.xTransformOrigin;
|
31347 | var transformProperty = HAS_WINDOW ? util_1.getCorrectPropertyName(window, 'transform') : 'transform';
|
31348 | this.adapter.setSurfaceAnimationStyleProperty(transformProperty + "-origin", xTransformOrigin + " " + yTransformOrigin);
|
31349 |
|
31350 |
|
31351 |
|
31352 |
|
31353 | var leftAdjustment = left - ((_b = (_a = this.parentRect) === null || _a === void 0 ? void 0 : _a.left) !== null && _b !== void 0 ? _b : 0);
|
31354 | var topAdjustment = top - ((_d = (_c = this.parentRect) === null || _c === void 0 ? void 0 : _c.top) !== null && _d !== void 0 ? _d : 0);
|
31355 | this.adapter.setStyleProperty('top', topAdjustment + "px");
|
31356 | this.adapter.setStyleProperty('left', leftAdjustment + "px");
|
31357 | };
|
31358 | |
31359 |
|
31360 |
|
31361 |
|
31362 |
|
31363 |
|
31364 |
|
31365 |
|
31366 |
|
31367 |
|
31368 |
|
31369 |
|
31370 |
|
31371 |
|
31372 | MDCTooltipFoundation.prototype.calculateTooltipStyles = function (anchorRect) {
|
31373 | if (!anchorRect) {
|
31374 | return { top: 0, left: 0 };
|
31375 | }
|
31376 | var tooltipSize = this.adapter.getTooltipSize();
|
31377 | var top = this.calculateYTooltipDistance(anchorRect, tooltipSize.height);
|
31378 | var left = this.calculateXTooltipDistance(anchorRect, tooltipSize.width);
|
31379 | return {
|
31380 | top: top.distance,
|
31381 | yTransformOrigin: top.yTransformOrigin,
|
31382 | left: left.distance,
|
31383 | xTransformOrigin: left.xTransformOrigin
|
31384 | };
|
31385 | };
|
31386 | |
31387 |
|
31388 |
|
31389 |
|
31390 |
|
31391 | MDCTooltipFoundation.prototype.calculateXTooltipDistance = function (anchorRect, tooltipWidth) {
|
31392 | var isLTR = !this.adapter.isRTL();
|
31393 | var startPos, endPos, centerPos;
|
31394 | var startTransformOrigin, endTransformOrigin;
|
31395 | if (this.richTooltip) {
|
31396 | startPos = isLTR ? anchorRect.left - tooltipWidth : anchorRect.right;
|
31397 | endPos = isLTR ? anchorRect.right : anchorRect.left - tooltipWidth;
|
31398 | startTransformOrigin = isLTR ? constants_1.strings.RIGHT : constants_1.strings.LEFT;
|
31399 | endTransformOrigin = isLTR ? constants_1.strings.LEFT : constants_1.strings.RIGHT;
|
31400 | } else {
|
31401 | startPos = isLTR ? anchorRect.left : anchorRect.right - tooltipWidth;
|
31402 | endPos = isLTR ? anchorRect.right - tooltipWidth : anchorRect.left;
|
31403 | centerPos = anchorRect.left + (anchorRect.width - tooltipWidth) / 2;
|
31404 | startTransformOrigin = isLTR ? constants_1.strings.LEFT : constants_1.strings.RIGHT;
|
31405 | endTransformOrigin = isLTR ? constants_1.strings.RIGHT : constants_1.strings.LEFT;
|
31406 | }
|
31407 | var positionOptions = this.richTooltip ? this.determineValidPositionOptions(startPos, endPos) :
|
31408 |
|
31409 | this.determineValidPositionOptions(centerPos, startPos, endPos);
|
31410 | if (this.xTooltipPos === constants_1.XPosition.START && positionOptions.has(startPos)) {
|
31411 | return { distance: startPos, xTransformOrigin: startTransformOrigin };
|
31412 | }
|
31413 | if (this.xTooltipPos === constants_1.XPosition.END && positionOptions.has(endPos)) {
|
31414 | return { distance: endPos, xTransformOrigin: endTransformOrigin };
|
31415 | }
|
31416 | if (this.xTooltipPos === constants_1.XPosition.CENTER && positionOptions.has(centerPos)) {
|
31417 |
|
31418 |
|
31419 |
|
31420 | return { distance: centerPos, xTransformOrigin: constants_1.strings.CENTER };
|
31421 | }
|
31422 |
|
31423 |
|
31424 | var possiblePositions = this.richTooltip ? [{ distance: endPos, xTransformOrigin: endTransformOrigin }, { distance: startPos, xTransformOrigin: startTransformOrigin }] : [{ distance: centerPos, xTransformOrigin: constants_1.strings.CENTER }, { distance: startPos, xTransformOrigin: startTransformOrigin }, { distance: endPos, xTransformOrigin: endTransformOrigin }];
|
31425 | var validPosition = possiblePositions.find(function (_a) {
|
31426 | var distance = _a.distance;
|
31427 | return positionOptions.has(distance);
|
31428 | });
|
31429 | if (validPosition) {
|
31430 | return validPosition;
|
31431 | }
|
31432 |
|
31433 |
|
31434 |
|
31435 |
|
31436 |
|
31437 | if (anchorRect.left < 0) {
|
31438 | return {
|
31439 | distance: this.minViewportTooltipThreshold,
|
31440 | xTransformOrigin: constants_1.strings.LEFT
|
31441 | };
|
31442 | } else {
|
31443 | var viewportWidth = this.adapter.getViewportWidth();
|
31444 | var distance = viewportWidth - (tooltipWidth + this.minViewportTooltipThreshold);
|
31445 | return { distance: distance, xTransformOrigin: constants_1.strings.RIGHT };
|
31446 | }
|
31447 | };
|
31448 | |
31449 |
|
31450 |
|
31451 |
|
31452 |
|
31453 |
|
31454 |
|
31455 |
|
31456 |
|
31457 |
|
31458 |
|
31459 | MDCTooltipFoundation.prototype.determineValidPositionOptions = function () {
|
31460 | var e_3, _a;
|
31461 | var positions = [];
|
31462 | for (var _i = 0; _i < arguments.length; _i++) {
|
31463 | positions[_i] = arguments[_i];
|
31464 | }
|
31465 | var posWithinThreshold = new Set();
|
31466 | var posWithinViewport = new Set();
|
31467 | try {
|
31468 | for (var positions_1 = __values(positions), positions_1_1 = positions_1.next(); !positions_1_1.done; positions_1_1 = positions_1.next()) {
|
31469 | var position = positions_1_1.value;
|
31470 | if (this.positionHonorsViewportThreshold(position)) {
|
31471 | posWithinThreshold.add(position);
|
31472 | } else if (this.positionDoesntCollideWithViewport(position)) {
|
31473 | posWithinViewport.add(position);
|
31474 | }
|
31475 | }
|
31476 | } catch (e_3_1) {
|
31477 | e_3 = { error: e_3_1 };
|
31478 | } finally {
|
31479 | try {
|
31480 | if (positions_1_1 && !positions_1_1.done && (_a = positions_1.return)) _a.call(positions_1);
|
31481 | } finally {
|
31482 | if (e_3) throw e_3.error;
|
31483 | }
|
31484 | }
|
31485 | return posWithinThreshold.size ? posWithinThreshold : posWithinViewport;
|
31486 | };
|
31487 | MDCTooltipFoundation.prototype.positionHonorsViewportThreshold = function (leftPos) {
|
31488 | var viewportWidth = this.adapter.getViewportWidth();
|
31489 | var tooltipWidth = this.adapter.getTooltipSize().width;
|
31490 | return leftPos + tooltipWidth <= viewportWidth - this.minViewportTooltipThreshold && leftPos >= this.minViewportTooltipThreshold;
|
31491 | };
|
31492 | MDCTooltipFoundation.prototype.positionDoesntCollideWithViewport = function (leftPos) {
|
31493 | var viewportWidth = this.adapter.getViewportWidth();
|
31494 | var tooltipWidth = this.adapter.getTooltipSize().width;
|
31495 | return leftPos + tooltipWidth <= viewportWidth && leftPos >= 0;
|
31496 | };
|
31497 | |
31498 |
|
31499 |
|
31500 |
|
31501 |
|
31502 | MDCTooltipFoundation.prototype.calculateYTooltipDistance = function (anchorRect, tooltipHeight) {
|
31503 | var belowYPos = anchorRect.bottom + this.anchorGap;
|
31504 | var aboveYPos = anchorRect.top - (this.anchorGap + tooltipHeight);
|
31505 | var yPositionOptions = this.determineValidYPositionOptions(aboveYPos, belowYPos);
|
31506 | if (this.yTooltipPos === constants_1.YPosition.ABOVE && yPositionOptions.has(aboveYPos)) {
|
31507 | return { distance: aboveYPos, yTransformOrigin: constants_1.strings.BOTTOM };
|
31508 | } else if (this.yTooltipPos === constants_1.YPosition.BELOW && yPositionOptions.has(belowYPos)) {
|
31509 | return { distance: belowYPos, yTransformOrigin: constants_1.strings.TOP };
|
31510 | }
|
31511 | if (yPositionOptions.has(belowYPos)) {
|
31512 | return { distance: belowYPos, yTransformOrigin: constants_1.strings.TOP };
|
31513 | }
|
31514 | if (yPositionOptions.has(aboveYPos)) {
|
31515 | return { distance: aboveYPos, yTransformOrigin: constants_1.strings.BOTTOM };
|
31516 | }
|
31517 |
|
31518 |
|
31519 |
|
31520 | return { distance: belowYPos, yTransformOrigin: constants_1.strings.TOP };
|
31521 | };
|
31522 | |
31523 |
|
31524 |
|
31525 |
|
31526 |
|
31527 |
|
31528 |
|
31529 |
|
31530 |
|
31531 |
|
31532 |
|
31533 | MDCTooltipFoundation.prototype.determineValidYPositionOptions = function (aboveAnchorPos, belowAnchorPos) {
|
31534 | var posWithinThreshold = new Set();
|
31535 | var posWithinViewport = new Set();
|
31536 | if (this.yPositionHonorsViewportThreshold(aboveAnchorPos)) {
|
31537 | posWithinThreshold.add(aboveAnchorPos);
|
31538 | } else if (this.yPositionDoesntCollideWithViewport(aboveAnchorPos)) {
|
31539 | posWithinViewport.add(aboveAnchorPos);
|
31540 | }
|
31541 | if (this.yPositionHonorsViewportThreshold(belowAnchorPos)) {
|
31542 | posWithinThreshold.add(belowAnchorPos);
|
31543 | } else if (this.yPositionDoesntCollideWithViewport(belowAnchorPos)) {
|
31544 | posWithinViewport.add(belowAnchorPos);
|
31545 | }
|
31546 | return posWithinThreshold.size ? posWithinThreshold : posWithinViewport;
|
31547 | };
|
31548 | MDCTooltipFoundation.prototype.yPositionHonorsViewportThreshold = function (yPos) {
|
31549 | var viewportHeight = this.adapter.getViewportHeight();
|
31550 | var tooltipHeight = this.adapter.getTooltipSize().height;
|
31551 | return yPos + tooltipHeight + this.minViewportTooltipThreshold <= viewportHeight && yPos >= this.minViewportTooltipThreshold;
|
31552 | };
|
31553 | MDCTooltipFoundation.prototype.yPositionDoesntCollideWithViewport = function (yPos) {
|
31554 | var viewportHeight = this.adapter.getViewportHeight();
|
31555 | var tooltipHeight = this.adapter.getTooltipSize().height;
|
31556 | return yPos + tooltipHeight <= viewportHeight && yPos >= 0;
|
31557 | };
|
31558 | MDCTooltipFoundation.prototype.calculateTooltipWithCaretStyles = function (anchorRect) {
|
31559 |
|
31560 |
|
31561 |
|
31562 |
|
31563 | this.adapter.clearTooltipCaretStyles();
|
31564 | var caretSize = this.adapter.getTooltipCaretBoundingRect();
|
31565 | if (!anchorRect || !caretSize) {
|
31566 | return { position: constants_1.PositionWithCaret.DETECTED, top: 0, left: 0 };
|
31567 | }
|
31568 |
|
31569 |
|
31570 |
|
31571 |
|
31572 |
|
31573 |
|
31574 |
|
31575 | var caretWidth = caretSize.width / constants_1.numbers.ANIMATION_SCALE;
|
31576 |
|
31577 |
|
31578 | var caretHeight = caretSize.height / constants_1.numbers.ANIMATION_SCALE / 2;
|
31579 | var tooltipSize = this.adapter.getTooltipSize();
|
31580 | var yOptions = this.calculateYWithCaretDistanceOptions(anchorRect, tooltipSize.height, { caretWidth: caretWidth, caretHeight: caretHeight });
|
31581 | var xOptions = this.calculateXWithCaretDistanceOptions(anchorRect, tooltipSize.width, { caretWidth: caretWidth, caretHeight: caretHeight });
|
31582 | var positionOptions = this.validateTooltipWithCaretDistances(yOptions, xOptions);
|
31583 | if (positionOptions.size < 1) {
|
31584 | positionOptions = this.generateBackupPositionOption(anchorRect, tooltipSize, { caretWidth: caretWidth, caretHeight: caretHeight });
|
31585 | }
|
31586 | var _a = this.determineTooltipWithCaretDistance(positionOptions),
|
31587 | position = _a.position,
|
31588 | xDistance = _a.xDistance,
|
31589 | yDistance = _a.yDistance;
|
31590 |
|
31591 |
|
31592 |
|
31593 | var _b = this.setCaretPositionStyles(position, { caretWidth: caretWidth, caretHeight: caretHeight }),
|
31594 | yTransformOrigin = _b.yTransformOrigin,
|
31595 | xTransformOrigin = _b.xTransformOrigin;
|
31596 | return {
|
31597 | yTransformOrigin: yTransformOrigin,
|
31598 | xTransformOrigin: xTransformOrigin,
|
31599 | top: yDistance,
|
31600 | left: xDistance
|
31601 | };
|
31602 | };
|
31603 | MDCTooltipFoundation.prototype.calculateXWithCaretDistanceOptions = function (anchorRect, tooltipWidth, caretSize) {
|
31604 | var caretWidth = caretSize.caretWidth,
|
31605 | caretHeight = caretSize.caretHeight;
|
31606 | var isLTR = !this.adapter.isRTL();
|
31607 | var anchorMidpoint = anchorRect.left + anchorRect.width / 2;
|
31608 | var sideLeftAligned = anchorRect.left - (tooltipWidth + this.anchorGap + caretHeight);
|
31609 | var sideRightAligned = anchorRect.right + this.anchorGap + caretHeight;
|
31610 | var sideStartPos = isLTR ? sideLeftAligned : sideRightAligned;
|
31611 | var sideEndPos = isLTR ? sideRightAligned : sideLeftAligned;
|
31612 | var verticalLeftAligned = anchorMidpoint - (constants_1.numbers.CARET_INDENTATION + caretWidth / 2);
|
31613 | var verticalRightAligned = anchorMidpoint - (tooltipWidth - constants_1.numbers.CARET_INDENTATION - caretWidth / 2);
|
31614 | var verticalStartPos = isLTR ? verticalLeftAligned : verticalRightAligned;
|
31615 | var verticalEndPos = isLTR ? verticalRightAligned : verticalLeftAligned;
|
31616 | var verticalCenterPos = anchorMidpoint - tooltipWidth / 2;
|
31617 | var possiblePositionsMap = new Map([[constants_1.XPositionWithCaret.START, verticalStartPos], [constants_1.XPositionWithCaret.CENTER, verticalCenterPos], [constants_1.XPositionWithCaret.END, verticalEndPos], [constants_1.XPositionWithCaret.SIDE_END, sideEndPos], [constants_1.XPositionWithCaret.SIDE_START, sideStartPos]]);
|
31618 | return possiblePositionsMap;
|
31619 | };
|
31620 | MDCTooltipFoundation.prototype.calculateYWithCaretDistanceOptions = function (anchorRect, tooltipHeight, caretSize) {
|
31621 | var caretWidth = caretSize.caretWidth,
|
31622 | caretHeight = caretSize.caretHeight;
|
31623 | var anchorMidpoint = anchorRect.top + anchorRect.height / 2;
|
31624 | var belowYPos = anchorRect.bottom + this.anchorGap + caretHeight;
|
31625 | var aboveYPos = anchorRect.top - (this.anchorGap + tooltipHeight + caretHeight);
|
31626 | var sideTopYPos = anchorMidpoint - (constants_1.numbers.CARET_INDENTATION + caretWidth / 2);
|
31627 | var sideCenterYPos = anchorMidpoint - tooltipHeight / 2;
|
31628 | var sideBottomYPos = anchorMidpoint - (tooltipHeight - constants_1.numbers.CARET_INDENTATION - caretWidth / 2);
|
31629 | var possiblePositionsMap = new Map([[constants_1.YPositionWithCaret.ABOVE, aboveYPos], [constants_1.YPositionWithCaret.BELOW, belowYPos], [constants_1.YPositionWithCaret.SIDE_TOP, sideTopYPos], [constants_1.YPositionWithCaret.SIDE_CENTER, sideCenterYPos], [constants_1.YPositionWithCaret.SIDE_BOTTOM, sideBottomYPos]]);
|
31630 | return possiblePositionsMap;
|
31631 | };
|
31632 | MDCTooltipFoundation.prototype.repositionTooltipOnAnchorMove = function () {
|
31633 | var newAnchorRect = this.adapter.getAnchorBoundingRect();
|
31634 | if (!newAnchorRect || !this.anchorRect) return;
|
31635 | if (newAnchorRect.top !== this.anchorRect.top || newAnchorRect.left !== this.anchorRect.left || newAnchorRect.height !== this.anchorRect.height || newAnchorRect.width !== this.anchorRect.width) {
|
31636 | this.anchorRect = newAnchorRect;
|
31637 | this.parentRect = this.adapter.getParentBoundingRect();
|
31638 | this.richTooltip ? this.positionRichTooltip() : this.positionPlainTooltip();
|
31639 | }
|
31640 | };
|
31641 | |
31642 |
|
31643 |
|
31644 |
|
31645 |
|
31646 |
|
31647 |
|
31648 | MDCTooltipFoundation.prototype.validateTooltipWithCaretDistances = function (yOptions, xOptions) {
|
31649 | var e_4, _a, e_5, _b, e_6, _c;
|
31650 | var posWithinThreshold = new Map();
|
31651 | var posWithinViewport = new Map();
|
31652 |
|
31653 |
|
31654 |
|
31655 |
|
31656 | var validMappings = new Map([[constants_1.YPositionWithCaret.ABOVE, [constants_1.XPositionWithCaret.START, constants_1.XPositionWithCaret.CENTER, constants_1.XPositionWithCaret.END]], [constants_1.YPositionWithCaret.BELOW, [constants_1.XPositionWithCaret.START, constants_1.XPositionWithCaret.CENTER, constants_1.XPositionWithCaret.END]], [constants_1.YPositionWithCaret.SIDE_TOP, [constants_1.XPositionWithCaret.SIDE_START, constants_1.XPositionWithCaret.SIDE_END]], [constants_1.YPositionWithCaret.SIDE_CENTER, [constants_1.XPositionWithCaret.SIDE_START, constants_1.XPositionWithCaret.SIDE_END]], [constants_1.YPositionWithCaret.SIDE_BOTTOM, [constants_1.XPositionWithCaret.SIDE_START, constants_1.XPositionWithCaret.SIDE_END]]]);
|
31657 | try {
|
31658 | for (var _d = __values(validMappings.keys()), _e = _d.next(); !_e.done; _e = _d.next()) {
|
31659 | var y = _e.value;
|
31660 | var yDistance = yOptions.get(y);
|
31661 | if (this.yPositionHonorsViewportThreshold(yDistance)) {
|
31662 | try {
|
31663 | for (var _f = (e_5 = void 0, __values(validMappings.get(y))), _g = _f.next(); !_g.done; _g = _f.next()) {
|
31664 | var x = _g.value;
|
31665 | var xDistance = xOptions.get(x);
|
31666 | if (this.positionHonorsViewportThreshold(xDistance)) {
|
31667 | var caretPositionName = this.caretPositionOptionsMapping(x, y);
|
31668 | posWithinThreshold.set(caretPositionName, { xDistance: xDistance, yDistance: yDistance });
|
31669 | }
|
31670 | }
|
31671 | } catch (e_5_1) {
|
31672 | e_5 = { error: e_5_1 };
|
31673 | } finally {
|
31674 | try {
|
31675 | if (_g && !_g.done && (_b = _f.return)) _b.call(_f);
|
31676 | } finally {
|
31677 | if (e_5) throw e_5.error;
|
31678 | }
|
31679 | }
|
31680 | } else if (this.yPositionDoesntCollideWithViewport(yDistance)) {
|
31681 | try {
|
31682 | for (var _h = (e_6 = void 0, __values(validMappings.get(y))), _j = _h.next(); !_j.done; _j = _h.next()) {
|
31683 | var x = _j.value;
|
31684 | var xDistance = xOptions.get(x);
|
31685 | if (this.positionDoesntCollideWithViewport(xDistance)) {
|
31686 | var caretPositionName = this.caretPositionOptionsMapping(x, y);
|
31687 | posWithinViewport.set(caretPositionName, { xDistance: xDistance, yDistance: yDistance });
|
31688 | }
|
31689 | }
|
31690 | } catch (e_6_1) {
|
31691 | e_6 = { error: e_6_1 };
|
31692 | } finally {
|
31693 | try {
|
31694 | if (_j && !_j.done && (_c = _h.return)) _c.call(_h);
|
31695 | } finally {
|
31696 | if (e_6) throw e_6.error;
|
31697 | }
|
31698 | }
|
31699 | }
|
31700 | }
|
31701 | } catch (e_4_1) {
|
31702 | e_4 = { error: e_4_1 };
|
31703 | } finally {
|
31704 | try {
|
31705 | if (_e && !_e.done && (_a = _d.return)) _a.call(_d);
|
31706 | } finally {
|
31707 | if (e_4) throw e_4.error;
|
31708 | }
|
31709 | }
|
31710 | return posWithinThreshold.size ? posWithinThreshold : posWithinViewport;
|
31711 | };
|
31712 | |
31713 |
|
31714 |
|
31715 |
|
31716 |
|
31717 | MDCTooltipFoundation.prototype.generateBackupPositionOption = function (anchorRect, tooltipSize, caretSize) {
|
31718 | var isLTR = !this.adapter.isRTL();
|
31719 | var xDistance;
|
31720 | var xPos;
|
31721 | if (anchorRect.left < 0) {
|
31722 | xDistance = this.minViewportTooltipThreshold + caretSize.caretHeight;
|
31723 | xPos = isLTR ? constants_1.XPositionWithCaret.END : constants_1.XPositionWithCaret.START;
|
31724 | } else {
|
31725 | var viewportWidth = this.adapter.getViewportWidth();
|
31726 | xDistance = viewportWidth - (tooltipSize.width + this.minViewportTooltipThreshold + caretSize.caretHeight);
|
31727 | xPos = isLTR ? constants_1.XPositionWithCaret.START : constants_1.XPositionWithCaret.END;
|
31728 | }
|
31729 | var yDistance;
|
31730 | var yPos;
|
31731 | if (anchorRect.top < 0) {
|
31732 | yDistance = this.minViewportTooltipThreshold + caretSize.caretHeight;
|
31733 | yPos = constants_1.YPositionWithCaret.BELOW;
|
31734 | } else {
|
31735 | var viewportHeight = this.adapter.getViewportHeight();
|
31736 | yDistance = viewportHeight - (tooltipSize.height + this.minViewportTooltipThreshold + caretSize.caretHeight);
|
31737 | yPos = constants_1.YPositionWithCaret.ABOVE;
|
31738 | }
|
31739 | var caretPositionName = this.caretPositionOptionsMapping(xPos, yPos);
|
31740 | return new Map([[caretPositionName, { xDistance: xDistance, yDistance: yDistance }]]);
|
31741 | };
|
31742 | |
31743 |
|
31744 |
|
31745 |
|
31746 | MDCTooltipFoundation.prototype.determineTooltipWithCaretDistance = function (options) {
|
31747 | if (options.has(this.tooltipPositionWithCaret)) {
|
31748 | var tooltipPos = options.get(this.tooltipPositionWithCaret);
|
31749 | return {
|
31750 | position: this.tooltipPositionWithCaret,
|
31751 | xDistance: tooltipPos.xDistance,
|
31752 | yDistance: tooltipPos.yDistance
|
31753 | };
|
31754 | }
|
31755 | var orderPref = [constants_1.PositionWithCaret.ABOVE_START, constants_1.PositionWithCaret.ABOVE_CENTER, constants_1.PositionWithCaret.ABOVE_END, constants_1.PositionWithCaret.TOP_SIDE_START, constants_1.PositionWithCaret.CENTER_SIDE_START, constants_1.PositionWithCaret.BOTTOM_SIDE_START, constants_1.PositionWithCaret.TOP_SIDE_END, constants_1.PositionWithCaret.CENTER_SIDE_END, constants_1.PositionWithCaret.BOTTOM_SIDE_END, constants_1.PositionWithCaret.BELOW_START, constants_1.PositionWithCaret.BELOW_CENTER, constants_1.PositionWithCaret.BELOW_END];
|
31756 |
|
31757 |
|
31758 |
|
31759 | var validPosition = orderPref.find(function (pos) {
|
31760 | return options.has(pos);
|
31761 | });
|
31762 | var pos = options.get(validPosition);
|
31763 | return {
|
31764 | position: validPosition,
|
31765 | xDistance: pos.xDistance,
|
31766 | yDistance: pos.yDistance
|
31767 | };
|
31768 | };
|
31769 | |
31770 |
|
31771 |
|
31772 |
|
31773 |
|
31774 |
|
31775 |
|
31776 |
|
31777 | MDCTooltipFoundation.prototype.caretPositionOptionsMapping = function (xPos, yPos) {
|
31778 | switch (yPos) {
|
31779 | case constants_1.YPositionWithCaret.ABOVE:
|
31780 | if (xPos === constants_1.XPositionWithCaret.START) {
|
31781 | return constants_1.PositionWithCaret.ABOVE_START;
|
31782 | } else if (xPos === constants_1.XPositionWithCaret.CENTER) {
|
31783 | return constants_1.PositionWithCaret.ABOVE_CENTER;
|
31784 | } else if (xPos === constants_1.XPositionWithCaret.END) {
|
31785 | return constants_1.PositionWithCaret.ABOVE_END;
|
31786 | }
|
31787 | break;
|
31788 | case constants_1.YPositionWithCaret.BELOW:
|
31789 | if (xPos === constants_1.XPositionWithCaret.START) {
|
31790 | return constants_1.PositionWithCaret.BELOW_START;
|
31791 | } else if (xPos === constants_1.XPositionWithCaret.CENTER) {
|
31792 | return constants_1.PositionWithCaret.BELOW_CENTER;
|
31793 | } else if (xPos === constants_1.XPositionWithCaret.END) {
|
31794 | return constants_1.PositionWithCaret.BELOW_END;
|
31795 | }
|
31796 | break;
|
31797 | case constants_1.YPositionWithCaret.SIDE_TOP:
|
31798 | if (xPos === constants_1.XPositionWithCaret.SIDE_START) {
|
31799 | return constants_1.PositionWithCaret.TOP_SIDE_START;
|
31800 | } else if (xPos === constants_1.XPositionWithCaret.SIDE_END) {
|
31801 | return constants_1.PositionWithCaret.TOP_SIDE_END;
|
31802 | }
|
31803 | break;
|
31804 | case constants_1.YPositionWithCaret.SIDE_CENTER:
|
31805 | if (xPos === constants_1.XPositionWithCaret.SIDE_START) {
|
31806 | return constants_1.PositionWithCaret.CENTER_SIDE_START;
|
31807 | } else if (xPos === constants_1.XPositionWithCaret.SIDE_END) {
|
31808 | return constants_1.PositionWithCaret.CENTER_SIDE_END;
|
31809 | }
|
31810 | break;
|
31811 | case constants_1.YPositionWithCaret.SIDE_BOTTOM:
|
31812 | if (xPos === constants_1.XPositionWithCaret.SIDE_START) {
|
31813 | return constants_1.PositionWithCaret.BOTTOM_SIDE_START;
|
31814 | } else if (xPos === constants_1.XPositionWithCaret.SIDE_END) {
|
31815 | return constants_1.PositionWithCaret.BOTTOM_SIDE_END;
|
31816 | }
|
31817 | break;
|
31818 | default:
|
31819 | break;
|
31820 | }
|
31821 | throw new Error("MDCTooltipFoundation: Invalid caret position of " + xPos + ", " + yPos);
|
31822 | };
|
31823 | |
31824 |
|
31825 |
|
31826 |
|
31827 |
|
31828 |
|
31829 | MDCTooltipFoundation.prototype.setCaretPositionStyles = function (position, caretSize) {
|
31830 | var e_7, _a;
|
31831 | var values = this.calculateCaretPositionOnTooltip(position, caretSize);
|
31832 | if (!values) {
|
31833 | return { yTransformOrigin: 0, xTransformOrigin: 0 };
|
31834 | }
|
31835 |
|
31836 |
|
31837 |
|
31838 |
|
31839 | this.adapter.clearTooltipCaretStyles();
|
31840 | this.adapter.setTooltipCaretStyle(values.yAlignment, values.yAxisPx);
|
31841 | this.adapter.setTooltipCaretStyle(values.xAlignment, values.xAxisPx);
|
31842 |
|
31843 |
|
31844 | var skewRadians = values.skew * (Math.PI / 180);
|
31845 | var scaleX = Math.cos(skewRadians);
|
31846 | this.adapter.setTooltipCaretStyle('transform', "rotate(" + values.rotation + "deg) skewY(" + values.skew + "deg) scaleX(" + scaleX + ")");
|
31847 | this.adapter.setTooltipCaretStyle('transform-origin', values.xAlignment + " " + values.yAlignment);
|
31848 | try {
|
31849 | for (var _b = __values(values.caretCorners), _c = _b.next(); !_c.done; _c = _b.next()) {
|
31850 | var corner = _c.value;
|
31851 | this.adapter.setTooltipCaretStyle(corner, '0');
|
31852 | }
|
31853 | } catch (e_7_1) {
|
31854 | e_7 = { error: e_7_1 };
|
31855 | } finally {
|
31856 | try {
|
31857 | if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
31858 | } finally {
|
31859 | if (e_7) throw e_7.error;
|
31860 | }
|
31861 | }
|
31862 | return {
|
31863 | yTransformOrigin: values.yTransformOrigin,
|
31864 | xTransformOrigin: values.xTransformOrigin
|
31865 | };
|
31866 | };
|
31867 | |
31868 |
|
31869 |
|
31870 |
|
31871 | MDCTooltipFoundation.prototype.calculateCaretPositionOnTooltip = function (tooltipPos, caretSize) {
|
31872 | var isLTR = !this.adapter.isRTL();
|
31873 | var tooltipWidth = this.adapter.getComputedStyleProperty('width');
|
31874 | var tooltipHeight = this.adapter.getComputedStyleProperty('height');
|
31875 | if (!tooltipWidth || !tooltipHeight || !caretSize) {
|
31876 | return;
|
31877 | }
|
31878 | var midpointWidth = "calc((" + tooltipWidth + " - " + caretSize.caretWidth + "px) / 2)";
|
31879 | var midpointHeight = "calc((" + tooltipHeight + " - " + caretSize.caretWidth + "px) / 2)";
|
31880 | var flushWithEdge = '0';
|
31881 | var indentedFromEdge = constants_1.numbers.CARET_INDENTATION + "px";
|
31882 | var indentedFromWidth = "calc(" + tooltipWidth + " - " + indentedFromEdge + ")";
|
31883 | var indentedFromHeight = "calc(" + tooltipHeight + " - " + indentedFromEdge + ")";
|
31884 | var verticalRotation = 35;
|
31885 | var horizontalRotation = Math.abs(90 - verticalRotation);
|
31886 | var bottomRightTopLeftBorderRadius = ['border-bottom-right-radius', 'border-top-left-radius'];
|
31887 | var bottomLeftTopRightBorderRadius = ['border-bottom-left-radius', 'border-top-right-radius'];
|
31888 | var skewDeg = 20;
|
31889 | switch (tooltipPos) {
|
31890 | case constants_1.PositionWithCaret.BELOW_CENTER:
|
31891 | return {
|
31892 | yAlignment: constants_1.strings.TOP,
|
31893 | xAlignment: constants_1.strings.LEFT,
|
31894 | yAxisPx: flushWithEdge,
|
31895 | xAxisPx: midpointWidth,
|
31896 | rotation: -1 * verticalRotation,
|
31897 | skew: -1 * skewDeg,
|
31898 | xTransformOrigin: midpointWidth,
|
31899 | yTransformOrigin: flushWithEdge,
|
31900 | caretCorners: bottomRightTopLeftBorderRadius
|
31901 | };
|
31902 | case constants_1.PositionWithCaret.BELOW_END:
|
31903 | return {
|
31904 | yAlignment: constants_1.strings.TOP,
|
31905 | xAlignment: isLTR ? constants_1.strings.RIGHT : constants_1.strings.LEFT,
|
31906 | yAxisPx: flushWithEdge,
|
31907 | xAxisPx: indentedFromEdge,
|
31908 | rotation: isLTR ? verticalRotation : -1 * verticalRotation,
|
31909 | skew: isLTR ? skewDeg : -1 * skewDeg,
|
31910 | xTransformOrigin: isLTR ? indentedFromWidth : indentedFromEdge,
|
31911 | yTransformOrigin: flushWithEdge,
|
31912 | caretCorners: isLTR ? bottomLeftTopRightBorderRadius : bottomRightTopLeftBorderRadius
|
31913 | };
|
31914 | case constants_1.PositionWithCaret.BELOW_START:
|
31915 | return {
|
31916 | yAlignment: constants_1.strings.TOP,
|
31917 | xAlignment: isLTR ? constants_1.strings.LEFT : constants_1.strings.RIGHT,
|
31918 | yAxisPx: flushWithEdge,
|
31919 | xAxisPx: indentedFromEdge,
|
31920 | rotation: isLTR ? -1 * verticalRotation : verticalRotation,
|
31921 | skew: isLTR ? -1 * skewDeg : skewDeg,
|
31922 | xTransformOrigin: isLTR ? indentedFromEdge : indentedFromWidth,
|
31923 | yTransformOrigin: flushWithEdge,
|
31924 | caretCorners: isLTR ? bottomRightTopLeftBorderRadius : bottomLeftTopRightBorderRadius
|
31925 | };
|
31926 | case constants_1.PositionWithCaret.TOP_SIDE_END:
|
31927 | return {
|
31928 | yAlignment: constants_1.strings.TOP,
|
31929 | xAlignment: isLTR ? constants_1.strings.LEFT : constants_1.strings.RIGHT,
|
31930 | yAxisPx: indentedFromEdge,
|
31931 | xAxisPx: flushWithEdge,
|
31932 | rotation: isLTR ? horizontalRotation : -1 * horizontalRotation,
|
31933 | skew: isLTR ? -1 * skewDeg : skewDeg,
|
31934 | xTransformOrigin: isLTR ? flushWithEdge : tooltipWidth,
|
31935 | yTransformOrigin: indentedFromEdge,
|
31936 | caretCorners: isLTR ? bottomRightTopLeftBorderRadius : bottomLeftTopRightBorderRadius
|
31937 | };
|
31938 | case constants_1.PositionWithCaret.CENTER_SIDE_END:
|
31939 | return {
|
31940 | yAlignment: constants_1.strings.TOP,
|
31941 | xAlignment: isLTR ? constants_1.strings.LEFT : constants_1.strings.RIGHT,
|
31942 | yAxisPx: midpointHeight,
|
31943 | xAxisPx: flushWithEdge,
|
31944 | rotation: isLTR ? horizontalRotation : -1 * horizontalRotation,
|
31945 | skew: isLTR ? -1 * skewDeg : skewDeg,
|
31946 | xTransformOrigin: isLTR ? flushWithEdge : tooltipWidth,
|
31947 | yTransformOrigin: midpointHeight,
|
31948 | caretCorners: isLTR ? bottomRightTopLeftBorderRadius : bottomLeftTopRightBorderRadius
|
31949 | };
|
31950 | case constants_1.PositionWithCaret.BOTTOM_SIDE_END:
|
31951 | return {
|
31952 | yAlignment: constants_1.strings.BOTTOM,
|
31953 | xAlignment: isLTR ? constants_1.strings.LEFT : constants_1.strings.RIGHT,
|
31954 | yAxisPx: indentedFromEdge,
|
31955 | xAxisPx: flushWithEdge,
|
31956 | rotation: isLTR ? -1 * horizontalRotation : horizontalRotation,
|
31957 | skew: isLTR ? skewDeg : -1 * skewDeg,
|
31958 | xTransformOrigin: isLTR ? flushWithEdge : tooltipWidth,
|
31959 | yTransformOrigin: indentedFromHeight,
|
31960 | caretCorners: isLTR ? bottomLeftTopRightBorderRadius : bottomRightTopLeftBorderRadius
|
31961 | };
|
31962 | case constants_1.PositionWithCaret.TOP_SIDE_START:
|
31963 | return {
|
31964 | yAlignment: constants_1.strings.TOP,
|
31965 | xAlignment: isLTR ? constants_1.strings.RIGHT : constants_1.strings.LEFT,
|
31966 | yAxisPx: indentedFromEdge,
|
31967 | xAxisPx: flushWithEdge,
|
31968 | rotation: isLTR ? -1 * horizontalRotation : horizontalRotation,
|
31969 | skew: isLTR ? skewDeg : -1 * skewDeg,
|
31970 | xTransformOrigin: isLTR ? tooltipWidth : flushWithEdge,
|
31971 | yTransformOrigin: indentedFromEdge,
|
31972 | caretCorners: isLTR ? bottomLeftTopRightBorderRadius : bottomRightTopLeftBorderRadius
|
31973 | };
|
31974 | case constants_1.PositionWithCaret.CENTER_SIDE_START:
|
31975 | return {
|
31976 | yAlignment: constants_1.strings.TOP,
|
31977 | xAlignment: isLTR ? constants_1.strings.RIGHT : constants_1.strings.LEFT,
|
31978 | yAxisPx: midpointHeight,
|
31979 | xAxisPx: flushWithEdge,
|
31980 | rotation: isLTR ? -1 * horizontalRotation : horizontalRotation,
|
31981 | skew: isLTR ? skewDeg : -1 * skewDeg,
|
31982 | xTransformOrigin: isLTR ? tooltipWidth : flushWithEdge,
|
31983 | yTransformOrigin: midpointHeight,
|
31984 | caretCorners: isLTR ? bottomLeftTopRightBorderRadius : bottomRightTopLeftBorderRadius
|
31985 | };
|
31986 | case constants_1.PositionWithCaret.BOTTOM_SIDE_START:
|
31987 | return {
|
31988 | yAlignment: constants_1.strings.BOTTOM,
|
31989 | xAlignment: isLTR ? constants_1.strings.RIGHT : constants_1.strings.LEFT,
|
31990 | yAxisPx: indentedFromEdge,
|
31991 | xAxisPx: flushWithEdge,
|
31992 | rotation: isLTR ? horizontalRotation : -1 * horizontalRotation,
|
31993 | skew: isLTR ? -1 * skewDeg : skewDeg,
|
31994 | xTransformOrigin: isLTR ? tooltipWidth : flushWithEdge,
|
31995 | yTransformOrigin: indentedFromHeight,
|
31996 | caretCorners: isLTR ? bottomRightTopLeftBorderRadius : bottomLeftTopRightBorderRadius
|
31997 | };
|
31998 | case constants_1.PositionWithCaret.ABOVE_CENTER:
|
31999 | return {
|
32000 | yAlignment: constants_1.strings.BOTTOM,
|
32001 | xAlignment: constants_1.strings.LEFT,
|
32002 | yAxisPx: flushWithEdge,
|
32003 | xAxisPx: midpointWidth,
|
32004 | rotation: verticalRotation,
|
32005 | skew: skewDeg,
|
32006 | xTransformOrigin: midpointWidth,
|
32007 | yTransformOrigin: tooltipHeight,
|
32008 | caretCorners: bottomLeftTopRightBorderRadius
|
32009 | };
|
32010 | case constants_1.PositionWithCaret.ABOVE_END:
|
32011 | return {
|
32012 | yAlignment: constants_1.strings.BOTTOM,
|
32013 | xAlignment: isLTR ? constants_1.strings.RIGHT : constants_1.strings.LEFT,
|
32014 | yAxisPx: flushWithEdge,
|
32015 | xAxisPx: indentedFromEdge,
|
32016 | rotation: isLTR ? -1 * verticalRotation : verticalRotation,
|
32017 | skew: isLTR ? -1 * skewDeg : skewDeg,
|
32018 | xTransformOrigin: isLTR ? indentedFromWidth : indentedFromEdge,
|
32019 | yTransformOrigin: tooltipHeight,
|
32020 | caretCorners: isLTR ? bottomRightTopLeftBorderRadius : bottomLeftTopRightBorderRadius
|
32021 | };
|
32022 | default:
|
32023 | case constants_1.PositionWithCaret.ABOVE_START:
|
32024 | return {
|
32025 | yAlignment: constants_1.strings.BOTTOM,
|
32026 | xAlignment: isLTR ? constants_1.strings.LEFT : constants_1.strings.RIGHT,
|
32027 | yAxisPx: flushWithEdge,
|
32028 | xAxisPx: indentedFromEdge,
|
32029 | rotation: isLTR ? verticalRotation : -1 * verticalRotation,
|
32030 | skew: isLTR ? skewDeg : -1 * skewDeg,
|
32031 | xTransformOrigin: isLTR ? indentedFromEdge : indentedFromWidth,
|
32032 | yTransformOrigin: tooltipHeight,
|
32033 | caretCorners: isLTR ? bottomLeftTopRightBorderRadius : bottomRightTopLeftBorderRadius
|
32034 | };
|
32035 | }
|
32036 | };
|
32037 | MDCTooltipFoundation.prototype.clearShowTimeout = function () {
|
32038 | if (this.showTimeout) {
|
32039 | clearTimeout(this.showTimeout);
|
32040 | this.showTimeout = null;
|
32041 | }
|
32042 | };
|
32043 | MDCTooltipFoundation.prototype.clearHideTimeout = function () {
|
32044 | if (this.hideTimeout) {
|
32045 | clearTimeout(this.hideTimeout);
|
32046 | this.hideTimeout = null;
|
32047 | }
|
32048 | };
|
32049 | |
32050 |
|
32051 |
|
32052 |
|
32053 |
|
32054 |
|
32055 | MDCTooltipFoundation.prototype.attachScrollHandler = function (addEventListenerFn) {
|
32056 | var _this = this;
|
32057 | this.addAncestorScrollEventListeners.push(function () {
|
32058 | addEventListenerFn('scroll', _this.windowScrollHandler);
|
32059 | });
|
32060 | };
|
32061 | |
32062 |
|
32063 |
|
32064 |
|
32065 | MDCTooltipFoundation.prototype.removeScrollHandler = function (removeEventHandlerFn) {
|
32066 | var _this = this;
|
32067 | this.removeAncestorScrollEventListeners.push(function () {
|
32068 | removeEventHandlerFn('scroll', _this.windowScrollHandler);
|
32069 | });
|
32070 | };
|
32071 | MDCTooltipFoundation.prototype.destroy = function () {
|
32072 | var e_8, _a;
|
32073 | if (this.frameId) {
|
32074 | cancelAnimationFrame(this.frameId);
|
32075 | this.frameId = null;
|
32076 | }
|
32077 | this.clearHideTimeout();
|
32078 | this.clearShowTimeout();
|
32079 | this.adapter.removeClass(SHOWN);
|
32080 | this.adapter.removeClass(SHOWING_TRANSITION);
|
32081 | this.adapter.removeClass(SHOWING);
|
32082 | this.adapter.removeClass(HIDE);
|
32083 | this.adapter.removeClass(HIDE_TRANSITION);
|
32084 | if (this.richTooltip) {
|
32085 | this.adapter.deregisterEventHandler('focusout', this.richTooltipFocusOutHandler);
|
32086 | }
|
32087 | if (!this.persistentTooltip) {
|
32088 | this.adapter.deregisterEventHandler('mouseenter', this.tooltipMouseEnterHandler);
|
32089 | this.adapter.deregisterEventHandler('mouseleave', this.tooltipMouseLeaveHandler);
|
32090 | }
|
32091 | this.adapter.deregisterAnchorEventHandler('blur', this.anchorBlurHandler);
|
32092 | this.adapter.deregisterDocumentEventHandler('click', this.documentClickHandler);
|
32093 | this.adapter.deregisterDocumentEventHandler('keydown', this.documentKeydownHandler);
|
32094 | this.adapter.deregisterWindowEventHandler('scroll', this.windowScrollHandler);
|
32095 | this.adapter.deregisterWindowEventHandler('resize', this.windowResizeHandler);
|
32096 | try {
|
32097 | for (var _b = __values(this.removeAncestorScrollEventListeners), _c = _b.next(); !_c.done; _c = _b.next()) {
|
32098 | var fn = _c.value;
|
32099 | fn();
|
32100 | }
|
32101 | } catch (e_8_1) {
|
32102 | e_8 = { error: e_8_1 };
|
32103 | } finally {
|
32104 | try {
|
32105 | if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
32106 | } finally {
|
32107 | if (e_8) throw e_8.error;
|
32108 | }
|
32109 | }
|
32110 | this.animFrame.cancelAll();
|
32111 | };
|
32112 | return MDCTooltipFoundation;
|
32113 | }(foundation_1.MDCFoundation);
|
32114 | exports.MDCTooltipFoundation = MDCTooltipFoundation;
|
32115 |
|
32116 | exports.default = MDCTooltipFoundation;
|
32117 |
|
32118 | }),
|
32119 |
|
32120 | "./packages/mdc-tooltip/index.ts":
|
32121 |
|
32122 |
|
32123 |
|
32124 |
|
32125 | (function(module, exports, __webpack_require__) {
|
32126 |
|
32127 | "use strict";
|
32128 |
|
32129 |
|
32130 |
|
32131 |
|
32132 |
|
32133 |
|
32134 |
|
32135 |
|
32136 |
|
32137 |
|
32138 |
|
32139 |
|
32140 |
|
32141 |
|
32142 |
|
32143 |
|
32144 |
|
32145 |
|
32146 |
|
32147 |
|
32148 |
|
32149 |
|
32150 |
|
32151 |
|
32152 | var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
|
32153 | if (k2 === undefined) k2 = k;
|
32154 | Object.defineProperty(o, k2, { enumerable: true, get: function get() {
|
32155 | return m[k];
|
32156 | } });
|
32157 | } : function (o, m, k, k2) {
|
32158 | if (k2 === undefined) k2 = k;
|
32159 | o[k2] = m[k];
|
32160 | });
|
32161 | var __exportStar = this && this.__exportStar || function (m, exports) {
|
32162 | for (var p in m) {
|
32163 | if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
32164 | }
|
32165 | };
|
32166 | Object.defineProperty(exports, "__esModule", { value: true });
|
32167 | __exportStar(__webpack_require__( "./packages/mdc-tooltip/adapter.ts"), exports);
|
32168 | __exportStar(__webpack_require__( "./packages/mdc-tooltip/component.ts"), exports);
|
32169 | __exportStar(__webpack_require__( "./packages/mdc-tooltip/foundation.ts"), exports);
|
32170 | __exportStar(__webpack_require__( "./packages/mdc-tooltip/constants.ts"), exports);
|
32171 |
|
32172 | }),
|
32173 |
|
32174 | "./packages/mdc-top-app-bar/adapter.ts":
|
32175 |
|
32176 |
|
32177 |
|
32178 |
|
32179 | (function(module, exports, __webpack_require__) {
|
32180 |
|
32181 | "use strict";
|
32182 |
|
32183 |
|
32184 |
|
32185 |
|
32186 |
|
32187 |
|
32188 |
|
32189 |
|
32190 |
|
32191 |
|
32192 |
|
32193 |
|
32194 |
|
32195 |
|
32196 |
|
32197 |
|
32198 |
|
32199 |
|
32200 |
|
32201 |
|
32202 |
|
32203 |
|
32204 |
|
32205 |
|
32206 | Object.defineProperty(exports, "__esModule", { value: true });
|
32207 |
|
32208 | }),
|
32209 |
|
32210 | "./packages/mdc-top-app-bar/component.ts":
|
32211 |
|
32212 |
|
32213 |
|
32214 |
|
32215 | (function(module, exports, __webpack_require__) {
|
32216 |
|
32217 | "use strict";
|
32218 |
|
32219 |
|
32220 |
|
32221 |
|
32222 |
|
32223 |
|
32224 |
|
32225 |
|
32226 |
|
32227 |
|
32228 |
|
32229 |
|
32230 |
|
32231 |
|
32232 |
|
32233 |
|
32234 |
|
32235 |
|
32236 |
|
32237 |
|
32238 |
|
32239 |
|
32240 |
|
32241 |
|
32242 | var __extends = this && this.__extends || function () {
|
32243 | var _extendStatics = function extendStatics(d, b) {
|
32244 | _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
|
32245 | d.__proto__ = b;
|
32246 | } || function (d, b) {
|
32247 | for (var p in b) {
|
32248 | if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
32249 | }
|
32250 | };
|
32251 | return _extendStatics(d, b);
|
32252 | };
|
32253 | return function (d, b) {
|
32254 | if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
32255 | _extendStatics(d, b);
|
32256 | function __() {
|
32257 | this.constructor = d;
|
32258 | }
|
32259 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
32260 | };
|
32261 | }();
|
32262 | var __values = this && this.__values || function (o) {
|
32263 | var s = typeof Symbol === "function" && Symbol.iterator,
|
32264 | m = s && o[s],
|
32265 | i = 0;
|
32266 | if (m) return m.call(o);
|
32267 | if (o && typeof o.length === "number") return {
|
32268 | next: function next() {
|
32269 | if (o && i >= o.length) o = void 0;
|
32270 | return { value: o && o[i++], done: !o };
|
32271 | }
|
32272 | };
|
32273 | throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
32274 | };
|
32275 | Object.defineProperty(exports, "__esModule", { value: true });
|
32276 | exports.MDCTopAppBar = void 0;
|
32277 | var component_1 = __webpack_require__( "./packages/mdc-base/component.ts");
|
32278 | var component_2 = __webpack_require__( "./packages/mdc-ripple/component.ts");
|
32279 | var constants_1 = __webpack_require__( "./packages/mdc-top-app-bar/constants.ts");
|
32280 | var foundation_1 = __webpack_require__( "./packages/mdc-top-app-bar/fixed/foundation.ts");
|
32281 | var foundation_2 = __webpack_require__( "./packages/mdc-top-app-bar/short/foundation.ts");
|
32282 | var foundation_3 = __webpack_require__( "./packages/mdc-top-app-bar/standard/foundation.ts");
|
32283 | var MDCTopAppBar = function (_super) {
|
32284 | __extends(MDCTopAppBar, _super);
|
32285 | function MDCTopAppBar() {
|
32286 | return _super !== null && _super.apply(this, arguments) || this;
|
32287 | }
|
32288 | MDCTopAppBar.attachTo = function (root) {
|
32289 | return new MDCTopAppBar(root);
|
32290 | };
|
32291 | MDCTopAppBar.prototype.initialize = function (rippleFactory) {
|
32292 | if (rippleFactory === void 0) {
|
32293 | rippleFactory = function rippleFactory(el) {
|
32294 | return component_2.MDCRipple.attachTo(el);
|
32295 | };
|
32296 | }
|
32297 | this.navIcon = this.root.querySelector(constants_1.strings.NAVIGATION_ICON_SELECTOR);
|
32298 |
|
32299 | var icons = [].slice.call(this.root.querySelectorAll(constants_1.strings.ACTION_ITEM_SELECTOR));
|
32300 | if (this.navIcon) {
|
32301 | icons.push(this.navIcon);
|
32302 | }
|
32303 | this.iconRipples = icons.map(function (icon) {
|
32304 | var ripple = rippleFactory(icon);
|
32305 | ripple.unbounded = true;
|
32306 | return ripple;
|
32307 | });
|
32308 | this.scrollTarget = window;
|
32309 | };
|
32310 | MDCTopAppBar.prototype.initialSyncWithDOM = function () {
|
32311 | this.handleNavigationClick = this.foundation.handleNavigationClick.bind(this.foundation);
|
32312 | this.handleWindowResize = this.foundation.handleWindowResize.bind(this.foundation);
|
32313 | this.handleTargetScroll = this.foundation.handleTargetScroll.bind(this.foundation);
|
32314 | this.scrollTarget.addEventListener('scroll', this.handleTargetScroll);
|
32315 | if (this.navIcon) {
|
32316 | this.navIcon.addEventListener('click', this.handleNavigationClick);
|
32317 | }
|
32318 | var isFixed = this.root.classList.contains(constants_1.cssClasses.FIXED_CLASS);
|
32319 | var isShort = this.root.classList.contains(constants_1.cssClasses.SHORT_CLASS);
|
32320 | if (!isShort && !isFixed) {
|
32321 | window.addEventListener('resize', this.handleWindowResize);
|
32322 | }
|
32323 | };
|
32324 | MDCTopAppBar.prototype.destroy = function () {
|
32325 | var e_1, _a;
|
32326 | try {
|
32327 | for (var _b = __values(this.iconRipples), _c = _b.next(); !_c.done; _c = _b.next()) {
|
32328 | var iconRipple = _c.value;
|
32329 | iconRipple.destroy();
|
32330 | }
|
32331 | } catch (e_1_1) {
|
32332 | e_1 = { error: e_1_1 };
|
32333 | } finally {
|
32334 | try {
|
32335 | if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
32336 | } finally {
|
32337 | if (e_1) throw e_1.error;
|
32338 | }
|
32339 | }
|
32340 | this.scrollTarget.removeEventListener('scroll', this.handleTargetScroll);
|
32341 | if (this.navIcon) {
|
32342 | this.navIcon.removeEventListener('click', this.handleNavigationClick);
|
32343 | }
|
32344 | var isFixed = this.root.classList.contains(constants_1.cssClasses.FIXED_CLASS);
|
32345 | var isShort = this.root.classList.contains(constants_1.cssClasses.SHORT_CLASS);
|
32346 | if (!isShort && !isFixed) {
|
32347 | window.removeEventListener('resize', this.handleWindowResize);
|
32348 | }
|
32349 | _super.prototype.destroy.call(this);
|
32350 | };
|
32351 | MDCTopAppBar.prototype.setScrollTarget = function (target) {
|
32352 |
|
32353 | this.scrollTarget.removeEventListener('scroll', this.handleTargetScroll);
|
32354 | this.scrollTarget = target;
|
32355 |
|
32356 | this.handleTargetScroll = this.foundation.handleTargetScroll.bind(this.foundation);
|
32357 | this.scrollTarget.addEventListener('scroll', this.handleTargetScroll);
|
32358 | };
|
32359 | MDCTopAppBar.prototype.getDefaultFoundation = function () {
|
32360 | var _this = this;
|
32361 |
|
32362 |
|
32363 |
|
32364 | var adapter = {
|
32365 | hasClass: function hasClass(className) {
|
32366 | return _this.root.classList.contains(className);
|
32367 | },
|
32368 | addClass: function addClass(className) {
|
32369 | return _this.root.classList.add(className);
|
32370 | },
|
32371 | removeClass: function removeClass(className) {
|
32372 | return _this.root.classList.remove(className);
|
32373 | },
|
32374 | setStyle: function setStyle(property, value) {
|
32375 | return _this.root.style.setProperty(property, value);
|
32376 | },
|
32377 | getTopAppBarHeight: function getTopAppBarHeight() {
|
32378 | return _this.root.clientHeight;
|
32379 | },
|
32380 | notifyNavigationIconClicked: function notifyNavigationIconClicked() {
|
32381 | return _this.emit(constants_1.strings.NAVIGATION_EVENT, {});
|
32382 | },
|
32383 | getViewportScrollY: function getViewportScrollY() {
|
32384 | var win = _this.scrollTarget;
|
32385 | var el = _this.scrollTarget;
|
32386 | return win.pageYOffset !== undefined ? win.pageYOffset : el.scrollTop;
|
32387 | },
|
32388 | getTotalActionItems: function getTotalActionItems() {
|
32389 | return _this.root.querySelectorAll(constants_1.strings.ACTION_ITEM_SELECTOR).length;
|
32390 | }
|
32391 | };
|
32392 |
|
32393 | var foundation;
|
32394 | if (this.root.classList.contains(constants_1.cssClasses.SHORT_CLASS)) {
|
32395 | foundation = new foundation_2.MDCShortTopAppBarFoundation(adapter);
|
32396 | } else if (this.root.classList.contains(constants_1.cssClasses.FIXED_CLASS)) {
|
32397 | foundation = new foundation_1.MDCFixedTopAppBarFoundation(adapter);
|
32398 | } else {
|
32399 | foundation = new foundation_3.MDCTopAppBarFoundation(adapter);
|
32400 | }
|
32401 | return foundation;
|
32402 | };
|
32403 | return MDCTopAppBar;
|
32404 | }(component_1.MDCComponent);
|
32405 | exports.MDCTopAppBar = MDCTopAppBar;
|
32406 |
|
32407 | }),
|
32408 |
|
32409 | "./packages/mdc-top-app-bar/constants.ts":
|
32410 |
|
32411 |
|
32412 |
|
32413 |
|
32414 | (function(module, exports, __webpack_require__) {
|
32415 |
|
32416 | "use strict";
|
32417 |
|
32418 |
|
32419 |
|
32420 |
|
32421 |
|
32422 |
|
32423 |
|
32424 |
|
32425 |
|
32426 |
|
32427 |
|
32428 |
|
32429 |
|
32430 |
|
32431 |
|
32432 |
|
32433 |
|
32434 |
|
32435 |
|
32436 |
|
32437 |
|
32438 |
|
32439 |
|
32440 |
|
32441 | Object.defineProperty(exports, "__esModule", { value: true });
|
32442 | exports.strings = exports.numbers = exports.cssClasses = void 0;
|
32443 | var cssClasses = {
|
32444 | FIXED_CLASS: 'mdc-top-app-bar--fixed',
|
32445 | FIXED_SCROLLED_CLASS: 'mdc-top-app-bar--fixed-scrolled',
|
32446 | SHORT_CLASS: 'mdc-top-app-bar--short',
|
32447 | SHORT_COLLAPSED_CLASS: 'mdc-top-app-bar--short-collapsed',
|
32448 | SHORT_HAS_ACTION_ITEM_CLASS: 'mdc-top-app-bar--short-has-action-item'
|
32449 | };
|
32450 | exports.cssClasses = cssClasses;
|
32451 | var numbers = {
|
32452 | DEBOUNCE_THROTTLE_RESIZE_TIME_MS: 100,
|
32453 | MAX_TOP_APP_BAR_HEIGHT: 128
|
32454 | };
|
32455 | exports.numbers = numbers;
|
32456 | var strings = {
|
32457 | ACTION_ITEM_SELECTOR: '.mdc-top-app-bar__action-item',
|
32458 | NAVIGATION_EVENT: 'MDCTopAppBar:nav',
|
32459 | NAVIGATION_ICON_SELECTOR: '.mdc-top-app-bar__navigation-icon',
|
32460 | ROOT_SELECTOR: '.mdc-top-app-bar',
|
32461 | TITLE_SELECTOR: '.mdc-top-app-bar__title'
|
32462 | };
|
32463 | exports.strings = strings;
|
32464 |
|
32465 | }),
|
32466 |
|
32467 | "./packages/mdc-top-app-bar/fixed/foundation.ts":
|
32468 |
|
32469 |
|
32470 |
|
32471 |
|
32472 | (function(module, exports, __webpack_require__) {
|
32473 |
|
32474 | "use strict";
|
32475 |
|
32476 |
|
32477 |
|
32478 |
|
32479 |
|
32480 |
|
32481 |
|
32482 |
|
32483 |
|
32484 |
|
32485 |
|
32486 |
|
32487 |
|
32488 |
|
32489 |
|
32490 |
|
32491 |
|
32492 |
|
32493 |
|
32494 |
|
32495 |
|
32496 |
|
32497 |
|
32498 |
|
32499 | var __extends = this && this.__extends || function () {
|
32500 | var _extendStatics = function extendStatics(d, b) {
|
32501 | _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
|
32502 | d.__proto__ = b;
|
32503 | } || function (d, b) {
|
32504 | for (var p in b) {
|
32505 | if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
32506 | }
|
32507 | };
|
32508 | return _extendStatics(d, b);
|
32509 | };
|
32510 | return function (d, b) {
|
32511 | if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
32512 | _extendStatics(d, b);
|
32513 | function __() {
|
32514 | this.constructor = d;
|
32515 | }
|
32516 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
32517 | };
|
32518 | }();
|
32519 | Object.defineProperty(exports, "__esModule", { value: true });
|
32520 | exports.MDCFixedTopAppBarFoundation = void 0;
|
32521 | var constants_1 = __webpack_require__( "./packages/mdc-top-app-bar/constants.ts");
|
32522 | var foundation_1 = __webpack_require__( "./packages/mdc-top-app-bar/standard/foundation.ts");
|
32523 | var MDCFixedTopAppBarFoundation = function (_super) {
|
32524 | __extends(MDCFixedTopAppBarFoundation, _super);
|
32525 | function MDCFixedTopAppBarFoundation() {
|
32526 | var _this = _super !== null && _super.apply(this, arguments) || this;
|
32527 | |
32528 |
|
32529 |
|
32530 | _this.wasScrolled = false;
|
32531 | return _this;
|
32532 | }
|
32533 | |
32534 |
|
32535 |
|
32536 |
|
32537 | MDCFixedTopAppBarFoundation.prototype.handleTargetScroll = function () {
|
32538 | var currentScroll = this.adapter.getViewportScrollY();
|
32539 | if (currentScroll <= 0) {
|
32540 | if (this.wasScrolled) {
|
32541 | this.adapter.removeClass(constants_1.cssClasses.FIXED_SCROLLED_CLASS);
|
32542 | this.wasScrolled = false;
|
32543 | }
|
32544 | } else {
|
32545 | if (!this.wasScrolled) {
|
32546 | this.adapter.addClass(constants_1.cssClasses.FIXED_SCROLLED_CLASS);
|
32547 | this.wasScrolled = true;
|
32548 | }
|
32549 | }
|
32550 | };
|
32551 | return MDCFixedTopAppBarFoundation;
|
32552 | }(foundation_1.MDCTopAppBarFoundation);
|
32553 | exports.MDCFixedTopAppBarFoundation = MDCFixedTopAppBarFoundation;
|
32554 |
|
32555 | exports.default = MDCFixedTopAppBarFoundation;
|
32556 |
|
32557 | }),
|
32558 |
|
32559 | "./packages/mdc-top-app-bar/foundation.ts":
|
32560 |
|
32561 |
|
32562 |
|
32563 |
|
32564 | (function(module, exports, __webpack_require__) {
|
32565 |
|
32566 | "use strict";
|
32567 |
|
32568 |
|
32569 |
|
32570 |
|
32571 |
|
32572 |
|
32573 |
|
32574 |
|
32575 |
|
32576 |
|
32577 |
|
32578 |
|
32579 |
|
32580 |
|
32581 |
|
32582 |
|
32583 |
|
32584 |
|
32585 |
|
32586 |
|
32587 |
|
32588 |
|
32589 |
|
32590 |
|
32591 | var __extends = this && this.__extends || function () {
|
32592 | var _extendStatics = function extendStatics(d, b) {
|
32593 | _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
|
32594 | d.__proto__ = b;
|
32595 | } || function (d, b) {
|
32596 | for (var p in b) {
|
32597 | if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
32598 | }
|
32599 | };
|
32600 | return _extendStatics(d, b);
|
32601 | };
|
32602 | return function (d, b) {
|
32603 | if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
32604 | _extendStatics(d, b);
|
32605 | function __() {
|
32606 | this.constructor = d;
|
32607 | }
|
32608 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
32609 | };
|
32610 | }();
|
32611 | var __assign = this && this.__assign || function () {
|
32612 | __assign = Object.assign || function (t) {
|
32613 | for (var s, i = 1, n = arguments.length; i < n; i++) {
|
32614 | s = arguments[i];
|
32615 | for (var p in s) {
|
32616 | if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
32617 | }
|
32618 | }
|
32619 | return t;
|
32620 | };
|
32621 | return __assign.apply(this, arguments);
|
32622 | };
|
32623 | Object.defineProperty(exports, "__esModule", { value: true });
|
32624 | exports.MDCTopAppBarBaseFoundation = void 0;
|
32625 | var foundation_1 = __webpack_require__( "./packages/mdc-base/foundation.ts");
|
32626 | var constants_1 = __webpack_require__( "./packages/mdc-top-app-bar/constants.ts");
|
32627 | var MDCTopAppBarBaseFoundation = function (_super) {
|
32628 | __extends(MDCTopAppBarBaseFoundation, _super);
|
32629 |
|
32630 | function MDCTopAppBarBaseFoundation(adapter) {
|
32631 | return _super.call(this, __assign(__assign({}, MDCTopAppBarBaseFoundation.defaultAdapter), adapter)) || this;
|
32632 | }
|
32633 | Object.defineProperty(MDCTopAppBarBaseFoundation, "strings", {
|
32634 | get: function get() {
|
32635 | return constants_1.strings;
|
32636 | },
|
32637 | enumerable: false,
|
32638 | configurable: true
|
32639 | });
|
32640 | Object.defineProperty(MDCTopAppBarBaseFoundation, "cssClasses", {
|
32641 | get: function get() {
|
32642 | return constants_1.cssClasses;
|
32643 | },
|
32644 | enumerable: false,
|
32645 | configurable: true
|
32646 | });
|
32647 | Object.defineProperty(MDCTopAppBarBaseFoundation, "numbers", {
|
32648 | get: function get() {
|
32649 | return constants_1.numbers;
|
32650 | },
|
32651 | enumerable: false,
|
32652 | configurable: true
|
32653 | });
|
32654 | Object.defineProperty(MDCTopAppBarBaseFoundation, "defaultAdapter", {
|
32655 | |
32656 |
|
32657 |
|
32658 | get: function get() {
|
32659 |
|
32660 | return {
|
32661 | addClass: function addClass() {
|
32662 | return undefined;
|
32663 | },
|
32664 | removeClass: function removeClass() {
|
32665 | return undefined;
|
32666 | },
|
32667 | hasClass: function hasClass() {
|
32668 | return false;
|
32669 | },
|
32670 | setStyle: function setStyle() {
|
32671 | return undefined;
|
32672 | },
|
32673 | getTopAppBarHeight: function getTopAppBarHeight() {
|
32674 | return 0;
|
32675 | },
|
32676 | notifyNavigationIconClicked: function notifyNavigationIconClicked() {
|
32677 | return undefined;
|
32678 | },
|
32679 | getViewportScrollY: function getViewportScrollY() {
|
32680 | return 0;
|
32681 | },
|
32682 | getTotalActionItems: function getTotalActionItems() {
|
32683 | return 0;
|
32684 | }
|
32685 | };
|
32686 |
|
32687 | },
|
32688 | enumerable: false,
|
32689 | configurable: true
|
32690 | });
|
32691 |
|
32692 | MDCTopAppBarBaseFoundation.prototype.handleTargetScroll = function () {};
|
32693 |
|
32694 | MDCTopAppBarBaseFoundation.prototype.handleWindowResize = function () {};
|
32695 | MDCTopAppBarBaseFoundation.prototype.handleNavigationClick = function () {
|
32696 | this.adapter.notifyNavigationIconClicked();
|
32697 | };
|
32698 | return MDCTopAppBarBaseFoundation;
|
32699 | }(foundation_1.MDCFoundation);
|
32700 | exports.MDCTopAppBarBaseFoundation = MDCTopAppBarBaseFoundation;
|
32701 |
|
32702 | exports.default = MDCTopAppBarBaseFoundation;
|
32703 |
|
32704 | }),
|
32705 |
|
32706 | "./packages/mdc-top-app-bar/index.ts":
|
32707 |
|
32708 |
|
32709 |
|
32710 |
|
32711 | (function(module, exports, __webpack_require__) {
|
32712 |
|
32713 | "use strict";
|
32714 |
|
32715 |
|
32716 |
|
32717 |
|
32718 |
|
32719 |
|
32720 |
|
32721 |
|
32722 |
|
32723 |
|
32724 |
|
32725 |
|
32726 |
|
32727 |
|
32728 |
|
32729 |
|
32730 |
|
32731 |
|
32732 |
|
32733 |
|
32734 |
|
32735 |
|
32736 |
|
32737 |
|
32738 | var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
|
32739 | if (k2 === undefined) k2 = k;
|
32740 | Object.defineProperty(o, k2, { enumerable: true, get: function get() {
|
32741 | return m[k];
|
32742 | } });
|
32743 | } : function (o, m, k, k2) {
|
32744 | if (k2 === undefined) k2 = k;
|
32745 | o[k2] = m[k];
|
32746 | });
|
32747 | var __exportStar = this && this.__exportStar || function (m, exports) {
|
32748 | for (var p in m) {
|
32749 | if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
32750 | }
|
32751 | };
|
32752 | Object.defineProperty(exports, "__esModule", { value: true });
|
32753 | __exportStar(__webpack_require__( "./packages/mdc-top-app-bar/adapter.ts"), exports);
|
32754 | __exportStar(__webpack_require__( "./packages/mdc-top-app-bar/component.ts"), exports);
|
32755 | __exportStar(__webpack_require__( "./packages/mdc-top-app-bar/constants.ts"), exports);
|
32756 | __exportStar(__webpack_require__( "./packages/mdc-top-app-bar/foundation.ts"), exports);
|
32757 | __exportStar(__webpack_require__( "./packages/mdc-top-app-bar/fixed/foundation.ts"), exports);
|
32758 | __exportStar(__webpack_require__( "./packages/mdc-top-app-bar/short/foundation.ts"), exports);
|
32759 | __exportStar(__webpack_require__( "./packages/mdc-top-app-bar/standard/foundation.ts"), exports);
|
32760 |
|
32761 | }),
|
32762 |
|
32763 | "./packages/mdc-top-app-bar/short/foundation.ts":
|
32764 |
|
32765 |
|
32766 |
|
32767 |
|
32768 | (function(module, exports, __webpack_require__) {
|
32769 |
|
32770 | "use strict";
|
32771 |
|
32772 |
|
32773 |
|
32774 |
|
32775 |
|
32776 |
|
32777 |
|
32778 |
|
32779 |
|
32780 |
|
32781 |
|
32782 |
|
32783 |
|
32784 |
|
32785 |
|
32786 |
|
32787 |
|
32788 |
|
32789 |
|
32790 |
|
32791 |
|
32792 |
|
32793 |
|
32794 |
|
32795 | var __extends = this && this.__extends || function () {
|
32796 | var _extendStatics = function extendStatics(d, b) {
|
32797 | _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
|
32798 | d.__proto__ = b;
|
32799 | } || function (d, b) {
|
32800 | for (var p in b) {
|
32801 | if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
32802 | }
|
32803 | };
|
32804 | return _extendStatics(d, b);
|
32805 | };
|
32806 | return function (d, b) {
|
32807 | if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
32808 | _extendStatics(d, b);
|
32809 | function __() {
|
32810 | this.constructor = d;
|
32811 | }
|
32812 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
32813 | };
|
32814 | }();
|
32815 | Object.defineProperty(exports, "__esModule", { value: true });
|
32816 | exports.MDCShortTopAppBarFoundation = void 0;
|
32817 | var constants_1 = __webpack_require__( "./packages/mdc-top-app-bar/constants.ts");
|
32818 | var foundation_1 = __webpack_require__( "./packages/mdc-top-app-bar/foundation.ts");
|
32819 | var MDCShortTopAppBarFoundation = function (_super) {
|
32820 | __extends(MDCShortTopAppBarFoundation, _super);
|
32821 |
|
32822 | function MDCShortTopAppBarFoundation(adapter) {
|
32823 | var _this = _super.call(this, adapter) || this;
|
32824 | _this.collapsed = false;
|
32825 | _this.isAlwaysCollapsed = false;
|
32826 | return _this;
|
32827 | }
|
32828 | Object.defineProperty(MDCShortTopAppBarFoundation.prototype, "isCollapsed", {
|
32829 |
|
32830 | get: function get() {
|
32831 | return this.collapsed;
|
32832 | },
|
32833 | enumerable: false,
|
32834 | configurable: true
|
32835 | });
|
32836 | MDCShortTopAppBarFoundation.prototype.init = function () {
|
32837 | _super.prototype.init.call(this);
|
32838 | if (this.adapter.getTotalActionItems() > 0) {
|
32839 | this.adapter.addClass(constants_1.cssClasses.SHORT_HAS_ACTION_ITEM_CLASS);
|
32840 | }
|
32841 |
|
32842 | this.setAlwaysCollapsed(this.adapter.hasClass(constants_1.cssClasses.SHORT_COLLAPSED_CLASS));
|
32843 | };
|
32844 | |
32845 |
|
32846 |
|
32847 |
|
32848 |
|
32849 | MDCShortTopAppBarFoundation.prototype.setAlwaysCollapsed = function (value) {
|
32850 | this.isAlwaysCollapsed = !!value;
|
32851 | if (this.isAlwaysCollapsed) {
|
32852 | this.collapse();
|
32853 | } else {
|
32854 |
|
32855 | this.maybeCollapseBar();
|
32856 | }
|
32857 | };
|
32858 | MDCShortTopAppBarFoundation.prototype.getAlwaysCollapsed = function () {
|
32859 | return this.isAlwaysCollapsed;
|
32860 | };
|
32861 | |
32862 |
|
32863 |
|
32864 |
|
32865 | MDCShortTopAppBarFoundation.prototype.handleTargetScroll = function () {
|
32866 | this.maybeCollapseBar();
|
32867 | };
|
32868 | MDCShortTopAppBarFoundation.prototype.maybeCollapseBar = function () {
|
32869 | if (this.isAlwaysCollapsed) {
|
32870 | return;
|
32871 | }
|
32872 | var currentScroll = this.adapter.getViewportScrollY();
|
32873 | if (currentScroll <= 0) {
|
32874 | if (this.collapsed) {
|
32875 | this.uncollapse();
|
32876 | }
|
32877 | } else {
|
32878 | if (!this.collapsed) {
|
32879 | this.collapse();
|
32880 | }
|
32881 | }
|
32882 | };
|
32883 | MDCShortTopAppBarFoundation.prototype.uncollapse = function () {
|
32884 | this.adapter.removeClass(constants_1.cssClasses.SHORT_COLLAPSED_CLASS);
|
32885 | this.collapsed = false;
|
32886 | };
|
32887 | MDCShortTopAppBarFoundation.prototype.collapse = function () {
|
32888 | this.adapter.addClass(constants_1.cssClasses.SHORT_COLLAPSED_CLASS);
|
32889 | this.collapsed = true;
|
32890 | };
|
32891 | return MDCShortTopAppBarFoundation;
|
32892 | }(foundation_1.MDCTopAppBarBaseFoundation);
|
32893 | exports.MDCShortTopAppBarFoundation = MDCShortTopAppBarFoundation;
|
32894 |
|
32895 | exports.default = MDCShortTopAppBarFoundation;
|
32896 |
|
32897 | }),
|
32898 |
|
32899 | "./packages/mdc-top-app-bar/standard/foundation.ts":
|
32900 |
|
32901 |
|
32902 |
|
32903 |
|
32904 | (function(module, exports, __webpack_require__) {
|
32905 |
|
32906 | "use strict";
|
32907 |
|
32908 |
|
32909 |
|
32910 |
|
32911 |
|
32912 |
|
32913 |
|
32914 |
|
32915 |
|
32916 |
|
32917 |
|
32918 |
|
32919 |
|
32920 |
|
32921 |
|
32922 |
|
32923 |
|
32924 |
|
32925 |
|
32926 |
|
32927 |
|
32928 |
|
32929 |
|
32930 |
|
32931 | var __extends = this && this.__extends || function () {
|
32932 | var _extendStatics = function extendStatics(d, b) {
|
32933 | _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
|
32934 | d.__proto__ = b;
|
32935 | } || function (d, b) {
|
32936 | for (var p in b) {
|
32937 | if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
32938 | }
|
32939 | };
|
32940 | return _extendStatics(d, b);
|
32941 | };
|
32942 | return function (d, b) {
|
32943 | if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
32944 | _extendStatics(d, b);
|
32945 | function __() {
|
32946 | this.constructor = d;
|
32947 | }
|
32948 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
32949 | };
|
32950 | }();
|
32951 | Object.defineProperty(exports, "__esModule", { value: true });
|
32952 | exports.MDCTopAppBarFoundation = void 0;
|
32953 | var constants_1 = __webpack_require__( "./packages/mdc-top-app-bar/constants.ts");
|
32954 | var foundation_1 = __webpack_require__( "./packages/mdc-top-app-bar/foundation.ts");
|
32955 | var INITIAL_VALUE = 0;
|
32956 | var MDCTopAppBarFoundation = function (_super) {
|
32957 | __extends(MDCTopAppBarFoundation, _super);
|
32958 |
|
32959 | function MDCTopAppBarFoundation(adapter) {
|
32960 | var _this = _super.call(this, adapter) || this;
|
32961 | |
32962 |
|
32963 |
|
32964 | _this.wasDocked = true;
|
32965 | |
32966 |
|
32967 |
|
32968 | _this.isDockedShowing = true;
|
32969 | |
32970 |
|
32971 |
|
32972 | _this.currentAppBarOffsetTop = 0;
|
32973 | |
32974 |
|
32975 |
|
32976 | _this.isCurrentlyBeingResized = false;
|
32977 | |
32978 |
|
32979 |
|
32980 | _this.resizeThrottleId = INITIAL_VALUE;
|
32981 | |
32982 |
|
32983 |
|
32984 |
|
32985 | _this.resizeDebounceId = INITIAL_VALUE;
|
32986 | _this.lastScrollPosition = _this.adapter.getViewportScrollY();
|
32987 | _this.topAppBarHeight = _this.adapter.getTopAppBarHeight();
|
32988 | return _this;
|
32989 | }
|
32990 | MDCTopAppBarFoundation.prototype.destroy = function () {
|
32991 | _super.prototype.destroy.call(this);
|
32992 | this.adapter.setStyle('top', '');
|
32993 | };
|
32994 | |
32995 |
|
32996 |
|
32997 |
|
32998 | MDCTopAppBarFoundation.prototype.handleTargetScroll = function () {
|
32999 | var currentScrollPosition = Math.max(this.adapter.getViewportScrollY(), 0);
|
33000 | var diff = currentScrollPosition - this.lastScrollPosition;
|
33001 | this.lastScrollPosition = currentScrollPosition;
|
33002 |
|
33003 |
|
33004 |
|
33005 | if (!this.isCurrentlyBeingResized) {
|
33006 | this.currentAppBarOffsetTop -= diff;
|
33007 | if (this.currentAppBarOffsetTop > 0) {
|
33008 | this.currentAppBarOffsetTop = 0;
|
33009 | } else if (Math.abs(this.currentAppBarOffsetTop) > this.topAppBarHeight) {
|
33010 | this.currentAppBarOffsetTop = -this.topAppBarHeight;
|
33011 | }
|
33012 | this.moveTopAppBar();
|
33013 | }
|
33014 | };
|
33015 | |
33016 |
|
33017 |
|
33018 |
|
33019 | MDCTopAppBarFoundation.prototype.handleWindowResize = function () {
|
33020 | var _this = this;
|
33021 |
|
33022 | if (!this.resizeThrottleId) {
|
33023 | this.resizeThrottleId = setTimeout(function () {
|
33024 | _this.resizeThrottleId = INITIAL_VALUE;
|
33025 | _this.throttledResizeHandler();
|
33026 | }, constants_1.numbers.DEBOUNCE_THROTTLE_RESIZE_TIME_MS);
|
33027 | }
|
33028 | this.isCurrentlyBeingResized = true;
|
33029 | if (this.resizeDebounceId) {
|
33030 | clearTimeout(this.resizeDebounceId);
|
33031 | }
|
33032 | this.resizeDebounceId = setTimeout(function () {
|
33033 | _this.handleTargetScroll();
|
33034 | _this.isCurrentlyBeingResized = false;
|
33035 | _this.resizeDebounceId = INITIAL_VALUE;
|
33036 | }, constants_1.numbers.DEBOUNCE_THROTTLE_RESIZE_TIME_MS);
|
33037 | };
|
33038 | |
33039 |
|
33040 |
|
33041 | MDCTopAppBarFoundation.prototype.checkForUpdate = function () {
|
33042 | var offscreenBoundaryTop = -this.topAppBarHeight;
|
33043 | var hasAnyPixelsOffscreen = this.currentAppBarOffsetTop < 0;
|
33044 | var hasAnyPixelsOnscreen = this.currentAppBarOffsetTop > offscreenBoundaryTop;
|
33045 | var partiallyShowing = hasAnyPixelsOffscreen && hasAnyPixelsOnscreen;
|
33046 |
|
33047 | if (partiallyShowing) {
|
33048 | this.wasDocked = false;
|
33049 | } else {
|
33050 |
|
33051 | if (!this.wasDocked) {
|
33052 | this.wasDocked = true;
|
33053 | return true;
|
33054 | } else if (this.isDockedShowing !== hasAnyPixelsOnscreen) {
|
33055 | this.isDockedShowing = hasAnyPixelsOnscreen;
|
33056 | return true;
|
33057 | }
|
33058 | }
|
33059 | return partiallyShowing;
|
33060 | };
|
33061 | |
33062 |
|
33063 |
|
33064 | MDCTopAppBarFoundation.prototype.moveTopAppBar = function () {
|
33065 | if (this.checkForUpdate()) {
|
33066 |
|
33067 |
|
33068 | var offset = this.currentAppBarOffsetTop;
|
33069 | if (Math.abs(offset) >= this.topAppBarHeight) {
|
33070 | offset = -constants_1.numbers.MAX_TOP_APP_BAR_HEIGHT;
|
33071 | }
|
33072 | this.adapter.setStyle('top', offset + 'px');
|
33073 | }
|
33074 | };
|
33075 | |
33076 |
|
33077 |
|
33078 |
|
33079 | MDCTopAppBarFoundation.prototype.throttledResizeHandler = function () {
|
33080 | var currentHeight = this.adapter.getTopAppBarHeight();
|
33081 | if (this.topAppBarHeight !== currentHeight) {
|
33082 | this.wasDocked = false;
|
33083 |
|
33084 |
|
33085 |
|
33086 | this.currentAppBarOffsetTop -= this.topAppBarHeight - currentHeight;
|
33087 | this.topAppBarHeight = currentHeight;
|
33088 | }
|
33089 | this.handleTargetScroll();
|
33090 | };
|
33091 | return MDCTopAppBarFoundation;
|
33092 | }(foundation_1.MDCTopAppBarBaseFoundation);
|
33093 | exports.MDCTopAppBarFoundation = MDCTopAppBarFoundation;
|
33094 |
|
33095 | exports.default = MDCTopAppBarFoundation;
|
33096 |
|
33097 | })
|
33098 |
|
33099 | });
|
33100 | });
|
33101 |
|
\ | No newline at end of file |