@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.
Files changed (60) hide show
  1. package/docs/components/Accordion.mdx +158 -0
  2. package/docs/components/Alert.mdx +123 -0
  3. package/docs/components/AspectRatio.mdx +55 -0
  4. package/docs/components/Avatar.mdx +85 -0
  5. package/docs/components/Background.mdx +522 -0
  6. package/docs/components/Badge.mdx +220 -0
  7. package/docs/components/Button.mdx +272 -0
  8. package/docs/components/Calendar.mdx +274 -0
  9. package/docs/components/Card.mdx +341 -0
  10. package/docs/components/Carousel.mdx +411 -0
  11. package/docs/components/Center.mdx +474 -0
  12. package/docs/components/Chart.mdx +232 -0
  13. package/docs/components/ChatInput.mdx +373 -0
  14. package/docs/components/Checkbox.mdx +66 -0
  15. package/docs/components/ColorInput.mdx +209 -0
  16. package/docs/components/ComboBox.mdx +364 -0
  17. package/docs/components/Command.mdx +252 -0
  18. package/docs/components/ContextMenu.mdx +219 -0
  19. package/docs/components/CountryPicker.mdx +123 -0
  20. package/docs/components/DatePicker.mdx +77 -0
  21. package/docs/components/DragAndDrop.mdx +539 -0
  22. package/docs/components/DropdownMenu.mdx +205 -0
  23. package/docs/components/File.mdx +8 -0
  24. package/docs/components/Flow.mdx +257 -0
  25. package/docs/components/Form.mdx +681 -0
  26. package/docs/components/Formik.mdx +621 -0
  27. package/docs/components/Gradient.mdx +271 -0
  28. package/docs/components/Horizontal.mdx +40 -0
  29. package/docs/components/HoverCard.mdx +140 -0
  30. package/docs/components/Icon.mdx +438 -0
  31. package/docs/components/Label.mdx +438 -0
  32. package/docs/components/Link.mdx +83 -0
  33. package/docs/components/Loader.mdx +527 -0
  34. package/docs/components/Menubar.mdx +124 -0
  35. package/docs/components/Message.mdx +571 -0
  36. package/docs/components/Modal.mdx +533 -0
  37. package/docs/components/NavigationMenu.mdx +165 -0
  38. package/docs/components/Pagination.mdx +150 -0
  39. package/docs/components/Password.mdx +121 -0
  40. package/docs/components/Resizable.mdx +148 -0
  41. package/docs/components/Select.mdx +126 -0
  42. package/docs/components/Separator.mdx +121 -0
  43. package/docs/components/Sidebar.mdx +147 -0
  44. package/docs/components/Slider.mdx +232 -0
  45. package/docs/components/Switch.mdx +62 -0
  46. package/docs/components/Table.mdx +409 -0
  47. package/docs/components/Tabs.mdx +215 -0
  48. package/docs/components/TagInput.mdx +528 -0
  49. package/docs/components/Text.mdx +163 -0
  50. package/docs/components/TextArea.mdx +136 -0
  51. package/docs/components/TextField.mdx +225 -0
  52. package/docs/components/Title.mdx +535 -0
  53. package/docs/components/Toast.mdx +165 -0
  54. package/docs/components/Toggle.mdx +141 -0
  55. package/docs/components/ToggleGroup.mdx +165 -0
  56. package/docs/components/Tooltip.mdx +191 -0
  57. package/docs/components/Tree.mdx +340 -0
  58. package/docs/components/Uploader.mdx +426 -0
  59. package/docs/components/Vertical.mdx +566 -0
  60. package/package.json +1 -1
@@ -0,0 +1,621 @@
1
+ # Formik
2
+
3
+ Formik integration components for form state management and validation.
4
+
5
+ ### **Import**
6
+ ```tsx
7
+ import { FormikForm, FormikTextField, FormikCheckbox, FormikChatInput, FormikColorInput, FormikSelect, FormikSwitch, FormikTextArea, FormikDatePicker, FormikCountryPicker, FormikPassword, FormikComboBox, FormikSlider } from '@app-studio/web';
8
+ ```
9
+
10
+ ### **Basic Form**
11
+ A basic form with Formik integration.
12
+
13
+ ```tsx
14
+ import React from 'react';
15
+ import { Formik } from 'formik';
16
+ import * as Yup from 'yup';
17
+ import { FormikForm } from '../Formik.Form';
18
+ import { FormikTextField } from '../Formik.TextField';
19
+ import { FormikCheckbox } from '../Formik.Checkbox';
20
+ import { Button } from '../../Button/Button';
21
+ import { Vertical } from 'app-studio';
22
+
23
+ export const BasicFormExample = () => {
24
+ // Define initial values
25
+ const initialValues = {
26
+ firstName: '',
27
+ lastName: '',
28
+ email: '',
29
+ agreeToTerms: false,
30
+ };
31
+
32
+ // Define validation schema
33
+ const validationSchema = Yup.object().shape({
34
+ firstName: Yup.string().required('Required'),
35
+ lastName: Yup.string().required('Required'),
36
+ email: Yup.string().email('Invalid email').required('Required'),
37
+ agreeToTerms: Yup.boolean().oneOf([true], 'You must agree to the terms'),
38
+ });
39
+
40
+ // Handle form submission
41
+ const handleSubmit = (values: any) => {
42
+ console.log('Form values:', values);
43
+ alert(JSON.stringify(values, null, 2));
44
+ };
45
+
46
+ return (
47
+ <Formik
48
+ initialValues={initialValues}
49
+ validationSchema={validationSchema}
50
+ onSubmit={handleSubmit}
51
+ >
52
+ {({ handleSubmit }) => (
53
+ <FormikForm>
54
+ <Vertical gap={16} width="100%" maxWidth={400}>
55
+ <FormikTextField
56
+ name="firstName"
57
+ label="First Name"
58
+ placeholder="Enter your first name"
59
+ />
60
+ <FormikTextField
61
+ name="lastName"
62
+ label="Last Name"
63
+ placeholder="Enter your last name"
64
+ />
65
+ <FormikTextField
66
+ name="email"
67
+ label="Email"
68
+ placeholder="Enter your email"
69
+ type="email"
70
+ />
71
+ <FormikCheckbox
72
+ name="agreeToTerms"
73
+ label="I agree to the terms and conditions"
74
+ />
75
+ <Button type="submit" onClick={handleSubmit}>
76
+ Submit
77
+ </Button>
78
+ </Vertical>
79
+ </FormikForm>
80
+ )}
81
+ </Formik>
82
+ );
83
+ };
84
+ ```
85
+
86
+ ### **FormikTextField**
87
+ Text input field integrated with Formik.
88
+
89
+ ```tsx
90
+ import React from 'react';
91
+ import { Formik } from 'formik';
92
+ import * as Yup from 'yup';
93
+ import { FormikForm } from '../Formik.Form';
94
+ import { FormikTextField } from '../Formik.TextField';
95
+ import { Button } from '../../Button/Button';
96
+
97
+ export const FormikTextFieldExample = () => {
98
+ return (
99
+ <Formik
100
+ initialValues={{ username: '' }}
101
+ validationSchema={Yup.object({
102
+ username: Yup.string().required('Username is required'),
103
+ })}
104
+ onSubmit={(values) => alert(JSON.stringify(values))}
105
+ >
106
+ {({ handleSubmit }) => (
107
+ <FormikForm>
108
+ <FormikTextField
109
+ name="username"
110
+ label="Username"
111
+ placeholder="Enter username"
112
+ helperText="Your unique username"
113
+ />
114
+ <Button type="submit" onClick={handleSubmit} marginTop={16}>
115
+ Submit
116
+ </Button>
117
+ </FormikForm>
118
+ )}
119
+ </Formik>
120
+ );
121
+ };
122
+ ```
123
+
124
+ ### **FormikTextArea**
125
+ Multi-line text input integrated with Formik.
126
+
127
+ ```tsx
128
+ import React from 'react';
129
+ import { Formik } from 'formik';
130
+ import * as Yup from 'yup';
131
+ import { FormikForm } from '../Formik.Form';
132
+ import { FormikTextArea } from '../Formik.TextArea';
133
+ import { Button } from '../../Button/Button';
134
+
135
+ export const FormikTextAreaExample = () => {
136
+ return (
137
+ <Formik
138
+ initialValues={{ comments: '' }}
139
+ validationSchema={Yup.object({
140
+ comments: Yup.string().required('Comments are required'),
141
+ })}
142
+ onSubmit={(values) => alert(JSON.stringify(values))}
143
+ >
144
+ {({ handleSubmit }) => (
145
+ <FormikForm>
146
+ <FormikTextArea
147
+ name="comments"
148
+ label="Comments"
149
+ placeholder="Enter your comments"
150
+ rows={4}
151
+ />
152
+ <Button type="submit" onClick={handleSubmit} marginTop={16}>
153
+ Submit
154
+ </Button>
155
+ </FormikForm>
156
+ )}
157
+ </Formik>
158
+ );
159
+ };
160
+ ```
161
+
162
+ ### **FormikCheckbox**
163
+ Checkbox input integrated with Formik.
164
+
165
+ ```tsx
166
+ import React from 'react';
167
+ import { Formik } from 'formik';
168
+ import * as Yup from 'yup';
169
+ import { FormikForm } from '../Formik.Form';
170
+ import { FormikCheckbox } from '../Formik.Checkbox';
171
+ import { Button } from '../../Button/Button';
172
+
173
+ export const FormikCheckboxExample = () => {
174
+ return (
175
+ <Formik
176
+ initialValues={{ subscribe: false }}
177
+ validationSchema={Yup.object({
178
+ subscribe: Yup.boolean().oneOf([true], 'You must subscribe'),
179
+ })}
180
+ onSubmit={(values) => alert(JSON.stringify(values))}
181
+ >
182
+ {({ handleSubmit }) => (
183
+ <FormikForm>
184
+ <FormikCheckbox
185
+ name="subscribe"
186
+ label="Subscribe to newsletter"
187
+ />
188
+ <Button type="submit" onClick={handleSubmit} marginTop={16}>
189
+ Submit
190
+ </Button>
191
+ </FormikForm>
192
+ )}
193
+ </Formik>
194
+ );
195
+ };
196
+ ```
197
+
198
+ ### **FormikChatInput**
199
+ Chat input with file upload, mentions, and auto-completion integrated with Formik.
200
+
201
+ ```tsx
202
+ import React from 'react';
203
+ import { Formik } from 'formik';
204
+ import * as Yup from 'yup';
205
+ import { FormikForm } from '../Formik.Form';
206
+ import { FormikChatInput } from '../Formik.ChatInput';
207
+ import { Button, Vertical, Text } from 'app-studio';
208
+
209
+ export const FormikChatInputExample = () => {
210
+ const mentionData = [
211
+ { id: '1', name: 'John Doe', avatar: '', email: 'john@example.com' },
212
+ { id: '2', name: 'Jane Smith', avatar: '', email: 'jane@example.com' },
213
+ ];
214
+
215
+ const promptExamples = [
216
+ { id: '1', text: 'Hello, how can I help you today?' },
217
+ { id: '2', text: 'What would you like to know about our product?' },
218
+ ];
219
+
220
+ return (
221
+ <Formik
222
+ initialValues={{
223
+ message: '',
224
+ chatHistory: [] as string[]
225
+ }}
226
+ validationSchema={Yup.object({
227
+ message: Yup.string().required('Message is required'),
228
+ })}
229
+ onSubmit={(values, { setFieldValue }) => {
230
+ console.log('Message submitted:', values.message);
231
+ // Add to chat history and clear input
232
+ const newHistory = [...values.chatHistory, values.message];
233
+ setFieldValue('chatHistory', newHistory);
234
+ setFieldValue('message', '');
235
+ }}
236
+ >
237
+ {({ handleSubmit, values }) => (
238
+ <FormikForm>
239
+ <Vertical gap={16}>
240
+ {/* Display chat history */}
241
+ {values.chatHistory.length > 0 && (
242
+ <Vertical gap={8}>
243
+ <Text fontSize="md" fontWeight="semibold">Chat History:</Text>
244
+ {values.chatHistory.map((msg: string, index: number) => (
245
+ <Text
246
+ key={index}
247
+ padding={8}
248
+ backgroundColor="color.gray.100"
249
+ borderRadius={8}
250
+ >
251
+ {msg}
252
+ </Text>
253
+ ))}
254
+ </Vertical>
255
+ )}
256
+
257
+ <FormikChatInput
258
+ name="message"
259
+ placeholder="Type your message here... Use @ to mention someone"
260
+ mentionData={mentionData}
261
+ mentionTrigger="@"
262
+ promptExamples={promptExamples}
263
+ autoFocus={true}
264
+ hideAttachments={false}
265
+ onMentionSelect={(mention) => {
266
+ console.log('Mention selected:', mention);
267
+ }}
268
+ />
269
+
270
+ <Button
271
+ type="submit"
272
+ onClick={handleSubmit}
273
+ disabled={!values.message?.trim()}
274
+ >
275
+ Send Message
276
+ </Button>
277
+ </Vertical>
278
+ </FormikForm>
279
+ )}
280
+ </Formik>
281
+ );
282
+ };
283
+ ```
284
+
285
+ ### **FormikColorInput**
286
+ Color picker input integrated with Formik.
287
+
288
+ ```tsx
289
+ import React from 'react';
290
+ import { Formik } from 'formik';
291
+ import * as Yup from 'yup';
292
+ import { FormikForm } from '../Formik.Form';
293
+ import { FormikColorInput } from '../Formik.ColorInput';
294
+ import { Button } from '../../Button/Button';
295
+
296
+ export const FormikColorInputExample = () => {
297
+ return (
298
+ <Formik
299
+ initialValues={{
300
+ backgroundColor: 'color.blue.500',
301
+ textColor: 'color.white'
302
+ }}
303
+ validationSchema={Yup.object({
304
+ backgroundColor: Yup.string().required('Background color is required'),
305
+ textColor: Yup.string().required('Text color is required'),
306
+ })}
307
+ onSubmit={(values) => alert(JSON.stringify(values))}
308
+ >
309
+ {({ handleSubmit, values }) => (
310
+ <FormikForm>
311
+ <FormikColorInput
312
+ name="backgroundColor"
313
+ label="Background Color"
314
+ helperText="Choose the background color"
315
+ />
316
+ <FormikColorInput
317
+ name="textColor"
318
+ label="Text Color"
319
+ helperText="Choose the text color"
320
+ />
321
+
322
+ {/* Preview */}
323
+ <div
324
+ style={{
325
+ padding: '16px',
326
+ borderRadius: '8px',
327
+ backgroundColor: values.backgroundColor,
328
+ color: values.textColor,
329
+ marginTop: '16px'
330
+ }}
331
+ >
332
+ Preview: This is how your colors will look
333
+ </div>
334
+
335
+ <Button type="submit" onClick={handleSubmit} marginTop={16}>
336
+ Submit
337
+ </Button>
338
+ </FormikForm>
339
+ )}
340
+ </Formik>
341
+ );
342
+ };
343
+ ```
344
+
345
+ ### **FormikSelect**
346
+ Select dropdown integrated with Formik.
347
+
348
+ ```tsx
349
+ import React from 'react';
350
+ import { Formik } from 'formik';
351
+ import * as Yup from 'yup';
352
+ import { FormikForm } from '../Formik.Form';
353
+ import { FormikSelect } from '../Formik.Select';
354
+ import { Button } from '../../Button/Button';
355
+
356
+ export const FormikSelectExample = () => {
357
+ const options = [
358
+ { label: 'Apple', value: 'apple' },
359
+ { label: 'Banana', value: 'banana' },
360
+ { label: 'Orange', value: 'orange' },
361
+ ];
362
+
363
+ return (
364
+ <Formik
365
+ initialValues={{ fruit: '' }}
366
+ validationSchema={Yup.object({
367
+ fruit: Yup.string().required('Please select a fruit'),
368
+ })}
369
+ onSubmit={(values) => alert(JSON.stringify(values))}
370
+ >
371
+ {({ handleSubmit }) => (
372
+ <FormikForm>
373
+ <FormikSelect
374
+ name="fruit"
375
+ label="Favorite Fruit"
376
+ options={options}
377
+ placeholder="Select a fruit"
378
+ />
379
+ <Button type="submit" onClick={handleSubmit} marginTop={16}>
380
+ Submit
381
+ </Button>
382
+ </FormikForm>
383
+ )}
384
+ </Formik>
385
+ );
386
+ };
387
+ ```
388
+
389
+ ### **FormikSwitch**
390
+ Toggle switch integrated with Formik.
391
+
392
+ ```tsx
393
+ import React from 'react';
394
+ import { Formik } from 'formik';
395
+ import { FormikForm } from '../Formik.Form';
396
+ import { FormikSwitch } from '../Formik.Switch';
397
+ import { Button } from '../../Button/Button';
398
+
399
+ export const FormikSwitchExample = () => {
400
+ return (
401
+ <Formik
402
+ initialValues={{ darkMode: false }}
403
+ onSubmit={(values) => alert(JSON.stringify(values))}
404
+ >
405
+ {({ handleSubmit }) => (
406
+ <FormikForm>
407
+ <FormikSwitch
408
+ name="darkMode"
409
+ label="Dark Mode"
410
+ />
411
+ <Button type="submit" onClick={handleSubmit} marginTop={16}>
412
+ Submit
413
+ </Button>
414
+ </FormikForm>
415
+ )}
416
+ </Formik>
417
+ );
418
+ };
419
+ ```
420
+
421
+ ### **FormikDatePicker**
422
+ Date picker integrated with Formik.
423
+
424
+ ```tsx
425
+ import React from 'react';
426
+ import { Formik } from 'formik';
427
+ import * as Yup from 'yup';
428
+ import { FormikForm } from '../Formik.Form';
429
+ import { FormikDatePicker } from '../Formik.DatePicker';
430
+ import { Button } from '../../Button/Button';
431
+
432
+ export const FormikDatePickerExample = () => {
433
+ return (
434
+ <Formik
435
+ initialValues={{ birthdate: '' }}
436
+ validationSchema={Yup.object({
437
+ birthdate: Yup.date().required('Birthdate is required'),
438
+ })}
439
+ onSubmit={(values) => alert(JSON.stringify(values))}
440
+ >
441
+ {({ handleSubmit }) => (
442
+ <FormikForm>
443
+ <FormikDatePicker
444
+ name="birthdate"
445
+ label="Birthdate"
446
+ placeholder="Select your birthdate"
447
+ />
448
+ <Button type="submit" onClick={handleSubmit} marginTop={16}>
449
+ Submit
450
+ </Button>
451
+ </FormikForm>
452
+ )}
453
+ </Formik>
454
+ );
455
+ };
456
+ ```
457
+
458
+ ### **FormikCountryPicker**
459
+ Country selection dropdown integrated with Formik.
460
+
461
+ ```tsx
462
+ import React from 'react';
463
+ import { Formik } from 'formik';
464
+ import * as Yup from 'yup';
465
+ import { FormikForm } from '../Formik.Form';
466
+ import { FormikCountryPicker } from '../Formik.CountryPicker';
467
+ import { Button } from '../../Button/Button';
468
+
469
+ export const FormikCountryPickerExample = () => {
470
+ return (
471
+ <Formik
472
+ initialValues={{ country: '' }}
473
+ validationSchema={Yup.object({
474
+ country: Yup.string().required('Country is required'),
475
+ })}
476
+ onSubmit={(values) => alert(JSON.stringify(values))}
477
+ >
478
+ {({ handleSubmit }) => (
479
+ <FormikForm>
480
+ <FormikCountryPicker
481
+ name="country"
482
+ label="Country"
483
+ placeholder="Select your country"
484
+ />
485
+ <Button type="submit" onClick={handleSubmit} marginTop={16}>
486
+ Submit
487
+ </Button>
488
+ </FormikForm>
489
+ )}
490
+ </Formik>
491
+ );
492
+ };
493
+ ```
494
+
495
+ ### **FormikPassword**
496
+ Password input with show/hide toggle integrated with Formik.
497
+
498
+ ```tsx
499
+ import React from 'react';
500
+ import { Formik } from 'formik';
501
+ import * as Yup from 'yup';
502
+ import { FormikForm } from '../Formik.Form';
503
+ import { FormikPassword } from '../Formik.Password';
504
+ import { Button } from '../../Button/Button';
505
+
506
+ export const FormikPasswordExample = () => {
507
+ return (
508
+ <Formik
509
+ initialValues={{ password: '' }}
510
+ validationSchema={Yup.object({
511
+ password: Yup.string()
512
+ .min(8, 'Password must be at least 8 characters')
513
+ .required('Password is required'),
514
+ })}
515
+ onSubmit={(values) => alert(JSON.stringify(values))}
516
+ >
517
+ {({ handleSubmit }) => (
518
+ <FormikForm>
519
+ <FormikPassword
520
+ name="password"
521
+ label="Password"
522
+ placeholder="Enter your password"
523
+ />
524
+ <Button type="submit" onClick={handleSubmit} marginTop={16}>
525
+ Submit
526
+ </Button>
527
+ </FormikForm>
528
+ )}
529
+ </Formik>
530
+ );
531
+ };
532
+ ```
533
+
534
+ ### **FormikComboBox**
535
+ Combobox with search functionality integrated with Formik.
536
+
537
+ ```tsx
538
+ import React from 'react';
539
+ import { Formik } from 'formik';
540
+ import * as Yup from 'yup';
541
+ import { FormikForm } from '../Formik.Form';
542
+ import { FormikComboBox } from '../Formik.ComboBox';
543
+ import { Button } from '../../Button/Button';
544
+
545
+ export const FormikComboBoxExample = () => {
546
+ const items = [
547
+ { label: 'React', value: 'react' },
548
+ { label: 'Vue', value: 'vue' },
549
+ { label: 'Angular', value: 'angular' },
550
+ { label: 'Svelte', value: 'svelte' },
551
+ ];
552
+
553
+ return (
554
+ <Formik
555
+ initialValues={{ framework: '' }}
556
+ validationSchema={Yup.object({
557
+ framework: Yup.string().required('Framework is required'),
558
+ })}
559
+ onSubmit={(values) => alert(JSON.stringify(values))}
560
+ >
561
+ {({ handleSubmit }) => (
562
+ <FormikForm>
563
+ <FormikComboBox
564
+ name="framework"
565
+ label="Framework"
566
+ placeholder="Select or search for a framework"
567
+ items={items}
568
+ />
569
+ <Button type="submit" onClick={handleSubmit} marginTop={16}>
570
+ Submit
571
+ </Button>
572
+ </FormikForm>
573
+ )}
574
+ </Formik>
575
+ );
576
+ };
577
+ ```
578
+
579
+ ### **FormikSlider**
580
+ Slider component integrated with Formik.
581
+
582
+ ```tsx
583
+ import React from 'react';
584
+ import { Formik } from 'formik';
585
+ import * as Yup from 'yup';
586
+ import { FormikForm } from '../Formik.Form';
587
+ import { FormikSlider } from '../Formik.Slider';
588
+ import { Button } from '../../Button/Button';
589
+
590
+ export const FormikSliderExample = () => {
591
+ return (
592
+ <Formik
593
+ initialValues={{ volume: 50 }}
594
+ validationSchema={Yup.object({
595
+ volume: Yup.number()
596
+ .min(0, 'Volume cannot be negative')
597
+ .max(100, 'Volume cannot exceed 100')
598
+ .required('Volume is required'),
599
+ })}
600
+ onSubmit={(values) => alert(JSON.stringify(values))}
601
+ >
602
+ {({ handleSubmit }) => (
603
+ <FormikForm>
604
+ <FormikSlider
605
+ name="volume"
606
+ label="Volume"
607
+ min={0}
608
+ max={100}
609
+ step={1}
610
+ showValue
611
+ helperText="Adjust the volume level"
612
+ />
613
+ <Button type="submit" onClick={handleSubmit} marginTop={16}>
614
+ Submit
615
+ </Button>
616
+ </FormikForm>
617
+ )}
618
+ </Formik>
619
+ );
620
+ };
621
+ ```