@ds-autonomie/react-native 0.1.0 → 0.2.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.
- package/CHANGELOG.md +10 -0
- package/dist/chunks/chunk.2HOUMFYI.js +94 -0
- package/dist/chunks/{chunk.NNC6C337.js → chunk.B2JV2E47.js} +3 -3
- package/dist/chunks/chunk.H2AL2E3A.js +47 -0
- package/dist/chunks/chunk.MCKLJGG3.js +70 -0
- package/dist/chunks/{chunk.4EJ4MEUR.js → chunk.OQSCGAEY.js} +4 -2
- package/dist/chunks/chunk.QOZS5EA3.js +111 -0
- package/dist/chunks/chunk.RNOZ5AW4.js +71 -0
- package/dist/chunks/chunk.YWEWQ2LT.js +39 -0
- package/dist/components/button/Button.d.ts +65 -0
- package/dist/components/button/Button.js +68 -0
- package/dist/components/button/Button.styles.d.ts +38 -0
- package/dist/components/button/Button.styles.js +14 -0
- package/dist/components/checkbox/Checkbox.d.ts +55 -0
- package/dist/components/checkbox/Checkbox.js +71 -0
- package/dist/components/checkbox/Checkbox.styles.d.ts +38 -0
- package/dist/components/checkbox/Checkbox.styles.js +8 -0
- package/dist/components/icon/Icon.d.ts +10 -4
- package/dist/components/icon/Icon.js +1 -1
- package/dist/components/radio/Radio.d.ts +55 -0
- package/dist/components/radio/Radio.js +59 -0
- package/dist/components/radio/Radio.styles.d.ts +30 -0
- package/dist/components/radio/Radio.styles.js +8 -0
- package/dist/components/search/SearchField.d.ts +14 -0
- package/dist/components/search/SearchField.js +72 -0
- package/dist/components/search/SearchField.styles.d.ts +42 -0
- package/dist/components/search/SearchField.styles.js +10 -0
- package/dist/components/text-input/TextInput.d.ts +54 -0
- package/dist/components/text-input/TextInput.js +8 -0
- package/dist/components/text-input/TextInput.styles.d.ts +86 -0
- package/dist/components/text-input/TextInput.styles.js +10 -0
- package/dist/components/toggle/Toggle.js +2 -2
- package/dist/index.d.ts +2 -1
- package/dist/index.js +7 -2
- package/dist/styles/fonts.d.ts +17 -0
- package/dist/utils/device.d.ts +2 -0
- package/package.json +1 -1
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { View } from 'react-native';
|
|
3
|
+
import { PressableProps, StyleProp, ViewStyle } from 'react-native/types';
|
|
4
|
+
type OmittedPressableProps = 'accessibilityLabel' | 'accessibilityRole' | 'accessibilityState' | 'accessible' | 'aria-checked' | 'aria-invalid' | 'aria-disabled' | 'aria-pressed' | 'style' | 'onPress' | 'children' | 'role';
|
|
5
|
+
export type CheckboxProps = {
|
|
6
|
+
/**
|
|
7
|
+
* When set to `true`, component is checked.
|
|
8
|
+
*/
|
|
9
|
+
value?: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* When set to `true`, component is in error.
|
|
12
|
+
*/
|
|
13
|
+
error?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* When set to `true`, component is disabled.
|
|
16
|
+
*/
|
|
17
|
+
disabled?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Callback when component is checked.
|
|
20
|
+
*
|
|
21
|
+
* @param {boolean} value
|
|
22
|
+
*/
|
|
23
|
+
onValueChange?: (value: boolean) => void;
|
|
24
|
+
/**
|
|
25
|
+
* If `style` is defined, it will extend the container style.
|
|
26
|
+
* If a similar property is defined, the new property will be ignored.
|
|
27
|
+
* * */
|
|
28
|
+
style?: StyleProp<ViewStyle>;
|
|
29
|
+
} & Omit<PressableProps, OmittedPressableProps>;
|
|
30
|
+
export declare const Checkbox: React.ForwardRefExoticComponent<{
|
|
31
|
+
/**
|
|
32
|
+
* When set to `true`, component is checked.
|
|
33
|
+
*/
|
|
34
|
+
value?: boolean | undefined;
|
|
35
|
+
/**
|
|
36
|
+
* When set to `true`, component is in error.
|
|
37
|
+
*/
|
|
38
|
+
error?: boolean | undefined;
|
|
39
|
+
/**
|
|
40
|
+
* When set to `true`, component is disabled.
|
|
41
|
+
*/
|
|
42
|
+
disabled?: boolean | undefined;
|
|
43
|
+
/**
|
|
44
|
+
* Callback when component is checked.
|
|
45
|
+
*
|
|
46
|
+
* @param {boolean} value
|
|
47
|
+
*/
|
|
48
|
+
onValueChange?: ((value: boolean) => void) | undefined;
|
|
49
|
+
/**
|
|
50
|
+
* If `style` is defined, it will extend the container style.
|
|
51
|
+
* If a similar property is defined, the new property will be ignored.
|
|
52
|
+
* * */
|
|
53
|
+
style?: StyleProp<ViewStyle>;
|
|
54
|
+
} & Omit<PressableProps, OmittedPressableProps> & React.RefAttributes<View>>;
|
|
55
|
+
export {};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import {
|
|
2
|
+
checkboxCheckStyles,
|
|
3
|
+
checkboxContainerStyles
|
|
4
|
+
} from "../../chunks/chunk.H2AL2E3A.js";
|
|
5
|
+
import {
|
|
6
|
+
Icon
|
|
7
|
+
} from "../../chunks/chunk.OQSCGAEY.js";
|
|
8
|
+
|
|
9
|
+
// src/components/checkbox/Checkbox.tsx
|
|
10
|
+
import theme from "@ds-autonomie/assets/js/dsa-theme";
|
|
11
|
+
import React, { useEffect, useState } from "react";
|
|
12
|
+
import { Pressable, View } from "react-native";
|
|
13
|
+
var Checkbox = React.forwardRef(function Checkbox2({
|
|
14
|
+
value = false,
|
|
15
|
+
disabled = false,
|
|
16
|
+
error = false,
|
|
17
|
+
onValueChange,
|
|
18
|
+
style: styleProps,
|
|
19
|
+
...restProps
|
|
20
|
+
}, ref) {
|
|
21
|
+
const [checked, setChecked] = useState(value);
|
|
22
|
+
useEffect(
|
|
23
|
+
function onValueUpdate() {
|
|
24
|
+
setChecked(value);
|
|
25
|
+
},
|
|
26
|
+
[value]
|
|
27
|
+
);
|
|
28
|
+
function handlePress() {
|
|
29
|
+
if (disabled) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
onValueChange?.(!checked);
|
|
33
|
+
setChecked(!checked);
|
|
34
|
+
}
|
|
35
|
+
return <Pressable
|
|
36
|
+
ref={ref}
|
|
37
|
+
{...restProps}
|
|
38
|
+
accessibilityLabel="checkbox"
|
|
39
|
+
accessibilityRole="checkbox"
|
|
40
|
+
accessibilityState={{ checked, disabled }}
|
|
41
|
+
accessible
|
|
42
|
+
aria-checked={checked}
|
|
43
|
+
aria-disabled={disabled}
|
|
44
|
+
aria-invalid={error}
|
|
45
|
+
aria-pressed={checked}
|
|
46
|
+
onPress={handlePress}
|
|
47
|
+
role="checkbox"
|
|
48
|
+
hitSlop={15}
|
|
49
|
+
style={[
|
|
50
|
+
styleProps,
|
|
51
|
+
checkboxContainerStyles.default,
|
|
52
|
+
checked && checkboxContainerStyles.active,
|
|
53
|
+
error && checkboxContainerStyles.error,
|
|
54
|
+
disabled && checkboxContainerStyles.disabled
|
|
55
|
+
]}
|
|
56
|
+
>{checked && <View
|
|
57
|
+
style={[
|
|
58
|
+
checkboxCheckStyles.default,
|
|
59
|
+
checked && checkboxCheckStyles.active,
|
|
60
|
+
error && checkboxCheckStyles.error,
|
|
61
|
+
disabled && checkboxCheckStyles.disabled
|
|
62
|
+
]}
|
|
63
|
+
><Icon
|
|
64
|
+
name="check"
|
|
65
|
+
color={theme.primitives.color.neutral[100]}
|
|
66
|
+
size={18}
|
|
67
|
+
/></View>}</Pressable>;
|
|
68
|
+
});
|
|
69
|
+
export {
|
|
70
|
+
Checkbox
|
|
71
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export declare const checkboxContainerStyles: {
|
|
2
|
+
default: {
|
|
3
|
+
width: number;
|
|
4
|
+
height: number;
|
|
5
|
+
borderWidth: number;
|
|
6
|
+
borderRadius: number;
|
|
7
|
+
alignItems: "center";
|
|
8
|
+
justifyContent: "center";
|
|
9
|
+
borderColor: "#666666ff";
|
|
10
|
+
};
|
|
11
|
+
error: {
|
|
12
|
+
borderColor: "#dd1708ff";
|
|
13
|
+
};
|
|
14
|
+
disabled: {
|
|
15
|
+
borderColor: "#d7d7d7ff";
|
|
16
|
+
};
|
|
17
|
+
active: {
|
|
18
|
+
borderColor: "#540abdff";
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
export declare const checkboxCheckStyles: {
|
|
22
|
+
default: {
|
|
23
|
+
width: number;
|
|
24
|
+
height: number;
|
|
25
|
+
borderRadius: number;
|
|
26
|
+
alignItems: "center";
|
|
27
|
+
justifyContent: "center";
|
|
28
|
+
};
|
|
29
|
+
disabled: {
|
|
30
|
+
backgroundColor: "#d7d7d7ff";
|
|
31
|
+
};
|
|
32
|
+
error: {
|
|
33
|
+
backgroundColor: "#dd1708ff";
|
|
34
|
+
};
|
|
35
|
+
active: {
|
|
36
|
+
backgroundColor: "#540abdff";
|
|
37
|
+
};
|
|
38
|
+
};
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
|
|
2
|
+
import { IconProps as MaterialIconProps } from 'react-native-vector-icons/Icon';
|
|
3
|
+
import MaterialIcons from 'react-native-vector-icons/MaterialIcons';
|
|
4
|
+
export type IconProps = {
|
|
3
5
|
name: string;
|
|
4
6
|
size?: number;
|
|
5
|
-
color
|
|
6
|
-
}
|
|
7
|
-
export declare
|
|
7
|
+
color?: string;
|
|
8
|
+
} & MaterialIconProps;
|
|
9
|
+
export declare const Icon: React.ForwardRefExoticComponent<{
|
|
10
|
+
name: string;
|
|
11
|
+
size?: number | undefined;
|
|
12
|
+
color?: string | undefined;
|
|
13
|
+
} & MaterialIconProps & React.RefAttributes<MaterialIcons>>;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { View } from 'react-native';
|
|
3
|
+
import { PressableProps, StyleProp, ViewStyle } from 'react-native/types';
|
|
4
|
+
type OmittedPressableProps = 'accessibilityLabel' | 'accessibilityRole' | 'accessibilityState' | 'accessible' | 'aria-checked' | 'aria-invalid' | 'aria-disabled' | 'aria-pressed' | 'style' | 'onPress' | 'children' | 'role';
|
|
5
|
+
export type RadioProps = {
|
|
6
|
+
/**
|
|
7
|
+
* When set to `true`, component is checked.
|
|
8
|
+
*/
|
|
9
|
+
value?: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* When set to `true`, component is in error.
|
|
12
|
+
*/
|
|
13
|
+
error?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* When set to `true`, component is disabled.
|
|
16
|
+
*/
|
|
17
|
+
disabled?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Callback when component is checked.
|
|
20
|
+
*
|
|
21
|
+
* @param {boolean} value
|
|
22
|
+
*/
|
|
23
|
+
onValueChange?: (value: boolean) => void;
|
|
24
|
+
/**
|
|
25
|
+
* If `style` is defined, it will extend the container style.
|
|
26
|
+
* If a similar property is defined, the new property will overwrite the old one.
|
|
27
|
+
* */
|
|
28
|
+
style?: StyleProp<ViewStyle>;
|
|
29
|
+
} & Omit<PressableProps, OmittedPressableProps>;
|
|
30
|
+
export declare const Radio: React.ForwardRefExoticComponent<{
|
|
31
|
+
/**
|
|
32
|
+
* When set to `true`, component is checked.
|
|
33
|
+
*/
|
|
34
|
+
value?: boolean | undefined;
|
|
35
|
+
/**
|
|
36
|
+
* When set to `true`, component is in error.
|
|
37
|
+
*/
|
|
38
|
+
error?: boolean | undefined;
|
|
39
|
+
/**
|
|
40
|
+
* When set to `true`, component is disabled.
|
|
41
|
+
*/
|
|
42
|
+
disabled?: boolean | undefined;
|
|
43
|
+
/**
|
|
44
|
+
* Callback when component is checked.
|
|
45
|
+
*
|
|
46
|
+
* @param {boolean} value
|
|
47
|
+
*/
|
|
48
|
+
onValueChange?: ((value: boolean) => void) | undefined;
|
|
49
|
+
/**
|
|
50
|
+
* If `style` is defined, it will extend the container style.
|
|
51
|
+
* If a similar property is defined, the new property will overwrite the old one.
|
|
52
|
+
* */
|
|
53
|
+
style?: StyleProp<ViewStyle>;
|
|
54
|
+
} & Omit<PressableProps, OmittedPressableProps> & React.RefAttributes<View>>;
|
|
55
|
+
export {};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import {
|
|
2
|
+
radioContainerStyles,
|
|
3
|
+
radioDotStyles
|
|
4
|
+
} from "../../chunks/chunk.YWEWQ2LT.js";
|
|
5
|
+
|
|
6
|
+
// src/components/radio/Radio.tsx
|
|
7
|
+
import React, { useEffect, useState } from "react";
|
|
8
|
+
import { Pressable, View } from "react-native";
|
|
9
|
+
var Radio = React.forwardRef(function Checkbox({
|
|
10
|
+
value = false,
|
|
11
|
+
disabled = false,
|
|
12
|
+
onValueChange,
|
|
13
|
+
style: styleProps,
|
|
14
|
+
...restProps
|
|
15
|
+
}, ref) {
|
|
16
|
+
const [checked, setChecked] = useState(value);
|
|
17
|
+
useEffect(
|
|
18
|
+
function onValueUpdate() {
|
|
19
|
+
setChecked(value);
|
|
20
|
+
},
|
|
21
|
+
[value]
|
|
22
|
+
);
|
|
23
|
+
function handlePress() {
|
|
24
|
+
if (disabled || checked) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
onValueChange?.(true);
|
|
28
|
+
setChecked(true);
|
|
29
|
+
}
|
|
30
|
+
return <Pressable
|
|
31
|
+
ref={ref}
|
|
32
|
+
{...restProps}
|
|
33
|
+
accessibilityLabel="radio"
|
|
34
|
+
accessibilityRole="radio"
|
|
35
|
+
accessibilityState={{ checked, disabled }}
|
|
36
|
+
accessible
|
|
37
|
+
aria-checked={checked}
|
|
38
|
+
aria-disabled={disabled}
|
|
39
|
+
aria-pressed={checked}
|
|
40
|
+
onPress={handlePress}
|
|
41
|
+
hitSlop={14}
|
|
42
|
+
role="radio"
|
|
43
|
+
style={[
|
|
44
|
+
styleProps,
|
|
45
|
+
radioContainerStyles.default,
|
|
46
|
+
checked && radioContainerStyles.active,
|
|
47
|
+
disabled && radioContainerStyles.disabled
|
|
48
|
+
]}
|
|
49
|
+
>{checked && <View
|
|
50
|
+
style={[
|
|
51
|
+
radioDotStyles.default,
|
|
52
|
+
checked && radioDotStyles.active,
|
|
53
|
+
disabled && radioDotStyles.disabled
|
|
54
|
+
]}
|
|
55
|
+
/>}</Pressable>;
|
|
56
|
+
});
|
|
57
|
+
export {
|
|
58
|
+
Radio
|
|
59
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export declare const radioContainerStyles: {
|
|
2
|
+
default: {
|
|
3
|
+
width: number;
|
|
4
|
+
height: number;
|
|
5
|
+
borderWidth: number;
|
|
6
|
+
borderRadius: number;
|
|
7
|
+
alignItems: "center";
|
|
8
|
+
justifyContent: "center";
|
|
9
|
+
borderColor: "#666666ff";
|
|
10
|
+
};
|
|
11
|
+
active: {
|
|
12
|
+
borderColor: "#540abdff";
|
|
13
|
+
};
|
|
14
|
+
disabled: {
|
|
15
|
+
borderColor: "#d7d7d7ff";
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
export declare const radioDotStyles: {
|
|
19
|
+
default: {
|
|
20
|
+
width: number;
|
|
21
|
+
height: number;
|
|
22
|
+
borderRadius: number;
|
|
23
|
+
};
|
|
24
|
+
disabled: {
|
|
25
|
+
backgroundColor: "#d7d7d7ff";
|
|
26
|
+
};
|
|
27
|
+
active: {
|
|
28
|
+
backgroundColor: "#540abdff";
|
|
29
|
+
};
|
|
30
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { TextInput, TextInputProps, StyleProp, ViewProps } from 'react-native';
|
|
3
|
+
type OmittedTextInputProps = Omit<TextInputProps, 'accessibilityLabel' | 'accessibilityRole' | 'editable' | 'returnKeyType' | 'style'>;
|
|
4
|
+
export declare const SearchField: React.ForwardRefExoticComponent<{
|
|
5
|
+
/**
|
|
6
|
+
* If `disabled` is `true`, the component is not editable.
|
|
7
|
+
*/
|
|
8
|
+
disabled?: boolean | undefined;
|
|
9
|
+
/**
|
|
10
|
+
* If `style` is defined, it will extend the container style.
|
|
11
|
+
*/
|
|
12
|
+
style?: StyleProp<ViewProps>;
|
|
13
|
+
} & OmittedTextInputProps & React.RefAttributes<TextInput>>;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import {
|
|
2
|
+
isIOS,
|
|
3
|
+
placeholderTextColor,
|
|
4
|
+
plateformStyles,
|
|
5
|
+
styles
|
|
6
|
+
} from "../../chunks/chunk.MCKLJGG3.js";
|
|
7
|
+
|
|
8
|
+
// src/components/search/SearchField.tsx
|
|
9
|
+
import React, { useEffect, useState } from "react";
|
|
10
|
+
import {
|
|
11
|
+
View,
|
|
12
|
+
TextInput
|
|
13
|
+
} from "react-native";
|
|
14
|
+
import Icon from "react-native-vector-icons/MaterialIcons";
|
|
15
|
+
var INIT_PLACEHOLDER = isIOS ? "Recherche" : "Rechercher un...";
|
|
16
|
+
var SearchField = React.forwardRef(
|
|
17
|
+
function SearchField2({
|
|
18
|
+
onChangeText,
|
|
19
|
+
placeholder = INIT_PLACEHOLDER,
|
|
20
|
+
style,
|
|
21
|
+
value = "",
|
|
22
|
+
disabled = false,
|
|
23
|
+
...props
|
|
24
|
+
}, ref) {
|
|
25
|
+
const [text, setText] = useState(value);
|
|
26
|
+
useEffect(
|
|
27
|
+
function onValueUpdate() {
|
|
28
|
+
setText(value);
|
|
29
|
+
},
|
|
30
|
+
[value]
|
|
31
|
+
);
|
|
32
|
+
function handleKeypress(text2) {
|
|
33
|
+
if (disabled) {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
onChangeText?.(text2);
|
|
37
|
+
setText(text2);
|
|
38
|
+
}
|
|
39
|
+
return <View
|
|
40
|
+
style={[
|
|
41
|
+
style,
|
|
42
|
+
styles.container,
|
|
43
|
+
isIOS && styles.iOScontainer,
|
|
44
|
+
disabled && styles.disabledContainer
|
|
45
|
+
]}
|
|
46
|
+
>
|
|
47
|
+
<Icon
|
|
48
|
+
name="search"
|
|
49
|
+
{...plateformStyles}
|
|
50
|
+
accessibilityRole="button"
|
|
51
|
+
accessibilityLabel="search"
|
|
52
|
+
/>
|
|
53
|
+
<TextInput
|
|
54
|
+
ref={ref}
|
|
55
|
+
{...props}
|
|
56
|
+
editable={!disabled}
|
|
57
|
+
accessibilityLabel="search"
|
|
58
|
+
accessibilityRole="search"
|
|
59
|
+
accessibilityState={{ disabled }}
|
|
60
|
+
onChangeText={handleKeypress}
|
|
61
|
+
placeholder={placeholder}
|
|
62
|
+
placeholderTextColor={placeholderTextColor}
|
|
63
|
+
returnKeyType="search"
|
|
64
|
+
style={[styles.input, isIOS ? styles.iOSInput : styles.androidInput]}
|
|
65
|
+
value={text}
|
|
66
|
+
/>
|
|
67
|
+
</View>;
|
|
68
|
+
}
|
|
69
|
+
);
|
|
70
|
+
export {
|
|
71
|
+
SearchField
|
|
72
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { IconProps } from 'react-native-vector-icons/Icon';
|
|
2
|
+
export declare const placeholderTextColor = "#3C3C4399";
|
|
3
|
+
export declare const styles: {
|
|
4
|
+
container: {
|
|
5
|
+
flexDirection: "row";
|
|
6
|
+
alignItems: "center";
|
|
7
|
+
borderRadius: number;
|
|
8
|
+
backgroundColor: string;
|
|
9
|
+
padding: 8;
|
|
10
|
+
paddingLeft: number;
|
|
11
|
+
};
|
|
12
|
+
iOScontainer: {
|
|
13
|
+
padding: number;
|
|
14
|
+
paddingLeft: number;
|
|
15
|
+
};
|
|
16
|
+
disabledContainer: {
|
|
17
|
+
backgroundColor: "#f7f7f7ff";
|
|
18
|
+
};
|
|
19
|
+
input: {
|
|
20
|
+
flex: number;
|
|
21
|
+
};
|
|
22
|
+
icon: {
|
|
23
|
+
position: "absolute";
|
|
24
|
+
left: 8;
|
|
25
|
+
};
|
|
26
|
+
iOSInput: {
|
|
27
|
+
paddingLeft: number;
|
|
28
|
+
};
|
|
29
|
+
androidInput: {
|
|
30
|
+
paddingLeft: number;
|
|
31
|
+
};
|
|
32
|
+
iosIcon: {
|
|
33
|
+
top: number;
|
|
34
|
+
width: number;
|
|
35
|
+
height: number;
|
|
36
|
+
marginLeft: 8;
|
|
37
|
+
};
|
|
38
|
+
androidIcon: {
|
|
39
|
+
marginLeft: 12;
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
export declare const plateformStyles: Pick<IconProps, "size" | "color" | "style">;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
|
+
import { TextInput as NativeTextInput, TextInputProps as NativeTextInputProps, ViewStyle, StyleProp } from 'react-native';
|
|
3
|
+
export type TextInputProps = {
|
|
4
|
+
/** The input's label. */
|
|
5
|
+
label?: string;
|
|
6
|
+
/** Makes the input a required field. */
|
|
7
|
+
required?: boolean;
|
|
8
|
+
/** Indicates whether the input should be in error state. */
|
|
9
|
+
error?: boolean;
|
|
10
|
+
/** The input's error text. A string or Text component. */
|
|
11
|
+
errorText?: ReactNode;
|
|
12
|
+
/** Disables the input. */
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
/** Makes the input readonly. */
|
|
15
|
+
readOnly?: boolean;
|
|
16
|
+
/** The input's help text. A string or Text component. */
|
|
17
|
+
helpText?: ReactNode;
|
|
18
|
+
/** Stylise the outer view of the input. */
|
|
19
|
+
style?: StyleProp<ViewStyle>;
|
|
20
|
+
/**
|
|
21
|
+
* The value to show for the text input. TextInput is a controlled component,
|
|
22
|
+
* which means the native value will be forced to match this value prop if provided.
|
|
23
|
+
* For most uses this works great, but in some cases this may cause flickering - one common cause is preventing edits by keeping value the same.
|
|
24
|
+
* In addition to simply setting the same value, either set editable={false},
|
|
25
|
+
* or set/update maxLength to prevent unwanted edits without flicker.
|
|
26
|
+
*/
|
|
27
|
+
value: string;
|
|
28
|
+
} & Omit<NativeTextInputProps, 'style' | 'editable' | 'value'>;
|
|
29
|
+
export declare const TextInput: React.ForwardRefExoticComponent<{
|
|
30
|
+
/** The input's label. */
|
|
31
|
+
label?: string | undefined;
|
|
32
|
+
/** Makes the input a required field. */
|
|
33
|
+
required?: boolean | undefined;
|
|
34
|
+
/** Indicates whether the input should be in error state. */
|
|
35
|
+
error?: boolean | undefined;
|
|
36
|
+
/** The input's error text. A string or Text component. */
|
|
37
|
+
errorText?: ReactNode;
|
|
38
|
+
/** Disables the input. */
|
|
39
|
+
disabled?: boolean | undefined;
|
|
40
|
+
/** Makes the input readonly. */
|
|
41
|
+
readOnly?: boolean | undefined;
|
|
42
|
+
/** The input's help text. A string or Text component. */
|
|
43
|
+
helpText?: ReactNode;
|
|
44
|
+
/** Stylise the outer view of the input. */
|
|
45
|
+
style?: StyleProp<ViewStyle>;
|
|
46
|
+
/**
|
|
47
|
+
* The value to show for the text input. TextInput is a controlled component,
|
|
48
|
+
* which means the native value will be forced to match this value prop if provided.
|
|
49
|
+
* For most uses this works great, but in some cases this may cause flickering - one common cause is preventing edits by keeping value the same.
|
|
50
|
+
* In addition to simply setting the same value, either set editable={false},
|
|
51
|
+
* or set/update maxLength to prevent unwanted edits without flicker.
|
|
52
|
+
*/
|
|
53
|
+
value: string;
|
|
54
|
+
} & Omit<NativeTextInputProps, "style" | "value" | "editable"> & React.RefAttributes<NativeTextInput>>;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
export declare const styles: {
|
|
2
|
+
container: {
|
|
3
|
+
display: "flex";
|
|
4
|
+
flex: number;
|
|
5
|
+
};
|
|
6
|
+
header: {
|
|
7
|
+
marginBottom: 8;
|
|
8
|
+
display: "flex";
|
|
9
|
+
flexDirection: "row";
|
|
10
|
+
};
|
|
11
|
+
label: {
|
|
12
|
+
color: "#666666ff";
|
|
13
|
+
fontSize: number;
|
|
14
|
+
fontFamily: string;
|
|
15
|
+
letterSpacing: number;
|
|
16
|
+
};
|
|
17
|
+
counter: {
|
|
18
|
+
color: "#666666ff";
|
|
19
|
+
fontSize: number;
|
|
20
|
+
fontFamily: string;
|
|
21
|
+
letterSpacing: number;
|
|
22
|
+
marginLeft: "auto";
|
|
23
|
+
};
|
|
24
|
+
labelRequired: {
|
|
25
|
+
color: "#dd1708ff";
|
|
26
|
+
};
|
|
27
|
+
input: {
|
|
28
|
+
fontSize: number;
|
|
29
|
+
fontFamily: string;
|
|
30
|
+
letterSpacing: number;
|
|
31
|
+
paddingTop: 16;
|
|
32
|
+
paddingBottom: 16;
|
|
33
|
+
paddingRight: 16;
|
|
34
|
+
paddingLeft: 16;
|
|
35
|
+
borderRadius: 8;
|
|
36
|
+
};
|
|
37
|
+
bottomMessage: {
|
|
38
|
+
marginTop: 8;
|
|
39
|
+
display: "flex";
|
|
40
|
+
flexDirection: "row";
|
|
41
|
+
};
|
|
42
|
+
errorText: {
|
|
43
|
+
color: "#dd1708ff";
|
|
44
|
+
};
|
|
45
|
+
errorIcon: {
|
|
46
|
+
color: "#dd1708ff";
|
|
47
|
+
marginTop: number;
|
|
48
|
+
marginRight: 4;
|
|
49
|
+
fontSize: number;
|
|
50
|
+
fontFamily: string;
|
|
51
|
+
letterSpacing: number;
|
|
52
|
+
};
|
|
53
|
+
helpText: {
|
|
54
|
+
color: "#252625ff";
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
export declare const inputWrapperStyles: {
|
|
58
|
+
default: {
|
|
59
|
+
backgroundColor: "#ffffffff";
|
|
60
|
+
borderColor: "#e7e7e7ff";
|
|
61
|
+
borderWidth: number;
|
|
62
|
+
borderRadius: 8;
|
|
63
|
+
};
|
|
64
|
+
focused: {
|
|
65
|
+
borderColor: "#540abdff";
|
|
66
|
+
};
|
|
67
|
+
error: {
|
|
68
|
+
borderColor: "#dd1708ff";
|
|
69
|
+
backgroundColor: "#fff5f5ff";
|
|
70
|
+
color: "#252625ff";
|
|
71
|
+
};
|
|
72
|
+
readonly: {
|
|
73
|
+
borderColor: "#e7e7e7ff";
|
|
74
|
+
backgroundColor: "#d7d7d7ff";
|
|
75
|
+
color: "#252625ff";
|
|
76
|
+
};
|
|
77
|
+
disabled: {
|
|
78
|
+
borderColor: "#e7e7e7ff";
|
|
79
|
+
backgroundColor: "#f7f7f7ff";
|
|
80
|
+
color: "#8a8c8aff";
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
export declare function getCursorColors(error: boolean): {
|
|
84
|
+
cursorColor: "#540abdff" | "#dd1708ff";
|
|
85
|
+
selectionColor: "#540abdff" | "#dd1708ff";
|
|
86
|
+
};
|
package/dist/index.d.ts
CHANGED