@draftbit/core 48.4.5-e76f7c.2 → 48.4.5

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 (78) hide show
  1. package/lib/commonjs/components/Checkbox/Checkbox.js +1 -1
  2. package/lib/commonjs/components/CodeInput/CodeInput.js +1 -0
  3. package/lib/commonjs/components/CodeInput/CodeInputCell.js +1 -0
  4. package/lib/commonjs/components/{PinInput/PinInputText.js → CodeInput/CodeInputText.js} +1 -1
  5. package/lib/commonjs/components/CodeInput/index.js +1 -0
  6. package/lib/commonjs/components/IconButton.js +1 -1
  7. package/lib/commonjs/index.js +1 -1
  8. package/lib/commonjs/utilities.js +1 -1
  9. package/lib/typescript/src/components/Checkbox/Checkbox.js +1 -1
  10. package/lib/typescript/src/components/Checkbox/Checkbox.js.map +1 -1
  11. package/lib/typescript/src/components/CodeInput/CodeInput.d.ts +18 -0
  12. package/lib/typescript/src/components/CodeInput/CodeInput.js +30 -0
  13. package/lib/typescript/src/components/CodeInput/CodeInput.js.map +1 -0
  14. package/lib/typescript/src/components/CodeInput/CodeInputCell.d.ts +16 -0
  15. package/lib/typescript/src/components/CodeInput/CodeInputCell.js +43 -0
  16. package/lib/typescript/src/components/CodeInput/CodeInputCell.js.map +1 -0
  17. package/lib/typescript/src/components/{PinInput/PinInputText.d.ts → CodeInput/CodeInputText.d.ts} +3 -3
  18. package/{src/components/PinInput/PinInputText.js → lib/typescript/src/components/CodeInput/CodeInputText.js} +4 -4
  19. package/lib/typescript/src/components/CodeInput/CodeInputText.js.map +1 -0
  20. package/lib/typescript/src/components/CodeInput/index.d.ts +3 -0
  21. package/lib/typescript/src/components/CodeInput/index.js +4 -0
  22. package/lib/typescript/src/components/CodeInput/index.js.map +1 -0
  23. package/lib/typescript/src/components/IconButton.js +0 -2
  24. package/lib/typescript/src/components/IconButton.js.map +1 -1
  25. package/lib/typescript/src/index.d.ts +1 -1
  26. package/lib/typescript/src/index.js +1 -1
  27. package/lib/typescript/src/index.js.map +1 -1
  28. package/lib/typescript/src/utilities.js +0 -6
  29. package/lib/typescript/src/utilities.js.map +1 -1
  30. package/lib/typescript/tsconfig.tsbuildinfo +1 -1
  31. package/package.json +3 -3
  32. package/src/components/Checkbox/Checkbox.js +1 -1
  33. package/src/components/Checkbox/Checkbox.js.map +1 -1
  34. package/src/components/Checkbox/Checkbox.tsx +1 -1
  35. package/src/components/CodeInput/CodeInput.js +30 -0
  36. package/src/components/CodeInput/CodeInput.js.map +1 -0
  37. package/src/components/CodeInput/CodeInput.tsx +95 -0
  38. package/src/components/CodeInput/CodeInputCell.js +43 -0
  39. package/src/components/CodeInput/CodeInputCell.js.map +1 -0
  40. package/src/components/CodeInput/CodeInputCell.tsx +73 -0
  41. package/{lib/typescript/src/components/PinInput/PinInputText.js → src/components/CodeInput/CodeInputText.js} +4 -4
  42. package/src/components/CodeInput/CodeInputText.js.map +1 -0
  43. package/src/components/{PinInput/PinInputText.tsx → CodeInput/CodeInputText.tsx} +4 -4
  44. package/src/components/CodeInput/index.js +4 -0
  45. package/src/components/CodeInput/index.js.map +1 -0
  46. package/src/components/CodeInput/index.tsx +3 -0
  47. package/src/components/IconButton.js +0 -2
  48. package/src/components/IconButton.js.map +1 -1
  49. package/src/components/IconButton.tsx +0 -2
  50. package/src/index.js +1 -1
  51. package/src/index.js.map +1 -1
  52. package/src/index.tsx +4 -4
  53. package/src/utilities.js +0 -6
  54. package/src/utilities.js.map +1 -1
  55. package/src/utilities.ts +0 -7
  56. package/lib/commonjs/components/PinInput/CustomPinInputCell.js +0 -1
  57. package/lib/commonjs/components/PinInput/PinInput.js +0 -1
  58. package/lib/commonjs/components/PinInput/index.js +0 -1
  59. package/lib/typescript/src/components/PinInput/CustomPinInputCell.d.ts +0 -11
  60. package/lib/typescript/src/components/PinInput/CustomPinInputCell.js +0 -11
  61. package/lib/typescript/src/components/PinInput/CustomPinInputCell.js.map +0 -1
  62. package/lib/typescript/src/components/PinInput/PinInput.d.ts +0 -30
  63. package/lib/typescript/src/components/PinInput/PinInput.js +0 -70
  64. package/lib/typescript/src/components/PinInput/PinInput.js.map +0 -1
  65. package/lib/typescript/src/components/PinInput/PinInputText.js.map +0 -1
  66. package/lib/typescript/src/components/PinInput/index.d.ts +0 -3
  67. package/lib/typescript/src/components/PinInput/index.js +0 -4
  68. package/lib/typescript/src/components/PinInput/index.js.map +0 -1
  69. package/src/components/PinInput/CustomPinInputCell.js +0 -11
  70. package/src/components/PinInput/CustomPinInputCell.js.map +0 -1
  71. package/src/components/PinInput/CustomPinInputCell.tsx +0 -18
  72. package/src/components/PinInput/PinInput.js +0 -70
  73. package/src/components/PinInput/PinInput.js.map +0 -1
  74. package/src/components/PinInput/PinInput.tsx +0 -165
  75. package/src/components/PinInput/PinInputText.js.map +0 -1
  76. package/src/components/PinInput/index.js +0 -4
  77. package/src/components/PinInput/index.js.map +0 -1
  78. package/src/components/PinInput/index.tsx +0 -3
@@ -1,70 +0,0 @@
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
@@ -1 +0,0 @@
1
- {"version":3,"file":"PinInput.js","sourceRoot":"","sources":["../../../../../src/components/PinInput/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;AA0BhD,MAAM,QAAQ,GAAG,KAAK,CAAC,UAAU,CAC/B,CACE,EACE,KAAK,EACL,WAAW,EACX,SAAS,GAAG,CAAC,EACb,gBAAgB,GAAG,IAAI,EACvB,UAAU,GAAG,IAAI,EACjB,UAAU,EACV,KAAK,EACL,YAAY,EACZ,kBAAkB,GAAG,KAAK,CAAC,MAAM,CAAC,OAAO,EACzC,oBAAoB,GAAG,KAAK,CAAC,MAAM,CAAC,QAAQ,EAC5C,sBAAsB,EACtB,wBAAwB,EACxB,kBAAkB,GAAG,CAAC,EACtB,oBAAoB,GAAG,CAAC,EACxB,gBAAgB,GAAG,KAAK,CAAC,MAAM,CAAC,MAAM,EACtC,kBAAkB,GAAG,gBAAgB,EACrC,KAAK,EACL,GAAG,IAAI,EACR,EACD,GAAG,EACH,EAAE;IACF,MAAM,cAAc,GAAG,KAAK,CAAC,MAAM,CAAkB,IAAI,CAAC,CAAC;IAE3D,+DAA+D;IAC/D,MAAM,WAAW,GAAG,GAAG;QACrB,CAAC,CAAE,GAAwC;QAC3C,CAAC,CAAC,cAAc,CAAC;IAEnB,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,GAAG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EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,KAAI,CAChD,oBAAC,IAAI,IACH,MAAM,EAAC,yBAAyB,EAChC,KAAK,EAAE;gBACL,MAAM,CAAC,IAAI;gBACX;oBACE,WAAW,EAAE,SAAS;wBACpB,CAAC,CAAC,kBAAkB;wBACpB,CAAC,CAAC,oBAAoB;oBACxB,WAAW,EAAE,SAAS;wBACpB,CAAC,CAAC,kBAAkB;wBACpB,CAAC,CAAC,oBAAoB;oBACxB,eAAe,EAAE,SAAS;wBACxB,CAAC,CAAC,sBAAsB;wBACxB,CAAC,CAAC,wBAAwB;iBAC7B;gBACD,UAAU;aACX;YAED,oBAAC,YAAY,IACX,KAAK,EAAE;oBACL,MAAM,CAAC,QAAQ;oBACf;wBACE,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC,gBAAgB,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"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"PinInputText.js","sourceRoot":"","sources":["../../../../../src/components/PinInput/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"}
@@ -1,3 +0,0 @@
1
- export { default as PinInput } from "./PinInput";
2
- export { default as CustomPinInputCell } from "./CustomPinInputCell";
3
- export { default as PinInputText } from "./PinInputText";
@@ -1,4 +0,0 @@
1
- export { default as PinInput } from "./PinInput";
2
- export { default as CustomPinInputCell } from "./CustomPinInputCell";
3
- export { default as PinInputText } from "./PinInputText";
4
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/components/PinInput/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"}
@@ -1,11 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1,18 +0,0 @@
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;
@@ -1,70 +0,0 @@
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
@@ -1 +0,0 @@
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;AA0BhD,MAAM,QAAQ,GAAG,KAAK,CAAC,UAAU,CAC/B,CACE,EACE,KAAK,EACL,WAAW,EACX,SAAS,GAAG,CAAC,EACb,gBAAgB,GAAG,IAAI,EACvB,UAAU,GAAG,IAAI,EACjB,UAAU,EACV,KAAK,EACL,YAAY,EACZ,kBAAkB,GAAG,KAAK,CAAC,MAAM,CAAC,OAAO,EACzC,oBAAoB,GAAG,KAAK,CAAC,MAAM,CAAC,QAAQ,EAC5C,sBAAsB,EACtB,wBAAwB,EACxB,kBAAkB,GAAG,CAAC,EACtB,oBAAoB,GAAG,CAAC,EACxB,gBAAgB,GAAG,KAAK,CAAC,MAA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d,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"}
@@ -1,165 +0,0 @@
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);
@@ -1 +0,0 @@
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"}
@@ -1,4 +0,0 @@
1
- export { default as PinInput } from "./PinInput";
2
- export { default as CustomPinInputCell } from "./CustomPinInputCell";
3
- export { default as PinInputText } from "./PinInputText";
4
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
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"}
@@ -1,3 +0,0 @@
1
- export { default as PinInput } from "./PinInput";
2
- export { default as CustomPinInputCell } from "./CustomPinInputCell";
3
- export { default as PinInputText } from "./PinInputText";