@covalent/components 6.0.1 → 6.0.2
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/action-ribbon.mjs +9 -7
- package/alert.mjs +13 -11
- package/app-shell.mjs +10 -4
- package/aria-property.mjs +41 -0
- package/base-element.mjs +28 -0
- package/button.mjs +180 -13
- package/card.mjs +3 -3
- package/check-list-item.mjs +92 -14
- package/checkbox.mjs +26 -14
- package/circular-progress.mjs +144 -10
- package/class-map.mjs +62 -0
- package/code-snippet.mjs +6 -5
- package/covalent.mjs +2 -2
- package/covalent.umd.js +3339 -137
- package/dialog.mjs +750 -15
- package/directive-helpers.mjs +11 -0
- package/drawer.mjs +26 -15
- package/empty-state.mjs +4 -4
- package/event-options.mjs +14 -0
- package/form-element.mjs +50 -0
- package/foundation.mjs +152 -0
- package/foundation2.mjs +60 -0
- package/icon-button.mjs +130 -15
- package/icon-check-toggle.mjs +18 -8
- package/icon-radio-toggle.mjs +29 -18
- package/icon.mjs +19 -13
- package/if-defined.mjs +10 -0
- package/inert.esm.mjs +640 -0
- package/linear-progress.mjs +178 -15
- package/list-expansion.mjs +33 -22
- package/list-item.mjs +19 -20
- package/list.mjs +26 -13
- package/menu.mjs +32 -13
- package/mwc-checkbox-base.mjs +198 -0
- package/mwc-checkbox.css.mjs +10 -0
- package/mwc-drawer-base.mjs +335 -0
- package/mwc-icon.mjs +26 -0
- package/mwc-line-ripple-directive.mjs +653 -0
- package/mwc-list-base.mjs +840 -0
- package/mwc-list-item-base.mjs +202 -0
- package/mwc-list-item.css.mjs +17 -0
- package/mwc-menu-base.mjs +1145 -0
- package/mwc-radio-base.mjs +528 -0
- package/mwc-radio.css.mjs +10 -0
- package/mwc-slider.css.mjs +956 -0
- package/mwc-tab-base.mjs +694 -0
- package/mwc-top-app-bar-base.mjs +380 -0
- package/nav-list-item.mjs +28 -20
- package/observer.mjs +32 -0
- package/package.json +9 -2
- package/property.mjs +20 -0
- package/query-assigned-elements.mjs +615 -0
- package/query-assigned-nodes.mjs +17 -0
- package/query.mjs +25 -0
- package/radio-list-item.mjs +93 -12
- package/radio.mjs +28 -15
- package/ripple-handlers.mjs +761 -0
- package/select.mjs +1257 -15
- package/side-sheet.mjs +21 -16
- package/slider-range.mjs +438 -11
- package/slider.mjs +253 -13
- package/snackbar.mjs +456 -15
- package/src/action-ribbon/action-ribbon-base.d.ts +30 -0
- package/src/action-ribbon/action-ribbon-base.d.ts.map +1 -0
- package/src/action-ribbon/action-ribbon.d.ts +15 -0
- package/src/action-ribbon/action-ribbon.d.ts.map +1 -0
- package/src/alert/alert-base.d.ts +31 -0
- package/src/alert/alert-base.d.ts.map +1 -0
- package/src/alert/alert.d.ts +15 -0
- package/src/alert/alert.d.ts.map +1 -0
- package/src/app-shell/app-shell.d.ts +26 -0
- package/src/app-shell/app-shell.d.ts.map +1 -0
- package/src/button/button.d.ts +10 -0
- package/src/button/button.d.ts.map +1 -0
- package/src/card/card-base.d.ts +25 -0
- package/src/card/card-base.d.ts.map +1 -0
- package/src/card/card.d.ts +10 -0
- package/src/card/card.d.ts.map +1 -0
- package/src/checkbox/checkbox.d.ts +10 -0
- package/src/checkbox/checkbox.d.ts.map +1 -0
- package/src/chips/chip-base.d.ts +52 -0
- package/src/chips/chip-base.d.ts.map +1 -0
- package/src/chips/chip-set-base.d.ts +33 -0
- package/src/chips/chip-set-base.d.ts.map +1 -0
- package/src/chips/chip-set.d.ts +15 -0
- package/src/chips/chip-set.d.ts.map +1 -0
- package/src/chips/chip.d.ts +15 -0
- package/src/chips/chip.d.ts.map +1 -0
- package/src/chips/foundation.d.ts +60 -0
- package/src/chips/foundation.d.ts.map +1 -0
- package/src/circular-progress/circular-progress.d.ts +10 -0
- package/src/circular-progress/circular-progress.d.ts.map +1 -0
- package/src/code-snippet/code-snippet.d.ts +21 -0
- package/src/code-snippet/code-snippet.d.ts.map +1 -0
- package/src/dialog/dialog.d.ts +10 -0
- package/src/dialog/dialog.d.ts.map +1 -0
- package/src/drawer/drawer.d.ts +10 -0
- package/src/drawer/drawer.d.ts.map +1 -0
- package/src/empty-state/empty-state.d.ts +16 -0
- package/src/empty-state/empty-state.d.ts.map +1 -0
- package/src/formfield/formfield.d.ts +10 -0
- package/src/formfield/formfield.d.ts.map +1 -0
- package/src/icon/icon.d.ts +10 -0
- package/src/icon/icon.d.ts.map +1 -0
- package/src/icon-button/icon-button.d.ts +10 -0
- package/src/icon-button/icon-button.d.ts.map +1 -0
- package/src/icon-checkbox/icon-check-toggle.d.ts +15 -0
- package/src/icon-checkbox/icon-check-toggle.d.ts.map +1 -0
- package/src/icon-radio/icon-radio-toggle.d.ts +14 -0
- package/src/icon-radio/icon-radio-toggle.d.ts.map +1 -0
- package/src/index.d.ts +3 -0
- package/src/index.d.ts.map +1 -0
- package/src/linear-progress/linear-progress.d.ts +10 -0
- package/src/linear-progress/linear-progress.d.ts.map +1 -0
- package/src/list/check-list-item.d.ts +10 -0
- package/src/list/check-list-item.d.ts.map +1 -0
- package/src/list/list-expansion.d.ts +18 -0
- package/src/list/list-expansion.d.ts.map +1 -0
- package/src/list/list-item.d.ts +12 -0
- package/src/list/list-item.d.ts.map +1 -0
- package/src/list/list.d.ts +10 -0
- package/src/list/list.d.ts.map +1 -0
- package/src/list/nav-list-item.d.ts +12 -0
- package/src/list/nav-list-item.d.ts.map +1 -0
- package/src/list/radio-list-item.d.ts +10 -0
- package/src/list/radio-list-item.d.ts.map +1 -0
- package/src/menu/menu.d.ts +10 -0
- package/src/menu/menu.d.ts.map +1 -0
- package/src/radio/radio.d.ts +10 -0
- package/src/radio/radio.d.ts.map +1 -0
- package/src/select/select.d.ts +10 -0
- package/src/select/select.d.ts.map +1 -0
- package/src/side-sheet/side-sheet.d.ts +18 -0
- package/src/side-sheet/side-sheet.d.ts.map +1 -0
- package/src/slider/slider-range.d.ts +10 -0
- package/src/slider/slider-range.d.ts.map +1 -0
- package/src/slider/slider.d.ts +10 -0
- package/src/slider/slider.d.ts.map +1 -0
- package/src/snackbar/snackbar.d.ts +10 -0
- package/src/snackbar/snackbar.d.ts.map +1 -0
- package/src/status-header/status-header-base.d.ts +9 -0
- package/src/status-header/status-header-base.d.ts.map +1 -0
- package/src/status-header/status-header-item.d.ts +17 -0
- package/src/status-header/status-header-item.d.ts.map +1 -0
- package/src/status-header/status-header.d.ts +15 -0
- package/src/status-header/status-header.d.ts.map +1 -0
- package/src/switch/switch.d.ts +10 -0
- package/src/switch/switch.d.ts.map +1 -0
- package/src/tab/tab-bar.d.ts +10 -0
- package/src/tab/tab-bar.d.ts.map +1 -0
- package/src/tab/tab.d.ts +10 -0
- package/src/tab/tab.d.ts.map +1 -0
- package/src/text-lockup/text-lockup.d.ts +17 -0
- package/src/text-lockup/text-lockup.d.ts.map +1 -0
- package/src/textarea/textarea.d.ts +10 -0
- package/src/textarea/textarea.d.ts.map +1 -0
- package/src/textfield/textfield.d.ts +10 -0
- package/src/textfield/textfield.d.ts.map +1 -0
- package/src/toolbar/toolbar.d.ts +10 -0
- package/src/toolbar/toolbar.d.ts.map +1 -0
- package/src/tooltip/tooltip.d.ts +27 -0
- package/src/tooltip/tooltip.d.ts.map +1 -0
- package/src/top-app-bar/top-app-bar-fixed.d.ts +10 -0
- package/src/top-app-bar/top-app-bar-fixed.d.ts.map +1 -0
- package/src/top-app-bar/top-app-bar.d.ts +10 -0
- package/src/top-app-bar/top-app-bar.d.ts.map +1 -0
- package/src/tree-list/tree-list-item.d.ts +16 -0
- package/src/tree-list/tree-list-item.d.ts.map +1 -0
- package/src/tree-list/tree-list.d.ts +11 -0
- package/src/tree-list/tree-list.d.ts.map +1 -0
- package/src/typography/typography.d.ts +12 -0
- package/src/typography/typography.d.ts.map +1 -0
- package/state.mjs +12 -0
- package/status-header-item.mjs +16 -16
- package/status-header.mjs +5 -5
- package/style-map.mjs +40 -0
- package/switch.mjs +531 -15
- package/tab-bar.mjs +1030 -13
- package/tab.mjs +29 -15
- package/text-lockup.mjs +8 -8
- package/textarea.mjs +111 -16
- package/textfield.mjs +34 -18
- package/textfield2.mjs +929 -2
- package/toolbar.mjs +8 -3
- package/tooltip.mjs +1153 -96
- package/top-app-bar-fixed.mjs +78 -18
- package/top-app-bar.mjs +19 -15
- package/top-app-bar2.mjs +9 -2
- package/tree-list-item.mjs +3 -3
- package/tree-list.mjs +6 -7
- package/tslib.es6.mjs +82 -0
- package/typography.mjs +8 -8
- package/utils.mjs +52 -0
@@ -0,0 +1,1145 @@
|
|
1
|
+
import { b as o, _ as U, a as B, c as q } from "./tslib.es6.mjs";
|
2
|
+
import { i as V, e as K, y as F } from "./query-assigned-elements.mjs";
|
3
|
+
import { L as Q } from "./mwc-list-base.mjs";
|
4
|
+
import { B as j } from "./base-element.mjs";
|
5
|
+
import { o as g } from "./observer.mjs";
|
6
|
+
import { a as Y, d as Z, b as J } from "./utils.mjs";
|
7
|
+
import { e as a } from "./property.mjs";
|
8
|
+
import { t as b } from "./state.mjs";
|
9
|
+
import { i as D } from "./query.mjs";
|
10
|
+
import { o as P } from "./class-map.mjs";
|
11
|
+
import { i as tt } from "./style-map.mjs";
|
12
|
+
/**
|
13
|
+
* @license
|
14
|
+
* Copyright 2021 Google LLC
|
15
|
+
* SPDX-LIcense-Identifier: Apache-2.0
|
16
|
+
*/
|
17
|
+
const et = V`@keyframes mdc-ripple-fg-radius-in{from{animation-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transform:translate(var(--mdc-ripple-fg-translate-start, 0)) scale(1)}to{transform:translate(var(--mdc-ripple-fg-translate-end, 0)) scale(var(--mdc-ripple-fg-scale, 1))}}@keyframes mdc-ripple-fg-opacity-in{from{animation-timing-function:linear;opacity:0}to{opacity:var(--mdc-ripple-fg-opacity, 0)}}@keyframes mdc-ripple-fg-opacity-out{from{animation-timing-function:linear;opacity:var(--mdc-ripple-fg-opacity, 0)}to{opacity:0}}:host{display:block}.mdc-deprecated-list{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;font-family:Roboto, sans-serif;font-family:var(--mdc-typography-subtitle1-font-family, var(--mdc-typography-font-family, Roboto, sans-serif));font-size:1rem;font-size:var(--mdc-typography-subtitle1-font-size, 1rem);line-height:1.75rem;line-height:var(--mdc-typography-subtitle1-line-height, 1.75rem);font-weight:400;font-weight:var(--mdc-typography-subtitle1-font-weight, 400);letter-spacing:0.009375em;letter-spacing:var(--mdc-typography-subtitle1-letter-spacing, 0.009375em);text-decoration:inherit;text-decoration:var(--mdc-typography-subtitle1-text-decoration, inherit);text-transform:inherit;text-transform:var(--mdc-typography-subtitle1-text-transform, inherit);line-height:1.5rem;margin:0;padding:8px 0;list-style-type:none;color:rgba(0, 0, 0, 0.87);color:var(--mdc-theme-text-primary-on-background, rgba(0, 0, 0, 0.87));padding:var(--mdc-list-vertical-padding, 8px) 0}.mdc-deprecated-list:focus{outline:none}.mdc-deprecated-list-item{height:48px}.mdc-deprecated-list--dense{padding-top:4px;padding-bottom:4px;font-size:.812rem}.mdc-deprecated-list ::slotted([divider]){height:0;margin:0;border:none;border-bottom-width:1px;border-bottom-style:solid;border-bottom-color:rgba(0, 0, 0, 0.12)}.mdc-deprecated-list ::slotted([divider][padded]){margin:0 var(--mdc-list-side-padding, 16px)}.mdc-deprecated-list ::slotted([divider][inset]){margin-left:var(--mdc-list-inset-margin, 72px);margin-right:0;width:calc( 100% - var(--mdc-list-inset-margin, 72px) )}[dir=rtl] .mdc-deprecated-list ::slotted([divider][inset]),.mdc-deprecated-list ::slotted([divider][inset][dir=rtl]){margin-left:0;margin-right:var(--mdc-list-inset-margin, 72px)}.mdc-deprecated-list ::slotted([divider][inset][padded]){width:calc( 100% - var(--mdc-list-inset-margin, 72px) - var(--mdc-list-side-padding, 16px) )}.mdc-deprecated-list--dense ::slotted([mwc-list-item]){height:40px}.mdc-deprecated-list--dense ::slotted([mwc-list]){--mdc-list-item-graphic-size: 20px}.mdc-deprecated-list--two-line.mdc-deprecated-list--dense ::slotted([mwc-list-item]),.mdc-deprecated-list--avatar-list.mdc-deprecated-list--dense ::slotted([mwc-list-item]){height:60px}.mdc-deprecated-list--avatar-list.mdc-deprecated-list--dense ::slotted([mwc-list]){--mdc-list-item-graphic-size: 36px}:host([noninteractive]){pointer-events:none;cursor:default}.mdc-deprecated-list--dense ::slotted(.mdc-deprecated-list-item__primary-text){display:block;margin-top:0;line-height:normal;margin-bottom:-20px}.mdc-deprecated-list--dense ::slotted(.mdc-deprecated-list-item__primary-text)::before{display:inline-block;width:0;height:24px;content:"";vertical-align:0}.mdc-deprecated-list--dense ::slotted(.mdc-deprecated-list-item__primary-text)::after{display:inline-block;width:0;height:20px;content:"";vertical-align:-20px}`;
|
18
|
+
/**
|
19
|
+
* @license
|
20
|
+
* Copyright 2020 Google LLC
|
21
|
+
* SPDX-License-Identifier: Apache-2.0
|
22
|
+
*/
|
23
|
+
let k = class extends Q {
|
24
|
+
};
|
25
|
+
k.styles = [et];
|
26
|
+
k = o([
|
27
|
+
K("mwc-list")
|
28
|
+
], k);
|
29
|
+
/**
|
30
|
+
* @license
|
31
|
+
* Copyright 2018 Google Inc.
|
32
|
+
*
|
33
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
34
|
+
* of this software and associated documentation files (the "Software"), to deal
|
35
|
+
* in the Software without restriction, including without limitation the rights
|
36
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
37
|
+
* copies of the Software, and to permit persons to whom the Software is
|
38
|
+
* furnished to do so, subject to the following conditions:
|
39
|
+
*
|
40
|
+
* The above copyright notice and this permission notice shall be included in
|
41
|
+
* all copies or substantial portions of the Software.
|
42
|
+
*
|
43
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
44
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
45
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
46
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
47
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
48
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
49
|
+
* THE SOFTWARE.
|
50
|
+
*/
|
51
|
+
var it = {
|
52
|
+
ANCHOR: "mdc-menu-surface--anchor",
|
53
|
+
ANIMATING_CLOSED: "mdc-menu-surface--animating-closed",
|
54
|
+
ANIMATING_OPEN: "mdc-menu-surface--animating-open",
|
55
|
+
FIXED: "mdc-menu-surface--fixed",
|
56
|
+
IS_OPEN_BELOW: "mdc-menu-surface--is-open-below",
|
57
|
+
OPEN: "mdc-menu-surface--open",
|
58
|
+
ROOT: "mdc-menu-surface"
|
59
|
+
}, nt = {
|
60
|
+
CLOSED_EVENT: "MDCMenuSurface:closed",
|
61
|
+
CLOSING_EVENT: "MDCMenuSurface:closing",
|
62
|
+
OPENED_EVENT: "MDCMenuSurface:opened",
|
63
|
+
OPENING_EVENT: "MDCMenuSurface:opening",
|
64
|
+
FOCUSABLE_ELEMENTS: [
|
65
|
+
"button:not(:disabled)",
|
66
|
+
'[href]:not([aria-disabled="true"])',
|
67
|
+
"input:not(:disabled)",
|
68
|
+
"select:not(:disabled)",
|
69
|
+
"textarea:not(:disabled)",
|
70
|
+
'[tabindex]:not([tabindex="-1"]):not([aria-disabled="true"])'
|
71
|
+
].join(", ")
|
72
|
+
}, M = {
|
73
|
+
/** Total duration of menu-surface open animation. */
|
74
|
+
TRANSITION_OPEN_DURATION: 120,
|
75
|
+
/** Total duration of menu-surface close animation. */
|
76
|
+
TRANSITION_CLOSE_DURATION: 75,
|
77
|
+
/**
|
78
|
+
* Margin left to the edge of the viewport when menu-surface is at maximum
|
79
|
+
* possible height. Also used as a viewport margin.
|
80
|
+
*/
|
81
|
+
MARGIN_TO_EDGE: 32,
|
82
|
+
/**
|
83
|
+
* Ratio of anchor width to menu-surface width for switching from corner
|
84
|
+
* positioning to center positioning.
|
85
|
+
*/
|
86
|
+
ANCHOR_TO_MENU_SURFACE_WIDTH_RATIO: 0.67,
|
87
|
+
/**
|
88
|
+
* Amount of time to wait before restoring focus when closing the menu
|
89
|
+
* surface. This is important because if a touch event triggered the menu
|
90
|
+
* close, and the subsequent mouse event occurs after focus is restored, then
|
91
|
+
* the restored focus would be lost.
|
92
|
+
*/
|
93
|
+
TOUCH_EVENT_WAIT_MS: 30
|
94
|
+
}, c;
|
95
|
+
(function(n) {
|
96
|
+
n[n.BOTTOM = 1] = "BOTTOM", n[n.CENTER = 2] = "CENTER", n[n.RIGHT = 4] = "RIGHT", n[n.FLIP_RTL = 8] = "FLIP_RTL";
|
97
|
+
})(c || (c = {}));
|
98
|
+
var m;
|
99
|
+
(function(n) {
|
100
|
+
n[n.TOP_LEFT = 0] = "TOP_LEFT", n[n.TOP_RIGHT = 4] = "TOP_RIGHT", n[n.BOTTOM_LEFT = 1] = "BOTTOM_LEFT", n[n.BOTTOM_RIGHT = 5] = "BOTTOM_RIGHT", n[n.TOP_START = 8] = "TOP_START", n[n.TOP_END = 12] = "TOP_END", n[n.BOTTOM_START = 9] = "BOTTOM_START", n[n.BOTTOM_END = 13] = "BOTTOM_END";
|
101
|
+
})(m || (m = {}));
|
102
|
+
/**
|
103
|
+
* @license
|
104
|
+
* Copyright 2016 Google Inc.
|
105
|
+
*
|
106
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
107
|
+
* of this software and associated documentation files (the "Software"), to deal
|
108
|
+
* in the Software without restriction, including without limitation the rights
|
109
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
110
|
+
* copies of the Software, and to permit persons to whom the Software is
|
111
|
+
* furnished to do so, subject to the following conditions:
|
112
|
+
*
|
113
|
+
* The above copyright notice and this permission notice shall be included in
|
114
|
+
* all copies or substantial portions of the Software.
|
115
|
+
*
|
116
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
117
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
118
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
119
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
120
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
121
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
122
|
+
* THE SOFTWARE.
|
123
|
+
*/
|
124
|
+
var W = (
|
125
|
+
/** @class */
|
126
|
+
function() {
|
127
|
+
function n(e) {
|
128
|
+
e === void 0 && (e = {}), this.adapter = e;
|
129
|
+
}
|
130
|
+
return Object.defineProperty(n, "cssClasses", {
|
131
|
+
get: function() {
|
132
|
+
return {};
|
133
|
+
},
|
134
|
+
enumerable: !1,
|
135
|
+
configurable: !0
|
136
|
+
}), Object.defineProperty(n, "strings", {
|
137
|
+
get: function() {
|
138
|
+
return {};
|
139
|
+
},
|
140
|
+
enumerable: !1,
|
141
|
+
configurable: !0
|
142
|
+
}), Object.defineProperty(n, "numbers", {
|
143
|
+
get: function() {
|
144
|
+
return {};
|
145
|
+
},
|
146
|
+
enumerable: !1,
|
147
|
+
configurable: !0
|
148
|
+
}), Object.defineProperty(n, "defaultAdapter", {
|
149
|
+
get: function() {
|
150
|
+
return {};
|
151
|
+
},
|
152
|
+
enumerable: !1,
|
153
|
+
configurable: !0
|
154
|
+
}), n.prototype.init = function() {
|
155
|
+
}, n.prototype.destroy = function() {
|
156
|
+
}, n;
|
157
|
+
}()
|
158
|
+
);
|
159
|
+
/**
|
160
|
+
* @license
|
161
|
+
* Copyright 2018 Google Inc.
|
162
|
+
*
|
163
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
164
|
+
* of this software and associated documentation files (the "Software"), to deal
|
165
|
+
* in the Software without restriction, including without limitation the rights
|
166
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
167
|
+
* copies of the Software, and to permit persons to whom the Software is
|
168
|
+
* furnished to do so, subject to the following conditions:
|
169
|
+
*
|
170
|
+
* The above copyright notice and this permission notice shall be included in
|
171
|
+
* all copies or substantial portions of the Software.
|
172
|
+
*
|
173
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
174
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
175
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
176
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
177
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
178
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
179
|
+
* THE SOFTWARE.
|
180
|
+
*/
|
181
|
+
var X = (
|
182
|
+
/** @class */
|
183
|
+
function(n) {
|
184
|
+
U(e, n);
|
185
|
+
function e(t) {
|
186
|
+
var i = n.call(this, B(B({}, e.defaultAdapter), t)) || this;
|
187
|
+
return i.isSurfaceOpen = !1, i.isQuickOpen = !1, i.isHoistedElement = !1, i.isFixedPosition = !1, i.isHorizontallyCenteredOnViewport = !1, i.maxHeight = 0, i.openBottomBias = 0, i.openAnimationEndTimerId = 0, i.closeAnimationEndTimerId = 0, i.animationRequestId = 0, i.anchorCorner = m.TOP_START, i.originCorner = m.TOP_START, i.anchorMargin = { top: 0, right: 0, bottom: 0, left: 0 }, i.position = { x: 0, y: 0 }, i;
|
188
|
+
}
|
189
|
+
return Object.defineProperty(e, "cssClasses", {
|
190
|
+
get: function() {
|
191
|
+
return it;
|
192
|
+
},
|
193
|
+
enumerable: !1,
|
194
|
+
configurable: !0
|
195
|
+
}), Object.defineProperty(e, "strings", {
|
196
|
+
get: function() {
|
197
|
+
return nt;
|
198
|
+
},
|
199
|
+
enumerable: !1,
|
200
|
+
configurable: !0
|
201
|
+
}), Object.defineProperty(e, "numbers", {
|
202
|
+
get: function() {
|
203
|
+
return M;
|
204
|
+
},
|
205
|
+
enumerable: !1,
|
206
|
+
configurable: !0
|
207
|
+
}), Object.defineProperty(e, "Corner", {
|
208
|
+
get: function() {
|
209
|
+
return m;
|
210
|
+
},
|
211
|
+
enumerable: !1,
|
212
|
+
configurable: !0
|
213
|
+
}), Object.defineProperty(e, "defaultAdapter", {
|
214
|
+
/**
|
215
|
+
* @see {@link MDCMenuSurfaceAdapter} for typing information on parameters and return types.
|
216
|
+
*/
|
217
|
+
get: function() {
|
218
|
+
return {
|
219
|
+
addClass: function() {
|
220
|
+
},
|
221
|
+
removeClass: function() {
|
222
|
+
},
|
223
|
+
hasClass: function() {
|
224
|
+
return !1;
|
225
|
+
},
|
226
|
+
hasAnchor: function() {
|
227
|
+
return !1;
|
228
|
+
},
|
229
|
+
isElementInContainer: function() {
|
230
|
+
return !1;
|
231
|
+
},
|
232
|
+
isFocused: function() {
|
233
|
+
return !1;
|
234
|
+
},
|
235
|
+
isRtl: function() {
|
236
|
+
return !1;
|
237
|
+
},
|
238
|
+
getInnerDimensions: function() {
|
239
|
+
return { height: 0, width: 0 };
|
240
|
+
},
|
241
|
+
getAnchorDimensions: function() {
|
242
|
+
return null;
|
243
|
+
},
|
244
|
+
getWindowDimensions: function() {
|
245
|
+
return { height: 0, width: 0 };
|
246
|
+
},
|
247
|
+
getBodyDimensions: function() {
|
248
|
+
return { height: 0, width: 0 };
|
249
|
+
},
|
250
|
+
getWindowScroll: function() {
|
251
|
+
return { x: 0, y: 0 };
|
252
|
+
},
|
253
|
+
setPosition: function() {
|
254
|
+
},
|
255
|
+
setMaxHeight: function() {
|
256
|
+
},
|
257
|
+
setTransformOrigin: function() {
|
258
|
+
},
|
259
|
+
saveFocus: function() {
|
260
|
+
},
|
261
|
+
restoreFocus: function() {
|
262
|
+
},
|
263
|
+
notifyClose: function() {
|
264
|
+
},
|
265
|
+
notifyClosing: function() {
|
266
|
+
},
|
267
|
+
notifyOpen: function() {
|
268
|
+
},
|
269
|
+
notifyOpening: function() {
|
270
|
+
}
|
271
|
+
};
|
272
|
+
},
|
273
|
+
enumerable: !1,
|
274
|
+
configurable: !0
|
275
|
+
}), e.prototype.init = function() {
|
276
|
+
var t = e.cssClasses, i = t.ROOT, s = t.OPEN;
|
277
|
+
if (!this.adapter.hasClass(i))
|
278
|
+
throw new Error(i + " class required in root element.");
|
279
|
+
this.adapter.hasClass(s) && (this.isSurfaceOpen = !0);
|
280
|
+
}, e.prototype.destroy = function() {
|
281
|
+
clearTimeout(this.openAnimationEndTimerId), clearTimeout(this.closeAnimationEndTimerId), cancelAnimationFrame(this.animationRequestId);
|
282
|
+
}, e.prototype.setAnchorCorner = function(t) {
|
283
|
+
this.anchorCorner = t;
|
284
|
+
}, e.prototype.flipCornerHorizontally = function() {
|
285
|
+
this.originCorner = this.originCorner ^ c.RIGHT;
|
286
|
+
}, e.prototype.setAnchorMargin = function(t) {
|
287
|
+
this.anchorMargin.top = t.top || 0, this.anchorMargin.right = t.right || 0, this.anchorMargin.bottom = t.bottom || 0, this.anchorMargin.left = t.left || 0;
|
288
|
+
}, e.prototype.setIsHoisted = function(t) {
|
289
|
+
this.isHoistedElement = t;
|
290
|
+
}, e.prototype.setFixedPosition = function(t) {
|
291
|
+
this.isFixedPosition = t;
|
292
|
+
}, e.prototype.isFixed = function() {
|
293
|
+
return this.isFixedPosition;
|
294
|
+
}, e.prototype.setAbsolutePosition = function(t, i) {
|
295
|
+
this.position.x = this.isFinite(t) ? t : 0, this.position.y = this.isFinite(i) ? i : 0;
|
296
|
+
}, e.prototype.setIsHorizontallyCenteredOnViewport = function(t) {
|
297
|
+
this.isHorizontallyCenteredOnViewport = t;
|
298
|
+
}, e.prototype.setQuickOpen = function(t) {
|
299
|
+
this.isQuickOpen = t;
|
300
|
+
}, e.prototype.setMaxHeight = function(t) {
|
301
|
+
this.maxHeight = t;
|
302
|
+
}, e.prototype.setOpenBottomBias = function(t) {
|
303
|
+
this.openBottomBias = t;
|
304
|
+
}, e.prototype.isOpen = function() {
|
305
|
+
return this.isSurfaceOpen;
|
306
|
+
}, e.prototype.open = function() {
|
307
|
+
var t = this;
|
308
|
+
this.isSurfaceOpen || (this.adapter.notifyOpening(), this.adapter.saveFocus(), this.isQuickOpen ? (this.isSurfaceOpen = !0, this.adapter.addClass(e.cssClasses.OPEN), this.dimensions = this.adapter.getInnerDimensions(), this.autoposition(), this.adapter.notifyOpen()) : (this.adapter.addClass(e.cssClasses.ANIMATING_OPEN), this.animationRequestId = requestAnimationFrame(function() {
|
309
|
+
t.dimensions = t.adapter.getInnerDimensions(), t.autoposition(), t.adapter.addClass(e.cssClasses.OPEN), t.openAnimationEndTimerId = setTimeout(function() {
|
310
|
+
t.openAnimationEndTimerId = 0, t.adapter.removeClass(e.cssClasses.ANIMATING_OPEN), t.adapter.notifyOpen();
|
311
|
+
}, M.TRANSITION_OPEN_DURATION);
|
312
|
+
}), this.isSurfaceOpen = !0));
|
313
|
+
}, e.prototype.close = function(t) {
|
314
|
+
var i = this;
|
315
|
+
if (t === void 0 && (t = !1), !!this.isSurfaceOpen) {
|
316
|
+
if (this.adapter.notifyClosing(), this.isQuickOpen) {
|
317
|
+
this.isSurfaceOpen = !1, t || this.maybeRestoreFocus(), this.adapter.removeClass(e.cssClasses.OPEN), this.adapter.removeClass(e.cssClasses.IS_OPEN_BELOW), this.adapter.notifyClose();
|
318
|
+
return;
|
319
|
+
}
|
320
|
+
this.adapter.addClass(e.cssClasses.ANIMATING_CLOSED), requestAnimationFrame(function() {
|
321
|
+
i.adapter.removeClass(e.cssClasses.OPEN), i.adapter.removeClass(e.cssClasses.IS_OPEN_BELOW), i.closeAnimationEndTimerId = setTimeout(function() {
|
322
|
+
i.closeAnimationEndTimerId = 0, i.adapter.removeClass(e.cssClasses.ANIMATING_CLOSED), i.adapter.notifyClose();
|
323
|
+
}, M.TRANSITION_CLOSE_DURATION);
|
324
|
+
}), this.isSurfaceOpen = !1, t || this.maybeRestoreFocus();
|
325
|
+
}
|
326
|
+
}, e.prototype.handleBodyClick = function(t) {
|
327
|
+
var i = t.target;
|
328
|
+
this.adapter.isElementInContainer(i) || this.close();
|
329
|
+
}, e.prototype.handleKeydown = function(t) {
|
330
|
+
var i = t.keyCode, s = t.key, r = s === "Escape" || i === 27;
|
331
|
+
r && this.close();
|
332
|
+
}, e.prototype.autoposition = function() {
|
333
|
+
var t;
|
334
|
+
this.measurements = this.getAutoLayoutmeasurements();
|
335
|
+
var i = this.getoriginCorner(), s = this.getMenuSurfaceMaxHeight(i), r = this.hasBit(i, c.BOTTOM) ? "bottom" : "top", l = this.hasBit(i, c.RIGHT) ? "right" : "left", f = this.getHorizontalOriginOffset(i), R = this.getVerticalOriginOffset(i), I = this.measurements, _ = I.anchorSize, S = I.surfaceSize, p = (t = {}, t[l] = f, t[r] = R, t);
|
336
|
+
_.width / S.width > M.ANCHOR_TO_MENU_SURFACE_WIDTH_RATIO && (l = "center"), (this.isHoistedElement || this.isFixedPosition) && this.adjustPositionForHoistedElement(p), this.adapter.setTransformOrigin(l + " " + r), this.adapter.setPosition(p), this.adapter.setMaxHeight(s ? s + "px" : ""), this.hasBit(i, c.BOTTOM) || this.adapter.addClass(e.cssClasses.IS_OPEN_BELOW);
|
337
|
+
}, e.prototype.getAutoLayoutmeasurements = function() {
|
338
|
+
var t = this.adapter.getAnchorDimensions(), i = this.adapter.getBodyDimensions(), s = this.adapter.getWindowDimensions(), r = this.adapter.getWindowScroll();
|
339
|
+
return t || (t = {
|
340
|
+
top: this.position.y,
|
341
|
+
right: this.position.x,
|
342
|
+
bottom: this.position.y,
|
343
|
+
left: this.position.x,
|
344
|
+
width: 0,
|
345
|
+
height: 0
|
346
|
+
}), {
|
347
|
+
anchorSize: t,
|
348
|
+
bodySize: i,
|
349
|
+
surfaceSize: this.dimensions,
|
350
|
+
viewportDistance: {
|
351
|
+
// tslint:disable:object-literal-sort-keys Positional properties are more readable when they're grouped together
|
352
|
+
top: t.top,
|
353
|
+
right: s.width - t.right,
|
354
|
+
bottom: s.height - t.bottom,
|
355
|
+
left: t.left
|
356
|
+
// tslint:enable:object-literal-sort-keys
|
357
|
+
},
|
358
|
+
viewportSize: s,
|
359
|
+
windowScroll: r
|
360
|
+
};
|
361
|
+
}, e.prototype.getoriginCorner = function() {
|
362
|
+
var t = this.originCorner, i = this.measurements, s = i.viewportDistance, r = i.anchorSize, l = i.surfaceSize, f = e.numbers.MARGIN_TO_EDGE, R = this.hasBit(this.anchorCorner, c.BOTTOM), I, _;
|
363
|
+
R ? (I = s.top - f + this.anchorMargin.bottom, _ = s.bottom - f - this.anchorMargin.bottom) : (I = s.top - f + this.anchorMargin.top, _ = s.bottom - f + r.height - this.anchorMargin.top);
|
364
|
+
var S = _ - l.height > 0;
|
365
|
+
!S && I > _ + this.openBottomBias && (t = this.setBit(t, c.BOTTOM));
|
366
|
+
var p = this.adapter.isRtl(), T = this.hasBit(this.anchorCorner, c.FLIP_RTL), E = this.hasBit(this.anchorCorner, c.RIGHT) || this.hasBit(t, c.RIGHT), A = !1;
|
367
|
+
p && T ? A = !E : A = E;
|
368
|
+
var L, w;
|
369
|
+
A ? (L = s.left + r.width + this.anchorMargin.right, w = s.right - this.anchorMargin.right) : (L = s.left + this.anchorMargin.left, w = s.right + r.width - this.anchorMargin.left);
|
370
|
+
var N = L - l.width > 0, G = w - l.width > 0, $ = this.hasBit(t, c.FLIP_RTL) && this.hasBit(t, c.RIGHT);
|
371
|
+
return G && $ && p || !N && $ ? t = this.unsetBit(t, c.RIGHT) : (N && A && p || N && !A && E || !G && L >= w) && (t = this.setBit(t, c.RIGHT)), t;
|
372
|
+
}, e.prototype.getMenuSurfaceMaxHeight = function(t) {
|
373
|
+
if (this.maxHeight > 0)
|
374
|
+
return this.maxHeight;
|
375
|
+
var i = this.measurements.viewportDistance, s = 0, r = this.hasBit(t, c.BOTTOM), l = this.hasBit(this.anchorCorner, c.BOTTOM), f = e.numbers.MARGIN_TO_EDGE;
|
376
|
+
return r ? (s = i.top + this.anchorMargin.top - f, l || (s += this.measurements.anchorSize.height)) : (s = i.bottom - this.anchorMargin.bottom + this.measurements.anchorSize.height - f, l && (s -= this.measurements.anchorSize.height)), s;
|
377
|
+
}, e.prototype.getHorizontalOriginOffset = function(t) {
|
378
|
+
var i = this.measurements.anchorSize, s = this.hasBit(t, c.RIGHT), r = this.hasBit(this.anchorCorner, c.RIGHT);
|
379
|
+
if (s) {
|
380
|
+
var l = r ? i.width - this.anchorMargin.left : this.anchorMargin.right;
|
381
|
+
return this.isHoistedElement || this.isFixedPosition ? l - (this.measurements.viewportSize.width - this.measurements.bodySize.width) : l;
|
382
|
+
}
|
383
|
+
return r ? i.width - this.anchorMargin.right : this.anchorMargin.left;
|
384
|
+
}, e.prototype.getVerticalOriginOffset = function(t) {
|
385
|
+
var i = this.measurements.anchorSize, s = this.hasBit(t, c.BOTTOM), r = this.hasBit(this.anchorCorner, c.BOTTOM), l = 0;
|
386
|
+
return s ? l = r ? i.height - this.anchorMargin.top : -this.anchorMargin.bottom : l = r ? i.height + this.anchorMargin.bottom : this.anchorMargin.top, l;
|
387
|
+
}, e.prototype.adjustPositionForHoistedElement = function(t) {
|
388
|
+
var i, s, r = this.measurements, l = r.windowScroll, f = r.viewportDistance, R = r.surfaceSize, I = r.viewportSize, _ = Object.keys(t);
|
389
|
+
try {
|
390
|
+
for (var S = q(_), p = S.next(); !p.done; p = S.next()) {
|
391
|
+
var T = p.value, E = t[T] || 0;
|
392
|
+
if (this.isHorizontallyCenteredOnViewport && (T === "left" || T === "right")) {
|
393
|
+
t[T] = (I.width - R.width) / 2;
|
394
|
+
continue;
|
395
|
+
}
|
396
|
+
E += f[T], this.isFixedPosition || (T === "top" ? E += l.y : T === "bottom" ? E -= l.y : T === "left" ? E += l.x : E -= l.x), t[T] = E;
|
397
|
+
}
|
398
|
+
} catch (A) {
|
399
|
+
i = { error: A };
|
400
|
+
} finally {
|
401
|
+
try {
|
402
|
+
p && !p.done && (s = S.return) && s.call(S);
|
403
|
+
} finally {
|
404
|
+
if (i)
|
405
|
+
throw i.error;
|
406
|
+
}
|
407
|
+
}
|
408
|
+
}, e.prototype.maybeRestoreFocus = function() {
|
409
|
+
var t = this, i = this.adapter.isFocused(), s = this.adapter.getOwnerDocument ? this.adapter.getOwnerDocument() : document, r = s.activeElement && this.adapter.isElementInContainer(s.activeElement);
|
410
|
+
(i || r) && setTimeout(function() {
|
411
|
+
t.adapter.restoreFocus();
|
412
|
+
}, M.TOUCH_EVENT_WAIT_MS);
|
413
|
+
}, e.prototype.hasBit = function(t, i) {
|
414
|
+
return Boolean(t & i);
|
415
|
+
}, e.prototype.setBit = function(t, i) {
|
416
|
+
return t | i;
|
417
|
+
}, e.prototype.unsetBit = function(t, i) {
|
418
|
+
return t ^ i;
|
419
|
+
}, e.prototype.isFinite = function(t) {
|
420
|
+
return typeof t == "number" && isFinite(t);
|
421
|
+
}, e;
|
422
|
+
}(W)
|
423
|
+
);
|
424
|
+
const st = X;
|
425
|
+
/**
|
426
|
+
* @license
|
427
|
+
* Copyright 2020 Google LLC
|
428
|
+
* SPDX-License-Identifier: Apache-2.0
|
429
|
+
*/
|
430
|
+
const ot = {
|
431
|
+
TOP_LEFT: m.TOP_LEFT,
|
432
|
+
TOP_RIGHT: m.TOP_RIGHT,
|
433
|
+
BOTTOM_LEFT: m.BOTTOM_LEFT,
|
434
|
+
BOTTOM_RIGHT: m.BOTTOM_RIGHT,
|
435
|
+
TOP_START: m.TOP_START,
|
436
|
+
TOP_END: m.TOP_END,
|
437
|
+
BOTTOM_START: m.BOTTOM_START,
|
438
|
+
BOTTOM_END: m.BOTTOM_END
|
439
|
+
};
|
440
|
+
class u extends j {
|
441
|
+
constructor() {
|
442
|
+
super(...arguments), this.mdcFoundationClass = st, this.absolute = !1, this.fullwidth = !1, this.fixed = !1, this.x = null, this.y = null, this.quick = !1, this.open = !1, this.stayOpenOnBodyClick = !1, this.bitwiseCorner = m.TOP_START, this.previousMenuCorner = null, this.menuCorner = "START", this.corner = "TOP_START", this.styleTop = "", this.styleLeft = "", this.styleRight = "", this.styleBottom = "", this.styleMaxHeight = "", this.styleTransformOrigin = "", this.anchor = null, this.previouslyFocused = null, this.previousAnchor = null, this.onBodyClickBound = () => {
|
443
|
+
};
|
444
|
+
}
|
445
|
+
render() {
|
446
|
+
return this.renderSurface();
|
447
|
+
}
|
448
|
+
renderSurface() {
|
449
|
+
const e = this.getRootClasses(), t = this.getRootStyles();
|
450
|
+
return F`
|
451
|
+
<div
|
452
|
+
class=${P(e)}
|
453
|
+
style="${tt(t)}"
|
454
|
+
@keydown=${this.onKeydown}
|
455
|
+
@opened=${this.registerBodyClick}
|
456
|
+
@closed=${this.deregisterBodyClick}>
|
457
|
+
${this.renderContent()}
|
458
|
+
</div>`;
|
459
|
+
}
|
460
|
+
getRootClasses() {
|
461
|
+
return {
|
462
|
+
"mdc-menu-surface": !0,
|
463
|
+
"mdc-menu-surface--fixed": this.fixed,
|
464
|
+
"mdc-menu-surface--fullwidth": this.fullwidth
|
465
|
+
};
|
466
|
+
}
|
467
|
+
getRootStyles() {
|
468
|
+
return {
|
469
|
+
top: this.styleTop,
|
470
|
+
left: this.styleLeft,
|
471
|
+
right: this.styleRight,
|
472
|
+
bottom: this.styleBottom,
|
473
|
+
"max-height": this.styleMaxHeight,
|
474
|
+
"transform-origin": this.styleTransformOrigin
|
475
|
+
};
|
476
|
+
}
|
477
|
+
renderContent() {
|
478
|
+
return F`<slot></slot>`;
|
479
|
+
}
|
480
|
+
createAdapter() {
|
481
|
+
return Object.assign(Object.assign({}, Y(this.mdcRoot)), { hasAnchor: () => !!this.anchor, notifyClose: () => {
|
482
|
+
const e = { bubbles: !0, composed: !0 }, t = new CustomEvent("closed", e);
|
483
|
+
this.open = !1, this.mdcRoot.dispatchEvent(t);
|
484
|
+
}, notifyClosing: () => {
|
485
|
+
const e = { bubbles: !0, composed: !0 }, t = new CustomEvent("closing", e);
|
486
|
+
this.mdcRoot.dispatchEvent(t);
|
487
|
+
}, notifyOpen: () => {
|
488
|
+
const e = { bubbles: !0, composed: !0 }, t = new CustomEvent("opened", e);
|
489
|
+
this.open = !0, this.mdcRoot.dispatchEvent(t);
|
490
|
+
}, notifyOpening: () => {
|
491
|
+
const e = { bubbles: !0, composed: !0 }, t = new CustomEvent("opening", e);
|
492
|
+
this.mdcRoot.dispatchEvent(t);
|
493
|
+
}, isElementInContainer: () => !1, isRtl: () => this.mdcRoot ? getComputedStyle(this.mdcRoot).direction === "rtl" : !1, setTransformOrigin: (e) => {
|
494
|
+
this.mdcRoot && (this.styleTransformOrigin = e);
|
495
|
+
}, isFocused: () => Z(this), saveFocus: () => {
|
496
|
+
const e = J(), t = e.length;
|
497
|
+
t || (this.previouslyFocused = null), this.previouslyFocused = e[t - 1];
|
498
|
+
}, restoreFocus: () => {
|
499
|
+
this.previouslyFocused && "focus" in this.previouslyFocused && this.previouslyFocused.focus();
|
500
|
+
}, getInnerDimensions: () => {
|
501
|
+
const e = this.mdcRoot;
|
502
|
+
return e ? { width: e.offsetWidth, height: e.offsetHeight } : { width: 0, height: 0 };
|
503
|
+
}, getAnchorDimensions: () => {
|
504
|
+
const e = this.anchor;
|
505
|
+
return e ? e.getBoundingClientRect() : null;
|
506
|
+
}, getBodyDimensions: () => ({
|
507
|
+
width: document.body.clientWidth,
|
508
|
+
height: document.body.clientHeight
|
509
|
+
}), getWindowDimensions: () => ({
|
510
|
+
width: window.innerWidth,
|
511
|
+
height: window.innerHeight
|
512
|
+
}), getWindowScroll: () => ({
|
513
|
+
x: window.pageXOffset,
|
514
|
+
y: window.pageYOffset
|
515
|
+
}), setPosition: (e) => {
|
516
|
+
this.mdcRoot && (this.styleLeft = "left" in e ? `${e.left}px` : "", this.styleRight = "right" in e ? `${e.right}px` : "", this.styleTop = "top" in e ? `${e.top}px` : "", this.styleBottom = "bottom" in e ? `${e.bottom}px` : "");
|
517
|
+
}, setMaxHeight: async (e) => {
|
518
|
+
this.mdcRoot && (this.styleMaxHeight = e, await this.updateComplete, this.styleMaxHeight = `var(--mdc-menu-max-height, ${e})`);
|
519
|
+
} });
|
520
|
+
}
|
521
|
+
onKeydown(e) {
|
522
|
+
this.mdcFoundation && this.mdcFoundation.handleKeydown(e);
|
523
|
+
}
|
524
|
+
onBodyClick(e) {
|
525
|
+
if (this.stayOpenOnBodyClick)
|
526
|
+
return;
|
527
|
+
e.composedPath().indexOf(this) === -1 && this.close();
|
528
|
+
}
|
529
|
+
registerBodyClick() {
|
530
|
+
this.onBodyClickBound = this.onBodyClick.bind(this), document.body.addEventListener("click", this.onBodyClickBound, { passive: !0, capture: !0 });
|
531
|
+
}
|
532
|
+
deregisterBodyClick() {
|
533
|
+
document.body.removeEventListener("click", this.onBodyClickBound, { capture: !0 });
|
534
|
+
}
|
535
|
+
onOpenChanged(e, t) {
|
536
|
+
this.mdcFoundation && (e ? this.mdcFoundation.open() : t !== void 0 && this.mdcFoundation.close());
|
537
|
+
}
|
538
|
+
close() {
|
539
|
+
this.open = !1;
|
540
|
+
}
|
541
|
+
show() {
|
542
|
+
this.open = !0;
|
543
|
+
}
|
544
|
+
}
|
545
|
+
o([
|
546
|
+
D(".mdc-menu-surface")
|
547
|
+
], u.prototype, "mdcRoot", void 0);
|
548
|
+
o([
|
549
|
+
D("slot")
|
550
|
+
], u.prototype, "slotElement", void 0);
|
551
|
+
o([
|
552
|
+
a({ type: Boolean }),
|
553
|
+
g(function(n) {
|
554
|
+
this.mdcFoundation && !this.fixed && this.mdcFoundation.setIsHoisted(n);
|
555
|
+
})
|
556
|
+
], u.prototype, "absolute", void 0);
|
557
|
+
o([
|
558
|
+
a({ type: Boolean })
|
559
|
+
], u.prototype, "fullwidth", void 0);
|
560
|
+
o([
|
561
|
+
a({ type: Boolean }),
|
562
|
+
g(function(n) {
|
563
|
+
this.mdcFoundation && !this.absolute && this.mdcFoundation.setFixedPosition(n);
|
564
|
+
})
|
565
|
+
], u.prototype, "fixed", void 0);
|
566
|
+
o([
|
567
|
+
a({ type: Number }),
|
568
|
+
g(function(n) {
|
569
|
+
this.mdcFoundation && this.y !== null && n !== null && (this.mdcFoundation.setAbsolutePosition(n, this.y), this.mdcFoundation.setAnchorMargin({ left: n, top: this.y, right: -n, bottom: this.y }));
|
570
|
+
})
|
571
|
+
], u.prototype, "x", void 0);
|
572
|
+
o([
|
573
|
+
a({ type: Number }),
|
574
|
+
g(function(n) {
|
575
|
+
this.mdcFoundation && this.x !== null && n !== null && (this.mdcFoundation.setAbsolutePosition(this.x, n), this.mdcFoundation.setAnchorMargin({ left: this.x, top: n, right: -this.x, bottom: n }));
|
576
|
+
})
|
577
|
+
], u.prototype, "y", void 0);
|
578
|
+
o([
|
579
|
+
a({ type: Boolean }),
|
580
|
+
g(function(n) {
|
581
|
+
this.mdcFoundation && this.mdcFoundation.setQuickOpen(n);
|
582
|
+
})
|
583
|
+
], u.prototype, "quick", void 0);
|
584
|
+
o([
|
585
|
+
a({ type: Boolean, reflect: !0 }),
|
586
|
+
g(function(n, e) {
|
587
|
+
this.onOpenChanged(n, e);
|
588
|
+
})
|
589
|
+
], u.prototype, "open", void 0);
|
590
|
+
o([
|
591
|
+
a({ type: Boolean })
|
592
|
+
], u.prototype, "stayOpenOnBodyClick", void 0);
|
593
|
+
o([
|
594
|
+
b(),
|
595
|
+
g(function(n) {
|
596
|
+
this.mdcFoundation && (n ? this.mdcFoundation.setAnchorCorner(n) : this.mdcFoundation.setAnchorCorner(n));
|
597
|
+
})
|
598
|
+
], u.prototype, "bitwiseCorner", void 0);
|
599
|
+
o([
|
600
|
+
a({ type: String }),
|
601
|
+
g(function(n) {
|
602
|
+
if (this.mdcFoundation) {
|
603
|
+
const e = n === "START" || n === "END", t = this.previousMenuCorner === null, i = !t && n !== this.previousMenuCorner;
|
604
|
+
e && (i || t && n === "END") && (this.bitwiseCorner = this.bitwiseCorner ^ c.RIGHT, this.mdcFoundation.flipCornerHorizontally(), this.previousMenuCorner = n);
|
605
|
+
}
|
606
|
+
})
|
607
|
+
], u.prototype, "menuCorner", void 0);
|
608
|
+
o([
|
609
|
+
a({ type: String }),
|
610
|
+
g(function(n) {
|
611
|
+
if (this.mdcFoundation && n) {
|
612
|
+
let e = ot[n];
|
613
|
+
this.menuCorner === "END" && (e = e ^ c.RIGHT), this.bitwiseCorner = e;
|
614
|
+
}
|
615
|
+
})
|
616
|
+
], u.prototype, "corner", void 0);
|
617
|
+
o([
|
618
|
+
b()
|
619
|
+
], u.prototype, "styleTop", void 0);
|
620
|
+
o([
|
621
|
+
b()
|
622
|
+
], u.prototype, "styleLeft", void 0);
|
623
|
+
o([
|
624
|
+
b()
|
625
|
+
], u.prototype, "styleRight", void 0);
|
626
|
+
o([
|
627
|
+
b()
|
628
|
+
], u.prototype, "styleBottom", void 0);
|
629
|
+
o([
|
630
|
+
b()
|
631
|
+
], u.prototype, "styleMaxHeight", void 0);
|
632
|
+
o([
|
633
|
+
b()
|
634
|
+
], u.prototype, "styleTransformOrigin", void 0);
|
635
|
+
/**
|
636
|
+
* @license
|
637
|
+
* Copyright 2021 Google LLC
|
638
|
+
* SPDX-LIcense-Identifier: Apache-2.0
|
639
|
+
*/
|
640
|
+
const rt = V`.mdc-menu-surface{display:none;position:absolute;box-sizing:border-box;max-width:calc(100vw - 32px);max-width:var(--mdc-menu-max-width, calc(100vw - 32px));max-height:calc(100vh - 32px);max-height:var(--mdc-menu-max-height, calc(100vh - 32px));margin:0;padding:0;transform:scale(1);transform-origin:top left;opacity:0;overflow:auto;will-change:transform,opacity;z-index:8;transition:opacity .03s linear,transform .12s cubic-bezier(0, 0, 0.2, 1),height 250ms cubic-bezier(0, 0, 0.2, 1);box-shadow:0px 5px 5px -3px rgba(0, 0, 0, 0.2),0px 8px 10px 1px rgba(0, 0, 0, 0.14),0px 3px 14px 2px rgba(0,0,0,.12);background-color:#fff;background-color:var(--mdc-theme-surface, #fff);color:#000;color:var(--mdc-theme-on-surface, #000);border-radius:4px;border-radius:var(--mdc-shape-medium, 4px);transform-origin-left:top left;transform-origin-right:top right}.mdc-menu-surface:focus{outline:none}.mdc-menu-surface--animating-open{display:inline-block;transform:scale(0.8);opacity:0}.mdc-menu-surface--open{display:inline-block;transform:scale(1);opacity:1}.mdc-menu-surface--animating-closed{display:inline-block;opacity:0;transition:opacity .075s linear}[dir=rtl] .mdc-menu-surface,.mdc-menu-surface[dir=rtl]{transform-origin-left:top right;transform-origin-right:top left}.mdc-menu-surface--anchor{position:relative;overflow:visible}.mdc-menu-surface--fixed{position:fixed}.mdc-menu-surface--fullwidth{width:100%}:host(:not([open])){display:none}.mdc-menu-surface{z-index:8;z-index:var(--mdc-menu-z-index, 8);min-width:112px;min-width:var(--mdc-menu-min-width, 112px)}`;
|
641
|
+
/**
|
642
|
+
* @license
|
643
|
+
* Copyright 2020 Google LLC
|
644
|
+
* SPDX-License-Identifier: Apache-2.0
|
645
|
+
*/
|
646
|
+
let z = class extends u {
|
647
|
+
};
|
648
|
+
z.styles = [rt];
|
649
|
+
z = o([
|
650
|
+
K("mwc-menu-surface")
|
651
|
+
], z);
|
652
|
+
/**
|
653
|
+
* @license
|
654
|
+
* Copyright 2018 Google Inc.
|
655
|
+
*
|
656
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
657
|
+
* of this software and associated documentation files (the "Software"), to deal
|
658
|
+
* in the Software without restriction, including without limitation the rights
|
659
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
660
|
+
* copies of the Software, and to permit persons to whom the Software is
|
661
|
+
* furnished to do so, subject to the following conditions:
|
662
|
+
*
|
663
|
+
* The above copyright notice and this permission notice shall be included in
|
664
|
+
* all copies or substantial portions of the Software.
|
665
|
+
*
|
666
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
667
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
668
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
669
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
670
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
671
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
672
|
+
* THE SOFTWARE.
|
673
|
+
*/
|
674
|
+
var H = {
|
675
|
+
MENU_SELECTED_LIST_ITEM: "mdc-menu-item--selected",
|
676
|
+
MENU_SELECTION_GROUP: "mdc-menu__selection-group",
|
677
|
+
ROOT: "mdc-menu"
|
678
|
+
}, v = {
|
679
|
+
ARIA_CHECKED_ATTR: "aria-checked",
|
680
|
+
ARIA_DISABLED_ATTR: "aria-disabled",
|
681
|
+
CHECKBOX_SELECTOR: 'input[type="checkbox"]',
|
682
|
+
LIST_SELECTOR: ".mdc-list,.mdc-deprecated-list",
|
683
|
+
SELECTED_EVENT: "MDCMenu:selected",
|
684
|
+
SKIP_RESTORE_FOCUS: "data-menu-item-skip-restore-focus"
|
685
|
+
}, at = {
|
686
|
+
FOCUS_ROOT_INDEX: -1
|
687
|
+
}, C;
|
688
|
+
(function(n) {
|
689
|
+
n[n.NONE = 0] = "NONE", n[n.LIST_ROOT = 1] = "LIST_ROOT", n[n.FIRST_ITEM = 2] = "FIRST_ITEM", n[n.LAST_ITEM = 3] = "LAST_ITEM";
|
690
|
+
})(C || (C = {}));
|
691
|
+
/**
|
692
|
+
* @license
|
693
|
+
* Copyright 2018 Google Inc.
|
694
|
+
*
|
695
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
696
|
+
* of this software and associated documentation files (the "Software"), to deal
|
697
|
+
* in the Software without restriction, including without limitation the rights
|
698
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
699
|
+
* copies of the Software, and to permit persons to whom the Software is
|
700
|
+
* furnished to do so, subject to the following conditions:
|
701
|
+
*
|
702
|
+
* The above copyright notice and this permission notice shall be included in
|
703
|
+
* all copies or substantial portions of the Software.
|
704
|
+
*
|
705
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
706
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
707
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
708
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
709
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
710
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
711
|
+
* THE SOFTWARE.
|
712
|
+
*/
|
713
|
+
var O, y, d = {
|
714
|
+
LIST_ITEM_ACTIVATED_CLASS: "mdc-list-item--activated",
|
715
|
+
LIST_ITEM_CLASS: "mdc-list-item",
|
716
|
+
LIST_ITEM_DISABLED_CLASS: "mdc-list-item--disabled",
|
717
|
+
LIST_ITEM_SELECTED_CLASS: "mdc-list-item--selected",
|
718
|
+
LIST_ITEM_TEXT_CLASS: "mdc-list-item__text",
|
719
|
+
LIST_ITEM_PRIMARY_TEXT_CLASS: "mdc-list-item__primary-text",
|
720
|
+
ROOT: "mdc-list"
|
721
|
+
};
|
722
|
+
O = {}, O["" + d.LIST_ITEM_ACTIVATED_CLASS] = "mdc-list-item--activated", O["" + d.LIST_ITEM_CLASS] = "mdc-list-item", O["" + d.LIST_ITEM_DISABLED_CLASS] = "mdc-list-item--disabled", O["" + d.LIST_ITEM_SELECTED_CLASS] = "mdc-list-item--selected", O["" + d.LIST_ITEM_PRIMARY_TEXT_CLASS] = "mdc-list-item__primary-text", O["" + d.ROOT] = "mdc-list";
|
723
|
+
var x = (y = {}, y["" + d.LIST_ITEM_ACTIVATED_CLASS] = "mdc-deprecated-list-item--activated", y["" + d.LIST_ITEM_CLASS] = "mdc-deprecated-list-item", y["" + d.LIST_ITEM_DISABLED_CLASS] = "mdc-deprecated-list-item--disabled", y["" + d.LIST_ITEM_SELECTED_CLASS] = "mdc-deprecated-list-item--selected", y["" + d.LIST_ITEM_TEXT_CLASS] = "mdc-deprecated-list-item__text", y["" + d.LIST_ITEM_PRIMARY_TEXT_CLASS] = "mdc-deprecated-list-item__primary-text", y["" + d.ROOT] = "mdc-deprecated-list", y);
|
724
|
+
"" + d.LIST_ITEM_CLASS + d.LIST_ITEM_CLASS + x[d.LIST_ITEM_CLASS] + x[d.LIST_ITEM_CLASS], "" + d.LIST_ITEM_CLASS + d.LIST_ITEM_CLASS + d.LIST_ITEM_CLASS + d.LIST_ITEM_CLASS + x[d.LIST_ITEM_CLASS] + x[d.LIST_ITEM_CLASS] + x[d.LIST_ITEM_CLASS] + x[d.LIST_ITEM_CLASS];
|
725
|
+
/**
|
726
|
+
* @license
|
727
|
+
* Copyright 2018 Google Inc.
|
728
|
+
*
|
729
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
730
|
+
* of this software and associated documentation files (the "Software"), to deal
|
731
|
+
* in the Software without restriction, including without limitation the rights
|
732
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
733
|
+
* copies of the Software, and to permit persons to whom the Software is
|
734
|
+
* furnished to do so, subject to the following conditions:
|
735
|
+
*
|
736
|
+
* The above copyright notice and this permission notice shall be included in
|
737
|
+
* all copies or substantial portions of the Software.
|
738
|
+
*
|
739
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
740
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
741
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
742
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
743
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
744
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
745
|
+
* THE SOFTWARE.
|
746
|
+
*/
|
747
|
+
var dt = (
|
748
|
+
/** @class */
|
749
|
+
function(n) {
|
750
|
+
U(e, n);
|
751
|
+
function e(t) {
|
752
|
+
var i = n.call(this, B(B({}, e.defaultAdapter), t)) || this;
|
753
|
+
return i.closeAnimationEndTimerId = 0, i.defaultFocusState = C.LIST_ROOT, i.selectedIndex = -1, i;
|
754
|
+
}
|
755
|
+
return Object.defineProperty(e, "cssClasses", {
|
756
|
+
get: function() {
|
757
|
+
return H;
|
758
|
+
},
|
759
|
+
enumerable: !1,
|
760
|
+
configurable: !0
|
761
|
+
}), Object.defineProperty(e, "strings", {
|
762
|
+
get: function() {
|
763
|
+
return v;
|
764
|
+
},
|
765
|
+
enumerable: !1,
|
766
|
+
configurable: !0
|
767
|
+
}), Object.defineProperty(e, "numbers", {
|
768
|
+
get: function() {
|
769
|
+
return at;
|
770
|
+
},
|
771
|
+
enumerable: !1,
|
772
|
+
configurable: !0
|
773
|
+
}), Object.defineProperty(e, "defaultAdapter", {
|
774
|
+
/**
|
775
|
+
* @see {@link MDCMenuAdapter} for typing information on parameters and return types.
|
776
|
+
*/
|
777
|
+
get: function() {
|
778
|
+
return {
|
779
|
+
addClassToElementAtIndex: function() {
|
780
|
+
},
|
781
|
+
removeClassFromElementAtIndex: function() {
|
782
|
+
},
|
783
|
+
addAttributeToElementAtIndex: function() {
|
784
|
+
},
|
785
|
+
removeAttributeFromElementAtIndex: function() {
|
786
|
+
},
|
787
|
+
getAttributeFromElementAtIndex: function() {
|
788
|
+
return null;
|
789
|
+
},
|
790
|
+
elementContainsClass: function() {
|
791
|
+
return !1;
|
792
|
+
},
|
793
|
+
closeSurface: function() {
|
794
|
+
},
|
795
|
+
getElementIndex: function() {
|
796
|
+
return -1;
|
797
|
+
},
|
798
|
+
notifySelected: function() {
|
799
|
+
},
|
800
|
+
getMenuItemCount: function() {
|
801
|
+
return 0;
|
802
|
+
},
|
803
|
+
focusItemAtIndex: function() {
|
804
|
+
},
|
805
|
+
focusListRoot: function() {
|
806
|
+
},
|
807
|
+
getSelectedSiblingOfItemAtIndex: function() {
|
808
|
+
return -1;
|
809
|
+
},
|
810
|
+
isSelectableItemAtIndex: function() {
|
811
|
+
return !1;
|
812
|
+
}
|
813
|
+
};
|
814
|
+
},
|
815
|
+
enumerable: !1,
|
816
|
+
configurable: !0
|
817
|
+
}), e.prototype.destroy = function() {
|
818
|
+
this.closeAnimationEndTimerId && clearTimeout(this.closeAnimationEndTimerId), this.adapter.closeSurface();
|
819
|
+
}, e.prototype.handleKeydown = function(t) {
|
820
|
+
var i = t.key, s = t.keyCode, r = i === "Tab" || s === 9;
|
821
|
+
r && this.adapter.closeSurface(
|
822
|
+
/** skipRestoreFocus */
|
823
|
+
!0
|
824
|
+
);
|
825
|
+
}, e.prototype.handleItemAction = function(t) {
|
826
|
+
var i = this, s = this.adapter.getElementIndex(t);
|
827
|
+
if (!(s < 0)) {
|
828
|
+
this.adapter.notifySelected({ index: s });
|
829
|
+
var r = this.adapter.getAttributeFromElementAtIndex(s, v.SKIP_RESTORE_FOCUS) === "true";
|
830
|
+
this.adapter.closeSurface(r), this.closeAnimationEndTimerId = setTimeout(function() {
|
831
|
+
var l = i.adapter.getElementIndex(t);
|
832
|
+
l >= 0 && i.adapter.isSelectableItemAtIndex(l) && i.setSelectedIndex(l);
|
833
|
+
}, X.numbers.TRANSITION_CLOSE_DURATION);
|
834
|
+
}
|
835
|
+
}, e.prototype.handleMenuSurfaceOpened = function() {
|
836
|
+
switch (this.defaultFocusState) {
|
837
|
+
case C.FIRST_ITEM:
|
838
|
+
this.adapter.focusItemAtIndex(0);
|
839
|
+
break;
|
840
|
+
case C.LAST_ITEM:
|
841
|
+
this.adapter.focusItemAtIndex(this.adapter.getMenuItemCount() - 1);
|
842
|
+
break;
|
843
|
+
case C.NONE:
|
844
|
+
break;
|
845
|
+
default:
|
846
|
+
this.adapter.focusListRoot();
|
847
|
+
break;
|
848
|
+
}
|
849
|
+
}, e.prototype.setDefaultFocusState = function(t) {
|
850
|
+
this.defaultFocusState = t;
|
851
|
+
}, e.prototype.getSelectedIndex = function() {
|
852
|
+
return this.selectedIndex;
|
853
|
+
}, e.prototype.setSelectedIndex = function(t) {
|
854
|
+
if (this.validatedIndex(t), !this.adapter.isSelectableItemAtIndex(t))
|
855
|
+
throw new Error("MDCMenuFoundation: No selection group at specified index.");
|
856
|
+
var i = this.adapter.getSelectedSiblingOfItemAtIndex(t);
|
857
|
+
i >= 0 && (this.adapter.removeAttributeFromElementAtIndex(i, v.ARIA_CHECKED_ATTR), this.adapter.removeClassFromElementAtIndex(i, H.MENU_SELECTED_LIST_ITEM)), this.adapter.addClassToElementAtIndex(t, H.MENU_SELECTED_LIST_ITEM), this.adapter.addAttributeToElementAtIndex(t, v.ARIA_CHECKED_ATTR, "true"), this.selectedIndex = t;
|
858
|
+
}, e.prototype.setEnabled = function(t, i) {
|
859
|
+
this.validatedIndex(t), i ? (this.adapter.removeClassFromElementAtIndex(t, d.LIST_ITEM_DISABLED_CLASS), this.adapter.addAttributeToElementAtIndex(t, v.ARIA_DISABLED_ATTR, "false")) : (this.adapter.addClassToElementAtIndex(t, d.LIST_ITEM_DISABLED_CLASS), this.adapter.addAttributeToElementAtIndex(t, v.ARIA_DISABLED_ATTR, "true"));
|
860
|
+
}, e.prototype.validatedIndex = function(t) {
|
861
|
+
var i = this.adapter.getMenuItemCount(), s = t >= 0 && t < i;
|
862
|
+
if (!s)
|
863
|
+
throw new Error("MDCMenuFoundation: No list item at specified index.");
|
864
|
+
}, e;
|
865
|
+
}(W)
|
866
|
+
);
|
867
|
+
const lt = dt;
|
868
|
+
/**
|
869
|
+
* @license
|
870
|
+
* Copyright 2020 Google LLC
|
871
|
+
* SPDX-License-Identifier: Apache-2.0
|
872
|
+
*/
|
873
|
+
class h extends j {
|
874
|
+
constructor() {
|
875
|
+
super(...arguments), this.mdcFoundationClass = lt, this.listElement_ = null, this.anchor = null, this.open = !1, this.quick = !1, this.wrapFocus = !1, this.innerRole = "menu", this.innerAriaLabel = null, this.corner = "TOP_START", this.x = null, this.y = null, this.absolute = !1, this.multi = !1, this.activatable = !1, this.fixed = !1, this.forceGroupSelection = !1, this.fullwidth = !1, this.menuCorner = "START", this.stayOpenOnBodyClick = !1, this.defaultFocus = "LIST_ROOT", this._listUpdateComplete = null;
|
876
|
+
}
|
877
|
+
get listElement() {
|
878
|
+
return this.listElement_ ? this.listElement_ : (this.listElement_ = this.renderRoot.querySelector("mwc-list"), this.listElement_);
|
879
|
+
}
|
880
|
+
get items() {
|
881
|
+
const e = this.listElement;
|
882
|
+
return e ? e.items : [];
|
883
|
+
}
|
884
|
+
get index() {
|
885
|
+
const e = this.listElement;
|
886
|
+
return e ? e.index : -1;
|
887
|
+
}
|
888
|
+
get selected() {
|
889
|
+
const e = this.listElement;
|
890
|
+
return e ? e.selected : null;
|
891
|
+
}
|
892
|
+
render() {
|
893
|
+
return this.renderSurface();
|
894
|
+
}
|
895
|
+
renderSurface() {
|
896
|
+
const e = this.getSurfaceClasses();
|
897
|
+
return F`
|
898
|
+
<mwc-menu-surface
|
899
|
+
?hidden=${!this.open}
|
900
|
+
.anchor=${this.anchor}
|
901
|
+
.open=${this.open}
|
902
|
+
.quick=${this.quick}
|
903
|
+
.corner=${this.corner}
|
904
|
+
.x=${this.x}
|
905
|
+
.y=${this.y}
|
906
|
+
.absolute=${this.absolute}
|
907
|
+
.fixed=${this.fixed}
|
908
|
+
.fullwidth=${this.fullwidth}
|
909
|
+
.menuCorner=${this.menuCorner}
|
910
|
+
?stayOpenOnBodyClick=${this.stayOpenOnBodyClick}
|
911
|
+
class=${P(e)}
|
912
|
+
@closed=${this.onClosed}
|
913
|
+
@opened=${this.onOpened}
|
914
|
+
@keydown=${this.onKeydown}>
|
915
|
+
${this.renderList()}
|
916
|
+
</mwc-menu-surface>`;
|
917
|
+
}
|
918
|
+
getSurfaceClasses() {
|
919
|
+
return {
|
920
|
+
"mdc-menu": !0,
|
921
|
+
"mdc-menu-surface": !0
|
922
|
+
};
|
923
|
+
}
|
924
|
+
renderList() {
|
925
|
+
const e = this.innerRole === "menu" ? "menuitem" : "option", t = this.renderListClasses();
|
926
|
+
return F`
|
927
|
+
<mwc-list
|
928
|
+
rootTabbable
|
929
|
+
.innerAriaLabel=${this.innerAriaLabel}
|
930
|
+
.innerRole=${this.innerRole}
|
931
|
+
.multi=${this.multi}
|
932
|
+
class=${P(t)}
|
933
|
+
.itemRoles=${e}
|
934
|
+
.wrapFocus=${this.wrapFocus}
|
935
|
+
.activatable=${this.activatable}
|
936
|
+
@action=${this.onAction}>
|
937
|
+
<slot></slot>
|
938
|
+
</mwc-list>`;
|
939
|
+
}
|
940
|
+
renderListClasses() {
|
941
|
+
return {
|
942
|
+
"mdc-deprecated-list": !0
|
943
|
+
};
|
944
|
+
}
|
945
|
+
createAdapter() {
|
946
|
+
return {
|
947
|
+
addClassToElementAtIndex: (e, t) => {
|
948
|
+
const i = this.listElement;
|
949
|
+
if (!i)
|
950
|
+
return;
|
951
|
+
const s = i.items[e];
|
952
|
+
s && (t === "mdc-menu-item--selected" ? this.forceGroupSelection && !s.selected && i.toggle(e, !0) : s.classList.add(t));
|
953
|
+
},
|
954
|
+
removeClassFromElementAtIndex: (e, t) => {
|
955
|
+
const i = this.listElement;
|
956
|
+
if (!i)
|
957
|
+
return;
|
958
|
+
const s = i.items[e];
|
959
|
+
s && (t === "mdc-menu-item--selected" ? s.selected && i.toggle(e, !1) : s.classList.remove(t));
|
960
|
+
},
|
961
|
+
addAttributeToElementAtIndex: (e, t, i) => {
|
962
|
+
const s = this.listElement;
|
963
|
+
if (!s)
|
964
|
+
return;
|
965
|
+
const r = s.items[e];
|
966
|
+
r && r.setAttribute(t, i);
|
967
|
+
},
|
968
|
+
removeAttributeFromElementAtIndex: (e, t) => {
|
969
|
+
const i = this.listElement;
|
970
|
+
if (!i)
|
971
|
+
return;
|
972
|
+
const s = i.items[e];
|
973
|
+
s && s.removeAttribute(t);
|
974
|
+
},
|
975
|
+
getAttributeFromElementAtIndex: (e, t) => {
|
976
|
+
const i = this.listElement;
|
977
|
+
if (!i)
|
978
|
+
return null;
|
979
|
+
const s = i.items[e];
|
980
|
+
return s ? s.getAttribute(t) : null;
|
981
|
+
},
|
982
|
+
elementContainsClass: (e, t) => e.classList.contains(t),
|
983
|
+
closeSurface: () => {
|
984
|
+
this.open = !1;
|
985
|
+
},
|
986
|
+
getElementIndex: (e) => {
|
987
|
+
const t = this.listElement;
|
988
|
+
return t ? t.items.indexOf(e) : -1;
|
989
|
+
},
|
990
|
+
notifySelected: () => {
|
991
|
+
},
|
992
|
+
getMenuItemCount: () => {
|
993
|
+
const e = this.listElement;
|
994
|
+
return e ? e.items.length : 0;
|
995
|
+
},
|
996
|
+
focusItemAtIndex: (e) => {
|
997
|
+
const t = this.listElement;
|
998
|
+
if (!t)
|
999
|
+
return;
|
1000
|
+
const i = t.items[e];
|
1001
|
+
i && i.focus();
|
1002
|
+
},
|
1003
|
+
focusListRoot: () => {
|
1004
|
+
this.listElement && this.listElement.focus();
|
1005
|
+
},
|
1006
|
+
getSelectedSiblingOfItemAtIndex: (e) => {
|
1007
|
+
const t = this.listElement;
|
1008
|
+
if (!t)
|
1009
|
+
return -1;
|
1010
|
+
const i = t.items[e];
|
1011
|
+
if (!i || !i.group)
|
1012
|
+
return -1;
|
1013
|
+
for (let s = 0; s < t.items.length; s++) {
|
1014
|
+
if (s === e)
|
1015
|
+
continue;
|
1016
|
+
const r = t.items[s];
|
1017
|
+
if (r.selected && r.group === i.group)
|
1018
|
+
return s;
|
1019
|
+
}
|
1020
|
+
return -1;
|
1021
|
+
},
|
1022
|
+
isSelectableItemAtIndex: (e) => {
|
1023
|
+
const t = this.listElement;
|
1024
|
+
if (!t)
|
1025
|
+
return !1;
|
1026
|
+
const i = t.items[e];
|
1027
|
+
return i ? i.hasAttribute("group") : !1;
|
1028
|
+
}
|
1029
|
+
};
|
1030
|
+
}
|
1031
|
+
onKeydown(e) {
|
1032
|
+
this.mdcFoundation && this.mdcFoundation.handleKeydown(e);
|
1033
|
+
}
|
1034
|
+
onAction(e) {
|
1035
|
+
const t = this.listElement;
|
1036
|
+
if (this.mdcFoundation && t) {
|
1037
|
+
const i = e.detail.index, s = t.items[i];
|
1038
|
+
s && this.mdcFoundation.handleItemAction(s);
|
1039
|
+
}
|
1040
|
+
}
|
1041
|
+
onOpened() {
|
1042
|
+
this.open = !0, this.mdcFoundation && this.mdcFoundation.handleMenuSurfaceOpened();
|
1043
|
+
}
|
1044
|
+
onClosed() {
|
1045
|
+
this.open = !1;
|
1046
|
+
}
|
1047
|
+
// tslint:disable:ban-ts-ignore
|
1048
|
+
async getUpdateComplete() {
|
1049
|
+
return await this._listUpdateComplete, await super.getUpdateComplete();
|
1050
|
+
}
|
1051
|
+
// tslint:enable:ban-ts-ignore
|
1052
|
+
async firstUpdated() {
|
1053
|
+
super.firstUpdated();
|
1054
|
+
const e = this.listElement;
|
1055
|
+
e && (this._listUpdateComplete = e.updateComplete, await this._listUpdateComplete);
|
1056
|
+
}
|
1057
|
+
select(e) {
|
1058
|
+
const t = this.listElement;
|
1059
|
+
t && t.select(e);
|
1060
|
+
}
|
1061
|
+
close() {
|
1062
|
+
this.open = !1;
|
1063
|
+
}
|
1064
|
+
show() {
|
1065
|
+
this.open = !0;
|
1066
|
+
}
|
1067
|
+
getFocusedItemIndex() {
|
1068
|
+
const e = this.listElement;
|
1069
|
+
return e ? e.getFocusedItemIndex() : -1;
|
1070
|
+
}
|
1071
|
+
focusItemAtIndex(e) {
|
1072
|
+
const t = this.listElement;
|
1073
|
+
t && t.focusItemAtIndex(e);
|
1074
|
+
}
|
1075
|
+
layout(e = !0) {
|
1076
|
+
const t = this.listElement;
|
1077
|
+
t && t.layout(e);
|
1078
|
+
}
|
1079
|
+
}
|
1080
|
+
o([
|
1081
|
+
D(".mdc-menu")
|
1082
|
+
], h.prototype, "mdcRoot", void 0);
|
1083
|
+
o([
|
1084
|
+
D("slot")
|
1085
|
+
], h.prototype, "slotElement", void 0);
|
1086
|
+
o([
|
1087
|
+
a({ type: Object })
|
1088
|
+
], h.prototype, "anchor", void 0);
|
1089
|
+
o([
|
1090
|
+
a({ type: Boolean, reflect: !0 })
|
1091
|
+
], h.prototype, "open", void 0);
|
1092
|
+
o([
|
1093
|
+
a({ type: Boolean })
|
1094
|
+
], h.prototype, "quick", void 0);
|
1095
|
+
o([
|
1096
|
+
a({ type: Boolean })
|
1097
|
+
], h.prototype, "wrapFocus", void 0);
|
1098
|
+
o([
|
1099
|
+
a({ type: String })
|
1100
|
+
], h.prototype, "innerRole", void 0);
|
1101
|
+
o([
|
1102
|
+
a({ type: String })
|
1103
|
+
], h.prototype, "innerAriaLabel", void 0);
|
1104
|
+
o([
|
1105
|
+
a({ type: String })
|
1106
|
+
], h.prototype, "corner", void 0);
|
1107
|
+
o([
|
1108
|
+
a({ type: Number })
|
1109
|
+
], h.prototype, "x", void 0);
|
1110
|
+
o([
|
1111
|
+
a({ type: Number })
|
1112
|
+
], h.prototype, "y", void 0);
|
1113
|
+
o([
|
1114
|
+
a({ type: Boolean })
|
1115
|
+
], h.prototype, "absolute", void 0);
|
1116
|
+
o([
|
1117
|
+
a({ type: Boolean })
|
1118
|
+
], h.prototype, "multi", void 0);
|
1119
|
+
o([
|
1120
|
+
a({ type: Boolean })
|
1121
|
+
], h.prototype, "activatable", void 0);
|
1122
|
+
o([
|
1123
|
+
a({ type: Boolean })
|
1124
|
+
], h.prototype, "fixed", void 0);
|
1125
|
+
o([
|
1126
|
+
a({ type: Boolean })
|
1127
|
+
], h.prototype, "forceGroupSelection", void 0);
|
1128
|
+
o([
|
1129
|
+
a({ type: Boolean })
|
1130
|
+
], h.prototype, "fullwidth", void 0);
|
1131
|
+
o([
|
1132
|
+
a({ type: String })
|
1133
|
+
], h.prototype, "menuCorner", void 0);
|
1134
|
+
o([
|
1135
|
+
a({ type: Boolean })
|
1136
|
+
], h.prototype, "stayOpenOnBodyClick", void 0);
|
1137
|
+
o([
|
1138
|
+
a({ type: String }),
|
1139
|
+
g(function(n) {
|
1140
|
+
this.mdcFoundation && this.mdcFoundation.setDefaultFocusState(C[n]);
|
1141
|
+
})
|
1142
|
+
], h.prototype, "defaultFocus", void 0);
|
1143
|
+
export {
|
1144
|
+
h as M
|
1145
|
+
};
|