@khanacademy/math-input 15.1.0 → 16.0.0

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 (138) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/dist/components/keypad/index.d.ts +1 -1
  3. package/dist/components/keypad/mobile-keypad-internals.d.ts +49 -0
  4. package/dist/components/keypad/mobile-keypad.d.ts +4 -48
  5. package/dist/es/index.js +168 -4740
  6. package/dist/es/index.js.map +1 -1
  7. package/dist/index.d.ts +1 -1
  8. package/dist/index.js +166 -4722
  9. package/dist/index.js.map +1 -1
  10. package/package.json +1 -1
  11. package/src/components/__tests__/integration.test.tsx +2 -3
  12. package/src/components/keypad/__tests__/mobile-keypad.test.tsx +8 -8
  13. package/src/components/keypad/index.tsx +1 -1
  14. package/src/components/keypad/mobile-keypad-internals.tsx +240 -0
  15. package/src/components/keypad/mobile-keypad.tsx +21 -234
  16. package/src/full-mobile-input.stories.tsx +0 -1
  17. package/src/index.ts +1 -1
  18. package/tsconfig-build.tsbuildinfo +1 -1
  19. package/dist/components/keypad-legacy/compute-layout-parameters.d.ts +0 -28
  20. package/dist/components/keypad-legacy/corner-decal.d.ts +0 -12
  21. package/dist/components/keypad-legacy/echo-manager.d.ts +0 -17
  22. package/dist/components/keypad-legacy/empty-keypad-button.d.ts +0 -13
  23. package/dist/components/keypad-legacy/expression-keypad.d.ts +0 -21
  24. package/dist/components/keypad-legacy/fraction-keypad.d.ts +0 -21
  25. package/dist/components/keypad-legacy/gesture-manager.d.ts +0 -86
  26. package/dist/components/keypad-legacy/gesture-state-machine.d.ts +0 -105
  27. package/dist/components/keypad-legacy/icon.d.ts +0 -15
  28. package/dist/components/keypad-legacy/index.d.ts +0 -1
  29. package/dist/components/keypad-legacy/keypad-button.d.ts +0 -53
  30. package/dist/components/keypad-legacy/keypad-container.d.ts +0 -41
  31. package/dist/components/keypad-legacy/keypad.d.ts +0 -31
  32. package/dist/components/keypad-legacy/many-keypad-button.d.ts +0 -15
  33. package/dist/components/keypad-legacy/math-icon.d.ts +0 -16
  34. package/dist/components/keypad-legacy/multi-symbol-grid.d.ts +0 -14
  35. package/dist/components/keypad-legacy/multi-symbol-popover.d.ts +0 -12
  36. package/dist/components/keypad-legacy/navigation-pad.d.ts +0 -14
  37. package/dist/components/keypad-legacy/node-manager.d.ts +0 -49
  38. package/dist/components/keypad-legacy/popover-manager.d.ts +0 -13
  39. package/dist/components/keypad-legacy/popover-state-machine.d.ts +0 -68
  40. package/dist/components/keypad-legacy/provided-keypad.d.ts +0 -28
  41. package/dist/components/keypad-legacy/store/actions.d.ts +0 -55
  42. package/dist/components/keypad-legacy/store/echo-reducer.d.ts +0 -4
  43. package/dist/components/keypad-legacy/store/index.d.ts +0 -9
  44. package/dist/components/keypad-legacy/store/input-reducer.d.ts +0 -4
  45. package/dist/components/keypad-legacy/store/keypad-reducer.d.ts +0 -4
  46. package/dist/components/keypad-legacy/store/layout-reducer.d.ts +0 -4
  47. package/dist/components/keypad-legacy/store/shared.d.ts +0 -7
  48. package/dist/components/keypad-legacy/store/types.d.ts +0 -47
  49. package/dist/components/keypad-legacy/styles.d.ts +0 -5
  50. package/dist/components/keypad-legacy/svg-icon.d.ts +0 -12
  51. package/dist/components/keypad-legacy/text-icon.d.ts +0 -13
  52. package/dist/components/keypad-legacy/touchable-keypad-button.d.ts +0 -37
  53. package/dist/components/keypad-legacy/two-page-keypad.d.ts +0 -21
  54. package/dist/components/keypad-legacy/z-indexes.d.ts +0 -7
  55. package/dist/components/keypad-switch.d.ts +0 -12
  56. package/src/components/keypad-legacy/__tests__/gesture-state-machine.test.ts +0 -441
  57. package/src/components/keypad-legacy/__tests__/node-manager.test.ts +0 -89
  58. package/src/components/keypad-legacy/compute-layout-parameters.ts +0 -205
  59. package/src/components/keypad-legacy/corner-decal.tsx +0 -56
  60. package/src/components/keypad-legacy/echo-manager.tsx +0 -152
  61. package/src/components/keypad-legacy/empty-keypad-button.tsx +0 -58
  62. package/src/components/keypad-legacy/expression-keypad.tsx +0 -315
  63. package/src/components/keypad-legacy/fraction-keypad.tsx +0 -180
  64. package/src/components/keypad-legacy/gesture-manager.ts +0 -255
  65. package/src/components/keypad-legacy/gesture-state-machine.ts +0 -329
  66. package/src/components/keypad-legacy/icon.tsx +0 -72
  67. package/src/components/keypad-legacy/iconography/arrow.js +0 -22
  68. package/src/components/keypad-legacy/iconography/backspace.js +0 -29
  69. package/src/components/keypad-legacy/iconography/cdot.js +0 -29
  70. package/src/components/keypad-legacy/iconography/cos.js +0 -30
  71. package/src/components/keypad-legacy/iconography/cube-root.js +0 -36
  72. package/src/components/keypad-legacy/iconography/dismiss.js +0 -25
  73. package/src/components/keypad-legacy/iconography/divide.js +0 -34
  74. package/src/components/keypad-legacy/iconography/down.js +0 -16
  75. package/src/components/keypad-legacy/iconography/equal.js +0 -33
  76. package/src/components/keypad-legacy/iconography/exp-2.js +0 -29
  77. package/src/components/keypad-legacy/iconography/exp-3.js +0 -29
  78. package/src/components/keypad-legacy/iconography/exp.js +0 -29
  79. package/src/components/keypad-legacy/iconography/frac.js +0 -44
  80. package/src/components/keypad-legacy/iconography/geq.js +0 -33
  81. package/src/components/keypad-legacy/iconography/gt.js +0 -33
  82. package/src/components/keypad-legacy/iconography/index.js +0 -45
  83. package/src/components/keypad-legacy/iconography/jump-into-numerator.js +0 -41
  84. package/src/components/keypad-legacy/iconography/jump-out-base.js +0 -30
  85. package/src/components/keypad-legacy/iconography/jump-out-denominator.js +0 -41
  86. package/src/components/keypad-legacy/iconography/jump-out-exponent.js +0 -30
  87. package/src/components/keypad-legacy/iconography/jump-out-numerator.js +0 -41
  88. package/src/components/keypad-legacy/iconography/jump-out-parentheses.js +0 -33
  89. package/src/components/keypad-legacy/iconography/left-paren.js +0 -33
  90. package/src/components/keypad-legacy/iconography/left.js +0 -16
  91. package/src/components/keypad-legacy/iconography/leq.js +0 -33
  92. package/src/components/keypad-legacy/iconography/ln.js +0 -29
  93. package/src/components/keypad-legacy/iconography/log-n.js +0 -29
  94. package/src/components/keypad-legacy/iconography/log.js +0 -29
  95. package/src/components/keypad-legacy/iconography/lt.js +0 -33
  96. package/src/components/keypad-legacy/iconography/minus.js +0 -32
  97. package/src/components/keypad-legacy/iconography/neq.js +0 -33
  98. package/src/components/keypad-legacy/iconography/parens.js +0 -33
  99. package/src/components/keypad-legacy/iconography/percent.js +0 -49
  100. package/src/components/keypad-legacy/iconography/period.js +0 -26
  101. package/src/components/keypad-legacy/iconography/plus.js +0 -32
  102. package/src/components/keypad-legacy/iconography/radical.js +0 -36
  103. package/src/components/keypad-legacy/iconography/right-paren.js +0 -33
  104. package/src/components/keypad-legacy/iconography/right.js +0 -16
  105. package/src/components/keypad-legacy/iconography/sin.js +0 -30
  106. package/src/components/keypad-legacy/iconography/sqrt.js +0 -32
  107. package/src/components/keypad-legacy/iconography/tan.js +0 -30
  108. package/src/components/keypad-legacy/iconography/times.js +0 -33
  109. package/src/components/keypad-legacy/iconography/up.js +0 -16
  110. package/src/components/keypad-legacy/index.ts +0 -1
  111. package/src/components/keypad-legacy/keypad-button.tsx +0 -368
  112. package/src/components/keypad-legacy/keypad-container.tsx +0 -358
  113. package/src/components/keypad-legacy/keypad.tsx +0 -162
  114. package/src/components/keypad-legacy/many-keypad-button.tsx +0 -54
  115. package/src/components/keypad-legacy/math-icon.tsx +0 -66
  116. package/src/components/keypad-legacy/multi-symbol-grid.tsx +0 -182
  117. package/src/components/keypad-legacy/multi-symbol-popover.tsx +0 -58
  118. package/src/components/keypad-legacy/navigation-pad.tsx +0 -140
  119. package/src/components/keypad-legacy/node-manager.ts +0 -133
  120. package/src/components/keypad-legacy/popover-manager.tsx +0 -73
  121. package/src/components/keypad-legacy/popover-state-machine.ts +0 -184
  122. package/src/components/keypad-legacy/provided-keypad.tsx +0 -136
  123. package/src/components/keypad-legacy/store/actions.ts +0 -155
  124. package/src/components/keypad-legacy/store/echo-reducer.ts +0 -57
  125. package/src/components/keypad-legacy/store/index.ts +0 -110
  126. package/src/components/keypad-legacy/store/input-reducer.ts +0 -55
  127. package/src/components/keypad-legacy/store/keypad-reducer.ts +0 -58
  128. package/src/components/keypad-legacy/store/layout-reducer.test.ts +0 -171
  129. package/src/components/keypad-legacy/store/layout-reducer.ts +0 -129
  130. package/src/components/keypad-legacy/store/shared.ts +0 -12
  131. package/src/components/keypad-legacy/store/types.ts +0 -78
  132. package/src/components/keypad-legacy/styles.ts +0 -38
  133. package/src/components/keypad-legacy/svg-icon.tsx +0 -24
  134. package/src/components/keypad-legacy/text-icon.tsx +0 -53
  135. package/src/components/keypad-legacy/touchable-keypad-button.tsx +0 -163
  136. package/src/components/keypad-legacy/two-page-keypad.tsx +0 -115
  137. package/src/components/keypad-legacy/z-indexes.ts +0 -8
  138. package/src/components/keypad-switch.tsx +0 -42
@@ -1,30 +0,0 @@
1
- /**
2
- * An autogenerated component that renders the TAN iconograpy in SVG.
3
- *
4
- * Generated with: https://gist.github.com/crm416/3c7abc88e520eaed72347af240b32590.
5
- */
6
- import PropTypes from "prop-types";
7
- import * as React from "react";
8
-
9
- class Tan extends React.Component {
10
- static propTypes = {
11
- color: PropTypes.string.isRequired,
12
- };
13
-
14
- render() {
15
- return (
16
- <svg width="48" height="48" viewBox="0 0 48 48">
17
- <g fill="none" fillRule="evenodd">
18
- <path fill="none" d="M0 0h48v48H0z" />
19
- <path fill="none" d="M12 12h24v24H12z" />
20
- <path
21
- d="M16.93 29.168c.742 0 1.218-.196 1.484-.434l-.378-1.344c-.098.098-.35.196-.616.196-.392 0-.616-.322-.616-.742v-3.052h1.372v-1.554h-1.372V20.39h-1.792v1.848h-1.12v1.554h1.12v3.528c0 1.204.672 1.848 1.918 1.848zM25.232 29v-4.368c0-1.946-1.414-2.562-2.954-2.562-1.064 0-2.128.336-2.954 1.064l.672 1.19c.574-.532 1.246-.798 1.974-.798.896 0 1.484.448 1.484 1.134v.91c-.448-.532-1.246-.826-2.142-.826-1.078 0-2.352.602-2.352 2.184 0 1.512 1.274 2.24 2.352 2.24.882 0 1.68-.322 2.142-.868v.7h1.778zm-3.206-1.036c-.7 0-1.274-.364-1.274-.994 0-.658.574-1.022 1.274-1.022.574 0 1.134.196 1.428.588v.84c-.294.392-.854.588-1.428.588zM33.338 29v-4.774c0-1.316-.714-2.156-2.198-2.156-1.106 0-1.932.532-2.366 1.05v-.882h-1.778V29h1.778v-4.55c.294-.406.84-.798 1.54-.798.756 0 1.246.322 1.246 1.26V29h1.778z"
22
- fill={this.props.color}
23
- />
24
- </g>
25
- </svg>
26
- );
27
- }
28
- }
29
-
30
- export default Tan;
@@ -1,33 +0,0 @@
1
- /**
2
- * An autogenerated component that renders the TIMES iconograpy in SVG.
3
- *
4
- * Generated with: https://gist.github.com/crm416/3c7abc88e520eaed72347af240b32590.
5
- */
6
- import PropTypes from "prop-types";
7
- import * as React from "react";
8
-
9
- class Times extends React.Component {
10
- static propTypes = {
11
- color: PropTypes.string.isRequired,
12
- };
13
-
14
- render() {
15
- return (
16
- <svg width="48" height="48" viewBox="0 0 48 48">
17
- <g fill="none" fillRule="evenodd">
18
- <path fill="none" d="M0 0h48v48H0z" />
19
- <path fill="none" d="M12 12h24v24H12z" />
20
- <path
21
- d="M20 20l8 8M28 20l-8 8"
22
- stroke={this.props.color}
23
- strokeWidth="2"
24
- strokeLinecap="round"
25
- strokeLinejoin="round"
26
- />
27
- </g>
28
- </svg>
29
- );
30
- }
31
- }
32
-
33
- export default Times;
@@ -1,16 +0,0 @@
1
- /**
2
- * A component that renders the UP iconograpy in SVG.
3
- */
4
- import * as React from "react";
5
-
6
- import Arrow from "./arrow";
7
-
8
- const Up = () => {
9
- return (
10
- <svg width="48" height="48" viewBox="0 0 48 48">
11
- <Arrow transform="rotate(90 24 24)" />
12
- </svg>
13
- );
14
- };
15
-
16
- export default Up;
@@ -1 +0,0 @@
1
- export {default} from "./provided-keypad";
@@ -1,368 +0,0 @@
1
- /**
2
- * A component that renders a keypad button.
3
- */
4
-
5
- import Color from "@khanacademy/wonder-blocks-color";
6
- import {StyleSheet, css} from "aphrodite";
7
- import * as React from "react";
8
- import {connect} from "react-redux";
9
-
10
- import {BorderDirection, BorderStyles, KeyTypes} from "../../enums";
11
- import {View} from "../../fake-react-native-web/index";
12
- import {
13
- wonderBlocksBlue,
14
- innerBorderColor,
15
- innerBorderStyle,
16
- innerBorderWidthPx,
17
- valueGrey,
18
- operatorGrey,
19
- controlGrey,
20
- emptyGrey,
21
- } from "../common-style";
22
-
23
- import CornerDecal from "./corner-decal";
24
- import Icon from "./icon";
25
- import MultiSymbolGrid from "./multi-symbol-grid";
26
-
27
- import type {KeyType} from "../../enums";
28
- import type {Border, NonManyKeyConfig, IconConfig} from "../../types";
29
- import type {State} from "./store/types";
30
- import type {StyleType} from "@khanacademy/wonder-blocks-core";
31
-
32
- interface ReduxProps {
33
- heightPx: number;
34
- widthPx: number;
35
- }
36
-
37
- interface Props extends ReduxProps {
38
- ariaLabel?: string;
39
- borders: Border;
40
- childKeys: ReadonlyArray<NonManyKeyConfig>;
41
- disabled: boolean;
42
- focused: boolean;
43
- popoverEnabled: boolean;
44
- type: KeyType;
45
- icon?: IconConfig;
46
- style?: StyleType;
47
- onTouchCancel?: (evt: React.TouchEvent<HTMLDivElement>) => void;
48
- onTouchEnd?: (evt: React.TouchEvent<HTMLDivElement>) => void;
49
- onTouchMove?: (evt: React.TouchEvent<HTMLDivElement>) => void;
50
- onTouchStart?: (evt: React.TouchEvent<HTMLDivElement>) => void;
51
- // NOTE(matthewc)[LC-754] this is a normal React thing, but TS
52
- // gets mad if I don't explicitly set it as a prop
53
- ref?: (any) => void;
54
- }
55
-
56
- // eslint-disable-next-line react/no-unsafe
57
- class KeypadButton extends React.PureComponent<Props> {
58
- buttonSizeStyle: StyleType | undefined;
59
-
60
- static defaultProps = {
61
- borders: BorderStyles.ALL,
62
- childKeys: [],
63
- disabled: false,
64
- focused: false,
65
- popoverEnabled: false,
66
- };
67
-
68
- UNSAFE_componentWillMount() {
69
- this.buttonSizeStyle = styleForButtonDimensions(
70
- this.props.heightPx,
71
- this.props.widthPx,
72
- );
73
- }
74
-
75
- componentDidMount() {
76
- this._preInjectStyles();
77
- }
78
-
79
- UNSAFE_componentWillUpdate(newProps, newState) {
80
- // Only recompute the Aphrodite StyleSheet when the button height has
81
- // changed. Though it is safe to recompute the StyleSheet (since
82
- // they're content-addressable), it saves us a bunch of hashing and
83
- // other work to cache it here.
84
- if (
85
- newProps.heightPx !== this.props.heightPx ||
86
- newProps.widthPx !== this.props.widthPx
87
- ) {
88
- this.buttonSizeStyle = styleForButtonDimensions(
89
- newProps.heightPx,
90
- newProps.widthPx,
91
- );
92
-
93
- this._preInjectStyles();
94
- }
95
- }
96
-
97
- _preInjectStyles = () => {
98
- // HACK(charlie): Pre-inject all of the possible styles for the button.
99
- // This avoids a flickering effect in the echo animation whereby the
100
- // echoes vary in size as they animate. Note that we need to account for
101
- // the "initial" styles that `View` will include, as these styles are
102
- // applied to `View` components and Aphrodite will consolidate the style
103
- // object. This method must be called whenever a property that
104
- // influences the possible outcomes of `this._getFocusStyle` and
105
- // `this._getButtonStyle` changes (such as `this.buttonSizeStyle`).
106
- for (const type of KeyTypes) {
107
- css(View.styles.initial, ...this._getFocusStyle(type));
108
-
109
- for (const borders of Object.values(BorderStyles)) {
110
- css(
111
- View.styles.initial,
112
- ...this._getButtonStyle(type, borders),
113
- );
114
- }
115
- }
116
- };
117
-
118
- _getFocusStyle = (type: KeyType) => {
119
- let focusBackgroundStyle;
120
- if (type === "INPUT_NAVIGATION" || type === "KEYPAD_NAVIGATION") {
121
- focusBackgroundStyle = styles.light;
122
- } else {
123
- focusBackgroundStyle = styles.bright;
124
- }
125
-
126
- return [styles.focusBox, focusBackgroundStyle];
127
- };
128
-
129
- _getButtonStyle = (type, borders, style?) => {
130
- // Select the appropriate style for the button.
131
- let backgroundStyle;
132
- switch (type) {
133
- case "EMPTY":
134
- backgroundStyle = styles.empty;
135
- break;
136
-
137
- case "MANY":
138
- case "VALUE":
139
- backgroundStyle = styles.value;
140
- break;
141
-
142
- case "OPERATOR":
143
- backgroundStyle = styles.operator;
144
- break;
145
-
146
- case "INPUT_NAVIGATION":
147
- case "KEYPAD_NAVIGATION":
148
- backgroundStyle = styles.control;
149
- break;
150
-
151
- case "ECHO":
152
- backgroundStyle = null;
153
- break;
154
- }
155
-
156
- const borderStyle = [];
157
- if (borders.includes(BorderDirection.LEFT)) {
158
- // @ts-expect-error TS2345
159
- borderStyle.push(styles.leftBorder);
160
- }
161
- if (borders.includes(BorderDirection.BOTTOM)) {
162
- // @ts-expect-error TS2345
163
- borderStyle.push(styles.bottomBorder);
164
- }
165
-
166
- return [
167
- styles.buttonBase,
168
- backgroundStyle,
169
- ...borderStyle,
170
- type === "ECHO" && styles.echo,
171
- this.buttonSizeStyle,
172
- // React Native allows you to set the 'style' props on user defined
173
- // components.
174
- // See: https://facebook.github.io/react-native/docs/style.html
175
- ...(Array.isArray(style) ? style : [style]),
176
- ];
177
- };
178
-
179
- render() {
180
- const {
181
- ariaLabel,
182
- borders,
183
- childKeys,
184
- disabled,
185
- focused,
186
- icon,
187
- onTouchCancel,
188
- onTouchEnd,
189
- onTouchMove,
190
- onTouchStart,
191
- popoverEnabled,
192
- style,
193
- type,
194
- } = this.props;
195
-
196
- // We render in the focus state if the key is focused, or if it's an
197
- // echo.
198
- const renderFocused =
199
- (!disabled && focused) || popoverEnabled || type === "ECHO";
200
- const buttonStyle = this._getButtonStyle(type, borders, style);
201
- const focusStyle = this._getFocusStyle(type);
202
- const iconWrapperStyle = [
203
- styles.iconWrapper,
204
- disabled ? styles.disabled : undefined,
205
- ];
206
-
207
- const eventHandlers = {
208
- onTouchCancel,
209
- onTouchEnd,
210
- onTouchMove,
211
- onTouchStart,
212
- };
213
-
214
- const maybeFocusBox = renderFocused && <View style={focusStyle} />;
215
- const maybeCornerDecal = !renderFocused &&
216
- !disabled &&
217
- childKeys &&
218
- childKeys.length > 0 && <CornerDecal style={styles.decalInset} />;
219
-
220
- if (type === "EMPTY") {
221
- return <View style={buttonStyle} {...eventHandlers} />;
222
- } else if (type === "MANY") {
223
- // TODO(charlie): Make the long-press interaction accessible. See
224
- // the TODO in key-configs.js for more.
225
- const manyButtonA11yMarkup = {
226
- role: "button",
227
- ariaLabel: childKeys[0].ariaLabel,
228
- };
229
- const icons = childKeys.map((keyConfig) => {
230
- return keyConfig.icon;
231
- }) as ReadonlyArray<IconConfig>;
232
- return (
233
- <View
234
- style={buttonStyle}
235
- {...eventHandlers}
236
- {...manyButtonA11yMarkup}
237
- >
238
- {maybeFocusBox}
239
- <View style={iconWrapperStyle}>
240
- <MultiSymbolGrid
241
- icons={icons}
242
- focused={renderFocused}
243
- />
244
- </View>
245
- {maybeCornerDecal}
246
- </View>
247
- );
248
- } else {
249
- const a11yMarkup = {
250
- role: "button",
251
- ariaLabel: ariaLabel,
252
- };
253
-
254
- return (
255
- <View style={buttonStyle} {...eventHandlers} {...a11yMarkup}>
256
- {maybeFocusBox}
257
- <View style={iconWrapperStyle}>
258
- <Icon
259
- icon={icon as IconConfig}
260
- focused={renderFocused}
261
- />
262
- </View>
263
- {maybeCornerDecal}
264
- </View>
265
- );
266
- }
267
- }
268
- }
269
-
270
- const focusInsetPx = 4;
271
- const focusBoxZIndex = 0;
272
-
273
- const styles = StyleSheet.create({
274
- buttonBase: {
275
- flex: 1,
276
- cursor: "pointer",
277
- // Make the text unselectable
278
- userSelect: "none",
279
- justifyContent: "center",
280
- alignItems: "center",
281
- // Borders are made selectively visible.
282
- borderColor: innerBorderColor,
283
- borderStyle: innerBorderStyle,
284
- boxSizing: "border-box",
285
- },
286
-
287
- decalInset: {
288
- top: focusInsetPx,
289
- right: focusInsetPx,
290
- },
291
-
292
- // Overrides for the echo state, where we want to render the borders for
293
- // layout purposes, but we don't want them to be visible.
294
- echo: {
295
- borderColor: "transparent",
296
- },
297
-
298
- // Background colors and other base styles that may vary between key types.
299
- value: {
300
- backgroundColor: valueGrey,
301
- },
302
- operator: {
303
- backgroundColor: operatorGrey,
304
- },
305
- control: {
306
- backgroundColor: controlGrey,
307
- },
308
- empty: {
309
- backgroundColor: emptyGrey,
310
- cursor: "default",
311
- },
312
-
313
- bright: {
314
- backgroundColor: wonderBlocksBlue,
315
- },
316
- light: {
317
- backgroundColor: Color.offBlack32,
318
- },
319
-
320
- iconWrapper: {
321
- zIndex: focusBoxZIndex + 1,
322
- },
323
-
324
- focusBox: {
325
- position: "absolute",
326
- zIndex: focusBoxZIndex,
327
- left: focusInsetPx,
328
- right: focusInsetPx,
329
- bottom: focusInsetPx,
330
- top: focusInsetPx,
331
- borderRadius: 1,
332
- },
333
-
334
- disabled: {
335
- opacity: 0.3,
336
- },
337
-
338
- // Styles used to render the appropriate borders. Buttons are only allowed
339
- // to render left and bottom borders, to simplify layout.
340
- leftBorder: {
341
- borderLeftWidth: innerBorderWidthPx,
342
- },
343
- bottomBorder: {
344
- borderBottomWidth: innerBorderWidthPx,
345
- },
346
- });
347
-
348
- const styleForButtonDimensions = (heightPx, widthPx) => {
349
- return StyleSheet.create({
350
- // eslint-disable-next-line react-native/no-unused-styles
351
- buttonSize: {
352
- height: heightPx,
353
- width: widthPx,
354
- maxWidth: widthPx,
355
- },
356
- }).buttonSize;
357
- };
358
-
359
- const mapStateToProps = (state: State): ReduxProps => {
360
- return {
361
- heightPx: state.layout.buttonDimensions.height,
362
- widthPx: state.layout.buttonDimensions.width,
363
- };
364
- };
365
-
366
- export default connect(mapStateToProps, null, null, {forwardRef: true})(
367
- KeypadButton,
368
- );