@khanacademy/wonder-blocks-dropdown 2.4.2 → 2.4.3
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/dist/es/index.js
CHANGED
|
@@ -1420,6 +1420,7 @@ class DropdownCore extends Component {
|
|
|
1420
1420
|
}
|
|
1421
1421
|
},
|
|
1422
1422
|
referenceElement: this.props.openerElement,
|
|
1423
|
+
strategy: "fixed",
|
|
1423
1424
|
placement: alignment === "left" ? "bottom-start" : "bottom-end",
|
|
1424
1425
|
modifiers: [{
|
|
1425
1426
|
name: "preventOverflow",
|
|
@@ -1428,7 +1429,10 @@ class DropdownCore extends Component {
|
|
|
1428
1429
|
// Allows to overlap the popper in case there's
|
|
1429
1430
|
// no more vertical room in the viewport.
|
|
1430
1431
|
altAxis: true,
|
|
1431
|
-
|
|
1432
|
+
// Also needed to make sure the Popper will be
|
|
1433
|
+
// displayed correctly in different contexts
|
|
1434
|
+
// (e.g inside a Modal)
|
|
1435
|
+
tether: false
|
|
1432
1436
|
}
|
|
1433
1437
|
}]
|
|
1434
1438
|
}, ({
|
package/dist/index.js
CHANGED
|
@@ -1414,6 +1414,7 @@ class DropdownCore extends react__WEBPACK_IMPORTED_MODULE_0__["Component"] {
|
|
|
1414
1414
|
}
|
|
1415
1415
|
},
|
|
1416
1416
|
referenceElement: this.props.openerElement,
|
|
1417
|
+
strategy: "fixed",
|
|
1417
1418
|
placement: alignment === "left" ? "bottom-start" : "bottom-end",
|
|
1418
1419
|
modifiers: [{
|
|
1419
1420
|
name: "preventOverflow",
|
|
@@ -1422,7 +1423,10 @@ class DropdownCore extends react__WEBPACK_IMPORTED_MODULE_0__["Component"] {
|
|
|
1422
1423
|
// Allows to overlap the popper in case there's
|
|
1423
1424
|
// no more vertical room in the viewport.
|
|
1424
1425
|
altAxis: true,
|
|
1425
|
-
|
|
1426
|
+
// Also needed to make sure the Popper will be
|
|
1427
|
+
// displayed correctly in different contexts
|
|
1428
|
+
// (e.g inside a Modal)
|
|
1429
|
+
tether: false
|
|
1426
1430
|
}
|
|
1427
1431
|
}]
|
|
1428
1432
|
}, ({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@khanacademy/wonder-blocks-dropdown",
|
|
3
|
-
"version": "2.4.
|
|
3
|
+
"version": "2.4.3",
|
|
4
4
|
"design": "v1",
|
|
5
5
|
"description": "Dropdown variants for Wonder Blocks.",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -41,5 +41,5 @@
|
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"wb-dev-build-settings": "^0.1.2"
|
|
43
43
|
},
|
|
44
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "2a21f4ec19e5611fe716237c21f45c9164b65710"
|
|
45
45
|
}
|
|
@@ -691,6 +691,7 @@ class DropdownCore extends React.Component<Props, State> {
|
|
|
691
691
|
}
|
|
692
692
|
}}
|
|
693
693
|
referenceElement={this.props.openerElement}
|
|
694
|
+
strategy="fixed"
|
|
694
695
|
placement={
|
|
695
696
|
alignment === "left" ? "bottom-start" : "bottom-end"
|
|
696
697
|
}
|
|
@@ -702,7 +703,10 @@ class DropdownCore extends React.Component<Props, State> {
|
|
|
702
703
|
// Allows to overlap the popper in case there's
|
|
703
704
|
// no more vertical room in the viewport.
|
|
704
705
|
altAxis: true,
|
|
705
|
-
|
|
706
|
+
// Also needed to make sure the Popper will be
|
|
707
|
+
// displayed correctly in different contexts
|
|
708
|
+
// (e.g inside a Modal)
|
|
709
|
+
tether: false,
|
|
706
710
|
},
|
|
707
711
|
},
|
|
708
712
|
]}
|
|
@@ -2,8 +2,13 @@
|
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import {StyleSheet} from "aphrodite";
|
|
4
4
|
|
|
5
|
+
import Button from "@khanacademy/wonder-blocks-button";
|
|
5
6
|
import {View} from "@khanacademy/wonder-blocks-core";
|
|
6
7
|
import {SingleSelect, OptionItem} from "@khanacademy/wonder-blocks-dropdown";
|
|
8
|
+
import {Strut} from "@khanacademy/wonder-blocks-layout";
|
|
9
|
+
import {OnePaneDialog, ModalLauncher} from "@khanacademy/wonder-blocks-modal";
|
|
10
|
+
import Spacing from "@khanacademy/wonder-blocks-spacing";
|
|
11
|
+
import {Body} from "@khanacademy/wonder-blocks-typography";
|
|
7
12
|
|
|
8
13
|
import type {StoryComponentType} from "@storybook/react";
|
|
9
14
|
|
|
@@ -94,6 +99,9 @@ const styles = StyleSheet.create({
|
|
|
94
99
|
justifyContent: "center",
|
|
95
100
|
height: `calc(100vh - 16px)`,
|
|
96
101
|
},
|
|
102
|
+
scrollableArea: {
|
|
103
|
+
height: "200vh",
|
|
104
|
+
},
|
|
97
105
|
});
|
|
98
106
|
|
|
99
107
|
export const WithFilter: StoryComponentType = () => <SingleSelectWithFilter />;
|
|
@@ -111,13 +119,21 @@ export const WithFilterOpened: StoryComponentType = () => (
|
|
|
111
119
|
<SingleSelectWithFilter opened={true} />
|
|
112
120
|
);
|
|
113
121
|
|
|
114
|
-
export const
|
|
122
|
+
export const DropdownInModal: StoryComponentType = () => {
|
|
115
123
|
const [value, setValue] = React.useState(null);
|
|
116
124
|
const [opened, setOpened] = React.useState(true);
|
|
117
125
|
|
|
118
|
-
|
|
119
|
-
<View style={styles.
|
|
126
|
+
const modalContent = (
|
|
127
|
+
<View style={styles.scrollableArea}>
|
|
120
128
|
<View>
|
|
129
|
+
<Body>
|
|
130
|
+
Sometimes we want to include Dropdowns inside a Modal, and
|
|
131
|
+
these controls can be accessed only by scrolling down. This
|
|
132
|
+
example help us to demonstrate that SingleSelect components
|
|
133
|
+
can correctly be displayed within the visible scrolling
|
|
134
|
+
area.
|
|
135
|
+
</Body>
|
|
136
|
+
<Strut size={Spacing.large_24} />
|
|
121
137
|
<SingleSelect
|
|
122
138
|
onChange={(selected) => setValue(selected)}
|
|
123
139
|
isFilterable={true}
|
|
@@ -131,13 +147,29 @@ export const DropdownOverlap: StoryComponentType = () => {
|
|
|
131
147
|
</View>
|
|
132
148
|
</View>
|
|
133
149
|
);
|
|
150
|
+
|
|
151
|
+
const modal = (
|
|
152
|
+
<OnePaneDialog title="Dropdown in a Modal" content={modalContent} />
|
|
153
|
+
);
|
|
154
|
+
|
|
155
|
+
return (
|
|
156
|
+
<View style={styles.centered}>
|
|
157
|
+
<ModalLauncher modal={modal}>
|
|
158
|
+
{({openModal}) => (
|
|
159
|
+
<Button onClick={openModal}>Click here!</Button>
|
|
160
|
+
)}
|
|
161
|
+
</ModalLauncher>
|
|
162
|
+
</View>
|
|
163
|
+
);
|
|
134
164
|
};
|
|
135
165
|
|
|
136
|
-
|
|
137
|
-
name: "Dropdown
|
|
166
|
+
DropdownInModal.story = {
|
|
167
|
+
name: "Dropdown in a modal",
|
|
138
168
|
parameters: {
|
|
139
169
|
chromatic: {
|
|
140
|
-
|
|
170
|
+
// We don't need screenshots because this story can be tested after
|
|
171
|
+
// the modal is opened.
|
|
172
|
+
disable: true,
|
|
141
173
|
},
|
|
142
174
|
},
|
|
143
175
|
};
|