@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.
Files changed (68) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/es/index.css +61 -61
  3. package/dist/es/index.js +50 -119
  4. package/dist/es/index.js.map +1 -1
  5. package/dist/index.css +61 -61
  6. package/dist/index.js +39 -77
  7. package/dist/index.js.map +1 -1
  8. package/dist/widgets/plotter.d.ts +47 -13
  9. package/dist/widgets/plotter.js.flow +47 -13
  10. package/package.json +2 -2
  11. package/src/__tests__/item-renderer.test.tsx +1 -1
  12. package/src/components/__stories__/image-loader.stories.tsx +1 -0
  13. package/src/components/graph.tsx +1 -0
  14. package/src/components/icon.tsx +1 -0
  15. package/src/components/image-loader.tsx +1 -0
  16. package/src/components/number-input.tsx +1 -0
  17. package/src/components/sortable.tsx +1 -0
  18. package/src/components/svg-image.tsx +1 -0
  19. package/src/components/tex-buttons.tsx +1 -0
  20. package/src/components/text-input.tsx +1 -0
  21. package/src/components/text-list-editor.tsx +1 -0
  22. package/src/components/zoomable.tsx +1 -0
  23. package/src/hints-renderer.tsx +1 -0
  24. package/src/index.ts +1 -0
  25. package/src/item-renderer.tsx +1 -0
  26. package/src/mixins/provide-keypad.tsx +1 -0
  27. package/src/multi-items/multi-renderer.tsx +1 -0
  28. package/src/renderer.tsx +1 -0
  29. package/src/server-item-renderer.tsx +1 -0
  30. package/src/styles/articles.less +8 -4
  31. package/src/styles/perseus-renderer.less +47 -38
  32. package/src/styles/util.less +1 -1
  33. package/src/styles/variables.boostrap.less +158 -182
  34. package/src/styles/variables.less +20 -20
  35. package/src/styles/variables.shared.less +162 -168
  36. package/src/styles/widgets/categorizer.less +1 -2
  37. package/src/styles/widgets/expression.less +7 -4
  38. package/src/styles/widgets/grapher.less +2 -1
  39. package/src/styles/widgets/image.less +3 -2
  40. package/src/styles/widgets/interactive-graph.less +4 -2
  41. package/src/styles/widgets/label-image.less +2 -1
  42. package/src/styles/widgets/matrix.less +11 -7
  43. package/src/styles/widgets/orderer.less +2 -1
  44. package/src/styles/widgets/passage.less +2 -1
  45. package/src/styles/widgets/plotter.less +4 -3
  46. package/src/styles/widgets/radio.less +4 -2
  47. package/src/styles/widgets/sortable.less +1 -1
  48. package/src/styles/widgets/table.less +2 -1
  49. package/src/styles/widgets/transformer.less +2 -1
  50. package/src/styles/widgets/unit.less +2 -1
  51. package/src/widgets/__stories__/plotter.stories.tsx +27 -0
  52. package/src/widgets/__testdata__/plotter.testdata.ts +36 -0
  53. package/src/widgets/__tests__/__snapshots__/plotter.test.tsx.snap +863 -0
  54. package/src/widgets/__tests__/plotter.test.tsx +65 -0
  55. package/src/widgets/categorizer.tsx +1 -0
  56. package/src/widgets/graded-group-set.tsx +1 -0
  57. package/src/widgets/graded-group.tsx +1 -0
  58. package/src/widgets/interaction.tsx +1 -0
  59. package/src/widgets/label-image/marker.tsx +1 -0
  60. package/src/widgets/matcher.tsx +1 -0
  61. package/src/widgets/orderer.tsx +1 -0
  62. package/src/widgets/passage-ref-target.tsx +1 -0
  63. package/src/widgets/plotter.tsx +108 -98
  64. package/src/widgets/radio/base-radio.tsx +1 -0
  65. package/src/widgets/radio/choice-icon/choice-icon.tsx +1 -0
  66. package/src/widgets/sorter.tsx +1 -0
  67. package/src/widgets/transformer.tsx +1 -0
  68. package/tsconfig-build.tsbuildinfo +1 -1
@@ -32,7 +32,7 @@
32
32
  touch-action: none;
33
33
 
34
34
  &.placeholder {
35
- background:#ddd;
35
+ background: #ddd;
36
36
  border: 1px solid #ccc;
37
37
  }
38
38
 
@@ -8,7 +8,8 @@
8
8
  height: 23px;
9
9
  }
10
10
 
11
- th, td {
11
+ th,
12
+ td {
12
13
  border: 2px solid black;
13
14
  border-width: 0 2px;
14
15
 
@@ -7,7 +7,8 @@
7
7
  position: relative;
8
8
  overflow: hidden;
9
9
 
10
- > img, > .unresponsive-svg-image {
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)
@@ -1,4 +1,5 @@
1
- .old-unit-input input, .unit-editor-canonical {
1
+ .old-unit-input input,
2
+ .unit-editor-canonical {
2
3
  border: 1px solid #a4a4a4;
3
4
  border-radius: 5px;
4
5
  // box-sizing: border-box;
@@ -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
+ };