@justeattakeaway/pie-modal 0.43.5 → 0.44.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/custom-elements.json +41 -39
- package/dist/index.d.ts +33 -38
- package/dist/index.js +190 -180
- package/dist/react.d.ts +33 -38
- package/dist/react.js +14 -12
- package/package.json +1 -1
- package/src/defs.ts +21 -24
- package/src/index.ts +66 -53
package/custom-elements.json
CHANGED
|
@@ -87,7 +87,7 @@
|
|
|
87
87
|
"type": {
|
|
88
88
|
"text": "DefaultProps"
|
|
89
89
|
},
|
|
90
|
-
"default": "{\n hasBackButton: false,\n hasStackedActions: false,\n headingLevel: 'h2',\n isOpen: false,\n isDismissible: false,\n isFooterPinned: true,\n isFullWidthBelowMid: false,\n isLoading: false,\n position: 'center',\n size: 'medium',\n}"
|
|
90
|
+
"default": "{\n hasBackButton: false,\n hasStackedActions: false,\n headingLevel: 'h2',\n isOpen: false,\n isDismissible: false,\n isFooterPinned: true,\n isFullWidthBelowMid: false,\n isLoading: false,\n leadingActionVariant: 'primary',\n position: 'center',\n size: 'medium',\n supportingActionVariant: 'ghost',\n}"
|
|
91
91
|
}
|
|
92
92
|
],
|
|
93
93
|
"exports": [
|
|
@@ -178,7 +178,7 @@
|
|
|
178
178
|
"kind": "field",
|
|
179
179
|
"name": "aria",
|
|
180
180
|
"type": {
|
|
181
|
-
"text": "
|
|
181
|
+
"text": "ModalProps['aria']"
|
|
182
182
|
},
|
|
183
183
|
"privacy": "public",
|
|
184
184
|
"attribute": "aria"
|
|
@@ -195,9 +195,6 @@
|
|
|
195
195
|
{
|
|
196
196
|
"kind": "field",
|
|
197
197
|
"name": "headingLevel",
|
|
198
|
-
"type": {
|
|
199
|
-
"text": "ModalProps['headingLevel']"
|
|
200
|
-
},
|
|
201
198
|
"privacy": "public",
|
|
202
199
|
"attribute": "headingLevel"
|
|
203
200
|
},
|
|
@@ -247,19 +244,22 @@
|
|
|
247
244
|
},
|
|
248
245
|
{
|
|
249
246
|
"kind": "field",
|
|
250
|
-
"name": "
|
|
247
|
+
"name": "leadingActionText",
|
|
251
248
|
"type": {
|
|
252
|
-
"text": "
|
|
249
|
+
"text": "ModalProps['leadingActionText']"
|
|
253
250
|
},
|
|
254
251
|
"privacy": "public",
|
|
255
|
-
"attribute": "
|
|
252
|
+
"attribute": "leadingActionText"
|
|
253
|
+
},
|
|
254
|
+
{
|
|
255
|
+
"kind": "field",
|
|
256
|
+
"name": "leadingActionVariant",
|
|
257
|
+
"privacy": "public",
|
|
258
|
+
"attribute": "leadingActionVariant"
|
|
256
259
|
},
|
|
257
260
|
{
|
|
258
261
|
"kind": "field",
|
|
259
262
|
"name": "position",
|
|
260
|
-
"type": {
|
|
261
|
-
"text": "ModalProps['position']"
|
|
262
|
-
},
|
|
263
263
|
"privacy": "public",
|
|
264
264
|
"attribute": "position"
|
|
265
265
|
},
|
|
@@ -267,7 +267,7 @@
|
|
|
267
267
|
"kind": "field",
|
|
268
268
|
"name": "returnFocusAfterCloseSelector",
|
|
269
269
|
"type": {
|
|
270
|
-
"text": "
|
|
270
|
+
"text": "ModalProps['returnFocusAfterCloseSelector'] | undefined"
|
|
271
271
|
},
|
|
272
272
|
"privacy": "public",
|
|
273
273
|
"attribute": "returnFocusAfterCloseSelector"
|
|
@@ -275,20 +275,23 @@
|
|
|
275
275
|
{
|
|
276
276
|
"kind": "field",
|
|
277
277
|
"name": "size",
|
|
278
|
-
"type": {
|
|
279
|
-
"text": "ModalProps['size']"
|
|
280
|
-
},
|
|
281
278
|
"privacy": "public",
|
|
282
279
|
"attribute": "size"
|
|
283
280
|
},
|
|
284
281
|
{
|
|
285
282
|
"kind": "field",
|
|
286
|
-
"name": "
|
|
283
|
+
"name": "supportingActionText",
|
|
287
284
|
"type": {
|
|
288
|
-
"text": "
|
|
285
|
+
"text": "ModalProps['supportingActionText']"
|
|
289
286
|
},
|
|
290
287
|
"privacy": "public",
|
|
291
|
-
"attribute": "
|
|
288
|
+
"attribute": "supportingActionText"
|
|
289
|
+
},
|
|
290
|
+
{
|
|
291
|
+
"kind": "field",
|
|
292
|
+
"name": "supportingActionVariant",
|
|
293
|
+
"privacy": "public",
|
|
294
|
+
"attribute": "supportingActionVariant"
|
|
292
295
|
},
|
|
293
296
|
{
|
|
294
297
|
"kind": "field",
|
|
@@ -431,7 +434,7 @@
|
|
|
431
434
|
"privacy": "private",
|
|
432
435
|
"return": {
|
|
433
436
|
"type": {
|
|
434
|
-
"text": "TemplateResult"
|
|
437
|
+
"text": "TemplateResult | typeof nothing"
|
|
435
438
|
}
|
|
436
439
|
},
|
|
437
440
|
"description": "Template for the close button element. Called within the\nmain render function."
|
|
@@ -442,7 +445,7 @@
|
|
|
442
445
|
"privacy": "private",
|
|
443
446
|
"return": {
|
|
444
447
|
"type": {
|
|
445
|
-
"text": "TemplateResult"
|
|
448
|
+
"text": "TemplateResult | typeof nothing"
|
|
446
449
|
}
|
|
447
450
|
},
|
|
448
451
|
"description": "Template for the back button element. Called within the\nmain render function."
|
|
@@ -456,7 +459,7 @@
|
|
|
456
459
|
"text": "TemplateResult | typeof nothing"
|
|
457
460
|
}
|
|
458
461
|
},
|
|
459
|
-
"description": "
|
|
462
|
+
"description": "Renders the \"leadingAction\" button if the text is provided.\n\nIf `leadingActionText` is not provided, the button is not rendered.\nIf `leadingActionVariant` is not provided, the default value is used.\nThe (optional) aria-label is read from the `aria` prop's `leadingActionLabel` property."
|
|
460
463
|
},
|
|
461
464
|
{
|
|
462
465
|
"kind": "method",
|
|
@@ -467,7 +470,7 @@
|
|
|
467
470
|
"text": "TemplateResult | typeof nothing"
|
|
468
471
|
}
|
|
469
472
|
},
|
|
470
|
-
"description": "
|
|
473
|
+
"description": "Renders the \"supportingAction\" button if the text is provided.\nYou cannot have a supporting action without a leading action.\n\nIf `supportingActionText` or `leadingActionText` are not provided, the button is not rendered.\nIf `supportingActionVariant` is not provided, the default value is used."
|
|
471
474
|
},
|
|
472
475
|
{
|
|
473
476
|
"kind": "method",
|
|
@@ -537,7 +540,7 @@
|
|
|
537
540
|
{
|
|
538
541
|
"name": "aria",
|
|
539
542
|
"type": {
|
|
540
|
-
"text": "
|
|
543
|
+
"text": "ModalProps['aria']"
|
|
541
544
|
},
|
|
542
545
|
"fieldName": "aria"
|
|
543
546
|
},
|
|
@@ -550,9 +553,6 @@
|
|
|
550
553
|
},
|
|
551
554
|
{
|
|
552
555
|
"name": "headingLevel",
|
|
553
|
-
"type": {
|
|
554
|
-
"text": "ModalProps['headingLevel']"
|
|
555
|
-
},
|
|
556
556
|
"fieldName": "headingLevel"
|
|
557
557
|
},
|
|
558
558
|
{
|
|
@@ -584,39 +584,41 @@
|
|
|
584
584
|
"fieldName": "isOpen"
|
|
585
585
|
},
|
|
586
586
|
{
|
|
587
|
-
"name": "
|
|
587
|
+
"name": "leadingActionText",
|
|
588
588
|
"type": {
|
|
589
|
-
"text": "
|
|
589
|
+
"text": "ModalProps['leadingActionText']"
|
|
590
590
|
},
|
|
591
|
-
"fieldName": "
|
|
591
|
+
"fieldName": "leadingActionText"
|
|
592
|
+
},
|
|
593
|
+
{
|
|
594
|
+
"name": "leadingActionVariant",
|
|
595
|
+
"fieldName": "leadingActionVariant"
|
|
592
596
|
},
|
|
593
597
|
{
|
|
594
598
|
"name": "position",
|
|
595
|
-
"type": {
|
|
596
|
-
"text": "ModalProps['position']"
|
|
597
|
-
},
|
|
598
599
|
"fieldName": "position"
|
|
599
600
|
},
|
|
600
601
|
{
|
|
601
602
|
"name": "returnFocusAfterCloseSelector",
|
|
602
603
|
"type": {
|
|
603
|
-
"text": "
|
|
604
|
+
"text": "ModalProps['returnFocusAfterCloseSelector'] | undefined"
|
|
604
605
|
},
|
|
605
606
|
"fieldName": "returnFocusAfterCloseSelector"
|
|
606
607
|
},
|
|
607
608
|
{
|
|
608
609
|
"name": "size",
|
|
609
|
-
"type": {
|
|
610
|
-
"text": "ModalProps['size']"
|
|
611
|
-
},
|
|
612
610
|
"fieldName": "size"
|
|
613
611
|
},
|
|
614
612
|
{
|
|
615
|
-
"name": "
|
|
613
|
+
"name": "supportingActionText",
|
|
616
614
|
"type": {
|
|
617
|
-
"text": "
|
|
615
|
+
"text": "ModalProps['supportingActionText']"
|
|
618
616
|
},
|
|
619
|
-
"fieldName": "
|
|
617
|
+
"fieldName": "supportingActionText"
|
|
618
|
+
},
|
|
619
|
+
{
|
|
620
|
+
"name": "supportingActionVariant",
|
|
621
|
+
"fieldName": "supportingActionVariant"
|
|
620
622
|
}
|
|
621
623
|
],
|
|
622
624
|
"mixins": [
|
package/dist/index.d.ts
CHANGED
|
@@ -7,28 +7,15 @@ import type { RTLInterface } from '@justeattakeaway/pie-webc-core';
|
|
|
7
7
|
import type { TemplateResult } from 'lit';
|
|
8
8
|
import { Variant } from '@justeattakeaway/pie-button/src/defs.ts';
|
|
9
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
10
|
export declare type AriaProps = {
|
|
26
11
|
close?: string;
|
|
27
12
|
back?: string;
|
|
28
13
|
loading?: string;
|
|
14
|
+
leadingActionLabel?: string;
|
|
15
|
+
supportingActionLabel?: string;
|
|
29
16
|
};
|
|
30
17
|
|
|
31
|
-
export declare type DefaultProps = ComponentDefaultProps<ModalProps, keyof Omit<ModalProps, 'aria' | 'heading' | '
|
|
18
|
+
export declare type DefaultProps = ComponentDefaultProps<ModalProps, keyof Omit<ModalProps, 'aria' | 'heading' | 'leadingActionText' | 'supportingActionText' | 'returnFocusAfterCloseSelector'>>;
|
|
32
19
|
|
|
33
20
|
export declare const defaultProps: DefaultProps;
|
|
34
21
|
|
|
@@ -42,7 +29,7 @@ export declare interface ModalEventDetail {
|
|
|
42
29
|
|
|
43
30
|
export declare type ModalProps = {
|
|
44
31
|
/**
|
|
45
|
-
* The ARIA labels used for the modal close and back buttons, as well as loading state.
|
|
32
|
+
* The ARIA labels used for the modal leading action, supporting action, close and back buttons, as well as for the loading state.
|
|
46
33
|
*/
|
|
47
34
|
aria?: AriaProps;
|
|
48
35
|
/**
|
|
@@ -90,13 +77,21 @@ export declare type ModalProps = {
|
|
|
90
77
|
*/
|
|
91
78
|
isLoading?: boolean;
|
|
92
79
|
/**
|
|
93
|
-
* The
|
|
80
|
+
* The text to display inside the leading action button.
|
|
81
|
+
*/
|
|
82
|
+
leadingActionText?: string;
|
|
83
|
+
/**
|
|
84
|
+
* The button variant for the leading action button.
|
|
94
85
|
*/
|
|
95
|
-
|
|
86
|
+
leadingActionVariant?: Variant;
|
|
96
87
|
/**
|
|
97
|
-
* The
|
|
88
|
+
* The text to display inside the supporting action button.
|
|
98
89
|
*/
|
|
99
|
-
|
|
90
|
+
supportingActionText?: string;
|
|
91
|
+
/**
|
|
92
|
+
* The button variant for the supporting action button.
|
|
93
|
+
*/
|
|
94
|
+
supportingActionVariant?: Variant;
|
|
100
95
|
position?: typeof positions[number];
|
|
101
96
|
/**
|
|
102
97
|
* The selector for the element that you would like focus to be returned to when the modal is closed, e.g., #skipToMain
|
|
@@ -152,9 +147,9 @@ export declare const ON_MODAL_SUPPORTING_ACTION_CLICK = "pie-modal-supporting-ac
|
|
|
152
147
|
* @event {CustomEvent} pie-modal-supporting-action-click - when the modal supporting action is clicked.
|
|
153
148
|
*/
|
|
154
149
|
export declare class PieModal extends PieModal_base implements ModalProps {
|
|
155
|
-
aria:
|
|
150
|
+
aria: ModalProps['aria'];
|
|
156
151
|
heading: string;
|
|
157
|
-
headingLevel:
|
|
152
|
+
headingLevel: "h1" | "h2" | "h3" | "h4" | "h5" | "h6";
|
|
158
153
|
hasBackButton: boolean;
|
|
159
154
|
hasStackedActions: boolean;
|
|
160
155
|
isDismissible: boolean;
|
|
@@ -162,11 +157,13 @@ export declare class PieModal extends PieModal_base implements ModalProps {
|
|
|
162
157
|
isFullWidthBelowMid: boolean;
|
|
163
158
|
isLoading: boolean;
|
|
164
159
|
isOpen: boolean;
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
160
|
+
leadingActionText: ModalProps['leadingActionText'];
|
|
161
|
+
leadingActionVariant: "primary" | "secondary" | "outline" | "outline-inverse" | "ghost" | "inverse" | "ghost-inverse" | "destructive" | "destructive-ghost";
|
|
162
|
+
position: "top" | "center";
|
|
163
|
+
returnFocusAfterCloseSelector?: ModalProps['returnFocusAfterCloseSelector'];
|
|
164
|
+
size: "medium" | "large" | "small";
|
|
165
|
+
supportingActionText: ModalProps['supportingActionText'];
|
|
166
|
+
supportingActionVariant: "primary" | "secondary" | "outline" | "outline-inverse" | "ghost" | "inverse" | "ghost-inverse" | "destructive" | "destructive-ghost";
|
|
170
167
|
private _dialog?;
|
|
171
168
|
private _backButtonClicked;
|
|
172
169
|
static styles: CSSResult;
|
|
@@ -212,23 +209,21 @@ export declare class PieModal extends PieModal_base implements ModalProps {
|
|
|
212
209
|
*/
|
|
213
210
|
private renderBackButton;
|
|
214
211
|
/**
|
|
215
|
-
*
|
|
212
|
+
* Renders the "leadingAction" button if the text is provided.
|
|
216
213
|
*
|
|
217
|
-
*
|
|
218
|
-
*
|
|
219
|
-
*
|
|
214
|
+
* If `leadingActionText` is not provided, the button is not rendered.
|
|
215
|
+
* If `leadingActionVariant` is not provided, the default value is used.
|
|
216
|
+
* The (optional) aria-label is read from the `aria` prop's `leadingActionLabel` property.
|
|
220
217
|
*
|
|
221
218
|
* @private
|
|
222
219
|
*/
|
|
223
220
|
private renderLeadingAction;
|
|
224
221
|
/**
|
|
225
|
-
*
|
|
222
|
+
* Renders the "supportingAction" button if the text is provided.
|
|
223
|
+
* You cannot have a supporting action without a leading action.
|
|
226
224
|
*
|
|
227
|
-
*
|
|
228
|
-
*
|
|
229
|
-
* are not provided, they fall back to their default values.
|
|
230
|
-
* 3. If `supportingAction` is provided but not `leadingAction`, log a warning and do
|
|
231
|
-
* not render `supportingAction`.
|
|
225
|
+
* If `supportingActionText` or `leadingActionText` are not provided, the button is not rendered.
|
|
226
|
+
* If `supportingActionVariant` is not provided, the default value is used.
|
|
232
227
|
*
|
|
233
228
|
* @private
|
|
234
229
|
*/
|