@khanacademy/perseus 7.2.0 → 7.2.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 +12 -0
- package/dist/es/index.css +61 -61
- package/dist/es/index.js +50 -119
- package/dist/es/index.js.map +1 -1
- package/dist/index.css +61 -61
- package/dist/index.js +39 -77
- package/dist/index.js.map +1 -1
- package/dist/widgets/plotter.d.ts +47 -13
- package/dist/widgets/plotter.js.flow +47 -13
- package/package.json +2 -2
- package/src/__tests__/item-renderer.test.tsx +1 -1
- package/src/components/__stories__/image-loader.stories.tsx +1 -0
- package/src/components/graph.tsx +1 -0
- package/src/components/icon.tsx +1 -0
- package/src/components/image-loader.tsx +1 -0
- package/src/components/number-input.tsx +1 -0
- package/src/components/sortable.tsx +1 -0
- package/src/components/svg-image.tsx +1 -0
- package/src/components/tex-buttons.tsx +1 -0
- package/src/components/text-input.tsx +1 -0
- package/src/components/text-list-editor.tsx +1 -0
- package/src/components/zoomable.tsx +1 -0
- package/src/hints-renderer.tsx +1 -0
- package/src/index.ts +1 -0
- package/src/item-renderer.tsx +1 -0
- package/src/mixins/provide-keypad.tsx +1 -0
- package/src/multi-items/multi-renderer.tsx +1 -0
- package/src/renderer.tsx +1 -0
- package/src/server-item-renderer.tsx +1 -0
- package/src/styles/articles.less +8 -4
- package/src/styles/perseus-renderer.less +47 -38
- package/src/styles/util.less +1 -1
- package/src/styles/variables.boostrap.less +158 -182
- package/src/styles/variables.less +20 -20
- package/src/styles/variables.shared.less +162 -168
- package/src/styles/widgets/categorizer.less +1 -2
- package/src/styles/widgets/expression.less +7 -4
- package/src/styles/widgets/grapher.less +2 -1
- package/src/styles/widgets/image.less +3 -2
- package/src/styles/widgets/interactive-graph.less +4 -2
- package/src/styles/widgets/label-image.less +2 -1
- package/src/styles/widgets/matrix.less +11 -7
- package/src/styles/widgets/orderer.less +2 -1
- package/src/styles/widgets/passage.less +2 -1
- package/src/styles/widgets/plotter.less +4 -3
- package/src/styles/widgets/radio.less +4 -2
- package/src/styles/widgets/sortable.less +1 -1
- package/src/styles/widgets/table.less +2 -1
- package/src/styles/widgets/transformer.less +2 -1
- package/src/styles/widgets/unit.less +2 -1
- package/src/widgets/__stories__/plotter.stories.tsx +27 -0
- package/src/widgets/__testdata__/plotter.testdata.ts +36 -0
- package/src/widgets/__tests__/__snapshots__/plotter.test.tsx.snap +863 -0
- package/src/widgets/__tests__/plotter.test.tsx +65 -0
- package/src/widgets/categorizer.tsx +1 -0
- package/src/widgets/graded-group-set.tsx +1 -0
- package/src/widgets/graded-group.tsx +1 -0
- package/src/widgets/interaction.tsx +1 -0
- package/src/widgets/label-image/marker.tsx +1 -0
- package/src/widgets/matcher.tsx +1 -0
- package/src/widgets/orderer.tsx +1 -0
- package/src/widgets/passage-ref-target.tsx +1 -0
- package/src/widgets/plotter.tsx +108 -98
- package/src/widgets/radio/base-radio.tsx +1 -0
- package/src/widgets/radio/choice-icon/choice-icon.tsx +1 -0
- package/src/widgets/sorter.tsx +1 -0
- package/src/widgets/transformer.tsx +1 -0
- package/tsconfig-build.tsbuildinfo +1 -1
|
@@ -7,7 +7,8 @@
|
|
|
7
7
|
position: relative;
|
|
8
8
|
overflow: hidden;
|
|
9
9
|
|
|
10
|
-
> img,
|
|
10
|
+
> img,
|
|
11
|
+
> .unresponsive-svg-image {
|
|
11
12
|
position: absolute;
|
|
12
13
|
// Preserves background image alignment (if image is a graph,
|
|
13
14
|
// it can extend up and to the right to allow for axis labels)
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import {View} from "@khanacademy/wonder-blocks-core";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
|
|
4
|
+
import {RendererWithDebugUI} from "../../../../../testing/renderer-with-debug-ui";
|
|
5
|
+
import {question1} from "../__testdata__/plotter.testdata";
|
|
6
|
+
|
|
7
|
+
import type {PerseusRenderer} from "../../perseus-types";
|
|
8
|
+
|
|
9
|
+
export default {
|
|
10
|
+
title: "Perseus/Widgets/Plotter",
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
type StoryArgs = Record<any, any>;
|
|
14
|
+
|
|
15
|
+
const Template = (props: {question: PerseusRenderer}): React.ReactElement => (
|
|
16
|
+
<View
|
|
17
|
+
style={{
|
|
18
|
+
paddingLeft: 20,
|
|
19
|
+
}}
|
|
20
|
+
>
|
|
21
|
+
<RendererWithDebugUI question={props.question} />
|
|
22
|
+
</View>
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
export const Basic = (args: StoryArgs): React.ReactElement => {
|
|
26
|
+
return <Template question={question1} />;
|
|
27
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type {PerseusRenderer} from "../../perseus-types";
|
|
2
|
+
|
|
3
|
+
export const question1: PerseusRenderer = {
|
|
4
|
+
content:
|
|
5
|
+
"The elementary school principal asked teachers to report the number of students absent in each grade during the past week.\n\n**Create a bar graph to show how many students were absent in each grade.**\n\nSchool grade | Number of absent students \n:- | :-: \n$1^{\\text{st}} \\text{ grade}$ | $15$ \n$2^{\\text{nd}} \\text{ grade}$ |$25$ \n$3^{\\text{rd}} \\text{ grade}$ | $5$ \n$4^{\\text{th}} \\text{ grade}$ | $10$ \n$5^{\\text{th}} \\text{ grade}$ | $10$ \n\n[[☃ plotter 1]]\n\n",
|
|
6
|
+
images: {},
|
|
7
|
+
widgets: {
|
|
8
|
+
// This is the actual problem from the server
|
|
9
|
+
// I don't know why the type is incorrect
|
|
10
|
+
// @ts-expect-error - TS2322
|
|
11
|
+
"plotter 1": {
|
|
12
|
+
alignment: "default",
|
|
13
|
+
graded: true,
|
|
14
|
+
options: {
|
|
15
|
+
categories: [
|
|
16
|
+
"$1^{\\text{st}} \\text{}$",
|
|
17
|
+
"$2^{\\text{nd}} \\text{}$",
|
|
18
|
+
"$3^{\\text{rd}} \\text{}$",
|
|
19
|
+
"$4^{\\text{th}} \\text{}$",
|
|
20
|
+
"$5^{\\text{th}} \\text{}$",
|
|
21
|
+
],
|
|
22
|
+
correct: [15, 25, 5, 10, 10],
|
|
23
|
+
labelInterval: 1,
|
|
24
|
+
labels: ["School grade", "Number of absent students"],
|
|
25
|
+
maxY: 30,
|
|
26
|
+
scaleY: 5,
|
|
27
|
+
snapsPerLine: 1,
|
|
28
|
+
starting: [0, 0, 0, 0, 0],
|
|
29
|
+
type: "bar",
|
|
30
|
+
},
|
|
31
|
+
static: false,
|
|
32
|
+
type: "plotter",
|
|
33
|
+
version: {major: 0, minor: 0},
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
};
|