@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.
@@ -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 {...inputProps} />
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 classNames from "classnames";
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
- // $FlowFixMe[prop-missing]
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: string,
551
+ size: "normal" | "small",
546
552
  coefficient: boolean,
547
553
  rightAlign?: boolean,
548
554
  static: boolean,