@justeattakeaway/pie-modal 0.17.0 → 0.18.0
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/dist/{types/packages/components/pie-modal/src/index.d.ts → index.d.ts} +241 -126
- package/dist/index.js +4 -0
- package/dist/react.d.ts +249 -0
- package/dist/react.js +213 -206
- package/package.json +7 -2
- package/src/index.ts +1 -1
- package/.eslintignore +0 -5
- package/.turbo/turbo-build.log +0 -14
- package/CHANGELOG.md +0 -209
- package/dist/types/index.d.ts +0 -1
- package/dist/types/packages/components/pie-modal/src/defs.d.ts +0 -110
- package/dist/types/packages/components/pie-modal/src/defs.d.ts.map +0 -1
- package/dist/types/packages/components/pie-modal/src/index.d.ts.map +0 -1
- package/dist/types/packages/components/pie-modal/src/react.d.ts +0 -8
- package/dist/types/packages/components/pie-modal/src/react.d.ts.map +0 -1
- package/dist/types/react.d.ts +0 -1
- package/playwright/index.html +0 -56
- package/playwright/index.ts +0 -1
- package/playwright-lit-visual.config.ts +0 -4
- package/playwright-lit.config.ts +0 -4
- package/test/component/pie-modal.spec.ts +0 -816
- package/test/helpers/index.ts +0 -31
- package/test/visual/pie-modal.spec.ts +0 -494
- package/tsconfig.json +0 -8
- package/vite.config.js +0 -3
|
@@ -1,126 +1,241 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type { DependentMap } from '@justeattakeaway/pie-webc-core';
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
*
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
*/
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
*
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
*
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
*
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
*
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
*
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
*
|
|
95
|
-
*/
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
1
|
+
import type { CSSResult } from 'lit';
|
|
2
|
+
import type { DependentMap } from '@justeattakeaway/pie-webc-core';
|
|
3
|
+
import type { LitElement } from 'lit';
|
|
4
|
+
import { RTLComponentProps } from '@justeattakeaway/pie-webc-core';
|
|
5
|
+
import type { TemplateResult } from 'lit';
|
|
6
|
+
import { Variant } from '@justeattakeaway/pie-button/src/defs.ts';
|
|
7
|
+
|
|
8
|
+
export declare type ActionProps = {
|
|
9
|
+
/**
|
|
10
|
+
* The text to display inside the button.
|
|
11
|
+
*/
|
|
12
|
+
text: string;
|
|
13
|
+
/**
|
|
14
|
+
* The button variant.
|
|
15
|
+
*/
|
|
16
|
+
variant?: Variant;
|
|
17
|
+
/**
|
|
18
|
+
* The ARIA label for the button.
|
|
19
|
+
*/
|
|
20
|
+
ariaLabel?: string;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export declare type AriaProps = {
|
|
24
|
+
close?: string;
|
|
25
|
+
back?: string;
|
|
26
|
+
loading?: string;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export declare const headingLevels: readonly ["h1", "h2", "h3", "h4", "h5", "h6"];
|
|
30
|
+
|
|
31
|
+
export declare type ModalProps = RTLComponentProps & {
|
|
32
|
+
/**
|
|
33
|
+
* The ARIA labels used for the modal close and back buttons, as well as loading state.
|
|
34
|
+
*/
|
|
35
|
+
aria?: AriaProps;
|
|
36
|
+
/**
|
|
37
|
+
* When true, the modal will have a back button. This currently behaves the same as the close button.
|
|
38
|
+
*/
|
|
39
|
+
hasBackButton: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* When true, the modal will have a back button. This currently behaves the same as the close button.
|
|
42
|
+
*/
|
|
43
|
+
hasStackedActions: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* The text to display in the modal's heading.
|
|
46
|
+
*/
|
|
47
|
+
heading: string;
|
|
48
|
+
/**
|
|
49
|
+
* The HTML heading tag to use for the modal's heading. Can be h1-h6.
|
|
50
|
+
*/
|
|
51
|
+
headingLevel: typeof headingLevels[number];
|
|
52
|
+
/**
|
|
53
|
+
* When true, the modal will be open.
|
|
54
|
+
*/
|
|
55
|
+
isOpen: boolean;
|
|
56
|
+
/**
|
|
57
|
+
* When set to `true`:
|
|
58
|
+
* 1. The close button within the modal will be visible.
|
|
59
|
+
* 2. The user can dismiss the modal via the ESCAPE key, clicking the backdrop
|
|
60
|
+
* or via a close button.
|
|
61
|
+
*
|
|
62
|
+
* When set to `false`:
|
|
63
|
+
* 1. The close button within the modal will be hidden.
|
|
64
|
+
* 2. The user can NOT dismiss the modal via the ESCAPE key or clicking the backdrop.
|
|
65
|
+
*
|
|
66
|
+
*/
|
|
67
|
+
isDismissible: boolean;
|
|
68
|
+
/**
|
|
69
|
+
* When false, the modal footer will scroll with the content inside the modal body.
|
|
70
|
+
*/
|
|
71
|
+
isFooterPinned: boolean;
|
|
72
|
+
/**
|
|
73
|
+
* This controls whether a *medium-sized* modal will cover the full width of the page when below the mid breakpoint.
|
|
74
|
+
*/
|
|
75
|
+
isFullWidthBelowMid: boolean;
|
|
76
|
+
/**
|
|
77
|
+
* When true, displays a loading spinner in the modal.
|
|
78
|
+
*/
|
|
79
|
+
isLoading: boolean;
|
|
80
|
+
/**
|
|
81
|
+
* The leading action configuration for the modal.
|
|
82
|
+
*/
|
|
83
|
+
leadingAction: ActionProps;
|
|
84
|
+
position: typeof positions[number];
|
|
85
|
+
/**
|
|
86
|
+
* The selector for the element that you would like focus to be returned to when the modal is closed, e.g., #skipToMain
|
|
87
|
+
*/
|
|
88
|
+
returnFocusAfterCloseSelector?: string;
|
|
89
|
+
/**
|
|
90
|
+
* The size of the modal; this controls how wide it will appear on the page.
|
|
91
|
+
*/
|
|
92
|
+
size: typeof sizes[number];
|
|
93
|
+
/**
|
|
94
|
+
* The supporting action configuration for the modal.
|
|
95
|
+
*/
|
|
96
|
+
supportingAction: ActionProps;
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Event name for when the modal back button is clicked.
|
|
101
|
+
*
|
|
102
|
+
* @constant
|
|
103
|
+
*/
|
|
104
|
+
export declare const ON_MODAL_BACK_EVENT = "pie-modal-back";
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Event name for when the modal is closed.
|
|
108
|
+
*
|
|
109
|
+
* @constant
|
|
110
|
+
*/
|
|
111
|
+
export declare const ON_MODAL_CLOSE_EVENT = "pie-modal-close";
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Event name for when the modal is opened.
|
|
115
|
+
*
|
|
116
|
+
* @constant
|
|
117
|
+
*/
|
|
118
|
+
export declare const ON_MODAL_OPEN_EVENT = "pie-modal-open";
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* @event {CustomEvent} pie-modal-open - when the modal is opened.
|
|
122
|
+
* @event {CustomEvent} pie-modal-close - when the modal is closed.
|
|
123
|
+
* @event {CustomEvent} pie-modal-back - when the modal back button is clicked.
|
|
124
|
+
*/
|
|
125
|
+
export declare class PieModal extends PieModal_base implements ModalProps {
|
|
126
|
+
aria: AriaProps;
|
|
127
|
+
heading: string;
|
|
128
|
+
headingLevel: ModalProps['headingLevel'];
|
|
129
|
+
hasBackButton: boolean;
|
|
130
|
+
hasStackedActions: boolean;
|
|
131
|
+
isDismissible: boolean;
|
|
132
|
+
isFooterPinned: boolean;
|
|
133
|
+
isFullWidthBelowMid: boolean;
|
|
134
|
+
isLoading: boolean;
|
|
135
|
+
isOpen: boolean;
|
|
136
|
+
leadingAction: ActionProps;
|
|
137
|
+
position: ModalProps['position'];
|
|
138
|
+
returnFocusAfterCloseSelector?: string;
|
|
139
|
+
size: ModalProps['size'];
|
|
140
|
+
supportingAction: ActionProps;
|
|
141
|
+
private _dialog?;
|
|
142
|
+
private _backButtonClicked;
|
|
143
|
+
static styles: CSSResult;
|
|
144
|
+
constructor();
|
|
145
|
+
connectedCallback(): void;
|
|
146
|
+
disconnectedCallback(): void;
|
|
147
|
+
firstUpdated(changedProperties: DependentMap<ModalProps>): void;
|
|
148
|
+
updated(changedProperties: DependentMap<ModalProps>): void;
|
|
149
|
+
/**
|
|
150
|
+
* Opens the dialog element and disables page scrolling
|
|
151
|
+
*/
|
|
152
|
+
private _handleModalOpened;
|
|
153
|
+
/**
|
|
154
|
+
* Closes the dialog element and re-enables page scrolling
|
|
155
|
+
*/
|
|
156
|
+
private _handleModalClosed;
|
|
157
|
+
/**
|
|
158
|
+
* Prevents the user from dismissing the dialog via the `cancel`
|
|
159
|
+
* event (ESC key) when `isDismissible` is set to false.
|
|
160
|
+
*
|
|
161
|
+
* @param {Event} event - The event object.
|
|
162
|
+
*/
|
|
163
|
+
private _handleDialogCancelEvent;
|
|
164
|
+
private _handleModalOpenStateOnFirstRender;
|
|
165
|
+
private _handleModalOpenStateChanged;
|
|
166
|
+
/**
|
|
167
|
+
* Return focus to the specified element, providing the selector is valid
|
|
168
|
+
* and the chosen element can be found.
|
|
169
|
+
*/
|
|
170
|
+
private _returnFocus;
|
|
171
|
+
/**
|
|
172
|
+
* Template for the close button element. Called within the
|
|
173
|
+
* main render function.
|
|
174
|
+
*
|
|
175
|
+
* @private
|
|
176
|
+
*/
|
|
177
|
+
private renderCloseButton;
|
|
178
|
+
/**
|
|
179
|
+
* Template for the back button element. Called within the
|
|
180
|
+
* main render function.
|
|
181
|
+
*
|
|
182
|
+
* @private
|
|
183
|
+
*/
|
|
184
|
+
private renderBackButton;
|
|
185
|
+
/**
|
|
186
|
+
* Render leadingAction button depending on prop availability.
|
|
187
|
+
*
|
|
188
|
+
* 1. If the prop `leadingAction` is not provided, the button is not rendered.
|
|
189
|
+
* 2. If the prop `leadingAction` is provided but any of the optional properties
|
|
190
|
+
* are not provided, they fall back to their default values.
|
|
191
|
+
*
|
|
192
|
+
* @private
|
|
193
|
+
*/
|
|
194
|
+
private renderLeadingAction;
|
|
195
|
+
/**
|
|
196
|
+
* Render supportingAction button depending on prop availability.
|
|
197
|
+
*
|
|
198
|
+
* 1. If the prop `supportingAction` is not provided, the button is not rendered.
|
|
199
|
+
* 2. If the prop `supportingAction` is provided but any of the optional properties
|
|
200
|
+
* are not provided, they fall back to their default values.
|
|
201
|
+
* 3. If `supportingAction` is provided but not `leadingAction`, log a warning and do
|
|
202
|
+
* not render `supportingAction`.
|
|
203
|
+
*
|
|
204
|
+
* @private
|
|
205
|
+
*/
|
|
206
|
+
private renderSupportingAction;
|
|
207
|
+
/**
|
|
208
|
+
* Renders the modal inner content and footer of the modal.
|
|
209
|
+
* @private
|
|
210
|
+
*/
|
|
211
|
+
private renderModalContentAndFooter;
|
|
212
|
+
render(): TemplateResult;
|
|
213
|
+
/**
|
|
214
|
+
* Dismisses the modal on backdrop click if `isDismissible` is `true`.
|
|
215
|
+
* @param {MouseEvent} event - the click event targetting the modal/backdrop
|
|
216
|
+
*/
|
|
217
|
+
private _handleDialogLightDismiss;
|
|
218
|
+
/**
|
|
219
|
+
* Note: We should aim to have a shareable event helper system to allow
|
|
220
|
+
* us to share this across components in-future.
|
|
221
|
+
*
|
|
222
|
+
* Dispatch a custom event.
|
|
223
|
+
*
|
|
224
|
+
* To be used whenever we have behavioural events we want to
|
|
225
|
+
* bubble up through the modal.
|
|
226
|
+
*
|
|
227
|
+
* @param {string} eventType
|
|
228
|
+
*/
|
|
229
|
+
private _dispatchModalCustomEvent;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
declare const PieModal_base: (new (...args: any[]) => {
|
|
233
|
+
dir: "ltr" | "rtl" | "auto";
|
|
234
|
+
isRTL: boolean;
|
|
235
|
+
}) & typeof LitElement;
|
|
236
|
+
|
|
237
|
+
export declare const positions: readonly ["top", "center"];
|
|
238
|
+
|
|
239
|
+
export declare const sizes: readonly ["small", "medium", "large"];
|
|
240
|
+
|
|
241
|
+
export { }
|
package/dist/index.js
CHANGED
|
@@ -1618,7 +1618,11 @@ g([
|
|
|
1618
1618
|
], f.prototype, "_dialog", 2);
|
|
1619
1619
|
customElements.define(Z, f);
|
|
1620
1620
|
export {
|
|
1621
|
+
ve as ON_MODAL_BACK_EVENT,
|
|
1622
|
+
ge as ON_MODAL_CLOSE_EVENT,
|
|
1623
|
+
G as ON_MODAL_OPEN_EVENT,
|
|
1621
1624
|
f as PieModal,
|
|
1622
1625
|
ei as headingLevels,
|
|
1626
|
+
ii as positions,
|
|
1623
1627
|
ti as sizes
|
|
1624
1628
|
};
|
package/dist/react.d.ts
ADDED
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
import type { CSSResult } from 'lit';
|
|
2
|
+
import type { DependentMap } from '@justeattakeaway/pie-webc-core';
|
|
3
|
+
import type { EventName } from '@lit-labs/react';
|
|
4
|
+
import type { LitElement } from 'lit';
|
|
5
|
+
import type { ReactWebComponent } from '@lit-labs/react';
|
|
6
|
+
import { RTLComponentProps } from '@justeattakeaway/pie-webc-core';
|
|
7
|
+
import type { TemplateResult } from 'lit';
|
|
8
|
+
import { Variant } from '@justeattakeaway/pie-button/src/defs.ts';
|
|
9
|
+
|
|
10
|
+
export declare type ActionProps = {
|
|
11
|
+
/**
|
|
12
|
+
* The text to display inside the button.
|
|
13
|
+
*/
|
|
14
|
+
text: string;
|
|
15
|
+
/**
|
|
16
|
+
* The button variant.
|
|
17
|
+
*/
|
|
18
|
+
variant?: Variant;
|
|
19
|
+
/**
|
|
20
|
+
* The ARIA label for the button.
|
|
21
|
+
*/
|
|
22
|
+
ariaLabel?: string;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export declare type AriaProps = {
|
|
26
|
+
close?: string;
|
|
27
|
+
back?: string;
|
|
28
|
+
loading?: string;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export declare const headingLevels: readonly ["h1", "h2", "h3", "h4", "h5", "h6"];
|
|
32
|
+
|
|
33
|
+
export declare type ModalProps = RTLComponentProps & {
|
|
34
|
+
/**
|
|
35
|
+
* The ARIA labels used for the modal close and back buttons, as well as loading state.
|
|
36
|
+
*/
|
|
37
|
+
aria?: AriaProps;
|
|
38
|
+
/**
|
|
39
|
+
* When true, the modal will have a back button. This currently behaves the same as the close button.
|
|
40
|
+
*/
|
|
41
|
+
hasBackButton: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* When true, the modal will have a back button. This currently behaves the same as the close button.
|
|
44
|
+
*/
|
|
45
|
+
hasStackedActions: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* The text to display in the modal's heading.
|
|
48
|
+
*/
|
|
49
|
+
heading: string;
|
|
50
|
+
/**
|
|
51
|
+
* The HTML heading tag to use for the modal's heading. Can be h1-h6.
|
|
52
|
+
*/
|
|
53
|
+
headingLevel: typeof headingLevels[number];
|
|
54
|
+
/**
|
|
55
|
+
* When true, the modal will be open.
|
|
56
|
+
*/
|
|
57
|
+
isOpen: boolean;
|
|
58
|
+
/**
|
|
59
|
+
* When set to `true`:
|
|
60
|
+
* 1. The close button within the modal will be visible.
|
|
61
|
+
* 2. The user can dismiss the modal via the ESCAPE key, clicking the backdrop
|
|
62
|
+
* or via a close button.
|
|
63
|
+
*
|
|
64
|
+
* When set to `false`:
|
|
65
|
+
* 1. The close button within the modal will be hidden.
|
|
66
|
+
* 2. The user can NOT dismiss the modal via the ESCAPE key or clicking the backdrop.
|
|
67
|
+
*
|
|
68
|
+
*/
|
|
69
|
+
isDismissible: boolean;
|
|
70
|
+
/**
|
|
71
|
+
* When false, the modal footer will scroll with the content inside the modal body.
|
|
72
|
+
*/
|
|
73
|
+
isFooterPinned: boolean;
|
|
74
|
+
/**
|
|
75
|
+
* This controls whether a *medium-sized* modal will cover the full width of the page when below the mid breakpoint.
|
|
76
|
+
*/
|
|
77
|
+
isFullWidthBelowMid: boolean;
|
|
78
|
+
/**
|
|
79
|
+
* When true, displays a loading spinner in the modal.
|
|
80
|
+
*/
|
|
81
|
+
isLoading: boolean;
|
|
82
|
+
/**
|
|
83
|
+
* The leading action configuration for the modal.
|
|
84
|
+
*/
|
|
85
|
+
leadingAction: ActionProps;
|
|
86
|
+
position: typeof positions[number];
|
|
87
|
+
/**
|
|
88
|
+
* The selector for the element that you would like focus to be returned to when the modal is closed, e.g., #skipToMain
|
|
89
|
+
*/
|
|
90
|
+
returnFocusAfterCloseSelector?: string;
|
|
91
|
+
/**
|
|
92
|
+
* The size of the modal; this controls how wide it will appear on the page.
|
|
93
|
+
*/
|
|
94
|
+
size: typeof sizes[number];
|
|
95
|
+
/**
|
|
96
|
+
* The supporting action configuration for the modal.
|
|
97
|
+
*/
|
|
98
|
+
supportingAction: ActionProps;
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Event name for when the modal back button is clicked.
|
|
103
|
+
*
|
|
104
|
+
* @constant
|
|
105
|
+
*/
|
|
106
|
+
export declare const ON_MODAL_BACK_EVENT = "pie-modal-back";
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Event name for when the modal is closed.
|
|
110
|
+
*
|
|
111
|
+
* @constant
|
|
112
|
+
*/
|
|
113
|
+
export declare const ON_MODAL_CLOSE_EVENT = "pie-modal-close";
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Event name for when the modal is opened.
|
|
117
|
+
*
|
|
118
|
+
* @constant
|
|
119
|
+
*/
|
|
120
|
+
export declare const ON_MODAL_OPEN_EVENT = "pie-modal-open";
|
|
121
|
+
|
|
122
|
+
export declare const PieModal: ReactWebComponent<PieModal_2, {
|
|
123
|
+
onPieModalOpen: EventName<CustomEvent<any>>;
|
|
124
|
+
onPieModalClose: EventName<CustomEvent<any>>;
|
|
125
|
+
onPieModalBack: EventName<CustomEvent<any>>;
|
|
126
|
+
}>;
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* @event {CustomEvent} pie-modal-open - when the modal is opened.
|
|
130
|
+
* @event {CustomEvent} pie-modal-close - when the modal is closed.
|
|
131
|
+
* @event {CustomEvent} pie-modal-back - when the modal back button is clicked.
|
|
132
|
+
*/
|
|
133
|
+
declare class PieModal_2 extends PieModal_base implements ModalProps {
|
|
134
|
+
aria: AriaProps;
|
|
135
|
+
heading: string;
|
|
136
|
+
headingLevel: ModalProps['headingLevel'];
|
|
137
|
+
hasBackButton: boolean;
|
|
138
|
+
hasStackedActions: boolean;
|
|
139
|
+
isDismissible: boolean;
|
|
140
|
+
isFooterPinned: boolean;
|
|
141
|
+
isFullWidthBelowMid: boolean;
|
|
142
|
+
isLoading: boolean;
|
|
143
|
+
isOpen: boolean;
|
|
144
|
+
leadingAction: ActionProps;
|
|
145
|
+
position: ModalProps['position'];
|
|
146
|
+
returnFocusAfterCloseSelector?: string;
|
|
147
|
+
size: ModalProps['size'];
|
|
148
|
+
supportingAction: ActionProps;
|
|
149
|
+
private _dialog?;
|
|
150
|
+
private _backButtonClicked;
|
|
151
|
+
static styles: CSSResult;
|
|
152
|
+
constructor();
|
|
153
|
+
connectedCallback(): void;
|
|
154
|
+
disconnectedCallback(): void;
|
|
155
|
+
firstUpdated(changedProperties: DependentMap<ModalProps>): void;
|
|
156
|
+
updated(changedProperties: DependentMap<ModalProps>): void;
|
|
157
|
+
/**
|
|
158
|
+
* Opens the dialog element and disables page scrolling
|
|
159
|
+
*/
|
|
160
|
+
private _handleModalOpened;
|
|
161
|
+
/**
|
|
162
|
+
* Closes the dialog element and re-enables page scrolling
|
|
163
|
+
*/
|
|
164
|
+
private _handleModalClosed;
|
|
165
|
+
/**
|
|
166
|
+
* Prevents the user from dismissing the dialog via the `cancel`
|
|
167
|
+
* event (ESC key) when `isDismissible` is set to false.
|
|
168
|
+
*
|
|
169
|
+
* @param {Event} event - The event object.
|
|
170
|
+
*/
|
|
171
|
+
private _handleDialogCancelEvent;
|
|
172
|
+
private _handleModalOpenStateOnFirstRender;
|
|
173
|
+
private _handleModalOpenStateChanged;
|
|
174
|
+
/**
|
|
175
|
+
* Return focus to the specified element, providing the selector is valid
|
|
176
|
+
* and the chosen element can be found.
|
|
177
|
+
*/
|
|
178
|
+
private _returnFocus;
|
|
179
|
+
/**
|
|
180
|
+
* Template for the close button element. Called within the
|
|
181
|
+
* main render function.
|
|
182
|
+
*
|
|
183
|
+
* @private
|
|
184
|
+
*/
|
|
185
|
+
private renderCloseButton;
|
|
186
|
+
/**
|
|
187
|
+
* Template for the back button element. Called within the
|
|
188
|
+
* main render function.
|
|
189
|
+
*
|
|
190
|
+
* @private
|
|
191
|
+
*/
|
|
192
|
+
private renderBackButton;
|
|
193
|
+
/**
|
|
194
|
+
* Render leadingAction button depending on prop availability.
|
|
195
|
+
*
|
|
196
|
+
* 1. If the prop `leadingAction` is not provided, the button is not rendered.
|
|
197
|
+
* 2. If the prop `leadingAction` is provided but any of the optional properties
|
|
198
|
+
* are not provided, they fall back to their default values.
|
|
199
|
+
*
|
|
200
|
+
* @private
|
|
201
|
+
*/
|
|
202
|
+
private renderLeadingAction;
|
|
203
|
+
/**
|
|
204
|
+
* Render supportingAction button depending on prop availability.
|
|
205
|
+
*
|
|
206
|
+
* 1. If the prop `supportingAction` is not provided, the button is not rendered.
|
|
207
|
+
* 2. If the prop `supportingAction` is provided but any of the optional properties
|
|
208
|
+
* are not provided, they fall back to their default values.
|
|
209
|
+
* 3. If `supportingAction` is provided but not `leadingAction`, log a warning and do
|
|
210
|
+
* not render `supportingAction`.
|
|
211
|
+
*
|
|
212
|
+
* @private
|
|
213
|
+
*/
|
|
214
|
+
private renderSupportingAction;
|
|
215
|
+
/**
|
|
216
|
+
* Renders the modal inner content and footer of the modal.
|
|
217
|
+
* @private
|
|
218
|
+
*/
|
|
219
|
+
private renderModalContentAndFooter;
|
|
220
|
+
render(): TemplateResult;
|
|
221
|
+
/**
|
|
222
|
+
* Dismisses the modal on backdrop click if `isDismissible` is `true`.
|
|
223
|
+
* @param {MouseEvent} event - the click event targetting the modal/backdrop
|
|
224
|
+
*/
|
|
225
|
+
private _handleDialogLightDismiss;
|
|
226
|
+
/**
|
|
227
|
+
* Note: We should aim to have a shareable event helper system to allow
|
|
228
|
+
* us to share this across components in-future.
|
|
229
|
+
*
|
|
230
|
+
* Dispatch a custom event.
|
|
231
|
+
*
|
|
232
|
+
* To be used whenever we have behavioural events we want to
|
|
233
|
+
* bubble up through the modal.
|
|
234
|
+
*
|
|
235
|
+
* @param {string} eventType
|
|
236
|
+
*/
|
|
237
|
+
private _dispatchModalCustomEvent;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
declare const PieModal_base: (new (...args: any[]) => {
|
|
241
|
+
dir: "ltr" | "rtl" | "auto";
|
|
242
|
+
isRTL: boolean;
|
|
243
|
+
}) & typeof LitElement;
|
|
244
|
+
|
|
245
|
+
export declare const positions: readonly ["top", "center"];
|
|
246
|
+
|
|
247
|
+
export declare const sizes: readonly ["small", "medium", "large"];
|
|
248
|
+
|
|
249
|
+
export { }
|