@limetech/lime-elements 37.55.4 → 37.55.6
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/CHANGELOG.md +21 -0
- package/dist/cjs/lime-elements.cjs.js +1 -1
- package/dist/cjs/limel-badge_3.cjs.entry.js +1 -4
- package/dist/cjs/limel-badge_3.cjs.entry.js.map +1 -1
- package/dist/cjs/limel-breadcrumbs_5.cjs.entry.js +2 -4
- package/dist/cjs/limel-breadcrumbs_5.cjs.entry.js.map +1 -1
- package/dist/cjs/limel-callout.cjs.entry.js +1 -1
- package/dist/cjs/limel-callout.cjs.entry.js.map +1 -1
- package/dist/cjs/limel-color-picker.cjs.entry.js.map +1 -1
- package/dist/cjs/limel-date-picker.cjs.entry.js +6 -6
- package/dist/cjs/limel-date-picker.cjs.entry.js.map +1 -1
- package/dist/cjs/limel-dynamic-label_4.cjs.entry.js +5 -2
- package/dist/cjs/limel-dynamic-label_4.cjs.entry.js.map +1 -1
- package/dist/cjs/limel-form.cjs.entry.js +2 -2
- package/dist/cjs/limel-form.cjs.entry.js.map +1 -1
- package/dist/cjs/limel-icon_2.cjs.entry.js +16 -54
- package/dist/cjs/limel-icon_2.cjs.entry.js.map +1 -1
- package/dist/cjs/limel-picker.cjs.entry.js +1 -2
- package/dist/cjs/limel-picker.cjs.entry.js.map +1 -1
- package/dist/cjs/limel-popover_2.cjs.entry.js +4 -35
- package/dist/cjs/limel-popover_2.cjs.entry.js.map +1 -1
- package/dist/cjs/limel-prosemirror-adapter.cjs.entry.js +7 -7
- package/dist/cjs/limel-prosemirror-adapter.cjs.entry.js.map +1 -1
- package/dist/cjs/limel-select.cjs.entry.js +4 -5
- package/dist/cjs/limel-select.cjs.entry.js.map +1 -1
- package/dist/cjs/limel-snackbar.cjs.entry.js +92 -523
- package/dist/cjs/limel-snackbar.cjs.entry.js.map +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/components/callout/callout.helpers.js +1 -1
- package/dist/collection/components/callout/callout.helpers.js.map +1 -1
- package/dist/collection/components/color-picker/color-picker.js +0 -1
- package/dist/collection/components/color-picker/color-picker.js.map +1 -1
- package/dist/collection/components/date-picker/date-picker.css +0 -3
- package/dist/collection/components/date-picker/date-picker.js +6 -6
- package/dist/collection/components/date-picker/date-picker.js.map +1 -1
- package/dist/collection/components/form/widgets/code-editor.js +2 -2
- package/dist/collection/components/form/widgets/code-editor.js.map +1 -1
- package/dist/collection/components/input-field/input-field.js +1 -2
- package/dist/collection/components/input-field/input-field.js.map +1 -1
- package/dist/collection/components/list/list-renderer.js +2 -2
- package/dist/collection/components/list/list-renderer.js.map +1 -1
- package/dist/collection/components/menu/menu.css +0 -1
- package/dist/collection/components/menu/menu.js +1 -2
- package/dist/collection/components/menu/menu.js.map +1 -1
- package/dist/collection/components/menu-surface/menu-surface.js +3 -0
- package/dist/collection/components/menu-surface/menu-surface.js.map +1 -1
- package/dist/collection/components/picker/picker.css +0 -3
- package/dist/collection/components/picker/picker.js +1 -2
- package/dist/collection/components/picker/picker.js.map +1 -1
- package/dist/collection/components/popover/popover.css +0 -1
- package/dist/collection/components/popover/popover.js +4 -5
- package/dist/collection/components/popover/popover.js.map +1 -1
- package/dist/collection/components/portal/portal.css +10 -7
- package/dist/collection/components/portal/portal.js +22 -123
- package/dist/collection/components/portal/portal.js.map +1 -1
- package/dist/collection/components/select/select.css +0 -3
- package/dist/collection/components/select/select.js +2 -3
- package/dist/collection/components/select/select.js.map +1 -1
- package/dist/collection/components/select/select.template.js +1 -1
- package/dist/collection/components/select/select.template.js.map +1 -1
- package/dist/collection/components/snackbar/container.js +50 -0
- package/dist/collection/components/snackbar/container.js.map +1 -0
- package/dist/collection/components/snackbar/snackbar.css +37 -51
- package/dist/collection/components/snackbar/snackbar.js +66 -40
- package/dist/collection/components/snackbar/snackbar.js.map +1 -1
- package/dist/collection/components/text-editor/prosemirror-adapter/prosemirror-adapter.js +1 -1
- package/dist/collection/components/text-editor/prosemirror-adapter/prosemirror-adapter.js.map +1 -1
- package/dist/collection/components/tooltip/tooltip.css +0 -3
- package/dist/collection/components/tooltip/tooltip.js +1 -4
- package/dist/collection/components/tooltip/tooltip.js.map +1 -1
- package/dist/collection/index.js.map +1 -1
- package/dist/collection/style/internal/codemirror-tooltip.scss +0 -1
- package/dist/esm/lime-elements.js +1 -1
- package/dist/esm/limel-badge_3.entry.js +1 -4
- package/dist/esm/limel-badge_3.entry.js.map +1 -1
- package/dist/esm/limel-breadcrumbs_5.entry.js +2 -4
- package/dist/esm/limel-breadcrumbs_5.entry.js.map +1 -1
- package/dist/esm/limel-callout.entry.js +1 -1
- package/dist/esm/limel-callout.entry.js.map +1 -1
- package/dist/esm/limel-color-picker.entry.js.map +1 -1
- package/dist/esm/limel-date-picker.entry.js +6 -6
- package/dist/esm/limel-date-picker.entry.js.map +1 -1
- package/dist/esm/limel-dynamic-label_4.entry.js +5 -2
- package/dist/esm/limel-dynamic-label_4.entry.js.map +1 -1
- package/dist/esm/limel-form.entry.js +2 -2
- package/dist/esm/limel-form.entry.js.map +1 -1
- package/dist/esm/limel-icon_2.entry.js +17 -55
- package/dist/esm/limel-icon_2.entry.js.map +1 -1
- package/dist/esm/limel-picker.entry.js +1 -2
- package/dist/esm/limel-picker.entry.js.map +1 -1
- package/dist/esm/limel-popover_2.entry.js +4 -35
- package/dist/esm/limel-popover_2.entry.js.map +1 -1
- package/dist/esm/limel-prosemirror-adapter.entry.js +7 -7
- package/dist/esm/limel-prosemirror-adapter.entry.js.map +1 -1
- package/dist/esm/limel-select.entry.js +4 -5
- package/dist/esm/limel-select.entry.js.map +1 -1
- package/dist/esm/limel-snackbar.entry.js +92 -523
- package/dist/esm/limel-snackbar.entry.js.map +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/lime-elements/lime-elements.css +1 -1
- package/dist/lime-elements/lime-elements.esm.js +1 -1
- package/dist/lime-elements/lime-elements.esm.js.map +1 -1
- package/dist/lime-elements/p-04fc9578.entry.js +2 -0
- package/dist/lime-elements/p-04fc9578.entry.js.map +1 -0
- package/dist/lime-elements/{p-ed214c35.entry.js → p-36b385b2.entry.js} +2 -2
- package/dist/lime-elements/p-36b385b2.entry.js.map +1 -0
- package/dist/lime-elements/{p-d1838cf6.entry.js → p-39c678f7.entry.js} +2 -2
- package/dist/lime-elements/p-39c678f7.entry.js.map +1 -0
- package/dist/lime-elements/p-465c22b0.entry.js +2 -0
- package/dist/lime-elements/p-465c22b0.entry.js.map +1 -0
- package/dist/lime-elements/p-47f7d74f.entry.js.map +1 -1
- package/dist/lime-elements/p-48652dbe.entry.js.map +1 -1
- package/dist/lime-elements/p-4aa1d842.entry.js +68 -0
- package/dist/lime-elements/p-4aa1d842.entry.js.map +1 -0
- package/dist/lime-elements/p-50303eb1.entry.js.map +1 -1
- package/dist/lime-elements/p-e364c2b1.entry.js +2 -0
- package/dist/lime-elements/p-e364c2b1.entry.js.map +1 -0
- package/dist/lime-elements/{p-b8bfe44d.entry.js → p-e728ae13.entry.js} +2 -2
- package/dist/lime-elements/p-e728ae13.entry.js.map +1 -0
- package/dist/lime-elements/p-e7fc1c16.entry.js +2 -0
- package/dist/lime-elements/p-e7fc1c16.entry.js.map +1 -0
- package/dist/lime-elements/{p-773e3d4f.entry.js → p-f3ef8842.entry.js} +2 -2
- package/dist/lime-elements/p-f3ef8842.entry.js.map +1 -0
- package/dist/lime-elements/p-fec054fd.entry.js +2 -0
- package/dist/lime-elements/p-fec054fd.entry.js.map +1 -0
- package/dist/lime-elements/style/internal/codemirror-tooltip.scss +0 -1
- package/dist/types/components/list/list-renderer.d.ts +1 -1
- package/dist/types/components/portal/portal.d.ts +9 -42
- package/dist/types/components/select/select.template.d.ts +0 -1
- package/dist/types/components/snackbar/snackbar.d.ts +9 -7
- package/dist/types/components/tooltip/tooltip.d.ts +0 -1
- package/dist/types/components.d.ts +26 -92
- package/dist/types/index.d.ts +7 -0
- package/package.json +16 -13
- package/dist/lime-elements/p-480884e6.entry.js +0 -90
- package/dist/lime-elements/p-480884e6.entry.js.map +0 -1
- package/dist/lime-elements/p-5224d7bb.entry.js +0 -2
- package/dist/lime-elements/p-5224d7bb.entry.js.map +0 -1
- package/dist/lime-elements/p-53fc6f0e.entry.js +0 -2
- package/dist/lime-elements/p-53fc6f0e.entry.js.map +0 -1
- package/dist/lime-elements/p-773e3d4f.entry.js.map +0 -1
- package/dist/lime-elements/p-9a895330.entry.js +0 -2
- package/dist/lime-elements/p-9a895330.entry.js.map +0 -1
- package/dist/lime-elements/p-b8bfe44d.entry.js.map +0 -1
- package/dist/lime-elements/p-d1838cf6.entry.js.map +0 -1
- package/dist/lime-elements/p-d4d2593b.entry.js +0 -2
- package/dist/lime-elements/p-d4d2593b.entry.js.map +0 -1
- package/dist/lime-elements/p-ed214c35.entry.js.map +0 -1
- package/dist/lime-elements/p-ef5539b0.entry.js +0 -68
- package/dist/lime-elements/p-ef5539b0.entry.js.map +0 -1
|
@@ -4,573 +4,142 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
const index = require('./index-d1052409.js');
|
|
6
6
|
const translations = require('./translations-a73f2479.js');
|
|
7
|
-
const
|
|
8
|
-
const ponyfill = require('./ponyfill-98ca4766.js');
|
|
7
|
+
const randomString = require('./random-string-c8445652.js');
|
|
9
8
|
|
|
10
9
|
/**
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* of this software and associated documentation files (the "Software"), to deal
|
|
16
|
-
* in the Software without restriction, including without limitation the rights
|
|
17
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
18
|
-
* copies of the Software, and to permit persons to whom the Software is
|
|
19
|
-
* furnished to do so, subject to the following conditions:
|
|
20
|
-
*
|
|
21
|
-
* The above copyright notice and this permission notice shall be included in
|
|
22
|
-
* all copies or substantial portions of the Software.
|
|
23
|
-
*
|
|
24
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
25
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
26
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
27
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
28
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
29
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
30
|
-
* THE SOFTWARE.
|
|
10
|
+
* Container to keep track of all snackbar elements that gets added to the page.
|
|
11
|
+
* When an element gets added or removed, the container will emit a
|
|
12
|
+
* `changeOffset` event on all elements in the container, letting them know
|
|
13
|
+
* the new offset to where they should position themselves.
|
|
31
14
|
*/
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
*
|
|
70
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
71
|
-
* of this software and associated documentation files (the "Software"), to deal
|
|
72
|
-
* in the Software without restriction, including without limitation the rights
|
|
73
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
74
|
-
* copies of the Software, and to permit persons to whom the Software is
|
|
75
|
-
* furnished to do so, subject to the following conditions:
|
|
76
|
-
*
|
|
77
|
-
* The above copyright notice and this permission notice shall be included in
|
|
78
|
-
* all copies or substantial portions of the Software.
|
|
79
|
-
*
|
|
80
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
81
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
82
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
83
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
84
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
85
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
86
|
-
* THE SOFTWARE.
|
|
87
|
-
*/
|
|
88
|
-
var ARIA_LIVE_DELAY_MS = numbers.ARIA_LIVE_DELAY_MS;
|
|
89
|
-
var ARIA_LIVE_LABEL_TEXT_ATTR = strings.ARIA_LIVE_LABEL_TEXT_ATTR;
|
|
90
|
-
function announce(ariaEl, labelEl) {
|
|
91
|
-
if (labelEl === void 0) { labelEl = ariaEl; }
|
|
92
|
-
var priority = ariaEl.getAttribute('aria-live');
|
|
93
|
-
// Trim text to ignore ` ` (see below).
|
|
94
|
-
// textContent is only null if the node is a document, DOCTYPE, or notation.
|
|
95
|
-
var labelText = labelEl.textContent.trim();
|
|
96
|
-
if (!labelText || !priority) {
|
|
97
|
-
return;
|
|
98
|
-
}
|
|
99
|
-
// Temporarily disable `aria-live` to prevent JAWS+Firefox from announcing the message twice.
|
|
100
|
-
ariaEl.setAttribute('aria-live', 'off');
|
|
101
|
-
// Temporarily clear `textContent` to force a DOM mutation event that will be detected by screen readers.
|
|
102
|
-
// `aria-live` elements are only announced when the element's `textContent` *changes*, so snackbars
|
|
103
|
-
// sent to the browser in the initial HTML response won't be read unless we clear the element's `textContent` first.
|
|
104
|
-
// Similarly, displaying the same snackbar message twice in a row doesn't trigger a DOM mutation event,
|
|
105
|
-
// so screen readers won't announce the second message unless we first clear `textContent`.
|
|
106
|
-
//
|
|
107
|
-
// We have to clear the label text two different ways to make it work in all browsers and screen readers:
|
|
108
|
-
//
|
|
109
|
-
// 1. `textContent = ''` is required for IE11 + JAWS
|
|
110
|
-
// 2. `innerHTML = ' '` is required for Chrome + JAWS and NVDA
|
|
111
|
-
//
|
|
112
|
-
// All other browser/screen reader combinations support both methods.
|
|
113
|
-
//
|
|
114
|
-
// The wrapper `<span>` visually hides the space character so that it doesn't cause jank when added/removed.
|
|
115
|
-
// N.B.: Setting `position: absolute`, `opacity: 0`, or `height: 0` prevents Chrome from detecting the DOM change.
|
|
116
|
-
//
|
|
117
|
-
// This technique has been tested in:
|
|
118
|
-
//
|
|
119
|
-
// * JAWS 2019:
|
|
120
|
-
// - Chrome 70
|
|
121
|
-
// - Firefox 60 (ESR)
|
|
122
|
-
// - IE 11
|
|
123
|
-
// * NVDA 2018:
|
|
124
|
-
// - Chrome 70
|
|
125
|
-
// - Firefox 60 (ESR)
|
|
126
|
-
// - IE 11
|
|
127
|
-
// * ChromeVox 53
|
|
128
|
-
labelEl.textContent = '';
|
|
129
|
-
labelEl.innerHTML = '<span style="display: inline-block; width: 0; height: 1px;"> </span>';
|
|
130
|
-
// Prevent visual jank by temporarily displaying the label text in the ::before pseudo-element.
|
|
131
|
-
// CSS generated content is normally announced by screen readers
|
|
132
|
-
// (except in IE 11; see https://tink.uk/accessibility-support-for-css-generated-content/);
|
|
133
|
-
// however, `aria-live` is turned off, so this DOM update will be ignored by screen readers.
|
|
134
|
-
labelEl.setAttribute(ARIA_LIVE_LABEL_TEXT_ATTR, labelText);
|
|
135
|
-
setTimeout(function () {
|
|
136
|
-
// Allow screen readers to announce changes to the DOM again.
|
|
137
|
-
ariaEl.setAttribute('aria-live', priority);
|
|
138
|
-
// Remove the message from the ::before pseudo-element.
|
|
139
|
-
labelEl.removeAttribute(ARIA_LIVE_LABEL_TEXT_ATTR);
|
|
140
|
-
// Restore the original label text, which will be announced by screen readers.
|
|
141
|
-
labelEl.textContent = labelText;
|
|
142
|
-
}, ARIA_LIVE_DELAY_MS);
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
/**
|
|
146
|
-
* @license
|
|
147
|
-
* Copyright 2018 Google Inc.
|
|
148
|
-
*
|
|
149
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
150
|
-
* of this software and associated documentation files (the "Software"), to deal
|
|
151
|
-
* in the Software without restriction, including without limitation the rights
|
|
152
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
153
|
-
* copies of the Software, and to permit persons to whom the Software is
|
|
154
|
-
* furnished to do so, subject to the following conditions:
|
|
155
|
-
*
|
|
156
|
-
* The above copyright notice and this permission notice shall be included in
|
|
157
|
-
* all copies or substantial portions of the Software.
|
|
158
|
-
*
|
|
159
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
160
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
161
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
162
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
163
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
164
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
165
|
-
* THE SOFTWARE.
|
|
166
|
-
*/
|
|
167
|
-
var OPENING = cssClasses.OPENING, OPEN = cssClasses.OPEN, CLOSING = cssClasses.CLOSING;
|
|
168
|
-
var REASON_ACTION = strings.REASON_ACTION, REASON_DISMISS = strings.REASON_DISMISS;
|
|
169
|
-
var MDCSnackbarFoundation = /** @class */ (function (_super) {
|
|
170
|
-
component.__extends(MDCSnackbarFoundation, _super);
|
|
171
|
-
function MDCSnackbarFoundation(adapter) {
|
|
172
|
-
var _this = _super.call(this, component.__assign(component.__assign({}, MDCSnackbarFoundation.defaultAdapter), adapter)) || this;
|
|
173
|
-
_this.opened = false;
|
|
174
|
-
_this.animationFrame = 0;
|
|
175
|
-
_this.animationTimer = 0;
|
|
176
|
-
_this.autoDismissTimer = 0;
|
|
177
|
-
_this.autoDismissTimeoutMs = numbers.DEFAULT_AUTO_DISMISS_TIMEOUT_MS;
|
|
178
|
-
_this.closeOnEscape = true;
|
|
179
|
-
return _this;
|
|
180
|
-
}
|
|
181
|
-
Object.defineProperty(MDCSnackbarFoundation, "cssClasses", {
|
|
182
|
-
get: function () {
|
|
183
|
-
return cssClasses;
|
|
184
|
-
},
|
|
185
|
-
enumerable: false,
|
|
186
|
-
configurable: true
|
|
187
|
-
});
|
|
188
|
-
Object.defineProperty(MDCSnackbarFoundation, "strings", {
|
|
189
|
-
get: function () {
|
|
190
|
-
return strings;
|
|
191
|
-
},
|
|
192
|
-
enumerable: false,
|
|
193
|
-
configurable: true
|
|
194
|
-
});
|
|
195
|
-
Object.defineProperty(MDCSnackbarFoundation, "numbers", {
|
|
196
|
-
get: function () {
|
|
197
|
-
return numbers;
|
|
198
|
-
},
|
|
199
|
-
enumerable: false,
|
|
200
|
-
configurable: true
|
|
201
|
-
});
|
|
202
|
-
Object.defineProperty(MDCSnackbarFoundation, "defaultAdapter", {
|
|
203
|
-
get: function () {
|
|
204
|
-
return {
|
|
205
|
-
addClass: function () { return undefined; },
|
|
206
|
-
announce: function () { return undefined; },
|
|
207
|
-
notifyClosed: function () { return undefined; },
|
|
208
|
-
notifyClosing: function () { return undefined; },
|
|
209
|
-
notifyOpened: function () { return undefined; },
|
|
210
|
-
notifyOpening: function () { return undefined; },
|
|
211
|
-
removeClass: function () { return undefined; },
|
|
212
|
-
};
|
|
213
|
-
},
|
|
214
|
-
enumerable: false,
|
|
215
|
-
configurable: true
|
|
216
|
-
});
|
|
217
|
-
MDCSnackbarFoundation.prototype.destroy = function () {
|
|
218
|
-
this.clearAutoDismissTimer();
|
|
219
|
-
cancelAnimationFrame(this.animationFrame);
|
|
220
|
-
this.animationFrame = 0;
|
|
221
|
-
clearTimeout(this.animationTimer);
|
|
222
|
-
this.animationTimer = 0;
|
|
223
|
-
this.adapter.removeClass(OPENING);
|
|
224
|
-
this.adapter.removeClass(OPEN);
|
|
225
|
-
this.adapter.removeClass(CLOSING);
|
|
226
|
-
};
|
|
227
|
-
MDCSnackbarFoundation.prototype.open = function () {
|
|
228
|
-
var _this = this;
|
|
229
|
-
this.clearAutoDismissTimer();
|
|
230
|
-
this.opened = true;
|
|
231
|
-
this.adapter.notifyOpening();
|
|
232
|
-
this.adapter.removeClass(CLOSING);
|
|
233
|
-
this.adapter.addClass(OPENING);
|
|
234
|
-
this.adapter.announce();
|
|
235
|
-
// Wait a frame once display is no longer "none", to establish basis for animation
|
|
236
|
-
this.runNextAnimationFrame(function () {
|
|
237
|
-
_this.adapter.addClass(OPEN);
|
|
238
|
-
_this.animationTimer = setTimeout(function () {
|
|
239
|
-
var timeoutMs = _this.getTimeoutMs();
|
|
240
|
-
_this.handleAnimationTimerEnd();
|
|
241
|
-
_this.adapter.notifyOpened();
|
|
242
|
-
if (timeoutMs !== numbers.INDETERMINATE) {
|
|
243
|
-
_this.autoDismissTimer = setTimeout(function () {
|
|
244
|
-
_this.close(REASON_DISMISS);
|
|
245
|
-
}, timeoutMs);
|
|
246
|
-
}
|
|
247
|
-
}, numbers.SNACKBAR_ANIMATION_OPEN_TIME_MS);
|
|
248
|
-
});
|
|
249
|
-
};
|
|
250
|
-
/**
|
|
251
|
-
* @param reason Why the snackbar was closed. Value will be passed to CLOSING_EVENT and CLOSED_EVENT via the
|
|
252
|
-
* `event.detail.reason` property. Standard values are REASON_ACTION and REASON_DISMISS, but custom
|
|
253
|
-
* client-specific values may also be used if desired.
|
|
254
|
-
*/
|
|
255
|
-
MDCSnackbarFoundation.prototype.close = function (reason) {
|
|
256
|
-
var _this = this;
|
|
257
|
-
if (reason === void 0) { reason = ''; }
|
|
258
|
-
if (!this.opened) {
|
|
259
|
-
// Avoid redundant close calls (and events), e.g. repeated interactions as the snackbar is animating closed
|
|
260
|
-
return;
|
|
261
|
-
}
|
|
262
|
-
cancelAnimationFrame(this.animationFrame);
|
|
263
|
-
this.animationFrame = 0;
|
|
264
|
-
this.clearAutoDismissTimer();
|
|
265
|
-
this.opened = false;
|
|
266
|
-
this.adapter.notifyClosing(reason);
|
|
267
|
-
this.adapter.addClass(cssClasses.CLOSING);
|
|
268
|
-
this.adapter.removeClass(cssClasses.OPEN);
|
|
269
|
-
this.adapter.removeClass(cssClasses.OPENING);
|
|
270
|
-
clearTimeout(this.animationTimer);
|
|
271
|
-
this.animationTimer = setTimeout(function () {
|
|
272
|
-
_this.handleAnimationTimerEnd();
|
|
273
|
-
_this.adapter.notifyClosed(reason);
|
|
274
|
-
}, numbers.SNACKBAR_ANIMATION_CLOSE_TIME_MS);
|
|
275
|
-
};
|
|
276
|
-
MDCSnackbarFoundation.prototype.isOpen = function () {
|
|
277
|
-
return this.opened;
|
|
278
|
-
};
|
|
279
|
-
MDCSnackbarFoundation.prototype.getTimeoutMs = function () {
|
|
280
|
-
return this.autoDismissTimeoutMs;
|
|
281
|
-
};
|
|
282
|
-
MDCSnackbarFoundation.prototype.setTimeoutMs = function (timeoutMs) {
|
|
283
|
-
// Use shorter variable names to make the code more readable
|
|
284
|
-
var minValue = numbers.MIN_AUTO_DISMISS_TIMEOUT_MS;
|
|
285
|
-
var maxValue = numbers.MAX_AUTO_DISMISS_TIMEOUT_MS;
|
|
286
|
-
var indeterminateValue = numbers.INDETERMINATE;
|
|
287
|
-
if (timeoutMs === numbers.INDETERMINATE || (timeoutMs <= maxValue && timeoutMs >= minValue)) {
|
|
288
|
-
this.autoDismissTimeoutMs = timeoutMs;
|
|
289
|
-
}
|
|
290
|
-
else {
|
|
291
|
-
throw new Error("\n timeoutMs must be an integer in the range " + minValue + "\u2013" + maxValue + "\n (or " + indeterminateValue + " to disable), but got '" + timeoutMs + "'");
|
|
292
|
-
}
|
|
293
|
-
};
|
|
294
|
-
MDCSnackbarFoundation.prototype.getCloseOnEscape = function () {
|
|
295
|
-
return this.closeOnEscape;
|
|
296
|
-
};
|
|
297
|
-
MDCSnackbarFoundation.prototype.setCloseOnEscape = function (closeOnEscape) {
|
|
298
|
-
this.closeOnEscape = closeOnEscape;
|
|
299
|
-
};
|
|
300
|
-
MDCSnackbarFoundation.prototype.handleKeyDown = function (evt) {
|
|
301
|
-
var isEscapeKey = evt.key === 'Escape' || evt.keyCode === 27;
|
|
302
|
-
if (isEscapeKey && this.getCloseOnEscape()) {
|
|
303
|
-
this.close(REASON_DISMISS);
|
|
304
|
-
}
|
|
305
|
-
};
|
|
306
|
-
MDCSnackbarFoundation.prototype.handleActionButtonClick = function (_evt) {
|
|
307
|
-
this.close(REASON_ACTION);
|
|
308
|
-
};
|
|
309
|
-
MDCSnackbarFoundation.prototype.handleActionIconClick = function (_evt) {
|
|
310
|
-
this.close(REASON_DISMISS);
|
|
311
|
-
};
|
|
312
|
-
MDCSnackbarFoundation.prototype.clearAutoDismissTimer = function () {
|
|
313
|
-
clearTimeout(this.autoDismissTimer);
|
|
314
|
-
this.autoDismissTimer = 0;
|
|
315
|
-
};
|
|
316
|
-
MDCSnackbarFoundation.prototype.handleAnimationTimerEnd = function () {
|
|
317
|
-
this.animationTimer = 0;
|
|
318
|
-
this.adapter.removeClass(cssClasses.OPENING);
|
|
319
|
-
this.adapter.removeClass(cssClasses.CLOSING);
|
|
320
|
-
};
|
|
321
|
-
/**
|
|
322
|
-
* Runs the given logic on the next animation frame, using setTimeout to factor in Firefox reflow behavior.
|
|
323
|
-
*/
|
|
324
|
-
MDCSnackbarFoundation.prototype.runNextAnimationFrame = function (callback) {
|
|
325
|
-
var _this = this;
|
|
326
|
-
cancelAnimationFrame(this.animationFrame);
|
|
327
|
-
this.animationFrame = requestAnimationFrame(function () {
|
|
328
|
-
_this.animationFrame = 0;
|
|
329
|
-
clearTimeout(_this.animationTimer);
|
|
330
|
-
_this.animationTimer = setTimeout(callback, 0);
|
|
331
|
-
});
|
|
332
|
-
};
|
|
333
|
-
return MDCSnackbarFoundation;
|
|
334
|
-
}(component.MDCFoundation));
|
|
335
|
-
|
|
336
|
-
/**
|
|
337
|
-
* @license
|
|
338
|
-
* Copyright 2018 Google Inc.
|
|
339
|
-
*
|
|
340
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
341
|
-
* of this software and associated documentation files (the "Software"), to deal
|
|
342
|
-
* in the Software without restriction, including without limitation the rights
|
|
343
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
344
|
-
* copies of the Software, and to permit persons to whom the Software is
|
|
345
|
-
* furnished to do so, subject to the following conditions:
|
|
346
|
-
*
|
|
347
|
-
* The above copyright notice and this permission notice shall be included in
|
|
348
|
-
* all copies or substantial portions of the Software.
|
|
349
|
-
*
|
|
350
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
351
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
352
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
353
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
354
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
355
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
356
|
-
* THE SOFTWARE.
|
|
357
|
-
*/
|
|
358
|
-
var SURFACE_SELECTOR = strings.SURFACE_SELECTOR, LABEL_SELECTOR = strings.LABEL_SELECTOR, ACTION_SELECTOR = strings.ACTION_SELECTOR, DISMISS_SELECTOR = strings.DISMISS_SELECTOR, OPENING_EVENT = strings.OPENING_EVENT, OPENED_EVENT = strings.OPENED_EVENT, CLOSING_EVENT = strings.CLOSING_EVENT, CLOSED_EVENT = strings.CLOSED_EVENT;
|
|
359
|
-
var MDCSnackbar = /** @class */ (function (_super) {
|
|
360
|
-
component.__extends(MDCSnackbar, _super);
|
|
361
|
-
function MDCSnackbar() {
|
|
362
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
363
|
-
}
|
|
364
|
-
MDCSnackbar.attachTo = function (root) {
|
|
365
|
-
return new MDCSnackbar(root);
|
|
366
|
-
};
|
|
367
|
-
MDCSnackbar.prototype.initialize = function (announcerFactory) {
|
|
368
|
-
if (announcerFactory === void 0) { announcerFactory = function () { return announce; }; }
|
|
369
|
-
this.announce = announcerFactory();
|
|
370
|
-
};
|
|
371
|
-
MDCSnackbar.prototype.initialSyncWithDOM = function () {
|
|
372
|
-
var _this = this;
|
|
373
|
-
this.surfaceEl = this.root.querySelector(SURFACE_SELECTOR);
|
|
374
|
-
this.labelEl = this.root.querySelector(LABEL_SELECTOR);
|
|
375
|
-
this.actionEl = this.root.querySelector(ACTION_SELECTOR);
|
|
376
|
-
this.handleKeyDown = function (evt) {
|
|
377
|
-
_this.foundation.handleKeyDown(evt);
|
|
378
|
-
};
|
|
379
|
-
this.handleSurfaceClick = function (evt) {
|
|
380
|
-
var target = evt.target;
|
|
381
|
-
if (_this.isActionButton(target)) {
|
|
382
|
-
_this.foundation.handleActionButtonClick(evt);
|
|
383
|
-
}
|
|
384
|
-
else if (_this.isActionIcon(target)) {
|
|
385
|
-
_this.foundation.handleActionIconClick(evt);
|
|
386
|
-
}
|
|
387
|
-
};
|
|
388
|
-
this.registerKeyDownHandler(this.handleKeyDown);
|
|
389
|
-
this.registerSurfaceClickHandler(this.handleSurfaceClick);
|
|
390
|
-
};
|
|
391
|
-
MDCSnackbar.prototype.destroy = function () {
|
|
392
|
-
_super.prototype.destroy.call(this);
|
|
393
|
-
this.deregisterKeyDownHandler(this.handleKeyDown);
|
|
394
|
-
this.deregisterSurfaceClickHandler(this.handleSurfaceClick);
|
|
395
|
-
};
|
|
396
|
-
MDCSnackbar.prototype.open = function () {
|
|
397
|
-
this.foundation.open();
|
|
398
|
-
};
|
|
399
|
-
/**
|
|
400
|
-
* @param reason Why the snackbar was closed. Value will be passed to CLOSING_EVENT and CLOSED_EVENT via the
|
|
401
|
-
* `event.detail.reason` property. Standard values are REASON_ACTION and REASON_DISMISS, but custom
|
|
402
|
-
* client-specific values may also be used if desired.
|
|
403
|
-
*/
|
|
404
|
-
MDCSnackbar.prototype.close = function (reason) {
|
|
405
|
-
if (reason === void 0) { reason = ''; }
|
|
406
|
-
this.foundation.close(reason);
|
|
407
|
-
};
|
|
408
|
-
MDCSnackbar.prototype.getDefaultFoundation = function () {
|
|
409
|
-
var _this = this;
|
|
410
|
-
// DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
|
|
411
|
-
// To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
|
|
412
|
-
var adapter = {
|
|
413
|
-
addClass: function (className) {
|
|
414
|
-
_this.root.classList.add(className);
|
|
415
|
-
},
|
|
416
|
-
announce: function () {
|
|
417
|
-
_this.announce(_this.labelEl);
|
|
418
|
-
},
|
|
419
|
-
notifyClosed: function (reason) { return _this.emit(CLOSED_EVENT, reason ? { reason: reason } : {}); },
|
|
420
|
-
notifyClosing: function (reason) { return _this.emit(CLOSING_EVENT, reason ? { reason: reason } : {}); },
|
|
421
|
-
notifyOpened: function () { return _this.emit(OPENED_EVENT, {}); },
|
|
422
|
-
notifyOpening: function () { return _this.emit(OPENING_EVENT, {}); },
|
|
423
|
-
removeClass: function (className) { return _this.root.classList.remove(className); },
|
|
424
|
-
};
|
|
425
|
-
return new MDCSnackbarFoundation(adapter);
|
|
426
|
-
};
|
|
427
|
-
Object.defineProperty(MDCSnackbar.prototype, "timeoutMs", {
|
|
428
|
-
get: function () {
|
|
429
|
-
return this.foundation.getTimeoutMs();
|
|
430
|
-
},
|
|
431
|
-
set: function (timeoutMs) {
|
|
432
|
-
this.foundation.setTimeoutMs(timeoutMs);
|
|
433
|
-
},
|
|
434
|
-
enumerable: false,
|
|
435
|
-
configurable: true
|
|
436
|
-
});
|
|
437
|
-
Object.defineProperty(MDCSnackbar.prototype, "closeOnEscape", {
|
|
438
|
-
get: function () {
|
|
439
|
-
return this.foundation.getCloseOnEscape();
|
|
440
|
-
},
|
|
441
|
-
set: function (closeOnEscape) {
|
|
442
|
-
this.foundation.setCloseOnEscape(closeOnEscape);
|
|
443
|
-
},
|
|
444
|
-
enumerable: false,
|
|
445
|
-
configurable: true
|
|
446
|
-
});
|
|
447
|
-
Object.defineProperty(MDCSnackbar.prototype, "isOpen", {
|
|
448
|
-
get: function () {
|
|
449
|
-
return this.foundation.isOpen();
|
|
450
|
-
},
|
|
451
|
-
enumerable: false,
|
|
452
|
-
configurable: true
|
|
453
|
-
});
|
|
454
|
-
Object.defineProperty(MDCSnackbar.prototype, "labelText", {
|
|
455
|
-
get: function () {
|
|
456
|
-
// This property only returns null if the node is a document, DOCTYPE,
|
|
457
|
-
// or notation. On Element nodes, it always returns a string.
|
|
458
|
-
return this.labelEl.textContent;
|
|
459
|
-
},
|
|
460
|
-
set: function (labelText) {
|
|
461
|
-
this.labelEl.textContent = labelText;
|
|
462
|
-
},
|
|
463
|
-
enumerable: false,
|
|
464
|
-
configurable: true
|
|
465
|
-
});
|
|
466
|
-
Object.defineProperty(MDCSnackbar.prototype, "actionButtonText", {
|
|
467
|
-
get: function () {
|
|
468
|
-
return this.actionEl.textContent;
|
|
469
|
-
},
|
|
470
|
-
set: function (actionButtonText) {
|
|
471
|
-
this.actionEl.textContent = actionButtonText;
|
|
472
|
-
},
|
|
473
|
-
enumerable: false,
|
|
474
|
-
configurable: true
|
|
15
|
+
class SnackbarContainer {
|
|
16
|
+
constructor() {
|
|
17
|
+
this.snackbarElements = [];
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Add a new element to the container
|
|
21
|
+
*
|
|
22
|
+
* @param snackbar - element to add
|
|
23
|
+
*/
|
|
24
|
+
add(snackbar) {
|
|
25
|
+
const popover = this.getPopover(snackbar);
|
|
26
|
+
// Stencil does not seem to recognise the existance of showPopover
|
|
27
|
+
// @ts-ignore
|
|
28
|
+
popover === null || popover === void 0 ? void 0 : popover.showPopover();
|
|
29
|
+
this.snackbarElements = [snackbar, ...this.snackbarElements];
|
|
30
|
+
this.emitOffsets();
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Remove an element from the container
|
|
34
|
+
*
|
|
35
|
+
* @param snackbar - element to remove
|
|
36
|
+
*/
|
|
37
|
+
remove(snackbar) {
|
|
38
|
+
const popover = this.getPopover(snackbar);
|
|
39
|
+
// Stencil does not seem to recognise the existance of hidePopover
|
|
40
|
+
// @ts-ignore
|
|
41
|
+
popover === null || popover === void 0 ? void 0 : popover.hidePopover();
|
|
42
|
+
this.snackbarElements = this.snackbarElements.filter((item) => item !== snackbar);
|
|
43
|
+
this.emitOffsets();
|
|
44
|
+
}
|
|
45
|
+
emitOffsets() {
|
|
46
|
+
let offset = 0;
|
|
47
|
+
this.snackbarElements.forEach((snackbar) => {
|
|
48
|
+
snackbar.dispatchEvent(new CustomEvent('changeOffset', {
|
|
49
|
+
detail: offset,
|
|
50
|
+
}));
|
|
51
|
+
offset += this.getPopover(snackbar).getBoundingClientRect().height;
|
|
475
52
|
});
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
};
|
|
482
|
-
MDCSnackbar.prototype.registerSurfaceClickHandler = function (handler) {
|
|
483
|
-
this.surfaceEl.addEventListener('click', handler);
|
|
484
|
-
};
|
|
485
|
-
MDCSnackbar.prototype.deregisterSurfaceClickHandler = function (handler) {
|
|
486
|
-
this.surfaceEl.removeEventListener('click', handler);
|
|
487
|
-
};
|
|
488
|
-
MDCSnackbar.prototype.isActionButton = function (target) {
|
|
489
|
-
return Boolean(ponyfill.closest(target, ACTION_SELECTOR));
|
|
490
|
-
};
|
|
491
|
-
MDCSnackbar.prototype.isActionIcon = function (target) {
|
|
492
|
-
return Boolean(ponyfill.closest(target, DISMISS_SELECTOR));
|
|
493
|
-
};
|
|
494
|
-
return MDCSnackbar;
|
|
495
|
-
}(component.MDCComponent));
|
|
53
|
+
}
|
|
54
|
+
getPopover(snackbar) {
|
|
55
|
+
return snackbar.shadowRoot.querySelector('[popover]');
|
|
56
|
+
}
|
|
57
|
+
}
|
|
496
58
|
|
|
497
|
-
const snackbarCss = "*{box-sizing:border-box}
|
|
59
|
+
const snackbarCss = "*{box-sizing:border-box}aside{background:none;border:none;inset:unset;overflow:visible;padding:0.5rem 0.5rem 0 0.5rem;right:0;width:var(--limel-snackbar-width, 21rem);top:calc(var(--snackbar-distance-to-top-edge) + env(safe-area-inset-top, 0));transition:opacity var(--limel-snackbar-opacity-transition-speed, 0.2s) ease, top var(--limel-snackbar-top-transition-speed, 0.46s) cubic-bezier(1, 0.09, 0, 0.89), transform var(--limel-snackbar-top-transition-speed, 0.46s) ease;transform:translate3d(0, 0, 0);opacity:1}aside.is-closing{transform:translate3d(2rem, 0, 0);opacity:0;--limel-snackbar-top-transition-speed:0.2s;--limel-snackbar-opacity-transition-speed:0.2s}.surface{overflow:hidden;padding:0.5rem;display:flex;align-items:center;justify-content:flex-start;gap:0.25rem;min-height:3.25rem;border-radius:0.75rem;background-color:rgb(var(--contrast-1400));box-shadow:var(--shadow-depth-8), var(--shadow-depth-16)}.label{color:rgb(var(--contrast-100));-webkit-font-smoothing:antialiased;font-size:0.8125rem;font-weight:400;padding:0 0.25rem;width:100%;flex-grow:1}.actions{display:flex;flex-shrink:0;align-items:center;box-sizing:border-box;gap:0.5rem}.dismiss,.actions{--lime-elevated-surface-background-color:rgb(\n var(--contrast-1300)\n )}.dismiss{--mdc-theme-on-surface:rgb(var(--contrast-100));--icon-background-color:var(--lime-elevated-surface-background-color);--fill-color:var(--mdc-theme-primary);--track-color:rgb(var(--contrast-800), 0.2);transition:opacity 0.1s ease, transform 0.1s ease;position:absolute;top:-0.375rem;left:-0.375rem;transform:scale(0.7);display:flex;align-items:center;justify-content:center}.dismiss svg{position:absolute;transform:rotate(90deg);fill:transparent;stroke-dasharray:100;stroke-linecap:round}aside:popover-open .dismiss svg{animation:timeout var(--snackbar-timeout) linear forwards}.dismiss .is-closing{transform:scale(0.5);opacity:0}.dismiss-button{transform:scale(0.8);margin:0;padding:0}@keyframes timeout{0%{stroke-width:4;stroke-dashoffset:0;opacity:1}100%{stroke-width:1;stroke-dashoffset:-100;opacity:0.7}}";
|
|
498
60
|
|
|
61
|
+
const container = new SnackbarContainer();
|
|
62
|
+
const hideAnimationDuration = 300;
|
|
499
63
|
const Snackbar = class {
|
|
500
64
|
constructor(hostRef) {
|
|
501
65
|
index.registerInstance(this, hostRef);
|
|
502
66
|
this.action = index.createEvent(this, "action", 7);
|
|
503
67
|
this.hide = index.createEvent(this, "hide", 7);
|
|
68
|
+
this.close = () => {
|
|
69
|
+
if (!this.open) {
|
|
70
|
+
return false;
|
|
71
|
+
}
|
|
72
|
+
this.closing = true;
|
|
73
|
+
if (this.timeoutId) {
|
|
74
|
+
clearTimeout(this.timeoutId);
|
|
75
|
+
this.timeoutId = undefined;
|
|
76
|
+
}
|
|
77
|
+
setTimeout(() => {
|
|
78
|
+
this.open = false;
|
|
79
|
+
container.remove(this.host);
|
|
80
|
+
this.hide.emit();
|
|
81
|
+
this.offset = 0;
|
|
82
|
+
}, hideAnimationDuration);
|
|
83
|
+
};
|
|
84
|
+
this.handleClickAction = () => {
|
|
85
|
+
this.action.emit();
|
|
86
|
+
};
|
|
504
87
|
this.message = undefined;
|
|
505
88
|
this.timeout = 5000;
|
|
506
89
|
this.actionText = undefined;
|
|
507
90
|
this.dismissible = true;
|
|
508
91
|
this.multiline = undefined;
|
|
509
92
|
this.language = 'en';
|
|
510
|
-
this.
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
this.
|
|
514
|
-
}
|
|
515
|
-
componentDidLoad() {
|
|
516
|
-
this.initialize();
|
|
93
|
+
this.offset = 0;
|
|
94
|
+
this.open = false;
|
|
95
|
+
this.closing = true;
|
|
96
|
+
this.snackbarId = randomString.createRandomString();
|
|
517
97
|
}
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
return;
|
|
522
|
-
}
|
|
523
|
-
this.mdcSnackbar = new MDCSnackbar(element);
|
|
524
|
-
this.mdcSnackbar.listen('MDCSnackbar:closing', this.handleMdcClosing);
|
|
525
|
-
}
|
|
526
|
-
disconnectedCallback() {
|
|
527
|
-
this.mdcSnackbar.unlisten('MDCSnackbar:closing', this.handleMdcClosing);
|
|
528
|
-
this.mdcSnackbar.destroy();
|
|
98
|
+
onChangeIndex(event) {
|
|
99
|
+
event.stopPropagation();
|
|
100
|
+
this.offset = event.detail;
|
|
529
101
|
}
|
|
530
102
|
/**
|
|
531
103
|
* Show the snackbar
|
|
532
104
|
*/
|
|
533
105
|
async show() {
|
|
106
|
+
if (this.open) {
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
this.open = true;
|
|
110
|
+
this.closing = false;
|
|
111
|
+
container.add(this.host);
|
|
534
112
|
if (this.timeout) {
|
|
535
|
-
this.
|
|
113
|
+
this.timeoutId = window.setTimeout(this.close, Math.max(this.timeout - hideAnimationDuration, 0));
|
|
536
114
|
}
|
|
537
|
-
this.mdcSnackbar.labelText = this.message;
|
|
538
|
-
this.mdcSnackbar.open();
|
|
539
115
|
}
|
|
540
116
|
render() {
|
|
541
|
-
return (index.h("aside", {
|
|
542
|
-
mdc-snackbar
|
|
543
|
-
${this.multiline ? 'mdc-snackbar--stacked' : ''}
|
|
544
|
-
`, style: {
|
|
117
|
+
return (index.h("aside", { popover: "manual", style: {
|
|
545
118
|
'--snackbar-timeout': `${this.timeout}ms`,
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
this.
|
|
551
|
-
}
|
|
552
|
-
else {
|
|
553
|
-
this.hide.emit();
|
|
554
|
-
}
|
|
119
|
+
'--snackbar-distance-to-top-edge': `${this.offset}px`,
|
|
120
|
+
}, class: {
|
|
121
|
+
open: this.open,
|
|
122
|
+
'is-closing': this.closing,
|
|
123
|
+
}, id: this.snackbarId, role: this.open ? 'status' : undefined, "aria-relevant": this.open ? 'additions' : undefined }, index.h("div", { class: "surface", "aria-atomic": "false" }, index.h("div", { class: "label" }, this.message), this.renderActions(this.actionText), this.renderDismissButton(this.dismissible))));
|
|
555
124
|
}
|
|
556
125
|
renderActions(actionText) {
|
|
557
126
|
if (!actionText) {
|
|
558
127
|
return;
|
|
559
128
|
}
|
|
560
|
-
return (index.h("div", { class: "
|
|
129
|
+
return (index.h("div", { class: "actions", "aria-atomic": "true" }, this.renderActionButton(actionText)));
|
|
561
130
|
}
|
|
562
131
|
renderActionButton(actionText) {
|
|
563
132
|
if (!actionText) {
|
|
564
133
|
return;
|
|
565
134
|
}
|
|
566
|
-
return (index.h("limel-button", {
|
|
135
|
+
return (index.h("limel-button", { label: actionText, onClick: this.handleClickAction }));
|
|
567
136
|
}
|
|
568
137
|
renderDismissButton(dismissible) {
|
|
569
138
|
if (!dismissible) {
|
|
570
139
|
return;
|
|
571
140
|
}
|
|
572
141
|
const label = translations.translate.get('snackbar.dismiss', this.language);
|
|
573
|
-
return (index.h("div", { class: "dismiss" }, this.renderTimeoutVisualization(), index.h("limel-icon-button", { class: "
|
|
142
|
+
return (index.h("div", { class: "dismiss" }, this.renderTimeoutVisualization(), index.h("limel-icon-button", { class: "dismiss-button", icon: "multiply", label: label, onClick: this.close, "aria-controls": this.snackbarId })));
|
|
574
143
|
}
|
|
575
144
|
renderTimeoutVisualization() {
|
|
576
145
|
return (index.h("svg", { width: "36", height: "36", viewBox: "0 0 36 36" }, index.h("circle", { r: "18", cx: "18", cy: "18", fill: "var(--track-color)" }), index.h("path", { class: "track", d: "M 18,18 m -16,0 a 16,16 0 1,0 32,0 a 16,16 0 1,0 -32,0", stroke: "var(--fill-color)" })));
|