@digital-realty/ix-dialog 1.2.1 → 1.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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,45 @@ 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
+ private nativeClosing;
20
+ private dialogRef;
21
+ private containerRef;
22
+ private portalHost?;
23
+ private portalRoot?;
24
+ private portalStyleEl?;
25
+ private pointerDownInside;
26
+ private isScrollLocked;
27
+ private scrollYBackup;
28
+ private removeScrollHandlers?;
29
+ private nativeOnEnd?;
30
+ private mo?;
31
+ private get nativeDialog();
32
+ private get nativeDialogContainer();
33
+ connectedCallback(): void;
19
34
  disconnectedCallback(): void;
20
- resetBodyStyles(): void;
35
+ updated(changed: Map<string, unknown>): void;
36
+ dismiss(): void;
37
+ private startNativeCloseAnimation;
38
+ private ensurePortal;
39
+ private attachPortalStyles;
40
+ private teardownPortal;
41
+ private moveNodesToPortal;
42
+ private moveNodesBackFromPortal;
43
+ private populatePortal;
44
+ private onKeydown;
45
+ private onNativeCancel;
46
+ private requestClose;
47
+ private onScrimClick;
48
+ private lockScroll;
49
+ private unlockScroll;
21
50
  onOpen(): void;
22
51
  onOpened(): void;
23
52
  onClose(): void;
24
53
  onClosed(): void;
25
- onCancel(e: any): void;
26
- render(): import("lit-html").TemplateResult<1>;
54
+ onCancel(e: Event): void;
55
+ private portalTemplate;
56
+ private renderMdDialog;
57
+ private renderNativeDialog;
58
+ render(): symbol | import("lit-html").TemplateResult<1>;
27
59
  }
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,332 @@ 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.nativeClosing = false;
17
+ this.dialogRef = createRef();
18
+ this.containerRef = createRef();
19
+ this.pointerDownInside = false;
20
+ this.isScrollLocked = false;
21
+ this.scrollYBackup = 0;
22
+ this.onKeydown = (e) => {
23
+ if (e.key !== 'Escape')
24
+ return;
25
+ if (this.preventCancel) {
26
+ e.preventDefault();
27
+ return;
28
+ }
29
+ const cancelEvt = new Event('cancel', {
30
+ bubbles: true,
31
+ composed: true,
32
+ cancelable: true,
33
+ });
34
+ const prevented = !this.dispatchEvent(cancelEvt);
35
+ if (prevented) {
36
+ e.preventDefault();
37
+ return;
38
+ }
39
+ this.requestClose();
40
+ };
41
+ this.onNativeCancel = (e) => {
42
+ const forwarded = new Event('cancel', {
43
+ bubbles: true,
44
+ composed: true,
45
+ cancelable: true,
46
+ });
47
+ const prevented = !this.dispatchEvent(forwarded);
48
+ if (prevented) {
49
+ e.preventDefault();
50
+ return;
51
+ }
52
+ this.requestClose();
53
+ };
54
+ this.onScrimClick = () => {
55
+ if (!this.preventCloseOnScrimClick)
56
+ this.requestClose();
57
+ };
58
+ }
59
+ get nativeDialog() {
60
+ var _a;
61
+ return (_a = this.dialogRef.value) !== null && _a !== void 0 ? _a : null;
62
+ }
63
+ get nativeDialogContainer() {
64
+ var _a;
65
+ return (_a = this.containerRef.value) !== null && _a !== void 0 ? _a : null;
66
+ }
67
+ connectedCallback() {
68
+ super.connectedCallback();
69
+ this.mo = new MutationObserver(() => {
70
+ if (this.useNativeDialog && this.open)
71
+ this.populatePortal();
72
+ });
73
+ this.mo.observe(this, {
74
+ childList: true,
75
+ subtree: true,
76
+ attributes: true,
77
+ characterData: true,
78
+ });
14
79
  }
15
80
  disconnectedCallback() {
81
+ var _a;
16
82
  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);
83
+ (_a = this.mo) === null || _a === void 0 ? void 0 : _a.disconnect();
84
+ this.unlockScroll();
85
+ this.teardownPortal();
86
+ }
87
+ updated(changed) {
88
+ var _a;
89
+ if (!this.useNativeDialog)
90
+ return;
91
+ if (changed.has('open')) {
92
+ if (this.open) {
93
+ this.ensurePortal();
94
+ if (this.portalRoot) {
95
+ this.attachPortalStyles();
96
+ render(this.portalTemplate(), this.portalRoot);
97
+ this.populatePortal();
98
+ }
99
+ if (this.nativeClosing) {
100
+ this.nativeClosing = false;
101
+ (_a = this.nativeDialogContainer) === null || _a === void 0 ? void 0 : _a.classList.remove('closing');
102
+ if (this.nativeOnEnd && this.nativeDialogContainer) {
103
+ this.nativeDialogContainer.removeEventListener('animationend', this.nativeOnEnd);
104
+ }
105
+ this.nativeOnEnd = undefined;
106
+ }
107
+ this.dispatchEvent(new Event('open', { bubbles: true, composed: true }));
108
+ this.lockScroll();
109
+ requestAnimationFrame(() => {
110
+ var _a;
111
+ (_a = this.nativeDialog) === null || _a === void 0 ? void 0 : _a.show();
112
+ requestAnimationFrame(() => {
113
+ this.dispatchEvent(new Event('opened', { bubbles: true, composed: true }));
114
+ });
115
+ });
116
+ }
117
+ else {
118
+ this.startNativeCloseAnimation();
119
+ }
120
+ }
121
+ }
122
+ dismiss() {
123
+ if (!this.open)
124
+ return;
125
+ Promise.resolve().then(() => {
126
+ this.requestClose();
127
+ });
128
+ }
129
+ startNativeCloseAnimation() {
130
+ if (this.nativeClosing)
131
+ return;
132
+ this.nativeClosing = true;
133
+ this.dispatchEvent(new Event('close', { bubbles: true, composed: true }));
134
+ const finish = () => {
135
+ var _a, _b;
136
+ (_a = this.nativeDialogContainer) === null || _a === void 0 ? void 0 : _a.classList.remove('closing');
137
+ this.nativeClosing = false;
138
+ (_b = this.nativeDialog) === null || _b === void 0 ? void 0 : _b.close();
139
+ this.unlockScroll();
140
+ this.dispatchEvent(new Event('closed', { bubbles: true, composed: true }));
141
+ this.moveNodesBackFromPortal();
142
+ this.teardownPortal();
143
+ };
144
+ const container = this.nativeDialogContainer;
145
+ if (!container) {
146
+ finish();
147
+ return;
148
+ }
149
+ container.classList.add('closing');
150
+ let done = false;
151
+ const onEnd = () => {
152
+ if (done)
153
+ return;
154
+ done = true;
155
+ container.removeEventListener('animationend', onEnd);
156
+ finish();
157
+ };
158
+ this.nativeOnEnd = onEnd;
159
+ container.addEventListener('animationend', onEnd, { once: true });
160
+ window.setTimeout(onEnd, 1);
161
+ }
162
+ ensurePortal() {
163
+ if (this.portalRoot)
164
+ return;
165
+ const host = document.createElement('ix-dialog-portal-host');
166
+ const root = host.attachShadow({ mode: 'open' });
167
+ if (this.shadowRoot && 'adoptedStyleSheets' in this.shadowRoot) {
168
+ root.adoptedStyleSheets = this.shadowRoot.adoptedStyleSheets;
169
+ }
170
+ document.body.appendChild(host);
171
+ this.portalHost = host;
172
+ this.portalRoot = root;
173
+ }
174
+ attachPortalStyles() {
175
+ if (!this.portalRoot || this.portalStyleEl)
176
+ return;
177
+ const style = document.createElement('style');
178
+ style.textContent = `
179
+ dialog {
180
+ position: fixed;
181
+ inset: 0;
182
+ margin: 0;
183
+ padding: 0;
184
+ border: 0;
185
+ top: 30%;
186
+ left: 5%;
187
+ background: transparent;
188
+ display: grid;
189
+ place-items: center;
190
+ pointer-events: none;
191
+ z-index: 1000;
192
+ max-width: none !important;
193
+ max-height: none !important;
194
+ }
195
+ .scrim {
196
+ position: fixed;
197
+ inset: 0;
198
+ background: var(--ix-dialog-scrim, rgba(0,0,0,0.32));
199
+ pointer-events: auto;
200
+ z-index: 1000;
201
+ touch-action: none;
202
+ border: 0;
203
+ padding: 0;
204
+ appearance: none;
205
+ }
206
+ .container {
207
+ position: relative;
208
+ border-radius: 0.75rem;
209
+ background: var(--ix-dialog-bg, #fff);
210
+ box-shadow: var(--ix-dialog-shadow, 0 10px 30px rgba(0,0,0,0.25));
211
+ display: grid;
212
+ grid-template-rows: auto 1fr auto;
213
+ overflow: visible;
214
+ pointer-events: auto;
215
+ z-index: 1001;
216
+ max-width: none!important;
217
+ }
218
+ .container .content {
219
+ overflow: visible;
220
+ }
221
+ @media (prefers-reduced-motion: reduce) {
222
+ dialog > .container { animation: none !important; }
223
+ }
224
+ `;
225
+ this.portalRoot.append(style);
226
+ this.portalStyleEl = style;
227
+ }
228
+ teardownPortal() {
229
+ var _a;
230
+ if (!this.portalHost)
231
+ return;
232
+ if (this.portalRoot)
233
+ render(nothing, this.portalRoot);
234
+ (_a = this.portalStyleEl) === null || _a === void 0 ? void 0 : _a.remove();
235
+ this.portalStyleEl = undefined;
236
+ this.portalHost.remove();
237
+ this.portalRoot = undefined;
238
+ this.portalHost = undefined;
239
+ }
240
+ moveNodesToPortal(slotName, targetSelector) {
241
+ if (!this.nativeDialogContainer)
242
+ return;
243
+ const target = this.nativeDialogContainer.querySelector(targetSelector);
244
+ if (!target)
245
+ return;
246
+ const nodes = Array.from(this.children).filter(el => el instanceof HTMLElement && el.slot === slotName);
247
+ nodes.forEach(n => target.appendChild(n));
248
+ }
249
+ moveNodesBackFromPortal() {
250
+ if (!this.nativeDialogContainer)
251
+ return;
252
+ const h = this.nativeDialogContainer.querySelector('.headline');
253
+ const b = this.nativeDialogContainer.querySelector('.content');
254
+ const a = this.nativeDialogContainer.querySelector('.actions');
255
+ [h, b, a].forEach(container => {
256
+ if (!container)
257
+ return;
258
+ const children = Array.from(container.childNodes);
259
+ children.forEach(n => this.appendChild(n));
260
+ });
261
+ }
262
+ populatePortal() {
263
+ this.moveNodesToPortal('headline', '.headline');
264
+ this.moveNodesToPortal('content', '.content');
265
+ this.moveNodesToPortal('actions', '.actions');
266
+ }
267
+ requestClose() {
268
+ this.open = false;
269
+ }
270
+ lockScroll() {
271
+ if (this.isScrollLocked)
272
+ return;
273
+ this.isScrollLocked = true;
274
+ this.scrollYBackup =
275
+ window.scrollY || document.documentElement.scrollTop || 0;
276
+ const { body } = document;
277
+ const scrollbarWidth = window.innerWidth - document.documentElement.clientWidth;
278
+ if (scrollbarWidth > 0) {
279
+ body.style.paddingRight = `${scrollbarWidth}px`;
280
+ }
281
+ body.style.overflow = 'hidden';
282
+ body.style.position = 'fixed';
283
+ body.style.top = `-${this.scrollYBackup}px`;
284
+ body.style.left = '0';
285
+ body.style.right = '0';
286
+ body.style.width = '100%';
287
+ const stopIfOutside = (ev) => {
288
+ const t = ev.target;
289
+ if (!this.nativeDialogContainer || !t)
290
+ return;
291
+ if (!this.nativeDialogContainer.contains(t))
292
+ ev.preventDefault();
293
+ };
294
+ const onTouchMove = (e) => stopIfOutside(e);
295
+ const onKeyDown = (e) => {
296
+ const keys = [
297
+ 'PageUp',
298
+ 'PageDown',
299
+ 'Home',
300
+ 'End',
301
+ 'ArrowUp',
302
+ 'ArrowDown',
303
+ ' ',
304
+ ];
305
+ if (!keys.includes(e.key))
306
+ return;
307
+ const t = e.target;
308
+ if (!this.nativeDialogContainer || !t)
309
+ return;
310
+ if (!this.nativeDialogContainer.contains(t))
311
+ e.preventDefault();
312
+ };
313
+ window.addEventListener('touchmove', onTouchMove, { passive: false });
314
+ window.addEventListener('keydown', onKeyDown, { passive: false });
315
+ this.removeScrollHandlers = () => {
316
+ window.removeEventListener('touchmove', onTouchMove);
317
+ window.removeEventListener('keydown', onKeyDown);
318
+ };
319
+ }
320
+ unlockScroll() {
321
+ if (!this.isScrollLocked)
322
+ return;
323
+ this.isScrollLocked = false;
324
+ if (this.removeScrollHandlers) {
325
+ this.removeScrollHandlers();
326
+ this.removeScrollHandlers = undefined;
327
+ }
328
+ const { body } = document;
329
+ body.style.paddingRight = '';
330
+ body.style.position = '';
331
+ body.style.top = '';
332
+ body.style.left = '';
333
+ body.style.right = '';
334
+ body.style.overflow = '';
335
+ body.style.width = '';
336
+ window.scrollTo(0, this.scrollYBackup || 0);
29
337
  }
30
338
  onOpen() {
31
339
  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%';
340
+ this.lockScroll();
45
341
  }
46
342
  onOpened() {
47
343
  this.dispatchEvent(new Event('opened'));
@@ -51,38 +347,193 @@ export class IxDialog extends LitElement {
51
347
  }
52
348
  onClosed() {
53
349
  this.dispatchEvent(new Event('closed'));
54
- this.resetBodyStyles();
350
+ this.unlockScroll();
55
351
  }
56
352
  onCancel(e) {
57
- if (this.preventCancel) {
353
+ if (this.preventCancel)
58
354
  e.preventDefault();
59
- }
60
- this.dispatchEvent(new Event('cancel'));
355
+ this.dispatchEvent(new Event('cancel', { bubbles: true, composed: true }));
61
356
  }
62
- render() {
357
+ portalTemplate() {
63
358
  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}
359
+ <dialog
360
+ ${ref(this.dialogRef)}
361
+ @cancel=${this.onNativeCancel}
362
+ @keydown=${this.onKeydown}
74
363
  >
75
- <slot slot="headline" name="headline"></slot>
76
- <slot slot="content" name="content"></slot>
77
- <slot slot="actions" name="actions"></slot>
78
- </md-dialog>
364
+ <button
365
+ class="scrim"
366
+ type="button"
367
+ aria-label="Close dialog"
368
+ @click=${this.onScrimClick}
369
+ ></button>
370
+ <div
371
+ class="container"
372
+ ${ref(this.containerRef)}
373
+ role="dialog"
374
+ aria-modal="true"
375
+ >
376
+ <div class="headline"></div>
377
+ <div class="content"></div>
378
+ <div class="actions"></div>
379
+ </div>
380
+ </dialog>
79
381
  `;
80
382
  }
383
+ renderMdDialog() {
384
+ if (this.portalHost) {
385
+ this.moveNodesBackFromPortal();
386
+ this.teardownPortal();
387
+ }
388
+ return html `<md-dialog
389
+ ?open=${this.open}
390
+ class="dialog"
391
+ ?preventCloseOnScrimClick=${this.preventCloseOnScrimClick}
392
+ ?disableNextClickIsFromContent=${this.disableNextClickIsFromContent}
393
+ @open=${this.onOpen}
394
+ @opened=${this.onOpened}
395
+ @close=${this.onClose}
396
+ @closed=${this.onClosed}
397
+ @cancel=${this.onCancel}
398
+ >
399
+ <slot slot="headline" name="headline"></slot>
400
+ <slot slot="content" name="content"></slot>
401
+ <slot slot="actions" name="actions"></slot>
402
+ </md-dialog>`;
403
+ }
404
+ renderNativeDialog() {
405
+ if (this.portalRoot) {
406
+ render(this.portalTemplate(), this.portalRoot);
407
+ this.populatePortal();
408
+ }
409
+ return nothing;
410
+ }
411
+ render() {
412
+ return this.useNativeDialog
413
+ ? this.renderNativeDialog()
414
+ : this.renderMdDialog();
415
+ }
81
416
  }
82
417
  (() => {
83
418
  requestUpdateOnAriaChange(IxDialog);
84
419
  })();
85
- /** @nocollapse */
420
+ IxDialog.styles = [
421
+ IxDialogStyles,
422
+ css `
423
+ :host([use-native-dialog]) dialog[open],
424
+ :host([use-native-dialog][closing]) dialog {
425
+ position: fixed;
426
+ inset: 0;
427
+ margin: 0;
428
+ padding: 0;
429
+ border: 0;
430
+ background: transparent;
431
+ display: block;
432
+ inline-size: 100vw;
433
+ block-size: 100dvh;
434
+ pointer-events: none;
435
+ z-index: 99;
436
+ overscroll-behavior: contain;
437
+ }
438
+
439
+ :host([use-native-dialog]) dialog[open] .scrim,
440
+ :host([use-native-dialog][closing]) .scrim,
441
+ :host([use-native-dialog]) dialog[open] > .container,
442
+ :host([use-native-dialog][closing]) dialog > .container {
443
+ pointer-events: auto;
444
+ }
445
+
446
+ :host([use-native-dialog]) dialog[open] .scrim,
447
+ :host([use-native-dialog][closing]) .scrim {
448
+ position: fixed;
449
+ inset: 0;
450
+ background: var(--ix-dialog-scrim, rgba(0, 0, 0, 0.32));
451
+ }
452
+
453
+ :host([use-native-dialog]) dialog[open] .scrim {
454
+ overscroll-behavior: contain;
455
+ touch-action: none;
456
+ }
457
+
458
+ :host([use-native-dialog]) dialog[open] > .container,
459
+ :host([use-native-dialog][closing]) dialog > .container {
460
+ transform: translate(-50%, -50%);
461
+ width: auto;
462
+ height: auto;
463
+ max-block-size: var(--ix-dialog-max-height, 90dvh);
464
+ border-radius: 0.75rem;
465
+ background: var(--ix-dialog-bg, #fff);
466
+ box-shadow: var(
467
+ --ix-dialog-shadow,
468
+ 0 0.625rem 1.875rem rgba(0, 0, 0, 0.25)
469
+ );
470
+ display: grid;
471
+ grid-template-rows: auto 1fr auto;
472
+ overflow: hidden;
473
+ z-index: 9;
474
+ transform-origin: top center;
475
+ will-change: transform, opacity;
476
+ }
477
+
478
+ :host([use-native-dialog]) .headline,
479
+ :host([use-native-dialog]) .content,
480
+ :host([use-native-dialog]) .actions {
481
+ padding: var(--ix-dialog-section-padding, 1rem);
482
+ }
483
+
484
+ :host([use-native-dialog]) .content {
485
+ overflow: auto;
486
+ }
487
+
488
+ :host([use-native-dialog]) .actions {
489
+ display: inline-flex;
490
+ gap: var(--ix-dialog-actions-gap, 0.5rem);
491
+ justify-content: flex-end;
492
+ align-items: center;
493
+ padding-block: var(--ix-dialog-actions-padding-block, 0.75rem);
494
+ border-top: var(
495
+ --ix-dialog-actions-border,
496
+ 1px solid rgba(0, 0, 0, 0.08)
497
+ );
498
+ }
499
+
500
+ @keyframes ix-fold-in {
501
+ from {
502
+ transform: translate(-50%, -50%) translateY(-0.5rem) scaleY(0.92);
503
+ opacity: 0;
504
+ }
505
+ to {
506
+ transform: translate(-50%, -50%) translateY(0) scaleY(1);
507
+ opacity: 1;
508
+ }
509
+ }
510
+ @keyframes ix-fold-out {
511
+ from {
512
+ transform: translate(-50%, -50%) translateY(0) scaleY(1);
513
+ opacity: 1;
514
+ }
515
+ to {
516
+ transform: translate(-50%, -50%) translateY(-0.5rem) scaleY(0.98);
517
+ opacity: 0;
518
+ }
519
+ }
520
+
521
+ :host([use-native-dialog]:not([closing])) dialog[open] > .container {
522
+ animation: ix-fold-in var(--ix-dialog-in-dur, 1000ms)
523
+ cubic-bezier(0.2, 0.7, 0.3, 1) both;
524
+ }
525
+ :host([use-native-dialog][closing]) dialog > .container {
526
+ animation: ix-fold-out var(--ix-dialog-out-dur, 250ms)
527
+ cubic-bezier(0.2, 0.7, 0.3, 1) both;
528
+ }
529
+
530
+ @media (prefers-reduced-motion: reduce) {
531
+ :host([use-native-dialog]) dialog > .container {
532
+ animation: none !important;
533
+ }
534
+ }
535
+ `,
536
+ ];
86
537
  IxDialog.shadowRootOptions = {
87
538
  ...LitElement.shadowRootOptions,
88
539
  delegatesFocus: true,
@@ -102,7 +553,10 @@ __decorate([
102
553
  __decorate([
103
554
  property({ type: Boolean })
104
555
  ], IxDialog.prototype, "disableNextClickIsFromContent", void 0);
556
+ __decorate([
557
+ property({ type: Boolean, reflect: true, attribute: 'use-native-dialog' })
558
+ ], IxDialog.prototype, "useNativeDialog", void 0);
105
559
  __decorate([
106
560
  state()
107
- ], IxDialog.prototype, "scrollPosition", void 0);
561
+ ], IxDialog.prototype, "nativeClosing", void 0);
108
562
  //# 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,GAAG,EAAE,CAAC;QACpB,IAAI,CAAC,KAAK,CAAC,IAAI,GAAG,EAAE,CAAC;QACrB,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,EAAE,CAAC;QACtB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AAC,QAAQ,CAAC,CAAC,CAAC;QACxC,IAAI,CAAC,eAAe,EAAE,CAAC;IACzB,CAAC;IAED,QAAQ,CAAC,CAAM;QACb,IAAI,IAAI,CAAC,aAAa,EAAE;YACtB,CAAC,CAAC,cAAc,EAAE,CAAC;SACpB;QACD,IAAI,CAAC,aAAa,CAAC,IAAI,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC1C,CAAC;IAED,MAAM;QACJ,OAAO,IAAI,CAAA;;gBAEC,IAAI,CAAC,IAAI;;oCAEW,IAAI,CAAC,wBAAwB;yCACxB,IAAI,CAAC,6BAA6B;gBAC3D,IAAI,CAAC,MAAM;kBACT,IAAI,CAAC,QAAQ;iBACd,IAAI,CAAC,OAAO;kBACX,IAAI,CAAC,QAAQ;kBACb,IAAI,CAAC,QAAQ;;;;;;KAM1B,CAAC;IACJ,CAAC;;AAhGD;IACE,yBAAyB,CAAC,QAAQ,CAAC,CAAC;AACtC,CAAC,GAAA,CAAA;AAED,kBAAkB;AACF,0BAAiB,GAAG;IAClC,GAAG,UAAU,CAAC,iBAAiB;IAC/B,cAAc,EAAE,IAAI;CACrB,CAAC;AAGF;IADC,KAAK,CAAC,SAAS,CAAC;2CACW;AAEgB;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;AAE1D;IAAR,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;QAEP,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;QAkOlB,cAAS,GAAG,CAAC,CAAgB,EAAE,EAAE;YACvC,IAAI,CAAC,CAAC,GAAG,KAAK,QAAQ;gBAAE,OAAO;YAC/B,IAAI,IAAI,CAAC,aAAa,EAAE;gBACtB,CAAC,CAAC,cAAc,E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AE,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;AAEf;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 @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 @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"]}
@@ -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.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:a,headline:n,content:s,actions:l}=this;if(i&&o&&a&&n&&s&&l){var{container:r,dialog:d,scrim:c,headline:h,content:p,actions:g}=e,v=[];for(let[e,t]of[[i,null!=d?d:[]],[o,null!=c?c:[]],[a,null!=r?r:[]],[n,null!=h?h:[]],[s,null!=p?p:[]],[l,null!=g?g:[]]])for(var m of t)v.push(e.animate(...m));await Promise.all(v.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.useNativeDialog=!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 i=()=>{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()},o=this.nativeDialogContainer;if(o){o.classList.add("closing");let e=!1,t=()=>{e||(e=!0,o.removeEventListener("animationend",t),i())};this.nativeOnEnd=t,o.addEventListener("animationend",t,{once:!0}),window.setTimeout(t,1)}else i()}}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(i,e){if(this.nativeDialogContainer){let t=this.nativeDialogContainer.querySelector(e);t&&Array.from(this.children).filter(e=>e instanceof HTMLElement&&e.slot===i).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 o=document.body,a=window.innerWidth-document.documentElement.clientWidth;0<a&&(o.style.paddingRight=a+"px"),o.style.overflow="hidden",o.style.position="fixed",o.style.top=`-${this.scrollYBackup}px`,o.style.left="0",o.style.right="0",o.style.width="100%";let t=e=>{var t=e.target;this.nativeDialogContainer&&t&&(this.nativeDialogContainer.contains(t)||e.preventDefault())},e=e=>t(e),i=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",i,{passive:!1}),this.removeScrollHandlers=()=>{window.removeEventListener("touchmove",e),window.removeEventListener("keydown",i)}}}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}" @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([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/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.2",
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": "ec17c4a17800ab0383f1e91890928c4897cf0263"
106
106
  }