@limetech/lime-elements 37.55.6 → 37.55.7

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.
Files changed (102) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/cjs/lime-elements.cjs.js +1 -1
  3. package/dist/cjs/limel-dialog.cjs.entry.js +51 -931
  4. package/dist/cjs/limel-dialog.cjs.entry.js.map +1 -1
  5. package/dist/cjs/limel-form.cjs.entry.js +2498 -2498
  6. package/dist/cjs/limel-form.cjs.entry.js.map +1 -1
  7. package/dist/cjs/limel-slider.cjs.entry.js +86 -2
  8. package/dist/cjs/limel-slider.cjs.entry.js.map +1 -1
  9. package/dist/cjs/loader.cjs.js +1 -1
  10. package/dist/collection/components/dialog/dialog.css +79 -679
  11. package/dist/collection/components/dialog/dialog.js +58 -62
  12. package/dist/collection/components/dialog/dialog.js.map +1 -1
  13. package/dist/esm/{_arrayIncludesWith-8fac90b7.js → _arrayIncludesWith-37fb8c3e.js} +3 -3
  14. package/dist/esm/{_arrayIncludesWith-8fac90b7.js.map → _arrayIncludesWith-37fb8c3e.js.map} +1 -1
  15. package/dist/esm/{_baseForOwn-6eb68438.js → _baseForOwn-fff53ded.js} +2 -2
  16. package/dist/esm/{_baseForOwn-6eb68438.js.map → _baseForOwn-fff53ded.js.map} +1 -1
  17. package/dist/esm/{_baseIsEqual-f751b77f.js → _baseIsEqual-f3eeaadf.js} +3 -3
  18. package/dist/esm/{_baseIsEqual-f751b77f.js.map → _baseIsEqual-f3eeaadf.js.map} +1 -1
  19. package/dist/esm/{_baseIteratee-77de5982.js → _baseIteratee-b8e533f5.js} +3 -3
  20. package/dist/esm/{_baseIteratee-77de5982.js.map → _baseIteratee-b8e533f5.js.map} +1 -1
  21. package/dist/esm/{_getAllKeysIn-f5fc1fe7.js → _getAllKeysIn-4936435d.js} +3 -3
  22. package/dist/esm/{_getAllKeysIn-f5fc1fe7.js.map → _getAllKeysIn-4936435d.js.map} +1 -1
  23. package/dist/esm/{isArrayLike-385e0f31.js → isArrayLike-dd37ba9a.js} +2 -2
  24. package/dist/esm/{isArrayLike-385e0f31.js.map → isArrayLike-dd37ba9a.js.map} +1 -1
  25. package/dist/esm/{isEmpty-3b1e5881.js → isEmpty-d700c746.js} +3 -3
  26. package/dist/esm/{isEmpty-3b1e5881.js.map → isEmpty-d700c746.js.map} +1 -1
  27. package/dist/esm/{isEqual-90c6e6fc.js → isEqual-883988f1.js} +2 -2
  28. package/dist/esm/{isEqual-90c6e6fc.js.map → isEqual-883988f1.js.map} +1 -1
  29. package/dist/esm/lime-elements.js +1 -1
  30. package/dist/esm/limel-chip_2.entry.js +4 -4
  31. package/dist/esm/limel-dialog.entry.js +51 -931
  32. package/dist/esm/limel-dialog.entry.js.map +1 -1
  33. package/dist/esm/limel-file-dropzone_2.entry.js +4 -4
  34. package/dist/esm/limel-flatpickr-adapter.entry.js +1 -1
  35. package/dist/esm/limel-form.entry.js +2507 -2507
  36. package/dist/esm/limel-form.entry.js.map +1 -1
  37. package/dist/esm/limel-prosemirror-adapter.entry.js +4 -4
  38. package/dist/esm/limel-slider.entry.js +85 -1
  39. package/dist/esm/limel-slider.entry.js.map +1 -1
  40. package/dist/esm/limel-tab-bar.entry.js +4 -4
  41. package/dist/esm/limel-table.entry.js +6 -6
  42. package/dist/esm/loader.js +1 -1
  43. package/dist/esm/{pickBy-7b1558ef.js → pickBy-923628c8.js} +4 -4
  44. package/dist/esm/{pickBy-7b1558ef.js.map → pickBy-923628c8.js.map} +1 -1
  45. package/dist/lime-elements/lime-elements.esm.js +1 -1
  46. package/dist/lime-elements/lime-elements.esm.js.map +1 -1
  47. package/dist/lime-elements/{p-efe6d8b9.entry.js → p-09792bbf.entry.js} +2 -2
  48. package/dist/lime-elements/{p-f1d08f33.entry.js → p-33733088.entry.js} +2 -2
  49. package/dist/lime-elements/p-3d88b583.js +2 -0
  50. package/dist/lime-elements/p-57906760.js +2 -0
  51. package/dist/lime-elements/{p-a28fa78d.js.map → p-57906760.js.map} +1 -1
  52. package/dist/lime-elements/p-69b694b5.js +2 -0
  53. package/dist/lime-elements/{p-038bd215.js.map → p-69b694b5.js.map} +1 -1
  54. package/dist/lime-elements/p-6a3d0141.js +2 -0
  55. package/dist/lime-elements/p-7377db39.js +2 -0
  56. package/dist/lime-elements/{p-2b06f854.entry.js → p-75b4a7aa.entry.js} +2 -2
  57. package/dist/lime-elements/p-785755e9.js +2 -0
  58. package/dist/lime-elements/{p-0ec8eec7.js.map → p-785755e9.js.map} +1 -1
  59. package/dist/lime-elements/{p-9acf7b5d.js → p-7f43b0c4.js} +2 -2
  60. package/dist/lime-elements/{p-347c1107.entry.js → p-82af91ed.entry.js} +2 -2
  61. package/dist/lime-elements/p-836774a8.js +2 -0
  62. package/dist/lime-elements/p-9b51660b.entry.js +21 -0
  63. package/dist/lime-elements/p-9b51660b.entry.js.map +1 -0
  64. package/dist/lime-elements/p-b11ab47e.entry.js +2 -0
  65. package/dist/lime-elements/p-b11ab47e.entry.js.map +1 -0
  66. package/dist/lime-elements/{p-9375145d.entry.js → p-d505de95.entry.js} +27 -5
  67. package/dist/lime-elements/p-d505de95.entry.js.map +1 -0
  68. package/dist/lime-elements/{p-178bbeb4.entry.js → p-e53fae23.entry.js} +2 -2
  69. package/dist/lime-elements/{p-1b9d3851.js → p-f069e11f.js} +2 -2
  70. package/dist/lime-elements/{p-36b385b2.entry.js → p-f629e2bf.entry.js} +2 -2
  71. package/dist/types/components/dialog/dialog.d.ts +5 -8
  72. package/package.json +1 -1
  73. package/dist/cjs/animationframe-e4c1798e.js +0 -90
  74. package/dist/cjs/animationframe-e4c1798e.js.map +0 -1
  75. package/dist/esm/animationframe-b52af02d.js +0 -88
  76. package/dist/esm/animationframe-b52af02d.js.map +0 -1
  77. package/dist/lime-elements/p-038bd215.js +0 -2
  78. package/dist/lime-elements/p-0ec8eec7.js +0 -2
  79. package/dist/lime-elements/p-22704cbc.js +0 -2
  80. package/dist/lime-elements/p-48105d44.js +0 -24
  81. package/dist/lime-elements/p-48105d44.js.map +0 -1
  82. package/dist/lime-elements/p-48ef6a20.js +0 -2
  83. package/dist/lime-elements/p-50303eb1.entry.js +0 -21
  84. package/dist/lime-elements/p-50303eb1.entry.js.map +0 -1
  85. package/dist/lime-elements/p-9375145d.entry.js.map +0 -1
  86. package/dist/lime-elements/p-a28fa78d.js +0 -2
  87. package/dist/lime-elements/p-adf6cbe8.entry.js +0 -112
  88. package/dist/lime-elements/p-adf6cbe8.entry.js.map +0 -1
  89. package/dist/lime-elements/p-d0bdb2e3.js +0 -2
  90. package/dist/lime-elements/p-d4029e33.js +0 -2
  91. /package/dist/lime-elements/{p-efe6d8b9.entry.js.map → p-09792bbf.entry.js.map} +0 -0
  92. /package/dist/lime-elements/{p-f1d08f33.entry.js.map → p-33733088.entry.js.map} +0 -0
  93. /package/dist/lime-elements/{p-48ef6a20.js.map → p-3d88b583.js.map} +0 -0
  94. /package/dist/lime-elements/{p-d4029e33.js.map → p-6a3d0141.js.map} +0 -0
  95. /package/dist/lime-elements/{p-d0bdb2e3.js.map → p-7377db39.js.map} +0 -0
  96. /package/dist/lime-elements/{p-2b06f854.entry.js.map → p-75b4a7aa.entry.js.map} +0 -0
  97. /package/dist/lime-elements/{p-9acf7b5d.js.map → p-7f43b0c4.js.map} +0 -0
  98. /package/dist/lime-elements/{p-347c1107.entry.js.map → p-82af91ed.entry.js.map} +0 -0
  99. /package/dist/lime-elements/{p-22704cbc.js.map → p-836774a8.js.map} +0 -0
  100. /package/dist/lime-elements/{p-178bbeb4.entry.js.map → p-e53fae23.entry.js.map} +0 -0
  101. /package/dist/lime-elements/{p-1b9d3851.js.map → p-f069e11f.js.map} +0 -0
  102. /package/dist/lime-elements/{p-36b385b2.entry.js.map → p-f629e2bf.entry.js.map} +0 -0
@@ -1,879 +1,7 @@
1
1
  import { r as registerInstance, c as createEvent, h, g as getElement } from './index-6156b4fd.js';
2
- import { d as dispatchResizeEvent } from './dispatch-resize-event-cd1d230c.js';
3
2
  import { c as createRandomString } from './random-string-812b1c35.js';
4
- import { _ as __extends, a as __assign, M as MDCFoundation, c as __values, b as MDCComponent } from './component-8b6ce3e9.js';
5
- import { m as matches, c as closest } from './ponyfill-30263d5e.js';
6
- import { M as MDCRipple } from './component-f972b8db.js';
7
- import { A as AnimationFrame } from './animationframe-b52af02d.js';
8
- import { i as isEqual } from './isEqual-90c6e6fc.js';
9
- import './_baseIsEqual-f751b77f.js';
10
- import './eq-c1c7f528.js';
11
- import './isObject-c74e273c.js';
12
- import './_getNative-93d6bfe9.js';
13
- import './isArray-80298bc7.js';
14
- import './isObjectLike-38996507.js';
15
- import './isArrayLike-385e0f31.js';
16
3
 
17
- /**
18
- * @license
19
- * Copyright 2016 Google Inc.
20
- *
21
- * Permission is hereby granted, free of charge, to any person obtaining a copy
22
- * of this software and associated documentation files (the "Software"), to deal
23
- * in the Software without restriction, including without limitation the rights
24
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
25
- * copies of the Software, and to permit persons to whom the Software is
26
- * furnished to do so, subject to the following conditions:
27
- *
28
- * The above copyright notice and this permission notice shall be included in
29
- * all copies or substantial portions of the Software.
30
- *
31
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
32
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
33
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
34
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
35
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
36
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
37
- * THE SOFTWARE.
38
- */
39
- function createFocusTrapInstance(surfaceEl, focusTrapFactory, initialFocusEl) {
40
- return focusTrapFactory(surfaceEl, { initialFocusEl: initialFocusEl });
41
- }
42
- function isScrollable(el) {
43
- return el ? el.scrollHeight > el.offsetHeight : false;
44
- }
45
- /**
46
- * For scrollable content, returns true if the content has not been scrolled
47
- * (that is, the scroll content is as the "top"). This is used in full-screen
48
- * dialogs, where the scroll divider is expected only to appear once the
49
- * content has been scrolled "underneath" the header bar.
50
- */
51
- function isScrollAtTop(el) {
52
- return el ? el.scrollTop === 0 : false;
53
- }
54
- /**
55
- * For scrollable content, returns true if the content has been scrolled all the
56
- * way to the bottom. This is used in full-screen dialogs, where the footer
57
- * scroll divider is expected only to appear when the content is "cut-off" by
58
- * the footer bar.
59
- */
60
- function isScrollAtBottom(el) {
61
- return el ? Math.ceil(el.scrollHeight - el.scrollTop) === el.clientHeight :
62
- false;
63
- }
64
- function areTopsMisaligned(els) {
65
- var tops = new Set();
66
- [].forEach.call(els, function (el) { return tops.add(el.offsetTop); });
67
- return tops.size > 1;
68
- }
69
-
70
- /**
71
- * @license
72
- * Copyright 2020 Google Inc.
73
- *
74
- * Permission is hereby granted, free of charge, to any person obtaining a copy
75
- * of this software and associated documentation files (the "Software"), to deal
76
- * in the Software without restriction, including without limitation the rights
77
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
78
- * copies of the Software, and to permit persons to whom the Software is
79
- * furnished to do so, subject to the following conditions:
80
- *
81
- * The above copyright notice and this permission notice shall be included in
82
- * all copies or substantial portions of the Software.
83
- *
84
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
85
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
86
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
87
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
88
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
89
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
90
- * THE SOFTWARE.
91
- */
92
- var FOCUS_SENTINEL_CLASS = 'mdc-dom-focus-sentinel';
93
- /**
94
- * Utility to trap focus in a given root element, e.g. for modal components such
95
- * as dialogs. The root should have at least one focusable child element,
96
- * for setting initial focus when trapping focus.
97
- * Also tracks the previously focused element, and restores focus to that
98
- * element when releasing focus.
99
- */
100
- var FocusTrap = /** @class */ (function () {
101
- function FocusTrap(root, options) {
102
- if (options === void 0) { options = {}; }
103
- this.root = root;
104
- this.options = options;
105
- // Previously focused element before trapping focus.
106
- this.elFocusedBeforeTrapFocus = null;
107
- }
108
- /**
109
- * Traps focus in `root`. Also focuses on either `initialFocusEl` if set;
110
- * otherwises sets initial focus to the first focusable child element.
111
- */
112
- FocusTrap.prototype.trapFocus = function () {
113
- var focusableEls = this.getFocusableElements(this.root);
114
- if (focusableEls.length === 0) {
115
- throw new Error('FocusTrap: Element must have at least one focusable child.');
116
- }
117
- this.elFocusedBeforeTrapFocus =
118
- document.activeElement instanceof HTMLElement ? document.activeElement :
119
- null;
120
- this.wrapTabFocus(this.root);
121
- if (!this.options.skipInitialFocus) {
122
- this.focusInitialElement(focusableEls, this.options.initialFocusEl);
123
- }
124
- };
125
- /**
126
- * Releases focus from `root`. Also restores focus to the previously focused
127
- * element.
128
- */
129
- FocusTrap.prototype.releaseFocus = function () {
130
- [].slice.call(this.root.querySelectorAll("." + FOCUS_SENTINEL_CLASS))
131
- .forEach(function (sentinelEl) {
132
- sentinelEl.parentElement.removeChild(sentinelEl);
133
- });
134
- if (!this.options.skipRestoreFocus && this.elFocusedBeforeTrapFocus) {
135
- this.elFocusedBeforeTrapFocus.focus();
136
- }
137
- };
138
- /**
139
- * Wraps tab focus within `el` by adding two hidden sentinel divs which are
140
- * used to mark the beginning and the end of the tabbable region. When
141
- * focused, these sentinel elements redirect focus to the first/last
142
- * children elements of the tabbable region, ensuring that focus is trapped
143
- * within that region.
144
- */
145
- FocusTrap.prototype.wrapTabFocus = function (el) {
146
- var _this = this;
147
- var sentinelStart = this.createSentinel();
148
- var sentinelEnd = this.createSentinel();
149
- sentinelStart.addEventListener('focus', function () {
150
- var focusableEls = _this.getFocusableElements(el);
151
- if (focusableEls.length > 0) {
152
- focusableEls[focusableEls.length - 1].focus();
153
- }
154
- });
155
- sentinelEnd.addEventListener('focus', function () {
156
- var focusableEls = _this.getFocusableElements(el);
157
- if (focusableEls.length > 0) {
158
- focusableEls[0].focus();
159
- }
160
- });
161
- el.insertBefore(sentinelStart, el.children[0]);
162
- el.appendChild(sentinelEnd);
163
- };
164
- /**
165
- * Focuses on `initialFocusEl` if defined and a child of the root element.
166
- * Otherwise, focuses on the first focusable child element of the root.
167
- */
168
- FocusTrap.prototype.focusInitialElement = function (focusableEls, initialFocusEl) {
169
- var focusIndex = 0;
170
- if (initialFocusEl) {
171
- focusIndex = Math.max(focusableEls.indexOf(initialFocusEl), 0);
172
- }
173
- focusableEls[focusIndex].focus();
174
- };
175
- FocusTrap.prototype.getFocusableElements = function (root) {
176
- var focusableEls = [].slice.call(root.querySelectorAll('[autofocus], [tabindex], a, input, textarea, select, button'));
177
- return focusableEls.filter(function (el) {
178
- var isDisabledOrHidden = el.getAttribute('aria-disabled') === 'true' ||
179
- el.getAttribute('disabled') != null ||
180
- el.getAttribute('hidden') != null ||
181
- el.getAttribute('aria-hidden') === 'true';
182
- var isTabbableAndVisible = el.tabIndex >= 0 &&
183
- el.getBoundingClientRect().width > 0 &&
184
- !el.classList.contains(FOCUS_SENTINEL_CLASS) && !isDisabledOrHidden;
185
- var isProgrammaticallyHidden = false;
186
- if (isTabbableAndVisible) {
187
- var style = getComputedStyle(el);
188
- isProgrammaticallyHidden =
189
- style.display === 'none' || style.visibility === 'hidden';
190
- }
191
- return isTabbableAndVisible && !isProgrammaticallyHidden;
192
- });
193
- };
194
- FocusTrap.prototype.createSentinel = function () {
195
- var sentinel = document.createElement('div');
196
- sentinel.setAttribute('tabindex', '0');
197
- // Don't announce in screen readers.
198
- sentinel.setAttribute('aria-hidden', 'true');
199
- sentinel.classList.add(FOCUS_SENTINEL_CLASS);
200
- return sentinel;
201
- };
202
- return FocusTrap;
203
- }());
204
-
205
- /**
206
- * @license
207
- * Copyright 2016 Google Inc.
208
- *
209
- * Permission is hereby granted, free of charge, to any person obtaining a copy
210
- * of this software and associated documentation files (the "Software"), to deal
211
- * in the Software without restriction, including without limitation the rights
212
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
213
- * copies of the Software, and to permit persons to whom the Software is
214
- * furnished to do so, subject to the following conditions:
215
- *
216
- * The above copyright notice and this permission notice shall be included in
217
- * all copies or substantial portions of the Software.
218
- *
219
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
220
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
221
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
222
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
223
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
224
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
225
- * THE SOFTWARE.
226
- */
227
- var cssClasses = {
228
- CLOSING: 'mdc-dialog--closing',
229
- OPEN: 'mdc-dialog--open',
230
- OPENING: 'mdc-dialog--opening',
231
- SCROLLABLE: 'mdc-dialog--scrollable',
232
- SCROLL_LOCK: 'mdc-dialog-scroll-lock',
233
- STACKED: 'mdc-dialog--stacked',
234
- FULLSCREEN: 'mdc-dialog--fullscreen',
235
- // Class for showing a scroll divider on full-screen dialog header element.
236
- // Should only be displayed on scrollable content, when the dialog content is
237
- // scrolled "underneath" the header.
238
- SCROLL_DIVIDER_HEADER: 'mdc-dialog-scroll-divider-header',
239
- // Class for showing a scroll divider on a full-screen dialog footer element.
240
- // Should only be displayed on scrolalble content, when the dialog content is
241
- // obscured "underneath" the footer.
242
- SCROLL_DIVIDER_FOOTER: 'mdc-dialog-scroll-divider-footer',
243
- // The "surface scrim" is a scrim covering only the surface of a dialog. This
244
- // is used in situations where a confirmation dialog is shown over an already
245
- // opened full-screen dialog. On larger screen-sizes, the full-screen dialog
246
- // is sized as a modal and so in these situations we display a "surface scrim"
247
- // to prevent a "double scrim" (where the scrim from the secondary
248
- // confirmation dialog would overlap with the scrim from the full-screen
249
- // dialog).
250
- SURFACE_SCRIM_SHOWN: 'mdc-dialog__surface-scrim--shown',
251
- // "Showing" animating class for the surface-scrim.
252
- SURFACE_SCRIM_SHOWING: 'mdc-dialog__surface-scrim--showing',
253
- // "Hiding" animating class for the surface-scrim.
254
- SURFACE_SCRIM_HIDING: 'mdc-dialog__surface-scrim--hiding',
255
- // Class to hide a dialog's scrim (used in conjunction with a surface-scrim).
256
- // Note that we only hide the original scrim rather than removing it entirely
257
- // to prevent interactions with the content behind this scrim, and to capture
258
- // scrim clicks.
259
- SCRIM_HIDDEN: 'mdc-dialog__scrim--hidden',
260
- };
261
- var strings$1 = {
262
- ACTION_ATTRIBUTE: 'data-mdc-dialog-action',
263
- BUTTON_DEFAULT_ATTRIBUTE: 'data-mdc-dialog-button-default',
264
- BUTTON_SELECTOR: '.mdc-dialog__button',
265
- CLOSED_EVENT: 'MDCDialog:closed',
266
- CLOSE_ACTION: 'close',
267
- CLOSING_EVENT: 'MDCDialog:closing',
268
- CONTAINER_SELECTOR: '.mdc-dialog__container',
269
- CONTENT_SELECTOR: '.mdc-dialog__content',
270
- DESTROY_ACTION: 'destroy',
271
- INITIAL_FOCUS_ATTRIBUTE: 'data-mdc-dialog-initial-focus',
272
- OPENED_EVENT: 'MDCDialog:opened',
273
- OPENING_EVENT: 'MDCDialog:opening',
274
- SCRIM_SELECTOR: '.mdc-dialog__scrim',
275
- SUPPRESS_DEFAULT_PRESS_SELECTOR: [
276
- 'textarea',
277
- '.mdc-menu .mdc-list-item',
278
- '.mdc-menu .mdc-deprecated-list-item',
279
- ].join(', '),
280
- SURFACE_SELECTOR: '.mdc-dialog__surface',
281
- };
282
- var numbers = {
283
- DIALOG_ANIMATION_CLOSE_TIME_MS: 75,
284
- DIALOG_ANIMATION_OPEN_TIME_MS: 150,
285
- };
286
-
287
- /**
288
- * @license
289
- * Copyright 2017 Google Inc.
290
- *
291
- * Permission is hereby granted, free of charge, to any person obtaining a copy
292
- * of this software and associated documentation files (the "Software"), to deal
293
- * in the Software without restriction, including without limitation the rights
294
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
295
- * copies of the Software, and to permit persons to whom the Software is
296
- * furnished to do so, subject to the following conditions:
297
- *
298
- * The above copyright notice and this permission notice shall be included in
299
- * all copies or substantial portions of the Software.
300
- *
301
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
302
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
303
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
304
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
305
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
306
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
307
- * THE SOFTWARE.
308
- */
309
- var AnimationKeys;
310
- (function (AnimationKeys) {
311
- AnimationKeys["POLL_SCROLL_POS"] = "poll_scroll_position";
312
- AnimationKeys["POLL_LAYOUT_CHANGE"] = "poll_layout_change";
313
- })(AnimationKeys || (AnimationKeys = {}));
314
- var MDCDialogFoundation = /** @class */ (function (_super) {
315
- __extends(MDCDialogFoundation, _super);
316
- function MDCDialogFoundation(adapter) {
317
- var _this = _super.call(this, __assign(__assign({}, MDCDialogFoundation.defaultAdapter), adapter)) || this;
318
- _this.dialogOpen = false;
319
- _this.isFullscreen = false;
320
- _this.animationFrame = 0;
321
- _this.animationTimer = 0;
322
- _this.escapeKeyAction = strings$1.CLOSE_ACTION;
323
- _this.scrimClickAction = strings$1.CLOSE_ACTION;
324
- _this.autoStackButtons = true;
325
- _this.areButtonsStacked = false;
326
- _this.suppressDefaultPressSelector = strings$1.SUPPRESS_DEFAULT_PRESS_SELECTOR;
327
- _this.animFrame = new AnimationFrame();
328
- _this.contentScrollHandler = function () {
329
- _this.handleScrollEvent();
330
- };
331
- _this.windowResizeHandler = function () {
332
- _this.layout();
333
- };
334
- _this.windowOrientationChangeHandler = function () {
335
- _this.layout();
336
- };
337
- return _this;
338
- }
339
- Object.defineProperty(MDCDialogFoundation, "cssClasses", {
340
- get: function () {
341
- return cssClasses;
342
- },
343
- enumerable: false,
344
- configurable: true
345
- });
346
- Object.defineProperty(MDCDialogFoundation, "strings", {
347
- get: function () {
348
- return strings$1;
349
- },
350
- enumerable: false,
351
- configurable: true
352
- });
353
- Object.defineProperty(MDCDialogFoundation, "numbers", {
354
- get: function () {
355
- return numbers;
356
- },
357
- enumerable: false,
358
- configurable: true
359
- });
360
- Object.defineProperty(MDCDialogFoundation, "defaultAdapter", {
361
- get: function () {
362
- return {
363
- addBodyClass: function () { return undefined; },
364
- addClass: function () { return undefined; },
365
- areButtonsStacked: function () { return false; },
366
- clickDefaultButton: function () { return undefined; },
367
- eventTargetMatches: function () { return false; },
368
- getActionFromEvent: function () { return ''; },
369
- getInitialFocusEl: function () { return null; },
370
- hasClass: function () { return false; },
371
- isContentScrollable: function () { return false; },
372
- notifyClosed: function () { return undefined; },
373
- notifyClosing: function () { return undefined; },
374
- notifyOpened: function () { return undefined; },
375
- notifyOpening: function () { return undefined; },
376
- releaseFocus: function () { return undefined; },
377
- removeBodyClass: function () { return undefined; },
378
- removeClass: function () { return undefined; },
379
- reverseButtons: function () { return undefined; },
380
- trapFocus: function () { return undefined; },
381
- registerContentEventHandler: function () { return undefined; },
382
- deregisterContentEventHandler: function () { return undefined; },
383
- isScrollableContentAtTop: function () { return false; },
384
- isScrollableContentAtBottom: function () { return false; },
385
- registerWindowEventHandler: function () { return undefined; },
386
- deregisterWindowEventHandler: function () { return undefined; },
387
- };
388
- },
389
- enumerable: false,
390
- configurable: true
391
- });
392
- MDCDialogFoundation.prototype.init = function () {
393
- if (this.adapter.hasClass(cssClasses.STACKED)) {
394
- this.setAutoStackButtons(false);
395
- }
396
- this.isFullscreen = this.adapter.hasClass(cssClasses.FULLSCREEN);
397
- };
398
- MDCDialogFoundation.prototype.destroy = function () {
399
- if (this.animationTimer) {
400
- clearTimeout(this.animationTimer);
401
- this.handleAnimationTimerEnd();
402
- }
403
- if (this.isFullscreen) {
404
- this.adapter.deregisterContentEventHandler('scroll', this.contentScrollHandler);
405
- }
406
- this.animFrame.cancelAll();
407
- this.adapter.deregisterWindowEventHandler('resize', this.windowResizeHandler);
408
- this.adapter.deregisterWindowEventHandler('orientationchange', this.windowOrientationChangeHandler);
409
- };
410
- MDCDialogFoundation.prototype.open = function (dialogOptions) {
411
- var _this = this;
412
- this.dialogOpen = true;
413
- this.adapter.notifyOpening();
414
- this.adapter.addClass(cssClasses.OPENING);
415
- if (this.isFullscreen) {
416
- // A scroll event listener is registered even if the dialog is not
417
- // scrollable on open, since the window resize event, or orientation
418
- // change may make the dialog scrollable after it is opened.
419
- this.adapter.registerContentEventHandler('scroll', this.contentScrollHandler);
420
- }
421
- if (dialogOptions && dialogOptions.isAboveFullscreenDialog) {
422
- this.adapter.addClass(cssClasses.SCRIM_HIDDEN);
423
- }
424
- this.adapter.registerWindowEventHandler('resize', this.windowResizeHandler);
425
- this.adapter.registerWindowEventHandler('orientationchange', this.windowOrientationChangeHandler);
426
- // Wait a frame once display is no longer "none", to establish basis for
427
- // animation
428
- this.runNextAnimationFrame(function () {
429
- _this.adapter.addClass(cssClasses.OPEN);
430
- _this.adapter.addBodyClass(cssClasses.SCROLL_LOCK);
431
- _this.layout();
432
- _this.animationTimer = setTimeout(function () {
433
- _this.handleAnimationTimerEnd();
434
- _this.adapter.trapFocus(_this.adapter.getInitialFocusEl());
435
- _this.adapter.notifyOpened();
436
- }, numbers.DIALOG_ANIMATION_OPEN_TIME_MS);
437
- });
438
- };
439
- MDCDialogFoundation.prototype.close = function (action) {
440
- var _this = this;
441
- if (action === void 0) { action = ''; }
442
- if (!this.dialogOpen) {
443
- // Avoid redundant close calls (and events), e.g. from keydown on elements
444
- // that inherently emit click
445
- return;
446
- }
447
- this.dialogOpen = false;
448
- this.adapter.notifyClosing(action);
449
- this.adapter.addClass(cssClasses.CLOSING);
450
- this.adapter.removeClass(cssClasses.OPEN);
451
- this.adapter.removeBodyClass(cssClasses.SCROLL_LOCK);
452
- if (this.isFullscreen) {
453
- this.adapter.deregisterContentEventHandler('scroll', this.contentScrollHandler);
454
- }
455
- this.adapter.deregisterWindowEventHandler('resize', this.windowResizeHandler);
456
- this.adapter.deregisterWindowEventHandler('orientationchange', this.windowOrientationChangeHandler);
457
- cancelAnimationFrame(this.animationFrame);
458
- this.animationFrame = 0;
459
- clearTimeout(this.animationTimer);
460
- this.animationTimer = setTimeout(function () {
461
- _this.adapter.releaseFocus();
462
- _this.handleAnimationTimerEnd();
463
- _this.adapter.notifyClosed(action);
464
- }, numbers.DIALOG_ANIMATION_CLOSE_TIME_MS);
465
- };
466
- /**
467
- * Used only in instances of showing a secondary dialog over a full-screen
468
- * dialog. Shows the "surface scrim" displayed over the full-screen dialog.
469
- */
470
- MDCDialogFoundation.prototype.showSurfaceScrim = function () {
471
- var _this = this;
472
- this.adapter.addClass(cssClasses.SURFACE_SCRIM_SHOWING);
473
- this.runNextAnimationFrame(function () {
474
- _this.adapter.addClass(cssClasses.SURFACE_SCRIM_SHOWN);
475
- });
476
- };
477
- /**
478
- * Used only in instances of showing a secondary dialog over a full-screen
479
- * dialog. Hides the "surface scrim" displayed over the full-screen dialog.
480
- */
481
- MDCDialogFoundation.prototype.hideSurfaceScrim = function () {
482
- this.adapter.removeClass(cssClasses.SURFACE_SCRIM_SHOWN);
483
- this.adapter.addClass(cssClasses.SURFACE_SCRIM_HIDING);
484
- };
485
- /**
486
- * Handles `transitionend` event triggered when surface scrim animation is
487
- * finished.
488
- */
489
- MDCDialogFoundation.prototype.handleSurfaceScrimTransitionEnd = function () {
490
- this.adapter.removeClass(cssClasses.SURFACE_SCRIM_HIDING);
491
- this.adapter.removeClass(cssClasses.SURFACE_SCRIM_SHOWING);
492
- };
493
- MDCDialogFoundation.prototype.isOpen = function () {
494
- return this.dialogOpen;
495
- };
496
- MDCDialogFoundation.prototype.getEscapeKeyAction = function () {
497
- return this.escapeKeyAction;
498
- };
499
- MDCDialogFoundation.prototype.setEscapeKeyAction = function (action) {
500
- this.escapeKeyAction = action;
501
- };
502
- MDCDialogFoundation.prototype.getScrimClickAction = function () {
503
- return this.scrimClickAction;
504
- };
505
- MDCDialogFoundation.prototype.setScrimClickAction = function (action) {
506
- this.scrimClickAction = action;
507
- };
508
- MDCDialogFoundation.prototype.getAutoStackButtons = function () {
509
- return this.autoStackButtons;
510
- };
511
- MDCDialogFoundation.prototype.setAutoStackButtons = function (autoStack) {
512
- this.autoStackButtons = autoStack;
513
- };
514
- MDCDialogFoundation.prototype.getSuppressDefaultPressSelector = function () {
515
- return this.suppressDefaultPressSelector;
516
- };
517
- MDCDialogFoundation.prototype.setSuppressDefaultPressSelector = function (selector) {
518
- this.suppressDefaultPressSelector = selector;
519
- };
520
- MDCDialogFoundation.prototype.layout = function () {
521
- var _this = this;
522
- this.animFrame.request(AnimationKeys.POLL_LAYOUT_CHANGE, function () {
523
- _this.layoutInternal();
524
- });
525
- };
526
- /** Handles click on the dialog root element. */
527
- MDCDialogFoundation.prototype.handleClick = function (evt) {
528
- var isScrim = this.adapter.eventTargetMatches(evt.target, strings$1.SCRIM_SELECTOR);
529
- // Check for scrim click first since it doesn't require querying ancestors.
530
- if (isScrim && this.scrimClickAction !== '') {
531
- this.close(this.scrimClickAction);
532
- }
533
- else {
534
- var action = this.adapter.getActionFromEvent(evt);
535
- if (action) {
536
- this.close(action);
537
- }
538
- }
539
- };
540
- /** Handles keydown on the dialog root element. */
541
- MDCDialogFoundation.prototype.handleKeydown = function (evt) {
542
- var isEnter = evt.key === 'Enter' || evt.keyCode === 13;
543
- if (!isEnter) {
544
- return;
545
- }
546
- var action = this.adapter.getActionFromEvent(evt);
547
- if (action) {
548
- // Action button callback is handled in `handleClick`,
549
- // since space/enter keydowns on buttons trigger click events.
550
- return;
551
- }
552
- // `composedPath` is used here, when available, to account for use cases
553
- // where a target meant to suppress the default press behaviour
554
- // may exist in a shadow root.
555
- // For example, a textarea inside a web component:
556
- // <mwc-dialog>
557
- // <horizontal-layout>
558
- // #shadow-root (open)
559
- // <mwc-textarea>
560
- // #shadow-root (open)
561
- // <textarea></textarea>
562
- // </mwc-textarea>
563
- // </horizontal-layout>
564
- // </mwc-dialog>
565
- var target = evt.composedPath ? evt.composedPath()[0] : evt.target;
566
- var isDefault = this.suppressDefaultPressSelector ?
567
- !this.adapter.eventTargetMatches(target, this.suppressDefaultPressSelector) :
568
- true;
569
- if (isEnter && isDefault) {
570
- this.adapter.clickDefaultButton();
571
- }
572
- };
573
- /** Handles keydown on the document. */
574
- MDCDialogFoundation.prototype.handleDocumentKeydown = function (evt) {
575
- var isEscape = evt.key === 'Escape' || evt.keyCode === 27;
576
- if (isEscape && this.escapeKeyAction !== '') {
577
- this.close(this.escapeKeyAction);
578
- }
579
- };
580
- /**
581
- * Handles scroll event on the dialog's content element -- showing a scroll
582
- * divider on the header or footer based on the scroll position. This handler
583
- * should only be registered on full-screen dialogs with scrollable content.
584
- */
585
- MDCDialogFoundation.prototype.handleScrollEvent = function () {
586
- var _this = this;
587
- // Since scroll events can fire at a high rate, we throttle these events by
588
- // using requestAnimationFrame.
589
- this.animFrame.request(AnimationKeys.POLL_SCROLL_POS, function () {
590
- _this.toggleScrollDividerHeader();
591
- _this.toggleScrollDividerFooter();
592
- });
593
- };
594
- MDCDialogFoundation.prototype.layoutInternal = function () {
595
- if (this.autoStackButtons) {
596
- this.detectStackedButtons();
597
- }
598
- this.toggleScrollableClasses();
599
- };
600
- MDCDialogFoundation.prototype.handleAnimationTimerEnd = function () {
601
- this.animationTimer = 0;
602
- this.adapter.removeClass(cssClasses.OPENING);
603
- this.adapter.removeClass(cssClasses.CLOSING);
604
- };
605
- /**
606
- * Runs the given logic on the next animation frame, using setTimeout to
607
- * factor in Firefox reflow behavior.
608
- */
609
- MDCDialogFoundation.prototype.runNextAnimationFrame = function (callback) {
610
- var _this = this;
611
- cancelAnimationFrame(this.animationFrame);
612
- this.animationFrame = requestAnimationFrame(function () {
613
- _this.animationFrame = 0;
614
- clearTimeout(_this.animationTimer);
615
- _this.animationTimer = setTimeout(callback, 0);
616
- });
617
- };
618
- MDCDialogFoundation.prototype.detectStackedButtons = function () {
619
- // Remove the class first to let us measure the buttons' natural positions.
620
- this.adapter.removeClass(cssClasses.STACKED);
621
- var areButtonsStacked = this.adapter.areButtonsStacked();
622
- if (areButtonsStacked) {
623
- this.adapter.addClass(cssClasses.STACKED);
624
- }
625
- if (areButtonsStacked !== this.areButtonsStacked) {
626
- this.adapter.reverseButtons();
627
- this.areButtonsStacked = areButtonsStacked;
628
- }
629
- };
630
- MDCDialogFoundation.prototype.toggleScrollableClasses = function () {
631
- // Remove the class first to let us measure the natural height of the
632
- // content.
633
- this.adapter.removeClass(cssClasses.SCROLLABLE);
634
- if (this.adapter.isContentScrollable()) {
635
- this.adapter.addClass(cssClasses.SCROLLABLE);
636
- if (this.isFullscreen) {
637
- // If dialog is full-screen and scrollable, check if a scroll divider
638
- // should be shown.
639
- this.toggleScrollDividerHeader();
640
- this.toggleScrollDividerFooter();
641
- }
642
- }
643
- };
644
- MDCDialogFoundation.prototype.toggleScrollDividerHeader = function () {
645
- if (!this.adapter.isScrollableContentAtTop()) {
646
- this.adapter.addClass(cssClasses.SCROLL_DIVIDER_HEADER);
647
- }
648
- else if (this.adapter.hasClass(cssClasses.SCROLL_DIVIDER_HEADER)) {
649
- this.adapter.removeClass(cssClasses.SCROLL_DIVIDER_HEADER);
650
- }
651
- };
652
- MDCDialogFoundation.prototype.toggleScrollDividerFooter = function () {
653
- if (!this.adapter.isScrollableContentAtBottom()) {
654
- this.adapter.addClass(cssClasses.SCROLL_DIVIDER_FOOTER);
655
- }
656
- else if (this.adapter.hasClass(cssClasses.SCROLL_DIVIDER_FOOTER)) {
657
- this.adapter.removeClass(cssClasses.SCROLL_DIVIDER_FOOTER);
658
- }
659
- };
660
- return MDCDialogFoundation;
661
- }(MDCFoundation));
662
-
663
- /**
664
- * @license
665
- * Copyright 2017 Google Inc.
666
- *
667
- * Permission is hereby granted, free of charge, to any person obtaining a copy
668
- * of this software and associated documentation files (the "Software"), to deal
669
- * in the Software without restriction, including without limitation the rights
670
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
671
- * copies of the Software, and to permit persons to whom the Software is
672
- * furnished to do so, subject to the following conditions:
673
- *
674
- * The above copyright notice and this permission notice shall be included in
675
- * all copies or substantial portions of the Software.
676
- *
677
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
678
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
679
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
680
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
681
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
682
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
683
- * THE SOFTWARE.
684
- */
685
- var strings = MDCDialogFoundation.strings;
686
- var MDCDialog = /** @class */ (function (_super) {
687
- __extends(MDCDialog, _super);
688
- function MDCDialog() {
689
- return _super !== null && _super.apply(this, arguments) || this;
690
- }
691
- Object.defineProperty(MDCDialog.prototype, "isOpen", {
692
- get: function () {
693
- return this.foundation.isOpen();
694
- },
695
- enumerable: false,
696
- configurable: true
697
- });
698
- Object.defineProperty(MDCDialog.prototype, "escapeKeyAction", {
699
- get: function () {
700
- return this.foundation.getEscapeKeyAction();
701
- },
702
- set: function (action) {
703
- this.foundation.setEscapeKeyAction(action);
704
- },
705
- enumerable: false,
706
- configurable: true
707
- });
708
- Object.defineProperty(MDCDialog.prototype, "scrimClickAction", {
709
- get: function () {
710
- return this.foundation.getScrimClickAction();
711
- },
712
- set: function (action) {
713
- this.foundation.setScrimClickAction(action);
714
- },
715
- enumerable: false,
716
- configurable: true
717
- });
718
- Object.defineProperty(MDCDialog.prototype, "autoStackButtons", {
719
- get: function () {
720
- return this.foundation.getAutoStackButtons();
721
- },
722
- set: function (autoStack) {
723
- this.foundation.setAutoStackButtons(autoStack);
724
- },
725
- enumerable: false,
726
- configurable: true
727
- });
728
- MDCDialog.attachTo = function (root) {
729
- return new MDCDialog(root);
730
- };
731
- MDCDialog.prototype.initialize = function (focusTrapFactory) {
732
- var e_1, _a;
733
- if (focusTrapFactory === void 0) { focusTrapFactory = function (el, focusOptions) {
734
- return new FocusTrap(el, focusOptions);
735
- }; }
736
- var container = this.root.querySelector(strings.CONTAINER_SELECTOR);
737
- if (!container) {
738
- throw new Error("Dialog component requires a " + strings.CONTAINER_SELECTOR + " container element");
739
- }
740
- this.container = container;
741
- this.content =
742
- this.root.querySelector(strings.CONTENT_SELECTOR);
743
- this.buttons = [].slice.call(this.root.querySelectorAll(strings.BUTTON_SELECTOR));
744
- this.defaultButton = this.root.querySelector("[" + strings.BUTTON_DEFAULT_ATTRIBUTE + "]");
745
- this.focusTrapFactory = focusTrapFactory;
746
- this.buttonRipples = [];
747
- try {
748
- for (var _b = __values(this.buttons), _c = _b.next(); !_c.done; _c = _b.next()) {
749
- var buttonEl = _c.value;
750
- this.buttonRipples.push(new MDCRipple(buttonEl));
751
- }
752
- }
753
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
754
- finally {
755
- try {
756
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
757
- }
758
- finally { if (e_1) throw e_1.error; }
759
- }
760
- };
761
- MDCDialog.prototype.initialSyncWithDOM = function () {
762
- var _this = this;
763
- this.focusTrap = createFocusTrapInstance(this.container, this.focusTrapFactory, this.getInitialFocusEl() || undefined);
764
- this.handleClick = this.foundation.handleClick.bind(this.foundation);
765
- this.handleKeydown = this.foundation.handleKeydown.bind(this.foundation);
766
- this.handleDocumentKeydown =
767
- this.foundation.handleDocumentKeydown.bind(this.foundation);
768
- // this.handleLayout = this.layout.bind(this);
769
- this.handleOpening = function () {
770
- document.addEventListener('keydown', _this.handleDocumentKeydown);
771
- };
772
- this.handleClosing = function () {
773
- document.removeEventListener('keydown', _this.handleDocumentKeydown);
774
- };
775
- this.listen('click', this.handleClick);
776
- this.listen('keydown', this.handleKeydown);
777
- this.listen(strings.OPENING_EVENT, this.handleOpening);
778
- this.listen(strings.CLOSING_EVENT, this.handleClosing);
779
- };
780
- MDCDialog.prototype.destroy = function () {
781
- this.unlisten('click', this.handleClick);
782
- this.unlisten('keydown', this.handleKeydown);
783
- this.unlisten(strings.OPENING_EVENT, this.handleOpening);
784
- this.unlisten(strings.CLOSING_EVENT, this.handleClosing);
785
- this.handleClosing();
786
- this.buttonRipples.forEach(function (ripple) {
787
- ripple.destroy();
788
- });
789
- _super.prototype.destroy.call(this);
790
- };
791
- MDCDialog.prototype.layout = function () {
792
- this.foundation.layout();
793
- };
794
- MDCDialog.prototype.open = function () {
795
- this.foundation.open();
796
- };
797
- MDCDialog.prototype.close = function (action) {
798
- if (action === void 0) { action = ''; }
799
- this.foundation.close(action);
800
- };
801
- MDCDialog.prototype.getDefaultFoundation = function () {
802
- var _this = this;
803
- // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
804
- // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
805
- var adapter = {
806
- addBodyClass: function (className) { return document.body.classList.add(className); },
807
- addClass: function (className) { return _this.root.classList.add(className); },
808
- areButtonsStacked: function () { return areTopsMisaligned(_this.buttons); },
809
- clickDefaultButton: function () {
810
- if (_this.defaultButton && !_this.defaultButton.disabled) {
811
- _this.defaultButton.click();
812
- }
813
- },
814
- eventTargetMatches: function (target, selector) {
815
- return target ? matches(target, selector) : false;
816
- },
817
- getActionFromEvent: function (evt) {
818
- if (!evt.target) {
819
- return '';
820
- }
821
- var element = closest(evt.target, "[" + strings.ACTION_ATTRIBUTE + "]");
822
- return element && element.getAttribute(strings.ACTION_ATTRIBUTE);
823
- },
824
- getInitialFocusEl: function () { return _this.getInitialFocusEl(); },
825
- hasClass: function (className) { return _this.root.classList.contains(className); },
826
- isContentScrollable: function () { return isScrollable(_this.content); },
827
- notifyClosed: function (action) { return _this.emit(strings.CLOSED_EVENT, action ? { action: action } : {}); },
828
- notifyClosing: function (action) { return _this.emit(strings.CLOSING_EVENT, action ? { action: action } : {}); },
829
- notifyOpened: function () { return _this.emit(strings.OPENED_EVENT, {}); },
830
- notifyOpening: function () { return _this.emit(strings.OPENING_EVENT, {}); },
831
- releaseFocus: function () {
832
- _this.focusTrap.releaseFocus();
833
- },
834
- removeBodyClass: function (className) { return document.body.classList.remove(className); },
835
- removeClass: function (className) { return _this.root.classList.remove(className); },
836
- reverseButtons: function () {
837
- _this.buttons.reverse();
838
- _this.buttons.forEach(function (button) {
839
- button.parentElement.appendChild(button);
840
- });
841
- },
842
- trapFocus: function () {
843
- _this.focusTrap.trapFocus();
844
- },
845
- registerContentEventHandler: function (evt, handler) {
846
- if (_this.content instanceof HTMLElement) {
847
- _this.content.addEventListener(evt, handler);
848
- }
849
- },
850
- deregisterContentEventHandler: function (evt, handler) {
851
- if (_this.content instanceof HTMLElement) {
852
- _this.content.removeEventListener(evt, handler);
853
- }
854
- },
855
- isScrollableContentAtTop: function () {
856
- return isScrollAtTop(_this.content);
857
- },
858
- isScrollableContentAtBottom: function () {
859
- return isScrollAtBottom(_this.content);
860
- },
861
- registerWindowEventHandler: function (evt, handler) {
862
- window.addEventListener(evt, handler);
863
- },
864
- deregisterWindowEventHandler: function (evt, handler) {
865
- window.removeEventListener(evt, handler);
866
- },
867
- };
868
- return new MDCDialogFoundation(adapter);
869
- };
870
- MDCDialog.prototype.getInitialFocusEl = function () {
871
- return this.root.querySelector("[" + strings.INITIAL_FOCUS_ATTRIBUTE + "]");
872
- };
873
- return MDCDialog;
874
- }(MDCComponent));
875
-
876
- const dialogCss = "@charset \"UTF-8\";:host{--mdc-theme-primary:var(\n --lime-primary-color,\n rgb(var(--color-teal-default))\n );--mdc-theme-secondary:var(\n --lime-secondary-color,\n rgb(var(--contrast-1100))\n );--mdc-theme-on-primary:var(\n --lime-on-primary-color,\n rgb(var(--contrast-100))\n );--mdc-theme-on-secondary:var(\n --lime-on-secondary-color,\n rgb(var(--contrast-100))\n );--mdc-theme-text-disabled-on-background:var(\n --lime-text-disabled-on-background-color,\n rgba(var(--contrast-1700), 0.38)\n );--mdc-theme-text-primary-on-background:var(\n --lime-text-primary-on-background-color,\n rgba(var(--contrast-1700), 0.87)\n );--mdc-theme-text-secondary-on-background:var(\n --lime-text-secondary-on-background-color,\n rgba(var(--contrast-1700), 0.54)\n );--mdc-theme-error:var(\n --lime-error-background-color,\n rgb(var(--color-red-dark))\n );--lime-error-text-color:rgb(var(--color-red-darker));--mdc-theme-surface:var(\n --lime-surface-background-color,\n rgb(var(--contrast-100))\n );--mdc-theme-on-surface:var(\n --lime-on-surface-color,\n rgb(var(--contrast-1500))\n )}:host{--dialog-background-color:var(--lime-elevated-surface-background-color);--header-heading-color:var(--dialog-heading-title-color);--header-subheading-color:var(--dialog-heading-subtitle-color);--header-supporting-text-color:var(--dialog-heading-supporting-text-color);--header-icon-color:var(--dialog-heading-icon-color);--header-icon-background-color:var(--dialog-heading-icon-background-color)}.mdc-dialog .mdc-dialog__surface{background-color:#fff;background-color:var(--mdc-theme-surface, #fff)}.mdc-dialog .mdc-dialog__scrim{background-color:rgba(0, 0, 0, 0.32)}.mdc-dialog .mdc-dialog__surface-scrim{background-color:rgba(0, 0, 0, 0.32)}.mdc-dialog .mdc-dialog__title{color:rgba(0, 0, 0, 0.87)}.mdc-dialog .mdc-dialog__content{color:rgba(0, 0, 0, 0.6)}.mdc-dialog .mdc-dialog__close{color:#000;color:var(--mdc-theme-on-surface, #000)}.mdc-dialog .mdc-dialog__close .mdc-icon-button__ripple::before,.mdc-dialog .mdc-dialog__close .mdc-icon-button__ripple::after{background-color:#000;background-color:var(--mdc-ripple-color, var(--mdc-theme-on-surface, #000))}.mdc-dialog .mdc-dialog__close:hover .mdc-icon-button__ripple::before,.mdc-dialog .mdc-dialog__close.mdc-ripple-surface--hover .mdc-icon-button__ripple::before{opacity:0.04;opacity:var(--mdc-ripple-hover-opacity, 0.04)}.mdc-dialog .mdc-dialog__close.mdc-ripple-upgraded--background-focused .mdc-icon-button__ripple::before,.mdc-dialog .mdc-dialog__close:not(.mdc-ripple-upgraded):focus .mdc-icon-button__ripple::before{transition-duration:75ms;opacity:0.12;opacity:var(--mdc-ripple-focus-opacity, 0.12)}.mdc-dialog .mdc-dialog__close:not(.mdc-ripple-upgraded) .mdc-icon-button__ripple::after{transition:opacity 150ms linear}.mdc-dialog .mdc-dialog__close:not(.mdc-ripple-upgraded):active .mdc-icon-button__ripple::after{transition-duration:75ms;opacity:0.12;opacity:var(--mdc-ripple-press-opacity, 0.12)}.mdc-dialog .mdc-dialog__close.mdc-ripple-upgraded{--mdc-ripple-fg-opacity:var(--mdc-ripple-press-opacity, 0.12)}.mdc-dialog.mdc-dialog--scrollable .mdc-dialog__title,.mdc-dialog.mdc-dialog--scrollable .mdc-dialog__actions,.mdc-dialog.mdc-dialog--scrollable.mdc-dialog-scroll-divider-footer .mdc-dialog__actions{border-color:rgba(0, 0, 0, 0.12)}.mdc-dialog.mdc-dialog--scrollable .mdc-dialog__title{border-bottom:1px solid rgba(0, 0, 0, 0.12);margin-bottom:0}.mdc-dialog.mdc-dialog-scroll-divider-header.mdc-dialog--fullscreen .mdc-dialog__header{box-shadow:0px 3px 1px -2px rgba(0, 0, 0, 0.2), 0px 2px 2px 0px rgba(0, 0, 0, 0.14), 0px 1px 5px 0px rgba(0, 0, 0, 0.12)}.mdc-dialog .mdc-dialog__surface{border-radius:4px;border-radius:var(--mdc-shape-medium, 4px)}.mdc-dialog__surface{box-shadow:0px 11px 15px -7px rgba(0, 0, 0, 0.2), 0px 24px 38px 3px rgba(0, 0, 0, 0.14), 0px 9px 46px 8px rgba(0, 0, 0, 0.12)}.mdc-dialog__title{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;font-family:inherit;font-family:var(--mdc-typography-headline6-font-family, var(--mdc-typography-font-family, inherit));font-size:0.875rem;font-size:var(--mdc-typography-headline6-font-size, 0.875rem);line-height:0.875rem;line-height:var(--mdc-typography-headline6-line-height, 0.875rem);font-weight:500;font-weight:var(--mdc-typography-headline6-font-weight, 500);letter-spacing:0.0125em;letter-spacing:var(--mdc-typography-headline6-letter-spacing, 0.0125em);text-decoration:inherit;text-decoration:var(--mdc-typography-headline6-text-decoration, inherit);text-transform:inherit;text-transform:var(--mdc-typography-headline6-text-transform, inherit)}.mdc-dialog__content{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;font-family:inherit;font-family:var(--mdc-typography-body1-font-family, var(--mdc-typography-font-family, inherit));font-size:0.8125rem;font-size:var(--mdc-typography-body1-font-size, 0.8125rem);line-height:1.5rem;line-height:var(--mdc-typography-body1-line-height, 1.5rem);font-weight:400;font-weight:var(--mdc-typography-body1-font-weight, 400);letter-spacing:0.03125em;letter-spacing:var(--mdc-typography-body1-letter-spacing, 0.03125em);text-decoration:inherit;text-decoration:var(--mdc-typography-body1-text-decoration, inherit);text-transform:inherit;text-transform:var(--mdc-typography-body1-text-transform, inherit)}.mdc-dialog__title-icon{}.mdc-elevation-overlay{position:absolute;border-radius:inherit;pointer-events:none;opacity:0;opacity:var(--mdc-elevation-overlay-opacity, 0);transition:opacity 280ms cubic-bezier(0.4, 0, 0.2, 1);background-color:#fff;background-color:var(--mdc-elevation-overlay-color, #fff)}.mdc-dialog,.mdc-dialog__scrim{position:fixed;top:0;left:0;align-items:center;justify-content:center;box-sizing:border-box;width:100%;height:100%}.mdc-dialog{display:none;z-index:7;z-index:var(--mdc-dialog-z-index, 7)}.mdc-dialog .mdc-dialog__content{padding:20px 24px 20px 24px}.mdc-dialog .mdc-dialog__surface{min-width:280px}@media (max-width: 592px){.mdc-dialog .mdc-dialog__surface{max-width:calc(100vw - 32px)}}@media (min-width: 592px){.mdc-dialog .mdc-dialog__surface{max-width:560px}}.mdc-dialog .mdc-dialog__surface{max-height:calc(100% - 32px)}@media all and (-ms-high-contrast: none), (-ms-high-contrast: active){.mdc-dialog .mdc-dialog__container{}}.mdc-dialog.mdc-dialog--fullscreen .mdc-dialog__surface{max-width:none}@media (max-width: 960px){.mdc-dialog.mdc-dialog--fullscreen .mdc-dialog__surface{max-height:560px;width:560px}.mdc-dialog.mdc-dialog--fullscreen .mdc-dialog__surface .mdc-dialog__close{right:-12px}}@media (max-width: 720px) and (max-width: 672px){.mdc-dialog.mdc-dialog--fullscreen .mdc-dialog__surface{width:calc(100vw - 112px)}}@media (max-width: 720px) and (min-width: 672px){.mdc-dialog.mdc-dialog--fullscreen .mdc-dialog__surface{width:560px}}@media (max-width: 720px) and (max-height: 720px){.mdc-dialog.mdc-dialog--fullscreen .mdc-dialog__surface{max-height:calc(100vh - 160px)}}@media (max-width: 720px) and (min-height: 720px){.mdc-dialog.mdc-dialog--fullscreen .mdc-dialog__surface{max-height:560px}}@media (max-width: 720px){.mdc-dialog.mdc-dialog--fullscreen .mdc-dialog__surface .mdc-dialog__close{right:-12px}}@media (max-width: 720px) and (max-height: 400px){.mdc-dialog.mdc-dialog--fullscreen .mdc-dialog__surface{height:100%;max-height:100vh;max-width:100vw;width:100vw;border-radius:0}.mdc-dialog.mdc-dialog--fullscreen .mdc-dialog__surface .mdc-dialog__close{order:-1;left:-12px}.mdc-dialog.mdc-dialog--fullscreen .mdc-dialog__surface .mdc-dialog__header{padding:0 16px 9px;justify-content:flex-start}.mdc-dialog.mdc-dialog--fullscreen .mdc-dialog__surface .mdc-dialog__title{margin-left:calc(16px - 2 * 12px)}}@media (max-width: 600px){.mdc-dialog.mdc-dialog--fullscreen .mdc-dialog__surface{height:100%;max-height:100vh;max-width:100vw;width:100vw;border-radius:0}.mdc-dialog.mdc-dialog--fullscreen .mdc-dialog__surface .mdc-dialog__close{order:-1;left:-12px}.mdc-dialog.mdc-dialog--fullscreen .mdc-dialog__surface .mdc-dialog__header{padding:0 16px 9px;justify-content:flex-start}.mdc-dialog.mdc-dialog--fullscreen .mdc-dialog__surface .mdc-dialog__title{margin-left:calc(16px - 2 * 12px)}}@media (min-width: 960px){.mdc-dialog.mdc-dialog--fullscreen .mdc-dialog__surface{width:calc(100vw - 400px)}.mdc-dialog.mdc-dialog--fullscreen .mdc-dialog__surface .mdc-dialog__close{right:-12px}}.mdc-dialog.mdc-dialog__scrim--hidden .mdc-dialog__scrim{opacity:0}.mdc-dialog__scrim{opacity:0;z-index:-1}.mdc-dialog__container{display:flex;flex-direction:row;align-items:center;justify-content:space-around;box-sizing:border-box;height:100%;transform:scale(0.8);opacity:0;pointer-events:none}.mdc-dialog__surface{position:relative;display:flex;flex-direction:column;flex-grow:0;flex-shrink:0;box-sizing:border-box;max-width:100%;max-height:100%;pointer-events:auto;overflow-y:auto}.mdc-dialog__surface .mdc-elevation-overlay{width:100%;height:100%;top:0;left:0}[dir=rtl] .mdc-dialog__surface,.mdc-dialog__surface[dir=rtl]{text-align:right;}@media screen and (forced-colors: active), (-ms-high-contrast: active){.mdc-dialog__surface{outline:2px solid windowText}}.mdc-dialog__surface::before{position:absolute;box-sizing:border-box;width:100%;height:100%;top:0;left:0;border:2px solid transparent;border-radius:inherit;content:\"\";pointer-events:none}@media screen and (-ms-high-contrast: active), screen and (-ms-high-contrast: none){.mdc-dialog__surface::before{content:none}}.mdc-dialog__title{display:block;margin-top:0;position:relative;flex-shrink:0;box-sizing:border-box;margin:0 0 1px;padding:0 24px 9px}.mdc-dialog__title::before{display:inline-block;width:0;height:40px;content:\"\";vertical-align:0}[dir=rtl] .mdc-dialog__title,.mdc-dialog__title[dir=rtl]{text-align:right;}.mdc-dialog--scrollable .mdc-dialog__title{margin-bottom:1px;padding-bottom:15px}.mdc-dialog--fullscreen .mdc-dialog__header{align-items:baseline;border-bottom:1px solid transparent;display:inline-flex;justify-content:space-between;padding:0 24px 9px;z-index:1}.mdc-dialog--fullscreen .mdc-dialog__header .mdc-dialog__close{right:-12px}.mdc-dialog--fullscreen .mdc-dialog__title{margin-bottom:0;padding:0;border-bottom:0}.mdc-dialog--fullscreen.mdc-dialog--scrollable .mdc-dialog__title{border-bottom:0;margin-bottom:0}.mdc-dialog--fullscreen .mdc-dialog__close{top:5px}.mdc-dialog--fullscreen.mdc-dialog--scrollable .mdc-dialog__actions{border-top:1px solid transparent}.mdc-dialog__content{flex-grow:1;box-sizing:border-box;margin:0;overflow:auto;-webkit-overflow-scrolling:touch}.mdc-dialog__content>:first-child{margin-top:0}.mdc-dialog__content>:last-child{margin-bottom:0}.mdc-dialog__title+.mdc-dialog__content,.mdc-dialog__header+.mdc-dialog__content{padding-top:0}.mdc-dialog--scrollable .mdc-dialog__title+.mdc-dialog__content{padding-top:8px;padding-bottom:8px}.mdc-dialog__content .mdc-deprecated-list:first-child:last-child{padding:6px 0 0}.mdc-dialog--scrollable .mdc-dialog__content .mdc-deprecated-list:first-child:last-child{padding:0}.mdc-dialog__actions{display:flex;position:relative;flex-shrink:0;flex-wrap:wrap;align-items:center;justify-content:flex-end;box-sizing:border-box;min-height:52px;margin:0;padding:8px;border-top:1px solid transparent}.mdc-dialog--stacked .mdc-dialog__actions{flex-direction:column;align-items:flex-end}.mdc-dialog__button{margin-left:8px;margin-right:0;max-width:100%;text-align:right}[dir=rtl] .mdc-dialog__button,.mdc-dialog__button[dir=rtl]{margin-left:0;margin-right:8px;}.mdc-dialog__button:first-child{margin-left:0;margin-right:0}[dir=rtl] .mdc-dialog__button:first-child,.mdc-dialog__button:first-child[dir=rtl]{margin-left:0;margin-right:0;}[dir=rtl] .mdc-dialog__button,.mdc-dialog__button[dir=rtl]{text-align:left;}.mdc-dialog--stacked .mdc-dialog__button:not(:first-child){margin-top:12px}.mdc-dialog--open,.mdc-dialog--opening,.mdc-dialog--closing{display:flex}.mdc-dialog--opening .mdc-dialog__scrim{transition:opacity 150ms linear}.mdc-dialog--opening .mdc-dialog__container{transition:opacity 75ms linear, transform 150ms 0ms cubic-bezier(0, 0, 0.2, 1)}.mdc-dialog--closing .mdc-dialog__scrim,.mdc-dialog--closing .mdc-dialog__container{transition:opacity 75ms linear}.mdc-dialog--closing .mdc-dialog__container{transform:none}.mdc-dialog--open .mdc-dialog__scrim{opacity:1}.mdc-dialog--open .mdc-dialog__container{transform:none;opacity:1}.mdc-dialog--open.mdc-dialog__surface-scrim--shown .mdc-dialog__surface-scrim{opacity:1;z-index:1}.mdc-dialog--open.mdc-dialog__surface-scrim--hiding .mdc-dialog__surface-scrim{transition:opacity 75ms linear}.mdc-dialog--open.mdc-dialog__surface-scrim--showing .mdc-dialog__surface-scrim{transition:opacity 150ms linear}.mdc-dialog__surface-scrim{display:none;opacity:0;position:absolute;width:100%;height:100%}.mdc-dialog__surface-scrim--shown .mdc-dialog__surface-scrim,.mdc-dialog__surface-scrim--showing .mdc-dialog__surface-scrim,.mdc-dialog__surface-scrim--hiding .mdc-dialog__surface-scrim{display:block}.mdc-dialog-scroll-lock{overflow:hidden}.mdc-dialog__content{font-family:inherit}.mdc-dialog{z-index:var(--dialog-z-index, 7);padding:env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left)}@media (max-width: 16032px){.mdc-dialog .mdc-dialog__surface{max-width:calc(100vw - 32px)}}@media (min-width: 16032px){.mdc-dialog .mdc-dialog__surface{max-width:16000px}}@media (max-height: 16032px){.mdc-dialog.full-screen .mdc-dialog__surface{max-height:calc(100% - 32px)}}@media (min-height: 16032px){.mdc-dialog.full-screen .mdc-dialog__surface{max-height:16000px}}@media all and (-ms-high-contrast: none), (-ms-high-contrast: active){.mdc-dialog.full-screen .mdc-dialog__container{}}@media (-ms-high-contrast: none) and (min-height: 16032px), (-ms-high-contrast: active) and (min-height: 16032px){.mdc-dialog.full-screen .mdc-dialog__container{align-items:stretch;height:auto}}.mdc-dialog.full-screen .mdc-dialog__container{height:100%;width:100%}.mdc-dialog.full-screen .mdc-dialog__container .mdc-dialog__surface{height:100%;width:100%}.mdc-dialog .mdc-dialog__scrim{background-color:rgba(var(--color-black), 0.4)}.mdc-dialog .mdc-dialog__container{height:100%;width:var(--dialog-width, auto)}.mdc-dialog .mdc-dialog__surface{width:var(--dialog-width, auto);height:var(--dialog-height, auto);background-color:var(--dialog-background-color);box-shadow:var(--shadow-depth-64);max-width:var(--dialog-max-width, calc(100vw - 2rem));max-height:var(--dialog-max-height, calc(100% - 2rem));border-radius:var(--dialog-border-radius, 0.25rem)}.mdc-dialog .mdc-dialog__content{--limel-top-edge-fade-height:var(--dialog-padding-top-bottom, 1.5rem);--limel-bottom-edge-fade-height:var(\n --dialog-padding-top-bottom,\n 1.5rem\n );--limel-overflow-mask-vertical:linear-gradient(\n to bottom,\n transparent 0%,\n black calc(0% + var(--limel-top-edge-fade-height, 1rem)),\n black calc(100% - var(--limel-bottom-edge-fade-height, 1rem)),\n transparent 100%\n );-webkit-mask-image:var(--limel-overflow-mask-vertical);mask-image:var(--limel-overflow-mask-vertical);padding-top:var(--limel-top-edge-fade-height, 1rem);padding-bottom:var(--limel-bottom-edge-fade-height, 1rem);color:var(--mdc-theme-on-surface);padding-left:var(--dialog-padding-left-right, min(1.25rem, 3vw));padding-right:var(--dialog-padding-left-right, min(1.25rem, 3vw))}#initialFocusElement{position:absolute;opacity:0;pointer-events:none;z-index:-1}slot[name=header]{display:none}slot[name=button]{display:flex;gap:0.5rem;width:100%;justify-content:flex-end}@media screen and (max-width: 760px){slot[name=button]{flex-direction:column-reverse}.mdc-dialog__actions{padding:min(1.5rem, 3vw);padding-top:1rem}}";
4
+ const dialogCss = "@charset \"UTF-8\";\n/**\n * Note! This file is exported to `dist/scss/` in the published\n * node module, for consumer projects to import.\n * That means this file cannot import from any file that isn't\n * also exported, keeping the same relative path.\n *\n * Or, just don't import anything, that works too.\n */\n/**\n* This can be used on a trigger element that opens a dropdown menu or a popover.\n*/\n/**\n * This mixin will mask out the content that is close to\n * the edges of a scrollable area.\n * - If the scrollable content has `overflow-y`, use `vertically`\n * as an argument for `$direction`.\n - If the scrollable content has `overflow-x`, use `horizontally`\n * as an argument for `$direction`.\n *\n * For the visual effect to work smoothly, we need to make sure that\n * the size of the fade-out edge effect is the same as the\n * internal paddings of the scrollable area. Otherwise, content of a\n * scrollable area that does not have a padding will fade out before\n * any scrolling has been done.\n * This is why this mixin already adds paddings, which automatically\n * default to the size of the fade-out effect.\n * This size defaults to `1rem`, but to override the size use\n * `--limel-top-edge-fade-height` & `--limel-bottom-edge-fade-height`\n * when `vertically` argument is set, and use\n * `--limel-left-edge-fade-width` & `--limel-right-edge-fade-width`\n * when `horizontally` argument is set.\n * Of course you can also programmatically increase and decrease the\n * size of these variables for each edge, based on the amount of\n * scrolling that has been done by the user. In this case, make sure\n * to add a custom padding where the mixin is used, to override\n * the paddings that are automatically added by the mixin in the\n * compiled CSS code.\n */\n/**\n* This mixin will add an animated underline to the bottom of an `a` elements.\n* Note that you may need to add `all: unset;` –depending on your use case–\n* before using this mixin.\n*/\n/**\n* This mixin creates a cross-browser font stack.\n* - `sans-serif` can be used for the UI of the components.\n* - `monospace` can be used for code.\n*\n* ⚠️ If we change the font stacks, we need to update\n* 1. the consumer documentation in `README.md`, and\n* 2. the CSS variables of `--kompendium-example-font-family`\n* in the `<style>` tag of `index.html`.\n*/\n/**\n * @prop --dialog-width: Width of the dialog.\n * @prop --dialog-max-width: Max width of the dialog.\n * @prop --dialog-height: Height of the dialog.\n * @prop --dialog-max-height: Max height of the dialog.\n * @prop --dialog-padding-top-bottom: Padding on top and bottom of dialog content. Affects the height of fade-out effects on top and bottom edges when the content is scrollable and has overflowed out of the content area. Defaults to `1.5rem`. Note that if you use this variable and set it to numbers smaller than 1rem, you will loose the fade-out effects on the edges. If you have set these paddings to `0`, losing the fade out effects should be however fine for your use case! Because in such a case your intention is to handle the `overflow` internally in the component that is displayed in the dialog's content.\n * @prop --dialog-padding-left-right: Padding on the sides of dialog content. Defaults to `1.25rem`.\n * @prop --dialog-heading-title-color: Color of the title.\n * @prop --dialog-heading-subtitle-color: Color of the subtitle.\n * @prop --dialog-heading-supporting-text-color: Color of the supporting text.\n * @prop --dialog-heading-icon-color: Color of the icon.\n * @prop --dialog-heading-icon-background-color: Background color of the icon when displayed as a badge.\n */\n:host(limel-dialog) {\n --limel-dialog-border-radius: 0.75rem;\n --header-heading-color: var(--dialog-heading-title-color);\n --header-subheading-color: var(--dialog-heading-subtitle-color);\n --header-supporting-text-color: var(--dialog-heading-supporting-text-color);\n --header-icon-color: var(--dialog-heading-icon-color);\n --header-icon-background-color: var(--dialog-heading-icon-background-color);\n}\n\n* {\n box-sizing: border-box;\n}\n\ndialog {\n border: none;\n outline: none;\n padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);\n border-radius: var(--limel-dialog-border-radius);\n width: var(--dialog-width, fit-content);\n height: var(--dialog-height, fit-content);\n max-width: var(--dialog-max-width, calc(100vw - 1rem));\n max-height: var(--dialog-max-height, calc(100% - 1rem));\n background-color: transparent;\n box-shadow: var(--shadow-depth-8), var(--shadow-depth-64);\n}\ndialog.fullscreen {\n --dialog-width: 100%;\n --dialog-height: 100%;\n width: 100%;\n height: 100%;\n}\n\n.surface {\n display: flex;\n flex-direction: column;\n height: 100%;\n width: 100%;\n border-radius: var(--limel-dialog-border-radius);\n background-color: var(--lime-elevated-surface-background-color);\n}\n\n.content {\n flex-grow: 1;\n overflow-y: auto;\n --limel-top-edge-fade-height: var(--dialog-padding-top-bottom, 1.5rem);\n --limel-bottom-edge-fade-height: var(--dialog-padding-top-bottom, 1.5rem);\n --limel-overflow-mask-vertical: linear-gradient(\n to bottom,\n transparent 0%,\n black calc(0% + var(--limel-top-edge-fade-height, 1rem)),\n black calc(100% - var(--limel-bottom-edge-fade-height, 1rem)),\n transparent 100%\n );\n -webkit-mask-image: var(--limel-overflow-mask-vertical);\n mask-image: var(--limel-overflow-mask-vertical);\n padding-top: var(--limel-top-edge-fade-height, 1rem);\n padding-bottom: var(--limel-bottom-edge-fade-height, 1rem);\n color: var(--mdc-theme-on-surface);\n padding-left: var(--dialog-padding-left-right, min(1.25rem, 3vw));\n padding-right: var(--dialog-padding-left-right, min(1.25rem, 3vw));\n}\n\nlimel-header,\n.actions {\n flex-shrink: 0;\n}\n\n.actions {\n display: flex;\n align-items: center;\n justify-content: flex-end;\n min-height: 52px;\n margin: 0px;\n padding: 8px;\n border-top: 1px solid transparent;\n}\n\nslot[name=header] {\n display: none;\n}\n\nslot[name=button] {\n display: flex;\n gap: 0.5rem;\n width: 100%;\n justify-content: flex-end;\n}\n\n@media screen and (max-width: 760px) {\n slot[name=button] {\n flex-direction: column-reverse;\n }\n .mdc-dialog__actions {\n padding: min(1.5rem, 3vw);\n padding-top: 1rem;\n }\n}\ndialog {\n --limel-dialog-display-speed: 0.2s;\n transition: opacity 0.2s ease, display var(--limel-dialog-display-speed) ease, transform var(--limel-dialog-display-speed) ease;\n transition-behavior: allow-discrete;\n opacity: 0;\n transform: translate3d(0, 1rem, 0);\n}\ndialog::backdrop {\n transition: background-color 0.6s ease;\n transition-behavior: allow-discrete;\n background-color: rgb(var(--color-black), 0);\n}\ndialog[open] {\n --limel-dialog-display-speed: 0.4s;\n opacity: 1;\n transform: translate3d(0, 0, 0) scale(1);\n}\n@starting-style {\n dialog[open] {\n opacity: 0;\n transform: translate3d(0, -1rem, 0) scale(0.9);\n }\n}\ndialog[open]::backdrop {\n transition-delay: var(--limel-dialog-display-speed);\n background-color: rgb(var(--color-black), 0.4);\n}\n@starting-style {\n dialog[open]::backdrop {\n background-color: rgb(var(--color-black), 0);\n }\n}\n\ndialog {\n position: fixed;\n inset: 0;\n}";
877
5
 
878
6
  const Dialog = class {
879
7
  constructor(hostRef) {
@@ -881,6 +9,13 @@ const Dialog = class {
881
9
  this.close = createEvent(this, "close", 7);
882
10
  this.closing = createEvent(this, "closing", 7);
883
11
  this.showFooter = true;
12
+ this.handleCancel = (event) => {
13
+ if (!this.closingActions.escapeKey && event.cancelable) {
14
+ event.preventDefault();
15
+ return;
16
+ }
17
+ this.closeDialog();
18
+ };
884
19
  this.heading = undefined;
885
20
  this.fullscreen = false;
886
21
  this.open = false;
@@ -888,9 +23,6 @@ const Dialog = class {
888
23
  escapeKey: true,
889
24
  scrimClick: true,
890
25
  };
891
- this.handleMdcOpened = this.handleMdcOpened.bind(this);
892
- this.handleMdcClosed = this.handleMdcClosed.bind(this);
893
- this.handleMdcClosing = this.handleMdcClosing.bind(this);
894
26
  }
895
27
  connectedCallback() {
896
28
  this.initialize();
@@ -903,67 +35,63 @@ const Dialog = class {
903
35
  this.initialize();
904
36
  }
905
37
  initialize() {
906
- const element = this.host.shadowRoot.querySelector('.mdc-dialog');
907
- if (!element) {
38
+ if (!this.dialog) {
908
39
  return;
909
40
  }
910
- this.mdcDialog = new MDCDialog(element);
911
41
  if (this.open) {
912
- this.mdcDialog.open();
42
+ this.dialog.showModal();
913
43
  }
914
- this.mdcDialog.listen('MDCDialog:opened', this.handleMdcOpened);
915
- this.mdcDialog.listen('MDCDialog:closed', this.handleMdcClosed);
916
- this.mdcDialog.listen('MDCDialog:closing', this.handleMdcClosing);
917
- this.setClosingActions();
918
44
  }
919
- disconnectedCallback() {
920
- this.mdcDialog.unlisten('MDCDialog:opened', this.handleMdcOpened);
921
- this.mdcDialog.unlisten('MDCDialog:closed', this.handleMdcClosed);
922
- this.mdcDialog.unlisten('MDCDialog:closing', this.handleMdcClosing);
923
- this.mdcDialog.destroy();
45
+ handleClick(event) {
46
+ if (!this.closingActions.scrimClick) {
47
+ return;
48
+ }
49
+ const rect = this.dialog.getBoundingClientRect();
50
+ const clickedInDialog = rect.top <= event.clientY &&
51
+ event.clientY <= rect.top + rect.height &&
52
+ rect.left <= event.clientX &&
53
+ event.clientX <= rect.left + rect.width;
54
+ if (!clickedInDialog) {
55
+ this.closeDialog();
56
+ }
57
+ }
58
+ closeDialog() {
59
+ if (!this.open) {
60
+ return;
61
+ }
62
+ const event = this.closing.emit();
63
+ if (event.defaultPrevented) {
64
+ return;
65
+ }
66
+ this.close.emit();
67
+ this.open = false;
924
68
  }
925
69
  render() {
926
- return (h("div", { class: {
927
- 'mdc-dialog': true,
928
- 'full-screen': !!this.fullscreen,
929
- }, role: "alertdialog", "aria-modal": "true", "aria-labelledby": 'limel-dialog-title-' + this.id, "aria-describedby": 'limel-dialog-content-' + this.id }, h("input", { hidden: true, id: "initialFocusEl" }), h("div", { class: "mdc-dialog__container" }, h("div", { class: "mdc-dialog__surface" }, h("input", { type: "button", id: "initialFocusElement" }), this.renderHeading(), h("div", { class: "mdc-dialog__content", id: 'limel-dialog-content-' + this.id }, h("slot", null)), this.renderFooter())), h("div", { class: "mdc-dialog__scrim" })));
70
+ return (h("dialog", Object.assign({ class: {
71
+ fullscreen: !!this.fullscreen,
72
+ } }, this.getDialogAttributes(this.open, this.id), { onCancel: this.handleCancel }), h("div", { class: "surface" }, this.renderHeading(), h("div", { class: "content", id: 'limel-dialog-content-' + this.id }, h("slot", null)), this.renderFooter())));
930
73
  }
931
74
  watchHandler(newValue, oldValue) {
932
75
  if (oldValue === newValue) {
933
76
  return;
934
77
  }
935
- if (!this.mdcDialog) {
936
- return;
937
- }
938
78
  if (newValue) {
939
- this.mdcDialog.open();
79
+ this.dialog.showModal();
940
80
  }
941
81
  else {
942
- this.mdcDialog.close();
82
+ this.dialog.close();
943
83
  }
944
84
  }
945
- closingActionsChanged(newValue, oldValue) {
946
- if (isEqual(newValue, oldValue)) {
947
- return;
85
+ getDialogAttributes(isOpen, id) {
86
+ if (isOpen) {
87
+ return {
88
+ role: 'alertdialog',
89
+ 'aria-modal': 'true',
90
+ 'aria-labelledby': 'limel-dialog-title-' + id,
91
+ 'aria-describedby': 'limel-dialog-content-' + id,
92
+ };
948
93
  }
949
- this.setClosingActions();
950
- }
951
- handleMdcOpened() {
952
- // When the opening-animation has completed, dispatch a
953
- // resize-event so that any content that depends on
954
- // javascript for layout has a chance to update to the
955
- // final layout of the dialog. /Ads
956
- const waitForUiToRender = 100;
957
- setTimeout(dispatchResizeEvent, waitForUiToRender);
958
- }
959
- handleMdcClosed() {
960
- if (this.open) {
961
- this.close.emit();
962
- }
963
- this.open = false;
964
- }
965
- handleMdcClosing() {
966
- this.closing.emit();
94
+ return {};
967
95
  }
968
96
  isBadgeHeading(heading) {
969
97
  return typeof heading === 'object' && !!heading.title && !!heading.icon;
@@ -980,23 +108,15 @@ const Dialog = class {
980
108
  }
981
109
  renderFooter() {
982
110
  if (this.showFooter) {
983
- return (h("footer", { class: "mdc-dialog__actions" }, h("slot", { name: "button" })));
111
+ return (h("footer", { class: "actions" }, h("slot", { name: "button" })));
984
112
  }
985
113
  }
986
- setClosingActions() {
987
- this.mdcDialog.scrimClickAction = '';
988
- if (this.closingActions.scrimClick) {
989
- this.mdcDialog.scrimClickAction = 'close';
990
- }
991
- this.mdcDialog.escapeKeyAction = '';
992
- if (this.closingActions.escapeKey) {
993
- this.mdcDialog.escapeKeyAction = 'close';
994
- }
114
+ get dialog() {
115
+ return this.host.shadowRoot.querySelector('dialog');
995
116
  }
996
117
  get host() { return getElement(this); }
997
118
  static get watchers() { return {
998
- "open": ["watchHandler"],
999
- "closingActions": ["closingActionsChanged"]
119
+ "open": ["watchHandler"]
1000
120
  }; }
1001
121
  };
1002
122
  Dialog.style = dialogCss;