@khanacademy/perseus 0.3.3 → 0.4.0
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 +31 -0
- package/dist/es/index.js +8247 -5609
- package/dist/es/index.js.map +1 -1
- package/dist/index.js +17900 -15265
- package/dist/index.js.map +1 -1
- package/dist/strings.js +0 -1
- package/package.json +9 -8
- package/src/__tests__/__snapshots__/item-renderer_test.jsx.snap +2 -3
- package/src/__tests__/__snapshots__/server-item-renderer_test.jsx.snap +2 -3
- package/src/__tests__/renderer-api_test.jsx +3 -27
- package/src/components/__stories__/svg-image.stories.jsx +11 -0
- package/src/components/fixed-to-responsive.jsx +1 -0
- package/src/components/highlighting/ui/util.js +2 -2
- package/src/components/input-with-examples.jsx +3 -1
- package/src/components/svg-image.jsx +10 -7
- package/src/components/text-input.jsx +65 -16
- package/src/definition-context.js +59 -0
- package/src/index.js +5 -1
- package/src/interaction-tracker.js +2 -2
- package/src/item-renderer.jsx +1 -1
- package/src/mixins/provide-keypad.jsx +1 -1
- package/src/multi-items/__tests__/__snapshots__/multi-renderer_test.js.snap +438 -523
- package/src/multi-items/__tests__/multi-renderer_test.js +9 -9
- package/src/renderer.jsx +15 -8
- package/src/server-item-renderer.jsx +1 -1
- package/src/types.js +3 -4
- package/src/util/scroll-utils.js +2 -2
- package/src/widgets/__stories__/definition.stories.jsx +44 -0
- package/src/widgets/__tests__/__snapshots__/categorizer_test.jsx.snap +76 -8
- package/src/widgets/__tests__/__snapshots__/graded-group-set-jipt_test.jsx.snap +6 -9
- package/src/widgets/__tests__/__snapshots__/graded-group-set_test.jsx.snap +2 -3
- package/src/widgets/__tests__/__snapshots__/grapher_test.jsx.snap +19 -2
- package/src/widgets/__tests__/__snapshots__/group_test.jsx.snap +338 -390
- package/src/widgets/__tests__/__snapshots__/image_test.jsx.snap +38 -4
- package/src/widgets/__tests__/__snapshots__/interactive-graph_test.jsx.snap +114 -12
- package/src/widgets/__tests__/__snapshots__/matrix_test.jsx.snap +120 -48
- package/src/widgets/__tests__/__snapshots__/numeric-input_test.jsx.snap +8 -12
- package/src/widgets/__tests__/__snapshots__/radio_test.jsx.snap +3615 -4517
- package/src/widgets/__tests__/graded-group-set-jipt_test.jsx +0 -1
- package/src/widgets/__tests__/grapher.cypress.jsx +236 -176
- package/src/widgets/__tests__/group_test.jsx +4 -4
- package/src/widgets/__tests__/interactive-graph.cypress.jsx +371 -291
- package/src/widgets/__tests__/radio_test.jsx +73 -114
- package/src/widgets/definition.jsx +34 -32
- package/src/widgets/interactive-graph.jsx +4 -4
- package/src/widgets/label-image/answer-choices.jsx +1 -1
- package/src/widgets/label-image.jsx +1 -1
- package/src/widgets/molecule/molecule-drawing.jsx +1 -1
- package/src/widgets/numeric-input.jsx +2 -15
- package/src/widgets/radio/base-radio.jsx +1 -1
- package/src/widgets/radio/choice-icon.jsx +11 -10
- package/src/widgets/radio/choice.jsx +164 -396
- package/src/widgets/radio/cross-out-button.jsx +3 -5
- package/src/widgets/radio/option-status.jsx +4 -5
- package/src/widgets/radio/__stories__/cross-out-menu.stories.jsx +0 -59
- package/src/widgets/radio/__stories__/cross-out-tooltip.stories.jsx +0 -59
- package/src/widgets/radio/__stories__/toggleable-radio-button.stories.jsx +0 -28
- package/src/widgets/radio/cross-out-menu-wrapper.jsx +0 -492
- package/src/widgets/radio/cross-out-tooltip.jsx +0 -129
- package/src/widgets/radio/toggleable-radio-button.jsx +0 -133
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// @flow
|
|
2
2
|
/* Component for rendering a letter icon in radio choice */
|
|
3
3
|
|
|
4
|
+
import Color from "@khanacademy/wonder-blocks-color";
|
|
4
5
|
import * as i18n from "@khanacademy/wonder-blocks-i18n";
|
|
5
6
|
import {StyleSheet, css} from "aphrodite";
|
|
6
7
|
import * as React from "react";
|
|
@@ -147,9 +148,7 @@ class LibraryChoiceIcon extends React.Component<{
|
|
|
147
148
|
// Note: kaGreen is not only the default product color,
|
|
148
149
|
// but also the "correctness" color
|
|
149
150
|
const bg =
|
|
150
|
-
showCorrectness && correct
|
|
151
|
-
? styleConstants.kaGreen
|
|
152
|
-
: primaryProductColor;
|
|
151
|
+
showCorrectness && correct ? Color.green : primaryProductColor;
|
|
153
152
|
return {
|
|
154
153
|
color: styleConstants.white,
|
|
155
154
|
backgroundColor: bg,
|
|
@@ -157,8 +156,8 @@ class LibraryChoiceIcon extends React.Component<{
|
|
|
157
156
|
};
|
|
158
157
|
}
|
|
159
158
|
return {
|
|
160
|
-
borderColor:
|
|
161
|
-
color:
|
|
159
|
+
borderColor: Color.offBlack64,
|
|
160
|
+
color: Color.offBlack64,
|
|
162
161
|
};
|
|
163
162
|
}
|
|
164
163
|
|
|
@@ -258,7 +257,6 @@ type ChoiceIconProps = {|
|
|
|
258
257
|
// TODO(amy): if we go this "product" flag route, define this type
|
|
259
258
|
// somewhere shared
|
|
260
259
|
product: "sat" | "library",
|
|
261
|
-
primaryProductColor: string,
|
|
262
260
|
reviewMode: boolean,
|
|
263
261
|
previouslyAnswered: boolean,
|
|
264
262
|
// TODO(mdr): The CrossOutButton needs a transparent-background ChoiceIcon,
|
|
@@ -266,10 +264,13 @@ type ChoiceIconProps = {|
|
|
|
266
264
|
// general case, though? When does the choice container have a
|
|
267
265
|
// non-white background, aside from SAT, which uses a different icon?
|
|
268
266
|
transparentBackground?: boolean,
|
|
267
|
+
|
|
268
|
+
primaryProductColor: string,
|
|
269
269
|
|};
|
|
270
|
+
|
|
270
271
|
class ChoiceIcon extends React.Component<ChoiceIconProps> {
|
|
271
272
|
static defaultProps: {|primaryProductColor: string|} = {
|
|
272
|
-
primaryProductColor:
|
|
273
|
+
primaryProductColor: Color.blue,
|
|
273
274
|
};
|
|
274
275
|
|
|
275
276
|
a11yText(letter: string): string {
|
|
@@ -440,9 +441,9 @@ const styles = StyleSheet.create({
|
|
|
440
441
|
},
|
|
441
442
|
|
|
442
443
|
libraryCircleIncorrectAnswered: {
|
|
443
|
-
backgroundColor:
|
|
444
|
-
borderColor:
|
|
445
|
-
color:
|
|
444
|
+
backgroundColor: Color.red,
|
|
445
|
+
borderColor: Color.red,
|
|
446
|
+
color: Color.white,
|
|
446
447
|
},
|
|
447
448
|
|
|
448
449
|
letter: {
|