@ptcwebops/ptcw-design 6.3.21 → 6.3.22-beta
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{component-35540bfb.js → component-4dd13907.js} +2643 -832
- package/dist/cjs/featured-list.cjs.entry.js +1 -1
- package/dist/cjs/innovator-toggle-container.cjs.entry.js +1 -1
- package/dist/cjs/jumbotron-sub-menu.cjs.entry.js +1 -1
- package/dist/cjs/list-item.cjs.entry.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/modal-form-example.cjs.entry.js +94 -0
- package/dist/cjs/ptc-back-to-top.cjs.entry.js +1 -16
- package/dist/cjs/ptc-bio-card.cjs.entry.js +5 -20
- package/dist/cjs/ptc-card_2.cjs.entry.js +5 -10
- package/dist/cjs/ptc-case-studies-slider.cjs.entry.js +6 -2
- package/dist/cjs/ptc-close-icon_2.cjs.entry.js +17 -32
- package/dist/cjs/ptc-data-lookup.cjs.entry.js +1 -2
- package/dist/cjs/ptc-dynamic-card.cjs.entry.js +1 -1
- package/dist/cjs/ptc-enhanced-product-listing-card.cjs.entry.js +1 -1
- package/dist/cjs/ptc-featured-list.cjs.entry.js +1 -1
- package/dist/cjs/ptc-filter-level-theater.cjs.entry.js +1 -1
- package/dist/cjs/{ptc-form-checkbox_2.cjs.entry.js → ptc-form-checkbox_4.cjs.entry.js} +787 -5
- package/dist/cjs/ptc-icon-list.cjs.entry.js +1 -1
- package/dist/cjs/ptc-info-tile.cjs.entry.js +1 -2
- package/dist/cjs/ptc-jumbotron.cjs.entry.js +1 -1
- package/dist/cjs/ptc-nav-skip-to-content.cjs.entry.js +3 -28
- package/dist/cjs/ptc-para.cjs.entry.js +1 -1
- package/dist/cjs/ptc-podcast-card.cjs.entry.js +1 -1
- package/dist/cjs/ptc-previous-url.cjs.entry.js +10 -2
- package/dist/cjs/ptc-pricing-packaging-table.cjs.entry.js +11 -9
- package/dist/cjs/ptc-pricing-tabs.cjs.entry.js +1 -1
- package/dist/cjs/ptc-product-card.cjs.entry.js +2 -2
- package/dist/cjs/ptc-product-category.cjs.entry.js +1 -1
- package/dist/cjs/ptc-product-dropdown.cjs.entry.js +2 -2
- package/dist/cjs/ptc-product-highlight-card.cjs.entry.js +1 -1
- package/dist/cjs/ptc-product-list.cjs.entry.js +1 -7
- package/dist/cjs/ptc-product-sidebar.cjs.entry.js +6 -38
- package/dist/cjs/ptc-readmore-char.cjs.entry.js +1 -1
- package/dist/cjs/ptc-readmore-v3.cjs.entry.js +1 -1
- package/dist/cjs/ptc-related-card-rail.cjs.entry.js +32 -90
- package/dist/cjs/ptc-tooltip-v2.cjs.entry.js +1 -1
- package/dist/cjs/ptc-value-led-speed-bump.cjs.entry.js +1 -1
- package/dist/cjs/ptc-white-paper.cjs.entry.js +10 -6
- package/dist/cjs/ptcw-design.cjs.js +1 -1
- package/dist/cjs/tab-header.cjs.entry.js +1 -1
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/icon-asset/media/designer-v6.0.6.svg +30 -2
- package/dist/collection/components/innovator-toggle-container/innovator-toggle-container.css +6 -6
- package/dist/collection/components/jumbotron-sub-menu/jumbotron-sub-menu.css +0 -1
- package/dist/collection/components/list-item/list-item.css +0 -4
- package/dist/collection/components/organism-bundles/bundle-featured-list/featured-list.css +3 -3
- package/dist/collection/components/organism-bundles/form/modal-from-example/modal-form-example.css +26 -0
- package/dist/collection/components/organism-bundles/form/modal-from-example/modal-form-example.js +99 -0
- package/dist/collection/components/ptc-back-to-top/ptc-back-to-top.css +0 -4
- package/dist/collection/components/ptc-back-to-top/ptc-back-to-top.js +0 -15
- package/dist/collection/components/ptc-bio-card/ptc-bio-card.css +6 -10
- package/dist/collection/components/ptc-bio-card/ptc-bio-card.js +4 -19
- package/dist/collection/components/ptc-case-studies-slider/ptc-case-studies-slider.css +6 -6
- package/dist/collection/components/ptc-case-studies-slider/ptc-case-studies-slider.js +5 -1
- package/dist/collection/components/ptc-container/ptc-container.js +2 -2
- package/dist/collection/components/ptc-dynamic-card/ptc-dynamic-card.css +1 -1
- package/dist/collection/components/ptc-enhanced-product-listing-card/ptc-enhanced-product-listing-card.css +0 -16
- package/dist/collection/components/ptc-featured-list/ptc-featured-list.css +6 -6
- package/dist/collection/components/ptc-filter-level-theater/ptc-filter-level-theater.css +6 -6
- package/dist/collection/components/ptc-icon-list/ptc-icon-list.css +0 -3
- package/dist/collection/components/ptc-info-tile/ptc-info-tile.js +1 -20
- package/dist/collection/components/ptc-jumbotron/ptc-jumbotron.css +6 -6
- package/dist/collection/components/ptc-modal/ptc-modal.css +4 -0
- package/dist/collection/components/ptc-modal/ptc-modal.js +18 -50
- package/dist/collection/components/ptc-nav-skip-to-content/ptc-nav-skip-to-content.css +0 -7
- package/dist/collection/components/ptc-nav-skip-to-content/ptc-nav-skip-to-content.js +2 -78
- package/dist/collection/components/ptc-para/ptc-para.css +3 -0
- package/dist/collection/components/ptc-para/ptc-para.js +2 -2
- package/dist/collection/components/ptc-podcast-card/ptc-podcast-card.css +6 -6
- package/dist/collection/components/ptc-preloader-section/ptc-preloader-section.css +0 -419
- package/dist/collection/components/ptc-preloader-section/ptc-preloader-section.js +4 -9
- package/dist/collection/components/ptc-previous-url/ptc-previous-url.css +16 -0
- package/dist/collection/components/ptc-previous-url/ptc-previous-url.js +27 -1
- package/dist/collection/components/ptc-pricing-packaging-table/ptc-pricing-packaging-table.js +11 -9
- package/dist/collection/components/ptc-pricing-tabs/ptc-pricing-tabs.js +1 -1
- package/dist/collection/components/ptc-product-card/ptc-product-card.css +6 -10
- package/dist/collection/components/ptc-product-card/ptc-product-card.js +1 -1
- package/dist/collection/components/ptc-product-category/ptc-product-category.css +6 -6
- package/dist/collection/components/ptc-product-dropdown/ptc-product-dropdown.css +0 -8
- package/dist/collection/components/ptc-product-dropdown/ptc-product-dropdown.js +1 -1
- package/dist/collection/components/ptc-product-highlight-card/ptc-product-highlight-card.css +6 -6
- package/dist/collection/components/ptc-product-list/ptc-product-list.js +1 -7
- package/dist/collection/components/ptc-product-sidebar/ptc-product-sidebar.css +0 -12
- package/dist/collection/components/ptc-product-sidebar/ptc-product-sidebar.js +5 -37
- package/dist/collection/components/ptc-readmore-char/ptc-readmore-char.css +6 -6
- package/dist/collection/components/ptc-readmore-v3/ptc-readmore-v3.css +6 -6
- package/dist/collection/components/ptc-related-card-rail/ptc-related-card-rail.css +2 -1
- package/dist/collection/components/ptc-related-card-rail/ptc-related-card-rail.js +33 -113
- package/dist/collection/components/ptc-textfield/ptc-textfield.js +19 -19
- package/dist/collection/components/ptc-tooltip-v2/ptc-tooltip-v2.css +6 -6
- package/dist/collection/components/ptc-value-led-speed-bump/ptc-value-led-speed-bump.css +6 -6
- package/dist/collection/components/ptc-white-paper/ptc-white-paper.css +6 -6
- package/dist/collection/components/ptc-white-paper/ptc-white-paper.js +9 -5
- package/dist/collection/components/tab-header/tab-header.js +1 -1
- package/dist/collection/stories/Card.stories.js +148 -3
- package/dist/collection/stories/Link.stories.js +13 -25
- package/dist/collection/stories/Paragraph.stories.js +10 -18
- package/dist/collection/stories/Select.stories.js +8 -5
- package/dist/collection/stories/Textfield.stories.js +28 -71
- package/dist/collection/stories/Title.stories.js +16 -28
- package/dist/collection/stories/organisms/eSupport/CaseTracker/preview.stories.js +45 -0
- package/dist/collection/stories/organisms/eSupport/SupportArticle/preview.stories.js +47 -0
- package/dist/collection/stories/organisms/eSupport/SupportPage/preview.stories.js +157 -0
- package/dist/custom-elements/index.d.ts +6 -0
- package/dist/custom-elements/index.js +230 -293
- package/dist/esm/{component-8c53e377.js → component-9c921cc6.js} +2592 -793
- package/dist/esm/featured-list.entry.js +1 -1
- package/dist/esm/innovator-toggle-container.entry.js +1 -1
- package/dist/esm/jumbotron-sub-menu.entry.js +1 -1
- package/dist/esm/list-item.entry.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/modal-form-example.entry.js +90 -0
- package/dist/esm/ptc-back-to-top.entry.js +1 -16
- package/dist/esm/ptc-bio-card.entry.js +5 -20
- package/dist/esm/ptc-card_2.entry.js +5 -10
- package/dist/esm/ptc-case-studies-slider.entry.js +6 -2
- package/dist/esm/ptc-close-icon_2.entry.js +17 -32
- package/dist/esm/ptc-data-lookup.entry.js +1 -2
- package/dist/esm/ptc-dynamic-card.entry.js +1 -1
- package/dist/esm/ptc-enhanced-product-listing-card.entry.js +1 -1
- package/dist/esm/ptc-featured-list.entry.js +1 -1
- package/dist/esm/ptc-filter-level-theater.entry.js +1 -1
- package/dist/esm/{ptc-form-checkbox_2.entry.js → ptc-form-checkbox_4.entry.js} +784 -4
- package/dist/esm/ptc-icon-list.entry.js +1 -1
- package/dist/esm/ptc-info-tile.entry.js +1 -2
- package/dist/esm/ptc-jumbotron.entry.js +1 -1
- package/dist/esm/ptc-nav-skip-to-content.entry.js +3 -28
- package/dist/esm/ptc-para.entry.js +1 -1
- package/dist/esm/ptc-podcast-card.entry.js +1 -1
- package/dist/esm/ptc-previous-url.entry.js +10 -2
- package/dist/esm/ptc-pricing-packaging-table.entry.js +11 -9
- package/dist/esm/ptc-pricing-tabs.entry.js +1 -1
- package/dist/esm/ptc-product-card.entry.js +2 -2
- package/dist/esm/ptc-product-category.entry.js +1 -1
- package/dist/esm/ptc-product-dropdown.entry.js +2 -2
- package/dist/esm/ptc-product-highlight-card.entry.js +1 -1
- package/dist/esm/ptc-product-list.entry.js +1 -7
- package/dist/esm/ptc-product-sidebar.entry.js +6 -38
- package/dist/esm/ptc-readmore-char.entry.js +1 -1
- package/dist/esm/ptc-readmore-v3.entry.js +1 -1
- package/dist/esm/ptc-related-card-rail.entry.js +32 -90
- package/dist/esm/ptc-tooltip-v2.entry.js +1 -1
- package/dist/esm/ptc-value-led-speed-bump.entry.js +1 -1
- package/dist/esm/ptc-white-paper.entry.js +10 -6
- package/dist/esm/ptcw-design.js +1 -1
- package/dist/esm/tab-header.entry.js +1 -1
- package/dist/ptcw-design/media/designer-v6.0.6.svg +30 -2
- package/dist/ptcw-design/{p-752bba1c.entry.js → p-0529caaa.entry.js} +1 -1
- package/dist/ptcw-design/p-072a76d3.entry.js +1 -0
- package/dist/ptcw-design/{p-a791c53a.entry.js → p-0b515839.entry.js} +1 -1
- package/dist/ptcw-design/p-0d223232.entry.js +1 -0
- package/dist/ptcw-design/p-0de4cd11.entry.js +1 -0
- package/dist/ptcw-design/p-21aa746d.entry.js +1 -0
- package/dist/ptcw-design/{p-24776ca2.entry.js → p-2cc7e2a8.entry.js} +1 -1
- package/dist/ptcw-design/p-32f64f48.entry.js +1 -0
- package/dist/ptcw-design/p-3dac861d.entry.js +1 -0
- package/dist/ptcw-design/{p-d089dc37.entry.js → p-3dd0ded9.entry.js} +1 -1
- package/dist/ptcw-design/{p-4d8f6f46.entry.js → p-445329ed.entry.js} +1 -1
- package/dist/ptcw-design/{p-68ed2afe.entry.js → p-48c5eab8.entry.js} +1 -1
- package/dist/ptcw-design/p-4b192f5e.entry.js +1 -0
- package/dist/ptcw-design/p-4f93c631.entry.js +1 -0
- package/dist/ptcw-design/p-5311c6e1.entry.js +1 -0
- package/dist/ptcw-design/p-58e91cb8.entry.js +1 -0
- package/dist/ptcw-design/p-5db7f70b.entry.js +1 -0
- package/dist/ptcw-design/p-67c248ec.entry.js +1 -0
- package/dist/ptcw-design/p-71fbb799.entry.js +1 -0
- package/dist/ptcw-design/p-75390f63.entry.js +1 -0
- package/dist/ptcw-design/{p-e3b1af2b.entry.js → p-7793babb.entry.js} +1 -1
- package/dist/ptcw-design/p-799afee5.entry.js +1 -0
- package/dist/ptcw-design/p-8038bf31.entry.js +1 -0
- package/dist/ptcw-design/p-9501995f.entry.js +1 -0
- package/dist/ptcw-design/p-97b9f41b.entry.js +1 -0
- package/dist/ptcw-design/p-99ee8a0e.entry.js +1 -0
- package/dist/ptcw-design/p-9d612f1f.entry.js +1 -0
- package/dist/ptcw-design/p-a89b986a.entry.js +68 -0
- package/dist/ptcw-design/p-b50f71dd.entry.js +1 -0
- package/dist/ptcw-design/{p-757954b2.entry.js → p-b570e9a5.entry.js} +1 -1
- package/dist/ptcw-design/p-baff4d44.entry.js +1 -0
- package/dist/ptcw-design/p-bcab66bf.js +336 -0
- package/dist/ptcw-design/p-c788f16f.entry.js +1 -0
- package/dist/ptcw-design/{p-18ac526f.entry.js → p-d73cc053.entry.js} +1 -1
- package/dist/ptcw-design/p-de960790.entry.js +1 -0
- package/dist/ptcw-design/p-e6a272d9.entry.js +1 -0
- package/dist/ptcw-design/p-f1734520.entry.js +1 -0
- package/dist/ptcw-design/{p-0ddf2a09.entry.js → p-f867ebe6.entry.js} +1 -1
- package/dist/ptcw-design/p-fe40421e.entry.js +1 -0
- package/dist/ptcw-design/ptcw-design.css +2 -2
- package/dist/ptcw-design/ptcw-design.esm.js +1 -1
- package/dist/types/components/organism-bundles/form/modal-from-example/modal-form-example.d.ts +25 -0
- package/dist/types/components/ptc-bio-card/ptc-bio-card.d.ts +1 -1
- package/dist/types/components/ptc-container/ptc-container.d.ts +1 -1
- package/dist/types/components/ptc-info-tile/ptc-info-tile.d.ts +0 -1
- package/dist/types/components/ptc-mobile-select/mobile-select/dist/mobile-select.d.ts +209 -0
- package/dist/types/components/ptc-modal/ptc-modal.d.ts +2 -2
- package/dist/types/components/ptc-nav-skip-to-content/ptc-nav-skip-to-content.d.ts +0 -6
- package/dist/types/components/ptc-para/ptc-para.d.ts +1 -1
- package/dist/types/components/ptc-previous-url/ptc-previous-url.d.ts +2 -0
- package/dist/types/components/ptc-product-list/ptc-product-list.d.ts +1 -1
- package/dist/types/components/ptc-product-sidebar/ptc-product-sidebar.d.ts +3 -6
- package/dist/types/components/ptc-related-card-rail/ptc-related-card-rail.d.ts +5 -12
- package/dist/types/components/ptc-textfield/ptc-textfield.d.ts +0 -54
- package/dist/types/components.d.ts +21 -126
- package/dist/types/utils/eloqua.d.ts +9 -0
- package/package.json +2 -6
- package/readme.md +5 -1
- package/dist/cjs/component-1b8ad4d2.js +0 -1819
- package/dist/cjs/ptc-multi-select_2.cjs.entry.js +0 -670
- package/dist/cjs/validation-messages-33a4f26b.js +0 -126
- package/dist/collection/stories/Jumbotron.stories.js +0 -763
- package/dist/esm/component-9beac35b.js +0 -1802
- package/dist/esm/ptc-multi-select_2.entry.js +0 -665
- package/dist/esm/validation-messages-adbb6518.js +0 -124
- package/dist/ptcw-design/p-00e21489.entry.js +0 -1
- package/dist/ptcw-design/p-05c29cc2.entry.js +0 -1
- package/dist/ptcw-design/p-13e338a5.entry.js +0 -1
- package/dist/ptcw-design/p-1454ba84.entry.js +0 -1
- package/dist/ptcw-design/p-18a5a338.js +0 -1
- package/dist/ptcw-design/p-352e87c0.entry.js +0 -1
- package/dist/ptcw-design/p-38e5e590.entry.js +0 -1
- package/dist/ptcw-design/p-4737a0f6.entry.js +0 -1
- package/dist/ptcw-design/p-4ca956c1.entry.js +0 -1
- package/dist/ptcw-design/p-593b8eff.entry.js +0 -1
- package/dist/ptcw-design/p-73a853fc.entry.js +0 -1
- package/dist/ptcw-design/p-75431fa1.entry.js +0 -1
- package/dist/ptcw-design/p-98426799.js +0 -203
- package/dist/ptcw-design/p-98844b50.js +0 -134
- package/dist/ptcw-design/p-a2c7df64.entry.js +0 -1
- package/dist/ptcw-design/p-a58698ca.entry.js +0 -1
- package/dist/ptcw-design/p-acdd9a1d.entry.js +0 -1
- package/dist/ptcw-design/p-ad821a01.entry.js +0 -1
- package/dist/ptcw-design/p-b6255525.entry.js +0 -1
- package/dist/ptcw-design/p-b7fa9f2c.entry.js +0 -1
- package/dist/ptcw-design/p-b963ec8c.entry.js +0 -68
- package/dist/ptcw-design/p-bb9a879f.entry.js +0 -1
- package/dist/ptcw-design/p-bf84ecc0.entry.js +0 -1
- package/dist/ptcw-design/p-c82eaf9d.entry.js +0 -1
- package/dist/ptcw-design/p-cad4b517.entry.js +0 -1
- package/dist/ptcw-design/p-d6845e91.entry.js +0 -1
- package/dist/ptcw-design/p-db1dcce0.entry.js +0 -1
- package/dist/ptcw-design/p-ddb898c7.entry.js +0 -1
- package/dist/ptcw-design/p-e6619d63.entry.js +0 -1
- package/dist/ptcw-design/p-f9256e3d.entry.js +0 -1
- package/dist/ptcw-design/p-fbd9c8fc.entry.js +0 -1
|
@@ -1,8 +1,92 @@
|
|
|
1
|
-
|
|
1
|
+
/******************************************************************************
|
|
2
|
+
Copyright (c) Microsoft Corporation.
|
|
3
|
+
|
|
4
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
5
|
+
purpose with or without fee is hereby granted.
|
|
6
|
+
|
|
7
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
8
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
9
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
10
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
11
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
12
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
13
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
14
|
+
***************************************************************************** */
|
|
15
|
+
/* global Reflect, Promise, SuppressedError, Symbol */
|
|
16
|
+
|
|
17
|
+
var extendStatics = function(d, b) {
|
|
18
|
+
extendStatics = Object.setPrototypeOf ||
|
|
19
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
20
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
21
|
+
return extendStatics(d, b);
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
function __extends(d, b) {
|
|
25
|
+
if (typeof b !== "function" && b !== null)
|
|
26
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
27
|
+
extendStatics(d, b);
|
|
28
|
+
function __() { this.constructor = d; }
|
|
29
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
var __assign = function() {
|
|
33
|
+
__assign = Object.assign || function __assign(t) {
|
|
34
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
35
|
+
s = arguments[i];
|
|
36
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
37
|
+
}
|
|
38
|
+
return t;
|
|
39
|
+
};
|
|
40
|
+
return __assign.apply(this, arguments);
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
function __values(o) {
|
|
44
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
45
|
+
if (m) return m.call(o);
|
|
46
|
+
if (o && typeof o.length === "number") return {
|
|
47
|
+
next: function () {
|
|
48
|
+
if (o && i >= o.length) o = void 0;
|
|
49
|
+
return { value: o && o[i++], done: !o };
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function __read(o, n) {
|
|
56
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
57
|
+
if (!m) return o;
|
|
58
|
+
var i = m.call(o), r, ar = [], e;
|
|
59
|
+
try {
|
|
60
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
61
|
+
}
|
|
62
|
+
catch (error) { e = { error: error }; }
|
|
63
|
+
finally {
|
|
64
|
+
try {
|
|
65
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
66
|
+
}
|
|
67
|
+
finally { if (e) throw e.error; }
|
|
68
|
+
}
|
|
69
|
+
return ar;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function __spreadArray(to, from, pack) {
|
|
73
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
74
|
+
if (ar || !(i in from)) {
|
|
75
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
76
|
+
ar[i] = from[i];
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
83
|
+
var e = new Error(message);
|
|
84
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
85
|
+
};
|
|
2
86
|
|
|
3
87
|
/**
|
|
4
88
|
* @license
|
|
5
|
-
* Copyright
|
|
89
|
+
* Copyright 2016 Google Inc.
|
|
6
90
|
*
|
|
7
91
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
92
|
* of this software and associated documentation files (the "Software"), to deal
|
|
@@ -22,86 +106,60 @@ import { _ as __extends, a as __assign, b as __read, c as __spreadArray, M as MD
|
|
|
22
106
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
23
107
|
* THE SOFTWARE.
|
|
24
108
|
*/
|
|
25
|
-
var
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
*/
|
|
76
|
-
var CornerBit;
|
|
77
|
-
(function (CornerBit) {
|
|
78
|
-
CornerBit[CornerBit["BOTTOM"] = 1] = "BOTTOM";
|
|
79
|
-
CornerBit[CornerBit["CENTER"] = 2] = "CENTER";
|
|
80
|
-
CornerBit[CornerBit["RIGHT"] = 4] = "RIGHT";
|
|
81
|
-
CornerBit[CornerBit["FLIP_RTL"] = 8] = "FLIP_RTL";
|
|
82
|
-
})(CornerBit || (CornerBit = {}));
|
|
83
|
-
/**
|
|
84
|
-
* Enum for representing an element corner for positioning the menu-surface.
|
|
85
|
-
*
|
|
86
|
-
* The START constants map to LEFT if element directionality is left
|
|
87
|
-
* to right and RIGHT if the directionality is right to left.
|
|
88
|
-
* Likewise END maps to RIGHT or LEFT depending on the directionality.
|
|
89
|
-
*/
|
|
90
|
-
var Corner;
|
|
91
|
-
(function (Corner) {
|
|
92
|
-
Corner[Corner["TOP_LEFT"] = 0] = "TOP_LEFT";
|
|
93
|
-
Corner[Corner["TOP_RIGHT"] = 4] = "TOP_RIGHT";
|
|
94
|
-
Corner[Corner["BOTTOM_LEFT"] = 1] = "BOTTOM_LEFT";
|
|
95
|
-
Corner[Corner["BOTTOM_RIGHT"] = 5] = "BOTTOM_RIGHT";
|
|
96
|
-
Corner[Corner["TOP_START"] = 8] = "TOP_START";
|
|
97
|
-
Corner[Corner["TOP_END"] = 12] = "TOP_END";
|
|
98
|
-
Corner[Corner["BOTTOM_START"] = 9] = "BOTTOM_START";
|
|
99
|
-
Corner[Corner["BOTTOM_END"] = 13] = "BOTTOM_END";
|
|
100
|
-
})(Corner || (Corner = {}));
|
|
109
|
+
var MDCFoundation = /** @class */ (function () {
|
|
110
|
+
function MDCFoundation(adapter) {
|
|
111
|
+
if (adapter === void 0) { adapter = {}; }
|
|
112
|
+
this.adapter = adapter;
|
|
113
|
+
}
|
|
114
|
+
Object.defineProperty(MDCFoundation, "cssClasses", {
|
|
115
|
+
get: function () {
|
|
116
|
+
// Classes extending MDCFoundation should implement this method to return an object which exports every
|
|
117
|
+
// CSS class the foundation class needs as a property. e.g. {ACTIVE: 'mdc-component--active'}
|
|
118
|
+
return {};
|
|
119
|
+
},
|
|
120
|
+
enumerable: false,
|
|
121
|
+
configurable: true
|
|
122
|
+
});
|
|
123
|
+
Object.defineProperty(MDCFoundation, "strings", {
|
|
124
|
+
get: function () {
|
|
125
|
+
// Classes extending MDCFoundation should implement this method to return an object which exports all
|
|
126
|
+
// semantic strings as constants. e.g. {ARIA_ROLE: 'tablist'}
|
|
127
|
+
return {};
|
|
128
|
+
},
|
|
129
|
+
enumerable: false,
|
|
130
|
+
configurable: true
|
|
131
|
+
});
|
|
132
|
+
Object.defineProperty(MDCFoundation, "numbers", {
|
|
133
|
+
get: function () {
|
|
134
|
+
// Classes extending MDCFoundation should implement this method to return an object which exports all
|
|
135
|
+
// of its semantic numbers as constants. e.g. {ANIMATION_DELAY_MS: 350}
|
|
136
|
+
return {};
|
|
137
|
+
},
|
|
138
|
+
enumerable: false,
|
|
139
|
+
configurable: true
|
|
140
|
+
});
|
|
141
|
+
Object.defineProperty(MDCFoundation, "defaultAdapter", {
|
|
142
|
+
get: function () {
|
|
143
|
+
// Classes extending MDCFoundation may choose to implement this getter in order to provide a convenient
|
|
144
|
+
// way of viewing the necessary methods of an adapter. In the future, this could also be used for adapter
|
|
145
|
+
// validation.
|
|
146
|
+
return {};
|
|
147
|
+
},
|
|
148
|
+
enumerable: false,
|
|
149
|
+
configurable: true
|
|
150
|
+
});
|
|
151
|
+
MDCFoundation.prototype.init = function () {
|
|
152
|
+
// Subclasses should override this method to perform initialization routines (registering events, etc.)
|
|
153
|
+
};
|
|
154
|
+
MDCFoundation.prototype.destroy = function () {
|
|
155
|
+
// Subclasses should override this method to perform de-initialization routines (de-registering events, etc.)
|
|
156
|
+
};
|
|
157
|
+
return MDCFoundation;
|
|
158
|
+
}());
|
|
101
159
|
|
|
102
160
|
/**
|
|
103
161
|
* @license
|
|
104
|
-
* Copyright
|
|
162
|
+
* Copyright 2016 Google Inc.
|
|
105
163
|
*
|
|
106
164
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
107
165
|
* of this software and associated documentation files (the "Software"), to deal
|
|
@@ -121,64 +179,86 @@ var Corner;
|
|
|
121
179
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
122
180
|
* THE SOFTWARE.
|
|
123
181
|
*/
|
|
124
|
-
var
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
};
|
|
177
|
-
|
|
182
|
+
var MDCComponent = /** @class */ (function () {
|
|
183
|
+
function MDCComponent(root, foundation) {
|
|
184
|
+
var args = [];
|
|
185
|
+
for (var _i = 2; _i < arguments.length; _i++) {
|
|
186
|
+
args[_i - 2] = arguments[_i];
|
|
187
|
+
}
|
|
188
|
+
this.root = root;
|
|
189
|
+
this.initialize.apply(this, __spreadArray([], __read(args)));
|
|
190
|
+
// Note that we initialize foundation here and not within the constructor's
|
|
191
|
+
// default param so that this.root is defined and can be used within the
|
|
192
|
+
// foundation class.
|
|
193
|
+
this.foundation =
|
|
194
|
+
foundation === undefined ? this.getDefaultFoundation() : foundation;
|
|
195
|
+
this.foundation.init();
|
|
196
|
+
this.initialSyncWithDOM();
|
|
197
|
+
}
|
|
198
|
+
MDCComponent.attachTo = function (root) {
|
|
199
|
+
// Subclasses which extend MDCBase should provide an attachTo() method that takes a root element and
|
|
200
|
+
// returns an instantiated component with its root set to that element. Also note that in the cases of
|
|
201
|
+
// subclasses, an explicit foundation class will not have to be passed in; it will simply be initialized
|
|
202
|
+
// from getDefaultFoundation().
|
|
203
|
+
return new MDCComponent(root, new MDCFoundation({}));
|
|
204
|
+
};
|
|
205
|
+
/* istanbul ignore next: method param only exists for typing purposes; it does not need to be unit tested */
|
|
206
|
+
MDCComponent.prototype.initialize = function () {
|
|
207
|
+
var _args = [];
|
|
208
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
209
|
+
_args[_i] = arguments[_i];
|
|
210
|
+
}
|
|
211
|
+
// Subclasses can override this to do any additional setup work that would be considered part of a
|
|
212
|
+
// "constructor". Essentially, it is a hook into the parent constructor before the foundation is
|
|
213
|
+
// initialized. Any additional arguments besides root and foundation will be passed in here.
|
|
214
|
+
};
|
|
215
|
+
MDCComponent.prototype.getDefaultFoundation = function () {
|
|
216
|
+
// Subclasses must override this method to return a properly configured foundation class for the
|
|
217
|
+
// component.
|
|
218
|
+
throw new Error('Subclasses must override getDefaultFoundation to return a properly configured ' +
|
|
219
|
+
'foundation class');
|
|
220
|
+
};
|
|
221
|
+
MDCComponent.prototype.initialSyncWithDOM = function () {
|
|
222
|
+
// Subclasses should override this method if they need to perform work to synchronize with a host DOM
|
|
223
|
+
// object. An example of this would be a form control wrapper that needs to synchronize its internal state
|
|
224
|
+
// to some property or attribute of the host DOM. Please note: this is *not* the place to perform DOM
|
|
225
|
+
// reads/writes that would cause layout / paint, as this is called synchronously from within the constructor.
|
|
226
|
+
};
|
|
227
|
+
MDCComponent.prototype.destroy = function () {
|
|
228
|
+
// Subclasses may implement this method to release any resources / deregister any listeners they have
|
|
229
|
+
// attached. An example of this might be deregistering a resize event from the window object.
|
|
230
|
+
this.foundation.destroy();
|
|
231
|
+
};
|
|
232
|
+
MDCComponent.prototype.listen = function (evtType, handler, options) {
|
|
233
|
+
this.root.addEventListener(evtType, handler, options);
|
|
234
|
+
};
|
|
235
|
+
MDCComponent.prototype.unlisten = function (evtType, handler, options) {
|
|
236
|
+
this.root.removeEventListener(evtType, handler, options);
|
|
237
|
+
};
|
|
238
|
+
/**
|
|
239
|
+
* Fires a cross-browser-compatible custom event from the component root of the given type, with the given data.
|
|
240
|
+
*/
|
|
241
|
+
MDCComponent.prototype.emit = function (evtType, evtData, shouldBubble) {
|
|
242
|
+
if (shouldBubble === void 0) { shouldBubble = false; }
|
|
243
|
+
var evt;
|
|
244
|
+
if (typeof CustomEvent === 'function') {
|
|
245
|
+
evt = new CustomEvent(evtType, {
|
|
246
|
+
bubbles: shouldBubble,
|
|
247
|
+
detail: evtData,
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
else {
|
|
251
|
+
evt = document.createEvent('CustomEvent');
|
|
252
|
+
evt.initCustomEvent(evtType, shouldBubble, false, evtData);
|
|
253
|
+
}
|
|
254
|
+
this.root.dispatchEvent(evt);
|
|
255
|
+
};
|
|
256
|
+
return MDCComponent;
|
|
257
|
+
}());
|
|
178
258
|
|
|
179
259
|
/**
|
|
180
260
|
* @license
|
|
181
|
-
* Copyright
|
|
261
|
+
* Copyright 2018 Google Inc.
|
|
182
262
|
*
|
|
183
263
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
184
264
|
* of this software and associated documentation files (the "Software"), to deal
|
|
@@ -199,106 +279,57 @@ var evolutionAttribute = 'evolution';
|
|
|
199
279
|
* THE SOFTWARE.
|
|
200
280
|
*/
|
|
201
281
|
/**
|
|
202
|
-
*
|
|
282
|
+
* @fileoverview A "ponyfill" is a polyfill that doesn't modify the global prototype chain.
|
|
283
|
+
* This makes ponyfills safer than traditional polyfills, especially for libraries like MDC.
|
|
203
284
|
*/
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
// by hand.
|
|
224
|
-
normalizedKeys.add(KEY.BACKSPACE);
|
|
225
|
-
normalizedKeys.add(KEY.ENTER);
|
|
226
|
-
normalizedKeys.add(KEY.SPACEBAR);
|
|
227
|
-
normalizedKeys.add(KEY.PAGE_UP);
|
|
228
|
-
normalizedKeys.add(KEY.PAGE_DOWN);
|
|
229
|
-
normalizedKeys.add(KEY.END);
|
|
230
|
-
normalizedKeys.add(KEY.HOME);
|
|
231
|
-
normalizedKeys.add(KEY.ARROW_LEFT);
|
|
232
|
-
normalizedKeys.add(KEY.ARROW_UP);
|
|
233
|
-
normalizedKeys.add(KEY.ARROW_RIGHT);
|
|
234
|
-
normalizedKeys.add(KEY.ARROW_DOWN);
|
|
235
|
-
normalizedKeys.add(KEY.DELETE);
|
|
236
|
-
normalizedKeys.add(KEY.ESCAPE);
|
|
237
|
-
normalizedKeys.add(KEY.TAB);
|
|
238
|
-
var KEY_CODE = {
|
|
239
|
-
BACKSPACE: 8,
|
|
240
|
-
ENTER: 13,
|
|
241
|
-
SPACEBAR: 32,
|
|
242
|
-
PAGE_UP: 33,
|
|
243
|
-
PAGE_DOWN: 34,
|
|
244
|
-
END: 35,
|
|
245
|
-
HOME: 36,
|
|
246
|
-
ARROW_LEFT: 37,
|
|
247
|
-
ARROW_UP: 38,
|
|
248
|
-
ARROW_RIGHT: 39,
|
|
249
|
-
ARROW_DOWN: 40,
|
|
250
|
-
DELETE: 46,
|
|
251
|
-
ESCAPE: 27,
|
|
252
|
-
TAB: 9,
|
|
253
|
-
};
|
|
254
|
-
var mappedKeyCodes = new Map();
|
|
255
|
-
// IE11 has no support for new Map with iterable so we need to initialize this
|
|
256
|
-
// by hand.
|
|
257
|
-
mappedKeyCodes.set(KEY_CODE.BACKSPACE, KEY.BACKSPACE);
|
|
258
|
-
mappedKeyCodes.set(KEY_CODE.ENTER, KEY.ENTER);
|
|
259
|
-
mappedKeyCodes.set(KEY_CODE.SPACEBAR, KEY.SPACEBAR);
|
|
260
|
-
mappedKeyCodes.set(KEY_CODE.PAGE_UP, KEY.PAGE_UP);
|
|
261
|
-
mappedKeyCodes.set(KEY_CODE.PAGE_DOWN, KEY.PAGE_DOWN);
|
|
262
|
-
mappedKeyCodes.set(KEY_CODE.END, KEY.END);
|
|
263
|
-
mappedKeyCodes.set(KEY_CODE.HOME, KEY.HOME);
|
|
264
|
-
mappedKeyCodes.set(KEY_CODE.ARROW_LEFT, KEY.ARROW_LEFT);
|
|
265
|
-
mappedKeyCodes.set(KEY_CODE.ARROW_UP, KEY.ARROW_UP);
|
|
266
|
-
mappedKeyCodes.set(KEY_CODE.ARROW_RIGHT, KEY.ARROW_RIGHT);
|
|
267
|
-
mappedKeyCodes.set(KEY_CODE.ARROW_DOWN, KEY.ARROW_DOWN);
|
|
268
|
-
mappedKeyCodes.set(KEY_CODE.DELETE, KEY.DELETE);
|
|
269
|
-
mappedKeyCodes.set(KEY_CODE.ESCAPE, KEY.ESCAPE);
|
|
270
|
-
mappedKeyCodes.set(KEY_CODE.TAB, KEY.TAB);
|
|
271
|
-
var navigationKeys = new Set();
|
|
272
|
-
// IE11 has no support for new Set with iterable so we need to initialize this
|
|
273
|
-
// by hand.
|
|
274
|
-
navigationKeys.add(KEY.PAGE_UP);
|
|
275
|
-
navigationKeys.add(KEY.PAGE_DOWN);
|
|
276
|
-
navigationKeys.add(KEY.END);
|
|
277
|
-
navigationKeys.add(KEY.HOME);
|
|
278
|
-
navigationKeys.add(KEY.ARROW_LEFT);
|
|
279
|
-
navigationKeys.add(KEY.ARROW_UP);
|
|
280
|
-
navigationKeys.add(KEY.ARROW_RIGHT);
|
|
281
|
-
navigationKeys.add(KEY.ARROW_DOWN);
|
|
285
|
+
function closest(element, selector) {
|
|
286
|
+
if (element.closest) {
|
|
287
|
+
return element.closest(selector);
|
|
288
|
+
}
|
|
289
|
+
var el = element;
|
|
290
|
+
while (el) {
|
|
291
|
+
if (matches(el, selector)) {
|
|
292
|
+
return el;
|
|
293
|
+
}
|
|
294
|
+
el = el.parentElement;
|
|
295
|
+
}
|
|
296
|
+
return null;
|
|
297
|
+
}
|
|
298
|
+
function matches(element, selector) {
|
|
299
|
+
var nativeMatches = element.matches
|
|
300
|
+
|| element.webkitMatchesSelector
|
|
301
|
+
|| element.msMatchesSelector;
|
|
302
|
+
return nativeMatches.call(element, selector);
|
|
303
|
+
}
|
|
282
304
|
/**
|
|
283
|
-
*
|
|
305
|
+
* Used to compute the estimated scroll width of elements. When an element is
|
|
306
|
+
* hidden due to display: none; being applied to a parent element, the width is
|
|
307
|
+
* returned as 0. However, the element will have a true width once no longer
|
|
308
|
+
* inside a display: none context. This method computes an estimated width when
|
|
309
|
+
* the element is hidden or returns the true width when the element is visble.
|
|
310
|
+
* @param {Element} element the element whose width to estimate
|
|
284
311
|
*/
|
|
285
|
-
function
|
|
286
|
-
|
|
287
|
-
//
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
if (mappedKey) {
|
|
294
|
-
return mappedKey;
|
|
312
|
+
function estimateScrollWidth(element) {
|
|
313
|
+
// Check the offsetParent. If the element inherits display: none from any
|
|
314
|
+
// parent, the offsetParent property will be null (see
|
|
315
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/offsetParent).
|
|
316
|
+
// This check ensures we only clone the node when necessary.
|
|
317
|
+
var htmlEl = element;
|
|
318
|
+
if (htmlEl.offsetParent !== null) {
|
|
319
|
+
return htmlEl.scrollWidth;
|
|
295
320
|
}
|
|
296
|
-
|
|
321
|
+
var clone = htmlEl.cloneNode(true);
|
|
322
|
+
clone.style.setProperty('position', 'absolute');
|
|
323
|
+
clone.style.setProperty('transform', 'translate(-9999px, -9999px)');
|
|
324
|
+
document.documentElement.appendChild(clone);
|
|
325
|
+
var scrollWidth = clone.scrollWidth;
|
|
326
|
+
document.documentElement.removeChild(clone);
|
|
327
|
+
return scrollWidth;
|
|
297
328
|
}
|
|
298
329
|
|
|
299
330
|
/**
|
|
300
331
|
* @license
|
|
301
|
-
* Copyright
|
|
332
|
+
* Copyright 2016 Google Inc.
|
|
302
333
|
*
|
|
303
334
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
304
335
|
* of this software and associated documentation files (the "Software"), to deal
|
|
@@ -318,27 +349,131 @@ function normalizeKey(evt) {
|
|
|
318
349
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
319
350
|
* THE SOFTWARE.
|
|
320
351
|
*/
|
|
321
|
-
var
|
|
352
|
+
var cssClasses$8 = {
|
|
353
|
+
LABEL_FLOAT_ABOVE: 'mdc-floating-label--float-above',
|
|
354
|
+
LABEL_REQUIRED: 'mdc-floating-label--required',
|
|
355
|
+
LABEL_SHAKE: 'mdc-floating-label--shake',
|
|
356
|
+
ROOT: 'mdc-floating-label',
|
|
357
|
+
};
|
|
358
|
+
|
|
322
359
|
/**
|
|
323
|
-
*
|
|
324
|
-
*
|
|
360
|
+
* @license
|
|
361
|
+
* Copyright 2016 Google Inc.
|
|
325
362
|
*
|
|
326
|
-
*
|
|
363
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
364
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
365
|
+
* in the Software without restriction, including without limitation the rights
|
|
366
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
367
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
368
|
+
* furnished to do so, subject to the following conditions:
|
|
369
|
+
*
|
|
370
|
+
* The above copyright notice and this permission notice shall be included in
|
|
371
|
+
* all copies or substantial portions of the Software.
|
|
372
|
+
*
|
|
373
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
374
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
375
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
376
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
377
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
378
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
379
|
+
* THE SOFTWARE.
|
|
327
380
|
*/
|
|
328
|
-
var
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
381
|
+
var MDCFloatingLabelFoundation = /** @class */ (function (_super) {
|
|
382
|
+
__extends(MDCFloatingLabelFoundation, _super);
|
|
383
|
+
function MDCFloatingLabelFoundation(adapter) {
|
|
384
|
+
var _this = _super.call(this, __assign(__assign({}, MDCFloatingLabelFoundation.defaultAdapter), adapter)) || this;
|
|
385
|
+
_this.shakeAnimationEndHandler = function () {
|
|
386
|
+
_this.handleShakeAnimationEnd();
|
|
387
|
+
};
|
|
388
|
+
return _this;
|
|
336
389
|
}
|
|
337
|
-
|
|
390
|
+
Object.defineProperty(MDCFloatingLabelFoundation, "cssClasses", {
|
|
391
|
+
get: function () {
|
|
392
|
+
return cssClasses$8;
|
|
393
|
+
},
|
|
394
|
+
enumerable: false,
|
|
395
|
+
configurable: true
|
|
396
|
+
});
|
|
397
|
+
Object.defineProperty(MDCFloatingLabelFoundation, "defaultAdapter", {
|
|
398
|
+
/**
|
|
399
|
+
* See {@link MDCFloatingLabelAdapter} for typing information on parameters and return types.
|
|
400
|
+
*/
|
|
401
|
+
get: function () {
|
|
402
|
+
// tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
|
|
403
|
+
return {
|
|
404
|
+
addClass: function () { return undefined; },
|
|
405
|
+
removeClass: function () { return undefined; },
|
|
406
|
+
getWidth: function () { return 0; },
|
|
407
|
+
registerInteractionHandler: function () { return undefined; },
|
|
408
|
+
deregisterInteractionHandler: function () { return undefined; },
|
|
409
|
+
};
|
|
410
|
+
// tslint:enable:object-literal-sort-keys
|
|
411
|
+
},
|
|
412
|
+
enumerable: false,
|
|
413
|
+
configurable: true
|
|
414
|
+
});
|
|
415
|
+
MDCFloatingLabelFoundation.prototype.init = function () {
|
|
416
|
+
this.adapter.registerInteractionHandler('animationend', this.shakeAnimationEndHandler);
|
|
417
|
+
};
|
|
418
|
+
MDCFloatingLabelFoundation.prototype.destroy = function () {
|
|
419
|
+
this.adapter.deregisterInteractionHandler('animationend', this.shakeAnimationEndHandler);
|
|
420
|
+
};
|
|
421
|
+
/**
|
|
422
|
+
* Returns the width of the label element.
|
|
423
|
+
*/
|
|
424
|
+
MDCFloatingLabelFoundation.prototype.getWidth = function () {
|
|
425
|
+
return this.adapter.getWidth();
|
|
426
|
+
};
|
|
427
|
+
/**
|
|
428
|
+
* Styles the label to produce a shake animation to indicate an error.
|
|
429
|
+
* @param shouldShake If true, adds the shake CSS class; otherwise, removes shake class.
|
|
430
|
+
*/
|
|
431
|
+
MDCFloatingLabelFoundation.prototype.shake = function (shouldShake) {
|
|
432
|
+
var LABEL_SHAKE = MDCFloatingLabelFoundation.cssClasses.LABEL_SHAKE;
|
|
433
|
+
if (shouldShake) {
|
|
434
|
+
this.adapter.addClass(LABEL_SHAKE);
|
|
435
|
+
}
|
|
436
|
+
else {
|
|
437
|
+
this.adapter.removeClass(LABEL_SHAKE);
|
|
438
|
+
}
|
|
439
|
+
};
|
|
440
|
+
/**
|
|
441
|
+
* Styles the label to float or dock.
|
|
442
|
+
* @param shouldFloat If true, adds the float CSS class; otherwise, removes float and shake classes to dock the label.
|
|
443
|
+
*/
|
|
444
|
+
MDCFloatingLabelFoundation.prototype.float = function (shouldFloat) {
|
|
445
|
+
var _a = MDCFloatingLabelFoundation.cssClasses, LABEL_FLOAT_ABOVE = _a.LABEL_FLOAT_ABOVE, LABEL_SHAKE = _a.LABEL_SHAKE;
|
|
446
|
+
if (shouldFloat) {
|
|
447
|
+
this.adapter.addClass(LABEL_FLOAT_ABOVE);
|
|
448
|
+
}
|
|
449
|
+
else {
|
|
450
|
+
this.adapter.removeClass(LABEL_FLOAT_ABOVE);
|
|
451
|
+
this.adapter.removeClass(LABEL_SHAKE);
|
|
452
|
+
}
|
|
453
|
+
};
|
|
454
|
+
/**
|
|
455
|
+
* Styles the label as required.
|
|
456
|
+
* @param isRequired If true, adds an asterisk to the label, indicating that it is required.
|
|
457
|
+
*/
|
|
458
|
+
MDCFloatingLabelFoundation.prototype.setRequired = function (isRequired) {
|
|
459
|
+
var LABEL_REQUIRED = MDCFloatingLabelFoundation.cssClasses.LABEL_REQUIRED;
|
|
460
|
+
if (isRequired) {
|
|
461
|
+
this.adapter.addClass(LABEL_REQUIRED);
|
|
462
|
+
}
|
|
463
|
+
else {
|
|
464
|
+
this.adapter.removeClass(LABEL_REQUIRED);
|
|
465
|
+
}
|
|
466
|
+
};
|
|
467
|
+
MDCFloatingLabelFoundation.prototype.handleShakeAnimationEnd = function () {
|
|
468
|
+
var LABEL_SHAKE = MDCFloatingLabelFoundation.cssClasses.LABEL_SHAKE;
|
|
469
|
+
this.adapter.removeClass(LABEL_SHAKE);
|
|
470
|
+
};
|
|
471
|
+
return MDCFloatingLabelFoundation;
|
|
472
|
+
}(MDCFoundation));
|
|
338
473
|
|
|
339
474
|
/**
|
|
340
475
|
* @license
|
|
341
|
-
* Copyright
|
|
476
|
+
* Copyright 2016 Google Inc.
|
|
342
477
|
*
|
|
343
478
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
344
479
|
* of this software and associated documentation files (the "Software"), to deal
|
|
@@ -358,83 +493,677 @@ var preventDefaultEvent = function (evt) {
|
|
|
358
493
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
359
494
|
* THE SOFTWARE.
|
|
360
495
|
*/
|
|
496
|
+
var MDCFloatingLabel = /** @class */ (function (_super) {
|
|
497
|
+
__extends(MDCFloatingLabel, _super);
|
|
498
|
+
function MDCFloatingLabel() {
|
|
499
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
500
|
+
}
|
|
501
|
+
MDCFloatingLabel.attachTo = function (root) {
|
|
502
|
+
return new MDCFloatingLabel(root);
|
|
503
|
+
};
|
|
504
|
+
/**
|
|
505
|
+
* Styles the label to produce the label shake for errors.
|
|
506
|
+
* @param shouldShake If true, shakes the label by adding a CSS class; otherwise, stops shaking by removing the class.
|
|
507
|
+
*/
|
|
508
|
+
MDCFloatingLabel.prototype.shake = function (shouldShake) {
|
|
509
|
+
this.foundation.shake(shouldShake);
|
|
510
|
+
};
|
|
511
|
+
/**
|
|
512
|
+
* Styles the label to float/dock.
|
|
513
|
+
* @param shouldFloat If true, floats the label by adding a CSS class; otherwise, docks it by removing the class.
|
|
514
|
+
*/
|
|
515
|
+
MDCFloatingLabel.prototype.float = function (shouldFloat) {
|
|
516
|
+
this.foundation.float(shouldFloat);
|
|
517
|
+
};
|
|
518
|
+
/**
|
|
519
|
+
* Styles the label as required.
|
|
520
|
+
* @param isRequired If true, adds an asterisk to the label, indicating that it is required.
|
|
521
|
+
*/
|
|
522
|
+
MDCFloatingLabel.prototype.setRequired = function (isRequired) {
|
|
523
|
+
this.foundation.setRequired(isRequired);
|
|
524
|
+
};
|
|
525
|
+
MDCFloatingLabel.prototype.getWidth = function () {
|
|
526
|
+
return this.foundation.getWidth();
|
|
527
|
+
};
|
|
528
|
+
MDCFloatingLabel.prototype.getDefaultFoundation = function () {
|
|
529
|
+
var _this = this;
|
|
530
|
+
// DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
|
|
531
|
+
// To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
|
|
532
|
+
// tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
|
|
533
|
+
var adapter = {
|
|
534
|
+
addClass: function (className) { return _this.root.classList.add(className); },
|
|
535
|
+
removeClass: function (className) { return _this.root.classList.remove(className); },
|
|
536
|
+
getWidth: function () { return estimateScrollWidth(_this.root); },
|
|
537
|
+
registerInteractionHandler: function (evtType, handler) {
|
|
538
|
+
return _this.listen(evtType, handler);
|
|
539
|
+
},
|
|
540
|
+
deregisterInteractionHandler: function (evtType, handler) {
|
|
541
|
+
return _this.unlisten(evtType, handler);
|
|
542
|
+
},
|
|
543
|
+
};
|
|
544
|
+
// tslint:enable:object-literal-sort-keys
|
|
545
|
+
return new MDCFloatingLabelFoundation(adapter);
|
|
546
|
+
};
|
|
547
|
+
return MDCFloatingLabel;
|
|
548
|
+
}(MDCComponent));
|
|
549
|
+
|
|
361
550
|
/**
|
|
362
|
-
*
|
|
363
|
-
*
|
|
551
|
+
* @license
|
|
552
|
+
* Copyright 2018 Google Inc.
|
|
364
553
|
*
|
|
365
|
-
*
|
|
366
|
-
*
|
|
367
|
-
*
|
|
554
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
555
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
556
|
+
* in the Software without restriction, including without limitation the rights
|
|
557
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
558
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
559
|
+
* furnished to do so, subject to the following conditions:
|
|
560
|
+
*
|
|
561
|
+
* The above copyright notice and this permission notice shall be included in
|
|
562
|
+
* all copies or substantial portions of the Software.
|
|
563
|
+
*
|
|
564
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
565
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
566
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
567
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
568
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
569
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
570
|
+
* THE SOFTWARE.
|
|
368
571
|
*/
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
typeaheadBuffer: '',
|
|
375
|
-
};
|
|
376
|
-
return state;
|
|
377
|
-
}
|
|
572
|
+
var cssClasses$7 = {
|
|
573
|
+
LINE_RIPPLE_ACTIVE: 'mdc-line-ripple--active',
|
|
574
|
+
LINE_RIPPLE_DEACTIVATING: 'mdc-line-ripple--deactivating',
|
|
575
|
+
};
|
|
576
|
+
|
|
378
577
|
/**
|
|
379
|
-
*
|
|
380
|
-
*
|
|
578
|
+
* @license
|
|
579
|
+
* Copyright 2018 Google Inc.
|
|
381
580
|
*
|
|
382
|
-
*
|
|
383
|
-
*
|
|
384
|
-
*
|
|
581
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
582
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
583
|
+
* in the Software without restriction, including without limitation the rights
|
|
584
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
585
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
586
|
+
* furnished to do so, subject to the following conditions:
|
|
385
587
|
*
|
|
386
|
-
*
|
|
387
|
-
*
|
|
588
|
+
* The above copyright notice and this permission notice shall be included in
|
|
589
|
+
* all copies or substantial portions of the Software.
|
|
590
|
+
*
|
|
591
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
592
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
593
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
594
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
595
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
596
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
597
|
+
* THE SOFTWARE.
|
|
388
598
|
*/
|
|
389
|
-
function
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
var firstChar = primaryText[0].toLowerCase();
|
|
398
|
-
if (!sortedIndexByFirstChar.has(firstChar)) {
|
|
399
|
-
sortedIndexByFirstChar.set(firstChar, []);
|
|
400
|
-
}
|
|
401
|
-
sortedIndexByFirstChar.get(firstChar).push({ text: primaryText.toLowerCase(), index: i });
|
|
599
|
+
var MDCLineRippleFoundation = /** @class */ (function (_super) {
|
|
600
|
+
__extends(MDCLineRippleFoundation, _super);
|
|
601
|
+
function MDCLineRippleFoundation(adapter) {
|
|
602
|
+
var _this = _super.call(this, __assign(__assign({}, MDCLineRippleFoundation.defaultAdapter), adapter)) || this;
|
|
603
|
+
_this.transitionEndHandler = function (evt) {
|
|
604
|
+
_this.handleTransitionEnd(evt);
|
|
605
|
+
};
|
|
606
|
+
return _this;
|
|
402
607
|
}
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
608
|
+
Object.defineProperty(MDCLineRippleFoundation, "cssClasses", {
|
|
609
|
+
get: function () {
|
|
610
|
+
return cssClasses$7;
|
|
611
|
+
},
|
|
612
|
+
enumerable: false,
|
|
613
|
+
configurable: true
|
|
409
614
|
});
|
|
410
|
-
|
|
411
|
-
|
|
615
|
+
Object.defineProperty(MDCLineRippleFoundation, "defaultAdapter", {
|
|
616
|
+
/**
|
|
617
|
+
* See {@link MDCLineRippleAdapter} for typing information on parameters and return types.
|
|
618
|
+
*/
|
|
619
|
+
get: function () {
|
|
620
|
+
// tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
|
|
621
|
+
return {
|
|
622
|
+
addClass: function () { return undefined; },
|
|
623
|
+
removeClass: function () { return undefined; },
|
|
624
|
+
hasClass: function () { return false; },
|
|
625
|
+
setStyle: function () { return undefined; },
|
|
626
|
+
registerEventHandler: function () { return undefined; },
|
|
627
|
+
deregisterEventHandler: function () { return undefined; },
|
|
628
|
+
};
|
|
629
|
+
// tslint:enable:object-literal-sort-keys
|
|
630
|
+
},
|
|
631
|
+
enumerable: false,
|
|
632
|
+
configurable: true
|
|
633
|
+
});
|
|
634
|
+
MDCLineRippleFoundation.prototype.init = function () {
|
|
635
|
+
this.adapter.registerEventHandler('transitionend', this.transitionEndHandler);
|
|
636
|
+
};
|
|
637
|
+
MDCLineRippleFoundation.prototype.destroy = function () {
|
|
638
|
+
this.adapter.deregisterEventHandler('transitionend', this.transitionEndHandler);
|
|
639
|
+
};
|
|
640
|
+
MDCLineRippleFoundation.prototype.activate = function () {
|
|
641
|
+
this.adapter.removeClass(cssClasses$7.LINE_RIPPLE_DEACTIVATING);
|
|
642
|
+
this.adapter.addClass(cssClasses$7.LINE_RIPPLE_ACTIVE);
|
|
643
|
+
};
|
|
644
|
+
MDCLineRippleFoundation.prototype.setRippleCenter = function (xCoordinate) {
|
|
645
|
+
this.adapter.setStyle('transform-origin', xCoordinate + "px center");
|
|
646
|
+
};
|
|
647
|
+
MDCLineRippleFoundation.prototype.deactivate = function () {
|
|
648
|
+
this.adapter.addClass(cssClasses$7.LINE_RIPPLE_DEACTIVATING);
|
|
649
|
+
};
|
|
650
|
+
MDCLineRippleFoundation.prototype.handleTransitionEnd = function (evt) {
|
|
651
|
+
// Wait for the line ripple to be either transparent or opaque
|
|
652
|
+
// before emitting the animation end event
|
|
653
|
+
var isDeactivating = this.adapter.hasClass(cssClasses$7.LINE_RIPPLE_DEACTIVATING);
|
|
654
|
+
if (evt.propertyName === 'opacity') {
|
|
655
|
+
if (isDeactivating) {
|
|
656
|
+
this.adapter.removeClass(cssClasses$7.LINE_RIPPLE_ACTIVE);
|
|
657
|
+
this.adapter.removeClass(cssClasses$7.LINE_RIPPLE_DEACTIVATING);
|
|
658
|
+
}
|
|
659
|
+
}
|
|
660
|
+
};
|
|
661
|
+
return MDCLineRippleFoundation;
|
|
662
|
+
}(MDCFoundation));
|
|
663
|
+
|
|
412
664
|
/**
|
|
413
|
-
*
|
|
414
|
-
*
|
|
665
|
+
* @license
|
|
666
|
+
* Copyright 2018 Google Inc.
|
|
415
667
|
*
|
|
416
|
-
*
|
|
417
|
-
*
|
|
418
|
-
*
|
|
419
|
-
*
|
|
420
|
-
*
|
|
421
|
-
*
|
|
422
|
-
* - isItemAtIndexDisabled - function that determines whether an item at a
|
|
423
|
-
* given index is disabled
|
|
424
|
-
* @param state The typeahead state instance. See `initState`.
|
|
668
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
669
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
670
|
+
* in the Software without restriction, including without limitation the rights
|
|
671
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
672
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
673
|
+
* furnished to do so, subject to the following conditions:
|
|
425
674
|
*
|
|
426
|
-
*
|
|
675
|
+
* The above copyright notice and this permission notice shall be included in
|
|
676
|
+
* all copies or substantial portions of the Software.
|
|
677
|
+
*
|
|
678
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
679
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
680
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
681
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
682
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
683
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
684
|
+
* THE SOFTWARE.
|
|
427
685
|
*/
|
|
428
|
-
function
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
686
|
+
var MDCLineRipple = /** @class */ (function (_super) {
|
|
687
|
+
__extends(MDCLineRipple, _super);
|
|
688
|
+
function MDCLineRipple() {
|
|
689
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
690
|
+
}
|
|
691
|
+
MDCLineRipple.attachTo = function (root) {
|
|
692
|
+
return new MDCLineRipple(root);
|
|
693
|
+
};
|
|
694
|
+
/**
|
|
695
|
+
* Activates the line ripple
|
|
696
|
+
*/
|
|
697
|
+
MDCLineRipple.prototype.activate = function () {
|
|
698
|
+
this.foundation.activate();
|
|
699
|
+
};
|
|
700
|
+
/**
|
|
701
|
+
* Deactivates the line ripple
|
|
702
|
+
*/
|
|
703
|
+
MDCLineRipple.prototype.deactivate = function () {
|
|
704
|
+
this.foundation.deactivate();
|
|
705
|
+
};
|
|
706
|
+
/**
|
|
707
|
+
* Sets the transform origin given a user's click location.
|
|
708
|
+
* The `rippleCenter` is the x-coordinate of the middle of the ripple.
|
|
709
|
+
*/
|
|
710
|
+
MDCLineRipple.prototype.setRippleCenter = function (xCoordinate) {
|
|
711
|
+
this.foundation.setRippleCenter(xCoordinate);
|
|
712
|
+
};
|
|
713
|
+
MDCLineRipple.prototype.getDefaultFoundation = function () {
|
|
714
|
+
var _this = this;
|
|
715
|
+
// DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
|
|
716
|
+
// To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
|
|
717
|
+
// tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
|
|
718
|
+
var adapter = {
|
|
719
|
+
addClass: function (className) { return _this.root.classList.add(className); },
|
|
720
|
+
removeClass: function (className) { return _this.root.classList.remove(className); },
|
|
721
|
+
hasClass: function (className) { return _this.root.classList.contains(className); },
|
|
722
|
+
setStyle: function (propertyName, value) { return _this.root.style.setProperty(propertyName, value); },
|
|
723
|
+
registerEventHandler: function (evtType, handler) { return _this.listen(evtType, handler); },
|
|
724
|
+
deregisterEventHandler: function (evtType, handler) { return _this.unlisten(evtType, handler); },
|
|
725
|
+
};
|
|
726
|
+
// tslint:enable:object-literal-sort-keys
|
|
727
|
+
return new MDCLineRippleFoundation(adapter);
|
|
728
|
+
};
|
|
729
|
+
return MDCLineRipple;
|
|
730
|
+
}(MDCComponent));
|
|
731
|
+
|
|
732
|
+
/**
|
|
733
|
+
* @license
|
|
734
|
+
* Copyright 2018 Google Inc.
|
|
735
|
+
*
|
|
736
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
737
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
738
|
+
* in the Software without restriction, including without limitation the rights
|
|
739
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
740
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
741
|
+
* furnished to do so, subject to the following conditions:
|
|
742
|
+
*
|
|
743
|
+
* The above copyright notice and this permission notice shall be included in
|
|
744
|
+
* all copies or substantial portions of the Software.
|
|
745
|
+
*
|
|
746
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
747
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
748
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
749
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
750
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
751
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
752
|
+
* THE SOFTWARE.
|
|
753
|
+
*/
|
|
754
|
+
var cssClasses$6 = {
|
|
755
|
+
ANCHOR: 'mdc-menu-surface--anchor',
|
|
756
|
+
ANIMATING_CLOSED: 'mdc-menu-surface--animating-closed',
|
|
757
|
+
ANIMATING_OPEN: 'mdc-menu-surface--animating-open',
|
|
758
|
+
FIXED: 'mdc-menu-surface--fixed',
|
|
759
|
+
IS_OPEN_BELOW: 'mdc-menu-surface--is-open-below',
|
|
760
|
+
OPEN: 'mdc-menu-surface--open',
|
|
761
|
+
ROOT: 'mdc-menu-surface',
|
|
762
|
+
};
|
|
763
|
+
// tslint:disable:object-literal-sort-keys
|
|
764
|
+
var strings$7 = {
|
|
765
|
+
CLOSED_EVENT: 'MDCMenuSurface:closed',
|
|
766
|
+
CLOSING_EVENT: 'MDCMenuSurface:closing',
|
|
767
|
+
OPENED_EVENT: 'MDCMenuSurface:opened',
|
|
768
|
+
OPENING_EVENT: 'MDCMenuSurface:opening',
|
|
769
|
+
FOCUSABLE_ELEMENTS: [
|
|
770
|
+
'button:not(:disabled)',
|
|
771
|
+
'[href]:not([aria-disabled="true"])',
|
|
772
|
+
'input:not(:disabled)',
|
|
773
|
+
'select:not(:disabled)',
|
|
774
|
+
'textarea:not(:disabled)',
|
|
775
|
+
'[tabindex]:not([tabindex="-1"]):not([aria-disabled="true"])',
|
|
776
|
+
].join(', '),
|
|
777
|
+
};
|
|
778
|
+
// tslint:enable:object-literal-sort-keys
|
|
779
|
+
var numbers$5 = {
|
|
780
|
+
/** Total duration of menu-surface open animation. */
|
|
781
|
+
TRANSITION_OPEN_DURATION: 120,
|
|
782
|
+
/** Total duration of menu-surface close animation. */
|
|
783
|
+
TRANSITION_CLOSE_DURATION: 75,
|
|
784
|
+
/**
|
|
785
|
+
* Margin left to the edge of the viewport when menu-surface is at maximum
|
|
786
|
+
* possible height. Also used as a viewport margin.
|
|
787
|
+
*/
|
|
788
|
+
MARGIN_TO_EDGE: 32,
|
|
789
|
+
/**
|
|
790
|
+
* Ratio of anchor width to menu-surface width for switching from corner
|
|
791
|
+
* positioning to center positioning.
|
|
792
|
+
*/
|
|
793
|
+
ANCHOR_TO_MENU_SURFACE_WIDTH_RATIO: 0.67,
|
|
794
|
+
/**
|
|
795
|
+
* Amount of time to wait before restoring focus when closing the menu
|
|
796
|
+
* surface. This is important because if a touch event triggered the menu
|
|
797
|
+
* close, and the subsequent mouse event occurs after focus is restored, then
|
|
798
|
+
* the restored focus would be lost.
|
|
799
|
+
*/
|
|
800
|
+
TOUCH_EVENT_WAIT_MS: 30,
|
|
801
|
+
};
|
|
802
|
+
/**
|
|
803
|
+
* Enum for bits in the {@see Corner) bitmap.
|
|
804
|
+
*/
|
|
805
|
+
var CornerBit;
|
|
806
|
+
(function (CornerBit) {
|
|
807
|
+
CornerBit[CornerBit["BOTTOM"] = 1] = "BOTTOM";
|
|
808
|
+
CornerBit[CornerBit["CENTER"] = 2] = "CENTER";
|
|
809
|
+
CornerBit[CornerBit["RIGHT"] = 4] = "RIGHT";
|
|
810
|
+
CornerBit[CornerBit["FLIP_RTL"] = 8] = "FLIP_RTL";
|
|
811
|
+
})(CornerBit || (CornerBit = {}));
|
|
812
|
+
/**
|
|
813
|
+
* Enum for representing an element corner for positioning the menu-surface.
|
|
814
|
+
*
|
|
815
|
+
* The START constants map to LEFT if element directionality is left
|
|
816
|
+
* to right and RIGHT if the directionality is right to left.
|
|
817
|
+
* Likewise END maps to RIGHT or LEFT depending on the directionality.
|
|
818
|
+
*/
|
|
819
|
+
var Corner;
|
|
820
|
+
(function (Corner) {
|
|
821
|
+
Corner[Corner["TOP_LEFT"] = 0] = "TOP_LEFT";
|
|
822
|
+
Corner[Corner["TOP_RIGHT"] = 4] = "TOP_RIGHT";
|
|
823
|
+
Corner[Corner["BOTTOM_LEFT"] = 1] = "BOTTOM_LEFT";
|
|
824
|
+
Corner[Corner["BOTTOM_RIGHT"] = 5] = "BOTTOM_RIGHT";
|
|
825
|
+
Corner[Corner["TOP_START"] = 8] = "TOP_START";
|
|
826
|
+
Corner[Corner["TOP_END"] = 12] = "TOP_END";
|
|
827
|
+
Corner[Corner["BOTTOM_START"] = 9] = "BOTTOM_START";
|
|
828
|
+
Corner[Corner["BOTTOM_END"] = 13] = "BOTTOM_END";
|
|
829
|
+
})(Corner || (Corner = {}));
|
|
830
|
+
|
|
831
|
+
/**
|
|
832
|
+
* @license
|
|
833
|
+
* Copyright 2018 Google Inc.
|
|
834
|
+
*
|
|
835
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
836
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
837
|
+
* in the Software without restriction, including without limitation the rights
|
|
838
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
839
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
840
|
+
* furnished to do so, subject to the following conditions:
|
|
841
|
+
*
|
|
842
|
+
* The above copyright notice and this permission notice shall be included in
|
|
843
|
+
* all copies or substantial portions of the Software.
|
|
844
|
+
*
|
|
845
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
846
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
847
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
848
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
849
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
850
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
851
|
+
* THE SOFTWARE.
|
|
852
|
+
*/
|
|
853
|
+
var _a, _b;
|
|
854
|
+
var cssClasses$5 = {
|
|
855
|
+
LIST_ITEM_ACTIVATED_CLASS: 'mdc-list-item--activated',
|
|
856
|
+
LIST_ITEM_CLASS: 'mdc-list-item',
|
|
857
|
+
LIST_ITEM_DISABLED_CLASS: 'mdc-list-item--disabled',
|
|
858
|
+
LIST_ITEM_SELECTED_CLASS: 'mdc-list-item--selected',
|
|
859
|
+
LIST_ITEM_TEXT_CLASS: 'mdc-list-item__text',
|
|
860
|
+
LIST_ITEM_PRIMARY_TEXT_CLASS: 'mdc-list-item__primary-text',
|
|
861
|
+
ROOT: 'mdc-list',
|
|
862
|
+
};
|
|
863
|
+
var evolutionClassNameMap = (_a = {},
|
|
864
|
+
_a["" + cssClasses$5.LIST_ITEM_ACTIVATED_CLASS] = 'mdc-list-item--activated',
|
|
865
|
+
_a["" + cssClasses$5.LIST_ITEM_CLASS] = 'mdc-list-item',
|
|
866
|
+
_a["" + cssClasses$5.LIST_ITEM_DISABLED_CLASS] = 'mdc-list-item--disabled',
|
|
867
|
+
_a["" + cssClasses$5.LIST_ITEM_SELECTED_CLASS] = 'mdc-list-item--selected',
|
|
868
|
+
_a["" + cssClasses$5.LIST_ITEM_PRIMARY_TEXT_CLASS] = 'mdc-list-item__primary-text',
|
|
869
|
+
_a["" + cssClasses$5.ROOT] = 'mdc-list',
|
|
870
|
+
_a);
|
|
871
|
+
var deprecatedClassNameMap = (_b = {},
|
|
872
|
+
_b["" + cssClasses$5.LIST_ITEM_ACTIVATED_CLASS] = 'mdc-deprecated-list-item--activated',
|
|
873
|
+
_b["" + cssClasses$5.LIST_ITEM_CLASS] = 'mdc-deprecated-list-item',
|
|
874
|
+
_b["" + cssClasses$5.LIST_ITEM_DISABLED_CLASS] = 'mdc-deprecated-list-item--disabled',
|
|
875
|
+
_b["" + cssClasses$5.LIST_ITEM_SELECTED_CLASS] = 'mdc-deprecated-list-item--selected',
|
|
876
|
+
_b["" + cssClasses$5.LIST_ITEM_TEXT_CLASS] = 'mdc-deprecated-list-item__text',
|
|
877
|
+
_b["" + cssClasses$5.LIST_ITEM_PRIMARY_TEXT_CLASS] = 'mdc-deprecated-list-item__primary-text',
|
|
878
|
+
_b["" + cssClasses$5.ROOT] = 'mdc-deprecated-list',
|
|
879
|
+
_b);
|
|
880
|
+
var strings$6 = {
|
|
881
|
+
ACTION_EVENT: 'MDCList:action',
|
|
882
|
+
SELECTION_CHANGE_EVENT: 'MDCList:selectionChange',
|
|
883
|
+
ARIA_CHECKED: 'aria-checked',
|
|
884
|
+
ARIA_CHECKED_CHECKBOX_SELECTOR: '[role="checkbox"][aria-checked="true"]',
|
|
885
|
+
ARIA_CHECKED_RADIO_SELECTOR: '[role="radio"][aria-checked="true"]',
|
|
886
|
+
ARIA_CURRENT: 'aria-current',
|
|
887
|
+
ARIA_DISABLED: 'aria-disabled',
|
|
888
|
+
ARIA_ORIENTATION: 'aria-orientation',
|
|
889
|
+
ARIA_ORIENTATION_HORIZONTAL: 'horizontal',
|
|
890
|
+
ARIA_ROLE_CHECKBOX_SELECTOR: '[role="checkbox"]',
|
|
891
|
+
ARIA_SELECTED: 'aria-selected',
|
|
892
|
+
ARIA_INTERACTIVE_ROLES_SELECTOR: '[role="listbox"], [role="menu"]',
|
|
893
|
+
ARIA_MULTI_SELECTABLE_SELECTOR: '[aria-multiselectable="true"]',
|
|
894
|
+
CHECKBOX_RADIO_SELECTOR: 'input[type="checkbox"], input[type="radio"]',
|
|
895
|
+
CHECKBOX_SELECTOR: 'input[type="checkbox"]',
|
|
896
|
+
CHILD_ELEMENTS_TO_TOGGLE_TABINDEX: "\n ." + cssClasses$5.LIST_ITEM_CLASS + " button:not(:disabled),\n ." + cssClasses$5.LIST_ITEM_CLASS + " a,\n ." + deprecatedClassNameMap[cssClasses$5.LIST_ITEM_CLASS] + " button:not(:disabled),\n ." + deprecatedClassNameMap[cssClasses$5.LIST_ITEM_CLASS] + " a\n ",
|
|
897
|
+
DEPRECATED_SELECTOR: '.mdc-deprecated-list',
|
|
898
|
+
FOCUSABLE_CHILD_ELEMENTS: "\n ." + cssClasses$5.LIST_ITEM_CLASS + " button:not(:disabled),\n ." + cssClasses$5.LIST_ITEM_CLASS + " a,\n ." + cssClasses$5.LIST_ITEM_CLASS + " input[type=\"radio\"]:not(:disabled),\n ." + cssClasses$5.LIST_ITEM_CLASS + " input[type=\"checkbox\"]:not(:disabled),\n ." + deprecatedClassNameMap[cssClasses$5.LIST_ITEM_CLASS] + " button:not(:disabled),\n ." + deprecatedClassNameMap[cssClasses$5.LIST_ITEM_CLASS] + " a,\n ." + deprecatedClassNameMap[cssClasses$5.LIST_ITEM_CLASS] + " input[type=\"radio\"]:not(:disabled),\n ." + deprecatedClassNameMap[cssClasses$5.LIST_ITEM_CLASS] + " input[type=\"checkbox\"]:not(:disabled)\n ",
|
|
899
|
+
RADIO_SELECTOR: 'input[type="radio"]',
|
|
900
|
+
SELECTED_ITEM_SELECTOR: '[aria-selected="true"], [aria-current="true"]',
|
|
901
|
+
};
|
|
902
|
+
var numbers$4 = {
|
|
903
|
+
UNSET_INDEX: -1,
|
|
904
|
+
TYPEAHEAD_BUFFER_CLEAR_TIMEOUT_MS: 300
|
|
905
|
+
};
|
|
906
|
+
var evolutionAttribute = 'evolution';
|
|
907
|
+
|
|
908
|
+
/**
|
|
909
|
+
* @license
|
|
910
|
+
* Copyright 2020 Google Inc.
|
|
911
|
+
*
|
|
912
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
913
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
914
|
+
* in the Software without restriction, including without limitation the rights
|
|
915
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
916
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
917
|
+
* furnished to do so, subject to the following conditions:
|
|
918
|
+
*
|
|
919
|
+
* The above copyright notice and this permission notice shall be included in
|
|
920
|
+
* all copies or substantial portions of the Software.
|
|
921
|
+
*
|
|
922
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
923
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
924
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
925
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
926
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
927
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
928
|
+
* THE SOFTWARE.
|
|
929
|
+
*/
|
|
930
|
+
/**
|
|
931
|
+
* KEY provides normalized string values for keys.
|
|
932
|
+
*/
|
|
933
|
+
var KEY = {
|
|
934
|
+
UNKNOWN: 'Unknown',
|
|
935
|
+
BACKSPACE: 'Backspace',
|
|
936
|
+
ENTER: 'Enter',
|
|
937
|
+
SPACEBAR: 'Spacebar',
|
|
938
|
+
PAGE_UP: 'PageUp',
|
|
939
|
+
PAGE_DOWN: 'PageDown',
|
|
940
|
+
END: 'End',
|
|
941
|
+
HOME: 'Home',
|
|
942
|
+
ARROW_LEFT: 'ArrowLeft',
|
|
943
|
+
ARROW_UP: 'ArrowUp',
|
|
944
|
+
ARROW_RIGHT: 'ArrowRight',
|
|
945
|
+
ARROW_DOWN: 'ArrowDown',
|
|
946
|
+
DELETE: 'Delete',
|
|
947
|
+
ESCAPE: 'Escape',
|
|
948
|
+
TAB: 'Tab',
|
|
949
|
+
};
|
|
950
|
+
var normalizedKeys = new Set();
|
|
951
|
+
// IE11 has no support for new Map with iterable so we need to initialize this
|
|
952
|
+
// by hand.
|
|
953
|
+
normalizedKeys.add(KEY.BACKSPACE);
|
|
954
|
+
normalizedKeys.add(KEY.ENTER);
|
|
955
|
+
normalizedKeys.add(KEY.SPACEBAR);
|
|
956
|
+
normalizedKeys.add(KEY.PAGE_UP);
|
|
957
|
+
normalizedKeys.add(KEY.PAGE_DOWN);
|
|
958
|
+
normalizedKeys.add(KEY.END);
|
|
959
|
+
normalizedKeys.add(KEY.HOME);
|
|
960
|
+
normalizedKeys.add(KEY.ARROW_LEFT);
|
|
961
|
+
normalizedKeys.add(KEY.ARROW_UP);
|
|
962
|
+
normalizedKeys.add(KEY.ARROW_RIGHT);
|
|
963
|
+
normalizedKeys.add(KEY.ARROW_DOWN);
|
|
964
|
+
normalizedKeys.add(KEY.DELETE);
|
|
965
|
+
normalizedKeys.add(KEY.ESCAPE);
|
|
966
|
+
normalizedKeys.add(KEY.TAB);
|
|
967
|
+
var KEY_CODE = {
|
|
968
|
+
BACKSPACE: 8,
|
|
969
|
+
ENTER: 13,
|
|
970
|
+
SPACEBAR: 32,
|
|
971
|
+
PAGE_UP: 33,
|
|
972
|
+
PAGE_DOWN: 34,
|
|
973
|
+
END: 35,
|
|
974
|
+
HOME: 36,
|
|
975
|
+
ARROW_LEFT: 37,
|
|
976
|
+
ARROW_UP: 38,
|
|
977
|
+
ARROW_RIGHT: 39,
|
|
978
|
+
ARROW_DOWN: 40,
|
|
979
|
+
DELETE: 46,
|
|
980
|
+
ESCAPE: 27,
|
|
981
|
+
TAB: 9,
|
|
982
|
+
};
|
|
983
|
+
var mappedKeyCodes = new Map();
|
|
984
|
+
// IE11 has no support for new Map with iterable so we need to initialize this
|
|
985
|
+
// by hand.
|
|
986
|
+
mappedKeyCodes.set(KEY_CODE.BACKSPACE, KEY.BACKSPACE);
|
|
987
|
+
mappedKeyCodes.set(KEY_CODE.ENTER, KEY.ENTER);
|
|
988
|
+
mappedKeyCodes.set(KEY_CODE.SPACEBAR, KEY.SPACEBAR);
|
|
989
|
+
mappedKeyCodes.set(KEY_CODE.PAGE_UP, KEY.PAGE_UP);
|
|
990
|
+
mappedKeyCodes.set(KEY_CODE.PAGE_DOWN, KEY.PAGE_DOWN);
|
|
991
|
+
mappedKeyCodes.set(KEY_CODE.END, KEY.END);
|
|
992
|
+
mappedKeyCodes.set(KEY_CODE.HOME, KEY.HOME);
|
|
993
|
+
mappedKeyCodes.set(KEY_CODE.ARROW_LEFT, KEY.ARROW_LEFT);
|
|
994
|
+
mappedKeyCodes.set(KEY_CODE.ARROW_UP, KEY.ARROW_UP);
|
|
995
|
+
mappedKeyCodes.set(KEY_CODE.ARROW_RIGHT, KEY.ARROW_RIGHT);
|
|
996
|
+
mappedKeyCodes.set(KEY_CODE.ARROW_DOWN, KEY.ARROW_DOWN);
|
|
997
|
+
mappedKeyCodes.set(KEY_CODE.DELETE, KEY.DELETE);
|
|
998
|
+
mappedKeyCodes.set(KEY_CODE.ESCAPE, KEY.ESCAPE);
|
|
999
|
+
mappedKeyCodes.set(KEY_CODE.TAB, KEY.TAB);
|
|
1000
|
+
var navigationKeys = new Set();
|
|
1001
|
+
// IE11 has no support for new Set with iterable so we need to initialize this
|
|
1002
|
+
// by hand.
|
|
1003
|
+
navigationKeys.add(KEY.PAGE_UP);
|
|
1004
|
+
navigationKeys.add(KEY.PAGE_DOWN);
|
|
1005
|
+
navigationKeys.add(KEY.END);
|
|
1006
|
+
navigationKeys.add(KEY.HOME);
|
|
1007
|
+
navigationKeys.add(KEY.ARROW_LEFT);
|
|
1008
|
+
navigationKeys.add(KEY.ARROW_UP);
|
|
1009
|
+
navigationKeys.add(KEY.ARROW_RIGHT);
|
|
1010
|
+
navigationKeys.add(KEY.ARROW_DOWN);
|
|
1011
|
+
/**
|
|
1012
|
+
* normalizeKey returns the normalized string for a navigational action.
|
|
1013
|
+
*/
|
|
1014
|
+
function normalizeKey(evt) {
|
|
1015
|
+
var key = evt.key;
|
|
1016
|
+
// If the event already has a normalized key, return it
|
|
1017
|
+
if (normalizedKeys.has(key)) {
|
|
1018
|
+
return key;
|
|
1019
|
+
}
|
|
1020
|
+
// tslint:disable-next-line:deprecation
|
|
1021
|
+
var mappedKey = mappedKeyCodes.get(evt.keyCode);
|
|
1022
|
+
if (mappedKey) {
|
|
1023
|
+
return mappedKey;
|
|
1024
|
+
}
|
|
1025
|
+
return KEY.UNKNOWN;
|
|
1026
|
+
}
|
|
1027
|
+
|
|
1028
|
+
/**
|
|
1029
|
+
* @license
|
|
1030
|
+
* Copyright 2020 Google Inc.
|
|
1031
|
+
*
|
|
1032
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
1033
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
1034
|
+
* in the Software without restriction, including without limitation the rights
|
|
1035
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
1036
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
1037
|
+
* furnished to do so, subject to the following conditions:
|
|
1038
|
+
*
|
|
1039
|
+
* The above copyright notice and this permission notice shall be included in
|
|
1040
|
+
* all copies or substantial portions of the Software.
|
|
1041
|
+
*
|
|
1042
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
1043
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
1044
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
1045
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
1046
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
1047
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
1048
|
+
* THE SOFTWARE.
|
|
1049
|
+
*/
|
|
1050
|
+
var ELEMENTS_KEY_ALLOWED_IN = ['input', 'button', 'textarea', 'select'];
|
|
1051
|
+
/**
|
|
1052
|
+
* Ensures that preventDefault is only called if the containing element
|
|
1053
|
+
* doesn't consume the event, and it will cause an unintended scroll.
|
|
1054
|
+
*
|
|
1055
|
+
* @param evt keyboard event to be prevented.
|
|
1056
|
+
*/
|
|
1057
|
+
var preventDefaultEvent = function (evt) {
|
|
1058
|
+
var target = evt.target;
|
|
1059
|
+
if (!target) {
|
|
1060
|
+
return;
|
|
1061
|
+
}
|
|
1062
|
+
var tagName = ("" + target.tagName).toLowerCase();
|
|
1063
|
+
if (ELEMENTS_KEY_ALLOWED_IN.indexOf(tagName) === -1) {
|
|
1064
|
+
evt.preventDefault();
|
|
1065
|
+
}
|
|
1066
|
+
};
|
|
1067
|
+
|
|
1068
|
+
/**
|
|
1069
|
+
* @license
|
|
1070
|
+
* Copyright 2020 Google Inc.
|
|
1071
|
+
*
|
|
1072
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
1073
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
1074
|
+
* in the Software without restriction, including without limitation the rights
|
|
1075
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
1076
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
1077
|
+
* furnished to do so, subject to the following conditions:
|
|
1078
|
+
*
|
|
1079
|
+
* The above copyright notice and this permission notice shall be included in
|
|
1080
|
+
* all copies or substantial portions of the Software.
|
|
1081
|
+
*
|
|
1082
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
1083
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
1084
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
1085
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
1086
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
1087
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
1088
|
+
* THE SOFTWARE.
|
|
1089
|
+
*/
|
|
1090
|
+
/**
|
|
1091
|
+
* Initializes a state object for typeahead. Use the same reference for calls to
|
|
1092
|
+
* typeahead functions.
|
|
1093
|
+
*
|
|
1094
|
+
* @return The current state of the typeahead process. Each state reference
|
|
1095
|
+
* represents a typeahead instance as the reference is typically mutated
|
|
1096
|
+
* in-place.
|
|
1097
|
+
*/
|
|
1098
|
+
function initState() {
|
|
1099
|
+
var state = {
|
|
1100
|
+
bufferClearTimeout: 0,
|
|
1101
|
+
currentFirstChar: '',
|
|
1102
|
+
sortedIndexCursor: 0,
|
|
1103
|
+
typeaheadBuffer: '',
|
|
1104
|
+
};
|
|
1105
|
+
return state;
|
|
1106
|
+
}
|
|
1107
|
+
/**
|
|
1108
|
+
* Initializes typeahead state by indexing the current list items by primary
|
|
1109
|
+
* text into the sortedIndexByFirstChar data structure.
|
|
1110
|
+
*
|
|
1111
|
+
* @param listItemCount numer of items in the list
|
|
1112
|
+
* @param getPrimaryTextByItemIndex function that returns the primary text at a
|
|
1113
|
+
* given index
|
|
1114
|
+
*
|
|
1115
|
+
* @return Map that maps the first character of the primary text to the full
|
|
1116
|
+
* list text and it's index
|
|
1117
|
+
*/
|
|
1118
|
+
function initSortedIndex(listItemCount, getPrimaryTextByItemIndex) {
|
|
1119
|
+
var sortedIndexByFirstChar = new Map();
|
|
1120
|
+
// Aggregate item text to index mapping
|
|
1121
|
+
for (var i = 0; i < listItemCount; i++) {
|
|
1122
|
+
var primaryText = getPrimaryTextByItemIndex(i).trim();
|
|
1123
|
+
if (!primaryText) {
|
|
1124
|
+
continue;
|
|
1125
|
+
}
|
|
1126
|
+
var firstChar = primaryText[0].toLowerCase();
|
|
1127
|
+
if (!sortedIndexByFirstChar.has(firstChar)) {
|
|
1128
|
+
sortedIndexByFirstChar.set(firstChar, []);
|
|
1129
|
+
}
|
|
1130
|
+
sortedIndexByFirstChar.get(firstChar).push({ text: primaryText.toLowerCase(), index: i });
|
|
1131
|
+
}
|
|
1132
|
+
// Sort the mapping
|
|
1133
|
+
// TODO(b/157162694): Investigate replacing forEach with Map.values()
|
|
1134
|
+
sortedIndexByFirstChar.forEach(function (values) {
|
|
1135
|
+
values.sort(function (first, second) {
|
|
1136
|
+
return first.index - second.index;
|
|
1137
|
+
});
|
|
1138
|
+
});
|
|
1139
|
+
return sortedIndexByFirstChar;
|
|
1140
|
+
}
|
|
1141
|
+
/**
|
|
1142
|
+
* Given the next desired character from the user, it attempts to find the next
|
|
1143
|
+
* list option matching the buffer. Wraps around if at the end of options.
|
|
1144
|
+
*
|
|
1145
|
+
* @param opts Options and accessors
|
|
1146
|
+
* - nextChar - the next character to match against items
|
|
1147
|
+
* - sortedIndexByFirstChar - output of `initSortedIndex(...)`
|
|
1148
|
+
* - focusedItemIndex - the index of the currently focused item
|
|
1149
|
+
* - focusItemAtIndex - function that focuses a list item at given index
|
|
1150
|
+
* - skipFocus - whether or not to focus the matched item
|
|
1151
|
+
* - isItemAtIndexDisabled - function that determines whether an item at a
|
|
1152
|
+
* given index is disabled
|
|
1153
|
+
* @param state The typeahead state instance. See `initState`.
|
|
1154
|
+
*
|
|
1155
|
+
* @return The index of the matched item, or -1 if no match.
|
|
1156
|
+
*/
|
|
1157
|
+
function matchItem(opts, state) {
|
|
1158
|
+
var nextChar = opts.nextChar, focusItemAtIndex = opts.focusItemAtIndex, sortedIndexByFirstChar = opts.sortedIndexByFirstChar, focusedItemIndex = opts.focusedItemIndex, skipFocus = opts.skipFocus, isItemAtIndexDisabled = opts.isItemAtIndexDisabled;
|
|
1159
|
+
clearTimeout(state.bufferClearTimeout);
|
|
1160
|
+
state.bufferClearTimeout = setTimeout(function () {
|
|
1161
|
+
clearBuffer(state);
|
|
1162
|
+
}, numbers$4.TYPEAHEAD_BUFFER_CLEAR_TIMEOUT_MS);
|
|
1163
|
+
state.typeaheadBuffer = state.typeaheadBuffer + nextChar;
|
|
1164
|
+
var index;
|
|
1165
|
+
if (state.typeaheadBuffer.length === 1) {
|
|
1166
|
+
index = matchFirstChar(sortedIndexByFirstChar, focusedItemIndex, isItemAtIndexDisabled, state);
|
|
438
1167
|
}
|
|
439
1168
|
else {
|
|
440
1169
|
index = matchAllChars(sortedIndexByFirstChar, isItemAtIndexDisabled, state);
|
|
@@ -660,8 +1389,8 @@ var MDCListFoundation = /** @class */ (function (_super) {
|
|
|
660
1389
|
_this.isVertical = true;
|
|
661
1390
|
_this.isSingleSelectionList = false;
|
|
662
1391
|
_this.areDisabledItemsFocusable = true;
|
|
663
|
-
_this.selectedIndex = numbers$
|
|
664
|
-
_this.focusedItemIndex = numbers$
|
|
1392
|
+
_this.selectedIndex = numbers$4.UNSET_INDEX;
|
|
1393
|
+
_this.focusedItemIndex = numbers$4.UNSET_INDEX;
|
|
665
1394
|
_this.useActivatedClass = false;
|
|
666
1395
|
_this.useSelectedAttr = false;
|
|
667
1396
|
_this.ariaCurrentAttrValue = null;
|
|
@@ -676,21 +1405,21 @@ var MDCListFoundation = /** @class */ (function (_super) {
|
|
|
676
1405
|
}
|
|
677
1406
|
Object.defineProperty(MDCListFoundation, "strings", {
|
|
678
1407
|
get: function () {
|
|
679
|
-
return strings$
|
|
1408
|
+
return strings$6;
|
|
680
1409
|
},
|
|
681
1410
|
enumerable: false,
|
|
682
1411
|
configurable: true
|
|
683
1412
|
});
|
|
684
1413
|
Object.defineProperty(MDCListFoundation, "cssClasses", {
|
|
685
1414
|
get: function () {
|
|
686
|
-
return cssClasses$
|
|
1415
|
+
return cssClasses$5;
|
|
687
1416
|
},
|
|
688
1417
|
enumerable: false,
|
|
689
1418
|
configurable: true
|
|
690
1419
|
});
|
|
691
1420
|
Object.defineProperty(MDCListFoundation, "numbers", {
|
|
692
1421
|
get: function () {
|
|
693
|
-
return numbers$
|
|
1422
|
+
return numbers$4;
|
|
694
1423
|
},
|
|
695
1424
|
enumerable: false,
|
|
696
1425
|
configurable: true
|
|
@@ -771,9 +1500,9 @@ var MDCListFoundation = /** @class */ (function (_super) {
|
|
|
771
1500
|
*/
|
|
772
1501
|
MDCListFoundation.prototype.maybeInitializeSingleSelection = function () {
|
|
773
1502
|
var selectedItemIndex = this.getSelectedIndexFromDOM();
|
|
774
|
-
if (selectedItemIndex === numbers$
|
|
1503
|
+
if (selectedItemIndex === numbers$4.UNSET_INDEX)
|
|
775
1504
|
return;
|
|
776
|
-
var hasActivatedClass = this.adapter.listItemAtIndexHasClass(selectedItemIndex, cssClasses$
|
|
1505
|
+
var hasActivatedClass = this.adapter.listItemAtIndexHasClass(selectedItemIndex, cssClasses$5.LIST_ITEM_ACTIVATED_CLASS);
|
|
777
1506
|
if (hasActivatedClass) {
|
|
778
1507
|
this.setUseActivatedClass(true);
|
|
779
1508
|
}
|
|
@@ -782,11 +1511,11 @@ var MDCListFoundation = /** @class */ (function (_super) {
|
|
|
782
1511
|
};
|
|
783
1512
|
/** @return Index of the first selected item based on the DOM state. */
|
|
784
1513
|
MDCListFoundation.prototype.getSelectedIndexFromDOM = function () {
|
|
785
|
-
var selectedIndex = numbers$
|
|
1514
|
+
var selectedIndex = numbers$4.UNSET_INDEX;
|
|
786
1515
|
var listItemsCount = this.adapter.getListItemCount();
|
|
787
1516
|
for (var i = 0; i < listItemsCount; i++) {
|
|
788
|
-
var hasSelectedClass = this.adapter.listItemAtIndexHasClass(i, cssClasses$
|
|
789
|
-
var hasActivatedClass = this.adapter.listItemAtIndexHasClass(i, cssClasses$
|
|
1517
|
+
var hasSelectedClass = this.adapter.listItemAtIndexHasClass(i, cssClasses$5.LIST_ITEM_SELECTED_CLASS);
|
|
1518
|
+
var hasActivatedClass = this.adapter.listItemAtIndexHasClass(i, cssClasses$5.LIST_ITEM_ACTIVATED_CLASS);
|
|
790
1519
|
if (!(hasSelectedClass || hasActivatedClass)) {
|
|
791
1520
|
continue;
|
|
792
1521
|
}
|
|
@@ -871,7 +1600,7 @@ var MDCListFoundation = /** @class */ (function (_super) {
|
|
|
871
1600
|
}, 0);
|
|
872
1601
|
};
|
|
873
1602
|
MDCListFoundation.prototype.isIndexDisabled = function (index) {
|
|
874
|
-
return this.adapter.listItemAtIndexHasClass(index, cssClasses$
|
|
1603
|
+
return this.adapter.listItemAtIndexHasClass(index, cssClasses$5.LIST_ITEM_DISABLED_CLASS);
|
|
875
1604
|
};
|
|
876
1605
|
/**
|
|
877
1606
|
* Key handler for the list.
|
|
@@ -991,7 +1720,7 @@ var MDCListFoundation = /** @class */ (function (_super) {
|
|
|
991
1720
|
}
|
|
992
1721
|
else if (isLetterA && eventHasModifiers(['Control']) && this.isCheckboxList) {
|
|
993
1722
|
event.preventDefault();
|
|
994
|
-
this.checkboxListToggleAll(this.selectedIndex === numbers$
|
|
1723
|
+
this.checkboxListToggleAll(this.selectedIndex === numbers$4.UNSET_INDEX ?
|
|
995
1724
|
[] :
|
|
996
1725
|
this.selectedIndex, true);
|
|
997
1726
|
}
|
|
@@ -1057,7 +1786,7 @@ var MDCListFoundation = /** @class */ (function (_super) {
|
|
|
1057
1786
|
MDCListFoundation.prototype.handleClick = function (index, isCheckboxAlreadyUpdatedInAdapter, event) {
|
|
1058
1787
|
var _a;
|
|
1059
1788
|
var eventHasModifiers = createModifierChecker(event);
|
|
1060
|
-
if (index === numbers$
|
|
1789
|
+
if (index === numbers$4.UNSET_INDEX) {
|
|
1061
1790
|
return;
|
|
1062
1791
|
}
|
|
1063
1792
|
if (this.isIndexDisabled(index)) {
|
|
@@ -1150,12 +1879,12 @@ var MDCListFoundation = /** @class */ (function (_super) {
|
|
|
1150
1879
|
return;
|
|
1151
1880
|
}
|
|
1152
1881
|
if (isEnabled) {
|
|
1153
|
-
this.adapter.removeClassForElementIndex(itemIndex, cssClasses$
|
|
1154
|
-
this.adapter.setAttributeForElementIndex(itemIndex, strings$
|
|
1882
|
+
this.adapter.removeClassForElementIndex(itemIndex, cssClasses$5.LIST_ITEM_DISABLED_CLASS);
|
|
1883
|
+
this.adapter.setAttributeForElementIndex(itemIndex, strings$6.ARIA_DISABLED, 'false');
|
|
1155
1884
|
}
|
|
1156
1885
|
else {
|
|
1157
|
-
this.adapter.addClassForElementIndex(itemIndex, cssClasses$
|
|
1158
|
-
this.adapter.setAttributeForElementIndex(itemIndex, strings$
|
|
1886
|
+
this.adapter.addClassForElementIndex(itemIndex, cssClasses$5.LIST_ITEM_DISABLED_CLASS);
|
|
1887
|
+
this.adapter.setAttributeForElementIndex(itemIndex, strings$6.ARIA_DISABLED, 'true');
|
|
1159
1888
|
}
|
|
1160
1889
|
};
|
|
1161
1890
|
MDCListFoundation.prototype.setSingleSelectionAtIndex = function (index, options) {
|
|
@@ -1163,16 +1892,16 @@ var MDCListFoundation = /** @class */ (function (_super) {
|
|
|
1163
1892
|
if (this.selectedIndex === index && !options.forceUpdate) {
|
|
1164
1893
|
return;
|
|
1165
1894
|
}
|
|
1166
|
-
var selectedClassName = cssClasses$
|
|
1895
|
+
var selectedClassName = cssClasses$5.LIST_ITEM_SELECTED_CLASS;
|
|
1167
1896
|
if (this.useActivatedClass) {
|
|
1168
|
-
selectedClassName = cssClasses$
|
|
1897
|
+
selectedClassName = cssClasses$5.LIST_ITEM_ACTIVATED_CLASS;
|
|
1169
1898
|
}
|
|
1170
|
-
if (this.selectedIndex !== numbers$
|
|
1899
|
+
if (this.selectedIndex !== numbers$4.UNSET_INDEX) {
|
|
1171
1900
|
this.adapter.removeClassForElementIndex(this.selectedIndex, selectedClassName);
|
|
1172
1901
|
}
|
|
1173
1902
|
this.setAriaForSingleSelectionAtIndex(index);
|
|
1174
1903
|
this.setTabindexAtIndex(index);
|
|
1175
|
-
if (index !== numbers$
|
|
1904
|
+
if (index !== numbers$4.UNSET_INDEX) {
|
|
1176
1905
|
this.adapter.addClassForElementIndex(index, selectedClassName);
|
|
1177
1906
|
}
|
|
1178
1907
|
this.selectedIndex = index;
|
|
@@ -1188,16 +1917,16 @@ var MDCListFoundation = /** @class */ (function (_super) {
|
|
|
1188
1917
|
MDCListFoundation.prototype.setAriaForSingleSelectionAtIndex = function (index) {
|
|
1189
1918
|
// Detect the presence of aria-current and get the value only during list
|
|
1190
1919
|
// initialization when it is in unset state.
|
|
1191
|
-
if (this.selectedIndex === numbers$
|
|
1920
|
+
if (this.selectedIndex === numbers$4.UNSET_INDEX) {
|
|
1192
1921
|
this.ariaCurrentAttrValue =
|
|
1193
|
-
this.adapter.getAttributeForElementIndex(index, strings$
|
|
1922
|
+
this.adapter.getAttributeForElementIndex(index, strings$6.ARIA_CURRENT);
|
|
1194
1923
|
}
|
|
1195
1924
|
var isAriaCurrent = this.ariaCurrentAttrValue !== null;
|
|
1196
|
-
var ariaAttribute = isAriaCurrent ? strings$
|
|
1197
|
-
if (this.selectedIndex !== numbers$
|
|
1925
|
+
var ariaAttribute = isAriaCurrent ? strings$6.ARIA_CURRENT : strings$6.ARIA_SELECTED;
|
|
1926
|
+
if (this.selectedIndex !== numbers$4.UNSET_INDEX) {
|
|
1198
1927
|
this.adapter.setAttributeForElementIndex(this.selectedIndex, ariaAttribute, 'false');
|
|
1199
1928
|
}
|
|
1200
|
-
if (index !== numbers$
|
|
1929
|
+
if (index !== numbers$4.UNSET_INDEX) {
|
|
1201
1930
|
var ariaAttributeValue = isAriaCurrent ? this.ariaCurrentAttrValue : 'true';
|
|
1202
1931
|
this.adapter.setAttributeForElementIndex(index, ariaAttribute, ariaAttributeValue);
|
|
1203
1932
|
}
|
|
@@ -1206,7 +1935,7 @@ var MDCListFoundation = /** @class */ (function (_super) {
|
|
|
1206
1935
|
* Returns the attribute to use for indicating selection status.
|
|
1207
1936
|
*/
|
|
1208
1937
|
MDCListFoundation.prototype.getSelectionAttribute = function () {
|
|
1209
|
-
return this.useSelectedAttr ? strings$
|
|
1938
|
+
return this.useSelectedAttr ? strings$6.ARIA_SELECTED : strings$6.ARIA_CHECKED;
|
|
1210
1939
|
};
|
|
1211
1940
|
/**
|
|
1212
1941
|
* Toggles radio at give index. Radio doesn't change the checked state if it
|
|
@@ -1219,7 +1948,7 @@ var MDCListFoundation = /** @class */ (function (_super) {
|
|
|
1219
1948
|
if (this.selectedIndex === index && !options.forceUpdate) {
|
|
1220
1949
|
return;
|
|
1221
1950
|
}
|
|
1222
|
-
if (this.selectedIndex !== numbers$
|
|
1951
|
+
if (this.selectedIndex !== numbers$4.UNSET_INDEX) {
|
|
1223
1952
|
this.adapter.setAttributeForElementIndex(this.selectedIndex, selectionAttribute, 'false');
|
|
1224
1953
|
}
|
|
1225
1954
|
this.adapter.setAttributeForElementIndex(index, selectionAttribute, 'true');
|
|
@@ -1237,7 +1966,7 @@ var MDCListFoundation = /** @class */ (function (_super) {
|
|
|
1237
1966
|
// need to know about the currently selected indices and can avoid
|
|
1238
1967
|
// constructing the `Set` for performance reasons.
|
|
1239
1968
|
var currentlySelected = options.isUserInteraction ?
|
|
1240
|
-
new Set(currentIndex === numbers$
|
|
1969
|
+
new Set(currentIndex === numbers$4.UNSET_INDEX ? [] :
|
|
1241
1970
|
currentIndex) :
|
|
1242
1971
|
null;
|
|
1243
1972
|
var selectionAttribute = this.getSelectionAttribute();
|
|
@@ -1273,7 +2002,7 @@ var MDCListFoundation = /** @class */ (function (_super) {
|
|
|
1273
2002
|
*/
|
|
1274
2003
|
MDCListFoundation.prototype.toggleCheckboxRange = function (fromIndex, toIndex, toggleIndex) {
|
|
1275
2004
|
this.lastSelectedIndex = toggleIndex;
|
|
1276
|
-
var currentlySelected = new Set(this.selectedIndex === numbers$
|
|
2005
|
+
var currentlySelected = new Set(this.selectedIndex === numbers$4.UNSET_INDEX ?
|
|
1277
2006
|
[] :
|
|
1278
2007
|
this.selectedIndex);
|
|
1279
2008
|
var newIsChecked = !(currentlySelected === null || currentlySelected === void 0 ? void 0 : currentlySelected.has(toggleIndex));
|
|
@@ -1307,7 +2036,7 @@ var MDCListFoundation = /** @class */ (function (_super) {
|
|
|
1307
2036
|
}
|
|
1308
2037
|
};
|
|
1309
2038
|
MDCListFoundation.prototype.setTabindexAtIndex = function (index) {
|
|
1310
|
-
if (this.focusedItemIndex === numbers$
|
|
2039
|
+
if (this.focusedItemIndex === numbers$4.UNSET_INDEX && index !== 0) {
|
|
1311
2040
|
// If some list item was selected set first list item's tabindex to -1.
|
|
1312
2041
|
// Generally, tabindex is set to 0 on first list item of list that has no
|
|
1313
2042
|
// preselected items.
|
|
@@ -1323,7 +2052,7 @@ var MDCListFoundation = /** @class */ (function (_super) {
|
|
|
1323
2052
|
this.selectedIndex !== index) {
|
|
1324
2053
|
this.adapter.setAttributeForElementIndex(this.selectedIndex, 'tabindex', '-1');
|
|
1325
2054
|
}
|
|
1326
|
-
if (index !== numbers$
|
|
2055
|
+
if (index !== numbers$4.UNSET_INDEX) {
|
|
1327
2056
|
this.adapter.setAttributeForElementIndex(index, 'tabindex', '0');
|
|
1328
2057
|
}
|
|
1329
2058
|
};
|
|
@@ -1346,7 +2075,7 @@ var MDCListFoundation = /** @class */ (function (_super) {
|
|
|
1346
2075
|
}
|
|
1347
2076
|
// Single-selection lists focus the selected item.
|
|
1348
2077
|
if (typeof this.selectedIndex === 'number' &&
|
|
1349
|
-
this.selectedIndex !== numbers$
|
|
2078
|
+
this.selectedIndex !== numbers$4.UNSET_INDEX) {
|
|
1350
2079
|
return this.selectedIndex;
|
|
1351
2080
|
}
|
|
1352
2081
|
// Multiple-selection lists focus the first selected item.
|
|
@@ -1375,7 +2104,7 @@ var MDCListFoundation = /** @class */ (function (_super) {
|
|
|
1375
2104
|
throw new Error("MDCListFoundation: Expected array of index for checkbox based list but got number: " + index);
|
|
1376
2105
|
}
|
|
1377
2106
|
return this.isIndexInRange(index) ||
|
|
1378
|
-
this.isSingleSelectionList && index === numbers$
|
|
2107
|
+
this.isSingleSelectionList && index === numbers$4.UNSET_INDEX;
|
|
1379
2108
|
}
|
|
1380
2109
|
else {
|
|
1381
2110
|
return false;
|
|
@@ -1423,7 +2152,7 @@ var MDCListFoundation = /** @class */ (function (_super) {
|
|
|
1423
2152
|
this.adapter.setAttributeForElementIndex(index, selectionAttribute, newCheckedValue ? 'true' : 'false');
|
|
1424
2153
|
// If none of the checkbox items are selected and selectedIndex is not
|
|
1425
2154
|
// initialized then provide a default value.
|
|
1426
|
-
var selectedIndexes = this.selectedIndex === numbers$
|
|
2155
|
+
var selectedIndexes = this.selectedIndex === numbers$4.UNSET_INDEX ?
|
|
1427
2156
|
[] :
|
|
1428
2157
|
this.selectedIndex.slice();
|
|
1429
2158
|
if (newCheckedValue) {
|
|
@@ -1538,7 +2267,7 @@ var MDCList = /** @class */ (function (_super) {
|
|
|
1538
2267
|
});
|
|
1539
2268
|
Object.defineProperty(MDCList.prototype, "listElements", {
|
|
1540
2269
|
get: function () {
|
|
1541
|
-
return Array.from(this.root.querySelectorAll("." + this.classNameMap[cssClasses$
|
|
2270
|
+
return Array.from(this.root.querySelectorAll("." + this.classNameMap[cssClasses$5.LIST_ITEM_CLASS]));
|
|
1542
2271
|
},
|
|
1543
2272
|
enumerable: false,
|
|
1544
2273
|
configurable: true
|
|
@@ -1604,12 +2333,12 @@ var MDCList = /** @class */ (function (_super) {
|
|
|
1604
2333
|
if (this.isEvolutionEnabled) {
|
|
1605
2334
|
this.classNameMap = evolutionClassNameMap;
|
|
1606
2335
|
}
|
|
1607
|
-
else if (matches(this.root, strings$
|
|
2336
|
+
else if (matches(this.root, strings$6.DEPRECATED_SELECTOR)) {
|
|
1608
2337
|
this.classNameMap = deprecatedClassNameMap;
|
|
1609
2338
|
}
|
|
1610
2339
|
else {
|
|
1611
2340
|
this.classNameMap =
|
|
1612
|
-
Object.values(cssClasses$
|
|
2341
|
+
Object.values(cssClasses$5)
|
|
1613
2342
|
.reduce(function (obj, className) {
|
|
1614
2343
|
obj[className] = className;
|
|
1615
2344
|
return obj;
|
|
@@ -1634,10 +2363,10 @@ var MDCList = /** @class */ (function (_super) {
|
|
|
1634
2363
|
this.unlisten('focusout', this.focusOutEventListener);
|
|
1635
2364
|
};
|
|
1636
2365
|
MDCList.prototype.layout = function () {
|
|
1637
|
-
var direction = this.root.getAttribute(strings$
|
|
1638
|
-
this.vertical = direction !== strings$
|
|
1639
|
-
var itemSelector = "." + this.classNameMap[cssClasses$
|
|
1640
|
-
var childSelector = strings$
|
|
2366
|
+
var direction = this.root.getAttribute(strings$6.ARIA_ORIENTATION);
|
|
2367
|
+
this.vertical = direction !== strings$6.ARIA_ORIENTATION_HORIZONTAL;
|
|
2368
|
+
var itemSelector = "." + this.classNameMap[cssClasses$5.LIST_ITEM_CLASS] + ":not([tabindex])";
|
|
2369
|
+
var childSelector = strings$6.FOCUSABLE_CHILD_ELEMENTS;
|
|
1641
2370
|
// List items need to have at least tabindex=-1 to be focusable.
|
|
1642
2371
|
var itemEls = this.root.querySelectorAll(itemSelector);
|
|
1643
2372
|
if (itemEls.length) {
|
|
@@ -1664,11 +2393,11 @@ var MDCList = /** @class */ (function (_super) {
|
|
|
1664
2393
|
*/
|
|
1665
2394
|
MDCList.prototype.getPrimaryText = function (item) {
|
|
1666
2395
|
var _a;
|
|
1667
|
-
var primaryText = item.querySelector("." + this.classNameMap[cssClasses$
|
|
2396
|
+
var primaryText = item.querySelector("." + this.classNameMap[cssClasses$5.LIST_ITEM_PRIMARY_TEXT_CLASS]);
|
|
1668
2397
|
if (this.isEvolutionEnabled || primaryText) {
|
|
1669
2398
|
return (_a = primaryText === null || primaryText === void 0 ? void 0 : primaryText.textContent) !== null && _a !== void 0 ? _a : '';
|
|
1670
2399
|
}
|
|
1671
|
-
var singleLineText = item.querySelector("." + this.classNameMap[cssClasses$
|
|
2400
|
+
var singleLineText = item.querySelector("." + this.classNameMap[cssClasses$5.LIST_ITEM_TEXT_CLASS]);
|
|
1672
2401
|
return (singleLineText && singleLineText.textContent) || '';
|
|
1673
2402
|
};
|
|
1674
2403
|
/**
|
|
@@ -1677,10 +2406,10 @@ var MDCList = /** @class */ (function (_super) {
|
|
|
1677
2406
|
MDCList.prototype.initializeListType = function () {
|
|
1678
2407
|
var _this = this;
|
|
1679
2408
|
this.isInteractive =
|
|
1680
|
-
matches(this.root, strings$
|
|
2409
|
+
matches(this.root, strings$6.ARIA_INTERACTIVE_ROLES_SELECTOR);
|
|
1681
2410
|
if (this.isEvolutionEnabled && this.isInteractive) {
|
|
1682
|
-
var selection = Array.from(this.root.querySelectorAll(strings$
|
|
1683
|
-
if (matches(this.root, strings$
|
|
2411
|
+
var selection = Array.from(this.root.querySelectorAll(strings$6.SELECTED_ITEM_SELECTOR), function (listItem) { return _this.listElements.indexOf(listItem); });
|
|
2412
|
+
if (matches(this.root, strings$6.ARIA_MULTI_SELECTABLE_SELECTOR)) {
|
|
1684
2413
|
this.selectedIndex = selection;
|
|
1685
2414
|
}
|
|
1686
2415
|
else if (selection.length > 0) {
|
|
@@ -1688,10 +2417,10 @@ var MDCList = /** @class */ (function (_super) {
|
|
|
1688
2417
|
}
|
|
1689
2418
|
return;
|
|
1690
2419
|
}
|
|
1691
|
-
var checkboxListItems = this.root.querySelectorAll(strings$
|
|
1692
|
-
var radioSelectedListItem = this.root.querySelector(strings$
|
|
2420
|
+
var checkboxListItems = this.root.querySelectorAll(strings$6.ARIA_ROLE_CHECKBOX_SELECTOR);
|
|
2421
|
+
var radioSelectedListItem = this.root.querySelector(strings$6.ARIA_CHECKED_RADIO_SELECTOR);
|
|
1693
2422
|
if (checkboxListItems.length) {
|
|
1694
|
-
var preselectedItems = this.root.querySelectorAll(strings$
|
|
2423
|
+
var preselectedItems = this.root.querySelectorAll(strings$6.ARIA_CHECKED_CHECKBOX_SELECTOR);
|
|
1695
2424
|
this.selectedIndex = Array.from(preselectedItems, function (listItem) { return _this.listElements.indexOf(listItem); });
|
|
1696
2425
|
}
|
|
1697
2426
|
else if (radioSelectedListItem) {
|
|
@@ -1749,15 +2478,15 @@ var MDCList = /** @class */ (function (_super) {
|
|
|
1749
2478
|
},
|
|
1750
2479
|
hasCheckboxAtIndex: function (index) {
|
|
1751
2480
|
var listItem = _this.listElements[index];
|
|
1752
|
-
return !!listItem.querySelector(strings$
|
|
2481
|
+
return !!listItem.querySelector(strings$6.CHECKBOX_SELECTOR);
|
|
1753
2482
|
},
|
|
1754
2483
|
hasRadioAtIndex: function (index) {
|
|
1755
2484
|
var listItem = _this.listElements[index];
|
|
1756
|
-
return !!listItem.querySelector(strings$
|
|
2485
|
+
return !!listItem.querySelector(strings$6.RADIO_SELECTOR);
|
|
1757
2486
|
},
|
|
1758
2487
|
isCheckboxCheckedAtIndex: function (index) {
|
|
1759
2488
|
var listItem = _this.listElements[index];
|
|
1760
|
-
var toggleEl = listItem.querySelector(strings$
|
|
2489
|
+
var toggleEl = listItem.querySelector(strings$6.CHECKBOX_SELECTOR);
|
|
1761
2490
|
return toggleEl.checked;
|
|
1762
2491
|
},
|
|
1763
2492
|
isFocusInsideList: function () {
|
|
@@ -1769,10 +2498,10 @@ var MDCList = /** @class */ (function (_super) {
|
|
|
1769
2498
|
return _this.listElements[index].classList.contains(_this.classNameMap[className]);
|
|
1770
2499
|
},
|
|
1771
2500
|
notifyAction: function (index) {
|
|
1772
|
-
_this.emit(strings$
|
|
2501
|
+
_this.emit(strings$6.ACTION_EVENT, { index: index }, /** shouldBubble */ true);
|
|
1773
2502
|
},
|
|
1774
2503
|
notifySelectionChange: function (changedIndices) {
|
|
1775
|
-
_this.emit(strings$
|
|
2504
|
+
_this.emit(strings$6.SELECTION_CHANGE_EVENT, { changedIndices: changedIndices }, /** shouldBubble */ true);
|
|
1776
2505
|
},
|
|
1777
2506
|
removeClassForElementIndex: function (index, className) {
|
|
1778
2507
|
var element = _this.listElements[index];
|
|
@@ -1788,7 +2517,7 @@ var MDCList = /** @class */ (function (_super) {
|
|
|
1788
2517
|
},
|
|
1789
2518
|
setCheckedCheckboxOrRadioAtIndex: function (index, isChecked) {
|
|
1790
2519
|
var listItem = _this.listElements[index];
|
|
1791
|
-
var toggleEl = listItem.querySelector(strings$
|
|
2520
|
+
var toggleEl = listItem.querySelector(strings$6.CHECKBOX_RADIO_SELECTOR);
|
|
1792
2521
|
toggleEl.checked = isChecked;
|
|
1793
2522
|
var event = document.createEvent('Event');
|
|
1794
2523
|
event.initEvent('change', true, true);
|
|
@@ -1796,7 +2525,7 @@ var MDCList = /** @class */ (function (_super) {
|
|
|
1796
2525
|
},
|
|
1797
2526
|
setTabIndexForListItemChildren: function (listItemIndex, tabIndexValue) {
|
|
1798
2527
|
var element = _this.listElements[listItemIndex];
|
|
1799
|
-
var selector = strings$
|
|
2528
|
+
var selector = strings$6.CHILD_ELEMENTS_TO_TOGGLE_TABINDEX;
|
|
1800
2529
|
Array.prototype.forEach.call(element.querySelectorAll(selector), function (el) {
|
|
1801
2530
|
el.setAttribute('tabindex', tabIndexValue);
|
|
1802
2531
|
});
|
|
@@ -1810,7 +2539,7 @@ var MDCList = /** @class */ (function (_super) {
|
|
|
1810
2539
|
*/
|
|
1811
2540
|
MDCList.prototype.ensureFocusable = function () {
|
|
1812
2541
|
if (this.isEvolutionEnabled && this.isInteractive) {
|
|
1813
|
-
if (!this.root.querySelector("." + this.classNameMap[cssClasses$
|
|
2542
|
+
if (!this.root.querySelector("." + this.classNameMap[cssClasses$5.LIST_ITEM_CLASS] + "[tabindex=\"0\"]")) {
|
|
1814
2543
|
var index = this.initialFocusIndex();
|
|
1815
2544
|
if (index !== -1) {
|
|
1816
2545
|
this.listElements[index].tabIndex = 0;
|
|
@@ -1823,10 +2552,10 @@ var MDCList = /** @class */ (function (_super) {
|
|
|
1823
2552
|
return this.selectedIndex[0];
|
|
1824
2553
|
}
|
|
1825
2554
|
if (typeof this.selectedIndex === 'number' &&
|
|
1826
|
-
this.selectedIndex !== numbers$
|
|
2555
|
+
this.selectedIndex !== numbers$4.UNSET_INDEX) {
|
|
1827
2556
|
return this.selectedIndex;
|
|
1828
2557
|
}
|
|
1829
|
-
var el = this.root.querySelector("." + this.classNameMap[cssClasses$
|
|
2558
|
+
var el = this.root.querySelector("." + this.classNameMap[cssClasses$5.LIST_ITEM_CLASS] + ":not(." + this.classNameMap[cssClasses$5.LIST_ITEM_DISABLED_CLASS] + ")");
|
|
1830
2559
|
if (el === null) {
|
|
1831
2560
|
return -1;
|
|
1832
2561
|
}
|
|
@@ -1837,10 +2566,10 @@ var MDCList = /** @class */ (function (_super) {
|
|
|
1837
2566
|
* if there is no list item
|
|
1838
2567
|
*/
|
|
1839
2568
|
MDCList.prototype.getListItemIndex = function (el) {
|
|
1840
|
-
var nearestParent = closest(el, "." + this.classNameMap[cssClasses$
|
|
2569
|
+
var nearestParent = closest(el, "." + this.classNameMap[cssClasses$5.LIST_ITEM_CLASS] + ", ." + this.classNameMap[cssClasses$5.ROOT]);
|
|
1841
2570
|
// Get the index of the element if it is a list item.
|
|
1842
2571
|
if (nearestParent &&
|
|
1843
|
-
matches(nearestParent, "." + this.classNameMap[cssClasses$
|
|
2572
|
+
matches(nearestParent, "." + this.classNameMap[cssClasses$5.LIST_ITEM_CLASS])) {
|
|
1844
2573
|
return this.listElements.indexOf(nearestParent);
|
|
1845
2574
|
}
|
|
1846
2575
|
return -1;
|
|
@@ -1868,7 +2597,7 @@ var MDCList = /** @class */ (function (_super) {
|
|
|
1868
2597
|
MDCList.prototype.handleKeydownEvent = function (evt) {
|
|
1869
2598
|
var index = this.getListItemIndex(evt.target);
|
|
1870
2599
|
var target = evt.target;
|
|
1871
|
-
this.foundation.handleKeydown(evt, target.classList.contains(this.classNameMap[cssClasses$
|
|
2600
|
+
this.foundation.handleKeydown(evt, target.classList.contains(this.classNameMap[cssClasses$5.LIST_ITEM_CLASS]), index);
|
|
1872
2601
|
};
|
|
1873
2602
|
/**
|
|
1874
2603
|
* Used to figure out which element was clicked before sending the event to
|
|
@@ -1879,7 +2608,7 @@ var MDCList = /** @class */ (function (_super) {
|
|
|
1879
2608
|
var target = evt.target;
|
|
1880
2609
|
// Toggle the checkbox only if it's not the target of the event, or the
|
|
1881
2610
|
// checkbox will have 2 change events.
|
|
1882
|
-
var toggleCheckbox = !matches(target, strings$
|
|
2611
|
+
var toggleCheckbox = !matches(target, strings$6.CHECKBOX_RADIO_SELECTOR);
|
|
1883
2612
|
this.foundation.handleClick(index, toggleCheckbox, evt);
|
|
1884
2613
|
};
|
|
1885
2614
|
return MDCList;
|
|
@@ -1943,21 +2672,21 @@ var MDCMenuSurfaceFoundation = /** @class */ (function (_super) {
|
|
|
1943
2672
|
}
|
|
1944
2673
|
Object.defineProperty(MDCMenuSurfaceFoundation, "cssClasses", {
|
|
1945
2674
|
get: function () {
|
|
1946
|
-
return cssClasses$
|
|
2675
|
+
return cssClasses$6;
|
|
1947
2676
|
},
|
|
1948
2677
|
enumerable: false,
|
|
1949
2678
|
configurable: true
|
|
1950
2679
|
});
|
|
1951
2680
|
Object.defineProperty(MDCMenuSurfaceFoundation, "strings", {
|
|
1952
2681
|
get: function () {
|
|
1953
|
-
return strings$
|
|
2682
|
+
return strings$7;
|
|
1954
2683
|
},
|
|
1955
2684
|
enumerable: false,
|
|
1956
2685
|
configurable: true
|
|
1957
2686
|
});
|
|
1958
2687
|
Object.defineProperty(MDCMenuSurfaceFoundation, "numbers", {
|
|
1959
2688
|
get: function () {
|
|
1960
|
-
return numbers$
|
|
2689
|
+
return numbers$5;
|
|
1961
2690
|
},
|
|
1962
2691
|
enumerable: false,
|
|
1963
2692
|
configurable: true
|
|
@@ -2115,7 +2844,7 @@ var MDCMenuSurfaceFoundation = /** @class */ (function (_super) {
|
|
|
2115
2844
|
_this.openAnimationEndTimerId = 0;
|
|
2116
2845
|
_this.adapter.removeClass(MDCMenuSurfaceFoundation.cssClasses.ANIMATING_OPEN);
|
|
2117
2846
|
_this.adapter.notifyOpen();
|
|
2118
|
-
}, numbers$
|
|
2847
|
+
}, numbers$5.TRANSITION_OPEN_DURATION);
|
|
2119
2848
|
});
|
|
2120
2849
|
this.isSurfaceOpen = true;
|
|
2121
2850
|
}
|
|
@@ -2148,7 +2877,7 @@ var MDCMenuSurfaceFoundation = /** @class */ (function (_super) {
|
|
|
2148
2877
|
_this.closeAnimationEndTimerId = 0;
|
|
2149
2878
|
_this.adapter.removeClass(MDCMenuSurfaceFoundation.cssClasses.ANIMATING_CLOSED);
|
|
2150
2879
|
_this.adapter.notifyClose();
|
|
2151
|
-
}, numbers$
|
|
2880
|
+
}, numbers$5.TRANSITION_CLOSE_DURATION);
|
|
2152
2881
|
});
|
|
2153
2882
|
this.isSurfaceOpen = false;
|
|
2154
2883
|
if (!skipRestoreFocus) {
|
|
@@ -2189,7 +2918,7 @@ var MDCMenuSurfaceFoundation = /** @class */ (function (_super) {
|
|
|
2189
2918
|
// Center align when anchor width is comparable or greater than menu
|
|
2190
2919
|
// surface, otherwise keep corner.
|
|
2191
2920
|
if (anchorSize.width / surfaceSize.width >
|
|
2192
|
-
numbers$
|
|
2921
|
+
numbers$5.ANCHOR_TO_MENU_SURFACE_WIDTH_RATIO) {
|
|
2193
2922
|
horizontalAlignment = 'center';
|
|
2194
2923
|
}
|
|
2195
2924
|
// If the menu-surface has been hoisted to the body, it's no longer relative
|
|
@@ -2462,7 +3191,7 @@ var MDCMenuSurfaceFoundation = /** @class */ (function (_super) {
|
|
|
2462
3191
|
// restored focus would be lost.
|
|
2463
3192
|
setTimeout(function () {
|
|
2464
3193
|
_this.adapter.restoreFocus();
|
|
2465
|
-
}, numbers$
|
|
3194
|
+
}, numbers$5.TOUCH_EVENT_WAIT_MS);
|
|
2466
3195
|
}
|
|
2467
3196
|
};
|
|
2468
3197
|
MDCMenuSurfaceFoundation.prototype.hasBit = function (corner, bit) {
|
|
@@ -2484,6 +3213,86 @@ var MDCMenuSurfaceFoundation = /** @class */ (function (_super) {
|
|
|
2484
3213
|
return MDCMenuSurfaceFoundation;
|
|
2485
3214
|
}(MDCFoundation));
|
|
2486
3215
|
|
|
3216
|
+
/**
|
|
3217
|
+
* @license
|
|
3218
|
+
* Copyright 2016 Google Inc.
|
|
3219
|
+
*
|
|
3220
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
3221
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
3222
|
+
* in the Software without restriction, including without limitation the rights
|
|
3223
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
3224
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
3225
|
+
* furnished to do so, subject to the following conditions:
|
|
3226
|
+
*
|
|
3227
|
+
* The above copyright notice and this permission notice shall be included in
|
|
3228
|
+
* all copies or substantial portions of the Software.
|
|
3229
|
+
*
|
|
3230
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
3231
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
3232
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
3233
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
3234
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
3235
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
3236
|
+
* THE SOFTWARE.
|
|
3237
|
+
*/
|
|
3238
|
+
var cssPropertyNameMap = {
|
|
3239
|
+
animation: {
|
|
3240
|
+
prefixed: '-webkit-animation',
|
|
3241
|
+
standard: 'animation',
|
|
3242
|
+
},
|
|
3243
|
+
transform: {
|
|
3244
|
+
prefixed: '-webkit-transform',
|
|
3245
|
+
standard: 'transform',
|
|
3246
|
+
},
|
|
3247
|
+
transition: {
|
|
3248
|
+
prefixed: '-webkit-transition',
|
|
3249
|
+
standard: 'transition',
|
|
3250
|
+
},
|
|
3251
|
+
};
|
|
3252
|
+
var jsEventTypeMap = {
|
|
3253
|
+
animationend: {
|
|
3254
|
+
cssProperty: 'animation',
|
|
3255
|
+
prefixed: 'webkitAnimationEnd',
|
|
3256
|
+
standard: 'animationend',
|
|
3257
|
+
},
|
|
3258
|
+
animationiteration: {
|
|
3259
|
+
cssProperty: 'animation',
|
|
3260
|
+
prefixed: 'webkitAnimationIteration',
|
|
3261
|
+
standard: 'animationiteration',
|
|
3262
|
+
},
|
|
3263
|
+
animationstart: {
|
|
3264
|
+
cssProperty: 'animation',
|
|
3265
|
+
prefixed: 'webkitAnimationStart',
|
|
3266
|
+
standard: 'animationstart',
|
|
3267
|
+
},
|
|
3268
|
+
transitionend: {
|
|
3269
|
+
cssProperty: 'transition',
|
|
3270
|
+
prefixed: 'webkitTransitionEnd',
|
|
3271
|
+
standard: 'transitionend',
|
|
3272
|
+
},
|
|
3273
|
+
};
|
|
3274
|
+
function isWindow(windowObj) {
|
|
3275
|
+
return Boolean(windowObj.document) && typeof windowObj.document.createElement === 'function';
|
|
3276
|
+
}
|
|
3277
|
+
function getCorrectPropertyName(windowObj, cssProperty) {
|
|
3278
|
+
if (isWindow(windowObj) && cssProperty in cssPropertyNameMap) {
|
|
3279
|
+
var el = windowObj.document.createElement('div');
|
|
3280
|
+
var _a = cssPropertyNameMap[cssProperty], standard = _a.standard, prefixed = _a.prefixed;
|
|
3281
|
+
var isStandard = standard in el.style;
|
|
3282
|
+
return isStandard ? standard : prefixed;
|
|
3283
|
+
}
|
|
3284
|
+
return cssProperty;
|
|
3285
|
+
}
|
|
3286
|
+
function getCorrectEventName(windowObj, eventType) {
|
|
3287
|
+
if (isWindow(windowObj) && eventType in jsEventTypeMap) {
|
|
3288
|
+
var el = windowObj.document.createElement('div');
|
|
3289
|
+
var _a = jsEventTypeMap[eventType], standard = _a.standard, prefixed = _a.prefixed, cssProperty = _a.cssProperty;
|
|
3290
|
+
var isStandard = cssProperty in el.style;
|
|
3291
|
+
return isStandard ? standard : prefixed;
|
|
3292
|
+
}
|
|
3293
|
+
return eventType;
|
|
3294
|
+
}
|
|
3295
|
+
|
|
2487
3296
|
/**
|
|
2488
3297
|
* @license
|
|
2489
3298
|
* Copyright 2018 Google Inc.
|
|
@@ -2517,8 +3326,8 @@ var MDCMenuSurface = /** @class */ (function (_super) {
|
|
|
2517
3326
|
MDCMenuSurface.prototype.initialSyncWithDOM = function () {
|
|
2518
3327
|
var _this = this;
|
|
2519
3328
|
var parentEl = this.root.parentElement;
|
|
2520
|
-
this.anchorElement = parentEl && parentEl.classList.contains(cssClasses$
|
|
2521
|
-
if (this.root.classList.contains(cssClasses$
|
|
3329
|
+
this.anchorElement = parentEl && parentEl.classList.contains(cssClasses$6.ANCHOR) ? parentEl : null;
|
|
3330
|
+
if (this.root.classList.contains(cssClasses$6.FIXED)) {
|
|
2522
3331
|
this.setFixedPosition(true);
|
|
2523
3332
|
}
|
|
2524
3333
|
this.handleKeydown = function (event) {
|
|
@@ -2536,13 +3345,13 @@ var MDCMenuSurface = /** @class */ (function (_super) {
|
|
|
2536
3345
|
document.body.removeEventListener('click', _this.handleBodyClick, { capture: true });
|
|
2537
3346
|
};
|
|
2538
3347
|
this.listen('keydown', this.handleKeydown);
|
|
2539
|
-
this.listen(strings$
|
|
2540
|
-
this.listen(strings$
|
|
3348
|
+
this.listen(strings$7.OPENED_EVENT, this.registerBodyClickListener);
|
|
3349
|
+
this.listen(strings$7.CLOSED_EVENT, this.deregisterBodyClickListener);
|
|
2541
3350
|
};
|
|
2542
3351
|
MDCMenuSurface.prototype.destroy = function () {
|
|
2543
3352
|
this.unlisten('keydown', this.handleKeydown);
|
|
2544
|
-
this.unlisten(strings$
|
|
2545
|
-
this.unlisten(strings$
|
|
3353
|
+
this.unlisten(strings$7.OPENED_EVENT, this.registerBodyClickListener);
|
|
3354
|
+
this.unlisten(strings$7.CLOSED_EVENT, this.deregisterBodyClickListener);
|
|
2546
3355
|
_super.prototype.destroy.call(this);
|
|
2547
3356
|
};
|
|
2548
3357
|
MDCMenuSurface.prototype.isOpen = function () {
|
|
@@ -2573,10 +3382,10 @@ var MDCMenuSurface = /** @class */ (function (_super) {
|
|
|
2573
3382
|
/** Sets the menu-surface to position: fixed. */
|
|
2574
3383
|
MDCMenuSurface.prototype.setFixedPosition = function (isFixed) {
|
|
2575
3384
|
if (isFixed) {
|
|
2576
|
-
this.root.classList.add(cssClasses$
|
|
3385
|
+
this.root.classList.add(cssClasses$6.FIXED);
|
|
2577
3386
|
}
|
|
2578
3387
|
else {
|
|
2579
|
-
this.root.classList.remove(cssClasses$
|
|
3388
|
+
this.root.classList.remove(cssClasses$6.FIXED);
|
|
2580
3389
|
}
|
|
2581
3390
|
this.foundation.setFixedPosition(isFixed);
|
|
2582
3391
|
};
|
|
@@ -2669,54 +3478,237 @@ var MDCMenuSurface = /** @class */ (function (_super) {
|
|
|
2669
3478
|
// tslint:enable:object-literal-sort-keys
|
|
2670
3479
|
return new MDCMenuSurfaceFoundation(adapter);
|
|
2671
3480
|
};
|
|
2672
|
-
return MDCMenuSurface;
|
|
2673
|
-
}(MDCComponent));
|
|
2674
|
-
|
|
2675
|
-
/**
|
|
2676
|
-
* @license
|
|
2677
|
-
* Copyright 2018 Google Inc.
|
|
2678
|
-
*
|
|
2679
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
2680
|
-
* of this software and associated documentation files (the "Software"), to deal
|
|
2681
|
-
* in the Software without restriction, including without limitation the rights
|
|
2682
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
2683
|
-
* copies of the Software, and to permit persons to whom the Software is
|
|
2684
|
-
* furnished to do so, subject to the following conditions:
|
|
2685
|
-
*
|
|
2686
|
-
* The above copyright notice and this permission notice shall be included in
|
|
2687
|
-
* all copies or substantial portions of the Software.
|
|
2688
|
-
*
|
|
2689
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
2690
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
2691
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
2692
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
2693
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
2694
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
2695
|
-
* THE SOFTWARE.
|
|
2696
|
-
*/
|
|
2697
|
-
var cssClasses$
|
|
2698
|
-
MENU_SELECTED_LIST_ITEM: 'mdc-menu-item--selected',
|
|
2699
|
-
MENU_SELECTION_GROUP: 'mdc-menu__selection-group',
|
|
2700
|
-
ROOT: 'mdc-menu',
|
|
2701
|
-
};
|
|
2702
|
-
var strings$
|
|
2703
|
-
ARIA_CHECKED_ATTR: 'aria-checked',
|
|
2704
|
-
ARIA_DISABLED_ATTR: 'aria-disabled',
|
|
2705
|
-
CHECKBOX_SELECTOR: 'input[type="checkbox"]',
|
|
2706
|
-
LIST_SELECTOR: '.mdc-list,.mdc-deprecated-list',
|
|
2707
|
-
SELECTED_EVENT: 'MDCMenu:selected',
|
|
2708
|
-
SKIP_RESTORE_FOCUS: 'data-menu-item-skip-restore-focus',
|
|
2709
|
-
};
|
|
2710
|
-
var numbers$
|
|
2711
|
-
FOCUS_ROOT_INDEX: -1,
|
|
2712
|
-
};
|
|
2713
|
-
var DefaultFocusState;
|
|
2714
|
-
(function (DefaultFocusState) {
|
|
2715
|
-
DefaultFocusState[DefaultFocusState["NONE"] = 0] = "NONE";
|
|
2716
|
-
DefaultFocusState[DefaultFocusState["LIST_ROOT"] = 1] = "LIST_ROOT";
|
|
2717
|
-
DefaultFocusState[DefaultFocusState["FIRST_ITEM"] = 2] = "FIRST_ITEM";
|
|
2718
|
-
DefaultFocusState[DefaultFocusState["LAST_ITEM"] = 3] = "LAST_ITEM";
|
|
2719
|
-
})(DefaultFocusState || (DefaultFocusState = {}));
|
|
3481
|
+
return MDCMenuSurface;
|
|
3482
|
+
}(MDCComponent));
|
|
3483
|
+
|
|
3484
|
+
/**
|
|
3485
|
+
* @license
|
|
3486
|
+
* Copyright 2018 Google Inc.
|
|
3487
|
+
*
|
|
3488
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
3489
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
3490
|
+
* in the Software without restriction, including without limitation the rights
|
|
3491
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
3492
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
3493
|
+
* furnished to do so, subject to the following conditions:
|
|
3494
|
+
*
|
|
3495
|
+
* The above copyright notice and this permission notice shall be included in
|
|
3496
|
+
* all copies or substantial portions of the Software.
|
|
3497
|
+
*
|
|
3498
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
3499
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
3500
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
3501
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
3502
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
3503
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
3504
|
+
* THE SOFTWARE.
|
|
3505
|
+
*/
|
|
3506
|
+
var cssClasses$4 = {
|
|
3507
|
+
MENU_SELECTED_LIST_ITEM: 'mdc-menu-item--selected',
|
|
3508
|
+
MENU_SELECTION_GROUP: 'mdc-menu__selection-group',
|
|
3509
|
+
ROOT: 'mdc-menu',
|
|
3510
|
+
};
|
|
3511
|
+
var strings$5 = {
|
|
3512
|
+
ARIA_CHECKED_ATTR: 'aria-checked',
|
|
3513
|
+
ARIA_DISABLED_ATTR: 'aria-disabled',
|
|
3514
|
+
CHECKBOX_SELECTOR: 'input[type="checkbox"]',
|
|
3515
|
+
LIST_SELECTOR: '.mdc-list,.mdc-deprecated-list',
|
|
3516
|
+
SELECTED_EVENT: 'MDCMenu:selected',
|
|
3517
|
+
SKIP_RESTORE_FOCUS: 'data-menu-item-skip-restore-focus',
|
|
3518
|
+
};
|
|
3519
|
+
var numbers$3 = {
|
|
3520
|
+
FOCUS_ROOT_INDEX: -1,
|
|
3521
|
+
};
|
|
3522
|
+
var DefaultFocusState;
|
|
3523
|
+
(function (DefaultFocusState) {
|
|
3524
|
+
DefaultFocusState[DefaultFocusState["NONE"] = 0] = "NONE";
|
|
3525
|
+
DefaultFocusState[DefaultFocusState["LIST_ROOT"] = 1] = "LIST_ROOT";
|
|
3526
|
+
DefaultFocusState[DefaultFocusState["FIRST_ITEM"] = 2] = "FIRST_ITEM";
|
|
3527
|
+
DefaultFocusState[DefaultFocusState["LAST_ITEM"] = 3] = "LAST_ITEM";
|
|
3528
|
+
})(DefaultFocusState || (DefaultFocusState = {}));
|
|
3529
|
+
|
|
3530
|
+
/**
|
|
3531
|
+
* @license
|
|
3532
|
+
* Copyright 2018 Google Inc.
|
|
3533
|
+
*
|
|
3534
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
3535
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
3536
|
+
* in the Software without restriction, including without limitation the rights
|
|
3537
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
3538
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
3539
|
+
* furnished to do so, subject to the following conditions:
|
|
3540
|
+
*
|
|
3541
|
+
* The above copyright notice and this permission notice shall be included in
|
|
3542
|
+
* all copies or substantial portions of the Software.
|
|
3543
|
+
*
|
|
3544
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
3545
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
3546
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
3547
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
3548
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
3549
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
3550
|
+
* THE SOFTWARE.
|
|
3551
|
+
*/
|
|
3552
|
+
var MDCMenuFoundation = /** @class */ (function (_super) {
|
|
3553
|
+
__extends(MDCMenuFoundation, _super);
|
|
3554
|
+
function MDCMenuFoundation(adapter) {
|
|
3555
|
+
var _this = _super.call(this, __assign(__assign({}, MDCMenuFoundation.defaultAdapter), adapter)) || this;
|
|
3556
|
+
_this.closeAnimationEndTimerId = 0;
|
|
3557
|
+
_this.defaultFocusState = DefaultFocusState.LIST_ROOT;
|
|
3558
|
+
_this.selectedIndex = -1;
|
|
3559
|
+
return _this;
|
|
3560
|
+
}
|
|
3561
|
+
Object.defineProperty(MDCMenuFoundation, "cssClasses", {
|
|
3562
|
+
get: function () {
|
|
3563
|
+
return cssClasses$4;
|
|
3564
|
+
},
|
|
3565
|
+
enumerable: false,
|
|
3566
|
+
configurable: true
|
|
3567
|
+
});
|
|
3568
|
+
Object.defineProperty(MDCMenuFoundation, "strings", {
|
|
3569
|
+
get: function () {
|
|
3570
|
+
return strings$5;
|
|
3571
|
+
},
|
|
3572
|
+
enumerable: false,
|
|
3573
|
+
configurable: true
|
|
3574
|
+
});
|
|
3575
|
+
Object.defineProperty(MDCMenuFoundation, "numbers", {
|
|
3576
|
+
get: function () {
|
|
3577
|
+
return numbers$3;
|
|
3578
|
+
},
|
|
3579
|
+
enumerable: false,
|
|
3580
|
+
configurable: true
|
|
3581
|
+
});
|
|
3582
|
+
Object.defineProperty(MDCMenuFoundation, "defaultAdapter", {
|
|
3583
|
+
/**
|
|
3584
|
+
* @see {@link MDCMenuAdapter} for typing information on parameters and return types.
|
|
3585
|
+
*/
|
|
3586
|
+
get: function () {
|
|
3587
|
+
// tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
|
|
3588
|
+
return {
|
|
3589
|
+
addClassToElementAtIndex: function () { return undefined; },
|
|
3590
|
+
removeClassFromElementAtIndex: function () { return undefined; },
|
|
3591
|
+
addAttributeToElementAtIndex: function () { return undefined; },
|
|
3592
|
+
removeAttributeFromElementAtIndex: function () { return undefined; },
|
|
3593
|
+
getAttributeFromElementAtIndex: function () { return null; },
|
|
3594
|
+
elementContainsClass: function () { return false; },
|
|
3595
|
+
closeSurface: function () { return undefined; },
|
|
3596
|
+
getElementIndex: function () { return -1; },
|
|
3597
|
+
notifySelected: function () { return undefined; },
|
|
3598
|
+
getMenuItemCount: function () { return 0; },
|
|
3599
|
+
focusItemAtIndex: function () { return undefined; },
|
|
3600
|
+
focusListRoot: function () { return undefined; },
|
|
3601
|
+
getSelectedSiblingOfItemAtIndex: function () { return -1; },
|
|
3602
|
+
isSelectableItemAtIndex: function () { return false; },
|
|
3603
|
+
};
|
|
3604
|
+
// tslint:enable:object-literal-sort-keys
|
|
3605
|
+
},
|
|
3606
|
+
enumerable: false,
|
|
3607
|
+
configurable: true
|
|
3608
|
+
});
|
|
3609
|
+
MDCMenuFoundation.prototype.destroy = function () {
|
|
3610
|
+
if (this.closeAnimationEndTimerId) {
|
|
3611
|
+
clearTimeout(this.closeAnimationEndTimerId);
|
|
3612
|
+
}
|
|
3613
|
+
this.adapter.closeSurface();
|
|
3614
|
+
};
|
|
3615
|
+
MDCMenuFoundation.prototype.handleKeydown = function (evt) {
|
|
3616
|
+
var key = evt.key, keyCode = evt.keyCode;
|
|
3617
|
+
var isTab = key === 'Tab' || keyCode === 9;
|
|
3618
|
+
if (isTab) {
|
|
3619
|
+
this.adapter.closeSurface(/** skipRestoreFocus */ true);
|
|
3620
|
+
}
|
|
3621
|
+
};
|
|
3622
|
+
MDCMenuFoundation.prototype.handleItemAction = function (listItem) {
|
|
3623
|
+
var _this = this;
|
|
3624
|
+
var index = this.adapter.getElementIndex(listItem);
|
|
3625
|
+
if (index < 0) {
|
|
3626
|
+
return;
|
|
3627
|
+
}
|
|
3628
|
+
this.adapter.notifySelected({ index: index });
|
|
3629
|
+
var skipRestoreFocus = this.adapter.getAttributeFromElementAtIndex(index, strings$5.SKIP_RESTORE_FOCUS) === 'true';
|
|
3630
|
+
this.adapter.closeSurface(skipRestoreFocus);
|
|
3631
|
+
// Wait for the menu to close before adding/removing classes that affect styles.
|
|
3632
|
+
this.closeAnimationEndTimerId = setTimeout(function () {
|
|
3633
|
+
// Recompute the index in case the menu contents have changed.
|
|
3634
|
+
var recomputedIndex = _this.adapter.getElementIndex(listItem);
|
|
3635
|
+
if (recomputedIndex >= 0 &&
|
|
3636
|
+
_this.adapter.isSelectableItemAtIndex(recomputedIndex)) {
|
|
3637
|
+
_this.setSelectedIndex(recomputedIndex);
|
|
3638
|
+
}
|
|
3639
|
+
}, MDCMenuSurfaceFoundation.numbers.TRANSITION_CLOSE_DURATION);
|
|
3640
|
+
};
|
|
3641
|
+
MDCMenuFoundation.prototype.handleMenuSurfaceOpened = function () {
|
|
3642
|
+
switch (this.defaultFocusState) {
|
|
3643
|
+
case DefaultFocusState.FIRST_ITEM:
|
|
3644
|
+
this.adapter.focusItemAtIndex(0);
|
|
3645
|
+
break;
|
|
3646
|
+
case DefaultFocusState.LAST_ITEM:
|
|
3647
|
+
this.adapter.focusItemAtIndex(this.adapter.getMenuItemCount() - 1);
|
|
3648
|
+
break;
|
|
3649
|
+
case DefaultFocusState.NONE:
|
|
3650
|
+
// Do nothing.
|
|
3651
|
+
break;
|
|
3652
|
+
default:
|
|
3653
|
+
this.adapter.focusListRoot();
|
|
3654
|
+
break;
|
|
3655
|
+
}
|
|
3656
|
+
};
|
|
3657
|
+
/**
|
|
3658
|
+
* Sets default focus state where the menu should focus every time when menu
|
|
3659
|
+
* is opened. Focuses the list root (`DefaultFocusState.LIST_ROOT`) element by
|
|
3660
|
+
* default.
|
|
3661
|
+
*/
|
|
3662
|
+
MDCMenuFoundation.prototype.setDefaultFocusState = function (focusState) {
|
|
3663
|
+
this.defaultFocusState = focusState;
|
|
3664
|
+
};
|
|
3665
|
+
/** @return Index of the currently selected list item within the menu. */
|
|
3666
|
+
MDCMenuFoundation.prototype.getSelectedIndex = function () {
|
|
3667
|
+
return this.selectedIndex;
|
|
3668
|
+
};
|
|
3669
|
+
/**
|
|
3670
|
+
* Selects the list item at `index` within the menu.
|
|
3671
|
+
* @param index Index of list item within the menu.
|
|
3672
|
+
*/
|
|
3673
|
+
MDCMenuFoundation.prototype.setSelectedIndex = function (index) {
|
|
3674
|
+
this.validatedIndex(index);
|
|
3675
|
+
if (!this.adapter.isSelectableItemAtIndex(index)) {
|
|
3676
|
+
throw new Error('MDCMenuFoundation: No selection group at specified index.');
|
|
3677
|
+
}
|
|
3678
|
+
var prevSelectedIndex = this.adapter.getSelectedSiblingOfItemAtIndex(index);
|
|
3679
|
+
if (prevSelectedIndex >= 0) {
|
|
3680
|
+
this.adapter.removeAttributeFromElementAtIndex(prevSelectedIndex, strings$5.ARIA_CHECKED_ATTR);
|
|
3681
|
+
this.adapter.removeClassFromElementAtIndex(prevSelectedIndex, cssClasses$4.MENU_SELECTED_LIST_ITEM);
|
|
3682
|
+
}
|
|
3683
|
+
this.adapter.addClassToElementAtIndex(index, cssClasses$4.MENU_SELECTED_LIST_ITEM);
|
|
3684
|
+
this.adapter.addAttributeToElementAtIndex(index, strings$5.ARIA_CHECKED_ATTR, 'true');
|
|
3685
|
+
this.selectedIndex = index;
|
|
3686
|
+
};
|
|
3687
|
+
/**
|
|
3688
|
+
* Sets the enabled state to isEnabled for the menu item at the given index.
|
|
3689
|
+
* @param index Index of the menu item
|
|
3690
|
+
* @param isEnabled The desired enabled state of the menu item.
|
|
3691
|
+
*/
|
|
3692
|
+
MDCMenuFoundation.prototype.setEnabled = function (index, isEnabled) {
|
|
3693
|
+
this.validatedIndex(index);
|
|
3694
|
+
if (isEnabled) {
|
|
3695
|
+
this.adapter.removeClassFromElementAtIndex(index, cssClasses$5.LIST_ITEM_DISABLED_CLASS);
|
|
3696
|
+
this.adapter.addAttributeToElementAtIndex(index, strings$5.ARIA_DISABLED_ATTR, 'false');
|
|
3697
|
+
}
|
|
3698
|
+
else {
|
|
3699
|
+
this.adapter.addClassToElementAtIndex(index, cssClasses$5.LIST_ITEM_DISABLED_CLASS);
|
|
3700
|
+
this.adapter.addAttributeToElementAtIndex(index, strings$5.ARIA_DISABLED_ATTR, 'true');
|
|
3701
|
+
}
|
|
3702
|
+
};
|
|
3703
|
+
MDCMenuFoundation.prototype.validatedIndex = function (index) {
|
|
3704
|
+
var menuSize = this.adapter.getMenuItemCount();
|
|
3705
|
+
var isIndexInRange = index >= 0 && index < menuSize;
|
|
3706
|
+
if (!isIndexInRange) {
|
|
3707
|
+
throw new Error('MDCMenuFoundation: No list item at specified index.');
|
|
3708
|
+
}
|
|
3709
|
+
};
|
|
3710
|
+
return MDCMenuFoundation;
|
|
3711
|
+
}(MDCFoundation));
|
|
2720
3712
|
|
|
2721
3713
|
/**
|
|
2722
3714
|
* @license
|
|
@@ -2740,166 +3732,319 @@ var DefaultFocusState;
|
|
|
2740
3732
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
2741
3733
|
* THE SOFTWARE.
|
|
2742
3734
|
*/
|
|
2743
|
-
var
|
|
2744
|
-
__extends(
|
|
2745
|
-
function
|
|
2746
|
-
|
|
2747
|
-
_this.closeAnimationEndTimerId = 0;
|
|
2748
|
-
_this.defaultFocusState = DefaultFocusState.LIST_ROOT;
|
|
2749
|
-
_this.selectedIndex = -1;
|
|
2750
|
-
return _this;
|
|
3735
|
+
var MDCMenu = /** @class */ (function (_super) {
|
|
3736
|
+
__extends(MDCMenu, _super);
|
|
3737
|
+
function MDCMenu() {
|
|
3738
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
2751
3739
|
}
|
|
2752
|
-
|
|
3740
|
+
MDCMenu.attachTo = function (root) {
|
|
3741
|
+
return new MDCMenu(root);
|
|
3742
|
+
};
|
|
3743
|
+
MDCMenu.prototype.initialize = function (menuSurfaceFactory, listFactory) {
|
|
3744
|
+
if (menuSurfaceFactory === void 0) { menuSurfaceFactory = function (el) { return new MDCMenuSurface(el); }; }
|
|
3745
|
+
if (listFactory === void 0) { listFactory = function (el) { return new MDCList(el); }; }
|
|
3746
|
+
this.menuSurfaceFactory = menuSurfaceFactory;
|
|
3747
|
+
this.listFactory = listFactory;
|
|
3748
|
+
};
|
|
3749
|
+
MDCMenu.prototype.initialSyncWithDOM = function () {
|
|
3750
|
+
var _this = this;
|
|
3751
|
+
this.menuSurface = this.menuSurfaceFactory(this.root);
|
|
3752
|
+
var list = this.root.querySelector(strings$5.LIST_SELECTOR);
|
|
3753
|
+
if (list) {
|
|
3754
|
+
this.list = this.listFactory(list);
|
|
3755
|
+
this.list.wrapFocus = true;
|
|
3756
|
+
}
|
|
3757
|
+
else {
|
|
3758
|
+
this.list = null;
|
|
3759
|
+
}
|
|
3760
|
+
this.handleKeydown = function (evt) {
|
|
3761
|
+
_this.foundation.handleKeydown(evt);
|
|
3762
|
+
};
|
|
3763
|
+
this.handleItemAction = function (evt) {
|
|
3764
|
+
_this.foundation.handleItemAction(_this.items[evt.detail.index]);
|
|
3765
|
+
};
|
|
3766
|
+
this.handleMenuSurfaceOpened = function () {
|
|
3767
|
+
_this.foundation.handleMenuSurfaceOpened();
|
|
3768
|
+
};
|
|
3769
|
+
this.menuSurface.listen(MDCMenuSurfaceFoundation.strings.OPENED_EVENT, this.handleMenuSurfaceOpened);
|
|
3770
|
+
this.listen('keydown', this.handleKeydown);
|
|
3771
|
+
this.listen(MDCListFoundation.strings.ACTION_EVENT, this.handleItemAction);
|
|
3772
|
+
};
|
|
3773
|
+
MDCMenu.prototype.destroy = function () {
|
|
3774
|
+
if (this.list) {
|
|
3775
|
+
this.list.destroy();
|
|
3776
|
+
}
|
|
3777
|
+
this.menuSurface.destroy();
|
|
3778
|
+
this.menuSurface.unlisten(MDCMenuSurfaceFoundation.strings.OPENED_EVENT, this.handleMenuSurfaceOpened);
|
|
3779
|
+
this.unlisten('keydown', this.handleKeydown);
|
|
3780
|
+
this.unlisten(MDCListFoundation.strings.ACTION_EVENT, this.handleItemAction);
|
|
3781
|
+
_super.prototype.destroy.call(this);
|
|
3782
|
+
};
|
|
3783
|
+
Object.defineProperty(MDCMenu.prototype, "open", {
|
|
2753
3784
|
get: function () {
|
|
2754
|
-
return
|
|
3785
|
+
return this.menuSurface.isOpen();
|
|
3786
|
+
},
|
|
3787
|
+
set: function (value) {
|
|
3788
|
+
if (value) {
|
|
3789
|
+
this.menuSurface.open();
|
|
3790
|
+
}
|
|
3791
|
+
else {
|
|
3792
|
+
this.menuSurface.close();
|
|
3793
|
+
}
|
|
2755
3794
|
},
|
|
2756
3795
|
enumerable: false,
|
|
2757
3796
|
configurable: true
|
|
2758
3797
|
});
|
|
2759
|
-
Object.defineProperty(
|
|
3798
|
+
Object.defineProperty(MDCMenu.prototype, "wrapFocus", {
|
|
2760
3799
|
get: function () {
|
|
2761
|
-
return
|
|
3800
|
+
return this.list ? this.list.wrapFocus : false;
|
|
3801
|
+
},
|
|
3802
|
+
set: function (value) {
|
|
3803
|
+
if (this.list) {
|
|
3804
|
+
this.list.wrapFocus = value;
|
|
3805
|
+
}
|
|
2762
3806
|
},
|
|
2763
3807
|
enumerable: false,
|
|
2764
3808
|
configurable: true
|
|
2765
3809
|
});
|
|
2766
|
-
Object.defineProperty(
|
|
3810
|
+
Object.defineProperty(MDCMenu.prototype, "hasTypeahead", {
|
|
3811
|
+
/**
|
|
3812
|
+
* Sets whether the menu has typeahead functionality.
|
|
3813
|
+
* @param value Whether typeahead is enabled.
|
|
3814
|
+
*/
|
|
3815
|
+
set: function (value) {
|
|
3816
|
+
if (this.list) {
|
|
3817
|
+
this.list.hasTypeahead = value;
|
|
3818
|
+
}
|
|
3819
|
+
},
|
|
3820
|
+
enumerable: false,
|
|
3821
|
+
configurable: true
|
|
3822
|
+
});
|
|
3823
|
+
Object.defineProperty(MDCMenu.prototype, "typeaheadInProgress", {
|
|
3824
|
+
/**
|
|
3825
|
+
* @return Whether typeahead logic is currently matching some user prefix.
|
|
3826
|
+
*/
|
|
2767
3827
|
get: function () {
|
|
2768
|
-
return
|
|
3828
|
+
return this.list ? this.list.typeaheadInProgress : false;
|
|
2769
3829
|
},
|
|
2770
3830
|
enumerable: false,
|
|
2771
3831
|
configurable: true
|
|
2772
3832
|
});
|
|
2773
|
-
|
|
3833
|
+
/**
|
|
3834
|
+
* Given the next desired character from the user, adds it to the typeahead
|
|
3835
|
+
* buffer. Then, attempts to find the next option matching the buffer. Wraps
|
|
3836
|
+
* around if at the end of options.
|
|
3837
|
+
*
|
|
3838
|
+
* @param nextChar The next character to add to the prefix buffer.
|
|
3839
|
+
* @param startingIndex The index from which to start matching. Only relevant
|
|
3840
|
+
* when starting a new match sequence. To start a new match sequence,
|
|
3841
|
+
* clear the buffer using `clearTypeaheadBuffer`, or wait for the buffer
|
|
3842
|
+
* to clear after a set interval defined in list foundation. Defaults to
|
|
3843
|
+
* the currently focused index.
|
|
3844
|
+
* @return The index of the matched item, or -1 if no match.
|
|
3845
|
+
*/
|
|
3846
|
+
MDCMenu.prototype.typeaheadMatchItem = function (nextChar, startingIndex) {
|
|
3847
|
+
if (this.list) {
|
|
3848
|
+
return this.list.typeaheadMatchItem(nextChar, startingIndex);
|
|
3849
|
+
}
|
|
3850
|
+
return -1;
|
|
3851
|
+
};
|
|
3852
|
+
/**
|
|
3853
|
+
* Layout the underlying list element in the case of any dynamic updates
|
|
3854
|
+
* to its structure.
|
|
3855
|
+
*/
|
|
3856
|
+
MDCMenu.prototype.layout = function () {
|
|
3857
|
+
if (this.list) {
|
|
3858
|
+
this.list.layout();
|
|
3859
|
+
}
|
|
3860
|
+
};
|
|
3861
|
+
Object.defineProperty(MDCMenu.prototype, "items", {
|
|
2774
3862
|
/**
|
|
2775
|
-
*
|
|
3863
|
+
* Return the items within the menu. Note that this only contains the set of elements within
|
|
3864
|
+
* the items container that are proper list items, and not supplemental / presentational DOM
|
|
3865
|
+
* elements.
|
|
2776
3866
|
*/
|
|
2777
3867
|
get: function () {
|
|
2778
|
-
|
|
2779
|
-
|
|
2780
|
-
|
|
2781
|
-
|
|
2782
|
-
|
|
2783
|
-
|
|
2784
|
-
|
|
2785
|
-
|
|
2786
|
-
|
|
2787
|
-
|
|
2788
|
-
|
|
2789
|
-
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
-
|
|
2793
|
-
|
|
2794
|
-
|
|
2795
|
-
|
|
3868
|
+
return this.list ? this.list.listElements : [];
|
|
3869
|
+
},
|
|
3870
|
+
enumerable: false,
|
|
3871
|
+
configurable: true
|
|
3872
|
+
});
|
|
3873
|
+
Object.defineProperty(MDCMenu.prototype, "singleSelection", {
|
|
3874
|
+
/**
|
|
3875
|
+
* Turns on/off the underlying list's single selection mode. Used mainly
|
|
3876
|
+
* by select menu.
|
|
3877
|
+
*
|
|
3878
|
+
* @param singleSelection Whether to enable single selection mode.
|
|
3879
|
+
*/
|
|
3880
|
+
set: function (singleSelection) {
|
|
3881
|
+
if (this.list) {
|
|
3882
|
+
this.list.singleSelection = singleSelection;
|
|
3883
|
+
}
|
|
3884
|
+
},
|
|
3885
|
+
enumerable: false,
|
|
3886
|
+
configurable: true
|
|
3887
|
+
});
|
|
3888
|
+
Object.defineProperty(MDCMenu.prototype, "selectedIndex", {
|
|
3889
|
+
/**
|
|
3890
|
+
* Retrieves the selected index. Only applicable to select menus.
|
|
3891
|
+
* @return The selected index, which is a number for single selection and
|
|
3892
|
+
* radio lists, and an array of numbers for checkbox lists.
|
|
3893
|
+
*/
|
|
3894
|
+
get: function () {
|
|
3895
|
+
return this.list ? this.list.selectedIndex : numbers$4.UNSET_INDEX;
|
|
3896
|
+
},
|
|
3897
|
+
/**
|
|
3898
|
+
* Sets the selected index of the list. Only applicable to select menus.
|
|
3899
|
+
* @param index The selected index, which is a number for single selection and
|
|
3900
|
+
* radio lists, and an array of numbers for checkbox lists.
|
|
3901
|
+
*/
|
|
3902
|
+
set: function (index) {
|
|
3903
|
+
if (this.list) {
|
|
3904
|
+
this.list.selectedIndex = index;
|
|
3905
|
+
}
|
|
3906
|
+
},
|
|
3907
|
+
enumerable: false,
|
|
3908
|
+
configurable: true
|
|
3909
|
+
});
|
|
3910
|
+
Object.defineProperty(MDCMenu.prototype, "quickOpen", {
|
|
3911
|
+
set: function (quickOpen) {
|
|
3912
|
+
this.menuSurface.quickOpen = quickOpen;
|
|
2796
3913
|
},
|
|
2797
3914
|
enumerable: false,
|
|
2798
3915
|
configurable: true
|
|
2799
3916
|
});
|
|
2800
|
-
MDCMenuFoundation.prototype.destroy = function () {
|
|
2801
|
-
if (this.closeAnimationEndTimerId) {
|
|
2802
|
-
clearTimeout(this.closeAnimationEndTimerId);
|
|
2803
|
-
}
|
|
2804
|
-
this.adapter.closeSurface();
|
|
2805
|
-
};
|
|
2806
|
-
MDCMenuFoundation.prototype.handleKeydown = function (evt) {
|
|
2807
|
-
var key = evt.key, keyCode = evt.keyCode;
|
|
2808
|
-
var isTab = key === 'Tab' || keyCode === 9;
|
|
2809
|
-
if (isTab) {
|
|
2810
|
-
this.adapter.closeSurface(/** skipRestoreFocus */ true);
|
|
2811
|
-
}
|
|
2812
|
-
};
|
|
2813
|
-
MDCMenuFoundation.prototype.handleItemAction = function (listItem) {
|
|
2814
|
-
var _this = this;
|
|
2815
|
-
var index = this.adapter.getElementIndex(listItem);
|
|
2816
|
-
if (index < 0) {
|
|
2817
|
-
return;
|
|
2818
|
-
}
|
|
2819
|
-
this.adapter.notifySelected({ index: index });
|
|
2820
|
-
var skipRestoreFocus = this.adapter.getAttributeFromElementAtIndex(index, strings$3.SKIP_RESTORE_FOCUS) === 'true';
|
|
2821
|
-
this.adapter.closeSurface(skipRestoreFocus);
|
|
2822
|
-
// Wait for the menu to close before adding/removing classes that affect styles.
|
|
2823
|
-
this.closeAnimationEndTimerId = setTimeout(function () {
|
|
2824
|
-
// Recompute the index in case the menu contents have changed.
|
|
2825
|
-
var recomputedIndex = _this.adapter.getElementIndex(listItem);
|
|
2826
|
-
if (recomputedIndex >= 0 &&
|
|
2827
|
-
_this.adapter.isSelectableItemAtIndex(recomputedIndex)) {
|
|
2828
|
-
_this.setSelectedIndex(recomputedIndex);
|
|
2829
|
-
}
|
|
2830
|
-
}, MDCMenuSurfaceFoundation.numbers.TRANSITION_CLOSE_DURATION);
|
|
2831
|
-
};
|
|
2832
|
-
MDCMenuFoundation.prototype.handleMenuSurfaceOpened = function () {
|
|
2833
|
-
switch (this.defaultFocusState) {
|
|
2834
|
-
case DefaultFocusState.FIRST_ITEM:
|
|
2835
|
-
this.adapter.focusItemAtIndex(0);
|
|
2836
|
-
break;
|
|
2837
|
-
case DefaultFocusState.LAST_ITEM:
|
|
2838
|
-
this.adapter.focusItemAtIndex(this.adapter.getMenuItemCount() - 1);
|
|
2839
|
-
break;
|
|
2840
|
-
case DefaultFocusState.NONE:
|
|
2841
|
-
// Do nothing.
|
|
2842
|
-
break;
|
|
2843
|
-
default:
|
|
2844
|
-
this.adapter.focusListRoot();
|
|
2845
|
-
break;
|
|
2846
|
-
}
|
|
2847
|
-
};
|
|
2848
3917
|
/**
|
|
2849
3918
|
* Sets default focus state where the menu should focus every time when menu
|
|
2850
3919
|
* is opened. Focuses the list root (`DefaultFocusState.LIST_ROOT`) element by
|
|
2851
3920
|
* default.
|
|
3921
|
+
* @param focusState Default focus state.
|
|
2852
3922
|
*/
|
|
2853
|
-
|
|
2854
|
-
this.
|
|
3923
|
+
MDCMenu.prototype.setDefaultFocusState = function (focusState) {
|
|
3924
|
+
this.foundation.setDefaultFocusState(focusState);
|
|
2855
3925
|
};
|
|
2856
|
-
/**
|
|
2857
|
-
|
|
2858
|
-
|
|
3926
|
+
/**
|
|
3927
|
+
* @param corner Default anchor corner alignment of top-left menu corner.
|
|
3928
|
+
*/
|
|
3929
|
+
MDCMenu.prototype.setAnchorCorner = function (corner) {
|
|
3930
|
+
this.menuSurface.setAnchorCorner(corner);
|
|
3931
|
+
};
|
|
3932
|
+
MDCMenu.prototype.setAnchorMargin = function (margin) {
|
|
3933
|
+
this.menuSurface.setAnchorMargin(margin);
|
|
2859
3934
|
};
|
|
2860
3935
|
/**
|
|
2861
|
-
*
|
|
2862
|
-
* @param index Index of list item within
|
|
3936
|
+
* Sets the list item as the selected row at the specified index.
|
|
3937
|
+
* @param index Index of list item within menu.
|
|
2863
3938
|
*/
|
|
2864
|
-
|
|
2865
|
-
this.
|
|
2866
|
-
if (!this.adapter.isSelectableItemAtIndex(index)) {
|
|
2867
|
-
throw new Error('MDCMenuFoundation: No selection group at specified index.');
|
|
2868
|
-
}
|
|
2869
|
-
var prevSelectedIndex = this.adapter.getSelectedSiblingOfItemAtIndex(index);
|
|
2870
|
-
if (prevSelectedIndex >= 0) {
|
|
2871
|
-
this.adapter.removeAttributeFromElementAtIndex(prevSelectedIndex, strings$3.ARIA_CHECKED_ATTR);
|
|
2872
|
-
this.adapter.removeClassFromElementAtIndex(prevSelectedIndex, cssClasses$2.MENU_SELECTED_LIST_ITEM);
|
|
2873
|
-
}
|
|
2874
|
-
this.adapter.addClassToElementAtIndex(index, cssClasses$2.MENU_SELECTED_LIST_ITEM);
|
|
2875
|
-
this.adapter.addAttributeToElementAtIndex(index, strings$3.ARIA_CHECKED_ATTR, 'true');
|
|
2876
|
-
this.selectedIndex = index;
|
|
3939
|
+
MDCMenu.prototype.setSelectedIndex = function (index) {
|
|
3940
|
+
this.foundation.setSelectedIndex(index);
|
|
2877
3941
|
};
|
|
2878
3942
|
/**
|
|
2879
3943
|
* Sets the enabled state to isEnabled for the menu item at the given index.
|
|
2880
3944
|
* @param index Index of the menu item
|
|
2881
3945
|
* @param isEnabled The desired enabled state of the menu item.
|
|
2882
3946
|
*/
|
|
2883
|
-
|
|
2884
|
-
this.
|
|
2885
|
-
|
|
2886
|
-
|
|
2887
|
-
|
|
3947
|
+
MDCMenu.prototype.setEnabled = function (index, isEnabled) {
|
|
3948
|
+
this.foundation.setEnabled(index, isEnabled);
|
|
3949
|
+
};
|
|
3950
|
+
/**
|
|
3951
|
+
* @return The item within the menu at the index specified.
|
|
3952
|
+
*/
|
|
3953
|
+
MDCMenu.prototype.getOptionByIndex = function (index) {
|
|
3954
|
+
var items = this.items;
|
|
3955
|
+
if (index < items.length) {
|
|
3956
|
+
return this.items[index];
|
|
2888
3957
|
}
|
|
2889
3958
|
else {
|
|
2890
|
-
|
|
2891
|
-
this.adapter.addAttributeToElementAtIndex(index, strings$3.ARIA_DISABLED_ATTR, 'true');
|
|
3959
|
+
return null;
|
|
2892
3960
|
}
|
|
2893
3961
|
};
|
|
2894
|
-
|
|
2895
|
-
|
|
2896
|
-
|
|
2897
|
-
|
|
2898
|
-
|
|
3962
|
+
/**
|
|
3963
|
+
* @param index A menu item's index.
|
|
3964
|
+
* @return The primary text within the menu at the index specified.
|
|
3965
|
+
*/
|
|
3966
|
+
MDCMenu.prototype.getPrimaryTextAtIndex = function (index) {
|
|
3967
|
+
var item = this.getOptionByIndex(index);
|
|
3968
|
+
if (item && this.list) {
|
|
3969
|
+
return this.list.getPrimaryText(item) || '';
|
|
2899
3970
|
}
|
|
3971
|
+
return '';
|
|
2900
3972
|
};
|
|
2901
|
-
|
|
2902
|
-
|
|
3973
|
+
MDCMenu.prototype.setFixedPosition = function (isFixed) {
|
|
3974
|
+
this.menuSurface.setFixedPosition(isFixed);
|
|
3975
|
+
};
|
|
3976
|
+
MDCMenu.prototype.setIsHoisted = function (isHoisted) {
|
|
3977
|
+
this.menuSurface.setIsHoisted(isHoisted);
|
|
3978
|
+
};
|
|
3979
|
+
MDCMenu.prototype.setAbsolutePosition = function (x, y) {
|
|
3980
|
+
this.menuSurface.setAbsolutePosition(x, y);
|
|
3981
|
+
};
|
|
3982
|
+
/**
|
|
3983
|
+
* Sets the element that the menu-surface is anchored to.
|
|
3984
|
+
*/
|
|
3985
|
+
MDCMenu.prototype.setAnchorElement = function (element) {
|
|
3986
|
+
this.menuSurface.anchorElement = element;
|
|
3987
|
+
};
|
|
3988
|
+
MDCMenu.prototype.getDefaultFoundation = function () {
|
|
3989
|
+
var _this = this;
|
|
3990
|
+
// DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
|
|
3991
|
+
// To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
|
|
3992
|
+
// tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
|
|
3993
|
+
var adapter = {
|
|
3994
|
+
addClassToElementAtIndex: function (index, className) {
|
|
3995
|
+
var list = _this.items;
|
|
3996
|
+
list[index].classList.add(className);
|
|
3997
|
+
},
|
|
3998
|
+
removeClassFromElementAtIndex: function (index, className) {
|
|
3999
|
+
var list = _this.items;
|
|
4000
|
+
list[index].classList.remove(className);
|
|
4001
|
+
},
|
|
4002
|
+
addAttributeToElementAtIndex: function (index, attr, value) {
|
|
4003
|
+
var list = _this.items;
|
|
4004
|
+
list[index].setAttribute(attr, value);
|
|
4005
|
+
},
|
|
4006
|
+
removeAttributeFromElementAtIndex: function (index, attr) {
|
|
4007
|
+
var list = _this.items;
|
|
4008
|
+
list[index].removeAttribute(attr);
|
|
4009
|
+
},
|
|
4010
|
+
getAttributeFromElementAtIndex: function (index, attr) {
|
|
4011
|
+
var list = _this.items;
|
|
4012
|
+
return list[index].getAttribute(attr);
|
|
4013
|
+
},
|
|
4014
|
+
elementContainsClass: function (element, className) {
|
|
4015
|
+
return element.classList.contains(className);
|
|
4016
|
+
},
|
|
4017
|
+
closeSurface: function (skipRestoreFocus) {
|
|
4018
|
+
_this.menuSurface.close(skipRestoreFocus);
|
|
4019
|
+
},
|
|
4020
|
+
getElementIndex: function (element) { return _this.items.indexOf(element); },
|
|
4021
|
+
notifySelected: function (evtData) {
|
|
4022
|
+
_this.emit(strings$5.SELECTED_EVENT, {
|
|
4023
|
+
index: evtData.index,
|
|
4024
|
+
item: _this.items[evtData.index],
|
|
4025
|
+
});
|
|
4026
|
+
},
|
|
4027
|
+
getMenuItemCount: function () { return _this.items.length; },
|
|
4028
|
+
focusItemAtIndex: function (index) {
|
|
4029
|
+
_this.items[index].focus();
|
|
4030
|
+
},
|
|
4031
|
+
focusListRoot: function () {
|
|
4032
|
+
_this.root.querySelector(strings$5.LIST_SELECTOR).focus();
|
|
4033
|
+
},
|
|
4034
|
+
isSelectableItemAtIndex: function (index) {
|
|
4035
|
+
return !!closest(_this.items[index], "." + cssClasses$4.MENU_SELECTION_GROUP);
|
|
4036
|
+
},
|
|
4037
|
+
getSelectedSiblingOfItemAtIndex: function (index) {
|
|
4038
|
+
var selectionGroupEl = closest(_this.items[index], "." + cssClasses$4.MENU_SELECTION_GROUP);
|
|
4039
|
+
var selectedItemEl = selectionGroupEl.querySelector("." + cssClasses$4.MENU_SELECTED_LIST_ITEM);
|
|
4040
|
+
return selectedItemEl ? _this.items.indexOf(selectedItemEl) : -1;
|
|
4041
|
+
},
|
|
4042
|
+
};
|
|
4043
|
+
// tslint:enable:object-literal-sort-keys
|
|
4044
|
+
return new MDCMenuFoundation(adapter);
|
|
4045
|
+
};
|
|
4046
|
+
return MDCMenu;
|
|
4047
|
+
}(MDCComponent));
|
|
2903
4048
|
|
|
2904
4049
|
/**
|
|
2905
4050
|
* @license
|
|
@@ -2923,318 +4068,972 @@ var MDCMenuFoundation = /** @class */ (function (_super) {
|
|
|
2923
4068
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
2924
4069
|
* THE SOFTWARE.
|
|
2925
4070
|
*/
|
|
2926
|
-
var
|
|
2927
|
-
|
|
2928
|
-
|
|
2929
|
-
|
|
2930
|
-
|
|
2931
|
-
|
|
2932
|
-
|
|
2933
|
-
|
|
2934
|
-
|
|
2935
|
-
|
|
2936
|
-
|
|
2937
|
-
|
|
2938
|
-
|
|
2939
|
-
|
|
2940
|
-
|
|
2941
|
-
|
|
2942
|
-
|
|
2943
|
-
|
|
2944
|
-
|
|
2945
|
-
|
|
2946
|
-
|
|
2947
|
-
|
|
2948
|
-
|
|
2949
|
-
|
|
2950
|
-
|
|
2951
|
-
|
|
2952
|
-
|
|
2953
|
-
|
|
2954
|
-
|
|
2955
|
-
|
|
2956
|
-
|
|
2957
|
-
|
|
2958
|
-
|
|
2959
|
-
|
|
2960
|
-
|
|
2961
|
-
|
|
2962
|
-
|
|
2963
|
-
|
|
2964
|
-
|
|
2965
|
-
|
|
2966
|
-
|
|
2967
|
-
}
|
|
2968
|
-
this.menuSurface.destroy();
|
|
2969
|
-
this.menuSurface.unlisten(MDCMenuSurfaceFoundation.strings.OPENED_EVENT, this.handleMenuSurfaceOpened);
|
|
2970
|
-
this.unlisten('keydown', this.handleKeydown);
|
|
2971
|
-
this.unlisten(MDCListFoundation.strings.ACTION_EVENT, this.handleItemAction);
|
|
2972
|
-
_super.prototype.destroy.call(this);
|
|
2973
|
-
};
|
|
2974
|
-
Object.defineProperty(MDCMenu.prototype, "open", {
|
|
4071
|
+
var strings$4 = {
|
|
4072
|
+
NOTCH_ELEMENT_SELECTOR: '.mdc-notched-outline__notch',
|
|
4073
|
+
};
|
|
4074
|
+
var numbers$2 = {
|
|
4075
|
+
// This should stay in sync with $mdc-notched-outline-padding * 2.
|
|
4076
|
+
NOTCH_ELEMENT_PADDING: 8,
|
|
4077
|
+
};
|
|
4078
|
+
var cssClasses$3 = {
|
|
4079
|
+
NO_LABEL: 'mdc-notched-outline--no-label',
|
|
4080
|
+
OUTLINE_NOTCHED: 'mdc-notched-outline--notched',
|
|
4081
|
+
OUTLINE_UPGRADED: 'mdc-notched-outline--upgraded',
|
|
4082
|
+
};
|
|
4083
|
+
|
|
4084
|
+
/**
|
|
4085
|
+
* @license
|
|
4086
|
+
* Copyright 2017 Google Inc.
|
|
4087
|
+
*
|
|
4088
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4089
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
4090
|
+
* in the Software without restriction, including without limitation the rights
|
|
4091
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
4092
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
4093
|
+
* furnished to do so, subject to the following conditions:
|
|
4094
|
+
*
|
|
4095
|
+
* The above copyright notice and this permission notice shall be included in
|
|
4096
|
+
* all copies or substantial portions of the Software.
|
|
4097
|
+
*
|
|
4098
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
4099
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
4100
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
4101
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
4102
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
4103
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
4104
|
+
* THE SOFTWARE.
|
|
4105
|
+
*/
|
|
4106
|
+
var MDCNotchedOutlineFoundation = /** @class */ (function (_super) {
|
|
4107
|
+
__extends(MDCNotchedOutlineFoundation, _super);
|
|
4108
|
+
function MDCNotchedOutlineFoundation(adapter) {
|
|
4109
|
+
return _super.call(this, __assign(__assign({}, MDCNotchedOutlineFoundation.defaultAdapter), adapter)) || this;
|
|
4110
|
+
}
|
|
4111
|
+
Object.defineProperty(MDCNotchedOutlineFoundation, "strings", {
|
|
2975
4112
|
get: function () {
|
|
2976
|
-
return
|
|
2977
|
-
},
|
|
2978
|
-
set: function (value) {
|
|
2979
|
-
if (value) {
|
|
2980
|
-
this.menuSurface.open();
|
|
2981
|
-
}
|
|
2982
|
-
else {
|
|
2983
|
-
this.menuSurface.close();
|
|
2984
|
-
}
|
|
4113
|
+
return strings$4;
|
|
2985
4114
|
},
|
|
2986
4115
|
enumerable: false,
|
|
2987
4116
|
configurable: true
|
|
2988
4117
|
});
|
|
2989
|
-
Object.defineProperty(
|
|
4118
|
+
Object.defineProperty(MDCNotchedOutlineFoundation, "cssClasses", {
|
|
2990
4119
|
get: function () {
|
|
2991
|
-
return
|
|
2992
|
-
},
|
|
2993
|
-
set: function (value) {
|
|
2994
|
-
if (this.list) {
|
|
2995
|
-
this.list.wrapFocus = value;
|
|
2996
|
-
}
|
|
4120
|
+
return cssClasses$3;
|
|
2997
4121
|
},
|
|
2998
4122
|
enumerable: false,
|
|
2999
4123
|
configurable: true
|
|
3000
4124
|
});
|
|
3001
|
-
Object.defineProperty(
|
|
3002
|
-
|
|
3003
|
-
|
|
3004
|
-
* @param value Whether typeahead is enabled.
|
|
3005
|
-
*/
|
|
3006
|
-
set: function (value) {
|
|
3007
|
-
if (this.list) {
|
|
3008
|
-
this.list.hasTypeahead = value;
|
|
3009
|
-
}
|
|
4125
|
+
Object.defineProperty(MDCNotchedOutlineFoundation, "numbers", {
|
|
4126
|
+
get: function () {
|
|
4127
|
+
return numbers$2;
|
|
3010
4128
|
},
|
|
3011
4129
|
enumerable: false,
|
|
3012
4130
|
configurable: true
|
|
3013
4131
|
});
|
|
3014
|
-
Object.defineProperty(
|
|
4132
|
+
Object.defineProperty(MDCNotchedOutlineFoundation, "defaultAdapter", {
|
|
3015
4133
|
/**
|
|
3016
|
-
* @
|
|
4134
|
+
* See {@link MDCNotchedOutlineAdapter} for typing information on parameters and return types.
|
|
3017
4135
|
*/
|
|
3018
4136
|
get: function () {
|
|
3019
|
-
|
|
4137
|
+
// tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
|
|
4138
|
+
return {
|
|
4139
|
+
addClass: function () { return undefined; },
|
|
4140
|
+
removeClass: function () { return undefined; },
|
|
4141
|
+
setNotchWidthProperty: function () { return undefined; },
|
|
4142
|
+
removeNotchWidthProperty: function () { return undefined; },
|
|
4143
|
+
};
|
|
4144
|
+
// tslint:enable:object-literal-sort-keys
|
|
3020
4145
|
},
|
|
3021
4146
|
enumerable: false,
|
|
3022
4147
|
configurable: true
|
|
3023
4148
|
});
|
|
3024
4149
|
/**
|
|
3025
|
-
*
|
|
3026
|
-
* buffer. Then, attempts to find the next option matching the buffer. Wraps
|
|
3027
|
-
* around if at the end of options.
|
|
3028
|
-
*
|
|
3029
|
-
* @param nextChar The next character to add to the prefix buffer.
|
|
3030
|
-
* @param startingIndex The index from which to start matching. Only relevant
|
|
3031
|
-
* when starting a new match sequence. To start a new match sequence,
|
|
3032
|
-
* clear the buffer using `clearTypeaheadBuffer`, or wait for the buffer
|
|
3033
|
-
* to clear after a set interval defined in list foundation. Defaults to
|
|
3034
|
-
* the currently focused index.
|
|
3035
|
-
* @return The index of the matched item, or -1 if no match.
|
|
4150
|
+
* Adds the outline notched selector and updates the notch width calculated based off of notchWidth.
|
|
3036
4151
|
*/
|
|
3037
|
-
|
|
3038
|
-
|
|
3039
|
-
|
|
4152
|
+
MDCNotchedOutlineFoundation.prototype.notch = function (notchWidth) {
|
|
4153
|
+
var OUTLINE_NOTCHED = MDCNotchedOutlineFoundation.cssClasses.OUTLINE_NOTCHED;
|
|
4154
|
+
if (notchWidth > 0) {
|
|
4155
|
+
notchWidth += numbers$2.NOTCH_ELEMENT_PADDING; // Add padding from left/right.
|
|
3040
4156
|
}
|
|
3041
|
-
|
|
4157
|
+
this.adapter.setNotchWidthProperty(notchWidth);
|
|
4158
|
+
this.adapter.addClass(OUTLINE_NOTCHED);
|
|
3042
4159
|
};
|
|
3043
4160
|
/**
|
|
3044
|
-
*
|
|
3045
|
-
* to its structure.
|
|
4161
|
+
* Removes notched outline selector to close the notch in the outline.
|
|
3046
4162
|
*/
|
|
3047
|
-
|
|
3048
|
-
|
|
3049
|
-
|
|
4163
|
+
MDCNotchedOutlineFoundation.prototype.closeNotch = function () {
|
|
4164
|
+
var OUTLINE_NOTCHED = MDCNotchedOutlineFoundation.cssClasses.OUTLINE_NOTCHED;
|
|
4165
|
+
this.adapter.removeClass(OUTLINE_NOTCHED);
|
|
4166
|
+
this.adapter.removeNotchWidthProperty();
|
|
4167
|
+
};
|
|
4168
|
+
return MDCNotchedOutlineFoundation;
|
|
4169
|
+
}(MDCFoundation));
|
|
4170
|
+
|
|
4171
|
+
/**
|
|
4172
|
+
* @license
|
|
4173
|
+
* Copyright 2017 Google Inc.
|
|
4174
|
+
*
|
|
4175
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4176
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
4177
|
+
* in the Software without restriction, including without limitation the rights
|
|
4178
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
4179
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
4180
|
+
* furnished to do so, subject to the following conditions:
|
|
4181
|
+
*
|
|
4182
|
+
* The above copyright notice and this permission notice shall be included in
|
|
4183
|
+
* all copies or substantial portions of the Software.
|
|
4184
|
+
*
|
|
4185
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
4186
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
4187
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
4188
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
4189
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
4190
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
4191
|
+
* THE SOFTWARE.
|
|
4192
|
+
*/
|
|
4193
|
+
var MDCNotchedOutline = /** @class */ (function (_super) {
|
|
4194
|
+
__extends(MDCNotchedOutline, _super);
|
|
4195
|
+
function MDCNotchedOutline() {
|
|
4196
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
4197
|
+
}
|
|
4198
|
+
MDCNotchedOutline.attachTo = function (root) {
|
|
4199
|
+
return new MDCNotchedOutline(root);
|
|
4200
|
+
};
|
|
4201
|
+
MDCNotchedOutline.prototype.initialSyncWithDOM = function () {
|
|
4202
|
+
this.notchElement =
|
|
4203
|
+
this.root.querySelector(strings$4.NOTCH_ELEMENT_SELECTOR);
|
|
4204
|
+
var label = this.root.querySelector('.' + MDCFloatingLabelFoundation.cssClasses.ROOT);
|
|
4205
|
+
if (label) {
|
|
4206
|
+
label.style.transitionDuration = '0s';
|
|
4207
|
+
this.root.classList.add(cssClasses$3.OUTLINE_UPGRADED);
|
|
4208
|
+
requestAnimationFrame(function () {
|
|
4209
|
+
label.style.transitionDuration = '';
|
|
4210
|
+
});
|
|
4211
|
+
}
|
|
4212
|
+
else {
|
|
4213
|
+
this.root.classList.add(cssClasses$3.NO_LABEL);
|
|
3050
4214
|
}
|
|
3051
4215
|
};
|
|
3052
|
-
|
|
3053
|
-
|
|
3054
|
-
|
|
3055
|
-
|
|
3056
|
-
|
|
3057
|
-
|
|
3058
|
-
|
|
3059
|
-
|
|
3060
|
-
|
|
3061
|
-
|
|
3062
|
-
|
|
3063
|
-
|
|
3064
|
-
|
|
3065
|
-
|
|
3066
|
-
|
|
3067
|
-
|
|
3068
|
-
|
|
3069
|
-
|
|
3070
|
-
|
|
3071
|
-
|
|
3072
|
-
|
|
3073
|
-
|
|
4216
|
+
/**
|
|
4217
|
+
* Updates classes and styles to open the notch to the specified width.
|
|
4218
|
+
* @param notchWidth The notch width in the outline.
|
|
4219
|
+
*/
|
|
4220
|
+
MDCNotchedOutline.prototype.notch = function (notchWidth) {
|
|
4221
|
+
this.foundation.notch(notchWidth);
|
|
4222
|
+
};
|
|
4223
|
+
/**
|
|
4224
|
+
* Updates classes and styles to close the notch.
|
|
4225
|
+
*/
|
|
4226
|
+
MDCNotchedOutline.prototype.closeNotch = function () {
|
|
4227
|
+
this.foundation.closeNotch();
|
|
4228
|
+
};
|
|
4229
|
+
MDCNotchedOutline.prototype.getDefaultFoundation = function () {
|
|
4230
|
+
var _this = this;
|
|
4231
|
+
// DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
|
|
4232
|
+
// To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
|
|
4233
|
+
// tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
|
|
4234
|
+
var adapter = {
|
|
4235
|
+
addClass: function (className) { return _this.root.classList.add(className); },
|
|
4236
|
+
removeClass: function (className) { return _this.root.classList.remove(className); },
|
|
4237
|
+
setNotchWidthProperty: function (width) {
|
|
4238
|
+
_this.notchElement.style.setProperty('width', width + 'px');
|
|
4239
|
+
},
|
|
4240
|
+
removeNotchWidthProperty: function () {
|
|
4241
|
+
_this.notchElement.style.removeProperty('width');
|
|
4242
|
+
},
|
|
4243
|
+
};
|
|
4244
|
+
// tslint:enable:object-literal-sort-keys
|
|
4245
|
+
return new MDCNotchedOutlineFoundation(adapter);
|
|
4246
|
+
};
|
|
4247
|
+
return MDCNotchedOutline;
|
|
4248
|
+
}(MDCComponent));
|
|
4249
|
+
|
|
4250
|
+
/**
|
|
4251
|
+
* @license
|
|
4252
|
+
* Copyright 2019 Google Inc.
|
|
4253
|
+
*
|
|
4254
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4255
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
4256
|
+
* in the Software without restriction, including without limitation the rights
|
|
4257
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
4258
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
4259
|
+
* furnished to do so, subject to the following conditions:
|
|
4260
|
+
*
|
|
4261
|
+
* The above copyright notice and this permission notice shall be included in
|
|
4262
|
+
* all copies or substantial portions of the Software.
|
|
4263
|
+
*
|
|
4264
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
4265
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
4266
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
4267
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
4268
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
4269
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
4270
|
+
* THE SOFTWARE.
|
|
4271
|
+
*/
|
|
4272
|
+
/**
|
|
4273
|
+
* Determine whether the current browser supports passive event listeners, and
|
|
4274
|
+
* if so, use them.
|
|
4275
|
+
*/
|
|
4276
|
+
function applyPassive(globalObj) {
|
|
4277
|
+
if (globalObj === void 0) { globalObj = window; }
|
|
4278
|
+
return supportsPassiveOption(globalObj) ?
|
|
4279
|
+
{ passive: true } :
|
|
4280
|
+
false;
|
|
4281
|
+
}
|
|
4282
|
+
function supportsPassiveOption(globalObj) {
|
|
4283
|
+
if (globalObj === void 0) { globalObj = window; }
|
|
4284
|
+
// See
|
|
4285
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener
|
|
4286
|
+
var passiveSupported = false;
|
|
4287
|
+
try {
|
|
4288
|
+
var options = {
|
|
4289
|
+
// This function will be called when the browser
|
|
4290
|
+
// attempts to access the passive property.
|
|
4291
|
+
get passive() {
|
|
4292
|
+
passiveSupported = true;
|
|
4293
|
+
return false;
|
|
3074
4294
|
}
|
|
4295
|
+
};
|
|
4296
|
+
var handler = function () { };
|
|
4297
|
+
globalObj.document.addEventListener('test', handler, options);
|
|
4298
|
+
globalObj.document.removeEventListener('test', handler, options);
|
|
4299
|
+
}
|
|
4300
|
+
catch (err) {
|
|
4301
|
+
passiveSupported = false;
|
|
4302
|
+
}
|
|
4303
|
+
return passiveSupported;
|
|
4304
|
+
}
|
|
4305
|
+
|
|
4306
|
+
/**
|
|
4307
|
+
* @license
|
|
4308
|
+
* Copyright 2016 Google Inc.
|
|
4309
|
+
*
|
|
4310
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4311
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
4312
|
+
* in the Software without restriction, including without limitation the rights
|
|
4313
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
4314
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
4315
|
+
* furnished to do so, subject to the following conditions:
|
|
4316
|
+
*
|
|
4317
|
+
* The above copyright notice and this permission notice shall be included in
|
|
4318
|
+
* all copies or substantial portions of the Software.
|
|
4319
|
+
*
|
|
4320
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
4321
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
4322
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
4323
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
4324
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
4325
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
4326
|
+
* THE SOFTWARE.
|
|
4327
|
+
*/
|
|
4328
|
+
var cssClasses$2 = {
|
|
4329
|
+
// Ripple is a special case where the "root" component is really a "mixin" of sorts,
|
|
4330
|
+
// given that it's an 'upgrade' to an existing component. That being said it is the root
|
|
4331
|
+
// CSS class that all other CSS classes derive from.
|
|
4332
|
+
BG_FOCUSED: 'mdc-ripple-upgraded--background-focused',
|
|
4333
|
+
FG_ACTIVATION: 'mdc-ripple-upgraded--foreground-activation',
|
|
4334
|
+
FG_DEACTIVATION: 'mdc-ripple-upgraded--foreground-deactivation',
|
|
4335
|
+
ROOT: 'mdc-ripple-upgraded',
|
|
4336
|
+
UNBOUNDED: 'mdc-ripple-upgraded--unbounded',
|
|
4337
|
+
};
|
|
4338
|
+
var strings$3 = {
|
|
4339
|
+
VAR_FG_SCALE: '--mdc-ripple-fg-scale',
|
|
4340
|
+
VAR_FG_SIZE: '--mdc-ripple-fg-size',
|
|
4341
|
+
VAR_FG_TRANSLATE_END: '--mdc-ripple-fg-translate-end',
|
|
4342
|
+
VAR_FG_TRANSLATE_START: '--mdc-ripple-fg-translate-start',
|
|
4343
|
+
VAR_LEFT: '--mdc-ripple-left',
|
|
4344
|
+
VAR_TOP: '--mdc-ripple-top',
|
|
4345
|
+
};
|
|
4346
|
+
var numbers$1 = {
|
|
4347
|
+
DEACTIVATION_TIMEOUT_MS: 225,
|
|
4348
|
+
FG_DEACTIVATION_MS: 150,
|
|
4349
|
+
INITIAL_ORIGIN_SCALE: 0.6,
|
|
4350
|
+
PADDING: 10,
|
|
4351
|
+
TAP_DELAY_MS: 300, // Delay between touch and simulated mouse events on touch devices
|
|
4352
|
+
};
|
|
4353
|
+
|
|
4354
|
+
/**
|
|
4355
|
+
* Stores result from supportsCssVariables to avoid redundant processing to
|
|
4356
|
+
* detect CSS custom variable support.
|
|
4357
|
+
*/
|
|
4358
|
+
var supportsCssVariables_;
|
|
4359
|
+
function supportsCssVariables(windowObj, forceRefresh) {
|
|
4360
|
+
if (forceRefresh === void 0) { forceRefresh = false; }
|
|
4361
|
+
var CSS = windowObj.CSS;
|
|
4362
|
+
var supportsCssVars = supportsCssVariables_;
|
|
4363
|
+
if (typeof supportsCssVariables_ === 'boolean' && !forceRefresh) {
|
|
4364
|
+
return supportsCssVariables_;
|
|
4365
|
+
}
|
|
4366
|
+
var supportsFunctionPresent = CSS && typeof CSS.supports === 'function';
|
|
4367
|
+
if (!supportsFunctionPresent) {
|
|
4368
|
+
return false;
|
|
4369
|
+
}
|
|
4370
|
+
var explicitlySupportsCssVars = CSS.supports('--css-vars', 'yes');
|
|
4371
|
+
// See: https://bugs.webkit.org/show_bug.cgi?id=154669
|
|
4372
|
+
// See: README section on Safari
|
|
4373
|
+
var weAreFeatureDetectingSafari10plus = (CSS.supports('(--css-vars: yes)') &&
|
|
4374
|
+
CSS.supports('color', '#00000000'));
|
|
4375
|
+
supportsCssVars =
|
|
4376
|
+
explicitlySupportsCssVars || weAreFeatureDetectingSafari10plus;
|
|
4377
|
+
if (!forceRefresh) {
|
|
4378
|
+
supportsCssVariables_ = supportsCssVars;
|
|
4379
|
+
}
|
|
4380
|
+
return supportsCssVars;
|
|
4381
|
+
}
|
|
4382
|
+
function getNormalizedEventCoords(evt, pageOffset, clientRect) {
|
|
4383
|
+
if (!evt) {
|
|
4384
|
+
return { x: 0, y: 0 };
|
|
4385
|
+
}
|
|
4386
|
+
var x = pageOffset.x, y = pageOffset.y;
|
|
4387
|
+
var documentX = x + clientRect.left;
|
|
4388
|
+
var documentY = y + clientRect.top;
|
|
4389
|
+
var normalizedX;
|
|
4390
|
+
var normalizedY;
|
|
4391
|
+
// Determine touch point relative to the ripple container.
|
|
4392
|
+
if (evt.type === 'touchstart') {
|
|
4393
|
+
var touchEvent = evt;
|
|
4394
|
+
normalizedX = touchEvent.changedTouches[0].pageX - documentX;
|
|
4395
|
+
normalizedY = touchEvent.changedTouches[0].pageY - documentY;
|
|
4396
|
+
}
|
|
4397
|
+
else {
|
|
4398
|
+
var mouseEvent = evt;
|
|
4399
|
+
normalizedX = mouseEvent.pageX - documentX;
|
|
4400
|
+
normalizedY = mouseEvent.pageY - documentY;
|
|
4401
|
+
}
|
|
4402
|
+
return { x: normalizedX, y: normalizedY };
|
|
4403
|
+
}
|
|
4404
|
+
|
|
4405
|
+
/**
|
|
4406
|
+
* @license
|
|
4407
|
+
* Copyright 2016 Google Inc.
|
|
4408
|
+
*
|
|
4409
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4410
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
4411
|
+
* in the Software without restriction, including without limitation the rights
|
|
4412
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
4413
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
4414
|
+
* furnished to do so, subject to the following conditions:
|
|
4415
|
+
*
|
|
4416
|
+
* The above copyright notice and this permission notice shall be included in
|
|
4417
|
+
* all copies or substantial portions of the Software.
|
|
4418
|
+
*
|
|
4419
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
4420
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
4421
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
4422
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
4423
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
4424
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
4425
|
+
* THE SOFTWARE.
|
|
4426
|
+
*/
|
|
4427
|
+
// Activation events registered on the root element of each instance for activation
|
|
4428
|
+
var ACTIVATION_EVENT_TYPES = [
|
|
4429
|
+
'touchstart', 'pointerdown', 'mousedown', 'keydown',
|
|
4430
|
+
];
|
|
4431
|
+
// Deactivation events registered on documentElement when a pointer-related down event occurs
|
|
4432
|
+
var POINTER_DEACTIVATION_EVENT_TYPES = [
|
|
4433
|
+
'touchend', 'pointerup', 'mouseup', 'contextmenu',
|
|
4434
|
+
];
|
|
4435
|
+
// simultaneous nested activations
|
|
4436
|
+
var activatedTargets = [];
|
|
4437
|
+
var MDCRippleFoundation = /** @class */ (function (_super) {
|
|
4438
|
+
__extends(MDCRippleFoundation, _super);
|
|
4439
|
+
function MDCRippleFoundation(adapter) {
|
|
4440
|
+
var _this = _super.call(this, __assign(__assign({}, MDCRippleFoundation.defaultAdapter), adapter)) || this;
|
|
4441
|
+
_this.activationAnimationHasEnded = false;
|
|
4442
|
+
_this.activationTimer = 0;
|
|
4443
|
+
_this.fgDeactivationRemovalTimer = 0;
|
|
4444
|
+
_this.fgScale = '0';
|
|
4445
|
+
_this.frame = { width: 0, height: 0 };
|
|
4446
|
+
_this.initialSize = 0;
|
|
4447
|
+
_this.layoutFrame = 0;
|
|
4448
|
+
_this.maxRadius = 0;
|
|
4449
|
+
_this.unboundedCoords = { left: 0, top: 0 };
|
|
4450
|
+
_this.activationState = _this.defaultActivationState();
|
|
4451
|
+
_this.activationTimerCallback = function () {
|
|
4452
|
+
_this.activationAnimationHasEnded = true;
|
|
4453
|
+
_this.runDeactivationUXLogicIfReady();
|
|
4454
|
+
};
|
|
4455
|
+
_this.activateHandler = function (e) {
|
|
4456
|
+
_this.activateImpl(e);
|
|
4457
|
+
};
|
|
4458
|
+
_this.deactivateHandler = function () {
|
|
4459
|
+
_this.deactivateImpl();
|
|
4460
|
+
};
|
|
4461
|
+
_this.focusHandler = function () {
|
|
4462
|
+
_this.handleFocus();
|
|
4463
|
+
};
|
|
4464
|
+
_this.blurHandler = function () {
|
|
4465
|
+
_this.handleBlur();
|
|
4466
|
+
};
|
|
4467
|
+
_this.resizeHandler = function () {
|
|
4468
|
+
_this.layout();
|
|
4469
|
+
};
|
|
4470
|
+
return _this;
|
|
4471
|
+
}
|
|
4472
|
+
Object.defineProperty(MDCRippleFoundation, "cssClasses", {
|
|
4473
|
+
get: function () {
|
|
4474
|
+
return cssClasses$2;
|
|
3075
4475
|
},
|
|
3076
4476
|
enumerable: false,
|
|
3077
4477
|
configurable: true
|
|
3078
4478
|
});
|
|
3079
|
-
Object.defineProperty(
|
|
3080
|
-
|
|
3081
|
-
|
|
3082
|
-
* @return The selected index, which is a number for single selection and
|
|
3083
|
-
* radio lists, and an array of numbers for checkbox lists.
|
|
3084
|
-
*/
|
|
3085
|
-
get: function () {
|
|
3086
|
-
return this.list ? this.list.selectedIndex : numbers$2.UNSET_INDEX;
|
|
3087
|
-
},
|
|
3088
|
-
/**
|
|
3089
|
-
* Sets the selected index of the list. Only applicable to select menus.
|
|
3090
|
-
* @param index The selected index, which is a number for single selection and
|
|
3091
|
-
* radio lists, and an array of numbers for checkbox lists.
|
|
3092
|
-
*/
|
|
3093
|
-
set: function (index) {
|
|
3094
|
-
if (this.list) {
|
|
3095
|
-
this.list.selectedIndex = index;
|
|
3096
|
-
}
|
|
4479
|
+
Object.defineProperty(MDCRippleFoundation, "strings", {
|
|
4480
|
+
get: function () {
|
|
4481
|
+
return strings$3;
|
|
3097
4482
|
},
|
|
3098
4483
|
enumerable: false,
|
|
3099
4484
|
configurable: true
|
|
3100
4485
|
});
|
|
3101
|
-
Object.defineProperty(
|
|
3102
|
-
|
|
3103
|
-
|
|
4486
|
+
Object.defineProperty(MDCRippleFoundation, "numbers", {
|
|
4487
|
+
get: function () {
|
|
4488
|
+
return numbers$1;
|
|
3104
4489
|
},
|
|
3105
4490
|
enumerable: false,
|
|
3106
4491
|
configurable: true
|
|
3107
4492
|
});
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
|
|
3111
|
-
|
|
3112
|
-
|
|
3113
|
-
|
|
3114
|
-
|
|
3115
|
-
|
|
4493
|
+
Object.defineProperty(MDCRippleFoundation, "defaultAdapter", {
|
|
4494
|
+
get: function () {
|
|
4495
|
+
return {
|
|
4496
|
+
addClass: function () { return undefined; },
|
|
4497
|
+
browserSupportsCssVars: function () { return true; },
|
|
4498
|
+
computeBoundingRect: function () {
|
|
4499
|
+
return ({ top: 0, right: 0, bottom: 0, left: 0, width: 0, height: 0 });
|
|
4500
|
+
},
|
|
4501
|
+
containsEventTarget: function () { return true; },
|
|
4502
|
+
deregisterDocumentInteractionHandler: function () { return undefined; },
|
|
4503
|
+
deregisterInteractionHandler: function () { return undefined; },
|
|
4504
|
+
deregisterResizeHandler: function () { return undefined; },
|
|
4505
|
+
getWindowPageOffset: function () { return ({ x: 0, y: 0 }); },
|
|
4506
|
+
isSurfaceActive: function () { return true; },
|
|
4507
|
+
isSurfaceDisabled: function () { return true; },
|
|
4508
|
+
isUnbounded: function () { return true; },
|
|
4509
|
+
registerDocumentInteractionHandler: function () { return undefined; },
|
|
4510
|
+
registerInteractionHandler: function () { return undefined; },
|
|
4511
|
+
registerResizeHandler: function () { return undefined; },
|
|
4512
|
+
removeClass: function () { return undefined; },
|
|
4513
|
+
updateCssVariable: function () { return undefined; },
|
|
4514
|
+
};
|
|
4515
|
+
},
|
|
4516
|
+
enumerable: false,
|
|
4517
|
+
configurable: true
|
|
4518
|
+
});
|
|
4519
|
+
MDCRippleFoundation.prototype.init = function () {
|
|
4520
|
+
var _this = this;
|
|
4521
|
+
var supportsPressRipple = this.supportsPressRipple();
|
|
4522
|
+
this.registerRootHandlers(supportsPressRipple);
|
|
4523
|
+
if (supportsPressRipple) {
|
|
4524
|
+
var _a = MDCRippleFoundation.cssClasses, ROOT_1 = _a.ROOT, UNBOUNDED_1 = _a.UNBOUNDED;
|
|
4525
|
+
requestAnimationFrame(function () {
|
|
4526
|
+
_this.adapter.addClass(ROOT_1);
|
|
4527
|
+
if (_this.adapter.isUnbounded()) {
|
|
4528
|
+
_this.adapter.addClass(UNBOUNDED_1);
|
|
4529
|
+
// Unbounded ripples need layout logic applied immediately to set coordinates for both shade and ripple
|
|
4530
|
+
_this.layoutInternal();
|
|
4531
|
+
}
|
|
4532
|
+
});
|
|
4533
|
+
}
|
|
4534
|
+
};
|
|
4535
|
+
MDCRippleFoundation.prototype.destroy = function () {
|
|
4536
|
+
var _this = this;
|
|
4537
|
+
if (this.supportsPressRipple()) {
|
|
4538
|
+
if (this.activationTimer) {
|
|
4539
|
+
clearTimeout(this.activationTimer);
|
|
4540
|
+
this.activationTimer = 0;
|
|
4541
|
+
this.adapter.removeClass(MDCRippleFoundation.cssClasses.FG_ACTIVATION);
|
|
4542
|
+
}
|
|
4543
|
+
if (this.fgDeactivationRemovalTimer) {
|
|
4544
|
+
clearTimeout(this.fgDeactivationRemovalTimer);
|
|
4545
|
+
this.fgDeactivationRemovalTimer = 0;
|
|
4546
|
+
this.adapter.removeClass(MDCRippleFoundation.cssClasses.FG_DEACTIVATION);
|
|
4547
|
+
}
|
|
4548
|
+
var _a = MDCRippleFoundation.cssClasses, ROOT_2 = _a.ROOT, UNBOUNDED_2 = _a.UNBOUNDED;
|
|
4549
|
+
requestAnimationFrame(function () {
|
|
4550
|
+
_this.adapter.removeClass(ROOT_2);
|
|
4551
|
+
_this.adapter.removeClass(UNBOUNDED_2);
|
|
4552
|
+
_this.removeCssVars();
|
|
4553
|
+
});
|
|
4554
|
+
}
|
|
4555
|
+
this.deregisterRootHandlers();
|
|
4556
|
+
this.deregisterDeactivationHandlers();
|
|
3116
4557
|
};
|
|
3117
4558
|
/**
|
|
3118
|
-
* @param
|
|
4559
|
+
* @param evt Optional event containing position information.
|
|
3119
4560
|
*/
|
|
3120
|
-
|
|
3121
|
-
this.
|
|
4561
|
+
MDCRippleFoundation.prototype.activate = function (evt) {
|
|
4562
|
+
this.activateImpl(evt);
|
|
3122
4563
|
};
|
|
3123
|
-
|
|
3124
|
-
this.
|
|
4564
|
+
MDCRippleFoundation.prototype.deactivate = function () {
|
|
4565
|
+
this.deactivateImpl();
|
|
3125
4566
|
};
|
|
3126
|
-
|
|
3127
|
-
|
|
3128
|
-
|
|
3129
|
-
|
|
3130
|
-
|
|
3131
|
-
this.
|
|
4567
|
+
MDCRippleFoundation.prototype.layout = function () {
|
|
4568
|
+
var _this = this;
|
|
4569
|
+
if (this.layoutFrame) {
|
|
4570
|
+
cancelAnimationFrame(this.layoutFrame);
|
|
4571
|
+
}
|
|
4572
|
+
this.layoutFrame = requestAnimationFrame(function () {
|
|
4573
|
+
_this.layoutInternal();
|
|
4574
|
+
_this.layoutFrame = 0;
|
|
4575
|
+
});
|
|
4576
|
+
};
|
|
4577
|
+
MDCRippleFoundation.prototype.setUnbounded = function (unbounded) {
|
|
4578
|
+
var UNBOUNDED = MDCRippleFoundation.cssClasses.UNBOUNDED;
|
|
4579
|
+
if (unbounded) {
|
|
4580
|
+
this.adapter.addClass(UNBOUNDED);
|
|
4581
|
+
}
|
|
4582
|
+
else {
|
|
4583
|
+
this.adapter.removeClass(UNBOUNDED);
|
|
4584
|
+
}
|
|
4585
|
+
};
|
|
4586
|
+
MDCRippleFoundation.prototype.handleFocus = function () {
|
|
4587
|
+
var _this = this;
|
|
4588
|
+
requestAnimationFrame(function () { return _this.adapter.addClass(MDCRippleFoundation.cssClasses.BG_FOCUSED); });
|
|
4589
|
+
};
|
|
4590
|
+
MDCRippleFoundation.prototype.handleBlur = function () {
|
|
4591
|
+
var _this = this;
|
|
4592
|
+
requestAnimationFrame(function () { return _this.adapter.removeClass(MDCRippleFoundation.cssClasses.BG_FOCUSED); });
|
|
3132
4593
|
};
|
|
3133
4594
|
/**
|
|
3134
|
-
*
|
|
3135
|
-
*
|
|
3136
|
-
*
|
|
4595
|
+
* We compute this property so that we are not querying information about the client
|
|
4596
|
+
* until the point in time where the foundation requests it. This prevents scenarios where
|
|
4597
|
+
* client-side feature-detection may happen too early, such as when components are rendered on the server
|
|
4598
|
+
* and then initialized at mount time on the client.
|
|
3137
4599
|
*/
|
|
3138
|
-
|
|
3139
|
-
this.
|
|
4600
|
+
MDCRippleFoundation.prototype.supportsPressRipple = function () {
|
|
4601
|
+
return this.adapter.browserSupportsCssVars();
|
|
4602
|
+
};
|
|
4603
|
+
MDCRippleFoundation.prototype.defaultActivationState = function () {
|
|
4604
|
+
return {
|
|
4605
|
+
activationEvent: undefined,
|
|
4606
|
+
hasDeactivationUXRun: false,
|
|
4607
|
+
isActivated: false,
|
|
4608
|
+
isProgrammatic: false,
|
|
4609
|
+
wasActivatedByPointer: false,
|
|
4610
|
+
wasElementMadeActive: false,
|
|
4611
|
+
};
|
|
3140
4612
|
};
|
|
3141
4613
|
/**
|
|
3142
|
-
*
|
|
4614
|
+
* supportsPressRipple Passed from init to save a redundant function call
|
|
3143
4615
|
*/
|
|
3144
|
-
|
|
3145
|
-
var
|
|
3146
|
-
if (
|
|
3147
|
-
|
|
4616
|
+
MDCRippleFoundation.prototype.registerRootHandlers = function (supportsPressRipple) {
|
|
4617
|
+
var e_1, _a;
|
|
4618
|
+
if (supportsPressRipple) {
|
|
4619
|
+
try {
|
|
4620
|
+
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()) {
|
|
4621
|
+
var evtType = ACTIVATION_EVENT_TYPES_1_1.value;
|
|
4622
|
+
this.adapter.registerInteractionHandler(evtType, this.activateHandler);
|
|
4623
|
+
}
|
|
4624
|
+
}
|
|
4625
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
4626
|
+
finally {
|
|
4627
|
+
try {
|
|
4628
|
+
if (ACTIVATION_EVENT_TYPES_1_1 && !ACTIVATION_EVENT_TYPES_1_1.done && (_a = ACTIVATION_EVENT_TYPES_1.return)) _a.call(ACTIVATION_EVENT_TYPES_1);
|
|
4629
|
+
}
|
|
4630
|
+
finally { if (e_1) throw e_1.error; }
|
|
4631
|
+
}
|
|
4632
|
+
if (this.adapter.isUnbounded()) {
|
|
4633
|
+
this.adapter.registerResizeHandler(this.resizeHandler);
|
|
4634
|
+
}
|
|
4635
|
+
}
|
|
4636
|
+
this.adapter.registerInteractionHandler('focus', this.focusHandler);
|
|
4637
|
+
this.adapter.registerInteractionHandler('blur', this.blurHandler);
|
|
4638
|
+
};
|
|
4639
|
+
MDCRippleFoundation.prototype.registerDeactivationHandlers = function (evt) {
|
|
4640
|
+
var e_2, _a;
|
|
4641
|
+
if (evt.type === 'keydown') {
|
|
4642
|
+
this.adapter.registerInteractionHandler('keyup', this.deactivateHandler);
|
|
3148
4643
|
}
|
|
3149
4644
|
else {
|
|
3150
|
-
|
|
4645
|
+
try {
|
|
4646
|
+
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()) {
|
|
4647
|
+
var evtType = POINTER_DEACTIVATION_EVENT_TYPES_1_1.value;
|
|
4648
|
+
this.adapter.registerDocumentInteractionHandler(evtType, this.deactivateHandler);
|
|
4649
|
+
}
|
|
4650
|
+
}
|
|
4651
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
4652
|
+
finally {
|
|
4653
|
+
try {
|
|
4654
|
+
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);
|
|
4655
|
+
}
|
|
4656
|
+
finally { if (e_2) throw e_2.error; }
|
|
4657
|
+
}
|
|
3151
4658
|
}
|
|
3152
4659
|
};
|
|
3153
|
-
|
|
3154
|
-
|
|
3155
|
-
|
|
3156
|
-
|
|
3157
|
-
|
|
3158
|
-
|
|
3159
|
-
|
|
3160
|
-
|
|
4660
|
+
MDCRippleFoundation.prototype.deregisterRootHandlers = function () {
|
|
4661
|
+
var e_3, _a;
|
|
4662
|
+
try {
|
|
4663
|
+
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()) {
|
|
4664
|
+
var evtType = ACTIVATION_EVENT_TYPES_2_1.value;
|
|
4665
|
+
this.adapter.deregisterInteractionHandler(evtType, this.activateHandler);
|
|
4666
|
+
}
|
|
4667
|
+
}
|
|
4668
|
+
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
4669
|
+
finally {
|
|
4670
|
+
try {
|
|
4671
|
+
if (ACTIVATION_EVENT_TYPES_2_1 && !ACTIVATION_EVENT_TYPES_2_1.done && (_a = ACTIVATION_EVENT_TYPES_2.return)) _a.call(ACTIVATION_EVENT_TYPES_2);
|
|
4672
|
+
}
|
|
4673
|
+
finally { if (e_3) throw e_3.error; }
|
|
4674
|
+
}
|
|
4675
|
+
this.adapter.deregisterInteractionHandler('focus', this.focusHandler);
|
|
4676
|
+
this.adapter.deregisterInteractionHandler('blur', this.blurHandler);
|
|
4677
|
+
if (this.adapter.isUnbounded()) {
|
|
4678
|
+
this.adapter.deregisterResizeHandler(this.resizeHandler);
|
|
3161
4679
|
}
|
|
3162
|
-
return '';
|
|
3163
4680
|
};
|
|
3164
|
-
|
|
3165
|
-
|
|
4681
|
+
MDCRippleFoundation.prototype.deregisterDeactivationHandlers = function () {
|
|
4682
|
+
var e_4, _a;
|
|
4683
|
+
this.adapter.deregisterInteractionHandler('keyup', this.deactivateHandler);
|
|
4684
|
+
try {
|
|
4685
|
+
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()) {
|
|
4686
|
+
var evtType = POINTER_DEACTIVATION_EVENT_TYPES_2_1.value;
|
|
4687
|
+
this.adapter.deregisterDocumentInteractionHandler(evtType, this.deactivateHandler);
|
|
4688
|
+
}
|
|
4689
|
+
}
|
|
4690
|
+
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
4691
|
+
finally {
|
|
4692
|
+
try {
|
|
4693
|
+
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);
|
|
4694
|
+
}
|
|
4695
|
+
finally { if (e_4) throw e_4.error; }
|
|
4696
|
+
}
|
|
3166
4697
|
};
|
|
3167
|
-
|
|
3168
|
-
this
|
|
4698
|
+
MDCRippleFoundation.prototype.removeCssVars = function () {
|
|
4699
|
+
var _this = this;
|
|
4700
|
+
var rippleStrings = MDCRippleFoundation.strings;
|
|
4701
|
+
var keys = Object.keys(rippleStrings);
|
|
4702
|
+
keys.forEach(function (key) {
|
|
4703
|
+
if (key.indexOf('VAR_') === 0) {
|
|
4704
|
+
_this.adapter.updateCssVariable(rippleStrings[key], null);
|
|
4705
|
+
}
|
|
4706
|
+
});
|
|
3169
4707
|
};
|
|
3170
|
-
|
|
3171
|
-
this
|
|
4708
|
+
MDCRippleFoundation.prototype.activateImpl = function (evt) {
|
|
4709
|
+
var _this = this;
|
|
4710
|
+
if (this.adapter.isSurfaceDisabled()) {
|
|
4711
|
+
return;
|
|
4712
|
+
}
|
|
4713
|
+
var activationState = this.activationState;
|
|
4714
|
+
if (activationState.isActivated) {
|
|
4715
|
+
return;
|
|
4716
|
+
}
|
|
4717
|
+
// Avoid reacting to follow-on events fired by touch device after an already-processed user interaction
|
|
4718
|
+
var previousActivationEvent = this.previousActivationEvent;
|
|
4719
|
+
var isSameInteraction = previousActivationEvent && evt !== undefined && previousActivationEvent.type !== evt.type;
|
|
4720
|
+
if (isSameInteraction) {
|
|
4721
|
+
return;
|
|
4722
|
+
}
|
|
4723
|
+
activationState.isActivated = true;
|
|
4724
|
+
activationState.isProgrammatic = evt === undefined;
|
|
4725
|
+
activationState.activationEvent = evt;
|
|
4726
|
+
activationState.wasActivatedByPointer = activationState.isProgrammatic ? false : evt !== undefined && (evt.type === 'mousedown' || evt.type === 'touchstart' || evt.type === 'pointerdown');
|
|
4727
|
+
var hasActivatedChild = evt !== undefined &&
|
|
4728
|
+
activatedTargets.length > 0 &&
|
|
4729
|
+
activatedTargets.some(function (target) { return _this.adapter.containsEventTarget(target); });
|
|
4730
|
+
if (hasActivatedChild) {
|
|
4731
|
+
// Immediately reset activation state, while preserving logic that prevents touch follow-on events
|
|
4732
|
+
this.resetActivationState();
|
|
4733
|
+
return;
|
|
4734
|
+
}
|
|
4735
|
+
if (evt !== undefined) {
|
|
4736
|
+
activatedTargets.push(evt.target);
|
|
4737
|
+
this.registerDeactivationHandlers(evt);
|
|
4738
|
+
}
|
|
4739
|
+
activationState.wasElementMadeActive = this.checkElementMadeActive(evt);
|
|
4740
|
+
if (activationState.wasElementMadeActive) {
|
|
4741
|
+
this.animateActivation();
|
|
4742
|
+
}
|
|
4743
|
+
requestAnimationFrame(function () {
|
|
4744
|
+
// Reset array on next frame after the current event has had a chance to bubble to prevent ancestor ripples
|
|
4745
|
+
activatedTargets = [];
|
|
4746
|
+
if (!activationState.wasElementMadeActive
|
|
4747
|
+
&& evt !== undefined
|
|
4748
|
+
&& (evt.key === ' ' || evt.keyCode === 32)) {
|
|
4749
|
+
// If space was pressed, try again within an rAF call to detect :active, because different UAs report
|
|
4750
|
+
// active states inconsistently when they're called within event handling code:
|
|
4751
|
+
// - https://bugs.chromium.org/p/chromium/issues/detail?id=635971
|
|
4752
|
+
// - https://bugzilla.mozilla.org/show_bug.cgi?id=1293741
|
|
4753
|
+
// We try first outside rAF to support Edge, which does not exhibit this problem, but will crash if a CSS
|
|
4754
|
+
// variable is set within a rAF callback for a submit button interaction (#2241).
|
|
4755
|
+
activationState.wasElementMadeActive = _this.checkElementMadeActive(evt);
|
|
4756
|
+
if (activationState.wasElementMadeActive) {
|
|
4757
|
+
_this.animateActivation();
|
|
4758
|
+
}
|
|
4759
|
+
}
|
|
4760
|
+
if (!activationState.wasElementMadeActive) {
|
|
4761
|
+
// Reset activation state immediately if element was not made active.
|
|
4762
|
+
_this.activationState = _this.defaultActivationState();
|
|
4763
|
+
}
|
|
4764
|
+
});
|
|
3172
4765
|
};
|
|
3173
|
-
|
|
3174
|
-
|
|
3175
|
-
|
|
3176
|
-
|
|
3177
|
-
this.menuSurface.anchorElement = element;
|
|
4766
|
+
MDCRippleFoundation.prototype.checkElementMadeActive = function (evt) {
|
|
4767
|
+
return (evt !== undefined && evt.type === 'keydown') ?
|
|
4768
|
+
this.adapter.isSurfaceActive() :
|
|
4769
|
+
true;
|
|
3178
4770
|
};
|
|
3179
|
-
|
|
4771
|
+
MDCRippleFoundation.prototype.animateActivation = function () {
|
|
3180
4772
|
var _this = this;
|
|
3181
|
-
|
|
3182
|
-
|
|
3183
|
-
|
|
3184
|
-
|
|
3185
|
-
|
|
3186
|
-
|
|
3187
|
-
|
|
3188
|
-
|
|
3189
|
-
|
|
3190
|
-
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
|
|
3196
|
-
|
|
3197
|
-
|
|
3198
|
-
|
|
3199
|
-
|
|
3200
|
-
|
|
3201
|
-
|
|
3202
|
-
|
|
3203
|
-
|
|
4773
|
+
var _a = MDCRippleFoundation.strings, VAR_FG_TRANSLATE_START = _a.VAR_FG_TRANSLATE_START, VAR_FG_TRANSLATE_END = _a.VAR_FG_TRANSLATE_END;
|
|
4774
|
+
var _b = MDCRippleFoundation.cssClasses, FG_DEACTIVATION = _b.FG_DEACTIVATION, FG_ACTIVATION = _b.FG_ACTIVATION;
|
|
4775
|
+
var DEACTIVATION_TIMEOUT_MS = MDCRippleFoundation.numbers.DEACTIVATION_TIMEOUT_MS;
|
|
4776
|
+
this.layoutInternal();
|
|
4777
|
+
var translateStart = '';
|
|
4778
|
+
var translateEnd = '';
|
|
4779
|
+
if (!this.adapter.isUnbounded()) {
|
|
4780
|
+
var _c = this.getFgTranslationCoordinates(), startPoint = _c.startPoint, endPoint = _c.endPoint;
|
|
4781
|
+
translateStart = startPoint.x + "px, " + startPoint.y + "px";
|
|
4782
|
+
translateEnd = endPoint.x + "px, " + endPoint.y + "px";
|
|
4783
|
+
}
|
|
4784
|
+
this.adapter.updateCssVariable(VAR_FG_TRANSLATE_START, translateStart);
|
|
4785
|
+
this.adapter.updateCssVariable(VAR_FG_TRANSLATE_END, translateEnd);
|
|
4786
|
+
// Cancel any ongoing activation/deactivation animations
|
|
4787
|
+
clearTimeout(this.activationTimer);
|
|
4788
|
+
clearTimeout(this.fgDeactivationRemovalTimer);
|
|
4789
|
+
this.rmBoundedActivationClasses();
|
|
4790
|
+
this.adapter.removeClass(FG_DEACTIVATION);
|
|
4791
|
+
// Force layout in order to re-trigger the animation.
|
|
4792
|
+
this.adapter.computeBoundingRect();
|
|
4793
|
+
this.adapter.addClass(FG_ACTIVATION);
|
|
4794
|
+
this.activationTimer = setTimeout(function () {
|
|
4795
|
+
_this.activationTimerCallback();
|
|
4796
|
+
}, DEACTIVATION_TIMEOUT_MS);
|
|
4797
|
+
};
|
|
4798
|
+
MDCRippleFoundation.prototype.getFgTranslationCoordinates = function () {
|
|
4799
|
+
var _a = this.activationState, activationEvent = _a.activationEvent, wasActivatedByPointer = _a.wasActivatedByPointer;
|
|
4800
|
+
var startPoint;
|
|
4801
|
+
if (wasActivatedByPointer) {
|
|
4802
|
+
startPoint = getNormalizedEventCoords(activationEvent, this.adapter.getWindowPageOffset(), this.adapter.computeBoundingRect());
|
|
4803
|
+
}
|
|
4804
|
+
else {
|
|
4805
|
+
startPoint = {
|
|
4806
|
+
x: this.frame.width / 2,
|
|
4807
|
+
y: this.frame.height / 2,
|
|
4808
|
+
};
|
|
4809
|
+
}
|
|
4810
|
+
// Center the element around the start point.
|
|
4811
|
+
startPoint = {
|
|
4812
|
+
x: startPoint.x - (this.initialSize / 2),
|
|
4813
|
+
y: startPoint.y - (this.initialSize / 2),
|
|
4814
|
+
};
|
|
4815
|
+
var endPoint = {
|
|
4816
|
+
x: (this.frame.width / 2) - (this.initialSize / 2),
|
|
4817
|
+
y: (this.frame.height / 2) - (this.initialSize / 2),
|
|
4818
|
+
};
|
|
4819
|
+
return { startPoint: startPoint, endPoint: endPoint };
|
|
4820
|
+
};
|
|
4821
|
+
MDCRippleFoundation.prototype.runDeactivationUXLogicIfReady = function () {
|
|
4822
|
+
var _this = this;
|
|
4823
|
+
// This method is called both when a pointing device is released, and when the activation animation ends.
|
|
4824
|
+
// The deactivation animation should only run after both of those occur.
|
|
4825
|
+
var FG_DEACTIVATION = MDCRippleFoundation.cssClasses.FG_DEACTIVATION;
|
|
4826
|
+
var _a = this.activationState, hasDeactivationUXRun = _a.hasDeactivationUXRun, isActivated = _a.isActivated;
|
|
4827
|
+
var activationHasEnded = hasDeactivationUXRun || !isActivated;
|
|
4828
|
+
if (activationHasEnded && this.activationAnimationHasEnded) {
|
|
4829
|
+
this.rmBoundedActivationClasses();
|
|
4830
|
+
this.adapter.addClass(FG_DEACTIVATION);
|
|
4831
|
+
this.fgDeactivationRemovalTimer = setTimeout(function () {
|
|
4832
|
+
_this.adapter.removeClass(FG_DEACTIVATION);
|
|
4833
|
+
}, numbers$1.FG_DEACTIVATION_MS);
|
|
4834
|
+
}
|
|
4835
|
+
};
|
|
4836
|
+
MDCRippleFoundation.prototype.rmBoundedActivationClasses = function () {
|
|
4837
|
+
var FG_ACTIVATION = MDCRippleFoundation.cssClasses.FG_ACTIVATION;
|
|
4838
|
+
this.adapter.removeClass(FG_ACTIVATION);
|
|
4839
|
+
this.activationAnimationHasEnded = false;
|
|
4840
|
+
this.adapter.computeBoundingRect();
|
|
4841
|
+
};
|
|
4842
|
+
MDCRippleFoundation.prototype.resetActivationState = function () {
|
|
4843
|
+
var _this = this;
|
|
4844
|
+
this.previousActivationEvent = this.activationState.activationEvent;
|
|
4845
|
+
this.activationState = this.defaultActivationState();
|
|
4846
|
+
// Touch devices may fire additional events for the same interaction within a short time.
|
|
4847
|
+
// Store the previous event until it's safe to assume that subsequent events are for new interactions.
|
|
4848
|
+
setTimeout(function () { return _this.previousActivationEvent = undefined; }, MDCRippleFoundation.numbers.TAP_DELAY_MS);
|
|
4849
|
+
};
|
|
4850
|
+
MDCRippleFoundation.prototype.deactivateImpl = function () {
|
|
4851
|
+
var _this = this;
|
|
4852
|
+
var activationState = this.activationState;
|
|
4853
|
+
// This can happen in scenarios such as when you have a keyup event that blurs the element.
|
|
4854
|
+
if (!activationState.isActivated) {
|
|
4855
|
+
return;
|
|
4856
|
+
}
|
|
4857
|
+
var state = __assign({}, activationState);
|
|
4858
|
+
if (activationState.isProgrammatic) {
|
|
4859
|
+
requestAnimationFrame(function () {
|
|
4860
|
+
_this.animateDeactivation(state);
|
|
4861
|
+
});
|
|
4862
|
+
this.resetActivationState();
|
|
4863
|
+
}
|
|
4864
|
+
else {
|
|
4865
|
+
this.deregisterDeactivationHandlers();
|
|
4866
|
+
requestAnimationFrame(function () {
|
|
4867
|
+
_this.activationState.hasDeactivationUXRun = true;
|
|
4868
|
+
_this.animateDeactivation(state);
|
|
4869
|
+
_this.resetActivationState();
|
|
4870
|
+
});
|
|
4871
|
+
}
|
|
4872
|
+
};
|
|
4873
|
+
MDCRippleFoundation.prototype.animateDeactivation = function (_a) {
|
|
4874
|
+
var wasActivatedByPointer = _a.wasActivatedByPointer, wasElementMadeActive = _a.wasElementMadeActive;
|
|
4875
|
+
if (wasActivatedByPointer || wasElementMadeActive) {
|
|
4876
|
+
this.runDeactivationUXLogicIfReady();
|
|
4877
|
+
}
|
|
4878
|
+
};
|
|
4879
|
+
MDCRippleFoundation.prototype.layoutInternal = function () {
|
|
4880
|
+
var _this = this;
|
|
4881
|
+
this.frame = this.adapter.computeBoundingRect();
|
|
4882
|
+
var maxDim = Math.max(this.frame.height, this.frame.width);
|
|
4883
|
+
// Surface diameter is treated differently for unbounded vs. bounded ripples.
|
|
4884
|
+
// Unbounded ripple diameter is calculated smaller since the surface is expected to already be padded appropriately
|
|
4885
|
+
// to extend the hitbox, and the ripple is expected to meet the edges of the padded hitbox (which is typically
|
|
4886
|
+
// square). Bounded ripples, on the other hand, are fully expected to expand beyond the surface's longest diameter
|
|
4887
|
+
// (calculated based on the diagonal plus a constant padding), and are clipped at the surface's border via
|
|
4888
|
+
// `overflow: hidden`.
|
|
4889
|
+
var getBoundedRadius = function () {
|
|
4890
|
+
var hypotenuse = Math.sqrt(Math.pow(_this.frame.width, 2) + Math.pow(_this.frame.height, 2));
|
|
4891
|
+
return hypotenuse + MDCRippleFoundation.numbers.PADDING;
|
|
4892
|
+
};
|
|
4893
|
+
this.maxRadius = this.adapter.isUnbounded() ? maxDim : getBoundedRadius();
|
|
4894
|
+
// Ripple is sized as a fraction of the largest dimension of the surface, then scales up using a CSS scale transform
|
|
4895
|
+
var initialSize = Math.floor(maxDim * MDCRippleFoundation.numbers.INITIAL_ORIGIN_SCALE);
|
|
4896
|
+
// Unbounded ripple size should always be even number to equally center align.
|
|
4897
|
+
if (this.adapter.isUnbounded() && initialSize % 2 !== 0) {
|
|
4898
|
+
this.initialSize = initialSize - 1;
|
|
4899
|
+
}
|
|
4900
|
+
else {
|
|
4901
|
+
this.initialSize = initialSize;
|
|
4902
|
+
}
|
|
4903
|
+
this.fgScale = "" + this.maxRadius / this.initialSize;
|
|
4904
|
+
this.updateLayoutCssVars();
|
|
4905
|
+
};
|
|
4906
|
+
MDCRippleFoundation.prototype.updateLayoutCssVars = function () {
|
|
4907
|
+
var _a = MDCRippleFoundation.strings, VAR_FG_SIZE = _a.VAR_FG_SIZE, VAR_LEFT = _a.VAR_LEFT, VAR_TOP = _a.VAR_TOP, VAR_FG_SCALE = _a.VAR_FG_SCALE;
|
|
4908
|
+
this.adapter.updateCssVariable(VAR_FG_SIZE, this.initialSize + "px");
|
|
4909
|
+
this.adapter.updateCssVariable(VAR_FG_SCALE, this.fgScale);
|
|
4910
|
+
if (this.adapter.isUnbounded()) {
|
|
4911
|
+
this.unboundedCoords = {
|
|
4912
|
+
left: Math.round((this.frame.width / 2) - (this.initialSize / 2)),
|
|
4913
|
+
top: Math.round((this.frame.height / 2) - (this.initialSize / 2)),
|
|
4914
|
+
};
|
|
4915
|
+
this.adapter.updateCssVariable(VAR_LEFT, this.unboundedCoords.left + "px");
|
|
4916
|
+
this.adapter.updateCssVariable(VAR_TOP, this.unboundedCoords.top + "px");
|
|
4917
|
+
}
|
|
4918
|
+
};
|
|
4919
|
+
return MDCRippleFoundation;
|
|
4920
|
+
}(MDCFoundation));
|
|
4921
|
+
|
|
4922
|
+
/**
|
|
4923
|
+
* @license
|
|
4924
|
+
* Copyright 2016 Google Inc.
|
|
4925
|
+
*
|
|
4926
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4927
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
4928
|
+
* in the Software without restriction, including without limitation the rights
|
|
4929
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
4930
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
4931
|
+
* furnished to do so, subject to the following conditions:
|
|
4932
|
+
*
|
|
4933
|
+
* The above copyright notice and this permission notice shall be included in
|
|
4934
|
+
* all copies or substantial portions of the Software.
|
|
4935
|
+
*
|
|
4936
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
4937
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
4938
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
4939
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
4940
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
4941
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
4942
|
+
* THE SOFTWARE.
|
|
4943
|
+
*/
|
|
4944
|
+
var MDCRipple = /** @class */ (function (_super) {
|
|
4945
|
+
__extends(MDCRipple, _super);
|
|
4946
|
+
function MDCRipple() {
|
|
4947
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
4948
|
+
_this.disabled = false;
|
|
4949
|
+
return _this;
|
|
4950
|
+
}
|
|
4951
|
+
MDCRipple.attachTo = function (root, opts) {
|
|
4952
|
+
if (opts === void 0) { opts = {
|
|
4953
|
+
isUnbounded: undefined
|
|
4954
|
+
}; }
|
|
4955
|
+
var ripple = new MDCRipple(root);
|
|
4956
|
+
// Only override unbounded behavior if option is explicitly specified
|
|
4957
|
+
if (opts.isUnbounded !== undefined) {
|
|
4958
|
+
ripple.unbounded = opts.isUnbounded;
|
|
4959
|
+
}
|
|
4960
|
+
return ripple;
|
|
4961
|
+
};
|
|
4962
|
+
MDCRipple.createAdapter = function (instance) {
|
|
4963
|
+
return {
|
|
4964
|
+
addClass: function (className) { return instance.root.classList.add(className); },
|
|
4965
|
+
browserSupportsCssVars: function () { return supportsCssVariables(window); },
|
|
4966
|
+
computeBoundingRect: function () { return instance.root.getBoundingClientRect(); },
|
|
4967
|
+
containsEventTarget: function (target) { return instance.root.contains(target); },
|
|
4968
|
+
deregisterDocumentInteractionHandler: function (evtType, handler) {
|
|
4969
|
+
return document.documentElement.removeEventListener(evtType, handler, applyPassive());
|
|
3204
4970
|
},
|
|
3205
|
-
|
|
3206
|
-
return
|
|
4971
|
+
deregisterInteractionHandler: function (evtType, handler) {
|
|
4972
|
+
return instance.root
|
|
4973
|
+
.removeEventListener(evtType, handler, applyPassive());
|
|
3207
4974
|
},
|
|
3208
|
-
|
|
3209
|
-
|
|
4975
|
+
deregisterResizeHandler: function (handler) {
|
|
4976
|
+
return window.removeEventListener('resize', handler);
|
|
3210
4977
|
},
|
|
3211
|
-
|
|
3212
|
-
|
|
3213
|
-
_this.emit(strings$3.SELECTED_EVENT, {
|
|
3214
|
-
index: evtData.index,
|
|
3215
|
-
item: _this.items[evtData.index],
|
|
3216
|
-
});
|
|
4978
|
+
getWindowPageOffset: function () {
|
|
4979
|
+
return ({ x: window.pageXOffset, y: window.pageYOffset });
|
|
3217
4980
|
},
|
|
3218
|
-
|
|
3219
|
-
|
|
3220
|
-
|
|
4981
|
+
isSurfaceActive: function () { return matches(instance.root, ':active'); },
|
|
4982
|
+
isSurfaceDisabled: function () { return Boolean(instance.disabled); },
|
|
4983
|
+
isUnbounded: function () { return Boolean(instance.unbounded); },
|
|
4984
|
+
registerDocumentInteractionHandler: function (evtType, handler) {
|
|
4985
|
+
return document.documentElement.addEventListener(evtType, handler, applyPassive());
|
|
3221
4986
|
},
|
|
3222
|
-
|
|
3223
|
-
|
|
4987
|
+
registerInteractionHandler: function (evtType, handler) {
|
|
4988
|
+
return instance.root
|
|
4989
|
+
.addEventListener(evtType, handler, applyPassive());
|
|
3224
4990
|
},
|
|
3225
|
-
|
|
3226
|
-
return
|
|
4991
|
+
registerResizeHandler: function (handler) {
|
|
4992
|
+
return window.addEventListener('resize', handler);
|
|
3227
4993
|
},
|
|
3228
|
-
|
|
3229
|
-
|
|
3230
|
-
|
|
3231
|
-
return selectedItemEl ? _this.items.indexOf(selectedItemEl) : -1;
|
|
4994
|
+
removeClass: function (className) { return instance.root.classList.remove(className); },
|
|
4995
|
+
updateCssVariable: function (varName, value) {
|
|
4996
|
+
return instance.root.style.setProperty(varName, value);
|
|
3232
4997
|
},
|
|
3233
4998
|
};
|
|
3234
|
-
// tslint:enable:object-literal-sort-keys
|
|
3235
|
-
return new MDCMenuFoundation(adapter);
|
|
3236
4999
|
};
|
|
3237
|
-
|
|
5000
|
+
Object.defineProperty(MDCRipple.prototype, "unbounded", {
|
|
5001
|
+
get: function () {
|
|
5002
|
+
return Boolean(this.isUnbounded);
|
|
5003
|
+
},
|
|
5004
|
+
set: function (unbounded) {
|
|
5005
|
+
this.isUnbounded = Boolean(unbounded);
|
|
5006
|
+
this.setUnbounded();
|
|
5007
|
+
},
|
|
5008
|
+
enumerable: false,
|
|
5009
|
+
configurable: true
|
|
5010
|
+
});
|
|
5011
|
+
MDCRipple.prototype.activate = function () {
|
|
5012
|
+
this.foundation.activate();
|
|
5013
|
+
};
|
|
5014
|
+
MDCRipple.prototype.deactivate = function () {
|
|
5015
|
+
this.foundation.deactivate();
|
|
5016
|
+
};
|
|
5017
|
+
MDCRipple.prototype.layout = function () {
|
|
5018
|
+
this.foundation.layout();
|
|
5019
|
+
};
|
|
5020
|
+
MDCRipple.prototype.getDefaultFoundation = function () {
|
|
5021
|
+
return new MDCRippleFoundation(MDCRipple.createAdapter(this));
|
|
5022
|
+
};
|
|
5023
|
+
MDCRipple.prototype.initialSyncWithDOM = function () {
|
|
5024
|
+
var root = this.root;
|
|
5025
|
+
this.isUnbounded = 'mdcRippleIsUnbounded' in root.dataset;
|
|
5026
|
+
};
|
|
5027
|
+
/**
|
|
5028
|
+
* Closure Compiler throws an access control error when directly accessing a
|
|
5029
|
+
* protected or private property inside a getter/setter, like unbounded above.
|
|
5030
|
+
* By accessing the protected property inside a method, we solve that problem.
|
|
5031
|
+
* That's why this function exists.
|
|
5032
|
+
*/
|
|
5033
|
+
MDCRipple.prototype.setUnbounded = function () {
|
|
5034
|
+
this.foundation.setUnbounded(Boolean(this.isUnbounded));
|
|
5035
|
+
};
|
|
5036
|
+
return MDCRipple;
|
|
3238
5037
|
}(MDCComponent));
|
|
3239
5038
|
|
|
3240
5039
|
/**
|
|
@@ -4306,10 +6105,10 @@ var MDCSelect = /** @class */ (function (_super) {
|
|
|
4306
6105
|
this.selectAnchor.addEventListener('blur', this.handleBlur);
|
|
4307
6106
|
this.selectAnchor.addEventListener('click', this.handleClick);
|
|
4308
6107
|
this.selectAnchor.addEventListener('keydown', this.handleKeydown);
|
|
4309
|
-
this.menu.listen(strings$
|
|
4310
|
-
this.menu.listen(strings$
|
|
4311
|
-
this.menu.listen(strings$
|
|
4312
|
-
this.menu.listen(strings$
|
|
6108
|
+
this.menu.listen(strings$7.CLOSED_EVENT, this.handleMenuClosed);
|
|
6109
|
+
this.menu.listen(strings$7.CLOSING_EVENT, this.handleMenuClosing);
|
|
6110
|
+
this.menu.listen(strings$7.OPENED_EVENT, this.handleMenuOpened);
|
|
6111
|
+
this.menu.listen(strings$5.SELECTED_EVENT, this.handleMenuItemAction);
|
|
4313
6112
|
if (this.hiddenInput) {
|
|
4314
6113
|
if (this.hiddenInput.value) {
|
|
4315
6114
|
// If the hidden input already has a value, use it to restore the
|
|
@@ -4327,9 +6126,9 @@ var MDCSelect = /** @class */ (function (_super) {
|
|
|
4327
6126
|
this.selectAnchor.removeEventListener('blur', this.handleBlur);
|
|
4328
6127
|
this.selectAnchor.removeEventListener('keydown', this.handleKeydown);
|
|
4329
6128
|
this.selectAnchor.removeEventListener('click', this.handleClick);
|
|
4330
|
-
this.menu.unlisten(strings$
|
|
4331
|
-
this.menu.unlisten(strings$
|
|
4332
|
-
this.menu.unlisten(strings$
|
|
6129
|
+
this.menu.unlisten(strings$7.CLOSED_EVENT, this.handleMenuClosed);
|
|
6130
|
+
this.menu.unlisten(strings$7.OPENED_EVENT, this.handleMenuOpened);
|
|
6131
|
+
this.menu.unlisten(strings$5.SELECTED_EVENT, this.handleMenuItemAction);
|
|
4333
6132
|
this.menu.destroy();
|
|
4334
6133
|
if (this.ripple) {
|
|
4335
6134
|
this.ripple.destroy();
|
|
@@ -4660,4 +6459,4 @@ var MDCSelect = /** @class */ (function (_super) {
|
|
|
4660
6459
|
return MDCSelect;
|
|
4661
6460
|
}(MDCComponent));
|
|
4662
6461
|
|
|
4663
|
-
export { MDCSelect as M };
|
|
6462
|
+
export { MDCSelect as M, __extends as _, __assign as a, MDCFoundation as b, MDCRipple as c, applyPassive as d, MDCRippleFoundation as e, __values as f, getCorrectEventName as g, MDCComponent as h, MDCLineRipple as i, MDCFloatingLabel as j, MDCNotchedOutline as k, matches as m };
|