@khanacademy/wonder-blocks-modal 4.0.39 → 4.2.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/CHANGELOG.md +13 -0
- package/dist/components/modal-content.d.ts +8 -9
- package/dist/components/modal-dialog.d.ts +3 -19
- package/dist/components/modal-footer.d.ts +5 -5
- package/dist/components/modal-header.d.ts +6 -7
- package/dist/components/modal-panel.d.ts +13 -14
- package/dist/es/index.js +287 -254
- package/dist/index.js +302 -269
- package/dist/themes/default.d.ts +33 -0
- package/dist/themes/khanmigo.d.ts +36 -0
- package/dist/themes/themed-modal-dialog.d.ts +48 -0
- package/package.json +2 -1
- package/src/components/__tests__/modal-dialog.test.tsx +78 -0
- package/src/components/modal-content.tsx +53 -54
- package/src/components/modal-dialog.tsx +103 -103
- package/src/components/modal-footer.tsx +8 -10
- package/src/components/modal-header.tsx +95 -102
- package/src/components/modal-panel.tsx +66 -73
- package/src/themes/default.ts +36 -0
- package/src/themes/khanmigo.ts +15 -0
- package/src/themes/themed-modal-dialog.tsx +44 -0
- package/tsconfig-build.json +1 -0
- package/tsconfig-build.tsbuildinfo +1 -1
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
declare const theme: {
|
|
2
|
+
color: {
|
|
3
|
+
bg: {
|
|
4
|
+
inverse: string;
|
|
5
|
+
};
|
|
6
|
+
text: {
|
|
7
|
+
inverse: string;
|
|
8
|
+
secondary: string;
|
|
9
|
+
};
|
|
10
|
+
shadow: {
|
|
11
|
+
default: string;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
border: {
|
|
15
|
+
radius: number;
|
|
16
|
+
};
|
|
17
|
+
spacing: {
|
|
18
|
+
dialog: {
|
|
19
|
+
small: 16;
|
|
20
|
+
};
|
|
21
|
+
panel: {
|
|
22
|
+
closeButton: 16;
|
|
23
|
+
footer: 32;
|
|
24
|
+
};
|
|
25
|
+
header: {
|
|
26
|
+
xsmall: 8;
|
|
27
|
+
small: 16;
|
|
28
|
+
medium: 24;
|
|
29
|
+
large: 32;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
export default theme;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The overrides for the Khanmigo theme.
|
|
3
|
+
*/
|
|
4
|
+
declare const theme: {
|
|
5
|
+
color: {
|
|
6
|
+
bg: {
|
|
7
|
+
inverse: string;
|
|
8
|
+
};
|
|
9
|
+
text: {
|
|
10
|
+
inverse: string;
|
|
11
|
+
secondary: string;
|
|
12
|
+
};
|
|
13
|
+
shadow: {
|
|
14
|
+
default: string;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
border: {
|
|
18
|
+
radius: number;
|
|
19
|
+
};
|
|
20
|
+
spacing: {
|
|
21
|
+
dialog: {
|
|
22
|
+
small: 16;
|
|
23
|
+
};
|
|
24
|
+
panel: {
|
|
25
|
+
closeButton: 16;
|
|
26
|
+
footer: 32;
|
|
27
|
+
};
|
|
28
|
+
header: {
|
|
29
|
+
xsmall: 8;
|
|
30
|
+
small: 16;
|
|
31
|
+
medium: 24;
|
|
32
|
+
large: 32;
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
export default theme;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import defaultTheme from "./default";
|
|
3
|
+
type Props = {
|
|
4
|
+
children: React.ReactNode;
|
|
5
|
+
};
|
|
6
|
+
export type ModalDialogThemeContract = typeof defaultTheme;
|
|
7
|
+
/**
|
|
8
|
+
* The context that provides the theme to the ModalDialog component.
|
|
9
|
+
* This is generally consumed via the `useScopedTheme` hook.
|
|
10
|
+
*/
|
|
11
|
+
export declare const ModalDialogThemeContext: React.Context<{
|
|
12
|
+
color: {
|
|
13
|
+
bg: {
|
|
14
|
+
inverse: string;
|
|
15
|
+
};
|
|
16
|
+
text: {
|
|
17
|
+
inverse: string;
|
|
18
|
+
secondary: string;
|
|
19
|
+
};
|
|
20
|
+
shadow: {
|
|
21
|
+
default: string;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
border: {
|
|
25
|
+
radius: number;
|
|
26
|
+
};
|
|
27
|
+
spacing: {
|
|
28
|
+
dialog: {
|
|
29
|
+
small: 16;
|
|
30
|
+
};
|
|
31
|
+
panel: {
|
|
32
|
+
closeButton: 16;
|
|
33
|
+
footer: 32;
|
|
34
|
+
};
|
|
35
|
+
header: {
|
|
36
|
+
xsmall: 8;
|
|
37
|
+
small: 16;
|
|
38
|
+
medium: 24;
|
|
39
|
+
large: 32;
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
}>;
|
|
43
|
+
/**
|
|
44
|
+
* ThemeModalDialog is a component that provides a theme to the <ModalDialog/>
|
|
45
|
+
* component.
|
|
46
|
+
*/
|
|
47
|
+
export default function ThemeModalDialog(props: Props): JSX.Element;
|
|
48
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@khanacademy/wonder-blocks-modal",
|
|
3
|
-
"version": "4.0
|
|
3
|
+
"version": "4.2.0",
|
|
4
4
|
"design": "v2",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
"@khanacademy/wonder-blocks-icon-button": "^5.1.7",
|
|
23
23
|
"@khanacademy/wonder-blocks-layout": "^2.0.25",
|
|
24
24
|
"@khanacademy/wonder-blocks-spacing": "^4.0.1",
|
|
25
|
+
"@khanacademy/wonder-blocks-theming": "^1.2.1",
|
|
25
26
|
"@khanacademy/wonder-blocks-timing": "^4.0.2",
|
|
26
27
|
"@khanacademy/wonder-blocks-typography": "^2.1.10"
|
|
27
28
|
},
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import {render, screen} from "@testing-library/react";
|
|
3
|
+
|
|
4
|
+
import ModalDialog from "../modal-dialog";
|
|
5
|
+
|
|
6
|
+
describe("ModalDialog", () => {
|
|
7
|
+
it("should render its contents", () => {
|
|
8
|
+
// Arrange
|
|
9
|
+
|
|
10
|
+
// Act
|
|
11
|
+
render(
|
|
12
|
+
<ModalDialog>
|
|
13
|
+
<h1>A modal</h1>
|
|
14
|
+
<p>The contents</p>
|
|
15
|
+
</ModalDialog>,
|
|
16
|
+
);
|
|
17
|
+
|
|
18
|
+
// Assert
|
|
19
|
+
expect(screen.getByRole("dialog")).toBeInTheDocument();
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
it("should announce the dialog if aria-labelledby is set", () => {
|
|
23
|
+
// Arrange
|
|
24
|
+
|
|
25
|
+
// Act
|
|
26
|
+
render(
|
|
27
|
+
<ModalDialog aria-labelledby="dialog-title">
|
|
28
|
+
<h1 id="dialog-title">A modal</h1>
|
|
29
|
+
<p>The contents</p>
|
|
30
|
+
</ModalDialog>,
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
// Assert
|
|
34
|
+
expect(
|
|
35
|
+
screen.getByRole("dialog", {name: "A modal"}),
|
|
36
|
+
).toBeInTheDocument();
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
it("should announce the dialog's contents if aria-describedby is set", () => {
|
|
40
|
+
// Arrange
|
|
41
|
+
|
|
42
|
+
// Act
|
|
43
|
+
render(
|
|
44
|
+
<ModalDialog aria-describedby="dialog-body">
|
|
45
|
+
<>
|
|
46
|
+
<h1>A modal</h1>
|
|
47
|
+
<p id="dialog-body">The contents</p>
|
|
48
|
+
</>
|
|
49
|
+
</ModalDialog>,
|
|
50
|
+
);
|
|
51
|
+
|
|
52
|
+
// Assert
|
|
53
|
+
expect(
|
|
54
|
+
screen.getByRole("dialog", {description: "The contents"}),
|
|
55
|
+
).toBeInTheDocument();
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
it("adds testId to the dialog element", () => {
|
|
59
|
+
// Arrange
|
|
60
|
+
|
|
61
|
+
// Act
|
|
62
|
+
render(<ModalDialog testId="test-id">A modal</ModalDialog>);
|
|
63
|
+
|
|
64
|
+
// Assert
|
|
65
|
+
expect(screen.getByTestId("test-id")).toBeInTheDocument();
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
it("forwards the ref to the dialog element", () => {
|
|
69
|
+
// Arrange
|
|
70
|
+
const ref: React.RefObject<HTMLDivElement> = React.createRef();
|
|
71
|
+
|
|
72
|
+
// Act
|
|
73
|
+
render(<ModalDialog ref={ref}>A modal</ModalDialog>);
|
|
74
|
+
|
|
75
|
+
// Assert
|
|
76
|
+
expect(ref.current).toBeInstanceOf(HTMLDivElement);
|
|
77
|
+
});
|
|
78
|
+
});
|
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import {StyleSheet} from "aphrodite";
|
|
3
2
|
import {View} from "@khanacademy/wonder-blocks-core";
|
|
4
|
-
import {MediaLayout} from "@khanacademy/wonder-blocks-layout";
|
|
5
3
|
import Spacing from "@khanacademy/wonder-blocks-spacing";
|
|
6
4
|
|
|
7
5
|
import type {StyleType} from "@khanacademy/wonder-blocks-core";
|
|
6
|
+
import {
|
|
7
|
+
ThemedStylesFn,
|
|
8
|
+
useScopedTheme,
|
|
9
|
+
useStyles,
|
|
10
|
+
} from "@khanacademy/wonder-blocks-theming";
|
|
11
|
+
import {
|
|
12
|
+
ModalDialogThemeContext,
|
|
13
|
+
ModalDialogThemeContract,
|
|
14
|
+
} from "../themes/themed-modal-dialog";
|
|
8
15
|
|
|
9
16
|
type Props = {
|
|
10
17
|
/** Should the content scroll on overflow, or just expand. */
|
|
@@ -15,68 +22,60 @@ type Props = {
|
|
|
15
22
|
style?: StyleType;
|
|
16
23
|
};
|
|
17
24
|
|
|
18
|
-
type DefaultProps = {
|
|
19
|
-
scrollOverflow: Props["scrollOverflow"];
|
|
20
|
-
};
|
|
21
|
-
|
|
22
25
|
/**
|
|
23
26
|
* The Modal content included after the header
|
|
24
27
|
*/
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
static defaultProps: DefaultProps = {
|
|
30
|
-
scrollOverflow: true,
|
|
31
|
-
};
|
|
28
|
+
function ModalContent(props: Props) {
|
|
29
|
+
const {scrollOverflow, style, children} = props;
|
|
30
|
+
const {theme} = useScopedTheme(ModalDialogThemeContext);
|
|
31
|
+
const styles = useStyles(themedStylesFn, theme);
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
return (
|
|
34
|
+
<View style={[styles.wrapper, scrollOverflow && styles.scrollOverflow]}>
|
|
35
|
+
<View style={[styles.content, style]}>{children}</View>
|
|
36
|
+
</View>
|
|
37
|
+
);
|
|
38
|
+
}
|
|
34
39
|
|
|
35
|
-
|
|
36
|
-
const {scrollOverflow, style, children} = this.props;
|
|
40
|
+
ModalContent.__IS_MODAL_CONTENT__ = true;
|
|
37
41
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
<View
|
|
42
|
-
style={[
|
|
43
|
-
styles.wrapper,
|
|
44
|
-
scrollOverflow && styles.scrollOverflow,
|
|
45
|
-
]}
|
|
46
|
-
>
|
|
47
|
-
<View style={[styles.content, style]}>{children}</View>
|
|
48
|
-
</View>
|
|
49
|
-
)}
|
|
50
|
-
</MediaLayout>
|
|
51
|
-
);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
42
|
+
ModalContent.isComponentOf = (instance: any): boolean => {
|
|
43
|
+
return instance && instance.type && instance.type.__IS_MODAL_CONTENT__;
|
|
44
|
+
};
|
|
54
45
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
46
|
+
/**
|
|
47
|
+
* Media query for small screens.
|
|
48
|
+
* TODO(WB-1655): Change this to use the theme instead (inside themedStylesFn).
|
|
49
|
+
* e.g. `[theme.breakpoints.small]: {...}`
|
|
50
|
+
*/
|
|
51
|
+
const small = "@media (max-width: 767px)";
|
|
59
52
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
},
|
|
53
|
+
const themedStylesFn: ThemedStylesFn<ModalDialogThemeContract> = (theme) => ({
|
|
54
|
+
wrapper: {
|
|
55
|
+
flex: 1,
|
|
64
56
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
57
|
+
// This helps to ensure that the paddingBottom is preserved when
|
|
58
|
+
// the contents start to overflow, this goes away on display: flex
|
|
59
|
+
display: "block",
|
|
60
|
+
},
|
|
68
61
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
padding: Spacing.xLarge_32,
|
|
73
|
-
boxSizing: "border-box",
|
|
74
|
-
},
|
|
75
|
-
}),
|
|
62
|
+
scrollOverflow: {
|
|
63
|
+
overflow: "auto",
|
|
64
|
+
},
|
|
76
65
|
|
|
77
|
-
|
|
78
|
-
|
|
66
|
+
content: {
|
|
67
|
+
flex: 1,
|
|
68
|
+
minHeight: "100%",
|
|
69
|
+
padding: Spacing.xLarge_32,
|
|
70
|
+
boxSizing: "border-box",
|
|
71
|
+
[small]: {
|
|
79
72
|
padding: `${Spacing.xLarge_32}px ${Spacing.medium_16}px`,
|
|
80
73
|
},
|
|
81
|
-
}
|
|
82
|
-
}
|
|
74
|
+
},
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
ModalContent.defaultProps = {
|
|
78
|
+
scrollOverflow: true,
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
export default ModalContent;
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import {StyleSheet} from "aphrodite";
|
|
3
|
-
import {
|
|
4
|
-
MediaLayout,
|
|
5
|
-
MediaLayoutContext,
|
|
6
|
-
MEDIA_MODAL_SPEC,
|
|
7
|
-
} from "@khanacademy/wonder-blocks-layout";
|
|
8
2
|
import {View} from "@khanacademy/wonder-blocks-core";
|
|
9
3
|
import type {StyleType} from "@khanacademy/wonder-blocks-core";
|
|
10
|
-
|
|
11
|
-
import
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
ThemedStylesFn,
|
|
7
|
+
useScopedTheme,
|
|
8
|
+
useStyles,
|
|
9
|
+
} from "@khanacademy/wonder-blocks-theming";
|
|
10
|
+
import ThemeModalDialog, {
|
|
11
|
+
ModalDialogThemeContext,
|
|
12
|
+
ModalDialogThemeContract,
|
|
13
|
+
} from "../themes/themed-modal-dialog";
|
|
12
14
|
|
|
13
15
|
type Props = {
|
|
14
16
|
/**
|
|
@@ -42,7 +44,7 @@ type Props = {
|
|
|
42
44
|
*/
|
|
43
45
|
testId?: string;
|
|
44
46
|
/**
|
|
45
|
-
* The ID of the
|
|
47
|
+
* The ID of the title labelling this dialog, if applicable.
|
|
46
48
|
*/
|
|
47
49
|
"aria-labelledby"?: string;
|
|
48
50
|
/**
|
|
@@ -51,10 +53,6 @@ type Props = {
|
|
|
51
53
|
"aria-describedby"?: string;
|
|
52
54
|
};
|
|
53
55
|
|
|
54
|
-
type DefaultProps = {
|
|
55
|
-
role: Props["role"];
|
|
56
|
-
};
|
|
57
|
-
|
|
58
56
|
/**
|
|
59
57
|
* `ModalDialog` is a component that contains these elements:
|
|
60
58
|
* - The visual dialog element itself (`<div role="dialog"/>`)
|
|
@@ -65,102 +63,104 @@ type DefaultProps = {
|
|
|
65
63
|
* - If there is a custom Dialog implementation (e.g. `TwoPaneDialog`), the dialog element doesn’t have to have
|
|
66
64
|
* the `aria-labelledby` attribute however this is recommended. It should match the `id` of the dialog title.
|
|
67
65
|
*/
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
66
|
+
const ModalDialogCore = React.forwardRef(function ModalDialogCore(
|
|
67
|
+
props: Props,
|
|
68
|
+
ref: React.ForwardedRef<HTMLDivElement>,
|
|
69
|
+
) {
|
|
70
|
+
const {
|
|
71
|
+
above,
|
|
72
|
+
below,
|
|
73
|
+
role = "dialog",
|
|
74
|
+
style,
|
|
75
|
+
children,
|
|
76
|
+
testId,
|
|
77
|
+
/* eslint-disable react/prop-types */
|
|
78
|
+
// the react/prop-types plugin does not like these
|
|
79
|
+
"aria-labelledby": ariaLabelledBy,
|
|
80
|
+
"aria-describedby": ariaDescribedBy,
|
|
81
|
+
/* eslint-enable react/prop-types */
|
|
82
|
+
} = props;
|
|
72
83
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
above,
|
|
76
|
-
below,
|
|
77
|
-
role,
|
|
78
|
-
style,
|
|
79
|
-
children,
|
|
80
|
-
testId,
|
|
81
|
-
/* eslint-disable react/prop-types */
|
|
82
|
-
// the react/prop-types plugin does not like these
|
|
83
|
-
"aria-labelledby": ariaLabelledBy,
|
|
84
|
-
"aria-describedby": ariaDescribedBy,
|
|
85
|
-
/* eslint-enable react/prop-types */
|
|
86
|
-
} = this.props;
|
|
84
|
+
const {theme} = useScopedTheme(ModalDialogThemeContext);
|
|
85
|
+
const styles = useStyles(themedStylesFn, theme);
|
|
87
86
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
87
|
+
return (
|
|
88
|
+
<View style={[styles.wrapper, style]}>
|
|
89
|
+
{below && <View style={styles.below}>{below}</View>}
|
|
90
|
+
<View
|
|
91
|
+
role={role}
|
|
92
|
+
aria-modal="true"
|
|
93
|
+
aria-labelledby={ariaLabelledBy}
|
|
94
|
+
aria-describedby={ariaDescribedBy}
|
|
95
|
+
ref={ref}
|
|
96
|
+
style={styles.dialog}
|
|
97
|
+
testId={testId}
|
|
98
|
+
>
|
|
99
|
+
{children}
|
|
100
|
+
</View>
|
|
101
|
+
{above && <View style={styles.above}>{above}</View>}
|
|
102
|
+
</View>
|
|
103
|
+
);
|
|
104
|
+
});
|
|
92
105
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
aria-describedby={ariaDescribedBy}
|
|
104
|
-
style={styles.dialog}
|
|
105
|
-
testId={testId}
|
|
106
|
-
>
|
|
107
|
-
{children}
|
|
108
|
-
</View>
|
|
109
|
-
{above && <View style={styles.above}>{above}</View>}
|
|
110
|
-
</View>
|
|
111
|
-
)}
|
|
112
|
-
</MediaLayout>
|
|
113
|
-
</MediaLayoutContext.Provider>
|
|
114
|
-
);
|
|
115
|
-
}
|
|
116
|
-
}
|
|
106
|
+
const ModalDialog = React.forwardRef(function ModalDialog(
|
|
107
|
+
props: Props,
|
|
108
|
+
ref: React.ForwardedRef<HTMLDivElement>,
|
|
109
|
+
) {
|
|
110
|
+
return (
|
|
111
|
+
<ThemeModalDialog>
|
|
112
|
+
<ModalDialogCore {...props} ref={ref} />
|
|
113
|
+
</ThemeModalDialog>
|
|
114
|
+
);
|
|
115
|
+
});
|
|
117
116
|
|
|
118
|
-
const
|
|
119
|
-
all: StyleSheet.create({
|
|
120
|
-
wrapper: {
|
|
121
|
-
display: "flex",
|
|
122
|
-
flexDirection: "row",
|
|
123
|
-
alignItems: "stretch",
|
|
124
|
-
width: "100%",
|
|
125
|
-
height: "100%",
|
|
126
|
-
position: "relative",
|
|
127
|
-
},
|
|
117
|
+
const small = "@media (max-width: 767px)";
|
|
128
118
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
119
|
+
const themedStylesFn: ThemedStylesFn<ModalDialogThemeContract> = (theme) => ({
|
|
120
|
+
wrapper: {
|
|
121
|
+
display: "flex",
|
|
122
|
+
flexDirection: "row",
|
|
123
|
+
alignItems: "stretch",
|
|
124
|
+
width: "100%",
|
|
125
|
+
height: "100%",
|
|
126
|
+
position: "relative",
|
|
127
|
+
[small]: {
|
|
128
|
+
padding: theme.spacing.dialog.small,
|
|
129
|
+
flexDirection: "column",
|
|
137
130
|
},
|
|
131
|
+
},
|
|
138
132
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
133
|
+
/**
|
|
134
|
+
* Ensures the dialog container uses the container size
|
|
135
|
+
*/
|
|
136
|
+
dialog: {
|
|
137
|
+
width: "100%",
|
|
138
|
+
height: "100%",
|
|
139
|
+
borderRadius: theme.border.radius,
|
|
140
|
+
overflow: "hidden",
|
|
141
|
+
},
|
|
148
142
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
}),
|
|
143
|
+
above: {
|
|
144
|
+
pointerEvents: "none",
|
|
145
|
+
position: "absolute",
|
|
146
|
+
top: 0,
|
|
147
|
+
left: 0,
|
|
148
|
+
bottom: 0,
|
|
149
|
+
right: 0,
|
|
150
|
+
zIndex: 1,
|
|
151
|
+
},
|
|
159
152
|
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
153
|
+
below: {
|
|
154
|
+
pointerEvents: "none",
|
|
155
|
+
position: "absolute",
|
|
156
|
+
top: 0,
|
|
157
|
+
left: 0,
|
|
158
|
+
bottom: 0,
|
|
159
|
+
right: 0,
|
|
160
|
+
zIndex: -1,
|
|
161
|
+
},
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
ModalDialog.displayName = "ModalDialog";
|
|
165
|
+
|
|
166
|
+
export default ModalDialog;
|
|
@@ -25,18 +25,16 @@ type Props = {
|
|
|
25
25
|
* </ModalFooter>
|
|
26
26
|
* ```
|
|
27
27
|
*/
|
|
28
|
-
export default
|
|
29
|
-
|
|
30
|
-
return instance && instance.type && instance.type.__IS_MODAL_FOOTER__;
|
|
31
|
-
}
|
|
32
|
-
static __IS_MODAL_FOOTER__ = true;
|
|
33
|
-
|
|
34
|
-
render(): React.ReactNode {
|
|
35
|
-
const {children} = this.props;
|
|
36
|
-
return <View style={styles.footer}>{children}</View>;
|
|
37
|
-
}
|
|
28
|
+
export default function ModalFooter({children}: Props) {
|
|
29
|
+
return <View style={styles.footer}>{children}</View>;
|
|
38
30
|
}
|
|
39
31
|
|
|
32
|
+
ModalFooter.__IS_MODAL_FOOTER__ = true;
|
|
33
|
+
|
|
34
|
+
ModalFooter.isComponentOf = (instance: any): boolean => {
|
|
35
|
+
return instance && instance.type && instance.type.__IS_MODAL_FOOTER__;
|
|
36
|
+
};
|
|
37
|
+
|
|
40
38
|
const styles = StyleSheet.create({
|
|
41
39
|
footer: {
|
|
42
40
|
flex: "0 0 auto",
|