@app-studio/web 0.9.31 → 0.9.32
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/docs/components/Accordion.mdx +158 -0
- package/docs/components/Alert.mdx +123 -0
- package/docs/components/AspectRatio.mdx +55 -0
- package/docs/components/Avatar.mdx +85 -0
- package/docs/components/Background.mdx +522 -0
- package/docs/components/Badge.mdx +220 -0
- package/docs/components/Button.mdx +272 -0
- package/docs/components/Calendar.mdx +274 -0
- package/docs/components/Card.mdx +341 -0
- package/docs/components/Carousel.mdx +411 -0
- package/docs/components/Center.mdx +474 -0
- package/docs/components/Chart.mdx +232 -0
- package/docs/components/ChatInput.mdx +373 -0
- package/docs/components/Checkbox.mdx +66 -0
- package/docs/components/ColorInput.mdx +209 -0
- package/docs/components/ComboBox.mdx +364 -0
- package/docs/components/Command.mdx +252 -0
- package/docs/components/ContextMenu.mdx +219 -0
- package/docs/components/CountryPicker.mdx +123 -0
- package/docs/components/DatePicker.mdx +77 -0
- package/docs/components/DragAndDrop.mdx +539 -0
- package/docs/components/DropdownMenu.mdx +205 -0
- package/docs/components/File.mdx +8 -0
- package/docs/components/Flow.mdx +257 -0
- package/docs/components/Form.mdx +681 -0
- package/docs/components/Formik.mdx +621 -0
- package/docs/components/Gradient.mdx +271 -0
- package/docs/components/Horizontal.mdx +40 -0
- package/docs/components/HoverCard.mdx +140 -0
- package/docs/components/Icon.mdx +438 -0
- package/docs/components/Label.mdx +438 -0
- package/docs/components/Link.mdx +83 -0
- package/docs/components/Loader.mdx +527 -0
- package/docs/components/Menubar.mdx +124 -0
- package/docs/components/Message.mdx +571 -0
- package/docs/components/Modal.mdx +533 -0
- package/docs/components/NavigationMenu.mdx +165 -0
- package/docs/components/Pagination.mdx +150 -0
- package/docs/components/Password.mdx +121 -0
- package/docs/components/Resizable.mdx +148 -0
- package/docs/components/Select.mdx +126 -0
- package/docs/components/Separator.mdx +121 -0
- package/docs/components/Sidebar.mdx +147 -0
- package/docs/components/Slider.mdx +232 -0
- package/docs/components/Switch.mdx +62 -0
- package/docs/components/Table.mdx +409 -0
- package/docs/components/Tabs.mdx +215 -0
- package/docs/components/TagInput.mdx +528 -0
- package/docs/components/Text.mdx +163 -0
- package/docs/components/TextArea.mdx +136 -0
- package/docs/components/TextField.mdx +225 -0
- package/docs/components/Title.mdx +535 -0
- package/docs/components/Toast.mdx +165 -0
- package/docs/components/Toggle.mdx +141 -0
- package/docs/components/ToggleGroup.mdx +165 -0
- package/docs/components/Tooltip.mdx +191 -0
- package/docs/components/Tree.mdx +340 -0
- package/docs/components/Uploader.mdx +426 -0
- package/docs/components/Vertical.mdx +566 -0
- package/package.json +1 -1
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
# Accordion
|
|
2
|
+
|
|
3
|
+
A component that displays collapsible content panels for presenting information in a limited amount of space.
|
|
4
|
+
|
|
5
|
+
### **Import**
|
|
6
|
+
```tsx
|
|
7
|
+
import { Accordion } from '@app-studio/web';
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
### **Default**
|
|
11
|
+
```tsx
|
|
12
|
+
import React from 'react';
|
|
13
|
+
import { Accordion } from '../Accordion';
|
|
14
|
+
import { Text } from '../../Text/Text';
|
|
15
|
+
|
|
16
|
+
export const DefaultAccordion = () => {
|
|
17
|
+
return (
|
|
18
|
+
<Accordion>
|
|
19
|
+
<Accordion.Item id="item-1">
|
|
20
|
+
<Accordion.Header>
|
|
21
|
+
<Text fontWeight="bold">What is React?</Text>
|
|
22
|
+
</Accordion.Header>
|
|
23
|
+
<Accordion.Content>
|
|
24
|
+
<Text>
|
|
25
|
+
React is a JavaScript library for building user interfaces. It is maintained by Facebook and a community of individual developers and companies.
|
|
26
|
+
</Text>
|
|
27
|
+
</Accordion.Content>
|
|
28
|
+
</Accordion.Item>
|
|
29
|
+
|
|
30
|
+
<Accordion.Item id="item-2">
|
|
31
|
+
<Accordion.Header>
|
|
32
|
+
<Text fontWeight="bold">What are React Hooks?</Text>
|
|
33
|
+
</Accordion.Header>
|
|
34
|
+
<Accordion.Content>
|
|
35
|
+
<Text>
|
|
36
|
+
Hooks are functions that let you "hook into" React state and lifecycle features from function components.
|
|
37
|
+
</Text>
|
|
38
|
+
</Accordion.Content>
|
|
39
|
+
</Accordion.Item>
|
|
40
|
+
</Accordion>
|
|
41
|
+
);
|
|
42
|
+
};
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### **Multiple**
|
|
46
|
+
Allow multiple items to be expanded at once.
|
|
47
|
+
|
|
48
|
+
```tsx
|
|
49
|
+
import React from 'react';
|
|
50
|
+
import { Accordion } from '../Accordion';
|
|
51
|
+
import { Text } from '../../Text/Text';
|
|
52
|
+
|
|
53
|
+
export const MultipleAccordion = () => {
|
|
54
|
+
return (
|
|
55
|
+
<Accordion allowMultiple defaultExpandedItems={['item-1']}>
|
|
56
|
+
<Accordion.Item id="item-1">
|
|
57
|
+
<Accordion.Header>
|
|
58
|
+
<Text fontWeight="bold">First Item (Initially Expanded)</Text>
|
|
59
|
+
</Accordion.Header>
|
|
60
|
+
<Accordion.Content>
|
|
61
|
+
<Text>
|
|
62
|
+
This item is initially expanded. You can expand multiple items at once in this accordion.
|
|
63
|
+
</Text>
|
|
64
|
+
</Accordion.Content>
|
|
65
|
+
</Accordion.Item>
|
|
66
|
+
|
|
67
|
+
<Accordion.Item id="item-2">
|
|
68
|
+
<Accordion.Header>
|
|
69
|
+
<Text fontWeight="bold">Second Item</Text>
|
|
70
|
+
</Accordion.Header>
|
|
71
|
+
<Accordion.Content>
|
|
72
|
+
<Text>
|
|
73
|
+
This is the second item. Try expanding this while the first item is still open.
|
|
74
|
+
</Text>
|
|
75
|
+
</Accordion.Content>
|
|
76
|
+
</Accordion.Item>
|
|
77
|
+
</Accordion>
|
|
78
|
+
);
|
|
79
|
+
};
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### **Variants**
|
|
83
|
+
Different visual styles for the accordion.
|
|
84
|
+
|
|
85
|
+
```tsx
|
|
86
|
+
import React from 'react';
|
|
87
|
+
import { Accordion } from '../Accordion';
|
|
88
|
+
import { Text } from '../../Text/Text';
|
|
89
|
+
|
|
90
|
+
export const AccordionVariants = () => {
|
|
91
|
+
return (
|
|
92
|
+
<>
|
|
93
|
+
<Accordion variant="outline">
|
|
94
|
+
<Accordion.Item id="outline-1">
|
|
95
|
+
<Accordion.Header>
|
|
96
|
+
<Text fontWeight="bold">Outline Variant</Text>
|
|
97
|
+
</Accordion.Header>
|
|
98
|
+
<Accordion.Content>
|
|
99
|
+
<Text>
|
|
100
|
+
This is the content for the outline variant accordion.
|
|
101
|
+
</Text>
|
|
102
|
+
</Accordion.Content>
|
|
103
|
+
</Accordion.Item>
|
|
104
|
+
</Accordion>
|
|
105
|
+
|
|
106
|
+
<Accordion variant="filled">
|
|
107
|
+
<Accordion.Item id="filled-1">
|
|
108
|
+
<Accordion.Header>
|
|
109
|
+
<Text fontWeight="bold">Filled Variant</Text>
|
|
110
|
+
</Accordion.Header>
|
|
111
|
+
<Accordion.Content>
|
|
112
|
+
<Text>
|
|
113
|
+
This is the content for the filled variant accordion.
|
|
114
|
+
</Text>
|
|
115
|
+
</Accordion.Content>
|
|
116
|
+
</Accordion.Item>
|
|
117
|
+
</Accordion>
|
|
118
|
+
</>
|
|
119
|
+
);
|
|
120
|
+
};
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### **Disabled**
|
|
124
|
+
Disable specific accordion items.
|
|
125
|
+
|
|
126
|
+
```tsx
|
|
127
|
+
import React from 'react';
|
|
128
|
+
import { Accordion } from '../Accordion';
|
|
129
|
+
import { Text } from '../../Text/Text';
|
|
130
|
+
|
|
131
|
+
export const DisabledAccordion = () => {
|
|
132
|
+
return (
|
|
133
|
+
<Accordion>
|
|
134
|
+
<Accordion.Item id="regular-1">
|
|
135
|
+
<Accordion.Header>
|
|
136
|
+
<Text fontWeight="bold">Regular Item</Text>
|
|
137
|
+
</Accordion.Header>
|
|
138
|
+
<Accordion.Content>
|
|
139
|
+
<Text>
|
|
140
|
+
This is a regular accordion item that can be expanded and collapsed.
|
|
141
|
+
</Text>
|
|
142
|
+
</Accordion.Content>
|
|
143
|
+
</Accordion.Item>
|
|
144
|
+
|
|
145
|
+
<Accordion.Item id="disabled-1" isDisabled>
|
|
146
|
+
<Accordion.Header>
|
|
147
|
+
<Text fontWeight="bold">Disabled Item</Text>
|
|
148
|
+
</Accordion.Header>
|
|
149
|
+
<Accordion.Content>
|
|
150
|
+
<Text>
|
|
151
|
+
This content won't be accessible because the item is disabled.
|
|
152
|
+
</Text>
|
|
153
|
+
</Accordion.Content>
|
|
154
|
+
</Accordion.Item>
|
|
155
|
+
</Accordion>
|
|
156
|
+
);
|
|
157
|
+
};
|
|
158
|
+
```
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
# Alert
|
|
2
|
+
|
|
3
|
+
Displays an alert with optional icon and customizable views.
|
|
4
|
+
|
|
5
|
+
### **Import**
|
|
6
|
+
```tsx
|
|
7
|
+
import { Alert } from '@app-studio/web';
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
### **Default**
|
|
11
|
+
```tsx
|
|
12
|
+
import React from 'react';
|
|
13
|
+
import { Alert } from '../Alert';
|
|
14
|
+
|
|
15
|
+
export const DefaultDemo = () => {
|
|
16
|
+
return (
|
|
17
|
+
<Alert
|
|
18
|
+
title="Heads up!"
|
|
19
|
+
description="You can add components to your app using the cli."
|
|
20
|
+
/>
|
|
21
|
+
);
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### **icon**
|
|
27
|
+
Optional icon property, expecting a React node element
|
|
28
|
+
|
|
29
|
+
```tsx
|
|
30
|
+
import React from 'react';
|
|
31
|
+
import { EditIcon } from '../../Icon/Icon';
|
|
32
|
+
import { Alert } from '../Alert';
|
|
33
|
+
|
|
34
|
+
export const IconDemo = () => {
|
|
35
|
+
return (
|
|
36
|
+
<Alert
|
|
37
|
+
title="Heads up!"
|
|
38
|
+
description="You can add components to your app using the cli."
|
|
39
|
+
icon={<EditIcon size={24} color="black" />}
|
|
40
|
+
/>
|
|
41
|
+
);
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### **variant**
|
|
47
|
+
Optional variant property to determine the style of the alert
|
|
48
|
+
|
|
49
|
+
```tsx
|
|
50
|
+
import React from 'react';
|
|
51
|
+
import { Horizontal } from 'app-studio';
|
|
52
|
+
import { Alert } from '../Alert';
|
|
53
|
+
import { Variant } from '../Alert/Alert.type';
|
|
54
|
+
|
|
55
|
+
export const VariantDemo = () => (
|
|
56
|
+
<Horizontal gap={10}>
|
|
57
|
+
{['default', 'info', 'warning', 'success', 'error'].map((color, index) => (
|
|
58
|
+
<Alert
|
|
59
|
+
key={index}
|
|
60
|
+
variant={color as Variant}
|
|
61
|
+
title={'Heads Up!'}
|
|
62
|
+
description={'You can add components to your app using the cli.'}
|
|
63
|
+
/>
|
|
64
|
+
))}
|
|
65
|
+
</Horizontal>
|
|
66
|
+
);
|
|
67
|
+
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### **styles**
|
|
71
|
+
Optional styles property to apply custom styles to the alert component
|
|
72
|
+
|
|
73
|
+
```tsx
|
|
74
|
+
import React from 'react';
|
|
75
|
+
import { Alert } from '../Alert';
|
|
76
|
+
|
|
77
|
+
export const StylesDemo = () => (
|
|
78
|
+
<Alert
|
|
79
|
+
title={'Heads Up!'}
|
|
80
|
+
description={'You can add components to your app using the cli.'}
|
|
81
|
+
views={{
|
|
82
|
+
container: { backgroundColor: 'black' },
|
|
83
|
+
title: { color: 'white' },
|
|
84
|
+
description: { color: 'white' },
|
|
85
|
+
icon: { color: 'white' },
|
|
86
|
+
}}
|
|
87
|
+
/>
|
|
88
|
+
);
|
|
89
|
+
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### **Theme Mode Support**
|
|
93
|
+
The Alert component supports both light and dark themes through the `themeMode` prop.
|
|
94
|
+
|
|
95
|
+
```tsx
|
|
96
|
+
import React from 'react';
|
|
97
|
+
import { Alert } from '../Alert';
|
|
98
|
+
import { Vertical } from 'app-studio';
|
|
99
|
+
import { Text } from '../../Text/Text';
|
|
100
|
+
|
|
101
|
+
export const DarkModeDemo = () => {
|
|
102
|
+
return (
|
|
103
|
+
<Vertical gap={24}>
|
|
104
|
+
<Text fontSize={20} fontWeight="bold">Light Mode Alerts</Text>
|
|
105
|
+
<Alert
|
|
106
|
+
themeMode="light"
|
|
107
|
+
variant="info"
|
|
108
|
+
title="Info Alert (Light)"
|
|
109
|
+
description="This is an info alert in light mode."
|
|
110
|
+
/>
|
|
111
|
+
|
|
112
|
+
<Text fontSize={20} fontWeight="bold" marginTop={40}>Dark Mode Alerts</Text>
|
|
113
|
+
<Alert
|
|
114
|
+
themeMode="dark"
|
|
115
|
+
variant="info"
|
|
116
|
+
title="Info Alert (Dark)"
|
|
117
|
+
description="This is an info alert in dark mode."
|
|
118
|
+
/>
|
|
119
|
+
</Vertical>
|
|
120
|
+
);
|
|
121
|
+
};
|
|
122
|
+
```
|
|
123
|
+
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# AspectRatio
|
|
2
|
+
|
|
3
|
+
Maintains a set aspect ratio for child content
|
|
4
|
+
|
|
5
|
+
### **Import**
|
|
6
|
+
```tsx
|
|
7
|
+
import { AspectRatio } from '@app-studio/web';
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
### **Default**
|
|
11
|
+
```tsx
|
|
12
|
+
import React from 'react';
|
|
13
|
+
import { Image } from 'app-studio';
|
|
14
|
+
import { AspectRatio } from '../AspectRatio';
|
|
15
|
+
|
|
16
|
+
export const DefaultDemo = () => {
|
|
17
|
+
return (
|
|
18
|
+
<AspectRatio>
|
|
19
|
+
<Image
|
|
20
|
+
alt="image"
|
|
21
|
+
objectFit="cover"
|
|
22
|
+
width="100%"
|
|
23
|
+
height="100%"
|
|
24
|
+
src="https://t3.ftcdn.net/jpg/02/82/15/88/360_F_282158853_VtXRiSiN5eCjPddHobErJewxJ65lYZGt.jpg"
|
|
25
|
+
/>
|
|
26
|
+
</AspectRatio>
|
|
27
|
+
);
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### **ratio**
|
|
33
|
+
specifying the aspect ratio
|
|
34
|
+
|
|
35
|
+
```tsx
|
|
36
|
+
import React from 'react';
|
|
37
|
+
import { Image } from 'app-studio';
|
|
38
|
+
import { AspectRatio } from '../AspectRatio';
|
|
39
|
+
|
|
40
|
+
export const RatioDemo = () => {
|
|
41
|
+
return (
|
|
42
|
+
<AspectRatio ratio={4 / 3} width={300}>
|
|
43
|
+
<Image
|
|
44
|
+
alt="image"
|
|
45
|
+
objectFit="cover"
|
|
46
|
+
width="100%"
|
|
47
|
+
height="100%"
|
|
48
|
+
src="https://t3.ftcdn.net/jpg/02/82/15/88/360_F_282158853_VtXRiSiN5eCjPddHobErJewxJ65lYZGt.jpg"
|
|
49
|
+
/>
|
|
50
|
+
</AspectRatio>
|
|
51
|
+
);
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
```
|
|
55
|
+
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# Avatar
|
|
2
|
+
|
|
3
|
+
Displays a circular avatar with image fallback and custom styling options.
|
|
4
|
+
|
|
5
|
+
### **Import**
|
|
6
|
+
```tsx
|
|
7
|
+
import { Avatar } from '@app-studio/web';
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
### **Default**
|
|
11
|
+
```tsx
|
|
12
|
+
import React from 'react';
|
|
13
|
+
import { Avatar } from '../Avatar';
|
|
14
|
+
|
|
15
|
+
export const DefaultDemo = () => (
|
|
16
|
+
<Avatar src="https://t3.ftcdn.net/jpg/06/17/13/26/360_F_617132669_YptvM7fIuczaUbYYpMe3VTLimwZwzlWf.jpg" />
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
### **size**
|
|
22
|
+
Optional property to specify the size of the avatar, from predefined Size options.
|
|
23
|
+
|
|
24
|
+
```tsx
|
|
25
|
+
import React from 'react';
|
|
26
|
+
import { Vertical } from 'app-studio';
|
|
27
|
+
import { Avatar } from '../Avatar';
|
|
28
|
+
import { Size } from '../Avatar/Avatar.type';
|
|
29
|
+
|
|
30
|
+
export const SizeDemo = () => {
|
|
31
|
+
return (
|
|
32
|
+
<Vertical gap={10}>
|
|
33
|
+
{['xs', 'sm', 'md', 'lg', 'xl'].map((size, index) => (
|
|
34
|
+
<Avatar
|
|
35
|
+
key={index}
|
|
36
|
+
src="https://t3.ftcdn.net/jpg/06/17/13/26/360_F_617132669_YptvM7fIuczaUbYYpMe3VTLimwZwzlWf.jpg"
|
|
37
|
+
size={size as Size}
|
|
38
|
+
/>
|
|
39
|
+
))}
|
|
40
|
+
</Vertical>
|
|
41
|
+
);
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### **fallback**
|
|
47
|
+
Optional string for an image URL to use if the primary 'src' fails to load.
|
|
48
|
+
|
|
49
|
+
```tsx
|
|
50
|
+
import React from 'react';
|
|
51
|
+
import { Avatar } from '../Avatar';
|
|
52
|
+
|
|
53
|
+
export const FallbackDemo = () => <Avatar src="" fallback="ML" />;
|
|
54
|
+
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### **styles**
|
|
58
|
+
Optional object to apply custom styles to the avatar component.
|
|
59
|
+
|
|
60
|
+
```tsx
|
|
61
|
+
import React from 'react';
|
|
62
|
+
import { Avatar } from '../Avatar';
|
|
63
|
+
|
|
64
|
+
export const StylesDemo = () => {
|
|
65
|
+
return (
|
|
66
|
+
<Avatar
|
|
67
|
+
src="https://t3.ftcdn.net/jpg/06/17/13/26/360_F_617132669_YptvM7fIuczaUbYYpMe3VTLimwZwzlWf.jpg"
|
|
68
|
+
views={{
|
|
69
|
+
container: {
|
|
70
|
+
boxShadow: 'none', // Add shadow effect
|
|
71
|
+
},
|
|
72
|
+
fallback: {
|
|
73
|
+
color: 'theme.secondary',
|
|
74
|
+
},
|
|
75
|
+
image: {
|
|
76
|
+
objectFit: 'fill',
|
|
77
|
+
},
|
|
78
|
+
}}
|
|
79
|
+
onClick={() => console.log('hello')}
|
|
80
|
+
/>
|
|
81
|
+
);
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
```
|
|
85
|
+
|