@khanacademy/wonder-blocks-layout 1.4.6 → 1.4.7
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 +6 -0
- package/dist/es/index.js +10 -10
- package/package.json +4 -5
- package/src/__tests__/__snapshots__/generated-snapshot.test.js.snap +5 -5
- package/src/components/__tests__/media-layout-context.test.js +1 -0
- package/src/components/__tests__/media-layout.test.js +1 -0
- package/src/components/spring.stories.js +4 -4
- package/src/components/strut.stories.js +4 -4
- package/LICENSE +0 -21
package/CHANGELOG.md
ADDED
package/dist/es/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _extends from '@babel/runtime/helpers/extends';
|
|
2
|
-
import
|
|
2
|
+
import * as React from 'react';
|
|
3
3
|
import Spacing from '@khanacademy/wonder-blocks-spacing';
|
|
4
4
|
import { StyleSheet } from 'aphrodite';
|
|
5
5
|
import { View } from '@khanacademy/wonder-blocks-core';
|
|
@@ -59,7 +59,7 @@ const defaultContext = {
|
|
|
59
59
|
ssrSize: "large",
|
|
60
60
|
mediaSpec: MEDIA_DEFAULT_SPEC
|
|
61
61
|
};
|
|
62
|
-
var MediaLayoutContext = /*#__PURE__*/createContext(defaultContext);
|
|
62
|
+
var MediaLayoutContext = /*#__PURE__*/React.createContext(defaultContext);
|
|
63
63
|
|
|
64
64
|
const queries = [].concat(Object.values(MEDIA_DEFAULT_SPEC).map(spec => spec.query), Object.values(MEDIA_INTERNAL_SPEC).map(spec => spec.query), Object.values(MEDIA_MODAL_SPEC).map(spec => spec.query));
|
|
65
65
|
const mediaQueryLists = {}; // eslint-disable-next-line flowtype/require-exact-type
|
|
@@ -74,7 +74,7 @@ const DEFAULT_SIZE = "large";
|
|
|
74
74
|
* to specify different breakpoint configurations. By default it uses
|
|
75
75
|
* `MEDIA_DEFAULT_SPEC`. See media-layout-context.js for additiional options.
|
|
76
76
|
*/
|
|
77
|
-
class MediaLayoutInternal extends Component {
|
|
77
|
+
class MediaLayoutInternal extends React.Component {
|
|
78
78
|
// A collection of thunks that's used to clean up event listeners
|
|
79
79
|
// when the component is unmounted.
|
|
80
80
|
constructor(props) {
|
|
@@ -217,16 +217,16 @@ class MediaLayoutInternal extends Component {
|
|
|
217
217
|
} // gen-snapshot-tests.js only understands `export default class ...`
|
|
218
218
|
|
|
219
219
|
|
|
220
|
-
class MediaLayout extends Component {
|
|
220
|
+
class MediaLayout extends React.Component {
|
|
221
221
|
render() {
|
|
222
222
|
// We listen to the MediaLayoutContext to see what defaults we're
|
|
223
223
|
// being given (this can be overriden by wrapping this component in
|
|
224
224
|
// a MediaLayoutContext.Consumer).
|
|
225
|
-
return /*#__PURE__*/createElement(MediaLayoutContext.Consumer, null, ({
|
|
225
|
+
return /*#__PURE__*/React.createElement(MediaLayoutContext.Consumer, null, ({
|
|
226
226
|
overrideSize,
|
|
227
227
|
ssrSize,
|
|
228
228
|
mediaSpec
|
|
229
|
-
}) => /*#__PURE__*/createElement(MediaLayoutInternal, _extends({}, this.props, {
|
|
229
|
+
}) => /*#__PURE__*/React.createElement(MediaLayoutInternal, _extends({}, this.props, {
|
|
230
230
|
overrideSize: overrideSize,
|
|
231
231
|
ssrSize: ssrSize,
|
|
232
232
|
mediaSpec: mediaSpec
|
|
@@ -240,12 +240,12 @@ class MediaLayout extends Component {
|
|
|
240
240
|
*
|
|
241
241
|
* Assumes parent is a View.
|
|
242
242
|
*/
|
|
243
|
-
class Spring extends Component {
|
|
243
|
+
class Spring extends React.Component {
|
|
244
244
|
render() {
|
|
245
245
|
const {
|
|
246
246
|
style
|
|
247
247
|
} = this.props;
|
|
248
|
-
return /*#__PURE__*/createElement(View, {
|
|
248
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
249
249
|
"aria-hidden": "true",
|
|
250
250
|
style: [styles.grow, style]
|
|
251
251
|
});
|
|
@@ -263,13 +263,13 @@ const styles = StyleSheet.create({
|
|
|
263
263
|
*
|
|
264
264
|
* Assumes parent is a View.
|
|
265
265
|
*/
|
|
266
|
-
class Strut extends Component {
|
|
266
|
+
class Strut extends React.Component {
|
|
267
267
|
render() {
|
|
268
268
|
const {
|
|
269
269
|
size,
|
|
270
270
|
style
|
|
271
271
|
} = this.props;
|
|
272
|
-
return /*#__PURE__*/createElement(View, {
|
|
272
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
273
273
|
"aria-hidden": "true",
|
|
274
274
|
style: [strutStyle(size), style]
|
|
275
275
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@khanacademy/wonder-blocks-layout",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.7",
|
|
4
4
|
"design": "v1",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -14,17 +14,16 @@
|
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
16
|
"@babel/runtime": "^7.16.3",
|
|
17
|
-
"@khanacademy/wonder-blocks-core": "^4.
|
|
17
|
+
"@khanacademy/wonder-blocks-core": "^4.2.1",
|
|
18
18
|
"@khanacademy/wonder-blocks-spacing": "^3.0.5"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
|
-
"wb-dev-build-settings": "^0.
|
|
21
|
+
"wb-dev-build-settings": "^0.3.0"
|
|
22
22
|
},
|
|
23
23
|
"peerDependencies": {
|
|
24
24
|
"aphrodite": "^1.2.5",
|
|
25
25
|
"react": "16.14.0"
|
|
26
26
|
},
|
|
27
27
|
"author": "",
|
|
28
|
-
"license": "MIT"
|
|
29
|
-
"gitHead": "9ebea88533e702011165072f090a377e02fa3f0f"
|
|
28
|
+
"license": "MIT"
|
|
30
29
|
}
|
|
@@ -22,8 +22,8 @@ exports[`wonder-blocks-layout example 1 1`] = `
|
|
|
22
22
|
}
|
|
23
23
|
>
|
|
24
24
|
<button
|
|
25
|
+
aria-disabled={false}
|
|
25
26
|
className=""
|
|
26
|
-
disabled={false}
|
|
27
27
|
onBlur={[Function]}
|
|
28
28
|
onClick={[Function]}
|
|
29
29
|
onDragStart={[Function]}
|
|
@@ -121,8 +121,8 @@ exports[`wonder-blocks-layout example 1 1`] = `
|
|
|
121
121
|
}
|
|
122
122
|
/>
|
|
123
123
|
<button
|
|
124
|
+
aria-disabled={false}
|
|
124
125
|
className=""
|
|
125
|
-
disabled={false}
|
|
126
126
|
onBlur={[Function]}
|
|
127
127
|
onClick={[Function]}
|
|
128
128
|
onDragStart={[Function]}
|
|
@@ -220,8 +220,8 @@ exports[`wonder-blocks-layout example 1 1`] = `
|
|
|
220
220
|
}
|
|
221
221
|
/>
|
|
222
222
|
<button
|
|
223
|
+
aria-disabled={false}
|
|
223
224
|
className=""
|
|
224
|
-
disabled={false}
|
|
225
225
|
onBlur={[Function]}
|
|
226
226
|
onClick={[Function]}
|
|
227
227
|
onDragStart={[Function]}
|
|
@@ -314,8 +314,8 @@ exports[`wonder-blocks-layout example 1 1`] = `
|
|
|
314
314
|
}
|
|
315
315
|
/>
|
|
316
316
|
<button
|
|
317
|
+
aria-disabled={false}
|
|
317
318
|
className=""
|
|
318
|
-
disabled={false}
|
|
319
319
|
onBlur={[Function]}
|
|
320
320
|
onClick={[Function]}
|
|
321
321
|
onDragStart={[Function]}
|
|
@@ -413,8 +413,8 @@ exports[`wonder-blocks-layout example 1 1`] = `
|
|
|
413
413
|
}
|
|
414
414
|
/>
|
|
415
415
|
<button
|
|
416
|
+
aria-disabled={false}
|
|
416
417
|
className=""
|
|
417
|
-
disabled={false}
|
|
418
418
|
onBlur={[Function]}
|
|
419
419
|
onClick={[Function]}
|
|
420
420
|
onDragStart={[Function]}
|
|
@@ -3,6 +3,7 @@ import * as React from "react";
|
|
|
3
3
|
import {StyleSheet} from "aphrodite";
|
|
4
4
|
import {View} from "@khanacademy/wonder-blocks-core";
|
|
5
5
|
import {mount} from "enzyme";
|
|
6
|
+
import "jest-enzyme";
|
|
6
7
|
|
|
7
8
|
import MediaLayout from "../media-layout.js";
|
|
8
9
|
import {resizeWindow, matchMedia} from "../../util/test-util.js";
|
|
@@ -32,7 +32,7 @@ const styles = StyleSheet.create({
|
|
|
32
32
|
},
|
|
33
33
|
});
|
|
34
34
|
|
|
35
|
-
export const
|
|
35
|
+
export const Simple: StoryComponentType = () => (
|
|
36
36
|
<View style={styles.column}>
|
|
37
37
|
<View style={styles.row}>
|
|
38
38
|
<Button>Hello, world!</Button>
|
|
@@ -48,7 +48,7 @@ export const simple: StoryComponentType = () => (
|
|
|
48
48
|
</View>
|
|
49
49
|
);
|
|
50
50
|
|
|
51
|
-
export const
|
|
51
|
+
export const WithStyle: StoryComponentType = () => (
|
|
52
52
|
<View style={styles.column}>
|
|
53
53
|
<View style={styles.row}>
|
|
54
54
|
<Button>Hello, world!</Button>
|
|
@@ -68,14 +68,14 @@ export const withStyle: StoryComponentType = () => (
|
|
|
68
68
|
</View>
|
|
69
69
|
);
|
|
70
70
|
|
|
71
|
-
|
|
71
|
+
Simple.parameters = {
|
|
72
72
|
chromatic: {
|
|
73
73
|
// we don't need screenshots because this story only tests behavior.
|
|
74
74
|
disableSnapshot: true,
|
|
75
75
|
},
|
|
76
76
|
};
|
|
77
77
|
|
|
78
|
-
|
|
78
|
+
WithStyle.parameters = {
|
|
79
79
|
chromatic: {
|
|
80
80
|
// we don't need screenshots because this story only tests behavior.
|
|
81
81
|
disableSnapshot: true,
|
|
@@ -36,7 +36,7 @@ const styles = StyleSheet.create({
|
|
|
36
36
|
const smallSize = Spacing.medium_16;
|
|
37
37
|
const largeSize = Spacing.xxxLarge_64;
|
|
38
38
|
|
|
39
|
-
export const
|
|
39
|
+
export const Simple: StoryComponentType = () => (
|
|
40
40
|
<View style={styles.column}>
|
|
41
41
|
<View style={styles.row}>
|
|
42
42
|
<Button>Hello, world!</Button>
|
|
@@ -59,7 +59,7 @@ export const simple: StoryComponentType = () => (
|
|
|
59
59
|
</View>
|
|
60
60
|
);
|
|
61
61
|
|
|
62
|
-
export const
|
|
62
|
+
export const WithStyle: StoryComponentType = () => (
|
|
63
63
|
<View style={styles.column}>
|
|
64
64
|
<View style={styles.row}>
|
|
65
65
|
<Button>Hello, world!</Button>
|
|
@@ -83,14 +83,14 @@ export const withStyle: StoryComponentType = () => (
|
|
|
83
83
|
</View>
|
|
84
84
|
);
|
|
85
85
|
|
|
86
|
-
|
|
86
|
+
Simple.parameters = {
|
|
87
87
|
chromatic: {
|
|
88
88
|
// we don't need screenshots because this story only tests behavior.
|
|
89
89
|
disableSnapshot: true,
|
|
90
90
|
},
|
|
91
91
|
};
|
|
92
92
|
|
|
93
|
-
|
|
93
|
+
WithStyle.parameters = {
|
|
94
94
|
chromatic: {
|
|
95
95
|
// we don't need screenshots because this story only tests behavior.
|
|
96
96
|
disableSnapshot: true,
|
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2018 Khan Academy
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|