@idealyst/components 1.0.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/README.md +568 -0
- package/package.json +107 -0
- package/plugin/web.js +186 -0
- package/src/Avatar/Avatar.native.tsx +44 -0
- package/src/Avatar/Avatar.styles.tsx +67 -0
- package/src/Avatar/Avatar.web.tsx +51 -0
- package/src/Avatar/index.native.ts +2 -0
- package/src/Avatar/index.ts +2 -0
- package/src/Avatar/index.web.ts +2 -0
- package/src/Avatar/types.ts +43 -0
- package/src/Badge/Badge.native.tsx +43 -0
- package/src/Badge/Badge.styles.tsx +154 -0
- package/src/Badge/Badge.web.tsx +45 -0
- package/src/Badge/index.native.ts +2 -0
- package/src/Badge/index.ts +2 -0
- package/src/Badge/index.web.ts +2 -0
- package/src/Badge/types.ts +34 -0
- package/src/Button/Button.native.tsx +39 -0
- package/src/Button/Button.styles.tsx +215 -0
- package/src/Button/Button.types.ts +12 -0
- package/src/Button/Button.web.tsx +56 -0
- package/src/Button/index.native.ts +3 -0
- package/src/Button/index.ts +5 -0
- package/src/Button/index.web.ts +3 -0
- package/src/Button/types.ts +49 -0
- package/src/Card/Card.native.tsx +52 -0
- package/src/Card/Card.styles.tsx +240 -0
- package/src/Card/Card.web.tsx +62 -0
- package/src/Card/index.native.ts +3 -0
- package/src/Card/index.ts +5 -0
- package/src/Card/index.web.ts +3 -0
- package/src/Card/types.ts +59 -0
- package/src/Checkbox/Checkbox.native.tsx +99 -0
- package/src/Checkbox/Checkbox.styles.tsx +292 -0
- package/src/Checkbox/Checkbox.web.tsx +131 -0
- package/src/Checkbox/index.native.ts +3 -0
- package/src/Checkbox/index.ts +5 -0
- package/src/Checkbox/index.web.ts +3 -0
- package/src/Checkbox/types.ts +79 -0
- package/src/Divider/Divider.native.tsx +145 -0
- package/src/Divider/Divider.styles.tsx +602 -0
- package/src/Divider/Divider.web.tsx +73 -0
- package/src/Divider/index.native.ts +3 -0
- package/src/Divider/index.ts +5 -0
- package/src/Divider/index.web.ts +3 -0
- package/src/Divider/types.ts +54 -0
- package/src/Icon/Icon.native.tsx +39 -0
- package/src/Icon/Icon.styles.tsx +50 -0
- package/src/Icon/Icon.web.tsx +47 -0
- package/src/Icon/icon-types.ts +7452 -0
- package/src/Icon/index.native.ts +3 -0
- package/src/Icon/index.ts +5 -0
- package/src/Icon/index.web.ts +3 -0
- package/src/Icon/types.ts +36 -0
- package/src/Input/Input.native.tsx +75 -0
- package/src/Input/Input.styles.tsx +177 -0
- package/src/Input/Input.web.tsx +71 -0
- package/src/Input/index.native.ts +3 -0
- package/src/Input/index.ts +5 -0
- package/src/Input/index.web.ts +3 -0
- package/src/Input/types.ts +69 -0
- package/src/Screen/Screen.native.tsx +41 -0
- package/src/Screen/Screen.styles.tsx +60 -0
- package/src/Screen/Screen.web.tsx +33 -0
- package/src/Screen/index.native.ts +2 -0
- package/src/Screen/index.ts +2 -0
- package/src/Screen/index.web.ts +2 -0
- package/src/Screen/types.ts +38 -0
- package/src/Text/Text.native.tsx +36 -0
- package/src/Text/Text.styles.tsx +67 -0
- package/src/Text/Text.web.tsx +41 -0
- package/src/Text/index.native.ts +3 -0
- package/src/Text/index.ts +5 -0
- package/src/Text/index.web.ts +3 -0
- package/src/Text/types.ts +39 -0
- package/src/View/View.native.tsx +56 -0
- package/src/View/View.styles.tsx +103 -0
- package/src/View/View.web.tsx +60 -0
- package/src/View/index.native.ts +3 -0
- package/src/View/index.ts +5 -0
- package/src/View/index.web.ts +3 -0
- package/src/View/types.ts +73 -0
- package/src/examples/AllExamples.tsx +72 -0
- package/src/examples/AvatarExamples.tsx +97 -0
- package/src/examples/BadgeExamples.tsx +200 -0
- package/src/examples/ButtonExamples.tsx +150 -0
- package/src/examples/CardExamples.tsx +176 -0
- package/src/examples/CheckboxExamples.tsx +217 -0
- package/src/examples/DividerExamples.tsx +218 -0
- package/src/examples/IconExamples.tsx +342 -0
- package/src/examples/InputExamples.tsx +134 -0
- package/src/examples/README.md +136 -0
- package/src/examples/ScreenExamples.tsx +154 -0
- package/src/examples/TextExamples.tsx +89 -0
- package/src/examples/ThemeExtensionExamples.tsx +91 -0
- package/src/examples/ValidationExamples.tsx +95 -0
- package/src/examples/ViewExamples.tsx +129 -0
- package/src/examples/extendedTheme.ts +331 -0
- package/src/examples/index.ts +15 -0
- package/src/index.native.ts +52 -0
- package/src/index.ts +48 -0
- package/src/theme/breakpoints.ts +8 -0
- package/src/theme/colorResolver.ts +218 -0
- package/src/theme/colors.ts +315 -0
- package/src/theme/defaultThemes.ts +326 -0
- package/src/theme/index.ts +188 -0
- package/src/theme/themeBuilder.ts +602 -0
- package/src/theme/unistyles.d.ts +6 -0
- package/src/theme/variantHelpers.ts +584 -0
- package/src/theme/variants.ts +56 -0
- package/src/unistyles.d.ts +108 -0
- package/src/unistyles.ts +43 -0
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { TouchableOpacity, Text } from 'react-native';
|
|
3
|
+
import { ButtonProps } from './types';
|
|
4
|
+
import { buttonStyles } from './Button.styles';
|
|
5
|
+
|
|
6
|
+
const Button: React.FC<ButtonProps> = ({
|
|
7
|
+
children,
|
|
8
|
+
title,
|
|
9
|
+
onPress,
|
|
10
|
+
disabled = false,
|
|
11
|
+
variant = 'contained',
|
|
12
|
+
intent = 'primary',
|
|
13
|
+
size = 'medium',
|
|
14
|
+
style,
|
|
15
|
+
testID,
|
|
16
|
+
}) => {
|
|
17
|
+
buttonStyles.useVariants({
|
|
18
|
+
size,
|
|
19
|
+
intent,
|
|
20
|
+
variant,
|
|
21
|
+
disabled,
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
<TouchableOpacity
|
|
26
|
+
onPress={onPress}
|
|
27
|
+
disabled={disabled}
|
|
28
|
+
testID={testID}
|
|
29
|
+
activeOpacity={0.7}
|
|
30
|
+
style={[buttonStyles.button, style]}
|
|
31
|
+
>
|
|
32
|
+
<Text style={buttonStyles.text}>
|
|
33
|
+
{children || title}
|
|
34
|
+
</Text>
|
|
35
|
+
</TouchableOpacity>
|
|
36
|
+
);
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export default Button;
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
import { StyleSheet } from 'react-native-unistyles';
|
|
2
|
+
import { generateIntentVariants, generateButtonCompoundVariants } from '../theme/variantHelpers';
|
|
3
|
+
|
|
4
|
+
export const buttonStyles = StyleSheet.create((theme) => ({
|
|
5
|
+
button: {
|
|
6
|
+
// Base styles - no borders defined here
|
|
7
|
+
alignItems: 'center',
|
|
8
|
+
justifyContent: 'center',
|
|
9
|
+
borderRadius: theme.borderRadius?.md || 8,
|
|
10
|
+
fontWeight: '600',
|
|
11
|
+
textAlign: 'center',
|
|
12
|
+
transition: 'all 0.2s ease',
|
|
13
|
+
// Set default color to prevent fallback to theme.colors.text.placeholder
|
|
14
|
+
color: theme.intents?.primary?.on || '#ffffff',
|
|
15
|
+
|
|
16
|
+
// All variants defined here
|
|
17
|
+
variants: {
|
|
18
|
+
size: {
|
|
19
|
+
small: {
|
|
20
|
+
paddingHorizontal: theme.spacing?.sm || 8,
|
|
21
|
+
paddingVertical: theme.spacing?.xs || 4,
|
|
22
|
+
minHeight: 24,
|
|
23
|
+
},
|
|
24
|
+
medium: {
|
|
25
|
+
paddingHorizontal: theme.spacing?.md || 12,
|
|
26
|
+
paddingVertical: theme.spacing?.sm || 8,
|
|
27
|
+
minHeight: 32,
|
|
28
|
+
},
|
|
29
|
+
large: {
|
|
30
|
+
paddingHorizontal: theme.spacing?.lg || 16,
|
|
31
|
+
paddingVertical: theme.spacing?.md || 12,
|
|
32
|
+
minHeight: 40,
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
// Dynamically generated intent variants
|
|
36
|
+
intent: generateIntentVariants(theme),
|
|
37
|
+
variant: {
|
|
38
|
+
contained: {
|
|
39
|
+
// Contained buttons have no border
|
|
40
|
+
border: 'none',
|
|
41
|
+
},
|
|
42
|
+
outlined: {
|
|
43
|
+
backgroundColor: 'transparent',
|
|
44
|
+
// Border is defined in compound variants
|
|
45
|
+
},
|
|
46
|
+
text: {
|
|
47
|
+
backgroundColor: 'transparent',
|
|
48
|
+
border: 'none',
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
disabled: {
|
|
52
|
+
true: {
|
|
53
|
+
opacity: 0.6,
|
|
54
|
+
},
|
|
55
|
+
false: {
|
|
56
|
+
opacity: 1,
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
|
|
61
|
+
// Dynamically generated compound variants for outlined and text variants
|
|
62
|
+
compoundVariants: generateButtonCompoundVariants(theme),
|
|
63
|
+
|
|
64
|
+
// Web-specific styles
|
|
65
|
+
_web: {
|
|
66
|
+
cursor: 'pointer',
|
|
67
|
+
outline: 'none',
|
|
68
|
+
display: 'flex',
|
|
69
|
+
boxSizing: 'border-box',
|
|
70
|
+
userSelect: 'none',
|
|
71
|
+
// Fix for Chromium-based browsers (Brave, Chrome) border rendering
|
|
72
|
+
WebkitAppearance: 'none',
|
|
73
|
+
MozAppearance: 'none',
|
|
74
|
+
appearance: 'none',
|
|
75
|
+
backfaceVisibility: 'hidden',
|
|
76
|
+
WebkitBackfaceVisibility: 'hidden',
|
|
77
|
+
transform: 'translateZ(0)', // Force hardware acceleration
|
|
78
|
+
_hover: {
|
|
79
|
+
opacity: 0.9,
|
|
80
|
+
},
|
|
81
|
+
_active: {
|
|
82
|
+
transform: 'scale(0.98) translateZ(0)', // Maintain hardware acceleration
|
|
83
|
+
},
|
|
84
|
+
_focus: {
|
|
85
|
+
outlineOffset: '2px',
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
|
|
90
|
+
// Separate text style for React Native (no borders, just text properties)
|
|
91
|
+
text: {
|
|
92
|
+
fontWeight: '600',
|
|
93
|
+
textAlign: 'center',
|
|
94
|
+
|
|
95
|
+
variants: {
|
|
96
|
+
size: {
|
|
97
|
+
small: {
|
|
98
|
+
fontSize: 14,
|
|
99
|
+
},
|
|
100
|
+
medium: {
|
|
101
|
+
fontSize: 16,
|
|
102
|
+
},
|
|
103
|
+
large: {
|
|
104
|
+
fontSize: 18,
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
intent: {
|
|
108
|
+
primary: {
|
|
109
|
+
color: theme.intents?.primary?.on || '#ffffff',
|
|
110
|
+
},
|
|
111
|
+
success: {
|
|
112
|
+
color: theme.intents?.success?.on || '#ffffff',
|
|
113
|
+
},
|
|
114
|
+
error: {
|
|
115
|
+
color: theme.intents?.error?.on || '#ffffff',
|
|
116
|
+
},
|
|
117
|
+
warning: {
|
|
118
|
+
color: theme.intents?.warning?.on || '#ffffff',
|
|
119
|
+
},
|
|
120
|
+
neutral: {
|
|
121
|
+
color: theme.intents?.neutral?.on || '#ffffff',
|
|
122
|
+
},
|
|
123
|
+
},
|
|
124
|
+
variant: {
|
|
125
|
+
contained: {},
|
|
126
|
+
outlined: {},
|
|
127
|
+
text: {},
|
|
128
|
+
},
|
|
129
|
+
disabled: {
|
|
130
|
+
true: {
|
|
131
|
+
opacity: 0.6,
|
|
132
|
+
},
|
|
133
|
+
false: {
|
|
134
|
+
opacity: 1,
|
|
135
|
+
},
|
|
136
|
+
},
|
|
137
|
+
},
|
|
138
|
+
|
|
139
|
+
// Compound variants for text colors in different variants
|
|
140
|
+
compoundVariants: [
|
|
141
|
+
// Outlined variant text colors
|
|
142
|
+
{
|
|
143
|
+
variant: 'outlined',
|
|
144
|
+
intent: 'primary',
|
|
145
|
+
styles: {
|
|
146
|
+
color: theme.intents?.primary?.main || '#3b82f6',
|
|
147
|
+
},
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
variant: 'outlined',
|
|
151
|
+
intent: 'success',
|
|
152
|
+
styles: {
|
|
153
|
+
color: theme.intents?.success?.main || '#22c55e',
|
|
154
|
+
},
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
variant: 'outlined',
|
|
158
|
+
intent: 'error',
|
|
159
|
+
styles: {
|
|
160
|
+
color: theme.intents?.error?.main || '#ef4444',
|
|
161
|
+
},
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
variant: 'outlined',
|
|
165
|
+
intent: 'warning',
|
|
166
|
+
styles: {
|
|
167
|
+
color: theme.intents?.warning?.main || '#f59e0b',
|
|
168
|
+
},
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
variant: 'outlined',
|
|
172
|
+
intent: 'neutral',
|
|
173
|
+
styles: {
|
|
174
|
+
color: theme.intents?.neutral?.main || '#6b7280',
|
|
175
|
+
},
|
|
176
|
+
},
|
|
177
|
+
// Text variant text colors
|
|
178
|
+
{
|
|
179
|
+
variant: 'text',
|
|
180
|
+
intent: 'primary',
|
|
181
|
+
styles: {
|
|
182
|
+
color: theme.intents?.primary?.main || '#3b82f6',
|
|
183
|
+
},
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
variant: 'text',
|
|
187
|
+
intent: 'success',
|
|
188
|
+
styles: {
|
|
189
|
+
color: theme.intents?.success?.main || '#22c55e',
|
|
190
|
+
},
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
variant: 'text',
|
|
194
|
+
intent: 'error',
|
|
195
|
+
styles: {
|
|
196
|
+
color: theme.intents?.error?.main || '#ef4444',
|
|
197
|
+
},
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
variant: 'text',
|
|
201
|
+
intent: 'warning',
|
|
202
|
+
styles: {
|
|
203
|
+
color: theme.intents?.warning?.main || '#f59e0b',
|
|
204
|
+
},
|
|
205
|
+
},
|
|
206
|
+
{
|
|
207
|
+
variant: 'text',
|
|
208
|
+
intent: 'neutral',
|
|
209
|
+
styles: {
|
|
210
|
+
color: theme.intents?.neutral?.main || '#6b7280',
|
|
211
|
+
},
|
|
212
|
+
},
|
|
213
|
+
],
|
|
214
|
+
},
|
|
215
|
+
}));
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { TouchableOpacityProps } from 'react-native';
|
|
2
|
+
import { IntentNames } from '../theme';
|
|
3
|
+
|
|
4
|
+
export interface ButtonProps extends Omit<TouchableOpacityProps, 'disabled'> {
|
|
5
|
+
title: string;
|
|
6
|
+
onPress: () => void;
|
|
7
|
+
variant?: 'contained' | 'outlined' | 'text';
|
|
8
|
+
intent?: IntentNames;
|
|
9
|
+
size?: 'small' | 'medium' | 'large';
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
loading?: boolean;
|
|
12
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { getWebProps } from 'react-native-unistyles/web';
|
|
3
|
+
import { ButtonProps } from './types';
|
|
4
|
+
import { buttonStyles } from './Button.styles';
|
|
5
|
+
|
|
6
|
+
const Button: React.FC<ButtonProps> = ({
|
|
7
|
+
title,
|
|
8
|
+
children,
|
|
9
|
+
onPress,
|
|
10
|
+
disabled = false,
|
|
11
|
+
variant = 'contained',
|
|
12
|
+
intent = 'primary',
|
|
13
|
+
size = 'medium',
|
|
14
|
+
style,
|
|
15
|
+
testID,
|
|
16
|
+
}) => {
|
|
17
|
+
const handleClick = () => {
|
|
18
|
+
if (!disabled && onPress) {
|
|
19
|
+
onPress();
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
// Apply variants using the correct Unistyles 3.0 pattern
|
|
24
|
+
buttonStyles.useVariants({
|
|
25
|
+
size: size as 'small' | 'medium' | 'large',
|
|
26
|
+
intent: intent as 'primary' | 'success' | 'error' | 'warning' | 'neutral',
|
|
27
|
+
variant: variant as 'contained' | 'outlined' | 'text',
|
|
28
|
+
disabled: disabled as boolean,
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
// Create the style array following the official documentation pattern
|
|
32
|
+
const buttonStyleArray = [
|
|
33
|
+
buttonStyles.button,
|
|
34
|
+
buttonStyles.text, // Include text styles for font sizing
|
|
35
|
+
style,
|
|
36
|
+
];
|
|
37
|
+
|
|
38
|
+
// Use getWebProps to generate className and ref for web
|
|
39
|
+
const webProps = getWebProps(buttonStyleArray);
|
|
40
|
+
|
|
41
|
+
// Use children if available, otherwise use title
|
|
42
|
+
const buttonContent = children || title;
|
|
43
|
+
|
|
44
|
+
return (
|
|
45
|
+
<button
|
|
46
|
+
{...webProps}
|
|
47
|
+
onClick={handleClick}
|
|
48
|
+
disabled={disabled}
|
|
49
|
+
data-testid={testID}
|
|
50
|
+
>
|
|
51
|
+
{buttonContent}
|
|
52
|
+
</button>
|
|
53
|
+
);
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
export default Button;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import type { IntentVariant } from '../theme/variants';
|
|
3
|
+
|
|
4
|
+
export interface ButtonProps {
|
|
5
|
+
/**
|
|
6
|
+
* The text or content to display inside the button
|
|
7
|
+
*/
|
|
8
|
+
children?: ReactNode;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* The text title to display inside the button (for web)
|
|
12
|
+
*/
|
|
13
|
+
title?: string;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Called when the button is pressed
|
|
17
|
+
*/
|
|
18
|
+
onPress?: () => void;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Whether the button is disabled
|
|
22
|
+
*/
|
|
23
|
+
disabled?: boolean;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* The visual style variant of the button
|
|
27
|
+
*/
|
|
28
|
+
variant?: 'contained' | 'outlined' | 'text';
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* The intent/color scheme of the button
|
|
32
|
+
*/
|
|
33
|
+
intent?: IntentVariant;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* The size of the button
|
|
37
|
+
*/
|
|
38
|
+
size?: 'small' | 'medium' | 'large';
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Additional styles (platform-specific)
|
|
42
|
+
*/
|
|
43
|
+
style?: any;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Test ID for testing
|
|
47
|
+
*/
|
|
48
|
+
testID?: string;
|
|
49
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { View, Pressable } from 'react-native';
|
|
3
|
+
import { CardProps } from './types';
|
|
4
|
+
import { cardStyles } from './Card.styles';
|
|
5
|
+
|
|
6
|
+
const Card: React.FC<CardProps> = ({
|
|
7
|
+
children,
|
|
8
|
+
variant = 'default',
|
|
9
|
+
padding = 'medium',
|
|
10
|
+
radius = 'medium',
|
|
11
|
+
intent = 'neutral',
|
|
12
|
+
clickable = false,
|
|
13
|
+
onPress,
|
|
14
|
+
disabled = false,
|
|
15
|
+
style,
|
|
16
|
+
testID,
|
|
17
|
+
accessibilityLabel,
|
|
18
|
+
}) => {
|
|
19
|
+
// Apply variants
|
|
20
|
+
cardStyles.useVariants({
|
|
21
|
+
variant: variant as any,
|
|
22
|
+
padding,
|
|
23
|
+
radius,
|
|
24
|
+
intent,
|
|
25
|
+
clickable,
|
|
26
|
+
disabled,
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
// Use appropriate component based on clickable state
|
|
30
|
+
const Component = clickable ? Pressable : View;
|
|
31
|
+
|
|
32
|
+
const componentProps = {
|
|
33
|
+
style: [cardStyles.card, style],
|
|
34
|
+
testID,
|
|
35
|
+
accessibilityLabel,
|
|
36
|
+
// Only use button role for clickable cards in React Native
|
|
37
|
+
...(clickable && { accessibilityRole: 'button' as const }),
|
|
38
|
+
...(clickable && {
|
|
39
|
+
onPress: disabled ? undefined : onPress,
|
|
40
|
+
disabled,
|
|
41
|
+
android_ripple: { color: 'rgba(0, 0, 0, 0.1)' },
|
|
42
|
+
}),
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
return (
|
|
46
|
+
<Component {...componentProps}>
|
|
47
|
+
{children}
|
|
48
|
+
</Component>
|
|
49
|
+
);
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export default Card;
|
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
import { StyleSheet } from 'react-native-unistyles';
|
|
2
|
+
|
|
3
|
+
export const cardStyles = StyleSheet.create((theme) => ({
|
|
4
|
+
card: {
|
|
5
|
+
backgroundColor: theme.colors?.surface?.primary || '#ffffff',
|
|
6
|
+
position: 'relative',
|
|
7
|
+
overflow: 'hidden',
|
|
8
|
+
|
|
9
|
+
variants: {
|
|
10
|
+
variant: {
|
|
11
|
+
default: {
|
|
12
|
+
backgroundColor: theme.colors?.surface?.primary || '#ffffff',
|
|
13
|
+
// React Native border properties
|
|
14
|
+
borderWidth: 1,
|
|
15
|
+
borderColor: theme.colors?.border?.primary || theme.palettes?.gray?.[200] || '#e5e7eb',
|
|
16
|
+
// Web-specific border override
|
|
17
|
+
_web: {
|
|
18
|
+
border: `1px solid ${theme.colors?.border?.primary || theme.palettes?.gray?.[200] || '#e5e7eb'}`,
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
outlined: {
|
|
22
|
+
backgroundColor: 'transparent',
|
|
23
|
+
// React Native border properties
|
|
24
|
+
borderWidth: 1,
|
|
25
|
+
borderColor: theme.colors?.border?.primary || theme.palettes?.gray?.[300] || '#d1d5db',
|
|
26
|
+
// Web-specific border override
|
|
27
|
+
_web: {
|
|
28
|
+
border: `1px solid ${theme.colors?.border?.primary || theme.palettes?.gray?.[300] || '#d1d5db'}`,
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
elevated: {
|
|
32
|
+
backgroundColor: theme.colors?.surface?.primary || '#ffffff',
|
|
33
|
+
borderWidth: 0,
|
|
34
|
+
_web: {
|
|
35
|
+
border: 'none',
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
filled: {
|
|
39
|
+
backgroundColor: theme.colors?.surface?.secondary || theme.palettes?.gray?.[50] || '#f9fafb',
|
|
40
|
+
borderWidth: 0,
|
|
41
|
+
_web: {
|
|
42
|
+
border: 'none',
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
padding: {
|
|
47
|
+
none: {
|
|
48
|
+
padding: 0,
|
|
49
|
+
},
|
|
50
|
+
small: {
|
|
51
|
+
padding: theme.spacing?.sm || 8,
|
|
52
|
+
},
|
|
53
|
+
medium: {
|
|
54
|
+
padding: theme.spacing?.md || 12,
|
|
55
|
+
},
|
|
56
|
+
large: {
|
|
57
|
+
padding: theme.spacing?.lg || 16,
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
radius: {
|
|
61
|
+
none: {
|
|
62
|
+
borderRadius: 0,
|
|
63
|
+
},
|
|
64
|
+
small: {
|
|
65
|
+
borderRadius: theme.borderRadius?.sm || 4,
|
|
66
|
+
},
|
|
67
|
+
medium: {
|
|
68
|
+
borderRadius: theme.borderRadius?.md || 8,
|
|
69
|
+
},
|
|
70
|
+
large: {
|
|
71
|
+
borderRadius: theme.borderRadius?.lg || 12,
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
intent: {
|
|
75
|
+
neutral: {
|
|
76
|
+
// Default colors handled by variant
|
|
77
|
+
},
|
|
78
|
+
primary: {
|
|
79
|
+
// Intent colors applied via compound variants
|
|
80
|
+
},
|
|
81
|
+
success: {
|
|
82
|
+
// Intent colors applied via compound variants
|
|
83
|
+
},
|
|
84
|
+
error: {
|
|
85
|
+
// Intent colors applied via compound variants
|
|
86
|
+
},
|
|
87
|
+
warning: {
|
|
88
|
+
// Intent colors applied via compound variants
|
|
89
|
+
},
|
|
90
|
+
info: {
|
|
91
|
+
// Intent colors applied via compound variants
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
clickable: {
|
|
95
|
+
true: {
|
|
96
|
+
cursor: 'pointer',
|
|
97
|
+
transition: 'all 0.2s ease',
|
|
98
|
+
},
|
|
99
|
+
false: {
|
|
100
|
+
cursor: 'default',
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
disabled: {
|
|
104
|
+
true: {
|
|
105
|
+
opacity: 0.6,
|
|
106
|
+
cursor: 'not-allowed',
|
|
107
|
+
},
|
|
108
|
+
false: {
|
|
109
|
+
opacity: 1,
|
|
110
|
+
},
|
|
111
|
+
},
|
|
112
|
+
},
|
|
113
|
+
|
|
114
|
+
compoundVariants: [
|
|
115
|
+
// Elevated variant with shadows
|
|
116
|
+
{
|
|
117
|
+
variant: 'elevated',
|
|
118
|
+
styles: {
|
|
119
|
+
shadowColor: theme.shadows?.md?.shadowColor || '#000',
|
|
120
|
+
shadowOffset: theme.shadows?.md?.shadowOffset || { width: 0, height: 4 },
|
|
121
|
+
shadowOpacity: theme.shadows?.md?.shadowOpacity || 0.1,
|
|
122
|
+
shadowRadius: theme.shadows?.md?.shadowRadius || 8,
|
|
123
|
+
elevation: theme.shadows?.md?.elevation || 4,
|
|
124
|
+
// More subtle shadow for web
|
|
125
|
+
_web: {
|
|
126
|
+
boxShadow: '0 2px 8px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04)',
|
|
127
|
+
},
|
|
128
|
+
},
|
|
129
|
+
},
|
|
130
|
+
// Intent color combinations for outlined variant
|
|
131
|
+
{
|
|
132
|
+
variant: 'outlined',
|
|
133
|
+
intent: 'primary',
|
|
134
|
+
styles: {
|
|
135
|
+
borderColor: theme.intents?.primary?.main || '#3b82f6',
|
|
136
|
+
_web: {
|
|
137
|
+
border: `1px solid ${theme.intents?.primary?.main || '#3b82f6'}`,
|
|
138
|
+
},
|
|
139
|
+
},
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
variant: 'outlined',
|
|
143
|
+
intent: 'success',
|
|
144
|
+
styles: {
|
|
145
|
+
borderColor: theme.intents?.success?.main || '#22c55e',
|
|
146
|
+
_web: {
|
|
147
|
+
border: `1px solid ${theme.intents?.success?.main || '#22c55e'}`,
|
|
148
|
+
},
|
|
149
|
+
},
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
variant: 'outlined',
|
|
153
|
+
intent: 'error',
|
|
154
|
+
styles: {
|
|
155
|
+
borderColor: theme.intents?.error?.main || '#ef4444',
|
|
156
|
+
_web: {
|
|
157
|
+
border: `1px solid ${theme.intents?.error?.main || '#ef4444'}`,
|
|
158
|
+
},
|
|
159
|
+
},
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
variant: 'outlined',
|
|
163
|
+
intent: 'warning',
|
|
164
|
+
styles: {
|
|
165
|
+
borderColor: theme.intents?.warning?.main || '#f59e0b',
|
|
166
|
+
_web: {
|
|
167
|
+
border: `1px solid ${theme.intents?.warning?.main || '#f59e0b'}`,
|
|
168
|
+
},
|
|
169
|
+
},
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
variant: 'outlined',
|
|
173
|
+
intent: 'info',
|
|
174
|
+
styles: {
|
|
175
|
+
borderColor: theme.intents?.info?.main || '#06b6d4',
|
|
176
|
+
_web: {
|
|
177
|
+
border: `1px solid ${theme.intents?.info?.main || '#06b6d4'}`,
|
|
178
|
+
},
|
|
179
|
+
},
|
|
180
|
+
},
|
|
181
|
+
// Intent color combinations for filled variant
|
|
182
|
+
{
|
|
183
|
+
variant: 'filled',
|
|
184
|
+
intent: 'primary',
|
|
185
|
+
styles: {
|
|
186
|
+
backgroundColor: theme.intents?.primary?.container || theme.palettes?.blue?.[50] || '#eff6ff',
|
|
187
|
+
},
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
variant: 'filled',
|
|
191
|
+
intent: 'success',
|
|
192
|
+
styles: {
|
|
193
|
+
backgroundColor: theme.intents?.success?.container || theme.palettes?.green?.[50] || '#f0fdf4',
|
|
194
|
+
},
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
variant: 'filled',
|
|
198
|
+
intent: 'error',
|
|
199
|
+
styles: {
|
|
200
|
+
backgroundColor: theme.intents?.error?.container || theme.palettes?.red?.[50] || '#fef2f2',
|
|
201
|
+
},
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
variant: 'filled',
|
|
205
|
+
intent: 'warning',
|
|
206
|
+
styles: {
|
|
207
|
+
backgroundColor: theme.intents?.warning?.container || theme.palettes?.amber?.[50] || '#fffbeb',
|
|
208
|
+
},
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
variant: 'filled',
|
|
212
|
+
intent: 'info',
|
|
213
|
+
styles: {
|
|
214
|
+
backgroundColor: theme.intents?.info?.container || theme.palettes?.cyan?.[50] || '#ecfeff',
|
|
215
|
+
},
|
|
216
|
+
},
|
|
217
|
+
],
|
|
218
|
+
|
|
219
|
+
_web: {
|
|
220
|
+
display: 'flex',
|
|
221
|
+
flexDirection: 'column',
|
|
222
|
+
boxSizing: 'border-box',
|
|
223
|
+
_hover: {
|
|
224
|
+
// Hover effects for clickable cards
|
|
225
|
+
},
|
|
226
|
+
},
|
|
227
|
+
},
|
|
228
|
+
}));
|
|
229
|
+
|
|
230
|
+
// Add hover effects for clickable cards
|
|
231
|
+
export const cardHoverStyles = StyleSheet.create((theme) => ({
|
|
232
|
+
clickableHover: {
|
|
233
|
+
_web: {
|
|
234
|
+
_hover: {
|
|
235
|
+
transform: 'translateY(-2px)',
|
|
236
|
+
boxShadow: '0 4px 12px rgba(0, 0, 0, 0.08), 0 2px 4px rgba(0, 0, 0, 0.06)',
|
|
237
|
+
},
|
|
238
|
+
},
|
|
239
|
+
},
|
|
240
|
+
}));
|