@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,242 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Badge Component Examples
|
|
3
|
+
*
|
|
4
|
+
* These examples are type-checked against the actual BadgeProps interface
|
|
5
|
+
* to ensure accuracy and correctness.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import React from 'react';
|
|
9
|
+
import { Badge, View, Text, Icon } from '@idealyst/components';
|
|
10
|
+
|
|
11
|
+
// Example 1: Basic Badge
|
|
12
|
+
export function BasicBadge() {
|
|
13
|
+
return <Badge>New</Badge>;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
// Example 2: Badge Sizes
|
|
17
|
+
export function BadgeSizes() {
|
|
18
|
+
return (
|
|
19
|
+
<View spacing="md">
|
|
20
|
+
<Badge size="xs">Extra Small</Badge>
|
|
21
|
+
<Badge size="sm">Small</Badge>
|
|
22
|
+
<Badge size="md">Medium</Badge>
|
|
23
|
+
<Badge size="lg">Large</Badge>
|
|
24
|
+
<Badge size="xl">Extra Large</Badge>
|
|
25
|
+
</View>
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// Example 3: Badge Types
|
|
30
|
+
export function BadgeTypes() {
|
|
31
|
+
return (
|
|
32
|
+
<View spacing="md">
|
|
33
|
+
<Badge type="filled">Filled</Badge>
|
|
34
|
+
<Badge type="outlined">Outlined</Badge>
|
|
35
|
+
<Badge type="dot">Dot</Badge>
|
|
36
|
+
</View>
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// Example 4: Badge Colors
|
|
41
|
+
export function BadgeColors() {
|
|
42
|
+
return (
|
|
43
|
+
<View spacing="md">
|
|
44
|
+
<Badge >Blue</Badge>
|
|
45
|
+
<Badge >Green</Badge>
|
|
46
|
+
<Badge >Red</Badge>
|
|
47
|
+
<Badge >Yellow</Badge>
|
|
48
|
+
<Badge >Purple</Badge>
|
|
49
|
+
<Badge >Gray</Badge>
|
|
50
|
+
</View>
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// Example 5: Badge with Icons (Icon Name)
|
|
55
|
+
export function BadgeWithIconName() {
|
|
56
|
+
return (
|
|
57
|
+
<View spacing="md">
|
|
58
|
+
<Badge icon="check">Verified</Badge>
|
|
59
|
+
<Badge icon="star">Premium</Badge>
|
|
60
|
+
<Badge icon="fire">Hot</Badge>
|
|
61
|
+
<Badge icon="new-box">New</Badge>
|
|
62
|
+
<Badge icon="alert">Alert</Badge>
|
|
63
|
+
</View>
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// Example 6: Badge with Icons (ReactNode)
|
|
68
|
+
export function BadgeWithIconComponent() {
|
|
69
|
+
return (
|
|
70
|
+
<View spacing="md">
|
|
71
|
+
<Badge icon={<Icon name="check" size="xs" />}>Verified</Badge>
|
|
72
|
+
<Badge icon={<Icon name="star" size="xs" />} >
|
|
73
|
+
Premium
|
|
74
|
+
</Badge>
|
|
75
|
+
<Badge icon={<Icon name="fire" size="xs" />} >
|
|
76
|
+
Hot
|
|
77
|
+
</Badge>
|
|
78
|
+
</View>
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// Example 7: Status Badges
|
|
83
|
+
export function StatusBadges() {
|
|
84
|
+
return (
|
|
85
|
+
<View spacing="md">
|
|
86
|
+
<Badge type="filled" icon="check-circle">
|
|
87
|
+
Active
|
|
88
|
+
</Badge>
|
|
89
|
+
<Badge type="filled" icon="pause-circle">
|
|
90
|
+
Paused
|
|
91
|
+
</Badge>
|
|
92
|
+
<Badge type="filled" icon="close-circle">
|
|
93
|
+
Inactive
|
|
94
|
+
</Badge>
|
|
95
|
+
<Badge type="filled" icon="clock">
|
|
96
|
+
Pending
|
|
97
|
+
</Badge>
|
|
98
|
+
</View>
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// Example 8: Outlined Badges
|
|
103
|
+
export function OutlinedBadges() {
|
|
104
|
+
return (
|
|
105
|
+
<View spacing="md">
|
|
106
|
+
<Badge type="outlined" >
|
|
107
|
+
Info
|
|
108
|
+
</Badge>
|
|
109
|
+
<Badge type="outlined" >
|
|
110
|
+
Success
|
|
111
|
+
</Badge>
|
|
112
|
+
<Badge type="outlined" >
|
|
113
|
+
Error
|
|
114
|
+
</Badge>
|
|
115
|
+
<Badge type="outlined" >
|
|
116
|
+
Warning
|
|
117
|
+
</Badge>
|
|
118
|
+
</View>
|
|
119
|
+
);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// Example 9: Dot Badges
|
|
123
|
+
export function DotBadges() {
|
|
124
|
+
return (
|
|
125
|
+
<View spacing="md">
|
|
126
|
+
<View spacing="sm">
|
|
127
|
+
<Badge type="dot" />
|
|
128
|
+
<Text>Online</Text>
|
|
129
|
+
</View>
|
|
130
|
+
<View spacing="sm">
|
|
131
|
+
<Badge type="dot" />
|
|
132
|
+
<Text>Offline</Text>
|
|
133
|
+
</View>
|
|
134
|
+
<View spacing="sm">
|
|
135
|
+
<Badge type="dot" />
|
|
136
|
+
<Text>Away</Text>
|
|
137
|
+
</View>
|
|
138
|
+
<View spacing="sm">
|
|
139
|
+
<Badge type="dot" />
|
|
140
|
+
<Text>Busy</Text>
|
|
141
|
+
</View>
|
|
142
|
+
</View>
|
|
143
|
+
);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
// Example 10: Notification Badges
|
|
147
|
+
export function NotificationBadges() {
|
|
148
|
+
return (
|
|
149
|
+
<View spacing="md">
|
|
150
|
+
<View spacing="sm">
|
|
151
|
+
<Icon name="bell" size="lg" />
|
|
152
|
+
<Badge type="filled" size="xs">
|
|
153
|
+
5
|
|
154
|
+
</Badge>
|
|
155
|
+
</View>
|
|
156
|
+
<View spacing="sm">
|
|
157
|
+
<Icon name="email" size="lg" />
|
|
158
|
+
<Badge type="filled" size="xs">
|
|
159
|
+
12
|
|
160
|
+
</Badge>
|
|
161
|
+
</View>
|
|
162
|
+
<View spacing="sm">
|
|
163
|
+
<Icon name="message" size="lg" />
|
|
164
|
+
<Badge type="filled" size="xs">
|
|
165
|
+
3
|
|
166
|
+
</Badge>
|
|
167
|
+
</View>
|
|
168
|
+
</View>
|
|
169
|
+
);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
// Example 11: Product Badges
|
|
173
|
+
export function ProductBadges() {
|
|
174
|
+
return (
|
|
175
|
+
<View spacing="md">
|
|
176
|
+
<Badge type="filled" icon="fire">
|
|
177
|
+
Sale
|
|
178
|
+
</Badge>
|
|
179
|
+
<Badge type="filled" icon="new-box">
|
|
180
|
+
New Arrival
|
|
181
|
+
</Badge>
|
|
182
|
+
<Badge type="filled" icon="star">
|
|
183
|
+
Best Seller
|
|
184
|
+
</Badge>
|
|
185
|
+
<Badge type="filled" icon="crown">
|
|
186
|
+
Premium
|
|
187
|
+
</Badge>
|
|
188
|
+
<Badge type="outlined" icon="percent">
|
|
189
|
+
20% Off
|
|
190
|
+
</Badge>
|
|
191
|
+
</View>
|
|
192
|
+
);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
// Example 12: Category Badges
|
|
196
|
+
export function CategoryBadges() {
|
|
197
|
+
return (
|
|
198
|
+
<View spacing="md">
|
|
199
|
+
<Badge type="outlined" size="sm" >
|
|
200
|
+
Technology
|
|
201
|
+
</Badge>
|
|
202
|
+
<Badge type="outlined" size="sm" >
|
|
203
|
+
Design
|
|
204
|
+
</Badge>
|
|
205
|
+
<Badge type="outlined" size="sm" >
|
|
206
|
+
Business
|
|
207
|
+
</Badge>
|
|
208
|
+
<Badge type="outlined" size="sm" >
|
|
209
|
+
Marketing
|
|
210
|
+
</Badge>
|
|
211
|
+
<Badge type="outlined" size="sm" >
|
|
212
|
+
Finance
|
|
213
|
+
</Badge>
|
|
214
|
+
</View>
|
|
215
|
+
);
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
// Example 13: User Role Badges
|
|
219
|
+
export function UserRoleBadges() {
|
|
220
|
+
return (
|
|
221
|
+
<View spacing="md">
|
|
222
|
+
<View spacing="sm">
|
|
223
|
+
<Text weight="semibold">John Doe</Text>
|
|
224
|
+
<Badge type="filled" size="sm" icon="crown">
|
|
225
|
+
Admin
|
|
226
|
+
</Badge>
|
|
227
|
+
</View>
|
|
228
|
+
<View spacing="sm">
|
|
229
|
+
<Text weight="semibold">Jane Smith</Text>
|
|
230
|
+
<Badge type="filled" size="sm" icon="shield">
|
|
231
|
+
Moderator
|
|
232
|
+
</Badge>
|
|
233
|
+
</View>
|
|
234
|
+
<View spacing="sm">
|
|
235
|
+
<Text weight="semibold">Bob Johnson</Text>
|
|
236
|
+
<Badge type="outlined" size="sm" icon="account">
|
|
237
|
+
Member
|
|
238
|
+
</Badge>
|
|
239
|
+
</View>
|
|
240
|
+
</View>
|
|
241
|
+
);
|
|
242
|
+
}
|
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Breadcrumb Component Examples
|
|
3
|
+
*
|
|
4
|
+
* These examples are type-checked against the actual BreadcrumbProps interface
|
|
5
|
+
* to ensure accuracy and correctness.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import React from 'react';
|
|
9
|
+
import { Breadcrumb, View, Text, Icon } from '@idealyst/components';
|
|
10
|
+
import type { BreadcrumbItem } from '@idealyst/components';
|
|
11
|
+
|
|
12
|
+
// Example 1: Basic Breadcrumb
|
|
13
|
+
export function BasicBreadcrumb() {
|
|
14
|
+
const items: BreadcrumbItem[] = [
|
|
15
|
+
{ label: 'Home', onPress: () => console.log('Home') },
|
|
16
|
+
{ label: 'Products', onPress: () => console.log('Products') },
|
|
17
|
+
{ label: 'Electronics', onPress: () => console.log('Electronics') },
|
|
18
|
+
{ label: 'Laptops' },
|
|
19
|
+
];
|
|
20
|
+
|
|
21
|
+
return <Breadcrumb items={items} />;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// Example 2: Breadcrumb with Icons
|
|
25
|
+
export function BreadcrumbWithIcons() {
|
|
26
|
+
const items: BreadcrumbItem[] = [
|
|
27
|
+
{ label: 'Home', icon: 'home', onPress: () => console.log('Home') },
|
|
28
|
+
{ label: 'Documents', icon: 'folder', onPress: () => console.log('Documents') },
|
|
29
|
+
{ label: 'Projects', icon: 'folder-open', onPress: () => console.log('Projects') },
|
|
30
|
+
{ label: 'Report.pdf', icon: 'file-document' },
|
|
31
|
+
];
|
|
32
|
+
|
|
33
|
+
return <Breadcrumb items={items} />;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// Example 3: Breadcrumb with Custom Icons
|
|
37
|
+
export function BreadcrumbWithCustomIcons() {
|
|
38
|
+
const items: BreadcrumbItem[] = [
|
|
39
|
+
{
|
|
40
|
+
label: 'Dashboard',
|
|
41
|
+
icon: <Icon name="view-dashboard" size="sm" />,
|
|
42
|
+
onPress: () => console.log('Dashboard'),
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
label: 'Analytics',
|
|
46
|
+
icon: <Icon name="chart-line" size="sm" />,
|
|
47
|
+
onPress: () => console.log('Analytics'),
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
label: 'Reports',
|
|
51
|
+
icon: <Icon name="file-chart" size="sm" />,
|
|
52
|
+
},
|
|
53
|
+
];
|
|
54
|
+
|
|
55
|
+
return <Breadcrumb items={items} />;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// Example 4: Breadcrumb Sizes
|
|
59
|
+
export function BreadcrumbSizes() {
|
|
60
|
+
const items: BreadcrumbItem[] = [
|
|
61
|
+
{ label: 'Home', onPress: () => {} },
|
|
62
|
+
{ label: 'Category', onPress: () => {} },
|
|
63
|
+
{ label: 'Subcategory' },
|
|
64
|
+
];
|
|
65
|
+
|
|
66
|
+
return (
|
|
67
|
+
<View spacing="lg">
|
|
68
|
+
<View spacing="sm">
|
|
69
|
+
<Text weight="semibold">Extra Small</Text>
|
|
70
|
+
<Breadcrumb items={items} size="xs" />
|
|
71
|
+
</View>
|
|
72
|
+
<View spacing="sm">
|
|
73
|
+
<Text weight="semibold">Small</Text>
|
|
74
|
+
<Breadcrumb items={items} size="sm" />
|
|
75
|
+
</View>
|
|
76
|
+
<View spacing="sm">
|
|
77
|
+
<Text weight="semibold">Medium</Text>
|
|
78
|
+
<Breadcrumb items={items} size="md" />
|
|
79
|
+
</View>
|
|
80
|
+
<View spacing="sm">
|
|
81
|
+
<Text weight="semibold">Large</Text>
|
|
82
|
+
<Breadcrumb items={items} size="lg" />
|
|
83
|
+
</View>
|
|
84
|
+
<View spacing="sm">
|
|
85
|
+
<Text weight="semibold">Extra Large</Text>
|
|
86
|
+
<Breadcrumb items={items} size="xl" />
|
|
87
|
+
</View>
|
|
88
|
+
</View>
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// Example 5: Breadcrumb with Custom Separator
|
|
93
|
+
export function BreadcrumbWithCustomSeparator() {
|
|
94
|
+
const items: BreadcrumbItem[] = [
|
|
95
|
+
{ label: 'Home', onPress: () => {} },
|
|
96
|
+
{ label: 'Products', onPress: () => {} },
|
|
97
|
+
{ label: 'Item' },
|
|
98
|
+
];
|
|
99
|
+
|
|
100
|
+
return (
|
|
101
|
+
<View spacing="md">
|
|
102
|
+
<Breadcrumb items={items} separator=">" />
|
|
103
|
+
<Breadcrumb items={items} separator="-" />
|
|
104
|
+
<Breadcrumb items={items} separator="•" />
|
|
105
|
+
<Breadcrumb items={items} separator={<Icon name="chevron-right" size="sm" />} />
|
|
106
|
+
</View>
|
|
107
|
+
);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// Example 6: Breadcrumb with Intent Colors
|
|
111
|
+
export function BreadcrumbWithIntent() {
|
|
112
|
+
const items: BreadcrumbItem[] = [
|
|
113
|
+
{ label: 'Home', onPress: () => {} },
|
|
114
|
+
{ label: 'Settings', onPress: () => {} },
|
|
115
|
+
{ label: 'Profile' },
|
|
116
|
+
];
|
|
117
|
+
|
|
118
|
+
return (
|
|
119
|
+
<View spacing="md">
|
|
120
|
+
<View spacing="sm">
|
|
121
|
+
<Text weight="semibold">Primary Intent</Text>
|
|
122
|
+
<Breadcrumb items={items} intent="primary" />
|
|
123
|
+
</View>
|
|
124
|
+
<View spacing="sm">
|
|
125
|
+
<Text weight="semibold">Neutral Intent</Text>
|
|
126
|
+
<Breadcrumb items={items} intent="neutral" />
|
|
127
|
+
</View>
|
|
128
|
+
</View>
|
|
129
|
+
);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
// Example 7: Breadcrumb with Max Items
|
|
133
|
+
export function BreadcrumbWithMaxItems() {
|
|
134
|
+
const items: BreadcrumbItem[] = [
|
|
135
|
+
{ label: 'Home', onPress: () => {} },
|
|
136
|
+
{ label: 'Level 1', onPress: () => {} },
|
|
137
|
+
{ label: 'Level 2', onPress: () => {} },
|
|
138
|
+
{ label: 'Level 3', onPress: () => {} },
|
|
139
|
+
{ label: 'Level 4', onPress: () => {} },
|
|
140
|
+
{ label: 'Current Page' },
|
|
141
|
+
];
|
|
142
|
+
|
|
143
|
+
return (
|
|
144
|
+
<View spacing="md">
|
|
145
|
+
<View spacing="sm">
|
|
146
|
+
<Text weight="semibold">All Items (6 total)</Text>
|
|
147
|
+
<Breadcrumb items={items} />
|
|
148
|
+
</View>
|
|
149
|
+
<View spacing="sm">
|
|
150
|
+
<Text weight="semibold">Max 4 Items</Text>
|
|
151
|
+
<Breadcrumb items={items} maxItems={4} />
|
|
152
|
+
</View>
|
|
153
|
+
<View spacing="sm">
|
|
154
|
+
<Text weight="semibold">Max 3 Items</Text>
|
|
155
|
+
<Breadcrumb items={items} maxItems={3} />
|
|
156
|
+
</View>
|
|
157
|
+
</View>
|
|
158
|
+
);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
// Example 8: Breadcrumb with Disabled Items
|
|
162
|
+
export function BreadcrumbWithDisabledItems() {
|
|
163
|
+
const items: BreadcrumbItem[] = [
|
|
164
|
+
{ label: 'Home', onPress: () => console.log('Home') },
|
|
165
|
+
{ label: 'Restricted', disabled: true },
|
|
166
|
+
{ label: 'Current Page' },
|
|
167
|
+
];
|
|
168
|
+
|
|
169
|
+
return (
|
|
170
|
+
<View spacing="md">
|
|
171
|
+
<Breadcrumb items={items} />
|
|
172
|
+
<Text size="sm" >
|
|
173
|
+
The "Restricted" item is disabled
|
|
174
|
+
</Text>
|
|
175
|
+
</View>
|
|
176
|
+
);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
// Example 9: Responsive Breadcrumb
|
|
180
|
+
export function ResponsiveBreadcrumb() {
|
|
181
|
+
const items: BreadcrumbItem[] = [
|
|
182
|
+
{ label: 'Home', icon: 'home', onPress: () => {} },
|
|
183
|
+
{ label: 'Products', onPress: () => {} },
|
|
184
|
+
{ label: 'Electronics', onPress: () => {} },
|
|
185
|
+
{ label: 'Laptops', onPress: () => {} },
|
|
186
|
+
{ label: 'Gaming Laptops' },
|
|
187
|
+
];
|
|
188
|
+
|
|
189
|
+
return (
|
|
190
|
+
<View spacing="md">
|
|
191
|
+
<View spacing="sm">
|
|
192
|
+
<Text weight="semibold">Responsive (collapses on narrow screens)</Text>
|
|
193
|
+
<Breadcrumb items={items} responsive minVisibleItems={3} />
|
|
194
|
+
</View>
|
|
195
|
+
<Text size="sm" >
|
|
196
|
+
Try resizing the window to see the breadcrumb collapse
|
|
197
|
+
</Text>
|
|
198
|
+
</View>
|
|
199
|
+
);
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
// Example 10: File System Navigation
|
|
203
|
+
export function FileSystemBreadcrumb() {
|
|
204
|
+
const [path, setPath] = React.useState(['Users', 'john', 'Documents', 'Projects']);
|
|
205
|
+
|
|
206
|
+
const items: BreadcrumbItem[] = [
|
|
207
|
+
{
|
|
208
|
+
label: 'Root',
|
|
209
|
+
icon: 'harddisk',
|
|
210
|
+
onPress: () => setPath([]),
|
|
211
|
+
},
|
|
212
|
+
...path.map((folder, index) => ({
|
|
213
|
+
label: folder,
|
|
214
|
+
icon: index === path.length - 1 ? 'folder-open' : 'folder',
|
|
215
|
+
onPress:
|
|
216
|
+
index < path.length - 1
|
|
217
|
+
? () => setPath(path.slice(0, index + 1))
|
|
218
|
+
: undefined,
|
|
219
|
+
})),
|
|
220
|
+
];
|
|
221
|
+
|
|
222
|
+
return (
|
|
223
|
+
<View spacing="md">
|
|
224
|
+
<Breadcrumb items={items} separator="/" />
|
|
225
|
+
<Text size="sm" >
|
|
226
|
+
Current path: /{path.join('/')}
|
|
227
|
+
</Text>
|
|
228
|
+
</View>
|
|
229
|
+
);
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
// Example 11: E-commerce Breadcrumb
|
|
233
|
+
export function EcommerceBreadcrumb() {
|
|
234
|
+
const items: BreadcrumbItem[] = [
|
|
235
|
+
{ label: 'Home', icon: 'home', onPress: () => console.log('Navigate to home') },
|
|
236
|
+
{ label: 'Electronics', onPress: () => console.log('Navigate to electronics') },
|
|
237
|
+
{ label: 'Computers', onPress: () => console.log('Navigate to computers') },
|
|
238
|
+
{ label: 'Laptops', onPress: () => console.log('Navigate to laptops') },
|
|
239
|
+
{ label: 'Gaming Laptops' },
|
|
240
|
+
];
|
|
241
|
+
|
|
242
|
+
return (
|
|
243
|
+
<View spacing="lg">
|
|
244
|
+
<Breadcrumb items={items} intent="primary" />
|
|
245
|
+
<View spacing="md">
|
|
246
|
+
<Text size="xl" weight="bold">
|
|
247
|
+
Gaming Laptops
|
|
248
|
+
</Text>
|
|
249
|
+
<Text>Browse our selection of high-performance gaming laptops.</Text>
|
|
250
|
+
</View>
|
|
251
|
+
</View>
|
|
252
|
+
);
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
// Example 12: Documentation Breadcrumb
|
|
256
|
+
export function DocumentationBreadcrumb() {
|
|
257
|
+
const items: BreadcrumbItem[] = [
|
|
258
|
+
{ label: 'Docs', icon: 'book-open', onPress: () => {} },
|
|
259
|
+
{ label: 'Components', icon: 'puzzle', onPress: () => {} },
|
|
260
|
+
{ label: 'Navigation', icon: 'navigation', onPress: () => {} },
|
|
261
|
+
{ label: 'Breadcrumb', icon: 'file-document' },
|
|
262
|
+
];
|
|
263
|
+
|
|
264
|
+
return (
|
|
265
|
+
<View spacing="lg">
|
|
266
|
+
<Breadcrumb
|
|
267
|
+
items={items}
|
|
268
|
+
size="md"
|
|
269
|
+
separator={<Icon name="chevron-right" size="xs" />}
|
|
270
|
+
/>
|
|
271
|
+
<View spacing="md">
|
|
272
|
+
<Text size="xl" weight="bold">
|
|
273
|
+
Breadcrumb Component
|
|
274
|
+
</Text>
|
|
275
|
+
<Text>
|
|
276
|
+
Learn how to use the Breadcrumb component to create hierarchical navigation in your
|
|
277
|
+
application.
|
|
278
|
+
</Text>
|
|
279
|
+
</View>
|
|
280
|
+
</View>
|
|
281
|
+
);
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
// Example 13: Settings Navigation Breadcrumb
|
|
285
|
+
export function SettingsBreadcrumb() {
|
|
286
|
+
const items: BreadcrumbItem[] = [
|
|
287
|
+
{ label: 'Settings', icon: 'cog', onPress: () => {} },
|
|
288
|
+
{ label: 'Account', icon: 'account', onPress: () => {} },
|
|
289
|
+
{ label: 'Privacy', icon: 'shield-lock' },
|
|
290
|
+
];
|
|
291
|
+
|
|
292
|
+
return (
|
|
293
|
+
<View spacing="lg">
|
|
294
|
+
<Breadcrumb items={items} intent="neutral" size="md" />
|
|
295
|
+
<View spacing="md">
|
|
296
|
+
<Text size="lg" weight="bold">
|
|
297
|
+
Privacy Settings
|
|
298
|
+
</Text>
|
|
299
|
+
<Text>Manage your privacy preferences and data sharing options.</Text>
|
|
300
|
+
</View>
|
|
301
|
+
</View>
|
|
302
|
+
);
|
|
303
|
+
}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Button Component Examples
|
|
3
|
+
*
|
|
4
|
+
* These examples are type-checked against the actual ButtonProps interface
|
|
5
|
+
* to ensure accuracy and correctness.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import React from 'react';
|
|
9
|
+
import { Button } from '@idealyst/components';
|
|
10
|
+
|
|
11
|
+
// Example 1: Basic Button
|
|
12
|
+
export function BasicButton() {
|
|
13
|
+
return (
|
|
14
|
+
<Button onPress={() => console.log('Clicked')}>
|
|
15
|
+
Click Me
|
|
16
|
+
</Button>
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// Example 2: Button Variants (types)
|
|
21
|
+
export function ButtonTypes() {
|
|
22
|
+
return (
|
|
23
|
+
<>
|
|
24
|
+
<Button type="contained" intent="primary">Contained</Button>
|
|
25
|
+
<Button type="outlined" intent="primary">Outlined</Button>
|
|
26
|
+
<Button type="text" intent="primary">Text</Button>
|
|
27
|
+
</>
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// Example 3: Button Sizes
|
|
32
|
+
export function ButtonSizes() {
|
|
33
|
+
return (
|
|
34
|
+
<>
|
|
35
|
+
<Button size="xs">Extra Small</Button>
|
|
36
|
+
<Button size="sm">Small</Button>
|
|
37
|
+
<Button size="md">Medium</Button>
|
|
38
|
+
<Button size="lg">Large</Button>
|
|
39
|
+
<Button size="xl">Extra Large</Button>
|
|
40
|
+
</>
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// Example 4: Button Intents
|
|
45
|
+
export function ButtonIntents() {
|
|
46
|
+
return (
|
|
47
|
+
<>
|
|
48
|
+
<Button intent="primary">Primary</Button>
|
|
49
|
+
<Button intent="success">Success</Button>
|
|
50
|
+
<Button intent="error">Error</Button>
|
|
51
|
+
<Button intent="warning">Warning</Button>
|
|
52
|
+
<Button intent="neutral">Neutral</Button>
|
|
53
|
+
<Button intent="info">Info</Button>
|
|
54
|
+
</>
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// Example 5: Button with Icons
|
|
59
|
+
export function ButtonWithIcons() {
|
|
60
|
+
return (
|
|
61
|
+
<>
|
|
62
|
+
<Button leftIcon="check" onPress={() => {}}>
|
|
63
|
+
Save
|
|
64
|
+
</Button>
|
|
65
|
+
<Button rightIcon="arrow-right" onPress={() => {}}>
|
|
66
|
+
Next
|
|
67
|
+
</Button>
|
|
68
|
+
<Button leftIcon="plus" rightIcon="arrow-down" onPress={() => {}}>
|
|
69
|
+
Add Item
|
|
70
|
+
</Button>
|
|
71
|
+
</>
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// Example 6: Disabled Button
|
|
76
|
+
export function DisabledButton() {
|
|
77
|
+
return (
|
|
78
|
+
<Button disabled onPress={() => {}}>
|
|
79
|
+
Disabled
|
|
80
|
+
</Button>
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// Example 7: Button with Custom Style
|
|
85
|
+
export function ButtonWithCustomStyle() {
|
|
86
|
+
return (
|
|
87
|
+
<Button type="contained" intent="primary" style={{ width: '100%' }}>
|
|
88
|
+
Full Width Button (via style)
|
|
89
|
+
</Button>
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// Example 8: Interactive Example with State
|
|
94
|
+
export function InteractiveButton() {
|
|
95
|
+
const [loading, setLoading] = React.useState(false);
|
|
96
|
+
|
|
97
|
+
const handlePress = async () => {
|
|
98
|
+
setLoading(true);
|
|
99
|
+
await new Promise(resolve => setTimeout(resolve, 2000));
|
|
100
|
+
setLoading(false);
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
return (
|
|
104
|
+
<Button
|
|
105
|
+
disabled={loading}
|
|
106
|
+
onPress={handlePress}
|
|
107
|
+
type="contained"
|
|
108
|
+
intent="primary"
|
|
109
|
+
>
|
|
110
|
+
{loading ? 'Saving...' : 'Save'}
|
|
111
|
+
</Button>
|
|
112
|
+
);
|
|
113
|
+
}
|