@wizzard-packages/adapter-zod 0.1.0 → 0.1.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/LICENSE +1 -1
- package/README.md +53 -0
- package/package.json +11 -2
package/LICENSE
CHANGED
package/README.md
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# @wizzard-packages/adapter-zod
|
|
2
|
+
|
|
3
|
+

|
|
4
|
+

|
|
5
|
+

|
|
6
|
+
|
|
7
|
+
Zod validation adapter for Wizzard Stepper. Pair it with @wizzard-packages/react or your own core-driven UI.
|
|
8
|
+
|
|
9
|
+
## Install
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
pnpm add @wizzard-packages/adapter-zod zod
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Usage with React
|
|
16
|
+
|
|
17
|
+
```tsx
|
|
18
|
+
import { createWizardFactory } from '@wizzard-packages/react';
|
|
19
|
+
import { ZodAdapter } from '@wizzard-packages/adapter-zod';
|
|
20
|
+
import { z } from 'zod';
|
|
21
|
+
|
|
22
|
+
type Data = { name: string };
|
|
23
|
+
|
|
24
|
+
type StepId = 'name' | 'review';
|
|
25
|
+
|
|
26
|
+
const schema = z.object({ name: z.string().min(1) });
|
|
27
|
+
|
|
28
|
+
const { WizardProvider, createStep } = createWizardFactory<Data, StepId>();
|
|
29
|
+
|
|
30
|
+
const steps = [
|
|
31
|
+
createStep({
|
|
32
|
+
id: 'name',
|
|
33
|
+
label: 'Name',
|
|
34
|
+
component: NameStep,
|
|
35
|
+
validationAdapter: new ZodAdapter(schema),
|
|
36
|
+
}),
|
|
37
|
+
];
|
|
38
|
+
|
|
39
|
+
export function App() {
|
|
40
|
+
return <WizardProvider config={{ steps }} initialData={{ name: '' }} />;
|
|
41
|
+
}
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Fits in the stack
|
|
45
|
+
|
|
46
|
+
- Core engine: @wizzard-packages/core
|
|
47
|
+
- React bindings: @wizzard-packages/react
|
|
48
|
+
- Alternative validation: @wizzard-packages/adapter-yup
|
|
49
|
+
|
|
50
|
+
## Links
|
|
51
|
+
|
|
52
|
+
- Repo: https://github.com/ZizzX/wizzard-packages
|
|
53
|
+
- Docs UI: https://zizzx.github.io/wizzard-packages/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wizzard-packages/adapter-zod",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Zod validation adapter for Wizzard Stepper.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -24,8 +24,17 @@
|
|
|
24
24
|
"require": "./dist/index.cjs"
|
|
25
25
|
}
|
|
26
26
|
},
|
|
27
|
+
"keywords": [
|
|
28
|
+
"wizard",
|
|
29
|
+
"stepper",
|
|
30
|
+
"validation",
|
|
31
|
+
"zod",
|
|
32
|
+
"adapter",
|
|
33
|
+
"form"
|
|
34
|
+
],
|
|
35
|
+
"license": "MIT",
|
|
27
36
|
"dependencies": {
|
|
28
|
-
"@wizzard-packages/core": "0.1.
|
|
37
|
+
"@wizzard-packages/core": "0.1.1"
|
|
29
38
|
},
|
|
30
39
|
"devDependencies": {
|
|
31
40
|
"tsup": "^8.3.5",
|