@pie-lib/math-input 6.31.2-next.11 → 6.31.2-next.164

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.
Files changed (83) hide show
  1. package/CHANGELOG.md +6 -64
  2. package/lib/horizontal-keypad.js +16 -44
  3. package/lib/horizontal-keypad.js.map +1 -1
  4. package/lib/index.js +3 -25
  5. package/lib/index.js.map +1 -1
  6. package/lib/keypad/index.js +254 -332
  7. package/lib/keypad/index.js.map +1 -1
  8. package/lib/keypad/keys-layout.js +2 -12
  9. package/lib/keypad/keys-layout.js.map +1 -1
  10. package/lib/keys/basic-operators.js +5 -13
  11. package/lib/keys/basic-operators.js.map +1 -1
  12. package/lib/keys/chars.js +5 -10
  13. package/lib/keys/chars.js.map +1 -1
  14. package/lib/keys/comparison.js +6 -16
  15. package/lib/keys/comparison.js.map +1 -1
  16. package/lib/keys/constants.js +4 -10
  17. package/lib/keys/constants.js.map +1 -1
  18. package/lib/keys/digits.js +1 -7
  19. package/lib/keys/digits.js.map +1 -1
  20. package/lib/keys/edit.js +1 -4
  21. package/lib/keys/edit.js.map +1 -1
  22. package/lib/keys/exponent.js +4 -10
  23. package/lib/keys/exponent.js.map +1 -1
  24. package/lib/keys/fractions.js +3 -8
  25. package/lib/keys/fractions.js.map +1 -1
  26. package/lib/keys/geometry.js +25 -54
  27. package/lib/keys/geometry.js.map +1 -1
  28. package/lib/keys/grades.js +10 -46
  29. package/lib/keys/grades.js.map +1 -1
  30. package/lib/keys/index.js +13 -32
  31. package/lib/keys/index.js.map +1 -1
  32. package/lib/keys/log.js +3 -8
  33. package/lib/keys/log.js.map +1 -1
  34. package/lib/keys/logic.js +2 -6
  35. package/lib/keys/logic.js.map +1 -1
  36. package/lib/keys/matrices.js +2 -6
  37. package/lib/keys/matrices.js.map +1 -1
  38. package/lib/keys/misc.js +10 -22
  39. package/lib/keys/misc.js.map +1 -1
  40. package/lib/keys/navigation.js +2 -7
  41. package/lib/keys/navigation.js.map +1 -1
  42. package/lib/keys/operators.js +1 -4
  43. package/lib/keys/operators.js.map +1 -1
  44. package/lib/keys/statistics.js +5 -12
  45. package/lib/keys/statistics.js.map +1 -1
  46. package/lib/keys/sub-sup.js +2 -6
  47. package/lib/keys/sub-sup.js.map +1 -1
  48. package/lib/keys/trigonometry.js +6 -14
  49. package/lib/keys/trigonometry.js.map +1 -1
  50. package/lib/keys/utils.js +7 -40
  51. package/lib/keys/utils.js.map +1 -1
  52. package/lib/keys/vars.js +3 -8
  53. package/lib/keys/vars.js.map +1 -1
  54. package/lib/math-input.js +52 -103
  55. package/lib/math-input.js.map +1 -1
  56. package/lib/mq/common-mq-styles.js +7 -18
  57. package/lib/mq/common-mq-styles.js.map +1 -1
  58. package/lib/mq/custom-elements.js +1 -4
  59. package/lib/mq/custom-elements.js.map +1 -1
  60. package/lib/mq/index.js +0 -4
  61. package/lib/mq/index.js.map +1 -1
  62. package/lib/mq/input.js +22 -75
  63. package/lib/mq/input.js.map +1 -1
  64. package/lib/mq/static.js +34 -92
  65. package/lib/mq/static.js.map +1 -1
  66. package/lib/shared/constants.js +3 -6
  67. package/lib/updateSpans.js +1 -5
  68. package/lib/updateSpans.js.map +1 -1
  69. package/package.json +10 -10
  70. package/src/__tests__/math-input-test.jsx +31 -71
  71. package/src/keypad/__tests__/index.test.jsx +18 -17
  72. package/src/keypad/index.jsx +172 -169
  73. package/src/math-input.jsx +35 -44
  74. package/src/mq/__tests__/input.test.jsx +26 -78
  75. package/src/mq/__tests__/static.test.jsx +14 -38
  76. package/src/mq/input.jsx +9 -9
  77. package/src/mq/static.jsx +3 -0
  78. package/esm/index.css +0 -847
  79. package/esm/index.js +0 -44393
  80. package/esm/index.js.map +0 -1
  81. package/src/__tests__/__snapshots__/math-input-test.jsx.snap +0 -152
  82. package/src/keypad/__tests__/__snapshots__/index.test.jsx.snap +0 -193
  83. package/src/mq/__tests__/__snapshots__/input.test.jsx.snap +0 -9
@@ -1,33 +1,34 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import Button from '@material-ui/core/Button';
4
- import IconButton from '@material-ui/core/IconButton';
5
- import { withStyles } from '@material-ui/core/styles';
6
- import classNames from 'classnames';
7
- import { lighten, fade } from '@material-ui/core/styles/colorManipulator';
8
- import green from '@material-ui/core/colors/green';
3
+ import Button from '@mui/material/Button';
4
+ import IconButton from '@mui/material/IconButton';
5
+ import { lighten, alpha, styled } from '@mui/material/styles';
9
6
  import debug from 'debug';
10
7
  import _ from 'lodash';
11
8
  import MathQuill from '@pie-framework/mathquill';
12
-
13
9
  import * as mq from '../mq';
10
+
14
11
  import { baseSet } from '../keys';
15
12
  import editableHtmlConstants from '../../../editable-html/src/constants';
16
13
  import { commonMqKeyboardStyles } from '../mq/common-mq-styles';
17
14
  import { sortKeys } from './keys-layout';
15
+ import { indigo, pink } from '@mui/material/colors';
16
+ import { color } from '@pie-lib/render-ui';
18
17
 
19
18
  const log = debug('pie-lib:math-inline:keypad');
20
19
 
21
- const LatexButton = withStyles((theme) => ({
22
- root: {
23
- textTransform: 'none',
24
- padding: 0,
25
- margin: 0,
26
- fontSize: '110% !important',
27
- },
28
- latexButton: {
20
+ const StyledLatexButton = styled(Button)(() => ({
21
+ textTransform: 'none',
22
+ padding: 0,
23
+ margin: 0,
24
+ fontSize: '110% !important',
25
+ }));
26
+
27
+ const LatexButtonContent = styled(mq.Static)(({ latex }) => {
28
+ const baseStyles = {
29
29
  pointerEvents: 'none',
30
30
  textTransform: 'none !important',
31
+ color: color.text(),
31
32
  '& .mq-scaled.mq-sqrt-prefix': {
32
33
  transform: 'scale(1, 0.9) !important',
33
34
  },
@@ -35,25 +36,24 @@ const LatexButton = withStyles((theme) => ({
35
36
  marginBottom: '0.9px !important',
36
37
  },
37
38
  '& .mq-empty': {
38
- backgroundColor: `${fade(theme.palette.secondary.main, 0.4)} !important`,
39
+ backgroundColor: `${alpha(pink[300], 0.4)} !important`,
39
40
  },
40
41
  '& .mq-overline .mq-overline-inner': {
41
42
  borderTop: '2px solid black',
42
43
  },
43
44
  '& .mq-non-leaf.mq-overline': {
44
- borderTop: 'none !important', // fixing PD-4873 - in OT, it has border-top 1px and adds extra line
45
+ borderTop: 'none !important',
45
46
  },
46
47
  '& .mq-overarrow': {
47
48
  width: '30px',
48
49
  marginTop: '0 !important',
49
50
  borderTop: '2px solid black',
50
51
  fontFamily: 'Roboto, Helvetica, Arial, sans-serif !important',
51
-
52
52
  '&.mq-arrow-both': {
53
53
  top: '0px !important',
54
54
  '& *': {
55
55
  lineHeight: '1 !important',
56
- borderTop: 'none !important', // fixing PD-4873 - in OT, it has border-top 1px and adds extra line,
56
+ borderTop: 'none !important',
57
57
  },
58
58
  '&:before': {
59
59
  fontSize: '80%',
@@ -119,64 +119,48 @@ const LatexButton = withStyles((theme) => ({
119
119
  '& .mq-overarc': {
120
120
  borderTop: '2px solid black !important',
121
121
  '& .mq-overline': {
122
- borderTop: 'none !important', // fixing PD-4873 - in OT, it has border-top 1px and adds extra line
123
- },
124
- '& .mq-overline-inner': {
125
122
  borderTop: 'none !important',
126
- paddingTop: '0 !important',
127
123
  },
128
- },
129
- },
130
- parallelButton: {
131
- fontStyle: 'italic !important',
132
- },
133
- leftRightArrowButton: {
134
- '& .mq-overarrow.mq-arrow-both': {
135
124
  '& .mq-overline-inner': {
136
125
  borderTop: 'none !important',
137
126
  paddingTop: '0 !important',
138
127
  },
139
- '&:after': {
140
- position: 'absolute !important',
141
- top: '0px !important',
142
- },
143
128
  },
144
- },
145
- }))((props) => {
146
- let buttonClass;
147
-
148
- if (props.latex === '\\parallel') {
149
- buttonClass = classNames(props.classes.latexButton, props.mqClassName, props.classes.parallelButton);
150
- } else if (props.latex === '\\overleftrightarrow{\\overline{}}') {
151
- buttonClass = classNames(props.classes.latexButton, props.mqClassName, props.classes.leftRightArrowButton);
152
- } else {
153
- buttonClass = classNames(props.classes.latexButton, props.mqClassName);
129
+ };
130
+
131
+ // Add specific styles based on latex content
132
+ if (latex === '\\parallel') {
133
+ return {
134
+ ...baseStyles,
135
+ fontStyle: 'italic !important',
136
+ };
154
137
  }
155
138
 
156
- try {
157
- const MQ = MathQuill.getInterface(2);
158
- const span = document.createElement('span');
159
- span.innerHTML = '';
160
- const mathField = MQ.StaticMath(span);
161
-
162
- mathField.parseLatex(props.latex);
163
- mathField.latex(props.latex);
164
- } catch (e) {
165
- // received latex has errors - do not create button
166
- return <></>;
139
+ if (latex === '\\overleftrightarrow{\\overline{}}') {
140
+ return {
141
+ ...baseStyles,
142
+ '& .mq-overarrow.mq-arrow-both': {
143
+ '& .mq-overline-inner': {
144
+ borderTop: 'none !important',
145
+ paddingTop: '0 !important',
146
+ },
147
+ '&:after': {
148
+ position: 'absolute !important',
149
+ top: '0px !important',
150
+ },
151
+ },
152
+ };
167
153
  }
168
154
 
169
- return (
170
- <Button
171
- className={classNames(props.classes.root, props.className)}
172
- onClick={props.onClick}
173
- aria-label={props.ariaLabel}
174
- >
175
- <mq.Static className={buttonClass} latex={props.latex} />
176
- </Button>
177
- );
155
+ return baseStyles;
178
156
  });
179
157
 
158
+ LatexButtonContent.propTypes = {
159
+ latex: PropTypes.string.isRequired,
160
+ };
161
+
162
+ // LatexButton component removed - LatexButtonContent is used directly instead
163
+
180
164
  const createCustomLayout = (layoutObj) => {
181
165
  if (layoutObj) {
182
166
  return {
@@ -189,9 +173,92 @@ const createCustomLayout = (layoutObj) => {
189
173
  return {};
190
174
  };
191
175
 
176
+ const KeyPadContainer = styled('div')(() => ({
177
+ ...commonMqKeyboardStyles,
178
+ width: '100%',
179
+ display: 'grid',
180
+ gridTemplateRows: 'repeat(5, minmax(40px, 60px))',
181
+ gridRowGap: '0px',
182
+ gridColumnGap: '0px',
183
+ gridAutoFlow: 'column',
184
+ '&.character': {
185
+ textTransform: 'initial !important',
186
+ gridTemplateRows: 'repeat(5, minmax(40px, 50px)) !important',
187
+ },
188
+ '&.language': {
189
+ gridTemplateRows: 'repeat(4, minmax(40px, 50px)) !important',
190
+ '& *': {
191
+ fontFamily: 'Roboto, Helvetica, Arial, sans-serif !important',
192
+ },
193
+ },
194
+ }));
195
+
196
+ const StyledButton = styled(Button)(({ category, isDelete, isComma, isDot }) => ({
197
+ minWidth: 'auto',
198
+ fontSize: isComma || isDot ? '200% !important' : '140% !important',
199
+ lineHeight: isComma || isDot ? '100%' : 'normal',
200
+ color: color.text(),
201
+
202
+ backgroundColor:
203
+ category === 'operators'
204
+ ? lighten(pink[300], 0.5)
205
+ : // this code with green seems to not be applied to current implementation, so I commented it out, but left it here just in case
206
+ // category === 'comparison' ? lighten(green[500], 0.5) :
207
+ lighten(indigo[300], 0.5),
208
+ '&:hover': {
209
+ backgroundColor:
210
+ category === 'operators'
211
+ ? lighten(pink[300], 0.7)
212
+ : // category === 'comparison' ? lighten(green[500], 0.7) :
213
+ lighten(indigo[300], 0.7),
214
+ },
215
+ borderRadius: 0,
216
+ ...(isDelete && {
217
+ '& > span': {
218
+ fontFamily: 'Roboto, Helvetica, Arial, sans-serif !important',
219
+ },
220
+ }),
221
+ }));
222
+
223
+ const StyledLatexButtonWrapper = styled(Button)(({ category }) => ({
224
+ minWidth: 'auto',
225
+ borderRadius: 0,
226
+ backgroundColor:
227
+ category === 'operators'
228
+ ? lighten(pink[300], 0.5)
229
+ : // category === 'comparison' ? lighten(green[500], 0.5) :
230
+ lighten(indigo[300], 0.5),
231
+ '&:hover': {
232
+ backgroundColor:
233
+ category === 'operators'
234
+ ? lighten(pink[300], 0.7)
235
+ : // category === 'comparison' ? lighten(green[500], 0.7) :
236
+ lighten(indigo[300], 0.7),
237
+ },
238
+ }));
239
+
240
+ const StyledIconButton = styled(IconButton)(({ category }) => ({
241
+ minWidth: 'auto',
242
+ backgroundColor:
243
+ category === 'operators'
244
+ ? lighten(pink[300], 0.5)
245
+ : // category === 'comparison' ? lighten(green[500], 0.5) :
246
+ lighten(indigo[300], 0.5),
247
+ '&:hover': {
248
+ backgroundColor:
249
+ category === 'operators'
250
+ ? lighten(pink[300], 0.7)
251
+ : // category === 'comparison' ? lighten(green[500], 0.7) :
252
+ lighten(indigo[300], 0.7),
253
+ },
254
+ borderRadius: 0,
255
+ '& .icon': {
256
+ height: '30px',
257
+ },
258
+ }));
259
+
192
260
  export class KeyPad extends React.Component {
193
261
  static propTypes = {
194
- classes: PropTypes.object.isRequired,
195
262
  className: PropTypes.string,
196
263
  controlledKeypadMode: PropTypes.bool,
197
264
  baseSet: PropTypes.array,
@@ -289,14 +356,14 @@ export class KeyPad extends React.Component {
289
356
  };
290
357
 
291
358
  render() {
292
- const { classes, className, baseSet, additionalKeys, layoutForKeyPad, onFocus, mode } = this.props;
359
+ const { className, baseSet, additionalKeys, layoutForKeyPad, onFocus, mode } = this.props;
293
360
 
294
361
  const noBaseSet = ['non-negative-integers', 'integers', 'decimals', 'fractions', 'item-authoring', 'language'];
295
362
 
296
363
  const keysWithoutBaseSet = noBaseSet.includes(mode);
297
364
  const allKeys = keysWithoutBaseSet
298
365
  ? this.flowKeys([], additionalKeys || [])
299
- : this.flowKeys(baseSet, additionalKeys || []); //, ...sortKeys(additionalKeys)];
366
+ : this.flowKeys(baseSet, additionalKeys || []);
300
367
 
301
368
  const shift = allKeys.length % 5 ? 1 : 0;
302
369
  const style = {
@@ -305,9 +372,9 @@ export class KeyPad extends React.Component {
305
372
  };
306
373
 
307
374
  return (
308
- <div
375
+ <KeyPadContainer
309
376
  ref={this.keypadRef}
310
- className={classNames(classes.keys, className, classes[mode])}
377
+ className={[className, mode].filter(Boolean).join(' ')}
311
378
  style={style}
312
379
  onFocus={onFocus}
313
380
  >
@@ -320,13 +387,6 @@ export class KeyPad extends React.Component {
320
387
 
321
388
  const common = {
322
389
  onClick,
323
- className: classNames(
324
- classes.labelButton,
325
- !keysWithoutBaseSet && classes[k.category],
326
- classes[k.extraClass],
327
- k.label === ',' && classes.comma,
328
- k.label === '.' && classes.dot,
329
- ),
330
390
  disabled: this.keyIsNotAllowed(k),
331
391
  key: `${k.label || k.latex || k.command}-${index}`,
332
392
  ...(k.actions || {}),
@@ -335,116 +395,59 @@ export class KeyPad extends React.Component {
335
395
 
336
396
  if (k.latex) {
337
397
  return (
338
- <LatexButton
339
- latex={k.latex}
340
- key={index}
341
- {...common}
342
- className={classes.latexButton}
343
- ariaLabel={k.ariaLabel ? k.ariaLabel : k.name || k.label}
344
- />
398
+ <StyledLatexButtonWrapper
399
+ key={common.key}
400
+ onClick={common.onClick}
401
+ disabled={common.disabled}
402
+ category={!keysWithoutBaseSet ? k.category : undefined}
403
+ aria-label={k.ariaLabel ? k.ariaLabel : k.name || k.label}
404
+ {...(k.actions || {})}
405
+ {...(k.extraProps || {})}
406
+ >
407
+ <LatexButtonContent latex={k.latex} />
408
+ </StyledLatexButtonWrapper>
345
409
  );
346
410
  }
347
411
 
348
412
  if (k.label) {
349
413
  return (
350
- <Button
351
- key={index}
352
- {...common}
353
- className={classNames(common.className, { [classes.deleteButton]: k.label === '⌫' })}
414
+ <StyledButton
415
+ key={common.key}
416
+ onClick={common.onClick}
417
+ disabled={common.disabled}
418
+ category={!keysWithoutBaseSet ? k.category : undefined}
419
+ isDelete={k.label === '⌫'}
420
+ isComma={k.label === ','}
421
+ isDot={k.label === '.'}
354
422
  aria-label={k.ariaLabel ? k.ariaLabel : k.name || k.label}
423
+ {...(k.actions || {})}
424
+ {...(k.extraProps || {})}
355
425
  >
356
426
  {k.label}
357
- </Button>
427
+ </StyledButton>
358
428
  );
359
429
  } else {
360
430
  const Icon = k.icon ? k.icon : 'div';
361
431
 
362
432
  return (
363
- <IconButton tabIndex={'-1'} {...common} key={index}>
364
- <Icon className={classes.icon} />
365
- </IconButton>
433
+ <StyledIconButton
434
+ key={common.key}
435
+ tabIndex={'-1'}
436
+ onClick={common.onClick}
437
+ disabled={common.disabled}
438
+ category={!keysWithoutBaseSet ? k.category : undefined}
439
+ size="large"
440
+ {...(k.actions || {})}
441
+ {...(k.extraProps || {})}
442
+ >
443
+ <Icon className="icon" />
444
+ </StyledIconButton>
366
445
  );
367
446
  }
368
447
  })}
369
- </div>
448
+ </KeyPadContainer>
370
449
  );
371
450
  }
372
451
  }
373
452
 
374
- const styles = (theme) => ({
375
- keys: {
376
- ...commonMqKeyboardStyles,
377
- width: '100%',
378
- display: 'grid',
379
- gridTemplateRows: 'repeat(5, minmax(40px, 60px))',
380
- gridRowGap: '0px',
381
- gridColumnGap: '0px',
382
- gridAutoFlow: 'column',
383
- },
384
- character: {
385
- textTransform: 'initial !important',
386
- gridTemplateRows: 'repeat(5, minmax(40px, 50px)) !important',
387
- },
388
- language: {
389
- gridTemplateRows: 'repeat(4, minmax(40px, 50px)) !important',
390
- '& *': {
391
- fontFamily: 'Roboto, Helvetica, Arial, sans-serif !important',
392
- },
393
- },
394
- holder: {
395
- position: 'relative',
396
- width: '100%',
397
- height: '100%',
398
- backgroundColor: '#cef',
399
- borderRadius: 0,
400
- padding: `${theme.spacing.unit}px 0 ${theme.spacing.unit}px 0`,
401
- },
402
- labelButton: {
403
- minWidth: 'auto',
404
- fontSize: '140% !important',
405
- backgroundColor: lighten(theme.palette.primary.light, 0.5),
406
- '&:hover': {
407
- backgroundColor: lighten(theme.palette.primary.light, 0.7),
408
- },
409
- borderRadius: 0,
410
- },
411
- latexButton: {
412
- minWidth: 'auto',
413
- borderRadius: 0,
414
- backgroundColor: lighten(theme.palette.primary.light, 0.5),
415
- '&:hover': {
416
- backgroundColor: lighten(theme.palette.primary.light, 0.7),
417
- },
418
- },
419
- deleteButton: {
420
- '& > span': {
421
- fontFamily: 'Roboto, Helvetica, Arial, sans-serif !important',
422
- },
423
- },
424
- base: {},
425
- operators: {
426
- backgroundColor: lighten(theme.palette.secondary.light, 0.5),
427
- '&:hover': {
428
- backgroundColor: lighten(theme.palette.secondary.light, 0.7),
429
- },
430
- },
431
- comparison: {
432
- backgroundColor: lighten(green[500], 0.5),
433
- '&:hover': {
434
- backgroundColor: lighten(green[500], 0.7),
435
- },
436
- },
437
- comma: {
438
- fontSize: '200% !important',
439
- lineHeight: '100%',
440
- },
441
- dot: {
442
- fontSize: '200% !important',
443
- lineHeight: '100%',
444
- },
445
- icon: {
446
- height: '30px',
447
- },
448
- });
449
-
450
- export default withStyles(styles)(KeyPad);
453
+ export default KeyPad;
@@ -1,7 +1,6 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import { withStyles } from '@material-ui/core/styles';
4
- import classNames from 'classnames';
3
+ import { styled } from '@mui/material/styles';
5
4
  import * as mq from './mq';
6
5
  import { baseSet } from './keys';
7
6
  import KeyPad from './keypad';
@@ -9,9 +8,35 @@ import debug from 'debug';
9
8
 
10
9
  const log = debug('pie-lib:math-input');
11
10
 
11
+ const grey = 'rgba(0, 0, 0, 0.23)';
12
+
13
+ const MathInputContainer = styled('div')(({ theme, focused }) => ({
14
+ borderRadius: '4px',
15
+ border: `solid 1px ${focused ? theme.palette.primary.main : grey}`,
16
+ marginTop: theme.spacing(1),
17
+ marginBottom: theme.spacing(1),
18
+ transition: 'border 200ms linear',
19
+ }));
20
+
21
+ const PadContainer = styled('div')({
22
+ width: '100%',
23
+ display: 'flex',
24
+ });
25
+
26
+ const StyledMqInput = styled(mq.Input)(({ theme }) => ({
27
+ width: '100%',
28
+ border: `solid 0px ${theme.palette.primary.light}`,
29
+ transition: 'border 200ms linear',
30
+ padding: theme.spacing(1),
31
+ '&.mq-focused': {
32
+ outline: 'none',
33
+ boxShadow: 'none',
34
+ border: `solid 0px ${theme.palette.primary.dark}`,
35
+ },
36
+ }));
37
+
12
38
  export class MathInput extends React.Component {
13
39
  static propTypes = {
14
- classes: PropTypes.object.isRequired,
15
40
  className: PropTypes.string,
16
41
  keyset: PropTypes.array,
17
42
  displayMode: PropTypes.oneOf(['block', 'block-on-focus']),
@@ -67,15 +92,14 @@ export class MathInput extends React.Component {
67
92
  };
68
93
 
69
94
  render() {
70
- const { classes, className, keyset, latex } = this.props;
95
+ const { className, keyset, latex } = this.props;
71
96
  const { focused } = this.state;
72
97
 
73
98
  const showKeypad = true; // TODO: add support for different displayModes - displayMode === 'block' || focused;
74
99
 
75
100
  return (
76
- <div className={classNames(classes.mathInput, className, focused && classes.focused)}>
77
- <mq.Input
78
- className={classes.mqInput}
101
+ <MathInputContainer className={className} focused={focused}>
102
+ <StyledMqInput
79
103
  innerRef={(r) => (this.input = r)}
80
104
  onFocus={this.inputFocus}
81
105
  onBlur={this.inputBlur}
@@ -83,46 +107,13 @@ export class MathInput extends React.Component {
83
107
  onChange={this.changeLatex}
84
108
  />
85
109
  {showKeypad && (
86
- <div className={classes.pad}>
110
+ <PadContainer>
87
111
  <KeyPad baseSet={baseSet} additionalKeys={keyset} onPress={this.keypadPress} />
88
- </div>
112
+ </PadContainer>
89
113
  )}
90
- </div>
114
+ </MathInputContainer>
91
115
  );
92
116
  }
93
117
  }
94
118
 
95
- const grey = 'rgba(0, 0, 0, 0.23)';
96
- const styles = (theme) => ({
97
- formGroup: {
98
- display: 'flex',
99
- textAlign: 'right',
100
- float: 'right',
101
- },
102
- pad: {
103
- width: '100%',
104
- display: 'flex',
105
- },
106
- mathInput: {
107
- borderRadius: '4px',
108
- border: `solid 1px ${grey}`,
109
- marginTop: theme.spacing.unit,
110
- marginBottom: theme.spacing.unit,
111
- transition: 'border 200ms linear',
112
- },
113
- focused: {
114
- border: `solid 1px ${theme.palette.primary.main}`,
115
- },
116
- mqInput: {
117
- width: '100%',
118
- border: `solid 0px ${theme.palette.primary.light}`,
119
- transition: 'border 200ms linear',
120
- padding: theme.spacing.unit,
121
- '&.mq-focused': {
122
- outline: 'none',
123
- boxShadow: 'none',
124
- border: `solid 0px ${theme.palette.primary.dark}`,
125
- },
126
- },
127
- });
128
- export default withStyles(styles)(MathInput);
119
+ export default MathInput;