@app-studio/web 0.9.30 → 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/dist/components/Text/Text/Text.view.d.ts +1 -0
- package/dist/web.cjs.development.js +3 -3
- package/dist/web.cjs.development.js.map +1 -1
- package/dist/web.cjs.production.min.js +1 -1
- package/dist/web.cjs.production.min.js.map +1 -1
- package/dist/web.esm.js +3 -3
- package/dist/web.esm.js.map +1 -1
- package/dist/web.umd.development.js +3 -3
- package/dist/web.umd.development.js.map +1 -1
- package/dist/web.umd.production.min.js +1 -1
- package/dist/web.umd.production.min.js.map +1 -1
- 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,136 @@
|
|
|
1
|
+
# TextArea
|
|
2
|
+
|
|
3
|
+
A text input field for multi-line text editing with customizable features.
|
|
4
|
+
|
|
5
|
+
### **Import**
|
|
6
|
+
```tsx
|
|
7
|
+
import { TextArea } from '@app-studio/web';
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
### **Default**
|
|
11
|
+
```tsx
|
|
12
|
+
import React from 'react';
|
|
13
|
+
|
|
14
|
+
import { TextArea } from '../TextArea';
|
|
15
|
+
|
|
16
|
+
export const DefaultArea = () => (
|
|
17
|
+
<TextArea name="comments" placeholder="Enter your thoughts" />
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
### **colorScheme**
|
|
23
|
+
Optional color scheme for the component.
|
|
24
|
+
|
|
25
|
+
```tsx
|
|
26
|
+
import React from 'react';
|
|
27
|
+
import { Vertical } from 'app-studio';
|
|
28
|
+
|
|
29
|
+
import { TextArea } from '../TextArea';
|
|
30
|
+
|
|
31
|
+
export const ColorArea = () => {
|
|
32
|
+
return (
|
|
33
|
+
<Vertical gap={10}>
|
|
34
|
+
<TextArea name="surname" label="Surname" colorScheme="theme.secondary" />
|
|
35
|
+
<TextArea
|
|
36
|
+
name="name"
|
|
37
|
+
label="Name"
|
|
38
|
+
colorScheme="theme.primary"
|
|
39
|
+
variant="outline"
|
|
40
|
+
/>
|
|
41
|
+
</Vertical>
|
|
42
|
+
);
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### **helperText**
|
|
48
|
+
Helper text that appears below the text area.
|
|
49
|
+
|
|
50
|
+
```tsx
|
|
51
|
+
import { useState } from 'react';
|
|
52
|
+
import React from 'react';
|
|
53
|
+
|
|
54
|
+
import { Button } from '../../../Button/Button';
|
|
55
|
+
import { TextArea } from '../../../Form/TextArea/TextArea';
|
|
56
|
+
|
|
57
|
+
import { Vertical } from 'app-studio';
|
|
58
|
+
|
|
59
|
+
export const HelperTextArea = () => {
|
|
60
|
+
const initialValues = {
|
|
61
|
+
guess: '',
|
|
62
|
+
};
|
|
63
|
+
const [formValues, setFormValues] = useState(initialValues);
|
|
64
|
+
const [formErrors, setFormErrors] = useState(initialValues);
|
|
65
|
+
|
|
66
|
+
const validate = (values: any) => {
|
|
67
|
+
const errors: any = {};
|
|
68
|
+
if (!values.guess) {
|
|
69
|
+
errors.guess = 'Required';
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
setFormErrors(errors);
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
const handleChange = (event: any) => {
|
|
76
|
+
setFormValues({ ...formValues, [event.target.name]: event.target.value });
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
const handleSubmit = (event: any) => {
|
|
80
|
+
event.preventDefault();
|
|
81
|
+
validate(formValues);
|
|
82
|
+
if (Object.values(formErrors).length === 0) {
|
|
83
|
+
alert(formValues.guess);
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
return (
|
|
87
|
+
<form onSubmit={handleSubmit}>
|
|
88
|
+
<Vertical gap={10}>
|
|
89
|
+
<TextArea
|
|
90
|
+
name="guess"
|
|
91
|
+
placeholder="Write here..."
|
|
92
|
+
helperText={formErrors.guess}
|
|
93
|
+
error={!!formErrors.guess}
|
|
94
|
+
onChange={handleChange}
|
|
95
|
+
/>
|
|
96
|
+
<Button type="submit" height="40px" isAuto>
|
|
97
|
+
Submit
|
|
98
|
+
</Button>
|
|
99
|
+
</Vertical>
|
|
100
|
+
</form>
|
|
101
|
+
);
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### **placeholder**
|
|
107
|
+
Placeholder text for the text area when it is empty.
|
|
108
|
+
|
|
109
|
+
```tsx
|
|
110
|
+
import React from 'react';
|
|
111
|
+
import { Button } from '../../../Button/Button';
|
|
112
|
+
|
|
113
|
+
import { Horizontal } from 'app-studio';
|
|
114
|
+
|
|
115
|
+
import { TextArea } from '../TextArea';
|
|
116
|
+
|
|
117
|
+
export const PlaceholderArea = () => {
|
|
118
|
+
const handleSubmit = (event: any) => {
|
|
119
|
+
event.preventDefault();
|
|
120
|
+
const formData = new FormData(event.target);
|
|
121
|
+
alert(formData.get('comment'));
|
|
122
|
+
};
|
|
123
|
+
return (
|
|
124
|
+
<form onSubmit={handleSubmit}>
|
|
125
|
+
<Horizontal gap={10} alignItems="center" flexWrap="nowrap">
|
|
126
|
+
<TextArea name="comment" placeholder="Type your comment here..." />
|
|
127
|
+
<Button type="submit" height="40px" isAuto>
|
|
128
|
+
Submit
|
|
129
|
+
</Button>
|
|
130
|
+
</Horizontal>
|
|
131
|
+
</form>
|
|
132
|
+
);
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
```
|
|
136
|
+
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
# TextField
|
|
2
|
+
|
|
3
|
+
A customizable text input field with optional helpers, labels, and icons.
|
|
4
|
+
|
|
5
|
+
### **Import**
|
|
6
|
+
```tsx
|
|
7
|
+
import { TextField } from '@app-studio/web';
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
### **Default**
|
|
11
|
+
```tsx
|
|
12
|
+
import React from 'react';
|
|
13
|
+
import { Button } from '../../../Button/Button';
|
|
14
|
+
|
|
15
|
+
import { Horizontal } from 'app-studio';
|
|
16
|
+
|
|
17
|
+
import { TextField } from '../TextField';
|
|
18
|
+
|
|
19
|
+
export const DefaultInput = () => {
|
|
20
|
+
const handleSubmit = (event: any) => {
|
|
21
|
+
event.preventDefault();
|
|
22
|
+
const formData = new FormData(event.target);
|
|
23
|
+
alert(`Hello, ${formData.get('surname')}`);
|
|
24
|
+
};
|
|
25
|
+
return (
|
|
26
|
+
<form onSubmit={handleSubmit}>
|
|
27
|
+
<Horizontal gap={10} alignItems="center" flexWrap="nowrap">
|
|
28
|
+
<TextField name="surname" />
|
|
29
|
+
<Button type="submit" height="40px" isAuto>
|
|
30
|
+
Submit
|
|
31
|
+
</Button>
|
|
32
|
+
</Horizontal>
|
|
33
|
+
</form>
|
|
34
|
+
);
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### **helperText**
|
|
40
|
+
Optional helper text that appears below the TextField.
|
|
41
|
+
|
|
42
|
+
```tsx
|
|
43
|
+
import { useState } from 'react';
|
|
44
|
+
import React from 'react';
|
|
45
|
+
import { Button } from '../../../Button/Button';
|
|
46
|
+
|
|
47
|
+
import { TextField } from '../../../Form/TextField/TextField';
|
|
48
|
+
|
|
49
|
+
import { Vertical } from 'app-studio';
|
|
50
|
+
|
|
51
|
+
export const HelperTextInput = () => {
|
|
52
|
+
const initialValues = {
|
|
53
|
+
firstName: '',
|
|
54
|
+
lastName: '',
|
|
55
|
+
};
|
|
56
|
+
const [formValues, setFormValues] = useState(initialValues);
|
|
57
|
+
const [formErrors, setFormErrors] = useState(initialValues);
|
|
58
|
+
|
|
59
|
+
const validate = (values: any) => {
|
|
60
|
+
const errors: any = {};
|
|
61
|
+
if (!values.firstName) {
|
|
62
|
+
errors.firstName = 'Required';
|
|
63
|
+
}
|
|
64
|
+
if (!values.lastName) {
|
|
65
|
+
errors.lastName = 'Required';
|
|
66
|
+
}
|
|
67
|
+
setFormErrors(errors);
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
const handleChange = (event: any) => {
|
|
71
|
+
setFormValues({ ...formValues, [event.target.name]: event.target.value });
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
const handleSubmit = (event: any) => {
|
|
75
|
+
event.preventDefault();
|
|
76
|
+
validate(formValues);
|
|
77
|
+
if (Object.values(formErrors).length === 0) {
|
|
78
|
+
alert(`Hello, ${formValues.firstName} ${formValues.lastName} `);
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
return (
|
|
82
|
+
<form onSubmit={handleSubmit}>
|
|
83
|
+
<Vertical gap={10} alignItems="center" flexWrap="nowrap">
|
|
84
|
+
<TextField
|
|
85
|
+
name="firstName"
|
|
86
|
+
placeholder="First Name"
|
|
87
|
+
helperText={formErrors.firstName}
|
|
88
|
+
error={!!formErrors.firstName}
|
|
89
|
+
onChange={handleChange}
|
|
90
|
+
/>
|
|
91
|
+
<TextField
|
|
92
|
+
name="lastName"
|
|
93
|
+
placeholder="Last Name"
|
|
94
|
+
helperText={formErrors.lastName}
|
|
95
|
+
error={!!formErrors.lastName}
|
|
96
|
+
onChange={handleChange}
|
|
97
|
+
/>
|
|
98
|
+
<Button type="submit" height="40px" isAuto>
|
|
99
|
+
Submit
|
|
100
|
+
</Button>
|
|
101
|
+
</Vertical>
|
|
102
|
+
</form>
|
|
103
|
+
);
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### **colorScheme**
|
|
109
|
+
Optional property to specify the color scheme of the TextField.
|
|
110
|
+
|
|
111
|
+
```tsx
|
|
112
|
+
import React from 'react';
|
|
113
|
+
import { Vertical } from 'app-studio';
|
|
114
|
+
|
|
115
|
+
import { TextField } from '../TextField';
|
|
116
|
+
|
|
117
|
+
export const ColorSchemeDemo = () => {
|
|
118
|
+
return (
|
|
119
|
+
<Vertical gap={10} width="300px">
|
|
120
|
+
<TextField name="surname" label="Surname" colorScheme="theme.secondary" />
|
|
121
|
+
<TextField
|
|
122
|
+
name="name"
|
|
123
|
+
label="Name"
|
|
124
|
+
colorScheme="theme.primary"
|
|
125
|
+
variant="outline"
|
|
126
|
+
/>
|
|
127
|
+
</Vertical>
|
|
128
|
+
);
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### **left**
|
|
134
|
+
Optional React node to be rendered on the left side of the TextField.
|
|
135
|
+
|
|
136
|
+
```tsx
|
|
137
|
+
import React from 'react';
|
|
138
|
+
import { ProfileIcon } from '../../../Icon';
|
|
139
|
+
|
|
140
|
+
import { TextField } from '../TextField';
|
|
141
|
+
|
|
142
|
+
export const LeftInput = () => {
|
|
143
|
+
return (
|
|
144
|
+
<TextField
|
|
145
|
+
name="name"
|
|
146
|
+
placeholder="Name"
|
|
147
|
+
left={<ProfileIcon color="black" size={16} />}
|
|
148
|
+
/>
|
|
149
|
+
);
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
### **right**
|
|
155
|
+
Optional React node to be rendered on the right side of the TextField.
|
|
156
|
+
|
|
157
|
+
```tsx
|
|
158
|
+
import React from 'react';
|
|
159
|
+
import { EditIcon } from '../../../Icon';
|
|
160
|
+
|
|
161
|
+
import { TextField } from '../TextField';
|
|
162
|
+
|
|
163
|
+
export const RightInput = () => {
|
|
164
|
+
return (
|
|
165
|
+
<TextField
|
|
166
|
+
name="name"
|
|
167
|
+
placeholder="Name"
|
|
168
|
+
right={<EditIcon color="black" size={16} />}
|
|
169
|
+
/>
|
|
170
|
+
);
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
### **placeholder**
|
|
176
|
+
Optional placeholder text shown inside the TextField when empty.
|
|
177
|
+
|
|
178
|
+
```tsx
|
|
179
|
+
import React from 'react';
|
|
180
|
+
import { Button } from '../../../Button/Button';
|
|
181
|
+
|
|
182
|
+
import { Horizontal } from 'app-studio';
|
|
183
|
+
|
|
184
|
+
import { TextField } from '../TextField';
|
|
185
|
+
|
|
186
|
+
export const Placeholder = () => {
|
|
187
|
+
const handleSubmit = (event: any) => {
|
|
188
|
+
event.preventDefault();
|
|
189
|
+
const formData = new FormData(event.target);
|
|
190
|
+
alert(`Hello, ${formData.get('surname')}`);
|
|
191
|
+
};
|
|
192
|
+
return (
|
|
193
|
+
<form onSubmit={handleSubmit}>
|
|
194
|
+
<Horizontal gap={10} alignItems="center" flexWrap="nowrap">
|
|
195
|
+
<TextField name="surname" placeholder="Surname" />
|
|
196
|
+
<Button type="submit" height="40px" isAuto>
|
|
197
|
+
Submit
|
|
198
|
+
</Button>
|
|
199
|
+
</Horizontal>
|
|
200
|
+
</form>
|
|
201
|
+
);
|
|
202
|
+
};
|
|
203
|
+
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
### **isClearable**
|
|
207
|
+
Optional flag that when true allows the TextField to be cleared.
|
|
208
|
+
|
|
209
|
+
```tsx
|
|
210
|
+
import React from 'react';
|
|
211
|
+
import { Vertical } from 'app-studio';
|
|
212
|
+
|
|
213
|
+
import { TextField } from '../TextField';
|
|
214
|
+
|
|
215
|
+
export const IsClearableDemo = () => {
|
|
216
|
+
return (
|
|
217
|
+
<Vertical gap={10} width="300px">
|
|
218
|
+
<TextField value="Clear Button" size="xs" />
|
|
219
|
+
<TextField size="xs" value="No Clear Button" isClearable={false} />
|
|
220
|
+
</Vertical>
|
|
221
|
+
);
|
|
222
|
+
};
|
|
223
|
+
|
|
224
|
+
```
|
|
225
|
+
|