@khanacademy/perseus 1.1.0 → 1.1.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 +8 -0
- package/dist/es/index.css +2 -0
- package/dist/es/index.js +33 -29
- package/dist/es/index.js.map +1 -1
- package/dist/index.css +2 -0
- package/dist/index.js +32 -29
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/__stories__/input-with-examples.stories.jsx +1 -0
- package/src/components/input-with-examples.jsx +41 -24
- package/src/components/text-input.jsx +5 -3
- package/src/styles/widgets/matrix.less +2 -0
- package/src/widgets/__stories__/numeric-input.stories.jsx +53 -7
- package/src/widgets/__tests__/__snapshots__/graded-group-set-jipt_test.jsx.snap +15 -6
- package/src/widgets/__tests__/__snapshots__/graded-group-set_test.jsx.snap +5 -2
- package/src/widgets/__tests__/__snapshots__/graded-group_test.jsx.snap +4 -1
- package/src/widgets/__tests__/__snapshots__/group_test.jsx.snap +2 -2
- package/src/widgets/__tests__/__snapshots__/matrix_test.jsx.snap +24 -24
- package/src/widgets/__tests__/__snapshots__/numeric-input_test.jsx.snap +4 -4
- package/src/widgets/graded-group.jsx +5 -1
- package/src/widgets/matrix.jsx +17 -1
- package/src/widgets/numeric-input.jsx +12 -6
package/src/widgets/matrix.jsx
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
// @flow
|
|
4
4
|
import {linterContextDefault} from "@khanacademy/perseus-linter";
|
|
5
5
|
import * as i18n from "@khanacademy/wonder-blocks-i18n";
|
|
6
|
+
import {StyleSheet} from "aphrodite";
|
|
6
7
|
import classNames from "classnames";
|
|
7
8
|
import * as React from "react";
|
|
8
9
|
import ReactDOM from "react-dom";
|
|
@@ -324,8 +325,23 @@ class Matrix extends React.Component<Props, State> {
|
|
|
324
325
|
<NumberInput {...inputProps} />
|
|
325
326
|
);
|
|
326
327
|
} else {
|
|
328
|
+
const updatedProps = {
|
|
329
|
+
...inputProps,
|
|
330
|
+
style: StyleSheet.create({
|
|
331
|
+
// eslint-disable-next-line react-native/no-unused-styles
|
|
332
|
+
input: {
|
|
333
|
+
...inputProps.style,
|
|
334
|
+
display: "inline-block",
|
|
335
|
+
padding: 0,
|
|
336
|
+
backgroundColor: outside
|
|
337
|
+
? "#f3f3f3"
|
|
338
|
+
: "#fff",
|
|
339
|
+
},
|
|
340
|
+
}).input,
|
|
341
|
+
};
|
|
342
|
+
|
|
327
343
|
MatrixInput = (
|
|
328
|
-
<TextInput {...
|
|
344
|
+
<TextInput {...updatedProps} />
|
|
329
345
|
);
|
|
330
346
|
}
|
|
331
347
|
return (
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
import {linterContextDefault} from "@khanacademy/perseus-linter";
|
|
5
5
|
import * as i18n from "@khanacademy/wonder-blocks-i18n";
|
|
6
|
-
import
|
|
6
|
+
import {StyleSheet} from "aphrodite";
|
|
7
7
|
import * as React from "react";
|
|
8
8
|
import _ from "underscore";
|
|
9
9
|
|
|
@@ -419,7 +419,6 @@ export class NumericInput extends React.Component<Props, State> {
|
|
|
419
419
|
const rubric = this.props.reviewModeRubric;
|
|
420
420
|
const answers = this.getAnswerBlurb(rubric);
|
|
421
421
|
const answerBlurb = answers[0];
|
|
422
|
-
const classes = [];
|
|
423
422
|
|
|
424
423
|
let labelText = this.props.labelText;
|
|
425
424
|
if (labelText == null || labelText === "") {
|
|
@@ -449,12 +448,20 @@ export class NumericInput extends React.Component<Props, State> {
|
|
|
449
448
|
);
|
|
450
449
|
}
|
|
451
450
|
|
|
451
|
+
const styles = StyleSheet.create({
|
|
452
|
+
input: {
|
|
453
|
+
textAlign: this.props.rightAlign ? "right" : "left",
|
|
454
|
+
width: this.props.size === "small" ? 40 : 80,
|
|
455
|
+
padding: 0,
|
|
456
|
+
height: "auto",
|
|
457
|
+
},
|
|
458
|
+
});
|
|
459
|
+
|
|
452
460
|
const input = (
|
|
453
461
|
<InputWithExamples
|
|
454
462
|
ref={(ref) => (this.inputRef = ref)}
|
|
455
463
|
value={this.props.currentValue}
|
|
456
464
|
onChange={this.handleChange}
|
|
457
|
-
className={classNames(classes)}
|
|
458
465
|
labelText={labelText}
|
|
459
466
|
type={this._getInputType()}
|
|
460
467
|
examples={this.examples()}
|
|
@@ -463,8 +470,7 @@ export class NumericInput extends React.Component<Props, State> {
|
|
|
463
470
|
onBlur={this._handleBlur}
|
|
464
471
|
id={this.props.widgetId}
|
|
465
472
|
disabled={this.props.apiOptions.readOnly}
|
|
466
|
-
|
|
467
|
-
highlightLint={this.props.highlightLint}
|
|
473
|
+
style={styles.input}
|
|
468
474
|
/>
|
|
469
475
|
);
|
|
470
476
|
|
|
@@ -542,7 +548,7 @@ type RenderProps = {|
|
|
|
542
548
|
name: "integer" | "decimal" | "proper" | "improper" | "mixed" | "pi",
|
|
543
549
|
|}>,
|
|
544
550
|
labelText: string,
|
|
545
|
-
size:
|
|
551
|
+
size: "normal" | "small",
|
|
546
552
|
coefficient: boolean,
|
|
547
553
|
rightAlign?: boolean,
|
|
548
554
|
static: boolean,
|