@draftbit/core 48.4.3-2c0125.2 → 48.4.4-c4bd53.2
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/lib/commonjs/components/PinInput/CustomPinInputCell.js +1 -0
- package/lib/commonjs/components/PinInput/PinInput.js +1 -0
- package/lib/commonjs/components/{CodeInput/CodeInputText.js → PinInput/PinInputText.js} +1 -1
- package/lib/commonjs/components/PinInput/index.js +1 -0
- package/lib/commonjs/index.js +1 -1
- package/lib/commonjs/utilities.js +1 -1
- package/lib/typescript/src/components/PinInput/CustomPinInputCell.d.ts +11 -0
- package/lib/typescript/src/components/PinInput/CustomPinInputCell.js +11 -0
- package/lib/typescript/src/components/PinInput/CustomPinInputCell.js.map +1 -0
- package/lib/typescript/src/components/PinInput/PinInput.d.ts +30 -0
- package/lib/typescript/src/components/PinInput/PinInput.js +70 -0
- package/lib/typescript/src/components/PinInput/PinInput.js.map +1 -0
- package/lib/typescript/src/components/{CodeInput/CodeInputText.d.ts → PinInput/PinInputText.d.ts} +3 -3
- package/lib/typescript/src/components/{CodeInput/CodeInputText.js → PinInput/PinInputText.js} +4 -4
- package/lib/typescript/src/components/PinInput/PinInputText.js.map +1 -0
- package/lib/typescript/src/components/PinInput/index.d.ts +3 -0
- package/lib/typescript/src/components/PinInput/index.js +4 -0
- package/lib/typescript/src/components/PinInput/index.js.map +1 -0
- package/lib/typescript/src/index.d.ts +1 -1
- package/lib/typescript/src/index.js +1 -1
- package/lib/typescript/src/index.js.map +1 -1
- package/lib/typescript/src/utilities.js +6 -0
- package/lib/typescript/src/utilities.js.map +1 -1
- package/lib/typescript/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/src/components/PinInput/CustomPinInputCell.js +11 -0
- package/src/components/PinInput/CustomPinInputCell.js.map +1 -0
- package/src/components/PinInput/CustomPinInputCell.tsx +18 -0
- package/src/components/PinInput/PinInput.js +70 -0
- package/src/components/PinInput/PinInput.js.map +1 -0
- package/src/components/PinInput/PinInput.tsx +165 -0
- package/src/components/{CodeInput/CodeInputText.js → PinInput/PinInputText.js} +4 -4
- package/src/components/PinInput/PinInputText.js.map +1 -0
- package/src/components/{CodeInput/CodeInputText.tsx → PinInput/PinInputText.tsx} +4 -4
- package/src/components/PinInput/index.js +4 -0
- package/src/components/PinInput/index.js.map +1 -0
- package/src/components/PinInput/index.tsx +3 -0
- package/src/index.js +1 -1
- package/src/index.js.map +1 -1
- package/src/index.tsx +4 -4
- package/src/utilities.js +6 -0
- package/src/utilities.js.map +1 -1
- package/src/utilities.ts +7 -0
- package/lib/commonjs/components/CodeInput/CodeInput.js +0 -1
- package/lib/commonjs/components/CodeInput/CodeInputCell.js +0 -1
- package/lib/commonjs/components/CodeInput/index.js +0 -1
- package/lib/typescript/src/components/CodeInput/CodeInput.d.ts +0 -18
- package/lib/typescript/src/components/CodeInput/CodeInput.js +0 -30
- package/lib/typescript/src/components/CodeInput/CodeInput.js.map +0 -1
- package/lib/typescript/src/components/CodeInput/CodeInputCell.d.ts +0 -16
- package/lib/typescript/src/components/CodeInput/CodeInputCell.js +0 -43
- package/lib/typescript/src/components/CodeInput/CodeInputCell.js.map +0 -1
- package/lib/typescript/src/components/CodeInput/CodeInputText.js.map +0 -1
- package/lib/typescript/src/components/CodeInput/index.d.ts +0 -3
- package/lib/typescript/src/components/CodeInput/index.js +0 -4
- package/lib/typescript/src/components/CodeInput/index.js.map +0 -1
- package/src/components/CodeInput/CodeInput.js +0 -30
- package/src/components/CodeInput/CodeInput.js.map +0 -1
- package/src/components/CodeInput/CodeInput.tsx +0 -95
- package/src/components/CodeInput/CodeInputCell.js +0 -43
- package/src/components/CodeInput/CodeInputCell.js.map +0 -1
- package/src/components/CodeInput/CodeInputCell.tsx +0 -73
- package/src/components/CodeInput/CodeInputText.js.map +0 -1
- package/src/components/CodeInput/index.js +0 -4
- package/src/components/CodeInput/index.js.map +0 -1
- package/src/components/CodeInput/index.tsx +0 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@draftbit/core",
|
|
3
|
-
"version": "48.4.
|
|
3
|
+
"version": "48.4.4-c4bd53.2+c4bd530",
|
|
4
4
|
"description": "Core (non-native) Components",
|
|
5
5
|
"main": "lib/commonjs/index.js",
|
|
6
6
|
"types": "lib/typescript/src/index.d.ts",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"@date-io/date-fns": "^1.3.13",
|
|
43
43
|
"@draftbit/react-theme-provider": "^2.1.1",
|
|
44
|
-
"@draftbit/types": "^48.4.
|
|
44
|
+
"@draftbit/types": "^48.4.4-c4bd53.2+c4bd530",
|
|
45
45
|
"@expo/vector-icons": "^13.0.0",
|
|
46
46
|
"@material-ui/core": "^4.11.0",
|
|
47
47
|
"@material-ui/pickers": "^3.2.10",
|
|
@@ -100,5 +100,5 @@
|
|
|
100
100
|
],
|
|
101
101
|
"testEnvironment": "node"
|
|
102
102
|
},
|
|
103
|
-
"gitHead": "
|
|
103
|
+
"gitHead": "c4bd530c93d70dafb1bc63b661cb1a27e6259057"
|
|
104
104
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { View } from "react-native";
|
|
3
|
+
/**
|
|
4
|
+
* Simple View wrapper component to create a custom pin input cell
|
|
5
|
+
* Meant to be used in PinInput's renderItem
|
|
6
|
+
*/
|
|
7
|
+
const CustomPinInputCell = ({ style, children }) => {
|
|
8
|
+
return React.createElement(View, { style: style, children: children });
|
|
9
|
+
};
|
|
10
|
+
export default CustomPinInputCell;
|
|
11
|
+
//# sourceMappingURL=CustomPinInputCell.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CustomPinInputCell.js","sourceRoot":"","sources":["CustomPinInputCell.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAwB,IAAI,EAAE,MAAM,cAAc,CAAC;AAM1D;;;GAGG;AACH,MAAM,kBAAkB,GAEpB,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,EAAE;IAC1B,OAAO,oBAAC,IAAI,IAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,GAAI,CAAC;AACpD,CAAC,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { StyleProp, ViewStyle, View } from "react-native";
|
|
3
|
+
|
|
4
|
+
interface CustomPinInputCellProps {
|
|
5
|
+
style?: StyleProp<ViewStyle>;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Simple View wrapper component to create a custom pin input cell
|
|
10
|
+
* Meant to be used in PinInput's renderItem
|
|
11
|
+
*/
|
|
12
|
+
const CustomPinInputCell: React.FC<
|
|
13
|
+
React.PropsWithChildren<CustomPinInputCellProps>
|
|
14
|
+
> = ({ style, children }) => {
|
|
15
|
+
return <View style={style} children={children} />;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export default CustomPinInputCell;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { View, StyleSheet, } from "react-native";
|
|
3
|
+
import TextInput from "../TextInput";
|
|
4
|
+
import { CodeField, useClearByFocusCell, } from "react-native-confirmation-code-field";
|
|
5
|
+
import { withTheme } from "../../theming";
|
|
6
|
+
import PinInputText from "./PinInputText";
|
|
7
|
+
import { extractStyles } from "../../utilities";
|
|
8
|
+
const PinInput = React.forwardRef(({ theme, onInputFull, cellCount = 4, clearOnCellFocus = true, blurOnFull = true, renderItem, value, onChangeText, focusedBorderColor = theme.colors.primary, unFocusedBorderColor = theme.colors.disabled, focusedBackgroundColor, unFocusedBackgroundColor, focusedBorderWidth = 2, unFocusedBorderWidth = 1, focusedTextColor = theme.colors.strong, unFocusedTextColor = focusedTextColor, style, ...rest }, ref) => {
|
|
9
|
+
const newPinInputRef = React.useRef(null);
|
|
10
|
+
// Use the provided ref or default to new ref when not provided
|
|
11
|
+
const pinInputRef = ref
|
|
12
|
+
? ref
|
|
13
|
+
: newPinInputRef;
|
|
14
|
+
const { viewStyles, textStyles } = extractStyles(style);
|
|
15
|
+
// Clears input of a cell when focused, configured as explained here (https://github.com/retyui/react-native-confirmation-code-field/blob/master/API.md#useclearbyfocuscellvalue-string-setvalue-text-string--void)
|
|
16
|
+
const [codeFieldProps, getCellOnLayout] = useClearByFocusCell({
|
|
17
|
+
value,
|
|
18
|
+
setValue: (text) => onChangeText === null || onChangeText === void 0 ? void 0 : onChangeText(text),
|
|
19
|
+
});
|
|
20
|
+
React.useEffect(() => {
|
|
21
|
+
var _a;
|
|
22
|
+
if ((value === null || value === void 0 ? void 0 : value.length) === cellCount) {
|
|
23
|
+
if (blurOnFull) {
|
|
24
|
+
(_a = pinInputRef.current) === null || _a === void 0 ? void 0 : _a.blur();
|
|
25
|
+
}
|
|
26
|
+
onInputFull === null || onInputFull === void 0 ? void 0 : onInputFull(value);
|
|
27
|
+
}
|
|
28
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
29
|
+
}, [value, cellCount, blurOnFull, pinInputRef]);
|
|
30
|
+
return (React.createElement(CodeField, { ref: pinInputRef, ...(clearOnCellFocus ? codeFieldProps : {}), value: value, onChangeText: onChangeText, textInputStyle: { height: "100%" }, InputComponent: TextInput, cellCount: cellCount, renderCell: ({ symbol: cellValue, index, isFocused }) => (React.createElement(View, { key: index, onLayout: clearOnCellFocus ? getCellOnLayout(index) : undefined, style: { flex: 1 } }, (renderItem === null || renderItem === void 0 ? void 0 : renderItem({ cellValue, index, isFocused })) || (React.createElement(View, { testID: "default-code-input-cell", style: [
|
|
31
|
+
styles.cell,
|
|
32
|
+
{
|
|
33
|
+
borderWidth: isFocused
|
|
34
|
+
? focusedBorderWidth
|
|
35
|
+
: unFocusedBorderWidth,
|
|
36
|
+
borderColor: isFocused
|
|
37
|
+
? focusedBorderColor
|
|
38
|
+
: unFocusedBorderColor,
|
|
39
|
+
backgroundColor: isFocused
|
|
40
|
+
? focusedBackgroundColor
|
|
41
|
+
: unFocusedBackgroundColor,
|
|
42
|
+
},
|
|
43
|
+
viewStyles,
|
|
44
|
+
] },
|
|
45
|
+
React.createElement(PinInputText, { style: [
|
|
46
|
+
styles.cellText,
|
|
47
|
+
{
|
|
48
|
+
color: isFocused ? focusedTextColor : unFocusedTextColor,
|
|
49
|
+
},
|
|
50
|
+
textStyles,
|
|
51
|
+
], isFocused: isFocused }, cellValue))))), ...rest }));
|
|
52
|
+
});
|
|
53
|
+
const styles = StyleSheet.create({
|
|
54
|
+
cell: {
|
|
55
|
+
marginStart: 5,
|
|
56
|
+
marginEnd: 5,
|
|
57
|
+
padding: 5,
|
|
58
|
+
borderRadius: 5,
|
|
59
|
+
justifyContent: "center",
|
|
60
|
+
alignItems: "center",
|
|
61
|
+
aspectRatio: 1,
|
|
62
|
+
maxWidth: 70,
|
|
63
|
+
maxHeight: 70,
|
|
64
|
+
},
|
|
65
|
+
cellText: {
|
|
66
|
+
fontSize: 25,
|
|
67
|
+
},
|
|
68
|
+
});
|
|
69
|
+
export default withTheme(PinInput);
|
|
70
|
+
//# sourceMappingURL=PinInput.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PinInput.js","sourceRoot":"","sources":["PinInput.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAIL,IAAI,EACJ,UAAU,GACX,MAAM,cAAc,CAAC;AACtB,OAAO,SAA6B,MAAM,cAAc,CAAC;AACzD,OAAO,EACL,SAAS,EACT,mBAAmB,GACpB,MAAM,sCAAsC,CAAC;AAE9C,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,YAAY,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;A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BAAgB,CAAC,CAAC,CAAC,kBAAkB;qBACzD;oBACD,UAAU;iBACX,EACD,SAAS,EAAE,SAAS,IAEnB,SAAS,CACG,CACV,CACR,CACI,CACR,KACG,IAAI,GACR,CACH,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;IAC/B,IAAI,EAAE;QACJ,WAAW,EAAE,CAAC;QACd,SAAS,EAAE,CAAC;QACZ,OAAO,EAAE,CAAC;QACV,YAAY,EAAE,CAAC;QACf,cAAc,EAAE,QAAQ;QACxB,UAAU,EAAE,QAAQ;QACpB,WAAW,EAAE,CAAC;QACd,QAAQ,EAAE,EAAE;QACZ,SAAS,EAAE,EAAE;KACd;IACD,QAAQ,EAAE;QACR,QAAQ,EAAE,EAAE;KACb;CACF,CAAC,CAAC;AAEH,eAAe,SAAS,CAAC,QAAQ,CAAC,CAAC"}
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import {
|
|
3
|
+
StyleProp,
|
|
4
|
+
ViewStyle,
|
|
5
|
+
TextInput as NativeTextInput,
|
|
6
|
+
View,
|
|
7
|
+
StyleSheet,
|
|
8
|
+
} from "react-native";
|
|
9
|
+
import TextInput, { TextInputProps } from "../TextInput";
|
|
10
|
+
import {
|
|
11
|
+
CodeField,
|
|
12
|
+
useClearByFocusCell,
|
|
13
|
+
} from "react-native-confirmation-code-field";
|
|
14
|
+
import type { Theme } from "../../styles/DefaultTheme";
|
|
15
|
+
import { withTheme } from "../../theming";
|
|
16
|
+
import PinInputText from "./PinInputText";
|
|
17
|
+
import { extractStyles } from "../../utilities";
|
|
18
|
+
|
|
19
|
+
interface CellItem {
|
|
20
|
+
cellValue: string;
|
|
21
|
+
index: number;
|
|
22
|
+
isFocused: boolean;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
interface PinInputProps extends TextInputProps {
|
|
26
|
+
onInputFull?: (value: string) => void;
|
|
27
|
+
cellCount?: number;
|
|
28
|
+
clearOnCellFocus?: boolean;
|
|
29
|
+
blurOnFull?: boolean;
|
|
30
|
+
renderItem?: ({ cellValue, index, isFocused }: CellItem) => JSX.Element;
|
|
31
|
+
focusedBorderColor?: string;
|
|
32
|
+
unFocusedBorderColor?: string;
|
|
33
|
+
focusedBackgroundColor?: string;
|
|
34
|
+
unFocusedBackgroundColor?: string;
|
|
35
|
+
focusedBorderWidth?: number;
|
|
36
|
+
unFocusedBorderWidth?: number;
|
|
37
|
+
focusedTextColor?: string;
|
|
38
|
+
unFocusedTextColor?: string;
|
|
39
|
+
style?: StyleProp<ViewStyle>;
|
|
40
|
+
theme: Theme;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const PinInput = React.forwardRef<NativeTextInput, PinInputProps>(
|
|
44
|
+
(
|
|
45
|
+
{
|
|
46
|
+
theme,
|
|
47
|
+
onInputFull,
|
|
48
|
+
cellCount = 4,
|
|
49
|
+
clearOnCellFocus = true,
|
|
50
|
+
blurOnFull = true,
|
|
51
|
+
renderItem,
|
|
52
|
+
value,
|
|
53
|
+
onChangeText,
|
|
54
|
+
focusedBorderColor = theme.colors.primary,
|
|
55
|
+
unFocusedBorderColor = theme.colors.disabled,
|
|
56
|
+
focusedBackgroundColor,
|
|
57
|
+
unFocusedBackgroundColor,
|
|
58
|
+
focusedBorderWidth = 2,
|
|
59
|
+
unFocusedBorderWidth = 1,
|
|
60
|
+
focusedTextColor = theme.colors.strong,
|
|
61
|
+
unFocusedTextColor = focusedTextColor,
|
|
62
|
+
style,
|
|
63
|
+
...rest
|
|
64
|
+
},
|
|
65
|
+
ref
|
|
66
|
+
) => {
|
|
67
|
+
const newPinInputRef = React.useRef<NativeTextInput>(null);
|
|
68
|
+
|
|
69
|
+
// Use the provided ref or default to new ref when not provided
|
|
70
|
+
const pinInputRef = ref
|
|
71
|
+
? (ref as React.RefObject<NativeTextInput>)
|
|
72
|
+
: newPinInputRef;
|
|
73
|
+
|
|
74
|
+
const { viewStyles, textStyles } = extractStyles(style);
|
|
75
|
+
|
|
76
|
+
// Clears input of a cell when focused, configured as explained here (https://github.com/retyui/react-native-confirmation-code-field/blob/master/API.md#useclearbyfocuscellvalue-string-setvalue-text-string--void)
|
|
77
|
+
const [codeFieldProps, getCellOnLayout] = useClearByFocusCell({
|
|
78
|
+
value,
|
|
79
|
+
setValue: (text) => onChangeText?.(text),
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
React.useEffect(() => {
|
|
83
|
+
if (value?.length === cellCount) {
|
|
84
|
+
if (blurOnFull) {
|
|
85
|
+
pinInputRef.current?.blur();
|
|
86
|
+
}
|
|
87
|
+
onInputFull?.(value);
|
|
88
|
+
}
|
|
89
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
90
|
+
}, [value, cellCount, blurOnFull, pinInputRef]);
|
|
91
|
+
|
|
92
|
+
return (
|
|
93
|
+
<CodeField
|
|
94
|
+
ref={pinInputRef}
|
|
95
|
+
{...(clearOnCellFocus ? codeFieldProps : {})}
|
|
96
|
+
value={value}
|
|
97
|
+
onChangeText={onChangeText}
|
|
98
|
+
textInputStyle={{ height: "100%" }} // addresses issue on firefox where the hidden input did not fill the height
|
|
99
|
+
InputComponent={TextInput}
|
|
100
|
+
cellCount={cellCount}
|
|
101
|
+
renderCell={({ symbol: cellValue, index, isFocused }) => (
|
|
102
|
+
<View
|
|
103
|
+
key={index}
|
|
104
|
+
onLayout={clearOnCellFocus ? getCellOnLayout(index) : undefined}
|
|
105
|
+
style={{ flex: 1 }}
|
|
106
|
+
>
|
|
107
|
+
{renderItem?.({ cellValue, index, isFocused }) || (
|
|
108
|
+
<View
|
|
109
|
+
testID="default-code-input-cell"
|
|
110
|
+
style={[
|
|
111
|
+
styles.cell,
|
|
112
|
+
{
|
|
113
|
+
borderWidth: isFocused
|
|
114
|
+
? focusedBorderWidth
|
|
115
|
+
: unFocusedBorderWidth,
|
|
116
|
+
borderColor: isFocused
|
|
117
|
+
? focusedBorderColor
|
|
118
|
+
: unFocusedBorderColor,
|
|
119
|
+
backgroundColor: isFocused
|
|
120
|
+
? focusedBackgroundColor
|
|
121
|
+
: unFocusedBackgroundColor,
|
|
122
|
+
},
|
|
123
|
+
viewStyles,
|
|
124
|
+
]}
|
|
125
|
+
>
|
|
126
|
+
<PinInputText
|
|
127
|
+
style={[
|
|
128
|
+
styles.cellText,
|
|
129
|
+
{
|
|
130
|
+
color: isFocused ? focusedTextColor : unFocusedTextColor,
|
|
131
|
+
},
|
|
132
|
+
textStyles,
|
|
133
|
+
]}
|
|
134
|
+
isFocused={isFocused}
|
|
135
|
+
>
|
|
136
|
+
{cellValue}
|
|
137
|
+
</PinInputText>
|
|
138
|
+
</View>
|
|
139
|
+
)}
|
|
140
|
+
</View>
|
|
141
|
+
)}
|
|
142
|
+
{...rest}
|
|
143
|
+
/>
|
|
144
|
+
);
|
|
145
|
+
}
|
|
146
|
+
);
|
|
147
|
+
|
|
148
|
+
const styles = StyleSheet.create({
|
|
149
|
+
cell: {
|
|
150
|
+
marginStart: 5,
|
|
151
|
+
marginEnd: 5,
|
|
152
|
+
padding: 5,
|
|
153
|
+
borderRadius: 5,
|
|
154
|
+
justifyContent: "center",
|
|
155
|
+
alignItems: "center",
|
|
156
|
+
aspectRatio: 1,
|
|
157
|
+
maxWidth: 70,
|
|
158
|
+
maxHeight: 70,
|
|
159
|
+
},
|
|
160
|
+
cellText: {
|
|
161
|
+
fontSize: 25,
|
|
162
|
+
},
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
export default withTheme(PinInput);
|
|
@@ -4,11 +4,11 @@ import { withTheme } from "../../theming";
|
|
|
4
4
|
import { Cursor } from "react-native-confirmation-code-field";
|
|
5
5
|
/**
|
|
6
6
|
* Text component that can conditionally render a blinking cursor when focused and empty
|
|
7
|
-
* Meant to be used within a
|
|
7
|
+
* Meant to be used within a CustomPinInputCell component
|
|
8
8
|
*/
|
|
9
|
-
const
|
|
9
|
+
const CustomPinInputText = ({ isFocused, cursorBlinkDuration, cursorText, style, theme, children, ...rest }) => {
|
|
10
10
|
return (React.createElement(Text, { style: [{ color: theme.colors.strong }, style], ...rest }, children ||
|
|
11
11
|
(isFocused ? (React.createElement(Cursor, { cursorSymbol: cursorText, delay: cursorBlinkDuration })) : null)));
|
|
12
12
|
};
|
|
13
|
-
export default withTheme(
|
|
14
|
-
//# sourceMappingURL=
|
|
13
|
+
export default withTheme(CustomPinInputText);
|
|
14
|
+
//# sourceMappingURL=PinInputText.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PinInputText.js","sourceRoot":"","sources":["PinInputText.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,IAAI,EAAa,MAAM,cAAc,CAAC;AAE/C,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,sCAAsC,CAAC;AAS9D;;;GAGG;AACH,MAAM,kBAAkB,GAAsC,CAAC,EAC7D,SAAS,EACT,mBAAmB,EACnB,UAAU,EACV,KAAK,EACL,KAAK,EACL,QAAQ,EACR,GAAG,IAAI,EACR,EAAE,EAAE;IACH,OAAO,CACL,oBAAC,IAAI,IAAC,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,EAAE,KAAK,CAAC,KAAM,IAAI,IAC3D,QAAQ;QACP,CAAC,SAAS,CAAC,CAAC,CAAC,CACX,oBAAC,MAAM,IAAC,YAAY,EAAE,UAAU,EAAE,KAAK,EAAE,mBAAmB,GAAI,CACjE,CAAC,CAAC,CAAC,IAAI,CAAC,CACN,CACR,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,SAAS,CAAC,kBAAkB,CAAC,CAAC"}
|
|
@@ -4,7 +4,7 @@ import type { Theme } from "../../styles/DefaultTheme";
|
|
|
4
4
|
import { withTheme } from "../../theming";
|
|
5
5
|
import { Cursor } from "react-native-confirmation-code-field";
|
|
6
6
|
|
|
7
|
-
interface
|
|
7
|
+
interface CustomPinInputTextProps extends TextProps {
|
|
8
8
|
cursorBlinkDuration?: number;
|
|
9
9
|
cursorText?: string;
|
|
10
10
|
isFocused?: boolean;
|
|
@@ -13,9 +13,9 @@ interface CodeInputTextProps extends TextProps {
|
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* Text component that can conditionally render a blinking cursor when focused and empty
|
|
16
|
-
* Meant to be used within a
|
|
16
|
+
* Meant to be used within a CustomPinInputCell component
|
|
17
17
|
*/
|
|
18
|
-
const
|
|
18
|
+
const CustomPinInputText: React.FC<CustomPinInputTextProps> = ({
|
|
19
19
|
isFocused,
|
|
20
20
|
cursorBlinkDuration,
|
|
21
21
|
cursorText,
|
|
@@ -34,4 +34,4 @@ const CodeInputText: React.FC<CodeInputTextProps> = ({
|
|
|
34
34
|
);
|
|
35
35
|
};
|
|
36
36
|
|
|
37
|
-
export default withTheme(
|
|
37
|
+
export default withTheme(CustomPinInputText);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AACrE,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,gBAAgB,CAAC"}
|
package/src/index.js
CHANGED
|
@@ -40,7 +40,7 @@ export { default as LinearProgress } from "./components/Progress/LinearProgress"
|
|
|
40
40
|
export { default as CircularProgress } from "./components/Progress/CircularProgress";
|
|
41
41
|
export { default as TextInput } from "./components/TextInput";
|
|
42
42
|
export { default as VideoPlayer, } from "./components/MediaPlayer/VideoPlayer";
|
|
43
|
-
export {
|
|
43
|
+
export { PinInput, CustomPinInputCell, PinInputText as CustomPinInputText, } from "./components/PinInput";
|
|
44
44
|
export { AspectRatio, Circle, Center, HStack, VStack, ZStack, Spacer, Square, } from "./components/Layout";
|
|
45
45
|
/* Deprecated: Fix or Delete! */
|
|
46
46
|
export { default as AccordionItem } from "./deprecated-components/AccordionItem";
|
package/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AACrD,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,OAAO,IAAI,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC1E,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,SAAS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AAI,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,uCAAuC,CAAC;AACjF,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,qCAAqC,CAAC;AAC7E,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,mCAAmC,CAAC;AACzE,OAAO,EAAE,OAAO,IAAI,GAAG,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,4CAA4C,CAAC;AAC3F,OAAO,EACL,MAAM,IAAI,gBAAgB,EAC1B,MAAM,IAAI,gBAAgB,EAC1B,MAAM,IAAI,gBAAgB,EAC1B,GAAG,EACH,KAAK,GACN,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,sCAAsC,CAAC;AAC/E,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,qCAAqC,CAAC;AAC7E,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,wCAAwC,CAAC;AACnF,OAAO,EAAE,OAAO,IAAI,qBAAqB,EAAE,MAAM,+CAA+C,CAAC;AACjG,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,qCAAqC,CAAC;AAC7E,OAAO,EAAE,OAAO,IAAI,uBAAuB,EAAE,MAAM,iDAAiD,CAAC;AACrG,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,MAAM,8CAA8C,CAAC;AAC/F,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC"}
|
package/src/index.tsx
CHANGED
|
@@ -59,10 +59,10 @@ export {
|
|
|
59
59
|
VideoPlayerRef,
|
|
60
60
|
} from "./components/MediaPlayer/VideoPlayer";
|
|
61
61
|
export {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
} from "./components/
|
|
62
|
+
PinInput,
|
|
63
|
+
CustomPinInputCell,
|
|
64
|
+
PinInputText as CustomPinInputText,
|
|
65
|
+
} from "./components/PinInput";
|
|
66
66
|
export {
|
|
67
67
|
AspectRatio,
|
|
68
68
|
Circle,
|
package/src/utilities.js
CHANGED
|
@@ -16,6 +16,12 @@ export function extractStyles(style) {
|
|
|
16
16
|
textDecorationColor,
|
|
17
17
|
textDecorationStyle,
|
|
18
18
|
};
|
|
19
|
+
for (let key in textStyles) {
|
|
20
|
+
const styleKey = key;
|
|
21
|
+
if (textStyles[styleKey] === undefined) {
|
|
22
|
+
delete textStyles[styleKey];
|
|
23
|
+
}
|
|
24
|
+
}
|
|
19
25
|
return { viewStyles, textStyles };
|
|
20
26
|
}
|
|
21
27
|
export const borderStyleNames = [
|
package/src/utilities.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utilities.js","sourceRoot":"","sources":["utilities.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,UAAU,EAAwB,MAAM,cAAc,CAAC;AAChE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAEpE,MAAM,UAAU,aAAa,CAAC,KAAqB;IACjD,MAAM,EACJ,KAAK,EACL,UAAU,EACV,UAAU,EACV,QAAQ,EACR,UAAU,EACV,aAAa,EACb,aAAa,EACb,SAAS,EACT,kBAAkB,EAClB,mBAAmB,EACnB,mBAAmB,EACnB,GAAG,UAAU,EACd,GAAG,UAAU,CAAC,OAAO,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC;IAEpC,MAAM,UAAU,GAAc;QAC5B,KAAK;QACL,UAAU;QACV,UAAU;QACV,QAAQ;QACR,UAAU;QACV,aAAa;QACb,aAAa;QACb,SAAS;QACT,kBAAkB;QAClB,mBAAmB;QACnB,mBAAmB;KACpB,CAAC;IAEF,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,CAAC;AACpC,CA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CAAC;AAED,MAAM,UAAU,sBAAsB,CAAC,KAAsB;IAC3D,IAAI,QAAQ,CAAC,KAAK,CAAC,EAAE;QACnB,OAAO,KAAK,CAAC;KACd;SAAM,IAAI,QAAQ,CAAC,KAAK,CAAC,EAAE;QAC1B,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;KACtB;SAAM;QACL,MAAM,IAAI,KAAK,CAAC,kBAAkB,KAAK,EAAE,CAAC,CAAC;KAC5C;AACH,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,qBAAqB,CACnC,UAAgC;;IAEhC,MAAM,SAAS,GAAG,EAAE,CAAC;IACrB,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE;QAClC,IAAI,SAAS,CAAC,IAAI,KAAK,KAAK,CAAC,QAAQ,EAAE;YACrC,MAAM,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC,OAAO,CACrC,MAAA,SAAS,CAAC,KAAK,0CAAE,QAAQ,CACF,CAAC;YAE1B,KAAK,MAAM,KAAK,IAAI,QAAQ,EAAE;gBAC5B,SAAS,CAAC,IAAI,CAAC,GAAG,qBAAqB,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;aACnD;SACF;aAAM;YACL,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;SAC3B;KACF;IAED,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
package/src/utilities.ts
CHANGED
|
@@ -32,6 +32,13 @@ export function extractStyles(style: StyleProp<any>) {
|
|
|
32
32
|
textDecorationStyle,
|
|
33
33
|
};
|
|
34
34
|
|
|
35
|
+
for (let key in textStyles) {
|
|
36
|
+
const styleKey = key as keyof TextStyle;
|
|
37
|
+
if (textStyles[styleKey] === undefined) {
|
|
38
|
+
delete textStyles[styleKey];
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
35
42
|
return { viewStyles, textStyles };
|
|
36
43
|
}
|
|
37
44
|
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var _objectWithoutProperties2=_interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));var _react=_interopRequireDefault(require("react"));var _reactNative=require("react-native");var _TextInput=_interopRequireDefault(require("../TextInput"));var _reactNativeConfirmationCodeField=require("react-native-confirmation-code-field");var _CodeInputCell=require("./CodeInputCell");var _jsxRuntime=require("react/jsx-runtime");var _excluded=["onInputFull","cellCount","clearOnCellFocus","blurOnFull","renderItem","value","onChangeText","style"];var _this=this,_jsxFileName="/home/runner/work/react-native-jigsaw/react-native-jigsaw/packages/core/src/components/CodeInput/CodeInput.tsx";var CodeInput=_react.default.forwardRef(function(_ref,ref){var onInputFull=_ref.onInputFull,_ref$cellCount=_ref.cellCount,cellCount=_ref$cellCount===void 0?4:_ref$cellCount,_ref$clearOnCellFocus=_ref.clearOnCellFocus,clearOnCellFocus=_ref$clearOnCellFocus===void 0?true:_ref$clearOnCellFocus,_ref$blurOnFull=_ref.blurOnFull,blurOnFull=_ref$blurOnFull===void 0?true:_ref$blurOnFull,renderItem=_ref.renderItem,value=_ref.value,onChangeText=_ref.onChangeText,style=_ref.style,rest=(0,_objectWithoutProperties2.default)(_ref,_excluded);var newCodeInputRef=_react.default.useRef(null);var codeInputRef=ref?ref:newCodeInputRef;var _useClearByFocusCell=(0,_reactNativeConfirmationCodeField.useClearByFocusCell)({value:value,setValue:function setValue(text){return onChangeText==null?void 0:onChangeText(text);}}),_useClearByFocusCell2=(0,_slicedToArray2.default)(_useClearByFocusCell,2),codeFieldProps=_useClearByFocusCell2[0],getCellOnLayout=_useClearByFocusCell2[1];_react.default.useEffect(function(){if((value==null?void 0:value.length)===cellCount){if(blurOnFull){var _codeInputRef$current;(_codeInputRef$current=codeInputRef.current)==null?void 0:_codeInputRef$current.blur();}onInputFull==null?void 0:onInputFull(value);}},[value,cellCount,blurOnFull,codeInputRef]);return(0,_jsxRuntime.jsx)(_reactNativeConfirmationCodeField.CodeField,Object.assign({ref:codeInputRef},clearOnCellFocus?codeFieldProps:{},{value:value,onChangeText:onChangeText,rootStyle:style,textInputStyle:{height:"100%"},InputComponent:_TextInput.default,cellCount:cellCount,renderCell:function renderCell(_ref2){var symbol=_ref2.symbol,index=_ref2.index,isFocused=_ref2.isFocused;return(0,_jsxRuntime.jsx)(_reactNative.View,{onLayout:clearOnCellFocus?getCellOnLayout(index):undefined,style:{flex:1},children:(renderItem==null?void 0:renderItem({cellValue:symbol,index:index,isFocused:isFocused}))||(0,_jsxRuntime.jsx)(_CodeInputCell.DefaultCodeInputCell,{cellValue:symbol,isFocused:isFocused})},index);}},rest));});var _default=CodeInput;exports.default=_default;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=exports.DefaultCodeInputCell=void 0;var _react=_interopRequireDefault(require("react"));var _reactNative=require("react-native");var _theming=require("../../theming");var _CodeInputText=_interopRequireDefault(require("./CodeInputText"));var _jsxRuntime=require("react/jsx-runtime");var _this=this,_jsxFileName="/home/runner/work/react-native-jigsaw/react-native-jigsaw/packages/core/src/components/CodeInput/CodeInputCell.tsx";var CodeInputCell=function CodeInputCell(_ref){var style=_ref.style,children=_ref.children;return(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.cell,style],children:children});};var DefaultCodeInputCell=(0,_theming.withTheme)(function(_ref2){var cellValue=_ref2.cellValue,isFocused=_ref2.isFocused,theme=_ref2.theme;return(0,_jsxRuntime.jsx)(_reactNative.View,{testID:"default-code-input-cell",style:[styles.cell,styles.defaultCellContainer,{borderWidth:isFocused?2:1,borderColor:isFocused?theme.colors.primary:theme.colors.disabled}],children:(0,_jsxRuntime.jsx)(_CodeInputText.default,{style:[styles.defaultCellText,{color:theme.colors.strong}],isFocused:isFocused,children:cellValue})});});exports.DefaultCodeInputCell=DefaultCodeInputCell;var styles=_reactNative.StyleSheet.create({cell:{marginStart:5,marginEnd:5},defaultCellContainer:{padding:5,backgroundColor:"transparent",borderRadius:5,justifyContent:"center",alignItems:"center",aspectRatio:1,maxWidth:70,maxHeight:70},defaultCellText:{fontSize:25}});var _default=CodeInputCell;exports.default=_default;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"CodeInput",{enumerable:true,get:function get(){return _CodeInput.default;}});Object.defineProperty(exports,"CodeInputCell",{enumerable:true,get:function get(){return _CodeInputCell.default;}});Object.defineProperty(exports,"CodeInputText",{enumerable:true,get:function get(){return _CodeInputText.default;}});var _CodeInput=_interopRequireDefault(require("./CodeInput"));var _CodeInputCell=_interopRequireDefault(require("./CodeInputCell"));var _CodeInputText=_interopRequireDefault(require("./CodeInputText"));
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { StyleProp, ViewStyle, TextInput as NativeTextInput } from "react-native";
|
|
3
|
-
import { TextInputProps } from "../TextInput";
|
|
4
|
-
interface CellItem {
|
|
5
|
-
cellValue: string;
|
|
6
|
-
index: number;
|
|
7
|
-
isFocused: boolean;
|
|
8
|
-
}
|
|
9
|
-
interface CodeInputProps extends TextInputProps {
|
|
10
|
-
onInputFull?: (value: string) => void;
|
|
11
|
-
cellCount?: number;
|
|
12
|
-
clearOnCellFocus?: boolean;
|
|
13
|
-
blurOnFull?: boolean;
|
|
14
|
-
renderItem?: ({ cellValue, index, isFocused }: CellItem) => JSX.Element;
|
|
15
|
-
style?: StyleProp<ViewStyle>;
|
|
16
|
-
}
|
|
17
|
-
declare const CodeInput: React.ForwardRefExoticComponent<CodeInputProps & React.RefAttributes<NativeTextInput>>;
|
|
18
|
-
export default CodeInput;
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { View, } from "react-native";
|
|
3
|
-
import TextInput from "../TextInput";
|
|
4
|
-
import { CodeField, useClearByFocusCell, } from "react-native-confirmation-code-field";
|
|
5
|
-
import { DefaultCodeInputCell } from "./CodeInputCell";
|
|
6
|
-
const CodeInput = React.forwardRef(({ onInputFull, cellCount = 4, clearOnCellFocus = true, blurOnFull = true, renderItem, value, onChangeText, style, ...rest }, ref) => {
|
|
7
|
-
const newCodeInputRef = React.useRef(null);
|
|
8
|
-
// Use the provided ref or default to new ref when not provided
|
|
9
|
-
const codeInputRef = ref
|
|
10
|
-
? ref
|
|
11
|
-
: newCodeInputRef;
|
|
12
|
-
// Clears input of a cell when focused, configured as explained here (https://github.com/retyui/react-native-confirmation-code-field/blob/master/API.md#useclearbyfocuscellvalue-string-setvalue-text-string--void)
|
|
13
|
-
const [codeFieldProps, getCellOnLayout] = useClearByFocusCell({
|
|
14
|
-
value,
|
|
15
|
-
setValue: (text) => onChangeText === null || onChangeText === void 0 ? void 0 : onChangeText(text),
|
|
16
|
-
});
|
|
17
|
-
React.useEffect(() => {
|
|
18
|
-
var _a;
|
|
19
|
-
if ((value === null || value === void 0 ? void 0 : value.length) === cellCount) {
|
|
20
|
-
if (blurOnFull) {
|
|
21
|
-
(_a = codeInputRef.current) === null || _a === void 0 ? void 0 : _a.blur();
|
|
22
|
-
}
|
|
23
|
-
onInputFull === null || onInputFull === void 0 ? void 0 : onInputFull(value);
|
|
24
|
-
}
|
|
25
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
26
|
-
}, [value, cellCount, blurOnFull, codeInputRef]);
|
|
27
|
-
return (React.createElement(CodeField, { ref: codeInputRef, ...(clearOnCellFocus ? codeFieldProps : {}), value: value, onChangeText: onChangeText, rootStyle: style, textInputStyle: { height: "100%" }, InputComponent: TextInput, cellCount: cellCount, renderCell: ({ symbol, index, isFocused }) => (React.createElement(View, { key: index, onLayout: clearOnCellFocus ? getCellOnLayout(index) : undefined, style: { flex: 1 } }, (renderItem === null || renderItem === void 0 ? void 0 : renderItem({ cellValue: symbol, index, isFocused })) || (React.createElement(DefaultCodeInputCell, { cellValue: symbol, isFocused: isFocused })))), ...rest }));
|
|
28
|
-
});
|
|
29
|
-
export default CodeInput;
|
|
30
|
-
//# sourceMappingURL=CodeInput.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CodeInput.js","sourceRoot":"","sources":["../../../../../src/components/CodeInput/CodeInput.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAIL,IAAI,GACL,MAAM,cAAc,CAAC;AACtB,OAAO,SAA6B,MAAM,cAAc,CAAC;AACzD,OAAO,EACL,SAAS,EACT,mBAAmB,GACpB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAiBvD,MAAM,SAAS,GAAG,KAAK,CAAC,UAAU,CAChC,CACE,EACE,WAAW,EACX,SAAS,GAAG,CAAC,EACb,gBAAgB,GAAG,IAAI,EACvB,UAAU,GAAG,IAAI,EACjB,UAAU,EACV,KAAK,EACL,YAAY,EACZ,KAAK,EACL,GAAG,IAAI,EACR,EACD,GAAG,EACH,EAAE;IACF,MAAM,eAAe,GAAG,KAAK,CAAC,MAAM,CAAkB,IAAI,CAAC,CAAC;IAE5D,+DAA+D;IAC/D,MAAM,YAAY,GAAG,GAAG;QACtB,CAAC,CAAE,GAAwC;QAC3C,CAAC,CAAC,eAAe,CAAC;IAEpB,mNAAmN;IACnN,MAAM,CAAC,cAAc,EAAE,eAAe,CAAC,GAAG,mBAAmB,CAAC;QAC5D,KAAK;QACL,QAAQ,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAG,IAAI,CAAC;KACzC,CAAC,CAAC;IAEH,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;;QACnB,IAAI,CAAA,KAAK,aAAL,KAAK,uB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|
3
|
-
import type { Theme } from "../../styles/DefaultTheme";
|
|
4
|
-
interface CodeInputCellProps {
|
|
5
|
-
style?: StyleProp<ViewStyle>;
|
|
6
|
-
}
|
|
7
|
-
declare const CodeInputCell: React.FC<React.PropsWithChildren<CodeInputCellProps>>;
|
|
8
|
-
interface DefaultCodeInputCellProps {
|
|
9
|
-
cellValue: string;
|
|
10
|
-
isFocused: boolean;
|
|
11
|
-
theme: Theme;
|
|
12
|
-
}
|
|
13
|
-
export declare const DefaultCodeInputCell: React.ComponentType<import("@draftbit/react-theme-provider").$Without<DefaultCodeInputCellProps, "theme"> & {
|
|
14
|
-
theme?: import("@draftbit/react-theme-provider").$DeepPartial<any> | undefined;
|
|
15
|
-
}> & import("@draftbit/react-theme-provider/typings/hoist-non-react-statics").NonReactStatics<React.ComponentType<DefaultCodeInputCellProps> & (({ cellValue, isFocused, theme }: DefaultCodeInputCellProps) => JSX.Element), {}>;
|
|
16
|
-
export default CodeInputCell;
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { View, StyleSheet } from "react-native";
|
|
3
|
-
import { withTheme } from "../../theming";
|
|
4
|
-
import CodeInputText from "./CodeInputText";
|
|
5
|
-
const CodeInputCell = ({ style, children, }) => {
|
|
6
|
-
return React.createElement(View, { style: [styles.cell, style], children: children });
|
|
7
|
-
};
|
|
8
|
-
export const DefaultCodeInputCell = withTheme(({ cellValue, isFocused, theme }) => {
|
|
9
|
-
return (React.createElement(View, { testID: "default-code-input-cell", style: [
|
|
10
|
-
styles.cell,
|
|
11
|
-
styles.defaultCellContainer,
|
|
12
|
-
{
|
|
13
|
-
borderWidth: isFocused ? 2 : 1,
|
|
14
|
-
borderColor: isFocused
|
|
15
|
-
? theme.colors.primary
|
|
16
|
-
: theme.colors.disabled,
|
|
17
|
-
},
|
|
18
|
-
] },
|
|
19
|
-
React.createElement(CodeInputText, { style: [
|
|
20
|
-
styles.defaultCellText,
|
|
21
|
-
{
|
|
22
|
-
color: theme.colors.strong,
|
|
23
|
-
},
|
|
24
|
-
], isFocused: isFocused }, cellValue)));
|
|
25
|
-
});
|
|
26
|
-
const styles = StyleSheet.create({
|
|
27
|
-
cell: { marginStart: 5, marginEnd: 5 },
|
|
28
|
-
defaultCellContainer: {
|
|
29
|
-
padding: 5,
|
|
30
|
-
backgroundColor: "transparent",
|
|
31
|
-
borderRadius: 5,
|
|
32
|
-
justifyContent: "center",
|
|
33
|
-
alignItems: "center",
|
|
34
|
-
aspectRatio: 1,
|
|
35
|
-
maxWidth: 70,
|
|
36
|
-
maxHeight: 70,
|
|
37
|
-
},
|
|
38
|
-
defaultCellText: {
|
|
39
|
-
fontSize: 25,
|
|
40
|
-
},
|
|
41
|
-
});
|
|
42
|
-
export default CodeInputCell;
|
|
43
|
-
//# sourceMappingURL=CodeInputCell.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CodeInputCell.js","sourceRoot":"","sources":["../../../../../src/components/CodeInput/CodeInputCell.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAwB,IAAI,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAEtE,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAM5C,MAAM,aAAa,GAA0D,CAAC,EAC5E,KAAK,EACL,QAAQ,GACT,EAAE,EAAE;IACH,OAAO,oBAAC,IAAI,IAAC,KAAK,EAAE,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,QAAQ,EAAE,QAAQ,GAAI,CAAC;AACnE,CAAC,CAAC;AAQF,MAAM,CAAC,MAAM,oBAAoB,GAAG,SAAS,CAC3C,CAAC,EAAE,SAAS,EAAE,SAAS,EAAE,KAAK,EAA6B,EAAE,EAAE;IAC7D,OAAO,CACL,oBAAC,IAAI,IACH,MAAM,EAAC,yBAAyB,EAChC,KAAK,EAAE;YACL,MAAM,CAAC,IAAI;YACX,MAAM,CAAC,oBAAoB;YAC3B;gBACE,WAAW,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;gBAC9B,WAAW,EAAE,SAAS;oBACpB,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO;oBACtB,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ;aAC1B;SACF;QAED,oBAAC,aAAa,IACZ,KAAK,EAAE;gBACL,MAAM,CAAC,eAAe;gBACtB;oBACE,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM;iBAC3B;aACF,EACD,SAAS,EAAE,SAAS,IAEnB,SAAS,CACI,CACX,CACR,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;IAC/B,IAAI,EAAE,EAAE,WAAW,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE;IACtC,oBAAoB,EAAE;QACpB,OAAO,EAAE,CAAC;QACV,eAAe,EAAE,aAAa;QAC9B,YAAY,EAAE,CAAC;QACf,cAAc,EAAE,QAAQ;QACxB,UAAU,EAAE,QAAQ;QACpB,WAAW,EAAE,CAAC;QACd,QAAQ,EAAE,EAAE;QACZ,SAAS,EAAE,EAAE;KACd;IACD,eAAe,EAAE;QACf,QAAQ,EAAE,EAAE;KACb;CACF,CAAC,CAAC;AAEH,eAAe,aAAa,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CodeInputText.js","sourceRoot":"","sources":["../../../../../src/components/CodeInput/CodeInputText.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,IAAI,EAAa,MAAM,cAAc,CAAC;AAE/C,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,sCAAsC,CAAC;AAS9D;;;GAGG;AACH,MAAM,aAAa,GAAiC,CAAC,EACnD,SAAS,EACT,mBAAmB,EACnB,UAAU,EACV,KAAK,EACL,KAAK,EACL,QAAQ,EACR,GAAG,IAAI,EACR,EAAE,EAAE;IACH,OAAO,CACL,oBAAC,IAAI,IAAC,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,EAAE,KAAK,CAAC,KAAM,IAAI,IAC3D,QAAQ;QACP,CAAC,SAAS,CAAC,CAAC,CAAC,CACX,oBAAC,MAAM,IAAC,YAAY,EAAE,UAAU,EAAE,KAAK,EAAE,mBAAmB,GAAI,CACjE,CAAC,CAAC,CAAC,IAAI,CAAC,CACN,CACR,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,SAAS,CAAC,aAAa,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/components/CodeInput/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAC"}
|