@idealyst/mcp-server 1.0.86 → 1.0.88
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/ARCHITECTURE.md +313 -0
- package/README.md +292 -104
- package/TYPE-SYSTEM.md +397 -0
- package/dist/index.js +170 -1
- package/examples/components/Accordion.examples.tsx +147 -0
- package/examples/components/ActivityIndicator.examples.tsx +350 -0
- package/examples/components/Alert.examples.tsx +335 -0
- package/examples/components/Avatar.examples.tsx +188 -0
- package/examples/components/Badge.examples.tsx +242 -0
- package/examples/components/Breadcrumb.examples.tsx +303 -0
- package/examples/components/Button.examples.tsx +113 -0
- package/examples/components/Card.examples.tsx +131 -0
- package/examples/components/Checkbox.examples.tsx +195 -0
- package/examples/components/Chip.examples.tsx +87 -0
- package/examples/components/Dialog.examples.tsx +344 -0
- package/examples/components/Divider.examples.tsx +258 -0
- package/examples/components/Icon.examples.tsx +202 -0
- package/examples/components/Input.examples.tsx +205 -0
- package/examples/components/Menu.examples.tsx +321 -0
- package/examples/components/Popover.examples.tsx +439 -0
- package/examples/components/Progress.examples.tsx +340 -0
- package/examples/components/RadioButton.examples.tsx +443 -0
- package/examples/components/Screen.examples.tsx +347 -0
- package/examples/components/Select.examples.tsx +279 -0
- package/examples/components/Skeleton.examples.tsx +278 -0
- package/examples/components/Slider.examples.tsx +249 -0
- package/examples/components/Switch.examples.tsx +94 -0
- package/examples/components/TabBar.examples.tsx +356 -0
- package/examples/components/Text.examples.tsx +177 -0
- package/examples/components/TextArea.examples.tsx +203 -0
- package/examples/components/Tooltip.examples.tsx +318 -0
- package/examples/components/View.examples.tsx +307 -0
- package/package.json +15 -2
- package/scripts/extract-types.ts +71 -0
- package/scripts/type-extractor.ts +286 -0
- package/scripts/validate-examples.ts +142 -0
- package/src/data/components/Icon.ts +1 -1
- package/src/data/components/index.ts +2 -0
- package/src/index.ts +181 -1
- package/src/tools/get-types.ts +169 -0
- package/tsconfig.examples.json +14 -0
- package/dist/data/cli-commands.d.ts +0 -2
- package/dist/data/cli-commands.d.ts.map +0 -1
- package/dist/data/cli-commands.js +0 -100
- package/dist/data/cli-commands.js.map +0 -1
- package/dist/data/components/Accordion.d.ts +0 -15
- package/dist/data/components/Accordion.d.ts.map +0 -1
- package/dist/data/components/Accordion.js +0 -112
- package/dist/data/components/Accordion.js.map +0 -1
- package/dist/data/components/ActivityIndicator.d.ts +0 -15
- package/dist/data/components/ActivityIndicator.d.ts.map +0 -1
- package/dist/data/components/ActivityIndicator.js +0 -82
- package/dist/data/components/ActivityIndicator.js.map +0 -1
- package/dist/data/components/Alert.d.ts +0 -15
- package/dist/data/components/Alert.d.ts.map +0 -1
- package/dist/data/components/Alert.js +0 -132
- package/dist/data/components/Alert.js.map +0 -1
- package/dist/data/components/Avatar.d.ts +0 -15
- package/dist/data/components/Avatar.d.ts.map +0 -1
- package/dist/data/components/Avatar.js +0 -93
- package/dist/data/components/Avatar.js.map +0 -1
- package/dist/data/components/Badge.d.ts +0 -15
- package/dist/data/components/Badge.d.ts.map +0 -1
- package/dist/data/components/Badge.js +0 -64
- package/dist/data/components/Badge.js.map +0 -1
- package/dist/data/components/Breadcrumb.d.ts +0 -15
- package/dist/data/components/Breadcrumb.d.ts.map +0 -1
- package/dist/data/components/Breadcrumb.js +0 -96
- package/dist/data/components/Breadcrumb.js.map +0 -1
- package/dist/data/components/Button.d.ts +0 -15
- package/dist/data/components/Button.d.ts.map +0 -1
- package/dist/data/components/Button.js +0 -87
- package/dist/data/components/Button.js.map +0 -1
- package/dist/data/components/Card.d.ts +0 -15
- package/dist/data/components/Card.d.ts.map +0 -1
- package/dist/data/components/Card.js +0 -67
- package/dist/data/components/Card.js.map +0 -1
- package/dist/data/components/Checkbox.d.ts +0 -15
- package/dist/data/components/Checkbox.d.ts.map +0 -1
- package/dist/data/components/Checkbox.js +0 -118
- package/dist/data/components/Checkbox.js.map +0 -1
- package/dist/data/components/Chip.d.ts +0 -15
- package/dist/data/components/Chip.d.ts.map +0 -1
- package/dist/data/components/Chip.js +0 -76
- package/dist/data/components/Chip.js.map +0 -1
- package/dist/data/components/Dialog.d.ts +0 -15
- package/dist/data/components/Dialog.d.ts.map +0 -1
- package/dist/data/components/Dialog.js +0 -137
- package/dist/data/components/Dialog.js.map +0 -1
- package/dist/data/components/Divider.d.ts +0 -15
- package/dist/data/components/Divider.d.ts.map +0 -1
- package/dist/data/components/Divider.js +0 -71
- package/dist/data/components/Divider.js.map +0 -1
- package/dist/data/components/Icon.d.ts +0 -15
- package/dist/data/components/Icon.d.ts.map +0 -1
- package/dist/data/components/Icon.js +0 -70
- package/dist/data/components/Icon.js.map +0 -1
- package/dist/data/components/Image.d.ts +0 -15
- package/dist/data/components/Image.d.ts.map +0 -1
- package/dist/data/components/Image.js +0 -122
- package/dist/data/components/Image.js.map +0 -1
- package/dist/data/components/Input.d.ts +0 -15
- package/dist/data/components/Input.d.ts.map +0 -1
- package/dist/data/components/Input.js +0 -109
- package/dist/data/components/Input.js.map +0 -1
- package/dist/data/components/List.d.ts +0 -15
- package/dist/data/components/List.d.ts.map +0 -1
- package/dist/data/components/List.js +0 -113
- package/dist/data/components/List.js.map +0 -1
- package/dist/data/components/Menu.d.ts +0 -15
- package/dist/data/components/Menu.d.ts.map +0 -1
- package/dist/data/components/Menu.js +0 -132
- package/dist/data/components/Menu.js.map +0 -1
- package/dist/data/components/Popover.d.ts +0 -15
- package/dist/data/components/Popover.d.ts.map +0 -1
- package/dist/data/components/Popover.js +0 -159
- package/dist/data/components/Popover.js.map +0 -1
- package/dist/data/components/Pressable.d.ts +0 -15
- package/dist/data/components/Pressable.d.ts.map +0 -1
- package/dist/data/components/Pressable.js +0 -125
- package/dist/data/components/Pressable.js.map +0 -1
- package/dist/data/components/Progress.d.ts +0 -15
- package/dist/data/components/Progress.d.ts.map +0 -1
- package/dist/data/components/Progress.js +0 -95
- package/dist/data/components/Progress.js.map +0 -1
- package/dist/data/components/RadioButton.d.ts +0 -15
- package/dist/data/components/RadioButton.d.ts.map +0 -1
- package/dist/data/components/RadioButton.js +0 -140
- package/dist/data/components/RadioButton.js.map +0 -1
- package/dist/data/components/SVGImage.d.ts +0 -15
- package/dist/data/components/SVGImage.d.ts.map +0 -1
- package/dist/data/components/SVGImage.js +0 -112
- package/dist/data/components/SVGImage.js.map +0 -1
- package/dist/data/components/Screen.d.ts +0 -15
- package/dist/data/components/Screen.d.ts.map +0 -1
- package/dist/data/components/Screen.js +0 -99
- package/dist/data/components/Screen.js.map +0 -1
- package/dist/data/components/Select.d.ts +0 -15
- package/dist/data/components/Select.d.ts.map +0 -1
- package/dist/data/components/Select.js +0 -146
- package/dist/data/components/Select.js.map +0 -1
- package/dist/data/components/Skeleton.d.ts +0 -15
- package/dist/data/components/Skeleton.d.ts.map +0 -1
- package/dist/data/components/Skeleton.js +0 -110
- package/dist/data/components/Skeleton.js.map +0 -1
- package/dist/data/components/Slider.d.ts +0 -15
- package/dist/data/components/Slider.d.ts.map +0 -1
- package/dist/data/components/Slider.js +0 -129
- package/dist/data/components/Slider.js.map +0 -1
- package/dist/data/components/Switch.d.ts +0 -15
- package/dist/data/components/Switch.d.ts.map +0 -1
- package/dist/data/components/Switch.js +0 -127
- package/dist/data/components/Switch.js.map +0 -1
- package/dist/data/components/TabBar.d.ts +0 -15
- package/dist/data/components/TabBar.d.ts.map +0 -1
- package/dist/data/components/TabBar.js +0 -145
- package/dist/data/components/TabBar.js.map +0 -1
- package/dist/data/components/Table.d.ts +0 -15
- package/dist/data/components/Table.d.ts.map +0 -1
- package/dist/data/components/Table.js +0 -151
- package/dist/data/components/Table.js.map +0 -1
- package/dist/data/components/Tabs.d.ts +0 -15
- package/dist/data/components/Tabs.d.ts.map +0 -1
- package/dist/data/components/Tabs.js +0 -150
- package/dist/data/components/Tabs.js.map +0 -1
- package/dist/data/components/Text.d.ts +0 -15
- package/dist/data/components/Text.d.ts.map +0 -1
- package/dist/data/components/Text.js +0 -85
- package/dist/data/components/Text.js.map +0 -1
- package/dist/data/components/TextArea.d.ts +0 -15
- package/dist/data/components/TextArea.d.ts.map +0 -1
- package/dist/data/components/TextArea.js +0 -155
- package/dist/data/components/TextArea.js.map +0 -1
- package/dist/data/components/Tooltip.d.ts +0 -15
- package/dist/data/components/Tooltip.d.ts.map +0 -1
- package/dist/data/components/Tooltip.js +0 -105
- package/dist/data/components/Tooltip.js.map +0 -1
- package/dist/data/components/Video.d.ts +0 -15
- package/dist/data/components/Video.d.ts.map +0 -1
- package/dist/data/components/Video.js +0 -168
- package/dist/data/components/Video.js.map +0 -1
- package/dist/data/components/View.d.ts +0 -15
- package/dist/data/components/View.d.ts.map +0 -1
- package/dist/data/components/View.js +0 -126
- package/dist/data/components/View.js.map +0 -1
- package/dist/data/components/index.d.ts +0 -37
- package/dist/data/components/index.d.ts.map +0 -1
- package/dist/data/components/index.js +0 -110
- package/dist/data/components/index.js.map +0 -1
- package/dist/data/framework-guides.d.ts +0 -2
- package/dist/data/framework-guides.d.ts.map +0 -1
- package/dist/data/framework-guides.js +0 -589
- package/dist/data/framework-guides.js.map +0 -1
- package/dist/data/icon-guide.d.ts +0 -2
- package/dist/data/icon-guide.d.ts.map +0 -1
- package/dist/data/icon-guide.js +0 -285
- package/dist/data/icon-guide.js.map +0 -1
- package/dist/data/icons.json +0 -7452
- package/dist/data/navigation-guides.d.ts +0 -2
- package/dist/data/navigation-guides.d.ts.map +0 -1
- package/dist/data/navigation-guides.js +0 -1196
- package/dist/data/navigation-guides.js.map +0 -1
- package/dist/index.d.ts +0 -3
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Icon Component Examples
|
|
3
|
+
*
|
|
4
|
+
* These examples are type-checked against the actual IconProps interface
|
|
5
|
+
* to ensure accuracy and correctness.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import React from 'react';
|
|
9
|
+
import { Icon, View, Text } from '@idealyst/components';
|
|
10
|
+
|
|
11
|
+
// Example 1: Basic Icon
|
|
12
|
+
export function BasicIcon() {
|
|
13
|
+
return <Icon name="home" />;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
// Example 2: Icon Sizes
|
|
17
|
+
export function IconSizes() {
|
|
18
|
+
return (
|
|
19
|
+
<View spacing="md">
|
|
20
|
+
<Icon name="heart" size="xs" />
|
|
21
|
+
<Icon name="heart" size="sm" />
|
|
22
|
+
<Icon name="heart" size="md" />
|
|
23
|
+
<Icon name="heart" size="lg" />
|
|
24
|
+
<Icon name="heart" size="xl" />
|
|
25
|
+
</View>
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// Example 3: Icon with Custom Size (Number)
|
|
30
|
+
export function IconCustomSize() {
|
|
31
|
+
return (
|
|
32
|
+
<View spacing="md">
|
|
33
|
+
<Icon name="star" size={16} />
|
|
34
|
+
<Icon name="star" size={24} />
|
|
35
|
+
<Icon name="star" size={32} />
|
|
36
|
+
<Icon name="star" size={48} />
|
|
37
|
+
<Icon name="star" size={64} />
|
|
38
|
+
</View>
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// Example 4: Icon with Colors
|
|
43
|
+
export function IconWithColors() {
|
|
44
|
+
return (
|
|
45
|
+
<View spacing="md">
|
|
46
|
+
<Icon name="circle" />
|
|
47
|
+
<Icon name="circle" />
|
|
48
|
+
<Icon name="circle" />
|
|
49
|
+
<Icon name="circle" />
|
|
50
|
+
<Icon name="circle" />
|
|
51
|
+
</View>
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// Example 5: Icon with Intent
|
|
56
|
+
export function IconWithIntent() {
|
|
57
|
+
return (
|
|
58
|
+
<View spacing="md">
|
|
59
|
+
<Icon name="information" intent="primary" size="lg" />
|
|
60
|
+
<Icon name="check-circle" intent="success" size="lg" />
|
|
61
|
+
<Icon name="alert-circle" intent="error" size="lg" />
|
|
62
|
+
<Icon name="alert" intent="warning" size="lg" />
|
|
63
|
+
<Icon name="help-circle" intent="info" size="lg" />
|
|
64
|
+
</View>
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// Example 6: Common UI Icons
|
|
69
|
+
export function CommonUIIcons() {
|
|
70
|
+
return (
|
|
71
|
+
<View spacing="md">
|
|
72
|
+
<View spacing="sm">
|
|
73
|
+
<Icon name="home" />
|
|
74
|
+
<Text size="sm">Home</Text>
|
|
75
|
+
</View>
|
|
76
|
+
<View spacing="sm">
|
|
77
|
+
<Icon name="magnify" />
|
|
78
|
+
<Text size="sm">Search</Text>
|
|
79
|
+
</View>
|
|
80
|
+
<View spacing="sm">
|
|
81
|
+
<Icon name="account" />
|
|
82
|
+
<Text size="sm">Profile</Text>
|
|
83
|
+
</View>
|
|
84
|
+
<View spacing="sm">
|
|
85
|
+
<Icon name="cog" />
|
|
86
|
+
<Text size="sm">Settings</Text>
|
|
87
|
+
</View>
|
|
88
|
+
<View spacing="sm">
|
|
89
|
+
<Icon name="bell" />
|
|
90
|
+
<Text size="sm">Notifications</Text>
|
|
91
|
+
</View>
|
|
92
|
+
</View>
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// Example 7: Action Icons
|
|
97
|
+
export function ActionIcons() {
|
|
98
|
+
return (
|
|
99
|
+
<View spacing="md">
|
|
100
|
+
<Icon name="plus" size="lg" />
|
|
101
|
+
<Icon name="pencil" size="lg" />
|
|
102
|
+
<Icon name="delete" size="lg" />
|
|
103
|
+
<Icon name="check" size="lg" />
|
|
104
|
+
<Icon name="close" size="lg" />
|
|
105
|
+
<Icon name="refresh" size="lg" />
|
|
106
|
+
</View>
|
|
107
|
+
);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// Example 8: Navigation Icons
|
|
111
|
+
export function NavigationIcons() {
|
|
112
|
+
return (
|
|
113
|
+
<View spacing="md">
|
|
114
|
+
<Icon name="chevron-up" size="lg" />
|
|
115
|
+
<Icon name="chevron-down" size="lg" />
|
|
116
|
+
<Icon name="chevron-left" size="lg" />
|
|
117
|
+
<Icon name="chevron-right" size="lg" />
|
|
118
|
+
<Icon name="arrow-left" size="lg" />
|
|
119
|
+
<Icon name="arrow-right" size="lg" />
|
|
120
|
+
</View>
|
|
121
|
+
);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
// Example 9: Status Icons with Text
|
|
125
|
+
export function StatusIconsWithText() {
|
|
126
|
+
return (
|
|
127
|
+
<View spacing="md">
|
|
128
|
+
<View spacing="sm">
|
|
129
|
+
<Icon name="check-circle" intent="success" size="md" />
|
|
130
|
+
<Text size="sm">
|
|
131
|
+
Success
|
|
132
|
+
</Text>
|
|
133
|
+
</View>
|
|
134
|
+
<View spacing="sm">
|
|
135
|
+
<Icon name="alert-circle" intent="error" size="md" />
|
|
136
|
+
<Text size="sm">
|
|
137
|
+
Error
|
|
138
|
+
</Text>
|
|
139
|
+
</View>
|
|
140
|
+
<View spacing="sm">
|
|
141
|
+
<Icon name="alert" intent="warning" size="md" />
|
|
142
|
+
<Text size="sm">
|
|
143
|
+
Warning
|
|
144
|
+
</Text>
|
|
145
|
+
</View>
|
|
146
|
+
<View spacing="sm">
|
|
147
|
+
<Icon name="information" intent="info" size="md" />
|
|
148
|
+
<Text size="sm">
|
|
149
|
+
Info
|
|
150
|
+
</Text>
|
|
151
|
+
</View>
|
|
152
|
+
</View>
|
|
153
|
+
);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
// Example 10: Social Media Icons
|
|
157
|
+
export function SocialMediaIcons() {
|
|
158
|
+
return (
|
|
159
|
+
<View spacing="md">
|
|
160
|
+
<Icon name="facebook" size="lg" />
|
|
161
|
+
<Icon name="twitter" size="lg" />
|
|
162
|
+
<Icon name="instagram" size="lg" />
|
|
163
|
+
<Icon name="linkedin" size="lg" />
|
|
164
|
+
<Icon name="youtube" size="lg" />
|
|
165
|
+
<Icon name="github" size="lg" />
|
|
166
|
+
</View>
|
|
167
|
+
);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
// Example 11: Using MDI Prefix
|
|
171
|
+
export function IconWithMDIPrefix() {
|
|
172
|
+
return (
|
|
173
|
+
<View spacing="md">
|
|
174
|
+
<Icon name="mdi:home" size="lg" />
|
|
175
|
+
<Icon name="mdi:account" size="lg" />
|
|
176
|
+
<Icon name="mdi:heart" size="lg" intent="error" />
|
|
177
|
+
</View>
|
|
178
|
+
);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
// Example 12: Icon with Accessibility
|
|
182
|
+
export function IconWithAccessibility() {
|
|
183
|
+
return (
|
|
184
|
+
<View spacing="md">
|
|
185
|
+
<Icon
|
|
186
|
+
name="magnify"
|
|
187
|
+
size="lg"
|
|
188
|
+
accessibilityLabel="Search"
|
|
189
|
+
/>
|
|
190
|
+
<Icon
|
|
191
|
+
name="account"
|
|
192
|
+
size="lg"
|
|
193
|
+
accessibilityLabel="User profile"
|
|
194
|
+
/>
|
|
195
|
+
<Icon
|
|
196
|
+
name="cog"
|
|
197
|
+
size="lg"
|
|
198
|
+
accessibilityLabel="Settings"
|
|
199
|
+
/>
|
|
200
|
+
</View>
|
|
201
|
+
);
|
|
202
|
+
}
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Input Component Examples
|
|
3
|
+
*
|
|
4
|
+
* These examples are type-checked against the actual InputProps interface
|
|
5
|
+
* to ensure accuracy and correctness.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import React from 'react';
|
|
9
|
+
import { Input, View } from '@idealyst/components';
|
|
10
|
+
|
|
11
|
+
// Example 1: Basic Input
|
|
12
|
+
export function BasicInput() {
|
|
13
|
+
const [value, setValue] = React.useState('');
|
|
14
|
+
|
|
15
|
+
return (
|
|
16
|
+
<Input
|
|
17
|
+
value={value}
|
|
18
|
+
onChangeText={setValue}
|
|
19
|
+
placeholder="Enter text..."
|
|
20
|
+
/>
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// Example 2: Input Types
|
|
25
|
+
export function InputTypes() {
|
|
26
|
+
const [value, setValue] = React.useState('');
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<View spacing="md">
|
|
30
|
+
<Input type="outlined" value={value} onChangeText={setValue} placeholder="Outlined" />
|
|
31
|
+
<Input type="filled" value={value} onChangeText={setValue} placeholder="Filled" />
|
|
32
|
+
<Input type="bare" value={value} onChangeText={setValue} placeholder="Bare" />
|
|
33
|
+
</View>
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// Example 3: Input Sizes
|
|
38
|
+
export function InputSizes() {
|
|
39
|
+
const [value, setValue] = React.useState('');
|
|
40
|
+
|
|
41
|
+
return (
|
|
42
|
+
<View spacing="md">
|
|
43
|
+
<Input size="xs" value={value} onChangeText={setValue} placeholder="Extra Small" />
|
|
44
|
+
<Input size="sm" value={value} onChangeText={setValue} placeholder="Small" />
|
|
45
|
+
<Input size="md" value={value} onChangeText={setValue} placeholder="Medium" />
|
|
46
|
+
<Input size="lg" value={value} onChangeText={setValue} placeholder="Large" />
|
|
47
|
+
<Input size="xl" value={value} onChangeText={setValue} placeholder="Extra Large" />
|
|
48
|
+
</View>
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// Example 4: Input with Icons
|
|
53
|
+
export function InputWithIcons() {
|
|
54
|
+
const [value, setValue] = React.useState('');
|
|
55
|
+
|
|
56
|
+
return (
|
|
57
|
+
<View spacing="md">
|
|
58
|
+
<Input
|
|
59
|
+
leftIcon="magnify"
|
|
60
|
+
value={value}
|
|
61
|
+
onChangeText={setValue}
|
|
62
|
+
placeholder="Search..."
|
|
63
|
+
/>
|
|
64
|
+
<Input
|
|
65
|
+
rightIcon="email"
|
|
66
|
+
value={value}
|
|
67
|
+
onChangeText={setValue}
|
|
68
|
+
placeholder="Email address"
|
|
69
|
+
/>
|
|
70
|
+
<Input
|
|
71
|
+
leftIcon="account"
|
|
72
|
+
rightIcon="check"
|
|
73
|
+
value={value}
|
|
74
|
+
onChangeText={setValue}
|
|
75
|
+
placeholder="Username"
|
|
76
|
+
/>
|
|
77
|
+
</View>
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// Example 5: Input Types (inputType)
|
|
82
|
+
export function InputInputTypes() {
|
|
83
|
+
const [text, setText] = React.useState('');
|
|
84
|
+
const [email, setEmail] = React.useState('');
|
|
85
|
+
const [password, setPassword] = React.useState('');
|
|
86
|
+
const [number, setNumber] = React.useState('');
|
|
87
|
+
|
|
88
|
+
return (
|
|
89
|
+
<View spacing="md">
|
|
90
|
+
<Input
|
|
91
|
+
inputType="text"
|
|
92
|
+
value={text}
|
|
93
|
+
onChangeText={setText}
|
|
94
|
+
placeholder="Text input"
|
|
95
|
+
/>
|
|
96
|
+
<Input
|
|
97
|
+
inputType="email"
|
|
98
|
+
leftIcon="email"
|
|
99
|
+
value={email}
|
|
100
|
+
onChangeText={setEmail}
|
|
101
|
+
placeholder="Email address"
|
|
102
|
+
/>
|
|
103
|
+
<Input
|
|
104
|
+
inputType="password"
|
|
105
|
+
leftIcon="lock"
|
|
106
|
+
value={password}
|
|
107
|
+
onChangeText={setPassword}
|
|
108
|
+
placeholder="Password"
|
|
109
|
+
showPasswordToggle
|
|
110
|
+
/>
|
|
111
|
+
<Input
|
|
112
|
+
inputType="number"
|
|
113
|
+
value={number}
|
|
114
|
+
onChangeText={setNumber}
|
|
115
|
+
placeholder="Enter number"
|
|
116
|
+
/>
|
|
117
|
+
</View>
|
|
118
|
+
);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
// Example 6: Input States
|
|
122
|
+
export function InputStates() {
|
|
123
|
+
const [value, setValue] = React.useState('');
|
|
124
|
+
|
|
125
|
+
return (
|
|
126
|
+
<View spacing="md">
|
|
127
|
+
<Input
|
|
128
|
+
value={value}
|
|
129
|
+
onChangeText={setValue}
|
|
130
|
+
placeholder="Normal state"
|
|
131
|
+
/>
|
|
132
|
+
<Input
|
|
133
|
+
value={value}
|
|
134
|
+
onChangeText={setValue}
|
|
135
|
+
placeholder="Disabled"
|
|
136
|
+
disabled
|
|
137
|
+
/>
|
|
138
|
+
<Input
|
|
139
|
+
value={value}
|
|
140
|
+
onChangeText={setValue}
|
|
141
|
+
placeholder="Error state"
|
|
142
|
+
hasError
|
|
143
|
+
/>
|
|
144
|
+
<Input
|
|
145
|
+
value={value}
|
|
146
|
+
onChangeText={setValue}
|
|
147
|
+
placeholder="Primary intent"
|
|
148
|
+
intent="primary"
|
|
149
|
+
/>
|
|
150
|
+
</View>
|
|
151
|
+
);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
// Example 7: Password Input
|
|
155
|
+
export function PasswordInput() {
|
|
156
|
+
const [password, setPassword] = React.useState('');
|
|
157
|
+
|
|
158
|
+
return (
|
|
159
|
+
<Input
|
|
160
|
+
inputType="password"
|
|
161
|
+
leftIcon="lock"
|
|
162
|
+
value={password}
|
|
163
|
+
onChangeText={setPassword}
|
|
164
|
+
placeholder="Enter password"
|
|
165
|
+
showPasswordToggle
|
|
166
|
+
secureTextEntry
|
|
167
|
+
/>
|
|
168
|
+
);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
// Example 8: Form with Validation
|
|
172
|
+
export function FormWithValidation() {
|
|
173
|
+
const [email, setEmail] = React.useState('');
|
|
174
|
+
const [password, setPassword] = React.useState('');
|
|
175
|
+
const [emailError, setEmailError] = React.useState(false);
|
|
176
|
+
|
|
177
|
+
const validateEmail = (value: string) => {
|
|
178
|
+
const isValid = /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value);
|
|
179
|
+
setEmailError(!isValid && value.length > 0);
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
return (
|
|
183
|
+
<View spacing="md">
|
|
184
|
+
<Input
|
|
185
|
+
inputType="email"
|
|
186
|
+
leftIcon="email"
|
|
187
|
+
value={email}
|
|
188
|
+
onChangeText={(value) => {
|
|
189
|
+
setEmail(value);
|
|
190
|
+
validateEmail(value);
|
|
191
|
+
}}
|
|
192
|
+
placeholder="Email"
|
|
193
|
+
hasError={emailError}
|
|
194
|
+
/>
|
|
195
|
+
<Input
|
|
196
|
+
inputType="password"
|
|
197
|
+
leftIcon="lock"
|
|
198
|
+
value={password}
|
|
199
|
+
onChangeText={setPassword}
|
|
200
|
+
placeholder="Password"
|
|
201
|
+
showPasswordToggle
|
|
202
|
+
/>
|
|
203
|
+
</View>
|
|
204
|
+
);
|
|
205
|
+
}
|