@idealyst/components 1.0.24 → 1.0.25
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,154 +1,154 @@
|
|
|
1
|
-
import { StyleSheet } from 'react-native-unistyles';
|
|
2
|
-
import { generateBadgeCompoundVariants } from '../theme/variantHelpers';
|
|
3
|
-
|
|
4
|
-
export const badgeStyles = StyleSheet.create((theme) => ({
|
|
5
|
-
badge: {
|
|
6
|
-
alignItems: 'center',
|
|
7
|
-
justifyContent: 'center',
|
|
8
|
-
borderRadius: 9999,
|
|
9
|
-
|
|
10
|
-
// Web-specific styles for better text centering
|
|
11
|
-
_web: {
|
|
12
|
-
display: 'flex',
|
|
13
|
-
alignItems: 'center',
|
|
14
|
-
justifyContent: 'center',
|
|
15
|
-
boxSizing: 'border-box',
|
|
16
|
-
// Text styles for web (since text is rendered directly in the container)
|
|
17
|
-
fontSize: 12, // Default medium size
|
|
18
|
-
fontWeight: '600',
|
|
19
|
-
color: '#ffffff',
|
|
20
|
-
lineHeight: 1, // Use ratio instead of fixed value for better centering
|
|
21
|
-
},
|
|
22
|
-
|
|
23
|
-
variants: {
|
|
24
|
-
size: {
|
|
25
|
-
small: {
|
|
26
|
-
minWidth: 16,
|
|
27
|
-
height: 16,
|
|
28
|
-
paddingHorizontal: 4,
|
|
29
|
-
},
|
|
30
|
-
medium: {
|
|
31
|
-
minWidth: 20,
|
|
32
|
-
height: 20,
|
|
33
|
-
paddingHorizontal: 6,
|
|
34
|
-
},
|
|
35
|
-
large: {
|
|
36
|
-
minWidth: 24,
|
|
37
|
-
height: 24,
|
|
38
|
-
paddingHorizontal: 8,
|
|
39
|
-
},
|
|
40
|
-
},
|
|
41
|
-
variant: {
|
|
42
|
-
filled: {
|
|
43
|
-
// Colors handled by compound variants
|
|
44
|
-
},
|
|
45
|
-
outlined: {
|
|
46
|
-
backgroundColor: 'transparent',
|
|
47
|
-
borderWidth: 1,
|
|
48
|
-
},
|
|
49
|
-
dot: {
|
|
50
|
-
minWidth: 8,
|
|
51
|
-
width: 8,
|
|
52
|
-
height: 8,
|
|
53
|
-
paddingHorizontal: 0, // Override size variant padding
|
|
54
|
-
paddingVertical: 0,
|
|
55
|
-
},
|
|
56
|
-
},
|
|
57
|
-
// Dynamically generated color variants (placeholder - actual styling in compound variants)
|
|
58
|
-
color: Object.fromEntries([
|
|
59
|
-
// All palette colors including shade-specific variants
|
|
60
|
-
...(theme.palettes ? Object.entries(theme.palettes).flatMap(([colorKey, palette]) => [
|
|
61
|
-
// Base color
|
|
62
|
-
[colorKey, {}],
|
|
63
|
-
// All shade variants
|
|
64
|
-
...Object.keys(palette).map((shade) => [`${colorKey}.${shade}`, {}])
|
|
65
|
-
]) : [
|
|
66
|
-
// Fallback base colors
|
|
67
|
-
['blue', {}], ['green', {}], ['red', {}], ['amber', {}],
|
|
68
|
-
['gray', {}], ['purple', {}], ['pink', {}], ['cyan', {}]
|
|
69
|
-
]),
|
|
70
|
-
// Semantic colors
|
|
71
|
-
['primary', {}],
|
|
72
|
-
['secondary', {}],
|
|
73
|
-
['disabled', {}],
|
|
74
|
-
['inverse', {}],
|
|
75
|
-
['muted', {}],
|
|
76
|
-
]),
|
|
77
|
-
},
|
|
78
|
-
|
|
79
|
-
// Dynamically generated compound variants plus static size variants
|
|
80
|
-
compoundVariants: [
|
|
81
|
-
...generateBadgeCompoundVariants(theme),
|
|
82
|
-
// Web-specific text size variants
|
|
83
|
-
{
|
|
84
|
-
size: 'small',
|
|
85
|
-
styles: {
|
|
86
|
-
_web: {
|
|
87
|
-
fontSize: 10,
|
|
88
|
-
},
|
|
89
|
-
},
|
|
90
|
-
},
|
|
91
|
-
{
|
|
92
|
-
size: 'medium',
|
|
93
|
-
styles: {
|
|
94
|
-
_web: {
|
|
95
|
-
fontSize: 12,
|
|
96
|
-
},
|
|
97
|
-
},
|
|
98
|
-
},
|
|
99
|
-
{
|
|
100
|
-
size: 'large',
|
|
101
|
-
styles: {
|
|
102
|
-
_web: {
|
|
103
|
-
fontSize: 14,
|
|
104
|
-
},
|
|
105
|
-
},
|
|
106
|
-
},
|
|
107
|
-
],
|
|
108
|
-
},
|
|
109
|
-
|
|
110
|
-
text: {
|
|
111
|
-
color: '#ffffff',
|
|
112
|
-
fontWeight: '600',
|
|
113
|
-
textAlign: 'center',
|
|
114
|
-
|
|
115
|
-
variants: {
|
|
116
|
-
size: {
|
|
117
|
-
small: {
|
|
118
|
-
fontSize: 10,
|
|
119
|
-
lineHeight: 12, // Tight line height for better vertical centering
|
|
120
|
-
},
|
|
121
|
-
medium: {
|
|
122
|
-
fontSize: 12,
|
|
123
|
-
lineHeight: 14,
|
|
124
|
-
},
|
|
125
|
-
large: {
|
|
126
|
-
fontSize: 14,
|
|
127
|
-
lineHeight: 16,
|
|
128
|
-
},
|
|
129
|
-
},
|
|
130
|
-
variant: {
|
|
131
|
-
filled: {
|
|
132
|
-
color: '#ffffff',
|
|
133
|
-
},
|
|
134
|
-
outlined: {
|
|
135
|
-
// Colors handled by compound variants
|
|
136
|
-
},
|
|
137
|
-
dot: {
|
|
138
|
-
// No text for dot variant
|
|
139
|
-
},
|
|
140
|
-
},
|
|
141
|
-
},
|
|
142
|
-
|
|
143
|
-
compoundVariants: [
|
|
144
|
-
// Outlined variant text colors - dynamically generated
|
|
145
|
-
...Object.entries(theme.palettes || {}).map(([colorKey, palette]: [string, any]) => ({
|
|
146
|
-
variant: 'outlined',
|
|
147
|
-
color: colorKey,
|
|
148
|
-
styles: {
|
|
149
|
-
color: palette?.[500] || '#6b7280',
|
|
150
|
-
},
|
|
151
|
-
})),
|
|
152
|
-
],
|
|
153
|
-
},
|
|
1
|
+
import { StyleSheet } from 'react-native-unistyles';
|
|
2
|
+
import { generateBadgeCompoundVariants } from '../theme/variantHelpers';
|
|
3
|
+
|
|
4
|
+
export const badgeStyles = StyleSheet.create((theme) => ({
|
|
5
|
+
badge: {
|
|
6
|
+
alignItems: 'center',
|
|
7
|
+
justifyContent: 'center',
|
|
8
|
+
borderRadius: 9999,
|
|
9
|
+
|
|
10
|
+
// Web-specific styles for better text centering
|
|
11
|
+
_web: {
|
|
12
|
+
display: 'flex',
|
|
13
|
+
alignItems: 'center',
|
|
14
|
+
justifyContent: 'center',
|
|
15
|
+
boxSizing: 'border-box',
|
|
16
|
+
// Text styles for web (since text is rendered directly in the container)
|
|
17
|
+
fontSize: 12, // Default medium size
|
|
18
|
+
fontWeight: '600',
|
|
19
|
+
color: '#ffffff',
|
|
20
|
+
lineHeight: 1, // Use ratio instead of fixed value for better centering
|
|
21
|
+
},
|
|
22
|
+
|
|
23
|
+
variants: {
|
|
24
|
+
size: {
|
|
25
|
+
small: {
|
|
26
|
+
minWidth: 16,
|
|
27
|
+
height: 16,
|
|
28
|
+
paddingHorizontal: 4,
|
|
29
|
+
},
|
|
30
|
+
medium: {
|
|
31
|
+
minWidth: 20,
|
|
32
|
+
height: 20,
|
|
33
|
+
paddingHorizontal: 6,
|
|
34
|
+
},
|
|
35
|
+
large: {
|
|
36
|
+
minWidth: 24,
|
|
37
|
+
height: 24,
|
|
38
|
+
paddingHorizontal: 8,
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
variant: {
|
|
42
|
+
filled: {
|
|
43
|
+
// Colors handled by compound variants
|
|
44
|
+
},
|
|
45
|
+
outlined: {
|
|
46
|
+
backgroundColor: 'transparent',
|
|
47
|
+
borderWidth: 1,
|
|
48
|
+
},
|
|
49
|
+
dot: {
|
|
50
|
+
minWidth: 8,
|
|
51
|
+
width: 8,
|
|
52
|
+
height: 8,
|
|
53
|
+
paddingHorizontal: 0, // Override size variant padding
|
|
54
|
+
paddingVertical: 0,
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
// Dynamically generated color variants (placeholder - actual styling in compound variants)
|
|
58
|
+
color: Object.fromEntries([
|
|
59
|
+
// All palette colors including shade-specific variants
|
|
60
|
+
...(theme.palettes ? Object.entries(theme.palettes).flatMap(([colorKey, palette]) => [
|
|
61
|
+
// Base color
|
|
62
|
+
[colorKey, {}],
|
|
63
|
+
// All shade variants
|
|
64
|
+
...Object.keys(palette).map((shade) => [`${colorKey}.${shade}`, {}])
|
|
65
|
+
]) : [
|
|
66
|
+
// Fallback base colors
|
|
67
|
+
['blue', {}], ['green', {}], ['red', {}], ['amber', {}],
|
|
68
|
+
['gray', {}], ['purple', {}], ['pink', {}], ['cyan', {}]
|
|
69
|
+
]),
|
|
70
|
+
// Semantic colors
|
|
71
|
+
['primary', {}],
|
|
72
|
+
['secondary', {}],
|
|
73
|
+
['disabled', {}],
|
|
74
|
+
['inverse', {}],
|
|
75
|
+
['muted', {}],
|
|
76
|
+
]),
|
|
77
|
+
},
|
|
78
|
+
|
|
79
|
+
// Dynamically generated compound variants plus static size variants
|
|
80
|
+
compoundVariants: [
|
|
81
|
+
...generateBadgeCompoundVariants(theme),
|
|
82
|
+
// Web-specific text size variants
|
|
83
|
+
{
|
|
84
|
+
size: 'small',
|
|
85
|
+
styles: {
|
|
86
|
+
_web: {
|
|
87
|
+
fontSize: 10,
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
size: 'medium',
|
|
93
|
+
styles: {
|
|
94
|
+
_web: {
|
|
95
|
+
fontSize: 12,
|
|
96
|
+
},
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
size: 'large',
|
|
101
|
+
styles: {
|
|
102
|
+
_web: {
|
|
103
|
+
fontSize: 14,
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
],
|
|
108
|
+
},
|
|
109
|
+
|
|
110
|
+
text: {
|
|
111
|
+
color: '#ffffff',
|
|
112
|
+
fontWeight: '600',
|
|
113
|
+
textAlign: 'center',
|
|
114
|
+
|
|
115
|
+
variants: {
|
|
116
|
+
size: {
|
|
117
|
+
small: {
|
|
118
|
+
fontSize: 10,
|
|
119
|
+
lineHeight: 12, // Tight line height for better vertical centering
|
|
120
|
+
},
|
|
121
|
+
medium: {
|
|
122
|
+
fontSize: 12,
|
|
123
|
+
lineHeight: 14,
|
|
124
|
+
},
|
|
125
|
+
large: {
|
|
126
|
+
fontSize: 14,
|
|
127
|
+
lineHeight: 16,
|
|
128
|
+
},
|
|
129
|
+
},
|
|
130
|
+
variant: {
|
|
131
|
+
filled: {
|
|
132
|
+
color: '#ffffff',
|
|
133
|
+
},
|
|
134
|
+
outlined: {
|
|
135
|
+
// Colors handled by compound variants
|
|
136
|
+
},
|
|
137
|
+
dot: {
|
|
138
|
+
// No text for dot variant
|
|
139
|
+
},
|
|
140
|
+
},
|
|
141
|
+
},
|
|
142
|
+
|
|
143
|
+
compoundVariants: [
|
|
144
|
+
// Outlined variant text colors - dynamically generated
|
|
145
|
+
...Object.entries(theme.palettes || {}).map(([colorKey, palette]: [string, any]) => ({
|
|
146
|
+
variant: 'outlined',
|
|
147
|
+
color: colorKey,
|
|
148
|
+
styles: {
|
|
149
|
+
color: palette?.[500] || '#6b7280',
|
|
150
|
+
},
|
|
151
|
+
})),
|
|
152
|
+
],
|
|
153
|
+
},
|
|
154
154
|
}));
|
package/src/Badge/Badge.web.tsx
CHANGED
|
@@ -1,45 +1,45 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { getWebProps } from 'react-native-unistyles/web';
|
|
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
|
-
const badgeStyleArray = [badgeStyles.badge, style];
|
|
21
|
-
const badgeProps = getWebProps(badgeStyleArray);
|
|
22
|
-
|
|
23
|
-
if (variant === 'dot') {
|
|
24
|
-
return (
|
|
25
|
-
<span
|
|
26
|
-
{...badgeProps}
|
|
27
|
-
data-testid={testID}
|
|
28
|
-
role="status"
|
|
29
|
-
aria-label="status indicator"
|
|
30
|
-
/>
|
|
31
|
-
);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
return (
|
|
35
|
-
<span
|
|
36
|
-
{...badgeProps}
|
|
37
|
-
data-testid={testID}
|
|
38
|
-
role="status"
|
|
39
|
-
>
|
|
40
|
-
{children}
|
|
41
|
-
</span>
|
|
42
|
-
);
|
|
43
|
-
};
|
|
44
|
-
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { getWebProps } from 'react-native-unistyles/web';
|
|
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
|
+
const badgeStyleArray = [badgeStyles.badge, style];
|
|
21
|
+
const badgeProps = getWebProps(badgeStyleArray);
|
|
22
|
+
|
|
23
|
+
if (variant === 'dot') {
|
|
24
|
+
return (
|
|
25
|
+
<span
|
|
26
|
+
{...badgeProps}
|
|
27
|
+
data-testid={testID}
|
|
28
|
+
role="status"
|
|
29
|
+
aria-label="status indicator"
|
|
30
|
+
/>
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return (
|
|
35
|
+
<span
|
|
36
|
+
{...badgeProps}
|
|
37
|
+
data-testid={testID}
|
|
38
|
+
role="status"
|
|
39
|
+
>
|
|
40
|
+
{children}
|
|
41
|
+
</span>
|
|
42
|
+
);
|
|
43
|
+
};
|
|
44
|
+
|
|
45
45
|
export default Badge;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { default } from './Badge.native';
|
|
1
|
+
export { default } from './Badge.native';
|
|
2
2
|
export * from './types';
|
package/src/Badge/index.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { default } from './Badge.web';
|
|
1
|
+
export { default } from './Badge.web';
|
|
2
2
|
export * from './types';
|
package/src/Badge/index.web.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { default } from './Badge.web';
|
|
1
|
+
export { default } from './Badge.web';
|
|
2
2
|
export * from './types';
|
package/src/Badge/types.ts
CHANGED
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
2
|
-
import type { DisplayColorVariant } from '../theme/variants';
|
|
3
|
-
|
|
4
|
-
export interface BadgeProps {
|
|
5
|
-
/**
|
|
6
|
-
* The content to display inside the badge
|
|
7
|
-
*/
|
|
8
|
-
children?: ReactNode;
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* The size of the badge
|
|
12
|
-
*/
|
|
13
|
-
size?: 'small' | 'medium' | 'large';
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* The visual style variant of the badge
|
|
17
|
-
*/
|
|
18
|
-
variant?: 'filled' | 'outlined' | 'dot';
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* The color scheme of the badge
|
|
22
|
-
*/
|
|
23
|
-
color?: DisplayColorVariant;
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Additional styles
|
|
27
|
-
*/
|
|
28
|
-
style?: any;
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Test ID for testing
|
|
32
|
-
*/
|
|
33
|
-
testID?: string;
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import type { DisplayColorVariant } from '../theme/variants';
|
|
3
|
+
|
|
4
|
+
export interface BadgeProps {
|
|
5
|
+
/**
|
|
6
|
+
* The content to display inside the badge
|
|
7
|
+
*/
|
|
8
|
+
children?: ReactNode;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* The size of the badge
|
|
12
|
+
*/
|
|
13
|
+
size?: 'small' | 'medium' | 'large';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* The visual style variant of the badge
|
|
17
|
+
*/
|
|
18
|
+
variant?: 'filled' | 'outlined' | 'dot';
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* The color scheme of the badge
|
|
22
|
+
*/
|
|
23
|
+
color?: DisplayColorVariant;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Additional styles
|
|
27
|
+
*/
|
|
28
|
+
style?: any;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Test ID for testing
|
|
32
|
+
*/
|
|
33
|
+
testID?: string;
|
|
34
34
|
}
|
|
@@ -1,39 +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
|
-
|
|
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
39
|
export default Button;
|