@idealyst/components 1.0.24 → 1.0.26
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/README.md +567 -567
- package/package.json +2 -2
- package/plugin/web.js +319 -185
- package/src/Avatar/Avatar.native.tsx +43 -43
- package/src/Avatar/Avatar.styles.tsx +66 -66
- package/src/Avatar/Avatar.web.tsx +50 -50
- package/src/Avatar/index.native.ts +1 -1
- package/src/Avatar/index.ts +1 -1
- package/src/Avatar/index.web.ts +1 -1
- package/src/Avatar/types.ts +42 -42
- package/src/Badge/Badge.native.tsx +42 -42
- package/src/Badge/Badge.styles.tsx +153 -153
- package/src/Badge/Badge.web.tsx +44 -44
- package/src/Badge/index.native.ts +1 -1
- package/src/Badge/index.ts +1 -1
- package/src/Badge/index.web.ts +1 -1
- package/src/Badge/types.ts +33 -33
- package/src/Button/Button.native.tsx +38 -38
- package/src/Button/Button.styles.tsx +214 -214
- package/src/Button/Button.types.ts +11 -11
- package/src/Button/Button.web.tsx +55 -55
- package/src/Button/index.native.ts +2 -2
- package/src/Button/index.ts +4 -4
- package/src/Button/index.web.ts +2 -2
- package/src/Button/types.ts +48 -48
- package/src/Card/Card.native.tsx +51 -51
- package/src/Card/Card.styles.tsx +239 -239
- package/src/Card/Card.web.tsx +61 -61
- package/src/Card/index.native.ts +2 -2
- package/src/Card/index.ts +4 -4
- package/src/Card/index.web.ts +2 -2
- package/src/Card/types.ts +58 -58
- package/src/Checkbox/Checkbox.native.tsx +98 -98
- package/src/Checkbox/Checkbox.styles.tsx +291 -291
- package/src/Checkbox/Checkbox.web.tsx +130 -130
- package/src/Checkbox/index.native.ts +2 -2
- package/src/Checkbox/index.ts +4 -4
- package/src/Checkbox/index.web.ts +2 -2
- package/src/Checkbox/types.ts +78 -78
- package/src/Divider/Divider.native.tsx +144 -144
- package/src/Divider/Divider.styles.tsx +601 -601
- package/src/Divider/Divider.web.tsx +72 -72
- package/src/Divider/index.native.ts +2 -2
- package/src/Divider/index.ts +4 -4
- package/src/Divider/index.web.ts +2 -2
- package/src/Divider/types.ts +53 -53
- package/src/Icon/Icon.native.tsx +38 -38
- package/src/Icon/Icon.styles.tsx +49 -49
- package/src/Icon/Icon.web.tsx +46 -46
- package/src/Icon/icon-types.ts +7452 -7452
- package/src/Icon/index.native.ts +2 -2
- package/src/Icon/index.ts +4 -4
- package/src/Icon/index.web.ts +2 -2
- package/src/Icon/types.ts +35 -35
- package/src/Input/Input.native.tsx +74 -74
- package/src/Input/Input.styles.tsx +176 -176
- package/src/Input/Input.web.tsx +70 -70
- package/src/Input/index.native.ts +2 -2
- package/src/Input/index.ts +4 -4
- package/src/Input/index.web.ts +2 -2
- package/src/Input/types.ts +68 -68
- package/src/Screen/Screen.native.tsx +40 -40
- package/src/Screen/Screen.styles.tsx +59 -59
- package/src/Screen/Screen.web.tsx +32 -32
- package/src/Screen/index.native.ts +1 -1
- package/src/Screen/index.ts +1 -1
- package/src/Screen/index.web.ts +1 -1
- package/src/Screen/types.ts +37 -37
- package/src/Text/Text.native.tsx +35 -35
- package/src/Text/Text.styles.tsx +66 -66
- package/src/Text/Text.web.tsx +40 -40
- package/src/Text/index.native.ts +2 -2
- package/src/Text/index.ts +4 -4
- package/src/Text/index.web.ts +2 -2
- package/src/Text/types.ts +38 -38
- package/src/View/View.native.tsx +55 -55
- package/src/View/View.styles.tsx +102 -102
- package/src/View/View.web.tsx +59 -59
- package/src/View/index.native.ts +2 -2
- package/src/View/index.ts +4 -4
- package/src/View/index.web.ts +2 -2
- package/src/View/types.ts +72 -72
- package/src/examples/AllExamples.tsx +71 -71
- package/src/examples/AvatarExamples.tsx +96 -96
- package/src/examples/BadgeExamples.tsx +199 -199
- package/src/examples/ButtonExamples.tsx +149 -149
- package/src/examples/CardExamples.tsx +175 -175
- package/src/examples/CheckboxExamples.tsx +216 -216
- package/src/examples/DividerExamples.tsx +217 -217
- package/src/examples/IconExamples.tsx +341 -341
- package/src/examples/InputExamples.tsx +133 -133
- package/src/examples/README.md +135 -135
- package/src/examples/ScreenExamples.tsx +153 -153
- package/src/examples/TextExamples.tsx +88 -88
- package/src/examples/ThemeExtensionExamples.tsx +90 -90
- package/src/examples/ValidationExamples.tsx +94 -94
- package/src/examples/ViewExamples.tsx +128 -128
- package/src/examples/extendedTheme.ts +328 -328
- package/src/examples/index.ts +14 -14
- package/src/index.native.ts +48 -48
- package/src/index.ts +47 -47
- package/src/theme/breakpoints.ts +8 -8
- package/src/theme/colorResolver.ts +217 -217
- package/src/theme/colors.ts +314 -314
- package/src/theme/defaultThemes.ts +325 -325
- package/src/theme/index.ts +187 -187
- package/src/theme/themeBuilder.ts +601 -601
- package/src/theme/unistyles.d.ts +5 -5
- package/src/theme/variantHelpers.ts +583 -583
- package/src/theme/variants.ts +55 -55
package/src/Icon/index.native.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
// React Native-specific Icon export
|
|
2
|
-
export { default } from './Icon.native';
|
|
1
|
+
// React Native-specific Icon export
|
|
2
|
+
export { default } from './Icon.native';
|
|
3
3
|
export * from './types';
|
package/src/Icon/index.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
// Platform-agnostic Icon export
|
|
2
|
-
// Metro will resolve to index.native.ts for React Native
|
|
3
|
-
// This file serves as fallback for web environments
|
|
4
|
-
export { default } from './Icon.web';
|
|
1
|
+
// Platform-agnostic Icon export
|
|
2
|
+
// Metro will resolve to index.native.ts for React Native
|
|
3
|
+
// This file serves as fallback for web environments
|
|
4
|
+
export { default } from './Icon.web';
|
|
5
5
|
export * from './types';
|
package/src/Icon/index.web.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
// Web-specific Icon export
|
|
2
|
-
export { default } from './Icon.web';
|
|
1
|
+
// Web-specific Icon export
|
|
2
|
+
export { default } from './Icon.web';
|
|
3
3
|
export * from './types';
|
package/src/Icon/types.ts
CHANGED
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
import { IconName } from "./icon-types";
|
|
2
|
-
import type { DisplayColorVariant } from '../theme/variants';
|
|
3
|
-
|
|
4
|
-
export type IconSizeVariant = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
5
|
-
|
|
6
|
-
export interface IconProps {
|
|
7
|
-
/**
|
|
8
|
-
* The name of the icon to display
|
|
9
|
-
*/
|
|
10
|
-
name: IconName;
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* The size variant of the icon
|
|
14
|
-
*/
|
|
15
|
-
size?: IconSizeVariant;
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Predefined color variant based on theme
|
|
19
|
-
*/
|
|
20
|
-
color?: DisplayColorVariant;
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Additional styles (platform-specific)
|
|
24
|
-
*/
|
|
25
|
-
style?: any;
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Test ID for testing
|
|
29
|
-
*/
|
|
30
|
-
testID?: string;
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Accessibility label for screen readers
|
|
34
|
-
*/
|
|
35
|
-
accessibilityLabel?: string;
|
|
1
|
+
import { IconName } from "./icon-types";
|
|
2
|
+
import type { DisplayColorVariant } from '../theme/variants';
|
|
3
|
+
|
|
4
|
+
export type IconSizeVariant = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
5
|
+
|
|
6
|
+
export interface IconProps {
|
|
7
|
+
/**
|
|
8
|
+
* The name of the icon to display
|
|
9
|
+
*/
|
|
10
|
+
name: IconName;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* The size variant of the icon
|
|
14
|
+
*/
|
|
15
|
+
size?: IconSizeVariant;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Predefined color variant based on theme
|
|
19
|
+
*/
|
|
20
|
+
color?: DisplayColorVariant;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Additional styles (platform-specific)
|
|
24
|
+
*/
|
|
25
|
+
style?: any;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Test ID for testing
|
|
29
|
+
*/
|
|
30
|
+
testID?: string;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Accessibility label for screen readers
|
|
34
|
+
*/
|
|
35
|
+
accessibilityLabel?: string;
|
|
36
36
|
}
|
|
@@ -1,75 +1,75 @@
|
|
|
1
|
-
import React, { useState } from 'react';
|
|
2
|
-
import { TextInput } from 'react-native';
|
|
3
|
-
import { InputProps } from './types';
|
|
4
|
-
import { inputStyles } from './Input.styles';
|
|
5
|
-
|
|
6
|
-
const Input: React.FC<InputProps> = ({
|
|
7
|
-
value,
|
|
8
|
-
onChangeText,
|
|
9
|
-
placeholder,
|
|
10
|
-
disabled = false,
|
|
11
|
-
inputType = 'text',
|
|
12
|
-
secureTextEntry = false,
|
|
13
|
-
autoCapitalize = 'sentences',
|
|
14
|
-
size = 'medium',
|
|
15
|
-
variant = 'default',
|
|
16
|
-
hasError = false,
|
|
17
|
-
style,
|
|
18
|
-
testID,
|
|
19
|
-
}) => {
|
|
20
|
-
const [isFocused, setIsFocused] = useState(false);
|
|
21
|
-
|
|
22
|
-
const getKeyboardType = () => {
|
|
23
|
-
switch (inputType) {
|
|
24
|
-
case 'email':
|
|
25
|
-
return 'email-address';
|
|
26
|
-
case 'number':
|
|
27
|
-
return 'numeric';
|
|
28
|
-
case 'password':
|
|
29
|
-
case 'text':
|
|
30
|
-
default:
|
|
31
|
-
return 'default';
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
const handleFocus = () => {
|
|
36
|
-
setIsFocused(true);
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
const handleBlur = () => {
|
|
40
|
-
setIsFocused(false);
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
// Apply variants to the stylesheet
|
|
44
|
-
inputStyles.useVariants({
|
|
45
|
-
size,
|
|
46
|
-
variant,
|
|
47
|
-
focused: isFocused,
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
const inputStyleArray = [
|
|
51
|
-
inputStyles.input,
|
|
52
|
-
disabled && inputStyles.disabled,
|
|
53
|
-
hasError && inputStyles.error,
|
|
54
|
-
style,
|
|
55
|
-
];
|
|
56
|
-
|
|
57
|
-
return (
|
|
58
|
-
<TextInput
|
|
59
|
-
value={value}
|
|
60
|
-
onChangeText={onChangeText}
|
|
61
|
-
placeholder={placeholder}
|
|
62
|
-
editable={!disabled}
|
|
63
|
-
keyboardType={getKeyboardType()}
|
|
64
|
-
secureTextEntry={secureTextEntry || inputType === 'password'}
|
|
65
|
-
autoCapitalize={autoCapitalize}
|
|
66
|
-
onFocus={handleFocus}
|
|
67
|
-
onBlur={handleBlur}
|
|
68
|
-
style={inputStyleArray}
|
|
69
|
-
testID={testID}
|
|
70
|
-
placeholderTextColor="#999999"
|
|
71
|
-
/>
|
|
72
|
-
);
|
|
73
|
-
};
|
|
74
|
-
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { TextInput } from 'react-native';
|
|
3
|
+
import { InputProps } from './types';
|
|
4
|
+
import { inputStyles } from './Input.styles';
|
|
5
|
+
|
|
6
|
+
const Input: React.FC<InputProps> = ({
|
|
7
|
+
value,
|
|
8
|
+
onChangeText,
|
|
9
|
+
placeholder,
|
|
10
|
+
disabled = false,
|
|
11
|
+
inputType = 'text',
|
|
12
|
+
secureTextEntry = false,
|
|
13
|
+
autoCapitalize = 'sentences',
|
|
14
|
+
size = 'medium',
|
|
15
|
+
variant = 'default',
|
|
16
|
+
hasError = false,
|
|
17
|
+
style,
|
|
18
|
+
testID,
|
|
19
|
+
}) => {
|
|
20
|
+
const [isFocused, setIsFocused] = useState(false);
|
|
21
|
+
|
|
22
|
+
const getKeyboardType = () => {
|
|
23
|
+
switch (inputType) {
|
|
24
|
+
case 'email':
|
|
25
|
+
return 'email-address';
|
|
26
|
+
case 'number':
|
|
27
|
+
return 'numeric';
|
|
28
|
+
case 'password':
|
|
29
|
+
case 'text':
|
|
30
|
+
default:
|
|
31
|
+
return 'default';
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
const handleFocus = () => {
|
|
36
|
+
setIsFocused(true);
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
const handleBlur = () => {
|
|
40
|
+
setIsFocused(false);
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
// Apply variants to the stylesheet
|
|
44
|
+
inputStyles.useVariants({
|
|
45
|
+
size,
|
|
46
|
+
variant,
|
|
47
|
+
focused: isFocused,
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
const inputStyleArray = [
|
|
51
|
+
inputStyles.input,
|
|
52
|
+
disabled && inputStyles.disabled,
|
|
53
|
+
hasError && inputStyles.error,
|
|
54
|
+
style,
|
|
55
|
+
];
|
|
56
|
+
|
|
57
|
+
return (
|
|
58
|
+
<TextInput
|
|
59
|
+
value={value}
|
|
60
|
+
onChangeText={onChangeText}
|
|
61
|
+
placeholder={placeholder}
|
|
62
|
+
editable={!disabled}
|
|
63
|
+
keyboardType={getKeyboardType()}
|
|
64
|
+
secureTextEntry={secureTextEntry || inputType === 'password'}
|
|
65
|
+
autoCapitalize={autoCapitalize}
|
|
66
|
+
onFocus={handleFocus}
|
|
67
|
+
onBlur={handleBlur}
|
|
68
|
+
style={inputStyleArray}
|
|
69
|
+
testID={testID}
|
|
70
|
+
placeholderTextColor="#999999"
|
|
71
|
+
/>
|
|
72
|
+
);
|
|
73
|
+
};
|
|
74
|
+
|
|
75
75
|
export default Input;
|
|
@@ -1,177 +1,177 @@
|
|
|
1
|
-
import { StyleSheet } from 'react-native-unistyles';
|
|
2
|
-
|
|
3
|
-
export const inputStyles = StyleSheet.create((theme) => ({
|
|
4
|
-
input: {
|
|
5
|
-
variants: {
|
|
6
|
-
size: {
|
|
7
|
-
small: {
|
|
8
|
-
height: 36,
|
|
9
|
-
paddingHorizontal: theme.spacing?.sm || 8,
|
|
10
|
-
paddingVertical: theme.spacing?.xs || 4,
|
|
11
|
-
fontSize: theme.typography?.fontSize?.sm || 14,
|
|
12
|
-
},
|
|
13
|
-
medium: {
|
|
14
|
-
height: 44,
|
|
15
|
-
paddingHorizontal: theme.spacing?.md || 12,
|
|
16
|
-
paddingVertical: theme.spacing?.sm || 8,
|
|
17
|
-
fontSize: theme.typography?.fontSize?.md || 16,
|
|
18
|
-
},
|
|
19
|
-
large: {
|
|
20
|
-
height: 52,
|
|
21
|
-
paddingHorizontal: theme.spacing?.lg || 16,
|
|
22
|
-
paddingVertical: theme.spacing?.md || 12,
|
|
23
|
-
fontSize: theme.typography?.fontSize?.lg || 18,
|
|
24
|
-
},
|
|
25
|
-
},
|
|
26
|
-
variant: {
|
|
27
|
-
default: {
|
|
28
|
-
backgroundColor: theme.colors?.surface?.primary || '#ffffff',
|
|
29
|
-
borderWidth: 1,
|
|
30
|
-
borderColor: theme.colors?.border?.primary || '#e5e7eb',
|
|
31
|
-
borderStyle: 'solid',
|
|
32
|
-
color: theme.colors?.text?.primary || '#000000',
|
|
33
|
-
|
|
34
|
-
_web: {
|
|
35
|
-
border: `1px solid ${theme.colors?.border?.primary || '#e5e7eb'}`,
|
|
36
|
-
},
|
|
37
|
-
},
|
|
38
|
-
outlined: {
|
|
39
|
-
backgroundColor: 'transparent',
|
|
40
|
-
borderWidth: 1,
|
|
41
|
-
borderColor: theme.intents?.primary?.main || '#3b82f6',
|
|
42
|
-
borderStyle: 'solid',
|
|
43
|
-
color: theme.colors?.text?.primary || '#000000',
|
|
44
|
-
|
|
45
|
-
_web: {
|
|
46
|
-
border: `1px solid ${theme.intents?.primary?.main || '#3b82f6'}`,
|
|
47
|
-
},
|
|
48
|
-
},
|
|
49
|
-
filled: {
|
|
50
|
-
backgroundColor: theme.colors?.surface?.secondary || '#f9fafb',
|
|
51
|
-
borderWidth: 0,
|
|
52
|
-
borderColor: 'transparent',
|
|
53
|
-
color: theme.colors?.text?.primary || '#000000',
|
|
54
|
-
|
|
55
|
-
_web: {
|
|
56
|
-
border: 'none',
|
|
57
|
-
},
|
|
58
|
-
},
|
|
59
|
-
},
|
|
60
|
-
focused: {
|
|
61
|
-
true: {
|
|
62
|
-
// Base focused styles - will be overridden by compound variants
|
|
63
|
-
},
|
|
64
|
-
false: {
|
|
65
|
-
// No additional styles when not focused
|
|
66
|
-
},
|
|
67
|
-
},
|
|
68
|
-
},
|
|
69
|
-
|
|
70
|
-
compoundVariants: [
|
|
71
|
-
// Default variant focus
|
|
72
|
-
{
|
|
73
|
-
variant: 'default',
|
|
74
|
-
focused: true,
|
|
75
|
-
styles: {
|
|
76
|
-
borderColor: theme.intents?.primary?.main || '#3b82f6',
|
|
77
|
-
shadowColor: theme.intents?.primary?.main || '#3b82f6',
|
|
78
|
-
shadowOffset: { width: 0, height: 0 },
|
|
79
|
-
shadowOpacity: 0.1,
|
|
80
|
-
shadowRadius: 2,
|
|
81
|
-
elevation: 1,
|
|
82
|
-
},
|
|
83
|
-
},
|
|
84
|
-
// Outlined variant focus
|
|
85
|
-
{
|
|
86
|
-
variant: 'outlined',
|
|
87
|
-
focused: true,
|
|
88
|
-
styles: {
|
|
89
|
-
backgroundColor: 'transparent',
|
|
90
|
-
borderWidth: 1,
|
|
91
|
-
borderColor: theme.intents?.primary?.main || '#3b82f6',
|
|
92
|
-
borderStyle: 'solid',
|
|
93
|
-
},
|
|
94
|
-
},
|
|
95
|
-
// Filled variant focus
|
|
96
|
-
{
|
|
97
|
-
variant: 'filled',
|
|
98
|
-
focused: true,
|
|
99
|
-
styles: {
|
|
100
|
-
backgroundColor: theme.colors?.surface?.secondary || '#f3f4f6',
|
|
101
|
-
borderWidth: 0,
|
|
102
|
-
shadowColor: theme.intents?.primary?.main || '#3b82f6',
|
|
103
|
-
shadowOffset: { width: 0, height: 0 },
|
|
104
|
-
shadowOpacity: 0.05,
|
|
105
|
-
shadowRadius: 1,
|
|
106
|
-
elevation: 0.5,
|
|
107
|
-
},
|
|
108
|
-
},
|
|
109
|
-
],
|
|
110
|
-
|
|
111
|
-
borderRadius: theme.borderRadius?.md || 8,
|
|
112
|
-
fontWeight: theme.typography?.fontWeight?.regular || '400',
|
|
113
|
-
// Web-specific styles
|
|
114
|
-
_web: {
|
|
115
|
-
boxSizing: 'border-box',
|
|
116
|
-
outline: 'none',
|
|
117
|
-
transition: 'border-color 0.2s ease, box-shadow 0.2s ease',
|
|
118
|
-
fontFamily: 'inherit',
|
|
119
|
-
_focus: {
|
|
120
|
-
borderColor: theme.intents?.primary?.main || '#3b82f6',
|
|
121
|
-
},
|
|
122
|
-
_hover: {
|
|
123
|
-
borderColor: theme.intents?.primary?.main || '#3b82f6',
|
|
124
|
-
},
|
|
125
|
-
},
|
|
126
|
-
},
|
|
127
|
-
disabled: {
|
|
128
|
-
opacity: 0.6,
|
|
129
|
-
backgroundColor: theme.colors?.surface?.secondary || '#f3f4f6',
|
|
130
|
-
color: theme.colors?.text?.disabled || '#9ca3af',
|
|
131
|
-
_web: {
|
|
132
|
-
cursor: 'not-allowed',
|
|
133
|
-
},
|
|
134
|
-
},
|
|
135
|
-
error: {
|
|
136
|
-
borderWidth: 1,
|
|
137
|
-
borderColor: theme.intents?.error?.main || '#ef4444',
|
|
138
|
-
borderStyle: 'solid',
|
|
139
|
-
|
|
140
|
-
variants: {
|
|
141
|
-
focused: {
|
|
142
|
-
true: {
|
|
143
|
-
shadowColor: theme.intents?.error?.main || '#ef4444',
|
|
144
|
-
shadowOffset: { width: 0, height: 0 },
|
|
145
|
-
shadowOpacity: 0.1,
|
|
146
|
-
shadowRadius: 2,
|
|
147
|
-
elevation: 1,
|
|
148
|
-
},
|
|
149
|
-
false: {
|
|
150
|
-
// No additional styles when not focused
|
|
151
|
-
},
|
|
152
|
-
},
|
|
153
|
-
variant: {
|
|
154
|
-
default: {
|
|
155
|
-
// Use default error styles
|
|
156
|
-
},
|
|
157
|
-
outlined: {
|
|
158
|
-
// Override outlined styles for error
|
|
159
|
-
borderColor: theme.intents?.error?.main || '#ef4444',
|
|
160
|
-
},
|
|
161
|
-
filled: {
|
|
162
|
-
// Add border for error even in filled variant
|
|
163
|
-
borderWidth: 1,
|
|
164
|
-
borderColor: theme.intents?.error?.main || '#ef4444',
|
|
165
|
-
},
|
|
166
|
-
},
|
|
167
|
-
},
|
|
168
|
-
|
|
169
|
-
_web: {
|
|
170
|
-
border: `1px solid ${theme.intents?.error?.main || '#ef4444'}`,
|
|
171
|
-
_focus: {
|
|
172
|
-
borderColor: theme.intents?.error?.main || '#ef4444',
|
|
173
|
-
boxShadow: `0 0 0 2px ${theme.intents?.error?.main || '#ef4444'}20`,
|
|
174
|
-
},
|
|
175
|
-
},
|
|
176
|
-
},
|
|
1
|
+
import { StyleSheet } from 'react-native-unistyles';
|
|
2
|
+
|
|
3
|
+
export const inputStyles = StyleSheet.create((theme) => ({
|
|
4
|
+
input: {
|
|
5
|
+
variants: {
|
|
6
|
+
size: {
|
|
7
|
+
small: {
|
|
8
|
+
height: 36,
|
|
9
|
+
paddingHorizontal: theme.spacing?.sm || 8,
|
|
10
|
+
paddingVertical: theme.spacing?.xs || 4,
|
|
11
|
+
fontSize: theme.typography?.fontSize?.sm || 14,
|
|
12
|
+
},
|
|
13
|
+
medium: {
|
|
14
|
+
height: 44,
|
|
15
|
+
paddingHorizontal: theme.spacing?.md || 12,
|
|
16
|
+
paddingVertical: theme.spacing?.sm || 8,
|
|
17
|
+
fontSize: theme.typography?.fontSize?.md || 16,
|
|
18
|
+
},
|
|
19
|
+
large: {
|
|
20
|
+
height: 52,
|
|
21
|
+
paddingHorizontal: theme.spacing?.lg || 16,
|
|
22
|
+
paddingVertical: theme.spacing?.md || 12,
|
|
23
|
+
fontSize: theme.typography?.fontSize?.lg || 18,
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
variant: {
|
|
27
|
+
default: {
|
|
28
|
+
backgroundColor: theme.colors?.surface?.primary || '#ffffff',
|
|
29
|
+
borderWidth: 1,
|
|
30
|
+
borderColor: theme.colors?.border?.primary || '#e5e7eb',
|
|
31
|
+
borderStyle: 'solid',
|
|
32
|
+
color: theme.colors?.text?.primary || '#000000',
|
|
33
|
+
|
|
34
|
+
_web: {
|
|
35
|
+
border: `1px solid ${theme.colors?.border?.primary || '#e5e7eb'}`,
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
outlined: {
|
|
39
|
+
backgroundColor: 'transparent',
|
|
40
|
+
borderWidth: 1,
|
|
41
|
+
borderColor: theme.intents?.primary?.main || '#3b82f6',
|
|
42
|
+
borderStyle: 'solid',
|
|
43
|
+
color: theme.colors?.text?.primary || '#000000',
|
|
44
|
+
|
|
45
|
+
_web: {
|
|
46
|
+
border: `1px solid ${theme.intents?.primary?.main || '#3b82f6'}`,
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
filled: {
|
|
50
|
+
backgroundColor: theme.colors?.surface?.secondary || '#f9fafb',
|
|
51
|
+
borderWidth: 0,
|
|
52
|
+
borderColor: 'transparent',
|
|
53
|
+
color: theme.colors?.text?.primary || '#000000',
|
|
54
|
+
|
|
55
|
+
_web: {
|
|
56
|
+
border: 'none',
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
focused: {
|
|
61
|
+
true: {
|
|
62
|
+
// Base focused styles - will be overridden by compound variants
|
|
63
|
+
},
|
|
64
|
+
false: {
|
|
65
|
+
// No additional styles when not focused
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
|
|
70
|
+
compoundVariants: [
|
|
71
|
+
// Default variant focus
|
|
72
|
+
{
|
|
73
|
+
variant: 'default',
|
|
74
|
+
focused: true,
|
|
75
|
+
styles: {
|
|
76
|
+
borderColor: theme.intents?.primary?.main || '#3b82f6',
|
|
77
|
+
shadowColor: theme.intents?.primary?.main || '#3b82f6',
|
|
78
|
+
shadowOffset: { width: 0, height: 0 },
|
|
79
|
+
shadowOpacity: 0.1,
|
|
80
|
+
shadowRadius: 2,
|
|
81
|
+
elevation: 1,
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
// Outlined variant focus
|
|
85
|
+
{
|
|
86
|
+
variant: 'outlined',
|
|
87
|
+
focused: true,
|
|
88
|
+
styles: {
|
|
89
|
+
backgroundColor: 'transparent',
|
|
90
|
+
borderWidth: 1,
|
|
91
|
+
borderColor: theme.intents?.primary?.main || '#3b82f6',
|
|
92
|
+
borderStyle: 'solid',
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
// Filled variant focus
|
|
96
|
+
{
|
|
97
|
+
variant: 'filled',
|
|
98
|
+
focused: true,
|
|
99
|
+
styles: {
|
|
100
|
+
backgroundColor: theme.colors?.surface?.secondary || '#f3f4f6',
|
|
101
|
+
borderWidth: 0,
|
|
102
|
+
shadowColor: theme.intents?.primary?.main || '#3b82f6',
|
|
103
|
+
shadowOffset: { width: 0, height: 0 },
|
|
104
|
+
shadowOpacity: 0.05,
|
|
105
|
+
shadowRadius: 1,
|
|
106
|
+
elevation: 0.5,
|
|
107
|
+
},
|
|
108
|
+
},
|
|
109
|
+
],
|
|
110
|
+
|
|
111
|
+
borderRadius: theme.borderRadius?.md || 8,
|
|
112
|
+
fontWeight: theme.typography?.fontWeight?.regular || '400',
|
|
113
|
+
// Web-specific styles
|
|
114
|
+
_web: {
|
|
115
|
+
boxSizing: 'border-box',
|
|
116
|
+
outline: 'none',
|
|
117
|
+
transition: 'border-color 0.2s ease, box-shadow 0.2s ease',
|
|
118
|
+
fontFamily: 'inherit',
|
|
119
|
+
_focus: {
|
|
120
|
+
borderColor: theme.intents?.primary?.main || '#3b82f6',
|
|
121
|
+
},
|
|
122
|
+
_hover: {
|
|
123
|
+
borderColor: theme.intents?.primary?.main || '#3b82f6',
|
|
124
|
+
},
|
|
125
|
+
},
|
|
126
|
+
},
|
|
127
|
+
disabled: {
|
|
128
|
+
opacity: 0.6,
|
|
129
|
+
backgroundColor: theme.colors?.surface?.secondary || '#f3f4f6',
|
|
130
|
+
color: theme.colors?.text?.disabled || '#9ca3af',
|
|
131
|
+
_web: {
|
|
132
|
+
cursor: 'not-allowed',
|
|
133
|
+
},
|
|
134
|
+
},
|
|
135
|
+
error: {
|
|
136
|
+
borderWidth: 1,
|
|
137
|
+
borderColor: theme.intents?.error?.main || '#ef4444',
|
|
138
|
+
borderStyle: 'solid',
|
|
139
|
+
|
|
140
|
+
variants: {
|
|
141
|
+
focused: {
|
|
142
|
+
true: {
|
|
143
|
+
shadowColor: theme.intents?.error?.main || '#ef4444',
|
|
144
|
+
shadowOffset: { width: 0, height: 0 },
|
|
145
|
+
shadowOpacity: 0.1,
|
|
146
|
+
shadowRadius: 2,
|
|
147
|
+
elevation: 1,
|
|
148
|
+
},
|
|
149
|
+
false: {
|
|
150
|
+
// No additional styles when not focused
|
|
151
|
+
},
|
|
152
|
+
},
|
|
153
|
+
variant: {
|
|
154
|
+
default: {
|
|
155
|
+
// Use default error styles
|
|
156
|
+
},
|
|
157
|
+
outlined: {
|
|
158
|
+
// Override outlined styles for error
|
|
159
|
+
borderColor: theme.intents?.error?.main || '#ef4444',
|
|
160
|
+
},
|
|
161
|
+
filled: {
|
|
162
|
+
// Add border for error even in filled variant
|
|
163
|
+
borderWidth: 1,
|
|
164
|
+
borderColor: theme.intents?.error?.main || '#ef4444',
|
|
165
|
+
},
|
|
166
|
+
},
|
|
167
|
+
},
|
|
168
|
+
|
|
169
|
+
_web: {
|
|
170
|
+
border: `1px solid ${theme.intents?.error?.main || '#ef4444'}`,
|
|
171
|
+
_focus: {
|
|
172
|
+
borderColor: theme.intents?.error?.main || '#ef4444',
|
|
173
|
+
boxShadow: `0 0 0 2px ${theme.intents?.error?.main || '#ef4444'}20`,
|
|
174
|
+
},
|
|
175
|
+
},
|
|
176
|
+
},
|
|
177
177
|
}));
|