@material/web 1.0.0-pre.14 → 1.0.0-pre.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -5
- package/all.d.ts +4 -8
- package/all.js +4 -8
- package/all.js.map +1 -1
- package/button/{_tonal-button.scss → _filled-tonal-button.scss} +1 -1
- package/button/{tonal-button.d.ts → filled-tonal-button.d.ts} +3 -3
- package/button/{tonal-button.js → filled-tonal-button.js} +9 -9
- package/button/filled-tonal-button.js.map +1 -0
- package/button/internal/{_tonal-button.scss → _filled-tonal-button.scss} +7 -7
- package/button/internal/_shared.scss +12 -7
- package/button/internal/_touch-target.scss +5 -1
- package/button/internal/button.d.ts +6 -10
- package/button/internal/button.js +10 -43
- package/button/internal/button.js.map +1 -1
- package/button/internal/elevated-styles.css.js +1 -1
- package/button/internal/elevated-styles.css.js.map +1 -1
- package/button/internal/filled-styles.css.js +1 -1
- package/button/internal/filled-styles.css.js.map +1 -1
- package/button/internal/{tonal-button.d.ts → filled-tonal-button.d.ts} +2 -2
- package/button/internal/{tonal-button.js → filled-tonal-button.js} +3 -3
- package/button/internal/filled-tonal-button.js.map +1 -0
- package/button/internal/filled-tonal-styles.css.js +9 -0
- package/button/internal/filled-tonal-styles.css.js.map +1 -0
- package/button/internal/{tonal-styles.scss → filled-tonal-styles.scss} +2 -2
- package/button/internal/outlined-styles.css.js +1 -1
- package/button/internal/outlined-styles.css.js.map +1 -1
- package/button/internal/shared-styles.css.js +1 -1
- package/button/internal/shared-styles.css.js.map +1 -1
- package/button/internal/text-styles.css.js +1 -1
- package/button/internal/text-styles.css.js.map +1 -1
- package/checkbox/internal/_checkbox.scss +22 -78
- package/checkbox/internal/checkbox-styles.css.js +1 -1
- package/checkbox/internal/checkbox-styles.css.js.map +1 -1
- package/checkbox/internal/checkbox.d.ts +77 -6
- package/checkbox/internal/checkbox.js +123 -14
- package/checkbox/internal/checkbox.js.map +1 -1
- package/chips/internal/_shared.scss +8 -0
- package/chips/internal/chip-set.js +1 -3
- package/chips/internal/chip-set.js.map +1 -1
- package/chips/internal/chip.js +1 -3
- package/chips/internal/chip.js.map +1 -1
- package/chips/internal/filter-chip.d.ts +1 -0
- package/chips/internal/filter-chip.js +12 -6
- package/chips/internal/filter-chip.js.map +1 -1
- package/chips/internal/shared-styles.css.js +1 -1
- package/chips/internal/shared-styles.css.js.map +1 -1
- package/common.d.ts +2 -6
- package/common.js +2 -6
- package/common.js.map +1 -1
- package/dialog/harness.d.ts +1 -6
- package/dialog/harness.js +2 -43
- package/dialog/harness.js.map +1 -1
- package/dialog/internal/_dialog.scss +165 -281
- package/dialog/internal/animations.d.ts +47 -0
- package/dialog/internal/animations.js +117 -0
- package/dialog/internal/animations.js.map +1 -0
- package/dialog/internal/dialog-styles.css.js +1 -1
- package/dialog/internal/dialog-styles.css.js.map +1 -1
- package/dialog/internal/dialog.d.ts +76 -169
- package/dialog/internal/dialog.js +251 -475
- package/dialog/internal/dialog.js.map +1 -1
- package/fab/internal/_fab.scss +4 -0
- package/fab/internal/_shared.scss +12 -0
- package/fab/internal/fab-styles.css.js +1 -1
- package/fab/internal/fab-styles.css.js.map +1 -1
- package/fab/internal/shared-styles.css.js +1 -1
- package/fab/internal/shared-styles.css.js.map +1 -1
- package/fab/internal/shared.d.ts +0 -4
- package/fab/internal/shared.js +3 -13
- package/fab/internal/shared.js.map +1 -1
- package/focus/internal/_focus-ring.scss +52 -48
- package/focus/internal/focus-ring-styles.css.js +1 -1
- package/focus/internal/focus-ring-styles.css.js.map +1 -1
- package/focus/internal/focus-ring.d.ts +2 -1
- package/focus/internal/focus-ring.js +10 -0
- package/focus/internal/focus-ring.js.map +1 -1
- package/icon/internal/_icon.scss +18 -17
- package/icon/internal/icon-styles.css.js +1 -1
- package/icon/internal/icon-styles.css.js.map +1 -1
- package/icon/internal/icon.d.ts +1 -0
- package/icon/internal/icon.js +9 -0
- package/icon/internal/icon.js.map +1 -1
- package/iconbutton/{_standard-icon-button.scss → _icon-button.scss} +1 -1
- package/iconbutton/{standard-icon-button.d.ts → icon-button.d.ts} +2 -2
- package/iconbutton/{standard-icon-button.js → icon-button.js} +7 -7
- package/iconbutton/icon-button.js.map +1 -0
- package/iconbutton/internal/_filled-icon-button.scss +8 -6
- package/iconbutton/internal/_filled-tonal-icon-button.scss +8 -6
- package/iconbutton/internal/{_standard-icon-button.scss → _icon-button.scss} +8 -8
- package/iconbutton/internal/_outlined-icon-button.scss +14 -14
- package/iconbutton/internal/_shared.scss +6 -9
- package/iconbutton/internal/filled-styles.css.js +1 -1
- package/iconbutton/internal/filled-styles.css.js.map +1 -1
- package/iconbutton/internal/filled-tonal-styles.css.js +1 -1
- package/iconbutton/internal/filled-tonal-styles.css.js.map +1 -1
- package/iconbutton/internal/icon-button.d.ts +10 -1
- package/iconbutton/internal/icon-button.js +17 -2
- package/iconbutton/internal/icon-button.js.map +1 -1
- package/iconbutton/internal/outlined-styles.css.js +1 -1
- package/iconbutton/internal/outlined-styles.css.js.map +1 -1
- package/iconbutton/internal/shared-styles.css.js +1 -1
- package/iconbutton/internal/shared-styles.css.js.map +1 -1
- package/iconbutton/internal/standard-styles.css.js +1 -1
- package/iconbutton/internal/standard-styles.css.js.map +1 -1
- package/iconbutton/internal/standard-styles.scss +2 -2
- package/internal/aria/delegate.d.ts +1 -1
- package/internal/aria/delegate.js +1 -1
- package/internal/aria/delegate.js.map +1 -1
- package/internal/controller/element-internals.d.ts +35 -0
- package/internal/controller/element-internals.js +24 -0
- package/internal/controller/element-internals.js.map +1 -0
- package/internal/controller/form-submitter.d.ts +60 -0
- package/internal/controller/form-submitter.js +69 -0
- package/internal/controller/form-submitter.js.map +1 -0
- package/labs/navigationbar/internal/navigation-bar.js +1 -3
- package/labs/navigationbar/internal/navigation-bar.js.map +1 -1
- package/labs/navigationdrawer/internal/navigation-drawer-modal.js +1 -3
- package/labs/navigationdrawer/internal/navigation-drawer-modal.js.map +1 -1
- package/labs/navigationdrawer/internal/navigation-drawer.js +1 -3
- package/labs/navigationdrawer/internal/navigation-drawer.js.map +1 -1
- package/labs/navigationtab/internal/navigation-tab.js +1 -3
- package/labs/navigationtab/internal/navigation-tab.js.map +1 -1
- package/labs/segmentedbutton/internal/outlined-styles.css.js +1 -1
- package/labs/segmentedbutton/internal/outlined-styles.css.js.map +1 -1
- package/labs/segmentedbutton/internal/segmented-button.js +1 -3
- package/labs/segmentedbutton/internal/segmented-button.js.map +1 -1
- package/labs/segmentedbuttonset/internal/outlined-styles.css.js +1 -1
- package/labs/segmentedbuttonset/internal/outlined-styles.css.js.map +1 -1
- package/labs/segmentedbuttonset/internal/segmented-button-set.js +1 -3
- package/labs/segmentedbuttonset/internal/segmented-button-set.js.map +1 -1
- package/list/internal/list.d.ts +2 -2
- package/list/internal/list.js +1 -3
- package/list/internal/list.js.map +1 -1
- package/list/internal/listitem/_list-item.scss +20 -54
- package/list/internal/listitem/list-item-styles.css.js +1 -1
- package/list/internal/listitem/list-item-styles.css.js.map +1 -1
- package/list/internal/listitem/list-item.d.ts +15 -3
- package/list/internal/listitem/list-item.js +43 -10
- package/list/internal/listitem/list-item.js.map +1 -1
- package/menu/internal/menu.js +3 -4
- package/menu/internal/menu.js.map +1 -1
- package/menu/internal/menuitem/_menu-item.scss +1 -1
- package/menu/internal/menuitem/forced-colors-styles.css.js +1 -1
- package/menu/internal/menuitem/forced-colors-styles.css.js.map +1 -1
- package/menu/internal/menuitem/forced-colors-styles.scss +1 -1
- package/menu/internal/menuitem/menu-item-styles.css.js +1 -1
- package/menu/internal/menuitem/menu-item-styles.css.js.map +1 -1
- package/menu/internal/menuitem/menu-item.d.ts +9 -0
- package/menu/internal/menuitem/menu-item.js +18 -4
- package/menu/internal/menuitem/menu-item.js.map +1 -1
- package/menu/internal/shared.d.ts +45 -38
- package/menu/internal/shared.js +29 -40
- package/menu/internal/shared.js.map +1 -1
- package/menu/internal/submenuitem/sub-menu-item.d.ts +22 -12
- package/menu/internal/submenuitem/sub-menu-item.js +39 -24
- package/menu/internal/submenuitem/sub-menu-item.js.map +1 -1
- package/menu/menu-item.d.ts +1 -1
- package/menu/menu-item.js +0 -1
- package/menu/menu-item.js.map +1 -1
- package/menu/menu.d.ts +1 -1
- package/menu/menu.js +0 -1
- package/menu/menu.js.map +1 -1
- package/menu/sub-menu-item.d.ts +1 -1
- package/menu/sub-menu-item.js +0 -1
- package/menu/sub-menu-item.js.map +1 -1
- package/package.json +1 -3
- package/progress/internal/progress.js +1 -3
- package/progress/internal/progress.js.map +1 -1
- package/radio/internal/_radio.scss +38 -24
- package/radio/internal/forced-colors-styles.css.js +1 -1
- package/radio/internal/forced-colors-styles.css.js.map +1 -1
- package/radio/internal/forced-colors-styles.scss +4 -4
- package/radio/internal/radio-styles.css.js +1 -1
- package/radio/internal/radio-styles.css.js.map +1 -1
- package/radio/internal/radio.js +7 -6
- package/radio/internal/radio.js.map +1 -1
- package/select/internal/_filled-select.scss +2 -2
- package/select/internal/_outlined-select.scss +2 -2
- package/select/internal/_shared.scss +30 -0
- package/select/internal/filled-select-styles.css.js +1 -1
- package/select/internal/filled-select-styles.css.js.map +1 -1
- package/select/internal/outlined-select-styles.css.js +1 -1
- package/select/internal/outlined-select-styles.css.js.map +1 -1
- package/select/internal/select.d.ts +0 -5
- package/select/internal/select.js +11 -16
- package/select/internal/select.js.map +1 -1
- package/select/internal/selectoption/select-option.d.ts +5 -6
- package/select/internal/selectoption/select-option.js +8 -9
- package/select/internal/selectoption/select-option.js.map +1 -1
- package/select/internal/shared-styles.css.js +1 -1
- package/select/internal/shared-styles.css.js.map +1 -1
- package/select/internal/shared.d.ts +5 -9
- package/select/internal/shared.js +13 -11
- package/select/internal/shared.js.map +1 -1
- package/slider/internal/slider.js +1 -3
- package/slider/internal/slider.js.map +1 -1
- package/switch/internal/_handle.scss +12 -12
- package/switch/internal/_icon.scss +8 -8
- package/switch/internal/_track.scss +10 -10
- package/switch/internal/forced-colors-styles.css.js +1 -1
- package/switch/internal/forced-colors-styles.css.js.map +1 -1
- package/switch/internal/forced-colors-styles.scss +12 -12
- package/switch/internal/switch-styles.css.js +1 -1
- package/switch/internal/switch-styles.css.js.map +1 -1
- package/switch/internal/switch.js +1 -3
- package/switch/internal/switch.js.map +1 -1
- package/tabs/internal/_tab.scss +1 -1
- package/tabs/internal/_tabs.scss +1 -0
- package/tabs/internal/tab.d.ts +3 -9
- package/tabs/internal/tab.js +4 -7
- package/tabs/internal/tab.js.map +1 -1
- package/tabs/internal/tabs.d.ts +1 -4
- package/tabs/internal/tabs.js +5 -10
- package/tabs/internal/tabs.js.map +1 -1
- package/textfield/harness.js +4 -0
- package/textfield/harness.js.map +1 -1
- package/textfield/internal/text-field.js +1 -4
- package/textfield/internal/text-field.js.map +1 -1
- package/tokens/_index.scss +1 -0
- package/tokens/_md-comp-checkbox.scss +16 -16
- package/tokens/_md-comp-dialog.scss +2 -1
- package/tokens/_md-comp-elevated-button.scss +14 -12
- package/tokens/_md-comp-filled-button.scss +14 -12
- package/tokens/_md-comp-filled-icon-button.scss +23 -8
- package/tokens/_md-comp-filled-select.scss +19 -1
- package/tokens/_md-comp-filled-tonal-button.scss +14 -12
- package/tokens/_md-comp-filled-tonal-icon-button.scss +23 -8
- package/tokens/_md-comp-icon-button.scss +24 -11
- package/tokens/_md-comp-icon.scss +32 -0
- package/tokens/_md-comp-outlined-button.scss +14 -12
- package/tokens/_md-comp-outlined-icon-button.scss +26 -12
- package/tokens/_md-comp-outlined-segmented-button.scss +2 -2
- package/tokens/_md-comp-radio-button.scss +20 -9
- package/tokens/_md-comp-switch.scss +66 -32
- package/tokens/_md-comp-text-button.scss +14 -12
- package/button/internal/tonal-button.js.map +0 -1
- package/button/internal/tonal-styles.css.js +0 -9
- package/button/internal/tonal-styles.css.js.map +0 -1
- package/button/tonal-button.js.map +0 -1
- package/dialog/internal/_tokens.scss +0 -66
- package/icon/internal/_md-comp-icon.scss +0 -18
- package/iconbutton/standard-icon-button.js.map +0 -1
- package/list/internal/listitemlink/list-item-link-only.d.ts +0 -23
- package/list/internal/listitemlink/list-item-link-only.js +0 -36
- package/list/internal/listitemlink/list-item-link-only.js.map +0 -1
- package/list/internal/listitemlink/list-item-link.d.ts +0 -18
- package/list/internal/listitemlink/list-item-link.js +0 -42
- package/list/internal/listitemlink/list-item-link.js.map +0 -1
- package/list/list-item-link.d.ts +0 -53
- package/list/list-item-link.js +0 -57
- package/list/list-item-link.js.map +0 -1
- package/menu/internal/menuitemlink/menu-item-link.d.ts +0 -23
- package/menu/internal/menuitemlink/menu-item-link.js +0 -49
- package/menu/internal/menuitemlink/menu-item-link.js.map +0 -1
- package/menu/menu-item-link.d.ts +0 -33
- package/menu/menu-item-link.js +0 -38
- package/menu/menu-item-link.js.map +0 -1
- /package/button/internal/{tonal-styles.css.d.ts → filled-tonal-styles.css.d.ts} +0 -0
|
@@ -4,559 +4,335 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
import { __decorate } from "tslib";
|
|
7
|
-
import '../../
|
|
8
|
-
import { html, LitElement } from 'lit';
|
|
7
|
+
import '../../divider/divider.js';
|
|
8
|
+
import { html, isServer, LitElement, nothing } from 'lit';
|
|
9
9
|
import { property, query, state } from 'lit/decorators.js';
|
|
10
10
|
import { classMap } from 'lit/directives/class-map.js';
|
|
11
|
+
import { requestUpdateOnAriaChange } from '../../internal/aria/delegate.js';
|
|
11
12
|
import { redispatchEvent } from '../../internal/controller/events.js';
|
|
12
|
-
import {
|
|
13
|
-
// This is required for decorators.
|
|
14
|
-
// tslint:disable:no-new-decorators
|
|
15
|
-
/**
|
|
16
|
-
* Default close action.
|
|
17
|
-
*/
|
|
18
|
-
export const CLOSE_ACTION = 'close';
|
|
19
|
-
const OPENING_TRANSITION_PROP = '--_opening-transition-duration';
|
|
20
|
-
const CLOSING_TRANSITION_PROP = '--_closing-transition-duration';
|
|
13
|
+
import { DIALOG_DEFAULT_CLOSE_ANIMATION, DIALOG_DEFAULT_OPEN_ANIMATION } from './animations.js';
|
|
21
14
|
/**
|
|
22
15
|
* A dialog component.
|
|
23
16
|
*
|
|
24
|
-
* @fires
|
|
17
|
+
* @fires open Dispatched when the dialog is opening before any animations.
|
|
25
18
|
* @fires opened Dispatched when the dialog has opened after any animations.
|
|
26
|
-
* @fires
|
|
19
|
+
* @fires close Dispatched when the dialog is closing before any animations.
|
|
27
20
|
* @fires closed Dispatched when the dialog has closed after any animations.
|
|
28
|
-
* @fires cancel
|
|
21
|
+
* @fires cancel Dispatched when the dialog has been canceled by clicking on the
|
|
22
|
+
* scrim or pressing Escape.
|
|
29
23
|
*/
|
|
30
24
|
export class Dialog extends LitElement {
|
|
25
|
+
/**
|
|
26
|
+
* Opens the dialog when set to `true` and closes it when set to `false`.
|
|
27
|
+
*/
|
|
28
|
+
get open() {
|
|
29
|
+
return this.isOpen;
|
|
30
|
+
}
|
|
31
|
+
set open(open) {
|
|
32
|
+
if (open === this.isOpen) {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
this.isOpen = open;
|
|
36
|
+
if (open) {
|
|
37
|
+
this.setAttribute('open', '');
|
|
38
|
+
this.show();
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
this.removeAttribute('open');
|
|
42
|
+
this.close();
|
|
43
|
+
}
|
|
44
|
+
}
|
|
31
45
|
constructor() {
|
|
32
|
-
super(
|
|
33
|
-
/**
|
|
34
|
-
* Opens the dialog when set to `true` and closes it when set to `false`.
|
|
35
|
-
*/
|
|
36
|
-
this.open = false;
|
|
37
|
-
/**
|
|
38
|
-
* Setting fullscreen displays the dialog fullscreen on small screens.
|
|
39
|
-
* This can be customized via the `fullscreenBreakpoint` property.
|
|
40
|
-
* When showing fullscreen, the header will take up less vertical space, and
|
|
41
|
-
* the dialog will have a `showing-fullscreen`attribute, allowing content to
|
|
42
|
-
* be styled in this state.
|
|
43
|
-
*
|
|
44
|
-
* Dialogs can be sized by setting:
|
|
45
|
-
*
|
|
46
|
-
* * --md-dialog-container-min-block-size
|
|
47
|
-
* * --md-dialog-container-max-block-size
|
|
48
|
-
* * --md-dialog-container-min-inline-size
|
|
49
|
-
* * --md-dialog-container-max-inline-size
|
|
50
|
-
*
|
|
51
|
-
* These are typically configured via media queries and are independent of the
|
|
52
|
-
* fullscreen setting.
|
|
53
|
-
*/
|
|
54
|
-
this.fullscreen = false;
|
|
55
|
-
/**
|
|
56
|
-
* A media query string specifying the breakpoint at which the dialog
|
|
57
|
-
* should be shown fullscreen. Note, this only applies when the `fullscreen`
|
|
58
|
-
* property is set.
|
|
59
|
-
*
|
|
60
|
-
* By default, the dialog is shown fullscreen on screens less than 600px wide
|
|
61
|
-
* or 400px tall.
|
|
62
|
-
*/
|
|
63
|
-
this.fullscreenBreakpoint = '(max-width: 600px), (max-height: 400px)';
|
|
64
|
-
/**
|
|
65
|
-
* Hides the dialog footer, making any content slotted into the footer
|
|
66
|
-
* inaccessible.
|
|
67
|
-
*/
|
|
68
|
-
this.footerHidden = false;
|
|
69
|
-
/**
|
|
70
|
-
* Renders footer content in a vertically stacked alignment rather than the
|
|
71
|
-
* normal horizontal alignment.
|
|
72
|
-
*/
|
|
73
|
-
this.stacked = false;
|
|
74
|
-
/**
|
|
75
|
-
* When the dialog is closed it disptaches `closing` and `closed` events.
|
|
76
|
-
* These events have an action property which has a default value of
|
|
77
|
-
* the value of this property. Specific actions have explicit values but when
|
|
78
|
-
* a value is not specified, the default is used. For example, clicking the
|
|
79
|
-
* scrim, pressing escape, or clicking a button with an action attribute set
|
|
80
|
-
* produce an explicit action.
|
|
81
|
-
*
|
|
82
|
-
* Defaults to `close`.
|
|
83
|
-
*/
|
|
84
|
-
this.defaultAction = CLOSE_ACTION;
|
|
46
|
+
super();
|
|
85
47
|
/**
|
|
86
|
-
*
|
|
87
|
-
*
|
|
88
|
-
* close the dialog and the `closing` and `closed` events dispatched will
|
|
89
|
-
* have their action property set the value of this attribute on the
|
|
90
|
-
* clicked element.The default value is `dialog-action`. For example,
|
|
48
|
+
* Gets or sets the dialog's return value, usually to indicate which button
|
|
49
|
+
* a user pressed to close it.
|
|
91
50
|
*
|
|
92
|
-
*
|
|
93
|
-
* Content
|
|
94
|
-
* <md-filled-button slot="footer" dialog-action="buy">
|
|
95
|
-
* Buy
|
|
96
|
-
* </md-filled-button>
|
|
97
|
-
* </md-dialog>
|
|
98
|
-
*/
|
|
99
|
-
this.actionAttribute = 'dialog-action';
|
|
100
|
-
/**
|
|
101
|
-
* When the dialog is opened, it will focus the first element which has
|
|
102
|
-
* an attribute name matching this property. The default value is
|
|
103
|
-
* `dialogFocus`. For example:
|
|
104
|
-
*
|
|
105
|
-
* <md-dialog>
|
|
106
|
-
* <md-filled-text-field
|
|
107
|
-
* label="Enter some text"
|
|
108
|
-
* dialog-focus
|
|
109
|
-
* >
|
|
110
|
-
* </md-filled-text-field>
|
|
111
|
-
* </md-dialog>
|
|
112
|
-
*/
|
|
113
|
-
this.focusAttribute = 'dialog-focus';
|
|
114
|
-
/**
|
|
115
|
-
* Clicking on the scrim surrounding the dialog closes the dialog.
|
|
116
|
-
* The `closing` and `closed` events this produces have an `action` property
|
|
117
|
-
* which is the value of this property and defaults to `close`.
|
|
51
|
+
* https://developer.mozilla.org/en-US/docs/Web/API/HTMLDialogElement/returnValue
|
|
118
52
|
*/
|
|
119
|
-
this.
|
|
53
|
+
this.returnValue = '';
|
|
120
54
|
/**
|
|
121
|
-
*
|
|
122
|
-
*
|
|
123
|
-
* which is the value of this property and defaults to `close`.
|
|
55
|
+
* Gets the opening animation for a dialog. Set to a new function to customize
|
|
56
|
+
* the animation.
|
|
124
57
|
*/
|
|
125
|
-
this.
|
|
58
|
+
this.getOpenAnimation = () => DIALOG_DEFAULT_OPEN_ANIMATION;
|
|
126
59
|
/**
|
|
127
|
-
*
|
|
128
|
-
*
|
|
129
|
-
* closing the dialog and does not display the scrim around the dialog.
|
|
130
|
-
*/
|
|
131
|
-
this.modeless = false;
|
|
132
|
-
/**
|
|
133
|
-
* Set to make the dialog position draggable.
|
|
134
|
-
*/
|
|
135
|
-
this.draggable = false;
|
|
136
|
-
this.throttle = createThrottle();
|
|
137
|
-
/**
|
|
138
|
-
* Private properties that reflect for styling manually in `updated`.
|
|
139
|
-
*/
|
|
140
|
-
this.showingFullscreen = false;
|
|
141
|
-
this.showingOpen = false;
|
|
142
|
-
this.opening = false;
|
|
143
|
-
this.closing = false;
|
|
144
|
-
/**
|
|
145
|
-
* Transition kind. Supported options include: grow, shrink, grow-down,
|
|
146
|
-
* grow-up, grow-left, and grow-right.
|
|
147
|
-
*
|
|
148
|
-
* Defaults to grow-down.
|
|
60
|
+
* Gets the closing animation for a dialog. Set to a new function to customize
|
|
61
|
+
* the animation.
|
|
149
62
|
*/
|
|
150
|
-
this.
|
|
151
|
-
this.
|
|
152
|
-
this.
|
|
153
|
-
this.
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
if (shouldPrevent && style.overflow === 'hidden') {
|
|
162
|
-
return;
|
|
63
|
+
this.getCloseAnimation = () => DIALOG_DEFAULT_CLOSE_ANIMATION;
|
|
64
|
+
this.isOpen = false;
|
|
65
|
+
this.isAtScrollTop = false;
|
|
66
|
+
this.isAtScrollBottom = false;
|
|
67
|
+
this.nextClickIsFromContent = false;
|
|
68
|
+
// Dialogs should not be SSR'd while open, so we can just use runtime checks.
|
|
69
|
+
this.hasHeadline = false;
|
|
70
|
+
this.hasActions = false;
|
|
71
|
+
this.hasIcon = false;
|
|
72
|
+
if (!isServer) {
|
|
73
|
+
this.addEventListener('submit', this.handleSubmit);
|
|
163
74
|
}
|
|
164
|
-
if (scrollbarTester === undefined) {
|
|
165
|
-
Dialog.scrollbarTester = scrollbarTester = document.createElement('div');
|
|
166
|
-
scrollbarTester.style.cssText =
|
|
167
|
-
`position: absolute; height: 0; width: 100%; visibility: hidden; pointer-events: none;`;
|
|
168
|
-
}
|
|
169
|
-
// Appends an element to see if its offsetWidth changes when overflow is
|
|
170
|
-
// altered. If it does, then add end inline padding to restore the width to
|
|
171
|
-
// avoid a visible layout shift.
|
|
172
|
-
document.body.append(scrollbarTester);
|
|
173
|
-
const { offsetWidth } = scrollbarTester;
|
|
174
|
-
style.overflow = shouldPrevent ? 'hidden' : '';
|
|
175
|
-
const scrollbarWidth = scrollbarTester.offsetWidth - offsetWidth;
|
|
176
|
-
scrollbarTester.remove();
|
|
177
|
-
style.paddingInlineEnd = shouldPrevent ? `${scrollbarWidth}px` : '';
|
|
178
75
|
}
|
|
179
76
|
/**
|
|
180
|
-
* Opens
|
|
181
|
-
*
|
|
77
|
+
* Opens the dialog and fires a cancelable `open` event. After a dialog's
|
|
78
|
+
* animation, an `opened` event is fired.
|
|
79
|
+
*
|
|
80
|
+
* Add an `autocomplete` attribute to a child of the dialog that should
|
|
81
|
+
* receive focus after opening.
|
|
82
|
+
*
|
|
83
|
+
* @return A Promise that resolves after the animation is finished and the
|
|
84
|
+
* `opened` event was fired.
|
|
182
85
|
*/
|
|
183
|
-
show() {
|
|
86
|
+
async show() {
|
|
87
|
+
const { dialog, container } = this;
|
|
88
|
+
if (!dialog || !container || dialog.open) {
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
const preventOpen = !this.dispatchEvent(new Event('open', { cancelable: true }));
|
|
92
|
+
if (preventOpen) {
|
|
93
|
+
this.open = false;
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
// All Material dialogs are modal.
|
|
97
|
+
dialog.showModal();
|
|
184
98
|
this.open = true;
|
|
99
|
+
// Reset scroll position if re-opening a dialog with the same content.
|
|
100
|
+
if (this.scroller) {
|
|
101
|
+
this.scroller.scrollTop = 0;
|
|
102
|
+
}
|
|
103
|
+
// Native modal dialogs ignore autofocus and instead force focus to the
|
|
104
|
+
// first focusable child. Override this behavior if there is a child with
|
|
105
|
+
// an autofocus attribute.
|
|
106
|
+
this.querySelector('[autofocus]')?.focus();
|
|
107
|
+
await this.animateDialog(this.getOpenAnimation());
|
|
108
|
+
this.dispatchEvent(new Event('opened'));
|
|
185
109
|
}
|
|
186
110
|
/**
|
|
187
|
-
* Closes the dialog
|
|
188
|
-
*
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
* Opens and shows the dialog if it is closed; otherwise closes it.
|
|
111
|
+
* Closes the dialog and fires a cancelable `close` event. After a dialog's
|
|
112
|
+
* animation, a `closed` event is fired.
|
|
113
|
+
*
|
|
114
|
+
* @param returnValue A return value usually indicating which button was used
|
|
115
|
+
* to close a dialog. If a dialog is canceled by clicking the scrim or
|
|
116
|
+
* pressing Escape, it will not change the return value after closing.
|
|
117
|
+
* @return A Promise that resolves after the animation is finished and the
|
|
118
|
+
* `closed` event was fired.
|
|
196
119
|
*/
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
else {
|
|
202
|
-
this.show();
|
|
120
|
+
async close(returnValue = this.returnValue) {
|
|
121
|
+
const { dialog, container } = this;
|
|
122
|
+
if (!dialog || !container || !dialog.open) {
|
|
123
|
+
return;
|
|
203
124
|
}
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
125
|
+
const prevReturnValue = this.returnValue;
|
|
126
|
+
this.returnValue = returnValue;
|
|
127
|
+
const preventClose = !this.dispatchEvent(new Event('close', { cancelable: true }));
|
|
128
|
+
if (preventClose) {
|
|
129
|
+
this.returnValue = prevReturnValue;
|
|
130
|
+
return;
|
|
208
131
|
}
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
isAtScrollBottom: Math.abs(Math.round(scrollHeight - scrollTop) - clientHeight) <= 2
|
|
214
|
-
};
|
|
132
|
+
await this.animateDialog(this.getCloseAnimation());
|
|
133
|
+
dialog.close(returnValue);
|
|
134
|
+
this.open = false;
|
|
135
|
+
this.dispatchEvent(new Event('closed'));
|
|
215
136
|
}
|
|
216
137
|
render() {
|
|
217
|
-
const
|
|
138
|
+
const scrollable = this.open && !(this.isAtScrollTop && this.isAtScrollBottom);
|
|
139
|
+
const classes = {
|
|
140
|
+
'has-headline': this.hasHeadline,
|
|
141
|
+
'has-actions': this.hasActions,
|
|
142
|
+
'has-icon': this.hasIcon,
|
|
143
|
+
'scrollable': scrollable,
|
|
144
|
+
'show-top-divider': scrollable && !this.isAtScrollTop,
|
|
145
|
+
'show-bottom-divider': scrollable && !this.isAtScrollBottom,
|
|
146
|
+
};
|
|
147
|
+
const { ariaLabel } = this;
|
|
218
148
|
return html `
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
'footerHidden': this.footerHidden
|
|
229
|
-
})}"
|
|
230
|
-
aria-labelledby="header"
|
|
231
|
-
aria-describedby="content"
|
|
232
|
-
>
|
|
233
|
-
<div class="container ${classMap({
|
|
234
|
-
'dragging': this.dragging
|
|
235
|
-
})}"
|
|
236
|
-
@pointermove=${this.handlePointerMove}
|
|
237
|
-
@pointerup=${this.handleDragEnd}
|
|
149
|
+
<div class="scrim"></div>
|
|
150
|
+
<dialog
|
|
151
|
+
class=${classMap(classes)}
|
|
152
|
+
aria-label=${ariaLabel || nothing}
|
|
153
|
+
aria-labelledby=${this.hasHeadline ? 'headline' : nothing}
|
|
154
|
+
role=${this.type === 'alert' ? 'alertdialog' : nothing}
|
|
155
|
+
@cancel=${this.handleCancel}
|
|
156
|
+
@click=${this.handleDialogClick}
|
|
157
|
+
.returnValue=${this.returnValue || nothing}
|
|
238
158
|
>
|
|
239
|
-
<
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
<
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
159
|
+
<div class="container"
|
|
160
|
+
@click=${this.handleContentClick}
|
|
161
|
+
>
|
|
162
|
+
<div class="headline">
|
|
163
|
+
<div class="icon" aria-hidden="true">
|
|
164
|
+
<slot name="icon" @slotchange=${this.handleIconChange}></slot>
|
|
165
|
+
</div>
|
|
166
|
+
<h2 id="headline" aria-hidden=${!this.hasHeadline || nothing}>
|
|
167
|
+
<slot name="headline"
|
|
168
|
+
@slotchange=${this.handleHeadlineChange}></slot>
|
|
169
|
+
</h2>
|
|
170
|
+
<md-divider></md-divider>
|
|
171
|
+
</div>
|
|
172
|
+
<div class="scroller">
|
|
173
|
+
<div class="content">
|
|
174
|
+
<div class="top anchor"></div>
|
|
175
|
+
<slot name="content"></slot>
|
|
176
|
+
<div class="bottom anchor"></div>
|
|
177
|
+
</div>
|
|
178
|
+
</div>
|
|
179
|
+
<div class="actions">
|
|
180
|
+
<md-divider></md-divider>
|
|
181
|
+
<slot name="actions"
|
|
182
|
+
@slotchange=${this.handleActionsChange}></slot>
|
|
183
|
+
</div>
|
|
184
|
+
</div>
|
|
185
|
+
</dialog>
|
|
186
|
+
`;
|
|
265
187
|
}
|
|
266
188
|
firstUpdated() {
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
this.requestUpdate();
|
|
189
|
+
this.intersectionObserver = new IntersectionObserver(entries => {
|
|
190
|
+
for (const entry of entries) {
|
|
191
|
+
this.handleAnchorIntersection(entry);
|
|
271
192
|
}
|
|
272
|
-
}
|
|
193
|
+
}, { root: this.scroller });
|
|
194
|
+
this.intersectionObserver.observe(this.topAnchor);
|
|
195
|
+
this.intersectionObserver.observe(this.bottomAnchor);
|
|
273
196
|
}
|
|
274
|
-
|
|
275
|
-
if (
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
// Reflect internal state to facilitate styling.
|
|
280
|
-
this.reflectStateProp(changed, 'opening', this.opening);
|
|
281
|
-
this.reflectStateProp(changed, 'closing', this.closing);
|
|
282
|
-
this.reflectStateProp(changed, 'showingFullscreen', this.showingFullscreen, 'showing-fullscreen');
|
|
283
|
-
this.reflectStateProp(changed, 'showingOpen', this.showingOpen, 'showing-open');
|
|
284
|
-
if (!changed.has('open')) {
|
|
197
|
+
handleDialogClick() {
|
|
198
|
+
if (this.nextClickIsFromContent) {
|
|
199
|
+
// Avoid doing a layout calculation below if we know the click came from
|
|
200
|
+
// content.
|
|
201
|
+
this.nextClickIsFromContent = false;
|
|
285
202
|
return;
|
|
286
203
|
}
|
|
287
|
-
//
|
|
288
|
-
//
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
}
|
|
292
|
-
if (this.open) {
|
|
293
|
-
this.contentElement.scrollTop = 0;
|
|
294
|
-
if (this.modeless) {
|
|
295
|
-
this.dialogElement.show();
|
|
296
|
-
}
|
|
297
|
-
else {
|
|
298
|
-
// Note, native focus handling fails when focused element is in an
|
|
299
|
-
// overflow: auto container.
|
|
300
|
-
this.dialogElement.showModal();
|
|
301
|
-
}
|
|
302
|
-
}
|
|
303
|
-
// Avoids dispatching initial state.
|
|
304
|
-
const shouldDispatchAction = changed.get('open') !== undefined;
|
|
305
|
-
this.performTransition(shouldDispatchAction);
|
|
306
|
-
}
|
|
307
|
-
/**
|
|
308
|
-
* Internal state is reflected here as attributes to effect styling. This
|
|
309
|
-
* could be done via internal classes, but it's published on the host
|
|
310
|
-
* to facilitate the (currently undocumented) possibility of customizing
|
|
311
|
-
* styling of user content based on these states.
|
|
312
|
-
* Note, in the future this could be done with `:state(...)` when browser
|
|
313
|
-
* support improves.
|
|
314
|
-
*/
|
|
315
|
-
reflectStateProp(changed, key, value, attribute) {
|
|
316
|
-
attribute ?? (attribute = key);
|
|
317
|
-
if (!changed.has(key)) {
|
|
204
|
+
// Click originated on the backdrop. Native `<dialog>`s will not cancel,
|
|
205
|
+
// but Material dialogs do.
|
|
206
|
+
const preventDefault = !this.dispatchEvent(new Event('cancel', { cancelable: true }));
|
|
207
|
+
if (preventDefault) {
|
|
318
208
|
return;
|
|
319
209
|
}
|
|
320
|
-
|
|
321
|
-
this.setAttribute(attribute, '');
|
|
322
|
-
}
|
|
323
|
-
else {
|
|
324
|
-
this.removeAttribute(attribute);
|
|
325
|
-
}
|
|
326
|
-
}
|
|
327
|
-
async performTransition(shouldDispatchAction) {
|
|
328
|
-
// TODO: pause here only to avoid a double update warning.
|
|
329
|
-
await this.updateComplete;
|
|
330
|
-
// Focus initial element.
|
|
331
|
-
if (this.open) {
|
|
332
|
-
this.focus();
|
|
333
|
-
}
|
|
334
|
-
this.showingOpen = this.open;
|
|
335
|
-
if (shouldDispatchAction) {
|
|
336
|
-
this.dispatchActionEvent(this.open ? 'opening' : 'closing');
|
|
337
|
-
}
|
|
338
|
-
// Compute desired transition duration.
|
|
339
|
-
const duration = msFromTimeCSSValue(getComputedStyle(this).getPropertyValue(this.open ? OPENING_TRANSITION_PROP : CLOSING_TRANSITION_PROP));
|
|
340
|
-
let promise = this.updateComplete;
|
|
341
|
-
if (duration > 0) {
|
|
342
|
-
promise = new Promise((r) => {
|
|
343
|
-
setTimeout(r, duration);
|
|
344
|
-
});
|
|
345
|
-
}
|
|
346
|
-
await promise;
|
|
347
|
-
this.opening = false;
|
|
348
|
-
this.closing = false;
|
|
349
|
-
if (!this.open && this.dialogElement?.open) {
|
|
350
|
-
// Closing the dialog triggers an asynchronous `close` event.
|
|
351
|
-
// It's important to wait for this event to fire since it changes the
|
|
352
|
-
// state of `open` to false.
|
|
353
|
-
// Without waiting, this element's `closed` event can be called before
|
|
354
|
-
// the dialog's `close` event, which is problematic since the user
|
|
355
|
-
// can set `open` in the `closed` event.
|
|
356
|
-
// The timing of the event appears to vary via browser and does *not*
|
|
357
|
-
// seem to resolve by "task" timing; therefore an explicit promise is
|
|
358
|
-
// used.
|
|
359
|
-
const closedPromise = new Promise(resolve => {
|
|
360
|
-
this.dialogClosedResolver = resolve;
|
|
361
|
-
});
|
|
362
|
-
this.dialogElement?.close(this.currentAction || this.defaultAction);
|
|
363
|
-
await closedPromise;
|
|
364
|
-
// enable scrolling late to avoid layout shift when closing
|
|
365
|
-
if (!this.modeless) {
|
|
366
|
-
Dialog.setDocumentScrollingDisabled(this.open);
|
|
367
|
-
}
|
|
368
|
-
}
|
|
369
|
-
if (shouldDispatchAction) {
|
|
370
|
-
this.dispatchActionEvent(this.open ? 'opened' : 'closed');
|
|
371
|
-
}
|
|
372
|
-
this.currentAction = undefined;
|
|
210
|
+
this.close();
|
|
373
211
|
}
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
this.dispatchEvent(new CustomEvent(type, { detail, bubbles: true }));
|
|
212
|
+
handleContentClick() {
|
|
213
|
+
this.nextClickIsFromContent = true;
|
|
377
214
|
}
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
}
|
|
383
|
-
if (!this.fullscreen) {
|
|
384
|
-
this.showingFullscreen = false;
|
|
215
|
+
handleSubmit(event) {
|
|
216
|
+
const form = event.target;
|
|
217
|
+
const { submitter } = event;
|
|
218
|
+
if (form.method !== 'dialog' || !submitter) {
|
|
385
219
|
return;
|
|
386
220
|
}
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
}));
|
|
391
|
-
this.showingFullscreen = this.fullscreenQuery.matches;
|
|
221
|
+
// Close reason is the submitter's value attribute, or the dialog's
|
|
222
|
+
// `returnValue` if there is no attribute.
|
|
223
|
+
this.close(submitter.getAttribute('value') ?? this.returnValue);
|
|
392
224
|
}
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
if (event.type === 'cancel') {
|
|
397
|
-
this.currentAction = this.escapeKeyAction;
|
|
398
|
-
// Prevents the <dialog> element from closing when
|
|
399
|
-
// `escapeKeyAction` is set to an empty string.
|
|
400
|
-
// It also early returns and avoids <md-dialog> internal state
|
|
401
|
-
// changes.
|
|
402
|
-
if (this.escapeKeyAction === '') {
|
|
403
|
-
event.preventDefault();
|
|
404
|
-
return;
|
|
405
|
-
}
|
|
406
|
-
}
|
|
407
|
-
this.dialogClosedResolver?.();
|
|
408
|
-
this.dialogClosedResolver = undefined;
|
|
409
|
-
this.open = false;
|
|
410
|
-
this.opening = false;
|
|
411
|
-
this.closing = false;
|
|
412
|
-
redispatchEvent(this, event);
|
|
413
|
-
}
|
|
414
|
-
handleDialogClick(event) {
|
|
415
|
-
if (!this.open) {
|
|
225
|
+
handleCancel(event) {
|
|
226
|
+
if (event.target !== this.dialog) {
|
|
227
|
+
// Ignore any cancel events dispatched by content.
|
|
416
228
|
return;
|
|
417
229
|
}
|
|
418
|
-
this
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
if (this.currentAction !== '') {
|
|
425
|
-
this.close(this.currentAction);
|
|
230
|
+
const preventDefault = !redispatchEvent(this, event);
|
|
231
|
+
// We always prevent default on the original dialog event since we'll
|
|
232
|
+
// animate closing it before it actually closes.
|
|
233
|
+
event.preventDefault();
|
|
234
|
+
if (preventDefault) {
|
|
235
|
+
return;
|
|
426
236
|
}
|
|
237
|
+
this.close();
|
|
427
238
|
}
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
}
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
239
|
+
async animateDialog(animation) {
|
|
240
|
+
const { dialog, scrim, container, headline, content, actions } = this;
|
|
241
|
+
if (!dialog || !scrim || !container || !headline || !content || !actions) {
|
|
242
|
+
return;
|
|
243
|
+
}
|
|
244
|
+
const { container: containerAnimate, dialog: dialogAnimate, scrim: scrimAnimate, headline: headlineAnimate, content: contentAnimate, actions: actionsAnimate } = animation;
|
|
245
|
+
const elementAndAnimation = [
|
|
246
|
+
[dialog, dialogAnimate ?? []], [scrim, scrimAnimate ?? []],
|
|
247
|
+
[container, containerAnimate ?? []], [headline, headlineAnimate ?? []],
|
|
248
|
+
[content, contentAnimate ?? []], [actions, actionsAnimate ?? []]
|
|
249
|
+
];
|
|
250
|
+
const animations = [];
|
|
251
|
+
for (const [element, animation] of elementAndAnimation) {
|
|
252
|
+
for (const animateArgs of animation) {
|
|
253
|
+
animations.push(element.animate(...animateArgs));
|
|
441
254
|
}
|
|
442
255
|
}
|
|
443
|
-
|
|
256
|
+
await Promise.all(animations.map(animation => animation.finished));
|
|
444
257
|
}
|
|
445
|
-
|
|
446
|
-
|
|
258
|
+
handleHeadlineChange(event) {
|
|
259
|
+
const slot = event.target;
|
|
260
|
+
this.hasHeadline = slot.assignedElements().length > 0;
|
|
447
261
|
}
|
|
448
|
-
|
|
449
|
-
|
|
262
|
+
handleActionsChange(event) {
|
|
263
|
+
const slot = event.target;
|
|
264
|
+
this.hasActions = slot.assignedElements().length > 0;
|
|
450
265
|
}
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
!event.composedPath().includes(this.headerElement)) {
|
|
455
|
-
return false;
|
|
456
|
-
}
|
|
457
|
-
return true;
|
|
266
|
+
handleIconChange(event) {
|
|
267
|
+
const slot = event.target;
|
|
268
|
+
this.hasIcon = slot.assignedElements().length > 0;
|
|
458
269
|
}
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
270
|
+
handleAnchorIntersection(entry) {
|
|
271
|
+
const { target, isIntersecting } = entry;
|
|
272
|
+
if (target === this.topAnchor) {
|
|
273
|
+
this.isAtScrollTop = isIntersecting;
|
|
462
274
|
}
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
this.containerElement.setPointerCapture(event.pointerId);
|
|
466
|
-
this.dragging = true;
|
|
467
|
-
const { x, y } = event;
|
|
468
|
-
this.dragInfo = [x, y, top, left];
|
|
469
|
-
}
|
|
470
|
-
const [sx, sy, st, sl] = this.dragInfo ?? [0, 0, 0, 0];
|
|
471
|
-
const dx = event.x - sx;
|
|
472
|
-
const dy = event.y - sy;
|
|
473
|
-
const ml = window.innerWidth - width - this.dragMargin;
|
|
474
|
-
const mt = window.innerHeight - height - this.dragMargin;
|
|
475
|
-
const l = Math.max(this.dragMargin, Math.min(ml, dx + sl));
|
|
476
|
-
const t = Math.max(this.dragMargin, Math.min(mt, dy + st));
|
|
477
|
-
this.style.setProperty('--_container-drag-inline-start', `${l}px`);
|
|
478
|
-
this.style.setProperty('--_container-drag-block-start', `${t}px`);
|
|
479
|
-
}
|
|
480
|
-
handleDragEnd(event) {
|
|
481
|
-
if (!this.dragging) {
|
|
482
|
-
return;
|
|
275
|
+
if (target === this.bottomAnchor) {
|
|
276
|
+
this.isAtScrollBottom = isIntersecting;
|
|
483
277
|
}
|
|
484
|
-
this.containerElement?.releasePointerCapture(event.pointerId);
|
|
485
|
-
this.dragging = false;
|
|
486
|
-
this.dragInfo = undefined;
|
|
487
278
|
}
|
|
488
279
|
}
|
|
489
|
-
|
|
280
|
+
(() => {
|
|
281
|
+
requestUpdateOnAriaChange(Dialog);
|
|
282
|
+
})();
|
|
283
|
+
Dialog.shadowRootOptions = {
|
|
284
|
+
...LitElement.shadowRootOptions,
|
|
285
|
+
delegatesFocus: true
|
|
286
|
+
};
|
|
490
287
|
__decorate([
|
|
491
288
|
property({ type: Boolean })
|
|
492
|
-
], Dialog.prototype, "open",
|
|
289
|
+
], Dialog.prototype, "open", null);
|
|
493
290
|
__decorate([
|
|
494
|
-
property({
|
|
495
|
-
], Dialog.prototype, "
|
|
496
|
-
__decorate([
|
|
497
|
-
property({ attribute: 'fullscreen-breakpoint' })
|
|
498
|
-
], Dialog.prototype, "fullscreenBreakpoint", void 0);
|
|
499
|
-
__decorate([
|
|
500
|
-
property({ type: Boolean, attribute: 'footer-hidden' })
|
|
501
|
-
], Dialog.prototype, "footerHidden", void 0);
|
|
502
|
-
__decorate([
|
|
503
|
-
property({ type: Boolean })
|
|
504
|
-
], Dialog.prototype, "stacked", void 0);
|
|
505
|
-
__decorate([
|
|
506
|
-
property({ attribute: 'default-action' })
|
|
507
|
-
], Dialog.prototype, "defaultAction", void 0);
|
|
508
|
-
__decorate([
|
|
509
|
-
property({ attribute: 'action-attribute' })
|
|
510
|
-
], Dialog.prototype, "actionAttribute", void 0);
|
|
291
|
+
property({ attribute: false })
|
|
292
|
+
], Dialog.prototype, "returnValue", void 0);
|
|
511
293
|
__decorate([
|
|
512
|
-
property(
|
|
513
|
-
], Dialog.prototype, "
|
|
294
|
+
property()
|
|
295
|
+
], Dialog.prototype, "type", void 0);
|
|
514
296
|
__decorate([
|
|
515
|
-
|
|
516
|
-
], Dialog.prototype, "
|
|
297
|
+
query('dialog')
|
|
298
|
+
], Dialog.prototype, "dialog", void 0);
|
|
517
299
|
__decorate([
|
|
518
|
-
|
|
519
|
-
], Dialog.prototype, "
|
|
300
|
+
query('.scrim')
|
|
301
|
+
], Dialog.prototype, "scrim", void 0);
|
|
520
302
|
__decorate([
|
|
521
|
-
|
|
522
|
-
], Dialog.prototype, "
|
|
303
|
+
query('.container')
|
|
304
|
+
], Dialog.prototype, "container", void 0);
|
|
523
305
|
__decorate([
|
|
524
|
-
|
|
525
|
-
], Dialog.prototype, "
|
|
306
|
+
query('.headline')
|
|
307
|
+
], Dialog.prototype, "headline", void 0);
|
|
526
308
|
__decorate([
|
|
527
|
-
query('.
|
|
528
|
-
], Dialog.prototype, "
|
|
309
|
+
query('.content')
|
|
310
|
+
], Dialog.prototype, "content", void 0);
|
|
529
311
|
__decorate([
|
|
530
|
-
query('
|
|
531
|
-
], Dialog.prototype, "
|
|
312
|
+
query('.actions')
|
|
313
|
+
], Dialog.prototype, "actions", void 0);
|
|
532
314
|
__decorate([
|
|
533
|
-
|
|
534
|
-
], Dialog.prototype, "
|
|
315
|
+
state()
|
|
316
|
+
], Dialog.prototype, "isAtScrollTop", void 0);
|
|
535
317
|
__decorate([
|
|
536
|
-
|
|
537
|
-
], Dialog.prototype, "
|
|
318
|
+
state()
|
|
319
|
+
], Dialog.prototype, "isAtScrollBottom", void 0);
|
|
538
320
|
__decorate([
|
|
539
|
-
query(
|
|
540
|
-
], Dialog.prototype, "
|
|
321
|
+
query('.scroller')
|
|
322
|
+
], Dialog.prototype, "scroller", void 0);
|
|
541
323
|
__decorate([
|
|
542
|
-
query(
|
|
543
|
-
], Dialog.prototype, "
|
|
324
|
+
query('.top.anchor')
|
|
325
|
+
], Dialog.prototype, "topAnchor", void 0);
|
|
544
326
|
__decorate([
|
|
545
|
-
|
|
546
|
-
], Dialog.prototype, "
|
|
327
|
+
query('.bottom.anchor')
|
|
328
|
+
], Dialog.prototype, "bottomAnchor", void 0);
|
|
547
329
|
__decorate([
|
|
548
330
|
state()
|
|
549
|
-
], Dialog.prototype, "
|
|
331
|
+
], Dialog.prototype, "hasHeadline", void 0);
|
|
550
332
|
__decorate([
|
|
551
333
|
state()
|
|
552
|
-
], Dialog.prototype, "
|
|
553
|
-
__decorate([
|
|
554
|
-
state()
|
|
555
|
-
], Dialog.prototype, "closing", void 0);
|
|
556
|
-
__decorate([
|
|
557
|
-
property({ reflect: true })
|
|
558
|
-
], Dialog.prototype, "transition", void 0);
|
|
334
|
+
], Dialog.prototype, "hasActions", void 0);
|
|
559
335
|
__decorate([
|
|
560
336
|
state()
|
|
561
|
-
], Dialog.prototype, "
|
|
337
|
+
], Dialog.prototype, "hasIcon", void 0);
|
|
562
338
|
//# sourceMappingURL=dialog.js.map
|