@draftbit/core 48.4.4-c4bd53.2 → 48.4.5-a295fc.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.
Files changed (85) hide show
  1. package/lib/commonjs/components/BottomSheet/BottomSheet.js +1 -1
  2. package/lib/commonjs/components/Checkbox/Checkbox.js +1 -1
  3. package/lib/commonjs/components/CodeInput/CodeInput.js +1 -0
  4. package/lib/commonjs/components/CodeInput/CodeInputCell.js +1 -0
  5. package/lib/commonjs/components/{PinInput/PinInputText.js → CodeInput/CodeInputText.js} +1 -1
  6. package/lib/commonjs/components/CodeInput/index.js +1 -0
  7. package/lib/commonjs/components/IconButton.js +1 -1
  8. package/lib/commonjs/index.js +1 -1
  9. package/lib/commonjs/utilities.js +1 -1
  10. package/lib/typescript/src/components/BottomSheet/BottomSheet.d.ts +3 -2
  11. package/lib/typescript/src/components/BottomSheet/BottomSheet.js +3 -3
  12. package/lib/typescript/src/components/BottomSheet/BottomSheet.js.map +1 -1
  13. package/lib/typescript/src/components/Checkbox/Checkbox.js +1 -1
  14. package/lib/typescript/src/components/Checkbox/Checkbox.js.map +1 -1
  15. package/lib/typescript/src/components/CodeInput/CodeInput.d.ts +18 -0
  16. package/lib/typescript/src/components/CodeInput/CodeInput.js +30 -0
  17. package/lib/typescript/src/components/CodeInput/CodeInput.js.map +1 -0
  18. package/lib/typescript/src/components/CodeInput/CodeInputCell.d.ts +16 -0
  19. package/lib/typescript/src/components/CodeInput/CodeInputCell.js +43 -0
  20. package/lib/typescript/src/components/CodeInput/CodeInputCell.js.map +1 -0
  21. package/lib/typescript/src/components/{PinInput/PinInputText.d.ts → CodeInput/CodeInputText.d.ts} +3 -3
  22. package/{src/components/PinInput/PinInputText.js → lib/typescript/src/components/CodeInput/CodeInputText.js} +4 -4
  23. package/lib/typescript/src/components/CodeInput/CodeInputText.js.map +1 -0
  24. package/lib/typescript/src/components/CodeInput/index.d.ts +3 -0
  25. package/lib/typescript/src/components/CodeInput/index.js +4 -0
  26. package/lib/typescript/src/components/CodeInput/index.js.map +1 -0
  27. package/lib/typescript/src/components/IconButton.js +0 -2
  28. package/lib/typescript/src/components/IconButton.js.map +1 -1
  29. package/lib/typescript/src/index.d.ts +1 -1
  30. package/lib/typescript/src/index.js +1 -1
  31. package/lib/typescript/src/index.js.map +1 -1
  32. package/lib/typescript/src/utilities.js +0 -6
  33. package/lib/typescript/src/utilities.js.map +1 -1
  34. package/lib/typescript/tsconfig.tsbuildinfo +1 -1
  35. package/package.json +3 -3
  36. package/src/components/BottomSheet/BottomSheet.js +3 -3
  37. package/src/components/BottomSheet/BottomSheet.js.map +1 -1
  38. package/src/components/BottomSheet/BottomSheet.tsx +90 -81
  39. package/src/components/Checkbox/Checkbox.js +1 -1
  40. package/src/components/Checkbox/Checkbox.js.map +1 -1
  41. package/src/components/Checkbox/Checkbox.tsx +1 -1
  42. package/src/components/CodeInput/CodeInput.js +30 -0
  43. package/src/components/CodeInput/CodeInput.js.map +1 -0
  44. package/src/components/CodeInput/CodeInput.tsx +95 -0
  45. package/src/components/CodeInput/CodeInputCell.js +43 -0
  46. package/src/components/CodeInput/CodeInputCell.js.map +1 -0
  47. package/src/components/CodeInput/CodeInputCell.tsx +73 -0
  48. package/{lib/typescript/src/components/PinInput/PinInputText.js → src/components/CodeInput/CodeInputText.js} +4 -4
  49. package/src/components/CodeInput/CodeInputText.js.map +1 -0
  50. package/src/components/{PinInput/PinInputText.tsx → CodeInput/CodeInputText.tsx} +4 -4
  51. package/src/components/CodeInput/index.js +4 -0
  52. package/src/components/CodeInput/index.js.map +1 -0
  53. package/src/components/CodeInput/index.tsx +3 -0
  54. package/src/components/IconButton.js +0 -2
  55. package/src/components/IconButton.js.map +1 -1
  56. package/src/components/IconButton.tsx +0 -2
  57. package/src/index.js +1 -1
  58. package/src/index.js.map +1 -1
  59. package/src/index.tsx +4 -4
  60. package/src/utilities.js +0 -6
  61. package/src/utilities.js.map +1 -1
  62. package/src/utilities.ts +0 -7
  63. package/lib/commonjs/components/PinInput/CustomPinInputCell.js +0 -1
  64. package/lib/commonjs/components/PinInput/PinInput.js +0 -1
  65. package/lib/commonjs/components/PinInput/index.js +0 -1
  66. package/lib/typescript/src/components/PinInput/CustomPinInputCell.d.ts +0 -11
  67. package/lib/typescript/src/components/PinInput/CustomPinInputCell.js +0 -11
  68. package/lib/typescript/src/components/PinInput/CustomPinInputCell.js.map +0 -1
  69. package/lib/typescript/src/components/PinInput/PinInput.d.ts +0 -30
  70. package/lib/typescript/src/components/PinInput/PinInput.js +0 -70
  71. package/lib/typescript/src/components/PinInput/PinInput.js.map +0 -1
  72. package/lib/typescript/src/components/PinInput/PinInputText.js.map +0 -1
  73. package/lib/typescript/src/components/PinInput/index.d.ts +0 -3
  74. package/lib/typescript/src/components/PinInput/index.js +0 -4
  75. package/lib/typescript/src/components/PinInput/index.js.map +0 -1
  76. package/src/components/PinInput/CustomPinInputCell.js +0 -11
  77. package/src/components/PinInput/CustomPinInputCell.js.map +0 -1
  78. package/src/components/PinInput/CustomPinInputCell.tsx +0 -18
  79. package/src/components/PinInput/PinInput.js +0 -70
  80. package/src/components/PinInput/PinInput.js.map +0 -1
  81. package/src/components/PinInput/PinInput.tsx +0 -165
  82. package/src/components/PinInput/PinInputText.js.map +0 -1
  83. package/src/components/PinInput/index.js +0 -4
  84. package/src/components/PinInput/index.js.map +0 -1
  85. package/src/components/PinInput/index.tsx +0 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@draftbit/core",
3
- "version": "48.4.4-c4bd53.2+c4bd530",
3
+ "version": "48.4.5-a295fc.2+a295fc0",
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.4-c4bd53.2+c4bd530",
44
+ "@draftbit/types": "^48.4.5-a295fc.2+a295fc0",
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": "c4bd530c93d70dafb1bc63b661cb1a27e6259057"
103
+ "gitHead": "a295fc04f50ba5263b087035556a2ab8f6dafc44"
104
104
  }
@@ -2,7 +2,7 @@ import React from "react";
2
2
  import { StyleSheet, View, } from "react-native";
3
3
  import BottomSheetComponent from "./BottomSheetComponent";
4
4
  import { withTheme } from "../../theming";
5
- const BottomSheet = ({ theme, snapPoints: snapPointsProp, topSnapPosition = "10%", middleSnapPosition = "50%", bottomSnapPosition = "80%", initialSnapIndex, initialSnapPosition = "bottom", showHandle = true, handleColor = theme.colors.divider, topBorderRadius = 20, borderWidth = 1, borderColor = theme.colors.divider, onSettle, style, children, ...rest }) => {
5
+ const BottomSheet = React.forwardRef(({ theme, snapPoints: snapPointsProp, topSnapPosition = "10%", middleSnapPosition = "50%", bottomSnapPosition = "80%", initialSnapIndex, initialSnapPosition = "bottom", showHandle = true, handleColor = theme.colors.divider, topBorderRadius = 20, borderWidth = 1, borderColor = theme.colors.divider, onSettle, style, children, ...rest }, ref) => {
6
6
  const backgroundColor = (style === null || style === void 0 ? void 0 : style.backgroundColor) || theme.colors.background;
7
7
  const snapPoints = snapPointsProp || [
8
8
  topSnapPosition,
@@ -20,7 +20,7 @@ const BottomSheet = ({ theme, snapPoints: snapPointsProp, topSnapPosition = "10%
20
20
  }
21
21
  };
22
22
  return (React.createElement(View, { style: styles.parentContainer, pointerEvents: "box-none" },
23
- React.createElement(BottomSheetComponent, { componentType: "ScrollView", snapPoints: snapPoints, initialSnapIndex: initialSnapIndex !== null && initialSnapIndex !== void 0 ? initialSnapIndex : getSnapIndexFromPosition(initialSnapPosition), renderHandle: () => (React.createElement(React.Fragment, null, showHandle && (React.createElement(View, { style: [
23
+ React.createElement(BottomSheetComponent, { ref: ref, componentType: "ScrollView", snapPoints: snapPoints, initialSnapIndex: initialSnapIndex !== null && initialSnapIndex !== void 0 ? initialSnapIndex : getSnapIndexFromPosition(initialSnapPosition), renderHandle: () => (React.createElement(React.Fragment, null, showHandle && (React.createElement(View, { style: [
24
24
  styles.handleContainer,
25
25
  {
26
26
  backgroundColor,
@@ -38,7 +38,7 @@ const BottomSheet = ({ theme, snapPoints: snapPointsProp, topSnapPosition = "10%
38
38
  borderColor,
39
39
  },
40
40
  ]), onSettle: onSettle, ...rest }, children)));
41
- };
41
+ });
42
42
  const styles = StyleSheet.create({
43
43
  //Render on top of everything
44
44
  parentContainer: {
@@ -1 +1 @@
1
- {"version":3,"file":"BottomSheet.js","sourceRoot":"","sources":["BottomSheet.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EACL,UAAU,EACV,IAAI,GAIL,MAAM,cAAc,CAAC;AAEtB,OAAO,oBAAoB,MAAM,wBAAwB,CAAC;AAE1D,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAuB1C,MAAM,WAAW,GAAwD,CAAC,EACxE,KAAK,EACL,UAAU,EAAE,cAAc,EAC1B,eAAe,GAAG,KAAK,EACvB,kBAAkB,GAAG,KAAK,EAC1B,kBAAkB,GAAG,KAAK,EAC1B,gBAAgB,EAChB,mBAAmB,GAAG,QAAQ,EAC9B,UAAU,GAAG,IAAI,EACjB,WAAW,GAAG,KAAK,CAAC,MAAM,CAAC,OAAO,EAClC,eAAe,GAAG,EAAE,EACpB,WAAW,GAAG,CAAC,EACf,WAAW,GAAG,KAAK,CAAC,MAAM,CAAC,OAAO,EAClC,QAAQ,EACR,KAAK,EACL,QAAQ,EACR,GAAG,IAAI,EACR,EAAE,EAAE;IACH,MAAM,eAAe,GACnB,CAAC,KAAmB,aAAnB,KAAK,uBAAL,KAAK,CAAgB,eAAe,KAAI,KAAK,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MAAM,CAAC,qBAAqB,EAAE,KAAK,CAAC,EAC5D,cAAc,EAAE,UAAU,CAAC,OAAO,CAAC;gBACjC,MAAM,CAAC,cAAc;gBACrB;oBACE,eAAe;oBACf,mBAAmB,EAAE,eAAe;oBACpC,oBAAoB,EAAE,eAAe;oBACrC,WAAW;oBACX,WAAW;iBACZ;aACF,CAAC,EACF,QAAQ,EAAE,QAAQ,KACd,IAAI,IAEP,QAAQ,CACY,CAClB,CACR,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;IAC/B,6BAA6B;IAC7B,eAAe,EAAE;QACf,QAAQ,EAAE,UAAU;QACpB,IAAI,EAAE,CAAC;QACP,KAAK,EAAE,CAAC;QACR,GAAG,EAAE,CAAC;QACN,MAAM,EAAE,CAAC;QACT,MAAM,EAAE,EAAE;QACV,QAAQ,EAAE,QAAQ;KACnB;IACD,qBAAqB,EAAE;QACrB,iBAAiB,EAAE,EAAE;QACrB,eAAe,EAAE,EAAE;KACpB;IACD,cAAc,EAAE;QACd,IAAI,EAAE,CAAC;QACP,QAAQ,EAAE,QAAQ;KACnB;IACD,eAAe,EAAE;QACf,UAAU,EAAE,QAAQ;QACpB,eAAe,EAAE,EAAE;KACpB;IACD,MAAM,EAAE;QACN,KAAK,EAAE,EAAE;QACT,MAAM,EAAE,CAAC;QACT,YAAY,EAAE,CAAC;KAChB;CACF,CAAC,CAAC;AAEH,eAAe,SAAS,CAAC,WAAW,CAAC,CAAC"}
@@ -32,91 +32,100 @@ export interface BottomSheetProps extends ScrollViewProps {
32
32
  theme: Theme;
33
33
  }
34
34
 
35
- const BottomSheet: React.FC<React.PropsWithChildren<BottomSheetProps>> = ({
36
- theme,
37
- snapPoints: snapPointsProp,
38
- topSnapPosition = "10%",
39
- middleSnapPosition = "50%",
40
- bottomSnapPosition = "80%",
41
- initialSnapIndex,
42
- initialSnapPosition = "bottom",
43
- showHandle = true,
44
- handleColor = theme.colors.divider,
45
- topBorderRadius = 20,
46
- borderWidth = 1,
47
- borderColor = theme.colors.divider,
48
- onSettle,
49
- style,
50
- children,
51
- ...rest
52
- }) => {
53
- const backgroundColor =
54
- (style as ViewStyle)?.backgroundColor || theme.colors.background;
35
+ const BottomSheet = React.forwardRef<
36
+ BottomSheetComponent<any>,
37
+ BottomSheetProps
38
+ >(
39
+ (
40
+ {
41
+ theme,
42
+ snapPoints: snapPointsProp,
43
+ topSnapPosition = "10%",
44
+ middleSnapPosition = "50%",
45
+ bottomSnapPosition = "80%",
46
+ initialSnapIndex,
47
+ initialSnapPosition = "bottom",
48
+ showHandle = true,
49
+ handleColor = theme.colors.divider,
50
+ topBorderRadius = 20,
51
+ borderWidth = 1,
52
+ borderColor = theme.colors.divider,
53
+ onSettle,
54
+ style,
55
+ children,
56
+ ...rest
57
+ },
58
+ ref
59
+ ) => {
60
+ const backgroundColor =
61
+ (style as ViewStyle)?.backgroundColor || theme.colors.background;
55
62
 
56
- const snapPoints = snapPointsProp || [
57
- topSnapPosition,
58
- middleSnapPosition,
59
- bottomSnapPosition,
60
- ];
63
+ const snapPoints = snapPointsProp || [
64
+ topSnapPosition,
65
+ middleSnapPosition,
66
+ bottomSnapPosition,
67
+ ];
61
68
 
62
- const getSnapIndexFromPosition = (position: SnapPosition) => {
63
- switch (position) {
64
- case "top":
65
- return 0;
66
- case "middle":
67
- return 1;
68
- case "bottom":
69
- return 2;
70
- }
71
- };
69
+ const getSnapIndexFromPosition = (position: SnapPosition) => {
70
+ switch (position) {
71
+ case "top":
72
+ return 0;
73
+ case "middle":
74
+ return 1;
75
+ case "bottom":
76
+ return 2;
77
+ }
78
+ };
72
79
 
73
- return (
74
- <View style={styles.parentContainer} pointerEvents="box-none">
75
- <BottomSheetComponent
76
- componentType="ScrollView"
77
- snapPoints={snapPoints}
78
- initialSnapIndex={
79
- initialSnapIndex ?? getSnapIndexFromPosition(initialSnapPosition)
80
- }
81
- renderHandle={() => (
82
- <>
83
- {showHandle && (
84
- <View
85
- style={[
86
- styles.handleContainer,
87
- {
88
- backgroundColor,
89
- borderTopLeftRadius: topBorderRadius,
90
- borderTopRightRadius: topBorderRadius,
91
- },
92
- ]}
93
- >
80
+ return (
81
+ <View style={styles.parentContainer} pointerEvents="box-none">
82
+ <BottomSheetComponent
83
+ ref={ref}
84
+ componentType="ScrollView"
85
+ snapPoints={snapPoints}
86
+ initialSnapIndex={
87
+ initialSnapIndex ?? getSnapIndexFromPosition(initialSnapPosition)
88
+ }
89
+ renderHandle={() => (
90
+ <>
91
+ {showHandle && (
94
92
  <View
95
- style={[styles.handle, { backgroundColor: handleColor }]}
96
- />
97
- </View>
98
- )}
99
- </>
100
- )}
101
- contentContainerStyle={[styles.contentContainerStyle, style]}
102
- containerStyle={StyleSheet.flatten([
103
- styles.containerStyle,
104
- {
105
- backgroundColor,
106
- borderTopLeftRadius: topBorderRadius,
107
- borderTopRightRadius: topBorderRadius,
108
- borderWidth,
109
- borderColor,
110
- },
111
- ])}
112
- onSettle={onSettle}
113
- {...rest}
114
- >
115
- {children}
116
- </BottomSheetComponent>
117
- </View>
118
- );
119
- };
93
+ style={[
94
+ styles.handleContainer,
95
+ {
96
+ backgroundColor,
97
+ borderTopLeftRadius: topBorderRadius,
98
+ borderTopRightRadius: topBorderRadius,
99
+ },
100
+ ]}
101
+ >
102
+ <View
103
+ style={[styles.handle, { backgroundColor: handleColor }]}
104
+ />
105
+ </View>
106
+ )}
107
+ </>
108
+ )}
109
+ contentContainerStyle={[styles.contentContainerStyle, style]}
110
+ containerStyle={StyleSheet.flatten([
111
+ styles.containerStyle,
112
+ {
113
+ backgroundColor,
114
+ borderTopLeftRadius: topBorderRadius,
115
+ borderTopRightRadius: topBorderRadius,
116
+ borderWidth,
117
+ borderColor,
118
+ },
119
+ ])}
120
+ onSettle={onSettle}
121
+ {...rest}
122
+ >
123
+ {children}
124
+ </BottomSheetComponent>
125
+ </View>
126
+ );
127
+ }
128
+ );
120
129
 
121
130
  const styles = StyleSheet.create({
122
131
  //Render on top of everything
@@ -32,7 +32,7 @@ const Checkbox = ({ Icon, status, disabled = false, onPress, onCheck, onUncheck,
32
32
  onUncheck === null || onUncheck === void 0 ? void 0 : onUncheck();
33
33
  }
34
34
  };
35
- return (React.createElement(Pressable, { ...rest, onPress: handlePress, disabled: disabled, accessibilityState: { disabled }, accessibilityRole: "button", accessibilityLiveRegion: "polite", style: [styles.container, style, { width: size, height: size }] },
35
+ return (React.createElement(Pressable, { ...rest, onPress: handlePress, disabled: disabled, accessibilityState: { disabled }, accessibilityRole: "button", accessibilityLiveRegion: "polite", style: [styles.container, style] },
36
36
  React.createElement(Icon, { style: styles.icon, name: internalValue ? checkedIcon : uncheckedIcon, size: size, color: checkboxColor }),
37
37
  React.createElement(View, { style: [StyleSheet.absoluteFill, styles.fillContainer] },
38
38
  React.createElement(View, { style: [
@@ -1 +1 @@
1
- {"version":3,"file":"Checkbox.js","sourceRoot":"","sources":["Checkbox.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EACL,IAAI,EACJ,UAAU,EACV,SAAS,GAIV,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAGzC,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAiB1C,MAAM,QAAQ,GAAwD,CAAC,EACrE,IAAI,EACJ,MAAM,EACN,QAAQ,GAAG,KAAK,EAChB,OAAO,EACP,OAAO,EACP,SAAS,EACT,KAAK,EACL,cAAc,EACd,YAAY,EACZ,WAAW,GAAG,wCAAwC,EACtD,aAAa,GAAG,+CAA+C,EAC/D,IAAI,GAAG,EAAE,EACT,KAAK,EACL,GAAG,IAAI,EACR,EAAE,EAAE;IACH,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC,GAAG,KAAK,CAAC,QAAQ,CACtD,MAAM,IAAI,YAAY,IAAI,KAAK,CAChC,CAAC;IAEF,KAAK,CAAC,SAAS,CAA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;QACV,SAAS,EAAE,QAAQ;KACpB;CACF,CAAC,CAAC;AAEH,eAAe,QAAQ,CAAC"}
@@ -92,7 +92,7 @@ const Checkbox: React.FC<CheckboxProps & PressableProps & IconSlot> = ({
92
92
  accessibilityState={{ disabled }}
93
93
  accessibilityRole="button"
94
94
  accessibilityLiveRegion="polite"
95
- style={[styles.container, style, { width: size, height: size }]}
95
+ style={[styles.container, style]}
96
96
  >
97
97
  <Icon
98
98
  style={styles.icon}
@@ -0,0 +1,30 @@
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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CodeInput.js","sourceRoot":"","sources":["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,CA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 -0,0 +1,95 @@
1
+ import React from "react";
2
+ import {
3
+ StyleProp,
4
+ ViewStyle,
5
+ TextInput as NativeTextInput,
6
+ View,
7
+ } from "react-native";
8
+ import TextInput, { TextInputProps } from "../TextInput";
9
+ import {
10
+ CodeField,
11
+ useClearByFocusCell,
12
+ } from "react-native-confirmation-code-field";
13
+ import { DefaultCodeInputCell } from "./CodeInputCell";
14
+
15
+ interface CellItem {
16
+ cellValue: string;
17
+ index: number;
18
+ isFocused: boolean;
19
+ }
20
+
21
+ interface CodeInputProps extends TextInputProps {
22
+ onInputFull?: (value: string) => void;
23
+ cellCount?: number;
24
+ clearOnCellFocus?: boolean;
25
+ blurOnFull?: boolean;
26
+ renderItem?: ({ cellValue, index, isFocused }: CellItem) => JSX.Element;
27
+ style?: StyleProp<ViewStyle>;
28
+ }
29
+
30
+ const CodeInput = React.forwardRef<NativeTextInput, CodeInputProps>(
31
+ (
32
+ {
33
+ onInputFull,
34
+ cellCount = 4,
35
+ clearOnCellFocus = true,
36
+ blurOnFull = true,
37
+ renderItem,
38
+ value,
39
+ onChangeText,
40
+ style,
41
+ ...rest
42
+ },
43
+ ref
44
+ ) => {
45
+ const newCodeInputRef = React.useRef<NativeTextInput>(null);
46
+
47
+ // Use the provided ref or default to new ref when not provided
48
+ const codeInputRef = ref
49
+ ? (ref as React.RefObject<NativeTextInput>)
50
+ : newCodeInputRef;
51
+
52
+ // 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)
53
+ const [codeFieldProps, getCellOnLayout] = useClearByFocusCell({
54
+ value,
55
+ setValue: (text) => onChangeText?.(text),
56
+ });
57
+
58
+ React.useEffect(() => {
59
+ if (value?.length === cellCount) {
60
+ if (blurOnFull) {
61
+ codeInputRef.current?.blur();
62
+ }
63
+ onInputFull?.(value);
64
+ }
65
+ // eslint-disable-next-line react-hooks/exhaustive-deps
66
+ }, [value, cellCount, blurOnFull, codeInputRef]);
67
+
68
+ return (
69
+ <CodeField
70
+ ref={codeInputRef}
71
+ {...(clearOnCellFocus ? codeFieldProps : {})}
72
+ value={value}
73
+ onChangeText={onChangeText}
74
+ rootStyle={style}
75
+ textInputStyle={{ height: "100%" }} // addresses issue on firefox where the hidden input did not fill the height
76
+ InputComponent={TextInput}
77
+ cellCount={cellCount}
78
+ renderCell={({ symbol, index, isFocused }) => (
79
+ <View
80
+ key={index}
81
+ onLayout={clearOnCellFocus ? getCellOnLayout(index) : undefined}
82
+ style={{ flex: 1 }}
83
+ >
84
+ {renderItem?.({ cellValue: symbol, index, isFocused }) || (
85
+ <DefaultCodeInputCell cellValue={symbol} isFocused={isFocused} />
86
+ )}
87
+ </View>
88
+ )}
89
+ {...rest}
90
+ />
91
+ );
92
+ }
93
+ );
94
+
95
+ export default CodeInput;
@@ -0,0 +1,43 @@
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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CodeInputCell.js","sourceRoot":"","sources":["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"}
@@ -0,0 +1,73 @@
1
+ import React from "react";
2
+ import { StyleProp, ViewStyle, View, StyleSheet } from "react-native";
3
+ import type { Theme } from "../../styles/DefaultTheme";
4
+ import { withTheme } from "../../theming";
5
+ import CodeInputText from "./CodeInputText";
6
+
7
+ interface CodeInputCellProps {
8
+ style?: StyleProp<ViewStyle>;
9
+ }
10
+
11
+ const CodeInputCell: React.FC<React.PropsWithChildren<CodeInputCellProps>> = ({
12
+ style,
13
+ children,
14
+ }) => {
15
+ return <View style={[styles.cell, style]} children={children} />;
16
+ };
17
+
18
+ interface DefaultCodeInputCellProps {
19
+ cellValue: string;
20
+ isFocused: boolean;
21
+ theme: Theme;
22
+ }
23
+
24
+ export const DefaultCodeInputCell = withTheme(
25
+ ({ cellValue, isFocused, theme }: DefaultCodeInputCellProps) => {
26
+ return (
27
+ <View
28
+ testID="default-code-input-cell"
29
+ style={[
30
+ styles.cell,
31
+ styles.defaultCellContainer,
32
+ {
33
+ borderWidth: isFocused ? 2 : 1,
34
+ borderColor: isFocused
35
+ ? theme.colors.primary
36
+ : theme.colors.disabled,
37
+ },
38
+ ]}
39
+ >
40
+ <CodeInputText
41
+ style={[
42
+ styles.defaultCellText,
43
+ {
44
+ color: theme.colors.strong,
45
+ },
46
+ ]}
47
+ isFocused={isFocused}
48
+ >
49
+ {cellValue}
50
+ </CodeInputText>
51
+ </View>
52
+ );
53
+ }
54
+ );
55
+
56
+ const styles = StyleSheet.create({
57
+ cell: { marginStart: 5, marginEnd: 5 },
58
+ defaultCellContainer: {
59
+ padding: 5,
60
+ backgroundColor: "transparent",
61
+ borderRadius: 5,
62
+ justifyContent: "center",
63
+ alignItems: "center",
64
+ aspectRatio: 1,
65
+ maxWidth: 70,
66
+ maxHeight: 70,
67
+ },
68
+ defaultCellText: {
69
+ fontSize: 25,
70
+ },
71
+ });
72
+
73
+ export default CodeInputCell;
@@ -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 CustomPinInputCell component
7
+ * Meant to be used within a CodeInputCell component
8
8
  */
9
- const CustomPinInputText = ({ isFocused, cursorBlinkDuration, cursorText, style, theme, children, ...rest }) => {
9
+ const CodeInputText = ({ 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(CustomPinInputText);
14
- //# sourceMappingURL=PinInputText.js.map
13
+ export default withTheme(CodeInputText);
14
+ //# sourceMappingURL=CodeInputText.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CodeInputText.js","sourceRoot":"","sources":["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"}
@@ -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 CustomPinInputTextProps extends TextProps {
7
+ interface CodeInputTextProps extends TextProps {
8
8
  cursorBlinkDuration?: number;
9
9
  cursorText?: string;
10
10
  isFocused?: boolean;
@@ -13,9 +13,9 @@ interface CustomPinInputTextProps 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 CustomPinInputCell component
16
+ * Meant to be used within a CodeInputCell component
17
17
  */
18
- const CustomPinInputText: React.FC<CustomPinInputTextProps> = ({
18
+ const CodeInputText: React.FC<CodeInputTextProps> = ({
19
19
  isFocused,
20
20
  cursorBlinkDuration,
21
21
  cursorText,
@@ -34,4 +34,4 @@ const CustomPinInputText: React.FC<CustomPinInputTextProps> = ({
34
34
  );
35
35
  };
36
36
 
37
- export default withTheme(CustomPinInputText);
37
+ export default withTheme(CodeInputText);
@@ -0,0 +1,4 @@
1
+ export { default as CodeInput } from "./CodeInput";
2
+ export { default as CodeInputCell } from "./CodeInputCell";
3
+ export { default as CodeInputText } from "./CodeInputText";
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["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"}
@@ -0,0 +1,3 @@
1
+ export { default as CodeInput } from "./CodeInput";
2
+ export { default as CodeInputCell } from "./CodeInputCell";
3
+ export { default as CodeInputText } from "./CodeInputText";
@@ -8,8 +8,6 @@ const IconButton = ({ Icon, icon, color: customColor, size = 32, disabled, loadi
8
8
  styles.container,
9
9
  {
10
10
  opacity: pressed ? activeOpacity : disabled ? disabledOpacity : 1,
11
- width: size,
12
- height: size,
13
11
  alignItems: "center",
14
12
  justifyContent: "center",
15
13
  },
@@ -1 +1 @@
1
- {"version":3,"file":"IconButton.js","sourceRoot":"","sources":["IconButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EACL,IAAI,EACJ,UAAU,EACV,iBAAiB,EAGjB,SAAS,EAET,QAAQ,GACT,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAkBvC,MAAM,UAAU,GAA6C,CAAC,EAC5D,IAAI,EACJ,IAAI,EACJ,KAAK,EAAE,WAAW,EAClB,IAAI,GAAG,EAAE,EACT,QAAQ,EACR,OAAO,GAAG,KAAK,EACf,OAAO,EACP,KAAK,EACL,KAAK,EACL,aAAa,GAAG,GAAG,EACnB,eAAe,GAAG,GAAG,EACrB,GAAG,KAAK,EACT,EAAE,EAAE;IACH,MAAM,SAAS,GAAG,WAAW,IAAI,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC;IAEtD,O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CACG,CACb,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;IAC/B,SAAS,EAAE;QACT,UAAU,EAAE,QAAQ;QACpB,cAAc,EAAE,QAAQ;QACxB,GAAG,QAAQ,CAAC,MAAM,CAAC;YACjB,GAAG,EAAE;gBACH,MAAM,EAAE,SAAS;gBACjB,UAAU,EAAE,MAAM;aACnB;SACF,CAAC;KACH;CACF,CAAC,CAAC;AAEH,eAAe,SAAS,CAAC,UAAU,CAAC,CAAC"}
@@ -52,8 +52,6 @@ const IconButton: React.FC<React.PropsWithChildren<Props>> = ({
52
52
  styles.container,
53
53
  {
54
54
  opacity: pressed ? activeOpacity : disabled ? disabledOpacity : 1,
55
- width: size,
56
- height: size,
57
55
  alignItems: "center",
58
56
  justifyContent: "center",
59
57
  },
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 { PinInput, CustomPinInputCell, PinInputText as CustomPinInputText, } from "./components/PinInput";
43
+ export { CodeInput, CodeInputCell, CodeInputText, } from "./components/CodeInput";
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";