@khanacademy/wonder-blocks-popover 2.1.7 → 3.0.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/CHANGELOG.md +26 -0
- package/dist/components/popover-content.d.ts +8 -2
- package/package.json +8 -8
- package/src/components/__tests__/popover-content.typestest.tsx +38 -0
- package/src/components/popover-content.tsx +33 -23
- package/tsconfig-build.tsbuildinfo +1 -1
- package/dist/components/close-button.js.flow +0 -41
- package/dist/components/focus-manager.js.flow +0 -104
- package/dist/components/initial-focus.js.flow +0 -42
- package/dist/components/popover-anchor.js.flow +0 -51
- package/dist/components/popover-content-core.js.flow +0 -73
- package/dist/components/popover-content.js.flow +0 -113
- package/dist/components/popover-context.js.flow +0 -35
- package/dist/components/popover-dialog.js.flow +0 -59
- package/dist/components/popover-event-listener.js.flow +0 -43
- package/dist/components/popover.js.flow +0 -182
- package/dist/index.js.flow +0 -10
- package/dist/util/util.js.flow +0 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,31 @@
|
|
|
1
1
|
# @khanacademy/wonder-blocks-popover
|
|
2
2
|
|
|
3
|
+
## 3.0.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- @khanacademy/wonder-blocks-icon-button@4.1.4
|
|
8
|
+
- @khanacademy/wonder-blocks-modal@4.0.20
|
|
9
|
+
- @khanacademy/wonder-blocks-tooltip@2.1.3
|
|
10
|
+
|
|
11
|
+
## 3.0.0
|
|
12
|
+
|
|
13
|
+
### Major Changes
|
|
14
|
+
|
|
15
|
+
- 674a1e5c: Props are using discriminated union types to prevent invalid combinations of props
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- 674a1e5c: We're no longer building flow types
|
|
20
|
+
- Updated dependencies [674a1e5c]
|
|
21
|
+
- Updated dependencies [674a1e5c]
|
|
22
|
+
- @khanacademy/wonder-blocks-modal@4.0.19
|
|
23
|
+
- @khanacademy/wonder-blocks-core@6.0.0
|
|
24
|
+
- @khanacademy/wonder-blocks-icon-button@4.1.3
|
|
25
|
+
- @khanacademy/wonder-blocks-icon@2.1.1
|
|
26
|
+
- @khanacademy/wonder-blocks-tooltip@2.1.2
|
|
27
|
+
- @khanacademy/wonder-blocks-typography@2.1.3
|
|
28
|
+
|
|
3
29
|
## 2.1.7
|
|
4
30
|
|
|
5
31
|
### Patch Changes
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import type { AriaProps, StyleType } from "@khanacademy/wonder-blocks-core";
|
|
3
3
|
import type { PopoverContextType } from "./popover-context";
|
|
4
|
-
type
|
|
4
|
+
type CommonProps = AriaProps & {
|
|
5
5
|
/**
|
|
6
6
|
* The content to render inside the popover.
|
|
7
7
|
*/
|
|
@@ -37,6 +37,8 @@ type Props = AriaProps & {
|
|
|
37
37
|
* Test ID used for e2e testing.
|
|
38
38
|
*/
|
|
39
39
|
testId?: string;
|
|
40
|
+
};
|
|
41
|
+
type Props = (CommonProps & {
|
|
40
42
|
/**
|
|
41
43
|
* Decorate the popover with an illustrated icon. It cannot be used at the
|
|
42
44
|
* same time with image.
|
|
@@ -47,13 +49,17 @@ type Props = AriaProps & {
|
|
|
47
49
|
* the same time with icon.
|
|
48
50
|
*/
|
|
49
51
|
image?: React.ReactElement<React.ComponentProps<"img">> | React.ReactElement<React.ComponentProps<"svg">>;
|
|
52
|
+
emphasized?: never;
|
|
53
|
+
}) | (CommonProps & {
|
|
50
54
|
/**
|
|
51
55
|
* When true, changes the popover dialog background to blue; otherwise, the
|
|
52
56
|
* popover dialog background is not modified. It can be used only with
|
|
53
57
|
* Text-only popovers. It cannot be used with icon or image.
|
|
54
58
|
*/
|
|
55
59
|
emphasized?: boolean;
|
|
56
|
-
|
|
60
|
+
icon?: never;
|
|
61
|
+
image?: never;
|
|
62
|
+
});
|
|
57
63
|
type DefaultProps = {
|
|
58
64
|
closeButtonVisible: Props["closeButtonVisible"];
|
|
59
65
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@khanacademy/wonder-blocks-popover",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.1",
|
|
4
4
|
"design": "v1",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -17,13 +17,13 @@
|
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"@babel/runtime": "^7.18.6",
|
|
19
19
|
"@khanacademy/wonder-blocks-color": "^2.0.1",
|
|
20
|
-
"@khanacademy/wonder-blocks-core": "^
|
|
21
|
-
"@khanacademy/wonder-blocks-icon": "^2.1.
|
|
22
|
-
"@khanacademy/wonder-blocks-icon-button": "^4.1.
|
|
23
|
-
"@khanacademy/wonder-blocks-modal": "^4.0.
|
|
20
|
+
"@khanacademy/wonder-blocks-core": "^6.0.0",
|
|
21
|
+
"@khanacademy/wonder-blocks-icon": "^2.1.1",
|
|
22
|
+
"@khanacademy/wonder-blocks-icon-button": "^4.1.4",
|
|
23
|
+
"@khanacademy/wonder-blocks-modal": "^4.0.20",
|
|
24
24
|
"@khanacademy/wonder-blocks-spacing": "^4.0.1",
|
|
25
|
-
"@khanacademy/wonder-blocks-tooltip": "^2.1.
|
|
26
|
-
"@khanacademy/wonder-blocks-typography": "^2.1.
|
|
25
|
+
"@khanacademy/wonder-blocks-tooltip": "^2.1.3",
|
|
26
|
+
"@khanacademy/wonder-blocks-typography": "^2.1.3"
|
|
27
27
|
},
|
|
28
28
|
"peerDependencies": {
|
|
29
29
|
"@popperjs/core": "^2.10.1",
|
|
@@ -33,6 +33,6 @@
|
|
|
33
33
|
"react-popper": "^2.0.0"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"wb-dev-build-settings": "^0.
|
|
36
|
+
"@khanacademy/wb-dev-build-settings": "^1.0.0"
|
|
37
37
|
}
|
|
38
38
|
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
|
|
3
|
+
import PopoverContent from "../popover-content";
|
|
4
|
+
|
|
5
|
+
<PopoverContent title="Title" content="Content" />;
|
|
6
|
+
|
|
7
|
+
<PopoverContent title="Title" content="Content" icon="close" />;
|
|
8
|
+
|
|
9
|
+
<PopoverContent
|
|
10
|
+
title="Title"
|
|
11
|
+
content="Content"
|
|
12
|
+
image={<img src="domokun.jpg" alt="domokun" />}
|
|
13
|
+
/>;
|
|
14
|
+
|
|
15
|
+
<PopoverContent
|
|
16
|
+
title="Title"
|
|
17
|
+
content="Content"
|
|
18
|
+
icon="close"
|
|
19
|
+
image={<img src="domokun.jpg" alt="domokun" />}
|
|
20
|
+
/>;
|
|
21
|
+
|
|
22
|
+
<PopoverContent title="Title" content="Content" emphasized={true} />;
|
|
23
|
+
|
|
24
|
+
// @ts-expect-error `emphasized` cannot be used with `icon`
|
|
25
|
+
<PopoverContent
|
|
26
|
+
title="Title"
|
|
27
|
+
content="Content"
|
|
28
|
+
icon="close"
|
|
29
|
+
emphasized={true}
|
|
30
|
+
/>;
|
|
31
|
+
|
|
32
|
+
// @ts-expect-error `emphasized` cannot be used with `img`
|
|
33
|
+
<PopoverContent
|
|
34
|
+
title="Title"
|
|
35
|
+
content="Content"
|
|
36
|
+
image={<img src="domokun.jpg" alt="domokun" />}
|
|
37
|
+
emphasized={true}
|
|
38
|
+
/>;
|
|
@@ -11,8 +11,7 @@ import type {PopoverContextType} from "./popover-context";
|
|
|
11
11
|
import PopoverContentCore from "./popover-content-core";
|
|
12
12
|
import PopoverContext from "./popover-context";
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
type Props = AriaProps & {
|
|
14
|
+
type CommonProps = AriaProps & {
|
|
16
15
|
/**
|
|
17
16
|
* The content to render inside the popover.
|
|
18
17
|
*/
|
|
@@ -48,29 +47,40 @@ type Props = AriaProps & {
|
|
|
48
47
|
* Test ID used for e2e testing.
|
|
49
48
|
*/
|
|
50
49
|
testId?: string;
|
|
51
|
-
/**
|
|
52
|
-
* Decorate the popover with an illustrated icon. It cannot be used at the
|
|
53
|
-
* same time with image.
|
|
54
|
-
*/
|
|
55
|
-
icon?:
|
|
56
|
-
| string
|
|
57
|
-
| React.ReactElement<React.ComponentProps<"img">>
|
|
58
|
-
| React.ReactElement<React.ComponentProps<"svg">>;
|
|
59
|
-
/**
|
|
60
|
-
* Decorate the popover with a full-bleed illustration. It cannot be used at
|
|
61
|
-
* the same time with icon.
|
|
62
|
-
*/
|
|
63
|
-
image?:
|
|
64
|
-
| React.ReactElement<React.ComponentProps<"img">>
|
|
65
|
-
| React.ReactElement<React.ComponentProps<"svg">>;
|
|
66
|
-
/**
|
|
67
|
-
* When true, changes the popover dialog background to blue; otherwise, the
|
|
68
|
-
* popover dialog background is not modified. It can be used only with
|
|
69
|
-
* Text-only popovers. It cannot be used with icon or image.
|
|
70
|
-
*/
|
|
71
|
-
emphasized?: boolean;
|
|
72
50
|
};
|
|
73
51
|
|
|
52
|
+
type Props =
|
|
53
|
+
| (CommonProps & {
|
|
54
|
+
/**
|
|
55
|
+
* Decorate the popover with an illustrated icon. It cannot be used at the
|
|
56
|
+
* same time with image.
|
|
57
|
+
*/
|
|
58
|
+
icon?:
|
|
59
|
+
| string
|
|
60
|
+
| React.ReactElement<React.ComponentProps<"img">>
|
|
61
|
+
| React.ReactElement<React.ComponentProps<"svg">>;
|
|
62
|
+
/**
|
|
63
|
+
* Decorate the popover with a full-bleed illustration. It cannot be used at
|
|
64
|
+
* the same time with icon.
|
|
65
|
+
*/
|
|
66
|
+
image?:
|
|
67
|
+
| React.ReactElement<React.ComponentProps<"img">>
|
|
68
|
+
| React.ReactElement<React.ComponentProps<"svg">>;
|
|
69
|
+
|
|
70
|
+
emphasized?: never;
|
|
71
|
+
})
|
|
72
|
+
| (CommonProps & {
|
|
73
|
+
/**
|
|
74
|
+
* When true, changes the popover dialog background to blue; otherwise, the
|
|
75
|
+
* popover dialog background is not modified. It can be used only with
|
|
76
|
+
* Text-only popovers. It cannot be used with icon or image.
|
|
77
|
+
*/
|
|
78
|
+
emphasized?: boolean;
|
|
79
|
+
|
|
80
|
+
icon?: never;
|
|
81
|
+
image?: never;
|
|
82
|
+
});
|
|
83
|
+
|
|
74
84
|
type DefaultProps = {
|
|
75
85
|
closeButtonVisible: Props["closeButtonVisible"];
|
|
76
86
|
};
|