aw-wizard-forms 3.0.0
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 +189 -0
- package/dist/wizard-form.esm.js +5306 -0
- package/dist/wizard-form.esm.js.map +1 -0
- package/dist/wizard-form.min.js +1253 -0
- package/dist/wizard-form.min.js.map +1 -0
- package/package.json +94 -0
package/README.md
ADDED
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
# aw-wizard-forms
|
|
2
|
+
|
|
3
|
+
A lightweight, Typeform-style multi-step form wizard built with Lit Web Components.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **Lightweight**: ~15KB (Brotli) / ~18KB (gzip) including Lit
|
|
8
|
+
- **Single Script Tag**: Easy embedding with `WizardForm.init()`
|
|
9
|
+
- **Declarative Components**: HTML-based composition with custom elements
|
|
10
|
+
- **Keyboard Navigation**: A-Z badges, Enter/Escape, arrow keys
|
|
11
|
+
- **Validation**: Debounced validation with custom validators
|
|
12
|
+
- **Theming**: CSS Custom Properties (`--wf-*` prefix)
|
|
13
|
+
- **Adapters**: HubSpot, Webhook, RevenueHero integrations
|
|
14
|
+
|
|
15
|
+
## Installation
|
|
16
|
+
|
|
17
|
+
### CDN (Recommended)
|
|
18
|
+
|
|
19
|
+
```html
|
|
20
|
+
<script src="https://unpkg.com/aw-wizard-forms@3/dist/wizard-form.min.js"></script>
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
### Yarn / NPM
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
yarn add aw-wizard-forms
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Quick Start
|
|
30
|
+
|
|
31
|
+
```html
|
|
32
|
+
<wizard-form id="demo-form">
|
|
33
|
+
<wf-step data-step="1">
|
|
34
|
+
<wf-input name="fullName" label="Full Name" required></wf-input>
|
|
35
|
+
<wf-email name="email" label="Email" work-email required></wf-email>
|
|
36
|
+
</wf-step>
|
|
37
|
+
|
|
38
|
+
<wf-step data-step="2">
|
|
39
|
+
<wf-options name="companySize" required>
|
|
40
|
+
<wf-option value="1-10">1-10 employees</wf-option>
|
|
41
|
+
<wf-option value="11-50">11-50 employees</wf-option>
|
|
42
|
+
<wf-option value="51+">51+ employees</wf-option>
|
|
43
|
+
</wf-options>
|
|
44
|
+
</wf-step>
|
|
45
|
+
|
|
46
|
+
<div slot="success">
|
|
47
|
+
<h2>Thank you!</h2>
|
|
48
|
+
<p>We'll be in touch soon.</p>
|
|
49
|
+
</div>
|
|
50
|
+
</wizard-form>
|
|
51
|
+
|
|
52
|
+
<script>
|
|
53
|
+
WizardForm.init({
|
|
54
|
+
container: '#demo-form',
|
|
55
|
+
adapter: 'hubspot',
|
|
56
|
+
hubspot: {
|
|
57
|
+
portalId: '12345',
|
|
58
|
+
formId: 'abc-123',
|
|
59
|
+
},
|
|
60
|
+
onSubmit: (data) => console.log('Submitted:', data),
|
|
61
|
+
onSuccess: () => console.log('Success!'),
|
|
62
|
+
onError: (err) => console.error('Error:', err),
|
|
63
|
+
});
|
|
64
|
+
</script>
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Components
|
|
68
|
+
|
|
69
|
+
| Component | Description |
|
|
70
|
+
|-----------|-------------|
|
|
71
|
+
| `<wizard-form>` | Main container/orchestrator |
|
|
72
|
+
| `<wf-step>` | Step container (use `data-step="N"`) |
|
|
73
|
+
| `<wf-input>` | Text input with validation |
|
|
74
|
+
| `<wf-number>` | Number input with min/max/step |
|
|
75
|
+
| `<wf-email>` | Email input with work-email validation |
|
|
76
|
+
| `<wf-textarea>` | Multiline text input |
|
|
77
|
+
| `<wf-options>` | Radio/checkbox option group |
|
|
78
|
+
| `<wf-option>` | Individual option card |
|
|
79
|
+
|
|
80
|
+
## Adapters
|
|
81
|
+
|
|
82
|
+
### HubSpot
|
|
83
|
+
|
|
84
|
+
```javascript
|
|
85
|
+
WizardForm.init({
|
|
86
|
+
container: '#form',
|
|
87
|
+
adapter: 'hubspot',
|
|
88
|
+
hubspot: {
|
|
89
|
+
portalId: '12345',
|
|
90
|
+
formId: 'abc-123',
|
|
91
|
+
fieldMapping: {
|
|
92
|
+
fullName: 'firstname', // Map form fields to HubSpot fields
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
});
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### Webhook
|
|
99
|
+
|
|
100
|
+
```javascript
|
|
101
|
+
WizardForm.init({
|
|
102
|
+
container: '#form',
|
|
103
|
+
adapter: 'webhook',
|
|
104
|
+
webhook: {
|
|
105
|
+
url: 'https://api.example.com/submit',
|
|
106
|
+
method: 'POST',
|
|
107
|
+
headers: {
|
|
108
|
+
'X-API-Key': 'your-key',
|
|
109
|
+
},
|
|
110
|
+
},
|
|
111
|
+
});
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### RevenueHero
|
|
115
|
+
|
|
116
|
+
```javascript
|
|
117
|
+
WizardForm.init({
|
|
118
|
+
container: '#form',
|
|
119
|
+
adapter: 'revenuehero',
|
|
120
|
+
revenuehero: {
|
|
121
|
+
routerId: 'your-router-id',
|
|
122
|
+
},
|
|
123
|
+
});
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
## Theming
|
|
127
|
+
|
|
128
|
+
Customize with CSS Custom Properties:
|
|
129
|
+
|
|
130
|
+
```css
|
|
131
|
+
wizard-form {
|
|
132
|
+
--wf-color-primary: #8b5cf6;
|
|
133
|
+
--wf-color-surface: #f8f9fa;
|
|
134
|
+
--wf-color-text: #212529;
|
|
135
|
+
--wf-color-error: #dc3545;
|
|
136
|
+
--wf-radius-lg: 12px;
|
|
137
|
+
--wf-font-size-base: 16px;
|
|
138
|
+
}
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
## Keyboard Shortcuts
|
|
142
|
+
|
|
143
|
+
| Key | Action |
|
|
144
|
+
|-----|--------|
|
|
145
|
+
| A-Z | Select option by badge |
|
|
146
|
+
| Enter | Next step / Submit |
|
|
147
|
+
| Escape | Previous step |
|
|
148
|
+
| ↑/↓ | Navigate options |
|
|
149
|
+
| Tab | Navigate fields |
|
|
150
|
+
|
|
151
|
+
## Development
|
|
152
|
+
|
|
153
|
+
```bash
|
|
154
|
+
# Install dependencies
|
|
155
|
+
yarn
|
|
156
|
+
|
|
157
|
+
# Development server
|
|
158
|
+
yarn dev
|
|
159
|
+
|
|
160
|
+
# Run tests
|
|
161
|
+
yarn test # Unit tests (Vitest)
|
|
162
|
+
yarn test:e2e # E2E tests (Playwright)
|
|
163
|
+
|
|
164
|
+
# Build
|
|
165
|
+
yarn build
|
|
166
|
+
|
|
167
|
+
# Check bundle size
|
|
168
|
+
yarn size
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
## Bundle Size
|
|
172
|
+
|
|
173
|
+
| Compression | Size |
|
|
174
|
+
|-------------|------|
|
|
175
|
+
| Raw | 78KB |
|
|
176
|
+
| Gzip | 17.7KB |
|
|
177
|
+
| **Brotli** | **15.5KB** |
|
|
178
|
+
|
|
179
|
+
## Browser Support
|
|
180
|
+
|
|
181
|
+
Modern browsers (ES2020+):
|
|
182
|
+
- Chrome 80+
|
|
183
|
+
- Firefox 78+
|
|
184
|
+
- Safari 14+
|
|
185
|
+
- Edge 80+
|
|
186
|
+
|
|
187
|
+
## License
|
|
188
|
+
|
|
189
|
+
MIT © [Atomicwork](https://atomicwork.com)
|