react-f0rm 0.1.0 → 0.2.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/package.json CHANGED
@@ -1,27 +1,41 @@
1
1
  {
2
2
  "name": "react-f0rm",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
+ "packageManager": "pnpm@11.4.0",
4
5
  "description": "react form",
5
6
  "main": "dist/index.cjs.js",
6
7
  "module": "dist/index.esm.js",
7
- "browser": "dist/index.esm.js",
8
8
  "unpkg": "dist/index.umd.min.js",
9
- "types": "index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "import": "./dist/index.esm.js",
12
+ "require": "./dist/index.cjs.js"
13
+ },
14
+ "./resolvers/zod": "./dist/resolvers/zod.js",
15
+ "./resolvers/yup": "./dist/resolvers/yup.js"
16
+ },
17
+ "types": "dist/index.d.ts",
10
18
  "files": [
11
- "dist",
12
- "*.d.ts"
19
+ "dist"
13
20
  ],
14
21
  "sideEffects": false,
15
22
  "scripts": {
16
- "start": "npm test -- --watch",
23
+ "start": "vitest --watch",
17
24
  "commit": "lint-staged && git-cz -n",
18
25
  "build": "npm run clean && cross-env NODE_ENV=production rollup -c",
19
26
  "prepublishOnly": "rimraf dist && npm run build",
20
- "coverage": "nyc report --reporter=text-lcov | coveralls",
21
- "test": "cross-env NODE_ENV=test nyc mocha",
27
+ "coverage": "vitest run --coverage",
28
+ "test": "vitest run",
29
+ "test:watch": "vitest",
30
+ "test:ui": "vitest --ui",
22
31
  "clean": "rimraf dist node_modules/.cache",
23
- "lint:fix": "eslint --fix src/",
24
- "lint": "eslint src/"
32
+ "lint:fix": "eslint --fix .",
33
+ "lint": "eslint .",
34
+ "storybook": "storybook dev -p 6006",
35
+ "build-storybook": "storybook build",
36
+ "size": "size-limit",
37
+ "docs:build": "cd docs-site && npm run build",
38
+ "docs:deploy": "cd docs-site && npm run deploy"
25
39
  },
26
40
  "repository": {
27
41
  "type": "git",
@@ -42,43 +56,66 @@
42
56
  "react": ">=16.8.0"
43
57
  },
44
58
  "devDependencies": {
45
- "@babel/core": "^7.12.16",
46
- "@babel/preset-env": "^7.12.16",
47
- "@babel/preset-react": "^7.12.13",
48
- "@babel/register": "^7.12.13",
49
- "@rollup/plugin-babel": "^5.3.0",
50
- "@rollup/plugin-commonjs": "^17.1.0",
51
- "@rollup/plugin-node-resolve": "^11.2.0",
52
- "@rollup/plugin-replace": "^2.3.4",
53
- "@types/react": "^17.0.2",
54
- "babel-eslint": "^10.1.0",
55
- "commitizen": "^4.2.3",
56
- "coveralls": "^3.1.0",
59
+ "@babel/core": "^7.22.8",
60
+ "@babel/eslint-parser": "^7.22.7",
61
+ "@babel/preset-env": "^7.22.7",
62
+ "@babel/preset-react": "^7.22.5",
63
+ "@babel/register": "^7.22.5",
64
+ "@rollup/plugin-babel": "^6.0.3",
65
+ "@rollup/plugin-commonjs": "^25.0.2",
66
+ "@rollup/plugin-node-resolve": "^15.1.0",
67
+ "@rollup/plugin-replace": "^5.0.2",
68
+ "@rollup/plugin-terser": "^0.4.3",
69
+ "@size-limit/preset-small-lib": "^12.1.0",
70
+ "@storybook/addon-docs": "^10.4.1",
71
+ "@storybook/addon-links": "^10.4.1",
72
+ "@storybook/react": "^10.4.1",
73
+ "@storybook/react-vite": "^10.4.1",
74
+ "@testing-library/dom": "^10.4.1",
75
+ "@testing-library/jest-dom": "^6.9.1",
76
+ "@testing-library/react": "^16.3.2",
77
+ "@testing-library/user-event": "^14.6.1",
78
+ "@types/react": "^18.2.14",
79
+ "@typescript-eslint/eslint-plugin": "^8.60.0",
80
+ "@typescript-eslint/parser": "^8.60.0",
81
+ "@vitest/coverage-v8": "^3.0.0",
82
+ "@vitest/ui": "^3.0.0",
83
+ "babel-loader": "^9.1.3",
84
+ "commitizen": "^4.3.0",
57
85
  "cross-env": "^7.0.3",
58
- "eslint": "^7.20.0",
59
- "eslint-config-airbnb": "^18.2.1",
60
- "eslint-config-prettier": "^7.2.0",
86
+ "eslint": "^8.44.0",
87
+ "eslint-config-airbnb": "^19.0.4",
88
+ "eslint-config-prettier": "^10.1.8",
89
+ "eslint-import-resolver-typescript": "^4.4.4",
61
90
  "eslint-plugin-builtin-compat": "0.0.2",
62
- "eslint-plugin-import": "^2.22.1",
63
- "eslint-plugin-jsx-a11y": "^6.4.1",
64
- "eslint-plugin-mocha": "^8.0.0",
65
- "eslint-plugin-prettier": "^3.3.1",
66
- "eslint-plugin-react": "^7.22.0",
67
- "eslint-plugin-react-hooks": "^4.2.0",
68
- "husky": "^5.0.9",
69
- "lint-staged": "^10.5.4",
70
- "mocha": "^8.3.0",
71
- "nyc": "^15.1.0",
72
- "prettier": "^2.2.1",
73
- "react": "^17.0.1",
74
- "rimraf": "^3.0.2",
75
- "rollup": "^2.39.0",
76
- "rollup-plugin-terser": "^7.0.2",
77
- "should": "^13.2.3",
78
- "should-sinon": "0.0.6",
79
- "typescript": "^4.1.5"
91
+ "eslint-plugin-import": "^2.27.5",
92
+ "eslint-plugin-jsx-a11y": "^6.7.1",
93
+ "eslint-plugin-prettier": "^5.5.5",
94
+ "eslint-plugin-react": "^7.32.2",
95
+ "eslint-plugin-react-hooks": "^4.6.0",
96
+ "eslint-plugin-storybook": "^10.4.1",
97
+ "eslint-plugin-vitest": "^0.5.4",
98
+ "husky": "^8.0.3",
99
+ "jsdom": "^24.0.0",
100
+ "lint-staged": "^13.2.3",
101
+ "prettier": "^3.0.0",
102
+ "react": "^18.2.0",
103
+ "react-dom": "^18.2.0",
104
+ "rimraf": "^5.0.1",
105
+ "rollup": "^3.26.2",
106
+ "rollup-plugin-esbuild": "^6.2.1",
107
+ "size-limit": "^12.1.0",
108
+ "storybook": "^10.4.1",
109
+ "typescript": "^5.1.6",
110
+ "vitest": "^3.0.0"
80
111
  },
81
112
  "dependencies": {
82
- "@for-fun/event-emitter": "^0.1.1"
83
- }
113
+ "@for-fun/event-emitter": "^1.0.0"
114
+ },
115
+ "size-limit": [
116
+ {
117
+ "path": "dist/index.esm.js",
118
+ "limit": "10 KB"
119
+ }
120
+ ]
84
121
  }
package/index.d.ts DELETED
@@ -1,22 +0,0 @@
1
- export type Form<T=any> = {
2
- emitter: import('@for-fun/event-emitter').EventEmitter;
3
- validatingCount: number;
4
- defaultValues?: T;
5
- values: Map<string, any>;
6
- errors: Map<string, string>;
7
- touched: Set<string>;
8
- }
9
-
10
- export type Paths = (string | number)[];
11
-
12
- export type TaskCounter = {
13
- emitter: import('@for-fun/event-emitter').EventEmitter;
14
- count: number;
15
- };
16
-
17
- export type FormProps<T> = {
18
- form?: Form<T>;
19
- onSubmit?(values: T, e): void;
20
- onValidSubmit?(values: T, e): void;
21
- onInvalidSubmit?(values: T, e): void;
22
- }