@digital-realty/ix-dialog 1.2.1 → 1.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,8 +1,8 @@
1
- import { LitElement } from 'lit';
2
- import './md-dialog.js';
1
+ import { CSSResultGroup, LitElement } from 'lit';
3
2
  import { Dialog } from './internal/dialog.js';
3
+ import './md-dialog.js';
4
4
  export declare class IxDialog extends LitElement {
5
- /** @nocollapse */
5
+ static styles: CSSResultGroup;
6
6
  static shadowRootOptions: {
7
7
  delegatesFocus: boolean;
8
8
  mode: ShadowRootMode;
@@ -15,13 +15,46 @@ export declare class IxDialog extends LitElement {
15
15
  preventCancel: boolean;
16
16
  preventCloseOnScrimClick: boolean;
17
17
  disableNextClickIsFromContent: boolean;
18
- private scrollPosition;
18
+ useNativeDialog: boolean;
19
+ allowOverflow: boolean;
20
+ private nativeClosing;
21
+ private dialogRef;
22
+ private containerRef;
23
+ private portalHost?;
24
+ private portalRoot?;
25
+ private portalStyleEl?;
26
+ private pointerDownInside;
27
+ private isScrollLocked;
28
+ private scrollYBackup;
29
+ private removeScrollHandlers?;
30
+ private nativeOnEnd?;
31
+ private mo?;
32
+ private get nativeDialog();
33
+ private get nativeDialogContainer();
34
+ connectedCallback(): void;
19
35
  disconnectedCallback(): void;
20
- resetBodyStyles(): void;
36
+ updated(changed: Map<string, unknown>): void;
37
+ dismiss(): void;
38
+ private startNativeCloseAnimation;
39
+ private ensurePortal;
40
+ private attachPortalStyles;
41
+ private teardownPortal;
42
+ private moveNodesToPortal;
43
+ private moveNodesBackFromPortal;
44
+ private populatePortal;
45
+ private onKeydown;
46
+ private onNativeCancel;
47
+ private requestClose;
48
+ private onScrimClick;
49
+ private lockScroll;
50
+ private unlockScroll;
21
51
  onOpen(): void;
22
52
  onOpened(): void;
23
53
  onClose(): void;
24
54
  onClosed(): void;
25
- onCancel(e: any): void;
26
- render(): import("lit-html").TemplateResult<1>;
55
+ onCancel(e: Event): void;
56
+ private portalTemplate;
57
+ private renderMdDialog;
58
+ private renderNativeDialog;
59
+ render(): symbol | import("lit-html").TemplateResult<1>;
27
60
  }
package/dist/IxDialog.js CHANGED
@@ -1,8 +1,10 @@
1
1
  import { __decorate } from "tslib";
2
- import { html, LitElement } from 'lit';
2
+ import { requestUpdateOnAriaChange } from '@material/web/internal/aria/delegate.js';
3
+ import { css, html, LitElement, nothing, render } from 'lit';
3
4
  import { property, query, state } from 'lit/decorators.js';
5
+ import { createRef, ref } from 'lit/directives/ref.js';
6
+ import { IxDialogStyles } from './ix-dialog-styles.js';
4
7
  import './md-dialog.js';
5
- import { requestUpdateOnAriaChange } from '@material/web/internal/aria/delegate.js';
6
8
  export class IxDialog extends LitElement {
7
9
  constructor() {
8
10
  super(...arguments);
@@ -10,38 +12,333 @@ export class IxDialog extends LitElement {
10
12
  this.preventCancel = false;
11
13
  this.preventCloseOnScrimClick = false;
12
14
  this.disableNextClickIsFromContent = false;
13
- this.scrollPosition = 0;
15
+ this.useNativeDialog = false;
16
+ this.allowOverflow = false;
17
+ this.nativeClosing = false;
18
+ this.dialogRef = createRef();
19
+ this.containerRef = createRef();
20
+ this.pointerDownInside = false;
21
+ this.isScrollLocked = false;
22
+ this.scrollYBackup = 0;
23
+ this.onKeydown = (e) => {
24
+ if (e.key !== 'Escape')
25
+ return;
26
+ if (this.preventCancel) {
27
+ e.preventDefault();
28
+ return;
29
+ }
30
+ const cancelEvt = new Event('cancel', {
31
+ bubbles: true,
32
+ composed: true,
33
+ cancelable: true,
34
+ });
35
+ const prevented = !this.dispatchEvent(cancelEvt);
36
+ if (prevented) {
37
+ e.preventDefault();
38
+ return;
39
+ }
40
+ this.requestClose();
41
+ };
42
+ this.onNativeCancel = (e) => {
43
+ const forwarded = new Event('cancel', {
44
+ bubbles: true,
45
+ composed: true,
46
+ cancelable: true,
47
+ });
48
+ const prevented = !this.dispatchEvent(forwarded);
49
+ if (prevented) {
50
+ e.preventDefault();
51
+ return;
52
+ }
53
+ this.requestClose();
54
+ };
55
+ this.onScrimClick = () => {
56
+ if (!this.preventCloseOnScrimClick)
57
+ this.requestClose();
58
+ };
59
+ }
60
+ get nativeDialog() {
61
+ var _a;
62
+ return (_a = this.dialogRef.value) !== null && _a !== void 0 ? _a : null;
63
+ }
64
+ get nativeDialogContainer() {
65
+ var _a;
66
+ return (_a = this.containerRef.value) !== null && _a !== void 0 ? _a : null;
67
+ }
68
+ connectedCallback() {
69
+ super.connectedCallback();
70
+ this.mo = new MutationObserver(() => {
71
+ if (this.useNativeDialog && this.open)
72
+ this.populatePortal();
73
+ });
74
+ this.mo.observe(this, {
75
+ childList: true,
76
+ subtree: true,
77
+ attributes: true,
78
+ characterData: true,
79
+ });
14
80
  }
15
81
  disconnectedCallback() {
82
+ var _a;
16
83
  super.disconnectedCallback();
17
- this.resetBodyStyles();
18
- }
19
- resetBodyStyles() {
20
- const page = document.body;
21
- page.style.paddingRight = '0';
22
- page.style.position = '';
23
- page.style.top = '';
24
- page.style.left = '';
25
- page.style.right = '';
26
- page.style.overflow = '';
27
- page.style.width = '';
28
- window.scrollTo(0, this.scrollPosition);
84
+ (_a = this.mo) === null || _a === void 0 ? void 0 : _a.disconnect();
85
+ this.unlockScroll();
86
+ this.teardownPortal();
87
+ }
88
+ updated(changed) {
89
+ var _a;
90
+ if (!this.useNativeDialog)
91
+ return;
92
+ if (changed.has('open')) {
93
+ if (this.open) {
94
+ this.ensurePortal();
95
+ if (this.portalRoot) {
96
+ this.attachPortalStyles();
97
+ render(this.portalTemplate(), this.portalRoot);
98
+ this.populatePortal();
99
+ }
100
+ if (this.nativeClosing) {
101
+ this.nativeClosing = false;
102
+ (_a = this.nativeDialogContainer) === null || _a === void 0 ? void 0 : _a.classList.remove('closing');
103
+ if (this.nativeOnEnd && this.nativeDialogContainer) {
104
+ this.nativeDialogContainer.removeEventListener('animationend', this.nativeOnEnd);
105
+ }
106
+ this.nativeOnEnd = undefined;
107
+ }
108
+ this.dispatchEvent(new Event('open', { bubbles: true, composed: true }));
109
+ this.lockScroll();
110
+ requestAnimationFrame(() => {
111
+ var _a;
112
+ (_a = this.nativeDialog) === null || _a === void 0 ? void 0 : _a.show();
113
+ requestAnimationFrame(() => {
114
+ this.dispatchEvent(new Event('opened', { bubbles: true, composed: true }));
115
+ });
116
+ });
117
+ }
118
+ else {
119
+ this.startNativeCloseAnimation();
120
+ }
121
+ }
122
+ }
123
+ dismiss() {
124
+ if (!this.open)
125
+ return;
126
+ Promise.resolve().then(() => {
127
+ this.requestClose();
128
+ });
129
+ }
130
+ startNativeCloseAnimation() {
131
+ if (this.nativeClosing)
132
+ return;
133
+ this.nativeClosing = true;
134
+ this.dispatchEvent(new Event('close', { bubbles: true, composed: true }));
135
+ const finish = () => {
136
+ var _a, _b;
137
+ (_a = this.nativeDialogContainer) === null || _a === void 0 ? void 0 : _a.classList.remove('closing');
138
+ this.nativeClosing = false;
139
+ (_b = this.nativeDialog) === null || _b === void 0 ? void 0 : _b.close();
140
+ this.unlockScroll();
141
+ this.dispatchEvent(new Event('closed', { bubbles: true, composed: true }));
142
+ this.moveNodesBackFromPortal();
143
+ this.teardownPortal();
144
+ };
145
+ const container = this.nativeDialogContainer;
146
+ if (!container) {
147
+ finish();
148
+ return;
149
+ }
150
+ container.classList.add('closing');
151
+ let done = false;
152
+ const onEnd = () => {
153
+ if (done)
154
+ return;
155
+ done = true;
156
+ container.removeEventListener('animationend', onEnd);
157
+ finish();
158
+ };
159
+ this.nativeOnEnd = onEnd;
160
+ container.addEventListener('animationend', onEnd, { once: true });
161
+ window.setTimeout(onEnd, 1);
162
+ }
163
+ ensurePortal() {
164
+ if (this.portalRoot)
165
+ return;
166
+ const host = document.createElement('ix-dialog-portal-host');
167
+ const root = host.attachShadow({ mode: 'open' });
168
+ if (this.shadowRoot && 'adoptedStyleSheets' in this.shadowRoot) {
169
+ root.adoptedStyleSheets = this.shadowRoot.adoptedStyleSheets;
170
+ }
171
+ document.body.appendChild(host);
172
+ this.portalHost = host;
173
+ this.portalRoot = root;
174
+ }
175
+ attachPortalStyles() {
176
+ if (!this.portalRoot || this.portalStyleEl)
177
+ return;
178
+ const style = document.createElement('style');
179
+ style.textContent = `
180
+ dialog {
181
+ position: fixed;
182
+ inset: 0;
183
+ margin: 0;
184
+ padding: 0;
185
+ border: 0;
186
+ top: 30%;
187
+ left: 5%;
188
+ background: transparent;
189
+ display: grid;
190
+ place-items: center;
191
+ pointer-events: none;
192
+ z-index: 1000;
193
+ max-width: none !important;
194
+ max-height: none !important;
195
+ }
196
+ .scrim {
197
+ position: fixed;
198
+ inset: 0;
199
+ background: var(--ix-dialog-scrim, rgba(0,0,0,0.32));
200
+ pointer-events: auto;
201
+ z-index: 1000;
202
+ touch-action: none;
203
+ border: 0;
204
+ padding: 0;
205
+ appearance: none;
206
+ }
207
+ .container {
208
+ position: relative;
209
+ border-radius: 0.75rem;
210
+ background: var(--ix-dialog-bg, #fff);
211
+ box-shadow: var(--ix-dialog-shadow, 0 10px 30px rgba(0,0,0,0.25));
212
+ display: grid;
213
+ grid-template-rows: auto 1fr auto;
214
+ overflow: visible;
215
+ pointer-events: auto;
216
+ z-index: 1001;
217
+ max-width: none!important;
218
+ }
219
+ .container .content {
220
+ overflow: visible;
221
+ }
222
+ @media (prefers-reduced-motion: reduce) {
223
+ dialog > .container { animation: none !important; }
224
+ }
225
+ `;
226
+ this.portalRoot.append(style);
227
+ this.portalStyleEl = style;
228
+ }
229
+ teardownPortal() {
230
+ var _a;
231
+ if (!this.portalHost)
232
+ return;
233
+ if (this.portalRoot)
234
+ render(nothing, this.portalRoot);
235
+ (_a = this.portalStyleEl) === null || _a === void 0 ? void 0 : _a.remove();
236
+ this.portalStyleEl = undefined;
237
+ this.portalHost.remove();
238
+ this.portalRoot = undefined;
239
+ this.portalHost = undefined;
240
+ }
241
+ moveNodesToPortal(slotName, targetSelector) {
242
+ if (!this.nativeDialogContainer)
243
+ return;
244
+ const target = this.nativeDialogContainer.querySelector(targetSelector);
245
+ if (!target)
246
+ return;
247
+ const nodes = Array.from(this.children).filter(el => el instanceof HTMLElement && el.slot === slotName);
248
+ nodes.forEach(n => target.appendChild(n));
249
+ }
250
+ moveNodesBackFromPortal() {
251
+ if (!this.nativeDialogContainer)
252
+ return;
253
+ const h = this.nativeDialogContainer.querySelector('.headline');
254
+ const b = this.nativeDialogContainer.querySelector('.content');
255
+ const a = this.nativeDialogContainer.querySelector('.actions');
256
+ [h, b, a].forEach(container => {
257
+ if (!container)
258
+ return;
259
+ const children = Array.from(container.childNodes);
260
+ children.forEach(n => this.appendChild(n));
261
+ });
262
+ }
263
+ populatePortal() {
264
+ this.moveNodesToPortal('headline', '.headline');
265
+ this.moveNodesToPortal('content', '.content');
266
+ this.moveNodesToPortal('actions', '.actions');
267
+ }
268
+ requestClose() {
269
+ this.open = false;
270
+ }
271
+ lockScroll() {
272
+ if (this.isScrollLocked)
273
+ return;
274
+ this.isScrollLocked = true;
275
+ this.scrollYBackup =
276
+ window.scrollY || document.documentElement.scrollTop || 0;
277
+ const { body } = document;
278
+ const scrollbarWidth = window.innerWidth - document.documentElement.clientWidth;
279
+ if (scrollbarWidth > 0) {
280
+ body.style.paddingRight = `${scrollbarWidth}px`;
281
+ }
282
+ body.style.overflow = 'hidden';
283
+ body.style.position = 'fixed';
284
+ body.style.top = `-${this.scrollYBackup}px`;
285
+ body.style.left = '0';
286
+ body.style.right = '0';
287
+ body.style.width = '100%';
288
+ const stopIfOutside = (ev) => {
289
+ const t = ev.target;
290
+ if (!this.nativeDialogContainer || !t)
291
+ return;
292
+ if (!this.nativeDialogContainer.contains(t))
293
+ ev.preventDefault();
294
+ };
295
+ const onTouchMove = (e) => stopIfOutside(e);
296
+ const onKeyDown = (e) => {
297
+ const keys = [
298
+ 'PageUp',
299
+ 'PageDown',
300
+ 'Home',
301
+ 'End',
302
+ 'ArrowUp',
303
+ 'ArrowDown',
304
+ ' ',
305
+ ];
306
+ if (!keys.includes(e.key))
307
+ return;
308
+ const t = e.target;
309
+ if (!this.nativeDialogContainer || !t)
310
+ return;
311
+ if (!this.nativeDialogContainer.contains(t))
312
+ e.preventDefault();
313
+ };
314
+ window.addEventListener('touchmove', onTouchMove, { passive: false });
315
+ window.addEventListener('keydown', onKeyDown, { passive: false });
316
+ this.removeScrollHandlers = () => {
317
+ window.removeEventListener('touchmove', onTouchMove);
318
+ window.removeEventListener('keydown', onKeyDown);
319
+ };
320
+ }
321
+ unlockScroll() {
322
+ if (!this.isScrollLocked)
323
+ return;
324
+ this.isScrollLocked = false;
325
+ if (this.removeScrollHandlers) {
326
+ this.removeScrollHandlers();
327
+ this.removeScrollHandlers = undefined;
328
+ }
329
+ const { body } = document;
330
+ body.style.paddingRight = '';
331
+ body.style.position = '';
332
+ body.style.top = '';
333
+ body.style.left = '';
334
+ body.style.right = '';
335
+ body.style.overflow = '';
336
+ body.style.width = '';
337
+ window.scrollTo(0, this.scrollYBackup || 0);
29
338
  }
30
339
  onOpen() {
31
340
  this.dispatchEvent(new Event('open'));
32
- // IXUAT-9997 prevent page scroll on dialog open
33
- const page = document.body;
34
- const clientWidthBefore = page.clientWidth;
35
- this.scrollPosition = window.scrollY;
36
- page.style.overflow = 'hidden';
37
- const clientWidthAfter = page.clientWidth;
38
- const scrollbarWidth = clientWidthAfter - clientWidthBefore;
39
- page.style.paddingRight = `${scrollbarWidth}px`;
40
- page.style.position = 'fixed';
41
- page.style.top = `-${this.scrollPosition}px`;
42
- page.style.left = '0';
43
- page.style.right = '0';
44
- page.style.width = '100%';
341
+ this.lockScroll();
45
342
  }
46
343
  onOpened() {
47
344
  this.dispatchEvent(new Event('opened'));
@@ -51,38 +348,194 @@ export class IxDialog extends LitElement {
51
348
  }
52
349
  onClosed() {
53
350
  this.dispatchEvent(new Event('closed'));
54
- this.resetBodyStyles();
351
+ this.unlockScroll();
55
352
  }
56
353
  onCancel(e) {
57
- if (this.preventCancel) {
354
+ if (this.preventCancel)
58
355
  e.preventDefault();
59
- }
60
- this.dispatchEvent(new Event('cancel'));
356
+ this.dispatchEvent(new Event('cancel', { bubbles: true, composed: true }));
61
357
  }
62
- render() {
358
+ portalTemplate() {
63
359
  return html `
64
- <md-dialog
65
- ?open=${this.open}
66
- class="dialog"
67
- ?preventCloseOnScrimClick=${this.preventCloseOnScrimClick}
68
- ?disableNextClickIsFromContent=${this.disableNextClickIsFromContent}
69
- @open=${this.onOpen}
70
- @opened=${this.onOpened}
71
- @close=${this.onClose}
72
- @closed=${this.onClosed}
73
- @cancel=${this.onCancel}
360
+ <dialog
361
+ ${ref(this.dialogRef)}
362
+ @cancel=${this.onNativeCancel}
363
+ @keydown=${this.onKeydown}
74
364
  >
75
- <slot slot="headline" name="headline"></slot>
76
- <slot slot="content" name="content"></slot>
77
- <slot slot="actions" name="actions"></slot>
78
- </md-dialog>
365
+ <button
366
+ class="scrim"
367
+ type="button"
368
+ aria-label="Close dialog"
369
+ @click=${this.onScrimClick}
370
+ ></button>
371
+ <div
372
+ class="container"
373
+ ${ref(this.containerRef)}
374
+ role="dialog"
375
+ aria-modal="true"
376
+ >
377
+ <div class="headline"></div>
378
+ <div class="content"></div>
379
+ <div class="actions"></div>
380
+ </div>
381
+ </dialog>
79
382
  `;
80
383
  }
384
+ renderMdDialog() {
385
+ if (this.portalHost) {
386
+ this.moveNodesBackFromPortal();
387
+ this.teardownPortal();
388
+ }
389
+ return html `<md-dialog
390
+ ?open=${this.open}
391
+ class="dialog"
392
+ ?preventCloseOnScrimClick=${this.preventCloseOnScrimClick}
393
+ ?disableNextClickIsFromContent=${this.disableNextClickIsFromContent}
394
+ ?allowOverflow=${this.allowOverflow}
395
+ @open=${this.onOpen}
396
+ @opened=${this.onOpened}
397
+ @close=${this.onClose}
398
+ @closed=${this.onClosed}
399
+ @cancel=${this.onCancel}
400
+ >
401
+ <slot slot="headline" name="headline"></slot>
402
+ <slot slot="content" name="content"></slot>
403
+ <slot slot="actions" name="actions"></slot>
404
+ </md-dialog>`;
405
+ }
406
+ renderNativeDialog() {
407
+ if (this.portalRoot) {
408
+ render(this.portalTemplate(), this.portalRoot);
409
+ this.populatePortal();
410
+ }
411
+ return nothing;
412
+ }
413
+ render() {
414
+ return this.useNativeDialog
415
+ ? this.renderNativeDialog()
416
+ : this.renderMdDialog();
417
+ }
81
418
  }
82
419
  (() => {
83
420
  requestUpdateOnAriaChange(IxDialog);
84
421
  })();
85
- /** @nocollapse */
422
+ IxDialog.styles = [
423
+ IxDialogStyles,
424
+ css `
425
+ :host([use-native-dialog]) dialog[open],
426
+ :host([use-native-dialog][closing]) dialog {
427
+ position: fixed;
428
+ inset: 0;
429
+ margin: 0;
430
+ padding: 0;
431
+ border: 0;
432
+ background: transparent;
433
+ display: block;
434
+ inline-size: 100vw;
435
+ block-size: 100dvh;
436
+ pointer-events: none;
437
+ z-index: 99;
438
+ overscroll-behavior: contain;
439
+ }
440
+
441
+ :host([use-native-dialog]) dialog[open] .scrim,
442
+ :host([use-native-dialog][closing]) .scrim,
443
+ :host([use-native-dialog]) dialog[open] > .container,
444
+ :host([use-native-dialog][closing]) dialog > .container {
445
+ pointer-events: auto;
446
+ }
447
+
448
+ :host([use-native-dialog]) dialog[open] .scrim,
449
+ :host([use-native-dialog][closing]) .scrim {
450
+ position: fixed;
451
+ inset: 0;
452
+ background: var(--ix-dialog-scrim, rgba(0, 0, 0, 0.32));
453
+ }
454
+
455
+ :host([use-native-dialog]) dialog[open] .scrim {
456
+ overscroll-behavior: contain;
457
+ touch-action: none;
458
+ }
459
+
460
+ :host([use-native-dialog]) dialog[open] > .container,
461
+ :host([use-native-dialog][closing]) dialog > .container {
462
+ transform: translate(-50%, -50%);
463
+ width: auto;
464
+ height: auto;
465
+ max-block-size: var(--ix-dialog-max-height, 90dvh);
466
+ border-radius: 0.75rem;
467
+ background: var(--ix-dialog-bg, #fff);
468
+ box-shadow: var(
469
+ --ix-dialog-shadow,
470
+ 0 0.625rem 1.875rem rgba(0, 0, 0, 0.25)
471
+ );
472
+ display: grid;
473
+ grid-template-rows: auto 1fr auto;
474
+ overflow: hidden;
475
+ z-index: 9;
476
+ transform-origin: top center;
477
+ will-change: transform, opacity;
478
+ }
479
+
480
+ :host([use-native-dialog]) .headline,
481
+ :host([use-native-dialog]) .content,
482
+ :host([use-native-dialog]) .actions {
483
+ padding: var(--ix-dialog-section-padding, 1rem);
484
+ }
485
+
486
+ :host([use-native-dialog]) .content {
487
+ overflow: auto;
488
+ }
489
+
490
+ :host([use-native-dialog]) .actions {
491
+ display: inline-flex;
492
+ gap: var(--ix-dialog-actions-gap, 0.5rem);
493
+ justify-content: flex-end;
494
+ align-items: center;
495
+ padding-block: var(--ix-dialog-actions-padding-block, 0.75rem);
496
+ border-top: var(
497
+ --ix-dialog-actions-border,
498
+ 1px solid rgba(0, 0, 0, 0.08)
499
+ );
500
+ }
501
+
502
+ @keyframes ix-fold-in {
503
+ from {
504
+ transform: translate(-50%, -50%) translateY(-0.5rem) scaleY(0.92);
505
+ opacity: 0;
506
+ }
507
+ to {
508
+ transform: translate(-50%, -50%) translateY(0) scaleY(1);
509
+ opacity: 1;
510
+ }
511
+ }
512
+ @keyframes ix-fold-out {
513
+ from {
514
+ transform: translate(-50%, -50%) translateY(0) scaleY(1);
515
+ opacity: 1;
516
+ }
517
+ to {
518
+ transform: translate(-50%, -50%) translateY(-0.5rem) scaleY(0.98);
519
+ opacity: 0;
520
+ }
521
+ }
522
+
523
+ :host([use-native-dialog]:not([closing])) dialog[open] > .container {
524
+ animation: ix-fold-in var(--ix-dialog-in-dur, 1000ms)
525
+ cubic-bezier(0.2, 0.7, 0.3, 1) both;
526
+ }
527
+ :host([use-native-dialog][closing]) dialog > .container {
528
+ animation: ix-fold-out var(--ix-dialog-out-dur, 250ms)
529
+ cubic-bezier(0.2, 0.7, 0.3, 1) both;
530
+ }
531
+
532
+ @media (prefers-reduced-motion: reduce) {
533
+ :host([use-native-dialog]) dialog > .container {
534
+ animation: none !important;
535
+ }
536
+ }
537
+ `,
538
+ ];
86
539
  IxDialog.shadowRootOptions = {
87
540
  ...LitElement.shadowRootOptions,
88
541
  delegatesFocus: true,
@@ -102,7 +555,13 @@ __decorate([
102
555
  __decorate([
103
556
  property({ type: Boolean })
104
557
  ], IxDialog.prototype, "disableNextClickIsFromContent", void 0);
558
+ __decorate([
559
+ property({ type: Boolean, reflect: true, attribute: 'use-native-dialog' })
560
+ ], IxDialog.prototype, "useNativeDialog", void 0);
561
+ __decorate([
562
+ property({ type: Boolean })
563
+ ], IxDialog.prototype, "allowOverflow", void 0);
105
564
  __decorate([
106
565
  state()
107
- ], IxDialog.prototype, "scrollPosition", void 0);
566
+ ], IxDialog.prototype, "nativeClosing", void 0);
108
567
  //# sourceMappingURL=IxDialog.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"IxDialog.js","sourceRoot":"","sources":["../src/IxDialog.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,gBAAgB,CAAC;AACxB,OAAO,EAAE,yBAAyB,EAAE,MAAM,yCAAyC,CAAC;AAGpF,MAAM,OAAO,QAAS,SAAQ,UAAU;IAAxC;;QAc8C,SAAI,GAAG,KAAK,CAAC;QAEC,kBAAa,GACrE,KAAK,CAAC;QAEqB,6BAAwB,GAAG,KAAK,CAAC;QAEjC,kCAA6B,GAAG,KAAK,CAAC;QAElD,mBAAc,GAAG,CAAC,CAAC;IA2EtC,CAAC;IAzEC,oBAAoB;QAClB,KAAK,CAAC,oBAAoB,EAAE,CAAC;QAC7B,IAAI,CAAC,eAAe,EAAE,CAAC;IACzB,CAAC;IAED,eAAe;QACb,MAAM,IAAI,GAAG,QAAQ,CAAC,IAAI,CAAC;QAC3B,IAAI,CAAC,KAAK,CAAC,YAAY,GAAG,GAAG,CAAC;QAC9B,IAAI,CAAC,KAAK,CAAC,QAAQ,GAAG,EAAE,CAAC;QACzB,IAAI,CAAC,KAAK,CAAC,GAAG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AR,KAAK,EAAE;gDAA4B","sourcesContent":["import { html, LitElement } from 'lit';\nimport { property, query, state } from 'lit/decorators.js';\nimport './md-dialog.js';\nimport { requestUpdateOnAriaChange } from '@material/web/internal/aria/delegate.js';\nimport { Dialog } from './internal/dialog.js';\n\nexport class IxDialog extends LitElement {\n static {\n requestUpdateOnAriaChange(IxDialog);\n }\n\n /** @nocollapse */\n static override shadowRootOptions = {\n ...LitElement.shadowRootOptions,\n delegatesFocus: true,\n };\n\n @query('.dialog')\n readonly component!: Dialog;\n\n @property({ type: Boolean, reflect: true }) open = false;\n\n @property({ type: Boolean, attribute: 'prevent-cancel' }) preventCancel =\n false;\n\n @property({ type: Boolean }) preventCloseOnScrimClick = false;\n\n @property({ type: Boolean }) disableNextClickIsFromContent = false;\n\n @state() private scrollPosition = 0;\n\n disconnectedCallback(): void {\n super.disconnectedCallback();\n this.resetBodyStyles();\n }\n\n resetBodyStyles() {\n const page = document.body;\n page.style.paddingRight = '0';\n page.style.position = '';\n page.style.top = '';\n page.style.left = '';\n page.style.right = '';\n page.style.overflow = '';\n page.style.width = '';\n window.scrollTo(0, this.scrollPosition);\n }\n\n onOpen() {\n this.dispatchEvent(new Event('open'));\n // IXUAT-9997 prevent page scroll on dialog open\n const page = document.body;\n const clientWidthBefore = page.clientWidth;\n this.scrollPosition = window.scrollY;\n page.style.overflow = 'hidden';\n const clientWidthAfter = page.clientWidth;\n const scrollbarWidth = clientWidthAfter - clientWidthBefore;\n page.style.paddingRight = `${scrollbarWidth}px`;\n page.style.position = 'fixed';\n page.style.top = `-${this.scrollPosition}px`;\n page.style.left = '0';\n page.style.right = '0';\n page.style.width = '100%';\n }\n\n onOpened() {\n this.dispatchEvent(new Event('opened'));\n }\n\n onClose() {\n this.dispatchEvent(new Event('close'));\n }\n\n onClosed() {\n this.dispatchEvent(new Event('closed'));\n this.resetBodyStyles();\n }\n\n onCancel(e: any) {\n if (this.preventCancel) {\n e.preventDefault();\n }\n this.dispatchEvent(new Event('cancel'));\n }\n\n render() {\n return html`\n <md-dialog\n ?open=${this.open}\n class=\"dialog\"\n ?preventCloseOnScrimClick=${this.preventCloseOnScrimClick}\n ?disableNextClickIsFromContent=${this.disableNextClickIsFromContent}\n @open=${this.onOpen}\n @opened=${this.onOpened}\n @close=${this.onClose}\n @closed=${this.onClosed}\n @cancel=${this.onCancel}\n >\n <slot slot=\"headline\" name=\"headline\"></slot>\n <slot slot=\"content\" name=\"content\"></slot>\n <slot slot=\"actions\" name=\"actions\"></slot>\n </md-dialog>\n `;\n }\n}\n"]}
1
+ {"version":3,"file":"IxDialog.js","sourceRoot":"","sources":["../src/IxDialog.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,yCAAyC,CAAC;AACpF,OAAO,EAAE,GAAG,EAAkB,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,KAAK,CAAC;AAC7E,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,GAAG,EAAO,MAAM,uBAAuB,CAAC;AAE5D,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,gBAAgB,CAAC;AAExB,MAAM,OAAO,QAAS,SAAQ,UAAU;IAAxC;;QAkI8C,SAAI,GAAG,KAAK,CAAC;QAEC,kBAAa,GACrE,KAAK,CAAC;QAEqB,6BAAwB,GAAG,KAAK,CAAC;QAEjC,kCAA6B,GAAG,KAAK,CAAC;QAGnE,oBAAe,GAAG,KAAK,CAAC;QAEK,kBAAa,GAAG,KAAK,CAAC;QAElC,kBAAa,GAAG,KAAK,CAAC;QAE/B,cAAS,GAA2B,SAAS,EAAE,CAAC;QAEhD,iBAAY,GAAwB,SAAS,EAAE,CAAC;QAQhD,sBAAiB,GAAG,KAAK,CAAC;QAE1B,mBAAc,GAAG,KAAK,CAAC;QAEvB,kBAAa,GAAG,CAAC,CAAC;QA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,GAAG;IAClC,GAAG,UAAU,CAAC,iBAAiB;IAC/B,cAAc,EAAE,IAAI;CACrB,CAAC;AAEgB;IAAjB,KAAK,CAAC,SAAS,CAAC;2CAA6B;AAEF;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;sCAAc;AAEC;IAAzD,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,CAAC;+CACjD;AAEqB;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;0DAAkC;AAEjC;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;+DAAuC;AAGnE;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,mBAAmB,EAAE,CAAC;iDACnD;AAEK;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;+CAAuB;AAE1C;IAAR,KAAK,EAAE;+CAA+B","sourcesContent":["import { requestUpdateOnAriaChange } from '@material/web/internal/aria/delegate.js';\nimport { css, CSSResultGroup, html, LitElement, nothing, render } from 'lit';\nimport { property, query, state } from 'lit/decorators.js';\nimport { createRef, ref, Ref } from 'lit/directives/ref.js';\nimport { Dialog } from './internal/dialog.js';\nimport { IxDialogStyles } from './ix-dialog-styles.js';\nimport './md-dialog.js';\n\nexport class IxDialog extends LitElement {\n static {\n requestUpdateOnAriaChange(IxDialog);\n }\n\n static styles: CSSResultGroup = [\n IxDialogStyles,\n css`\n :host([use-native-dialog]) dialog[open],\n :host([use-native-dialog][closing]) dialog {\n position: fixed;\n inset: 0;\n margin: 0;\n padding: 0;\n border: 0;\n background: transparent;\n display: block;\n inline-size: 100vw;\n block-size: 100dvh;\n pointer-events: none;\n z-index: 99;\n overscroll-behavior: contain;\n }\n\n :host([use-native-dialog]) dialog[open] .scrim,\n :host([use-native-dialog][closing]) .scrim,\n :host([use-native-dialog]) dialog[open] > .container,\n :host([use-native-dialog][closing]) dialog > .container {\n pointer-events: auto;\n }\n\n :host([use-native-dialog]) dialog[open] .scrim,\n :host([use-native-dialog][closing]) .scrim {\n position: fixed;\n inset: 0;\n background: var(--ix-dialog-scrim, rgba(0, 0, 0, 0.32));\n }\n\n :host([use-native-dialog]) dialog[open] .scrim {\n overscroll-behavior: contain;\n touch-action: none;\n }\n\n :host([use-native-dialog]) dialog[open] > .container,\n :host([use-native-dialog][closing]) dialog > .container {\n transform: translate(-50%, -50%);\n width: auto;\n height: auto;\n max-block-size: var(--ix-dialog-max-height, 90dvh);\n border-radius: 0.75rem;\n background: var(--ix-dialog-bg, #fff);\n box-shadow: var(\n --ix-dialog-shadow,\n 0 0.625rem 1.875rem rgba(0, 0, 0, 0.25)\n );\n display: grid;\n grid-template-rows: auto 1fr auto;\n overflow: hidden;\n z-index: 9;\n transform-origin: top center;\n will-change: transform, opacity;\n }\n\n :host([use-native-dialog]) .headline,\n :host([use-native-dialog]) .content,\n :host([use-native-dialog]) .actions {\n padding: var(--ix-dialog-section-padding, 1rem);\n }\n\n :host([use-native-dialog]) .content {\n overflow: auto;\n }\n\n :host([use-native-dialog]) .actions {\n display: inline-flex;\n gap: var(--ix-dialog-actions-gap, 0.5rem);\n justify-content: flex-end;\n align-items: center;\n padding-block: var(--ix-dialog-actions-padding-block, 0.75rem);\n border-top: var(\n --ix-dialog-actions-border,\n 1px solid rgba(0, 0, 0, 0.08)\n );\n }\n\n @keyframes ix-fold-in {\n from {\n transform: translate(-50%, -50%) translateY(-0.5rem) scaleY(0.92);\n opacity: 0;\n }\n to {\n transform: translate(-50%, -50%) translateY(0) scaleY(1);\n opacity: 1;\n }\n }\n @keyframes ix-fold-out {\n from {\n transform: translate(-50%, -50%) translateY(0) scaleY(1);\n opacity: 1;\n }\n to {\n transform: translate(-50%, -50%) translateY(-0.5rem) scaleY(0.98);\n opacity: 0;\n }\n }\n\n :host([use-native-dialog]:not([closing])) dialog[open] > .container {\n animation: ix-fold-in var(--ix-dialog-in-dur, 1000ms)\n cubic-bezier(0.2, 0.7, 0.3, 1) both;\n }\n :host([use-native-dialog][closing]) dialog > .container {\n animation: ix-fold-out var(--ix-dialog-out-dur, 250ms)\n cubic-bezier(0.2, 0.7, 0.3, 1) both;\n }\n\n @media (prefers-reduced-motion: reduce) {\n :host([use-native-dialog]) dialog > .container {\n animation: none !important;\n }\n }\n `,\n ];\n\n static override shadowRootOptions = {\n ...LitElement.shadowRootOptions,\n delegatesFocus: true,\n };\n\n @query('.dialog') readonly component!: Dialog;\n\n @property({ type: Boolean, reflect: true }) open = false;\n\n @property({ type: Boolean, attribute: 'prevent-cancel' }) preventCancel =\n false;\n\n @property({ type: Boolean }) preventCloseOnScrimClick = false;\n\n @property({ type: Boolean }) disableNextClickIsFromContent = false;\n\n @property({ type: Boolean, reflect: true, attribute: 'use-native-dialog' })\n useNativeDialog = false;\n\n @property({ type: Boolean }) allowOverflow = false;\n\n @state() private nativeClosing = false;\n\n private dialogRef: Ref<HTMLDialogElement> = createRef();\n\n private containerRef: Ref<HTMLDivElement> = createRef();\n\n private portalHost?: HTMLElement;\n\n private portalRoot?: ShadowRoot;\n\n private portalStyleEl?: HTMLStyleElement;\n\n private pointerDownInside = false;\n\n private isScrollLocked = false;\n\n private scrollYBackup = 0;\n\n private removeScrollHandlers?: () => void;\n\n private nativeOnEnd?: () => void;\n\n private mo?: MutationObserver;\n\n private get nativeDialog(): HTMLDialogElement | null {\n return this.dialogRef.value ?? null;\n }\n\n private get nativeDialogContainer(): HTMLDivElement | null {\n return this.containerRef.value ?? null;\n }\n\n connectedCallback(): void {\n super.connectedCallback();\n this.mo = new MutationObserver(() => {\n if (this.useNativeDialog && this.open) this.populatePortal();\n });\n this.mo.observe(this, {\n childList: true,\n subtree: true,\n attributes: true,\n characterData: true,\n });\n }\n\n disconnectedCallback(): void {\n super.disconnectedCallback();\n this.mo?.disconnect();\n this.unlockScroll();\n this.teardownPortal();\n }\n\n updated(changed: Map<string, unknown>) {\n if (!this.useNativeDialog) return;\n if (changed.has('open')) {\n if (this.open) {\n this.ensurePortal();\n if (this.portalRoot) {\n this.attachPortalStyles();\n render(this.portalTemplate(), this.portalRoot);\n this.populatePortal();\n }\n if (this.nativeClosing) {\n this.nativeClosing = false;\n this.nativeDialogContainer?.classList.remove('closing');\n if (this.nativeOnEnd && this.nativeDialogContainer) {\n this.nativeDialogContainer.removeEventListener(\n 'animationend',\n this.nativeOnEnd\n );\n }\n this.nativeOnEnd = undefined;\n }\n this.dispatchEvent(\n new Event('open', { bubbles: true, composed: true })\n );\n this.lockScroll();\n requestAnimationFrame(() => {\n this.nativeDialog?.show();\n requestAnimationFrame(() => {\n this.dispatchEvent(\n new Event('opened', { bubbles: true, composed: true })\n );\n });\n });\n } else {\n this.startNativeCloseAnimation();\n }\n }\n }\n\n public dismiss() {\n if (!this.open) return;\n Promise.resolve().then(() => {\n this.requestClose();\n });\n }\n\n private startNativeCloseAnimation() {\n if (this.nativeClosing) return;\n this.nativeClosing = true;\n this.dispatchEvent(new Event('close', { bubbles: true, composed: true }));\n\n const finish = () => {\n this.nativeDialogContainer?.classList.remove('closing');\n this.nativeClosing = false;\n this.nativeDialog?.close();\n this.unlockScroll();\n this.dispatchEvent(\n new Event('closed', { bubbles: true, composed: true })\n );\n this.moveNodesBackFromPortal();\n this.teardownPortal();\n };\n\n const container = this.nativeDialogContainer;\n if (!container) {\n finish();\n return;\n }\n\n container.classList.add('closing');\n\n let done = false;\n const onEnd = () => {\n if (done) return;\n done = true;\n container.removeEventListener('animationend', onEnd);\n finish();\n };\n this.nativeOnEnd = onEnd;\n container.addEventListener('animationend', onEnd, { once: true });\n\n window.setTimeout(onEnd, 1);\n }\n\n private ensurePortal() {\n if (this.portalRoot) return;\n const host = document.createElement('ix-dialog-portal-host');\n const root = host.attachShadow({ mode: 'open' });\n if (this.shadowRoot && 'adoptedStyleSheets' in this.shadowRoot) {\n (root as any).adoptedStyleSheets = (\n this.shadowRoot as any\n ).adoptedStyleSheets;\n }\n document.body.appendChild(host);\n this.portalHost = host;\n this.portalRoot = root;\n }\n\n private attachPortalStyles() {\n if (!this.portalRoot || this.portalStyleEl) return;\n const style = document.createElement('style');\n style.textContent = `\n dialog {\n position: fixed;\n inset: 0;\n margin: 0;\n padding: 0;\n border: 0;\n top: 30%;\n left: 5%;\n background: transparent;\n display: grid;\n place-items: center;\n pointer-events: none;\n z-index: 1000;\n max-width: none !important;\n max-height: none !important;\n }\n .scrim {\n position: fixed;\n inset: 0;\n background: var(--ix-dialog-scrim, rgba(0,0,0,0.32));\n pointer-events: auto;\n z-index: 1000;\n touch-action: none;\n border: 0;\n padding: 0;\n appearance: none;\n }\n .container {\n position: relative;\n border-radius: 0.75rem;\n background: var(--ix-dialog-bg, #fff);\n box-shadow: var(--ix-dialog-shadow, 0 10px 30px rgba(0,0,0,0.25));\n display: grid;\n grid-template-rows: auto 1fr auto;\n overflow: visible;\n pointer-events: auto;\n z-index: 1001;\n max-width: none!important;\n }\n .container .content {\n overflow: visible;\n }\n @media (prefers-reduced-motion: reduce) {\n dialog > .container { animation: none !important; }\n }\n`;\n this.portalRoot.append(style);\n this.portalStyleEl = style;\n }\n\n private teardownPortal() {\n if (!this.portalHost) return;\n if (this.portalRoot) render(nothing, this.portalRoot);\n this.portalStyleEl?.remove();\n this.portalStyleEl = undefined;\n this.portalHost.remove();\n this.portalRoot = undefined;\n this.portalHost = undefined;\n }\n\n private moveNodesToPortal(slotName: string, targetSelector: string) {\n if (!this.nativeDialogContainer) return;\n const target = this.nativeDialogContainer.querySelector(targetSelector);\n if (!target) return;\n const nodes = Array.from(this.children).filter(\n el => el instanceof HTMLElement && el.slot === slotName\n );\n nodes.forEach(n => target.appendChild(n));\n }\n\n private moveNodesBackFromPortal() {\n if (!this.nativeDialogContainer) return;\n const h = this.nativeDialogContainer.querySelector('.headline');\n const b = this.nativeDialogContainer.querySelector('.content');\n const a = this.nativeDialogContainer.querySelector('.actions');\n [h, b, a].forEach(container => {\n if (!container) return;\n const children = Array.from(container.childNodes);\n children.forEach(n => this.appendChild(n));\n });\n }\n\n private populatePortal() {\n this.moveNodesToPortal('headline', '.headline');\n this.moveNodesToPortal('content', '.content');\n this.moveNodesToPortal('actions', '.actions');\n }\n\n private onKeydown = (e: KeyboardEvent) => {\n if (e.key !== 'Escape') return;\n if (this.preventCancel) {\n e.preventDefault();\n return;\n }\n const cancelEvt = new Event('cancel', {\n bubbles: true,\n composed: true,\n cancelable: true,\n });\n const prevented = !this.dispatchEvent(cancelEvt);\n if (prevented) {\n e.preventDefault();\n return;\n }\n this.requestClose();\n };\n\n private onNativeCancel = (e: Event) => {\n const forwarded = new Event('cancel', {\n bubbles: true,\n composed: true,\n cancelable: true,\n });\n const prevented = !this.dispatchEvent(forwarded);\n if (prevented) {\n e.preventDefault();\n return;\n }\n this.requestClose();\n };\n\n private requestClose() {\n this.open = false;\n }\n\n private onScrimClick = () => {\n if (!this.preventCloseOnScrimClick) this.requestClose();\n };\n\n private lockScroll() {\n if (this.isScrollLocked) return;\n this.isScrollLocked = true;\n this.scrollYBackup =\n window.scrollY || document.documentElement.scrollTop || 0;\n const { body } = document;\n const scrollbarWidth =\n window.innerWidth - document.documentElement.clientWidth;\n if (scrollbarWidth > 0) {\n body.style.paddingRight = `${scrollbarWidth}px`;\n }\n body.style.overflow = 'hidden';\n body.style.position = 'fixed';\n body.style.top = `-${this.scrollYBackup}px`;\n body.style.left = '0';\n body.style.right = '0';\n body.style.width = '100%';\n const stopIfOutside = (ev: Event) => {\n const t = ev.target as Node | null;\n if (!this.nativeDialogContainer || !t) return;\n if (!this.nativeDialogContainer.contains(t)) ev.preventDefault();\n };\n const onTouchMove = (e: TouchEvent) => stopIfOutside(e);\n const onKeyDown = (e: KeyboardEvent) => {\n const keys = [\n 'PageUp',\n 'PageDown',\n 'Home',\n 'End',\n 'ArrowUp',\n 'ArrowDown',\n ' ',\n ];\n if (!keys.includes(e.key)) return;\n const t = e.target as Node | null;\n if (!this.nativeDialogContainer || !t) return;\n if (!this.nativeDialogContainer.contains(t)) e.preventDefault();\n };\n window.addEventListener('touchmove', onTouchMove, { passive: false });\n window.addEventListener('keydown', onKeyDown, { passive: false });\n this.removeScrollHandlers = () => {\n window.removeEventListener('touchmove', onTouchMove as any);\n window.removeEventListener('keydown', onKeyDown as any);\n };\n }\n\n private unlockScroll() {\n if (!this.isScrollLocked) return;\n this.isScrollLocked = false;\n if (this.removeScrollHandlers) {\n this.removeScrollHandlers();\n this.removeScrollHandlers = undefined;\n }\n const { body } = document;\n body.style.paddingRight = '';\n body.style.position = '';\n body.style.top = '';\n body.style.left = '';\n body.style.right = '';\n body.style.overflow = '';\n body.style.width = '';\n window.scrollTo(0, this.scrollYBackup || 0);\n }\n\n onOpen() {\n this.dispatchEvent(new Event('open'));\n this.lockScroll();\n }\n\n onOpened() {\n this.dispatchEvent(new Event('opened'));\n }\n\n onClose() {\n this.dispatchEvent(new Event('close'));\n }\n\n onClosed() {\n this.dispatchEvent(new Event('closed'));\n this.unlockScroll();\n }\n\n onCancel(e: Event) {\n if (this.preventCancel) e.preventDefault();\n this.dispatchEvent(new Event('cancel', { bubbles: true, composed: true }));\n }\n\n private portalTemplate() {\n return html`\n <dialog\n ${ref(this.dialogRef)}\n @cancel=${this.onNativeCancel}\n @keydown=${this.onKeydown}\n >\n <button\n class=\"scrim\"\n type=\"button\"\n aria-label=\"Close dialog\"\n @click=${this.onScrimClick}\n ></button>\n <div\n class=\"container\"\n ${ref(this.containerRef)}\n role=\"dialog\"\n aria-modal=\"true\"\n >\n <div class=\"headline\"></div>\n <div class=\"content\"></div>\n <div class=\"actions\"></div>\n </div>\n </dialog>\n `;\n }\n\n private renderMdDialog() {\n if (this.portalHost) {\n this.moveNodesBackFromPortal();\n this.teardownPortal();\n }\n return html`<md-dialog\n ?open=${this.open}\n class=\"dialog\"\n ?preventCloseOnScrimClick=${this.preventCloseOnScrimClick}\n ?disableNextClickIsFromContent=${this.disableNextClickIsFromContent}\n ?allowOverflow=${this.allowOverflow}\n @open=${this.onOpen}\n @opened=${this.onOpened}\n @close=${this.onClose}\n @closed=${this.onClosed}\n @cancel=${this.onCancel}\n >\n <slot slot=\"headline\" name=\"headline\"></slot>\n <slot slot=\"content\" name=\"content\"></slot>\n <slot slot=\"actions\" name=\"actions\"></slot>\n </md-dialog>`;\n }\n\n private renderNativeDialog() {\n if (this.portalRoot) {\n render(this.portalTemplate(), this.portalRoot);\n this.populatePortal();\n }\n return nothing;\n }\n\n render() {\n return this.useNativeDialog\n ? this.renderNativeDialog()\n : this.renderMdDialog();\n }\n}\n"]}
@@ -39,6 +39,7 @@ export declare class Dialog extends LitElement {
39
39
  */
40
40
  type?: 'alert';
41
41
  disableNextClickIsFromContent: boolean;
42
+ allowOverflow: boolean;
42
43
  /**
43
44
  * Gets the opening animation for a dialog. Set to a new function to customize
44
45
  * the animation.
@@ -58,6 +58,7 @@ export class Dialog extends LitElement {
58
58
  */
59
59
  this.returnValue = '';
60
60
  this.disableNextClickIsFromContent = false;
61
+ this.allowOverflow = false;
61
62
  /**
62
63
  * Gets the opening animation for a dialog. Set to a new function to customize
63
64
  * the animation.
@@ -213,6 +214,7 @@ export class Dialog extends LitElement {
213
214
  scrollable,
214
215
  'show-top-divider': scrollable && !this.isAtScrollTop,
215
216
  'show-bottom-divider': scrollable && !this.isAtScrollBottom,
217
+ 'allow-overflow': this.allowOverflow,
216
218
  };
217
219
  const { ariaLabel } = this;
218
220
  return html `
@@ -406,6 +408,9 @@ __decorate([
406
408
  __decorate([
407
409
  property({ type: Boolean })
408
410
  ], Dialog.prototype, "disableNextClickIsFromContent", void 0);
411
+ __decorate([
412
+ property({ type: Boolean })
413
+ ], Dialog.prototype, "allowOverflow", void 0);
409
414
  __decorate([
410
415
  query('dialog')
411
416
  ], Dialog.prototype, "dialog", void 0);
@@ -1 +1 @@
1
- {"version":3,"file":"dialog.js","sourceRoot":"","sources":["../../src/internal/dialog.ts"],"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YAAY,CAAC;yCAAuD;AAEvD;IAAnB,KAAK,CAAC,WAAW,CAAC;wCAAsD;AAEtD;IAAlB,KAAK,CAAC,UAAU,CAAC;uCAAqD;AAEpD;IAAlB,KAAK,CAAC,UAAU,CAAC;uCAAqD;AAE9D;IAAR,KAAK,EAAE;6CAA+B;AAE9B;IAAR,KAAK,EAAE;gDAAkC;AAEtB;IAAnB,KAAK,CAAC,WAAW,CAAC;wCAAgD;AAE7C;IAArB,KAAK,CAAC,aAAa,CAAC;yCAAiD;AAE7C;IAAxB,KAAK,CAAC,gBAAgB,CAAC;4CAAoD;AAOnE;IAAR,KAAK,EAAE;2CAA6B;AAE5B;IAAR,KAAK,EAAE;0CAA4B;AAE3B;IAAR,KAAK,EAAE;uCAAyB","sourcesContent":["/* eslint-disable no-shadow */\n/* eslint-disable class-methods-use-this */\n/**\n * @license\n * Copyright 2023 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport '@material/web/divider/divider.js';\n\nimport { html, isServer, LitElement, nothing } from 'lit';\nimport { property, query, state } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js';\n\nimport { ARIAMixinStrict } from '@material/web/internal/aria/aria.js';\nimport { requestUpdateOnAriaChange } from '@material/web/internal/aria/delegate.js';\nimport { redispatchEvent } from '@material/web/internal/events/redispatch-event.js';\n\nimport {\n DIALOG_DEFAULT_CLOSE_ANIMATION,\n DIALOG_DEFAULT_OPEN_ANIMATION,\n DialogAnimation,\n DialogAnimationArgs,\n} from '@material/web/dialog/internal/animations.js';\n\n/**\n * A dialog component.\n *\n * @fires open {Event} Dispatched when the dialog is opening before any animations.\n * @fires opened {Event} Dispatched when the dialog has opened after any animations.\n * @fires close {Event} Dispatched when the dialog is closing before any animations.\n * @fires closed {Event} Dispatched when the dialog has closed after any animations.\n * @fires cancel {Event} Dispatched when the dialog has been canceled by clicking\n * on the scrim or pressing Escape.\n */\nexport class Dialog extends LitElement {\n static {\n requestUpdateOnAriaChange(Dialog);\n }\n\n /**\n * Opens the dialog when set to `true` and closes it when set to `false`.\n */\n @property({ type: Boolean })\n get open() {\n return this.isOpen;\n }\n\n set open(open: boolean) {\n if (open === this.isOpen) {\n return;\n }\n\n this.isOpen = open;\n if (open) {\n this.setAttribute('open', '');\n this.show();\n } else {\n this.removeAttribute('open');\n this.close();\n }\n }\n\n /**\n * When set to `true`, prevents the dialog from closing when clicking on the scrim\n */\n @property({ type: Boolean }) preventCloseOnScrimClick = false;\n\n /**\n * Gets or sets the dialog's return value, usually to indicate which button\n * a user pressed to close it.\n *\n * https://developer.mozilla.org/en-US/docs/Web/API/HTMLDialogElement/returnValue\n */\n @property({ attribute: false }) returnValue = '';\n\n /**\n * The type of dialog for accessibility. Set this to `alert` to announce a\n * dialog as an alert dialog.\n */\n @property() type?: 'alert';\n\n @property({ type: Boolean }) disableNextClickIsFromContent = false;\n\n /**\n * Gets the opening animation for a dialog. Set to a new function to customize\n * the animation.\n */\n getOpenAnimation = () => DIALOG_DEFAULT_OPEN_ANIMATION;\n\n /**\n * Gets the closing animation for a dialog. Set to a new function to customize\n * the animation.\n */\n getCloseAnimation = () => DIALOG_DEFAULT_CLOSE_ANIMATION;\n\n private isOpen = false;\n\n private isOpening = false;\n\n // getIsConnectedPromise() immediately sets the resolve property.\n private isConnectedPromiseResolve!: () => void;\n\n private isConnectedPromise = this.getIsConnectedPromise();\n\n @query('dialog') private readonly dialog!: HTMLDialogElement | null;\n\n @query('.scrim') private readonly scrim!: HTMLDialogElement | null;\n\n @query('.container') private readonly container!: HTMLDialogElement | null;\n\n @query('.headline') private readonly headline!: HTMLDialogElement | null;\n\n @query('.content') private readonly content!: HTMLDialogElement | null;\n\n @query('.actions') private readonly actions!: HTMLDialogElement | null;\n\n @state() private isAtScrollTop = false;\n\n @state() private isAtScrollBottom = false;\n\n @query('.scroller') private readonly scroller!: HTMLElement | null;\n\n @query('.top.anchor') private readonly topAnchor!: HTMLElement | null;\n\n @query('.bottom.anchor') private readonly bottomAnchor!: HTMLElement | null;\n\n private nextClickIsFromContent = false;\n\n private intersectionObserver?: IntersectionObserver;\n\n // Dialogs should not be SSR'd while open, so we can just use runtime checks.\n @state() private hasHeadline = false;\n\n @state() private hasActions = false;\n\n @state() private hasIcon = false;\n\n // See https://bugs.chromium.org/p/chromium/issues/detail?id=1512224\n // Chrome v120 has a bug where escape keys do not trigger cancels. If we get\n // a dialog \"close\" event that is triggered without a \"cancel\" after an escape\n // keydown, then we need to manually trigger our closing logic.\n //\n // This bug occurs when pressing escape to close a dialog without first\n // interacting with the dialog's content.\n //\n // Cleanup tracking:\n // https://github.com/material-components/material-web/issues/5330\n // This can be removed when full CloseWatcher support added and the above bug\n // in Chromium is fixed to fire 'cancel' with one escape press and close with\n // multiple.\n private escapePressedWithoutCancel = false;\n\n constructor() {\n super();\n if (!isServer) {\n this.addEventListener('submit', this.handleSubmit);\n\n // We do not use `delegatesFocus: true` due to a Chromium bug with\n // selecting text.\n // See https://bugs.chromium.org/p/chromium/issues/detail?id=950357\n //\n // Material requires using focus trapping within the dialog (see\n // b/314840853 for the bug to add it). This would normally mean we don't\n // care about delegating focus since the `<dialog>` never receives it.\n // However, we still need to handle situations when a user has not\n // provided an focusable child in the content. When that happens, the\n // `<dialog>` itself is focused.\n //\n // Listen to focus/blur instead of focusin/focusout since those can bubble\n // from content.\n this.addEventListener('focus', () => {\n this.dialog?.focus();\n });\n this.addEventListener('blur', () => {\n this.dialog?.blur();\n });\n }\n }\n\n /**\n * Opens the dialog and fires a cancelable `open` event. After a dialog's\n * animation, an `opened` event is fired.\n *\n * Add an `autocomplete` attribute to a child of the dialog that should\n * receive focus after opening.\n *\n * @return A Promise that resolves after the animation is finished and the\n * `opened` event was fired.\n */\n async show() {\n this.isOpening = true;\n // Dialogs can be opened before being attached to the DOM, so we need to\n // wait until we're connected before calling `showModal()`.\n await this.isConnectedPromise;\n await this.updateComplete;\n const dialog = this.dialog!;\n // Check if already opened or if `dialog.close()` was called while awaiting.\n if (dialog.open || !this.isOpening) {\n this.isOpening = false;\n return;\n }\n\n const preventOpen = !this.dispatchEvent(\n new Event('open', { cancelable: true })\n );\n if (preventOpen) {\n this.open = false;\n return;\n }\n\n // All Material dialogs are modal.\n dialog.showModal();\n this.open = true;\n // Reset scroll position if re-opening a dialog with the same content.\n if (this.scroller) {\n this.scroller.scrollTop = 0;\n }\n // Native modal dialogs ignore autofocus and instead force focus to the\n // first focusable child. Override this behavior if there is a child with\n // an autofocus attribute.\n this.querySelector<HTMLElement>('[autofocus]')?.focus();\n\n await this.animateDialog(this.getOpenAnimation());\n this.dispatchEvent(new Event('opened'));\n this.isOpening = false;\n }\n\n /**\n * Closes the dialog and fires a cancelable `close` event. After a dialog's\n * animation, a `closed` event is fired.\n *\n * @param returnValue A return value usually indicating which button was used\n * to close a dialog. If a dialog is canceled by clicking the scrim or\n * pressing Escape, it will not change the return value after closing.\n * @return A Promise that resolves after the animation is finished and the\n * `closed` event was fired.\n */\n async close(returnValue = this.returnValue) {\n this.isOpening = false;\n if (!this.isConnected) {\n // Disconnected dialogs do not fire close events or animate.\n this.open = false;\n return;\n }\n\n await this.updateComplete;\n const dialog = this.dialog!;\n // Check if already closed or if `dialog.show()` was called while awaiting.\n if (!dialog.open || this.isOpening) {\n this.open = false;\n return;\n }\n\n const prevReturnValue = this.returnValue;\n this.returnValue = returnValue;\n const preventClose = !this.dispatchEvent(\n new Event('close', { cancelable: true })\n );\n if (preventClose) {\n this.returnValue = prevReturnValue;\n return;\n }\n\n await this.animateDialog(this.getCloseAnimation());\n dialog.close(returnValue);\n this.open = false;\n this.dispatchEvent(new Event('closed'));\n }\n\n override connectedCallback() {\n super.connectedCallback();\n this.isConnectedPromiseResolve();\n }\n\n override disconnectedCallback() {\n super.disconnectedCallback();\n this.isConnectedPromise = this.getIsConnectedPromise();\n }\n\n protected override render() {\n const scrollable =\n this.open && !(this.isAtScrollTop && this.isAtScrollBottom);\n const classes = {\n 'has-headline': this.hasHeadline,\n 'has-actions': this.hasActions,\n 'has-icon': this.hasIcon,\n scrollable,\n 'show-top-divider': scrollable && !this.isAtScrollTop,\n 'show-bottom-divider': scrollable && !this.isAtScrollBottom,\n };\n\n const { ariaLabel } = this as ARIAMixinStrict;\n return html`\n <div class=\"scrim\"></div>\n <dialog\n class=${classMap(classes)}\n aria-label=${ariaLabel || nothing}\n aria-labelledby=${this.hasHeadline ? 'headline' : nothing}\n role=${this.type === 'alert' ? 'alertdialog' : nothing}\n @cancel=${this.handleCancel}\n @click=${this.handleDialogClick}\n @close=${this.handleClose}\n @keydown=${this.handleKeydown}\n .returnValue=${this.returnValue || nothing}\n >\n <div class=\"container\" @mousedown=${this.handleContentClick}>\n <div class=\"headline\">\n <div class=\"icon\" aria-hidden=\"true\">\n <slot name=\"icon\" @slotchange=${this.handleIconChange}></slot>\n </div>\n <h2 id=\"headline\" aria-hidden=${!this.hasHeadline || nothing}>\n <slot\n name=\"headline\"\n @slotchange=${this.handleHeadlineChange}\n ></slot>\n </h2>\n <md-divider></md-divider>\n </div>\n <div class=\"scroller\">\n <div class=\"content\">\n <div class=\"top anchor\"></div>\n <slot name=\"content\"></slot>\n <div class=\"bottom anchor\"></div>\n </div>\n </div>\n <div class=\"actions\">\n <md-divider></md-divider>\n <slot name=\"actions\" @slotchange=${this.handleActionsChange}></slot>\n </div>\n </div>\n </dialog>\n `;\n }\n\n protected override firstUpdated() {\n this.intersectionObserver = new IntersectionObserver(\n entries => {\n for (const entry of entries) {\n this.handleAnchorIntersection(entry);\n }\n },\n { root: this.scroller! }\n );\n\n this.intersectionObserver.observe(this.topAnchor!);\n this.intersectionObserver.observe(this.bottomAnchor!);\n }\n\n private handleDialogClick(e: MouseEvent) {\n const container = this.container as EventTarget;\n if (e.composedPath().includes(container)) {\n // Ignore clicks on the dialog itself.\n return;\n }\n\n if (this.nextClickIsFromContent && !this.disableNextClickIsFromContent) {\n // Avoid doing a layout calculation below if we know the click came from\n // content.\n this.nextClickIsFromContent = false;\n return;\n }\n\n // If preventCloseOnScrimClick is true, do not close the dialog when clicking on the scrim\n if (this.preventCloseOnScrimClick) {\n return;\n }\n\n // Click originated on the backdrop. Native `<dialog>`s will not cancel,\n // but Material dialogs do.\n const preventDefault = !this.dispatchEvent(\n new Event('cancel', { cancelable: true })\n );\n if (preventDefault) {\n return;\n }\n\n this.close();\n }\n\n private handleContentClick() {\n this.nextClickIsFromContent = true;\n }\n\n private handleSubmit(event: SubmitEvent) {\n const form = event.target as HTMLFormElement;\n const { submitter } = event;\n if (form.method !== 'dialog' || !submitter) {\n return;\n }\n\n // Close reason is the submitter's value attribute, or the dialog's\n // `returnValue` if there is no attribute.\n this.close(submitter.getAttribute('value') ?? this.returnValue);\n }\n\n private handleCancel(event: Event) {\n if (event.target !== this.dialog) {\n // Ignore any cancel events dispatched by content.\n return;\n }\n\n this.escapePressedWithoutCancel = false;\n const preventDefault = !redispatchEvent(this, event);\n // We always prevent default on the original dialog event since we'll\n // animate closing it before it actually closes.\n event.preventDefault();\n if (preventDefault) {\n return;\n }\n\n this.close();\n }\n\n private handleClose() {\n if (!this.escapePressedWithoutCancel) {\n return;\n }\n\n this.escapePressedWithoutCancel = false;\n this.dialog?.dispatchEvent(new Event('cancel', { cancelable: true }));\n }\n\n private handleKeydown(event: KeyboardEvent) {\n if (event.key !== 'Escape') {\n return;\n }\n\n // An escape key was pressed. If a \"close\" event fires next without a\n // \"cancel\" event first, then we know we're in the Chrome v120 bug.\n this.escapePressedWithoutCancel = true;\n // Wait a full task for the cancel/close event listeners to fire, then\n // reset the flag.\n setTimeout(() => {\n this.escapePressedWithoutCancel = false;\n });\n }\n\n private async animateDialog(animation: DialogAnimation) {\n const { dialog, scrim, container, headline, content, actions } = this;\n if (!dialog || !scrim || !container || !headline || !content || !actions) {\n return;\n }\n\n const {\n container: containerAnimate,\n dialog: dialogAnimate,\n scrim: scrimAnimate,\n headline: headlineAnimate,\n content: contentAnimate,\n actions: actionsAnimate,\n } = animation;\n\n const elementAndAnimation: Array<[Element, DialogAnimationArgs[]]> = [\n [dialog, dialogAnimate ?? []],\n [scrim, scrimAnimate ?? []],\n [container, containerAnimate ?? []],\n [headline, headlineAnimate ?? []],\n [content, contentAnimate ?? []],\n [actions, actionsAnimate ?? []],\n ];\n\n const animations: Animation[] = [];\n for (const [element, animation] of elementAndAnimation) {\n for (const animateArgs of animation) {\n animations.push(element.animate(...animateArgs));\n }\n }\n\n await Promise.all(animations.map(animation => animation.finished));\n }\n\n private handleHeadlineChange(event: Event) {\n const slot = event.target as HTMLSlotElement;\n this.hasHeadline = slot.assignedElements().length > 0;\n }\n\n private handleActionsChange(event: Event) {\n const slot = event.target as HTMLSlotElement;\n this.hasActions = slot.assignedElements().length > 0;\n }\n\n private handleIconChange(event: Event) {\n const slot = event.target as HTMLSlotElement;\n this.hasIcon = slot.assignedElements().length > 0;\n }\n\n private handleAnchorIntersection(entry: IntersectionObserverEntry) {\n const { target, isIntersecting } = entry;\n if (target === this.topAnchor) {\n this.isAtScrollTop = isIntersecting;\n }\n\n if (target === this.bottomAnchor) {\n this.isAtScrollBottom = isIntersecting;\n }\n }\n\n private getIsConnectedPromise() {\n return new Promise<void>(resolve => {\n this.isConnectedPromiseResolve = resolve;\n });\n }\n}\n"]}
1
+ {"version":3,"file":"dialog.js","sourceRoot":"","sources":["../../src/internal/dialog.ts"],"names":[],"mappings":"AAAA,8BAA8B;AAC9B,2CAA2C;AAC3C;;;;GAIG;;AAEH,OAAO,kCAAkC,CAAC;AAE1C,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAGvD,OAAO,EAAE,yBAAyB,EAAE,MAAM,yCAAyC,CAAC;AACpF,OAAO,EAAE,eAAe,EAAE,MAAM,mDAAmD,CAAC;AAEpF,OAAO,EACL,8BAA8B,EA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K,CAAC,aAAa,CAAC;yCAAiD;AAE7C;IAAxB,KAAK,CAAC,gBAAgB,CAAC;4CAAoD;AAOnE;IAAR,KAAK,EAAE;2CAA6B;AAE5B;IAAR,KAAK,EAAE;0CAA4B;AAE3B;IAAR,KAAK,EAAE;uCAAyB","sourcesContent":["/* eslint-disable no-shadow */\n/* eslint-disable class-methods-use-this */\n/**\n * @license\n * Copyright 2023 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport '@material/web/divider/divider.js';\n\nimport { html, isServer, LitElement, nothing } from 'lit';\nimport { property, query, state } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js';\n\nimport { ARIAMixinStrict } from '@material/web/internal/aria/aria.js';\nimport { requestUpdateOnAriaChange } from '@material/web/internal/aria/delegate.js';\nimport { redispatchEvent } from '@material/web/internal/events/redispatch-event.js';\n\nimport {\n DIALOG_DEFAULT_CLOSE_ANIMATION,\n DIALOG_DEFAULT_OPEN_ANIMATION,\n DialogAnimation,\n DialogAnimationArgs,\n} from '@material/web/dialog/internal/animations.js';\n\n/**\n * A dialog component.\n *\n * @fires open {Event} Dispatched when the dialog is opening before any animations.\n * @fires opened {Event} Dispatched when the dialog has opened after any animations.\n * @fires close {Event} Dispatched when the dialog is closing before any animations.\n * @fires closed {Event} Dispatched when the dialog has closed after any animations.\n * @fires cancel {Event} Dispatched when the dialog has been canceled by clicking\n * on the scrim or pressing Escape.\n */\nexport class Dialog extends LitElement {\n static {\n requestUpdateOnAriaChange(Dialog);\n }\n\n /**\n * Opens the dialog when set to `true` and closes it when set to `false`.\n */\n @property({ type: Boolean })\n get open() {\n return this.isOpen;\n }\n\n set open(open: boolean) {\n if (open === this.isOpen) {\n return;\n }\n\n this.isOpen = open;\n if (open) {\n this.setAttribute('open', '');\n this.show();\n } else {\n this.removeAttribute('open');\n this.close();\n }\n }\n\n /**\n * When set to `true`, prevents the dialog from closing when clicking on the scrim\n */\n @property({ type: Boolean }) preventCloseOnScrimClick = false;\n\n /**\n * Gets or sets the dialog's return value, usually to indicate which button\n * a user pressed to close it.\n *\n * https://developer.mozilla.org/en-US/docs/Web/API/HTMLDialogElement/returnValue\n */\n @property({ attribute: false }) returnValue = '';\n\n /**\n * The type of dialog for accessibility. Set this to `alert` to announce a\n * dialog as an alert dialog.\n */\n @property() type?: 'alert';\n\n @property({ type: Boolean }) disableNextClickIsFromContent = false;\n\n @property({ type: Boolean }) allowOverflow = false;\n\n /**\n * Gets the opening animation for a dialog. Set to a new function to customize\n * the animation.\n */\n getOpenAnimation = () => DIALOG_DEFAULT_OPEN_ANIMATION;\n\n /**\n * Gets the closing animation for a dialog. Set to a new function to customize\n * the animation.\n */\n getCloseAnimation = () => DIALOG_DEFAULT_CLOSE_ANIMATION;\n\n private isOpen = false;\n\n private isOpening = false;\n\n // getIsConnectedPromise() immediately sets the resolve property.\n private isConnectedPromiseResolve!: () => void;\n\n private isConnectedPromise = this.getIsConnectedPromise();\n\n @query('dialog') private readonly dialog!: HTMLDialogElement | null;\n\n @query('.scrim') private readonly scrim!: HTMLDialogElement | null;\n\n @query('.container') private readonly container!: HTMLDialogElement | null;\n\n @query('.headline') private readonly headline!: HTMLDialogElement | null;\n\n @query('.content') private readonly content!: HTMLDialogElement | null;\n\n @query('.actions') private readonly actions!: HTMLDialogElement | null;\n\n @state() private isAtScrollTop = false;\n\n @state() private isAtScrollBottom = false;\n\n @query('.scroller') private readonly scroller!: HTMLElement | null;\n\n @query('.top.anchor') private readonly topAnchor!: HTMLElement | null;\n\n @query('.bottom.anchor') private readonly bottomAnchor!: HTMLElement | null;\n\n private nextClickIsFromContent = false;\n\n private intersectionObserver?: IntersectionObserver;\n\n // Dialogs should not be SSR'd while open, so we can just use runtime checks.\n @state() private hasHeadline = false;\n\n @state() private hasActions = false;\n\n @state() private hasIcon = false;\n\n // See https://bugs.chromium.org/p/chromium/issues/detail?id=1512224\n // Chrome v120 has a bug where escape keys do not trigger cancels. If we get\n // a dialog \"close\" event that is triggered without a \"cancel\" after an escape\n // keydown, then we need to manually trigger our closing logic.\n //\n // This bug occurs when pressing escape to close a dialog without first\n // interacting with the dialog's content.\n //\n // Cleanup tracking:\n // https://github.com/material-components/material-web/issues/5330\n // This can be removed when full CloseWatcher support added and the above bug\n // in Chromium is fixed to fire 'cancel' with one escape press and close with\n // multiple.\n private escapePressedWithoutCancel = false;\n\n constructor() {\n super();\n if (!isServer) {\n this.addEventListener('submit', this.handleSubmit);\n\n // We do not use `delegatesFocus: true` due to a Chromium bug with\n // selecting text.\n // See https://bugs.chromium.org/p/chromium/issues/detail?id=950357\n //\n // Material requires using focus trapping within the dialog (see\n // b/314840853 for the bug to add it). This would normally mean we don't\n // care about delegating focus since the `<dialog>` never receives it.\n // However, we still need to handle situations when a user has not\n // provided an focusable child in the content. When that happens, the\n // `<dialog>` itself is focused.\n //\n // Listen to focus/blur instead of focusin/focusout since those can bubble\n // from content.\n this.addEventListener('focus', () => {\n this.dialog?.focus();\n });\n this.addEventListener('blur', () => {\n this.dialog?.blur();\n });\n }\n }\n\n /**\n * Opens the dialog and fires a cancelable `open` event. After a dialog's\n * animation, an `opened` event is fired.\n *\n * Add an `autocomplete` attribute to a child of the dialog that should\n * receive focus after opening.\n *\n * @return A Promise that resolves after the animation is finished and the\n * `opened` event was fired.\n */\n async show() {\n this.isOpening = true;\n // Dialogs can be opened before being attached to the DOM, so we need to\n // wait until we're connected before calling `showModal()`.\n await this.isConnectedPromise;\n await this.updateComplete;\n const dialog = this.dialog!;\n // Check if already opened or if `dialog.close()` was called while awaiting.\n if (dialog.open || !this.isOpening) {\n this.isOpening = false;\n return;\n }\n\n const preventOpen = !this.dispatchEvent(\n new Event('open', { cancelable: true })\n );\n if (preventOpen) {\n this.open = false;\n return;\n }\n\n // All Material dialogs are modal.\n dialog.showModal();\n this.open = true;\n // Reset scroll position if re-opening a dialog with the same content.\n if (this.scroller) {\n this.scroller.scrollTop = 0;\n }\n // Native modal dialogs ignore autofocus and instead force focus to the\n // first focusable child. Override this behavior if there is a child with\n // an autofocus attribute.\n this.querySelector<HTMLElement>('[autofocus]')?.focus();\n\n await this.animateDialog(this.getOpenAnimation());\n this.dispatchEvent(new Event('opened'));\n this.isOpening = false;\n }\n\n /**\n * Closes the dialog and fires a cancelable `close` event. After a dialog's\n * animation, a `closed` event is fired.\n *\n * @param returnValue A return value usually indicating which button was used\n * to close a dialog. If a dialog is canceled by clicking the scrim or\n * pressing Escape, it will not change the return value after closing.\n * @return A Promise that resolves after the animation is finished and the\n * `closed` event was fired.\n */\n async close(returnValue = this.returnValue) {\n this.isOpening = false;\n if (!this.isConnected) {\n // Disconnected dialogs do not fire close events or animate.\n this.open = false;\n return;\n }\n\n await this.updateComplete;\n const dialog = this.dialog!;\n // Check if already closed or if `dialog.show()` was called while awaiting.\n if (!dialog.open || this.isOpening) {\n this.open = false;\n return;\n }\n\n const prevReturnValue = this.returnValue;\n this.returnValue = returnValue;\n const preventClose = !this.dispatchEvent(\n new Event('close', { cancelable: true })\n );\n if (preventClose) {\n this.returnValue = prevReturnValue;\n return;\n }\n\n await this.animateDialog(this.getCloseAnimation());\n dialog.close(returnValue);\n this.open = false;\n this.dispatchEvent(new Event('closed'));\n }\n\n override connectedCallback() {\n super.connectedCallback();\n this.isConnectedPromiseResolve();\n }\n\n override disconnectedCallback() {\n super.disconnectedCallback();\n this.isConnectedPromise = this.getIsConnectedPromise();\n }\n\n protected override render() {\n const scrollable =\n this.open && !(this.isAtScrollTop && this.isAtScrollBottom);\n const classes = {\n 'has-headline': this.hasHeadline,\n 'has-actions': this.hasActions,\n 'has-icon': this.hasIcon,\n scrollable,\n 'show-top-divider': scrollable && !this.isAtScrollTop,\n 'show-bottom-divider': scrollable && !this.isAtScrollBottom,\n 'allow-overflow': this.allowOverflow,\n };\n\n const { ariaLabel } = this as ARIAMixinStrict;\n return html`\n <div class=\"scrim\"></div>\n <dialog\n class=${classMap(classes)}\n aria-label=${ariaLabel || nothing}\n aria-labelledby=${this.hasHeadline ? 'headline' : nothing}\n role=${this.type === 'alert' ? 'alertdialog' : nothing}\n @cancel=${this.handleCancel}\n @click=${this.handleDialogClick}\n @close=${this.handleClose}\n @keydown=${this.handleKeydown}\n .returnValue=${this.returnValue || nothing}\n >\n <div class=\"container\" @mousedown=${this.handleContentClick}>\n <div class=\"headline\">\n <div class=\"icon\" aria-hidden=\"true\">\n <slot name=\"icon\" @slotchange=${this.handleIconChange}></slot>\n </div>\n <h2 id=\"headline\" aria-hidden=${!this.hasHeadline || nothing}>\n <slot\n name=\"headline\"\n @slotchange=${this.handleHeadlineChange}\n ></slot>\n </h2>\n <md-divider></md-divider>\n </div>\n <div class=\"scroller\">\n <div class=\"content\">\n <div class=\"top anchor\"></div>\n <slot name=\"content\"></slot>\n <div class=\"bottom anchor\"></div>\n </div>\n </div>\n <div class=\"actions\">\n <md-divider></md-divider>\n <slot name=\"actions\" @slotchange=${this.handleActionsChange}></slot>\n </div>\n </div>\n </dialog>\n `;\n }\n\n protected override firstUpdated() {\n this.intersectionObserver = new IntersectionObserver(\n entries => {\n for (const entry of entries) {\n this.handleAnchorIntersection(entry);\n }\n },\n { root: this.scroller! }\n );\n\n this.intersectionObserver.observe(this.topAnchor!);\n this.intersectionObserver.observe(this.bottomAnchor!);\n }\n\n private handleDialogClick(e: MouseEvent) {\n const container = this.container as EventTarget;\n if (e.composedPath().includes(container)) {\n // Ignore clicks on the dialog itself.\n return;\n }\n\n if (this.nextClickIsFromContent && !this.disableNextClickIsFromContent) {\n // Avoid doing a layout calculation below if we know the click came from\n // content.\n this.nextClickIsFromContent = false;\n return;\n }\n\n // If preventCloseOnScrimClick is true, do not close the dialog when clicking on the scrim\n if (this.preventCloseOnScrimClick) {\n return;\n }\n\n // Click originated on the backdrop. Native `<dialog>`s will not cancel,\n // but Material dialogs do.\n const preventDefault = !this.dispatchEvent(\n new Event('cancel', { cancelable: true })\n );\n if (preventDefault) {\n return;\n }\n\n this.close();\n }\n\n private handleContentClick() {\n this.nextClickIsFromContent = true;\n }\n\n private handleSubmit(event: SubmitEvent) {\n const form = event.target as HTMLFormElement;\n const { submitter } = event;\n if (form.method !== 'dialog' || !submitter) {\n return;\n }\n\n // Close reason is the submitter's value attribute, or the dialog's\n // `returnValue` if there is no attribute.\n this.close(submitter.getAttribute('value') ?? this.returnValue);\n }\n\n private handleCancel(event: Event) {\n if (event.target !== this.dialog) {\n // Ignore any cancel events dispatched by content.\n return;\n }\n\n this.escapePressedWithoutCancel = false;\n const preventDefault = !redispatchEvent(this, event);\n // We always prevent default on the original dialog event since we'll\n // animate closing it before it actually closes.\n event.preventDefault();\n if (preventDefault) {\n return;\n }\n\n this.close();\n }\n\n private handleClose() {\n if (!this.escapePressedWithoutCancel) {\n return;\n }\n\n this.escapePressedWithoutCancel = false;\n this.dialog?.dispatchEvent(new Event('cancel', { cancelable: true }));\n }\n\n private handleKeydown(event: KeyboardEvent) {\n if (event.key !== 'Escape') {\n return;\n }\n\n // An escape key was pressed. If a \"close\" event fires next without a\n // \"cancel\" event first, then we know we're in the Chrome v120 bug.\n this.escapePressedWithoutCancel = true;\n // Wait a full task for the cancel/close event listeners to fire, then\n // reset the flag.\n setTimeout(() => {\n this.escapePressedWithoutCancel = false;\n });\n }\n\n private async animateDialog(animation: DialogAnimation) {\n const { dialog, scrim, container, headline, content, actions } = this;\n if (!dialog || !scrim || !container || !headline || !content || !actions) {\n return;\n }\n\n const {\n container: containerAnimate,\n dialog: dialogAnimate,\n scrim: scrimAnimate,\n headline: headlineAnimate,\n content: contentAnimate,\n actions: actionsAnimate,\n } = animation;\n\n const elementAndAnimation: Array<[Element, DialogAnimationArgs[]]> = [\n [dialog, dialogAnimate ?? []],\n [scrim, scrimAnimate ?? []],\n [container, containerAnimate ?? []],\n [headline, headlineAnimate ?? []],\n [content, contentAnimate ?? []],\n [actions, actionsAnimate ?? []],\n ];\n\n const animations: Animation[] = [];\n for (const [element, animation] of elementAndAnimation) {\n for (const animateArgs of animation) {\n animations.push(element.animate(...animateArgs));\n }\n }\n\n await Promise.all(animations.map(animation => animation.finished));\n }\n\n private handleHeadlineChange(event: Event) {\n const slot = event.target as HTMLSlotElement;\n this.hasHeadline = slot.assignedElements().length > 0;\n }\n\n private handleActionsChange(event: Event) {\n const slot = event.target as HTMLSlotElement;\n this.hasActions = slot.assignedElements().length > 0;\n }\n\n private handleIconChange(event: Event) {\n const slot = event.target as HTMLSlotElement;\n this.hasIcon = slot.assignedElements().length > 0;\n }\n\n private handleAnchorIntersection(entry: IntersectionObserverEntry) {\n const { target, isIntersecting } = entry;\n if (target === this.topAnchor) {\n this.isAtScrollTop = isIntersecting;\n }\n\n if (target === this.bottomAnchor) {\n this.isAtScrollBottom = isIntersecting;\n }\n }\n\n private getIsConnectedPromise() {\n return new Promise<void>(resolve => {\n this.isConnectedPromiseResolve = resolve;\n });\n }\n}\n"]}
@@ -0,0 +1 @@
1
+ export declare const IxDialogStyles: import("lit").CSSResult;
@@ -0,0 +1,55 @@
1
+ import { css } from 'lit';
2
+ export const IxDialogStyles = css `
3
+ :host {
4
+ display: contents;
5
+ }
6
+
7
+ dialog {
8
+ border: none;
9
+ padding: 0;
10
+ margin: 0;
11
+ max-width: 90vw;
12
+ max-height: 90dvh;
13
+ width: auto;
14
+ background: transparent;
15
+ }
16
+
17
+ dialog::backdrop {
18
+ background: rgba(0, 0, 0, 0.32);
19
+ }
20
+
21
+ .container {
22
+ box-sizing: border-box;
23
+ background: var(--ix-dialog-bg, #fff);
24
+ color: var(--ix-dialog-fg, inherit);
25
+ border-radius: var(--ix-dialog-radius, 0.75rem);
26
+ max-width: var(--ix-dialog-max-width, 45rem);
27
+ overflow: hidden;
28
+ box-shadow: var(
29
+ --ix-dialog-shadow,
30
+ 0 0.625rem 1.875rem rgba(0, 0, 0, 0.25)
31
+ );
32
+ }
33
+
34
+ .headline {
35
+ padding: 1.25rem 1.5rem 0.75rem;
36
+ font: var(
37
+ --ix-dialog-headline-font,
38
+ 600 1.125rem/1.2 system-ui,
39
+ sans-serif
40
+ );
41
+ }
42
+
43
+ .content {
44
+ padding: 0 1.5rem 1rem;
45
+ overflow: auto;
46
+ }
47
+
48
+ .actions {
49
+ padding: 0.75rem 1rem 1rem;
50
+ display: flex;
51
+ gap: 0.5rem;
52
+ justify-content: flex-end;
53
+ }
54
+ `;
55
+ //# sourceMappingURL=ix-dialog-styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ix-dialog-styles.js","sourceRoot":"","sources":["../src/ix-dialog-styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,MAAM,CAAC,MAAM,cAAc,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoDhC,CAAC","sourcesContent":["import { css } from 'lit';\n\nexport const IxDialogStyles = css`\n :host {\n display: contents;\n }\n\n dialog {\n border: none;\n padding: 0;\n margin: 0;\n max-width: 90vw;\n max-height: 90dvh;\n width: auto;\n background: transparent;\n }\n\n dialog::backdrop {\n background: rgba(0, 0, 0, 0.32);\n }\n\n .container {\n box-sizing: border-box;\n background: var(--ix-dialog-bg, #fff);\n color: var(--ix-dialog-fg, inherit);\n border-radius: var(--ix-dialog-radius, 0.75rem);\n max-width: var(--ix-dialog-max-width, 45rem);\n overflow: hidden;\n box-shadow: var(\n --ix-dialog-shadow,\n 0 0.625rem 1.875rem rgba(0, 0, 0, 0.25)\n );\n }\n\n .headline {\n padding: 1.25rem 1.5rem 0.75rem;\n font: var(\n --ix-dialog-headline-font,\n 600 1.125rem/1.2 system-ui,\n sans-serif\n );\n }\n\n .content {\n padding: 0 1.5rem 1rem;\n overflow: auto;\n }\n\n .actions {\n padding: 0.75rem 1rem 1rem;\n display: flex;\n gap: 0.5rem;\n justify-content: flex-end;\n }\n`;\n"]}
@@ -1,4 +1,5 @@
1
+ import type { CSSResultGroup } from 'lit';
1
2
  import { IxDialog } from './IxDialog.js';
2
3
  export declare class IxDialogStyled extends IxDialog {
3
- static styles: import("lit").CSSResult;
4
+ static styles: CSSResultGroup;
4
5
  }
package/dist/ix-dialog.js CHANGED
@@ -1,12 +1,17 @@
1
+ var _a, _b;
1
2
  import { css } from 'lit';
2
3
  import { IxDialog } from './IxDialog.js';
3
- export class IxDialogStyled extends IxDialog {
4
+ export class IxDialogStyled extends (_b = IxDialog) {
4
5
  }
5
- IxDialogStyled.styles = css `
6
- .dialog {
7
- max-height: 90vh;
8
- max-width: 90vw;
9
- }
10
- `;
11
- window.customElements.define('ix-dialog', IxDialogStyled);
6
+ _a = IxDialogStyled;
7
+ IxDialogStyled.styles = [
8
+ Reflect.get(_b, "styles", _a),
9
+ css `
10
+ .dialog {
11
+ max-height: 90vh;
12
+ max-width: 90vw;
13
+ }
14
+ `,
15
+ ];
16
+ customElements.define('ix-dialog', IxDialogStyled);
12
17
  //# sourceMappingURL=ix-dialog.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ix-dialog.js","sourceRoot":"","sources":["../src/ix-dialog.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAC1B,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,MAAM,OAAO,cAAe,SAAQ,QAAQ;;AAC1B,qBAAM,GAAG,GAAG,CAAA;;;;;GAK3B,CAAC;AAGJ,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,CAAC","sourcesContent":["import { css } from 'lit';\nimport { IxDialog } from './IxDialog.js';\n\nexport class IxDialogStyled extends IxDialog {\n static override styles = css`\n .dialog {\n max-height: 90vh;\n max-width: 90vw;\n }\n `;\n}\n\nwindow.customElements.define('ix-dialog', IxDialogStyled);\n"]}
1
+ {"version":3,"file":"ix-dialog.js","sourceRoot":"","sources":["../src/ix-dialog.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAC1B,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,MAAM,OAAO,cAAe,SAAQ,MAAA,QAAQ,CAAA;;;AAC1B,qBAAM,GAAmB;IACvC,6BAAK;IACL,GAAG,CAAA;;;;;KAKF;CACF,CAAC;AAGJ,cAAc,CAAC,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,CAAC","sourcesContent":["import type { CSSResultGroup } from 'lit';\nimport { css } from 'lit';\nimport { IxDialog } from './IxDialog.js';\n\nexport class IxDialogStyled extends IxDialog {\n static override styles: CSSResultGroup = [\n super.styles,\n css`\n .dialog {\n max-height: 90vh;\n max-width: 90vw;\n }\n `,\n ];\n}\n\ncustomElements.define('ix-dialog', IxDialogStyled);\n"]}
@@ -1 +1,47 @@
1
- import{LitElement,isServer,nothing,html,css}from"lit";import{__decorate}from"tslib";import{property,query,state}from"lit/decorators.js";import"@material/web/divider/divider.js";import{classMap}from"lit/directives/class-map.js";import{requestUpdateOnAriaChange}from"@material/web/internal/aria/delegate.js";import{redispatchEvent}from"@material/web/internal/events/redispatch-event.js";import{DIALOG_DEFAULT_OPEN_ANIMATION,DIALOG_DEFAULT_CLOSE_ANIMATION}from"@material/web/dialog/internal/animations.js";class Dialog extends LitElement{get open(){return this.isOpen}set open(e){e!==this.isOpen&&((this.isOpen=e)?(this.setAttribute("open",""),this.show()):(this.removeAttribute("open"),this.close()))}constructor(){super(),this.preventCloseOnScrimClick=!1,this.returnValue="",this.disableNextClickIsFromContent=!1,this.getOpenAnimation=()=>DIALOG_DEFAULT_OPEN_ANIMATION,this.getCloseAnimation=()=>DIALOG_DEFAULT_CLOSE_ANIMATION,this.isOpen=!1,this.isOpening=!1,this.isConnectedPromise=this.getIsConnectedPromise(),this.isAtScrollTop=!1,this.isAtScrollBottom=!1,this.nextClickIsFromContent=!1,this.hasHeadline=!1,this.hasActions=!1,this.hasIcon=!1,this.escapePressedWithoutCancel=!1,isServer||(this.addEventListener("submit",this.handleSubmit),this.addEventListener("focus",()=>{var e;null!=(e=this.dialog)&&e.focus()}),this.addEventListener("blur",()=>{var e;null!=(e=this.dialog)&&e.blur()}))}async show(){this.isOpening=!0,await this.isConnectedPromise,await this.updateComplete;var e=this.dialog;e.open||!this.isOpening?this.isOpening=!1:!this.dispatchEvent(new Event("open",{cancelable:!0}))?this.open=!1:(e.showModal(),this.open=!0,this.scroller&&(this.scroller.scrollTop=0),null!=(e=this.querySelector("[autofocus]"))&&e.focus(),await this.animateDialog(this.getOpenAnimation()),this.dispatchEvent(new Event("opened")),this.isOpening=!1)}async close(e=this.returnValue){var t,i;this.isOpening=!1,!this.isConnected||(await this.updateComplete,!(t=this.dialog).open)||this.isOpening?this.open=!1:(i=this.returnValue,this.returnValue=e,!this.dispatchEvent(new Event("close",{cancelable:!0}))?this.returnValue=i:(await this.animateDialog(this.getCloseAnimation()),t.close(e),this.open=!1,this.dispatchEvent(new Event("closed"))))}connectedCallback(){super.connectedCallback(),this.isConnectedPromiseResolve()}disconnectedCallback(){super.disconnectedCallback(),this.isConnectedPromise=this.getIsConnectedPromise()}render(){var e=this.open&&!(this.isAtScrollTop&&this.isAtScrollBottom),e={"has-headline":this.hasHeadline,"has-actions":this.hasActions,"has-icon":this.hasIcon,scrollable:e,"show-top-divider":e&&!this.isAtScrollTop,"show-bottom-divider":e&&!this.isAtScrollBottom},t=this.ariaLabel;return html`<div class="scrim"></div><dialog class="${classMap(e)}" aria-label="${t||nothing}" aria-labelledby="${this.hasHeadline?"headline":nothing}" role="${"alert"===this.type?"alertdialog":nothing}" @cancel="${this.handleCancel}" @click="${this.handleDialogClick}" @close="${this.handleClose}" @keydown="${this.handleKeydown}" .returnValue="${this.returnValue||nothing}"><div class="container" @mousedown="${this.handleContentClick}"><div class="headline"><div class="icon" aria-hidden="true"><slot name="icon" @slotchange="${this.handleIconChange}"></slot></div><h2 id="headline" aria-hidden="${!this.hasHeadline||nothing}"><slot name="headline" @slotchange="${this.handleHeadlineChange}"></slot></h2><md-divider></md-divider></div><div class="scroller"><div class="content"><div class="top anchor"></div><slot name="content"></slot><div class="bottom anchor"></div></div></div><div class="actions"><md-divider></md-divider><slot name="actions" @slotchange="${this.handleActionsChange}"></slot></div></div></dialog>`}firstUpdated(){this.intersectionObserver=new IntersectionObserver(e=>{for(var t of e)this.handleAnchorIntersection(t)},{root:this.scroller}),this.intersectionObserver.observe(this.topAnchor),this.intersectionObserver.observe(this.bottomAnchor)}handleDialogClick(e){var t=this.container;e.composedPath().includes(t)||(this.nextClickIsFromContent&&!this.disableNextClickIsFromContent?this.nextClickIsFromContent=!1:!this.preventCloseOnScrimClick&&this.dispatchEvent(new Event("cancel",{cancelable:!0}))&&this.close())}handleContentClick(){this.nextClickIsFromContent=!0}handleSubmit(e){var t=e.submitter;"dialog"===e.target.method&&t&&this.close(null!=(e=t.getAttribute("value"))?e:this.returnValue)}handleCancel(e){var t;e.target!==this.dialog||(this.escapePressedWithoutCancel=!1,t=!redispatchEvent(this,e),e.preventDefault(),t)||this.close()}handleClose(){var e;this.escapePressedWithoutCancel&&(this.escapePressedWithoutCancel=!1,null!=(e=this.dialog))&&e.dispatchEvent(new Event("cancel",{cancelable:!0}))}handleKeydown(e){"Escape"===e.key&&(this.escapePressedWithoutCancel=!0,setTimeout(()=>{this.escapePressedWithoutCancel=!1}))}async animateDialog(e){var{dialog:i,scrim:o,container:n,headline:s,content:a,actions:l}=this;if(i&&o&&n&&s&&a&&l){var{container:r,dialog:d,scrim:c,headline:h,content:p,actions:m}=e,g=[];for(let[e,t]of[[i,null!=d?d:[]],[o,null!=c?c:[]],[n,null!=r?r:[]],[s,null!=h?h:[]],[a,null!=p?p:[]],[l,null!=m?m:[]]])for(var v of t)g.push(e.animate(...v));await Promise.all(g.map(e=>e.finished))}}handleHeadlineChange(e){e=e.target;this.hasHeadline=0<e.assignedElements().length}handleActionsChange(e){e=e.target;this.hasActions=0<e.assignedElements().length}handleIconChange(e){e=e.target;this.hasIcon=0<e.assignedElements().length}handleAnchorIntersection(e){var{target:e,isIntersecting:t}=e;e===this.topAnchor&&(this.isAtScrollTop=t),e===this.bottomAnchor&&(this.isAtScrollBottom=t)}getIsConnectedPromise(){return new Promise(e=>{this.isConnectedPromiseResolve=e})}}requestUpdateOnAriaChange(Dialog),__decorate([property({type:Boolean})],Dialog.prototype,"open",null),__decorate([property({type:Boolean})],Dialog.prototype,"preventCloseOnScrimClick",void 0),__decorate([property({attribute:!1})],Dialog.prototype,"returnValue",void 0),__decorate([property()],Dialog.prototype,"type",void 0),__decorate([property({type:Boolean})],Dialog.prototype,"disableNextClickIsFromContent",void 0),__decorate([query("dialog")],Dialog.prototype,"dialog",void 0),__decorate([query(".scrim")],Dialog.prototype,"scrim",void 0),__decorate([query(".container")],Dialog.prototype,"container",void 0),__decorate([query(".headline")],Dialog.prototype,"headline",void 0),__decorate([query(".content")],Dialog.prototype,"content",void 0),__decorate([query(".actions")],Dialog.prototype,"actions",void 0),__decorate([state()],Dialog.prototype,"isAtScrollTop",void 0),__decorate([state()],Dialog.prototype,"isAtScrollBottom",void 0),__decorate([query(".scroller")],Dialog.prototype,"scroller",void 0),__decorate([query(".top.anchor")],Dialog.prototype,"topAnchor",void 0),__decorate([query(".bottom.anchor")],Dialog.prototype,"bottomAnchor",void 0),__decorate([state()],Dialog.prototype,"hasHeadline",void 0),__decorate([state()],Dialog.prototype,"hasActions",void 0),__decorate([state()],Dialog.prototype,"hasIcon",void 0);let styles=css`:host{border-start-start-radius:var(--md-dialog-container-shape-start-start,var(--md-dialog-container-shape,var(--md-sys-shape-corner-extra-large,28px)));border-start-end-radius:var(--md-dialog-container-shape-start-end,var(--md-dialog-container-shape,var(--md-sys-shape-corner-extra-large,28px)));border-end-end-radius:var(--md-dialog-container-shape-end-end,var(--md-dialog-container-shape,var(--md-sys-shape-corner-extra-large,28px)));border-end-start-radius:var(--md-dialog-container-shape-end-start,var(--md-dialog-container-shape,var(--md-sys-shape-corner-extra-large,28px)));display:contents;margin:auto;max-height:min(560px,100% - 48px);max-width:min(560px,100% - 48px);min-width:280px;position:fixed;height:fit-content;width:fit-content}dialog{background:rgba(0,0,0,0);border:none;border-radius:inherit;box-shadow:0 12px 16px 0 rgba(0,0,0,.58);flex-direction:column;height:inherit;margin:inherit;max-height:inherit;max-width:inherit;min-height:inherit;min-width:inherit;outline:0;overflow:visible;padding:0;width:inherit}dialog[open]{display:block}::backdrop{background:rgba(0,0,0,.5)}h2{all:unset;align-self:stretch}.headline{align-items:center;color:var(--md-dialog-headline-color,var(--md-sys-color-on-surface,#1d1b20));display:flex;flex-direction:column;font-family:var(--md-dialog-headline-font,var(--md-sys-typescale-headline-small-font,var(--md-ref-typeface-brand,Roboto)));font-size:var(--md-dialog-headline-size,var(--md-sys-typescale-headline-small-size,1.5rem));line-height:var(--md-dialog-headline-line-height,var(--md-sys-typescale-headline-small-line-height,2rem));font-weight:var(--md-dialog-headline-weight,var(--md-sys-typescale-headline-small-weight,var(--md-ref-typeface-weight-regular,400)));position:relative}slot[name=headline]::slotted(*){align-items:center;align-self:stretch;box-sizing:border-box;display:flex;gap:8px;padding:24px 24px 0}.icon{display:flex}slot[name=icon]::slotted(*){color:var(--md-dialog-icon-color,var(--md-sys-color-secondary,#625b71));fill:currentColor;font-size:var(--md-dialog-icon-size,24px);margin-top:24px;height:var(--md-dialog-icon-size,24px);width:var(--md-dialog-icon-size,24px)}.has-icon slot[name=headline]::slotted(*){justify-content:center;padding-top:16px}.scrollable slot[name=headline]::slotted(*){padding-bottom:16px}.scrollable.has-headline slot[name=content]::slotted(*){padding-top:8px}.container{border-radius:inherit;display:flex;flex-direction:column;flex-grow:1;overflow:hidden;position:relative;transform-origin:top}.container::before{background:var(--md-dialog-container-color,var(--md-sys-color-surface-container-high,#ece6f0));border-radius:inherit;content:'';inset:0;position:absolute}.scroller{display:flex;flex:1;flex-direction:column;overflow:initial;z-index:1}.scrollable .scroller{overflow-y:scroll}.content{color:var(--clr-on-surface,#092241);font-family:var(--text-default-font,sans-serif);font-size:var(--text-default-size,16px);letter-spacing:var(--text-default-letter-spacing,.0275em);line-height:var(--text-default-line-height,1.75em);font-weight:var(--text-default-weight,normal);text-transform:var(--text-default-decoration,none);text-decoration:var(--text-default-transform,none);height:min-content;position:relative}slot[name=content]::slotted(*){box-sizing:border-box;padding:24px}.anchor{position:absolute}.top.anchor{top:0}.bottom.anchor{bottom:0}.actions{position:relative}slot[name=actions]::slotted(*){box-sizing:border-box;display:flex;gap:8px;justify-content:flex-end;padding:16px 24px 24px}.has-actions slot[name=content]::slotted(*){padding-bottom:8px}md-divider{display:none;position:absolute}.has-actions.show-bottom-divider .actions md-divider,.has-headline.show-top-divider .headline md-divider{display:flex}.headline md-divider{bottom:0}.actions md-divider{top:0}@media (forced-colors:active){dialog{outline:2px solid WindowText}}`;class MdDialog extends Dialog{}MdDialog.styles=[styles],window.customElements.define("md-dialog",MdDialog);class IxDialog extends LitElement{constructor(){super(...arguments),this.open=!1,this.preventCancel=!1,this.preventCloseOnScrimClick=!1,this.disableNextClickIsFromContent=!1,this.scrollPosition=0}disconnectedCallback(){super.disconnectedCallback(),this.resetBodyStyles()}resetBodyStyles(){var e=document.body;e.style.paddingRight="0",e.style.position="",e.style.top="",e.style.left="",e.style.right="",e.style.overflow="",e.style.width="",window.scrollTo(0,this.scrollPosition)}onOpen(){this.dispatchEvent(new Event("open"));var e=document.body,t=e.clientWidth,i=(this.scrollPosition=window.scrollY,e.style.overflow="hidden",e.clientWidth);e.style.paddingRight=i-t+"px",e.style.position="fixed",e.style.top=`-${this.scrollPosition}px`,e.style.left="0",e.style.right="0",e.style.width="100%"}onOpened(){this.dispatchEvent(new Event("opened"))}onClose(){this.dispatchEvent(new Event("close"))}onClosed(){this.dispatchEvent(new Event("closed")),this.resetBodyStyles()}onCancel(e){this.preventCancel&&e.preventDefault(),this.dispatchEvent(new Event("cancel"))}render(){return html`<md-dialog ?open="${this.open}" class="dialog" ?preventCloseOnScrimClick="${this.preventCloseOnScrimClick}" ?disableNextClickIsFromContent="${this.disableNextClickIsFromContent}" @open="${this.onOpen}" @opened="${this.onOpened}" @close="${this.onClose}" @closed="${this.onClosed}" @cancel="${this.onCancel}"><slot slot="headline" name="headline"></slot><slot slot="content" name="content"></slot><slot slot="actions" name="actions"></slot></md-dialog>`}}requestUpdateOnAriaChange(IxDialog),IxDialog.shadowRootOptions={...LitElement.shadowRootOptions,delegatesFocus:!0},__decorate([query(".dialog")],IxDialog.prototype,"component",void 0),__decorate([property({type:Boolean,reflect:!0})],IxDialog.prototype,"open",void 0),__decorate([property({type:Boolean,attribute:"prevent-cancel"})],IxDialog.prototype,"preventCancel",void 0),__decorate([property({type:Boolean})],IxDialog.prototype,"preventCloseOnScrimClick",void 0),__decorate([property({type:Boolean})],IxDialog.prototype,"disableNextClickIsFromContent",void 0),__decorate([state()],IxDialog.prototype,"scrollPosition",void 0);class IxDialogStyled extends IxDialog{}IxDialogStyled.styles=css`.dialog{max-height:90vh;max-width:90vw}`,window.customElements.define("ix-dialog",IxDialogStyled);export{IxDialogStyled};
1
+ import{css,LitElement,isServer,nothing,html,render}from"lit";import{__decorate}from"tslib";import{requestUpdateOnAriaChange}from"@material/web/internal/aria/delegate.js";import{property,query,state}from"lit/decorators.js";import{createRef,ref}from"lit/directives/ref.js";import"@material/web/divider/divider.js";import{classMap}from"lit/directives/class-map.js";import{redispatchEvent}from"@material/web/internal/events/redispatch-event.js";import{DIALOG_DEFAULT_OPEN_ANIMATION,DIALOG_DEFAULT_CLOSE_ANIMATION}from"@material/web/dialog/internal/animations.js";let IxDialogStyles=css`:host{display:contents}dialog{border:none;padding:0;margin:0;max-width:90vw;max-height:90dvh;width:auto;background:0 0}dialog::backdrop{background:rgba(0,0,0,.32)}.container{box-sizing:border-box;background:var(--ix-dialog-bg,#fff);color:var(--ix-dialog-fg,inherit);border-radius:var(--ix-dialog-radius,.75rem);max-width:var(--ix-dialog-max-width,45rem);overflow:hidden;box-shadow:var(--ix-dialog-shadow,0 .625rem 1.875rem rgba(0,0,0,.25))}.headline{padding:1.25rem 1.5rem .75rem;font:var(--ix-dialog-headline-font,600 1.125rem/1.2 system-ui,sans-serif)}.content{padding:0 1.5rem 1rem;overflow:auto}.actions{padding:.75rem 1rem 1rem;display:flex;gap:.5rem;justify-content:flex-end}`;class Dialog extends LitElement{get open(){return this.isOpen}set open(e){e!==this.isOpen&&((this.isOpen=e)?(this.setAttribute("open",""),this.show()):(this.removeAttribute("open"),this.close()))}constructor(){super(),this.preventCloseOnScrimClick=!1,this.returnValue="",this.disableNextClickIsFromContent=!1,this.allowOverflow=!1,this.getOpenAnimation=()=>DIALOG_DEFAULT_OPEN_ANIMATION,this.getCloseAnimation=()=>DIALOG_DEFAULT_CLOSE_ANIMATION,this.isOpen=!1,this.isOpening=!1,this.isConnectedPromise=this.getIsConnectedPromise(),this.isAtScrollTop=!1,this.isAtScrollBottom=!1,this.nextClickIsFromContent=!1,this.hasHeadline=!1,this.hasActions=!1,this.hasIcon=!1,this.escapePressedWithoutCancel=!1,isServer||(this.addEventListener("submit",this.handleSubmit),this.addEventListener("focus",()=>{var e;null!=(e=this.dialog)&&e.focus()}),this.addEventListener("blur",()=>{var e;null!=(e=this.dialog)&&e.blur()}))}async show(){this.isOpening=!0,await this.isConnectedPromise,await this.updateComplete;var e=this.dialog;e.open||!this.isOpening?this.isOpening=!1:!this.dispatchEvent(new Event("open",{cancelable:!0}))?this.open=!1:(e.showModal(),this.open=!0,this.scroller&&(this.scroller.scrollTop=0),null!=(e=this.querySelector("[autofocus]"))&&e.focus(),await this.animateDialog(this.getOpenAnimation()),this.dispatchEvent(new Event("opened")),this.isOpening=!1)}async close(e=this.returnValue){var t,o;this.isOpening=!1,!this.isConnected||(await this.updateComplete,!(t=this.dialog).open)||this.isOpening?this.open=!1:(o=this.returnValue,this.returnValue=e,!this.dispatchEvent(new Event("close",{cancelable:!0}))?this.returnValue=o:(await this.animateDialog(this.getCloseAnimation()),t.close(e),this.open=!1,this.dispatchEvent(new Event("closed"))))}connectedCallback(){super.connectedCallback(),this.isConnectedPromiseResolve()}disconnectedCallback(){super.disconnectedCallback(),this.isConnectedPromise=this.getIsConnectedPromise()}render(){var e=this.open&&!(this.isAtScrollTop&&this.isAtScrollBottom),e={"has-headline":this.hasHeadline,"has-actions":this.hasActions,"has-icon":this.hasIcon,scrollable:e,"show-top-divider":e&&!this.isAtScrollTop,"show-bottom-divider":e&&!this.isAtScrollBottom,"allow-overflow":this.allowOverflow},t=this.ariaLabel;return html`<div class="scrim"></div><dialog class="${classMap(e)}" aria-label="${t||nothing}" aria-labelledby="${this.hasHeadline?"headline":nothing}" role="${"alert"===this.type?"alertdialog":nothing}" @cancel="${this.handleCancel}" @click="${this.handleDialogClick}" @close="${this.handleClose}" @keydown="${this.handleKeydown}" .returnValue="${this.returnValue||nothing}"><div class="container" @mousedown="${this.handleContentClick}"><div class="headline"><div class="icon" aria-hidden="true"><slot name="icon" @slotchange="${this.handleIconChange}"></slot></div><h2 id="headline" aria-hidden="${!this.hasHeadline||nothing}"><slot name="headline" @slotchange="${this.handleHeadlineChange}"></slot></h2><md-divider></md-divider></div><div class="scroller"><div class="content"><div class="top anchor"></div><slot name="content"></slot><div class="bottom anchor"></div></div></div><div class="actions"><md-divider></md-divider><slot name="actions" @slotchange="${this.handleActionsChange}"></slot></div></div></dialog>`}firstUpdated(){this.intersectionObserver=new IntersectionObserver(e=>{for(var t of e)this.handleAnchorIntersection(t)},{root:this.scroller}),this.intersectionObserver.observe(this.topAnchor),this.intersectionObserver.observe(this.bottomAnchor)}handleDialogClick(e){var t=this.container;e.composedPath().includes(t)||(this.nextClickIsFromContent&&!this.disableNextClickIsFromContent?this.nextClickIsFromContent=!1:!this.preventCloseOnScrimClick&&this.dispatchEvent(new Event("cancel",{cancelable:!0}))&&this.close())}handleContentClick(){this.nextClickIsFromContent=!0}handleSubmit(e){var t=e.submitter;"dialog"===e.target.method&&t&&this.close(null!=(e=t.getAttribute("value"))?e:this.returnValue)}handleCancel(e){var t;e.target!==this.dialog||(this.escapePressedWithoutCancel=!1,t=!redispatchEvent(this,e),e.preventDefault(),t)||this.close()}handleClose(){var e;this.escapePressedWithoutCancel&&(this.escapePressedWithoutCancel=!1,null!=(e=this.dialog))&&e.dispatchEvent(new Event("cancel",{cancelable:!0}))}handleKeydown(e){"Escape"===e.key&&(this.escapePressedWithoutCancel=!0,setTimeout(()=>{this.escapePressedWithoutCancel=!1}))}async animateDialog(e){var{dialog:o,scrim:i,container:a,headline:n,content:s,actions:l}=this;if(o&&i&&a&&n&&s&&l){var{container:r,dialog:d,scrim:c,headline:h,content:p,actions:v}=e,g=[];for(let[e,t]of[[o,null!=d?d:[]],[i,null!=c?c:[]],[a,null!=r?r:[]],[n,null!=h?h:[]],[s,null!=p?p:[]],[l,null!=v?v:[]]])for(var m of t)g.push(e.animate(...m));await Promise.all(g.map(e=>e.finished))}}handleHeadlineChange(e){e=e.target;this.hasHeadline=0<e.assignedElements().length}handleActionsChange(e){e=e.target;this.hasActions=0<e.assignedElements().length}handleIconChange(e){e=e.target;this.hasIcon=0<e.assignedElements().length}handleAnchorIntersection(e){var{target:e,isIntersecting:t}=e;e===this.topAnchor&&(this.isAtScrollTop=t),e===this.bottomAnchor&&(this.isAtScrollBottom=t)}getIsConnectedPromise(){return new Promise(e=>{this.isConnectedPromiseResolve=e})}}requestUpdateOnAriaChange(Dialog),__decorate([property({type:Boolean})],Dialog.prototype,"open",null),__decorate([property({type:Boolean})],Dialog.prototype,"preventCloseOnScrimClick",void 0),__decorate([property({attribute:!1})],Dialog.prototype,"returnValue",void 0),__decorate([property()],Dialog.prototype,"type",void 0),__decorate([property({type:Boolean})],Dialog.prototype,"disableNextClickIsFromContent",void 0),__decorate([property({type:Boolean})],Dialog.prototype,"allowOverflow",void 0),__decorate([query("dialog")],Dialog.prototype,"dialog",void 0),__decorate([query(".scrim")],Dialog.prototype,"scrim",void 0),__decorate([query(".container")],Dialog.prototype,"container",void 0),__decorate([query(".headline")],Dialog.prototype,"headline",void 0),__decorate([query(".content")],Dialog.prototype,"content",void 0),__decorate([query(".actions")],Dialog.prototype,"actions",void 0),__decorate([state()],Dialog.prototype,"isAtScrollTop",void 0),__decorate([state()],Dialog.prototype,"isAtScrollBottom",void 0),__decorate([query(".scroller")],Dialog.prototype,"scroller",void 0),__decorate([query(".top.anchor")],Dialog.prototype,"topAnchor",void 0),__decorate([query(".bottom.anchor")],Dialog.prototype,"bottomAnchor",void 0),__decorate([state()],Dialog.prototype,"hasHeadline",void 0),__decorate([state()],Dialog.prototype,"hasActions",void 0),__decorate([state()],Dialog.prototype,"hasIcon",void 0);let styles=css`:host{border-start-start-radius:var(--md-dialog-container-shape-start-start,var(--md-dialog-container-shape,var(--md-sys-shape-corner-extra-large,28px)));border-start-end-radius:var(--md-dialog-container-shape-start-end,var(--md-dialog-container-shape,var(--md-sys-shape-corner-extra-large,28px)));border-end-end-radius:var(--md-dialog-container-shape-end-end,var(--md-dialog-container-shape,var(--md-sys-shape-corner-extra-large,28px)));border-end-start-radius:var(--md-dialog-container-shape-end-start,var(--md-dialog-container-shape,var(--md-sys-shape-corner-extra-large,28px)));display:contents;margin:auto;max-height:min(560px,100% - 48px);max-width:min(560px,100% - 48px);min-width:280px;position:fixed;height:fit-content;width:fit-content}dialog{background:rgba(0,0,0,0);border:none;border-radius:inherit;box-shadow:0 12px 16px 0 rgba(0,0,0,.58);flex-direction:column;height:inherit;margin:inherit;max-height:inherit;max-width:inherit;min-height:inherit;min-width:inherit;outline:0;overflow:visible;padding:0;width:inherit}dialog[open]{display:block}::backdrop{background:rgba(0,0,0,.5)}h2{all:unset;align-self:stretch}.headline{align-items:center;color:var(--md-dialog-headline-color,var(--md-sys-color-on-surface,#1d1b20));display:flex;flex-direction:column;font-family:var(--md-dialog-headline-font,var(--md-sys-typescale-headline-small-font,var(--md-ref-typeface-brand,Roboto)));font-size:var(--md-dialog-headline-size,var(--md-sys-typescale-headline-small-size,1.5rem));line-height:var(--md-dialog-headline-line-height,var(--md-sys-typescale-headline-small-line-height,2rem));font-weight:var(--md-dialog-headline-weight,var(--md-sys-typescale-headline-small-weight,var(--md-ref-typeface-weight-regular,400)));position:relative}slot[name=headline]::slotted(*){align-items:center;align-self:stretch;box-sizing:border-box;display:flex;gap:8px;padding:24px 24px 0}.icon{display:flex}slot[name=icon]::slotted(*){color:var(--md-dialog-icon-color,var(--md-sys-color-secondary,#625b71));fill:currentColor;font-size:var(--md-dialog-icon-size,24px);margin-top:24px;height:var(--md-dialog-icon-size,24px);width:var(--md-dialog-icon-size,24px)}.has-icon slot[name=headline]::slotted(*){justify-content:center;padding-top:16px}.scrollable slot[name=headline]::slotted(*){padding-bottom:16px}.scrollable.has-headline slot[name=content]::slotted(*){padding-top:8px}.container{border-radius:inherit;display:flex;flex-direction:column;flex-grow:1;overflow:hidden;position:relative;transform-origin:top}.allow-overflow .container{overflow:visible}.container::before{background:var(--md-dialog-container-color,var(--md-sys-color-surface-container-high,#ece6f0));border-radius:inherit;content:'';inset:0;position:absolute}.scroller{display:flex;flex:1;flex-direction:column;overflow:initial;z-index:1}.scrollable .scroller{overflow-y:scroll}.content{color:var(--clr-on-surface,#092241);font-family:var(--text-default-font,sans-serif);font-size:var(--text-default-size,16px);letter-spacing:var(--text-default-letter-spacing,.0275em);line-height:var(--text-default-line-height,1.75em);font-weight:var(--text-default-weight,normal);text-transform:var(--text-default-decoration,none);text-decoration:var(--text-default-transform,none);height:min-content;position:relative}slot[name=content]::slotted(*){box-sizing:border-box;padding:24px}.anchor{position:absolute}.top.anchor{top:0}.bottom.anchor{bottom:0}.actions{position:relative}slot[name=actions]::slotted(*){box-sizing:border-box;display:flex;gap:8px;justify-content:flex-end;padding:16px 24px 24px}.has-actions slot[name=content]::slotted(*){padding-bottom:8px}md-divider{display:none;position:absolute}.has-actions.show-bottom-divider .actions md-divider,.has-headline.show-top-divider .headline md-divider{display:flex}.headline md-divider{bottom:0}.actions md-divider{top:0}@media (forced-colors:active){dialog{outline:2px solid WindowText}}`;class MdDialog extends Dialog{}MdDialog.styles=[styles],window.customElements.define("md-dialog",MdDialog);class IxDialog extends LitElement{constructor(){super(...arguments),this.open=!1,this.preventCancel=!1,this.preventCloseOnScrimClick=!1,this.disableNextClickIsFromContent=!1,this.useNativeDialog=!1,this.allowOverflow=!1,this.nativeClosing=!1,this.dialogRef=createRef(),this.containerRef=createRef(),this.pointerDownInside=!1,this.isScrollLocked=!1,this.scrollYBackup=0,this.onKeydown=e=>{var t;"Escape"===e.key&&(this.preventCancel||(t=new Event("cancel",{bubbles:!0,composed:!0,cancelable:!0}),!this.dispatchEvent(t))?e.preventDefault():this.requestClose())},this.onNativeCancel=e=>{var t=new Event("cancel",{bubbles:!0,composed:!0,cancelable:!0});this.dispatchEvent(t)?this.requestClose():e.preventDefault()},this.onScrimClick=()=>{this.preventCloseOnScrimClick||this.requestClose()}}get nativeDialog(){var e;return null!=(e=this.dialogRef.value)?e:null}get nativeDialogContainer(){var e;return null!=(e=this.containerRef.value)?e:null}connectedCallback(){super.connectedCallback(),this.mo=new MutationObserver(()=>{this.useNativeDialog&&this.open&&this.populatePortal()}),this.mo.observe(this,{childList:!0,subtree:!0,attributes:!0,characterData:!0})}disconnectedCallback(){var e;super.disconnectedCallback(),null!=(e=this.mo)&&e.disconnect(),this.unlockScroll(),this.teardownPortal()}updated(e){this.useNativeDialog&&e.has("open")&&(this.open?(this.ensurePortal(),this.portalRoot&&(this.attachPortalStyles(),render(this.portalTemplate(),this.portalRoot),this.populatePortal()),this.nativeClosing&&(this.nativeClosing=!1,null!=(e=this.nativeDialogContainer)&&e.classList.remove("closing"),this.nativeOnEnd&&this.nativeDialogContainer&&this.nativeDialogContainer.removeEventListener("animationend",this.nativeOnEnd),this.nativeOnEnd=void 0),this.dispatchEvent(new Event("open",{bubbles:!0,composed:!0})),this.lockScroll(),requestAnimationFrame(()=>{var e;null!=(e=this.nativeDialog)&&e.show(),requestAnimationFrame(()=>{this.dispatchEvent(new Event("opened",{bubbles:!0,composed:!0}))})})):this.startNativeCloseAnimation())}dismiss(){this.open&&Promise.resolve().then(()=>{this.requestClose()})}startNativeCloseAnimation(){if(!this.nativeClosing){this.nativeClosing=!0,this.dispatchEvent(new Event("close",{bubbles:!0,composed:!0}));let o=()=>{var e;null!=(e=this.nativeDialogContainer)&&e.classList.remove("closing"),this.nativeClosing=!1,null!=(e=this.nativeDialog)&&e.close(),this.unlockScroll(),this.dispatchEvent(new Event("closed",{bubbles:!0,composed:!0})),this.moveNodesBackFromPortal(),this.teardownPortal()},i=this.nativeDialogContainer;if(i){i.classList.add("closing");let e=!1,t=()=>{e||(e=!0,i.removeEventListener("animationend",t),o())};this.nativeOnEnd=t,i.addEventListener("animationend",t,{once:!0}),window.setTimeout(t,1)}else o()}}ensurePortal(){var e,t;this.portalRoot||(t=(e=document.createElement("ix-dialog-portal-host")).attachShadow({mode:"open"}),this.shadowRoot&&"adoptedStyleSheets"in this.shadowRoot&&(t.adoptedStyleSheets=this.shadowRoot.adoptedStyleSheets),document.body.appendChild(e),this.portalHost=e,this.portalRoot=t)}attachPortalStyles(){var e;this.portalRoot&&!this.portalStyleEl&&((e=document.createElement("style")).textContent=`
2
+ dialog {
3
+ position: fixed;
4
+ inset: 0;
5
+ margin: 0;
6
+ padding: 0;
7
+ border: 0;
8
+ top: 30%;
9
+ left: 5%;
10
+ background: transparent;
11
+ display: grid;
12
+ place-items: center;
13
+ pointer-events: none;
14
+ z-index: 1000;
15
+ max-width: none !important;
16
+ max-height: none !important;
17
+ }
18
+ .scrim {
19
+ position: fixed;
20
+ inset: 0;
21
+ background: var(--ix-dialog-scrim, rgba(0,0,0,0.32));
22
+ pointer-events: auto;
23
+ z-index: 1000;
24
+ touch-action: none;
25
+ border: 0;
26
+ padding: 0;
27
+ appearance: none;
28
+ }
29
+ .container {
30
+ position: relative;
31
+ border-radius: 0.75rem;
32
+ background: var(--ix-dialog-bg, #fff);
33
+ box-shadow: var(--ix-dialog-shadow, 0 10px 30px rgba(0,0,0,0.25));
34
+ display: grid;
35
+ grid-template-rows: auto 1fr auto;
36
+ overflow: visible;
37
+ pointer-events: auto;
38
+ z-index: 1001;
39
+ max-width: none!important;
40
+ }
41
+ .container .content {
42
+ overflow: visible;
43
+ }
44
+ @media (prefers-reduced-motion: reduce) {
45
+ dialog > .container { animation: none !important; }
46
+ }
47
+ `,this.portalRoot.append(e),this.portalStyleEl=e)}teardownPortal(){var e;this.portalHost&&(this.portalRoot&&render(nothing,this.portalRoot),null!=(e=this.portalStyleEl)&&e.remove(),this.portalStyleEl=void 0,this.portalHost.remove(),this.portalRoot=void 0,this.portalHost=void 0)}moveNodesToPortal(o,e){if(this.nativeDialogContainer){let t=this.nativeDialogContainer.querySelector(e);t&&Array.from(this.children).filter(e=>e instanceof HTMLElement&&e.slot===o).forEach(e=>t.appendChild(e))}}moveNodesBackFromPortal(){this.nativeDialogContainer&&[this.nativeDialogContainer.querySelector(".headline"),this.nativeDialogContainer.querySelector(".content"),this.nativeDialogContainer.querySelector(".actions")].forEach(e=>{e&&Array.from(e.childNodes).forEach(e=>this.appendChild(e))})}populatePortal(){this.moveNodesToPortal("headline",".headline"),this.moveNodesToPortal("content",".content"),this.moveNodesToPortal("actions",".actions")}requestClose(){this.open=!1}lockScroll(){if(!this.isScrollLocked){this.isScrollLocked=!0,this.scrollYBackup=window.scrollY||document.documentElement.scrollTop||0;var i=document.body,a=window.innerWidth-document.documentElement.clientWidth;0<a&&(i.style.paddingRight=a+"px"),i.style.overflow="hidden",i.style.position="fixed",i.style.top=`-${this.scrollYBackup}px`,i.style.left="0",i.style.right="0",i.style.width="100%";let t=e=>{var t=e.target;this.nativeDialogContainer&&t&&(this.nativeDialogContainer.contains(t)||e.preventDefault())},e=e=>t(e),o=e=>{var t;["PageUp","PageDown","Home","End","ArrowUp","ArrowDown"," "].includes(e.key)&&(t=e.target,this.nativeDialogContainer)&&t&&(this.nativeDialogContainer.contains(t)||e.preventDefault())};window.addEventListener("touchmove",e,{passive:!1}),window.addEventListener("keydown",o,{passive:!1}),this.removeScrollHandlers=()=>{window.removeEventListener("touchmove",e),window.removeEventListener("keydown",o)}}}unlockScroll(){var e;this.isScrollLocked&&(this.isScrollLocked=!1,this.removeScrollHandlers&&(this.removeScrollHandlers(),this.removeScrollHandlers=void 0),e=document.body,e.style.paddingRight="",e.style.position="",e.style.top="",e.style.left="",e.style.right="",e.style.overflow="",e.style.width="",window.scrollTo(0,this.scrollYBackup||0))}onOpen(){this.dispatchEvent(new Event("open")),this.lockScroll()}onOpened(){this.dispatchEvent(new Event("opened"))}onClose(){this.dispatchEvent(new Event("close"))}onClosed(){this.dispatchEvent(new Event("closed")),this.unlockScroll()}onCancel(e){this.preventCancel&&e.preventDefault(),this.dispatchEvent(new Event("cancel",{bubbles:!0,composed:!0}))}portalTemplate(){return html`<dialog ${ref(this.dialogRef)} @cancel="${this.onNativeCancel}" @keydown="${this.onKeydown}"><button class="scrim" type="button" aria-label="Close dialog" @click="${this.onScrimClick}"></button><div class="container" ${ref(this.containerRef)} role="dialog" aria-modal="true"><div class="headline"></div><div class="content"></div><div class="actions"></div></div></dialog>`}renderMdDialog(){return this.portalHost&&(this.moveNodesBackFromPortal(),this.teardownPortal()),html`<md-dialog ?open="${this.open}" class="dialog" ?preventCloseOnScrimClick="${this.preventCloseOnScrimClick}" ?disableNextClickIsFromContent="${this.disableNextClickIsFromContent}" ?allowOverflow="${this.allowOverflow}" @open="${this.onOpen}" @opened="${this.onOpened}" @close="${this.onClose}" @closed="${this.onClosed}" @cancel="${this.onCancel}"><slot slot="headline" name="headline"></slot><slot slot="content" name="content"></slot><slot slot="actions" name="actions"></slot></md-dialog>`}renderNativeDialog(){return this.portalRoot&&(render(this.portalTemplate(),this.portalRoot),this.populatePortal()),nothing}render(){return this.useNativeDialog?this.renderNativeDialog():this.renderMdDialog()}}var _a,_b;requestUpdateOnAriaChange(IxDialog),IxDialog.styles=[IxDialogStyles,css`:host([use-native-dialog]) dialog[open],:host([use-native-dialog][closing]) dialog{position:fixed;inset:0;margin:0;padding:0;border:0;background:0 0;display:block;inline-size:100vw;block-size:100dvh;pointer-events:none;z-index:99;overscroll-behavior:contain}:host([use-native-dialog]) dialog[open] .scrim,:host([use-native-dialog]) dialog[open]>.container,:host([use-native-dialog][closing]) .scrim,:host([use-native-dialog][closing]) dialog>.container{pointer-events:auto}:host([use-native-dialog]) dialog[open] .scrim,:host([use-native-dialog][closing]) .scrim{position:fixed;inset:0;background:var(--ix-dialog-scrim,rgba(0,0,0,.32))}:host([use-native-dialog]) dialog[open] .scrim{overscroll-behavior:contain;touch-action:none}:host([use-native-dialog]) dialog[open]>.container,:host([use-native-dialog][closing]) dialog>.container{transform:translate(-50%,-50%);width:auto;height:auto;max-block-size:var(--ix-dialog-max-height,90dvh);border-radius:.75rem;background:var(--ix-dialog-bg,#fff);box-shadow:var(--ix-dialog-shadow,0 .625rem 1.875rem rgba(0,0,0,.25));display:grid;grid-template-rows:auto 1fr auto;overflow:hidden;z-index:9;transform-origin:top center;will-change:transform,opacity}:host([use-native-dialog]) .actions,:host([use-native-dialog]) .content,:host([use-native-dialog]) .headline{padding:var(--ix-dialog-section-padding,1rem)}:host([use-native-dialog]) .content{overflow:auto}:host([use-native-dialog]) .actions{display:inline-flex;gap:var(--ix-dialog-actions-gap,.5rem);justify-content:flex-end;align-items:center;padding-block:var(--ix-dialog-actions-padding-block,.75rem);border-top:var(--ix-dialog-actions-border,1px solid rgba(0,0,0,.08))}@keyframes ix-fold-in{from{transform:translate(-50%,-50%) translateY(-.5rem) scaleY(.92);opacity:0}to{transform:translate(-50%,-50%) translateY(0) scaleY(1);opacity:1}}@keyframes ix-fold-out{from{transform:translate(-50%,-50%) translateY(0) scaleY(1);opacity:1}to{transform:translate(-50%,-50%) translateY(-.5rem) scaleY(.98);opacity:0}}:host([use-native-dialog]:not([closing])) dialog[open]>.container{animation:ix-fold-in var(--ix-dialog-in-dur,1000ms) cubic-bezier(.2,.7,.3,1) both}:host([use-native-dialog][closing]) dialog>.container{animation:ix-fold-out var(--ix-dialog-out-dur,250ms) cubic-bezier(.2,.7,.3,1) both}@media (prefers-reduced-motion:reduce){:host([use-native-dialog]) dialog>.container{animation:none!important}}`],IxDialog.shadowRootOptions={...LitElement.shadowRootOptions,delegatesFocus:!0},__decorate([query(".dialog")],IxDialog.prototype,"component",void 0),__decorate([property({type:Boolean,reflect:!0})],IxDialog.prototype,"open",void 0),__decorate([property({type:Boolean,attribute:"prevent-cancel"})],IxDialog.prototype,"preventCancel",void 0),__decorate([property({type:Boolean})],IxDialog.prototype,"preventCloseOnScrimClick",void 0),__decorate([property({type:Boolean})],IxDialog.prototype,"disableNextClickIsFromContent",void 0),__decorate([property({type:Boolean,reflect:!0,attribute:"use-native-dialog"})],IxDialog.prototype,"useNativeDialog",void 0),__decorate([property({type:Boolean})],IxDialog.prototype,"allowOverflow",void 0),__decorate([state()],IxDialog.prototype,"nativeClosing",void 0);class IxDialogStyled extends(_b=IxDialog){}(_a=IxDialogStyled).styles=[Reflect.get(_b,"styles",_a),css`.dialog{max-height:90vh;max-width:90vw}`],customElements.define("ix-dialog",IxDialogStyled);export{IxDialogStyled};
package/dist/md-dialog.js CHANGED
@@ -149,6 +149,10 @@ export const styles = css `
149
149
  transform-origin: top;
150
150
  }
151
151
 
152
+ .allow-overflow .container {
153
+ overflow: visible;
154
+ }
155
+
152
156
  .container::before {
153
157
  background: var(
154
158
  --md-dialog-container-color,
@@ -1 +1 @@
1
- {"version":3,"file":"md-dialog.js","sourceRoot":"","sources":["../src/md-dialog.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,GAAG,EAAE,MAAM,KAAK,CAAC;AAE7C,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAE9C,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiPxB,CAAC;AAEF,MAAM,OAAO,QAAS,SAAQ,MAAM;;AAClB,eAAM,GAAwB,CAAC,MAAM,CAAC,CAAC;AAGzD,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC","sourcesContent":["import { CSSResultOrNative, css } from 'lit';\n\nimport { Dialog } from './internal/dialog.js';\n\nexport const styles = css`\n :host {\n border-start-start-radius: var(\n --md-dialog-container-shape-start-start,\n var(\n --md-dialog-container-shape,\n var(--md-sys-shape-corner-extra-large, 28px)\n )\n );\n border-start-end-radius: var(\n --md-dialog-container-shape-start-end,\n var(\n --md-dialog-container-shape,\n var(--md-sys-shape-corner-extra-large, 28px)\n )\n );\n border-end-end-radius: var(\n --md-dialog-container-shape-end-end,\n var(\n --md-dialog-container-shape,\n var(--md-sys-shape-corner-extra-large, 28px)\n )\n );\n border-end-start-radius: var(\n --md-dialog-container-shape-end-start,\n var(\n --md-dialog-container-shape,\n var(--md-sys-shape-corner-extra-large, 28px)\n )\n );\n display: contents;\n margin: auto;\n max-height: min(560px, 100% - 48px);\n max-width: min(560px, 100% - 48px);\n min-width: 280px;\n position: fixed;\n height: fit-content;\n width: fit-content;\n }\n\n dialog {\n background: rgba(0, 0, 0, 0);\n border: none;\n border-radius: inherit;\n box-shadow: 0px 12px 16px 0px rgba(0, 0, 0, 0.58);\n flex-direction: column;\n height: inherit;\n margin: inherit;\n max-height: inherit;\n max-width: inherit;\n min-height: inherit;\n min-width: inherit;\n outline: none;\n overflow: visible;\n padding: 0;\n width: inherit;\n }\n\n dialog[open] {\n display: block;\n }\n\n ::backdrop {\n background: rgba(0, 0, 0, 0.5);\n }\n\n h2 {\n all: unset;\n align-self: stretch;\n }\n\n .headline {\n align-items: center;\n color: var(\n --md-dialog-headline-color,\n var(--md-sys-color-on-surface, #1d1b20)\n );\n display: flex;\n flex-direction: column;\n font-family: var(\n --md-dialog-headline-font,\n var(\n --md-sys-typescale-headline-small-font,\n var(--md-ref-typeface-brand, Roboto)\n )\n );\n font-size: var(\n --md-dialog-headline-size,\n var(--md-sys-typescale-headline-small-size, 1.5rem)\n );\n line-height: var(\n --md-dialog-headline-line-height,\n var(--md-sys-typescale-headline-small-line-height, 2rem)\n );\n font-weight: var(\n --md-dialog-headline-weight,\n var(\n --md-sys-typescale-headline-small-weight,\n var(--md-ref-typeface-weight-regular, 400)\n )\n );\n position: relative;\n }\n\n slot[name='headline']::slotted(*) {\n align-items: center;\n align-self: stretch;\n box-sizing: border-box;\n display: flex;\n gap: 8px;\n padding: 24px 24px 0;\n }\n\n .icon {\n display: flex;\n }\n\n slot[name='icon']::slotted(*) {\n color: var(--md-dialog-icon-color, var(--md-sys-color-secondary, #625b71));\n fill: currentColor;\n font-size: var(--md-dialog-icon-size, 24px);\n margin-top: 24px;\n height: var(--md-dialog-icon-size, 24px);\n width: var(--md-dialog-icon-size, 24px);\n }\n\n .has-icon slot[name='headline']::slotted(*) {\n justify-content: center;\n padding-top: 16px;\n }\n\n .scrollable slot[name='headline']::slotted(*) {\n padding-bottom: 16px;\n }\n\n .scrollable.has-headline slot[name='content']::slotted(*) {\n padding-top: 8px;\n }\n\n .container {\n border-radius: inherit;\n display: flex;\n flex-direction: column;\n flex-grow: 1;\n overflow: hidden;\n position: relative;\n transform-origin: top;\n }\n\n .container::before {\n background: var(\n --md-dialog-container-color,\n var(--md-sys-color-surface-container-high, #ece6f0)\n );\n border-radius: inherit;\n content: '';\n inset: 0;\n position: absolute;\n }\n\n .scroller {\n display: flex;\n flex: 1;\n flex-direction: column;\n overflow: initial;\n z-index: 1;\n }\n\n .scrollable .scroller {\n overflow-y: scroll;\n }\n\n .content {\n color: var(--clr-on-surface, #092241);\n font-family: var(--text-default-font, sans-serif);\n font-size: var(--text-default-size, 16px);\n letter-spacing: var(--text-default-letter-spacing, 0.0275em);\n line-height: var(--text-default-line-height, 1.75em);\n font-weight: var(--text-default-weight, normal);\n text-transform: var(--text-default-decoration, none);\n text-decoration: var(--text-default-transform, none);\n height: min-content;\n position: relative;\n }\n\n slot[name='content']::slotted(*) {\n box-sizing: border-box;\n padding: 24px;\n }\n\n .anchor {\n position: absolute;\n }\n\n .top.anchor {\n top: 0;\n }\n\n .bottom.anchor {\n bottom: 0;\n }\n\n .actions {\n position: relative;\n }\n\n slot[name='actions']::slotted(*) {\n box-sizing: border-box;\n display: flex;\n gap: 8px;\n justify-content: flex-end;\n padding: 16px 24px 24px;\n }\n\n .has-actions slot[name='content']::slotted(*) {\n padding-bottom: 8px;\n }\n\n md-divider {\n display: none;\n position: absolute;\n }\n\n .has-headline.show-top-divider .headline md-divider,\n .has-actions.show-bottom-divider .actions md-divider {\n display: flex;\n }\n\n .headline md-divider {\n bottom: 0;\n }\n\n .actions md-divider {\n top: 0;\n }\n\n @media (forced-colors: active) {\n dialog {\n outline: 2px solid WindowText;\n }\n }\n`;\n\nexport class MdDialog extends Dialog {\n static override styles: CSSResultOrNative[] = [styles];\n}\n\nwindow.customElements.define('md-dialog', MdDialog);\n"]}
1
+ {"version":3,"file":"md-dialog.js","sourceRoot":"","sources":["../src/md-dialog.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,GAAG,EAAE,MAAM,KAAK,CAAC;AAE7C,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAE9C,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqPxB,CAAC;AAEF,MAAM,OAAO,QAAS,SAAQ,MAAM;;AAClB,eAAM,GAAwB,CAAC,MAAM,CAAC,CAAC;AAGzD,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC","sourcesContent":["import { CSSResultOrNative, css } from 'lit';\n\nimport { Dialog } from './internal/dialog.js';\n\nexport const styles = css`\n :host {\n border-start-start-radius: var(\n --md-dialog-container-shape-start-start,\n var(\n --md-dialog-container-shape,\n var(--md-sys-shape-corner-extra-large, 28px)\n )\n );\n border-start-end-radius: var(\n --md-dialog-container-shape-start-end,\n var(\n --md-dialog-container-shape,\n var(--md-sys-shape-corner-extra-large, 28px)\n )\n );\n border-end-end-radius: var(\n --md-dialog-container-shape-end-end,\n var(\n --md-dialog-container-shape,\n var(--md-sys-shape-corner-extra-large, 28px)\n )\n );\n border-end-start-radius: var(\n --md-dialog-container-shape-end-start,\n var(\n --md-dialog-container-shape,\n var(--md-sys-shape-corner-extra-large, 28px)\n )\n );\n display: contents;\n margin: auto;\n max-height: min(560px, 100% - 48px);\n max-width: min(560px, 100% - 48px);\n min-width: 280px;\n position: fixed;\n height: fit-content;\n width: fit-content;\n }\n\n dialog {\n background: rgba(0, 0, 0, 0);\n border: none;\n border-radius: inherit;\n box-shadow: 0px 12px 16px 0px rgba(0, 0, 0, 0.58);\n flex-direction: column;\n height: inherit;\n margin: inherit;\n max-height: inherit;\n max-width: inherit;\n min-height: inherit;\n min-width: inherit;\n outline: none;\n overflow: visible;\n padding: 0;\n width: inherit;\n }\n\n dialog[open] {\n display: block;\n }\n\n ::backdrop {\n background: rgba(0, 0, 0, 0.5);\n }\n\n h2 {\n all: unset;\n align-self: stretch;\n }\n\n .headline {\n align-items: center;\n color: var(\n --md-dialog-headline-color,\n var(--md-sys-color-on-surface, #1d1b20)\n );\n display: flex;\n flex-direction: column;\n font-family: var(\n --md-dialog-headline-font,\n var(\n --md-sys-typescale-headline-small-font,\n var(--md-ref-typeface-brand, Roboto)\n )\n );\n font-size: var(\n --md-dialog-headline-size,\n var(--md-sys-typescale-headline-small-size, 1.5rem)\n );\n line-height: var(\n --md-dialog-headline-line-height,\n var(--md-sys-typescale-headline-small-line-height, 2rem)\n );\n font-weight: var(\n --md-dialog-headline-weight,\n var(\n --md-sys-typescale-headline-small-weight,\n var(--md-ref-typeface-weight-regular, 400)\n )\n );\n position: relative;\n }\n\n slot[name='headline']::slotted(*) {\n align-items: center;\n align-self: stretch;\n box-sizing: border-box;\n display: flex;\n gap: 8px;\n padding: 24px 24px 0;\n }\n\n .icon {\n display: flex;\n }\n\n slot[name='icon']::slotted(*) {\n color: var(--md-dialog-icon-color, var(--md-sys-color-secondary, #625b71));\n fill: currentColor;\n font-size: var(--md-dialog-icon-size, 24px);\n margin-top: 24px;\n height: var(--md-dialog-icon-size, 24px);\n width: var(--md-dialog-icon-size, 24px);\n }\n\n .has-icon slot[name='headline']::slotted(*) {\n justify-content: center;\n padding-top: 16px;\n }\n\n .scrollable slot[name='headline']::slotted(*) {\n padding-bottom: 16px;\n }\n\n .scrollable.has-headline slot[name='content']::slotted(*) {\n padding-top: 8px;\n }\n\n .container {\n border-radius: inherit;\n display: flex;\n flex-direction: column;\n flex-grow: 1;\n overflow: hidden;\n position: relative;\n transform-origin: top;\n }\n\n .allow-overflow .container {\n overflow: visible;\n }\n\n .container::before {\n background: var(\n --md-dialog-container-color,\n var(--md-sys-color-surface-container-high, #ece6f0)\n );\n border-radius: inherit;\n content: '';\n inset: 0;\n position: absolute;\n }\n\n .scroller {\n display: flex;\n flex: 1;\n flex-direction: column;\n overflow: initial;\n z-index: 1;\n }\n\n .scrollable .scroller {\n overflow-y: scroll;\n }\n\n .content {\n color: var(--clr-on-surface, #092241);\n font-family: var(--text-default-font, sans-serif);\n font-size: var(--text-default-size, 16px);\n letter-spacing: var(--text-default-letter-spacing, 0.0275em);\n line-height: var(--text-default-line-height, 1.75em);\n font-weight: var(--text-default-weight, normal);\n text-transform: var(--text-default-decoration, none);\n text-decoration: var(--text-default-transform, none);\n height: min-content;\n position: relative;\n }\n\n slot[name='content']::slotted(*) {\n box-sizing: border-box;\n padding: 24px;\n }\n\n .anchor {\n position: absolute;\n }\n\n .top.anchor {\n top: 0;\n }\n\n .bottom.anchor {\n bottom: 0;\n }\n\n .actions {\n position: relative;\n }\n\n slot[name='actions']::slotted(*) {\n box-sizing: border-box;\n display: flex;\n gap: 8px;\n justify-content: flex-end;\n padding: 16px 24px 24px;\n }\n\n .has-actions slot[name='content']::slotted(*) {\n padding-bottom: 8px;\n }\n\n md-divider {\n display: none;\n position: absolute;\n }\n\n .has-headline.show-top-divider .headline md-divider,\n .has-actions.show-bottom-divider .actions md-divider {\n display: flex;\n }\n\n .headline md-divider {\n bottom: 0;\n }\n\n .actions md-divider {\n top: 0;\n }\n\n @media (forced-colors: active) {\n dialog {\n outline: 2px solid WindowText;\n }\n }\n`;\n\nexport class MdDialog extends Dialog {\n static override styles: CSSResultOrNative[] = [styles];\n}\n\nwindow.customElements.define('md-dialog', MdDialog);\n"]}
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "Webcomponent ix-dialog following open-wc recommendations",
4
4
  "license": "MIT",
5
5
  "author": "Digital Realty",
6
- "version": "1.2.1",
6
+ "version": "1.2.3",
7
7
  "type": "module",
8
8
  "main": "dist/index.js",
9
9
  "module": "dist/index.js",
@@ -102,5 +102,5 @@
102
102
  "README.md",
103
103
  "LICENSE"
104
104
  ],
105
- "gitHead": "0a87dc6e3da94a1375ec43a7ead2bfdec4913821"
105
+ "gitHead": "1ae325f4f33004b99a810afc06da42e119200d2f"
106
106
  }