@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,203 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TextArea Component Examples
|
|
3
|
+
*
|
|
4
|
+
* These examples are type-checked against the actual TextAreaProps interface
|
|
5
|
+
* to ensure accuracy and correctness.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import React from 'react';
|
|
9
|
+
import { TextArea, View } from '@idealyst/components';
|
|
10
|
+
|
|
11
|
+
// Example 1: Basic TextArea
|
|
12
|
+
export function BasicTextArea() {
|
|
13
|
+
const [value, setValue] = React.useState('');
|
|
14
|
+
|
|
15
|
+
return (
|
|
16
|
+
<TextArea
|
|
17
|
+
value={value}
|
|
18
|
+
onChange={setValue}
|
|
19
|
+
placeholder="Enter your message..."
|
|
20
|
+
/>
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// Example 2: TextArea with Label
|
|
25
|
+
export function TextAreaWithLabel() {
|
|
26
|
+
const [value, setValue] = React.useState('');
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<TextArea
|
|
30
|
+
label="Message"
|
|
31
|
+
value={value}
|
|
32
|
+
onChange={setValue}
|
|
33
|
+
placeholder="Type your message here..."
|
|
34
|
+
/>
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// Example 3: TextArea with Character Count
|
|
39
|
+
export function TextAreaWithCharacterCount() {
|
|
40
|
+
const [value, setValue] = React.useState('');
|
|
41
|
+
|
|
42
|
+
return (
|
|
43
|
+
<TextArea
|
|
44
|
+
label="Bio"
|
|
45
|
+
value={value}
|
|
46
|
+
onChange={setValue}
|
|
47
|
+
placeholder="Tell us about yourself..."
|
|
48
|
+
maxLength={200}
|
|
49
|
+
showCharacterCount
|
|
50
|
+
/>
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// Example 4: Auto-growing TextArea
|
|
55
|
+
export function AutoGrowingTextArea() {
|
|
56
|
+
const [value, setValue] = React.useState('');
|
|
57
|
+
|
|
58
|
+
return (
|
|
59
|
+
<TextArea
|
|
60
|
+
label="Comments"
|
|
61
|
+
value={value}
|
|
62
|
+
onChange={setValue}
|
|
63
|
+
placeholder="Add your comments..."
|
|
64
|
+
autoGrow
|
|
65
|
+
minHeight={60}
|
|
66
|
+
maxHeight={200}
|
|
67
|
+
/>
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// Example 5: TextArea with Fixed Rows
|
|
72
|
+
export function TextAreaWithRows() {
|
|
73
|
+
const [value, setValue] = React.useState('');
|
|
74
|
+
|
|
75
|
+
return (
|
|
76
|
+
<View spacing="md">
|
|
77
|
+
<TextArea
|
|
78
|
+
label="Short text (3 rows)"
|
|
79
|
+
value={value}
|
|
80
|
+
onChange={setValue}
|
|
81
|
+
rows={3}
|
|
82
|
+
placeholder="3 rows..."
|
|
83
|
+
/>
|
|
84
|
+
<TextArea
|
|
85
|
+
label="Long text (8 rows)"
|
|
86
|
+
value={value}
|
|
87
|
+
onChange={setValue}
|
|
88
|
+
rows={8}
|
|
89
|
+
placeholder="8 rows..."
|
|
90
|
+
/>
|
|
91
|
+
</View>
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// Example 6: TextArea Sizes
|
|
96
|
+
export function TextAreaSizes() {
|
|
97
|
+
const [value, setValue] = React.useState('');
|
|
98
|
+
|
|
99
|
+
return (
|
|
100
|
+
<View spacing="md">
|
|
101
|
+
<TextArea size="xs" value={value} onChange={setValue} placeholder="Extra Small" />
|
|
102
|
+
<TextArea size="sm" value={value} onChange={setValue} placeholder="Small" />
|
|
103
|
+
<TextArea size="md" value={value} onChange={setValue} placeholder="Medium" />
|
|
104
|
+
<TextArea size="lg" value={value} onChange={setValue} placeholder="Large" />
|
|
105
|
+
<TextArea size="xl" value={value} onChange={setValue} placeholder="Extra Large" />
|
|
106
|
+
</View>
|
|
107
|
+
);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// Example 7: TextArea with Error
|
|
111
|
+
export function TextAreaWithError() {
|
|
112
|
+
const [value, setValue] = React.useState('');
|
|
113
|
+
const [submitted, setSubmitted] = React.useState(false);
|
|
114
|
+
|
|
115
|
+
const minLength = 20;
|
|
116
|
+
const hasError = submitted && value.length < minLength;
|
|
117
|
+
|
|
118
|
+
return (
|
|
119
|
+
<View spacing="md">
|
|
120
|
+
<TextArea
|
|
121
|
+
label="Description *"
|
|
122
|
+
value={value}
|
|
123
|
+
onChange={setValue}
|
|
124
|
+
placeholder="Enter a detailed description..."
|
|
125
|
+
error={hasError ? `Description must be at least ${minLength} characters` : undefined}
|
|
126
|
+
helperText={!hasError ? `Minimum ${minLength} characters required` : undefined}
|
|
127
|
+
maxLength={500}
|
|
128
|
+
showCharacterCount
|
|
129
|
+
/>
|
|
130
|
+
</View>
|
|
131
|
+
);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
// Example 8: Disabled TextArea
|
|
135
|
+
export function DisabledTextArea() {
|
|
136
|
+
return (
|
|
137
|
+
<TextArea
|
|
138
|
+
label="Disabled TextArea"
|
|
139
|
+
value="This text area is disabled"
|
|
140
|
+
onChange={() => {}}
|
|
141
|
+
disabled
|
|
142
|
+
/>
|
|
143
|
+
);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
// Example 9: TextArea with Resize Options
|
|
147
|
+
export function TextAreaWithResize() {
|
|
148
|
+
const [value, setValue] = React.useState('');
|
|
149
|
+
|
|
150
|
+
return (
|
|
151
|
+
<View spacing="md">
|
|
152
|
+
<TextArea
|
|
153
|
+
label="No Resize"
|
|
154
|
+
value={value}
|
|
155
|
+
onChange={setValue}
|
|
156
|
+
resize="none"
|
|
157
|
+
placeholder="Cannot be resized..."
|
|
158
|
+
/>
|
|
159
|
+
<TextArea
|
|
160
|
+
label="Vertical Resize"
|
|
161
|
+
value={value}
|
|
162
|
+
onChange={setValue}
|
|
163
|
+
resize="vertical"
|
|
164
|
+
placeholder="Can resize vertically..."
|
|
165
|
+
/>
|
|
166
|
+
<TextArea
|
|
167
|
+
label="Both Directions"
|
|
168
|
+
value={value}
|
|
169
|
+
onChange={setValue}
|
|
170
|
+
resize="both"
|
|
171
|
+
placeholder="Can resize in any direction..."
|
|
172
|
+
/>
|
|
173
|
+
</View>
|
|
174
|
+
);
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
// Example 10: Form with TextArea
|
|
178
|
+
export function FormWithTextArea() {
|
|
179
|
+
const [title, setTitle] = React.useState('');
|
|
180
|
+
const [description, setDescription] = React.useState('');
|
|
181
|
+
|
|
182
|
+
return (
|
|
183
|
+
<View spacing="md">
|
|
184
|
+
<TextArea
|
|
185
|
+
label="Title"
|
|
186
|
+
value={title}
|
|
187
|
+
onChange={setTitle}
|
|
188
|
+
placeholder="Enter a title..."
|
|
189
|
+
rows={1}
|
|
190
|
+
/>
|
|
191
|
+
<TextArea
|
|
192
|
+
label="Description"
|
|
193
|
+
value={description}
|
|
194
|
+
onChange={setDescription}
|
|
195
|
+
placeholder="Provide a detailed description..."
|
|
196
|
+
rows={6}
|
|
197
|
+
maxLength={1000}
|
|
198
|
+
showCharacterCount
|
|
199
|
+
helperText="Describe your idea in detail"
|
|
200
|
+
/>
|
|
201
|
+
</View>
|
|
202
|
+
);
|
|
203
|
+
}
|
|
@@ -0,0 +1,318 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tooltip Component Examples
|
|
3
|
+
*
|
|
4
|
+
* These examples are type-checked against the actual TooltipProps interface
|
|
5
|
+
* to ensure accuracy and correctness.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import React from 'react';
|
|
9
|
+
import { Tooltip, View, Text, Button, Icon } from '@idealyst/components';
|
|
10
|
+
|
|
11
|
+
// Example 1: Basic Tooltip
|
|
12
|
+
export function BasicTooltip() {
|
|
13
|
+
return (
|
|
14
|
+
<View spacing="md">
|
|
15
|
+
<Tooltip content="This is a tooltip">
|
|
16
|
+
<Button>Hover me</Button>
|
|
17
|
+
</Tooltip>
|
|
18
|
+
</View>
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// Example 2: Tooltip Placements
|
|
23
|
+
export function TooltipPlacements() {
|
|
24
|
+
return (
|
|
25
|
+
<View spacing="md">
|
|
26
|
+
<Tooltip content="Tooltip on top" placement="top">
|
|
27
|
+
<Button size="sm">Top</Button>
|
|
28
|
+
</Tooltip>
|
|
29
|
+
<Tooltip content="Tooltip on bottom" placement="bottom">
|
|
30
|
+
<Button size="sm">Bottom</Button>
|
|
31
|
+
</Tooltip>
|
|
32
|
+
<Tooltip content="Tooltip on left" placement="left">
|
|
33
|
+
<Button size="sm">Left</Button>
|
|
34
|
+
</Tooltip>
|
|
35
|
+
<Tooltip content="Tooltip on right" placement="right">
|
|
36
|
+
<Button size="sm">Right</Button>
|
|
37
|
+
</Tooltip>
|
|
38
|
+
</View>
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// Example 3: Tooltip Sizes
|
|
43
|
+
export function TooltipSizes() {
|
|
44
|
+
return (
|
|
45
|
+
<View spacing="md">
|
|
46
|
+
<Tooltip content="Extra small tooltip" size="xs">
|
|
47
|
+
<Button size="xs">XS</Button>
|
|
48
|
+
</Tooltip>
|
|
49
|
+
<Tooltip content="Small tooltip" size="sm">
|
|
50
|
+
<Button size="sm">SM</Button>
|
|
51
|
+
</Tooltip>
|
|
52
|
+
<Tooltip content="Medium tooltip" size="md">
|
|
53
|
+
<Button size="md">MD</Button>
|
|
54
|
+
</Tooltip>
|
|
55
|
+
<Tooltip content="Large tooltip" size="lg">
|
|
56
|
+
<Button size="lg">LG</Button>
|
|
57
|
+
</Tooltip>
|
|
58
|
+
<Tooltip content="Extra large tooltip" size="xl">
|
|
59
|
+
<Button size="xl">XL</Button>
|
|
60
|
+
</Tooltip>
|
|
61
|
+
</View>
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// Example 4: Tooltip with Intent Colors
|
|
66
|
+
export function TooltipWithIntent() {
|
|
67
|
+
return (
|
|
68
|
+
<View spacing="md">
|
|
69
|
+
<Tooltip content="Primary tooltip" intent="primary">
|
|
70
|
+
<Button intent="primary">Primary</Button>
|
|
71
|
+
</Tooltip>
|
|
72
|
+
<Tooltip content="Success tooltip" intent="success">
|
|
73
|
+
<Button intent="success">Success</Button>
|
|
74
|
+
</Tooltip>
|
|
75
|
+
<Tooltip content="Error tooltip" intent="error">
|
|
76
|
+
<Button intent="error">Error</Button>
|
|
77
|
+
</Tooltip>
|
|
78
|
+
<Tooltip content="Warning tooltip" intent="warning">
|
|
79
|
+
<Button intent="warning">Warning</Button>
|
|
80
|
+
</Tooltip>
|
|
81
|
+
<Tooltip content="Info tooltip" intent="info">
|
|
82
|
+
<Button intent="info">Info</Button>
|
|
83
|
+
</Tooltip>
|
|
84
|
+
<Tooltip content="Neutral tooltip" intent="neutral">
|
|
85
|
+
<Button intent="neutral">Neutral</Button>
|
|
86
|
+
</Tooltip>
|
|
87
|
+
</View>
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// Example 5: Tooltip with Delay
|
|
92
|
+
export function TooltipWithDelay() {
|
|
93
|
+
return (
|
|
94
|
+
<View spacing="md">
|
|
95
|
+
<Tooltip content="Appears immediately" delay={0}>
|
|
96
|
+
<Button size="sm">No delay</Button>
|
|
97
|
+
</Tooltip>
|
|
98
|
+
<Tooltip content="Appears after 500ms" delay={500}>
|
|
99
|
+
<Button size="sm">500ms delay</Button>
|
|
100
|
+
</Tooltip>
|
|
101
|
+
<Tooltip content="Appears after 1 second" delay={1000}>
|
|
102
|
+
<Button size="sm">1s delay</Button>
|
|
103
|
+
</Tooltip>
|
|
104
|
+
</View>
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// Example 6: Tooltip on Icons
|
|
109
|
+
export function TooltipOnIcons() {
|
|
110
|
+
return (
|
|
111
|
+
<View spacing="md">
|
|
112
|
+
<Tooltip content="Home">
|
|
113
|
+
<Icon name="home" size="lg" style={{ cursor: 'pointer' }} />
|
|
114
|
+
</Tooltip>
|
|
115
|
+
<Tooltip content="Search">
|
|
116
|
+
<Icon name="magnify" size="lg" style={{ cursor: 'pointer' }} />
|
|
117
|
+
</Tooltip>
|
|
118
|
+
<Tooltip content="Settings">
|
|
119
|
+
<Icon name="cog" size="lg" style={{ cursor: 'pointer' }} />
|
|
120
|
+
</Tooltip>
|
|
121
|
+
<Tooltip content="Notifications">
|
|
122
|
+
<Icon name="bell" size="lg" style={{ cursor: 'pointer' }} />
|
|
123
|
+
</Tooltip>
|
|
124
|
+
<Tooltip content="Profile">
|
|
125
|
+
<Icon name="account" size="lg" style={{ cursor: 'pointer' }} />
|
|
126
|
+
</Tooltip>
|
|
127
|
+
</View>
|
|
128
|
+
);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// Example 7: Tooltip on Text
|
|
132
|
+
export function TooltipOnText() {
|
|
133
|
+
return (
|
|
134
|
+
<View spacing="md">
|
|
135
|
+
<Text>
|
|
136
|
+
This is a paragraph with a{' '}
|
|
137
|
+
<Tooltip content="This is additional information">
|
|
138
|
+
<Text weight="semibold">
|
|
139
|
+
tooltipped word
|
|
140
|
+
</Text>
|
|
141
|
+
</Tooltip>{' '}
|
|
142
|
+
in the middle of the sentence.
|
|
143
|
+
</Text>
|
|
144
|
+
</View>
|
|
145
|
+
);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
// Example 8: Tooltip with Rich Content
|
|
149
|
+
export function TooltipWithRichContent() {
|
|
150
|
+
const richContent = (
|
|
151
|
+
<View spacing="xs">
|
|
152
|
+
<Text weight="bold" size="sm" >
|
|
153
|
+
User Information
|
|
154
|
+
</Text>
|
|
155
|
+
<Text size="sm" >
|
|
156
|
+
John Doe
|
|
157
|
+
</Text>
|
|
158
|
+
<Text size="sm" >
|
|
159
|
+
john@example.com
|
|
160
|
+
</Text>
|
|
161
|
+
</View>
|
|
162
|
+
);
|
|
163
|
+
|
|
164
|
+
return (
|
|
165
|
+
<View spacing="md">
|
|
166
|
+
<Tooltip content={richContent}>
|
|
167
|
+
<Button type="outlined">Hover for details</Button>
|
|
168
|
+
</Tooltip>
|
|
169
|
+
</View>
|
|
170
|
+
);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
// Example 9: Tooltip on Disabled Elements
|
|
174
|
+
export function TooltipOnDisabledElements() {
|
|
175
|
+
return (
|
|
176
|
+
<View spacing="md">
|
|
177
|
+
<Tooltip content="This button is disabled because you don't have permission">
|
|
178
|
+
<Button disabled>Disabled Action</Button>
|
|
179
|
+
</Tooltip>
|
|
180
|
+
</View>
|
|
181
|
+
);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
// Example 10: Help Tooltips
|
|
185
|
+
export function HelpTooltips() {
|
|
186
|
+
return (
|
|
187
|
+
<View spacing="lg">
|
|
188
|
+
<View spacing="sm">
|
|
189
|
+
<View spacing="xs">
|
|
190
|
+
<Text weight="semibold">Username</Text>
|
|
191
|
+
<Tooltip content="Your username must be unique and at least 3 characters long">
|
|
192
|
+
<Icon name="help-circle" size="sm" style={{ cursor: 'pointer' }} />
|
|
193
|
+
</Tooltip>
|
|
194
|
+
</View>
|
|
195
|
+
<Text size="sm" >
|
|
196
|
+
Placeholder for input
|
|
197
|
+
</Text>
|
|
198
|
+
</View>
|
|
199
|
+
|
|
200
|
+
<View spacing="sm">
|
|
201
|
+
<View spacing="xs">
|
|
202
|
+
<Text weight="semibold">Email</Text>
|
|
203
|
+
<Tooltip content="We'll use this email for account recovery and notifications">
|
|
204
|
+
<Icon name="help-circle" size="sm" style={{ cursor: 'pointer' }} />
|
|
205
|
+
</Tooltip>
|
|
206
|
+
</View>
|
|
207
|
+
<Text size="sm" >
|
|
208
|
+
Placeholder for input
|
|
209
|
+
</Text>
|
|
210
|
+
</View>
|
|
211
|
+
|
|
212
|
+
<View spacing="sm">
|
|
213
|
+
<View spacing="xs">
|
|
214
|
+
<Text weight="semibold">Password</Text>
|
|
215
|
+
<Tooltip content="Password must be at least 8 characters with uppercase, lowercase, and numbers">
|
|
216
|
+
<Icon name="help-circle" size="sm" style={{ cursor: 'pointer' }} />
|
|
217
|
+
</Tooltip>
|
|
218
|
+
</View>
|
|
219
|
+
<Text size="sm" >
|
|
220
|
+
Placeholder for input
|
|
221
|
+
</Text>
|
|
222
|
+
</View>
|
|
223
|
+
</View>
|
|
224
|
+
);
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
// Example 11: Action Tooltips
|
|
228
|
+
export function ActionTooltips() {
|
|
229
|
+
return (
|
|
230
|
+
<View spacing="md">
|
|
231
|
+
<Tooltip content="Save your changes" placement="top">
|
|
232
|
+
<Button size="sm" intent="success">
|
|
233
|
+
<Icon name="content-save" />
|
|
234
|
+
</Button>
|
|
235
|
+
</Tooltip>
|
|
236
|
+
<Tooltip content="Discard changes" placement="top">
|
|
237
|
+
<Button size="sm" intent="error">
|
|
238
|
+
<Icon name="close" />
|
|
239
|
+
</Button>
|
|
240
|
+
</Tooltip>
|
|
241
|
+
<Tooltip content="Undo last action (Ctrl+Z)" placement="top">
|
|
242
|
+
<Button size="sm" type="outlined">
|
|
243
|
+
<Icon name="undo" />
|
|
244
|
+
</Button>
|
|
245
|
+
</Tooltip>
|
|
246
|
+
<Tooltip content="Redo last action (Ctrl+Y)" placement="top">
|
|
247
|
+
<Button size="sm" type="outlined">
|
|
248
|
+
<Icon name="redo" />
|
|
249
|
+
</Button>
|
|
250
|
+
</Tooltip>
|
|
251
|
+
</View>
|
|
252
|
+
);
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
// Example 12: Status Tooltips
|
|
256
|
+
export function StatusTooltips() {
|
|
257
|
+
return (
|
|
258
|
+
<View spacing="md">
|
|
259
|
+
<View spacing="sm">
|
|
260
|
+
<Icon name="circle" size="sm" />
|
|
261
|
+
<Tooltip content="System is operational">
|
|
262
|
+
<Text style={{ cursor: 'pointer' }}>All Systems Online</Text>
|
|
263
|
+
</Tooltip>
|
|
264
|
+
</View>
|
|
265
|
+
<View spacing="sm">
|
|
266
|
+
<Icon name="circle" size="sm" />
|
|
267
|
+
<Tooltip content="Some services are experiencing issues">
|
|
268
|
+
<Text style={{ cursor: 'pointer' }}>Partial Outage</Text>
|
|
269
|
+
</Tooltip>
|
|
270
|
+
</View>
|
|
271
|
+
<View spacing="sm">
|
|
272
|
+
<Icon name="circle" size="sm" />
|
|
273
|
+
<Tooltip content="System is currently offline for maintenance">
|
|
274
|
+
<Text style={{ cursor: 'pointer' }}>System Down</Text>
|
|
275
|
+
</Tooltip>
|
|
276
|
+
</View>
|
|
277
|
+
</View>
|
|
278
|
+
);
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
// Example 13: Keyboard Shortcut Tooltips
|
|
282
|
+
export function KeyboardShortcutTooltips() {
|
|
283
|
+
const shortcutContent = (name: string, shortcut: string) => (
|
|
284
|
+
<View spacing="xs">
|
|
285
|
+
<Text size="sm" >
|
|
286
|
+
{name}
|
|
287
|
+
</Text>
|
|
288
|
+
<Text size="sm" >
|
|
289
|
+
{shortcut}
|
|
290
|
+
</Text>
|
|
291
|
+
</View>
|
|
292
|
+
);
|
|
293
|
+
|
|
294
|
+
return (
|
|
295
|
+
<View spacing="md">
|
|
296
|
+
<Tooltip content={shortcutContent('New File', 'Ctrl+N')}>
|
|
297
|
+
<Button size="sm" type="outlined">
|
|
298
|
+
<Icon name="file-plus" />
|
|
299
|
+
</Button>
|
|
300
|
+
</Tooltip>
|
|
301
|
+
<Tooltip content={shortcutContent('Open File', 'Ctrl+O')}>
|
|
302
|
+
<Button size="sm" type="outlined">
|
|
303
|
+
<Icon name="folder-open" />
|
|
304
|
+
</Button>
|
|
305
|
+
</Tooltip>
|
|
306
|
+
<Tooltip content={shortcutContent('Save', 'Ctrl+S')}>
|
|
307
|
+
<Button size="sm" type="outlined">
|
|
308
|
+
<Icon name="content-save" />
|
|
309
|
+
</Button>
|
|
310
|
+
</Tooltip>
|
|
311
|
+
<Tooltip content={shortcutContent('Print', 'Ctrl+P')}>
|
|
312
|
+
<Button size="sm" type="outlined">
|
|
313
|
+
<Icon name="printer" />
|
|
314
|
+
</Button>
|
|
315
|
+
</Tooltip>
|
|
316
|
+
</View>
|
|
317
|
+
);
|
|
318
|
+
}
|