@idealyst/mcp-server 1.0.87 → 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,347 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Screen Component Examples
|
|
3
|
+
*
|
|
4
|
+
* These examples are type-checked against the actual ScreenProps interface
|
|
5
|
+
* to ensure accuracy and correctness.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import React from 'react';
|
|
9
|
+
import { Screen, View, Text, Button } from '@idealyst/components';
|
|
10
|
+
|
|
11
|
+
// Example 1: Basic Screen
|
|
12
|
+
export function BasicScreen() {
|
|
13
|
+
return (
|
|
14
|
+
<Screen>
|
|
15
|
+
<Text>This is a basic screen</Text>
|
|
16
|
+
</Screen>
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// Example 2: Screen with Backgrounds
|
|
21
|
+
export function ScreenWithBackgrounds() {
|
|
22
|
+
return (
|
|
23
|
+
<Screen background="primary">
|
|
24
|
+
<View spacing="md">
|
|
25
|
+
<Text size="lg" weight="bold">
|
|
26
|
+
Primary Surface Screen
|
|
27
|
+
</Text>
|
|
28
|
+
<Text>This screen has a primary surface background</Text>
|
|
29
|
+
</View>
|
|
30
|
+
</Screen>
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// Example 3: Screen with Padding Variants
|
|
35
|
+
export function ScreenWithPadding() {
|
|
36
|
+
return (
|
|
37
|
+
<Screen padding="md">
|
|
38
|
+
<View spacing="md">
|
|
39
|
+
<Text size="lg" weight="bold">
|
|
40
|
+
Padded Screen
|
|
41
|
+
</Text>
|
|
42
|
+
<Text>This screen has medium padding around all edges</Text>
|
|
43
|
+
</View>
|
|
44
|
+
</Screen>
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// Example 4: Screen with Safe Area
|
|
49
|
+
export function ScreenWithSafeArea() {
|
|
50
|
+
return (
|
|
51
|
+
<Screen safeArea padding="md">
|
|
52
|
+
<View spacing="md">
|
|
53
|
+
<Text size="lg" weight="bold">
|
|
54
|
+
Safe Area Screen
|
|
55
|
+
</Text>
|
|
56
|
+
<Text>
|
|
57
|
+
This screen respects device safe areas (notches, status bars, etc.)
|
|
58
|
+
</Text>
|
|
59
|
+
</View>
|
|
60
|
+
</Screen>
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// Example 5: Scrollable Screen
|
|
65
|
+
export function ScrollableScreen() {
|
|
66
|
+
return (
|
|
67
|
+
<Screen scrollable padding="md">
|
|
68
|
+
<View spacing="md">
|
|
69
|
+
<Text size="xl" weight="bold">
|
|
70
|
+
Scrollable Content
|
|
71
|
+
</Text>
|
|
72
|
+
{Array.from({ length: 20 }, (_, i) => (
|
|
73
|
+
<View
|
|
74
|
+
key={i}
|
|
75
|
+
background="primary"
|
|
76
|
+
spacing="md"
|
|
77
|
+
radius="md"
|
|
78
|
+
>
|
|
79
|
+
<Text weight="semibold">Item {i + 1}</Text>
|
|
80
|
+
<Text size="sm" >
|
|
81
|
+
This is a scrollable item. Add enough items to see scrolling behavior.
|
|
82
|
+
</Text>
|
|
83
|
+
</View>
|
|
84
|
+
))}
|
|
85
|
+
</View>
|
|
86
|
+
</Screen>
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// Example 6: Screen with Content Inset
|
|
91
|
+
export function ScreenWithContentInset() {
|
|
92
|
+
return (
|
|
93
|
+
<Screen
|
|
94
|
+
scrollable
|
|
95
|
+
contentInset={{ top: 20, bottom: 20, left: 16, right: 16 }}
|
|
96
|
+
>
|
|
97
|
+
<View spacing="md">
|
|
98
|
+
<Text size="lg" weight="bold">
|
|
99
|
+
Screen with Content Inset
|
|
100
|
+
</Text>
|
|
101
|
+
<Text>
|
|
102
|
+
This screen has custom content insets for top, bottom, left, and right.
|
|
103
|
+
</Text>
|
|
104
|
+
{Array.from({ length: 10 }, (_, i) => (
|
|
105
|
+
<View
|
|
106
|
+
key={i}
|
|
107
|
+
background="primary"
|
|
108
|
+
spacing="md"
|
|
109
|
+
radius="md"
|
|
110
|
+
>
|
|
111
|
+
<Text>Content Item {i + 1}</Text>
|
|
112
|
+
</View>
|
|
113
|
+
))}
|
|
114
|
+
</View>
|
|
115
|
+
</Screen>
|
|
116
|
+
);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
// Example 7: Profile Screen
|
|
120
|
+
export function ProfileScreen() {
|
|
121
|
+
return (
|
|
122
|
+
<Screen background="secondary" padding="md" safeArea>
|
|
123
|
+
<View spacing="lg">
|
|
124
|
+
<View spacing="md">
|
|
125
|
+
<Text size="xl" weight="bold">
|
|
126
|
+
John Doe
|
|
127
|
+
</Text>
|
|
128
|
+
<Text size="md" >
|
|
129
|
+
john.doe@example.com
|
|
130
|
+
</Text>
|
|
131
|
+
</View>
|
|
132
|
+
|
|
133
|
+
<View
|
|
134
|
+
background="primary"
|
|
135
|
+
spacing="md"
|
|
136
|
+
radius="lg"
|
|
137
|
+
>
|
|
138
|
+
<Text weight="semibold">Account Information</Text>
|
|
139
|
+
<View spacing="sm">
|
|
140
|
+
<Text size="sm" >
|
|
141
|
+
Member since: January 2024
|
|
142
|
+
</Text>
|
|
143
|
+
<Text size="sm" >
|
|
144
|
+
Status: Active
|
|
145
|
+
</Text>
|
|
146
|
+
</View>
|
|
147
|
+
</View>
|
|
148
|
+
|
|
149
|
+
<View
|
|
150
|
+
background="primary"
|
|
151
|
+
spacing="md"
|
|
152
|
+
radius="lg"
|
|
153
|
+
>
|
|
154
|
+
<Text weight="semibold">Settings</Text>
|
|
155
|
+
<View spacing="sm">
|
|
156
|
+
<Text size="sm">Notifications</Text>
|
|
157
|
+
<Text size="sm">Privacy</Text>
|
|
158
|
+
<Text size="sm">Security</Text>
|
|
159
|
+
</View>
|
|
160
|
+
</View>
|
|
161
|
+
</View>
|
|
162
|
+
</Screen>
|
|
163
|
+
);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
// Example 8: Dashboard Screen
|
|
167
|
+
export function DashboardScreen() {
|
|
168
|
+
return (
|
|
169
|
+
<Screen background="secondary" padding="lg" safeArea scrollable>
|
|
170
|
+
<View spacing="lg">
|
|
171
|
+
<Text size="xl" weight="bold">
|
|
172
|
+
Dashboard
|
|
173
|
+
</Text>
|
|
174
|
+
|
|
175
|
+
<View spacing="md">
|
|
176
|
+
<View
|
|
177
|
+
background="primary"
|
|
178
|
+
spacing="lg"
|
|
179
|
+
radius="lg"
|
|
180
|
+
>
|
|
181
|
+
<Text weight="semibold" size="lg">
|
|
182
|
+
Stats Overview
|
|
183
|
+
</Text>
|
|
184
|
+
<View spacing="md">
|
|
185
|
+
<View spacing="xs">
|
|
186
|
+
<Text size="sm" >
|
|
187
|
+
Total Users
|
|
188
|
+
</Text>
|
|
189
|
+
<Text size="xl" weight="bold">
|
|
190
|
+
1,234
|
|
191
|
+
</Text>
|
|
192
|
+
</View>
|
|
193
|
+
<View spacing="xs">
|
|
194
|
+
<Text size="sm" >
|
|
195
|
+
Revenue
|
|
196
|
+
</Text>
|
|
197
|
+
<Text size="xl" weight="bold">
|
|
198
|
+
$45,678
|
|
199
|
+
</Text>
|
|
200
|
+
</View>
|
|
201
|
+
</View>
|
|
202
|
+
</View>
|
|
203
|
+
|
|
204
|
+
<View
|
|
205
|
+
background="primary"
|
|
206
|
+
spacing="lg"
|
|
207
|
+
radius="lg"
|
|
208
|
+
>
|
|
209
|
+
<Text weight="semibold" size="lg">
|
|
210
|
+
Recent Activity
|
|
211
|
+
</Text>
|
|
212
|
+
<View spacing="sm">
|
|
213
|
+
<Text size="sm">New user registered</Text>
|
|
214
|
+
<Text size="sm">Payment received</Text>
|
|
215
|
+
<Text size="sm">Order completed</Text>
|
|
216
|
+
</View>
|
|
217
|
+
</View>
|
|
218
|
+
</View>
|
|
219
|
+
</View>
|
|
220
|
+
</Screen>
|
|
221
|
+
);
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
// Example 9: Form Screen
|
|
225
|
+
export function FormScreen() {
|
|
226
|
+
return (
|
|
227
|
+
<Screen background="secondary" padding="md" safeArea scrollable>
|
|
228
|
+
<View spacing="lg">
|
|
229
|
+
<View spacing="sm">
|
|
230
|
+
<Text size="xl" weight="bold">
|
|
231
|
+
Create Account
|
|
232
|
+
</Text>
|
|
233
|
+
<Text size="md" >
|
|
234
|
+
Fill in your information below
|
|
235
|
+
</Text>
|
|
236
|
+
</View>
|
|
237
|
+
|
|
238
|
+
<View spacing="md">
|
|
239
|
+
<View spacing="xs">
|
|
240
|
+
<Text size="sm" weight="semibold">
|
|
241
|
+
Full Name
|
|
242
|
+
</Text>
|
|
243
|
+
<View
|
|
244
|
+
background="primary"
|
|
245
|
+
spacing="md"
|
|
246
|
+
radius="md"
|
|
247
|
+
border="thin"
|
|
248
|
+
>
|
|
249
|
+
<Text size="sm" >
|
|
250
|
+
Enter your full name
|
|
251
|
+
</Text>
|
|
252
|
+
</View>
|
|
253
|
+
</View>
|
|
254
|
+
|
|
255
|
+
<View spacing="xs">
|
|
256
|
+
<Text size="sm" weight="semibold">
|
|
257
|
+
Email
|
|
258
|
+
</Text>
|
|
259
|
+
<View
|
|
260
|
+
background="primary"
|
|
261
|
+
spacing="md"
|
|
262
|
+
radius="md"
|
|
263
|
+
border="thin"
|
|
264
|
+
>
|
|
265
|
+
<Text size="sm" >
|
|
266
|
+
Enter your email
|
|
267
|
+
</Text>
|
|
268
|
+
</View>
|
|
269
|
+
</View>
|
|
270
|
+
|
|
271
|
+
<View spacing="xs">
|
|
272
|
+
<Text size="sm" weight="semibold">
|
|
273
|
+
Password
|
|
274
|
+
</Text>
|
|
275
|
+
<View
|
|
276
|
+
background="primary"
|
|
277
|
+
spacing="md"
|
|
278
|
+
radius="md"
|
|
279
|
+
border="thin"
|
|
280
|
+
>
|
|
281
|
+
<Text size="sm" >
|
|
282
|
+
Enter your password
|
|
283
|
+
</Text>
|
|
284
|
+
</View>
|
|
285
|
+
</View>
|
|
286
|
+
</View>
|
|
287
|
+
|
|
288
|
+
<Button>Create Account</Button>
|
|
289
|
+
</View>
|
|
290
|
+
</Screen>
|
|
291
|
+
);
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
// Example 10: Settings Screen
|
|
295
|
+
export function SettingsScreen() {
|
|
296
|
+
return (
|
|
297
|
+
<Screen background="secondary" padding="none" safeArea scrollable>
|
|
298
|
+
<View spacing="lg" marginVariant="md">
|
|
299
|
+
<Text size="xl" weight="bold">
|
|
300
|
+
Settings
|
|
301
|
+
</Text>
|
|
302
|
+
|
|
303
|
+
<View spacing="xs">
|
|
304
|
+
<Text size="sm" weight="semibold" >
|
|
305
|
+
ACCOUNT
|
|
306
|
+
</Text>
|
|
307
|
+
<View
|
|
308
|
+
background="primary"
|
|
309
|
+
spacing="none"
|
|
310
|
+
radius="md"
|
|
311
|
+
>
|
|
312
|
+
<View spacing="md" border="thin" borderColor="gray.200">
|
|
313
|
+
<Text>Profile</Text>
|
|
314
|
+
</View>
|
|
315
|
+
<View spacing="md" border="thin" borderColor="gray.200">
|
|
316
|
+
<Text>Email & Password</Text>
|
|
317
|
+
</View>
|
|
318
|
+
<View spacing="md">
|
|
319
|
+
<Text>Subscription</Text>
|
|
320
|
+
</View>
|
|
321
|
+
</View>
|
|
322
|
+
</View>
|
|
323
|
+
|
|
324
|
+
<View spacing="xs">
|
|
325
|
+
<Text size="sm" weight="semibold" >
|
|
326
|
+
PREFERENCES
|
|
327
|
+
</Text>
|
|
328
|
+
<View
|
|
329
|
+
background="primary"
|
|
330
|
+
spacing="none"
|
|
331
|
+
radius="md"
|
|
332
|
+
>
|
|
333
|
+
<View spacing="md" border="thin" borderColor="gray.200">
|
|
334
|
+
<Text>Notifications</Text>
|
|
335
|
+
</View>
|
|
336
|
+
<View spacing="md" border="thin" borderColor="gray.200">
|
|
337
|
+
<Text>Privacy</Text>
|
|
338
|
+
</View>
|
|
339
|
+
<View spacing="md">
|
|
340
|
+
<Text>Appearance</Text>
|
|
341
|
+
</View>
|
|
342
|
+
</View>
|
|
343
|
+
</View>
|
|
344
|
+
</View>
|
|
345
|
+
</Screen>
|
|
346
|
+
);
|
|
347
|
+
}
|
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Select Component Examples
|
|
3
|
+
*
|
|
4
|
+
* These examples are type-checked against the actual SelectProps interface
|
|
5
|
+
* to ensure accuracy and correctness.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import React from 'react';
|
|
9
|
+
import { Select, View } from '@idealyst/components';
|
|
10
|
+
import type { SelectOption } from '@idealyst/components';
|
|
11
|
+
|
|
12
|
+
const countryOptions: SelectOption[] = [
|
|
13
|
+
{ value: 'us', label: 'United States' },
|
|
14
|
+
{ value: 'ca', label: 'Canada' },
|
|
15
|
+
{ value: 'uk', label: 'United Kingdom' },
|
|
16
|
+
{ value: 'au', label: 'Australia' },
|
|
17
|
+
{ value: 'de', label: 'Germany' },
|
|
18
|
+
];
|
|
19
|
+
|
|
20
|
+
const fruitOptions: SelectOption[] = [
|
|
21
|
+
{ value: 'apple', label: 'Apple' },
|
|
22
|
+
{ value: 'banana', label: 'Banana' },
|
|
23
|
+
{ value: 'orange', label: 'Orange' },
|
|
24
|
+
{ value: 'grape', label: 'Grape' },
|
|
25
|
+
{ value: 'mango', label: 'Mango' },
|
|
26
|
+
];
|
|
27
|
+
|
|
28
|
+
// Example 1: Basic Select
|
|
29
|
+
export function BasicSelect() {
|
|
30
|
+
const [value, setValue] = React.useState('');
|
|
31
|
+
|
|
32
|
+
return (
|
|
33
|
+
<Select
|
|
34
|
+
options={fruitOptions}
|
|
35
|
+
value={value}
|
|
36
|
+
onValueChange={setValue}
|
|
37
|
+
placeholder="Select a fruit"
|
|
38
|
+
/>
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// Example 2: Select Types
|
|
43
|
+
export function SelectTypes() {
|
|
44
|
+
const [value, setValue] = React.useState('');
|
|
45
|
+
|
|
46
|
+
return (
|
|
47
|
+
<View spacing="md">
|
|
48
|
+
<Select
|
|
49
|
+
type="outlined"
|
|
50
|
+
options={fruitOptions}
|
|
51
|
+
value={value}
|
|
52
|
+
onValueChange={setValue}
|
|
53
|
+
placeholder="Outlined"
|
|
54
|
+
/>
|
|
55
|
+
<Select
|
|
56
|
+
type="filled"
|
|
57
|
+
options={fruitOptions}
|
|
58
|
+
value={value}
|
|
59
|
+
onValueChange={setValue}
|
|
60
|
+
placeholder="Filled"
|
|
61
|
+
/>
|
|
62
|
+
</View>
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// Example 3: Select Sizes
|
|
67
|
+
export function SelectSizes() {
|
|
68
|
+
const [value, setValue] = React.useState('');
|
|
69
|
+
|
|
70
|
+
return (
|
|
71
|
+
<View spacing="md">
|
|
72
|
+
<Select
|
|
73
|
+
size="xs"
|
|
74
|
+
options={fruitOptions}
|
|
75
|
+
value={value}
|
|
76
|
+
onValueChange={setValue}
|
|
77
|
+
placeholder="Extra Small"
|
|
78
|
+
/>
|
|
79
|
+
<Select
|
|
80
|
+
size="sm"
|
|
81
|
+
options={fruitOptions}
|
|
82
|
+
value={value}
|
|
83
|
+
onValueChange={setValue}
|
|
84
|
+
placeholder="Small"
|
|
85
|
+
/>
|
|
86
|
+
<Select
|
|
87
|
+
size="md"
|
|
88
|
+
options={fruitOptions}
|
|
89
|
+
value={value}
|
|
90
|
+
onValueChange={setValue}
|
|
91
|
+
placeholder="Medium"
|
|
92
|
+
/>
|
|
93
|
+
<Select
|
|
94
|
+
size="lg"
|
|
95
|
+
options={fruitOptions}
|
|
96
|
+
value={value}
|
|
97
|
+
onValueChange={setValue}
|
|
98
|
+
placeholder="Large"
|
|
99
|
+
/>
|
|
100
|
+
<Select
|
|
101
|
+
size="xl"
|
|
102
|
+
options={fruitOptions}
|
|
103
|
+
value={value}
|
|
104
|
+
onValueChange={setValue}
|
|
105
|
+
placeholder="Extra Large"
|
|
106
|
+
/>
|
|
107
|
+
</View>
|
|
108
|
+
);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// Example 4: Select with Label
|
|
112
|
+
export function SelectWithLabel() {
|
|
113
|
+
const [value, setValue] = React.useState('');
|
|
114
|
+
|
|
115
|
+
return (
|
|
116
|
+
<Select
|
|
117
|
+
label="Country"
|
|
118
|
+
options={countryOptions}
|
|
119
|
+
value={value}
|
|
120
|
+
onValueChange={setValue}
|
|
121
|
+
placeholder="Select your country"
|
|
122
|
+
/>
|
|
123
|
+
);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
// Example 5: Select with Helper Text
|
|
127
|
+
export function SelectWithHelperText() {
|
|
128
|
+
const [value, setValue] = React.useState('');
|
|
129
|
+
|
|
130
|
+
return (
|
|
131
|
+
<Select
|
|
132
|
+
label="Shipping Country"
|
|
133
|
+
options={countryOptions}
|
|
134
|
+
value={value}
|
|
135
|
+
onValueChange={setValue}
|
|
136
|
+
placeholder="Select country"
|
|
137
|
+
helperText="Choose where you want your order shipped"
|
|
138
|
+
/>
|
|
139
|
+
);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
// Example 6: Select with Error State
|
|
143
|
+
export function SelectWithError() {
|
|
144
|
+
const [value, setValue] = React.useState('');
|
|
145
|
+
const [submitted, setSubmitted] = React.useState(false);
|
|
146
|
+
|
|
147
|
+
const hasError = submitted && !value;
|
|
148
|
+
|
|
149
|
+
return (
|
|
150
|
+
<View spacing="md">
|
|
151
|
+
<Select
|
|
152
|
+
label="Country *"
|
|
153
|
+
options={countryOptions}
|
|
154
|
+
value={value}
|
|
155
|
+
onValueChange={setValue}
|
|
156
|
+
placeholder="Select country"
|
|
157
|
+
error={hasError}
|
|
158
|
+
helperText={hasError ? 'Please select a country' : 'Required field'}
|
|
159
|
+
/>
|
|
160
|
+
</View>
|
|
161
|
+
);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
// Example 7: Disabled Select
|
|
165
|
+
export function DisabledSelect() {
|
|
166
|
+
return (
|
|
167
|
+
<Select
|
|
168
|
+
options={fruitOptions}
|
|
169
|
+
value="apple"
|
|
170
|
+
onValueChange={() => {}}
|
|
171
|
+
placeholder="Select a fruit"
|
|
172
|
+
disabled
|
|
173
|
+
/>
|
|
174
|
+
);
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
// Example 8: Searchable Select (Web only)
|
|
178
|
+
export function SearchableSelect() {
|
|
179
|
+
const [value, setValue] = React.useState('');
|
|
180
|
+
|
|
181
|
+
const largeOptions: SelectOption[] = [
|
|
182
|
+
{ value: 'af', label: 'Afghanistan' },
|
|
183
|
+
{ value: 'al', label: 'Albania' },
|
|
184
|
+
{ value: 'dz', label: 'Algeria' },
|
|
185
|
+
{ value: 'ar', label: 'Argentina' },
|
|
186
|
+
{ value: 'au', label: 'Australia' },
|
|
187
|
+
{ value: 'at', label: 'Austria' },
|
|
188
|
+
{ value: 'br', label: 'Brazil' },
|
|
189
|
+
{ value: 'ca', label: 'Canada' },
|
|
190
|
+
{ value: 'cn', label: 'China' },
|
|
191
|
+
{ value: 'fr', label: 'France' },
|
|
192
|
+
{ value: 'de', label: 'Germany' },
|
|
193
|
+
{ value: 'in', label: 'India' },
|
|
194
|
+
{ value: 'it', label: 'Italy' },
|
|
195
|
+
{ value: 'jp', label: 'Japan' },
|
|
196
|
+
{ value: 'mx', label: 'Mexico' },
|
|
197
|
+
{ value: 'ru', label: 'Russia' },
|
|
198
|
+
{ value: 'es', label: 'Spain' },
|
|
199
|
+
{ value: 'uk', label: 'United Kingdom' },
|
|
200
|
+
{ value: 'us', label: 'United States' },
|
|
201
|
+
];
|
|
202
|
+
|
|
203
|
+
return (
|
|
204
|
+
<Select
|
|
205
|
+
label="Country"
|
|
206
|
+
options={largeOptions}
|
|
207
|
+
value={value}
|
|
208
|
+
onValueChange={setValue}
|
|
209
|
+
placeholder="Search for a country..."
|
|
210
|
+
searchable
|
|
211
|
+
maxHeight={300}
|
|
212
|
+
/>
|
|
213
|
+
);
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
// Example 9: Select with Disabled Options
|
|
217
|
+
export function SelectWithDisabledOptions() {
|
|
218
|
+
const [value, setValue] = React.useState('');
|
|
219
|
+
|
|
220
|
+
const optionsWithDisabled: SelectOption[] = [
|
|
221
|
+
{ value: 'apple', label: 'Apple' },
|
|
222
|
+
{ value: 'banana', label: 'Banana', disabled: true },
|
|
223
|
+
{ value: 'orange', label: 'Orange' },
|
|
224
|
+
{ value: 'grape', label: 'Grape', disabled: true },
|
|
225
|
+
{ value: 'mango', label: 'Mango' },
|
|
226
|
+
];
|
|
227
|
+
|
|
228
|
+
return (
|
|
229
|
+
<Select
|
|
230
|
+
label="Select a fruit"
|
|
231
|
+
options={optionsWithDisabled}
|
|
232
|
+
value={value}
|
|
233
|
+
onValueChange={setValue}
|
|
234
|
+
placeholder="Some options are disabled"
|
|
235
|
+
helperText="Banana and Grape are out of stock"
|
|
236
|
+
/>
|
|
237
|
+
);
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
// Example 10: Form with Multiple Selects
|
|
241
|
+
export function FormWithSelects() {
|
|
242
|
+
const [country, setCountry] = React.useState('');
|
|
243
|
+
const [fruit, setFruit] = React.useState('');
|
|
244
|
+
const [size, setSize] = React.useState('');
|
|
245
|
+
|
|
246
|
+
const sizeOptions: SelectOption[] = [
|
|
247
|
+
{ value: 'xs', label: 'Extra Small' },
|
|
248
|
+
{ value: 's', label: 'Small' },
|
|
249
|
+
{ value: 'm', label: 'Medium' },
|
|
250
|
+
{ value: 'l', label: 'Large' },
|
|
251
|
+
{ value: 'xl', label: 'Extra Large' },
|
|
252
|
+
];
|
|
253
|
+
|
|
254
|
+
return (
|
|
255
|
+
<View spacing="md">
|
|
256
|
+
<Select
|
|
257
|
+
label="Country"
|
|
258
|
+
options={countryOptions}
|
|
259
|
+
value={country}
|
|
260
|
+
onValueChange={setCountry}
|
|
261
|
+
placeholder="Select country"
|
|
262
|
+
/>
|
|
263
|
+
<Select
|
|
264
|
+
label="Favorite Fruit"
|
|
265
|
+
options={fruitOptions}
|
|
266
|
+
value={fruit}
|
|
267
|
+
onValueChange={setFruit}
|
|
268
|
+
placeholder="Select fruit"
|
|
269
|
+
/>
|
|
270
|
+
<Select
|
|
271
|
+
label="Size"
|
|
272
|
+
options={sizeOptions}
|
|
273
|
+
value={size}
|
|
274
|
+
onValueChange={setSize}
|
|
275
|
+
placeholder="Select size"
|
|
276
|
+
/>
|
|
277
|
+
</View>
|
|
278
|
+
);
|
|
279
|
+
}
|