@magmamath/students-features 0.9.0-rc4 → 0.9.0-rc6
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/dist/commonjs/features/keyboard/components/AlgebraLayout/AlgebraLayout.js +8 -2
- package/dist/commonjs/features/keyboard/components/AlgebraLayout/AlgebraLayout.js.map +1 -1
- package/dist/commonjs/features/keyboard/components/BasicExtendedLayout/BasicExtendedLayout.js +14 -5
- package/dist/commonjs/features/keyboard/components/BasicExtendedLayout/BasicExtendedLayout.js.map +1 -1
- package/dist/commonjs/features/keyboard/components/BasicExtendedPlusLayout/BasicExtendedPlusLayout.js +14 -3
- package/dist/commonjs/features/keyboard/components/BasicExtendedPlusLayout/BasicExtendedPlusLayout.js.map +1 -1
- package/dist/commonjs/features/keyboard/components/BasicLayout/BasicLayout.js +8 -1
- package/dist/commonjs/features/keyboard/components/BasicLayout/BasicLayout.js.map +1 -1
- package/dist/commonjs/features/keyboard/components/BasicLayout/CurrencyBasicLayout.js +8 -1
- package/dist/commonjs/features/keyboard/components/BasicLayout/CurrencyBasicLayout.js.map +1 -1
- package/dist/commonjs/features/keyboard/components/BasicLayout/TimeBasicLayout.js +8 -2
- package/dist/commonjs/features/keyboard/components/BasicLayout/TimeBasicLayout.js.map +1 -1
- package/dist/commonjs/features/keyboard/components/BasicLayout/keyboardGroup.js +1 -1
- package/dist/commonjs/features/keyboard/components/BasicLayout/keyboardGroup.js.map +1 -1
- package/dist/commonjs/features/keyboard/components/Keyboard.js +2 -1
- package/dist/commonjs/features/keyboard/components/Keyboard.js.map +1 -1
- package/dist/commonjs/features/keyboard/components/KeysList/KeysList.js +2 -15
- package/dist/commonjs/features/keyboard/components/KeysList/KeysList.js.map +1 -1
- package/dist/commonjs/features/keyboard/components/Numpad/Numpad.js +6 -1
- package/dist/commonjs/features/keyboard/components/Numpad/Numpad.js.map +1 -1
- package/dist/commonjs/features/keyboard/components/UnitsLayout/UnitTabs.js +7 -1
- package/dist/commonjs/features/keyboard/components/UnitsLayout/UnitTabs.js.map +1 -1
- package/dist/commonjs/features/keyboard/components/UnitsLayout/UnitsLayout.js +16 -2
- package/dist/commonjs/features/keyboard/components/UnitsLayout/UnitsLayout.js.map +1 -1
- package/dist/commonjs/features/keyboard/constants/keysValues.js +1 -1
- package/dist/commonjs/features/keyboard/constants/keysValues.js.map +1 -1
- package/dist/commonjs/features/keyboard/types/MathKeysGroups/calculusOperators.js +3 -3
- package/dist/commonjs/features/keyboard/types/MathKeysGroups/calculusOperators.js.map +1 -1
- package/dist/commonjs/features/keyboard/types/MathKeysGroups/specialOperators.js +2 -1
- package/dist/commonjs/features/keyboard/types/MathKeysGroups/specialOperators.js.map +1 -1
- package/dist/commonjs/features/keyboard/types/MathKeysGroups/trigonometric.js +7 -7
- package/dist/commonjs/features/keyboard/types/MathKeysGroups/units.js +5 -5
- package/dist/module/features/keyboard/components/AlgebraLayout/AlgebraLayout.js +9 -3
- package/dist/module/features/keyboard/components/AlgebraLayout/AlgebraLayout.js.map +1 -1
- package/dist/module/features/keyboard/components/BasicExtendedLayout/BasicExtendedLayout.js +14 -5
- package/dist/module/features/keyboard/components/BasicExtendedLayout/BasicExtendedLayout.js.map +1 -1
- package/dist/module/features/keyboard/components/BasicExtendedPlusLayout/BasicExtendedPlusLayout.js +14 -3
- package/dist/module/features/keyboard/components/BasicExtendedPlusLayout/BasicExtendedPlusLayout.js.map +1 -1
- package/dist/module/features/keyboard/components/BasicLayout/BasicLayout.js +8 -1
- package/dist/module/features/keyboard/components/BasicLayout/BasicLayout.js.map +1 -1
- package/dist/module/features/keyboard/components/BasicLayout/CurrencyBasicLayout.js +8 -1
- package/dist/module/features/keyboard/components/BasicLayout/CurrencyBasicLayout.js.map +1 -1
- package/dist/module/features/keyboard/components/BasicLayout/TimeBasicLayout.js +8 -2
- package/dist/module/features/keyboard/components/BasicLayout/TimeBasicLayout.js.map +1 -1
- package/dist/module/features/keyboard/components/BasicLayout/keyboardGroup.js +1 -1
- package/dist/module/features/keyboard/components/BasicLayout/keyboardGroup.js.map +1 -1
- package/dist/module/features/keyboard/components/Keyboard.js +2 -1
- package/dist/module/features/keyboard/components/Keyboard.js.map +1 -1
- package/dist/module/features/keyboard/components/KeysList/KeysList.js +2 -15
- package/dist/module/features/keyboard/components/KeysList/KeysList.js.map +1 -1
- package/dist/module/features/keyboard/components/Numpad/Numpad.js +7 -1
- package/dist/module/features/keyboard/components/Numpad/Numpad.js.map +1 -1
- package/dist/module/features/keyboard/components/UnitsLayout/UnitTabs.js +8 -2
- package/dist/module/features/keyboard/components/UnitsLayout/UnitTabs.js.map +1 -1
- package/dist/module/features/keyboard/components/UnitsLayout/UnitsLayout.js +17 -3
- package/dist/module/features/keyboard/components/UnitsLayout/UnitsLayout.js.map +1 -1
- package/dist/module/features/keyboard/constants/keysValues.js +2 -2
- package/dist/module/features/keyboard/constants/keysValues.js.map +1 -1
- package/dist/module/features/keyboard/types/MathKeysGroups/calculusOperators.js +3 -3
- package/dist/module/features/keyboard/types/MathKeysGroups/calculusOperators.js.map +1 -1
- package/dist/module/features/keyboard/types/MathKeysGroups/specialOperators.js +2 -1
- package/dist/module/features/keyboard/types/MathKeysGroups/specialOperators.js.map +1 -1
- package/dist/module/features/keyboard/types/MathKeysGroups/trigonometric.js +7 -7
- package/dist/module/features/keyboard/types/MathKeysGroups/units.js +5 -5
- package/dist/typescript/commonjs/features/keyboard/components/AlgebraLayout/AlgebraLayout.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/keyboard/components/BasicExtendedLayout/BasicExtendedLayout.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/keyboard/components/BasicExtendedPlusLayout/BasicExtendedPlusLayout.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/keyboard/components/BasicLayout/BasicLayout.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/keyboard/components/BasicLayout/CurrencyBasicLayout.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/keyboard/components/BasicLayout/TimeBasicLayout.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/keyboard/components/Keyboard.d.ts +2 -4
- package/dist/typescript/commonjs/features/keyboard/components/Keyboard.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/keyboard/components/KeysList/KeysList.d.ts +1 -1
- package/dist/typescript/commonjs/features/keyboard/components/KeysList/KeysList.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/keyboard/components/Numpad/Numpad.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/keyboard/components/UnitsLayout/UnitTabs.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/keyboard/components/UnitsLayout/UnitsLayout.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/keyboard/constants/keysValues.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/keyboard/types.d.ts +1 -2
- package/dist/typescript/commonjs/features/keyboard/types.d.ts.map +1 -1
- package/dist/typescript/module/features/keyboard/components/AlgebraLayout/AlgebraLayout.d.ts.map +1 -1
- package/dist/typescript/module/features/keyboard/components/BasicExtendedLayout/BasicExtendedLayout.d.ts.map +1 -1
- package/dist/typescript/module/features/keyboard/components/BasicExtendedPlusLayout/BasicExtendedPlusLayout.d.ts.map +1 -1
- package/dist/typescript/module/features/keyboard/components/BasicLayout/BasicLayout.d.ts.map +1 -1
- package/dist/typescript/module/features/keyboard/components/BasicLayout/CurrencyBasicLayout.d.ts.map +1 -1
- package/dist/typescript/module/features/keyboard/components/BasicLayout/TimeBasicLayout.d.ts.map +1 -1
- package/dist/typescript/module/features/keyboard/components/Keyboard.d.ts +2 -4
- package/dist/typescript/module/features/keyboard/components/Keyboard.d.ts.map +1 -1
- package/dist/typescript/module/features/keyboard/components/KeysList/KeysList.d.ts +1 -1
- package/dist/typescript/module/features/keyboard/components/KeysList/KeysList.d.ts.map +1 -1
- package/dist/typescript/module/features/keyboard/components/Numpad/Numpad.d.ts.map +1 -1
- package/dist/typescript/module/features/keyboard/components/UnitsLayout/UnitTabs.d.ts.map +1 -1
- package/dist/typescript/module/features/keyboard/components/UnitsLayout/UnitsLayout.d.ts.map +1 -1
- package/dist/typescript/module/features/keyboard/constants/keysValues.d.ts.map +1 -1
- package/dist/typescript/module/features/keyboard/types.d.ts +1 -2
- package/dist/typescript/module/features/keyboard/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/features/keyboard/components/AlgebraLayout/AlgebraLayout.tsx +3 -2
- package/src/features/keyboard/components/BasicExtendedLayout/BasicExtendedLayout.tsx +14 -5
- package/src/features/keyboard/components/BasicExtendedPlusLayout/BasicExtendedPlusLayout.tsx +14 -4
- package/src/features/keyboard/components/BasicLayout/BasicLayout.tsx +8 -1
- package/src/features/keyboard/components/BasicLayout/CurrencyBasicLayout.tsx +8 -1
- package/src/features/keyboard/components/BasicLayout/TimeBasicLayout.tsx +5 -1
- package/src/features/keyboard/components/BasicLayout/keyboardGroup.ts +1 -1
- package/src/features/keyboard/components/Keyboard.tsx +3 -4
- package/src/features/keyboard/components/KeysList/KeysList.tsx +5 -15
- package/src/features/keyboard/components/Numpad/Numpad.tsx +6 -1
- package/src/features/keyboard/components/UnitsLayout/UnitTabs.tsx +6 -2
- package/src/features/keyboard/components/UnitsLayout/UnitsLayout.tsx +11 -1
- package/src/features/keyboard/constants/keysValues.ts +2 -1
- package/src/features/keyboard/types/MathKeysGroups/calculusOperators.tsx +3 -3
- package/src/features/keyboard/types/MathKeysGroups/specialOperators.tsx +1 -1
- package/src/features/keyboard/types/MathKeysGroups/trigonometric.tsx +7 -7
- package/src/features/keyboard/types/MathKeysGroups/units.tsx +5 -5
- package/src/features/keyboard/types.ts +1 -2
|
@@ -1,18 +1,28 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import { KeysList } from '../KeysList/KeysList'
|
|
3
3
|
import { StyleSheet, View } from 'react-native'
|
|
4
|
-
import { KeyboardLayoutProps } from '../../types'
|
|
5
|
-
import {
|
|
4
|
+
import { KeyboardLayoutProps, KeyboardType } from '../../types'
|
|
5
|
+
import { IS_MOBILE } from '@magmamath/react-native-ui'
|
|
6
|
+
import { useText } from '../../../../shared/translation'
|
|
7
|
+
import { KEYBOARD_GROUPS_BY_LOCALE } from '../../constants/keysValues'
|
|
8
|
+
import { Locale } from '@magmamath/students-features'
|
|
6
9
|
|
|
7
10
|
export const BasicExtendedLayout = (props: KeyboardLayoutProps) => {
|
|
11
|
+
const t = useText()
|
|
12
|
+
const keysGroup = KEYBOARD_GROUPS_BY_LOCALE[t('locale') as Locale][KeyboardType.BasicExtended]
|
|
13
|
+
|
|
8
14
|
return (
|
|
9
15
|
<View style={styles.container}>
|
|
10
16
|
<KeysList
|
|
11
|
-
keys={
|
|
17
|
+
keys={keysGroup.keys}
|
|
12
18
|
numOfRows={3}
|
|
13
19
|
style={{
|
|
14
20
|
container: styles.keysContainer,
|
|
15
|
-
option: {
|
|
21
|
+
option: {
|
|
22
|
+
button: styles.option,
|
|
23
|
+
text: styles.text,
|
|
24
|
+
...(IS_MOBILE && { container: IS_MOBILE && { flexBasis: 50 } }),
|
|
25
|
+
},
|
|
16
26
|
}}
|
|
17
27
|
{...props}
|
|
18
28
|
/>
|
|
@@ -36,5 +46,4 @@ const styles = StyleSheet.create({
|
|
|
36
46
|
text: {
|
|
37
47
|
fontStyle: 'italic',
|
|
38
48
|
},
|
|
39
|
-
optionContainer: {},
|
|
40
49
|
})
|
package/src/features/keyboard/components/BasicExtendedPlusLayout/BasicExtendedPlusLayout.tsx
CHANGED
|
@@ -1,18 +1,28 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import { StyleSheet, View } from 'react-native'
|
|
3
3
|
import { KeysList } from '../KeysList/KeysList'
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { KeyboardLayoutProps, KeyboardType } from '../../types'
|
|
5
|
+
import { IS_MOBILE } from '@magmamath/react-native-ui'
|
|
6
|
+
import { useText } from '../../../../shared/translation'
|
|
7
|
+
import { KEYBOARD_GROUPS_BY_LOCALE } from '../../constants/keysValues'
|
|
8
|
+
import { Locale } from '@magmamath/students-features'
|
|
6
9
|
|
|
7
10
|
export const BasicExtendedPlusLayout = (props: KeyboardLayoutProps) => {
|
|
11
|
+
const t = useText()
|
|
12
|
+
const keysGroup = KEYBOARD_GROUPS_BY_LOCALE[t('locale') as Locale][KeyboardType.BasicExtendedPlus]
|
|
13
|
+
|
|
8
14
|
return (
|
|
9
15
|
<View style={styles.container}>
|
|
10
16
|
<KeysList
|
|
11
|
-
keys={
|
|
17
|
+
keys={keysGroup.keys}
|
|
12
18
|
numOfRows={3}
|
|
13
19
|
style={{
|
|
14
20
|
container: styles.keysContainer,
|
|
15
|
-
option: {
|
|
21
|
+
option: {
|
|
22
|
+
button: styles.option,
|
|
23
|
+
text: styles.text,
|
|
24
|
+
...(IS_MOBILE && { container: { flexBasis: 50, maxWidth: 50 } }),
|
|
25
|
+
},
|
|
16
26
|
}}
|
|
17
27
|
{...props}
|
|
18
28
|
/>
|
|
@@ -3,6 +3,7 @@ import { KeysList } from '../KeysList/KeysList'
|
|
|
3
3
|
import { StyleSheet, View } from 'react-native'
|
|
4
4
|
import { KeyboardLayoutProps } from '../../types'
|
|
5
5
|
import { MATH_ENTRY_BASIC_KEYBOARD_GROUP } from './keyboardGroup'
|
|
6
|
+
import { IS_MOBILE } from '@magmamath/react-native-ui'
|
|
6
7
|
|
|
7
8
|
export const BasicLayout = (props: KeyboardLayoutProps & PropsWithChildren) => {
|
|
8
9
|
const keys = props.children
|
|
@@ -14,7 +15,13 @@ export const BasicLayout = (props: KeyboardLayoutProps & PropsWithChildren) => {
|
|
|
14
15
|
keys={keys}
|
|
15
16
|
numOfRows={2}
|
|
16
17
|
{...props}
|
|
17
|
-
style={{
|
|
18
|
+
style={{
|
|
19
|
+
container: styles.keysContainer,
|
|
20
|
+
option: {
|
|
21
|
+
button: styles.keyOption,
|
|
22
|
+
...(IS_MOBILE && { container: { flexBasis: 45, maxWidth: 45 } }),
|
|
23
|
+
},
|
|
24
|
+
}}
|
|
18
25
|
/>
|
|
19
26
|
{props.children || null}
|
|
20
27
|
</View>
|
|
@@ -5,6 +5,7 @@ import { BasicLayout } from './BasicLayout'
|
|
|
5
5
|
import { KeyboardLayoutProps, KeyboardType } from '../../types'
|
|
6
6
|
import { Locale, useText } from '../../../../shared/translation'
|
|
7
7
|
import { KEYBOARD_GROUPS_BY_LOCALE } from '../../constants/keysValues'
|
|
8
|
+
import { IS_MOBILE } from '@magmamath/react-native-ui'
|
|
8
9
|
|
|
9
10
|
export const CurrencyBasicLayout = (props: KeyboardLayoutProps) => {
|
|
10
11
|
const t = useText()
|
|
@@ -15,7 +16,13 @@ export const CurrencyBasicLayout = (props: KeyboardLayoutProps) => {
|
|
|
15
16
|
<KeysList
|
|
16
17
|
keys={keysGroup.keys}
|
|
17
18
|
numOfRows={keysGroup.keys.length}
|
|
18
|
-
style={{
|
|
19
|
+
style={{
|
|
20
|
+
container: styles.keysContainer,
|
|
21
|
+
option: {
|
|
22
|
+
text: styles.optionText,
|
|
23
|
+
...(IS_MOBILE && { container: { flexBasis: 45, maxWidth: 45 } }),
|
|
24
|
+
},
|
|
25
|
+
}}
|
|
19
26
|
{...props}
|
|
20
27
|
/>
|
|
21
28
|
</BasicLayout>
|
|
@@ -5,6 +5,7 @@ import { BasicLayout } from './BasicLayout'
|
|
|
5
5
|
import { KeyboardLayoutProps, KeyboardType } from '../../types'
|
|
6
6
|
import { useText, Locale } from '../../../../shared/translation'
|
|
7
7
|
import { KEYBOARD_GROUPS_BY_LOCALE } from '../../constants/keysValues'
|
|
8
|
+
import { IS_MOBILE } from '@magmamath/react-native-ui'
|
|
8
9
|
|
|
9
10
|
export const TimeBasicLayout = (props: KeyboardLayoutProps) => {
|
|
10
11
|
const t = useText()
|
|
@@ -16,7 +17,10 @@ export const TimeBasicLayout = (props: KeyboardLayoutProps) => {
|
|
|
16
17
|
keys={keysGroup.keys}
|
|
17
18
|
numOfRows={keysGroup.numOfRows || keysGroup.keys.length}
|
|
18
19
|
style={{
|
|
19
|
-
option: {
|
|
20
|
+
option: {
|
|
21
|
+
text: styles.keysText,
|
|
22
|
+
...(IS_MOBILE && { container: { flexBasis: 45, maxWidth: 45 } }),
|
|
23
|
+
},
|
|
20
24
|
container: styles.keysContainer,
|
|
21
25
|
}}
|
|
22
26
|
{...props}
|
|
@@ -35,7 +35,7 @@ export const MATH_TIME_US_KEYBOARD_GROUP: KeyboardGroup = {
|
|
|
35
35
|
|
|
36
36
|
export const MATH_CURRENCY_SW_KEYBOARD_GROUP: KeyboardGroup = {
|
|
37
37
|
id: 'math-entry-currency-sw',
|
|
38
|
-
keys: [MATH_CURRENCY_UNITS.KRONE, MATH_CURRENCY_UNITS.
|
|
38
|
+
keys: [MATH_CURRENCY_UNITS.KRONE, MATH_CURRENCY_UNITS.EURO, MATH_CURRENCY_UNITS.POUND],
|
|
39
39
|
}
|
|
40
40
|
export const MATH_CURRENCY_UK_KEYBOARD_GROUP: KeyboardGroup = {
|
|
41
41
|
id: 'math-entry-currency-uk',
|
|
@@ -10,15 +10,13 @@ import {
|
|
|
10
10
|
import { COLORS, SelectOptionColor } from '@magmamath/react-native-ui'
|
|
11
11
|
import { Numpad } from './Numpad/Numpad'
|
|
12
12
|
import { getLayoutByCharType } from '../constants/keyboardLayouts'
|
|
13
|
-
import {
|
|
13
|
+
import { KeyboardKeyValue } from '../types'
|
|
14
14
|
|
|
15
15
|
type KeyboardProps = {
|
|
16
|
-
onKeyPress: ({ katexValue, mathliveValue }: KeyboardKeyValue) => void
|
|
16
|
+
onKeyPress: ({ katexValue, mathliveValue, isSpecialSymbol }: KeyboardKeyValue) => void
|
|
17
17
|
characterType?: number
|
|
18
18
|
style?: StyleProp<ViewStyle>
|
|
19
19
|
color?: SelectOptionColor
|
|
20
|
-
onBackspacePress?: () => void
|
|
21
|
-
onSpecialKeyPress?: (value: KeyboardKey) => void
|
|
22
20
|
visible?: boolean
|
|
23
21
|
isSpecialButtonsDisabled?: boolean
|
|
24
22
|
isDisabled?: boolean
|
|
@@ -73,5 +71,6 @@ const styles = StyleSheet.create({
|
|
|
73
71
|
borderWidth: 1,
|
|
74
72
|
width: 'auto',
|
|
75
73
|
overflow: 'hidden',
|
|
74
|
+
minHeight: 155,
|
|
76
75
|
},
|
|
77
76
|
})
|
|
@@ -7,7 +7,6 @@ import {
|
|
|
7
7
|
SelectOptionSize,
|
|
8
8
|
} from '@magmamath/react-native-ui'
|
|
9
9
|
import { KeyboardKey, KeyboardLayoutProps } from '../../types'
|
|
10
|
-
import { MathSpecialOperator } from '../../types/MathKeysGroups/specialOperators'
|
|
11
10
|
import { DISABLED_KEYS } from '../../constants/keysValues'
|
|
12
11
|
|
|
13
12
|
type KeysListProps = {
|
|
@@ -25,8 +24,6 @@ export const KeysList = ({
|
|
|
25
24
|
numOfRows,
|
|
26
25
|
style,
|
|
27
26
|
onKeyPress,
|
|
28
|
-
onSpecialKeyPress,
|
|
29
|
-
onBackspacePress,
|
|
30
27
|
isSpecialButtonsDisabled,
|
|
31
28
|
isDisabled,
|
|
32
29
|
}: KeysListProps) => {
|
|
@@ -56,18 +53,11 @@ export const KeysList = ({
|
|
|
56
53
|
onOptionChange={(option) => {
|
|
57
54
|
const key = keys.find((k) => k.katexValue === option.key)
|
|
58
55
|
if (!key) return
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
onSpecialKeyPress?.({
|
|
65
|
-
katexValue: key.katexValue,
|
|
66
|
-
mathliveValue: key.mathliveValue,
|
|
67
|
-
})
|
|
68
|
-
return
|
|
69
|
-
}
|
|
70
|
-
onKeyPress?.({ katexValue: key.katexValue, mathliveValue: key.mathliveValue })
|
|
56
|
+
onKeyPress?.({
|
|
57
|
+
katexValue: key.katexValue,
|
|
58
|
+
mathliveValue: key.mathliveValue,
|
|
59
|
+
isSpecialSymbol: key.isSpecialSymbol,
|
|
60
|
+
})
|
|
71
61
|
}}
|
|
72
62
|
/>
|
|
73
63
|
)
|
|
@@ -5,6 +5,7 @@ import { COLORS, SPACING } from '@magmamath/react-native-ui'
|
|
|
5
5
|
import { KeyboardLayoutProps, KeyboardType } from '../../types'
|
|
6
6
|
import { Locale, useText } from '../../../../shared/translation'
|
|
7
7
|
import { getKeyboardGroup } from '../../helpers'
|
|
8
|
+
import { IS_MOBILE } from '@magmamath/react-native-ui'
|
|
8
9
|
|
|
9
10
|
export const Numpad = (props: KeyboardLayoutProps) => {
|
|
10
11
|
const t = useText()
|
|
@@ -17,7 +18,11 @@ export const Numpad = (props: KeyboardLayoutProps) => {
|
|
|
17
18
|
numOfRows={3}
|
|
18
19
|
style={{
|
|
19
20
|
container: styles.keysContainer,
|
|
20
|
-
option: {
|
|
21
|
+
option: {
|
|
22
|
+
text: styles.keyText,
|
|
23
|
+
button: styles.keyButton,
|
|
24
|
+
...(IS_MOBILE && { container: { flexBasis: 45 } }),
|
|
25
|
+
},
|
|
21
26
|
}}
|
|
22
27
|
{...props}
|
|
23
28
|
/>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import { KeysList } from '../KeysList/KeysList'
|
|
3
3
|
import { StyleSheet, View } from 'react-native'
|
|
4
|
-
import { COLORS, TabGroup, TabOptionProps, TabVariant } from '@magmamath/react-native-ui'
|
|
4
|
+
import { COLORS, TabGroup, TabOptionProps, TabVariant, IS_MOBILE } from '@magmamath/react-native-ui'
|
|
5
5
|
import {
|
|
6
6
|
KEYBOARD_UNITS_GROUPS_BY_LOCALE,
|
|
7
7
|
KeyboardUnitsGroupType,
|
|
@@ -38,7 +38,11 @@ export const UnitTabs = ({ activeTab, tabs, onTabChange, ...props }: UnitTabsPro
|
|
|
38
38
|
numOfRows={1}
|
|
39
39
|
style={{
|
|
40
40
|
container: styles.keysContainer,
|
|
41
|
-
option: {
|
|
41
|
+
option: {
|
|
42
|
+
button: styles.option,
|
|
43
|
+
text: styles.text,
|
|
44
|
+
...(IS_MOBILE && { container: { flexBasis: 58, maxWidth: 58 } }),
|
|
45
|
+
},
|
|
42
46
|
}}
|
|
43
47
|
{...props}
|
|
44
48
|
/>
|
|
@@ -4,6 +4,7 @@ import { StyleSheet, View } from 'react-native'
|
|
|
4
4
|
import {
|
|
5
5
|
COLORS,
|
|
6
6
|
FONT_FAMILY,
|
|
7
|
+
IS_MOBILE,
|
|
7
8
|
RulerIcon,
|
|
8
9
|
SelectGroup,
|
|
9
10
|
SelectOptionSize,
|
|
@@ -112,6 +113,8 @@ export const UnitsLayout = (props: KeyboardLayoutProps) => {
|
|
|
112
113
|
]
|
|
113
114
|
}, [activeTab, selectedLayout])
|
|
114
115
|
|
|
116
|
+
console.log('IS_MOBILE', IS_MOBILE)
|
|
117
|
+
|
|
115
118
|
return (
|
|
116
119
|
<View style={styles.container}>
|
|
117
120
|
<SelectGroup
|
|
@@ -120,6 +123,7 @@ export const UnitsLayout = (props: KeyboardLayoutProps) => {
|
|
|
120
123
|
size={SelectOptionSize.SMALL}
|
|
121
124
|
style={{
|
|
122
125
|
container: styles.optionContainer,
|
|
126
|
+
option: { ...(IS_MOBILE && { container: { flexBasis: 45 } }) },
|
|
123
127
|
}}
|
|
124
128
|
color={props.color}
|
|
125
129
|
selectedOptions={[
|
|
@@ -143,7 +147,13 @@ export const UnitsLayout = (props: KeyboardLayoutProps) => {
|
|
|
143
147
|
keys={basicExtendedKeys.keys}
|
|
144
148
|
numOfRows={3}
|
|
145
149
|
{...props}
|
|
146
|
-
style={{
|
|
150
|
+
style={{
|
|
151
|
+
container: styles.basicExtendedContainer,
|
|
152
|
+
option: {
|
|
153
|
+
button: styles.key,
|
|
154
|
+
...(IS_MOBILE && { container: { flexBasis: 45, maxWidth: 45 } }),
|
|
155
|
+
},
|
|
156
|
+
}}
|
|
147
157
|
/>
|
|
148
158
|
)}
|
|
149
159
|
</View>
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { KeyboardGroup, KeyboardKey, KeyboardType } from '../types'
|
|
2
2
|
import {
|
|
3
3
|
MATH_CURRENCY_SW_KEYBOARD_GROUP,
|
|
4
|
+
MATH_CURRENCY_UK_KEYBOARD_GROUP,
|
|
4
5
|
MATH_CURRENCY_US_KEYBOARD_GROUP,
|
|
5
6
|
MATH_ENTRY_BASIC_KEYBOARD_GROUP,
|
|
6
7
|
MATH_TIME_SW_KEYBOARD_GROUP,
|
|
@@ -60,7 +61,7 @@ export const KEYBOARD_GROUPS_BY_LOCALE: Record<Locale, Record<KeyboardType, Keyb
|
|
|
60
61
|
...MATH_ENTRY_LENGTH_UNITS_US_KEYBOARD_GROUPS,
|
|
61
62
|
keys: MATH_ENTRY_LENGTH_UNITS_US_KEYBOARD_GROUPS.keys[0],
|
|
62
63
|
},
|
|
63
|
-
[KeyboardType.BasicCurrency]:
|
|
64
|
+
[KeyboardType.BasicCurrency]: MATH_CURRENCY_UK_KEYBOARD_GROUP,
|
|
64
65
|
[KeyboardType.BasicTime]: MATH_TIME_SW_KEYBOARD_GROUP,
|
|
65
66
|
[KeyboardType.AlgebraAdvanced]: MATH_ENTRY_ALGEBRA_KEYBOARD_GROUP,
|
|
66
67
|
[KeyboardType.Numpad]: MATH_ENTRY_NUMBERS_US_KEYBOARD_GROUP,
|
|
@@ -19,7 +19,7 @@ export const MATH_INTEGRALS_AND_DERIVATIVES: MathKeysGroup<
|
|
|
19
19
|
> = {
|
|
20
20
|
[MathIntegralsAndDerivativesOperator.INTEGRAL]: {
|
|
21
21
|
icon: <IntegralIcon {...DEFAULT_KEY_ICON_PROPS} />,
|
|
22
|
-
mathliveValue: '
|
|
22
|
+
mathliveValue: 'test',
|
|
23
23
|
katexValue: '∫',
|
|
24
24
|
},
|
|
25
25
|
[MathIntegralsAndDerivativesOperator.DOUBLE_INTEGRAL]: {
|
|
@@ -31,8 +31,8 @@ export const MATH_INTEGRALS_AND_DERIVATIVES: MathKeysGroup<
|
|
|
31
31
|
icon: (
|
|
32
32
|
<DefiniteIntegralIcon {...DEFAULT_KEY_ICON_PROPS} size={20} extraColor={COLORS.NEUTRAL_6} />
|
|
33
33
|
),
|
|
34
|
-
mathliveValue: '
|
|
35
|
-
katexValue: '
|
|
34
|
+
mathliveValue: '\\int_{\\placeholder{lower}}^{\\placeholder{upper}}',
|
|
35
|
+
katexValue: '\\int_{a}^{b}',
|
|
36
36
|
},
|
|
37
37
|
[MathIntegralsAndDerivativesOperator.DERIVATIVE]: {
|
|
38
38
|
icon: <DerivativeIcon {...DEFAULT_KEY_ICON_PROPS} size={20} />,
|
|
@@ -33,7 +33,7 @@ export const MATH_SPECIAL_OPERATORS: MathKeysGroup<typeof MathSpecialOperator> =
|
|
|
33
33
|
katexValue: 'log₁₀',
|
|
34
34
|
},
|
|
35
35
|
[MathSpecialOperator.BACKSPACE]: {
|
|
36
|
-
icon: <BackspaceIcon {...DEFAULT_KEY_ICON_PROPS} />,
|
|
36
|
+
icon: <BackspaceIcon {...DEFAULT_KEY_ICON_PROPS} size={20} />,
|
|
37
37
|
mathliveValue: 'backspace',
|
|
38
38
|
katexValue: 'backspace',
|
|
39
39
|
},
|
|
@@ -24,17 +24,17 @@ export const MATH_BASIC_TRIGONOMETRIC_FUNCTIONS: MathKeysGroup<
|
|
|
24
24
|
[MathBasicTrigonometricFunction.SIN]: {
|
|
25
25
|
label: 'sin',
|
|
26
26
|
mathliveValue: '$\\sin(\\placeholder{})$',
|
|
27
|
-
katexValue: 'sin',
|
|
27
|
+
katexValue: 'sin()',
|
|
28
28
|
},
|
|
29
29
|
[MathBasicTrigonometricFunction.COS]: {
|
|
30
30
|
label: 'cos',
|
|
31
31
|
mathliveValue: '$\\cos(\\placeholder{})$',
|
|
32
|
-
katexValue: 'cos',
|
|
32
|
+
katexValue: 'cos()',
|
|
33
33
|
},
|
|
34
34
|
[MathBasicTrigonometricFunction.TAN]: {
|
|
35
35
|
label: 'tan',
|
|
36
36
|
mathliveValue: '$\\tan(\\placeholder{})$',
|
|
37
|
-
katexValue: 'tan',
|
|
37
|
+
katexValue: 'tan()',
|
|
38
38
|
},
|
|
39
39
|
[MathBasicTrigonometricFunction.COT]: {
|
|
40
40
|
label: 'cot',
|
|
@@ -59,22 +59,22 @@ export const MATH_INVERSE_TRIGONOMETRIC_FUNCTIONS: MathKeysGroup<
|
|
|
59
59
|
[MathInverseTrigonometricFunction.ARCSIN]: {
|
|
60
60
|
label: 'arcsin',
|
|
61
61
|
mathliveValue: '$\\arcsin(\\placeholder{})$',
|
|
62
|
-
katexValue: 'arcsin',
|
|
62
|
+
katexValue: 'arcsin()',
|
|
63
63
|
},
|
|
64
64
|
[MathInverseTrigonometricFunction.ARCCOS]: {
|
|
65
65
|
label: 'arccos',
|
|
66
66
|
mathliveValue: '$\\arccos(\\placeholder{})$',
|
|
67
|
-
katexValue: 'arccos',
|
|
67
|
+
katexValue: 'arccos()',
|
|
68
68
|
},
|
|
69
69
|
[MathInverseTrigonometricFunction.ARCTAN]: {
|
|
70
70
|
label: 'arctan',
|
|
71
71
|
mathliveValue: '$\\arctan(\\placeholder{})$',
|
|
72
|
-
katexValue: 'arctan',
|
|
72
|
+
katexValue: 'arctan()',
|
|
73
73
|
},
|
|
74
74
|
[MathInverseTrigonometricFunction.ARCCOT]: {
|
|
75
75
|
label: 'arccot',
|
|
76
76
|
mathliveValue: '$\\operatorname{arccot}(\\placeholder{})$',
|
|
77
|
-
katexValue: 'arccot',
|
|
77
|
+
katexValue: 'arccot()',
|
|
78
78
|
},
|
|
79
79
|
[MathInverseTrigonometricFunction.ARCSEC]: {
|
|
80
80
|
label: 'arcsec',
|
|
@@ -108,7 +108,7 @@ export const MATH_CURRENCY_UNITS: MathKeysGroup<typeof MathCurrencyUnit> = {
|
|
|
108
108
|
[MathCurrencyUnit.DOLLAR]: {
|
|
109
109
|
icon: <DollarIcon {...DEFAULT_KEY_ICON_PROPS} />,
|
|
110
110
|
mathliveValue: '\\$',
|
|
111
|
-
katexValue: '
|
|
111
|
+
katexValue: '\$',
|
|
112
112
|
},
|
|
113
113
|
[MathCurrencyUnit.EURO]: {
|
|
114
114
|
icon: <EuroIcon {...DEFAULT_KEY_ICON_PROPS} />,
|
|
@@ -132,8 +132,8 @@ export const MATH_CURRENCY_UNITS: MathKeysGroup<typeof MathCurrencyUnit> = {
|
|
|
132
132
|
},
|
|
133
133
|
[MathCurrencyUnit.CENT]: {
|
|
134
134
|
icon: <CentIcon {...DEFAULT_KEY_ICON_PROPS} />,
|
|
135
|
-
mathliveValue: '
|
|
136
|
-
katexValue: '
|
|
135
|
+
mathliveValue: '¢',
|
|
136
|
+
katexValue: '¢',
|
|
137
137
|
},
|
|
138
138
|
}
|
|
139
139
|
|
|
@@ -300,9 +300,9 @@ export const MATH_VOLUME_UNITS: MathKeysGroup<typeof MathVolumeUnit> = {
|
|
|
300
300
|
katexValue: 'yd^3',
|
|
301
301
|
},
|
|
302
302
|
[MathVolumeUnit.MILLILITER]: {
|
|
303
|
-
label: '
|
|
303
|
+
label: 'ml',
|
|
304
304
|
mathliveValue: '\\mathrm{mL}',
|
|
305
|
-
katexValue: '
|
|
305
|
+
katexValue: 'ml',
|
|
306
306
|
},
|
|
307
307
|
[MathVolumeUnit.LITER]: {
|
|
308
308
|
label: 'L',
|
|
@@ -23,6 +23,7 @@ export type KeyboardKey = {
|
|
|
23
23
|
export type KeyboardKeyValue = {
|
|
24
24
|
katexValue: string
|
|
25
25
|
mathliveValue?: string
|
|
26
|
+
isSpecialSymbol?: boolean
|
|
26
27
|
}
|
|
27
28
|
|
|
28
29
|
export type KeyboardGroup = {
|
|
@@ -34,8 +35,6 @@ export type KeyboardGroup = {
|
|
|
34
35
|
|
|
35
36
|
export type KeyboardLayoutProps = {
|
|
36
37
|
onKeyPress: (key: KeyboardKeyValue) => void
|
|
37
|
-
onSpecialKeyPress?: (key: KeyboardKeyValue) => void
|
|
38
|
-
onBackspacePress?: () => void
|
|
39
38
|
color?: SelectOptionColor
|
|
40
39
|
isSpecialButtonsDisabled?: boolean
|
|
41
40
|
isDisabled?: boolean
|