@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,344 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dialog Component Examples
|
|
3
|
+
*
|
|
4
|
+
* These examples are type-checked against the actual DialogProps interface
|
|
5
|
+
* to ensure accuracy and correctness.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import React from 'react';
|
|
9
|
+
import { Dialog, View, Text, Button } from '@idealyst/components';
|
|
10
|
+
|
|
11
|
+
// Example 1: Basic Dialog
|
|
12
|
+
export function BasicDialog() {
|
|
13
|
+
const [open, setOpen] = React.useState(false);
|
|
14
|
+
|
|
15
|
+
return (
|
|
16
|
+
<View spacing="md">
|
|
17
|
+
<Button onPress={() => setOpen(true)}>Open Dialog</Button>
|
|
18
|
+
<Dialog open={open} onOpenChange={setOpen}>
|
|
19
|
+
<View spacing="md">
|
|
20
|
+
<Text size="lg" weight="bold">
|
|
21
|
+
Welcome!
|
|
22
|
+
</Text>
|
|
23
|
+
<Text>This is a basic dialog with some content.</Text>
|
|
24
|
+
<Button onPress={() => setOpen(false)}>Close</Button>
|
|
25
|
+
</View>
|
|
26
|
+
</Dialog>
|
|
27
|
+
</View>
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// Example 2: Dialog with Title
|
|
32
|
+
export function DialogWithTitle() {
|
|
33
|
+
const [open, setOpen] = React.useState(false);
|
|
34
|
+
|
|
35
|
+
return (
|
|
36
|
+
<View spacing="md">
|
|
37
|
+
<Button onPress={() => setOpen(true)}>Open Dialog</Button>
|
|
38
|
+
<Dialog open={open} onOpenChange={setOpen} title="Dialog Title">
|
|
39
|
+
<View spacing="md">
|
|
40
|
+
<Text>This dialog has a title in the header.</Text>
|
|
41
|
+
<Button onPress={() => setOpen(false)}>Close</Button>
|
|
42
|
+
</View>
|
|
43
|
+
</Dialog>
|
|
44
|
+
</View>
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// Example 3: Dialog Sizes
|
|
49
|
+
export function DialogSizes() {
|
|
50
|
+
const [size, setSize] = React.useState<'sm' | 'md' | 'lg' | 'fullscreen'>('md');
|
|
51
|
+
const [open, setOpen] = React.useState(false);
|
|
52
|
+
|
|
53
|
+
return (
|
|
54
|
+
<View spacing="md">
|
|
55
|
+
<View spacing="sm">
|
|
56
|
+
<Button size="sm" onPress={() => { setSize('sm'); setOpen(true); }}>
|
|
57
|
+
Small Dialog
|
|
58
|
+
</Button>
|
|
59
|
+
<Button size="sm" onPress={() => { setSize('md'); setOpen(true); }}>
|
|
60
|
+
Medium Dialog
|
|
61
|
+
</Button>
|
|
62
|
+
<Button size="sm" onPress={() => { setSize('lg'); setOpen(true); }}>
|
|
63
|
+
Large Dialog
|
|
64
|
+
</Button>
|
|
65
|
+
<Button size="sm" onPress={() => { setSize('fullscreen'); setOpen(true); }}>
|
|
66
|
+
Fullscreen Dialog
|
|
67
|
+
</Button>
|
|
68
|
+
</View>
|
|
69
|
+
<Dialog open={open} onOpenChange={setOpen} title={`${size.toUpperCase()} Dialog`} size={size}>
|
|
70
|
+
<View spacing="md">
|
|
71
|
+
<Text>This is a {size} dialog.</Text>
|
|
72
|
+
<Button onPress={() => setOpen(false)}>Close</Button>
|
|
73
|
+
</View>
|
|
74
|
+
</Dialog>
|
|
75
|
+
</View>
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// Example 4: Dialog Types
|
|
80
|
+
export function DialogTypes() {
|
|
81
|
+
const [type, setType] = React.useState<'standard' | 'alert' | 'confirmation'>('standard');
|
|
82
|
+
const [open, setOpen] = React.useState(false);
|
|
83
|
+
|
|
84
|
+
return (
|
|
85
|
+
<View spacing="md">
|
|
86
|
+
<View spacing="sm">
|
|
87
|
+
<Button onPress={() => { setType('standard'); setOpen(true); }}>
|
|
88
|
+
Standard Dialog
|
|
89
|
+
</Button>
|
|
90
|
+
<Button onPress={() => { setType('alert'); setOpen(true); }}>
|
|
91
|
+
Alert Dialog
|
|
92
|
+
</Button>
|
|
93
|
+
<Button onPress={() => { setType('confirmation'); setOpen(true); }}>
|
|
94
|
+
Confirmation Dialog
|
|
95
|
+
</Button>
|
|
96
|
+
</View>
|
|
97
|
+
<Dialog open={open} onOpenChange={setOpen} title="Dialog" type={type}>
|
|
98
|
+
<View spacing="md">
|
|
99
|
+
<Text>This is a {type} dialog type.</Text>
|
|
100
|
+
<Button onPress={() => setOpen(false)}>Close</Button>
|
|
101
|
+
</View>
|
|
102
|
+
</Dialog>
|
|
103
|
+
</View>
|
|
104
|
+
);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// Example 5: Dialog with Close Button
|
|
108
|
+
export function DialogWithCloseButton() {
|
|
109
|
+
const [open, setOpen] = React.useState(false);
|
|
110
|
+
|
|
111
|
+
return (
|
|
112
|
+
<View spacing="md">
|
|
113
|
+
<Button onPress={() => setOpen(true)}>Open Dialog</Button>
|
|
114
|
+
<Dialog
|
|
115
|
+
open={open}
|
|
116
|
+
onOpenChange={setOpen}
|
|
117
|
+
title="Dialog with Close Button"
|
|
118
|
+
showCloseButton
|
|
119
|
+
>
|
|
120
|
+
<View spacing="md">
|
|
121
|
+
<Text>This dialog has a close button in the header.</Text>
|
|
122
|
+
</View>
|
|
123
|
+
</Dialog>
|
|
124
|
+
</View>
|
|
125
|
+
);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
// Example 6: Dialog with Backdrop Click Disabled
|
|
129
|
+
export function DialogWithBackdropDisabled() {
|
|
130
|
+
const [open, setOpen] = React.useState(false);
|
|
131
|
+
|
|
132
|
+
return (
|
|
133
|
+
<View spacing="md">
|
|
134
|
+
<Button onPress={() => setOpen(true)}>Open Dialog</Button>
|
|
135
|
+
<Dialog
|
|
136
|
+
open={open}
|
|
137
|
+
onOpenChange={setOpen}
|
|
138
|
+
title="Modal Dialog"
|
|
139
|
+
closeOnBackdropClick={false}
|
|
140
|
+
>
|
|
141
|
+
<View spacing="md">
|
|
142
|
+
<Text>
|
|
143
|
+
You cannot close this dialog by clicking outside. Use the close button instead.
|
|
144
|
+
</Text>
|
|
145
|
+
<Button onPress={() => setOpen(false)}>Close</Button>
|
|
146
|
+
</View>
|
|
147
|
+
</Dialog>
|
|
148
|
+
</View>
|
|
149
|
+
);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
// Example 7: Confirmation Dialog
|
|
153
|
+
export function ConfirmationDialog() {
|
|
154
|
+
const [open, setOpen] = React.useState(false);
|
|
155
|
+
|
|
156
|
+
const handleConfirm = () => {
|
|
157
|
+
console.log('Confirmed!');
|
|
158
|
+
setOpen(false);
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
const handleCancel = () => {
|
|
162
|
+
console.log('Cancelled');
|
|
163
|
+
setOpen(false);
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
return (
|
|
167
|
+
<View spacing="md">
|
|
168
|
+
<Button intent="error" onPress={() => setOpen(true)}>
|
|
169
|
+
Delete Item
|
|
170
|
+
</Button>
|
|
171
|
+
<Dialog
|
|
172
|
+
open={open}
|
|
173
|
+
onOpenChange={setOpen}
|
|
174
|
+
title="Confirm Deletion"
|
|
175
|
+
type="confirmation"
|
|
176
|
+
size="sm"
|
|
177
|
+
>
|
|
178
|
+
<View spacing="lg">
|
|
179
|
+
<Text>Are you sure you want to delete this item? This action cannot be undone.</Text>
|
|
180
|
+
<View spacing="sm">
|
|
181
|
+
<Button intent="error" onPress={handleConfirm}>
|
|
182
|
+
Delete
|
|
183
|
+
</Button>
|
|
184
|
+
<Button type="outlined" onPress={handleCancel}>
|
|
185
|
+
Cancel
|
|
186
|
+
</Button>
|
|
187
|
+
</View>
|
|
188
|
+
</View>
|
|
189
|
+
</Dialog>
|
|
190
|
+
</View>
|
|
191
|
+
);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
// Example 8: Form Dialog
|
|
195
|
+
export function FormDialog() {
|
|
196
|
+
const [open, setOpen] = React.useState(false);
|
|
197
|
+
const [name, setName] = React.useState('');
|
|
198
|
+
const [email, setEmail] = React.useState('');
|
|
199
|
+
|
|
200
|
+
const handleSubmit = () => {
|
|
201
|
+
console.log('Submitted:', { name, email });
|
|
202
|
+
setOpen(false);
|
|
203
|
+
setName('');
|
|
204
|
+
setEmail('');
|
|
205
|
+
};
|
|
206
|
+
|
|
207
|
+
return (
|
|
208
|
+
<View spacing="md">
|
|
209
|
+
<Button onPress={() => setOpen(true)}>Add User</Button>
|
|
210
|
+
<Dialog
|
|
211
|
+
open={open}
|
|
212
|
+
onOpenChange={setOpen}
|
|
213
|
+
title="Add New User"
|
|
214
|
+
size="md"
|
|
215
|
+
showCloseButton
|
|
216
|
+
>
|
|
217
|
+
<View spacing="lg">
|
|
218
|
+
<View spacing="sm">
|
|
219
|
+
<Text size="sm" weight="semibold">
|
|
220
|
+
Name
|
|
221
|
+
</Text>
|
|
222
|
+
<Text size="sm" >
|
|
223
|
+
Placeholder for input
|
|
224
|
+
</Text>
|
|
225
|
+
</View>
|
|
226
|
+
<View spacing="sm">
|
|
227
|
+
<Text size="sm" weight="semibold">
|
|
228
|
+
Email
|
|
229
|
+
</Text>
|
|
230
|
+
<Text size="sm" >
|
|
231
|
+
Placeholder for input
|
|
232
|
+
</Text>
|
|
233
|
+
</View>
|
|
234
|
+
<View spacing="sm">
|
|
235
|
+
<Button intent="primary" onPress={handleSubmit}>
|
|
236
|
+
Add User
|
|
237
|
+
</Button>
|
|
238
|
+
<Button type="outlined" onPress={() => setOpen(false)}>
|
|
239
|
+
Cancel
|
|
240
|
+
</Button>
|
|
241
|
+
</View>
|
|
242
|
+
</View>
|
|
243
|
+
</Dialog>
|
|
244
|
+
</View>
|
|
245
|
+
);
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
// Example 9: Alert Dialog
|
|
249
|
+
export function AlertDialog() {
|
|
250
|
+
const [open, setOpen] = React.useState(false);
|
|
251
|
+
|
|
252
|
+
return (
|
|
253
|
+
<View spacing="md">
|
|
254
|
+
<Button intent="warning" onPress={() => setOpen(true)}>
|
|
255
|
+
Show Alert
|
|
256
|
+
</Button>
|
|
257
|
+
<Dialog
|
|
258
|
+
open={open}
|
|
259
|
+
onOpenChange={setOpen}
|
|
260
|
+
title="Important Notice"
|
|
261
|
+
type="alert"
|
|
262
|
+
size="sm"
|
|
263
|
+
showCloseButton
|
|
264
|
+
>
|
|
265
|
+
<View spacing="lg">
|
|
266
|
+
<Text>
|
|
267
|
+
Your session will expire in 5 minutes. Please save your work to avoid losing any
|
|
268
|
+
changes.
|
|
269
|
+
</Text>
|
|
270
|
+
<Button onPress={() => setOpen(false)}>OK</Button>
|
|
271
|
+
</View>
|
|
272
|
+
</Dialog>
|
|
273
|
+
</View>
|
|
274
|
+
);
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
// Example 10: Dialog with Animation Types (Native)
|
|
278
|
+
export function DialogWithAnimations() {
|
|
279
|
+
const [animationType, setAnimationType] = React.useState<'slide' | 'fade' | 'none'>('fade');
|
|
280
|
+
const [open, setOpen] = React.useState(false);
|
|
281
|
+
|
|
282
|
+
return (
|
|
283
|
+
<View spacing="md">
|
|
284
|
+
<View spacing="sm">
|
|
285
|
+
<Button size="sm" onPress={() => { setAnimationType('slide'); setOpen(true); }}>
|
|
286
|
+
Slide Animation
|
|
287
|
+
</Button>
|
|
288
|
+
<Button size="sm" onPress={() => { setAnimationType('fade'); setOpen(true); }}>
|
|
289
|
+
Fade Animation
|
|
290
|
+
</Button>
|
|
291
|
+
<Button size="sm" onPress={() => { setAnimationType('none'); setOpen(true); }}>
|
|
292
|
+
No Animation
|
|
293
|
+
</Button>
|
|
294
|
+
</View>
|
|
295
|
+
<Dialog
|
|
296
|
+
open={open}
|
|
297
|
+
onOpenChange={setOpen}
|
|
298
|
+
title="Animated Dialog"
|
|
299
|
+
animationType={animationType}
|
|
300
|
+
>
|
|
301
|
+
<View spacing="md">
|
|
302
|
+
<Text>This dialog uses {animationType} animation (Native only).</Text>
|
|
303
|
+
<Button onPress={() => setOpen(false)}>Close</Button>
|
|
304
|
+
</View>
|
|
305
|
+
</Dialog>
|
|
306
|
+
</View>
|
|
307
|
+
);
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
// Example 11: Settings Dialog
|
|
311
|
+
export function SettingsDialog() {
|
|
312
|
+
const [open, setOpen] = React.useState(false);
|
|
313
|
+
|
|
314
|
+
return (
|
|
315
|
+
<View spacing="md">
|
|
316
|
+
<Button onPress={() => setOpen(true)}>Open Settings</Button>
|
|
317
|
+
<Dialog
|
|
318
|
+
open={open}
|
|
319
|
+
onOpenChange={setOpen}
|
|
320
|
+
title="Settings"
|
|
321
|
+
size="md"
|
|
322
|
+
showCloseButton
|
|
323
|
+
>
|
|
324
|
+
<View spacing="lg">
|
|
325
|
+
<View spacing="md">
|
|
326
|
+
<Text weight="semibold">Notifications</Text>
|
|
327
|
+
<View spacing="sm">
|
|
328
|
+
<Text size="sm">• Email notifications: On</Text>
|
|
329
|
+
<Text size="sm">• Push notifications: Off</Text>
|
|
330
|
+
</View>
|
|
331
|
+
</View>
|
|
332
|
+
<View spacing="md">
|
|
333
|
+
<Text weight="semibold">Privacy</Text>
|
|
334
|
+
<View spacing="sm">
|
|
335
|
+
<Text size="sm">• Profile visibility: Public</Text>
|
|
336
|
+
<Text size="sm">• Activity status: Visible</Text>
|
|
337
|
+
</View>
|
|
338
|
+
</View>
|
|
339
|
+
<Button onPress={() => setOpen(false)}>Save Changes</Button>
|
|
340
|
+
</View>
|
|
341
|
+
</Dialog>
|
|
342
|
+
</View>
|
|
343
|
+
);
|
|
344
|
+
}
|
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Divider Component Examples
|
|
3
|
+
*
|
|
4
|
+
* These examples are type-checked against the actual DividerProps interface
|
|
5
|
+
* to ensure accuracy and correctness.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import React from 'react';
|
|
9
|
+
import { Divider, View, Text } from '@idealyst/components';
|
|
10
|
+
|
|
11
|
+
// Example 1: Basic Divider
|
|
12
|
+
export function BasicDivider() {
|
|
13
|
+
return (
|
|
14
|
+
<View spacing="md">
|
|
15
|
+
<Text>Content above</Text>
|
|
16
|
+
<Divider />
|
|
17
|
+
<Text>Content below</Text>
|
|
18
|
+
</View>
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// Example 2: Divider Orientations
|
|
23
|
+
export function DividerOrientations() {
|
|
24
|
+
return (
|
|
25
|
+
<View spacing="md">
|
|
26
|
+
<View spacing="sm">
|
|
27
|
+
<Text weight="semibold">Horizontal Divider</Text>
|
|
28
|
+
<Divider orientation="horizontal" />
|
|
29
|
+
</View>
|
|
30
|
+
<View spacing="sm">
|
|
31
|
+
<Text weight="semibold">Vertical Divider</Text>
|
|
32
|
+
<View spacing="sm">
|
|
33
|
+
<Text>Left</Text>
|
|
34
|
+
<Divider orientation="vertical" />
|
|
35
|
+
<Text>Right</Text>
|
|
36
|
+
</View>
|
|
37
|
+
</View>
|
|
38
|
+
</View>
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// Example 3: Divider Types
|
|
43
|
+
export function DividerTypes() {
|
|
44
|
+
return (
|
|
45
|
+
<View spacing="md">
|
|
46
|
+
<Text>Solid divider</Text>
|
|
47
|
+
<Divider type="solid" />
|
|
48
|
+
<Text>Dashed divider</Text>
|
|
49
|
+
<Divider type="dashed" />
|
|
50
|
+
<Text>Dotted divider</Text>
|
|
51
|
+
<Divider type="dotted" />
|
|
52
|
+
</View>
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// Example 4: Divider Thickness
|
|
57
|
+
export function DividerThickness() {
|
|
58
|
+
return (
|
|
59
|
+
<View spacing="md">
|
|
60
|
+
<Text>Thin divider</Text>
|
|
61
|
+
<Divider thickness="thin" />
|
|
62
|
+
<Text>Medium divider</Text>
|
|
63
|
+
<Divider thickness="md" />
|
|
64
|
+
<Text>Thick divider</Text>
|
|
65
|
+
<Divider thickness="thick" />
|
|
66
|
+
</View>
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// Example 5: Divider with Intent Colors
|
|
71
|
+
export function DividerWithIntent() {
|
|
72
|
+
return (
|
|
73
|
+
<View spacing="md">
|
|
74
|
+
<Text>Primary intent</Text>
|
|
75
|
+
<Divider intent="primary" />
|
|
76
|
+
<Text>Success intent</Text>
|
|
77
|
+
<Divider intent="success" />
|
|
78
|
+
<Text>Error intent</Text>
|
|
79
|
+
<Divider intent="error" />
|
|
80
|
+
<Text>Warning intent</Text>
|
|
81
|
+
<Divider intent="warning" />
|
|
82
|
+
<Text>Info intent</Text>
|
|
83
|
+
<Divider intent="info" />
|
|
84
|
+
<Text>Neutral intent</Text>
|
|
85
|
+
<Divider intent="neutral" />
|
|
86
|
+
</View>
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// Example 6: Divider with Text
|
|
91
|
+
export function DividerWithText() {
|
|
92
|
+
return (
|
|
93
|
+
<View spacing="md">
|
|
94
|
+
<Text>Section 1 content</Text>
|
|
95
|
+
<Divider>OR</Divider>
|
|
96
|
+
<Text>Section 2 content</Text>
|
|
97
|
+
<Divider>
|
|
98
|
+
<Text size="sm" >
|
|
99
|
+
Continue Reading
|
|
100
|
+
</Text>
|
|
101
|
+
</Divider>
|
|
102
|
+
<Text>More content here</Text>
|
|
103
|
+
</View>
|
|
104
|
+
);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// Example 7: Divider Spacing
|
|
108
|
+
export function DividerSpacing() {
|
|
109
|
+
return (
|
|
110
|
+
<View spacing="md">
|
|
111
|
+
<Text>No spacing</Text>
|
|
112
|
+
<Divider spacing="none" />
|
|
113
|
+
<Text>Small spacing</Text>
|
|
114
|
+
<Divider spacing="sm" />
|
|
115
|
+
<Text>Medium spacing</Text>
|
|
116
|
+
<Divider spacing="md" />
|
|
117
|
+
<Text>Large spacing</Text>
|
|
118
|
+
<Divider spacing="lg" />
|
|
119
|
+
<Text>Extra large spacing</Text>
|
|
120
|
+
<Divider spacing="xl" />
|
|
121
|
+
<Text>After content</Text>
|
|
122
|
+
</View>
|
|
123
|
+
);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
// Example 8: Divider Length Variants
|
|
127
|
+
export function DividerLength() {
|
|
128
|
+
return (
|
|
129
|
+
<View spacing="md">
|
|
130
|
+
<Text>Full length divider</Text>
|
|
131
|
+
<Divider length="full" />
|
|
132
|
+
<Text>Auto length divider</Text>
|
|
133
|
+
<Divider length="auto" />
|
|
134
|
+
<Text>Custom length divider (80%)</Text>
|
|
135
|
+
<Divider length={80} />
|
|
136
|
+
</View>
|
|
137
|
+
);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
// Example 9: Section Dividers
|
|
141
|
+
export function SectionDividers() {
|
|
142
|
+
return (
|
|
143
|
+
<View spacing="lg">
|
|
144
|
+
<View spacing="md">
|
|
145
|
+
<Text size="lg" weight="bold">
|
|
146
|
+
Section 1
|
|
147
|
+
</Text>
|
|
148
|
+
<Text>
|
|
149
|
+
This is the first section of content with some important information.
|
|
150
|
+
</Text>
|
|
151
|
+
</View>
|
|
152
|
+
|
|
153
|
+
<Divider spacing="lg" thickness="md" />
|
|
154
|
+
|
|
155
|
+
<View spacing="md">
|
|
156
|
+
<Text size="lg" weight="bold">
|
|
157
|
+
Section 2
|
|
158
|
+
</Text>
|
|
159
|
+
<Text>
|
|
160
|
+
This is the second section with more content to display.
|
|
161
|
+
</Text>
|
|
162
|
+
</View>
|
|
163
|
+
|
|
164
|
+
<Divider spacing="lg" thickness="md" />
|
|
165
|
+
|
|
166
|
+
<View spacing="md">
|
|
167
|
+
<Text size="lg" weight="bold">
|
|
168
|
+
Section 3
|
|
169
|
+
</Text>
|
|
170
|
+
<Text>
|
|
171
|
+
This is the third and final section.
|
|
172
|
+
</Text>
|
|
173
|
+
</View>
|
|
174
|
+
</View>
|
|
175
|
+
);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
// Example 10: Styled Dividers
|
|
179
|
+
export function StyledDividers() {
|
|
180
|
+
return (
|
|
181
|
+
<View spacing="md">
|
|
182
|
+
<Text weight="bold">Thick Primary Divider</Text>
|
|
183
|
+
<Divider thickness="thick" intent="primary" spacing="md" />
|
|
184
|
+
|
|
185
|
+
<Text weight="bold">Dashed Success Divider</Text>
|
|
186
|
+
<Divider type="dashed" intent="success" spacing="md" />
|
|
187
|
+
|
|
188
|
+
<Text weight="bold">Dotted Warning Divider</Text>
|
|
189
|
+
<Divider type="dotted" intent="warning" thickness="md" spacing="md" />
|
|
190
|
+
|
|
191
|
+
<Text weight="bold">Thick Error Divider</Text>
|
|
192
|
+
<Divider thickness="thick" intent="error" spacing="md" />
|
|
193
|
+
</View>
|
|
194
|
+
);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
// Example 11: Form Section Dividers
|
|
198
|
+
export function FormSectionDividers() {
|
|
199
|
+
return (
|
|
200
|
+
<View spacing="lg">
|
|
201
|
+
<View spacing="md">
|
|
202
|
+
<Text size="lg" weight="bold">
|
|
203
|
+
Personal Information
|
|
204
|
+
</Text>
|
|
205
|
+
<View spacing="sm">
|
|
206
|
+
<Text size="sm">Name: John Doe</Text>
|
|
207
|
+
<Text size="sm">Email: john@example.com</Text>
|
|
208
|
+
</View>
|
|
209
|
+
</View>
|
|
210
|
+
|
|
211
|
+
<Divider spacing="lg">
|
|
212
|
+
<Text size="sm" weight="semibold" >
|
|
213
|
+
CONTACT DETAILS
|
|
214
|
+
</Text>
|
|
215
|
+
</Divider>
|
|
216
|
+
|
|
217
|
+
<View spacing="md">
|
|
218
|
+
<View spacing="sm">
|
|
219
|
+
<Text size="sm">Phone: (555) 123-4567</Text>
|
|
220
|
+
<Text size="sm">Address: 123 Main St</Text>
|
|
221
|
+
</View>
|
|
222
|
+
</View>
|
|
223
|
+
|
|
224
|
+
<Divider spacing="lg">
|
|
225
|
+
<Text size="sm" weight="semibold" >
|
|
226
|
+
PREFERENCES
|
|
227
|
+
</Text>
|
|
228
|
+
</Divider>
|
|
229
|
+
|
|
230
|
+
<View spacing="md">
|
|
231
|
+
<View spacing="sm">
|
|
232
|
+
<Text size="sm">Theme: Dark</Text>
|
|
233
|
+
<Text size="sm">Notifications: Enabled</Text>
|
|
234
|
+
</View>
|
|
235
|
+
</View>
|
|
236
|
+
</View>
|
|
237
|
+
);
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
// Example 12: List Item Dividers
|
|
241
|
+
export function ListItemDividers() {
|
|
242
|
+
const items = ['Item 1', 'Item 2', 'Item 3', 'Item 4', 'Item 5'];
|
|
243
|
+
|
|
244
|
+
return (
|
|
245
|
+
<View spacing="none">
|
|
246
|
+
{items.map((item, index) => (
|
|
247
|
+
<React.Fragment key={item}>
|
|
248
|
+
<View spacing="md">
|
|
249
|
+
<Text>{item}</Text>
|
|
250
|
+
</View>
|
|
251
|
+
{index < items.length - 1 && (
|
|
252
|
+
<Divider spacing="none" thickness="thin" />
|
|
253
|
+
)}
|
|
254
|
+
</React.Fragment>
|
|
255
|
+
))}
|
|
256
|
+
</View>
|
|
257
|
+
);
|
|
258
|
+
}
|