@app-studio/web 0.9.31 → 0.9.33
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/docs/components.md +285 -0
- package/package.json +1 -1
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
# Sidebar
|
|
2
|
+
|
|
3
|
+
A composable, themeable and customizable sidebar component for navigation and content organization.
|
|
4
|
+
|
|
5
|
+
### **Import**
|
|
6
|
+
```tsx
|
|
7
|
+
import { Sidebar } from '@app-studio/web';
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
### **Default**
|
|
11
|
+
```tsx
|
|
12
|
+
import React from 'react';
|
|
13
|
+
import { Sidebar } from '@app-studio/web';
|
|
14
|
+
import { Text } from '@app-studio/web';
|
|
15
|
+
import { Vertical } from '@app-studio/web';
|
|
16
|
+
import { HomeIcon, UserIcon, SettingsIcon } from '@app-studio/web';
|
|
17
|
+
|
|
18
|
+
export const DefaultSidebar = () => {
|
|
19
|
+
return (
|
|
20
|
+
<Sidebar defaultExpanded={true}>
|
|
21
|
+
<Sidebar.Header>
|
|
22
|
+
<Text fontWeight="bold" size="lg">App Name</Text>
|
|
23
|
+
</Sidebar.Header>
|
|
24
|
+
<Sidebar.Content>
|
|
25
|
+
<Vertical gap={8}>
|
|
26
|
+
<NavItem icon={<HomeIcon widthHeight={20} />} label="Home" isActive />
|
|
27
|
+
<NavItem icon={<UserIcon widthHeight={20} />} label="Profile" />
|
|
28
|
+
<NavItem icon={<SettingsIcon widthHeight={20} />} label="Settings" />
|
|
29
|
+
</Vertical>
|
|
30
|
+
</Sidebar.Content>
|
|
31
|
+
<Sidebar.Footer>
|
|
32
|
+
<Text size="sm" color="color.gray.500">© 2023 App Studio</Text>
|
|
33
|
+
</Sidebar.Footer>
|
|
34
|
+
</Sidebar>
|
|
35
|
+
);
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
const NavItem = ({ icon, label, isActive = false }) => (
|
|
39
|
+
<Horizontal
|
|
40
|
+
alignItems="center"
|
|
41
|
+
gap={12}
|
|
42
|
+
padding="8px 12px"
|
|
43
|
+
borderRadius="4px"
|
|
44
|
+
backgroundColor={isActive ? 'color.blue.50' : 'transparent'}
|
|
45
|
+
color={isActive ? 'color.blue.600' : 'color.gray.700'}
|
|
46
|
+
fontWeight={isActive ? 'bold' : 'normal'}
|
|
47
|
+
cursor="pointer"
|
|
48
|
+
_hover={{ backgroundColor: isActive ? 'color.blue.50' : 'color.gray.100' }}
|
|
49
|
+
>
|
|
50
|
+
{icon}
|
|
51
|
+
<Text>{label}</Text>
|
|
52
|
+
</Horizontal>
|
|
53
|
+
);
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### **Variants**
|
|
57
|
+
The Sidebar component supports different visual variants:
|
|
58
|
+
|
|
59
|
+
```tsx
|
|
60
|
+
<Sidebar variant="default" />
|
|
61
|
+
<Sidebar variant="filled" />
|
|
62
|
+
<Sidebar variant="outline" />
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### **Positions**
|
|
66
|
+
The Sidebar component can be positioned on either side:
|
|
67
|
+
|
|
68
|
+
```tsx
|
|
69
|
+
<Sidebar position="left" />
|
|
70
|
+
<Sidebar position="right" />
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### **Sizes**
|
|
74
|
+
The Sidebar component supports different sizes:
|
|
75
|
+
|
|
76
|
+
```tsx
|
|
77
|
+
<Sidebar size="sm" />
|
|
78
|
+
<Sidebar size="md" />
|
|
79
|
+
<Sidebar size="lg" />
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### **Controlled Expansion**
|
|
83
|
+
The Sidebar component can be controlled externally:
|
|
84
|
+
|
|
85
|
+
```tsx
|
|
86
|
+
const [isExpanded, setIsExpanded] = useState(true);
|
|
87
|
+
|
|
88
|
+
<Button onClick={() => setIsExpanded(!isExpanded)}>
|
|
89
|
+
{isExpanded ? 'Collapse' : 'Expand'} Sidebar
|
|
90
|
+
</Button>
|
|
91
|
+
|
|
92
|
+
<Sidebar
|
|
93
|
+
expanded={isExpanded}
|
|
94
|
+
onExpandedChange={setIsExpanded}
|
|
95
|
+
>
|
|
96
|
+
{/* Sidebar content */}
|
|
97
|
+
</Sidebar>
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### **Customization**
|
|
101
|
+
The Sidebar component can be customized with the views prop:
|
|
102
|
+
|
|
103
|
+
```tsx
|
|
104
|
+
<Sidebar
|
|
105
|
+
views={{
|
|
106
|
+
container: {
|
|
107
|
+
backgroundColor: 'color.blue.800',
|
|
108
|
+
color: 'color.white',
|
|
109
|
+
},
|
|
110
|
+
header: {
|
|
111
|
+
borderBottomColor: 'color.blue.700',
|
|
112
|
+
backgroundColor: 'color.blue.900',
|
|
113
|
+
},
|
|
114
|
+
content: {
|
|
115
|
+
padding: '20px',
|
|
116
|
+
},
|
|
117
|
+
footer: {
|
|
118
|
+
borderTopColor: 'color.blue.700',
|
|
119
|
+
backgroundColor: 'color.blue.900',
|
|
120
|
+
},
|
|
121
|
+
toggleButton: {
|
|
122
|
+
backgroundColor: 'color.blue.700',
|
|
123
|
+
_hover: { backgroundColor: 'color.blue.600' },
|
|
124
|
+
},
|
|
125
|
+
}}
|
|
126
|
+
>
|
|
127
|
+
{/* Sidebar content */}
|
|
128
|
+
</Sidebar>
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
### **Responsive Behavior**
|
|
132
|
+
The Sidebar component can adapt to different screen sizes:
|
|
133
|
+
|
|
134
|
+
```tsx
|
|
135
|
+
<Sidebar
|
|
136
|
+
breakpoint={768}
|
|
137
|
+
breakpointBehavior="overlay"
|
|
138
|
+
hasBackdrop={true}
|
|
139
|
+
>
|
|
140
|
+
{/* Sidebar content */}
|
|
141
|
+
</Sidebar>
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
Available breakpoint behaviors:
|
|
145
|
+
- `collapse`: Automatically collapses the sidebar below the breakpoint
|
|
146
|
+
- `overlay`: Converts the sidebar to an overlay below the breakpoint
|
|
147
|
+
- `hide`: Hides the sidebar completely below the breakpoint
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
# Slider
|
|
2
|
+
|
|
3
|
+
A component that allows users to select a value from a range by moving a handle.
|
|
4
|
+
|
|
5
|
+
### **Import**
|
|
6
|
+
```tsx
|
|
7
|
+
import { Slider } from '@app-studio/web';
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
### **Default**
|
|
11
|
+
```tsx
|
|
12
|
+
import React, { useState } from 'react';
|
|
13
|
+
import { Slider } from '../Slider';
|
|
14
|
+
|
|
15
|
+
export const DefaultSlider = () => {
|
|
16
|
+
const [value, setValue] = useState(50);
|
|
17
|
+
|
|
18
|
+
const handleChange = (newValue: number) => {
|
|
19
|
+
setValue(newValue);
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
<Slider
|
|
24
|
+
label="Default Slider"
|
|
25
|
+
value={value}
|
|
26
|
+
onChange={handleChange}
|
|
27
|
+
showValue
|
|
28
|
+
helperText="Drag the slider to change the value"
|
|
29
|
+
/>
|
|
30
|
+
);
|
|
31
|
+
};
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### **Range**
|
|
35
|
+
Customize the min, max, and step values.
|
|
36
|
+
|
|
37
|
+
```tsx
|
|
38
|
+
import React, { useState } from 'react';
|
|
39
|
+
import { Slider } from '../Slider';
|
|
40
|
+
|
|
41
|
+
export const RangeSlider = () => {
|
|
42
|
+
const [value, setValue] = useState(25);
|
|
43
|
+
|
|
44
|
+
return (
|
|
45
|
+
<Slider
|
|
46
|
+
label="Custom Range"
|
|
47
|
+
value={value}
|
|
48
|
+
onChange={setValue}
|
|
49
|
+
min={0}
|
|
50
|
+
max={200}
|
|
51
|
+
step={5}
|
|
52
|
+
showValue
|
|
53
|
+
helperText="Range from 0 to 200 with steps of 5"
|
|
54
|
+
/>
|
|
55
|
+
);
|
|
56
|
+
};
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### **Step Values**
|
|
60
|
+
Use specific step values instead of a continuous range.
|
|
61
|
+
|
|
62
|
+
```tsx
|
|
63
|
+
import React, { useState } from 'react';
|
|
64
|
+
import { Slider } from '../Slider';
|
|
65
|
+
|
|
66
|
+
export const StepValuesSlider = () => {
|
|
67
|
+
const [value, setValue] = useState(40);
|
|
68
|
+
const stepValues = [0, 20, 40, 60, 80, 100];
|
|
69
|
+
|
|
70
|
+
return (
|
|
71
|
+
<Slider
|
|
72
|
+
label="Step Values Slider"
|
|
73
|
+
value={value}
|
|
74
|
+
onChange={setValue}
|
|
75
|
+
min={0}
|
|
76
|
+
max={100}
|
|
77
|
+
stepValues={stepValues}
|
|
78
|
+
showValue
|
|
79
|
+
helperText="This slider only allows specific values"
|
|
80
|
+
/>
|
|
81
|
+
);
|
|
82
|
+
};
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### **Orientation**
|
|
86
|
+
Change the orientation of the slider.
|
|
87
|
+
|
|
88
|
+
```tsx
|
|
89
|
+
import React, { useState } from 'react';
|
|
90
|
+
import { Slider } from '../Slider';
|
|
91
|
+
import { View } from 'app-studio';
|
|
92
|
+
|
|
93
|
+
export const VerticalSlider = () => {
|
|
94
|
+
const [value, setValue] = useState(50);
|
|
95
|
+
|
|
96
|
+
return (
|
|
97
|
+
<View height={250}>
|
|
98
|
+
<Slider
|
|
99
|
+
orientation="vertical"
|
|
100
|
+
value={value}
|
|
101
|
+
onChange={setValue}
|
|
102
|
+
min={0}
|
|
103
|
+
max={100}
|
|
104
|
+
step={1}
|
|
105
|
+
showTooltip
|
|
106
|
+
ariaLabel="Vertical slider"
|
|
107
|
+
/>
|
|
108
|
+
</View>
|
|
109
|
+
);
|
|
110
|
+
};
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
### **Tooltip**
|
|
114
|
+
Show a tooltip when dragging the slider.
|
|
115
|
+
|
|
116
|
+
```tsx
|
|
117
|
+
import React, { useState } from 'react';
|
|
118
|
+
import { Slider } from '../Slider';
|
|
119
|
+
|
|
120
|
+
export const TooltipSlider = () => {
|
|
121
|
+
const [value, setValue] = useState(50);
|
|
122
|
+
|
|
123
|
+
return (
|
|
124
|
+
<Slider
|
|
125
|
+
label="Slider with Tooltip"
|
|
126
|
+
value={value}
|
|
127
|
+
onChange={setValue}
|
|
128
|
+
showTooltip
|
|
129
|
+
helperText="Drag to see the tooltip"
|
|
130
|
+
/>
|
|
131
|
+
);
|
|
132
|
+
};
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### **Disabled**
|
|
136
|
+
Disable the slider to prevent interaction.
|
|
137
|
+
|
|
138
|
+
```tsx
|
|
139
|
+
import React from 'react';
|
|
140
|
+
import { Slider } from '../Slider';
|
|
141
|
+
|
|
142
|
+
export const DisabledSlider = () => {
|
|
143
|
+
return (
|
|
144
|
+
<Slider
|
|
145
|
+
label="Disabled Slider"
|
|
146
|
+
value={30}
|
|
147
|
+
isDisabled
|
|
148
|
+
helperText="This slider cannot be interacted with"
|
|
149
|
+
/>
|
|
150
|
+
);
|
|
151
|
+
};
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
### **Custom Styling**
|
|
155
|
+
Customize the appearance of the slider.
|
|
156
|
+
|
|
157
|
+
```tsx
|
|
158
|
+
import React, { useState } from 'react';
|
|
159
|
+
import { Slider } from '../Slider';
|
|
160
|
+
|
|
161
|
+
export const CustomStyledSlider = () => {
|
|
162
|
+
const [value, setValue] = useState(60);
|
|
163
|
+
|
|
164
|
+
return (
|
|
165
|
+
<Slider
|
|
166
|
+
label="Custom Styled Slider"
|
|
167
|
+
value={value}
|
|
168
|
+
onChange={setValue}
|
|
169
|
+
showValue
|
|
170
|
+
colorScheme="theme.secondary"
|
|
171
|
+
views={{
|
|
172
|
+
track: {
|
|
173
|
+
backgroundColor: 'color.gray.200',
|
|
174
|
+
height: 8,
|
|
175
|
+
borderRadius: 4,
|
|
176
|
+
},
|
|
177
|
+
progress: {
|
|
178
|
+
backgroundColor: 'color.blue.500',
|
|
179
|
+
},
|
|
180
|
+
thumb: {
|
|
181
|
+
backgroundColor: 'color.white',
|
|
182
|
+
border: '2px solid color.blue.500',
|
|
183
|
+
width: 20,
|
|
184
|
+
height: 20,
|
|
185
|
+
},
|
|
186
|
+
valueLabel: {
|
|
187
|
+
color: 'color.blue.500',
|
|
188
|
+
fontWeight: 'bold',
|
|
189
|
+
},
|
|
190
|
+
}}
|
|
191
|
+
/>
|
|
192
|
+
);
|
|
193
|
+
};
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
### **Formik Integration**
|
|
197
|
+
Use the slider with Formik for form state management.
|
|
198
|
+
|
|
199
|
+
```tsx
|
|
200
|
+
import React from 'react';
|
|
201
|
+
import { Formik, Form } from 'formik';
|
|
202
|
+
import { FormikSlider } from '../../Formik/Formik.Slider';
|
|
203
|
+
import { Button } from '../../Button/Button';
|
|
204
|
+
|
|
205
|
+
export const FormikSliderExample = () => {
|
|
206
|
+
return (
|
|
207
|
+
<Formik
|
|
208
|
+
initialValues={{ slider: 50 }}
|
|
209
|
+
onSubmit={(values) => {
|
|
210
|
+
alert(JSON.stringify(values, null, 2));
|
|
211
|
+
}}
|
|
212
|
+
>
|
|
213
|
+
{({ handleSubmit }) => (
|
|
214
|
+
<Form>
|
|
215
|
+
<FormikSlider
|
|
216
|
+
name="slider"
|
|
217
|
+
label="Formik Slider"
|
|
218
|
+
min={0}
|
|
219
|
+
max={100}
|
|
220
|
+
step={1}
|
|
221
|
+
showValue
|
|
222
|
+
helperText="This slider is connected to Formik"
|
|
223
|
+
/>
|
|
224
|
+
<Button type="submit" onClick={handleSubmit} marginTop={16}>
|
|
225
|
+
Submit
|
|
226
|
+
</Button>
|
|
227
|
+
</Form>
|
|
228
|
+
)}
|
|
229
|
+
</Formik>
|
|
230
|
+
);
|
|
231
|
+
};
|
|
232
|
+
```
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# Switch
|
|
2
|
+
|
|
3
|
+
A toggle switch for user interactions like turning settings on or off.
|
|
4
|
+
|
|
5
|
+
## Props
|
|
6
|
+
|
|
7
|
+
| Prop | Type | Description | Default |
|
|
8
|
+
| ---------------- | ------------- | ----------------------------------------------------------------------------------------------------------------------------------------- | ------- |
|
|
9
|
+
| name | string | Name of the switch. | |
|
|
10
|
+
| id | string | Id of the switch. | |
|
|
11
|
+
| colorScheme | string | Defines the color theme for the switch component. | |
|
|
12
|
+
| shadow | Shadow | Defines the shadow appearance of the switch using predefined Shadow or Elevation, or a custom CSSProperties object. | |
|
|
13
|
+
| styles | CSSProperties | Optional custom styles for the switch component. | |
|
|
14
|
+
| className | string | Optional className for the switch component. | |
|
|
15
|
+
| isChecked | boolean | Defines the initial toggle state. | false |
|
|
16
|
+
| isDisabled | boolean | Sets the toggle component as disabled or not. | false |
|
|
17
|
+
|
|
18
|
+
### **Import**
|
|
19
|
+
```tsx
|
|
20
|
+
import { Switch } from '@app-studio/web';
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
### **Default**
|
|
24
|
+
```tsx
|
|
25
|
+
import React from 'react';
|
|
26
|
+
import { Switch } from '../../../Form/Switch/Switch';
|
|
27
|
+
|
|
28
|
+
export const DefaultSwitch = () => <Switch id="check" name="checkbox" />;
|
|
29
|
+
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### **colorScheme**
|
|
33
|
+
Defines the color theme for the switch component.
|
|
34
|
+
|
|
35
|
+
```tsx
|
|
36
|
+
import React from 'react';
|
|
37
|
+
|
|
38
|
+
import { Switch } from '../Switch';
|
|
39
|
+
|
|
40
|
+
export const ColorSwitch = () => (
|
|
41
|
+
<Switch name="name" colorScheme="theme.primary" isChecked />
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### **shadow**
|
|
47
|
+
Defines the shadow appearance of the switch using predefined Shadow or Elevation, or a custom CSSProperties object.
|
|
48
|
+
|
|
49
|
+
```tsx
|
|
50
|
+
import React from 'react';
|
|
51
|
+
import { Switch } from '../../../Form/Switch/Switch';
|
|
52
|
+
|
|
53
|
+
export const ShadowSwitch = () => (
|
|
54
|
+
<Switch
|
|
55
|
+
id="shadowCheckbox"
|
|
56
|
+
name="shadowCheckbox"
|
|
57
|
+
shadow={{ boxShadow: 'rgb(249, 115, 22) 0px 4px 14px 0px' }}
|
|
58
|
+
isChecked
|
|
59
|
+
/>
|
|
60
|
+
);
|
|
61
|
+
|
|
62
|
+
```
|