formik-form-components 2.0.0 → 2.0.2
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/README.md +62 -126
- package/dist/index.esm.js +2 -1
- package/dist/index.js +2 -1
- package/package.json +10 -4
package/README.md
CHANGED
|
@@ -1,32 +1,28 @@
|
|
|
1
1
|
# Formik Form Components
|
|
2
2
|
|
|
3
|
-
> **
|
|
3
|
+
> **React form components** with Tailwind CSS and Formik - ready to use out of the box!
|
|
4
4
|
|
|
5
5
|
A complete, production-ready form component library that requires **zero configuration**. Just install and start building beautiful forms instantly. All Tailwind CSS styles are precompiled and bundled, so you don't need to configure anything.
|
|
6
6
|
|
|
7
7
|
## ✨ Features
|
|
8
8
|
|
|
9
9
|
- 🎨 **Zero Configuration** - No Tailwind setup, no config files, just install and use
|
|
10
|
-
- 📦 **Tiny Bundle Size** - Optimized and tree-shakable (stays in KBs, not MBs)
|
|
11
10
|
- 🔥 **18+ Form Components** - Complete form library with all common input types
|
|
12
11
|
- 💅 **Pre-styled with Tailwind** - Beautiful, modern design out of the box
|
|
13
12
|
- 🎯 **Formik Integration** - Seamless integration with Formik for form state management
|
|
14
|
-
- 📱 **Fully Responsive** - Mobile-first design that works on all screen sizes
|
|
15
|
-
- ♿ **Accessible** - WCAG compliant with keyboard navigation support
|
|
16
13
|
- 🔧 **TypeScript Support** - Full TypeScript definitions included
|
|
17
|
-
- 🎭 **Animated** - Smooth animations with Framer Motion
|
|
18
14
|
- 🌐 **International** - Phone input with country codes
|
|
19
15
|
|
|
20
16
|
## 📦 Installation
|
|
21
17
|
|
|
22
18
|
```bash
|
|
23
|
-
npm install
|
|
19
|
+
npm install formik-form-components
|
|
24
20
|
```
|
|
25
21
|
|
|
26
22
|
Or with yarn:
|
|
27
23
|
|
|
28
24
|
```bash
|
|
29
|
-
yarn add
|
|
25
|
+
yarn add formik-form-components
|
|
30
26
|
```
|
|
31
27
|
|
|
32
28
|
## 🚀 Quick Start
|
|
@@ -35,41 +31,35 @@ No configuration needed! Import and use:
|
|
|
35
31
|
|
|
36
32
|
```tsx
|
|
37
33
|
import React from 'react';
|
|
38
|
-
import {
|
|
39
|
-
import { AppInputField, AppTextArea, SubmitButton } from '@your-org/formik-form-components';
|
|
34
|
+
import { Form, AppInputField, AppTextArea } from "formik-form-components";
|
|
40
35
|
|
|
41
36
|
function MyForm() {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
onSubmit={(values) => console.log(values)}
|
|
37
|
+
<Form
|
|
38
|
+
initialValues={{ name: "", email: "", message: "" }}
|
|
39
|
+
onSubmit={(values: any) => console.log(values)}
|
|
46
40
|
>
|
|
47
|
-
<
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
<SubmitButton>Submit Form</SubmitButton>
|
|
71
|
-
</Form>
|
|
72
|
-
</Formik>
|
|
41
|
+
<AppInputField
|
|
42
|
+
name="name"
|
|
43
|
+
label="Your Name"
|
|
44
|
+
placeholder="John Doe"
|
|
45
|
+
required
|
|
46
|
+
/>
|
|
47
|
+
|
|
48
|
+
<AppInputField
|
|
49
|
+
name="email"
|
|
50
|
+
label="Email Address"
|
|
51
|
+
type="email"
|
|
52
|
+
placeholder="john@example.com"
|
|
53
|
+
required
|
|
54
|
+
/>
|
|
55
|
+
|
|
56
|
+
<AppTextArea
|
|
57
|
+
name="message"
|
|
58
|
+
label="Message"
|
|
59
|
+
rows={4}
|
|
60
|
+
placeholder="Your message here..."
|
|
61
|
+
/>
|
|
62
|
+
</Form>
|
|
73
63
|
);
|
|
74
64
|
}
|
|
75
65
|
|
|
@@ -110,41 +100,41 @@ That's it! No Tailwind setup, no configuration files. Everything just works.
|
|
|
110
100
|
### Text Input with Password Toggle
|
|
111
101
|
|
|
112
102
|
```tsx
|
|
113
|
-
<AppInputField
|
|
114
|
-
name="password"
|
|
115
|
-
label="Password"
|
|
103
|
+
<AppInputField
|
|
104
|
+
name="password"
|
|
105
|
+
label="Password"
|
|
116
106
|
type="password"
|
|
117
107
|
placeholder="Enter your password"
|
|
118
|
-
required
|
|
108
|
+
required
|
|
119
109
|
/>
|
|
120
110
|
```
|
|
121
111
|
|
|
122
112
|
### Phone Number Input
|
|
123
113
|
|
|
124
114
|
```tsx
|
|
125
|
-
<AppPhoneNoInput
|
|
126
|
-
name="phone"
|
|
115
|
+
<AppPhoneNoInput
|
|
116
|
+
name="phone"
|
|
127
117
|
label="Phone Number"
|
|
128
118
|
placeholder="Enter your phone number"
|
|
129
|
-
required
|
|
119
|
+
required
|
|
130
120
|
/>
|
|
131
121
|
```
|
|
132
122
|
|
|
133
123
|
### Date Picker
|
|
134
124
|
|
|
135
125
|
```tsx
|
|
136
|
-
<AppDatePicker
|
|
137
|
-
name="birthdate"
|
|
126
|
+
<AppDatePicker
|
|
127
|
+
name="birthdate"
|
|
138
128
|
label="Date of Birth"
|
|
139
|
-
disableFuture
|
|
129
|
+
disableFuture
|
|
140
130
|
/>
|
|
141
131
|
```
|
|
142
132
|
|
|
143
133
|
### Multi-Select
|
|
144
134
|
|
|
145
135
|
```tsx
|
|
146
|
-
<AppMultiSelector
|
|
147
|
-
name="skills"
|
|
136
|
+
<AppMultiSelector
|
|
137
|
+
name="skills"
|
|
148
138
|
label="Your Skills"
|
|
149
139
|
options={[
|
|
150
140
|
{ label: 'React', value: 'react' },
|
|
@@ -159,8 +149,8 @@ That's it! No Tailwind setup, no configuration files. Everything just works.
|
|
|
159
149
|
### File Upload with Preview
|
|
160
150
|
|
|
161
151
|
```tsx
|
|
162
|
-
<AppUploadFile
|
|
163
|
-
name="documents"
|
|
152
|
+
<AppUploadFile
|
|
153
|
+
name="documents"
|
|
164
154
|
label="Upload Documents"
|
|
165
155
|
multiple
|
|
166
156
|
accept={{ 'image/*': ['.png', '.jpg', '.jpeg'], 'application/pdf': ['.pdf'] }}
|
|
@@ -170,23 +160,23 @@ That's it! No Tailwind setup, no configuration files. Everything just works.
|
|
|
170
160
|
### Radio Group
|
|
171
161
|
|
|
172
162
|
```tsx
|
|
173
|
-
<AppRadioGroup
|
|
174
|
-
name="gender"
|
|
163
|
+
<AppRadioGroup
|
|
164
|
+
name="gender"
|
|
175
165
|
label="Gender"
|
|
176
166
|
options={[
|
|
177
167
|
{ label: 'Male', value: 'male' },
|
|
178
168
|
{ label: 'Female', value: 'female' },
|
|
179
169
|
{ label: 'Other', value: 'other' }
|
|
180
170
|
]}
|
|
181
|
-
required
|
|
171
|
+
required
|
|
182
172
|
/>
|
|
183
173
|
```
|
|
184
174
|
|
|
185
175
|
### Rating Component
|
|
186
176
|
|
|
187
177
|
```tsx
|
|
188
|
-
<AppRating
|
|
189
|
-
name="rating"
|
|
178
|
+
<AppRating
|
|
179
|
+
name="rating"
|
|
190
180
|
label="Rate this product"
|
|
191
181
|
helperText="Your rating helps us improve"
|
|
192
182
|
/>
|
|
@@ -195,8 +185,8 @@ That's it! No Tailwind setup, no configuration files. Everything just works.
|
|
|
195
185
|
### Tags Creator
|
|
196
186
|
|
|
197
187
|
```tsx
|
|
198
|
-
<AppTagsCreator
|
|
199
|
-
name="tags"
|
|
188
|
+
<AppTagsCreator
|
|
189
|
+
name="tags"
|
|
200
190
|
label="Tags"
|
|
201
191
|
placeholder="Type and press Enter"
|
|
202
192
|
options={['React', 'JavaScript', 'CSS']}
|
|
@@ -206,8 +196,8 @@ That's it! No Tailwind setup, no configuration files. Everything just works.
|
|
|
206
196
|
### Autocomplete
|
|
207
197
|
|
|
208
198
|
```tsx
|
|
209
|
-
<AppAutoCompleter
|
|
210
|
-
name="country"
|
|
199
|
+
<AppAutoCompleter
|
|
200
|
+
name="country"
|
|
211
201
|
label="Country"
|
|
212
202
|
placeholder="Search countries..."
|
|
213
203
|
options={['USA', 'Canada', 'Mexico', 'UK', 'Germany']}
|
|
@@ -219,8 +209,8 @@ That's it! No Tailwind setup, no configuration files. Everything just works.
|
|
|
219
209
|
All components come pre-styled with Tailwind CSS. You can customize them by passing a `className` prop:
|
|
220
210
|
|
|
221
211
|
```tsx
|
|
222
|
-
<AppInputField
|
|
223
|
-
name="email"
|
|
212
|
+
<AppInputField
|
|
213
|
+
name="email"
|
|
224
214
|
label="Email"
|
|
225
215
|
className="mb-6"
|
|
226
216
|
/>
|
|
@@ -243,70 +233,35 @@ const validationSchema = Yup.object({
|
|
|
243
233
|
age: Yup.number().min(18, 'Must be 18+').required('Age is required')
|
|
244
234
|
});
|
|
245
235
|
|
|
246
|
-
<
|
|
236
|
+
<Form
|
|
247
237
|
initialValues={{ name: '', email: '', age: '' }}
|
|
248
238
|
validationSchema={validationSchema}
|
|
249
239
|
onSubmit={(values) => console.log(values)}
|
|
250
240
|
>
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
</Form>
|
|
254
|
-
</Formik>
|
|
241
|
+
<AppInputField name="email" label="Email" />
|
|
242
|
+
</Form>
|
|
255
243
|
```
|
|
256
244
|
|
|
257
245
|
### Submit Button with Loading State
|
|
258
246
|
|
|
259
247
|
```tsx
|
|
260
|
-
<
|
|
248
|
+
<Form
|
|
261
249
|
initialValues={{ email: '' }}
|
|
262
250
|
onSubmit={async (values) => {
|
|
263
251
|
await api.submit(values);
|
|
264
252
|
}}
|
|
265
253
|
>
|
|
266
254
|
{({ isSubmitting }) => (
|
|
267
|
-
<
|
|
255
|
+
<div>
|
|
268
256
|
<AppInputField name="email" label="Email" />
|
|
269
257
|
<SubmitButton loading={isSubmitting}>
|
|
270
258
|
{isSubmitting ? 'Submitting...' : 'Submit'}
|
|
271
259
|
</SubmitButton>
|
|
272
|
-
</
|
|
260
|
+
</div>
|
|
273
261
|
)}
|
|
274
|
-
</
|
|
275
|
-
```
|
|
276
|
-
|
|
277
|
-
## 🎭 TypeScript Support
|
|
278
|
-
|
|
279
|
-
Full TypeScript support with type definitions:
|
|
280
|
-
|
|
281
|
-
```tsx
|
|
282
|
-
import type { FormProps, UploadProps, CustomFile } from '@your-org/formik-form-components';
|
|
283
|
-
|
|
284
|
-
// Use types in your components
|
|
285
|
-
const MyForm: React.FC = () => {
|
|
286
|
-
const handleUpload = (files: CustomFile[]) => {
|
|
287
|
-
console.log('Uploaded:', files);
|
|
288
|
-
};
|
|
289
|
-
|
|
290
|
-
return (
|
|
291
|
-
// Your form here
|
|
292
|
-
);
|
|
293
|
-
};
|
|
262
|
+
</Form>
|
|
294
263
|
```
|
|
295
264
|
|
|
296
|
-
## 📦 What's Included
|
|
297
|
-
|
|
298
|
-
When you install this package, you get:
|
|
299
|
-
|
|
300
|
-
✅ **All form components** - 18+ production-ready components
|
|
301
|
-
✅ **Precompiled Tailwind CSS** - No setup required
|
|
302
|
-
✅ **TypeScript definitions** - Full type safety
|
|
303
|
-
✅ **Formik integration** - Built-in form state management
|
|
304
|
-
✅ **Validation support** - Works with Yup and custom validators
|
|
305
|
-
✅ **Icons** - Heroicons included
|
|
306
|
-
✅ **Animations** - Framer Motion for smooth transitions
|
|
307
|
-
✅ **File upload** - React Dropzone integration
|
|
308
|
-
✅ **Phone input** - International phone numbers
|
|
309
|
-
|
|
310
265
|
## 🤝 Peer Dependencies
|
|
311
266
|
|
|
312
267
|
This package requires:
|
|
@@ -332,7 +287,7 @@ These will be installed automatically if not present.
|
|
|
332
287
|
|
|
333
288
|
### After (This Package)
|
|
334
289
|
|
|
335
|
-
1. `npm install
|
|
290
|
+
1. `npm install formik-form-components`
|
|
336
291
|
2. Import and use components
|
|
337
292
|
3. Done! ✨
|
|
338
293
|
|
|
@@ -344,23 +299,4 @@ MIT
|
|
|
344
299
|
|
|
345
300
|
Contributions are welcome! Please read our contributing guidelines before submitting PRs.
|
|
346
301
|
|
|
347
|
-
## 💬 Support
|
|
348
|
-
|
|
349
|
-
- 📧 Email: support@yourorg.com
|
|
350
|
-
- 🐛 Issues: [GitHub Issues](https://github.com/your-username/formik-form-components/issues)
|
|
351
|
-
- 📖 Docs: [Full Documentation](https://your-docs-site.com)
|
|
352
|
-
|
|
353
|
-
## 🙏 Acknowledgments
|
|
354
|
-
|
|
355
|
-
Built with:
|
|
356
|
-
- [React](https://reactjs.org/)
|
|
357
|
-
- [Formik](https://formik.org/)
|
|
358
|
-
- [Tailwind CSS](https://tailwindcss.com/)
|
|
359
|
-
- [Headless UI](https://headlessui.dev/)
|
|
360
|
-
- [Framer Motion](https://www.framer.com/motion/)
|
|
361
|
-
- [React Dropzone](https://react-dropzone.js.org/)
|
|
362
|
-
- [Heroicons](https://heroicons.com/)
|
|
363
|
-
|
|
364
|
-
---
|
|
365
|
-
|
|
366
302
|
Made with ❤️ for the React community
|