@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
|
@@ -1,67 +1,67 @@
|
|
|
1
|
-
import { StyleSheet } from 'react-native-unistyles';
|
|
2
|
-
|
|
3
|
-
export const avatarStyles = StyleSheet.create((theme) => ({
|
|
4
|
-
avatar: {
|
|
5
|
-
display: 'flex',
|
|
6
|
-
alignItems: 'center',
|
|
7
|
-
justifyContent: 'center',
|
|
8
|
-
backgroundColor: theme.colors?.surface?.secondary || '#f3f4f6',
|
|
9
|
-
overflow: 'hidden',
|
|
10
|
-
|
|
11
|
-
variants: {
|
|
12
|
-
size: {
|
|
13
|
-
small: {
|
|
14
|
-
width: 32,
|
|
15
|
-
height: 32,
|
|
16
|
-
},
|
|
17
|
-
medium: {
|
|
18
|
-
width: 40,
|
|
19
|
-
height: 40,
|
|
20
|
-
},
|
|
21
|
-
large: {
|
|
22
|
-
width: 48,
|
|
23
|
-
height: 48,
|
|
24
|
-
},
|
|
25
|
-
xlarge: {
|
|
26
|
-
width: 64,
|
|
27
|
-
height: 64,
|
|
28
|
-
},
|
|
29
|
-
},
|
|
30
|
-
shape: {
|
|
31
|
-
circle: {
|
|
32
|
-
borderRadius: 9999,
|
|
33
|
-
},
|
|
34
|
-
square: {
|
|
35
|
-
borderRadius: theme.borderRadius?.md || 8,
|
|
36
|
-
},
|
|
37
|
-
},
|
|
38
|
-
},
|
|
39
|
-
},
|
|
40
|
-
|
|
41
|
-
image: {
|
|
42
|
-
width: '100%',
|
|
43
|
-
height: '100%',
|
|
44
|
-
},
|
|
45
|
-
|
|
46
|
-
fallback: {
|
|
47
|
-
color: theme.colors?.text?.primary || '#374151',
|
|
48
|
-
fontWeight: '600',
|
|
49
|
-
|
|
50
|
-
variants: {
|
|
51
|
-
size: {
|
|
52
|
-
small: {
|
|
53
|
-
fontSize: 14,
|
|
54
|
-
},
|
|
55
|
-
medium: {
|
|
56
|
-
fontSize: 16,
|
|
57
|
-
},
|
|
58
|
-
large: {
|
|
59
|
-
fontSize: 18,
|
|
60
|
-
},
|
|
61
|
-
xlarge: {
|
|
62
|
-
fontSize: 24,
|
|
63
|
-
},
|
|
64
|
-
},
|
|
65
|
-
},
|
|
66
|
-
},
|
|
1
|
+
import { StyleSheet } from 'react-native-unistyles';
|
|
2
|
+
|
|
3
|
+
export const avatarStyles = StyleSheet.create((theme) => ({
|
|
4
|
+
avatar: {
|
|
5
|
+
display: 'flex',
|
|
6
|
+
alignItems: 'center',
|
|
7
|
+
justifyContent: 'center',
|
|
8
|
+
backgroundColor: theme.colors?.surface?.secondary || '#f3f4f6',
|
|
9
|
+
overflow: 'hidden',
|
|
10
|
+
|
|
11
|
+
variants: {
|
|
12
|
+
size: {
|
|
13
|
+
small: {
|
|
14
|
+
width: 32,
|
|
15
|
+
height: 32,
|
|
16
|
+
},
|
|
17
|
+
medium: {
|
|
18
|
+
width: 40,
|
|
19
|
+
height: 40,
|
|
20
|
+
},
|
|
21
|
+
large: {
|
|
22
|
+
width: 48,
|
|
23
|
+
height: 48,
|
|
24
|
+
},
|
|
25
|
+
xlarge: {
|
|
26
|
+
width: 64,
|
|
27
|
+
height: 64,
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
shape: {
|
|
31
|
+
circle: {
|
|
32
|
+
borderRadius: 9999,
|
|
33
|
+
},
|
|
34
|
+
square: {
|
|
35
|
+
borderRadius: theme.borderRadius?.md || 8,
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
|
|
41
|
+
image: {
|
|
42
|
+
width: '100%',
|
|
43
|
+
height: '100%',
|
|
44
|
+
},
|
|
45
|
+
|
|
46
|
+
fallback: {
|
|
47
|
+
color: theme.colors?.text?.primary || '#374151',
|
|
48
|
+
fontWeight: '600',
|
|
49
|
+
|
|
50
|
+
variants: {
|
|
51
|
+
size: {
|
|
52
|
+
small: {
|
|
53
|
+
fontSize: 14,
|
|
54
|
+
},
|
|
55
|
+
medium: {
|
|
56
|
+
fontSize: 16,
|
|
57
|
+
},
|
|
58
|
+
large: {
|
|
59
|
+
fontSize: 18,
|
|
60
|
+
},
|
|
61
|
+
xlarge: {
|
|
62
|
+
fontSize: 24,
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
67
|
}));
|
|
@@ -1,51 +1,51 @@
|
|
|
1
|
-
import React, { useState } from 'react';
|
|
2
|
-
import { getWebProps } from 'react-native-unistyles/web';
|
|
3
|
-
import { AvatarProps } from './types';
|
|
4
|
-
import { avatarStyles } from './Avatar.styles';
|
|
5
|
-
|
|
6
|
-
const Avatar: React.FC<AvatarProps> = ({
|
|
7
|
-
src,
|
|
8
|
-
alt,
|
|
9
|
-
fallback,
|
|
10
|
-
size = 'medium',
|
|
11
|
-
shape = 'circle',
|
|
12
|
-
style,
|
|
13
|
-
testID,
|
|
14
|
-
}) => {
|
|
15
|
-
const [hasError, setHasError] = useState(false);
|
|
16
|
-
|
|
17
|
-
avatarStyles.useVariants({
|
|
18
|
-
size,
|
|
19
|
-
shape,
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
const avatarStyleArray = [avatarStyles.avatar, style];
|
|
23
|
-
const avatarProps = getWebProps(avatarStyleArray);
|
|
24
|
-
|
|
25
|
-
// Generate fallback text styles with proper theming and size
|
|
26
|
-
const fallbackStyleArray = [avatarStyles.fallback];
|
|
27
|
-
const fallbackProps = getWebProps(fallbackStyleArray);
|
|
28
|
-
|
|
29
|
-
const handleImageError = () => {
|
|
30
|
-
setHasError(true);
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
return (
|
|
34
|
-
<div {...avatarProps} data-testid={testID}>
|
|
35
|
-
{src && !hasError ? (
|
|
36
|
-
<img
|
|
37
|
-
src={src}
|
|
38
|
-
alt={alt}
|
|
39
|
-
onError={handleImageError}
|
|
40
|
-
style={{ width: '100%', height: '100%', objectFit: 'cover' }}
|
|
41
|
-
/>
|
|
42
|
-
) : (
|
|
43
|
-
<span {...fallbackProps}>
|
|
44
|
-
{fallback}
|
|
45
|
-
</span>
|
|
46
|
-
)}
|
|
47
|
-
</div>
|
|
48
|
-
);
|
|
49
|
-
};
|
|
50
|
-
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { getWebProps } from 'react-native-unistyles/web';
|
|
3
|
+
import { AvatarProps } from './types';
|
|
4
|
+
import { avatarStyles } from './Avatar.styles';
|
|
5
|
+
|
|
6
|
+
const Avatar: React.FC<AvatarProps> = ({
|
|
7
|
+
src,
|
|
8
|
+
alt,
|
|
9
|
+
fallback,
|
|
10
|
+
size = 'medium',
|
|
11
|
+
shape = 'circle',
|
|
12
|
+
style,
|
|
13
|
+
testID,
|
|
14
|
+
}) => {
|
|
15
|
+
const [hasError, setHasError] = useState(false);
|
|
16
|
+
|
|
17
|
+
avatarStyles.useVariants({
|
|
18
|
+
size,
|
|
19
|
+
shape,
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
const avatarStyleArray = [avatarStyles.avatar, style];
|
|
23
|
+
const avatarProps = getWebProps(avatarStyleArray);
|
|
24
|
+
|
|
25
|
+
// Generate fallback text styles with proper theming and size
|
|
26
|
+
const fallbackStyleArray = [avatarStyles.fallback];
|
|
27
|
+
const fallbackProps = getWebProps(fallbackStyleArray);
|
|
28
|
+
|
|
29
|
+
const handleImageError = () => {
|
|
30
|
+
setHasError(true);
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
return (
|
|
34
|
+
<div {...avatarProps} data-testid={testID}>
|
|
35
|
+
{src && !hasError ? (
|
|
36
|
+
<img
|
|
37
|
+
src={src}
|
|
38
|
+
alt={alt}
|
|
39
|
+
onError={handleImageError}
|
|
40
|
+
style={{ width: '100%', height: '100%', objectFit: 'cover' }}
|
|
41
|
+
/>
|
|
42
|
+
) : (
|
|
43
|
+
<span {...fallbackProps}>
|
|
44
|
+
{fallback}
|
|
45
|
+
</span>
|
|
46
|
+
)}
|
|
47
|
+
</div>
|
|
48
|
+
);
|
|
49
|
+
};
|
|
50
|
+
|
|
51
51
|
export default Avatar;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { default } from './Avatar.native';
|
|
1
|
+
export { default } from './Avatar.native';
|
|
2
2
|
export * from './types';
|
package/src/Avatar/index.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { default } from './Avatar.web';
|
|
1
|
+
export { default } from './Avatar.web';
|
|
2
2
|
export * from './types';
|
package/src/Avatar/index.web.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { default } from './Avatar.web';
|
|
1
|
+
export { default } from './Avatar.web';
|
|
2
2
|
export * from './types';
|
package/src/Avatar/types.ts
CHANGED
|
@@ -1,43 +1,43 @@
|
|
|
1
|
-
import type { ColorVariant } from '../theme/variants';
|
|
2
|
-
|
|
3
|
-
export interface AvatarProps {
|
|
4
|
-
/**
|
|
5
|
-
* Image source (URL or require())
|
|
6
|
-
*/
|
|
7
|
-
src?: string | any;
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Alt text for the image
|
|
11
|
-
*/
|
|
12
|
-
alt?: string;
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Fallback text (usually initials)
|
|
16
|
-
*/
|
|
17
|
-
fallback?: string;
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Size of the avatar
|
|
21
|
-
*/
|
|
22
|
-
size?: 'small' | 'medium' | 'large' | 'xlarge';
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Shape of the avatar
|
|
26
|
-
*/
|
|
27
|
-
shape?: 'circle' | 'square';
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* The color scheme of the avatar (for background when no image)
|
|
31
|
-
*/
|
|
32
|
-
color?: ColorVariant;
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Additional styles
|
|
36
|
-
*/
|
|
37
|
-
style?: any;
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* Test ID for testing
|
|
41
|
-
*/
|
|
42
|
-
testID?: string;
|
|
1
|
+
import type { ColorVariant } from '../theme/variants';
|
|
2
|
+
|
|
3
|
+
export interface AvatarProps {
|
|
4
|
+
/**
|
|
5
|
+
* Image source (URL or require())
|
|
6
|
+
*/
|
|
7
|
+
src?: string | any;
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Alt text for the image
|
|
11
|
+
*/
|
|
12
|
+
alt?: string;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Fallback text (usually initials)
|
|
16
|
+
*/
|
|
17
|
+
fallback?: string;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Size of the avatar
|
|
21
|
+
*/
|
|
22
|
+
size?: 'small' | 'medium' | 'large' | 'xlarge';
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Shape of the avatar
|
|
26
|
+
*/
|
|
27
|
+
shape?: 'circle' | 'square';
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* The color scheme of the avatar (for background when no image)
|
|
31
|
+
*/
|
|
32
|
+
color?: ColorVariant;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Additional styles
|
|
36
|
+
*/
|
|
37
|
+
style?: any;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Test ID for testing
|
|
41
|
+
*/
|
|
42
|
+
testID?: string;
|
|
43
43
|
}
|
|
@@ -1,43 +1,43 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { View, Text } from 'react-native';
|
|
3
|
-
import { BadgeProps } from './types';
|
|
4
|
-
import { badgeStyles } from './Badge.styles';
|
|
5
|
-
|
|
6
|
-
const Badge: React.FC<BadgeProps> = ({
|
|
7
|
-
children,
|
|
8
|
-
size = 'medium',
|
|
9
|
-
variant = 'filled',
|
|
10
|
-
color = 'blue',
|
|
11
|
-
style,
|
|
12
|
-
testID,
|
|
13
|
-
}) => {
|
|
14
|
-
badgeStyles.useVariants({
|
|
15
|
-
size,
|
|
16
|
-
variant: variant as any,
|
|
17
|
-
color,
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
if (variant === 'dot') {
|
|
21
|
-
return (
|
|
22
|
-
<View
|
|
23
|
-
style={[badgeStyles.badge, style]}
|
|
24
|
-
testID={testID}
|
|
25
|
-
accessibilityLabel="status indicator"
|
|
26
|
-
/>
|
|
27
|
-
);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
return (
|
|
31
|
-
<View
|
|
32
|
-
style={[badgeStyles.badge, style]}
|
|
33
|
-
testID={testID}
|
|
34
|
-
accessibilityLabel="badge"
|
|
35
|
-
>
|
|
36
|
-
<Text style={badgeStyles.text}>
|
|
37
|
-
{children}
|
|
38
|
-
</Text>
|
|
39
|
-
</View>
|
|
40
|
-
);
|
|
41
|
-
};
|
|
42
|
-
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { View, Text } from 'react-native';
|
|
3
|
+
import { BadgeProps } from './types';
|
|
4
|
+
import { badgeStyles } from './Badge.styles';
|
|
5
|
+
|
|
6
|
+
const Badge: React.FC<BadgeProps> = ({
|
|
7
|
+
children,
|
|
8
|
+
size = 'medium',
|
|
9
|
+
variant = 'filled',
|
|
10
|
+
color = 'blue',
|
|
11
|
+
style,
|
|
12
|
+
testID,
|
|
13
|
+
}) => {
|
|
14
|
+
badgeStyles.useVariants({
|
|
15
|
+
size,
|
|
16
|
+
variant: variant as any,
|
|
17
|
+
color,
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
if (variant === 'dot') {
|
|
21
|
+
return (
|
|
22
|
+
<View
|
|
23
|
+
style={[badgeStyles.badge, style]}
|
|
24
|
+
testID={testID}
|
|
25
|
+
accessibilityLabel="status indicator"
|
|
26
|
+
/>
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return (
|
|
31
|
+
<View
|
|
32
|
+
style={[badgeStyles.badge, style]}
|
|
33
|
+
testID={testID}
|
|
34
|
+
accessibilityLabel="badge"
|
|
35
|
+
>
|
|
36
|
+
<Text style={badgeStyles.text}>
|
|
37
|
+
{children}
|
|
38
|
+
</Text>
|
|
39
|
+
</View>
|
|
40
|
+
);
|
|
41
|
+
};
|
|
42
|
+
|
|
43
43
|
export default Badge;
|