@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/dist/index.css
CHANGED
|
@@ -2893,10 +2893,12 @@ body.mobile .categorizer-container td.category input[type="radio"] + span:active
|
|
|
2893
2893
|
.perseus-matrix .matrix-bracket.bracket-left {
|
|
2894
2894
|
border-color: #666;
|
|
2895
2895
|
border-left-width: 2px;
|
|
2896
|
+
border-right-width: 0;
|
|
2896
2897
|
left: 3px;
|
|
2897
2898
|
}
|
|
2898
2899
|
.perseus-matrix .matrix-bracket.bracket-right {
|
|
2899
2900
|
border-color: #666;
|
|
2901
|
+
border-left-width: 0;
|
|
2900
2902
|
border-right-width: 2px;
|
|
2901
2903
|
margin-left: -3px;
|
|
2902
2904
|
}
|
package/dist/index.js
CHANGED
|
@@ -21596,13 +21596,15 @@ class TextInput extends React__namespace.Component {
|
|
|
21596
21596
|
onBlur,
|
|
21597
21597
|
disabled,
|
|
21598
21598
|
placeholder,
|
|
21599
|
-
onKeyDown
|
|
21599
|
+
onKeyDown,
|
|
21600
|
+
style
|
|
21600
21601
|
} = this.props;
|
|
21601
21602
|
const formattedValue = value === null ? "" : value.toString();
|
|
21602
21603
|
return (
|
|
21603
21604
|
/*#__PURE__*/
|
|
21604
21605
|
// $FlowIgnore
|
|
21605
21606
|
React__namespace.createElement(wonderBlocksForm.TextField, {
|
|
21607
|
+
style: style,
|
|
21606
21608
|
disabled: disabled,
|
|
21607
21609
|
id: this.id,
|
|
21608
21610
|
value: formattedValue,
|
|
@@ -22000,7 +22002,8 @@ class InputWithExamples extends React__namespace.Component {
|
|
|
22000
22002
|
value: this.props.value,
|
|
22001
22003
|
onFocus: this._handleFocus,
|
|
22002
22004
|
onBlur: this._handleBlur,
|
|
22003
|
-
disabled: this.props.disabled
|
|
22005
|
+
disabled: this.props.disabled,
|
|
22006
|
+
style: this.props.style
|
|
22004
22007
|
};
|
|
22005
22008
|
|
|
22006
22009
|
if (this.props.type === TEX) {
|
|
@@ -22134,32 +22137,14 @@ class InputWithExamples extends React__namespace.Component {
|
|
|
22134
22137
|
|
|
22135
22138
|
}
|
|
22136
22139
|
|
|
22137
|
-
_defineProperty(InputWithExamples, "propTypes", {
|
|
22138
|
-
type: PropTypes__default["default"].oneOf([MATH, TEXT, TEX]),
|
|
22139
|
-
value: PropTypes__default["default"].string,
|
|
22140
|
-
onChange: PropTypes__default["default"].func.isRequired,
|
|
22141
|
-
className: PropTypes__default["default"].string,
|
|
22142
|
-
examples: PropTypes__default["default"].arrayOf(PropTypes__default["default"].string).isRequired,
|
|
22143
|
-
shouldShowExamples: PropTypes__default["default"].bool,
|
|
22144
|
-
convertDotToTimes: PropTypes__default["default"].bool,
|
|
22145
|
-
buttonSet: PropTypes__default["default"].string,
|
|
22146
|
-
buttonsVisible: PropTypes__default["default"].oneOf(["always", "never", "focused"]),
|
|
22147
|
-
labelText: PropTypes__default["default"].string,
|
|
22148
|
-
onFocus: PropTypes__default["default"].func,
|
|
22149
|
-
onBlur: PropTypes__default["default"].func,
|
|
22150
|
-
disabled: PropTypes__default["default"].bool,
|
|
22151
|
-
// A unique string identifying this InputWithExamples
|
|
22152
|
-
id: PropTypes__default["default"].string.isRequired,
|
|
22153
|
-
linterContext: PerseusLinter__namespace.linterContextProps
|
|
22154
|
-
});
|
|
22155
|
-
|
|
22156
22140
|
_defineProperty(InputWithExamples, "defaultProps", {
|
|
22157
22141
|
type: TEXT,
|
|
22158
22142
|
shouldShowExamples: true,
|
|
22159
22143
|
onFocus: function () {},
|
|
22160
22144
|
onBlur: function () {},
|
|
22161
22145
|
disabled: false,
|
|
22162
|
-
linterContext: PerseusLinter__namespace.linterContextDefault
|
|
22146
|
+
linterContext: PerseusLinter__namespace.linterContextDefault,
|
|
22147
|
+
className: ""
|
|
22163
22148
|
});
|
|
22164
22149
|
|
|
22165
22150
|
/**
|
|
@@ -23589,7 +23574,6 @@ class NumericInput extends React__namespace.Component {
|
|
|
23589
23574
|
const rubric = this.props.reviewModeRubric;
|
|
23590
23575
|
const answers = this.getAnswerBlurb(rubric);
|
|
23591
23576
|
const answerBlurb = answers[0];
|
|
23592
|
-
const classes = [];
|
|
23593
23577
|
let labelText = this.props.labelText;
|
|
23594
23578
|
|
|
23595
23579
|
if (labelText == null || labelText === "") {
|
|
@@ -23615,11 +23599,18 @@ class NumericInput extends React__namespace.Component {
|
|
|
23615
23599
|
}));
|
|
23616
23600
|
}
|
|
23617
23601
|
|
|
23602
|
+
const styles = aphrodite.StyleSheet.create({
|
|
23603
|
+
input: {
|
|
23604
|
+
textAlign: this.props.rightAlign ? "right" : "left",
|
|
23605
|
+
width: this.props.size === "small" ? 40 : 80,
|
|
23606
|
+
padding: 0,
|
|
23607
|
+
height: "auto"
|
|
23608
|
+
}
|
|
23609
|
+
});
|
|
23618
23610
|
const input = /*#__PURE__*/React__namespace.createElement(InputWithExamples, {
|
|
23619
23611
|
ref: ref => this.inputRef = ref,
|
|
23620
23612
|
value: this.props.currentValue,
|
|
23621
23613
|
onChange: this.handleChange,
|
|
23622
|
-
className: classNames__default["default"](classes),
|
|
23623
23614
|
labelText: labelText,
|
|
23624
23615
|
type: this._getInputType(),
|
|
23625
23616
|
examples: this.examples(),
|
|
@@ -23627,9 +23618,8 @@ class NumericInput extends React__namespace.Component {
|
|
|
23627
23618
|
onFocus: this._handleFocus,
|
|
23628
23619
|
onBlur: this._handleBlur,
|
|
23629
23620
|
id: this.props.widgetId,
|
|
23630
|
-
disabled: this.props.apiOptions.readOnly
|
|
23631
|
-
|
|
23632
|
-
highlightLint: this.props.highlightLint
|
|
23621
|
+
disabled: this.props.apiOptions.readOnly,
|
|
23622
|
+
style: styles.input
|
|
23633
23623
|
});
|
|
23634
23624
|
/* This only gets used with SAT Content */
|
|
23635
23625
|
|
|
@@ -27273,7 +27263,10 @@ class GradedGroup$1 extends React__namespace.Component {
|
|
|
27273
27263
|
className: aphrodite.css(a11y.srOnly),
|
|
27274
27264
|
role: "alert",
|
|
27275
27265
|
"aria-label": gradeStatus
|
|
27276
|
-
}, gradeStatus), !apiOptions.isMobile && /*#__PURE__*/React__namespace.createElement("p",
|
|
27266
|
+
}, gradeStatus), !apiOptions.isMobile && /*#__PURE__*/React__namespace.createElement("p", {
|
|
27267
|
+
role: "status",
|
|
27268
|
+
"aria-live": "polite"
|
|
27269
|
+
}, this.state.message), !apiOptions.isMobile && /*#__PURE__*/React__namespace.createElement(Button__default["default"], {
|
|
27277
27270
|
kind: "secondary",
|
|
27278
27271
|
disabled: this.props.apiOptions.readOnly,
|
|
27279
27272
|
onClick: this._checkAnswer
|
|
@@ -36637,7 +36630,17 @@ class Matrix extends React__namespace.Component {
|
|
|
36637
36630
|
} else if (this.props.numericInput) {
|
|
36638
36631
|
MatrixInput = /*#__PURE__*/React__namespace.createElement(NumberInput, inputProps);
|
|
36639
36632
|
} else {
|
|
36640
|
-
|
|
36633
|
+
const updatedProps = { ...inputProps,
|
|
36634
|
+
style: aphrodite.StyleSheet.create({
|
|
36635
|
+
// eslint-disable-next-line react-native/no-unused-styles
|
|
36636
|
+
input: { ...inputProps.style,
|
|
36637
|
+
display: "inline-block",
|
|
36638
|
+
padding: 0,
|
|
36639
|
+
backgroundColor: outside ? "#f3f3f3" : "#fff"
|
|
36640
|
+
}
|
|
36641
|
+
}).input
|
|
36642
|
+
};
|
|
36643
|
+
MatrixInput = /*#__PURE__*/React__namespace.createElement(TextInput, updatedProps);
|
|
36641
36644
|
}
|
|
36642
36645
|
|
|
36643
36646
|
return /*#__PURE__*/React__namespace.createElement("span", {
|