@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,91 +1,91 @@
|
|
|
1
|
-
import React, { useEffect } from 'react';
|
|
2
|
-
import { Screen, View, Button, Text, Badge, Card, Input, Checkbox } from '../index';
|
|
3
|
-
|
|
4
|
-
export const ThemeExtensionExamples = () => {
|
|
5
|
-
return (
|
|
6
|
-
<Screen background="primary" padding="lg">
|
|
7
|
-
<View spacing="lg">
|
|
8
|
-
<Text size="large" weight="bold" align="center">
|
|
9
|
-
Extended Theme Test
|
|
10
|
-
</Text>
|
|
11
|
-
|
|
12
|
-
{/* Extended Colors */}
|
|
13
|
-
<View spacing="md">
|
|
14
|
-
<Text size="medium" weight="semibold">Extended Colors</Text>
|
|
15
|
-
<View style={{ flexDirection: 'row', gap: 8, flexWrap: 'wrap' }}>
|
|
16
|
-
<Badge color={"orange" as any}>Orange</Badge>
|
|
17
|
-
<Badge color={"teal" as any}>Teal</Badge>
|
|
18
|
-
<Badge color={"indigo" as any}>Indigo</Badge>
|
|
19
|
-
<Badge color={"violet" as any}>Violet</Badge>
|
|
20
|
-
<Badge color={"emerald" as any}>Emerald</Badge>
|
|
21
|
-
</View>
|
|
22
|
-
|
|
23
|
-
<View style={{ flexDirection: 'row', gap: 8, flexWrap: 'wrap' }}>
|
|
24
|
-
<Text color={"orange" as any}>Orange Text</Text>
|
|
25
|
-
<Text color={"teal" as any}>Teal Text</Text>
|
|
26
|
-
<Text color={"indigo" as any}>Indigo Text</Text>
|
|
27
|
-
<Text color={"violet" as any}>Violet Text</Text>
|
|
28
|
-
<Text color={"emerald" as any}>Emerald Text</Text>
|
|
29
|
-
</View>
|
|
30
|
-
</View>
|
|
31
|
-
|
|
32
|
-
{/* Extended Intents */}
|
|
33
|
-
<View spacing="md">
|
|
34
|
-
<Text size="medium" weight="semibold">Extended Intents</Text>
|
|
35
|
-
<View style={{ flexDirection: 'row', gap: 8, flexWrap: 'wrap' }}>
|
|
36
|
-
<Button intent={"accent" as any}>Accent Button</Button>
|
|
37
|
-
<Button intent={"feature" as any}>Feature Button</Button>
|
|
38
|
-
<Button intent={"highlight" as any}>Highlight Button</Button>
|
|
39
|
-
</View>
|
|
40
|
-
|
|
41
|
-
<View style={{ flexDirection: 'row', gap: 8, flexWrap: 'wrap' }}>
|
|
42
|
-
<Button intent={"accent" as any} variant="outlined">Accent Outlined</Button>
|
|
43
|
-
<Button intent={"feature" as any} variant="outlined">Feature Outlined</Button>
|
|
44
|
-
<Button intent={"highlight" as any} variant="outlined">Highlight Outlined</Button>
|
|
45
|
-
</View>
|
|
46
|
-
</View>
|
|
47
|
-
|
|
48
|
-
{/* Mixed Usage */}
|
|
49
|
-
<View spacing="md">
|
|
50
|
-
<Text size="medium" weight="semibold">Mixed Extended Usage</Text>
|
|
51
|
-
|
|
52
|
-
<Card>
|
|
53
|
-
<View spacing="sm">
|
|
54
|
-
<Text color={"orange" as any} weight="bold">Orange Card Header</Text>
|
|
55
|
-
<Text color="secondary">This card uses extended orange color for the header</Text>
|
|
56
|
-
<Button intent={"accent" as any} size="small">Accent Action</Button>
|
|
57
|
-
</View>
|
|
58
|
-
</Card>
|
|
59
|
-
|
|
60
|
-
<Card>
|
|
61
|
-
<View spacing="sm">
|
|
62
|
-
<Text color={"teal" as any} weight="bold">Teal Card Header</Text>
|
|
63
|
-
<Text color="secondary">This card uses extended teal color for the header</Text>
|
|
64
|
-
<Button intent={"feature" as any} size="small">Feature Action</Button>
|
|
65
|
-
</View>
|
|
66
|
-
</Card>
|
|
67
|
-
</View>
|
|
68
|
-
|
|
69
|
-
{/* Form with Extended Colors */}
|
|
70
|
-
<View spacing="md">
|
|
71
|
-
<Text size="medium" weight="semibold">Form with Extended Styling</Text>
|
|
72
|
-
|
|
73
|
-
<Input
|
|
74
|
-
placeholder="Input with accent intent"
|
|
75
|
-
intent={"accent" as any}
|
|
76
|
-
/>
|
|
77
|
-
|
|
78
|
-
<Input
|
|
79
|
-
placeholder="Input with feature intent"
|
|
80
|
-
intent={"feature" as any}
|
|
81
|
-
/>
|
|
82
|
-
|
|
83
|
-
<View style={{ flexDirection: 'row', gap: 12, flexWrap: 'wrap' }}>
|
|
84
|
-
<Checkbox intent={"accent" as any}>Accent Checkbox</Checkbox>
|
|
85
|
-
<Checkbox intent={"feature" as any}>Feature Checkbox</Checkbox>
|
|
86
|
-
</View>
|
|
87
|
-
</View>
|
|
88
|
-
</View>
|
|
89
|
-
</Screen>
|
|
90
|
-
);
|
|
1
|
+
import React, { useEffect } from 'react';
|
|
2
|
+
import { Screen, View, Button, Text, Badge, Card, Input, Checkbox } from '../index';
|
|
3
|
+
|
|
4
|
+
export const ThemeExtensionExamples = () => {
|
|
5
|
+
return (
|
|
6
|
+
<Screen background="primary" padding="lg">
|
|
7
|
+
<View spacing="lg">
|
|
8
|
+
<Text size="large" weight="bold" align="center">
|
|
9
|
+
Extended Theme Test
|
|
10
|
+
</Text>
|
|
11
|
+
|
|
12
|
+
{/* Extended Colors */}
|
|
13
|
+
<View spacing="md">
|
|
14
|
+
<Text size="medium" weight="semibold">Extended Colors</Text>
|
|
15
|
+
<View style={{ flexDirection: 'row', gap: 8, flexWrap: 'wrap' }}>
|
|
16
|
+
<Badge color={"orange" as any}>Orange</Badge>
|
|
17
|
+
<Badge color={"teal" as any}>Teal</Badge>
|
|
18
|
+
<Badge color={"indigo" as any}>Indigo</Badge>
|
|
19
|
+
<Badge color={"violet" as any}>Violet</Badge>
|
|
20
|
+
<Badge color={"emerald" as any}>Emerald</Badge>
|
|
21
|
+
</View>
|
|
22
|
+
|
|
23
|
+
<View style={{ flexDirection: 'row', gap: 8, flexWrap: 'wrap' }}>
|
|
24
|
+
<Text color={"orange" as any}>Orange Text</Text>
|
|
25
|
+
<Text color={"teal" as any}>Teal Text</Text>
|
|
26
|
+
<Text color={"indigo" as any}>Indigo Text</Text>
|
|
27
|
+
<Text color={"violet" as any}>Violet Text</Text>
|
|
28
|
+
<Text color={"emerald" as any}>Emerald Text</Text>
|
|
29
|
+
</View>
|
|
30
|
+
</View>
|
|
31
|
+
|
|
32
|
+
{/* Extended Intents */}
|
|
33
|
+
<View spacing="md">
|
|
34
|
+
<Text size="medium" weight="semibold">Extended Intents</Text>
|
|
35
|
+
<View style={{ flexDirection: 'row', gap: 8, flexWrap: 'wrap' }}>
|
|
36
|
+
<Button intent={"accent" as any}>Accent Button</Button>
|
|
37
|
+
<Button intent={"feature" as any}>Feature Button</Button>
|
|
38
|
+
<Button intent={"highlight" as any}>Highlight Button</Button>
|
|
39
|
+
</View>
|
|
40
|
+
|
|
41
|
+
<View style={{ flexDirection: 'row', gap: 8, flexWrap: 'wrap' }}>
|
|
42
|
+
<Button intent={"accent" as any} variant="outlined">Accent Outlined</Button>
|
|
43
|
+
<Button intent={"feature" as any} variant="outlined">Feature Outlined</Button>
|
|
44
|
+
<Button intent={"highlight" as any} variant="outlined">Highlight Outlined</Button>
|
|
45
|
+
</View>
|
|
46
|
+
</View>
|
|
47
|
+
|
|
48
|
+
{/* Mixed Usage */}
|
|
49
|
+
<View spacing="md">
|
|
50
|
+
<Text size="medium" weight="semibold">Mixed Extended Usage</Text>
|
|
51
|
+
|
|
52
|
+
<Card>
|
|
53
|
+
<View spacing="sm">
|
|
54
|
+
<Text color={"orange" as any} weight="bold">Orange Card Header</Text>
|
|
55
|
+
<Text color="secondary">This card uses extended orange color for the header</Text>
|
|
56
|
+
<Button intent={"accent" as any} size="small">Accent Action</Button>
|
|
57
|
+
</View>
|
|
58
|
+
</Card>
|
|
59
|
+
|
|
60
|
+
<Card>
|
|
61
|
+
<View spacing="sm">
|
|
62
|
+
<Text color={"teal" as any} weight="bold">Teal Card Header</Text>
|
|
63
|
+
<Text color="secondary">This card uses extended teal color for the header</Text>
|
|
64
|
+
<Button intent={"feature" as any} size="small">Feature Action</Button>
|
|
65
|
+
</View>
|
|
66
|
+
</Card>
|
|
67
|
+
</View>
|
|
68
|
+
|
|
69
|
+
{/* Form with Extended Colors */}
|
|
70
|
+
<View spacing="md">
|
|
71
|
+
<Text size="medium" weight="semibold">Form with Extended Styling</Text>
|
|
72
|
+
|
|
73
|
+
<Input
|
|
74
|
+
placeholder="Input with accent intent"
|
|
75
|
+
intent={"accent" as any}
|
|
76
|
+
/>
|
|
77
|
+
|
|
78
|
+
<Input
|
|
79
|
+
placeholder="Input with feature intent"
|
|
80
|
+
intent={"feature" as any}
|
|
81
|
+
/>
|
|
82
|
+
|
|
83
|
+
<View style={{ flexDirection: 'row', gap: 12, flexWrap: 'wrap' }}>
|
|
84
|
+
<Checkbox intent={"accent" as any}>Accent Checkbox</Checkbox>
|
|
85
|
+
<Checkbox intent={"feature" as any}>Feature Checkbox</Checkbox>
|
|
86
|
+
</View>
|
|
87
|
+
</View>
|
|
88
|
+
</View>
|
|
89
|
+
</Screen>
|
|
90
|
+
);
|
|
91
91
|
};
|
|
@@ -1,95 +1,95 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Validation Examples
|
|
3
|
-
*
|
|
4
|
-
* This file demonstrates how the theme validation system works
|
|
5
|
-
* and how components can use it to validate their props.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import React from 'react';
|
|
9
|
-
import { View } from 'react-native';
|
|
10
|
-
import { useUnistyles } from 'react-native-unistyles';
|
|
11
|
-
import Text from '../Text';
|
|
12
|
-
import Button from '../Button';
|
|
13
|
-
import Badge from '../Badge';
|
|
14
|
-
import { validateColorProp, validateIntentProp } from '../theme';
|
|
15
|
-
|
|
16
|
-
export function ValidationExamples() {
|
|
17
|
-
const { theme } = useUnistyles();
|
|
18
|
-
|
|
19
|
-
// Example: Valid usage
|
|
20
|
-
const handleValidUsage = () => {
|
|
21
|
-
console.log('=== Valid Usage Examples ===');
|
|
22
|
-
|
|
23
|
-
// These should not produce warnings
|
|
24
|
-
validateColorProp(theme, 'blue', 'Text');
|
|
25
|
-
validateColorProp(theme, 'primary', 'Text');
|
|
26
|
-
validateIntentProp(theme, 'primary', 'Button');
|
|
27
|
-
validateIntentProp(theme, 'success', 'Button');
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
// Example: Invalid usage
|
|
31
|
-
const handleInvalidUsage = () => {
|
|
32
|
-
console.log('=== Invalid Usage Examples ===');
|
|
33
|
-
|
|
34
|
-
// These should produce warnings in development
|
|
35
|
-
validateColorProp(theme, 'invalidColor', 'Text');
|
|
36
|
-
validateColorProp(theme, 'neonPink', 'Text');
|
|
37
|
-
validateIntentProp(theme, 'invalidIntent', 'Button');
|
|
38
|
-
validateIntentProp(theme, 'danger', 'Button'); // 'danger' doesn't exist, should be 'error'
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
return (
|
|
42
|
-
<View style={{ padding: 20, gap: 16 }}>
|
|
43
|
-
<Text size="large" weight="bold">
|
|
44
|
-
Theme Validation Examples
|
|
45
|
-
</Text>
|
|
46
|
-
|
|
47
|
-
<Text>
|
|
48
|
-
Open the browser console to see validation warnings when using invalid colors or intents.
|
|
49
|
-
</Text>
|
|
50
|
-
|
|
51
|
-
{/* Valid examples */}
|
|
52
|
-
<View style={{ gap: 8 }}>
|
|
53
|
-
<Text weight="semibold">✅ Valid Usage (no warnings):</Text>
|
|
54
|
-
<Text color="blue">Blue text (valid palette color)</Text>
|
|
55
|
-
<Text color="blue">Blue text (valid palette color)</Text>
|
|
56
|
-
<Button intent="primary" onPress={handleValidUsage}>
|
|
57
|
-
Valid Button
|
|
58
|
-
</Button>
|
|
59
|
-
<Badge color="green">Valid Badge</Badge>
|
|
60
|
-
</View>
|
|
61
|
-
|
|
62
|
-
{/* Invalid examples that would show warnings */}
|
|
63
|
-
<View style={{ gap: 8 }}>
|
|
64
|
-
<Text weight="semibold">⚠️ Invalid Usage (shows warnings):</Text>
|
|
65
|
-
<Button onPress={handleInvalidUsage}>
|
|
66
|
-
Click to Test Invalid Props (check console)
|
|
67
|
-
</Button>
|
|
68
|
-
|
|
69
|
-
<Text size="small" color="secondary">
|
|
70
|
-
Note: The invalid examples are triggered programmatically to avoid
|
|
71
|
-
runtime TypeScript errors. In real usage, TypeScript would catch
|
|
72
|
-
most of these at compile time.
|
|
73
|
-
</Text>
|
|
74
|
-
</View>
|
|
75
|
-
|
|
76
|
-
{/* Extensibility example */}
|
|
77
|
-
<View style={{ gap: 8 }}>
|
|
78
|
-
<Text weight="semibold">🔧 Extensibility:</Text>
|
|
79
|
-
<Text size="small">
|
|
80
|
-
When you add new colors to your theme palette (e.g., 'orange', 'teal'),
|
|
81
|
-
they automatically become available in all components that use ColorVariant.
|
|
82
|
-
The validation system will recognize them as valid options.
|
|
83
|
-
</Text>
|
|
84
|
-
|
|
85
|
-
<Text size="small">
|
|
86
|
-
Example: If you add 'orange' to your theme.palettes, then
|
|
87
|
-
<Text color="orange"> and <Badge color="orange">
|
|
88
|
-
will work without any code changes to the components.
|
|
89
|
-
</Text>
|
|
90
|
-
</View>
|
|
91
|
-
</View>
|
|
92
|
-
);
|
|
93
|
-
}
|
|
94
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Validation Examples
|
|
3
|
+
*
|
|
4
|
+
* This file demonstrates how the theme validation system works
|
|
5
|
+
* and how components can use it to validate their props.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import React from 'react';
|
|
9
|
+
import { View } from 'react-native';
|
|
10
|
+
import { useUnistyles } from 'react-native-unistyles';
|
|
11
|
+
import Text from '../Text';
|
|
12
|
+
import Button from '../Button';
|
|
13
|
+
import Badge from '../Badge';
|
|
14
|
+
import { validateColorProp, validateIntentProp } from '../theme';
|
|
15
|
+
|
|
16
|
+
export function ValidationExamples() {
|
|
17
|
+
const { theme } = useUnistyles();
|
|
18
|
+
|
|
19
|
+
// Example: Valid usage
|
|
20
|
+
const handleValidUsage = () => {
|
|
21
|
+
console.log('=== Valid Usage Examples ===');
|
|
22
|
+
|
|
23
|
+
// These should not produce warnings
|
|
24
|
+
validateColorProp(theme, 'blue', 'Text');
|
|
25
|
+
validateColorProp(theme, 'primary', 'Text');
|
|
26
|
+
validateIntentProp(theme, 'primary', 'Button');
|
|
27
|
+
validateIntentProp(theme, 'success', 'Button');
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
// Example: Invalid usage
|
|
31
|
+
const handleInvalidUsage = () => {
|
|
32
|
+
console.log('=== Invalid Usage Examples ===');
|
|
33
|
+
|
|
34
|
+
// These should produce warnings in development
|
|
35
|
+
validateColorProp(theme, 'invalidColor', 'Text');
|
|
36
|
+
validateColorProp(theme, 'neonPink', 'Text');
|
|
37
|
+
validateIntentProp(theme, 'invalidIntent', 'Button');
|
|
38
|
+
validateIntentProp(theme, 'danger', 'Button'); // 'danger' doesn't exist, should be 'error'
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
return (
|
|
42
|
+
<View style={{ padding: 20, gap: 16 }}>
|
|
43
|
+
<Text size="large" weight="bold">
|
|
44
|
+
Theme Validation Examples
|
|
45
|
+
</Text>
|
|
46
|
+
|
|
47
|
+
<Text>
|
|
48
|
+
Open the browser console to see validation warnings when using invalid colors or intents.
|
|
49
|
+
</Text>
|
|
50
|
+
|
|
51
|
+
{/* Valid examples */}
|
|
52
|
+
<View style={{ gap: 8 }}>
|
|
53
|
+
<Text weight="semibold">✅ Valid Usage (no warnings):</Text>
|
|
54
|
+
<Text color="blue">Blue text (valid palette color)</Text>
|
|
55
|
+
<Text color="blue">Blue text (valid palette color)</Text>
|
|
56
|
+
<Button intent="primary" onPress={handleValidUsage}>
|
|
57
|
+
Valid Button
|
|
58
|
+
</Button>
|
|
59
|
+
<Badge color="green">Valid Badge</Badge>
|
|
60
|
+
</View>
|
|
61
|
+
|
|
62
|
+
{/* Invalid examples that would show warnings */}
|
|
63
|
+
<View style={{ gap: 8 }}>
|
|
64
|
+
<Text weight="semibold">⚠️ Invalid Usage (shows warnings):</Text>
|
|
65
|
+
<Button onPress={handleInvalidUsage}>
|
|
66
|
+
Click to Test Invalid Props (check console)
|
|
67
|
+
</Button>
|
|
68
|
+
|
|
69
|
+
<Text size="small" color="secondary">
|
|
70
|
+
Note: The invalid examples are triggered programmatically to avoid
|
|
71
|
+
runtime TypeScript errors. In real usage, TypeScript would catch
|
|
72
|
+
most of these at compile time.
|
|
73
|
+
</Text>
|
|
74
|
+
</View>
|
|
75
|
+
|
|
76
|
+
{/* Extensibility example */}
|
|
77
|
+
<View style={{ gap: 8 }}>
|
|
78
|
+
<Text weight="semibold">🔧 Extensibility:</Text>
|
|
79
|
+
<Text size="small">
|
|
80
|
+
When you add new colors to your theme palette (e.g., 'orange', 'teal'),
|
|
81
|
+
they automatically become available in all components that use ColorVariant.
|
|
82
|
+
The validation system will recognize them as valid options.
|
|
83
|
+
</Text>
|
|
84
|
+
|
|
85
|
+
<Text size="small">
|
|
86
|
+
Example: If you add 'orange' to your theme.palettes, then
|
|
87
|
+
<Text color="orange"> and <Badge color="orange">
|
|
88
|
+
will work without any code changes to the components.
|
|
89
|
+
</Text>
|
|
90
|
+
</View>
|
|
91
|
+
</View>
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
95
|
export default ValidationExamples;
|
|
@@ -1,129 +1,129 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Screen, View, Text } from '../index';
|
|
3
|
-
|
|
4
|
-
export const ViewExamples = () => {
|
|
5
|
-
return (
|
|
6
|
-
<Screen background="primary" padding="lg">
|
|
7
|
-
<View spacing="none">
|
|
8
|
-
<Text size="large" weight="bold" align="center">
|
|
9
|
-
View Examples
|
|
10
|
-
</Text>
|
|
11
|
-
|
|
12
|
-
{/* Spacing Examples */}
|
|
13
|
-
<View spacing="md">
|
|
14
|
-
<Text size="medium" weight="semibold">Spacing Variants</Text>
|
|
15
|
-
<View style={{ flexDirection: 'row', gap: 8, flexWrap: 'wrap' }}>
|
|
16
|
-
<View spacing="none" background="surface" border="thin">
|
|
17
|
-
<Text size="small">None</Text>
|
|
18
|
-
</View>
|
|
19
|
-
<View spacing="xs" background="surface" border="thin">
|
|
20
|
-
<Text size="small">XS</Text>
|
|
21
|
-
</View>
|
|
22
|
-
<View spacing="sm" background="surface" border="thin">
|
|
23
|
-
<Text size="small">SM</Text>
|
|
24
|
-
</View>
|
|
25
|
-
<View spacing="md" background="surface" border="thin">
|
|
26
|
-
<Text size="small">MD</Text>
|
|
27
|
-
</View>
|
|
28
|
-
<View spacing="lg" background="surface" border="thin">
|
|
29
|
-
<Text size="small">LG</Text>
|
|
30
|
-
</View>
|
|
31
|
-
<View spacing="xl" background="surface" border="thin">
|
|
32
|
-
<Text size="small">XL</Text>
|
|
33
|
-
</View>
|
|
34
|
-
</View>
|
|
35
|
-
</View>
|
|
36
|
-
|
|
37
|
-
{/* Background Examples */}
|
|
38
|
-
<View spacing="md">
|
|
39
|
-
<Text size="medium" weight="semibold">Background Variants</Text>
|
|
40
|
-
<View style={{ flexDirection: 'row', gap: 8, flexWrap: 'wrap' }}>
|
|
41
|
-
<View background="transparent" border="thin" spacing="sm">
|
|
42
|
-
<Text size="small">Transparent</Text>
|
|
43
|
-
</View>
|
|
44
|
-
<View background="surface" spacing="sm">
|
|
45
|
-
<Text size="small">Surface</Text>
|
|
46
|
-
</View>
|
|
47
|
-
<View background="primary" spacing="sm">
|
|
48
|
-
<Text size="small" color="primary">Primary</Text>
|
|
49
|
-
</View>
|
|
50
|
-
<View background="secondary" spacing="sm">
|
|
51
|
-
<Text size="small" color="secondary">Secondary</Text>
|
|
52
|
-
</View>
|
|
53
|
-
</View>
|
|
54
|
-
</View>
|
|
55
|
-
|
|
56
|
-
{/* Border Radius Examples */}
|
|
57
|
-
<View spacing="md">
|
|
58
|
-
<Text size="medium" weight="semibold">Border Radius</Text>
|
|
59
|
-
<View style={{ flexDirection: 'row', gap: 8, flexWrap: 'wrap' }}>
|
|
60
|
-
<View radius="none" background="surface" spacing="sm" border="thin">
|
|
61
|
-
<Text size="small">None</Text>
|
|
62
|
-
</View>
|
|
63
|
-
<View radius="xs" background="surface" spacing="sm" border="thin">
|
|
64
|
-
<Text size="small">XS</Text>
|
|
65
|
-
</View>
|
|
66
|
-
<View radius="sm" background="surface" spacing="sm" border="thin">
|
|
67
|
-
<Text size="small">SM</Text>
|
|
68
|
-
</View>
|
|
69
|
-
<View radius="md" background="surface" spacing="sm" border="thin">
|
|
70
|
-
<Text size="small">MD</Text>
|
|
71
|
-
</View>
|
|
72
|
-
<View radius="lg" background="surface" spacing="sm" border="thin">
|
|
73
|
-
<Text size="small">LG</Text>
|
|
74
|
-
</View>
|
|
75
|
-
<View radius="xl" background="surface" spacing="sm" border="thin">
|
|
76
|
-
<Text size="small">XL</Text>
|
|
77
|
-
</View>
|
|
78
|
-
</View>
|
|
79
|
-
</View>
|
|
80
|
-
|
|
81
|
-
{/* Border Examples */}
|
|
82
|
-
<View spacing="md">
|
|
83
|
-
<Text size="medium" weight="semibold">Border Variants</Text>
|
|
84
|
-
<View style={{ flexDirection: 'row', gap: 8, flexWrap: 'wrap' }}>
|
|
85
|
-
<View border="none" background="surface" spacing="sm" radius="sm">
|
|
86
|
-
<Text size="small">None</Text>
|
|
87
|
-
</View>
|
|
88
|
-
<View border="thin" background="surface" spacing="sm" radius="sm">
|
|
89
|
-
<Text size="small">Thin</Text>
|
|
90
|
-
</View>
|
|
91
|
-
<View border="thick" background="surface" spacing="sm" radius="sm">
|
|
92
|
-
<Text size="small">Thick</Text>
|
|
93
|
-
</View>
|
|
94
|
-
</View>
|
|
95
|
-
</View>
|
|
96
|
-
|
|
97
|
-
{/* Layout Examples */}
|
|
98
|
-
<View spacing="md">
|
|
99
|
-
<Text size="medium" weight="semibold">Layout Examples</Text>
|
|
100
|
-
<View spacing="sm" style={{ gap: 10 }}>
|
|
101
|
-
<View
|
|
102
|
-
background="surface"
|
|
103
|
-
spacing="md"
|
|
104
|
-
radius="md"
|
|
105
|
-
border="thin"
|
|
106
|
-
style={{ flexDirection: 'row', justifyContent: 'space-between' }}
|
|
107
|
-
>
|
|
108
|
-
<Text>Left</Text>
|
|
109
|
-
<Text>Center</Text>
|
|
110
|
-
<Text>Right</Text>
|
|
111
|
-
</View>
|
|
112
|
-
|
|
113
|
-
<View
|
|
114
|
-
background="surface"
|
|
115
|
-
spacing="md"
|
|
116
|
-
radius="md"
|
|
117
|
-
border="thin"
|
|
118
|
-
style={{ flexDirection: 'column', alignItems: 'center' }}
|
|
119
|
-
>
|
|
120
|
-
<Text>Centered</Text>
|
|
121
|
-
<Text>Column</Text>
|
|
122
|
-
<Text>Layout</Text>
|
|
123
|
-
</View>
|
|
124
|
-
</View>
|
|
125
|
-
</View>
|
|
126
|
-
</View>
|
|
127
|
-
</Screen>
|
|
128
|
-
);
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Screen, View, Text } from '../index';
|
|
3
|
+
|
|
4
|
+
export const ViewExamples = () => {
|
|
5
|
+
return (
|
|
6
|
+
<Screen background="primary" padding="lg">
|
|
7
|
+
<View spacing="none">
|
|
8
|
+
<Text size="large" weight="bold" align="center">
|
|
9
|
+
View Examples
|
|
10
|
+
</Text>
|
|
11
|
+
|
|
12
|
+
{/* Spacing Examples */}
|
|
13
|
+
<View spacing="md">
|
|
14
|
+
<Text size="medium" weight="semibold">Spacing Variants</Text>
|
|
15
|
+
<View style={{ flexDirection: 'row', gap: 8, flexWrap: 'wrap' }}>
|
|
16
|
+
<View spacing="none" background="surface" border="thin">
|
|
17
|
+
<Text size="small">None</Text>
|
|
18
|
+
</View>
|
|
19
|
+
<View spacing="xs" background="surface" border="thin">
|
|
20
|
+
<Text size="small">XS</Text>
|
|
21
|
+
</View>
|
|
22
|
+
<View spacing="sm" background="surface" border="thin">
|
|
23
|
+
<Text size="small">SM</Text>
|
|
24
|
+
</View>
|
|
25
|
+
<View spacing="md" background="surface" border="thin">
|
|
26
|
+
<Text size="small">MD</Text>
|
|
27
|
+
</View>
|
|
28
|
+
<View spacing="lg" background="surface" border="thin">
|
|
29
|
+
<Text size="small">LG</Text>
|
|
30
|
+
</View>
|
|
31
|
+
<View spacing="xl" background="surface" border="thin">
|
|
32
|
+
<Text size="small">XL</Text>
|
|
33
|
+
</View>
|
|
34
|
+
</View>
|
|
35
|
+
</View>
|
|
36
|
+
|
|
37
|
+
{/* Background Examples */}
|
|
38
|
+
<View spacing="md">
|
|
39
|
+
<Text size="medium" weight="semibold">Background Variants</Text>
|
|
40
|
+
<View style={{ flexDirection: 'row', gap: 8, flexWrap: 'wrap' }}>
|
|
41
|
+
<View background="transparent" border="thin" spacing="sm">
|
|
42
|
+
<Text size="small">Transparent</Text>
|
|
43
|
+
</View>
|
|
44
|
+
<View background="surface" spacing="sm">
|
|
45
|
+
<Text size="small">Surface</Text>
|
|
46
|
+
</View>
|
|
47
|
+
<View background="primary" spacing="sm">
|
|
48
|
+
<Text size="small" color="primary">Primary</Text>
|
|
49
|
+
</View>
|
|
50
|
+
<View background="secondary" spacing="sm">
|
|
51
|
+
<Text size="small" color="secondary">Secondary</Text>
|
|
52
|
+
</View>
|
|
53
|
+
</View>
|
|
54
|
+
</View>
|
|
55
|
+
|
|
56
|
+
{/* Border Radius Examples */}
|
|
57
|
+
<View spacing="md">
|
|
58
|
+
<Text size="medium" weight="semibold">Border Radius</Text>
|
|
59
|
+
<View style={{ flexDirection: 'row', gap: 8, flexWrap: 'wrap' }}>
|
|
60
|
+
<View radius="none" background="surface" spacing="sm" border="thin">
|
|
61
|
+
<Text size="small">None</Text>
|
|
62
|
+
</View>
|
|
63
|
+
<View radius="xs" background="surface" spacing="sm" border="thin">
|
|
64
|
+
<Text size="small">XS</Text>
|
|
65
|
+
</View>
|
|
66
|
+
<View radius="sm" background="surface" spacing="sm" border="thin">
|
|
67
|
+
<Text size="small">SM</Text>
|
|
68
|
+
</View>
|
|
69
|
+
<View radius="md" background="surface" spacing="sm" border="thin">
|
|
70
|
+
<Text size="small">MD</Text>
|
|
71
|
+
</View>
|
|
72
|
+
<View radius="lg" background="surface" spacing="sm" border="thin">
|
|
73
|
+
<Text size="small">LG</Text>
|
|
74
|
+
</View>
|
|
75
|
+
<View radius="xl" background="surface" spacing="sm" border="thin">
|
|
76
|
+
<Text size="small">XL</Text>
|
|
77
|
+
</View>
|
|
78
|
+
</View>
|
|
79
|
+
</View>
|
|
80
|
+
|
|
81
|
+
{/* Border Examples */}
|
|
82
|
+
<View spacing="md">
|
|
83
|
+
<Text size="medium" weight="semibold">Border Variants</Text>
|
|
84
|
+
<View style={{ flexDirection: 'row', gap: 8, flexWrap: 'wrap' }}>
|
|
85
|
+
<View border="none" background="surface" spacing="sm" radius="sm">
|
|
86
|
+
<Text size="small">None</Text>
|
|
87
|
+
</View>
|
|
88
|
+
<View border="thin" background="surface" spacing="sm" radius="sm">
|
|
89
|
+
<Text size="small">Thin</Text>
|
|
90
|
+
</View>
|
|
91
|
+
<View border="thick" background="surface" spacing="sm" radius="sm">
|
|
92
|
+
<Text size="small">Thick</Text>
|
|
93
|
+
</View>
|
|
94
|
+
</View>
|
|
95
|
+
</View>
|
|
96
|
+
|
|
97
|
+
{/* Layout Examples */}
|
|
98
|
+
<View spacing="md">
|
|
99
|
+
<Text size="medium" weight="semibold">Layout Examples</Text>
|
|
100
|
+
<View spacing="sm" style={{ gap: 10 }}>
|
|
101
|
+
<View
|
|
102
|
+
background="surface"
|
|
103
|
+
spacing="md"
|
|
104
|
+
radius="md"
|
|
105
|
+
border="thin"
|
|
106
|
+
style={{ flexDirection: 'row', justifyContent: 'space-between' }}
|
|
107
|
+
>
|
|
108
|
+
<Text>Left</Text>
|
|
109
|
+
<Text>Center</Text>
|
|
110
|
+
<Text>Right</Text>
|
|
111
|
+
</View>
|
|
112
|
+
|
|
113
|
+
<View
|
|
114
|
+
background="surface"
|
|
115
|
+
spacing="md"
|
|
116
|
+
radius="md"
|
|
117
|
+
border="thin"
|
|
118
|
+
style={{ flexDirection: 'column', alignItems: 'center' }}
|
|
119
|
+
>
|
|
120
|
+
<Text>Centered</Text>
|
|
121
|
+
<Text>Column</Text>
|
|
122
|
+
<Text>Layout</Text>
|
|
123
|
+
</View>
|
|
124
|
+
</View>
|
|
125
|
+
</View>
|
|
126
|
+
</View>
|
|
127
|
+
</Screen>
|
|
128
|
+
);
|
|
129
129
|
};
|