@khanacademy/wonder-blocks-dropdown 3.0.0 → 3.0.2
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 +32 -0
- package/dist/components/__mocks__/dropdown-core-virtualized.d.ts +1 -1
- package/dist/components/__mocks__/dropdown-core-virtualized.js.flow +3 -4
- package/dist/components/action-item.d.ts +1 -1
- package/dist/components/action-item.js.flow +5 -7
- package/dist/components/action-menu-opener-core.d.ts +1 -1
- package/dist/components/action-menu-opener-core.js.flow +6 -7
- package/dist/components/action-menu.d.ts +1 -1
- package/dist/components/action-menu.js.flow +12 -15
- package/dist/components/check.js.flow +3 -4
- package/dist/components/checkbox.js.flow +3 -4
- package/dist/components/dropdown-core-virtualized-item.d.ts +1 -1
- package/dist/components/dropdown-core-virtualized-item.js.flow +3 -4
- package/dist/components/dropdown-core-virtualized.js.flow +4 -5
- package/dist/components/dropdown-core.js.flow +4 -6
- package/dist/components/dropdown-opener.d.ts +2 -2
- package/dist/components/dropdown-opener.js.flow +10 -12
- package/dist/components/dropdown-popper.d.ts +1 -1
- package/dist/components/dropdown-popper.js.flow +4 -5
- package/dist/components/multi-select.d.ts +1 -1
- package/dist/components/multi-select.js.flow +20 -27
- package/dist/components/option-item.d.ts +1 -1
- package/dist/components/option-item.js.flow +7 -9
- package/dist/components/select-opener.d.ts +1 -1
- package/dist/components/select-opener.js.flow +8 -10
- package/dist/components/separator-item.d.ts +1 -1
- package/dist/components/separator-item.js.flow +4 -5
- package/dist/components/single-select.d.ts +1 -1
- package/dist/components/single-select.js.flow +23 -28
- package/dist/util/constants.js.flow +8 -12
- package/dist/util/types.js.flow +8 -10
- package/package.json +13 -13
- package/src/components/__mocks__/dropdown-core-virtualized.tsx +1 -1
- package/src/components/action-item.tsx +1 -1
- package/src/components/action-menu-opener-core.tsx +1 -1
- package/src/components/action-menu.tsx +1 -1
- package/src/components/dropdown-core-virtualized-item.ts +1 -1
- package/src/components/dropdown-core.tsx +1 -2
- package/src/components/dropdown-opener.tsx +2 -3
- package/src/components/dropdown-popper.tsx +1 -1
- package/src/components/multi-select.tsx +1 -1
- package/src/components/option-item.tsx +1 -1
- package/src/components/select-opener.tsx +1 -1
- package/src/components/separator-item.tsx +1 -1
- package/src/components/single-select.tsx +1 -1
- package/tsconfig.tsbuildinfo +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,37 @@
|
|
|
1
1
|
# @khanacademy/wonder-blocks-dropdown
|
|
2
2
|
|
|
3
|
+
## 3.0.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [21ce20c7]
|
|
8
|
+
- @khanacademy/wonder-blocks-core@5.0.2
|
|
9
|
+
- @khanacademy/wonder-blocks-clickable@3.0.2
|
|
10
|
+
- @khanacademy/wonder-blocks-icon@2.0.2
|
|
11
|
+
- @khanacademy/wonder-blocks-layout@2.0.2
|
|
12
|
+
- @khanacademy/wonder-blocks-modal@4.0.2
|
|
13
|
+
- @khanacademy/wonder-blocks-search-field@2.0.2
|
|
14
|
+
- @khanacademy/wonder-blocks-typography@2.0.2
|
|
15
|
+
|
|
16
|
+
## 3.0.1
|
|
17
|
+
|
|
18
|
+
### Patch Changes
|
|
19
|
+
|
|
20
|
+
- ccb6fe00: Miscellaneous TS type fixes
|
|
21
|
+
- d4c2b18c: Fix a variety of issues with Flow types generated by flowgen
|
|
22
|
+
- Updated dependencies [ccb6fe00]
|
|
23
|
+
- Updated dependencies [d4c2b18c]
|
|
24
|
+
- @khanacademy/wonder-blocks-clickable@3.0.1
|
|
25
|
+
- @khanacademy/wonder-blocks-core@5.0.1
|
|
26
|
+
- @khanacademy/wonder-blocks-icon@2.0.1
|
|
27
|
+
- @khanacademy/wonder-blocks-layout@2.0.1
|
|
28
|
+
- @khanacademy/wonder-blocks-modal@4.0.1
|
|
29
|
+
- @khanacademy/wonder-blocks-timing@3.0.1
|
|
30
|
+
- @khanacademy/wonder-blocks-typography@2.0.1
|
|
31
|
+
- @khanacademy/wonder-blocks-color@2.0.1
|
|
32
|
+
- @khanacademy/wonder-blocks-search-field@2.0.1
|
|
33
|
+
- @khanacademy/wonder-blocks-spacing@4.0.1
|
|
34
|
+
|
|
3
35
|
## 3.0.0
|
|
4
36
|
|
|
5
37
|
### Major Changes
|
|
@@ -9,6 +9,6 @@ type Props = {
|
|
|
9
9
|
* A minimal mocked version of the Virtualized implementation
|
|
10
10
|
*/
|
|
11
11
|
declare class DropdownCoreVirtualizedMock extends React.Component<Props> {
|
|
12
|
-
render(): React.
|
|
12
|
+
render(): React.ReactNode;
|
|
13
13
|
}
|
|
14
14
|
export default DropdownCoreVirtualizedMock;
|
|
@@ -8,15 +8,14 @@
|
|
|
8
8
|
import * as React from "react";
|
|
9
9
|
import { VariableSizeList as List } from "react-window";
|
|
10
10
|
import type { DropdownItem } from "../../util/types";
|
|
11
|
-
declare type Props = {
|
|
11
|
+
declare type Props = {|
|
|
12
12
|
data: Array<DropdownItem>,
|
|
13
13
|
listRef?: React.RefObject<List>,
|
|
14
|
-
|
|
15
|
-
};
|
|
14
|
+
|};
|
|
16
15
|
/**
|
|
17
16
|
* A minimal mocked version of the Virtualized implementation
|
|
18
17
|
*/
|
|
19
18
|
declare class DropdownCoreVirtualizedMock extends React.Component<Props> {
|
|
20
|
-
render(): React.
|
|
19
|
+
render(): React.Node;
|
|
21
20
|
}
|
|
22
21
|
declare export default typeof DropdownCoreVirtualizedMock;
|
|
@@ -89,6 +89,6 @@ export default class ActionItem extends React.Component<ActionProps> {
|
|
|
89
89
|
static defaultProps: DefaultProps;
|
|
90
90
|
static __IS_ACTION_ITEM__: boolean;
|
|
91
91
|
renderClickableBehavior(router: any): React.ReactNode;
|
|
92
|
-
render(): React.
|
|
92
|
+
render(): React.ReactNode;
|
|
93
93
|
}
|
|
94
94
|
export {};
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
import * as React from "react";
|
|
9
9
|
import type { StyleType } from "@khanacademy/wonder-blocks-core";
|
|
10
|
-
declare type ActionProps = {
|
|
10
|
+
declare type ActionProps = {|
|
|
11
11
|
/**
|
|
12
12
|
* Display text of the action item.
|
|
13
13
|
*/
|
|
@@ -90,14 +90,12 @@ declare type ActionProps = {
|
|
|
90
90
|
* @ignore
|
|
91
91
|
*/
|
|
92
92
|
style?: StyleType,
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
declare type DefaultProps = {
|
|
93
|
+
|};
|
|
94
|
+
declare type DefaultProps = {|
|
|
96
95
|
disabled: $PropertyType<ActionProps, "disabled">,
|
|
97
96
|
indent: $PropertyType<ActionProps, "indent">,
|
|
98
97
|
role: $PropertyType<ActionProps, "role">,
|
|
99
|
-
|
|
100
|
-
};
|
|
98
|
+
|};
|
|
101
99
|
/**
|
|
102
100
|
* The action item trigger actions, such as navigating to a different page or
|
|
103
101
|
* opening a modal. Supply the href and/or onClick props. Used as a child of
|
|
@@ -108,5 +106,5 @@ declare export default class ActionItem extends React.Component<ActionProps> {
|
|
|
108
106
|
static defaultProps: DefaultProps;
|
|
109
107
|
static __IS_ACTION_ITEM__: boolean;
|
|
110
108
|
renderClickableBehavior(router: any): React.Node;
|
|
111
|
-
render(): React.
|
|
109
|
+
render(): React.Node;
|
|
112
110
|
}
|
|
@@ -26,6 +26,6 @@ type Props = Partial<Omit<AriaProps, "aria-disabled">> & ClickableState & {
|
|
|
26
26
|
* - the down caret icon is smaller that the one that would be used by ButtonCore
|
|
27
27
|
*/
|
|
28
28
|
export default class ActionMenuOpenerCore extends React.Component<Props> {
|
|
29
|
-
render(): React.
|
|
29
|
+
render(): React.ReactNode;
|
|
30
30
|
}
|
|
31
31
|
export {};
|
|
@@ -8,10 +8,10 @@
|
|
|
8
8
|
import * as React from "react";
|
|
9
9
|
import type { AriaProps } from "@khanacademy/wonder-blocks-core";
|
|
10
10
|
import type { ClickableState } from "@khanacademy/wonder-blocks-clickable";
|
|
11
|
-
declare type Props = {
|
|
12
|
-
...$Rest<$Diff<AriaProps, { "aria-disabled": any }>, {
|
|
11
|
+
declare type Props = {|
|
|
12
|
+
...$Rest<$Diff<AriaProps, { "aria-disabled": any }>, {}>,
|
|
13
13
|
...ClickableState,
|
|
14
|
-
...{
|
|
14
|
+
...{|
|
|
15
15
|
/**
|
|
16
16
|
* Display text for the opener.
|
|
17
17
|
*/
|
|
@@ -31,9 +31,8 @@ declare type Props = {
|
|
|
31
31
|
* Whether the dropdown is open.
|
|
32
32
|
*/
|
|
33
33
|
opened: boolean,
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
};
|
|
34
|
+
|},
|
|
35
|
+
|};
|
|
37
36
|
/**
|
|
38
37
|
* Although this component shares a lot with ButtonCore there are a couple
|
|
39
38
|
* of differences:
|
|
@@ -43,5 +42,5 @@ declare type Props = {
|
|
|
43
42
|
declare export default class ActionMenuOpenerCore
|
|
44
43
|
extends React.Component<Props>
|
|
45
44
|
{
|
|
46
|
-
render(): React.
|
|
45
|
+
render(): React.Node;
|
|
47
46
|
}
|
|
@@ -104,6 +104,6 @@ export default class ActionMenu extends React.Component<Props, State> {
|
|
|
104
104
|
handleOpenerRef: (node?: any) => void;
|
|
105
105
|
handleClick: (e: React.SyntheticEvent) => void;
|
|
106
106
|
renderOpener(numItems: number): React.ReactElement<React.ComponentProps<typeof DropdownOpener>>;
|
|
107
|
-
render(): React.
|
|
107
|
+
render(): React.ReactNode;
|
|
108
108
|
}
|
|
109
109
|
export {};
|
|
@@ -9,9 +9,9 @@ import * as React from "react";
|
|
|
9
9
|
import type { AriaProps, StyleType } from "@khanacademy/wonder-blocks-core";
|
|
10
10
|
import DropdownOpener from "./dropdown-opener";
|
|
11
11
|
import type { Item, DropdownItem, OpenerProps } from "../util/types";
|
|
12
|
-
declare type Props = {
|
|
12
|
+
declare type Props = {|
|
|
13
13
|
...AriaProps,
|
|
14
|
-
...{
|
|
14
|
+
...{|
|
|
15
15
|
/**
|
|
16
16
|
* The items in this dropdown.
|
|
17
17
|
*/
|
|
@@ -84,21 +84,18 @@ declare type Props = {
|
|
|
84
84
|
* element to access pointer event state.
|
|
85
85
|
*/
|
|
86
86
|
opener?: (openerProps: OpenerProps) => React.Element<any>,
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
declare type State = {
|
|
87
|
+
|},
|
|
88
|
+
|};
|
|
89
|
+
declare type State = {|
|
|
91
90
|
/**
|
|
92
91
|
* Whether or not the dropdown is open.
|
|
93
92
|
*/
|
|
94
93
|
opened: boolean,
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
declare type DefaultProps = {
|
|
94
|
+
|};
|
|
95
|
+
declare type DefaultProps = {|
|
|
98
96
|
alignment: $PropertyType<Props, "alignment">,
|
|
99
97
|
disabled: $PropertyType<Props, "disabled">,
|
|
100
|
-
|
|
101
|
-
};
|
|
98
|
+
|};
|
|
102
99
|
/**
|
|
103
100
|
* A menu that consists of various types of items.
|
|
104
101
|
*
|
|
@@ -125,15 +122,15 @@ declare export default class ActionMenu extends React.Component<Props, State> {
|
|
|
125
122
|
static getDerivedStateFromProps(
|
|
126
123
|
props: Props,
|
|
127
124
|
state: State
|
|
128
|
-
): $Rest<State, {
|
|
125
|
+
): $Rest<State, {}> | null;
|
|
129
126
|
handleItemSelected: () => void;
|
|
130
127
|
handleOpenChanged: (opened: boolean) => void;
|
|
131
128
|
handleOptionSelected: (selectedValue: string) => void;
|
|
132
129
|
getMenuItems(): Array<DropdownItem>;
|
|
133
130
|
handleOpenerRef: (node?: any) => void;
|
|
134
|
-
handleClick: (e:
|
|
131
|
+
handleClick: (e: SyntheticEvent<>) => void;
|
|
135
132
|
renderOpener(
|
|
136
133
|
numItems: number
|
|
137
|
-
): React.Element<React.
|
|
138
|
-
render(): React.
|
|
134
|
+
): React.Element<React.ElementProps<typeof DropdownOpener>>;
|
|
135
|
+
render(): React.Node;
|
|
139
136
|
}
|
|
@@ -11,7 +11,7 @@ import * as React from "react";
|
|
|
11
11
|
* Props describing the state of the OptionItem, shared by the checkbox
|
|
12
12
|
* component,
|
|
13
13
|
*/
|
|
14
|
-
declare type CheckProps = {
|
|
14
|
+
declare type CheckProps = {|
|
|
15
15
|
/**
|
|
16
16
|
* Whether option item is disabled.
|
|
17
17
|
*/
|
|
@@ -36,10 +36,9 @@ declare type CheckProps = {
|
|
|
36
36
|
* Whether option item is focused.
|
|
37
37
|
*/
|
|
38
38
|
focused: boolean,
|
|
39
|
-
|
|
40
|
-
};
|
|
39
|
+
|};
|
|
41
40
|
/**
|
|
42
41
|
* The check component used by OptionItem.
|
|
43
42
|
*/
|
|
44
|
-
declare var Check: React.
|
|
43
|
+
declare var Check: React.StatelessFunctionalComponent<CheckProps>;
|
|
45
44
|
declare export default typeof Check;
|
|
@@ -11,7 +11,7 @@ import * as React from "react";
|
|
|
11
11
|
* Props describing the state of the OptionItem, shared by the check
|
|
12
12
|
* component,
|
|
13
13
|
*/
|
|
14
|
-
declare type CheckProps = {
|
|
14
|
+
declare type CheckProps = {|
|
|
15
15
|
/**
|
|
16
16
|
* Whether option item is disabled.
|
|
17
17
|
*/
|
|
@@ -36,10 +36,9 @@ declare type CheckProps = {
|
|
|
36
36
|
* Whether option item is focused.
|
|
37
37
|
*/
|
|
38
38
|
focused: boolean,
|
|
39
|
-
|
|
40
|
-
};
|
|
39
|
+
|};
|
|
41
40
|
/**
|
|
42
41
|
* The checkbox component used by OptionItem.
|
|
43
42
|
*/
|
|
44
|
-
declare var Checkbox: React.
|
|
43
|
+
declare var Checkbox: React.StatelessFunctionalComponent<CheckProps>;
|
|
45
44
|
declare export default typeof Checkbox;
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
import * as React from "react";
|
|
9
9
|
import type { StyleType } from "@khanacademy/wonder-blocks-core";
|
|
10
10
|
import type { DropdownItem } from "../util/types";
|
|
11
|
-
declare type Props = {
|
|
11
|
+
declare type Props = {|
|
|
12
12
|
/**
|
|
13
13
|
* The complete list of items that will be virtualized.
|
|
14
14
|
*/
|
|
@@ -28,14 +28,13 @@ declare type Props = {
|
|
|
28
28
|
* Custom styles passed from react-window
|
|
29
29
|
*/
|
|
30
30
|
style: StyleType,
|
|
31
|
-
|
|
32
|
-
};
|
|
31
|
+
|};
|
|
33
32
|
/**
|
|
34
33
|
* A virtualized list item - It's created by decorating the DropdownItem
|
|
35
34
|
* (ActionItem, OptionItem, SeparatorItem) with custom styles to let
|
|
36
35
|
* react-window make its own calculations.
|
|
37
36
|
*/
|
|
38
37
|
declare class DropdownVirtualizedItem extends React.Component<Props> {
|
|
39
|
-
render(): React.
|
|
38
|
+
render(): React.Node;
|
|
40
39
|
}
|
|
41
40
|
declare export default typeof DropdownVirtualizedItem;
|
|
@@ -8,13 +8,12 @@
|
|
|
8
8
|
import * as React from "react";
|
|
9
9
|
import { VariableSizeList as List } from "react-window";
|
|
10
10
|
import type { DropdownItem } from "../util/types";
|
|
11
|
-
declare var _default: React.ForwardRefExoticComponent<{
|
|
12
|
-
...{
|
|
11
|
+
declare var _default: React.ForwardRefExoticComponent<{|
|
|
12
|
+
...{|
|
|
13
13
|
width?: number | null | void,
|
|
14
14
|
data: DropdownItem[],
|
|
15
15
|
listRef?: React.RefObject<List<any>> | void,
|
|
16
|
-
|
|
17
|
-
},
|
|
16
|
+
|},
|
|
18
17
|
...React.RefAttributes<mixed>,
|
|
19
|
-
}>;
|
|
18
|
+
|}>;
|
|
20
19
|
declare export default typeof _default;
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
import * as React from "react";
|
|
9
9
|
import type { StyleType } from "@khanacademy/wonder-blocks-core";
|
|
10
10
|
import type { DropdownItem } from "../util/types";
|
|
11
|
-
declare type Labels = {
|
|
11
|
+
declare type Labels = {|
|
|
12
12
|
/**
|
|
13
13
|
* Label for describing the dismiss icon on the search filter.
|
|
14
14
|
*/
|
|
@@ -29,10 +29,9 @@ declare type Labels = {
|
|
|
29
29
|
* These can be all items or only the ones that match the filter.
|
|
30
30
|
*/
|
|
31
31
|
someResults: (numOptions: number) => string,
|
|
32
|
-
|
|
33
|
-
};
|
|
32
|
+
|};
|
|
34
33
|
declare type DropdownAriaRole = "listbox" | "menu";
|
|
35
|
-
declare type ExportProps = {
|
|
34
|
+
declare type ExportProps = {|
|
|
36
35
|
/**
|
|
37
36
|
* Items for the menu.
|
|
38
37
|
*/
|
|
@@ -147,7 +146,6 @@ declare type ExportProps = {
|
|
|
147
146
|
* Used to determine if we can automatically select an item using the keyboard.
|
|
148
147
|
*/
|
|
149
148
|
selectionType?: "single" | "multi",
|
|
150
|
-
|
|
151
|
-
};
|
|
149
|
+
|};
|
|
152
150
|
declare var _default: React.ComponentType<ExportProps>;
|
|
153
151
|
declare export default typeof _default;
|
|
@@ -34,7 +34,7 @@ type DefaultProps = {
|
|
|
34
34
|
declare class DropdownOpener extends React.Component<Props> {
|
|
35
35
|
static defaultProps: DefaultProps;
|
|
36
36
|
getTestIdFromProps: (childrenProps?: any) => string;
|
|
37
|
-
renderAnchorChildren(eventState: ClickableState, clickableChildrenProps: ChildrenProps): React.
|
|
38
|
-
render(): React.
|
|
37
|
+
renderAnchorChildren(eventState: ClickableState, clickableChildrenProps: ChildrenProps): React.ReactElement;
|
|
38
|
+
render(): React.ReactNode;
|
|
39
39
|
}
|
|
40
40
|
export default DropdownOpener;
|
|
@@ -12,9 +12,9 @@ import type {
|
|
|
12
12
|
ClickableState,
|
|
13
13
|
} from "@khanacademy/wonder-blocks-clickable";
|
|
14
14
|
import type { OpenerProps } from "../util/types";
|
|
15
|
-
declare type Props = {
|
|
16
|
-
...$Rest<$Diff<AriaProps, { "aria-disabled": any }>, {
|
|
17
|
-
...{
|
|
15
|
+
declare type Props = {|
|
|
16
|
+
...$Rest<$Diff<AriaProps, { "aria-disabled": any }>, {}>,
|
|
17
|
+
...{|
|
|
18
18
|
/**
|
|
19
19
|
* The child function that returns the anchor the Dropdown will be activated
|
|
20
20
|
* by. This function takes two arguments:
|
|
@@ -32,7 +32,7 @@ declare type Props = {
|
|
|
32
32
|
/**
|
|
33
33
|
* Callback for when the opener is pressed.
|
|
34
34
|
*/
|
|
35
|
-
onClick: (e:
|
|
35
|
+
onClick: (e: SyntheticEvent<>) => mixed,
|
|
36
36
|
|
|
37
37
|
/**
|
|
38
38
|
* Test ID used for e2e testing.
|
|
@@ -43,20 +43,18 @@ declare type Props = {
|
|
|
43
43
|
* Text for the opener that can be passed to the child as an argument.
|
|
44
44
|
*/
|
|
45
45
|
text: string,
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
declare type DefaultProps = {
|
|
46
|
+
|},
|
|
47
|
+
|};
|
|
48
|
+
declare type DefaultProps = {|
|
|
50
49
|
disabled: $PropertyType<Props, "disabled">,
|
|
51
|
-
|
|
52
|
-
};
|
|
50
|
+
|};
|
|
53
51
|
declare class DropdownOpener extends React.Component<Props> {
|
|
54
52
|
static defaultProps: DefaultProps;
|
|
55
53
|
getTestIdFromProps: (childrenProps?: any) => string;
|
|
56
54
|
renderAnchorChildren(
|
|
57
55
|
eventState: ClickableState,
|
|
58
56
|
clickableChildrenProps: ChildrenProps
|
|
59
|
-
): React.
|
|
60
|
-
render(): React.
|
|
57
|
+
): React.Element<any>;
|
|
58
|
+
render(): React.Node;
|
|
61
59
|
}
|
|
62
60
|
declare export default typeof DropdownOpener;
|
|
@@ -4,7 +4,7 @@ type Props = {
|
|
|
4
4
|
/**
|
|
5
5
|
* The children that will be wrapped by PopperJS.
|
|
6
6
|
*/
|
|
7
|
-
children: (isReferenceHidden: boolean) => React.
|
|
7
|
+
children: (isReferenceHidden: boolean) => React.ReactNode;
|
|
8
8
|
/**
|
|
9
9
|
* The reference element used to position the popper.
|
|
10
10
|
*/
|
|
@@ -7,11 +7,11 @@
|
|
|
7
7
|
|
|
8
8
|
import * as React from "react";
|
|
9
9
|
import type { StyleType } from "@khanacademy/wonder-blocks-core";
|
|
10
|
-
declare type Props = {
|
|
10
|
+
declare type Props = {|
|
|
11
11
|
/**
|
|
12
12
|
* The children that will be wrapped by PopperJS.
|
|
13
13
|
*/
|
|
14
|
-
children: (isReferenceHidden: boolean) => React.
|
|
14
|
+
children: (isReferenceHidden: boolean) => React.Node,
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
17
|
* The reference element used to position the popper.
|
|
@@ -34,10 +34,9 @@ declare type Props = {
|
|
|
34
34
|
* Styles that will be applied to the children.
|
|
35
35
|
*/
|
|
36
36
|
style?: StyleType,
|
|
37
|
-
|
|
38
|
-
};
|
|
37
|
+
|};
|
|
39
38
|
/**
|
|
40
39
|
* A wrapper for PopperJS that renders the children inside a portal.
|
|
41
40
|
*/
|
|
42
|
-
declare var DropdownPopper: React.
|
|
41
|
+
declare var DropdownPopper: React.StatelessFunctionalComponent<Props>;
|
|
43
42
|
declare export default typeof DropdownPopper;
|
|
@@ -193,6 +193,6 @@ export default class MultiSelect extends React.Component<Props, State> {
|
|
|
193
193
|
handleSearchTextChanged: (searchText: string) => void;
|
|
194
194
|
handleClick: (e: React.SyntheticEvent) => void;
|
|
195
195
|
renderOpener(allChildren: Array<React.ReactElement<React.ComponentProps<typeof OptionItem>>>): React.ReactElement<React.ComponentProps<typeof DropdownOpener>> | React.ReactElement<React.ComponentProps<typeof SelectOpener>>;
|
|
196
|
-
render(): React.
|
|
196
|
+
render(): React.ReactNode;
|
|
197
197
|
}
|
|
198
198
|
export {};
|
|
@@ -11,7 +11,7 @@ import DropdownOpener from "./dropdown-opener";
|
|
|
11
11
|
import SelectOpener from "./select-opener";
|
|
12
12
|
import OptionItem from "./option-item";
|
|
13
13
|
import type { DropdownItem, OpenerProps } from "../util/types";
|
|
14
|
-
export type Labels = {
|
|
14
|
+
export type Labels = {|
|
|
15
15
|
/**
|
|
16
16
|
* Label for describing the dismiss icon on the search filter.
|
|
17
17
|
*/
|
|
@@ -51,9 +51,8 @@ export type Labels = {
|
|
|
51
51
|
* Label for the opening component when all the items have been selected.
|
|
52
52
|
*/
|
|
53
53
|
allSelected: string,
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
declare type DefaultProps = {
|
|
54
|
+
|};
|
|
55
|
+
declare type DefaultProps = {|
|
|
57
56
|
/**
|
|
58
57
|
* Whether this dropdown should be left-aligned or right-aligned with the
|
|
59
58
|
* opener component. Defaults to left-aligned.
|
|
@@ -81,20 +80,16 @@ declare type DefaultProps = {
|
|
|
81
80
|
* Whether to display shortcuts for Select All and Select None.
|
|
82
81
|
*/
|
|
83
82
|
shortcuts: boolean,
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
declare type Props = {
|
|
83
|
+
|};
|
|
84
|
+
declare type Props = {|
|
|
87
85
|
...AriaProps,
|
|
88
86
|
...DefaultProps,
|
|
89
|
-
...{
|
|
87
|
+
...{|
|
|
90
88
|
/**
|
|
91
89
|
* The items in this select.
|
|
92
90
|
*/
|
|
93
91
|
children?: Array<
|
|
94
|
-
|
|
95
|
-
| false
|
|
96
|
-
| null
|
|
97
|
-
| void
|
|
92
|
+
React.Element<React.ElementProps<typeof OptionItem>> | false | null | void
|
|
98
93
|
>,
|
|
99
94
|
|
|
100
95
|
/**
|
|
@@ -165,10 +160,9 @@ declare type Props = {
|
|
|
165
160
|
* Test ID used for e2e testing.
|
|
166
161
|
*/
|
|
167
162
|
testId?: string,
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
declare type State = {
|
|
163
|
+
|},
|
|
164
|
+
|};
|
|
165
|
+
declare type State = {|
|
|
172
166
|
/**
|
|
173
167
|
* Whether or not the dropdown is open.
|
|
174
168
|
*/
|
|
@@ -197,8 +191,7 @@ declare type State = {
|
|
|
197
191
|
* to this element, and also to pass the reference to Popper.js.
|
|
198
192
|
*/
|
|
199
193
|
openerElement: HTMLElement | null | void,
|
|
200
|
-
|
|
201
|
-
};
|
|
194
|
+
|};
|
|
202
195
|
/**
|
|
203
196
|
* A dropdown that consists of multiple selection items. This select allows
|
|
204
197
|
* multiple options to be selected. Clients are responsible for keeping track
|
|
@@ -230,29 +223,29 @@ declare export default class MultiSelect extends React.Component<Props, State> {
|
|
|
230
223
|
static getDerivedStateFromProps(
|
|
231
224
|
props: Props,
|
|
232
225
|
state: State
|
|
233
|
-
): $Rest<State, {
|
|
226
|
+
): $Rest<State, {}> | null;
|
|
234
227
|
componentDidUpdate(prevProps: Props): void;
|
|
235
228
|
handleOpenChanged: (opened: boolean) => void;
|
|
236
229
|
handleToggle: (selectedValue: string) => void;
|
|
237
230
|
handleSelectAll: () => void;
|
|
238
231
|
handleSelectNone: () => void;
|
|
239
232
|
getMenuText(
|
|
240
|
-
children: Array<React.Element<React.
|
|
233
|
+
children: Array<React.Element<React.ElementProps<typeof OptionItem>>>
|
|
241
234
|
): string;
|
|
242
235
|
getShortcuts(numOptions: number): Array<DropdownItem>;
|
|
243
236
|
getMenuItems(
|
|
244
|
-
children: Array<React.Element<React.
|
|
237
|
+
children: Array<React.Element<React.ElementProps<typeof OptionItem>>>
|
|
245
238
|
): Array<DropdownItem>;
|
|
246
239
|
mapOptionItemToDropdownItem: (
|
|
247
|
-
option: React.Element<React.
|
|
240
|
+
option: React.Element<React.ElementProps<typeof OptionItem>>
|
|
248
241
|
) => DropdownItem;
|
|
249
242
|
handleOpenerRef: (node?: any) => void;
|
|
250
243
|
handleSearchTextChanged: (searchText: string) => void;
|
|
251
|
-
handleClick: (e:
|
|
244
|
+
handleClick: (e: SyntheticEvent<>) => void;
|
|
252
245
|
renderOpener(
|
|
253
|
-
allChildren: Array<React.Element<React.
|
|
246
|
+
allChildren: Array<React.Element<React.ElementProps<typeof OptionItem>>>
|
|
254
247
|
):
|
|
255
|
-
| React.Element<React.
|
|
256
|
-
| React.Element<React.
|
|
257
|
-
render(): React.
|
|
248
|
+
| React.Element<React.ElementProps<typeof DropdownOpener>>
|
|
249
|
+
| React.Element<React.ElementProps<typeof SelectOpener>>;
|
|
250
|
+
render(): React.Node;
|
|
258
251
|
}
|
|
@@ -70,6 +70,6 @@ export default class OptionItem extends React.Component<OptionProps> {
|
|
|
70
70
|
static __IS_OPTION_ITEM__: boolean;
|
|
71
71
|
getCheckComponent(): typeof Check | typeof Checkbox;
|
|
72
72
|
handleClick: () => void;
|
|
73
|
-
render(): React.
|
|
73
|
+
render(): React.ReactNode;
|
|
74
74
|
}
|
|
75
75
|
export {};
|
|
@@ -9,9 +9,9 @@ import * as React from "react";
|
|
|
9
9
|
import type { AriaProps, StyleType } from "@khanacademy/wonder-blocks-core";
|
|
10
10
|
import Check from "./check";
|
|
11
11
|
import Checkbox from "./checkbox";
|
|
12
|
-
declare type OptionProps = {
|
|
12
|
+
declare type OptionProps = {|
|
|
13
13
|
...AriaProps,
|
|
14
|
-
...{
|
|
14
|
+
...{|
|
|
15
15
|
/**
|
|
16
16
|
* Display text of the option item.
|
|
17
17
|
*/
|
|
@@ -70,16 +70,14 @@ declare type OptionProps = {
|
|
|
70
70
|
* @ignore
|
|
71
71
|
*/
|
|
72
72
|
style?: StyleType,
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
declare type DefaultProps = {
|
|
73
|
+
|},
|
|
74
|
+
|};
|
|
75
|
+
declare type DefaultProps = {|
|
|
77
76
|
disabled: $PropertyType<OptionProps, "disabled">,
|
|
78
77
|
onToggle: $PropertyType<OptionProps, "onToggle">,
|
|
79
78
|
role: $PropertyType<OptionProps, "role">,
|
|
80
79
|
selected: $PropertyType<OptionProps, "selected">,
|
|
81
|
-
|
|
82
|
-
};
|
|
80
|
+
|};
|
|
83
81
|
/**
|
|
84
82
|
* For option items that can be selected in a dropdown, selection denoted either
|
|
85
83
|
* with a check ✔️ or a checkbox ☑️. Use as children in SingleSelect or
|
|
@@ -91,5 +89,5 @@ declare export default class OptionItem extends React.Component<OptionProps> {
|
|
|
91
89
|
static __IS_OPTION_ITEM__: boolean;
|
|
92
90
|
getCheckComponent(): typeof Check | typeof Checkbox;
|
|
93
91
|
handleClick: () => void;
|
|
94
|
-
render(): React.
|
|
92
|
+
render(): React.Node;
|
|
95
93
|
}
|
|
@@ -50,6 +50,6 @@ export default class SelectOpener extends React.Component<SelectOpenerProps> {
|
|
|
50
50
|
static defaultProps: DefaultProps;
|
|
51
51
|
handleClick: (e: React.SyntheticEvent) => void;
|
|
52
52
|
renderClickableBehavior(router: any): React.ReactNode;
|
|
53
|
-
render(): React.
|
|
53
|
+
render(): React.ReactNode;
|
|
54
54
|
}
|
|
55
55
|
export {};
|
|
@@ -7,9 +7,9 @@
|
|
|
7
7
|
|
|
8
8
|
import * as React from "react";
|
|
9
9
|
import type { AriaProps } from "@khanacademy/wonder-blocks-core";
|
|
10
|
-
declare type SelectOpenerProps = {
|
|
10
|
+
declare type SelectOpenerProps = {|
|
|
11
11
|
...AriaProps,
|
|
12
|
-
...{
|
|
12
|
+
...{|
|
|
13
13
|
/**
|
|
14
14
|
* Display text in the SelectOpener.
|
|
15
15
|
*/
|
|
@@ -53,15 +53,13 @@ declare type SelectOpenerProps = {
|
|
|
53
53
|
* Whether the dropdown is open.
|
|
54
54
|
*/
|
|
55
55
|
open: boolean,
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
declare type DefaultProps = {
|
|
56
|
+
|},
|
|
57
|
+
|};
|
|
58
|
+
declare type DefaultProps = {|
|
|
60
59
|
disabled: $PropertyType<SelectOpenerProps, "disabled">,
|
|
61
60
|
light: $PropertyType<SelectOpenerProps, "light">,
|
|
62
61
|
isPlaceholder: $PropertyType<SelectOpenerProps, "isPlaceholder">,
|
|
63
|
-
|
|
64
|
-
};
|
|
62
|
+
|};
|
|
65
63
|
/**
|
|
66
64
|
* An opener that opens select boxes.
|
|
67
65
|
*/
|
|
@@ -69,7 +67,7 @@ declare export default class SelectOpener
|
|
|
69
67
|
extends React.Component<SelectOpenerProps>
|
|
70
68
|
{
|
|
71
69
|
static defaultProps: DefaultProps;
|
|
72
|
-
handleClick: (e:
|
|
70
|
+
handleClick: (e: SyntheticEvent<>) => void;
|
|
73
71
|
renderClickableBehavior(router: any): React.Node;
|
|
74
|
-
render(): React.
|
|
72
|
+
render(): React.Node;
|
|
75
73
|
}
|