remix-validated-form 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. package/.eslintignore +1 -0
  2. package/.eslintrc.js +46 -0
  3. package/.github/workflows/test.yml +35 -0
  4. package/.husky/pre-commit +4 -0
  5. package/.prettierignore +8 -0
  6. package/LICENSE +21 -0
  7. package/README.md +3 -0
  8. package/jest.config.js +5 -0
  9. package/package.json +73 -0
  10. package/src/ValidatedForm.tsx +130 -0
  11. package/src/hooks.ts +27 -0
  12. package/src/index.ts +5 -0
  13. package/src/internal/formContext.ts +18 -0
  14. package/src/internal/util.ts +23 -0
  15. package/src/server.ts +5 -0
  16. package/src/validation/types.ts +12 -0
  17. package/src/validation/validation.test.ts +76 -0
  18. package/src/validation/withYup.ts +37 -0
  19. package/test-app/README.md +53 -0
  20. package/test-app/app/components/Input.tsx +24 -0
  21. package/test-app/app/components/SubmitButton.tsx +18 -0
  22. package/test-app/app/entry.client.tsx +4 -0
  23. package/test-app/app/entry.server.tsx +21 -0
  24. package/test-app/app/root.tsx +246 -0
  25. package/test-app/app/routes/default-values.tsx +34 -0
  26. package/test-app/app/routes/index.tsx +100 -0
  27. package/test-app/app/routes/noscript.tsx +10 -0
  28. package/test-app/app/routes/submission.alt.tsx +6 -0
  29. package/test-app/app/routes/submission.fetcher.tsx +6 -0
  30. package/test-app/app/routes/submission.tsx +47 -0
  31. package/test-app/app/routes/validation.tsx +40 -0
  32. package/test-app/app/styles/dark.css +7 -0
  33. package/test-app/app/styles/demos/about.css +26 -0
  34. package/test-app/app/styles/demos/remix.css +120 -0
  35. package/test-app/app/styles/global.css +98 -0
  36. package/test-app/cypress/fixtures/example.json +5 -0
  37. package/test-app/cypress/integration/default-values.ts +15 -0
  38. package/test-app/cypress/integration/sanity.ts +19 -0
  39. package/test-app/cypress/integration/submission.ts +26 -0
  40. package/test-app/cypress/integration/validation.ts +70 -0
  41. package/test-app/cypress/plugins/config.ts +38 -0
  42. package/test-app/cypress/plugins/index.ts +9 -0
  43. package/test-app/cypress/support/commands/index.ts +13 -0
  44. package/test-app/cypress/support/commands/types.d.ts +11 -0
  45. package/test-app/cypress/support/index.ts +20 -0
  46. package/test-app/cypress/tsconfig.json +11 -0
  47. package/test-app/cypress.json +3 -0
  48. package/test-app/package-lock.json +11675 -0
  49. package/test-app/package.json +40 -0
  50. package/test-app/public/favicon.ico +0 -0
  51. package/test-app/remix.config.js +10 -0
  52. package/test-app/remix.env.d.ts +2 -0
  53. package/test-app/tsconfig.json +18 -0
  54. package/tsconfig.json +15 -0
@@ -0,0 +1,40 @@
1
+ {
2
+ "private": true,
3
+ "name": "remix-app-template",
4
+ "description": "",
5
+ "license": "",
6
+ "scripts": {
7
+ "build": "remix build",
8
+ "dev": "start-server-and-test dev:remix http-get://localhost:3000 cy:open",
9
+ "test": "start-server-and-test dev:remix http-get://localhost:3000 cy:run",
10
+ "dev:remix": "remix dev",
11
+ "cy:open": "cypress open",
12
+ "cy:run": "cypress run",
13
+ "postinstall": "remix setup node",
14
+ "start": "remix-serve build"
15
+ },
16
+ "dependencies": {
17
+ "@remix-run/react": "^1.0.5",
18
+ "@remix-run/serve": "^1.0.5",
19
+ "@remix-run/server-runtime": "^1.0.5",
20
+ "react": "^17.0.2",
21
+ "react-dom": "^17.0.2",
22
+ "remix": "^1.0.5",
23
+ "yup": "^0.32.11"
24
+ },
25
+ "devDependencies": {
26
+ "@remix-run/dev": "^1.0.5",
27
+ "@testing-library/cypress": "^8.0.2",
28
+ "@types/react": "^17.0.24",
29
+ "@types/react-dom": "^17.0.9",
30
+ "cypress": "^9.1.0",
31
+ "har-validator": "^5.1.5",
32
+ "start-server-and-test": "^1.14.0",
33
+ "tiny-invariant": "^1.2.0",
34
+ "typescript": "^4.1.2"
35
+ },
36
+ "engines": {
37
+ "node": ">=14"
38
+ },
39
+ "sideEffects": false
40
+ }
Binary file
@@ -0,0 +1,10 @@
1
+ /**
2
+ * @type {import('@remix-run/dev/config').AppConfig}
3
+ */
4
+ module.exports = {
5
+ appDirectory: "app",
6
+ browserBuildDirectory: "public/build",
7
+ publicPath: "/build/",
8
+ serverBuildDirectory: "build",
9
+ devServerPort: 8002,
10
+ };
@@ -0,0 +1,2 @@
1
+ /// <reference types="@remix-run/dev" />
2
+ /// <reference types="@remix-run/node/globals" />
@@ -0,0 +1,18 @@
1
+ {
2
+ "include": ["remix.env.d.ts", "**/*.ts", "**/*.tsx"],
3
+ "compilerOptions": {
4
+ "lib": ["DOM", "DOM.Iterable", "ES2019"],
5
+ "esModuleInterop": true,
6
+ "jsx": "react-jsx",
7
+ "moduleResolution": "node",
8
+ "resolveJsonModule": true,
9
+ "target": "ES2019",
10
+ "strict": true,
11
+ "paths": {
12
+ "~/*": ["./app/*"]
13
+ },
14
+
15
+ // Remix takes care of building everything in `remix build`.
16
+ "noEmit": true
17
+ }
18
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,15 @@
1
+ {
2
+ "compilerOptions": {
3
+ "allowJs": true,
4
+ "lib": ["DOM", "DOM.Iterable", "ES2019"],
5
+ "esModuleInterop": true,
6
+ "moduleResolution": "Node",
7
+ "target": "ES2019",
8
+ "strict": true,
9
+ "skipLibCheck": true,
10
+ "declaration": true,
11
+ "jsx": "react-jsx"
12
+ },
13
+ "exclude": ["node_modules"],
14
+ "include": ["src/**/*.ts", "src/**/*.tsx"]
15
+ }