@idealyst/mcp-server 1.0.84
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/README.md +202 -0
- package/dist/data/cli-commands.d.ts +2 -0
- package/dist/data/cli-commands.d.ts.map +1 -0
- package/dist/data/cli-commands.js +100 -0
- package/dist/data/cli-commands.js.map +1 -0
- package/dist/data/components/Accordion.d.ts +15 -0
- package/dist/data/components/Accordion.d.ts.map +1 -0
- package/dist/data/components/Accordion.js +112 -0
- package/dist/data/components/Accordion.js.map +1 -0
- package/dist/data/components/ActivityIndicator.d.ts +15 -0
- package/dist/data/components/ActivityIndicator.d.ts.map +1 -0
- package/dist/data/components/ActivityIndicator.js +82 -0
- package/dist/data/components/ActivityIndicator.js.map +1 -0
- package/dist/data/components/Alert.d.ts +15 -0
- package/dist/data/components/Alert.d.ts.map +1 -0
- package/dist/data/components/Alert.js +132 -0
- package/dist/data/components/Alert.js.map +1 -0
- package/dist/data/components/Avatar.d.ts +15 -0
- package/dist/data/components/Avatar.d.ts.map +1 -0
- package/dist/data/components/Avatar.js +93 -0
- package/dist/data/components/Avatar.js.map +1 -0
- package/dist/data/components/Badge.d.ts +15 -0
- package/dist/data/components/Badge.d.ts.map +1 -0
- package/dist/data/components/Badge.js +64 -0
- package/dist/data/components/Badge.js.map +1 -0
- package/dist/data/components/Breadcrumb.d.ts +15 -0
- package/dist/data/components/Breadcrumb.d.ts.map +1 -0
- package/dist/data/components/Breadcrumb.js +96 -0
- package/dist/data/components/Breadcrumb.js.map +1 -0
- package/dist/data/components/Button.d.ts +15 -0
- package/dist/data/components/Button.d.ts.map +1 -0
- package/dist/data/components/Button.js +87 -0
- package/dist/data/components/Button.js.map +1 -0
- package/dist/data/components/Card.d.ts +15 -0
- package/dist/data/components/Card.d.ts.map +1 -0
- package/dist/data/components/Card.js +67 -0
- package/dist/data/components/Card.js.map +1 -0
- package/dist/data/components/Checkbox.d.ts +15 -0
- package/dist/data/components/Checkbox.d.ts.map +1 -0
- package/dist/data/components/Checkbox.js +118 -0
- package/dist/data/components/Checkbox.js.map +1 -0
- package/dist/data/components/Chip.d.ts +15 -0
- package/dist/data/components/Chip.d.ts.map +1 -0
- package/dist/data/components/Chip.js +76 -0
- package/dist/data/components/Chip.js.map +1 -0
- package/dist/data/components/Dialog.d.ts +15 -0
- package/dist/data/components/Dialog.d.ts.map +1 -0
- package/dist/data/components/Dialog.js +137 -0
- package/dist/data/components/Dialog.js.map +1 -0
- package/dist/data/components/Divider.d.ts +15 -0
- package/dist/data/components/Divider.d.ts.map +1 -0
- package/dist/data/components/Divider.js +71 -0
- package/dist/data/components/Divider.js.map +1 -0
- package/dist/data/components/Icon.d.ts +15 -0
- package/dist/data/components/Icon.d.ts.map +1 -0
- package/dist/data/components/Icon.js +70 -0
- package/dist/data/components/Icon.js.map +1 -0
- package/dist/data/components/Image.d.ts +15 -0
- package/dist/data/components/Image.d.ts.map +1 -0
- package/dist/data/components/Image.js +122 -0
- package/dist/data/components/Image.js.map +1 -0
- package/dist/data/components/Input.d.ts +15 -0
- package/dist/data/components/Input.d.ts.map +1 -0
- package/dist/data/components/Input.js +109 -0
- package/dist/data/components/Input.js.map +1 -0
- package/dist/data/components/List.d.ts +15 -0
- package/dist/data/components/List.d.ts.map +1 -0
- package/dist/data/components/List.js +113 -0
- package/dist/data/components/List.js.map +1 -0
- package/dist/data/components/Menu.d.ts +15 -0
- package/dist/data/components/Menu.d.ts.map +1 -0
- package/dist/data/components/Menu.js +132 -0
- package/dist/data/components/Menu.js.map +1 -0
- package/dist/data/components/Popover.d.ts +15 -0
- package/dist/data/components/Popover.d.ts.map +1 -0
- package/dist/data/components/Popover.js +159 -0
- package/dist/data/components/Popover.js.map +1 -0
- package/dist/data/components/Pressable.d.ts +15 -0
- package/dist/data/components/Pressable.d.ts.map +1 -0
- package/dist/data/components/Pressable.js +125 -0
- package/dist/data/components/Pressable.js.map +1 -0
- package/dist/data/components/Progress.d.ts +15 -0
- package/dist/data/components/Progress.d.ts.map +1 -0
- package/dist/data/components/Progress.js +95 -0
- package/dist/data/components/Progress.js.map +1 -0
- package/dist/data/components/RadioButton.d.ts +15 -0
- package/dist/data/components/RadioButton.d.ts.map +1 -0
- package/dist/data/components/RadioButton.js +140 -0
- package/dist/data/components/RadioButton.js.map +1 -0
- package/dist/data/components/SVGImage.d.ts +15 -0
- package/dist/data/components/SVGImage.d.ts.map +1 -0
- package/dist/data/components/SVGImage.js +112 -0
- package/dist/data/components/SVGImage.js.map +1 -0
- package/dist/data/components/Screen.d.ts +15 -0
- package/dist/data/components/Screen.d.ts.map +1 -0
- package/dist/data/components/Screen.js +99 -0
- package/dist/data/components/Screen.js.map +1 -0
- package/dist/data/components/Select.d.ts +15 -0
- package/dist/data/components/Select.d.ts.map +1 -0
- package/dist/data/components/Select.js +146 -0
- package/dist/data/components/Select.js.map +1 -0
- package/dist/data/components/Skeleton.d.ts +15 -0
- package/dist/data/components/Skeleton.d.ts.map +1 -0
- package/dist/data/components/Skeleton.js +110 -0
- package/dist/data/components/Skeleton.js.map +1 -0
- package/dist/data/components/Slider.d.ts +15 -0
- package/dist/data/components/Slider.d.ts.map +1 -0
- package/dist/data/components/Slider.js +129 -0
- package/dist/data/components/Slider.js.map +1 -0
- package/dist/data/components/Switch.d.ts +15 -0
- package/dist/data/components/Switch.d.ts.map +1 -0
- package/dist/data/components/Switch.js +127 -0
- package/dist/data/components/Switch.js.map +1 -0
- package/dist/data/components/TabBar.d.ts +15 -0
- package/dist/data/components/TabBar.d.ts.map +1 -0
- package/dist/data/components/TabBar.js +145 -0
- package/dist/data/components/TabBar.js.map +1 -0
- package/dist/data/components/Table.d.ts +15 -0
- package/dist/data/components/Table.d.ts.map +1 -0
- package/dist/data/components/Table.js +151 -0
- package/dist/data/components/Table.js.map +1 -0
- package/dist/data/components/Tabs.d.ts +15 -0
- package/dist/data/components/Tabs.d.ts.map +1 -0
- package/dist/data/components/Tabs.js +150 -0
- package/dist/data/components/Tabs.js.map +1 -0
- package/dist/data/components/Text.d.ts +15 -0
- package/dist/data/components/Text.d.ts.map +1 -0
- package/dist/data/components/Text.js +85 -0
- package/dist/data/components/Text.js.map +1 -0
- package/dist/data/components/TextArea.d.ts +15 -0
- package/dist/data/components/TextArea.d.ts.map +1 -0
- package/dist/data/components/TextArea.js +155 -0
- package/dist/data/components/TextArea.js.map +1 -0
- package/dist/data/components/Tooltip.d.ts +15 -0
- package/dist/data/components/Tooltip.d.ts.map +1 -0
- package/dist/data/components/Tooltip.js +105 -0
- package/dist/data/components/Tooltip.js.map +1 -0
- package/dist/data/components/Video.d.ts +15 -0
- package/dist/data/components/Video.d.ts.map +1 -0
- package/dist/data/components/Video.js +168 -0
- package/dist/data/components/Video.js.map +1 -0
- package/dist/data/components/View.d.ts +15 -0
- package/dist/data/components/View.d.ts.map +1 -0
- package/dist/data/components/View.js +126 -0
- package/dist/data/components/View.js.map +1 -0
- package/dist/data/components/index.d.ts +37 -0
- package/dist/data/components/index.d.ts.map +1 -0
- package/dist/data/components/index.js +110 -0
- package/dist/data/components/index.js.map +1 -0
- package/dist/data/framework-guides.d.ts +2 -0
- package/dist/data/framework-guides.d.ts.map +1 -0
- package/dist/data/framework-guides.js +589 -0
- package/dist/data/framework-guides.js.map +1 -0
- package/dist/data/icon-guide.d.ts +2 -0
- package/dist/data/icon-guide.d.ts.map +1 -0
- package/dist/data/icon-guide.js +285 -0
- package/dist/data/icon-guide.js.map +1 -0
- package/dist/data/icons.json +7452 -0
- package/dist/data/navigation-guides.d.ts +2 -0
- package/dist/data/navigation-guides.d.ts.map +1 -0
- package/dist/data/navigation-guides.js +1196 -0
- package/dist/data/navigation-guides.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +422 -0
- package/dist/index.js.map +1 -0
- package/package.json +34 -0
- package/src/data/cli-commands.ts +103 -0
- package/src/data/components/Accordion.ts +106 -0
- package/src/data/components/ActivityIndicator.ts +82 -0
- package/src/data/components/Alert.ts +132 -0
- package/src/data/components/Avatar.ts +93 -0
- package/src/data/components/Badge.ts +63 -0
- package/src/data/components/Breadcrumb.ts +94 -0
- package/src/data/components/Button.ts +86 -0
- package/src/data/components/Card.ts +67 -0
- package/src/data/components/Checkbox.ts +117 -0
- package/src/data/components/Chip.ts +93 -0
- package/src/data/components/Dialog.ts +136 -0
- package/src/data/components/Divider.ts +70 -0
- package/src/data/components/Icon.ts +70 -0
- package/src/data/components/Image.ts +121 -0
- package/src/data/components/Input.ts +150 -0
- package/src/data/components/List.ts +103 -0
- package/src/data/components/Menu.ts +125 -0
- package/src/data/components/Popover.ts +159 -0
- package/src/data/components/Pressable.ts +123 -0
- package/src/data/components/Progress.ts +95 -0
- package/src/data/components/RadioButton.ts +130 -0
- package/src/data/components/SVGImage.ts +114 -0
- package/src/data/components/Screen.ts +103 -0
- package/src/data/components/Select.ts +140 -0
- package/src/data/components/Skeleton.ts +102 -0
- package/src/data/components/Slider.ts +150 -0
- package/src/data/components/Switch.ts +127 -0
- package/src/data/components/TabBar.ts +142 -0
- package/src/data/components/Table.ts +153 -0
- package/src/data/components/Tabs.ts +152 -0
- package/src/data/components/Text.ts +85 -0
- package/src/data/components/TextArea.ts +155 -0
- package/src/data/components/Tooltip.ts +105 -0
- package/src/data/components/Video.ts +168 -0
- package/src/data/components/View.ts +126 -0
- package/src/data/components/index.ts +109 -0
- package/src/data/framework-guides.ts +593 -0
- package/src/data/icon-guide.ts +284 -0
- package/src/data/icons.json +7452 -0
- package/src/data/navigation-guides.ts +1199 -0
- package/src/index.ts +473 -0
- package/test-client.js +86 -0
- package/tsconfig.json +20 -0
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
export const Input = {
|
|
2
|
+
category: "form",
|
|
3
|
+
description: "Text input field with icons, password visibility toggle, and various input types",
|
|
4
|
+
props: `
|
|
5
|
+
- \`value\`: string - The current value of the input
|
|
6
|
+
- \`onChangeText\`: function - Called when the text changes
|
|
7
|
+
- \`onFocus\`: function - Called when the input receives focus
|
|
8
|
+
- \`onBlur\`: function - Called when the input loses focus
|
|
9
|
+
- \`placeholder\`: string - Placeholder text
|
|
10
|
+
- \`disabled\`: boolean - Whether the input is disabled
|
|
11
|
+
- \`inputType\`: InputInputType - The type of input (affects keyboard type on mobile)
|
|
12
|
+
- \`secureTextEntry\`: boolean - Whether to show the password
|
|
13
|
+
- \`leftIcon\`: IconName | React.ReactNode - Icon to display on the left side of the input
|
|
14
|
+
- \`rightIcon\`: IconName | React.ReactNode - Icon to display on the right side of the input
|
|
15
|
+
- \`showPasswordToggle\`: boolean - Show password visibility toggle for password inputs (defaults to true for password type)
|
|
16
|
+
- \`autoCapitalize\`: 'none' | 'sentences' | 'words' | 'characters' - Auto-capitalization behavior
|
|
17
|
+
- \`size\`: InputSize - Size variant of the input
|
|
18
|
+
- \`type\`: InputType - Style variant of the input
|
|
19
|
+
- \`intent\`: InputIntent - The intent/color scheme of the input (for focus states, validation, etc.)
|
|
20
|
+
- \`hasError\`: boolean - Whether the input has an error state
|
|
21
|
+
`,
|
|
22
|
+
features: [
|
|
23
|
+
"Left and right icon support with MDI icons",
|
|
24
|
+
"Password visibility toggle with eye/eye-off icons",
|
|
25
|
+
"Multiple input types (text, email, password, number)",
|
|
26
|
+
"Three size variants",
|
|
27
|
+
"Four style variants (default, outlined, filled, bare)",
|
|
28
|
+
"Disabled state",
|
|
29
|
+
"Auto-capitalization control",
|
|
30
|
+
"Focus and blur event handlers",
|
|
31
|
+
],
|
|
32
|
+
bestPractices: [
|
|
33
|
+
"Use leftIcon for contextual hints (e.g., email icon for email input)",
|
|
34
|
+
"Password inputs automatically show visibility toggle",
|
|
35
|
+
"Use inputType='email' for email fields to get proper keyboard on mobile",
|
|
36
|
+
"Use inputType='number' for numeric input",
|
|
37
|
+
"Disable password toggle with showPasswordToggle={false} if needed",
|
|
38
|
+
],
|
|
39
|
+
usage: `
|
|
40
|
+
import { Input } from '@idealyst/components';
|
|
41
|
+
import { useState } from 'react';
|
|
42
|
+
|
|
43
|
+
function Example() {
|
|
44
|
+
const [email, setEmail] = useState('');
|
|
45
|
+
|
|
46
|
+
return (
|
|
47
|
+
<Input
|
|
48
|
+
leftIcon="email"
|
|
49
|
+
value={email}
|
|
50
|
+
onChangeText={setEmail}
|
|
51
|
+
placeholder="Enter your email"
|
|
52
|
+
inputType="email"
|
|
53
|
+
/>
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
`,
|
|
57
|
+
examples: {
|
|
58
|
+
basic: `import { Input } from '@idealyst/components';
|
|
59
|
+
|
|
60
|
+
<Input
|
|
61
|
+
placeholder="Enter username"
|
|
62
|
+
/>`,
|
|
63
|
+
variants: `import { Input } from '@idealyst/components';
|
|
64
|
+
|
|
65
|
+
// Small size
|
|
66
|
+
<Input size="sm" placeholder="Small input" />
|
|
67
|
+
|
|
68
|
+
// Medium size (default)
|
|
69
|
+
<Input size="md" placeholder="Medium input" />
|
|
70
|
+
|
|
71
|
+
// Large size
|
|
72
|
+
<Input size="lg" placeholder="Large input" />
|
|
73
|
+
|
|
74
|
+
// Outlined variant
|
|
75
|
+
<Input type="outlined" placeholder="Outlined" />
|
|
76
|
+
|
|
77
|
+
// Filled variant
|
|
78
|
+
<Input type="filled" placeholder="Filled" />
|
|
79
|
+
|
|
80
|
+
// Bare variant
|
|
81
|
+
<Input type="bare" placeholder="Bare" />`,
|
|
82
|
+
"with-icons": `import { Input } from '@idealyst/components';
|
|
83
|
+
|
|
84
|
+
// Left icon
|
|
85
|
+
<Input
|
|
86
|
+
leftIcon="email"
|
|
87
|
+
placeholder="Email address"
|
|
88
|
+
inputType="email"
|
|
89
|
+
/>
|
|
90
|
+
|
|
91
|
+
// Right icon
|
|
92
|
+
<Input
|
|
93
|
+
rightIcon="magnify"
|
|
94
|
+
placeholder="Search"
|
|
95
|
+
/>
|
|
96
|
+
|
|
97
|
+
// Both icons
|
|
98
|
+
<Input
|
|
99
|
+
leftIcon="lock"
|
|
100
|
+
rightIcon="check"
|
|
101
|
+
placeholder="Secure field"
|
|
102
|
+
/>
|
|
103
|
+
|
|
104
|
+
// Password with visibility toggle (default)
|
|
105
|
+
<Input
|
|
106
|
+
inputType="password"
|
|
107
|
+
placeholder="Password"
|
|
108
|
+
/>
|
|
109
|
+
|
|
110
|
+
// Password without visibility toggle
|
|
111
|
+
<Input
|
|
112
|
+
inputType="password"
|
|
113
|
+
showPasswordToggle={false}
|
|
114
|
+
placeholder="Password"
|
|
115
|
+
/>
|
|
116
|
+
|
|
117
|
+
// Custom icons with password toggle
|
|
118
|
+
<Input
|
|
119
|
+
leftIcon="lock"
|
|
120
|
+
inputType="password"
|
|
121
|
+
placeholder="Enter password"
|
|
122
|
+
/>`,
|
|
123
|
+
interactive: `import { Input } from '@idealyst/components';
|
|
124
|
+
import { useState } from 'react';
|
|
125
|
+
|
|
126
|
+
function Example() {
|
|
127
|
+
const [email, setEmail] = useState('');
|
|
128
|
+
const [password, setPassword] = useState('');
|
|
129
|
+
|
|
130
|
+
return (
|
|
131
|
+
<View spacing="md">
|
|
132
|
+
<Input
|
|
133
|
+
leftIcon="email"
|
|
134
|
+
value={email}
|
|
135
|
+
onChangeText={setEmail}
|
|
136
|
+
placeholder="Email"
|
|
137
|
+
inputType="email"
|
|
138
|
+
/>
|
|
139
|
+
<Input
|
|
140
|
+
leftIcon="lock"
|
|
141
|
+
value={password}
|
|
142
|
+
onChangeText={setPassword}
|
|
143
|
+
placeholder="Password"
|
|
144
|
+
inputType="password"
|
|
145
|
+
/>
|
|
146
|
+
</View>
|
|
147
|
+
);
|
|
148
|
+
}`,
|
|
149
|
+
}
|
|
150
|
+
};
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
export const List = {
|
|
2
|
+
category: "display",
|
|
3
|
+
description: "Vertical list container with support for sections, icons, and interactive items",
|
|
4
|
+
props: `
|
|
5
|
+
- \`children\`: React.ReactNode - List items and sections to display
|
|
6
|
+
- \`type\`: ListType - The visual style variant of the list
|
|
7
|
+
- \`size\`: ListSizeVariant - The size variant of list items
|
|
8
|
+
- \`scrollable\`: boolean - Whether the list is scrollable
|
|
9
|
+
- \`maxHeight\`: number | string - Maximum height of the scrollable list
|
|
10
|
+
`,
|
|
11
|
+
features: [
|
|
12
|
+
"Three visual variants",
|
|
13
|
+
"Configurable item sizes",
|
|
14
|
+
"Leading and trailing elements (icons, badges, etc.)",
|
|
15
|
+
"Selected and active states",
|
|
16
|
+
"Section grouping with titles",
|
|
17
|
+
"Indentation for hierarchy",
|
|
18
|
+
"Icon support via string names",
|
|
19
|
+
],
|
|
20
|
+
bestPractices: [
|
|
21
|
+
"Use sections to organize related items",
|
|
22
|
+
"Use leading icons for visual categorization",
|
|
23
|
+
"Use trailing elements for metadata or actions",
|
|
24
|
+
"Keep list items concise and scannable",
|
|
25
|
+
],
|
|
26
|
+
usage: `
|
|
27
|
+
import { List, ListItem, ListSection } from '@idealyst/components';
|
|
28
|
+
|
|
29
|
+
<List type="bordered">
|
|
30
|
+
<ListSection title="Main">
|
|
31
|
+
<ListItem
|
|
32
|
+
label="Dashboard"
|
|
33
|
+
leading="home"
|
|
34
|
+
onPress={() => navigate('/dashboard')}
|
|
35
|
+
/>
|
|
36
|
+
<ListItem
|
|
37
|
+
label="Settings"
|
|
38
|
+
leading="cog"
|
|
39
|
+
onPress={() => navigate('/settings')}
|
|
40
|
+
/>
|
|
41
|
+
</ListSection>
|
|
42
|
+
</List>
|
|
43
|
+
`,
|
|
44
|
+
examples: {
|
|
45
|
+
basic: `import { List, ListItem } from '@idealyst/components';
|
|
46
|
+
|
|
47
|
+
<List type="divided">
|
|
48
|
+
<ListItem label="Item 1" />
|
|
49
|
+
<ListItem label="Item 2" />
|
|
50
|
+
<ListItem label="Item 3" />
|
|
51
|
+
</List>`,
|
|
52
|
+
variants: `import { List, ListItem } from '@idealyst/components';
|
|
53
|
+
|
|
54
|
+
<List type="default">
|
|
55
|
+
<ListItem label="Default" />
|
|
56
|
+
</List>
|
|
57
|
+
|
|
58
|
+
<List type="bordered">
|
|
59
|
+
<ListItem label="Bordered" />
|
|
60
|
+
</List>
|
|
61
|
+
|
|
62
|
+
<List type="divided">
|
|
63
|
+
<ListItem label="Divided" />
|
|
64
|
+
</List>`,
|
|
65
|
+
"with-icons": `import { List, ListItem, Badge } from '@idealyst/components';
|
|
66
|
+
|
|
67
|
+
<List type="bordered">
|
|
68
|
+
<ListItem
|
|
69
|
+
label="Notifications"
|
|
70
|
+
leading="bell"
|
|
71
|
+
trailing={<Badge>3</Badge>}
|
|
72
|
+
/>
|
|
73
|
+
<ListItem
|
|
74
|
+
label="Messages"
|
|
75
|
+
leading="email"
|
|
76
|
+
trailing={<Badge>12</Badge>}
|
|
77
|
+
/>
|
|
78
|
+
</List>`,
|
|
79
|
+
interactive: `import { List, ListItem } from '@idealyst/components';
|
|
80
|
+
import { useState } from 'react';
|
|
81
|
+
|
|
82
|
+
function Example() {
|
|
83
|
+
const [selected, setSelected] = useState('home');
|
|
84
|
+
|
|
85
|
+
return (
|
|
86
|
+
<List type="bordered">
|
|
87
|
+
<ListItem
|
|
88
|
+
label="Home"
|
|
89
|
+
leading="home"
|
|
90
|
+
selected={selected === 'home'}
|
|
91
|
+
onPress={() => setSelected('home')}
|
|
92
|
+
/>
|
|
93
|
+
<ListItem
|
|
94
|
+
label="Profile"
|
|
95
|
+
leading="account"
|
|
96
|
+
selected={selected === 'profile'}
|
|
97
|
+
onPress={() => setSelected('profile')}
|
|
98
|
+
/>
|
|
99
|
+
</List>
|
|
100
|
+
);
|
|
101
|
+
}`,
|
|
102
|
+
}
|
|
103
|
+
};
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
export const Menu = {
|
|
2
|
+
category: "overlay",
|
|
3
|
+
description: "Contextual menu with list of actions, typically triggered by a button or other element",
|
|
4
|
+
props: `
|
|
5
|
+
- \`children\`: React.ReactNode - The trigger element that opens the menu
|
|
6
|
+
- \`items\`: MenuItem[] - Array of menu items to display
|
|
7
|
+
- \`open\`: boolean - Whether the menu is currently open (controlled)
|
|
8
|
+
- \`onOpenChange\`: function - Called when the menu open state changes
|
|
9
|
+
- \`placement\`: MenuPlacement - The placement of the menu relative to the trigger
|
|
10
|
+
- \`closeOnSelection\`: boolean - Whether to close the menu when an item is selected
|
|
11
|
+
- \`size\`: MenuSizeVariant - The size variant of the menu
|
|
12
|
+
`,
|
|
13
|
+
features: [
|
|
14
|
+
"Icon support for menu items",
|
|
15
|
+
"Intent colors for items",
|
|
16
|
+
"Separators between items",
|
|
17
|
+
"Disabled items",
|
|
18
|
+
"Multiple placement options",
|
|
19
|
+
"Auto-close on selection",
|
|
20
|
+
"Three size options",
|
|
21
|
+
],
|
|
22
|
+
bestPractices: [
|
|
23
|
+
"Use separators to group related actions",
|
|
24
|
+
"Place destructive actions at the bottom with error intent",
|
|
25
|
+
"Keep menu items concise (1-3 words)",
|
|
26
|
+
"Use icons for visual scanning",
|
|
27
|
+
"Close menu after action unless multi-select",
|
|
28
|
+
],
|
|
29
|
+
usage: `
|
|
30
|
+
import { Menu, Button } from '@idealyst/components';
|
|
31
|
+
import { useState, useRef } from 'react';
|
|
32
|
+
|
|
33
|
+
function Example() {
|
|
34
|
+
const [open, setOpen] = useState(false);
|
|
35
|
+
const buttonRef = useRef(null);
|
|
36
|
+
|
|
37
|
+
const items = [
|
|
38
|
+
{ id: '1', label: 'Edit', icon: 'pencil', onClick: () => handleEdit() },
|
|
39
|
+
{ id: '2', label: 'Duplicate', icon: 'content-copy', onClick: () => handleDuplicate() },
|
|
40
|
+
{ id: '3', label: 'Delete', icon: 'delete', intent: 'error', onClick: () => handleDelete(), separator: true },
|
|
41
|
+
];
|
|
42
|
+
|
|
43
|
+
return (
|
|
44
|
+
<>
|
|
45
|
+
<div ref={buttonRef}>
|
|
46
|
+
<Button onPress={() => setOpen(true)}>Actions</Button>
|
|
47
|
+
</div>
|
|
48
|
+
<Menu
|
|
49
|
+
items={items}
|
|
50
|
+
open={open}
|
|
51
|
+
onOpenChange={setOpen}
|
|
52
|
+
anchor={buttonRef}
|
|
53
|
+
placement="bottom-start"
|
|
54
|
+
/>
|
|
55
|
+
</>
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
`,
|
|
59
|
+
examples: {
|
|
60
|
+
basic: `import { Menu, Button } from '@idealyst/components';
|
|
61
|
+
import { useRef, useState } from 'react';
|
|
62
|
+
|
|
63
|
+
const buttonRef = useRef(null);
|
|
64
|
+
const [open, setOpen] = useState(false);
|
|
65
|
+
|
|
66
|
+
const items = [
|
|
67
|
+
{ id: '1', label: 'Option 1', onClick: () => console.log('1') },
|
|
68
|
+
{ id: '2', label: 'Option 2', onClick: () => console.log('2') },
|
|
69
|
+
];
|
|
70
|
+
|
|
71
|
+
<div ref={buttonRef}>
|
|
72
|
+
<Button onPress={() => setOpen(true)}>Menu</Button>
|
|
73
|
+
</div>
|
|
74
|
+
<Menu items={items} open={open} onOpenChange={setOpen} anchor={buttonRef} />`,
|
|
75
|
+
|
|
76
|
+
variants: `import { Menu } from '@idealyst/components';
|
|
77
|
+
|
|
78
|
+
// Different sizes
|
|
79
|
+
<Menu items={items} open={open} onOpenChange={setOpen} anchor={ref} size="sm" />
|
|
80
|
+
<Menu items={items} open={open} onOpenChange={setOpen} anchor={ref} size="md" />
|
|
81
|
+
<Menu items={items} open={open} onOpenChange={setOpen} anchor={ref} size="lg" />`,
|
|
82
|
+
|
|
83
|
+
"with-icons": `import { Menu, Button } from '@idealyst/components';
|
|
84
|
+
import { useRef, useState } from 'react';
|
|
85
|
+
|
|
86
|
+
const items = [
|
|
87
|
+
{ id: '1', label: 'Profile', icon: 'account', onClick: () => navigate('/profile') },
|
|
88
|
+
{ id: '2', label: 'Settings', icon: 'cog', onClick: () => navigate('/settings') },
|
|
89
|
+
{ id: '3', label: 'Logout', icon: 'logout', intent: 'error', onClick: () => logout(), separator: true },
|
|
90
|
+
];
|
|
91
|
+
|
|
92
|
+
<Menu items={items} open={open} onOpenChange={setOpen} anchor={buttonRef} />`,
|
|
93
|
+
|
|
94
|
+
interactive: `import { Menu, Button, Text, View } from '@idealyst/components';
|
|
95
|
+
import { useRef, useState } from 'react';
|
|
96
|
+
|
|
97
|
+
function Example() {
|
|
98
|
+
const [open, setOpen] = useState(false);
|
|
99
|
+
const [selected, setSelected] = useState('');
|
|
100
|
+
const buttonRef = useRef(null);
|
|
101
|
+
|
|
102
|
+
const items = [
|
|
103
|
+
{ id: 'edit', label: 'Edit', icon: 'pencil', onClick: () => setSelected('edit') },
|
|
104
|
+
{ id: 'share', label: 'Share', icon: 'share', onClick: () => setSelected('share') },
|
|
105
|
+
{ id: 'delete', label: 'Delete', icon: 'delete', intent: 'error', onClick: () => setSelected('delete') },
|
|
106
|
+
];
|
|
107
|
+
|
|
108
|
+
return (
|
|
109
|
+
<View spacing="md">
|
|
110
|
+
<div ref={buttonRef}>
|
|
111
|
+
<Button onPress={() => setOpen(true)}>Actions</Button>
|
|
112
|
+
</div>
|
|
113
|
+
<Menu
|
|
114
|
+
items={items}
|
|
115
|
+
open={open}
|
|
116
|
+
onOpenChange={setOpen}
|
|
117
|
+
anchor={buttonRef}
|
|
118
|
+
placement="bottom-start"
|
|
119
|
+
/>
|
|
120
|
+
{selected && <Text>Selected: {selected}</Text>}
|
|
121
|
+
</View>
|
|
122
|
+
);
|
|
123
|
+
}`,
|
|
124
|
+
},
|
|
125
|
+
};
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
export const Popover = {
|
|
2
|
+
category: "overlay",
|
|
3
|
+
description: "Floating overlay that displays content anchored to an element, useful for tooltips, menus, and contextual information",
|
|
4
|
+
props: `
|
|
5
|
+
- \`open\`: boolean - Whether the popover is open/visible
|
|
6
|
+
- \`onOpenChange\`: function - Called when the popover should be opened or closed
|
|
7
|
+
- \`anchor\`: React.ReactNode | React.RefObject<Element> - The anchor element to position the popover relative to Can be a React element or a ref to a DOM element
|
|
8
|
+
- \`children\`: React.ReactNode - The content to display inside the popover
|
|
9
|
+
- \`placement\`: PopoverPlacement - Preferred placement of the popover relative to anchor
|
|
10
|
+
- \`offset\`: number - Distance from the anchor element in pixels
|
|
11
|
+
- \`closeOnClickOutside\`: boolean - Whether clicking outside should close the popover
|
|
12
|
+
- \`closeOnEscapeKey\`: boolean - Whether pressing escape key should close the popover (web only)
|
|
13
|
+
- \`showArrow\`: boolean - Whether to show an arrow pointing to the anchor
|
|
14
|
+
`,
|
|
15
|
+
features: [
|
|
16
|
+
"12 placement options with smart positioning",
|
|
17
|
+
"Automatic repositioning on scroll/resize",
|
|
18
|
+
"Click outside to close",
|
|
19
|
+
"Escape key to close (web)",
|
|
20
|
+
"Optional arrow indicator",
|
|
21
|
+
"Offset control",
|
|
22
|
+
"Accessible with focus management",
|
|
23
|
+
],
|
|
24
|
+
bestPractices: [
|
|
25
|
+
"Use for contextual information that doesn't require immediate action",
|
|
26
|
+
"Keep popover content focused and concise",
|
|
27
|
+
"Use arrow to clearly indicate relationship to anchor",
|
|
28
|
+
"Allow closing via click outside and Escape key",
|
|
29
|
+
"Don't nest popovers",
|
|
30
|
+
"Consider using Dialog for critical content",
|
|
31
|
+
],
|
|
32
|
+
usage: `
|
|
33
|
+
import { Popover, Button, View, Text } from '@idealyst/components';
|
|
34
|
+
import { useState, useRef } from 'react';
|
|
35
|
+
|
|
36
|
+
function Example() {
|
|
37
|
+
const [open, setOpen] = useState(false);
|
|
38
|
+
const buttonRef = useRef(null);
|
|
39
|
+
|
|
40
|
+
return (
|
|
41
|
+
<>
|
|
42
|
+
<div ref={buttonRef}>
|
|
43
|
+
<Button onPress={() => setOpen(true)}>Show Info</Button>
|
|
44
|
+
</div>
|
|
45
|
+
<Popover
|
|
46
|
+
open={open}
|
|
47
|
+
onOpenChange={setOpen}
|
|
48
|
+
anchor={buttonRef}
|
|
49
|
+
placement="bottom"
|
|
50
|
+
showArrow
|
|
51
|
+
>
|
|
52
|
+
<View spacing="sm" style={{ padding: 16 }}>
|
|
53
|
+
<Text weight="bold">Information</Text>
|
|
54
|
+
<Text>Additional context or help text</Text>
|
|
55
|
+
</View>
|
|
56
|
+
</Popover>
|
|
57
|
+
</>
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
`,
|
|
61
|
+
examples: {
|
|
62
|
+
basic: `import { Popover, Button, Text } from '@idealyst/components';
|
|
63
|
+
import { useState, useRef } from 'react';
|
|
64
|
+
|
|
65
|
+
const [open, setOpen] = useState(false);
|
|
66
|
+
const buttonRef = useRef(null);
|
|
67
|
+
|
|
68
|
+
<div ref={buttonRef}>
|
|
69
|
+
<Button onPress={() => setOpen(true)}>Open</Button>
|
|
70
|
+
</div>
|
|
71
|
+
<Popover open={open} onOpenChange={setOpen} anchor={buttonRef}>
|
|
72
|
+
<Text>Popover content</Text>
|
|
73
|
+
</Popover>`,
|
|
74
|
+
|
|
75
|
+
variants: `import { Popover, Button, View } from '@idealyst/components';
|
|
76
|
+
|
|
77
|
+
// Different placements
|
|
78
|
+
<Popover open={open} onOpenChange={setOpen} anchor={ref} placement="top">
|
|
79
|
+
<View>Top</View>
|
|
80
|
+
</Popover>
|
|
81
|
+
<Popover open={open} onOpenChange={setOpen} anchor={ref} placement="bottom-start">
|
|
82
|
+
<View>Bottom Start</View>
|
|
83
|
+
</Popover>
|
|
84
|
+
<Popover open={open} onOpenChange={setOpen} anchor={ref} placement="right-end">
|
|
85
|
+
<View>Right End</View>
|
|
86
|
+
</Popover>`,
|
|
87
|
+
|
|
88
|
+
"with-icons": `import { Popover, Button, View, Icon, Text } from '@idealyst/components';
|
|
89
|
+
import { useState, useRef } from 'react';
|
|
90
|
+
|
|
91
|
+
const buttonRef = useRef(null);
|
|
92
|
+
const [open, setOpen] = useState(false);
|
|
93
|
+
|
|
94
|
+
<div ref={buttonRef}>
|
|
95
|
+
<Button icon="help-circle" type="text" onPress={() => setOpen(true)} />
|
|
96
|
+
</div>
|
|
97
|
+
<Popover open={open} onOpenChange={setOpen} anchor={buttonRef} showArrow>
|
|
98
|
+
<View spacing="sm" style={{ padding: 12, maxWidth: 250 }}>
|
|
99
|
+
<View style={{ flexDirection: 'row', gap: 8, alignItems: 'center' }}>
|
|
100
|
+
<Icon name="information" size="md" color="primary" />
|
|
101
|
+
<Text weight="bold">Help</Text>
|
|
102
|
+
</View>
|
|
103
|
+
<Text size="sm">This feature allows you to...</Text>
|
|
104
|
+
</View>
|
|
105
|
+
</Popover>`,
|
|
106
|
+
|
|
107
|
+
interactive: `import { Popover, Button, View, Text, Input } from '@idealyst/components';
|
|
108
|
+
import { useState, useRef } from 'react';
|
|
109
|
+
|
|
110
|
+
function Example() {
|
|
111
|
+
const [open, setOpen] = useState(false);
|
|
112
|
+
const [value, setValue] = useState('');
|
|
113
|
+
const buttonRef = useRef(null);
|
|
114
|
+
|
|
115
|
+
return (
|
|
116
|
+
<View spacing="md">
|
|
117
|
+
<div ref={buttonRef}>
|
|
118
|
+
<Button onPress={() => setOpen(true)}>Edit Name</Button>
|
|
119
|
+
</div>
|
|
120
|
+
|
|
121
|
+
<Popover
|
|
122
|
+
open={open}
|
|
123
|
+
onOpenChange={setOpen}
|
|
124
|
+
anchor={buttonRef}
|
|
125
|
+
placement="bottom-start"
|
|
126
|
+
closeOnClickOutside={false}
|
|
127
|
+
>
|
|
128
|
+
<View spacing="md" style={{ padding: 16, minWidth: 250 }}>
|
|
129
|
+
<Text weight="bold">Edit Name</Text>
|
|
130
|
+
<Input
|
|
131
|
+
value={value}
|
|
132
|
+
onChangeText={setValue}
|
|
133
|
+
placeholder="Enter name"
|
|
134
|
+
/>
|
|
135
|
+
<View style={{ flexDirection: 'row', gap: 8, justifyContent: 'flex-end' }}>
|
|
136
|
+
<Button
|
|
137
|
+
type="outlined"
|
|
138
|
+
size="sm"
|
|
139
|
+
onPress={() => setOpen(false)}
|
|
140
|
+
>
|
|
141
|
+
Cancel
|
|
142
|
+
</Button>
|
|
143
|
+
<Button
|
|
144
|
+
size="sm"
|
|
145
|
+
onPress={() => {
|
|
146
|
+
handleSave(value);
|
|
147
|
+
setOpen(false);
|
|
148
|
+
}}
|
|
149
|
+
>
|
|
150
|
+
Save
|
|
151
|
+
</Button>
|
|
152
|
+
</View>
|
|
153
|
+
</View>
|
|
154
|
+
</Popover>
|
|
155
|
+
</View>
|
|
156
|
+
);
|
|
157
|
+
}`,
|
|
158
|
+
},
|
|
159
|
+
};
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
export const Pressable = {
|
|
2
|
+
category: "utility",
|
|
3
|
+
description: "Wrapper component that detects various press interactions on children",
|
|
4
|
+
props: `
|
|
5
|
+
- \`children\`: React.ReactNode - Content to render inside the pressable area
|
|
6
|
+
- \`onPress\`: function - Called when the press gesture is activated
|
|
7
|
+
- \`onPressIn\`: function - Called when the press gesture starts
|
|
8
|
+
- \`onPressOut\`: function - Called when the press gesture ends
|
|
9
|
+
- \`disabled\`: boolean - Whether the pressable is disabled
|
|
10
|
+
`,
|
|
11
|
+
features: [
|
|
12
|
+
"Press, press-in, press-out callbacks",
|
|
13
|
+
"Disabled state",
|
|
14
|
+
"Accessibility support",
|
|
15
|
+
"Custom styling",
|
|
16
|
+
"Cross-platform support",
|
|
17
|
+
"Touch feedback",
|
|
18
|
+
],
|
|
19
|
+
bestPractices: [
|
|
20
|
+
"Use for custom interactive elements",
|
|
21
|
+
"Prefer Button for standard button interactions",
|
|
22
|
+
"Provide accessibilityLabel for screen readers",
|
|
23
|
+
"Use accessibilityRole for semantic meaning",
|
|
24
|
+
"Add visual feedback on press",
|
|
25
|
+
"Ensure minimum 44x44px touch target",
|
|
26
|
+
],
|
|
27
|
+
usage: `
|
|
28
|
+
import { Pressable, Text, View } from '@idealyst/components';
|
|
29
|
+
|
|
30
|
+
<Pressable onPress={() => console.log('Pressed')}>
|
|
31
|
+
<View style={{ padding: 16, backgroundColor: '#f0f0f0' }}>
|
|
32
|
+
<Text>Press me</Text>
|
|
33
|
+
</View>
|
|
34
|
+
</Pressable>
|
|
35
|
+
`,
|
|
36
|
+
examples: {
|
|
37
|
+
basic: `import { Pressable, Text } from '@idealyst/components';
|
|
38
|
+
|
|
39
|
+
<Pressable onPress={() => console.log('Pressed')}>
|
|
40
|
+
<Text>Tap here</Text>
|
|
41
|
+
</Pressable>`,
|
|
42
|
+
|
|
43
|
+
variants: `import { Pressable, View, Text } from '@idealyst/components';
|
|
44
|
+
import { useState } from 'react';
|
|
45
|
+
|
|
46
|
+
function Example() {
|
|
47
|
+
const [pressed, setPressed] = useState(false);
|
|
48
|
+
|
|
49
|
+
return (
|
|
50
|
+
<Pressable
|
|
51
|
+
onPressIn={() => setPressed(true)}
|
|
52
|
+
onPressOut={() => setPressed(false)}
|
|
53
|
+
>
|
|
54
|
+
<View
|
|
55
|
+
style={{
|
|
56
|
+
padding: 16,
|
|
57
|
+
backgroundColor: pressed ? '#e0e0e0' : '#f5f5f5',
|
|
58
|
+
borderRadius: 8,
|
|
59
|
+
}}
|
|
60
|
+
>
|
|
61
|
+
<Text>{pressed ? 'Pressing...' : 'Press me'}</Text>
|
|
62
|
+
</View>
|
|
63
|
+
</Pressable>
|
|
64
|
+
);
|
|
65
|
+
}`,
|
|
66
|
+
|
|
67
|
+
"with-icons": `import { Pressable, View, Icon, Text } from '@idealyst/components';
|
|
68
|
+
|
|
69
|
+
<Pressable
|
|
70
|
+
onPress={() => handleAction()}
|
|
71
|
+
accessibilityLabel="Perform action"
|
|
72
|
+
accessibilityRole="button"
|
|
73
|
+
>
|
|
74
|
+
<View
|
|
75
|
+
style={{
|
|
76
|
+
flexDirection: 'row',
|
|
77
|
+
alignItems: 'center',
|
|
78
|
+
gap: 8,
|
|
79
|
+
padding: 12,
|
|
80
|
+
backgroundColor: '#f0f0f0',
|
|
81
|
+
borderRadius: 8,
|
|
82
|
+
}}
|
|
83
|
+
>
|
|
84
|
+
<Icon name="star" size="md" color="primary" />
|
|
85
|
+
<Text>Custom Button</Text>
|
|
86
|
+
</View>
|
|
87
|
+
</Pressable>`,
|
|
88
|
+
|
|
89
|
+
interactive: `import { Pressable, View, Text, Icon } from '@idealyst/components';
|
|
90
|
+
import { useState } from 'react';
|
|
91
|
+
|
|
92
|
+
function CustomCard() {
|
|
93
|
+
const [selected, setSelected] = useState(false);
|
|
94
|
+
|
|
95
|
+
return (
|
|
96
|
+
<Pressable
|
|
97
|
+
onPress={() => setSelected(!selected)}
|
|
98
|
+
accessibilityLabel="Toggle selection"
|
|
99
|
+
>
|
|
100
|
+
<View
|
|
101
|
+
style={{
|
|
102
|
+
padding: 16,
|
|
103
|
+
backgroundColor: selected ? '#e3f2fd' : '#fff',
|
|
104
|
+
borderWidth: 2,
|
|
105
|
+
borderColor: selected ? '#2196f3' : '#e0e0e0',
|
|
106
|
+
borderRadius: 8,
|
|
107
|
+
}}
|
|
108
|
+
>
|
|
109
|
+
<View style={{ flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center' }}>
|
|
110
|
+
<View spacing="xs">
|
|
111
|
+
<Text weight="bold">Custom Card</Text>
|
|
112
|
+
<Text size="sm">Tap to {selected ? 'deselect' : 'select'}</Text>
|
|
113
|
+
</View>
|
|
114
|
+
{selected && (
|
|
115
|
+
<Icon name="check-circle" size="lg" color="primary" />
|
|
116
|
+
)}
|
|
117
|
+
</View>
|
|
118
|
+
</View>
|
|
119
|
+
</Pressable>
|
|
120
|
+
);
|
|
121
|
+
}`,
|
|
122
|
+
},
|
|
123
|
+
};
|