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