@ptcwebops/ptcw-design 6.3.3-beta → 6.3.3
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-1b8ad4d2.js +1819 -0
- package/dist/cjs/{component-4dd13907.js → component-35540bfb.js} +1494 -3305
- package/dist/cjs/event-jumbotron-example.cjs.entry.js +196 -0
- package/dist/cjs/featured-list.cjs.entry.js +1 -1
- package/dist/cjs/focus-trap.esm-8c5a8938.js +1558 -0
- package/dist/cjs/icon-asset.cjs.entry.js +65 -0
- package/dist/cjs/innovator-toggle-container.cjs.entry.js +1 -1
- package/dist/cjs/list-item.cjs.entry.js +48 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/ptc-bio-card.cjs.entry.js +1 -1
- package/dist/cjs/ptc-breadcrumb.cjs.entry.js +47 -0
- package/dist/cjs/ptc-button.cjs.entry.js +87 -0
- package/dist/cjs/ptc-card-bottom_2.cjs.entry.js +156 -0
- package/dist/cjs/ptc-card-content.cjs.entry.js +76 -0
- package/dist/cjs/ptc-card_2.cjs.entry.js +3 -4
- package/dist/cjs/ptc-case-studies-slider.cjs.entry.js +1 -1
- package/dist/cjs/ptc-close-icon_2.cjs.entry.js +336 -0
- package/dist/cjs/ptc-countdown.cjs.entry.js +19 -71
- package/dist/cjs/ptc-data-lookup.cjs.entry.js +2 -1
- package/dist/cjs/ptc-dynamic-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_4.cjs.entry.js → ptc-form-checkbox_2.cjs.entry.js} +5 -787
- package/dist/cjs/ptc-icon-list.cjs.entry.js +2 -2
- package/dist/cjs/ptc-img.cjs.entry.js +133 -0
- package/dist/cjs/ptc-jumbotron.cjs.entry.js +1 -1
- package/dist/cjs/ptc-link.cjs.entry.js +87 -0
- package/dist/cjs/ptc-multi-select_2.cjs.entry.js +672 -0
- package/dist/cjs/ptc-office-location-card.cjs.entry.js +3 -2
- package/dist/cjs/ptc-office-locations.cjs.entry.js +5 -0
- package/dist/cjs/ptc-para.cjs.entry.js +127 -0
- package/dist/cjs/ptc-podcast-card.cjs.entry.js +1 -1
- package/dist/cjs/ptc-previous-url.cjs.entry.js +2 -10
- package/dist/cjs/ptc-product-card.cjs.entry.js +1 -1
- package/dist/cjs/ptc-product-category.cjs.entry.js +1 -1
- package/dist/cjs/ptc-product-highlight-card.cjs.entry.js +1 -1
- 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-scroll-button.cjs.entry.js +136 -0
- package/dist/cjs/ptc-spacer.cjs.entry.js +38 -0
- package/dist/cjs/ptc-title.cjs.entry.js +152 -0
- 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 +1 -1
- package/dist/cjs/ptcw-design.cjs.js +1 -1
- package/dist/cjs/validation-messages-33a4f26b.js +126 -0
- package/dist/collection/collection-manifest.json +0 -1
- package/dist/collection/components/icon-asset/media/designer-v6.0.6.svg +2 -30
- package/dist/collection/components/innovator-toggle-container/innovator-toggle-container.css +6 -6
- package/dist/collection/components/organism-bundles/bundle-featured-list/featured-list.css +3 -3
- package/dist/collection/components/ptc-bio-card/ptc-bio-card.css +6 -6
- package/dist/collection/components/ptc-case-studies-slider/ptc-case-studies-slider.css +6 -6
- package/dist/collection/components/ptc-countdown/ptc-countdown.css +0 -1
- package/dist/collection/components/ptc-countdown/ptc-countdown.js +17 -163
- package/dist/collection/components/ptc-dynamic-card/ptc-dynamic-card.css +5 -0
- 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 +6 -0
- package/dist/collection/components/ptc-icon-list/ptc-icon-list.js +1 -1
- package/dist/collection/components/ptc-jumbotron/ptc-jumbotron.css +6 -6
- package/dist/collection/components/ptc-modal/ptc-modal.css +0 -4
- package/dist/collection/components/ptc-modal/ptc-modal.js +86 -38
- package/dist/collection/components/ptc-multi-select/ptc-multi-select.js +3 -1
- package/dist/collection/components/ptc-office-location-card/ptc-office-location-card.js +3 -2
- package/dist/collection/components/ptc-office-locations/ptc-office-locations.js +5 -0
- package/dist/collection/components/ptc-para/ptc-para.css +0 -3
- 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.js +3 -4
- package/dist/collection/components/ptc-previous-url/ptc-previous-url.css +0 -16
- package/dist/collection/components/ptc-previous-url/ptc-previous-url.js +1 -27
- package/dist/collection/components/ptc-product-card/ptc-product-card.css +6 -6
- package/dist/collection/components/ptc-product-category/ptc-product-category.css +6 -6
- package/dist/collection/components/ptc-product-highlight-card/ptc-product-highlight-card.css +6 -6
- 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-textfield/ptc-textfield.js +1 -1
- 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/custom-elements/index.d.ts +0 -6
- package/dist/custom-elements/index.js +141 -240
- package/dist/esm/blog-detail-content_2.entry.js +1 -1
- package/dist/esm/blog-detail-layout.entry.js +1 -1
- package/dist/esm/blogs-search-section.entry.js +1 -1
- package/dist/esm/{component-9c921cc6.js → component-8c53e377.js} +1482 -3281
- package/dist/esm/component-9beac35b.js +1802 -0
- package/dist/esm/event-jumbotron-example.entry.js +192 -0
- package/dist/esm/featured-list.entry.js +1 -1
- package/dist/esm/focus-trap.esm-d205300d.js +1556 -0
- package/dist/esm/homepage-jumbotron.entry.js +1 -1
- package/dist/esm/homepage-toggled-content.entry.js +1 -1
- package/dist/esm/icon-asset.entry.js +61 -0
- package/dist/esm/innovator-toggle-container.entry.js +1 -1
- package/dist/esm/list-item.entry.js +44 -0
- package/dist/esm/loader.js +1 -1
- package/dist/esm/most-popular-news.entry.js +1 -1
- package/dist/esm/my-component.entry.js +1 -1
- package/dist/esm/ptc-accordion-item.entry.js +1 -1
- package/dist/esm/ptc-background-video.entry.js +1 -1
- package/dist/esm/ptc-bio-card.entry.js +1 -1
- package/dist/esm/ptc-breadcrumb.entry.js +43 -0
- package/dist/esm/ptc-button.entry.js +83 -0
- package/dist/esm/ptc-card-bottom_2.entry.js +151 -0
- package/dist/esm/ptc-card-content.entry.js +72 -0
- package/dist/esm/ptc-card_2.entry.js +3 -4
- package/dist/esm/ptc-case-studies-slider.entry.js +1 -1
- package/dist/esm/ptc-close-icon_2.entry.js +331 -0
- package/dist/esm/ptc-collapse-list.entry.js +1 -1
- package/dist/esm/ptc-countdown.entry.js +19 -71
- package/dist/esm/ptc-data-lookup.entry.js +2 -1
- package/dist/esm/ptc-dynamic-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_4.entry.js → ptc-form-checkbox_2.entry.js} +5 -785
- package/dist/esm/ptc-homepage-image-feature.entry.js +1 -1
- package/dist/esm/ptc-homepage-video-background.entry.js +1 -1
- package/dist/esm/ptc-icon-card.entry.js +1 -1
- package/dist/esm/ptc-icon-list.entry.js +2 -2
- package/dist/esm/ptc-img.entry.js +129 -0
- package/dist/esm/ptc-jumbotron.entry.js +1 -1
- package/dist/esm/ptc-link.entry.js +83 -0
- package/dist/esm/ptc-media-card.entry.js +1 -1
- package/dist/esm/ptc-multi-select_2.entry.js +667 -0
- package/dist/esm/ptc-office-location-card.entry.js +3 -2
- package/dist/esm/ptc-office-locations.entry.js +5 -0
- package/dist/esm/ptc-para.entry.js +123 -0
- package/dist/esm/ptc-podcast-card.entry.js +1 -1
- package/dist/esm/ptc-previous-url.entry.js +2 -10
- package/dist/esm/ptc-pricing-packaging-table.entry.js +1 -1
- package/dist/esm/ptc-pricing-tabs.entry.js +1 -1
- package/dist/esm/ptc-product-card.entry.js +1 -1
- package/dist/esm/ptc-product-category.entry.js +1 -1
- package/dist/esm/ptc-product-highlight-card.entry.js +1 -1
- package/dist/esm/ptc-readmore-char.entry.js +1 -1
- package/dist/esm/ptc-readmore-v3.entry.js +1 -1
- package/dist/esm/ptc-scroll-button.entry.js +132 -0
- package/dist/esm/ptc-social-icons-footer.entry.js +1 -1
- package/dist/esm/ptc-spacer.entry.js +34 -0
- package/dist/esm/ptc-title.entry.js +148 -0
- 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 +1 -1
- package/dist/esm/ptcw-design.js +1 -1
- package/dist/esm/{utils-ff65c75b.js → utils-63eab4bd.js} +1 -1
- package/dist/esm/validation-messages-adbb6518.js +124 -0
- package/dist/ptcw-design/media/designer-v6.0.6.svg +2 -30
- package/dist/ptcw-design/p-00e21489.entry.js +1 -0
- package/dist/ptcw-design/p-01075feb.entry.js +1 -0
- package/dist/ptcw-design/p-0b33279e.js +10 -0
- package/dist/ptcw-design/p-0c69ea52.entry.js +1 -0
- package/dist/ptcw-design/p-15758793.entry.js +1 -0
- package/dist/ptcw-design/{p-e0b873d0.entry.js → p-16e70f20.entry.js} +1 -1
- package/dist/ptcw-design/{p-ae970a60.entry.js → p-17f6e145.entry.js} +1 -1
- package/dist/ptcw-design/p-18a5a338.js +1 -0
- package/dist/ptcw-design/{p-d73cc053.entry.js → p-18ac526f.entry.js} +1 -1
- package/dist/ptcw-design/p-25a25451.entry.js +1 -0
- package/dist/ptcw-design/p-27a4ee73.entry.js +1 -0
- package/dist/ptcw-design/{p-e4000363.entry.js → p-28be539b.entry.js} +1 -1
- package/dist/ptcw-design/p-2b32297b.entry.js +1 -0
- package/dist/ptcw-design/p-2cb2de0f.entry.js +1 -0
- package/dist/ptcw-design/{p-4055f4f7.entry.js → p-38b782e8.entry.js} +1 -1
- package/dist/ptcw-design/p-42992202.entry.js +1 -0
- package/dist/ptcw-design/{p-d9abe7e8.entry.js → p-48c33817.entry.js} +1 -1
- package/dist/ptcw-design/{p-e3f8e5d5.entry.js → p-49e54079.entry.js} +1 -1
- package/dist/ptcw-design/{p-445329ed.entry.js → p-4d8f6f46.entry.js} +1 -1
- package/dist/ptcw-design/{p-2c6fc745.entry.js → p-4ee98a3e.entry.js} +1 -1
- package/dist/ptcw-design/p-51a45b13.entry.js +1 -0
- package/dist/ptcw-design/p-593b8eff.entry.js +1 -0
- package/dist/ptcw-design/p-5dae4f30.entry.js +1 -0
- package/dist/ptcw-design/{p-d10cb999.entry.js → p-627103d8.entry.js} +1 -1
- package/dist/ptcw-design/{p-c95f423e.entry.js → p-6a3caf2b.entry.js} +1 -1
- package/dist/ptcw-design/{p-7a9611b4.entry.js → p-6f5fecae.entry.js} +1 -1
- package/dist/ptcw-design/p-73a853fc.entry.js +1 -0
- package/dist/ptcw-design/{p-0de4cd11.entry.js → p-75988f52.entry.js} +1 -1
- package/dist/ptcw-design/p-7793babb.entry.js +1 -0
- package/dist/ptcw-design/{p-8872161f.js → p-77b1221e.js} +1 -1
- package/dist/ptcw-design/p-7a3e9ecd.entry.js +1 -0
- package/dist/ptcw-design/p-7fb155da.entry.js +1 -0
- package/dist/ptcw-design/p-7fe4d383.entry.js +1 -0
- package/dist/ptcw-design/{p-c37a3bd2.entry.js → p-821f0ff9.entry.js} +1 -1
- package/dist/ptcw-design/p-92d22c78.entry.js +1 -0
- package/dist/ptcw-design/p-98426799.js +203 -0
- package/dist/ptcw-design/p-98844b50.js +134 -0
- package/dist/ptcw-design/p-99355e65.entry.js +1 -0
- package/dist/ptcw-design/{p-21aa746d.entry.js → p-9f194554.entry.js} +1 -1
- package/dist/ptcw-design/p-a3822c52.entry.js +1 -0
- package/dist/ptcw-design/p-a58698ca.entry.js +1 -0
- package/dist/ptcw-design/{p-0b515839.entry.js → p-a791c53a.entry.js} +1 -1
- package/dist/ptcw-design/p-acdd9a1d.entry.js +1 -0
- package/dist/ptcw-design/p-ad821a01.entry.js +1 -0
- package/dist/ptcw-design/{p-94f99d2d.entry.js → p-b441e3fe.entry.js} +1 -1
- package/dist/ptcw-design/{p-918fb77d.entry.js → p-b52301e2.entry.js} +1 -1
- package/dist/ptcw-design/p-b651c1cb.entry.js +1 -0
- package/dist/ptcw-design/p-b8ee8699.entry.js +1 -0
- package/dist/ptcw-design/p-bf18b622.entry.js +1 -0
- package/dist/ptcw-design/p-bf3bc577.entry.js +1 -0
- package/dist/ptcw-design/{p-1b257420.entry.js → p-c01ea76f.entry.js} +1 -1
- package/dist/ptcw-design/{p-6d3326da.entry.js → p-cbee4653.entry.js} +1 -1
- package/dist/ptcw-design/{p-3dd0ded9.entry.js → p-d089dc37.entry.js} +1 -1
- package/dist/ptcw-design/{p-c66b8926.entry.js → p-d3229458.entry.js} +1 -1
- package/dist/ptcw-design/p-dd02e4d6.entry.js +68 -0
- package/dist/ptcw-design/{p-da82dc93.entry.js → p-e577ad62.entry.js} +1 -1
- package/dist/ptcw-design/{p-808ec62a.entry.js → p-eec2f3da.entry.js} +1 -1
- package/dist/ptcw-design/p-f4eb6d0a.entry.js +1 -0
- package/dist/ptcw-design/{p-a25578e9.entry.js → p-f867ebe6.entry.js} +1 -1
- package/dist/ptcw-design/p-f9256e3d.entry.js +1 -0
- package/dist/ptcw-design/{p-36007a57.entry.js → p-fd394e84.entry.js} +1 -1
- package/dist/ptcw-design/p-feecf6b5.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/ptc-countdown/ptc-countdown.d.ts +0 -8
- package/dist/types/components/ptc-modal/ptc-modal.d.ts +6 -3
- package/dist/types/components/ptc-office-location-card/ptc-office-location-card.d.ts +1 -1
- package/dist/types/components/ptc-para/ptc-para.d.ts +1 -1
- package/dist/types/components/ptc-previous-url/ptc-previous-url.d.ts +0 -2
- package/dist/types/components.d.ts +4 -29
- package/package.json +1 -1
- package/readme.md +1 -5
- package/dist/cjs/event-jumbotron-example_15.cjs.entry.js +0 -3051
- package/dist/cjs/modal-form-example.cjs.entry.js +0 -94
- package/dist/cjs/ptc-card-bottom.cjs.entry.js +0 -67
- package/dist/collection/components/organism-bundles/form/modal-from-example/modal-form-example.css +0 -26
- package/dist/collection/components/organism-bundles/form/modal-from-example/modal-form-example.js +0 -99
- package/dist/collection/stories/organisms/eSupport/CaseTracker/preview.stories.js +0 -45
- package/dist/collection/stories/organisms/eSupport/SupportArticle/preview.stories.js +0 -47
- package/dist/collection/stories/organisms/eSupport/SupportPage/preview.stories.js +0 -157
- package/dist/esm/event-jumbotron-example_15.entry.js +0 -3033
- package/dist/esm/modal-form-example.entry.js +0 -90
- package/dist/esm/ptc-card-bottom.entry.js +0 -63
- package/dist/ptcw-design/p-0098c4f0.entry.js +0 -1
- package/dist/ptcw-design/p-0d223232.entry.js +0 -1
- package/dist/ptcw-design/p-1118ed9e.entry.js +0 -68
- package/dist/ptcw-design/p-1a6759a4.entry.js +0 -1
- package/dist/ptcw-design/p-32f64f48.entry.js +0 -1
- package/dist/ptcw-design/p-48815ee0.entry.js +0 -1
- package/dist/ptcw-design/p-67c248ec.entry.js +0 -1
- package/dist/ptcw-design/p-75390f63.entry.js +0 -1
- package/dist/ptcw-design/p-799afee5.entry.js +0 -1
- package/dist/ptcw-design/p-9501995f.entry.js +0 -1
- package/dist/ptcw-design/p-9c875e66.entry.js +0 -11
- package/dist/ptcw-design/p-9fe0c27d.entry.js +0 -1
- package/dist/ptcw-design/p-a3b57ede.entry.js +0 -1
- package/dist/ptcw-design/p-baff4d44.entry.js +0 -1
- package/dist/ptcw-design/p-bcab66bf.js +0 -336
- package/dist/ptcw-design/p-bd6af63e.entry.js +0 -1
- package/dist/ptcw-design/p-dbbe35bf.entry.js +0 -1
- package/dist/ptcw-design/p-de960790.entry.js +0 -1
- package/dist/ptcw-design/p-e6a272d9.entry.js +0 -1
- package/dist/ptcw-design/p-fe40421e.entry.js +0 -1
- package/dist/types/components/organism-bundles/form/modal-from-example/modal-form-example.d.ts +0 -25
|
@@ -0,0 +1,1819 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/******************************************************************************
|
|
4
|
+
Copyright (c) Microsoft Corporation.
|
|
5
|
+
|
|
6
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
7
|
+
purpose with or without fee is hereby granted.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
10
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
11
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
12
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
13
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
14
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
15
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
16
|
+
***************************************************************************** */
|
|
17
|
+
/* global Reflect, Promise, SuppressedError, Symbol, Iterator */
|
|
18
|
+
|
|
19
|
+
var extendStatics = function(d, b) {
|
|
20
|
+
extendStatics = Object.setPrototypeOf ||
|
|
21
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
22
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
23
|
+
return extendStatics(d, b);
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
function __extends(d, b) {
|
|
27
|
+
if (typeof b !== "function" && b !== null)
|
|
28
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
29
|
+
extendStatics(d, b);
|
|
30
|
+
function __() { this.constructor = d; }
|
|
31
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
exports.__assign = function() {
|
|
35
|
+
exports.__assign = Object.assign || function __assign(t) {
|
|
36
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
37
|
+
s = arguments[i];
|
|
38
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
39
|
+
}
|
|
40
|
+
return t;
|
|
41
|
+
};
|
|
42
|
+
return exports.__assign.apply(this, arguments);
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
function __values(o) {
|
|
46
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
47
|
+
if (m) return m.call(o);
|
|
48
|
+
if (o && typeof o.length === "number") return {
|
|
49
|
+
next: function () {
|
|
50
|
+
if (o && i >= o.length) o = void 0;
|
|
51
|
+
return { value: o && o[i++], done: !o };
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function __read(o, n) {
|
|
58
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
59
|
+
if (!m) return o;
|
|
60
|
+
var i = m.call(o), r, ar = [], e;
|
|
61
|
+
try {
|
|
62
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
63
|
+
}
|
|
64
|
+
catch (error) { e = { error: error }; }
|
|
65
|
+
finally {
|
|
66
|
+
try {
|
|
67
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
68
|
+
}
|
|
69
|
+
finally { if (e) throw e.error; }
|
|
70
|
+
}
|
|
71
|
+
return ar;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function __spreadArray(to, from, pack) {
|
|
75
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
76
|
+
if (ar || !(i in from)) {
|
|
77
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
78
|
+
ar[i] = from[i];
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
85
|
+
var e = new Error(message);
|
|
86
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* @license
|
|
91
|
+
* Copyright 2016 Google Inc.
|
|
92
|
+
*
|
|
93
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
94
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
95
|
+
* in the Software without restriction, including without limitation the rights
|
|
96
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
97
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
98
|
+
* furnished to do so, subject to the following conditions:
|
|
99
|
+
*
|
|
100
|
+
* The above copyright notice and this permission notice shall be included in
|
|
101
|
+
* all copies or substantial portions of the Software.
|
|
102
|
+
*
|
|
103
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
104
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
105
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
106
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
107
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
108
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
109
|
+
* THE SOFTWARE.
|
|
110
|
+
*/
|
|
111
|
+
var MDCFoundation = /** @class */ (function () {
|
|
112
|
+
function MDCFoundation(adapter) {
|
|
113
|
+
if (adapter === void 0) { adapter = {}; }
|
|
114
|
+
this.adapter = adapter;
|
|
115
|
+
}
|
|
116
|
+
Object.defineProperty(MDCFoundation, "cssClasses", {
|
|
117
|
+
get: function () {
|
|
118
|
+
// Classes extending MDCFoundation should implement this method to return an object which exports every
|
|
119
|
+
// CSS class the foundation class needs as a property. e.g. {ACTIVE: 'mdc-component--active'}
|
|
120
|
+
return {};
|
|
121
|
+
},
|
|
122
|
+
enumerable: false,
|
|
123
|
+
configurable: true
|
|
124
|
+
});
|
|
125
|
+
Object.defineProperty(MDCFoundation, "strings", {
|
|
126
|
+
get: function () {
|
|
127
|
+
// Classes extending MDCFoundation should implement this method to return an object which exports all
|
|
128
|
+
// semantic strings as constants. e.g. {ARIA_ROLE: 'tablist'}
|
|
129
|
+
return {};
|
|
130
|
+
},
|
|
131
|
+
enumerable: false,
|
|
132
|
+
configurable: true
|
|
133
|
+
});
|
|
134
|
+
Object.defineProperty(MDCFoundation, "numbers", {
|
|
135
|
+
get: function () {
|
|
136
|
+
// Classes extending MDCFoundation should implement this method to return an object which exports all
|
|
137
|
+
// of its semantic numbers as constants. e.g. {ANIMATION_DELAY_MS: 350}
|
|
138
|
+
return {};
|
|
139
|
+
},
|
|
140
|
+
enumerable: false,
|
|
141
|
+
configurable: true
|
|
142
|
+
});
|
|
143
|
+
Object.defineProperty(MDCFoundation, "defaultAdapter", {
|
|
144
|
+
get: function () {
|
|
145
|
+
// Classes extending MDCFoundation may choose to implement this getter in order to provide a convenient
|
|
146
|
+
// way of viewing the necessary methods of an adapter. In the future, this could also be used for adapter
|
|
147
|
+
// validation.
|
|
148
|
+
return {};
|
|
149
|
+
},
|
|
150
|
+
enumerable: false,
|
|
151
|
+
configurable: true
|
|
152
|
+
});
|
|
153
|
+
MDCFoundation.prototype.init = function () {
|
|
154
|
+
// Subclasses should override this method to perform initialization routines (registering events, etc.)
|
|
155
|
+
};
|
|
156
|
+
MDCFoundation.prototype.destroy = function () {
|
|
157
|
+
// Subclasses should override this method to perform de-initialization routines (de-registering events, etc.)
|
|
158
|
+
};
|
|
159
|
+
return MDCFoundation;
|
|
160
|
+
}());
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* @license
|
|
164
|
+
* Copyright 2016 Google Inc.
|
|
165
|
+
*
|
|
166
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
167
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
168
|
+
* in the Software without restriction, including without limitation the rights
|
|
169
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
170
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
171
|
+
* furnished to do so, subject to the following conditions:
|
|
172
|
+
*
|
|
173
|
+
* The above copyright notice and this permission notice shall be included in
|
|
174
|
+
* all copies or substantial portions of the Software.
|
|
175
|
+
*
|
|
176
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
177
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
178
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
179
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
180
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
181
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
182
|
+
* THE SOFTWARE.
|
|
183
|
+
*/
|
|
184
|
+
var MDCComponent = /** @class */ (function () {
|
|
185
|
+
function MDCComponent(root, foundation) {
|
|
186
|
+
var args = [];
|
|
187
|
+
for (var _i = 2; _i < arguments.length; _i++) {
|
|
188
|
+
args[_i - 2] = arguments[_i];
|
|
189
|
+
}
|
|
190
|
+
this.root = root;
|
|
191
|
+
this.initialize.apply(this, __spreadArray([], __read(args)));
|
|
192
|
+
// Note that we initialize foundation here and not within the constructor's
|
|
193
|
+
// default param so that this.root is defined and can be used within the
|
|
194
|
+
// foundation class.
|
|
195
|
+
this.foundation =
|
|
196
|
+
foundation === undefined ? this.getDefaultFoundation() : foundation;
|
|
197
|
+
this.foundation.init();
|
|
198
|
+
this.initialSyncWithDOM();
|
|
199
|
+
}
|
|
200
|
+
MDCComponent.attachTo = function (root) {
|
|
201
|
+
// Subclasses which extend MDCBase should provide an attachTo() method that takes a root element and
|
|
202
|
+
// returns an instantiated component with its root set to that element. Also note that in the cases of
|
|
203
|
+
// subclasses, an explicit foundation class will not have to be passed in; it will simply be initialized
|
|
204
|
+
// from getDefaultFoundation().
|
|
205
|
+
return new MDCComponent(root, new MDCFoundation({}));
|
|
206
|
+
};
|
|
207
|
+
/* istanbul ignore next: method param only exists for typing purposes; it does not need to be unit tested */
|
|
208
|
+
MDCComponent.prototype.initialize = function () {
|
|
209
|
+
var _args = [];
|
|
210
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
211
|
+
_args[_i] = arguments[_i];
|
|
212
|
+
}
|
|
213
|
+
// Subclasses can override this to do any additional setup work that would be considered part of a
|
|
214
|
+
// "constructor". Essentially, it is a hook into the parent constructor before the foundation is
|
|
215
|
+
// initialized. Any additional arguments besides root and foundation will be passed in here.
|
|
216
|
+
};
|
|
217
|
+
MDCComponent.prototype.getDefaultFoundation = function () {
|
|
218
|
+
// Subclasses must override this method to return a properly configured foundation class for the
|
|
219
|
+
// component.
|
|
220
|
+
throw new Error('Subclasses must override getDefaultFoundation to return a properly configured ' +
|
|
221
|
+
'foundation class');
|
|
222
|
+
};
|
|
223
|
+
MDCComponent.prototype.initialSyncWithDOM = function () {
|
|
224
|
+
// Subclasses should override this method if they need to perform work to synchronize with a host DOM
|
|
225
|
+
// object. An example of this would be a form control wrapper that needs to synchronize its internal state
|
|
226
|
+
// to some property or attribute of the host DOM. Please note: this is *not* the place to perform DOM
|
|
227
|
+
// reads/writes that would cause layout / paint, as this is called synchronously from within the constructor.
|
|
228
|
+
};
|
|
229
|
+
MDCComponent.prototype.destroy = function () {
|
|
230
|
+
// Subclasses may implement this method to release any resources / deregister any listeners they have
|
|
231
|
+
// attached. An example of this might be deregistering a resize event from the window object.
|
|
232
|
+
this.foundation.destroy();
|
|
233
|
+
};
|
|
234
|
+
MDCComponent.prototype.listen = function (evtType, handler, options) {
|
|
235
|
+
this.root.addEventListener(evtType, handler, options);
|
|
236
|
+
};
|
|
237
|
+
MDCComponent.prototype.unlisten = function (evtType, handler, options) {
|
|
238
|
+
this.root.removeEventListener(evtType, handler, options);
|
|
239
|
+
};
|
|
240
|
+
/**
|
|
241
|
+
* Fires a cross-browser-compatible custom event from the component root of the given type, with the given data.
|
|
242
|
+
*/
|
|
243
|
+
MDCComponent.prototype.emit = function (evtType, evtData, shouldBubble) {
|
|
244
|
+
if (shouldBubble === void 0) { shouldBubble = false; }
|
|
245
|
+
var evt;
|
|
246
|
+
if (typeof CustomEvent === 'function') {
|
|
247
|
+
evt = new CustomEvent(evtType, {
|
|
248
|
+
bubbles: shouldBubble,
|
|
249
|
+
detail: evtData,
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
else {
|
|
253
|
+
evt = document.createEvent('CustomEvent');
|
|
254
|
+
evt.initCustomEvent(evtType, shouldBubble, false, evtData);
|
|
255
|
+
}
|
|
256
|
+
this.root.dispatchEvent(evt);
|
|
257
|
+
};
|
|
258
|
+
return MDCComponent;
|
|
259
|
+
}());
|
|
260
|
+
|
|
261
|
+
/**
|
|
262
|
+
* @license
|
|
263
|
+
* Copyright 2018 Google Inc.
|
|
264
|
+
*
|
|
265
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
266
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
267
|
+
* in the Software without restriction, including without limitation the rights
|
|
268
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
269
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
270
|
+
* furnished to do so, subject to the following conditions:
|
|
271
|
+
*
|
|
272
|
+
* The above copyright notice and this permission notice shall be included in
|
|
273
|
+
* all copies or substantial portions of the Software.
|
|
274
|
+
*
|
|
275
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
276
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
277
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
278
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
279
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
280
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
281
|
+
* THE SOFTWARE.
|
|
282
|
+
*/
|
|
283
|
+
/**
|
|
284
|
+
* @fileoverview A "ponyfill" is a polyfill that doesn't modify the global prototype chain.
|
|
285
|
+
* This makes ponyfills safer than traditional polyfills, especially for libraries like MDC.
|
|
286
|
+
*/
|
|
287
|
+
function closest(element, selector) {
|
|
288
|
+
if (element.closest) {
|
|
289
|
+
return element.closest(selector);
|
|
290
|
+
}
|
|
291
|
+
var el = element;
|
|
292
|
+
while (el) {
|
|
293
|
+
if (matches(el, selector)) {
|
|
294
|
+
return el;
|
|
295
|
+
}
|
|
296
|
+
el = el.parentElement;
|
|
297
|
+
}
|
|
298
|
+
return null;
|
|
299
|
+
}
|
|
300
|
+
function matches(element, selector) {
|
|
301
|
+
var nativeMatches = element.matches
|
|
302
|
+
|| element.webkitMatchesSelector
|
|
303
|
+
|| element.msMatchesSelector;
|
|
304
|
+
return nativeMatches.call(element, selector);
|
|
305
|
+
}
|
|
306
|
+
/**
|
|
307
|
+
* Used to compute the estimated scroll width of elements. When an element is
|
|
308
|
+
* hidden due to display: none; being applied to a parent element, the width is
|
|
309
|
+
* returned as 0. However, the element will have a true width once no longer
|
|
310
|
+
* inside a display: none context. This method computes an estimated width when
|
|
311
|
+
* the element is hidden or returns the true width when the element is visble.
|
|
312
|
+
* @param {Element} element the element whose width to estimate
|
|
313
|
+
*/
|
|
314
|
+
function estimateScrollWidth(element) {
|
|
315
|
+
// Check the offsetParent. If the element inherits display: none from any
|
|
316
|
+
// parent, the offsetParent property will be null (see
|
|
317
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/offsetParent).
|
|
318
|
+
// This check ensures we only clone the node when necessary.
|
|
319
|
+
var htmlEl = element;
|
|
320
|
+
if (htmlEl.offsetParent !== null) {
|
|
321
|
+
return htmlEl.scrollWidth;
|
|
322
|
+
}
|
|
323
|
+
var clone = htmlEl.cloneNode(true);
|
|
324
|
+
clone.style.setProperty('position', 'absolute');
|
|
325
|
+
clone.style.setProperty('transform', 'translate(-9999px, -9999px)');
|
|
326
|
+
document.documentElement.appendChild(clone);
|
|
327
|
+
var scrollWidth = clone.scrollWidth;
|
|
328
|
+
document.documentElement.removeChild(clone);
|
|
329
|
+
return scrollWidth;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
/**
|
|
333
|
+
* @license
|
|
334
|
+
* Copyright 2016 Google Inc.
|
|
335
|
+
*
|
|
336
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
337
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
338
|
+
* in the Software without restriction, including without limitation the rights
|
|
339
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
340
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
341
|
+
* furnished to do so, subject to the following conditions:
|
|
342
|
+
*
|
|
343
|
+
* The above copyright notice and this permission notice shall be included in
|
|
344
|
+
* all copies or substantial portions of the Software.
|
|
345
|
+
*
|
|
346
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
347
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
348
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
349
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
350
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
351
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
352
|
+
* THE SOFTWARE.
|
|
353
|
+
*/
|
|
354
|
+
var cssClasses$3 = {
|
|
355
|
+
LABEL_FLOAT_ABOVE: 'mdc-floating-label--float-above',
|
|
356
|
+
LABEL_REQUIRED: 'mdc-floating-label--required',
|
|
357
|
+
LABEL_SHAKE: 'mdc-floating-label--shake',
|
|
358
|
+
ROOT: 'mdc-floating-label',
|
|
359
|
+
};
|
|
360
|
+
|
|
361
|
+
/**
|
|
362
|
+
* @license
|
|
363
|
+
* Copyright 2016 Google Inc.
|
|
364
|
+
*
|
|
365
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
366
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
367
|
+
* in the Software without restriction, including without limitation the rights
|
|
368
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
369
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
370
|
+
* furnished to do so, subject to the following conditions:
|
|
371
|
+
*
|
|
372
|
+
* The above copyright notice and this permission notice shall be included in
|
|
373
|
+
* all copies or substantial portions of the Software.
|
|
374
|
+
*
|
|
375
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
376
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
377
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
378
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
379
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
380
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
381
|
+
* THE SOFTWARE.
|
|
382
|
+
*/
|
|
383
|
+
var MDCFloatingLabelFoundation = /** @class */ (function (_super) {
|
|
384
|
+
__extends(MDCFloatingLabelFoundation, _super);
|
|
385
|
+
function MDCFloatingLabelFoundation(adapter) {
|
|
386
|
+
var _this = _super.call(this, exports.__assign(exports.__assign({}, MDCFloatingLabelFoundation.defaultAdapter), adapter)) || this;
|
|
387
|
+
_this.shakeAnimationEndHandler = function () {
|
|
388
|
+
_this.handleShakeAnimationEnd();
|
|
389
|
+
};
|
|
390
|
+
return _this;
|
|
391
|
+
}
|
|
392
|
+
Object.defineProperty(MDCFloatingLabelFoundation, "cssClasses", {
|
|
393
|
+
get: function () {
|
|
394
|
+
return cssClasses$3;
|
|
395
|
+
},
|
|
396
|
+
enumerable: false,
|
|
397
|
+
configurable: true
|
|
398
|
+
});
|
|
399
|
+
Object.defineProperty(MDCFloatingLabelFoundation, "defaultAdapter", {
|
|
400
|
+
/**
|
|
401
|
+
* See {@link MDCFloatingLabelAdapter} for typing information on parameters and return types.
|
|
402
|
+
*/
|
|
403
|
+
get: function () {
|
|
404
|
+
// tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
|
|
405
|
+
return {
|
|
406
|
+
addClass: function () { return undefined; },
|
|
407
|
+
removeClass: function () { return undefined; },
|
|
408
|
+
getWidth: function () { return 0; },
|
|
409
|
+
registerInteractionHandler: function () { return undefined; },
|
|
410
|
+
deregisterInteractionHandler: function () { return undefined; },
|
|
411
|
+
};
|
|
412
|
+
// tslint:enable:object-literal-sort-keys
|
|
413
|
+
},
|
|
414
|
+
enumerable: false,
|
|
415
|
+
configurable: true
|
|
416
|
+
});
|
|
417
|
+
MDCFloatingLabelFoundation.prototype.init = function () {
|
|
418
|
+
this.adapter.registerInteractionHandler('animationend', this.shakeAnimationEndHandler);
|
|
419
|
+
};
|
|
420
|
+
MDCFloatingLabelFoundation.prototype.destroy = function () {
|
|
421
|
+
this.adapter.deregisterInteractionHandler('animationend', this.shakeAnimationEndHandler);
|
|
422
|
+
};
|
|
423
|
+
/**
|
|
424
|
+
* Returns the width of the label element.
|
|
425
|
+
*/
|
|
426
|
+
MDCFloatingLabelFoundation.prototype.getWidth = function () {
|
|
427
|
+
return this.adapter.getWidth();
|
|
428
|
+
};
|
|
429
|
+
/**
|
|
430
|
+
* Styles the label to produce a shake animation to indicate an error.
|
|
431
|
+
* @param shouldShake If true, adds the shake CSS class; otherwise, removes shake class.
|
|
432
|
+
*/
|
|
433
|
+
MDCFloatingLabelFoundation.prototype.shake = function (shouldShake) {
|
|
434
|
+
var LABEL_SHAKE = MDCFloatingLabelFoundation.cssClasses.LABEL_SHAKE;
|
|
435
|
+
if (shouldShake) {
|
|
436
|
+
this.adapter.addClass(LABEL_SHAKE);
|
|
437
|
+
}
|
|
438
|
+
else {
|
|
439
|
+
this.adapter.removeClass(LABEL_SHAKE);
|
|
440
|
+
}
|
|
441
|
+
};
|
|
442
|
+
/**
|
|
443
|
+
* Styles the label to float or dock.
|
|
444
|
+
* @param shouldFloat If true, adds the float CSS class; otherwise, removes float and shake classes to dock the label.
|
|
445
|
+
*/
|
|
446
|
+
MDCFloatingLabelFoundation.prototype.float = function (shouldFloat) {
|
|
447
|
+
var _a = MDCFloatingLabelFoundation.cssClasses, LABEL_FLOAT_ABOVE = _a.LABEL_FLOAT_ABOVE, LABEL_SHAKE = _a.LABEL_SHAKE;
|
|
448
|
+
if (shouldFloat) {
|
|
449
|
+
this.adapter.addClass(LABEL_FLOAT_ABOVE);
|
|
450
|
+
}
|
|
451
|
+
else {
|
|
452
|
+
this.adapter.removeClass(LABEL_FLOAT_ABOVE);
|
|
453
|
+
this.adapter.removeClass(LABEL_SHAKE);
|
|
454
|
+
}
|
|
455
|
+
};
|
|
456
|
+
/**
|
|
457
|
+
* Styles the label as required.
|
|
458
|
+
* @param isRequired If true, adds an asterisk to the label, indicating that it is required.
|
|
459
|
+
*/
|
|
460
|
+
MDCFloatingLabelFoundation.prototype.setRequired = function (isRequired) {
|
|
461
|
+
var LABEL_REQUIRED = MDCFloatingLabelFoundation.cssClasses.LABEL_REQUIRED;
|
|
462
|
+
if (isRequired) {
|
|
463
|
+
this.adapter.addClass(LABEL_REQUIRED);
|
|
464
|
+
}
|
|
465
|
+
else {
|
|
466
|
+
this.adapter.removeClass(LABEL_REQUIRED);
|
|
467
|
+
}
|
|
468
|
+
};
|
|
469
|
+
MDCFloatingLabelFoundation.prototype.handleShakeAnimationEnd = function () {
|
|
470
|
+
var LABEL_SHAKE = MDCFloatingLabelFoundation.cssClasses.LABEL_SHAKE;
|
|
471
|
+
this.adapter.removeClass(LABEL_SHAKE);
|
|
472
|
+
};
|
|
473
|
+
return MDCFloatingLabelFoundation;
|
|
474
|
+
}(MDCFoundation));
|
|
475
|
+
|
|
476
|
+
/**
|
|
477
|
+
* @license
|
|
478
|
+
* Copyright 2016 Google Inc.
|
|
479
|
+
*
|
|
480
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
481
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
482
|
+
* in the Software without restriction, including without limitation the rights
|
|
483
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
484
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
485
|
+
* furnished to do so, subject to the following conditions:
|
|
486
|
+
*
|
|
487
|
+
* The above copyright notice and this permission notice shall be included in
|
|
488
|
+
* all copies or substantial portions of the Software.
|
|
489
|
+
*
|
|
490
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
491
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
492
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
493
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
494
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
495
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
496
|
+
* THE SOFTWARE.
|
|
497
|
+
*/
|
|
498
|
+
var MDCFloatingLabel = /** @class */ (function (_super) {
|
|
499
|
+
__extends(MDCFloatingLabel, _super);
|
|
500
|
+
function MDCFloatingLabel() {
|
|
501
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
502
|
+
}
|
|
503
|
+
MDCFloatingLabel.attachTo = function (root) {
|
|
504
|
+
return new MDCFloatingLabel(root);
|
|
505
|
+
};
|
|
506
|
+
/**
|
|
507
|
+
* Styles the label to produce the label shake for errors.
|
|
508
|
+
* @param shouldShake If true, shakes the label by adding a CSS class; otherwise, stops shaking by removing the class.
|
|
509
|
+
*/
|
|
510
|
+
MDCFloatingLabel.prototype.shake = function (shouldShake) {
|
|
511
|
+
this.foundation.shake(shouldShake);
|
|
512
|
+
};
|
|
513
|
+
/**
|
|
514
|
+
* Styles the label to float/dock.
|
|
515
|
+
* @param shouldFloat If true, floats the label by adding a CSS class; otherwise, docks it by removing the class.
|
|
516
|
+
*/
|
|
517
|
+
MDCFloatingLabel.prototype.float = function (shouldFloat) {
|
|
518
|
+
this.foundation.float(shouldFloat);
|
|
519
|
+
};
|
|
520
|
+
/**
|
|
521
|
+
* Styles the label as required.
|
|
522
|
+
* @param isRequired If true, adds an asterisk to the label, indicating that it is required.
|
|
523
|
+
*/
|
|
524
|
+
MDCFloatingLabel.prototype.setRequired = function (isRequired) {
|
|
525
|
+
this.foundation.setRequired(isRequired);
|
|
526
|
+
};
|
|
527
|
+
MDCFloatingLabel.prototype.getWidth = function () {
|
|
528
|
+
return this.foundation.getWidth();
|
|
529
|
+
};
|
|
530
|
+
MDCFloatingLabel.prototype.getDefaultFoundation = function () {
|
|
531
|
+
var _this = this;
|
|
532
|
+
// DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
|
|
533
|
+
// To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
|
|
534
|
+
// tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
|
|
535
|
+
var adapter = {
|
|
536
|
+
addClass: function (className) { return _this.root.classList.add(className); },
|
|
537
|
+
removeClass: function (className) { return _this.root.classList.remove(className); },
|
|
538
|
+
getWidth: function () { return estimateScrollWidth(_this.root); },
|
|
539
|
+
registerInteractionHandler: function (evtType, handler) {
|
|
540
|
+
return _this.listen(evtType, handler);
|
|
541
|
+
},
|
|
542
|
+
deregisterInteractionHandler: function (evtType, handler) {
|
|
543
|
+
return _this.unlisten(evtType, handler);
|
|
544
|
+
},
|
|
545
|
+
};
|
|
546
|
+
// tslint:enable:object-literal-sort-keys
|
|
547
|
+
return new MDCFloatingLabelFoundation(adapter);
|
|
548
|
+
};
|
|
549
|
+
return MDCFloatingLabel;
|
|
550
|
+
}(MDCComponent));
|
|
551
|
+
|
|
552
|
+
/**
|
|
553
|
+
* @license
|
|
554
|
+
* Copyright 2018 Google Inc.
|
|
555
|
+
*
|
|
556
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
557
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
558
|
+
* in the Software without restriction, including without limitation the rights
|
|
559
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
560
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
561
|
+
* furnished to do so, subject to the following conditions:
|
|
562
|
+
*
|
|
563
|
+
* The above copyright notice and this permission notice shall be included in
|
|
564
|
+
* all copies or substantial portions of the Software.
|
|
565
|
+
*
|
|
566
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
567
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
568
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
569
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
570
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
571
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
572
|
+
* THE SOFTWARE.
|
|
573
|
+
*/
|
|
574
|
+
var cssClasses$2 = {
|
|
575
|
+
LINE_RIPPLE_ACTIVE: 'mdc-line-ripple--active',
|
|
576
|
+
LINE_RIPPLE_DEACTIVATING: 'mdc-line-ripple--deactivating',
|
|
577
|
+
};
|
|
578
|
+
|
|
579
|
+
/**
|
|
580
|
+
* @license
|
|
581
|
+
* Copyright 2018 Google Inc.
|
|
582
|
+
*
|
|
583
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
584
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
585
|
+
* in the Software without restriction, including without limitation the rights
|
|
586
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
587
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
588
|
+
* furnished to do so, subject to the following conditions:
|
|
589
|
+
*
|
|
590
|
+
* The above copyright notice and this permission notice shall be included in
|
|
591
|
+
* all copies or substantial portions of the Software.
|
|
592
|
+
*
|
|
593
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
594
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
595
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
596
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
597
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
598
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
599
|
+
* THE SOFTWARE.
|
|
600
|
+
*/
|
|
601
|
+
var MDCLineRippleFoundation = /** @class */ (function (_super) {
|
|
602
|
+
__extends(MDCLineRippleFoundation, _super);
|
|
603
|
+
function MDCLineRippleFoundation(adapter) {
|
|
604
|
+
var _this = _super.call(this, exports.__assign(exports.__assign({}, MDCLineRippleFoundation.defaultAdapter), adapter)) || this;
|
|
605
|
+
_this.transitionEndHandler = function (evt) {
|
|
606
|
+
_this.handleTransitionEnd(evt);
|
|
607
|
+
};
|
|
608
|
+
return _this;
|
|
609
|
+
}
|
|
610
|
+
Object.defineProperty(MDCLineRippleFoundation, "cssClasses", {
|
|
611
|
+
get: function () {
|
|
612
|
+
return cssClasses$2;
|
|
613
|
+
},
|
|
614
|
+
enumerable: false,
|
|
615
|
+
configurable: true
|
|
616
|
+
});
|
|
617
|
+
Object.defineProperty(MDCLineRippleFoundation, "defaultAdapter", {
|
|
618
|
+
/**
|
|
619
|
+
* See {@link MDCLineRippleAdapter} for typing information on parameters and return types.
|
|
620
|
+
*/
|
|
621
|
+
get: function () {
|
|
622
|
+
// tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
|
|
623
|
+
return {
|
|
624
|
+
addClass: function () { return undefined; },
|
|
625
|
+
removeClass: function () { return undefined; },
|
|
626
|
+
hasClass: function () { return false; },
|
|
627
|
+
setStyle: function () { return undefined; },
|
|
628
|
+
registerEventHandler: function () { return undefined; },
|
|
629
|
+
deregisterEventHandler: function () { return undefined; },
|
|
630
|
+
};
|
|
631
|
+
// tslint:enable:object-literal-sort-keys
|
|
632
|
+
},
|
|
633
|
+
enumerable: false,
|
|
634
|
+
configurable: true
|
|
635
|
+
});
|
|
636
|
+
MDCLineRippleFoundation.prototype.init = function () {
|
|
637
|
+
this.adapter.registerEventHandler('transitionend', this.transitionEndHandler);
|
|
638
|
+
};
|
|
639
|
+
MDCLineRippleFoundation.prototype.destroy = function () {
|
|
640
|
+
this.adapter.deregisterEventHandler('transitionend', this.transitionEndHandler);
|
|
641
|
+
};
|
|
642
|
+
MDCLineRippleFoundation.prototype.activate = function () {
|
|
643
|
+
this.adapter.removeClass(cssClasses$2.LINE_RIPPLE_DEACTIVATING);
|
|
644
|
+
this.adapter.addClass(cssClasses$2.LINE_RIPPLE_ACTIVE);
|
|
645
|
+
};
|
|
646
|
+
MDCLineRippleFoundation.prototype.setRippleCenter = function (xCoordinate) {
|
|
647
|
+
this.adapter.setStyle('transform-origin', xCoordinate + "px center");
|
|
648
|
+
};
|
|
649
|
+
MDCLineRippleFoundation.prototype.deactivate = function () {
|
|
650
|
+
this.adapter.addClass(cssClasses$2.LINE_RIPPLE_DEACTIVATING);
|
|
651
|
+
};
|
|
652
|
+
MDCLineRippleFoundation.prototype.handleTransitionEnd = function (evt) {
|
|
653
|
+
// Wait for the line ripple to be either transparent or opaque
|
|
654
|
+
// before emitting the animation end event
|
|
655
|
+
var isDeactivating = this.adapter.hasClass(cssClasses$2.LINE_RIPPLE_DEACTIVATING);
|
|
656
|
+
if (evt.propertyName === 'opacity') {
|
|
657
|
+
if (isDeactivating) {
|
|
658
|
+
this.adapter.removeClass(cssClasses$2.LINE_RIPPLE_ACTIVE);
|
|
659
|
+
this.adapter.removeClass(cssClasses$2.LINE_RIPPLE_DEACTIVATING);
|
|
660
|
+
}
|
|
661
|
+
}
|
|
662
|
+
};
|
|
663
|
+
return MDCLineRippleFoundation;
|
|
664
|
+
}(MDCFoundation));
|
|
665
|
+
|
|
666
|
+
/**
|
|
667
|
+
* @license
|
|
668
|
+
* Copyright 2018 Google Inc.
|
|
669
|
+
*
|
|
670
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
671
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
672
|
+
* in the Software without restriction, including without limitation the rights
|
|
673
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
674
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
675
|
+
* furnished to do so, subject to the following conditions:
|
|
676
|
+
*
|
|
677
|
+
* The above copyright notice and this permission notice shall be included in
|
|
678
|
+
* all copies or substantial portions of the Software.
|
|
679
|
+
*
|
|
680
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
681
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
682
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
683
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
684
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
685
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
686
|
+
* THE SOFTWARE.
|
|
687
|
+
*/
|
|
688
|
+
var MDCLineRipple = /** @class */ (function (_super) {
|
|
689
|
+
__extends(MDCLineRipple, _super);
|
|
690
|
+
function MDCLineRipple() {
|
|
691
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
692
|
+
}
|
|
693
|
+
MDCLineRipple.attachTo = function (root) {
|
|
694
|
+
return new MDCLineRipple(root);
|
|
695
|
+
};
|
|
696
|
+
/**
|
|
697
|
+
* Activates the line ripple
|
|
698
|
+
*/
|
|
699
|
+
MDCLineRipple.prototype.activate = function () {
|
|
700
|
+
this.foundation.activate();
|
|
701
|
+
};
|
|
702
|
+
/**
|
|
703
|
+
* Deactivates the line ripple
|
|
704
|
+
*/
|
|
705
|
+
MDCLineRipple.prototype.deactivate = function () {
|
|
706
|
+
this.foundation.deactivate();
|
|
707
|
+
};
|
|
708
|
+
/**
|
|
709
|
+
* Sets the transform origin given a user's click location.
|
|
710
|
+
* The `rippleCenter` is the x-coordinate of the middle of the ripple.
|
|
711
|
+
*/
|
|
712
|
+
MDCLineRipple.prototype.setRippleCenter = function (xCoordinate) {
|
|
713
|
+
this.foundation.setRippleCenter(xCoordinate);
|
|
714
|
+
};
|
|
715
|
+
MDCLineRipple.prototype.getDefaultFoundation = function () {
|
|
716
|
+
var _this = this;
|
|
717
|
+
// DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
|
|
718
|
+
// To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
|
|
719
|
+
// tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
|
|
720
|
+
var adapter = {
|
|
721
|
+
addClass: function (className) { return _this.root.classList.add(className); },
|
|
722
|
+
removeClass: function (className) { return _this.root.classList.remove(className); },
|
|
723
|
+
hasClass: function (className) { return _this.root.classList.contains(className); },
|
|
724
|
+
setStyle: function (propertyName, value) { return _this.root.style.setProperty(propertyName, value); },
|
|
725
|
+
registerEventHandler: function (evtType, handler) { return _this.listen(evtType, handler); },
|
|
726
|
+
deregisterEventHandler: function (evtType, handler) { return _this.unlisten(evtType, handler); },
|
|
727
|
+
};
|
|
728
|
+
// tslint:enable:object-literal-sort-keys
|
|
729
|
+
return new MDCLineRippleFoundation(adapter);
|
|
730
|
+
};
|
|
731
|
+
return MDCLineRipple;
|
|
732
|
+
}(MDCComponent));
|
|
733
|
+
|
|
734
|
+
/**
|
|
735
|
+
* @license
|
|
736
|
+
* Copyright 2016 Google Inc.
|
|
737
|
+
*
|
|
738
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
739
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
740
|
+
* in the Software without restriction, including without limitation the rights
|
|
741
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
742
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
743
|
+
* furnished to do so, subject to the following conditions:
|
|
744
|
+
*
|
|
745
|
+
* The above copyright notice and this permission notice shall be included in
|
|
746
|
+
* all copies or substantial portions of the Software.
|
|
747
|
+
*
|
|
748
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
749
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
750
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
751
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
752
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
753
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
754
|
+
* THE SOFTWARE.
|
|
755
|
+
*/
|
|
756
|
+
var cssPropertyNameMap = {
|
|
757
|
+
animation: {
|
|
758
|
+
prefixed: '-webkit-animation',
|
|
759
|
+
standard: 'animation',
|
|
760
|
+
},
|
|
761
|
+
transform: {
|
|
762
|
+
prefixed: '-webkit-transform',
|
|
763
|
+
standard: 'transform',
|
|
764
|
+
},
|
|
765
|
+
transition: {
|
|
766
|
+
prefixed: '-webkit-transition',
|
|
767
|
+
standard: 'transition',
|
|
768
|
+
},
|
|
769
|
+
};
|
|
770
|
+
var jsEventTypeMap = {
|
|
771
|
+
animationend: {
|
|
772
|
+
cssProperty: 'animation',
|
|
773
|
+
prefixed: 'webkitAnimationEnd',
|
|
774
|
+
standard: 'animationend',
|
|
775
|
+
},
|
|
776
|
+
animationiteration: {
|
|
777
|
+
cssProperty: 'animation',
|
|
778
|
+
prefixed: 'webkitAnimationIteration',
|
|
779
|
+
standard: 'animationiteration',
|
|
780
|
+
},
|
|
781
|
+
animationstart: {
|
|
782
|
+
cssProperty: 'animation',
|
|
783
|
+
prefixed: 'webkitAnimationStart',
|
|
784
|
+
standard: 'animationstart',
|
|
785
|
+
},
|
|
786
|
+
transitionend: {
|
|
787
|
+
cssProperty: 'transition',
|
|
788
|
+
prefixed: 'webkitTransitionEnd',
|
|
789
|
+
standard: 'transitionend',
|
|
790
|
+
},
|
|
791
|
+
};
|
|
792
|
+
function isWindow(windowObj) {
|
|
793
|
+
return Boolean(windowObj.document) && typeof windowObj.document.createElement === 'function';
|
|
794
|
+
}
|
|
795
|
+
function getCorrectPropertyName(windowObj, cssProperty) {
|
|
796
|
+
if (isWindow(windowObj) && cssProperty in cssPropertyNameMap) {
|
|
797
|
+
var el = windowObj.document.createElement('div');
|
|
798
|
+
var _a = cssPropertyNameMap[cssProperty], standard = _a.standard, prefixed = _a.prefixed;
|
|
799
|
+
var isStandard = standard in el.style;
|
|
800
|
+
return isStandard ? standard : prefixed;
|
|
801
|
+
}
|
|
802
|
+
return cssProperty;
|
|
803
|
+
}
|
|
804
|
+
function getCorrectEventName(windowObj, eventType) {
|
|
805
|
+
if (isWindow(windowObj) && eventType in jsEventTypeMap) {
|
|
806
|
+
var el = windowObj.document.createElement('div');
|
|
807
|
+
var _a = jsEventTypeMap[eventType], standard = _a.standard, prefixed = _a.prefixed, cssProperty = _a.cssProperty;
|
|
808
|
+
var isStandard = cssProperty in el.style;
|
|
809
|
+
return isStandard ? standard : prefixed;
|
|
810
|
+
}
|
|
811
|
+
return eventType;
|
|
812
|
+
}
|
|
813
|
+
|
|
814
|
+
/**
|
|
815
|
+
* @license
|
|
816
|
+
* Copyright 2018 Google Inc.
|
|
817
|
+
*
|
|
818
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
819
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
820
|
+
* in the Software without restriction, including without limitation the rights
|
|
821
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
822
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
823
|
+
* furnished to do so, subject to the following conditions:
|
|
824
|
+
*
|
|
825
|
+
* The above copyright notice and this permission notice shall be included in
|
|
826
|
+
* all copies or substantial portions of the Software.
|
|
827
|
+
*
|
|
828
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
829
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
830
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
831
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
832
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
833
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
834
|
+
* THE SOFTWARE.
|
|
835
|
+
*/
|
|
836
|
+
var strings$1 = {
|
|
837
|
+
NOTCH_ELEMENT_SELECTOR: '.mdc-notched-outline__notch',
|
|
838
|
+
};
|
|
839
|
+
var numbers$1 = {
|
|
840
|
+
// This should stay in sync with $mdc-notched-outline-padding * 2.
|
|
841
|
+
NOTCH_ELEMENT_PADDING: 8,
|
|
842
|
+
};
|
|
843
|
+
var cssClasses$1 = {
|
|
844
|
+
NO_LABEL: 'mdc-notched-outline--no-label',
|
|
845
|
+
OUTLINE_NOTCHED: 'mdc-notched-outline--notched',
|
|
846
|
+
OUTLINE_UPGRADED: 'mdc-notched-outline--upgraded',
|
|
847
|
+
};
|
|
848
|
+
|
|
849
|
+
/**
|
|
850
|
+
* @license
|
|
851
|
+
* Copyright 2017 Google Inc.
|
|
852
|
+
*
|
|
853
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
854
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
855
|
+
* in the Software without restriction, including without limitation the rights
|
|
856
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
857
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
858
|
+
* furnished to do so, subject to the following conditions:
|
|
859
|
+
*
|
|
860
|
+
* The above copyright notice and this permission notice shall be included in
|
|
861
|
+
* all copies or substantial portions of the Software.
|
|
862
|
+
*
|
|
863
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
864
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
865
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
866
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
867
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
868
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
869
|
+
* THE SOFTWARE.
|
|
870
|
+
*/
|
|
871
|
+
var MDCNotchedOutlineFoundation = /** @class */ (function (_super) {
|
|
872
|
+
__extends(MDCNotchedOutlineFoundation, _super);
|
|
873
|
+
function MDCNotchedOutlineFoundation(adapter) {
|
|
874
|
+
return _super.call(this, exports.__assign(exports.__assign({}, MDCNotchedOutlineFoundation.defaultAdapter), adapter)) || this;
|
|
875
|
+
}
|
|
876
|
+
Object.defineProperty(MDCNotchedOutlineFoundation, "strings", {
|
|
877
|
+
get: function () {
|
|
878
|
+
return strings$1;
|
|
879
|
+
},
|
|
880
|
+
enumerable: false,
|
|
881
|
+
configurable: true
|
|
882
|
+
});
|
|
883
|
+
Object.defineProperty(MDCNotchedOutlineFoundation, "cssClasses", {
|
|
884
|
+
get: function () {
|
|
885
|
+
return cssClasses$1;
|
|
886
|
+
},
|
|
887
|
+
enumerable: false,
|
|
888
|
+
configurable: true
|
|
889
|
+
});
|
|
890
|
+
Object.defineProperty(MDCNotchedOutlineFoundation, "numbers", {
|
|
891
|
+
get: function () {
|
|
892
|
+
return numbers$1;
|
|
893
|
+
},
|
|
894
|
+
enumerable: false,
|
|
895
|
+
configurable: true
|
|
896
|
+
});
|
|
897
|
+
Object.defineProperty(MDCNotchedOutlineFoundation, "defaultAdapter", {
|
|
898
|
+
/**
|
|
899
|
+
* See {@link MDCNotchedOutlineAdapter} for typing information on parameters and return types.
|
|
900
|
+
*/
|
|
901
|
+
get: function () {
|
|
902
|
+
// tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
|
|
903
|
+
return {
|
|
904
|
+
addClass: function () { return undefined; },
|
|
905
|
+
removeClass: function () { return undefined; },
|
|
906
|
+
setNotchWidthProperty: function () { return undefined; },
|
|
907
|
+
removeNotchWidthProperty: function () { return undefined; },
|
|
908
|
+
};
|
|
909
|
+
// tslint:enable:object-literal-sort-keys
|
|
910
|
+
},
|
|
911
|
+
enumerable: false,
|
|
912
|
+
configurable: true
|
|
913
|
+
});
|
|
914
|
+
/**
|
|
915
|
+
* Adds the outline notched selector and updates the notch width calculated based off of notchWidth.
|
|
916
|
+
*/
|
|
917
|
+
MDCNotchedOutlineFoundation.prototype.notch = function (notchWidth) {
|
|
918
|
+
var OUTLINE_NOTCHED = MDCNotchedOutlineFoundation.cssClasses.OUTLINE_NOTCHED;
|
|
919
|
+
if (notchWidth > 0) {
|
|
920
|
+
notchWidth += numbers$1.NOTCH_ELEMENT_PADDING; // Add padding from left/right.
|
|
921
|
+
}
|
|
922
|
+
this.adapter.setNotchWidthProperty(notchWidth);
|
|
923
|
+
this.adapter.addClass(OUTLINE_NOTCHED);
|
|
924
|
+
};
|
|
925
|
+
/**
|
|
926
|
+
* Removes notched outline selector to close the notch in the outline.
|
|
927
|
+
*/
|
|
928
|
+
MDCNotchedOutlineFoundation.prototype.closeNotch = function () {
|
|
929
|
+
var OUTLINE_NOTCHED = MDCNotchedOutlineFoundation.cssClasses.OUTLINE_NOTCHED;
|
|
930
|
+
this.adapter.removeClass(OUTLINE_NOTCHED);
|
|
931
|
+
this.adapter.removeNotchWidthProperty();
|
|
932
|
+
};
|
|
933
|
+
return MDCNotchedOutlineFoundation;
|
|
934
|
+
}(MDCFoundation));
|
|
935
|
+
|
|
936
|
+
/**
|
|
937
|
+
* @license
|
|
938
|
+
* Copyright 2017 Google Inc.
|
|
939
|
+
*
|
|
940
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
941
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
942
|
+
* in the Software without restriction, including without limitation the rights
|
|
943
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
944
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
945
|
+
* furnished to do so, subject to the following conditions:
|
|
946
|
+
*
|
|
947
|
+
* The above copyright notice and this permission notice shall be included in
|
|
948
|
+
* all copies or substantial portions of the Software.
|
|
949
|
+
*
|
|
950
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
951
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
952
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
953
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
954
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
955
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
956
|
+
* THE SOFTWARE.
|
|
957
|
+
*/
|
|
958
|
+
var MDCNotchedOutline = /** @class */ (function (_super) {
|
|
959
|
+
__extends(MDCNotchedOutline, _super);
|
|
960
|
+
function MDCNotchedOutline() {
|
|
961
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
962
|
+
}
|
|
963
|
+
MDCNotchedOutline.attachTo = function (root) {
|
|
964
|
+
return new MDCNotchedOutline(root);
|
|
965
|
+
};
|
|
966
|
+
MDCNotchedOutline.prototype.initialSyncWithDOM = function () {
|
|
967
|
+
this.notchElement =
|
|
968
|
+
this.root.querySelector(strings$1.NOTCH_ELEMENT_SELECTOR);
|
|
969
|
+
var label = this.root.querySelector('.' + MDCFloatingLabelFoundation.cssClasses.ROOT);
|
|
970
|
+
if (label) {
|
|
971
|
+
label.style.transitionDuration = '0s';
|
|
972
|
+
this.root.classList.add(cssClasses$1.OUTLINE_UPGRADED);
|
|
973
|
+
requestAnimationFrame(function () {
|
|
974
|
+
label.style.transitionDuration = '';
|
|
975
|
+
});
|
|
976
|
+
}
|
|
977
|
+
else {
|
|
978
|
+
this.root.classList.add(cssClasses$1.NO_LABEL);
|
|
979
|
+
}
|
|
980
|
+
};
|
|
981
|
+
/**
|
|
982
|
+
* Updates classes and styles to open the notch to the specified width.
|
|
983
|
+
* @param notchWidth The notch width in the outline.
|
|
984
|
+
*/
|
|
985
|
+
MDCNotchedOutline.prototype.notch = function (notchWidth) {
|
|
986
|
+
this.foundation.notch(notchWidth);
|
|
987
|
+
};
|
|
988
|
+
/**
|
|
989
|
+
* Updates classes and styles to close the notch.
|
|
990
|
+
*/
|
|
991
|
+
MDCNotchedOutline.prototype.closeNotch = function () {
|
|
992
|
+
this.foundation.closeNotch();
|
|
993
|
+
};
|
|
994
|
+
MDCNotchedOutline.prototype.getDefaultFoundation = function () {
|
|
995
|
+
var _this = this;
|
|
996
|
+
// DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
|
|
997
|
+
// To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
|
|
998
|
+
// tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
|
|
999
|
+
var adapter = {
|
|
1000
|
+
addClass: function (className) { return _this.root.classList.add(className); },
|
|
1001
|
+
removeClass: function (className) { return _this.root.classList.remove(className); },
|
|
1002
|
+
setNotchWidthProperty: function (width) {
|
|
1003
|
+
_this.notchElement.style.setProperty('width', width + 'px');
|
|
1004
|
+
},
|
|
1005
|
+
removeNotchWidthProperty: function () {
|
|
1006
|
+
_this.notchElement.style.removeProperty('width');
|
|
1007
|
+
},
|
|
1008
|
+
};
|
|
1009
|
+
// tslint:enable:object-literal-sort-keys
|
|
1010
|
+
return new MDCNotchedOutlineFoundation(adapter);
|
|
1011
|
+
};
|
|
1012
|
+
return MDCNotchedOutline;
|
|
1013
|
+
}(MDCComponent));
|
|
1014
|
+
|
|
1015
|
+
/**
|
|
1016
|
+
* @license
|
|
1017
|
+
* Copyright 2019 Google Inc.
|
|
1018
|
+
*
|
|
1019
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
1020
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
1021
|
+
* in the Software without restriction, including without limitation the rights
|
|
1022
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
1023
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
1024
|
+
* furnished to do so, subject to the following conditions:
|
|
1025
|
+
*
|
|
1026
|
+
* The above copyright notice and this permission notice shall be included in
|
|
1027
|
+
* all copies or substantial portions of the Software.
|
|
1028
|
+
*
|
|
1029
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
1030
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
1031
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
1032
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
1033
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
1034
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
1035
|
+
* THE SOFTWARE.
|
|
1036
|
+
*/
|
|
1037
|
+
/**
|
|
1038
|
+
* Determine whether the current browser supports passive event listeners, and
|
|
1039
|
+
* if so, use them.
|
|
1040
|
+
*/
|
|
1041
|
+
function applyPassive(globalObj) {
|
|
1042
|
+
if (globalObj === void 0) { globalObj = window; }
|
|
1043
|
+
return supportsPassiveOption(globalObj) ?
|
|
1044
|
+
{ passive: true } :
|
|
1045
|
+
false;
|
|
1046
|
+
}
|
|
1047
|
+
function supportsPassiveOption(globalObj) {
|
|
1048
|
+
if (globalObj === void 0) { globalObj = window; }
|
|
1049
|
+
// See
|
|
1050
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener
|
|
1051
|
+
var passiveSupported = false;
|
|
1052
|
+
try {
|
|
1053
|
+
var options = {
|
|
1054
|
+
// This function will be called when the browser
|
|
1055
|
+
// attempts to access the passive property.
|
|
1056
|
+
get passive() {
|
|
1057
|
+
passiveSupported = true;
|
|
1058
|
+
return false;
|
|
1059
|
+
}
|
|
1060
|
+
};
|
|
1061
|
+
var handler = function () { };
|
|
1062
|
+
globalObj.document.addEventListener('test', handler, options);
|
|
1063
|
+
globalObj.document.removeEventListener('test', handler, options);
|
|
1064
|
+
}
|
|
1065
|
+
catch (err) {
|
|
1066
|
+
passiveSupported = false;
|
|
1067
|
+
}
|
|
1068
|
+
return passiveSupported;
|
|
1069
|
+
}
|
|
1070
|
+
|
|
1071
|
+
/**
|
|
1072
|
+
* @license
|
|
1073
|
+
* Copyright 2016 Google Inc.
|
|
1074
|
+
*
|
|
1075
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
1076
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
1077
|
+
* in the Software without restriction, including without limitation the rights
|
|
1078
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
1079
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
1080
|
+
* furnished to do so, subject to the following conditions:
|
|
1081
|
+
*
|
|
1082
|
+
* The above copyright notice and this permission notice shall be included in
|
|
1083
|
+
* all copies or substantial portions of the Software.
|
|
1084
|
+
*
|
|
1085
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
1086
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
1087
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
1088
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
1089
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
1090
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
1091
|
+
* THE SOFTWARE.
|
|
1092
|
+
*/
|
|
1093
|
+
var cssClasses = {
|
|
1094
|
+
// Ripple is a special case where the "root" component is really a "mixin" of sorts,
|
|
1095
|
+
// given that it's an 'upgrade' to an existing component. That being said it is the root
|
|
1096
|
+
// CSS class that all other CSS classes derive from.
|
|
1097
|
+
BG_FOCUSED: 'mdc-ripple-upgraded--background-focused',
|
|
1098
|
+
FG_ACTIVATION: 'mdc-ripple-upgraded--foreground-activation',
|
|
1099
|
+
FG_DEACTIVATION: 'mdc-ripple-upgraded--foreground-deactivation',
|
|
1100
|
+
ROOT: 'mdc-ripple-upgraded',
|
|
1101
|
+
UNBOUNDED: 'mdc-ripple-upgraded--unbounded',
|
|
1102
|
+
};
|
|
1103
|
+
var strings = {
|
|
1104
|
+
VAR_FG_SCALE: '--mdc-ripple-fg-scale',
|
|
1105
|
+
VAR_FG_SIZE: '--mdc-ripple-fg-size',
|
|
1106
|
+
VAR_FG_TRANSLATE_END: '--mdc-ripple-fg-translate-end',
|
|
1107
|
+
VAR_FG_TRANSLATE_START: '--mdc-ripple-fg-translate-start',
|
|
1108
|
+
VAR_LEFT: '--mdc-ripple-left',
|
|
1109
|
+
VAR_TOP: '--mdc-ripple-top',
|
|
1110
|
+
};
|
|
1111
|
+
var numbers = {
|
|
1112
|
+
DEACTIVATION_TIMEOUT_MS: 225,
|
|
1113
|
+
FG_DEACTIVATION_MS: 150,
|
|
1114
|
+
INITIAL_ORIGIN_SCALE: 0.6,
|
|
1115
|
+
PADDING: 10,
|
|
1116
|
+
TAP_DELAY_MS: 300, // Delay between touch and simulated mouse events on touch devices
|
|
1117
|
+
};
|
|
1118
|
+
|
|
1119
|
+
/**
|
|
1120
|
+
* Stores result from supportsCssVariables to avoid redundant processing to
|
|
1121
|
+
* detect CSS custom variable support.
|
|
1122
|
+
*/
|
|
1123
|
+
var supportsCssVariables_;
|
|
1124
|
+
function supportsCssVariables(windowObj, forceRefresh) {
|
|
1125
|
+
if (forceRefresh === void 0) { forceRefresh = false; }
|
|
1126
|
+
var CSS = windowObj.CSS;
|
|
1127
|
+
var supportsCssVars = supportsCssVariables_;
|
|
1128
|
+
if (typeof supportsCssVariables_ === 'boolean' && !forceRefresh) {
|
|
1129
|
+
return supportsCssVariables_;
|
|
1130
|
+
}
|
|
1131
|
+
var supportsFunctionPresent = CSS && typeof CSS.supports === 'function';
|
|
1132
|
+
if (!supportsFunctionPresent) {
|
|
1133
|
+
return false;
|
|
1134
|
+
}
|
|
1135
|
+
var explicitlySupportsCssVars = CSS.supports('--css-vars', 'yes');
|
|
1136
|
+
// See: https://bugs.webkit.org/show_bug.cgi?id=154669
|
|
1137
|
+
// See: README section on Safari
|
|
1138
|
+
var weAreFeatureDetectingSafari10plus = (CSS.supports('(--css-vars: yes)') &&
|
|
1139
|
+
CSS.supports('color', '#00000000'));
|
|
1140
|
+
supportsCssVars =
|
|
1141
|
+
explicitlySupportsCssVars || weAreFeatureDetectingSafari10plus;
|
|
1142
|
+
if (!forceRefresh) {
|
|
1143
|
+
supportsCssVariables_ = supportsCssVars;
|
|
1144
|
+
}
|
|
1145
|
+
return supportsCssVars;
|
|
1146
|
+
}
|
|
1147
|
+
function getNormalizedEventCoords(evt, pageOffset, clientRect) {
|
|
1148
|
+
if (!evt) {
|
|
1149
|
+
return { x: 0, y: 0 };
|
|
1150
|
+
}
|
|
1151
|
+
var x = pageOffset.x, y = pageOffset.y;
|
|
1152
|
+
var documentX = x + clientRect.left;
|
|
1153
|
+
var documentY = y + clientRect.top;
|
|
1154
|
+
var normalizedX;
|
|
1155
|
+
var normalizedY;
|
|
1156
|
+
// Determine touch point relative to the ripple container.
|
|
1157
|
+
if (evt.type === 'touchstart') {
|
|
1158
|
+
var touchEvent = evt;
|
|
1159
|
+
normalizedX = touchEvent.changedTouches[0].pageX - documentX;
|
|
1160
|
+
normalizedY = touchEvent.changedTouches[0].pageY - documentY;
|
|
1161
|
+
}
|
|
1162
|
+
else {
|
|
1163
|
+
var mouseEvent = evt;
|
|
1164
|
+
normalizedX = mouseEvent.pageX - documentX;
|
|
1165
|
+
normalizedY = mouseEvent.pageY - documentY;
|
|
1166
|
+
}
|
|
1167
|
+
return { x: normalizedX, y: normalizedY };
|
|
1168
|
+
}
|
|
1169
|
+
|
|
1170
|
+
/**
|
|
1171
|
+
* @license
|
|
1172
|
+
* Copyright 2016 Google Inc.
|
|
1173
|
+
*
|
|
1174
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
1175
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
1176
|
+
* in the Software without restriction, including without limitation the rights
|
|
1177
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
1178
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
1179
|
+
* furnished to do so, subject to the following conditions:
|
|
1180
|
+
*
|
|
1181
|
+
* The above copyright notice and this permission notice shall be included in
|
|
1182
|
+
* all copies or substantial portions of the Software.
|
|
1183
|
+
*
|
|
1184
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
1185
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
1186
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
1187
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
1188
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
1189
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
1190
|
+
* THE SOFTWARE.
|
|
1191
|
+
*/
|
|
1192
|
+
// Activation events registered on the root element of each instance for activation
|
|
1193
|
+
var ACTIVATION_EVENT_TYPES = [
|
|
1194
|
+
'touchstart', 'pointerdown', 'mousedown', 'keydown',
|
|
1195
|
+
];
|
|
1196
|
+
// Deactivation events registered on documentElement when a pointer-related down event occurs
|
|
1197
|
+
var POINTER_DEACTIVATION_EVENT_TYPES = [
|
|
1198
|
+
'touchend', 'pointerup', 'mouseup', 'contextmenu',
|
|
1199
|
+
];
|
|
1200
|
+
// simultaneous nested activations
|
|
1201
|
+
var activatedTargets = [];
|
|
1202
|
+
var MDCRippleFoundation = /** @class */ (function (_super) {
|
|
1203
|
+
__extends(MDCRippleFoundation, _super);
|
|
1204
|
+
function MDCRippleFoundation(adapter) {
|
|
1205
|
+
var _this = _super.call(this, exports.__assign(exports.__assign({}, MDCRippleFoundation.defaultAdapter), adapter)) || this;
|
|
1206
|
+
_this.activationAnimationHasEnded = false;
|
|
1207
|
+
_this.activationTimer = 0;
|
|
1208
|
+
_this.fgDeactivationRemovalTimer = 0;
|
|
1209
|
+
_this.fgScale = '0';
|
|
1210
|
+
_this.frame = { width: 0, height: 0 };
|
|
1211
|
+
_this.initialSize = 0;
|
|
1212
|
+
_this.layoutFrame = 0;
|
|
1213
|
+
_this.maxRadius = 0;
|
|
1214
|
+
_this.unboundedCoords = { left: 0, top: 0 };
|
|
1215
|
+
_this.activationState = _this.defaultActivationState();
|
|
1216
|
+
_this.activationTimerCallback = function () {
|
|
1217
|
+
_this.activationAnimationHasEnded = true;
|
|
1218
|
+
_this.runDeactivationUXLogicIfReady();
|
|
1219
|
+
};
|
|
1220
|
+
_this.activateHandler = function (e) {
|
|
1221
|
+
_this.activateImpl(e);
|
|
1222
|
+
};
|
|
1223
|
+
_this.deactivateHandler = function () {
|
|
1224
|
+
_this.deactivateImpl();
|
|
1225
|
+
};
|
|
1226
|
+
_this.focusHandler = function () {
|
|
1227
|
+
_this.handleFocus();
|
|
1228
|
+
};
|
|
1229
|
+
_this.blurHandler = function () {
|
|
1230
|
+
_this.handleBlur();
|
|
1231
|
+
};
|
|
1232
|
+
_this.resizeHandler = function () {
|
|
1233
|
+
_this.layout();
|
|
1234
|
+
};
|
|
1235
|
+
return _this;
|
|
1236
|
+
}
|
|
1237
|
+
Object.defineProperty(MDCRippleFoundation, "cssClasses", {
|
|
1238
|
+
get: function () {
|
|
1239
|
+
return cssClasses;
|
|
1240
|
+
},
|
|
1241
|
+
enumerable: false,
|
|
1242
|
+
configurable: true
|
|
1243
|
+
});
|
|
1244
|
+
Object.defineProperty(MDCRippleFoundation, "strings", {
|
|
1245
|
+
get: function () {
|
|
1246
|
+
return strings;
|
|
1247
|
+
},
|
|
1248
|
+
enumerable: false,
|
|
1249
|
+
configurable: true
|
|
1250
|
+
});
|
|
1251
|
+
Object.defineProperty(MDCRippleFoundation, "numbers", {
|
|
1252
|
+
get: function () {
|
|
1253
|
+
return numbers;
|
|
1254
|
+
},
|
|
1255
|
+
enumerable: false,
|
|
1256
|
+
configurable: true
|
|
1257
|
+
});
|
|
1258
|
+
Object.defineProperty(MDCRippleFoundation, "defaultAdapter", {
|
|
1259
|
+
get: function () {
|
|
1260
|
+
return {
|
|
1261
|
+
addClass: function () { return undefined; },
|
|
1262
|
+
browserSupportsCssVars: function () { return true; },
|
|
1263
|
+
computeBoundingRect: function () {
|
|
1264
|
+
return ({ top: 0, right: 0, bottom: 0, left: 0, width: 0, height: 0 });
|
|
1265
|
+
},
|
|
1266
|
+
containsEventTarget: function () { return true; },
|
|
1267
|
+
deregisterDocumentInteractionHandler: function () { return undefined; },
|
|
1268
|
+
deregisterInteractionHandler: function () { return undefined; },
|
|
1269
|
+
deregisterResizeHandler: function () { return undefined; },
|
|
1270
|
+
getWindowPageOffset: function () { return ({ x: 0, y: 0 }); },
|
|
1271
|
+
isSurfaceActive: function () { return true; },
|
|
1272
|
+
isSurfaceDisabled: function () { return true; },
|
|
1273
|
+
isUnbounded: function () { return true; },
|
|
1274
|
+
registerDocumentInteractionHandler: function () { return undefined; },
|
|
1275
|
+
registerInteractionHandler: function () { return undefined; },
|
|
1276
|
+
registerResizeHandler: function () { return undefined; },
|
|
1277
|
+
removeClass: function () { return undefined; },
|
|
1278
|
+
updateCssVariable: function () { return undefined; },
|
|
1279
|
+
};
|
|
1280
|
+
},
|
|
1281
|
+
enumerable: false,
|
|
1282
|
+
configurable: true
|
|
1283
|
+
});
|
|
1284
|
+
MDCRippleFoundation.prototype.init = function () {
|
|
1285
|
+
var _this = this;
|
|
1286
|
+
var supportsPressRipple = this.supportsPressRipple();
|
|
1287
|
+
this.registerRootHandlers(supportsPressRipple);
|
|
1288
|
+
if (supportsPressRipple) {
|
|
1289
|
+
var _a = MDCRippleFoundation.cssClasses, ROOT_1 = _a.ROOT, UNBOUNDED_1 = _a.UNBOUNDED;
|
|
1290
|
+
requestAnimationFrame(function () {
|
|
1291
|
+
_this.adapter.addClass(ROOT_1);
|
|
1292
|
+
if (_this.adapter.isUnbounded()) {
|
|
1293
|
+
_this.adapter.addClass(UNBOUNDED_1);
|
|
1294
|
+
// Unbounded ripples need layout logic applied immediately to set coordinates for both shade and ripple
|
|
1295
|
+
_this.layoutInternal();
|
|
1296
|
+
}
|
|
1297
|
+
});
|
|
1298
|
+
}
|
|
1299
|
+
};
|
|
1300
|
+
MDCRippleFoundation.prototype.destroy = function () {
|
|
1301
|
+
var _this = this;
|
|
1302
|
+
if (this.supportsPressRipple()) {
|
|
1303
|
+
if (this.activationTimer) {
|
|
1304
|
+
clearTimeout(this.activationTimer);
|
|
1305
|
+
this.activationTimer = 0;
|
|
1306
|
+
this.adapter.removeClass(MDCRippleFoundation.cssClasses.FG_ACTIVATION);
|
|
1307
|
+
}
|
|
1308
|
+
if (this.fgDeactivationRemovalTimer) {
|
|
1309
|
+
clearTimeout(this.fgDeactivationRemovalTimer);
|
|
1310
|
+
this.fgDeactivationRemovalTimer = 0;
|
|
1311
|
+
this.adapter.removeClass(MDCRippleFoundation.cssClasses.FG_DEACTIVATION);
|
|
1312
|
+
}
|
|
1313
|
+
var _a = MDCRippleFoundation.cssClasses, ROOT_2 = _a.ROOT, UNBOUNDED_2 = _a.UNBOUNDED;
|
|
1314
|
+
requestAnimationFrame(function () {
|
|
1315
|
+
_this.adapter.removeClass(ROOT_2);
|
|
1316
|
+
_this.adapter.removeClass(UNBOUNDED_2);
|
|
1317
|
+
_this.removeCssVars();
|
|
1318
|
+
});
|
|
1319
|
+
}
|
|
1320
|
+
this.deregisterRootHandlers();
|
|
1321
|
+
this.deregisterDeactivationHandlers();
|
|
1322
|
+
};
|
|
1323
|
+
/**
|
|
1324
|
+
* @param evt Optional event containing position information.
|
|
1325
|
+
*/
|
|
1326
|
+
MDCRippleFoundation.prototype.activate = function (evt) {
|
|
1327
|
+
this.activateImpl(evt);
|
|
1328
|
+
};
|
|
1329
|
+
MDCRippleFoundation.prototype.deactivate = function () {
|
|
1330
|
+
this.deactivateImpl();
|
|
1331
|
+
};
|
|
1332
|
+
MDCRippleFoundation.prototype.layout = function () {
|
|
1333
|
+
var _this = this;
|
|
1334
|
+
if (this.layoutFrame) {
|
|
1335
|
+
cancelAnimationFrame(this.layoutFrame);
|
|
1336
|
+
}
|
|
1337
|
+
this.layoutFrame = requestAnimationFrame(function () {
|
|
1338
|
+
_this.layoutInternal();
|
|
1339
|
+
_this.layoutFrame = 0;
|
|
1340
|
+
});
|
|
1341
|
+
};
|
|
1342
|
+
MDCRippleFoundation.prototype.setUnbounded = function (unbounded) {
|
|
1343
|
+
var UNBOUNDED = MDCRippleFoundation.cssClasses.UNBOUNDED;
|
|
1344
|
+
if (unbounded) {
|
|
1345
|
+
this.adapter.addClass(UNBOUNDED);
|
|
1346
|
+
}
|
|
1347
|
+
else {
|
|
1348
|
+
this.adapter.removeClass(UNBOUNDED);
|
|
1349
|
+
}
|
|
1350
|
+
};
|
|
1351
|
+
MDCRippleFoundation.prototype.handleFocus = function () {
|
|
1352
|
+
var _this = this;
|
|
1353
|
+
requestAnimationFrame(function () { return _this.adapter.addClass(MDCRippleFoundation.cssClasses.BG_FOCUSED); });
|
|
1354
|
+
};
|
|
1355
|
+
MDCRippleFoundation.prototype.handleBlur = function () {
|
|
1356
|
+
var _this = this;
|
|
1357
|
+
requestAnimationFrame(function () { return _this.adapter.removeClass(MDCRippleFoundation.cssClasses.BG_FOCUSED); });
|
|
1358
|
+
};
|
|
1359
|
+
/**
|
|
1360
|
+
* We compute this property so that we are not querying information about the client
|
|
1361
|
+
* until the point in time where the foundation requests it. This prevents scenarios where
|
|
1362
|
+
* client-side feature-detection may happen too early, such as when components are rendered on the server
|
|
1363
|
+
* and then initialized at mount time on the client.
|
|
1364
|
+
*/
|
|
1365
|
+
MDCRippleFoundation.prototype.supportsPressRipple = function () {
|
|
1366
|
+
return this.adapter.browserSupportsCssVars();
|
|
1367
|
+
};
|
|
1368
|
+
MDCRippleFoundation.prototype.defaultActivationState = function () {
|
|
1369
|
+
return {
|
|
1370
|
+
activationEvent: undefined,
|
|
1371
|
+
hasDeactivationUXRun: false,
|
|
1372
|
+
isActivated: false,
|
|
1373
|
+
isProgrammatic: false,
|
|
1374
|
+
wasActivatedByPointer: false,
|
|
1375
|
+
wasElementMadeActive: false,
|
|
1376
|
+
};
|
|
1377
|
+
};
|
|
1378
|
+
/**
|
|
1379
|
+
* supportsPressRipple Passed from init to save a redundant function call
|
|
1380
|
+
*/
|
|
1381
|
+
MDCRippleFoundation.prototype.registerRootHandlers = function (supportsPressRipple) {
|
|
1382
|
+
var e_1, _a;
|
|
1383
|
+
if (supportsPressRipple) {
|
|
1384
|
+
try {
|
|
1385
|
+
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()) {
|
|
1386
|
+
var evtType = ACTIVATION_EVENT_TYPES_1_1.value;
|
|
1387
|
+
this.adapter.registerInteractionHandler(evtType, this.activateHandler);
|
|
1388
|
+
}
|
|
1389
|
+
}
|
|
1390
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
1391
|
+
finally {
|
|
1392
|
+
try {
|
|
1393
|
+
if (ACTIVATION_EVENT_TYPES_1_1 && !ACTIVATION_EVENT_TYPES_1_1.done && (_a = ACTIVATION_EVENT_TYPES_1.return)) _a.call(ACTIVATION_EVENT_TYPES_1);
|
|
1394
|
+
}
|
|
1395
|
+
finally { if (e_1) throw e_1.error; }
|
|
1396
|
+
}
|
|
1397
|
+
if (this.adapter.isUnbounded()) {
|
|
1398
|
+
this.adapter.registerResizeHandler(this.resizeHandler);
|
|
1399
|
+
}
|
|
1400
|
+
}
|
|
1401
|
+
this.adapter.registerInteractionHandler('focus', this.focusHandler);
|
|
1402
|
+
this.adapter.registerInteractionHandler('blur', this.blurHandler);
|
|
1403
|
+
};
|
|
1404
|
+
MDCRippleFoundation.prototype.registerDeactivationHandlers = function (evt) {
|
|
1405
|
+
var e_2, _a;
|
|
1406
|
+
if (evt.type === 'keydown') {
|
|
1407
|
+
this.adapter.registerInteractionHandler('keyup', this.deactivateHandler);
|
|
1408
|
+
}
|
|
1409
|
+
else {
|
|
1410
|
+
try {
|
|
1411
|
+
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()) {
|
|
1412
|
+
var evtType = POINTER_DEACTIVATION_EVENT_TYPES_1_1.value;
|
|
1413
|
+
this.adapter.registerDocumentInteractionHandler(evtType, this.deactivateHandler);
|
|
1414
|
+
}
|
|
1415
|
+
}
|
|
1416
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
1417
|
+
finally {
|
|
1418
|
+
try {
|
|
1419
|
+
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);
|
|
1420
|
+
}
|
|
1421
|
+
finally { if (e_2) throw e_2.error; }
|
|
1422
|
+
}
|
|
1423
|
+
}
|
|
1424
|
+
};
|
|
1425
|
+
MDCRippleFoundation.prototype.deregisterRootHandlers = function () {
|
|
1426
|
+
var e_3, _a;
|
|
1427
|
+
try {
|
|
1428
|
+
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()) {
|
|
1429
|
+
var evtType = ACTIVATION_EVENT_TYPES_2_1.value;
|
|
1430
|
+
this.adapter.deregisterInteractionHandler(evtType, this.activateHandler);
|
|
1431
|
+
}
|
|
1432
|
+
}
|
|
1433
|
+
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
1434
|
+
finally {
|
|
1435
|
+
try {
|
|
1436
|
+
if (ACTIVATION_EVENT_TYPES_2_1 && !ACTIVATION_EVENT_TYPES_2_1.done && (_a = ACTIVATION_EVENT_TYPES_2.return)) _a.call(ACTIVATION_EVENT_TYPES_2);
|
|
1437
|
+
}
|
|
1438
|
+
finally { if (e_3) throw e_3.error; }
|
|
1439
|
+
}
|
|
1440
|
+
this.adapter.deregisterInteractionHandler('focus', this.focusHandler);
|
|
1441
|
+
this.adapter.deregisterInteractionHandler('blur', this.blurHandler);
|
|
1442
|
+
if (this.adapter.isUnbounded()) {
|
|
1443
|
+
this.adapter.deregisterResizeHandler(this.resizeHandler);
|
|
1444
|
+
}
|
|
1445
|
+
};
|
|
1446
|
+
MDCRippleFoundation.prototype.deregisterDeactivationHandlers = function () {
|
|
1447
|
+
var e_4, _a;
|
|
1448
|
+
this.adapter.deregisterInteractionHandler('keyup', this.deactivateHandler);
|
|
1449
|
+
try {
|
|
1450
|
+
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()) {
|
|
1451
|
+
var evtType = POINTER_DEACTIVATION_EVENT_TYPES_2_1.value;
|
|
1452
|
+
this.adapter.deregisterDocumentInteractionHandler(evtType, this.deactivateHandler);
|
|
1453
|
+
}
|
|
1454
|
+
}
|
|
1455
|
+
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
1456
|
+
finally {
|
|
1457
|
+
try {
|
|
1458
|
+
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);
|
|
1459
|
+
}
|
|
1460
|
+
finally { if (e_4) throw e_4.error; }
|
|
1461
|
+
}
|
|
1462
|
+
};
|
|
1463
|
+
MDCRippleFoundation.prototype.removeCssVars = function () {
|
|
1464
|
+
var _this = this;
|
|
1465
|
+
var rippleStrings = MDCRippleFoundation.strings;
|
|
1466
|
+
var keys = Object.keys(rippleStrings);
|
|
1467
|
+
keys.forEach(function (key) {
|
|
1468
|
+
if (key.indexOf('VAR_') === 0) {
|
|
1469
|
+
_this.adapter.updateCssVariable(rippleStrings[key], null);
|
|
1470
|
+
}
|
|
1471
|
+
});
|
|
1472
|
+
};
|
|
1473
|
+
MDCRippleFoundation.prototype.activateImpl = function (evt) {
|
|
1474
|
+
var _this = this;
|
|
1475
|
+
if (this.adapter.isSurfaceDisabled()) {
|
|
1476
|
+
return;
|
|
1477
|
+
}
|
|
1478
|
+
var activationState = this.activationState;
|
|
1479
|
+
if (activationState.isActivated) {
|
|
1480
|
+
return;
|
|
1481
|
+
}
|
|
1482
|
+
// Avoid reacting to follow-on events fired by touch device after an already-processed user interaction
|
|
1483
|
+
var previousActivationEvent = this.previousActivationEvent;
|
|
1484
|
+
var isSameInteraction = previousActivationEvent && evt !== undefined && previousActivationEvent.type !== evt.type;
|
|
1485
|
+
if (isSameInteraction) {
|
|
1486
|
+
return;
|
|
1487
|
+
}
|
|
1488
|
+
activationState.isActivated = true;
|
|
1489
|
+
activationState.isProgrammatic = evt === undefined;
|
|
1490
|
+
activationState.activationEvent = evt;
|
|
1491
|
+
activationState.wasActivatedByPointer = activationState.isProgrammatic ? false : evt !== undefined && (evt.type === 'mousedown' || evt.type === 'touchstart' || evt.type === 'pointerdown');
|
|
1492
|
+
var hasActivatedChild = evt !== undefined &&
|
|
1493
|
+
activatedTargets.length > 0 &&
|
|
1494
|
+
activatedTargets.some(function (target) { return _this.adapter.containsEventTarget(target); });
|
|
1495
|
+
if (hasActivatedChild) {
|
|
1496
|
+
// Immediately reset activation state, while preserving logic that prevents touch follow-on events
|
|
1497
|
+
this.resetActivationState();
|
|
1498
|
+
return;
|
|
1499
|
+
}
|
|
1500
|
+
if (evt !== undefined) {
|
|
1501
|
+
activatedTargets.push(evt.target);
|
|
1502
|
+
this.registerDeactivationHandlers(evt);
|
|
1503
|
+
}
|
|
1504
|
+
activationState.wasElementMadeActive = this.checkElementMadeActive(evt);
|
|
1505
|
+
if (activationState.wasElementMadeActive) {
|
|
1506
|
+
this.animateActivation();
|
|
1507
|
+
}
|
|
1508
|
+
requestAnimationFrame(function () {
|
|
1509
|
+
// Reset array on next frame after the current event has had a chance to bubble to prevent ancestor ripples
|
|
1510
|
+
activatedTargets = [];
|
|
1511
|
+
if (!activationState.wasElementMadeActive
|
|
1512
|
+
&& evt !== undefined
|
|
1513
|
+
&& (evt.key === ' ' || evt.keyCode === 32)) {
|
|
1514
|
+
// If space was pressed, try again within an rAF call to detect :active, because different UAs report
|
|
1515
|
+
// active states inconsistently when they're called within event handling code:
|
|
1516
|
+
// - https://bugs.chromium.org/p/chromium/issues/detail?id=635971
|
|
1517
|
+
// - https://bugzilla.mozilla.org/show_bug.cgi?id=1293741
|
|
1518
|
+
// We try first outside rAF to support Edge, which does not exhibit this problem, but will crash if a CSS
|
|
1519
|
+
// variable is set within a rAF callback for a submit button interaction (#2241).
|
|
1520
|
+
activationState.wasElementMadeActive = _this.checkElementMadeActive(evt);
|
|
1521
|
+
if (activationState.wasElementMadeActive) {
|
|
1522
|
+
_this.animateActivation();
|
|
1523
|
+
}
|
|
1524
|
+
}
|
|
1525
|
+
if (!activationState.wasElementMadeActive) {
|
|
1526
|
+
// Reset activation state immediately if element was not made active.
|
|
1527
|
+
_this.activationState = _this.defaultActivationState();
|
|
1528
|
+
}
|
|
1529
|
+
});
|
|
1530
|
+
};
|
|
1531
|
+
MDCRippleFoundation.prototype.checkElementMadeActive = function (evt) {
|
|
1532
|
+
return (evt !== undefined && evt.type === 'keydown') ?
|
|
1533
|
+
this.adapter.isSurfaceActive() :
|
|
1534
|
+
true;
|
|
1535
|
+
};
|
|
1536
|
+
MDCRippleFoundation.prototype.animateActivation = function () {
|
|
1537
|
+
var _this = this;
|
|
1538
|
+
var _a = MDCRippleFoundation.strings, VAR_FG_TRANSLATE_START = _a.VAR_FG_TRANSLATE_START, VAR_FG_TRANSLATE_END = _a.VAR_FG_TRANSLATE_END;
|
|
1539
|
+
var _b = MDCRippleFoundation.cssClasses, FG_DEACTIVATION = _b.FG_DEACTIVATION, FG_ACTIVATION = _b.FG_ACTIVATION;
|
|
1540
|
+
var DEACTIVATION_TIMEOUT_MS = MDCRippleFoundation.numbers.DEACTIVATION_TIMEOUT_MS;
|
|
1541
|
+
this.layoutInternal();
|
|
1542
|
+
var translateStart = '';
|
|
1543
|
+
var translateEnd = '';
|
|
1544
|
+
if (!this.adapter.isUnbounded()) {
|
|
1545
|
+
var _c = this.getFgTranslationCoordinates(), startPoint = _c.startPoint, endPoint = _c.endPoint;
|
|
1546
|
+
translateStart = startPoint.x + "px, " + startPoint.y + "px";
|
|
1547
|
+
translateEnd = endPoint.x + "px, " + endPoint.y + "px";
|
|
1548
|
+
}
|
|
1549
|
+
this.adapter.updateCssVariable(VAR_FG_TRANSLATE_START, translateStart);
|
|
1550
|
+
this.adapter.updateCssVariable(VAR_FG_TRANSLATE_END, translateEnd);
|
|
1551
|
+
// Cancel any ongoing activation/deactivation animations
|
|
1552
|
+
clearTimeout(this.activationTimer);
|
|
1553
|
+
clearTimeout(this.fgDeactivationRemovalTimer);
|
|
1554
|
+
this.rmBoundedActivationClasses();
|
|
1555
|
+
this.adapter.removeClass(FG_DEACTIVATION);
|
|
1556
|
+
// Force layout in order to re-trigger the animation.
|
|
1557
|
+
this.adapter.computeBoundingRect();
|
|
1558
|
+
this.adapter.addClass(FG_ACTIVATION);
|
|
1559
|
+
this.activationTimer = setTimeout(function () {
|
|
1560
|
+
_this.activationTimerCallback();
|
|
1561
|
+
}, DEACTIVATION_TIMEOUT_MS);
|
|
1562
|
+
};
|
|
1563
|
+
MDCRippleFoundation.prototype.getFgTranslationCoordinates = function () {
|
|
1564
|
+
var _a = this.activationState, activationEvent = _a.activationEvent, wasActivatedByPointer = _a.wasActivatedByPointer;
|
|
1565
|
+
var startPoint;
|
|
1566
|
+
if (wasActivatedByPointer) {
|
|
1567
|
+
startPoint = getNormalizedEventCoords(activationEvent, this.adapter.getWindowPageOffset(), this.adapter.computeBoundingRect());
|
|
1568
|
+
}
|
|
1569
|
+
else {
|
|
1570
|
+
startPoint = {
|
|
1571
|
+
x: this.frame.width / 2,
|
|
1572
|
+
y: this.frame.height / 2,
|
|
1573
|
+
};
|
|
1574
|
+
}
|
|
1575
|
+
// Center the element around the start point.
|
|
1576
|
+
startPoint = {
|
|
1577
|
+
x: startPoint.x - (this.initialSize / 2),
|
|
1578
|
+
y: startPoint.y - (this.initialSize / 2),
|
|
1579
|
+
};
|
|
1580
|
+
var endPoint = {
|
|
1581
|
+
x: (this.frame.width / 2) - (this.initialSize / 2),
|
|
1582
|
+
y: (this.frame.height / 2) - (this.initialSize / 2),
|
|
1583
|
+
};
|
|
1584
|
+
return { startPoint: startPoint, endPoint: endPoint };
|
|
1585
|
+
};
|
|
1586
|
+
MDCRippleFoundation.prototype.runDeactivationUXLogicIfReady = function () {
|
|
1587
|
+
var _this = this;
|
|
1588
|
+
// This method is called both when a pointing device is released, and when the activation animation ends.
|
|
1589
|
+
// The deactivation animation should only run after both of those occur.
|
|
1590
|
+
var FG_DEACTIVATION = MDCRippleFoundation.cssClasses.FG_DEACTIVATION;
|
|
1591
|
+
var _a = this.activationState, hasDeactivationUXRun = _a.hasDeactivationUXRun, isActivated = _a.isActivated;
|
|
1592
|
+
var activationHasEnded = hasDeactivationUXRun || !isActivated;
|
|
1593
|
+
if (activationHasEnded && this.activationAnimationHasEnded) {
|
|
1594
|
+
this.rmBoundedActivationClasses();
|
|
1595
|
+
this.adapter.addClass(FG_DEACTIVATION);
|
|
1596
|
+
this.fgDeactivationRemovalTimer = setTimeout(function () {
|
|
1597
|
+
_this.adapter.removeClass(FG_DEACTIVATION);
|
|
1598
|
+
}, numbers.FG_DEACTIVATION_MS);
|
|
1599
|
+
}
|
|
1600
|
+
};
|
|
1601
|
+
MDCRippleFoundation.prototype.rmBoundedActivationClasses = function () {
|
|
1602
|
+
var FG_ACTIVATION = MDCRippleFoundation.cssClasses.FG_ACTIVATION;
|
|
1603
|
+
this.adapter.removeClass(FG_ACTIVATION);
|
|
1604
|
+
this.activationAnimationHasEnded = false;
|
|
1605
|
+
this.adapter.computeBoundingRect();
|
|
1606
|
+
};
|
|
1607
|
+
MDCRippleFoundation.prototype.resetActivationState = function () {
|
|
1608
|
+
var _this = this;
|
|
1609
|
+
this.previousActivationEvent = this.activationState.activationEvent;
|
|
1610
|
+
this.activationState = this.defaultActivationState();
|
|
1611
|
+
// Touch devices may fire additional events for the same interaction within a short time.
|
|
1612
|
+
// Store the previous event until it's safe to assume that subsequent events are for new interactions.
|
|
1613
|
+
setTimeout(function () { return _this.previousActivationEvent = undefined; }, MDCRippleFoundation.numbers.TAP_DELAY_MS);
|
|
1614
|
+
};
|
|
1615
|
+
MDCRippleFoundation.prototype.deactivateImpl = function () {
|
|
1616
|
+
var _this = this;
|
|
1617
|
+
var activationState = this.activationState;
|
|
1618
|
+
// This can happen in scenarios such as when you have a keyup event that blurs the element.
|
|
1619
|
+
if (!activationState.isActivated) {
|
|
1620
|
+
return;
|
|
1621
|
+
}
|
|
1622
|
+
var state = exports.__assign({}, activationState);
|
|
1623
|
+
if (activationState.isProgrammatic) {
|
|
1624
|
+
requestAnimationFrame(function () {
|
|
1625
|
+
_this.animateDeactivation(state);
|
|
1626
|
+
});
|
|
1627
|
+
this.resetActivationState();
|
|
1628
|
+
}
|
|
1629
|
+
else {
|
|
1630
|
+
this.deregisterDeactivationHandlers();
|
|
1631
|
+
requestAnimationFrame(function () {
|
|
1632
|
+
_this.activationState.hasDeactivationUXRun = true;
|
|
1633
|
+
_this.animateDeactivation(state);
|
|
1634
|
+
_this.resetActivationState();
|
|
1635
|
+
});
|
|
1636
|
+
}
|
|
1637
|
+
};
|
|
1638
|
+
MDCRippleFoundation.prototype.animateDeactivation = function (_a) {
|
|
1639
|
+
var wasActivatedByPointer = _a.wasActivatedByPointer, wasElementMadeActive = _a.wasElementMadeActive;
|
|
1640
|
+
if (wasActivatedByPointer || wasElementMadeActive) {
|
|
1641
|
+
this.runDeactivationUXLogicIfReady();
|
|
1642
|
+
}
|
|
1643
|
+
};
|
|
1644
|
+
MDCRippleFoundation.prototype.layoutInternal = function () {
|
|
1645
|
+
var _this = this;
|
|
1646
|
+
this.frame = this.adapter.computeBoundingRect();
|
|
1647
|
+
var maxDim = Math.max(this.frame.height, this.frame.width);
|
|
1648
|
+
// Surface diameter is treated differently for unbounded vs. bounded ripples.
|
|
1649
|
+
// Unbounded ripple diameter is calculated smaller since the surface is expected to already be padded appropriately
|
|
1650
|
+
// to extend the hitbox, and the ripple is expected to meet the edges of the padded hitbox (which is typically
|
|
1651
|
+
// square). Bounded ripples, on the other hand, are fully expected to expand beyond the surface's longest diameter
|
|
1652
|
+
// (calculated based on the diagonal plus a constant padding), and are clipped at the surface's border via
|
|
1653
|
+
// `overflow: hidden`.
|
|
1654
|
+
var getBoundedRadius = function () {
|
|
1655
|
+
var hypotenuse = Math.sqrt(Math.pow(_this.frame.width, 2) + Math.pow(_this.frame.height, 2));
|
|
1656
|
+
return hypotenuse + MDCRippleFoundation.numbers.PADDING;
|
|
1657
|
+
};
|
|
1658
|
+
this.maxRadius = this.adapter.isUnbounded() ? maxDim : getBoundedRadius();
|
|
1659
|
+
// Ripple is sized as a fraction of the largest dimension of the surface, then scales up using a CSS scale transform
|
|
1660
|
+
var initialSize = Math.floor(maxDim * MDCRippleFoundation.numbers.INITIAL_ORIGIN_SCALE);
|
|
1661
|
+
// Unbounded ripple size should always be even number to equally center align.
|
|
1662
|
+
if (this.adapter.isUnbounded() && initialSize % 2 !== 0) {
|
|
1663
|
+
this.initialSize = initialSize - 1;
|
|
1664
|
+
}
|
|
1665
|
+
else {
|
|
1666
|
+
this.initialSize = initialSize;
|
|
1667
|
+
}
|
|
1668
|
+
this.fgScale = "" + this.maxRadius / this.initialSize;
|
|
1669
|
+
this.updateLayoutCssVars();
|
|
1670
|
+
};
|
|
1671
|
+
MDCRippleFoundation.prototype.updateLayoutCssVars = function () {
|
|
1672
|
+
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;
|
|
1673
|
+
this.adapter.updateCssVariable(VAR_FG_SIZE, this.initialSize + "px");
|
|
1674
|
+
this.adapter.updateCssVariable(VAR_FG_SCALE, this.fgScale);
|
|
1675
|
+
if (this.adapter.isUnbounded()) {
|
|
1676
|
+
this.unboundedCoords = {
|
|
1677
|
+
left: Math.round((this.frame.width / 2) - (this.initialSize / 2)),
|
|
1678
|
+
top: Math.round((this.frame.height / 2) - (this.initialSize / 2)),
|
|
1679
|
+
};
|
|
1680
|
+
this.adapter.updateCssVariable(VAR_LEFT, this.unboundedCoords.left + "px");
|
|
1681
|
+
this.adapter.updateCssVariable(VAR_TOP, this.unboundedCoords.top + "px");
|
|
1682
|
+
}
|
|
1683
|
+
};
|
|
1684
|
+
return MDCRippleFoundation;
|
|
1685
|
+
}(MDCFoundation));
|
|
1686
|
+
|
|
1687
|
+
/**
|
|
1688
|
+
* @license
|
|
1689
|
+
* Copyright 2016 Google Inc.
|
|
1690
|
+
*
|
|
1691
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
1692
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
1693
|
+
* in the Software without restriction, including without limitation the rights
|
|
1694
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
1695
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
1696
|
+
* furnished to do so, subject to the following conditions:
|
|
1697
|
+
*
|
|
1698
|
+
* The above copyright notice and this permission notice shall be included in
|
|
1699
|
+
* all copies or substantial portions of the Software.
|
|
1700
|
+
*
|
|
1701
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
1702
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
1703
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
1704
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
1705
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
1706
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
1707
|
+
* THE SOFTWARE.
|
|
1708
|
+
*/
|
|
1709
|
+
var MDCRipple = /** @class */ (function (_super) {
|
|
1710
|
+
__extends(MDCRipple, _super);
|
|
1711
|
+
function MDCRipple() {
|
|
1712
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
1713
|
+
_this.disabled = false;
|
|
1714
|
+
return _this;
|
|
1715
|
+
}
|
|
1716
|
+
MDCRipple.attachTo = function (root, opts) {
|
|
1717
|
+
if (opts === void 0) { opts = {
|
|
1718
|
+
isUnbounded: undefined
|
|
1719
|
+
}; }
|
|
1720
|
+
var ripple = new MDCRipple(root);
|
|
1721
|
+
// Only override unbounded behavior if option is explicitly specified
|
|
1722
|
+
if (opts.isUnbounded !== undefined) {
|
|
1723
|
+
ripple.unbounded = opts.isUnbounded;
|
|
1724
|
+
}
|
|
1725
|
+
return ripple;
|
|
1726
|
+
};
|
|
1727
|
+
MDCRipple.createAdapter = function (instance) {
|
|
1728
|
+
return {
|
|
1729
|
+
addClass: function (className) { return instance.root.classList.add(className); },
|
|
1730
|
+
browserSupportsCssVars: function () { return supportsCssVariables(window); },
|
|
1731
|
+
computeBoundingRect: function () { return instance.root.getBoundingClientRect(); },
|
|
1732
|
+
containsEventTarget: function (target) { return instance.root.contains(target); },
|
|
1733
|
+
deregisterDocumentInteractionHandler: function (evtType, handler) {
|
|
1734
|
+
return document.documentElement.removeEventListener(evtType, handler, applyPassive());
|
|
1735
|
+
},
|
|
1736
|
+
deregisterInteractionHandler: function (evtType, handler) {
|
|
1737
|
+
return instance.root
|
|
1738
|
+
.removeEventListener(evtType, handler, applyPassive());
|
|
1739
|
+
},
|
|
1740
|
+
deregisterResizeHandler: function (handler) {
|
|
1741
|
+
return window.removeEventListener('resize', handler);
|
|
1742
|
+
},
|
|
1743
|
+
getWindowPageOffset: function () {
|
|
1744
|
+
return ({ x: window.pageXOffset, y: window.pageYOffset });
|
|
1745
|
+
},
|
|
1746
|
+
isSurfaceActive: function () { return matches(instance.root, ':active'); },
|
|
1747
|
+
isSurfaceDisabled: function () { return Boolean(instance.disabled); },
|
|
1748
|
+
isUnbounded: function () { return Boolean(instance.unbounded); },
|
|
1749
|
+
registerDocumentInteractionHandler: function (evtType, handler) {
|
|
1750
|
+
return document.documentElement.addEventListener(evtType, handler, applyPassive());
|
|
1751
|
+
},
|
|
1752
|
+
registerInteractionHandler: function (evtType, handler) {
|
|
1753
|
+
return instance.root
|
|
1754
|
+
.addEventListener(evtType, handler, applyPassive());
|
|
1755
|
+
},
|
|
1756
|
+
registerResizeHandler: function (handler) {
|
|
1757
|
+
return window.addEventListener('resize', handler);
|
|
1758
|
+
},
|
|
1759
|
+
removeClass: function (className) { return instance.root.classList.remove(className); },
|
|
1760
|
+
updateCssVariable: function (varName, value) {
|
|
1761
|
+
return instance.root.style.setProperty(varName, value);
|
|
1762
|
+
},
|
|
1763
|
+
};
|
|
1764
|
+
};
|
|
1765
|
+
Object.defineProperty(MDCRipple.prototype, "unbounded", {
|
|
1766
|
+
get: function () {
|
|
1767
|
+
return Boolean(this.isUnbounded);
|
|
1768
|
+
},
|
|
1769
|
+
set: function (unbounded) {
|
|
1770
|
+
this.isUnbounded = Boolean(unbounded);
|
|
1771
|
+
this.setUnbounded();
|
|
1772
|
+
},
|
|
1773
|
+
enumerable: false,
|
|
1774
|
+
configurable: true
|
|
1775
|
+
});
|
|
1776
|
+
MDCRipple.prototype.activate = function () {
|
|
1777
|
+
this.foundation.activate();
|
|
1778
|
+
};
|
|
1779
|
+
MDCRipple.prototype.deactivate = function () {
|
|
1780
|
+
this.foundation.deactivate();
|
|
1781
|
+
};
|
|
1782
|
+
MDCRipple.prototype.layout = function () {
|
|
1783
|
+
this.foundation.layout();
|
|
1784
|
+
};
|
|
1785
|
+
MDCRipple.prototype.getDefaultFoundation = function () {
|
|
1786
|
+
return new MDCRippleFoundation(MDCRipple.createAdapter(this));
|
|
1787
|
+
};
|
|
1788
|
+
MDCRipple.prototype.initialSyncWithDOM = function () {
|
|
1789
|
+
var root = this.root;
|
|
1790
|
+
this.isUnbounded = 'mdcRippleIsUnbounded' in root.dataset;
|
|
1791
|
+
};
|
|
1792
|
+
/**
|
|
1793
|
+
* Closure Compiler throws an access control error when directly accessing a
|
|
1794
|
+
* protected or private property inside a getter/setter, like unbounded above.
|
|
1795
|
+
* By accessing the protected property inside a method, we solve that problem.
|
|
1796
|
+
* That's why this function exists.
|
|
1797
|
+
*/
|
|
1798
|
+
MDCRipple.prototype.setUnbounded = function () {
|
|
1799
|
+
this.foundation.setUnbounded(Boolean(this.isUnbounded));
|
|
1800
|
+
};
|
|
1801
|
+
return MDCRipple;
|
|
1802
|
+
}(MDCComponent));
|
|
1803
|
+
|
|
1804
|
+
exports.MDCComponent = MDCComponent;
|
|
1805
|
+
exports.MDCFloatingLabel = MDCFloatingLabel;
|
|
1806
|
+
exports.MDCFoundation = MDCFoundation;
|
|
1807
|
+
exports.MDCLineRipple = MDCLineRipple;
|
|
1808
|
+
exports.MDCNotchedOutline = MDCNotchedOutline;
|
|
1809
|
+
exports.MDCRipple = MDCRipple;
|
|
1810
|
+
exports.MDCRippleFoundation = MDCRippleFoundation;
|
|
1811
|
+
exports.__extends = __extends;
|
|
1812
|
+
exports.__read = __read;
|
|
1813
|
+
exports.__spreadArray = __spreadArray;
|
|
1814
|
+
exports.__values = __values;
|
|
1815
|
+
exports.applyPassive = applyPassive;
|
|
1816
|
+
exports.closest = closest;
|
|
1817
|
+
exports.getCorrectEventName = getCorrectEventName;
|
|
1818
|
+
exports.getCorrectPropertyName = getCorrectPropertyName;
|
|
1819
|
+
exports.matches = matches;
|