@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.
Files changed (205) hide show
  1. package/ARCHITECTURE.md +313 -0
  2. package/README.md +292 -104
  3. package/TYPE-SYSTEM.md +397 -0
  4. package/dist/index.js +170 -1
  5. package/examples/components/Accordion.examples.tsx +147 -0
  6. package/examples/components/ActivityIndicator.examples.tsx +350 -0
  7. package/examples/components/Alert.examples.tsx +335 -0
  8. package/examples/components/Avatar.examples.tsx +188 -0
  9. package/examples/components/Badge.examples.tsx +242 -0
  10. package/examples/components/Breadcrumb.examples.tsx +303 -0
  11. package/examples/components/Button.examples.tsx +113 -0
  12. package/examples/components/Card.examples.tsx +131 -0
  13. package/examples/components/Checkbox.examples.tsx +195 -0
  14. package/examples/components/Chip.examples.tsx +87 -0
  15. package/examples/components/Dialog.examples.tsx +344 -0
  16. package/examples/components/Divider.examples.tsx +258 -0
  17. package/examples/components/Icon.examples.tsx +202 -0
  18. package/examples/components/Input.examples.tsx +205 -0
  19. package/examples/components/Menu.examples.tsx +321 -0
  20. package/examples/components/Popover.examples.tsx +439 -0
  21. package/examples/components/Progress.examples.tsx +340 -0
  22. package/examples/components/RadioButton.examples.tsx +443 -0
  23. package/examples/components/Screen.examples.tsx +347 -0
  24. package/examples/components/Select.examples.tsx +279 -0
  25. package/examples/components/Skeleton.examples.tsx +278 -0
  26. package/examples/components/Slider.examples.tsx +249 -0
  27. package/examples/components/Switch.examples.tsx +94 -0
  28. package/examples/components/TabBar.examples.tsx +356 -0
  29. package/examples/components/Text.examples.tsx +177 -0
  30. package/examples/components/TextArea.examples.tsx +203 -0
  31. package/examples/components/Tooltip.examples.tsx +318 -0
  32. package/examples/components/View.examples.tsx +307 -0
  33. package/package.json +15 -2
  34. package/scripts/extract-types.ts +71 -0
  35. package/scripts/type-extractor.ts +286 -0
  36. package/scripts/validate-examples.ts +142 -0
  37. package/src/data/components/Icon.ts +1 -1
  38. package/src/data/components/index.ts +2 -0
  39. package/src/index.ts +181 -1
  40. package/src/tools/get-types.ts +169 -0
  41. package/tsconfig.examples.json +14 -0
  42. package/dist/data/cli-commands.d.ts +0 -2
  43. package/dist/data/cli-commands.d.ts.map +0 -1
  44. package/dist/data/cli-commands.js +0 -100
  45. package/dist/data/cli-commands.js.map +0 -1
  46. package/dist/data/components/Accordion.d.ts +0 -15
  47. package/dist/data/components/Accordion.d.ts.map +0 -1
  48. package/dist/data/components/Accordion.js +0 -112
  49. package/dist/data/components/Accordion.js.map +0 -1
  50. package/dist/data/components/ActivityIndicator.d.ts +0 -15
  51. package/dist/data/components/ActivityIndicator.d.ts.map +0 -1
  52. package/dist/data/components/ActivityIndicator.js +0 -82
  53. package/dist/data/components/ActivityIndicator.js.map +0 -1
  54. package/dist/data/components/Alert.d.ts +0 -15
  55. package/dist/data/components/Alert.d.ts.map +0 -1
  56. package/dist/data/components/Alert.js +0 -132
  57. package/dist/data/components/Alert.js.map +0 -1
  58. package/dist/data/components/Avatar.d.ts +0 -15
  59. package/dist/data/components/Avatar.d.ts.map +0 -1
  60. package/dist/data/components/Avatar.js +0 -93
  61. package/dist/data/components/Avatar.js.map +0 -1
  62. package/dist/data/components/Badge.d.ts +0 -15
  63. package/dist/data/components/Badge.d.ts.map +0 -1
  64. package/dist/data/components/Badge.js +0 -64
  65. package/dist/data/components/Badge.js.map +0 -1
  66. package/dist/data/components/Breadcrumb.d.ts +0 -15
  67. package/dist/data/components/Breadcrumb.d.ts.map +0 -1
  68. package/dist/data/components/Breadcrumb.js +0 -96
  69. package/dist/data/components/Breadcrumb.js.map +0 -1
  70. package/dist/data/components/Button.d.ts +0 -15
  71. package/dist/data/components/Button.d.ts.map +0 -1
  72. package/dist/data/components/Button.js +0 -87
  73. package/dist/data/components/Button.js.map +0 -1
  74. package/dist/data/components/Card.d.ts +0 -15
  75. package/dist/data/components/Card.d.ts.map +0 -1
  76. package/dist/data/components/Card.js +0 -67
  77. package/dist/data/components/Card.js.map +0 -1
  78. package/dist/data/components/Checkbox.d.ts +0 -15
  79. package/dist/data/components/Checkbox.d.ts.map +0 -1
  80. package/dist/data/components/Checkbox.js +0 -118
  81. package/dist/data/components/Checkbox.js.map +0 -1
  82. package/dist/data/components/Chip.d.ts +0 -15
  83. package/dist/data/components/Chip.d.ts.map +0 -1
  84. package/dist/data/components/Chip.js +0 -76
  85. package/dist/data/components/Chip.js.map +0 -1
  86. package/dist/data/components/Dialog.d.ts +0 -15
  87. package/dist/data/components/Dialog.d.ts.map +0 -1
  88. package/dist/data/components/Dialog.js +0 -137
  89. package/dist/data/components/Dialog.js.map +0 -1
  90. package/dist/data/components/Divider.d.ts +0 -15
  91. package/dist/data/components/Divider.d.ts.map +0 -1
  92. package/dist/data/components/Divider.js +0 -71
  93. package/dist/data/components/Divider.js.map +0 -1
  94. package/dist/data/components/Icon.d.ts +0 -15
  95. package/dist/data/components/Icon.d.ts.map +0 -1
  96. package/dist/data/components/Icon.js +0 -70
  97. package/dist/data/components/Icon.js.map +0 -1
  98. package/dist/data/components/Image.d.ts +0 -15
  99. package/dist/data/components/Image.d.ts.map +0 -1
  100. package/dist/data/components/Image.js +0 -122
  101. package/dist/data/components/Image.js.map +0 -1
  102. package/dist/data/components/Input.d.ts +0 -15
  103. package/dist/data/components/Input.d.ts.map +0 -1
  104. package/dist/data/components/Input.js +0 -109
  105. package/dist/data/components/Input.js.map +0 -1
  106. package/dist/data/components/List.d.ts +0 -15
  107. package/dist/data/components/List.d.ts.map +0 -1
  108. package/dist/data/components/List.js +0 -113
  109. package/dist/data/components/List.js.map +0 -1
  110. package/dist/data/components/Menu.d.ts +0 -15
  111. package/dist/data/components/Menu.d.ts.map +0 -1
  112. package/dist/data/components/Menu.js +0 -132
  113. package/dist/data/components/Menu.js.map +0 -1
  114. package/dist/data/components/Popover.d.ts +0 -15
  115. package/dist/data/components/Popover.d.ts.map +0 -1
  116. package/dist/data/components/Popover.js +0 -159
  117. package/dist/data/components/Popover.js.map +0 -1
  118. package/dist/data/components/Pressable.d.ts +0 -15
  119. package/dist/data/components/Pressable.d.ts.map +0 -1
  120. package/dist/data/components/Pressable.js +0 -125
  121. package/dist/data/components/Pressable.js.map +0 -1
  122. package/dist/data/components/Progress.d.ts +0 -15
  123. package/dist/data/components/Progress.d.ts.map +0 -1
  124. package/dist/data/components/Progress.js +0 -95
  125. package/dist/data/components/Progress.js.map +0 -1
  126. package/dist/data/components/RadioButton.d.ts +0 -15
  127. package/dist/data/components/RadioButton.d.ts.map +0 -1
  128. package/dist/data/components/RadioButton.js +0 -140
  129. package/dist/data/components/RadioButton.js.map +0 -1
  130. package/dist/data/components/SVGImage.d.ts +0 -15
  131. package/dist/data/components/SVGImage.d.ts.map +0 -1
  132. package/dist/data/components/SVGImage.js +0 -112
  133. package/dist/data/components/SVGImage.js.map +0 -1
  134. package/dist/data/components/Screen.d.ts +0 -15
  135. package/dist/data/components/Screen.d.ts.map +0 -1
  136. package/dist/data/components/Screen.js +0 -99
  137. package/dist/data/components/Screen.js.map +0 -1
  138. package/dist/data/components/Select.d.ts +0 -15
  139. package/dist/data/components/Select.d.ts.map +0 -1
  140. package/dist/data/components/Select.js +0 -146
  141. package/dist/data/components/Select.js.map +0 -1
  142. package/dist/data/components/Skeleton.d.ts +0 -15
  143. package/dist/data/components/Skeleton.d.ts.map +0 -1
  144. package/dist/data/components/Skeleton.js +0 -110
  145. package/dist/data/components/Skeleton.js.map +0 -1
  146. package/dist/data/components/Slider.d.ts +0 -15
  147. package/dist/data/components/Slider.d.ts.map +0 -1
  148. package/dist/data/components/Slider.js +0 -129
  149. package/dist/data/components/Slider.js.map +0 -1
  150. package/dist/data/components/Switch.d.ts +0 -15
  151. package/dist/data/components/Switch.d.ts.map +0 -1
  152. package/dist/data/components/Switch.js +0 -127
  153. package/dist/data/components/Switch.js.map +0 -1
  154. package/dist/data/components/TabBar.d.ts +0 -15
  155. package/dist/data/components/TabBar.d.ts.map +0 -1
  156. package/dist/data/components/TabBar.js +0 -145
  157. package/dist/data/components/TabBar.js.map +0 -1
  158. package/dist/data/components/Table.d.ts +0 -15
  159. package/dist/data/components/Table.d.ts.map +0 -1
  160. package/dist/data/components/Table.js +0 -151
  161. package/dist/data/components/Table.js.map +0 -1
  162. package/dist/data/components/Tabs.d.ts +0 -15
  163. package/dist/data/components/Tabs.d.ts.map +0 -1
  164. package/dist/data/components/Tabs.js +0 -150
  165. package/dist/data/components/Tabs.js.map +0 -1
  166. package/dist/data/components/Text.d.ts +0 -15
  167. package/dist/data/components/Text.d.ts.map +0 -1
  168. package/dist/data/components/Text.js +0 -85
  169. package/dist/data/components/Text.js.map +0 -1
  170. package/dist/data/components/TextArea.d.ts +0 -15
  171. package/dist/data/components/TextArea.d.ts.map +0 -1
  172. package/dist/data/components/TextArea.js +0 -155
  173. package/dist/data/components/TextArea.js.map +0 -1
  174. package/dist/data/components/Tooltip.d.ts +0 -15
  175. package/dist/data/components/Tooltip.d.ts.map +0 -1
  176. package/dist/data/components/Tooltip.js +0 -105
  177. package/dist/data/components/Tooltip.js.map +0 -1
  178. package/dist/data/components/Video.d.ts +0 -15
  179. package/dist/data/components/Video.d.ts.map +0 -1
  180. package/dist/data/components/Video.js +0 -168
  181. package/dist/data/components/Video.js.map +0 -1
  182. package/dist/data/components/View.d.ts +0 -15
  183. package/dist/data/components/View.d.ts.map +0 -1
  184. package/dist/data/components/View.js +0 -126
  185. package/dist/data/components/View.js.map +0 -1
  186. package/dist/data/components/index.d.ts +0 -37
  187. package/dist/data/components/index.d.ts.map +0 -1
  188. package/dist/data/components/index.js +0 -110
  189. package/dist/data/components/index.js.map +0 -1
  190. package/dist/data/framework-guides.d.ts +0 -2
  191. package/dist/data/framework-guides.d.ts.map +0 -1
  192. package/dist/data/framework-guides.js +0 -589
  193. package/dist/data/framework-guides.js.map +0 -1
  194. package/dist/data/icon-guide.d.ts +0 -2
  195. package/dist/data/icon-guide.d.ts.map +0 -1
  196. package/dist/data/icon-guide.js +0 -285
  197. package/dist/data/icon-guide.js.map +0 -1
  198. package/dist/data/icons.json +0 -7452
  199. package/dist/data/navigation-guides.d.ts +0 -2
  200. package/dist/data/navigation-guides.d.ts.map +0 -1
  201. package/dist/data/navigation-guides.js +0 -1196
  202. package/dist/data/navigation-guides.js.map +0 -1
  203. package/dist/index.d.ts +0 -3
  204. package/dist/index.d.ts.map +0 -1
  205. package/dist/index.js.map +0 -1
@@ -0,0 +1,278 @@
1
+ /**
2
+ * Skeleton Component Examples
3
+ *
4
+ * These examples are type-checked against the actual SkeletonProps interface
5
+ * to ensure accuracy and correctness.
6
+ */
7
+
8
+ import React from 'react';
9
+ import { Skeleton, View, Text, Button } from '@idealyst/components';
10
+
11
+ // Example 1: Basic Skeleton
12
+ export function BasicSkeleton() {
13
+ return (
14
+ <View spacing="md">
15
+ <Skeleton width="100%" height={20} />
16
+ <Skeleton width="80%" height={20} />
17
+ <Skeleton width="60%" height={20} />
18
+ </View>
19
+ );
20
+ }
21
+
22
+ // Example 2: Skeleton Shapes
23
+ export function SkeletonShapes() {
24
+ return (
25
+ <View spacing="md">
26
+ <View spacing="sm">
27
+ <Text weight="semibold">Rectangle</Text>
28
+ <Skeleton width={200} height={40} shape="rectangle" />
29
+ </View>
30
+ <View spacing="sm">
31
+ <Text weight="semibold">Rounded</Text>
32
+ <Skeleton width={200} height={40} shape="rounded" />
33
+ </View>
34
+ <View spacing="sm">
35
+ <Text weight="semibold">Circle</Text>
36
+ <Skeleton width={60} height={60} shape="circle" />
37
+ </View>
38
+ </View>
39
+ );
40
+ }
41
+
42
+ // Example 3: Skeleton with Custom Border Radius
43
+ export function SkeletonWithBorderRadius() {
44
+ return (
45
+ <View spacing="md">
46
+ <Skeleton width={200} height={40} shape="rounded" borderRadius={4} />
47
+ <Skeleton width={200} height={40} shape="rounded" borderRadius={8} />
48
+ <Skeleton width={200} height={40} shape="rounded" borderRadius={16} />
49
+ <Skeleton width={200} height={40} shape="rounded" borderRadius={24} />
50
+ </View>
51
+ );
52
+ }
53
+
54
+ // Example 4: Skeleton Animation Types
55
+ export function SkeletonAnimationTypes() {
56
+ return (
57
+ <View spacing="md">
58
+ <View spacing="sm">
59
+ <Text weight="semibold">Pulse Animation</Text>
60
+ <Skeleton width="100%" height={40} animation="pulse" />
61
+ </View>
62
+ <View spacing="sm">
63
+ <Text weight="semibold">Wave Animation</Text>
64
+ <Skeleton width="100%" height={40} animation="wave" />
65
+ </View>
66
+ <View spacing="sm">
67
+ <Text weight="semibold">No Animation</Text>
68
+ <Skeleton width="100%" height={40} animation="none" />
69
+ </View>
70
+ </View>
71
+ );
72
+ }
73
+
74
+ // Example 5: Text Skeleton
75
+ export function TextSkeleton() {
76
+ return (
77
+ <View spacing="md">
78
+ <View spacing="sm">
79
+ <Skeleton width="100%" height={24} shape="rounded" />
80
+ <Skeleton width="95%" height={16} shape="rounded" />
81
+ <Skeleton width="90%" height={16} shape="rounded" />
82
+ <Skeleton width="85%" height={16} shape="rounded" />
83
+ </View>
84
+ </View>
85
+ );
86
+ }
87
+
88
+ // Example 6: Avatar Skeleton
89
+ export function AvatarSkeleton() {
90
+ return (
91
+ <View spacing="md">
92
+ <View spacing="sm">
93
+ <Skeleton width={40} height={40} shape="circle" />
94
+ <View spacing="xs">
95
+ <Skeleton width={120} height={16} shape="rounded" />
96
+ <Skeleton width={80} height={12} shape="rounded" />
97
+ </View>
98
+ </View>
99
+ </View>
100
+ );
101
+ }
102
+
103
+ // Example 7: Card Skeleton
104
+ export function CardSkeleton() {
105
+ return (
106
+ <View background="primary" spacing="md" radius="lg">
107
+ <Skeleton width="100%" height={200} shape="rounded" />
108
+ <View spacing="sm">
109
+ <Skeleton width="80%" height={24} shape="rounded" />
110
+ <Skeleton width="100%" height={16} shape="rounded" />
111
+ <Skeleton width="100%" height={16} shape="rounded" />
112
+ <Skeleton width="60%" height={16} shape="rounded" />
113
+ </View>
114
+ <Skeleton width={120} height={40} shape="rounded" />
115
+ </View>
116
+ );
117
+ }
118
+
119
+ // Example 8: List Skeleton
120
+ export function ListSkeleton() {
121
+ return (
122
+ <View spacing="md">
123
+ {Array.from({ length: 5 }, (_, index) => (
124
+ <View key={index} spacing="sm" background="primary" radius="md">
125
+ <View spacing="sm">
126
+ <Skeleton width={50} height={50} shape="circle" />
127
+ <View spacing="xs">
128
+ <Skeleton width={150} height={16} shape="rounded" />
129
+ <Skeleton width={100} height={12} shape="rounded" />
130
+ </View>
131
+ </View>
132
+ </View>
133
+ ))}
134
+ </View>
135
+ );
136
+ }
137
+
138
+ // Example 9: Profile Skeleton
139
+ export function ProfileSkeleton() {
140
+ return (
141
+ <View spacing="lg">
142
+ <View spacing="md">
143
+ <Skeleton width={100} height={100} shape="circle" />
144
+ <View spacing="sm">
145
+ <Skeleton width={200} height={24} shape="rounded" />
146
+ <Skeleton width={150} height={16} shape="rounded" />
147
+ </View>
148
+ </View>
149
+ <View spacing="sm">
150
+ <Skeleton width="100%" height={16} shape="rounded" />
151
+ <Skeleton width="100%" height={16} shape="rounded" />
152
+ <Skeleton width="80%" height={16} shape="rounded" />
153
+ </View>
154
+ <View spacing="sm">
155
+ <Skeleton width={120} height={40} shape="rounded" />
156
+ <Skeleton width={100} height={40} shape="rounded" />
157
+ </View>
158
+ </View>
159
+ );
160
+ }
161
+
162
+ // Example 10: Table Skeleton
163
+ export function TableSkeleton() {
164
+ return (
165
+ <View spacing="md">
166
+ <View spacing="sm">
167
+ <Skeleton width="100%" height={40} shape="rectangle" />
168
+ </View>
169
+ {Array.from({ length: 5 }, (_, index) => (
170
+ <View key={index} spacing="sm">
171
+ <Skeleton width="100%" height={60} shape="rectangle" />
172
+ </View>
173
+ ))}
174
+ </View>
175
+ );
176
+ }
177
+
178
+ // Example 11: Loading State Toggle
179
+ export function LoadingStateToggle() {
180
+ const [loading, setLoading] = React.useState(true);
181
+
182
+ return (
183
+ <View spacing="lg">
184
+ <Button onPress={() => setLoading(!loading)}>
185
+ {loading ? 'Show Content' : 'Show Loading'}
186
+ </Button>
187
+ <View background="primary" spacing="md" radius="lg">
188
+ {loading ? (
189
+ <View spacing="md">
190
+ <Skeleton width={60} height={60} shape="circle" />
191
+ <View spacing="sm">
192
+ <Skeleton width="100%" height={20} shape="rounded" />
193
+ <Skeleton width="80%" height={16} shape="rounded" />
194
+ <Skeleton width="60%" height={16} shape="rounded" />
195
+ </View>
196
+ </View>
197
+ ) : (
198
+ <View spacing="md">
199
+ <Text size="lg" weight="bold">
200
+ Content Loaded
201
+ </Text>
202
+ <Text>
203
+ This is the actual content that appears after loading is complete.
204
+ </Text>
205
+ </View>
206
+ )}
207
+ </View>
208
+ </View>
209
+ );
210
+ }
211
+
212
+ // Example 12: Article Skeleton
213
+ export function ArticleSkeleton() {
214
+ return (
215
+ <View spacing="lg">
216
+ <View spacing="md">
217
+ <Skeleton width="100%" height={200} shape="rounded" />
218
+ </View>
219
+ <View spacing="sm">
220
+ <Skeleton width="90%" height={32} shape="rounded" />
221
+ <Skeleton width="60%" height={16} shape="rounded" />
222
+ </View>
223
+ <View spacing="sm">
224
+ <View spacing="xs">
225
+ <Skeleton width={40} height={40} shape="circle" />
226
+ <View spacing="xs">
227
+ <Skeleton width={120} height={14} shape="rounded" />
228
+ <Skeleton width={80} height={12} shape="rounded" />
229
+ </View>
230
+ </View>
231
+ </View>
232
+ <View spacing="xs">
233
+ <Skeleton width="100%" height={16} shape="rounded" />
234
+ <Skeleton width="100%" height={16} shape="rounded" />
235
+ <Skeleton width="100%" height={16} shape="rounded" />
236
+ <Skeleton width="100%" height={16} shape="rounded" />
237
+ <Skeleton width="70%" height={16} shape="rounded" />
238
+ </View>
239
+ </View>
240
+ );
241
+ }
242
+
243
+ // Example 13: Dashboard Skeleton
244
+ export function DashboardSkeleton() {
245
+ return (
246
+ <View spacing="lg">
247
+ <View spacing="md">
248
+ <Skeleton width={200} height={32} shape="rounded" />
249
+ </View>
250
+ <View spacing="md">
251
+ <View spacing="md">
252
+ <View background="primary" spacing="md" radius="lg">
253
+ <Skeleton width={100} height={20} shape="rounded" />
254
+ <Skeleton width={150} height={48} shape="rounded" />
255
+ </View>
256
+ <View background="primary" spacing="md" radius="lg">
257
+ <Skeleton width={100} height={20} shape="rounded" />
258
+ <Skeleton width={150} height={48} shape="rounded" />
259
+ </View>
260
+ </View>
261
+ <View spacing="md">
262
+ <View background="primary" spacing="md" radius="lg">
263
+ <Skeleton width={100} height={20} shape="rounded" />
264
+ <Skeleton width={150} height={48} shape="rounded" />
265
+ </View>
266
+ <View background="primary" spacing="md" radius="lg">
267
+ <Skeleton width={100} height={20} shape="rounded" />
268
+ <Skeleton width={150} height={48} shape="rounded" />
269
+ </View>
270
+ </View>
271
+ </View>
272
+ <View background="primary" spacing="md" radius="lg">
273
+ <Skeleton width={150} height={24} shape="rounded" />
274
+ <Skeleton width="100%" height={200} shape="rounded" />
275
+ </View>
276
+ </View>
277
+ );
278
+ }
@@ -0,0 +1,249 @@
1
+ /**
2
+ * Slider Component Examples
3
+ *
4
+ * These examples are type-checked against the actual SliderProps interface
5
+ * to ensure accuracy and correctness.
6
+ */
7
+
8
+ import React from 'react';
9
+ import { Slider, View, Text } from '@idealyst/components';
10
+
11
+ // Example 1: Basic Slider
12
+ export function BasicSlider() {
13
+ const [value, setValue] = React.useState(50);
14
+
15
+ return (
16
+ <Slider
17
+ value={value}
18
+ onValueChange={setValue}
19
+ min={0}
20
+ max={100}
21
+ />
22
+ );
23
+ }
24
+
25
+ // Example 2: Slider with Value Display
26
+ export function SliderWithValue() {
27
+ const [value, setValue] = React.useState(25);
28
+
29
+ return (
30
+ <Slider
31
+ value={value}
32
+ onValueChange={setValue}
33
+ min={0}
34
+ max={100}
35
+ showValue
36
+ />
37
+ );
38
+ }
39
+
40
+ // Example 3: Slider with Min/Max Labels
41
+ export function SliderWithMinMax() {
42
+ const [value, setValue] = React.useState(50);
43
+
44
+ return (
45
+ <Slider
46
+ value={value}
47
+ onValueChange={setValue}
48
+ min={0}
49
+ max={100}
50
+ showMinMax
51
+ showValue
52
+ />
53
+ );
54
+ }
55
+
56
+ // Example 4: Slider with Steps
57
+ export function SliderWithSteps() {
58
+ const [value, setValue] = React.useState(50);
59
+
60
+ return (
61
+ <View spacing="md">
62
+ <Text>Value: {value}</Text>
63
+ <Slider
64
+ value={value}
65
+ onValueChange={setValue}
66
+ min={0}
67
+ max={100}
68
+ step={10}
69
+ showValue
70
+ showMinMax
71
+ />
72
+ </View>
73
+ );
74
+ }
75
+
76
+ // Example 5: Slider Sizes
77
+ export function SliderSizes() {
78
+ const [value, setValue] = React.useState(50);
79
+
80
+ return (
81
+ <View spacing="lg">
82
+ <Slider size="xs" value={value} onValueChange={setValue} min={0} max={100} showValue />
83
+ <Slider size="sm" value={value} onValueChange={setValue} min={0} max={100} showValue />
84
+ <Slider size="md" value={value} onValueChange={setValue} min={0} max={100} showValue />
85
+ <Slider size="lg" value={value} onValueChange={setValue} min={0} max={100} showValue />
86
+ <Slider size="xl" value={value} onValueChange={setValue} min={0} max={100} showValue />
87
+ </View>
88
+ );
89
+ }
90
+
91
+ // Example 6: Slider Intents
92
+ export function SliderIntents() {
93
+ const [value, setValue] = React.useState(50);
94
+
95
+ return (
96
+ <View spacing="md">
97
+ <Slider intent="primary" value={value} onValueChange={setValue} min={0} max={100} showValue />
98
+ <Slider intent="success" value={value} onValueChange={setValue} min={0} max={100} showValue />
99
+ <Slider intent="error" value={value} onValueChange={setValue} min={0} max={100} showValue />
100
+ <Slider intent="warning" value={value} onValueChange={setValue} min={0} max={100} showValue />
101
+ <Slider intent="info" value={value} onValueChange={setValue} min={0} max={100} showValue />
102
+ </View>
103
+ );
104
+ }
105
+
106
+ // Example 7: Slider with Icon
107
+ export function SliderWithIcon() {
108
+ const [volume, setVolume] = React.useState(50);
109
+
110
+ return (
111
+ <View spacing="sm">
112
+ <Text>Volume: {volume}%</Text>
113
+ <Slider
114
+ icon="volume-high"
115
+ value={volume}
116
+ onValueChange={setVolume}
117
+ min={0}
118
+ max={100}
119
+ showValue
120
+ />
121
+ </View>
122
+ );
123
+ }
124
+
125
+ // Example 8: Slider with Marks
126
+ export function SliderWithMarks() {
127
+ const [value, setValue] = React.useState(50);
128
+
129
+ const marks = [
130
+ { value: 0, label: '0°C' },
131
+ { value: 25, label: '25°C' },
132
+ { value: 50, label: '50°C' },
133
+ { value: 75, label: '75°C' },
134
+ { value: 100, label: '100°C' },
135
+ ];
136
+
137
+ return (
138
+ <Slider
139
+ value={value}
140
+ onValueChange={setValue}
141
+ min={0}
142
+ max={100}
143
+ marks={marks}
144
+ showValue
145
+ />
146
+ );
147
+ }
148
+
149
+ // Example 9: Disabled Slider
150
+ export function DisabledSlider() {
151
+ return (
152
+ <Slider
153
+ value={60}
154
+ onValueChange={() => {}}
155
+ min={0}
156
+ max={100}
157
+ disabled
158
+ showValue
159
+ showMinMax
160
+ />
161
+ );
162
+ }
163
+
164
+ // Example 10: Price Range Slider
165
+ export function PriceRangeSlider() {
166
+ const [price, setPrice] = React.useState(500);
167
+
168
+ return (
169
+ <View spacing="sm">
170
+ <Text weight="bold">Maximum Price: ${price}</Text>
171
+ <Slider
172
+ icon="currency-usd"
173
+ value={price}
174
+ onValueChange={setPrice}
175
+ min={0}
176
+ max={1000}
177
+ step={50}
178
+ showValue
179
+ showMinMax
180
+ intent="success"
181
+ />
182
+ </View>
183
+ );
184
+ }
185
+
186
+ // Example 11: Brightness Control
187
+ export function BrightnessControl() {
188
+ const [brightness, setBrightness] = React.useState(75);
189
+
190
+ return (
191
+ <View spacing="sm">
192
+ <Text>Brightness: {brightness}%</Text>
193
+ <Slider
194
+ icon="brightness-6"
195
+ value={brightness}
196
+ onValueChange={setBrightness}
197
+ min={0}
198
+ max={100}
199
+ step={5}
200
+ intent="warning"
201
+ />
202
+ </View>
203
+ );
204
+ }
205
+
206
+ // Example 12: Multiple Sliders with onValueCommit
207
+ export function MultipleSliders() {
208
+ const [red, setRed] = React.useState(128);
209
+ const [green, setGreen] = React.useState(128);
210
+ const [blue, setBlue] = React.useState(128);
211
+
212
+ return (
213
+ <View spacing="md">
214
+ <View
215
+ style={{
216
+ height: 100,
217
+ backgroundColor: `rgb(${red}, ${green}, ${blue})`,
218
+ borderRadius: 8,
219
+ }}
220
+ />
221
+ <View spacing="md">
222
+ <Slider
223
+ value={red}
224
+ onValueChange={setRed}
225
+ min={0}
226
+ max={255}
227
+ showValue
228
+ intent="error"
229
+ />
230
+ <Slider
231
+ value={green}
232
+ onValueChange={setGreen}
233
+ min={0}
234
+ max={255}
235
+ showValue
236
+ intent="success"
237
+ />
238
+ <Slider
239
+ value={blue}
240
+ onValueChange={setBlue}
241
+ min={0}
242
+ max={255}
243
+ showValue
244
+ intent="info"
245
+ />
246
+ </View>
247
+ </View>
248
+ );
249
+ }
@@ -0,0 +1,94 @@
1
+ /**
2
+ * Switch Component Examples
3
+ *
4
+ * These examples are type-checked against the actual SwitchProps interface
5
+ * to ensure accuracy and correctness.
6
+ */
7
+
8
+ import React from 'react';
9
+ import { Switch, View, Text } from '@idealyst/components';
10
+
11
+ // Example 1: Basic Switch
12
+ export function BasicSwitch() {
13
+ const [checked, setChecked] = React.useState(false);
14
+
15
+ return (
16
+ <Switch checked={checked} onCheckedChange={setChecked} />
17
+ );
18
+ }
19
+
20
+ // Example 2: Switch Sizes
21
+ export function SwitchSizes() {
22
+ const [checked, setChecked] = React.useState(false);
23
+
24
+ return (
25
+ <>
26
+ <Switch checked={checked} onCheckedChange={setChecked} size="xs" />
27
+ <Switch checked={checked} onCheckedChange={setChecked} size="sm" />
28
+ <Switch checked={checked} onCheckedChange={setChecked} size="md" />
29
+ <Switch checked={checked} onCheckedChange={setChecked} size="lg" />
30
+ <Switch checked={checked} onCheckedChange={setChecked} size="xl" />
31
+ </>
32
+ );
33
+ }
34
+
35
+ // Example 3: Switch Intents
36
+ export function SwitchIntents() {
37
+ const [checked, setChecked] = React.useState(true);
38
+
39
+ return (
40
+ <>
41
+ <Switch checked={checked} onCheckedChange={setChecked} intent="primary" />
42
+ <Switch checked={checked} onCheckedChange={setChecked} intent="success" />
43
+ <Switch checked={checked} onCheckedChange={setChecked} intent="error" />
44
+ <Switch checked={checked} onCheckedChange={setChecked} intent="warning" />
45
+ <Switch checked={checked} onCheckedChange={setChecked} intent="info" />
46
+ </>
47
+ );
48
+ }
49
+
50
+ // Example 4: Disabled Switch
51
+ export function DisabledSwitch() {
52
+ return (
53
+ <>
54
+ <Switch checked={false} onCheckedChange={() => {}} disabled />
55
+ <Switch checked={true} onCheckedChange={() => {}} disabled />
56
+ </>
57
+ );
58
+ }
59
+
60
+ // Example 5: Switch with Label
61
+ export function SwitchWithLabel() {
62
+ const [checked, setChecked] = React.useState(false);
63
+
64
+ return (
65
+ <View spacing="sm" style={{ flexDirection: 'row', alignItems: 'center' }}>
66
+ <Switch checked={checked} onCheckedChange={setChecked} />
67
+ <Text>Enable notifications</Text>
68
+ </View>
69
+ );
70
+ }
71
+
72
+ // Example 6: Form with Switches
73
+ export function FormWithSwitches() {
74
+ const [notifications, setNotifications] = React.useState(true);
75
+ const [emailUpdates, setEmailUpdates] = React.useState(false);
76
+ const [darkMode, setDarkMode] = React.useState(false);
77
+
78
+ return (
79
+ <View spacing="md">
80
+ <View spacing="sm" style={{ flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between' }}>
81
+ <Text>Push Notifications</Text>
82
+ <Switch checked={notifications} onCheckedChange={setNotifications} />
83
+ </View>
84
+ <View spacing="sm" style={{ flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between' }}>
85
+ <Text>Email Updates</Text>
86
+ <Switch checked={emailUpdates} onCheckedChange={setEmailUpdates} />
87
+ </View>
88
+ <View spacing="sm" style={{ flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between' }}>
89
+ <Text>Dark Mode</Text>
90
+ <Switch checked={darkMode} onCheckedChange={setDarkMode} />
91
+ </View>
92
+ </View>
93
+ );
94
+ }