@idealyst/mcp-server 1.0.86 → 1.0.88
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ARCHITECTURE.md +313 -0
- package/README.md +292 -104
- package/TYPE-SYSTEM.md +397 -0
- package/dist/index.js +170 -1
- package/examples/components/Accordion.examples.tsx +147 -0
- package/examples/components/ActivityIndicator.examples.tsx +350 -0
- package/examples/components/Alert.examples.tsx +335 -0
- package/examples/components/Avatar.examples.tsx +188 -0
- package/examples/components/Badge.examples.tsx +242 -0
- package/examples/components/Breadcrumb.examples.tsx +303 -0
- package/examples/components/Button.examples.tsx +113 -0
- package/examples/components/Card.examples.tsx +131 -0
- package/examples/components/Checkbox.examples.tsx +195 -0
- package/examples/components/Chip.examples.tsx +87 -0
- package/examples/components/Dialog.examples.tsx +344 -0
- package/examples/components/Divider.examples.tsx +258 -0
- package/examples/components/Icon.examples.tsx +202 -0
- package/examples/components/Input.examples.tsx +205 -0
- package/examples/components/Menu.examples.tsx +321 -0
- package/examples/components/Popover.examples.tsx +439 -0
- package/examples/components/Progress.examples.tsx +340 -0
- package/examples/components/RadioButton.examples.tsx +443 -0
- package/examples/components/Screen.examples.tsx +347 -0
- package/examples/components/Select.examples.tsx +279 -0
- package/examples/components/Skeleton.examples.tsx +278 -0
- package/examples/components/Slider.examples.tsx +249 -0
- package/examples/components/Switch.examples.tsx +94 -0
- package/examples/components/TabBar.examples.tsx +356 -0
- package/examples/components/Text.examples.tsx +177 -0
- package/examples/components/TextArea.examples.tsx +203 -0
- package/examples/components/Tooltip.examples.tsx +318 -0
- package/examples/components/View.examples.tsx +307 -0
- package/package.json +15 -2
- package/scripts/extract-types.ts +71 -0
- package/scripts/type-extractor.ts +286 -0
- package/scripts/validate-examples.ts +142 -0
- package/src/data/components/Icon.ts +1 -1
- package/src/data/components/index.ts +2 -0
- package/src/index.ts +181 -1
- package/src/tools/get-types.ts +169 -0
- package/tsconfig.examples.json +14 -0
- package/dist/data/cli-commands.d.ts +0 -2
- package/dist/data/cli-commands.d.ts.map +0 -1
- package/dist/data/cli-commands.js +0 -100
- package/dist/data/cli-commands.js.map +0 -1
- package/dist/data/components/Accordion.d.ts +0 -15
- package/dist/data/components/Accordion.d.ts.map +0 -1
- package/dist/data/components/Accordion.js +0 -112
- package/dist/data/components/Accordion.js.map +0 -1
- package/dist/data/components/ActivityIndicator.d.ts +0 -15
- package/dist/data/components/ActivityIndicator.d.ts.map +0 -1
- package/dist/data/components/ActivityIndicator.js +0 -82
- package/dist/data/components/ActivityIndicator.js.map +0 -1
- package/dist/data/components/Alert.d.ts +0 -15
- package/dist/data/components/Alert.d.ts.map +0 -1
- package/dist/data/components/Alert.js +0 -132
- package/dist/data/components/Alert.js.map +0 -1
- package/dist/data/components/Avatar.d.ts +0 -15
- package/dist/data/components/Avatar.d.ts.map +0 -1
- package/dist/data/components/Avatar.js +0 -93
- package/dist/data/components/Avatar.js.map +0 -1
- package/dist/data/components/Badge.d.ts +0 -15
- package/dist/data/components/Badge.d.ts.map +0 -1
- package/dist/data/components/Badge.js +0 -64
- package/dist/data/components/Badge.js.map +0 -1
- package/dist/data/components/Breadcrumb.d.ts +0 -15
- package/dist/data/components/Breadcrumb.d.ts.map +0 -1
- package/dist/data/components/Breadcrumb.js +0 -96
- package/dist/data/components/Breadcrumb.js.map +0 -1
- package/dist/data/components/Button.d.ts +0 -15
- package/dist/data/components/Button.d.ts.map +0 -1
- package/dist/data/components/Button.js +0 -87
- package/dist/data/components/Button.js.map +0 -1
- package/dist/data/components/Card.d.ts +0 -15
- package/dist/data/components/Card.d.ts.map +0 -1
- package/dist/data/components/Card.js +0 -67
- package/dist/data/components/Card.js.map +0 -1
- package/dist/data/components/Checkbox.d.ts +0 -15
- package/dist/data/components/Checkbox.d.ts.map +0 -1
- package/dist/data/components/Checkbox.js +0 -118
- package/dist/data/components/Checkbox.js.map +0 -1
- package/dist/data/components/Chip.d.ts +0 -15
- package/dist/data/components/Chip.d.ts.map +0 -1
- package/dist/data/components/Chip.js +0 -76
- package/dist/data/components/Chip.js.map +0 -1
- package/dist/data/components/Dialog.d.ts +0 -15
- package/dist/data/components/Dialog.d.ts.map +0 -1
- package/dist/data/components/Dialog.js +0 -137
- package/dist/data/components/Dialog.js.map +0 -1
- package/dist/data/components/Divider.d.ts +0 -15
- package/dist/data/components/Divider.d.ts.map +0 -1
- package/dist/data/components/Divider.js +0 -71
- package/dist/data/components/Divider.js.map +0 -1
- package/dist/data/components/Icon.d.ts +0 -15
- package/dist/data/components/Icon.d.ts.map +0 -1
- package/dist/data/components/Icon.js +0 -70
- package/dist/data/components/Icon.js.map +0 -1
- package/dist/data/components/Image.d.ts +0 -15
- package/dist/data/components/Image.d.ts.map +0 -1
- package/dist/data/components/Image.js +0 -122
- package/dist/data/components/Image.js.map +0 -1
- package/dist/data/components/Input.d.ts +0 -15
- package/dist/data/components/Input.d.ts.map +0 -1
- package/dist/data/components/Input.js +0 -109
- package/dist/data/components/Input.js.map +0 -1
- package/dist/data/components/List.d.ts +0 -15
- package/dist/data/components/List.d.ts.map +0 -1
- package/dist/data/components/List.js +0 -113
- package/dist/data/components/List.js.map +0 -1
- package/dist/data/components/Menu.d.ts +0 -15
- package/dist/data/components/Menu.d.ts.map +0 -1
- package/dist/data/components/Menu.js +0 -132
- package/dist/data/components/Menu.js.map +0 -1
- package/dist/data/components/Popover.d.ts +0 -15
- package/dist/data/components/Popover.d.ts.map +0 -1
- package/dist/data/components/Popover.js +0 -159
- package/dist/data/components/Popover.js.map +0 -1
- package/dist/data/components/Pressable.d.ts +0 -15
- package/dist/data/components/Pressable.d.ts.map +0 -1
- package/dist/data/components/Pressable.js +0 -125
- package/dist/data/components/Pressable.js.map +0 -1
- package/dist/data/components/Progress.d.ts +0 -15
- package/dist/data/components/Progress.d.ts.map +0 -1
- package/dist/data/components/Progress.js +0 -95
- package/dist/data/components/Progress.js.map +0 -1
- package/dist/data/components/RadioButton.d.ts +0 -15
- package/dist/data/components/RadioButton.d.ts.map +0 -1
- package/dist/data/components/RadioButton.js +0 -140
- package/dist/data/components/RadioButton.js.map +0 -1
- package/dist/data/components/SVGImage.d.ts +0 -15
- package/dist/data/components/SVGImage.d.ts.map +0 -1
- package/dist/data/components/SVGImage.js +0 -112
- package/dist/data/components/SVGImage.js.map +0 -1
- package/dist/data/components/Screen.d.ts +0 -15
- package/dist/data/components/Screen.d.ts.map +0 -1
- package/dist/data/components/Screen.js +0 -99
- package/dist/data/components/Screen.js.map +0 -1
- package/dist/data/components/Select.d.ts +0 -15
- package/dist/data/components/Select.d.ts.map +0 -1
- package/dist/data/components/Select.js +0 -146
- package/dist/data/components/Select.js.map +0 -1
- package/dist/data/components/Skeleton.d.ts +0 -15
- package/dist/data/components/Skeleton.d.ts.map +0 -1
- package/dist/data/components/Skeleton.js +0 -110
- package/dist/data/components/Skeleton.js.map +0 -1
- package/dist/data/components/Slider.d.ts +0 -15
- package/dist/data/components/Slider.d.ts.map +0 -1
- package/dist/data/components/Slider.js +0 -129
- package/dist/data/components/Slider.js.map +0 -1
- package/dist/data/components/Switch.d.ts +0 -15
- package/dist/data/components/Switch.d.ts.map +0 -1
- package/dist/data/components/Switch.js +0 -127
- package/dist/data/components/Switch.js.map +0 -1
- package/dist/data/components/TabBar.d.ts +0 -15
- package/dist/data/components/TabBar.d.ts.map +0 -1
- package/dist/data/components/TabBar.js +0 -145
- package/dist/data/components/TabBar.js.map +0 -1
- package/dist/data/components/Table.d.ts +0 -15
- package/dist/data/components/Table.d.ts.map +0 -1
- package/dist/data/components/Table.js +0 -151
- package/dist/data/components/Table.js.map +0 -1
- package/dist/data/components/Tabs.d.ts +0 -15
- package/dist/data/components/Tabs.d.ts.map +0 -1
- package/dist/data/components/Tabs.js +0 -150
- package/dist/data/components/Tabs.js.map +0 -1
- package/dist/data/components/Text.d.ts +0 -15
- package/dist/data/components/Text.d.ts.map +0 -1
- package/dist/data/components/Text.js +0 -85
- package/dist/data/components/Text.js.map +0 -1
- package/dist/data/components/TextArea.d.ts +0 -15
- package/dist/data/components/TextArea.d.ts.map +0 -1
- package/dist/data/components/TextArea.js +0 -155
- package/dist/data/components/TextArea.js.map +0 -1
- package/dist/data/components/Tooltip.d.ts +0 -15
- package/dist/data/components/Tooltip.d.ts.map +0 -1
- package/dist/data/components/Tooltip.js +0 -105
- package/dist/data/components/Tooltip.js.map +0 -1
- package/dist/data/components/Video.d.ts +0 -15
- package/dist/data/components/Video.d.ts.map +0 -1
- package/dist/data/components/Video.js +0 -168
- package/dist/data/components/Video.js.map +0 -1
- package/dist/data/components/View.d.ts +0 -15
- package/dist/data/components/View.d.ts.map +0 -1
- package/dist/data/components/View.js +0 -126
- package/dist/data/components/View.js.map +0 -1
- package/dist/data/components/index.d.ts +0 -37
- package/dist/data/components/index.d.ts.map +0 -1
- package/dist/data/components/index.js +0 -110
- package/dist/data/components/index.js.map +0 -1
- package/dist/data/framework-guides.d.ts +0 -2
- package/dist/data/framework-guides.d.ts.map +0 -1
- package/dist/data/framework-guides.js +0 -589
- package/dist/data/framework-guides.js.map +0 -1
- package/dist/data/icon-guide.d.ts +0 -2
- package/dist/data/icon-guide.d.ts.map +0 -1
- package/dist/data/icon-guide.js +0 -285
- package/dist/data/icon-guide.js.map +0 -1
- package/dist/data/icons.json +0 -7452
- package/dist/data/navigation-guides.d.ts +0 -2
- package/dist/data/navigation-guides.d.ts.map +0 -1
- package/dist/data/navigation-guides.js +0 -1196
- package/dist/data/navigation-guides.js.map +0 -1
- package/dist/index.d.ts +0 -3
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Card Component Examples
|
|
3
|
+
*
|
|
4
|
+
* These examples are type-checked against the actual CardProps interface
|
|
5
|
+
* to ensure accuracy and correctness.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import React from 'react';
|
|
9
|
+
import { Card, Text, View } from '@idealyst/components';
|
|
10
|
+
|
|
11
|
+
// Example 1: Basic Card
|
|
12
|
+
export function BasicCard() {
|
|
13
|
+
return (
|
|
14
|
+
<Card>
|
|
15
|
+
<Text>Simple card content</Text>
|
|
16
|
+
</Card>
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// Example 2: Card Types
|
|
21
|
+
export function CardTypes() {
|
|
22
|
+
return (
|
|
23
|
+
<>
|
|
24
|
+
<Card type="default">
|
|
25
|
+
<Text>Default Card</Text>
|
|
26
|
+
</Card>
|
|
27
|
+
<Card type="outlined">
|
|
28
|
+
<Text>Outlined Card</Text>
|
|
29
|
+
</Card>
|
|
30
|
+
<Card type="elevated">
|
|
31
|
+
<Text>Elevated Card</Text>
|
|
32
|
+
</Card>
|
|
33
|
+
<Card type="filled">
|
|
34
|
+
<Text>Filled Card</Text>
|
|
35
|
+
</Card>
|
|
36
|
+
</>
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// Example 3: Card with Padding Variants
|
|
41
|
+
export function CardPadding() {
|
|
42
|
+
return (
|
|
43
|
+
<>
|
|
44
|
+
<Card padding="none">
|
|
45
|
+
<Text>No Padding</Text>
|
|
46
|
+
</Card>
|
|
47
|
+
<Card padding="xs">
|
|
48
|
+
<Text>Extra Small Padding</Text>
|
|
49
|
+
</Card>
|
|
50
|
+
<Card padding="sm">
|
|
51
|
+
<Text>Small Padding</Text>
|
|
52
|
+
</Card>
|
|
53
|
+
<Card padding="md">
|
|
54
|
+
<Text>Medium Padding</Text>
|
|
55
|
+
</Card>
|
|
56
|
+
<Card padding="lg">
|
|
57
|
+
<Text>Large Padding</Text>
|
|
58
|
+
</Card>
|
|
59
|
+
<Card padding="xl">
|
|
60
|
+
<Text>Extra Large Padding</Text>
|
|
61
|
+
</Card>
|
|
62
|
+
</>
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// Example 4: Card with Radius Variants
|
|
67
|
+
export function CardRadius() {
|
|
68
|
+
return (
|
|
69
|
+
<>
|
|
70
|
+
<Card radius="none">
|
|
71
|
+
<Text>No Radius</Text>
|
|
72
|
+
</Card>
|
|
73
|
+
<Card radius="sm">
|
|
74
|
+
<Text>Small Radius</Text>
|
|
75
|
+
</Card>
|
|
76
|
+
<Card radius="md">
|
|
77
|
+
<Text>Medium Radius</Text>
|
|
78
|
+
</Card>
|
|
79
|
+
<Card radius="lg">
|
|
80
|
+
<Text>Large Radius</Text>
|
|
81
|
+
</Card>
|
|
82
|
+
<Card radius="xl">
|
|
83
|
+
<Text>Extra Large Radius</Text>
|
|
84
|
+
</Card>
|
|
85
|
+
</>
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// Example 5: Card with Intent
|
|
90
|
+
export function CardWithIntent() {
|
|
91
|
+
return (
|
|
92
|
+
<>
|
|
93
|
+
<Card intent="primary" type="filled">
|
|
94
|
+
<Text>Primary Card</Text>
|
|
95
|
+
</Card>
|
|
96
|
+
<Card intent="success" type="filled">
|
|
97
|
+
<Text>Success Card</Text>
|
|
98
|
+
</Card>
|
|
99
|
+
<Card intent="error" type="filled">
|
|
100
|
+
<Text>Error Card</Text>
|
|
101
|
+
</Card>
|
|
102
|
+
</>
|
|
103
|
+
);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
// Example 6: Clickable Card
|
|
107
|
+
export function ClickableCard() {
|
|
108
|
+
return (
|
|
109
|
+
<Card
|
|
110
|
+
clickable
|
|
111
|
+
onPress={() => console.log('Card clicked')}
|
|
112
|
+
type="outlined"
|
|
113
|
+
padding="md"
|
|
114
|
+
>
|
|
115
|
+
<Text>Click this card</Text>
|
|
116
|
+
</Card>
|
|
117
|
+
);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// Example 7: Complex Card
|
|
121
|
+
export function ComplexCard() {
|
|
122
|
+
return (
|
|
123
|
+
<Card type="elevated" padding="lg" radius="md">
|
|
124
|
+
<View spacing="md">
|
|
125
|
+
<Text size="lg" weight="bold">Card Title</Text>
|
|
126
|
+
<Text size="md">This is some card content with multiple elements.</Text>
|
|
127
|
+
<Text size="sm" >Additional information</Text>
|
|
128
|
+
</View>
|
|
129
|
+
</Card>
|
|
130
|
+
);
|
|
131
|
+
}
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checkbox Component Examples
|
|
3
|
+
*
|
|
4
|
+
* These examples are type-checked against the actual CheckboxProps interface
|
|
5
|
+
* to ensure accuracy and correctness.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import React from 'react';
|
|
9
|
+
import { Checkbox, View, Text } from '@idealyst/components';
|
|
10
|
+
|
|
11
|
+
// Example 1: Basic Checkbox
|
|
12
|
+
export function BasicCheckbox() {
|
|
13
|
+
const [checked, setChecked] = React.useState(false);
|
|
14
|
+
|
|
15
|
+
return (
|
|
16
|
+
<Checkbox
|
|
17
|
+
checked={checked}
|
|
18
|
+
onCheckedChange={setChecked}
|
|
19
|
+
label="Accept terms and conditions"
|
|
20
|
+
/>
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// Example 2: Checkbox Sizes
|
|
25
|
+
export function CheckboxSizes() {
|
|
26
|
+
const [checked, setChecked] = React.useState(true);
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<View spacing="md">
|
|
30
|
+
<Checkbox checked={checked} onCheckedChange={setChecked} label="Extra Small" size="xs" />
|
|
31
|
+
<Checkbox checked={checked} onCheckedChange={setChecked} label="Small" size="sm" />
|
|
32
|
+
<Checkbox checked={checked} onCheckedChange={setChecked} label="Medium" size="md" />
|
|
33
|
+
<Checkbox checked={checked} onCheckedChange={setChecked} label="Large" size="lg" />
|
|
34
|
+
<Checkbox checked={checked} onCheckedChange={setChecked} label="Extra Large" size="xl" />
|
|
35
|
+
</View>
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// Example 3: Checkbox Intents
|
|
40
|
+
export function CheckboxIntents() {
|
|
41
|
+
const [checked, setChecked] = React.useState(true);
|
|
42
|
+
|
|
43
|
+
return (
|
|
44
|
+
<View spacing="md">
|
|
45
|
+
<Checkbox checked={checked} onCheckedChange={setChecked} label="Primary" intent="primary" />
|
|
46
|
+
<Checkbox checked={checked} onCheckedChange={setChecked} label="Success" intent="success" />
|
|
47
|
+
<Checkbox checked={checked} onCheckedChange={setChecked} label="Error" intent="error" />
|
|
48
|
+
<Checkbox checked={checked} onCheckedChange={setChecked} label="Warning" intent="warning" />
|
|
49
|
+
<Checkbox checked={checked} onCheckedChange={setChecked} label="Neutral" intent="neutral" />
|
|
50
|
+
<Checkbox checked={checked} onCheckedChange={setChecked} label="Info" intent="info" />
|
|
51
|
+
</View>
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// Example 4: Checkbox Variants
|
|
56
|
+
export function CheckboxVariants() {
|
|
57
|
+
const [checked, setChecked] = React.useState(true);
|
|
58
|
+
|
|
59
|
+
return (
|
|
60
|
+
<View spacing="md">
|
|
61
|
+
<Checkbox
|
|
62
|
+
checked={checked}
|
|
63
|
+
onCheckedChange={setChecked}
|
|
64
|
+
label="Default variant"
|
|
65
|
+
variant="default"
|
|
66
|
+
/>
|
|
67
|
+
<Checkbox
|
|
68
|
+
checked={checked}
|
|
69
|
+
onCheckedChange={setChecked}
|
|
70
|
+
label="Outlined variant"
|
|
71
|
+
variant="outlined"
|
|
72
|
+
/>
|
|
73
|
+
</View>
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// Example 5: Indeterminate State
|
|
78
|
+
export function IndeterminateCheckbox() {
|
|
79
|
+
const [parentChecked, setParentChecked] = React.useState(false);
|
|
80
|
+
const [child1, setChild1] = React.useState(false);
|
|
81
|
+
const [child2, setChild2] = React.useState(false);
|
|
82
|
+
|
|
83
|
+
const indeterminate = child1 !== child2;
|
|
84
|
+
const allChecked = child1 && child2;
|
|
85
|
+
|
|
86
|
+
React.useEffect(() => {
|
|
87
|
+
setParentChecked(allChecked);
|
|
88
|
+
}, [child1, child2, allChecked]);
|
|
89
|
+
|
|
90
|
+
return (
|
|
91
|
+
<View spacing="sm">
|
|
92
|
+
<Checkbox
|
|
93
|
+
checked={parentChecked}
|
|
94
|
+
indeterminate={indeterminate}
|
|
95
|
+
onCheckedChange={(checked) => {
|
|
96
|
+
setParentChecked(checked);
|
|
97
|
+
setChild1(checked);
|
|
98
|
+
setChild2(checked);
|
|
99
|
+
}}
|
|
100
|
+
label="Select All"
|
|
101
|
+
/>
|
|
102
|
+
<View spacing="sm" style={{ paddingLeft: 20 }}>
|
|
103
|
+
<Checkbox checked={child1} onCheckedChange={setChild1} label="Option 1" />
|
|
104
|
+
<Checkbox checked={child2} onCheckedChange={setChild2} label="Option 2" />
|
|
105
|
+
</View>
|
|
106
|
+
</View>
|
|
107
|
+
);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// Example 6: Disabled Checkbox
|
|
111
|
+
export function DisabledCheckbox() {
|
|
112
|
+
return (
|
|
113
|
+
<View spacing="md">
|
|
114
|
+
<Checkbox checked={false} onCheckedChange={() => {}} label="Unchecked disabled" disabled />
|
|
115
|
+
<Checkbox checked={true} onCheckedChange={() => {}} label="Checked disabled" disabled />
|
|
116
|
+
</View>
|
|
117
|
+
);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// Example 7: Checkbox with Custom Children
|
|
121
|
+
export function CheckboxWithCustomContent() {
|
|
122
|
+
const [checked, setChecked] = React.useState(false);
|
|
123
|
+
|
|
124
|
+
return (
|
|
125
|
+
<Checkbox checked={checked} onCheckedChange={setChecked}>
|
|
126
|
+
<View spacing="xs">
|
|
127
|
+
<Text weight="bold">Marketing emails</Text>
|
|
128
|
+
<Text size="sm" >
|
|
129
|
+
Receive updates about new features and special offers
|
|
130
|
+
</Text>
|
|
131
|
+
</View>
|
|
132
|
+
</Checkbox>
|
|
133
|
+
);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
// Example 8: Checkbox with Helper Text and Error
|
|
137
|
+
export function CheckboxWithHelperText() {
|
|
138
|
+
const [accepted, setAccepted] = React.useState(false);
|
|
139
|
+
const [submitted, setSubmitted] = React.useState(false);
|
|
140
|
+
|
|
141
|
+
const showError = submitted && !accepted;
|
|
142
|
+
|
|
143
|
+
return (
|
|
144
|
+
<View spacing="md">
|
|
145
|
+
<Checkbox
|
|
146
|
+
checked={accepted}
|
|
147
|
+
onCheckedChange={setAccepted}
|
|
148
|
+
label="I agree to the terms and conditions"
|
|
149
|
+
required
|
|
150
|
+
error={showError ? 'You must accept the terms to continue' : undefined}
|
|
151
|
+
helperText={!showError ? 'Required field' : undefined}
|
|
152
|
+
/>
|
|
153
|
+
</View>
|
|
154
|
+
);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
// Example 9: Checkbox Group
|
|
158
|
+
export function CheckboxGroup() {
|
|
159
|
+
const [interests, setInterests] = React.useState({
|
|
160
|
+
tech: false,
|
|
161
|
+
design: false,
|
|
162
|
+
business: false,
|
|
163
|
+
marketing: false,
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
const toggleInterest = (key: keyof typeof interests) => {
|
|
167
|
+
setInterests(prev => ({ ...prev, [key]: !prev[key] }));
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
return (
|
|
171
|
+
<View spacing="sm">
|
|
172
|
+
<Text weight="bold">Select your interests:</Text>
|
|
173
|
+
<Checkbox
|
|
174
|
+
checked={interests.tech}
|
|
175
|
+
onCheckedChange={() => toggleInterest('tech')}
|
|
176
|
+
label="Technology"
|
|
177
|
+
/>
|
|
178
|
+
<Checkbox
|
|
179
|
+
checked={interests.design}
|
|
180
|
+
onCheckedChange={() => toggleInterest('design')}
|
|
181
|
+
label="Design"
|
|
182
|
+
/>
|
|
183
|
+
<Checkbox
|
|
184
|
+
checked={interests.business}
|
|
185
|
+
onCheckedChange={() => toggleInterest('business')}
|
|
186
|
+
label="Business"
|
|
187
|
+
/>
|
|
188
|
+
<Checkbox
|
|
189
|
+
checked={interests.marketing}
|
|
190
|
+
onCheckedChange={() => toggleInterest('marketing')}
|
|
191
|
+
label="Marketing"
|
|
192
|
+
/>
|
|
193
|
+
</View>
|
|
194
|
+
);
|
|
195
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Chip Component Examples
|
|
3
|
+
*
|
|
4
|
+
* These examples are type-checked against the actual ChipProps interface
|
|
5
|
+
* to ensure accuracy and correctness.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import React from 'react';
|
|
9
|
+
import { Chip } from '@idealyst/components';
|
|
10
|
+
|
|
11
|
+
// Example 1: Basic Chip
|
|
12
|
+
export function BasicChip() {
|
|
13
|
+
return <Chip label="React" />;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
// Example 2: Chip Types
|
|
17
|
+
export function ChipTypes() {
|
|
18
|
+
return (
|
|
19
|
+
<>
|
|
20
|
+
<Chip label="Filled" type="filled" />
|
|
21
|
+
<Chip label="Outlined" type="outlined" />
|
|
22
|
+
<Chip label="Soft" type="soft" />
|
|
23
|
+
</>
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// Example 3: Chip Sizes
|
|
28
|
+
export function ChipSizes() {
|
|
29
|
+
return (
|
|
30
|
+
<>
|
|
31
|
+
<Chip label="XS" size="xs" />
|
|
32
|
+
<Chip label="SM" size="sm" />
|
|
33
|
+
<Chip label="MD" size="md" />
|
|
34
|
+
<Chip label="LG" size="lg" />
|
|
35
|
+
<Chip label="XL" size="xl" />
|
|
36
|
+
</>
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// Example 4: Chip Intents
|
|
41
|
+
export function ChipIntents() {
|
|
42
|
+
return (
|
|
43
|
+
<>
|
|
44
|
+
<Chip label="Primary" intent="primary" />
|
|
45
|
+
<Chip label="Success" intent="success" />
|
|
46
|
+
<Chip label="Error" intent="error" />
|
|
47
|
+
<Chip label="Warning" intent="warning" />
|
|
48
|
+
<Chip label="Neutral" intent="neutral" />
|
|
49
|
+
<Chip label="Info" intent="info" />
|
|
50
|
+
</>
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// Example 5: Chip with Icon
|
|
55
|
+
export function ChipWithIcon() {
|
|
56
|
+
return (
|
|
57
|
+
<>
|
|
58
|
+
<Chip label="React" icon="react" />
|
|
59
|
+
<Chip label="TypeScript" icon="language-typescript" />
|
|
60
|
+
</>
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// Example 6: Deletable Chip
|
|
65
|
+
export function DeletableChip() {
|
|
66
|
+
const [visible, setVisible] = React.useState(true);
|
|
67
|
+
|
|
68
|
+
if (!visible) return null;
|
|
69
|
+
|
|
70
|
+
return (
|
|
71
|
+
<Chip
|
|
72
|
+
label="Deletable"
|
|
73
|
+
onDelete={() => setVisible(false)}
|
|
74
|
+
/>
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// Example 7: Clickable Chip
|
|
79
|
+
export function ClickableChip() {
|
|
80
|
+
return (
|
|
81
|
+
<Chip
|
|
82
|
+
label="Clickable"
|
|
83
|
+
onPress={() => console.log('Chip clicked')}
|
|
84
|
+
type="outlined"
|
|
85
|
+
/>
|
|
86
|
+
);
|
|
87
|
+
}
|