@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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @khanacademy/perseus
|
|
2
2
|
|
|
3
|
+
## 1.1.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 5b86aba4: bugfix: add size and rightAlign back to numeric-input widget
|
|
8
|
+
- 5b86aba4: bugfix for Matrix styles not getting passed through
|
|
9
|
+
- 6b48ca35: A tiny change that adds some aria labels to our message container so that the content will be read to screen readers upon update.
|
|
10
|
+
|
|
3
11
|
## 1.1.0
|
|
4
12
|
|
|
5
13
|
### Minor Changes
|
package/dist/es/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/es/index.js
CHANGED
|
@@ -21698,13 +21698,15 @@ class TextInput extends React.Component {
|
|
|
21698
21698
|
onBlur,
|
|
21699
21699
|
disabled,
|
|
21700
21700
|
placeholder,
|
|
21701
|
-
onKeyDown
|
|
21701
|
+
onKeyDown,
|
|
21702
|
+
style
|
|
21702
21703
|
} = this.props;
|
|
21703
21704
|
var formattedValue = value === null ? "" : value.toString();
|
|
21704
21705
|
return (
|
|
21705
21706
|
/*#__PURE__*/
|
|
21706
21707
|
// $FlowIgnore
|
|
21707
21708
|
React.createElement(TextField, {
|
|
21709
|
+
style: style,
|
|
21708
21710
|
disabled: disabled,
|
|
21709
21711
|
id: this.id,
|
|
21710
21712
|
value: formattedValue,
|
|
@@ -22102,7 +22104,8 @@ class InputWithExamples extends React.Component {
|
|
|
22102
22104
|
value: this.props.value,
|
|
22103
22105
|
onFocus: this._handleFocus,
|
|
22104
22106
|
onBlur: this._handleBlur,
|
|
22105
|
-
disabled: this.props.disabled
|
|
22107
|
+
disabled: this.props.disabled,
|
|
22108
|
+
style: this.props.style
|
|
22106
22109
|
};
|
|
22107
22110
|
|
|
22108
22111
|
if (this.props.type === TEX) {
|
|
@@ -22236,32 +22239,14 @@ class InputWithExamples extends React.Component {
|
|
|
22236
22239
|
|
|
22237
22240
|
}
|
|
22238
22241
|
|
|
22239
|
-
_defineProperty(InputWithExamples, "propTypes", {
|
|
22240
|
-
type: PropTypes.oneOf([MATH, TEXT, TEX]),
|
|
22241
|
-
value: PropTypes.string,
|
|
22242
|
-
onChange: PropTypes.func.isRequired,
|
|
22243
|
-
className: PropTypes.string,
|
|
22244
|
-
examples: PropTypes.arrayOf(PropTypes.string).isRequired,
|
|
22245
|
-
shouldShowExamples: PropTypes.bool,
|
|
22246
|
-
convertDotToTimes: PropTypes.bool,
|
|
22247
|
-
buttonSet: PropTypes.string,
|
|
22248
|
-
buttonsVisible: PropTypes.oneOf(["always", "never", "focused"]),
|
|
22249
|
-
labelText: PropTypes.string,
|
|
22250
|
-
onFocus: PropTypes.func,
|
|
22251
|
-
onBlur: PropTypes.func,
|
|
22252
|
-
disabled: PropTypes.bool,
|
|
22253
|
-
// A unique string identifying this InputWithExamples
|
|
22254
|
-
id: PropTypes.string.isRequired,
|
|
22255
|
-
linterContext: PerseusLinter.linterContextProps
|
|
22256
|
-
});
|
|
22257
|
-
|
|
22258
22242
|
_defineProperty(InputWithExamples, "defaultProps", {
|
|
22259
22243
|
type: TEXT,
|
|
22260
22244
|
shouldShowExamples: true,
|
|
22261
22245
|
onFocus: function onFocus() {},
|
|
22262
22246
|
onBlur: function onBlur() {},
|
|
22263
22247
|
disabled: false,
|
|
22264
|
-
linterContext: PerseusLinter.linterContextDefault
|
|
22248
|
+
linterContext: PerseusLinter.linterContextDefault,
|
|
22249
|
+
className: ""
|
|
22265
22250
|
});
|
|
22266
22251
|
|
|
22267
22252
|
/**
|
|
@@ -23696,7 +23681,6 @@ class NumericInput extends React.Component {
|
|
|
23696
23681
|
var rubric = this.props.reviewModeRubric;
|
|
23697
23682
|
var answers = this.getAnswerBlurb(rubric);
|
|
23698
23683
|
var answerBlurb = answers[0];
|
|
23699
|
-
var classes = [];
|
|
23700
23684
|
var labelText = this.props.labelText;
|
|
23701
23685
|
|
|
23702
23686
|
if (labelText == null || labelText === "") {
|
|
@@ -23722,11 +23706,18 @@ class NumericInput extends React.Component {
|
|
|
23722
23706
|
}));
|
|
23723
23707
|
}
|
|
23724
23708
|
|
|
23709
|
+
var styles = StyleSheet.create({
|
|
23710
|
+
input: {
|
|
23711
|
+
textAlign: this.props.rightAlign ? "right" : "left",
|
|
23712
|
+
width: this.props.size === "small" ? 40 : 80,
|
|
23713
|
+
padding: 0,
|
|
23714
|
+
height: "auto"
|
|
23715
|
+
}
|
|
23716
|
+
});
|
|
23725
23717
|
var input = /*#__PURE__*/React.createElement(InputWithExamples, {
|
|
23726
23718
|
ref: _ref2 => this.inputRef = _ref2,
|
|
23727
23719
|
value: this.props.currentValue,
|
|
23728
23720
|
onChange: this.handleChange,
|
|
23729
|
-
className: classNames(classes),
|
|
23730
23721
|
labelText: labelText,
|
|
23731
23722
|
type: this._getInputType(),
|
|
23732
23723
|
examples: this.examples(),
|
|
@@ -23734,9 +23725,8 @@ class NumericInput extends React.Component {
|
|
|
23734
23725
|
onFocus: this._handleFocus,
|
|
23735
23726
|
onBlur: this._handleBlur,
|
|
23736
23727
|
id: this.props.widgetId,
|
|
23737
|
-
disabled: this.props.apiOptions.readOnly
|
|
23738
|
-
|
|
23739
|
-
highlightLint: this.props.highlightLint
|
|
23728
|
+
disabled: this.props.apiOptions.readOnly,
|
|
23729
|
+
style: styles.input
|
|
23740
23730
|
});
|
|
23741
23731
|
/* This only gets used with SAT Content */
|
|
23742
23732
|
|
|
@@ -27386,7 +27376,10 @@ class GradedGroup$1 extends React.Component {
|
|
|
27386
27376
|
className: css(a11y.srOnly),
|
|
27387
27377
|
role: "alert",
|
|
27388
27378
|
"aria-label": gradeStatus
|
|
27389
|
-
}, gradeStatus), !apiOptions.isMobile && /*#__PURE__*/React.createElement("p",
|
|
27379
|
+
}, gradeStatus), !apiOptions.isMobile && /*#__PURE__*/React.createElement("p", {
|
|
27380
|
+
role: "status",
|
|
27381
|
+
"aria-live": "polite"
|
|
27382
|
+
}, this.state.message), !apiOptions.isMobile && /*#__PURE__*/React.createElement(Button, {
|
|
27390
27383
|
kind: "secondary",
|
|
27391
27384
|
disabled: this.props.apiOptions.readOnly,
|
|
27392
27385
|
onClick: this._checkAnswer
|
|
@@ -36776,7 +36769,18 @@ class Matrix extends React.Component {
|
|
|
36776
36769
|
} else if (this.props.numericInput) {
|
|
36777
36770
|
MatrixInput = /*#__PURE__*/React.createElement(NumberInput, inputProps);
|
|
36778
36771
|
} else {
|
|
36779
|
-
|
|
36772
|
+
var updatedProps = _objectSpread2(_objectSpread2({}, inputProps), {}, {
|
|
36773
|
+
style: StyleSheet.create({
|
|
36774
|
+
// eslint-disable-next-line react-native/no-unused-styles
|
|
36775
|
+
input: _objectSpread2(_objectSpread2({}, inputProps.style), {}, {
|
|
36776
|
+
display: "inline-block",
|
|
36777
|
+
padding: 0,
|
|
36778
|
+
backgroundColor: outside ? "#f3f3f3" : "#fff"
|
|
36779
|
+
})
|
|
36780
|
+
}).input
|
|
36781
|
+
});
|
|
36782
|
+
|
|
36783
|
+
MatrixInput = /*#__PURE__*/React.createElement(TextInput, updatedProps);
|
|
36780
36784
|
}
|
|
36781
36785
|
|
|
36782
36786
|
return /*#__PURE__*/React.createElement("span", {
|