formstack-ui 0.0.1
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/CHANGELOG.md +206 -0
- package/LICENSE +21 -0
- package/README.md +341 -0
- package/dist/bin/index.js +1077 -0
- package/dist/bin/registry.js +105 -0
- package/dist/components/FormikSchemaForm.d.ts +11 -0
- package/dist/components/SchemaForm.d.ts +26 -0
- package/dist/components/ThemeSwitcher.d.ts +1 -0
- package/dist/components/builder/FormBuilder.d.ts +1 -0
- package/dist/components/demo/Documentation.d.ts +1 -0
- package/dist/components/demo/StatesGallery.d.ts +1 -0
- package/dist/components/form/FormRenderer.d.ts +9 -0
- package/dist/components/layout/GridContainer.d.ts +8 -0
- package/dist/components/layout/GridItem.d.ts +8 -0
- package/dist/components/pages/ChangelogPage.d.ts +1 -0
- package/dist/components/pages/DemoPage.d.ts +6 -0
- package/dist/components/pages/GuidePage.d.ts +1 -0
- package/dist/components/pages/Home.d.ts +1 -0
- package/dist/components/pages/ReadmePage.d.ts +1 -0
- package/dist/components/pages/TasksPage.d.ts +1 -0
- package/dist/components/pages/ThemeOverridesPage.d.ts +1 -0
- package/dist/components/playground/ComponentPlayground.d.ts +8 -0
- package/dist/components/playground/PlaygroundPage.d.ts +1 -0
- package/dist/components/playground/components-config.d.ts +10 -0
- package/dist/components/playground/types.d.ts +14 -0
- package/dist/components/theme/ThemeContext.d.ts +16 -0
- package/dist/components/theme/defaultTheme.d.ts +2 -0
- package/dist/components/theme/types.d.ts +38 -0
- package/dist/components/ui/Checkbox.d.ts +6 -0
- package/dist/components/ui/FileInput.d.ts +12 -0
- package/dist/components/ui/Grid.d.ts +18 -0
- package/dist/components/ui/RadioGroup.d.ts +16 -0
- package/dist/components/ui/Select.d.ts +9 -0
- package/dist/components/ui/Switch.d.ts +6 -0
- package/dist/components/ui/TextInput.d.ts +6 -0
- package/dist/components/ui/Textarea.d.ts +10 -0
- package/dist/components/ui/date/Calendar.d.ts +16 -0
- package/dist/components/ui/date/DatePicker.d.ts +12 -0
- package/dist/components/ui/date/DateRangePicker.d.ts +18 -0
- package/dist/components/ui/date/DateTimePicker.d.ts +12 -0
- package/dist/components/ui/date/TimePicker.d.ts +12 -0
- package/dist/components/ui/date/TimeView.d.ts +7 -0
- package/dist/components/ui/date/index.d.ts +4 -0
- package/dist/components/ui/field/BaseField.d.ts +16 -0
- package/dist/components/ui/field/ErrorTooltip.d.ts +6 -0
- package/dist/components/ui/field/LabelWrapper.d.ts +14 -0
- package/dist/components/ui/field/types.d.ts +15 -0
- package/dist/components/ui/select/Autocomplete.d.ts +15 -0
- package/dist/components/ui/select/Chip.d.ts +7 -0
- package/dist/components/ui/select/types.d.ts +5 -0
- package/dist/context/ThemeContext.d.ts +14 -0
- package/dist/hooks/useDebounce.d.ts +1 -0
- package/dist/hooks/useForm.d.ts +28 -0
- package/dist/index.js +11801 -0
- package/dist/lib/demo-schemas.d.ts +2 -0
- package/dist/lib/index.d.ts +17 -0
- package/dist/lib/schema-helpers.d.ts +29 -0
- package/dist/types/schema.d.ts +136 -0
- package/dist/utils/date-utils.d.ts +10 -0
- package/dist/utils/dependencies.d.ts +2 -0
- package/dist/utils/validation.d.ts +7 -0
- package/dist/utils/yup-validation.d.ts +7 -0
- package/dist/vite.svg +1 -0
- package/package.json +130 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to FormEngine will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [3.1.0] - 2026-01-17
|
|
9
|
+
|
|
10
|
+
### 🎉 New Features & Breakthroughs
|
|
11
|
+
|
|
12
|
+
#### **Themed Variant System**
|
|
13
|
+
|
|
14
|
+
- **Unified Variants**: Full support for `outline`, `filled`, `standard`, and `floating` variants across all input components.
|
|
15
|
+
- **Animated Notches**: Precision-engineered floating labels with a solid background notch effect.
|
|
16
|
+
- **Enhanced Date/Time Pickers**: `DatePicker`, `DateRangePicker`, `DateTimePicker`, and `TimePicker` now support the full variant system natively.
|
|
17
|
+
|
|
18
|
+
#### **CLI 3.0 Power Tools**
|
|
19
|
+
|
|
20
|
+
- **Dynamic Package Names**: Users can now specify a custom `packageName` during `init` for highly tailored local installations.
|
|
21
|
+
- **Component Tracking**: The new `r-form.json` config tracks every component installed in `copy` mode.
|
|
22
|
+
- **`update` Command**: Introduced a powerful `update` command to automatically synchronize your local component source files with the latest upstream library versions.
|
|
23
|
+
- **Intelligent Dependency Resolution**: The `add` and `update` commands now recursively manage internal dependencies (like `theme-core` and `date-utils`).
|
|
24
|
+
|
|
25
|
+
#### **Core Enhancements**
|
|
26
|
+
|
|
27
|
+
- **Native Implementation**: Fully transitioned from external UI libraries to high-performance, tailored native components for all Date/Time operations.
|
|
28
|
+
- **Floating Labels for Selects**: Integrated floating label animations into `Select` and `Autocomplete` components.
|
|
29
|
+
- **Library Exports**: Expanded the public API to export the complete suite of themed components.
|
|
30
|
+
|
|
31
|
+
### 🔧 Technical Details
|
|
32
|
+
|
|
33
|
+
- **Dependencies**: React 19.2, Tailwind CSS 4.1, Zod 4.3, date-fns 4.1.
|
|
34
|
+
- **CLI Utilities**: Chalk, Commander, Execa, Fs-extra, Ora, Prompts.
|
|
35
|
+
|
|
36
|
+
## [3.0.2] - 2026-01-13
|
|
37
|
+
|
|
38
|
+
### 🎉 Initial Release
|
|
39
|
+
|
|
40
|
+
#### Added
|
|
41
|
+
|
|
42
|
+
**Core Features**
|
|
43
|
+
|
|
44
|
+
- Schema-driven form rendering with 17 field types
|
|
45
|
+
- Visual form builder with drag-and-drop
|
|
46
|
+
- Comprehensive validation system (20+ validation types)
|
|
47
|
+
- Conditional field visibility with AND/OR rules
|
|
48
|
+
- Responsive 12-column grid layout
|
|
49
|
+
- Dark mode support
|
|
50
|
+
- TypeScript support
|
|
51
|
+
|
|
52
|
+
**Field Types**
|
|
53
|
+
|
|
54
|
+
- Text inputs: text, email, url, tel, password
|
|
55
|
+
- Number input with min/max/step
|
|
56
|
+
- Textarea with auto-grow and character count
|
|
57
|
+
- Autocomplete with async support and multi-select
|
|
58
|
+
- Native select with multi-select
|
|
59
|
+
- Checkbox, Switch, Radio groups
|
|
60
|
+
- File upload with preview modes
|
|
61
|
+
- Date/Time pickers (Kendo UI integration)
|
|
62
|
+
|
|
63
|
+
**Form Builder**
|
|
64
|
+
|
|
65
|
+
- 60+ configurable properties per field
|
|
66
|
+
- Smart field defaults by type
|
|
67
|
+
- Schema import/export (JSON)
|
|
68
|
+
- Copy to clipboard functionality
|
|
69
|
+
- Real-time preview
|
|
70
|
+
- Organized property panels
|
|
71
|
+
- Icon-only button design
|
|
72
|
+
|
|
73
|
+
**Validation**
|
|
74
|
+
|
|
75
|
+
- Required, email, URL validation
|
|
76
|
+
- Min/max length for text
|
|
77
|
+
- Min/max value for numbers
|
|
78
|
+
- Pattern/regex validation
|
|
79
|
+
- File size and type validation
|
|
80
|
+
- Date range validation
|
|
81
|
+
- Custom validation functions
|
|
82
|
+
- Debounced validation
|
|
83
|
+
- Validate on blur/change
|
|
84
|
+
|
|
85
|
+
**UI/UX**
|
|
86
|
+
|
|
87
|
+
- Floating labels with notch effect
|
|
88
|
+
- Error tooltips
|
|
89
|
+
- Icon adornments (start/end)
|
|
90
|
+
- Responsive design (mobile/tablet/desktop)
|
|
91
|
+
- Accessibility (ARIA, keyboard navigation)
|
|
92
|
+
- Premium animations and transitions
|
|
93
|
+
|
|
94
|
+
**States Gallery**
|
|
95
|
+
|
|
96
|
+
- Component state showcase
|
|
97
|
+
- Smart state filtering by component type
|
|
98
|
+
- Responsive grid layout (4-2-1 columns)
|
|
99
|
+
- All field types with 7 states each
|
|
100
|
+
|
|
101
|
+
**Developer Experience**
|
|
102
|
+
|
|
103
|
+
- TypeScript definitions
|
|
104
|
+
- Comprehensive documentation
|
|
105
|
+
- Example schemas
|
|
106
|
+
- Theme customization
|
|
107
|
+
- Zod integration
|
|
108
|
+
|
|
109
|
+
### 🔧 Technical Details
|
|
110
|
+
|
|
111
|
+
**Dependencies**
|
|
112
|
+
|
|
113
|
+
- React 19.2+
|
|
114
|
+
- Tailwind CSS 4.1
|
|
115
|
+
- Zod 4.3+
|
|
116
|
+
- Kendo React UI 13.2 (optional)
|
|
117
|
+
|
|
118
|
+
**Browser Support**
|
|
119
|
+
|
|
120
|
+
- Chrome 90+
|
|
121
|
+
- Firefox 88+
|
|
122
|
+
- Safari 14+
|
|
123
|
+
- Edge 90+
|
|
124
|
+
|
|
125
|
+
### 📚 Documentation
|
|
126
|
+
|
|
127
|
+
- README with quick start guide
|
|
128
|
+
- API documentation
|
|
129
|
+
- Contributing guidelines
|
|
130
|
+
- MIT License
|
|
131
|
+
- Changelog
|
|
132
|
+
|
|
133
|
+
---
|
|
134
|
+
|
|
135
|
+
## [Unreleased]
|
|
136
|
+
|
|
137
|
+
### Planned Features
|
|
138
|
+
|
|
139
|
+
- [ ] Multi-step forms/wizard
|
|
140
|
+
- [ ] Form templates library
|
|
141
|
+
- [ ] Advanced file upload (drag-and-drop, crop)
|
|
142
|
+
- [ ] Rich text editor field
|
|
143
|
+
- [ ] Signature pad field
|
|
144
|
+
- [ ] Geolocation field
|
|
145
|
+
- [ ] Rating/star field
|
|
146
|
+
- [ ] Color picker field
|
|
147
|
+
- [ ] Slider/range field
|
|
148
|
+
- [ ] Form analytics
|
|
149
|
+
- [ ] A/B testing support
|
|
150
|
+
- [ ] Internationalization (i18n)
|
|
151
|
+
- [ ] Form versioning
|
|
152
|
+
- [ ] Collaboration features
|
|
153
|
+
- [ ] API integration templates
|
|
154
|
+
- [ ] Webhook support
|
|
155
|
+
- [ ] PDF export
|
|
156
|
+
- [ ] Email notifications
|
|
157
|
+
- [ ] Conditional sections
|
|
158
|
+
- [ ] Repeatable field groups
|
|
159
|
+
- [ ] Calculation fields
|
|
160
|
+
- [ ] Lookup fields
|
|
161
|
+
- [ ] Matrix/grid questions
|
|
162
|
+
|
|
163
|
+
---
|
|
164
|
+
|
|
165
|
+
## Version History
|
|
166
|
+
|
|
167
|
+
- **3.0.2** - Initial public release (2026-01-13)
|
|
168
|
+
|
|
169
|
+
---
|
|
170
|
+
|
|
171
|
+
## Migration Guides
|
|
172
|
+
|
|
173
|
+
### From 2.x to 3.0
|
|
174
|
+
|
|
175
|
+
No migration needed - this is the initial public release!
|
|
176
|
+
|
|
177
|
+
---
|
|
178
|
+
|
|
179
|
+
## Breaking Changes
|
|
180
|
+
|
|
181
|
+
None yet - this is version 1.0.0!
|
|
182
|
+
|
|
183
|
+
---
|
|
184
|
+
|
|
185
|
+
## Deprecations
|
|
186
|
+
|
|
187
|
+
None yet.
|
|
188
|
+
|
|
189
|
+
---
|
|
190
|
+
|
|
191
|
+
## Security
|
|
192
|
+
|
|
193
|
+
### Reporting Security Issues
|
|
194
|
+
|
|
195
|
+
Please report security vulnerabilities to adarshatl03@gmail.com
|
|
196
|
+
|
|
197
|
+
### Security Updates
|
|
198
|
+
|
|
199
|
+
- All dependencies are kept up-to-date
|
|
200
|
+
- Regular security audits
|
|
201
|
+
- Zod validation prevents injection attacks
|
|
202
|
+
- XSS protection built-in
|
|
203
|
+
|
|
204
|
+
---
|
|
205
|
+
|
|
206
|
+
**Note**: For detailed commit history, see [GitHub Releases](https://github.com/yourusername/form-engine/releases)
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Adarsh
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,341 @@
|
|
|
1
|
+
# 🚀 FormStack UI
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/formstack-ui)
|
|
4
|
+
[](https://opensource.org/licenses/MIT)
|
|
5
|
+
[](https://www.typescriptlang.org/)
|
|
6
|
+
[](https://reactjs.org/)
|
|
7
|
+
|
|
8
|
+
**A powerful, schema-driven form engine for React with a visual builder, comprehensive validation, and enterprise-grade features.**
|
|
9
|
+
|
|
10
|
+
## ✨ Features
|
|
11
|
+
|
|
12
|
+
### 🎨 **Visual Form Builder**
|
|
13
|
+
|
|
14
|
+
- Drag-and-drop field arrangement
|
|
15
|
+
- 60+ configurable properties per field
|
|
16
|
+
- Real-time preview
|
|
17
|
+
- Schema import/export (JSON)
|
|
18
|
+
- Smart field defaults
|
|
19
|
+
- **Component Playground**: Interactive gallery for all UI components
|
|
20
|
+
|
|
21
|
+
### 📝 **17 Field Types**
|
|
22
|
+
|
|
23
|
+
- Text inputs (text, email, url, tel, password)
|
|
24
|
+
- Number input with constraints
|
|
25
|
+
- Textarea with auto-grow
|
|
26
|
+
- Autocomplete with async support
|
|
27
|
+
- Native select & multi-select
|
|
28
|
+
- Checkbox, Switch, Radio groups
|
|
29
|
+
- File upload with preview
|
|
30
|
+
- Date, Time, DateTime, DateRange pickers (Native components)
|
|
31
|
+
|
|
32
|
+
### ✅ **Advanced Validation**
|
|
33
|
+
|
|
34
|
+
- 20+ validation types
|
|
35
|
+
- Zod integration
|
|
36
|
+
- Custom validation functions
|
|
37
|
+
|
|
38
|
+
## ✨ Features (v3.2.0)
|
|
39
|
+
|
|
40
|
+
- **Framework Agnostic State**: Choose between Native `useForm`, **Formik**, or **React Hook Form**.
|
|
41
|
+
- **Multi-Validation Support**: First-class support for **Zod** and **Yup**.
|
|
42
|
+
- **Themed Variant System**: Default, Outlined, and Covered variants for all inputs.
|
|
43
|
+
- **Smart CLI 3.0**: Select your stack (`npx formstack-ui init`) and we'll configure your validation and state management automatically.
|
|
44
|
+
- Dark mode support
|
|
45
|
+
- Fully responsive (12-column grid)
|
|
46
|
+
- Tailwind CSS 4.1
|
|
47
|
+
|
|
48
|
+
### 🛠️ **CLI 3.0 Power Tools**
|
|
49
|
+
|
|
50
|
+
Detailed instructions can be found in the [CLI Guide](CLI_GUIDE.md).
|
|
51
|
+
|
|
52
|
+
- **`init`**: Comprehensive setup with custom package name support
|
|
53
|
+
- **`add`**: Install specific components locally with dependency tracking
|
|
54
|
+
- **`update`**: Keep your local components up-to-date with a single command
|
|
55
|
+
- **`create`**: Scaffold a new project from scratch (`npx formstack-ui create`)
|
|
56
|
+
|
|
57
|
+
### 🌐 **Accessibility**
|
|
58
|
+
|
|
59
|
+
- ARIA labels
|
|
60
|
+
- Keyboard navigation
|
|
61
|
+
- Screen reader support
|
|
62
|
+
- Semantic HTML
|
|
63
|
+
|
|
64
|
+
## 📦 Installation
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
npm install formstack-ui
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### Peer Dependencies
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
npm install react react-dom tailwindcss zod formik yup
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## 🚀 Quick Start
|
|
77
|
+
|
|
78
|
+
### 1. Basic Form
|
|
79
|
+
|
|
80
|
+
```tsx
|
|
81
|
+
import { SchemaForm } from "formstack-ui";
|
|
82
|
+
import type { FormSchema } from "formstack-ui";
|
|
83
|
+
|
|
84
|
+
const schema: FormSchema = {
|
|
85
|
+
title: "Contact Form",
|
|
86
|
+
description: "Get in touch with us",
|
|
87
|
+
fields: [
|
|
88
|
+
{
|
|
89
|
+
id: "name",
|
|
90
|
+
name: "name",
|
|
91
|
+
label: "Full Name",
|
|
92
|
+
type: "text",
|
|
93
|
+
placeholder: "John Doe",
|
|
94
|
+
validation: [{ type: "required", message: "Name is required" }],
|
|
95
|
+
grid: { colSpan: 12, xs: 12, sm: 6 },
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
id: "email",
|
|
99
|
+
name: "email",
|
|
100
|
+
label: "Email",
|
|
101
|
+
type: "email",
|
|
102
|
+
placeholder: "john@example.com",
|
|
103
|
+
validation: [{ type: "required" }, { type: "email", message: "Invalid email" }],
|
|
104
|
+
grid: { colSpan: 12, xs: 12, sm: 6 },
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
id: "message",
|
|
108
|
+
name: "message",
|
|
109
|
+
label: "Message",
|
|
110
|
+
type: "textarea",
|
|
111
|
+
rows: 4,
|
|
112
|
+
grid: { colSpan: 12 },
|
|
113
|
+
},
|
|
114
|
+
],
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
function App() {
|
|
118
|
+
return (
|
|
119
|
+
<SchemaForm
|
|
120
|
+
schema={schema}
|
|
121
|
+
onSubmit={(values) => {
|
|
122
|
+
console.log("Form submitted:", values);
|
|
123
|
+
}}
|
|
124
|
+
/>
|
|
125
|
+
);
|
|
126
|
+
}
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### 2. Form Builder
|
|
130
|
+
|
|
131
|
+
```tsx
|
|
132
|
+
import { FormBuilder } from "formstack-ui";
|
|
133
|
+
|
|
134
|
+
function App() {
|
|
135
|
+
return <FormBuilder />;
|
|
136
|
+
}
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
### 3. Advanced Features
|
|
140
|
+
|
|
141
|
+
```tsx
|
|
142
|
+
import { SchemaForm } from "formstack-ui";
|
|
143
|
+
import { useRef } from "react";
|
|
144
|
+
import type { SchemaFormHandle } from "formstack-ui";
|
|
145
|
+
|
|
146
|
+
function App() {
|
|
147
|
+
const formRef = useRef<SchemaFormHandle>(null);
|
|
148
|
+
|
|
149
|
+
return (
|
|
150
|
+
<>
|
|
151
|
+
<SchemaForm
|
|
152
|
+
ref={formRef}
|
|
153
|
+
schema={schema}
|
|
154
|
+
debug // Show debug panel
|
|
155
|
+
onValidate={(values) => {
|
|
156
|
+
// Custom cross-field validation
|
|
157
|
+
const errors: Record<string, string> = {};
|
|
158
|
+
if (values.password !== values.confirmPassword) {
|
|
159
|
+
errors.confirmPassword = "Passwords don't match";
|
|
160
|
+
}
|
|
161
|
+
return errors;
|
|
162
|
+
}}
|
|
163
|
+
onSubmit={(values) => {
|
|
164
|
+
console.log("Submitted:", values);
|
|
165
|
+
}}
|
|
166
|
+
/>
|
|
167
|
+
|
|
168
|
+
<button onClick={() => formRef.current?.submit()}>Submit Form</button>
|
|
169
|
+
<button onClick={() => formRef.current?.reset()}>Reset Form</button>
|
|
170
|
+
</>
|
|
171
|
+
);
|
|
172
|
+
}
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
## 📚 Documentation
|
|
176
|
+
|
|
177
|
+
### Field Types
|
|
178
|
+
|
|
179
|
+
| Type | Description | Special Props |
|
|
180
|
+
| -------------- | ----------------- | ---------------------------------------------- |
|
|
181
|
+
| `text` | Single-line text | `minLength`, `maxLength`, `pattern` |
|
|
182
|
+
| `email` | Email input | Auto email validation |
|
|
183
|
+
| `url` | URL input | Auto URL validation |
|
|
184
|
+
| `tel` | Phone number | `pattern` for format |
|
|
185
|
+
| `password` | Password input | Masked input |
|
|
186
|
+
| `number` | Numeric input | `min`, `max`, `step` |
|
|
187
|
+
| `textarea` | Multi-line text | `rows`, `autoGrow`, `showCharCount` |
|
|
188
|
+
| `autocomplete` | Searchable select | `options`, `multiple`, `asyncUrl`, `creatable` |
|
|
189
|
+
| `select` | Native select | `options`, `multiple` |
|
|
190
|
+
| `checkbox` | Checkbox | `checkboxLabel` |
|
|
191
|
+
| `switch` | Toggle switch | Boolean value |
|
|
192
|
+
| `radio` | Radio group | `options`, `direction` |
|
|
193
|
+
| `file` | File upload | `accept`, `maxSize`, `maxFiles` |
|
|
194
|
+
| `date` | Date picker | `minDate`, `maxDate`, `dateFormat` |
|
|
195
|
+
| `time` | Time picker | `timeFormat` |
|
|
196
|
+
| `datetime` | Date + Time | `dateFormat`, `timeFormat` |
|
|
197
|
+
| `daterange` | Date range | `minDate`, `maxDate` |
|
|
198
|
+
|
|
199
|
+
### Validation Types
|
|
200
|
+
|
|
201
|
+
```typescript
|
|
202
|
+
type ValidationRule =
|
|
203
|
+
| { type: "required"; message?: string }
|
|
204
|
+
| { type: "email"; message?: string }
|
|
205
|
+
| { type: "url"; message?: string }
|
|
206
|
+
| { type: "minLength"; value: number; message?: string }
|
|
207
|
+
| { type: "maxLength"; value: number; message?: string }
|
|
208
|
+
| { type: "min"; value: number; message?: string }
|
|
209
|
+
| { type: "max"; value: number; message?: string }
|
|
210
|
+
| { type: "pattern"; value: string; message?: string }
|
|
211
|
+
| { type: "regex"; value: RegExp; message?: string }
|
|
212
|
+
| { type: "fileSize"; value: number; message?: string }
|
|
213
|
+
| { type: "fileType"; value: string[]; message?: string }
|
|
214
|
+
| { type: "minDate"; value: Date; message?: string }
|
|
215
|
+
| { type: "maxDate"; value: Date; message?: string }
|
|
216
|
+
| { type: "integer"; message?: string }
|
|
217
|
+
| { type: "positive"; message?: string }
|
|
218
|
+
| { type: "negative"; message?: string }
|
|
219
|
+
| { type: "custom"; validate: (value: any) => boolean; message?: string };
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
### Conditional Visibility
|
|
223
|
+
|
|
224
|
+
```typescript
|
|
225
|
+
{
|
|
226
|
+
id: "other-role",
|
|
227
|
+
name: "otherRole",
|
|
228
|
+
label: "Specify Role",
|
|
229
|
+
type: "text",
|
|
230
|
+
visibilityRules: [
|
|
231
|
+
{ field: "role", operator: "eq", value: "other" }
|
|
232
|
+
],
|
|
233
|
+
reserveSpace: true // Keeps layout stable
|
|
234
|
+
}
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
### Grid Layout
|
|
238
|
+
|
|
239
|
+
```typescript
|
|
240
|
+
{
|
|
241
|
+
grid: {
|
|
242
|
+
colSpan: 6, // Desktop (default)
|
|
243
|
+
xs: 12, // Mobile (<640px)
|
|
244
|
+
sm: 6, // Tablet (640px+)
|
|
245
|
+
lg: 4 // Large desktop (1024px+)
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
## 🎨 Theming
|
|
251
|
+
|
|
252
|
+
FormStack UI uses Tailwind CSS 4.1 with CSS variables for theming:
|
|
253
|
+
|
|
254
|
+
```css
|
|
255
|
+
@theme {
|
|
256
|
+
--color-primary: oklch(0.6 0.2 250);
|
|
257
|
+
--color-background: oklch(1 0 0);
|
|
258
|
+
--color-foreground: oklch(0.2 0 0);
|
|
259
|
+
/* ... more variables */
|
|
260
|
+
}
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
Toggle dark mode:
|
|
264
|
+
|
|
265
|
+
```tsx
|
|
266
|
+
import { ThemeProvider, ThemeSwitcher } from "formstack-ui";
|
|
267
|
+
|
|
268
|
+
function App() {
|
|
269
|
+
return (
|
|
270
|
+
<ThemeProvider defaultTheme="system">
|
|
271
|
+
<ThemeSwitcher />
|
|
272
|
+
{/* Your forms */}
|
|
273
|
+
</ThemeProvider>
|
|
274
|
+
);
|
|
275
|
+
}
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
## 🔧 Configuration
|
|
279
|
+
|
|
280
|
+
### TypeScript
|
|
281
|
+
|
|
282
|
+
```json
|
|
283
|
+
{
|
|
284
|
+
"compilerOptions": {
|
|
285
|
+
"paths": {
|
|
286
|
+
"@/*": ["./src/*"]
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
### Tailwind CSS
|
|
293
|
+
|
|
294
|
+
```js
|
|
295
|
+
// tailwind.config.js
|
|
296
|
+
export default {
|
|
297
|
+
content: [
|
|
298
|
+
"./index.html",
|
|
299
|
+
"./src/**/*.{js,ts,jsx,tsx}",
|
|
300
|
+
"./node_modules/formstack-ui/**/*.{js,ts,jsx,tsx}",
|
|
301
|
+
],
|
|
302
|
+
};
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
## 📖 Examples
|
|
306
|
+
|
|
307
|
+
Check out the `/examples` directory for:
|
|
308
|
+
|
|
309
|
+
- Basic form
|
|
310
|
+
- Multi-step wizard
|
|
311
|
+
- Dynamic fields
|
|
312
|
+
- File upload
|
|
313
|
+
- Async autocomplete
|
|
314
|
+
- Conditional logic
|
|
315
|
+
- Custom validation
|
|
316
|
+
|
|
317
|
+
## 🤝 Contributing
|
|
318
|
+
|
|
319
|
+
Contributions are welcome! Please read our [Contributing Guide](CONTRIBUTING.md) for details.
|
|
320
|
+
|
|
321
|
+
## 📄 License
|
|
322
|
+
|
|
323
|
+
MIT © Adarsh A
|
|
324
|
+
|
|
325
|
+
## 🙏 Acknowledgments
|
|
326
|
+
|
|
327
|
+
- Built with [React](https://reactjs.org/)
|
|
328
|
+
- Styled with [Tailwind CSS](https://tailwindcss.com/)
|
|
329
|
+
- Date pickers powered by Custom Native Components
|
|
330
|
+
- Validation with [Zod](https://zod.dev/)
|
|
331
|
+
|
|
332
|
+
## 🔗 Links
|
|
333
|
+
|
|
334
|
+
- [Documentation](https://adarshatl03.github.io/formstack-ui/)
|
|
335
|
+
- [GitHub](https://github.com/adarshatl03/formstack-ui)
|
|
336
|
+
- [NPM](https://www.npmjs.com/package/formstack-ui)
|
|
337
|
+
- [Demo](https://adarshatl03.github.io/formstack-ui/)
|
|
338
|
+
|
|
339
|
+
---
|
|
340
|
+
|
|
341
|
+
**Made with ❤️ by the FormStack UI team**
|