rn-floating-input 0.1.1 → 0.1.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/ErrorText.js +26 -0
- package/lib/commonjs/ErrorText.js.map +1 -0
- package/lib/commonjs/FloatingInput.js +79 -118
- package/lib/commonjs/FloatingInput.js.map +1 -1
- package/lib/commonjs/FloatingLabel.js +27 -0
- package/lib/commonjs/FloatingLabel.js.map +1 -0
- package/lib/commonjs/defaults.js +31 -26
- package/lib/commonjs/defaults.js.map +1 -1
- package/lib/commonjs/index.js +0 -13
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/useFloatingLabel.js +86 -0
- package/lib/commonjs/useFloatingLabel.js.map +1 -0
- package/lib/module/ErrorText.js +21 -0
- package/lib/module/ErrorText.js.map +1 -0
- package/lib/module/FloatingInput.js +82 -121
- package/lib/module/FloatingInput.js.map +1 -1
- package/lib/module/FloatingLabel.js +22 -0
- package/lib/module/FloatingLabel.js.map +1 -0
- package/lib/module/defaults.js +31 -26
- package/lib/module/defaults.js.map +1 -1
- package/lib/module/index.js +1 -2
- package/lib/module/index.js.map +1 -1
- package/lib/module/useFloatingLabel.js +82 -0
- package/lib/module/useFloatingLabel.js.map +1 -0
- package/lib/typescript/ErrorText.d.ts +14 -0
- package/lib/typescript/ErrorText.d.ts.map +1 -0
- package/lib/typescript/FloatingInput.d.ts.map +1 -1
- package/lib/typescript/FloatingLabel.d.ts +17 -0
- package/lib/typescript/FloatingLabel.d.ts.map +1 -0
- package/lib/typescript/defaults.d.ts +2 -1
- package/lib/typescript/defaults.d.ts.map +1 -1
- package/lib/typescript/index.d.ts +2 -3
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/types.d.ts +3 -5
- package/lib/typescript/types.d.ts.map +1 -1
- package/lib/typescript/useFloatingLabel.d.ts +43 -0
- package/lib/typescript/useFloatingLabel.d.ts.map +1 -0
- package/package.json +1 -1
- package/src/ErrorText.tsx +37 -0
- package/src/FloatingInput.tsx +91 -161
- package/src/FloatingLabel.tsx +41 -0
- package/src/defaults.ts +34 -29
- package/src/index.tsx +2 -3
- package/src/types.ts +50 -49
- package/src/useFloatingLabel.ts +111 -0
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import React, {
|
|
3
|
+
import React, { useImperativeHandle, useRef } from "react";
|
|
4
4
|
import { Pressable, TextInput as RNTextInput, View } from "react-native";
|
|
5
|
-
import Animated, {
|
|
6
|
-
import { baseStyles
|
|
5
|
+
import Animated, { LinearTransition } from "react-native-reanimated";
|
|
6
|
+
import { baseStyles } from "./defaults";
|
|
7
|
+
import { ErrorText } from "./ErrorText";
|
|
8
|
+
import { FloatingLabel } from "./FloatingLabel";
|
|
9
|
+
import { useFloatingLabel } from "./useFloatingLabel";
|
|
7
10
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
8
11
|
export const FloatingInput = /*#__PURE__*/React.forwardRef(({
|
|
9
12
|
value,
|
|
@@ -26,136 +29,94 @@ export const FloatingInput = /*#__PURE__*/React.forwardRef(({
|
|
|
26
29
|
theme: themeProp,
|
|
27
30
|
styles: stylesProp,
|
|
28
31
|
style,
|
|
29
|
-
animationConfig
|
|
32
|
+
animationConfig,
|
|
30
33
|
textInputProps
|
|
31
34
|
}, ref) => {
|
|
32
35
|
const inputRef = useRef(null);
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
36
|
+
const {
|
|
37
|
+
hasError,
|
|
38
|
+
shouldBeActive,
|
|
39
|
+
theme,
|
|
40
|
+
labelAnimatedStyle,
|
|
41
|
+
handleFocus,
|
|
42
|
+
handleBlur,
|
|
43
|
+
onContainerLayout
|
|
44
|
+
} = useFloatingLabel({
|
|
45
|
+
value,
|
|
46
|
+
onFocus,
|
|
47
|
+
onBlur,
|
|
48
|
+
touched,
|
|
49
|
+
error,
|
|
50
|
+
theme: themeProp,
|
|
51
|
+
animationConfig
|
|
52
|
+
});
|
|
46
53
|
useImperativeHandle(ref, () => ({
|
|
47
54
|
focus: () => inputRef.current?.focus(),
|
|
48
55
|
blur: () => inputRef.current?.blur(),
|
|
49
56
|
clear: () => inputRef.current?.clear(),
|
|
50
57
|
isFocused: () => inputRef.current?.isFocused() ?? false
|
|
51
58
|
}));
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
},
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
autoCapitalize,
|
|
101
|
-
secureTextEntry,
|
|
102
|
-
selectionColor: theme.selectionColor,
|
|
103
|
-
cursorColor: theme.selectionColor,
|
|
104
|
-
selectionHandleColor: theme.selectionColor,
|
|
105
|
-
underlineColorAndroid: "transparent",
|
|
106
|
-
style: [baseStyles.input, {
|
|
107
|
-
color: theme.inputColor,
|
|
108
|
-
fontFamily: theme.fontFamily,
|
|
109
|
-
fontSize: theme.fontSize
|
|
110
|
-
}, right ? baseStyles.inputWithRight : undefined, stylesProp?.input],
|
|
111
|
-
...textInputProps
|
|
112
|
-
};
|
|
113
|
-
const inputElement = renderInput ? renderInput(inputProps) : /*#__PURE__*/_jsx(RNTextInput, {
|
|
114
|
-
...inputProps
|
|
115
|
-
});
|
|
116
|
-
return /*#__PURE__*/_jsxs(View, {
|
|
117
|
-
style: [baseStyles.inputContainer, {
|
|
118
|
-
backgroundColor: theme.backgroundColor,
|
|
119
|
-
borderRadius: theme.borderRadius,
|
|
120
|
-
minHeight: theme.minHeight
|
|
121
|
-
}, style, stylesProp?.inputContainer],
|
|
122
|
-
children: [/*#__PURE__*/_jsxs(View, {
|
|
123
|
-
style: [baseStyles.labelAndInputArea, stylesProp?.labelAndInputArea],
|
|
124
|
-
children: [/*#__PURE__*/_jsx(Animated.Text, {
|
|
125
|
-
style: [baseStyles.label, {
|
|
126
|
-
color: hasError ? theme.errorColor : theme.labelColor,
|
|
127
|
-
fontFamily: theme.fontFamily
|
|
128
|
-
}, labelAnimatedStyle, stylesProp?.label],
|
|
129
|
-
children: label
|
|
130
|
-
}), inputElement]
|
|
131
|
-
}), right && /*#__PURE__*/_jsx(View, {
|
|
132
|
-
style: [baseStyles.rightContainer, stylesProp?.right],
|
|
133
|
-
children: right
|
|
134
|
-
})]
|
|
135
|
-
});
|
|
136
|
-
}
|
|
137
|
-
function renderContent() {
|
|
138
|
-
if (onPress) {
|
|
139
|
-
return /*#__PURE__*/_jsx(Pressable, {
|
|
140
|
-
onPress: onPress,
|
|
141
|
-
children: /*#__PURE__*/_jsx(View, {
|
|
142
|
-
pointerEvents: "none",
|
|
143
|
-
children: renderTextInput()
|
|
144
|
-
})
|
|
145
|
-
});
|
|
146
|
-
}
|
|
147
|
-
return renderTextInput();
|
|
148
|
-
}
|
|
59
|
+
const inputProps = {
|
|
60
|
+
ref: inputRef,
|
|
61
|
+
editable,
|
|
62
|
+
autoFocus,
|
|
63
|
+
maxLength,
|
|
64
|
+
value,
|
|
65
|
+
placeholder: shouldBeActive ? placeholder : undefined,
|
|
66
|
+
placeholderTextColor: theme.placeholderColor,
|
|
67
|
+
onChangeText,
|
|
68
|
+
onBlur: handleBlur,
|
|
69
|
+
onFocus: handleFocus,
|
|
70
|
+
keyboardType,
|
|
71
|
+
autoCapitalize,
|
|
72
|
+
secureTextEntry,
|
|
73
|
+
selectionColor: hasError ? theme.errorColor : theme.selectionColor,
|
|
74
|
+
cursorColor: hasError ? theme.errorColor : theme.selectionColor,
|
|
75
|
+
selectionHandleColor: hasError ? theme.errorColor : theme.selectionColor,
|
|
76
|
+
underlineColorAndroid: "transparent",
|
|
77
|
+
style: [baseStyles.input, {
|
|
78
|
+
color: theme.inputColor,
|
|
79
|
+
fontFamily: theme.fontFamily,
|
|
80
|
+
fontSize: theme.fontSize
|
|
81
|
+
}, right ? baseStyles.inputWithRight : undefined, stylesProp?.input],
|
|
82
|
+
...textInputProps
|
|
83
|
+
};
|
|
84
|
+
const inputElement = renderInput ? renderInput(inputProps) : /*#__PURE__*/_jsx(RNTextInput, {
|
|
85
|
+
...inputProps
|
|
86
|
+
});
|
|
87
|
+
const inputContainer = /*#__PURE__*/_jsxs(View, {
|
|
88
|
+
onLayout: onContainerLayout,
|
|
89
|
+
style: [baseStyles.inputContainer, {
|
|
90
|
+
backgroundColor: theme.backgroundColor,
|
|
91
|
+
borderRadius: theme.borderRadius
|
|
92
|
+
}, style, stylesProp?.inputContainer],
|
|
93
|
+
children: [/*#__PURE__*/_jsxs(View, {
|
|
94
|
+
style: [baseStyles.labelAndInputArea, stylesProp?.labelAndInputArea],
|
|
95
|
+
children: [/*#__PURE__*/_jsx(FloatingLabel, {
|
|
96
|
+
label: label,
|
|
97
|
+
hasError: hasError,
|
|
98
|
+
theme: theme,
|
|
99
|
+
labelAnimatedStyle: labelAnimatedStyle,
|
|
100
|
+
style: stylesProp?.label
|
|
101
|
+
}), inputElement]
|
|
102
|
+
}), right && /*#__PURE__*/_jsx(View, {
|
|
103
|
+
style: [baseStyles.rightContainer, stylesProp?.right],
|
|
104
|
+
children: right
|
|
105
|
+
})]
|
|
106
|
+
});
|
|
149
107
|
return /*#__PURE__*/_jsxs(Animated.View, {
|
|
150
108
|
layout: LinearTransition.springify(),
|
|
151
109
|
style: [baseStyles.container, stylesProp?.container],
|
|
152
|
-
children: [
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
}
|
|
158
|
-
|
|
110
|
+
children: [onPress ? /*#__PURE__*/_jsx(Pressable, {
|
|
111
|
+
onPress: onPress,
|
|
112
|
+
children: /*#__PURE__*/_jsx(View, {
|
|
113
|
+
pointerEvents: "none",
|
|
114
|
+
children: inputContainer
|
|
115
|
+
})
|
|
116
|
+
}) : inputContainer, hasError && /*#__PURE__*/_jsx(ErrorText, {
|
|
117
|
+
error: error,
|
|
118
|
+
theme: theme,
|
|
119
|
+
style: stylesProp?.error
|
|
159
120
|
})]
|
|
160
121
|
});
|
|
161
122
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","
|
|
1
|
+
{"version":3,"names":["React","useImperativeHandle","useRef","Pressable","TextInput","RNTextInput","View","Animated","LinearTransition","baseStyles","ErrorText","FloatingLabel","useFloatingLabel","jsx","_jsx","jsxs","_jsxs","FloatingInput","forwardRef","value","onChangeText","onBlur","onFocus","onPress","label","placeholder","error","touched","maxLength","keyboardType","autoFocus","editable","autoCapitalize","secureTextEntry","right","renderInput","theme","themeProp","styles","stylesProp","style","animationConfig","textInputProps","ref","inputRef","hasError","shouldBeActive","labelAnimatedStyle","handleFocus","handleBlur","onContainerLayout","focus","current","blur","clear","isFocused","inputProps","undefined","placeholderTextColor","placeholderColor","selectionColor","errorColor","cursorColor","selectionHandleColor","underlineColorAndroid","input","color","inputColor","fontFamily","fontSize","inputWithRight","inputElement","inputContainer","onLayout","backgroundColor","borderRadius","children","labelAndInputArea","rightContainer","layout","springify","container","pointerEvents","displayName"],"sourceRoot":"../../src","sources":["FloatingInput.tsx"],"mappings":";;AAAA,OAAOA,K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EZA,cACD,EACA3B,QAAQ,iBACP/B,IAAA,CAACJ,SAAS;MAACgB,KAAK,EAAEA,KAAM;MAACU,KAAK,EAAEA,KAAM;MAACI,KAAK,EAAED,UAAU,EAAEb;IAAM,CAAE,CACnE;EAAA,CACY,CAAC;AAEpB,CACF,CAAC;AAEDT,aAAa,CAACkE,WAAW,GAAG,eAAe","ignoreList":[]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import React from "react";
|
|
4
|
+
import Animated from "react-native-reanimated";
|
|
5
|
+
import { baseStyles } from "./defaults";
|
|
6
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
|
+
export const FloatingLabel = /*#__PURE__*/React.memo(function FloatingLabel({
|
|
8
|
+
label,
|
|
9
|
+
hasError,
|
|
10
|
+
theme,
|
|
11
|
+
labelAnimatedStyle,
|
|
12
|
+
style
|
|
13
|
+
}) {
|
|
14
|
+
return /*#__PURE__*/_jsx(Animated.Text, {
|
|
15
|
+
style: [baseStyles.label, {
|
|
16
|
+
color: hasError ? theme.errorColor : theme.labelColor,
|
|
17
|
+
fontFamily: theme.fontFamily
|
|
18
|
+
}, labelAnimatedStyle, style],
|
|
19
|
+
children: label
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
//# sourceMappingURL=FloatingLabel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","Animated","baseStyles","jsx","_jsx","FloatingLabel","memo","label","hasError","theme","labelAnimatedStyle","style","Text","color","errorColor","labelColor","fontFamily","children"],"sourceRoot":"../../src","sources":["FloatingLabel.tsx"],"mappings":";;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,QAAQ,MAA8B,yBAAyB;AAGtE,SAASC,UAAU,QAAQ,YAAY;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAcxC,OAAO,MAAMC,aAAa,gBAAGL,KAAK,CAACM,IAAI,CAAC,SAASD,aAAaA,CAAC;EAC7DE,KAAK;EACLC,QAAQ;EACRC,KAAK;EACLC,kBAAkB;EAClBC;AACkB,CAAC,EAAE;EACrB,oBACEP,IAAA,CAACH,QAAQ,CAACW,IAAI;IACZD,KAAK,EAAE,CACLT,UAAU,CAACK,KAAK,EAChB;MACEM,KAAK,EAAEL,QAAQ,GAAGC,KAAK,CAACK,UAAU,GAAGL,KAAK,CAACM,UAAU;MACrDC,UAAU,EAAEP,KAAK,CAACO;IACpB,CAAC,EACDN,kBAAkB,EAClBC,KAAK,CACL;IAAAM,QAAA,EAEDV;EAAK,CACO,CAAC;AAEpB,CAAC,CAAC","ignoreList":[]}
|
package/lib/module/defaults.js
CHANGED
|
@@ -1,56 +1,61 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import { StyleSheet } from
|
|
3
|
+
import { StyleSheet } from "react-native";
|
|
4
|
+
export const INPUT_PADDING_TOP = 24;
|
|
5
|
+
const INPUT_PADDING_BOTTOM = 8;
|
|
6
|
+
const INPUT_PADDING_HORIZONTAL = 16;
|
|
7
|
+
const RIGHT_CONTAINER_OFFSET = 12;
|
|
8
|
+
const INPUT_WITH_RIGHT_PADDING = 48;
|
|
9
|
+
const ERROR_MARGIN_LEFT = 8;
|
|
10
|
+
const ERROR_MARGIN_TOP = 6;
|
|
4
11
|
export const DEFAULT_THEME = {
|
|
5
|
-
backgroundColor:
|
|
6
|
-
labelColor:
|
|
7
|
-
inputColor:
|
|
8
|
-
errorColor:
|
|
9
|
-
selectionColor:
|
|
10
|
-
placeholderColor:
|
|
12
|
+
backgroundColor: "#EDEFF2",
|
|
13
|
+
labelColor: "#878A99",
|
|
14
|
+
inputColor: "#36373D",
|
|
15
|
+
errorColor: "#E3152E",
|
|
16
|
+
selectionColor: "#31BE30",
|
|
17
|
+
placeholderColor: "#878A99",
|
|
11
18
|
borderRadius: 14,
|
|
12
|
-
minHeight: 56,
|
|
13
19
|
fontSize: 16,
|
|
14
20
|
labelActiveFontSize: 12,
|
|
15
|
-
fontFamily:
|
|
21
|
+
fontFamily: "System"
|
|
16
22
|
};
|
|
17
23
|
export const DEFAULT_ANIMATION = {
|
|
18
24
|
labelDuration: 200,
|
|
19
25
|
shakeMagnitude: 2,
|
|
20
|
-
shakeDuration: 50
|
|
21
|
-
labelTranslateY: 10
|
|
26
|
+
shakeDuration: 50
|
|
22
27
|
};
|
|
23
28
|
export const baseStyles = StyleSheet.create({
|
|
24
29
|
container: {},
|
|
25
30
|
inputContainer: {
|
|
26
|
-
flexDirection:
|
|
27
|
-
alignItems:
|
|
31
|
+
flexDirection: "row",
|
|
32
|
+
alignItems: "center"
|
|
28
33
|
},
|
|
29
34
|
labelAndInputArea: {
|
|
30
35
|
flex: 1,
|
|
31
|
-
justifyContent:
|
|
36
|
+
justifyContent: "center"
|
|
32
37
|
},
|
|
33
38
|
label: {
|
|
34
|
-
position:
|
|
35
|
-
left:
|
|
39
|
+
position: "absolute",
|
|
40
|
+
left: INPUT_PADDING_HORIZONTAL
|
|
36
41
|
},
|
|
37
42
|
input: {
|
|
38
|
-
paddingTop:
|
|
39
|
-
paddingBottom:
|
|
40
|
-
paddingLeft:
|
|
41
|
-
paddingRight:
|
|
43
|
+
paddingTop: INPUT_PADDING_TOP,
|
|
44
|
+
paddingBottom: INPUT_PADDING_BOTTOM,
|
|
45
|
+
paddingLeft: INPUT_PADDING_HORIZONTAL,
|
|
46
|
+
paddingRight: INPUT_PADDING_HORIZONTAL
|
|
42
47
|
},
|
|
43
48
|
inputWithRight: {
|
|
44
|
-
paddingRight:
|
|
49
|
+
paddingRight: INPUT_WITH_RIGHT_PADDING
|
|
45
50
|
},
|
|
46
51
|
rightContainer: {
|
|
47
|
-
position:
|
|
48
|
-
right:
|
|
49
|
-
alignSelf:
|
|
52
|
+
position: "absolute",
|
|
53
|
+
right: RIGHT_CONTAINER_OFFSET,
|
|
54
|
+
alignSelf: "center"
|
|
50
55
|
},
|
|
51
56
|
errorText: {
|
|
52
|
-
marginLeft:
|
|
53
|
-
marginTop:
|
|
57
|
+
marginLeft: ERROR_MARGIN_LEFT,
|
|
58
|
+
marginTop: ERROR_MARGIN_TOP
|
|
54
59
|
}
|
|
55
60
|
});
|
|
56
61
|
//# sourceMappingURL=defaults.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["StyleSheet","DEFAULT_THEME","backgroundColor","labelColor","inputColor","errorColor","selectionColor","placeholderColor","borderRadius","
|
|
1
|
+
{"version":3,"names":["StyleSheet","INPUT_PADDING_TOP","INPUT_PADDING_BOTTOM","INPUT_PADDING_HORIZONTAL","RIGHT_CONTAINER_OFFSET","INPUT_WITH_RIGHT_PADDING","ERROR_MARGIN_LEFT","ERROR_MARGIN_TOP","DEFAULT_THEME","backgroundColor","labelColor","inputColor","errorColor","selectionColor","placeholderColor","borderRadius","fontSize","labelActiveFontSize","fontFamily","DEFAULT_ANIMATION","labelDuration","shakeMagnitude","shakeDuration","baseStyles","create","container","inputContainer","flexDirection","alignItems","labelAndInputArea","flex","justifyContent","label","position","left","input","paddingTop","paddingBottom","paddingLeft","paddingRight","inputWithRight","rightContainer","right","alignSelf","errorText","marginLeft","marginTop"],"sourceRoot":"../../src","sources":["defaults.ts"],"mappings":";;AAAA,SAASA,UAAU,QAAQ,cAAc;AAGzC,OAAO,MAAMC,iBAAiB,GAAG,EAAE;AACnC,MAAMC,oBAAoB,GAAG,CAAC;AAC9B,MAAMC,wBAAwB,GAAG,EAAE;AACnC,MAAMC,sBAAsB,GAAG,EAAE;AACjC,MAAMC,wBAAwB,GAAG,EAAE;AACnC,MAAMC,iBAAiB,GAAG,CAAC;AAC3B,MAAMC,gBAAgB,GAAG,CAAC;AAE1B,OAAO,MAAMC,aAA2C,GAAG;EACzDC,eAAe,EAAE,SAAS;EAC1BC,UAAU,EAAE,SAAS;EACrBC,UAAU,EAAE,SAAS;EACrBC,UAAU,EAAE,SAAS;EACrBC,cAAc,EAAE,SAAS;EACzBC,gBAAgB,EAAE,SAAS;EAC3BC,YAAY,EAAE,EAAE;EAChBC,QAAQ,EAAE,EAAE;EACZC,mBAAmB,EAAE,EAAE;EACvBC,UAAU,EAAE;AACd,CAAC;AAED,OAAO,MAAMC,iBAAyD,GAAG;EACvEC,aAAa,EAAE,GAAG;EAClBC,cAAc,EAAE,CAAC;EACjBC,aAAa,EAAE;AACjB,CAAC;AAED,OAAO,MAAMC,UAAU,GAAGvB,UAAU,CAACwB,MAAM,CAAC;EAC1CC,SAAS,EAAE,CAAC,CAAC;EACbC,cAAc,EAAE;IACdC,aAAa,EAAE,KAAK;IACpBC,UAAU,EAAE;EACd,CAAC;EACDC,iBAAiB,EAAE;IACjBC,IAAI,EAAE,CAAC;IACPC,cAAc,EAAE;EAClB,CAAC;EACDC,KAAK,EAAE;IACLC,QAAQ,EAAE,UAAU;IACpBC,IAAI,EAAE/B;EACR,CAAC;EACDgC,KAAK,EAAE;IACLC,UAAU,EAAEnC,iBAAiB;IAC7BoC,aAAa,EAAEnC,oBAAoB;IACnCoC,WAAW,EAAEnC,wBAAwB;IACrCoC,YAAY,EAAEpC;EAChB,CAAC;EACDqC,cAAc,EAAE;IACdD,YAAY,EAAElC;EAChB,CAAC;EACDoC,cAAc,EAAE;IACdR,QAAQ,EAAE,UAAU;IACpBS,KAAK,EAAEtC,sBAAsB;IAC7BuC,SAAS,EAAE;EACb,CAAC;EACDC,SAAS,EAAE;IACTC,UAAU,EAAEvC,iBAAiB;IAC7BwC,SAAS,EAAEvC;EACb;AACF,CAAC,CAAC","ignoreList":[]}
|
package/lib/module/index.js
CHANGED
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["FloatingInput"
|
|
1
|
+
{"version":3,"names":["FloatingInput"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,SAASA,aAAa,QAAQ,iBAAiB","ignoreList":[]}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { useEffect, useState } from "react";
|
|
4
|
+
import { interpolate, useAnimatedStyle, useSharedValue, withSequence, withTiming } from "react-native-reanimated";
|
|
5
|
+
import { DEFAULT_ANIMATION, DEFAULT_THEME, INPUT_PADDING_TOP } from "./defaults";
|
|
6
|
+
export function useFloatingLabel({
|
|
7
|
+
value,
|
|
8
|
+
onFocus,
|
|
9
|
+
onBlur,
|
|
10
|
+
touched,
|
|
11
|
+
error,
|
|
12
|
+
theme: themeProp,
|
|
13
|
+
animationConfig: animationProp
|
|
14
|
+
}) {
|
|
15
|
+
const [isFocused, setIsFocused] = useState(false);
|
|
16
|
+
const hasError = !!touched && !!error;
|
|
17
|
+
const theme = {
|
|
18
|
+
...DEFAULT_THEME,
|
|
19
|
+
...themeProp
|
|
20
|
+
};
|
|
21
|
+
const anim = {
|
|
22
|
+
...DEFAULT_ANIMATION,
|
|
23
|
+
...animationProp
|
|
24
|
+
};
|
|
25
|
+
const shouldBeActive = isFocused || !!value;
|
|
26
|
+
const focusAnim = useSharedValue(value ? 1 : 0);
|
|
27
|
+
const shakeAnim = useSharedValue(0);
|
|
28
|
+
const containerHeight = useSharedValue(0);
|
|
29
|
+
useEffect(() => {
|
|
30
|
+
focusAnim.value = withTiming(shouldBeActive ? 1 : 0, {
|
|
31
|
+
duration: anim.labelDuration
|
|
32
|
+
});
|
|
33
|
+
}, [shouldBeActive]);
|
|
34
|
+
useEffect(() => {
|
|
35
|
+
if (!hasError) return;
|
|
36
|
+
const mag = anim.shakeMagnitude;
|
|
37
|
+
const dur = anim.shakeDuration;
|
|
38
|
+
shakeAnim.value = withSequence(withTiming(-mag, {
|
|
39
|
+
duration: dur
|
|
40
|
+
}), withTiming(mag, {
|
|
41
|
+
duration: dur
|
|
42
|
+
}), withTiming(-mag, {
|
|
43
|
+
duration: dur
|
|
44
|
+
}), withTiming(0, {
|
|
45
|
+
duration: dur
|
|
46
|
+
}));
|
|
47
|
+
}, [hasError]);
|
|
48
|
+
const labelAnimatedStyle = useAnimatedStyle(() => {
|
|
49
|
+
const h = containerHeight.value;
|
|
50
|
+
const translateY = h > 0 ? interpolate(focusAnim.value, [0, 1], [0, -(h / 2 - INPUT_PADDING_TOP / 1.75)]) : 0;
|
|
51
|
+
return {
|
|
52
|
+
transform: [{
|
|
53
|
+
translateX: shakeAnim.value
|
|
54
|
+
}, {
|
|
55
|
+
translateY
|
|
56
|
+
}],
|
|
57
|
+
fontSize: interpolate(focusAnim.value, [0, 1], [theme.fontSize, theme.labelActiveFontSize])
|
|
58
|
+
};
|
|
59
|
+
});
|
|
60
|
+
function handleFocus() {
|
|
61
|
+
setIsFocused(true);
|
|
62
|
+
onFocus?.();
|
|
63
|
+
}
|
|
64
|
+
function handleBlur() {
|
|
65
|
+
setIsFocused(false);
|
|
66
|
+
onBlur?.();
|
|
67
|
+
}
|
|
68
|
+
function onContainerLayout(e) {
|
|
69
|
+
containerHeight.value = e.nativeEvent.layout.height;
|
|
70
|
+
}
|
|
71
|
+
return {
|
|
72
|
+
isFocused,
|
|
73
|
+
hasError,
|
|
74
|
+
shouldBeActive,
|
|
75
|
+
theme,
|
|
76
|
+
labelAnimatedStyle,
|
|
77
|
+
handleFocus,
|
|
78
|
+
handleBlur,
|
|
79
|
+
onContainerLayout
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=useFloatingLabel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useEffect","useState","interpolate","useAnimatedStyle","useSharedValue","withSequence","withTiming","DEFAULT_ANIMATION","DEFAULT_THEME","INPUT_PADDING_TOP","useFloatingLabel","value","onFocus","onBlur","touched","error","theme","themeProp","animationConfig","animationProp","isFocused","setIsFocused","hasError","anim","shouldBeActive","focusAnim","shakeAnim","containerHeight","duration","labelDuration","mag","shakeMagnitude","dur","shakeDuration","labelAnimatedStyle","h","translateY","transform","translateX","fontSize","labelActiveFontSize","handleFocus","handleBlur","onContainerLayout","e","nativeEvent","layout","height"],"sourceRoot":"../../src","sources":["useFloating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;EAEA,SAAS8B,iBAAiBA,CAACC,CAAoB,EAAE;IAC/CjB,eAAe,CAAChB,KAAK,GAAGiC,CAAC,CAACC,WAAW,CAACC,MAAM,CAACC,MAAM;EACrD;EAEA,OAAO;IACL3B,SAAS;IACTE,QAAQ;IACRE,cAAc;IACdR,KAAK;IACLkB,kBAAkB;IAClBO,WAAW;IACXC,UAAU;IACVC;EACF,CAAC;AACH","ignoreList":[]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { StyleProp, TextStyle } from "react-native";
|
|
3
|
+
interface ErrorTextProps {
|
|
4
|
+
error?: string;
|
|
5
|
+
theme: {
|
|
6
|
+
labelActiveFontSize: number;
|
|
7
|
+
errorColor: string;
|
|
8
|
+
fontFamily: string;
|
|
9
|
+
};
|
|
10
|
+
style?: StyleProp<TextStyle>;
|
|
11
|
+
}
|
|
12
|
+
export declare const ErrorText: React.NamedExoticComponent<ErrorTextProps>;
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=ErrorText.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ErrorText.d.ts","sourceRoot":"","sources":["../../src/ErrorText.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAIzD,UAAU,cAAc;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,EAAE;QACL,mBAAmB,EAAE,MAAM,CAAC;QAC5B,UAAU,EAAE,MAAM,CAAC;QACnB,UAAU,EAAE,MAAM,CAAC;KACpB,CAAC;IACF,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAC9B;AAED,eAAO,MAAM,SAAS,4CAoBpB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FloatingInput.d.ts","sourceRoot":"","sources":["../../src/FloatingInput.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"FloatingInput.d.ts","sourceRoot":"","sources":["../../src/FloatingInput.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAQ3D,OAAO,KAAK,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEpE,eAAO,MAAM,aAAa,6FAkJzB,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { type AnimatedStyle } from "react-native-reanimated";
|
|
3
|
+
import type { StyleProp, TextStyle } from "react-native";
|
|
4
|
+
interface FloatingLabelProps {
|
|
5
|
+
label?: string;
|
|
6
|
+
hasError: boolean;
|
|
7
|
+
theme: {
|
|
8
|
+
errorColor: string;
|
|
9
|
+
labelColor: string;
|
|
10
|
+
fontFamily: string;
|
|
11
|
+
};
|
|
12
|
+
labelAnimatedStyle: AnimatedStyle;
|
|
13
|
+
style?: StyleProp<TextStyle>;
|
|
14
|
+
}
|
|
15
|
+
export declare const FloatingLabel: React.NamedExoticComponent<FloatingLabelProps>;
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=FloatingLabel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FloatingLabel.d.ts","sourceRoot":"","sources":["../../src/FloatingLabel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAiB,EAAE,KAAK,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACvE,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAIzD,UAAU,kBAAkB;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,OAAO,CAAC;IAClB,KAAK,EAAE;QACL,UAAU,EAAE,MAAM,CAAC;QACnB,UAAU,EAAE,MAAM,CAAC;QACnB,UAAU,EAAE,MAAM,CAAC;KACpB,CAAC;IACF,kBAAkB,EAAE,aAAa,CAAC;IAClC,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAC9B;AAED,eAAO,MAAM,aAAa,gDAsBxB,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { FloatingInputAnimationConfig, FloatingInputTheme } from
|
|
1
|
+
import type { FloatingInputAnimationConfig, FloatingInputTheme } from "./types";
|
|
2
|
+
export declare const INPUT_PADDING_TOP = 24;
|
|
2
3
|
export declare const DEFAULT_THEME: Required<FloatingInputTheme>;
|
|
3
4
|
export declare const DEFAULT_ANIMATION: Required<FloatingInputAnimationConfig>;
|
|
4
5
|
export declare const baseStyles: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defaults.d.ts","sourceRoot":"","sources":["../../src/defaults.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"defaults.d.ts","sourceRoot":"","sources":["../../src/defaults.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,4BAA4B,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAEhF,eAAO,MAAM,iBAAiB,KAAK,CAAC;AAQpC,eAAO,MAAM,aAAa,EAAE,QAAQ,CAAC,kBAAkB,CAWtD,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,QAAQ,CAAC,4BAA4B,CAIpE,CAAC;AAEF,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgCrB,CAAC"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
export { FloatingInput } from
|
|
2
|
-
export {
|
|
3
|
-
export type { FloatingInputAnimationConfig, FloatingInputProps, FloatingInputRef, FloatingInputStyles, FloatingInputTheme, } from './types';
|
|
1
|
+
export { FloatingInput } from "./FloatingInput";
|
|
2
|
+
export type { FloatingInputAnimationConfig, FloatingInputProps, FloatingInputRef, FloatingInputStyles, FloatingInputTheme, } from "./types";
|
|
4
3
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,YAAY,EACV,4BAA4B,EAC5B,kBAAkB,EAClB,gBAAgB,EAChB,mBAAmB,EACnB,kBAAkB,GACnB,MAAM,SAAS,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { KeyboardTypeOptions, StyleProp, TextInputProps, TextStyle, ViewStyle } from
|
|
1
|
+
import type { KeyboardTypeOptions, StyleProp, TextInputProps, TextStyle, ViewStyle } from "react-native";
|
|
2
2
|
export interface FloatingInputTheme {
|
|
3
3
|
backgroundColor?: string;
|
|
4
4
|
labelColor?: string;
|
|
@@ -7,7 +7,6 @@ export interface FloatingInputTheme {
|
|
|
7
7
|
selectionColor?: string;
|
|
8
8
|
placeholderColor?: string;
|
|
9
9
|
borderRadius?: number;
|
|
10
|
-
minHeight?: number;
|
|
11
10
|
fontSize?: number;
|
|
12
11
|
labelActiveFontSize?: number;
|
|
13
12
|
fontFamily?: string;
|
|
@@ -25,7 +24,6 @@ export interface FloatingInputAnimationConfig {
|
|
|
25
24
|
labelDuration?: number;
|
|
26
25
|
shakeMagnitude?: number;
|
|
27
26
|
shakeDuration?: number;
|
|
28
|
-
labelTranslateY?: number;
|
|
29
27
|
}
|
|
30
28
|
export interface FloatingInputRef {
|
|
31
29
|
focus: () => void;
|
|
@@ -47,7 +45,7 @@ export interface FloatingInputProps {
|
|
|
47
45
|
keyboardType?: KeyboardTypeOptions;
|
|
48
46
|
autoFocus?: boolean;
|
|
49
47
|
editable?: boolean;
|
|
50
|
-
autoCapitalize?:
|
|
48
|
+
autoCapitalize?: "none" | "sentences" | "words" | "characters";
|
|
51
49
|
secureTextEntry?: boolean;
|
|
52
50
|
right?: React.ReactNode;
|
|
53
51
|
renderInput?: (props: TextInputProps) => React.ReactNode;
|
|
@@ -55,6 +53,6 @@ export interface FloatingInputProps {
|
|
|
55
53
|
styles?: FloatingInputStyles;
|
|
56
54
|
style?: StyleProp<ViewStyle>;
|
|
57
55
|
animationConfig?: FloatingInputAnimationConfig;
|
|
58
|
-
textInputProps?: Omit<TextInputProps,
|
|
56
|
+
textInputProps?: Omit<TextInputProps, "value" | "onChangeText" | "onBlur" | "onFocus" | "multiline">;
|
|
59
57
|
}
|
|
60
58
|
//# sourceMappingURL=types.d.ts.map
|