atlas-design-system 1.14.0 → 1.15.0
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.
|
@@ -10,6 +10,8 @@ export type TextInputProps = {
|
|
|
10
10
|
label: string;
|
|
11
11
|
containerStyle?: StyleProp<ViewStyle>;
|
|
12
12
|
error?: string;
|
|
13
|
+
multiline?: boolean;
|
|
14
|
+
numberOfLines?: number;
|
|
13
15
|
} & Omit<RNTextInputProps, "onBlur">;
|
|
14
16
|
export declare const TextInput: React.ForwardRefExoticComponent<{
|
|
15
17
|
disabled?: boolean;
|
|
@@ -21,5 +23,7 @@ export declare const TextInput: React.ForwardRefExoticComponent<{
|
|
|
21
23
|
label: string;
|
|
22
24
|
containerStyle?: StyleProp<ViewStyle>;
|
|
23
25
|
error?: string;
|
|
26
|
+
multiline?: boolean;
|
|
27
|
+
numberOfLines?: number;
|
|
24
28
|
} & Omit<RNTextInputProps, "onBlur"> & React.RefAttributes<unknown>>;
|
|
25
29
|
export default TextInput;
|
|
@@ -66,8 +66,8 @@ const getTextInputStyle = (disabled, error, style) => {
|
|
|
66
66
|
return style.default;
|
|
67
67
|
};
|
|
68
68
|
exports.TextInput = (0, react_1.forwardRef)((_a, ref) => {
|
|
69
|
-
var { caption, keyboardType, onChangeText, testId, value, label, onBlur, containerStyle, disabled = false, error } = _a, rest = __rest(_a, ["caption", "keyboardType", "onChangeText", "testId", "value", "label", "onBlur", "containerStyle", "disabled", "error"]);
|
|
70
|
-
const { styles, theme } = useStyles(disabled, !!error);
|
|
69
|
+
var { caption, keyboardType, onChangeText, testId, value, label, onBlur, containerStyle, disabled = false, error, multiline, numberOfLines } = _a, rest = __rest(_a, ["caption", "keyboardType", "onChangeText", "testId", "value", "label", "onBlur", "containerStyle", "disabled", "error", "multiline", "numberOfLines"]);
|
|
70
|
+
const { styles, theme } = useStyles(disabled, !!error, !!multiline);
|
|
71
71
|
const inputRef = (0, react_1.useRef)(null);
|
|
72
72
|
(0, react_1.useImperativeHandle)(ref, () => ({
|
|
73
73
|
focus: () => {
|
|
@@ -152,7 +152,7 @@ exports.TextInput = (0, react_1.forwardRef)((_a, ref) => {
|
|
|
152
152
|
</react_native_reanimated_1.default.Text>
|
|
153
153
|
</react_native_1.View>
|
|
154
154
|
<react_native_reanimated_1.default.View style={animatedInputStyles}>
|
|
155
|
-
{disabled ? (<Text_1.default style={styles.text}>{value}</Text_1.default>) : (<react_native_1.TextInput ref={inputRef} testID={testId} value={value} style={styles.textInput} numberOfLines={
|
|
155
|
+
{disabled ? (<Text_1.default style={styles.text}>{value}</Text_1.default>) : (<react_native_1.TextInput ref={inputRef} testID={testId} value={value} style={styles.textInput} numberOfLines={numberOfLines} multiline={multiline} keyboardType={keyboardType} onChangeText={handleOnChangeText} maxLength={40} returnKeyType="done" onBlur={handleOnBlur} onFocus={onFocus} keyboardAppearance={theme.keyboardAppearance} {...rest}/>)}
|
|
156
156
|
</react_native_reanimated_1.default.View>
|
|
157
157
|
</react_native_reanimated_1.default.View>
|
|
158
158
|
</react_native_1.Pressable>
|
|
@@ -162,7 +162,7 @@ exports.TextInput = (0, react_1.forwardRef)((_a, ref) => {
|
|
|
162
162
|
});
|
|
163
163
|
exports.default = exports.TextInput;
|
|
164
164
|
exports.TextInput.displayName = "TextInput";
|
|
165
|
-
const useStyles = (disabled, error) => (0, hooks_1.useThemedStyle)((0, react_1.useCallback)((theme) => react_native_1.StyleSheet.create({
|
|
165
|
+
const useStyles = (disabled, error, multiline) => (0, hooks_1.useThemedStyle)((0, react_1.useCallback)((theme) => react_native_1.StyleSheet.create({
|
|
166
166
|
container: {
|
|
167
167
|
width: "100%",
|
|
168
168
|
flexShrink: 0.5,
|
|
@@ -171,7 +171,7 @@ const useStyles = (disabled, error) => (0, hooks_1.useThemedStyle)((0, react_1.u
|
|
|
171
171
|
flexGrow: 2,
|
|
172
172
|
flexShrink: 1,
|
|
173
173
|
},
|
|
174
|
-
textInput: Object.assign(Object.assign({ paddingHorizontal: theme.size.baseSize * 2 }, theme.typography.p1), getTextInputStyle(disabled, error, {
|
|
174
|
+
textInput: Object.assign(Object.assign({ paddingHorizontal: theme.size.baseSize * 2, height: multiline ? "95%" : "auto" }, theme.typography.p1), getTextInputStyle(disabled, error, {
|
|
175
175
|
disabled: {
|
|
176
176
|
color: theme.colors.foregroundLowContrast,
|
|
177
177
|
},
|
|
@@ -196,7 +196,9 @@ const useStyles = (disabled, error) => (0, hooks_1.useThemedStyle)((0, react_1.u
|
|
|
196
196
|
itemContainer: {
|
|
197
197
|
borderWidth: theme.borderWidth,
|
|
198
198
|
backgroundColor: theme.colors.backgroundOnPrimary,
|
|
199
|
-
height:
|
|
199
|
+
height: multiline
|
|
200
|
+
? theme.size.baseSize * 24
|
|
201
|
+
: theme.size.baseSize * 9,
|
|
200
202
|
borderRadius: theme.borderRadius,
|
|
201
203
|
minHeight: theme.size.baseSize * 8,
|
|
202
204
|
flexDirection: "row",
|
|
@@ -211,6 +213,7 @@ const useStyles = (disabled, error) => (0, hooks_1.useThemedStyle)((0, react_1.u
|
|
|
211
213
|
},
|
|
212
214
|
labelContainer: {
|
|
213
215
|
left: theme.size.baseSize * 2,
|
|
216
|
+
top: multiline ? theme.size.baseSize * 1 : theme.size.baseSize * 2,
|
|
214
217
|
position: "absolute",
|
|
215
218
|
},
|
|
216
219
|
label: getLabelStyle(disabled, error, {
|
|
@@ -222,4 +225,4 @@ const useStyles = (disabled, error) => (0, hooks_1.useThemedStyle)((0, react_1.u
|
|
|
222
225
|
marginHorizontal: theme.size.baseSize * 4,
|
|
223
226
|
marginBottom: theme.size.baseSize * 2,
|
|
224
227
|
},
|
|
225
|
-
}), [disabled, error]));
|
|
228
|
+
}), [disabled, error, multiline]));
|