@justeattakeaway/pie-modal 0.37.0 → 0.38.1
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 +6 -0
- package/dist/index.d.ts +12 -12
- package/dist/index.js +2 -2
- package/dist/react.d.ts +24 -21
- package/dist/react.js +11 -11
- package/package.json +8 -8
- package/src/defs-react.ts +3 -0
- package/src/defs.ts +12 -12
- package/src/index.ts +2 -2
- package/src/react.ts +17 -4
package/custom-elements.json
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -43,11 +43,11 @@ export declare type ModalProps = {
|
|
|
43
43
|
/**
|
|
44
44
|
* When true, the modal will have a back button. This currently behaves the same as the close button.
|
|
45
45
|
*/
|
|
46
|
-
hasBackButton
|
|
46
|
+
hasBackButton?: boolean;
|
|
47
47
|
/**
|
|
48
48
|
* When true, the modal will have a back button. This currently behaves the same as the close button.
|
|
49
49
|
*/
|
|
50
|
-
hasStackedActions
|
|
50
|
+
hasStackedActions?: boolean;
|
|
51
51
|
/**
|
|
52
52
|
* The text to display in the modal's heading.
|
|
53
53
|
*/
|
|
@@ -55,11 +55,11 @@ export declare type ModalProps = {
|
|
|
55
55
|
/**
|
|
56
56
|
* The HTML heading tag to use for the modal's heading. Can be h1-h6.
|
|
57
57
|
*/
|
|
58
|
-
headingLevel
|
|
58
|
+
headingLevel?: typeof headingLevels[number];
|
|
59
59
|
/**
|
|
60
60
|
* When true, the modal will be open.
|
|
61
61
|
*/
|
|
62
|
-
isOpen
|
|
62
|
+
isOpen?: boolean;
|
|
63
63
|
/**
|
|
64
64
|
* When set to `true`:
|
|
65
65
|
* 1. The close button within the modal will be visible.
|
|
@@ -71,24 +71,24 @@ export declare type ModalProps = {
|
|
|
71
71
|
* 2. The user can NOT dismiss the modal via the ESCAPE key or clicking the backdrop.
|
|
72
72
|
*
|
|
73
73
|
*/
|
|
74
|
-
isDismissible
|
|
74
|
+
isDismissible?: boolean;
|
|
75
75
|
/**
|
|
76
76
|
* When false, the modal footer will scroll with the content inside the modal body.
|
|
77
77
|
*/
|
|
78
|
-
isFooterPinned
|
|
78
|
+
isFooterPinned?: boolean;
|
|
79
79
|
/**
|
|
80
80
|
* This controls whether a *medium-sized* modal will cover the full width of the page when below the mid breakpoint.
|
|
81
81
|
*/
|
|
82
|
-
isFullWidthBelowMid
|
|
82
|
+
isFullWidthBelowMid?: boolean;
|
|
83
83
|
/**
|
|
84
84
|
* When true, displays a loading spinner in the modal.
|
|
85
85
|
*/
|
|
86
|
-
isLoading
|
|
86
|
+
isLoading?: boolean;
|
|
87
87
|
/**
|
|
88
88
|
* The leading action configuration for the modal.
|
|
89
89
|
*/
|
|
90
|
-
leadingAction
|
|
91
|
-
position
|
|
90
|
+
leadingAction?: ActionProps;
|
|
91
|
+
position?: typeof positions[number];
|
|
92
92
|
/**
|
|
93
93
|
* The selector for the element that you would like focus to be returned to when the modal is closed, e.g., #skipToMain
|
|
94
94
|
*/
|
|
@@ -96,11 +96,11 @@ export declare type ModalProps = {
|
|
|
96
96
|
/**
|
|
97
97
|
* The size of the modal; this controls how wide it will appear on the page.
|
|
98
98
|
*/
|
|
99
|
-
size
|
|
99
|
+
size?: typeof sizes[number];
|
|
100
100
|
/**
|
|
101
101
|
* The supporting action configuration for the modal.
|
|
102
102
|
*/
|
|
103
|
-
supportingAction
|
|
103
|
+
supportingAction?: ActionProps;
|
|
104
104
|
};
|
|
105
105
|
|
|
106
106
|
/**
|
package/dist/index.js
CHANGED
package/dist/react.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import type { CSSResult } from 'lit';
|
|
2
|
-
import type { EventName } from '@lit/react';
|
|
3
2
|
import type { GenericConstructor } from '@justeattakeaway/pie-webc-core';
|
|
4
3
|
import type { LitElement } from 'lit';
|
|
5
4
|
import type { PropertyValues } from 'lit';
|
|
6
|
-
import
|
|
5
|
+
import * as React_2 from 'react';
|
|
7
6
|
import type { RTLInterface } from '@justeattakeaway/pie-webc-core';
|
|
8
7
|
import type { TemplateResult } from 'lit';
|
|
9
8
|
import { Variant } from '@justeattakeaway/pie-button/src/defs.ts';
|
|
@@ -41,11 +40,11 @@ export declare type ModalProps = {
|
|
|
41
40
|
/**
|
|
42
41
|
* When true, the modal will have a back button. This currently behaves the same as the close button.
|
|
43
42
|
*/
|
|
44
|
-
hasBackButton
|
|
43
|
+
hasBackButton?: boolean;
|
|
45
44
|
/**
|
|
46
45
|
* When true, the modal will have a back button. This currently behaves the same as the close button.
|
|
47
46
|
*/
|
|
48
|
-
hasStackedActions
|
|
47
|
+
hasStackedActions?: boolean;
|
|
49
48
|
/**
|
|
50
49
|
* The text to display in the modal's heading.
|
|
51
50
|
*/
|
|
@@ -53,11 +52,11 @@ export declare type ModalProps = {
|
|
|
53
52
|
/**
|
|
54
53
|
* The HTML heading tag to use for the modal's heading. Can be h1-h6.
|
|
55
54
|
*/
|
|
56
|
-
headingLevel
|
|
55
|
+
headingLevel?: typeof headingLevels[number];
|
|
57
56
|
/**
|
|
58
57
|
* When true, the modal will be open.
|
|
59
58
|
*/
|
|
60
|
-
isOpen
|
|
59
|
+
isOpen?: boolean;
|
|
61
60
|
/**
|
|
62
61
|
* When set to `true`:
|
|
63
62
|
* 1. The close button within the modal will be visible.
|
|
@@ -69,24 +68,24 @@ export declare type ModalProps = {
|
|
|
69
68
|
* 2. The user can NOT dismiss the modal via the ESCAPE key or clicking the backdrop.
|
|
70
69
|
*
|
|
71
70
|
*/
|
|
72
|
-
isDismissible
|
|
71
|
+
isDismissible?: boolean;
|
|
73
72
|
/**
|
|
74
73
|
* When false, the modal footer will scroll with the content inside the modal body.
|
|
75
74
|
*/
|
|
76
|
-
isFooterPinned
|
|
75
|
+
isFooterPinned?: boolean;
|
|
77
76
|
/**
|
|
78
77
|
* This controls whether a *medium-sized* modal will cover the full width of the page when below the mid breakpoint.
|
|
79
78
|
*/
|
|
80
|
-
isFullWidthBelowMid
|
|
79
|
+
isFullWidthBelowMid?: boolean;
|
|
81
80
|
/**
|
|
82
81
|
* When true, displays a loading spinner in the modal.
|
|
83
82
|
*/
|
|
84
|
-
isLoading
|
|
83
|
+
isLoading?: boolean;
|
|
85
84
|
/**
|
|
86
85
|
* The leading action configuration for the modal.
|
|
87
86
|
*/
|
|
88
|
-
leadingAction
|
|
89
|
-
position
|
|
87
|
+
leadingAction?: ActionProps;
|
|
88
|
+
position?: typeof positions[number];
|
|
90
89
|
/**
|
|
91
90
|
* The selector for the element that you would like focus to be returned to when the modal is closed, e.g., #skipToMain
|
|
92
91
|
*/
|
|
@@ -94,11 +93,11 @@ export declare type ModalProps = {
|
|
|
94
93
|
/**
|
|
95
94
|
* The size of the modal; this controls how wide it will appear on the page.
|
|
96
95
|
*/
|
|
97
|
-
size
|
|
96
|
+
size?: typeof sizes[number];
|
|
98
97
|
/**
|
|
99
98
|
* The supporting action configuration for the modal.
|
|
100
99
|
*/
|
|
101
|
-
supportingAction
|
|
100
|
+
supportingAction?: ActionProps;
|
|
102
101
|
};
|
|
103
102
|
|
|
104
103
|
/**
|
|
@@ -136,13 +135,7 @@ export declare const ON_MODAL_OPEN_EVENT = "pie-modal-open";
|
|
|
136
135
|
*/
|
|
137
136
|
export declare const ON_MODAL_SUPPORTING_ACTION_CLICK = "pie-modal-supporting-action-click";
|
|
138
137
|
|
|
139
|
-
export declare const PieModal:
|
|
140
|
-
onPieModalOpen: EventName<CustomEvent<any>>;
|
|
141
|
-
onPieModalClose: EventName<CustomEvent<any>>;
|
|
142
|
-
onPieModalBack: EventName<CustomEvent<any>>;
|
|
143
|
-
onPieModalLeadingActionClick: EventName<CustomEvent<any>>;
|
|
144
|
-
onPieModalSupportingActionClick: EventName<CustomEvent<any>>;
|
|
145
|
-
}>;
|
|
138
|
+
export declare const PieModal: React_2.ForwardRefExoticComponent<ModalProps & React_2.RefAttributes<PieModal_2> & PieModalEvents & ReactBaseType>;
|
|
146
139
|
|
|
147
140
|
/**
|
|
148
141
|
* @tagname pie-modal
|
|
@@ -261,8 +254,18 @@ declare class PieModal_2 extends PieModal_base implements ModalProps {
|
|
|
261
254
|
|
|
262
255
|
declare const PieModal_base: GenericConstructor<RTLInterface> & typeof LitElement;
|
|
263
256
|
|
|
257
|
+
declare type PieModalEvents = {
|
|
258
|
+
onPieModalOpen?: (event: CustomEvent) => void;
|
|
259
|
+
onPieModalClose?: (event: CustomEvent) => void;
|
|
260
|
+
onPieModalBack?: (event: CustomEvent) => void;
|
|
261
|
+
onPieModalLeadingActionClick?: (event: CustomEvent) => void;
|
|
262
|
+
onPieModalSupportingActionClick?: (event: CustomEvent) => void;
|
|
263
|
+
};
|
|
264
|
+
|
|
264
265
|
export declare const positions: readonly ["top", "center"];
|
|
265
266
|
|
|
267
|
+
declare type ReactBaseType = React_2.DialogHTMLAttributes<HTMLDialogElement>;
|
|
268
|
+
|
|
266
269
|
export declare const sizes: readonly ["small", "medium", "large"];
|
|
267
270
|
|
|
268
271
|
export { }
|
package/dist/react.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as o from "react";
|
|
2
2
|
import { createComponent as i } from "@lit/react";
|
|
3
3
|
import { PieModal as e } from "./index.js";
|
|
4
|
-
import { ON_MODAL_BACK_EVENT as
|
|
4
|
+
import { ON_MODAL_BACK_EVENT as A, ON_MODAL_CLOSE_EVENT as L, ON_MODAL_LEADING_ACTION_CLICK as E, ON_MODAL_OPEN_EVENT as g, ON_MODAL_SUPPORTING_ACTION_CLICK as k, headingLevels as D, positions as I, sizes as T } from "./index.js";
|
|
5
5
|
import "lit";
|
|
6
6
|
import "lit/static-html.js";
|
|
7
7
|
import "lit/decorators.js";
|
|
@@ -12,7 +12,7 @@ import "@justeattakeaway/pie-icons-webc/IconClose";
|
|
|
12
12
|
import "@justeattakeaway/pie-icons-webc/IconChevronLeft";
|
|
13
13
|
import "@justeattakeaway/pie-icons-webc/IconChevronRight";
|
|
14
14
|
import "@justeattakeaway/pie-spinner";
|
|
15
|
-
const
|
|
15
|
+
const a = i({
|
|
16
16
|
displayName: "PieModal",
|
|
17
17
|
elementClass: e,
|
|
18
18
|
react: o,
|
|
@@ -29,15 +29,15 @@ const N = i({
|
|
|
29
29
|
onPieModalSupportingActionClick: "pie-modal-supporting-action-click"
|
|
30
30
|
// when the modal supporting action is clicked.
|
|
31
31
|
}
|
|
32
|
-
});
|
|
32
|
+
}), N = a;
|
|
33
33
|
export {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
34
|
+
A as ON_MODAL_BACK_EVENT,
|
|
35
|
+
L as ON_MODAL_CLOSE_EVENT,
|
|
36
|
+
E as ON_MODAL_LEADING_ACTION_CLICK,
|
|
37
|
+
g as ON_MODAL_OPEN_EVENT,
|
|
38
|
+
k as ON_MODAL_SUPPORTING_ACTION_CLICK,
|
|
39
39
|
N as PieModal,
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
40
|
+
D as headingLevels,
|
|
41
|
+
I as positions,
|
|
42
|
+
T as sizes
|
|
43
43
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@justeattakeaway/pie-modal",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.38.1",
|
|
4
4
|
"description": "PIE design system modal built using web components",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -33,8 +33,8 @@
|
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@custom-elements-manifest/analyzer": "0.9.0",
|
|
35
35
|
"@justeat/pie-design-tokens": "5.9.0",
|
|
36
|
-
"@justeattakeaway/pie-components-config": "0.
|
|
37
|
-
"@justeattakeaway/pie-wrapper-react": "0.
|
|
36
|
+
"@justeattakeaway/pie-components-config": "0.9.0",
|
|
37
|
+
"@justeattakeaway/pie-wrapper-react": "0.14.0",
|
|
38
38
|
"@types/body-scroll-lock": "3.1.2",
|
|
39
39
|
"cem-plugin-module-file-extensions": "0.0.5"
|
|
40
40
|
},
|
|
@@ -42,11 +42,11 @@
|
|
|
42
42
|
"extends": "../../../package.json"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@justeattakeaway/pie-button": "0.
|
|
46
|
-
"@justeattakeaway/pie-icon-button": "0.
|
|
47
|
-
"@justeattakeaway/pie-icons-webc": "0.17.
|
|
48
|
-
"@justeattakeaway/pie-spinner": "0.
|
|
49
|
-
"@justeattakeaway/pie-webc-core": "0.
|
|
45
|
+
"@justeattakeaway/pie-button": "0.45.1",
|
|
46
|
+
"@justeattakeaway/pie-icon-button": "0.27.1",
|
|
47
|
+
"@justeattakeaway/pie-icons-webc": "0.17.2",
|
|
48
|
+
"@justeattakeaway/pie-spinner": "0.5.1",
|
|
49
|
+
"@justeattakeaway/pie-webc-core": "0.17.1",
|
|
50
50
|
"body-scroll-lock": "3.1.5",
|
|
51
51
|
"dialog-polyfill": "0.5.6"
|
|
52
52
|
},
|
package/src/defs.ts
CHANGED
|
@@ -36,12 +36,12 @@ export type ModalProps = {
|
|
|
36
36
|
/**
|
|
37
37
|
* When true, the modal will have a back button. This currently behaves the same as the close button.
|
|
38
38
|
*/
|
|
39
|
-
hasBackButton
|
|
39
|
+
hasBackButton?: boolean;
|
|
40
40
|
|
|
41
41
|
/**
|
|
42
42
|
* When true, the modal will have a back button. This currently behaves the same as the close button.
|
|
43
43
|
*/
|
|
44
|
-
hasStackedActions
|
|
44
|
+
hasStackedActions?: boolean;
|
|
45
45
|
|
|
46
46
|
/**
|
|
47
47
|
* The text to display in the modal's heading.
|
|
@@ -51,12 +51,12 @@ export type ModalProps = {
|
|
|
51
51
|
/**
|
|
52
52
|
* The HTML heading tag to use for the modal's heading. Can be h1-h6.
|
|
53
53
|
*/
|
|
54
|
-
headingLevel
|
|
54
|
+
headingLevel?: typeof headingLevels[number];
|
|
55
55
|
|
|
56
56
|
/**
|
|
57
57
|
* When true, the modal will be open.
|
|
58
58
|
*/
|
|
59
|
-
isOpen
|
|
59
|
+
isOpen?: boolean;
|
|
60
60
|
|
|
61
61
|
/**
|
|
62
62
|
* When set to `true`:
|
|
@@ -69,32 +69,32 @@ export type ModalProps = {
|
|
|
69
69
|
* 2. The user can NOT dismiss the modal via the ESCAPE key or clicking the backdrop.
|
|
70
70
|
*
|
|
71
71
|
*/
|
|
72
|
-
isDismissible
|
|
72
|
+
isDismissible?: boolean;
|
|
73
73
|
|
|
74
74
|
/**
|
|
75
75
|
* When false, the modal footer will scroll with the content inside the modal body.
|
|
76
76
|
*/
|
|
77
|
-
isFooterPinned
|
|
77
|
+
isFooterPinned?: boolean;
|
|
78
78
|
|
|
79
79
|
/**
|
|
80
80
|
* This controls whether a *medium-sized* modal will cover the full width of the page when below the mid breakpoint.
|
|
81
81
|
*/
|
|
82
|
-
isFullWidthBelowMid
|
|
82
|
+
isFullWidthBelowMid?: boolean;
|
|
83
83
|
|
|
84
84
|
/**
|
|
85
85
|
* When true, displays a loading spinner in the modal.
|
|
86
86
|
*/
|
|
87
|
-
isLoading
|
|
87
|
+
isLoading?: boolean;
|
|
88
88
|
|
|
89
89
|
/**
|
|
90
90
|
* The leading action configuration for the modal.
|
|
91
91
|
*/
|
|
92
|
-
leadingAction
|
|
92
|
+
leadingAction?: ActionProps;
|
|
93
93
|
|
|
94
94
|
/*
|
|
95
95
|
* The position of the modal; this controls where it will appear on the page.
|
|
96
96
|
*/
|
|
97
|
-
position
|
|
97
|
+
position?: typeof positions[number];
|
|
98
98
|
|
|
99
99
|
/**
|
|
100
100
|
* The selector for the element that you would like focus to be returned to when the modal is closed, e.g., #skipToMain
|
|
@@ -104,12 +104,12 @@ export type ModalProps = {
|
|
|
104
104
|
/**
|
|
105
105
|
* The size of the modal; this controls how wide it will appear on the page.
|
|
106
106
|
*/
|
|
107
|
-
size
|
|
107
|
+
size?: typeof sizes[number];
|
|
108
108
|
|
|
109
109
|
/**
|
|
110
110
|
* The supporting action configuration for the modal.
|
|
111
111
|
*/
|
|
112
|
-
supportingAction
|
|
112
|
+
supportingAction?: ActionProps;
|
|
113
113
|
};
|
|
114
114
|
|
|
115
115
|
/**
|
package/src/index.ts
CHANGED
|
@@ -387,8 +387,8 @@ export class PieModal extends RtlMixin(LitElement) implements ModalProps {
|
|
|
387
387
|
<dialog
|
|
388
388
|
id="dialog"
|
|
389
389
|
class="c-modal"
|
|
390
|
-
size="${size}"
|
|
391
|
-
position="${position}"
|
|
390
|
+
size="${size || 'medium'}"
|
|
391
|
+
position="${position || 'center'}"
|
|
392
392
|
?hasActions=${leadingAction || supportingAction}
|
|
393
393
|
?hasBackButton=${hasBackButton}
|
|
394
394
|
?hasStackedActions=${hasStackedActions}
|
package/src/react.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
|
|
2
1
|
import * as React from 'react';
|
|
3
2
|
import { createComponent, EventName } from '@lit/react';
|
|
4
|
-
import { PieModal as
|
|
3
|
+
import { PieModal as PieModalLit } from './index';
|
|
4
|
+
import { ModalProps } from './defs';
|
|
5
5
|
|
|
6
6
|
export * from './defs';
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
const PieModalReact = createComponent({
|
|
9
9
|
displayName: 'PieModal',
|
|
10
|
-
elementClass:
|
|
10
|
+
elementClass: PieModalLit,
|
|
11
11
|
react: React,
|
|
12
12
|
tagName: 'pie-modal',
|
|
13
13
|
events: {
|
|
@@ -18,3 +18,16 @@ export const PieModal = createComponent({
|
|
|
18
18
|
onPieModalSupportingActionClick: 'pie-modal-supporting-action-click' as EventName<CustomEvent>, // when the modal supporting action is clicked.
|
|
19
19
|
},
|
|
20
20
|
});
|
|
21
|
+
|
|
22
|
+
type ReactBaseType = React.DialogHTMLAttributes<HTMLDialogElement>
|
|
23
|
+
|
|
24
|
+
type PieModalEvents = {
|
|
25
|
+
onPieModalOpen?: (event: CustomEvent) => void;
|
|
26
|
+
onPieModalClose?: (event: CustomEvent) => void;
|
|
27
|
+
onPieModalBack?: (event: CustomEvent) => void;
|
|
28
|
+
onPieModalLeadingActionClick?: (event: CustomEvent) => void;
|
|
29
|
+
onPieModalSupportingActionClick?: (event: CustomEvent) => void;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export const PieModal = PieModalReact as React.ForwardRefExoticComponent<React.PropsWithoutRef<ModalProps>
|
|
33
|
+
& React.RefAttributes<PieModalLit> & PieModalEvents & ReactBaseType>;
|