@conform-to/react 1.1.1 → 1.1.3

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 CHANGED
@@ -8,7 +8,7 @@
8
8
  ╚══════╝ ╚═════╝ ╚═╝ ╚══╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝
9
9
 
10
10
 
11
- Version 1.1.1 / License MIT / Copyright (c) 2024 Edmund Hung
11
+ Version 1.1.3 / License MIT / Copyright (c) 2024 Edmund Hung
12
12
 
13
13
  A type-safe form validation library utilizing web fundamentals to progressively enhance HTML Forms with full support for server frameworks like Remix and Next.js.
14
14
 
package/helpers.d.ts CHANGED
@@ -72,7 +72,7 @@ type TextareaOptions = Pretty<FormControlOptions & {
72
72
  /**
73
73
  * Decide whether defaultValue should be returned. Pass `false` if you want to mange the value yourself.
74
74
  */
75
- value?: true;
75
+ value?: boolean;
76
76
  }>;
77
77
  /**
78
78
  * Derives aria attributes of a form control based on the field metadata.
@@ -138,7 +138,7 @@ export declare function getFormControlProps<Schema>(metadata: FieldMetadata<Sche
138
138
  * <input {...getInputProps(metadata, { type: 'radio', value: false })} />
139
139
  * ```
140
140
  */
141
- export declare function getInputProps<Schema>(metadata: FieldMetadata<Schema, any, any>, options: InputOptions): InputProps;
141
+ export declare function getInputProps<Schema, Options extends InputOptions>(metadata: FieldMetadata<Schema, any, any>, options: Options): InputProps & Pick<Options, 'type'>;
142
142
  /**
143
143
  * Derives the properties of a select element based on the field metadata,
144
144
  * including common form control attributes like `key`, `id`, `name`, `form`, `autoFocus`, `aria-invalid`, `aria-describedby`
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "Conform view adapter for react",
4
4
  "homepage": "https://conform.guide",
5
5
  "license": "MIT",
6
- "version": "1.1.1",
6
+ "version": "1.1.3",
7
7
  "main": "index.js",
8
8
  "module": "index.mjs",
9
9
  "types": "index.d.ts",
@@ -16,6 +16,15 @@
16
16
  "default": "./index.mjs"
17
17
  }
18
18
  },
19
+ "scripts": {
20
+ "build:js": "rollup -c",
21
+ "build:ts": "tsc",
22
+ "build": "pnpm run \"/^build:.*/\"",
23
+ "dev:js": "pnpm run build:js --watch",
24
+ "dev:ts": "pnpm run build:ts --watch",
25
+ "dev": "pnpm run \"/^dev:.*/\"",
26
+ "prepare": "pnpm run build"
27
+ },
19
28
  "repository": {
20
29
  "type": "git",
21
30
  "url": "https://github.com/edmundhung/conform",
@@ -30,11 +39,19 @@
30
39
  "url": "https://github.com/edmundhung/conform/issues"
31
40
  },
32
41
  "dependencies": {
33
- "@conform-to/dom": "1.1.1"
42
+ "@conform-to/dom": "1.1.3"
34
43
  },
35
44
  "devDependencies": {
45
+ "@babel/core": "^7.17.8",
46
+ "@babel/preset-env": "^7.20.2",
47
+ "@babel/preset-react": "^7.18.6",
48
+ "@babel/preset-typescript": "^7.20.2",
49
+ "@rollup/plugin-babel": "^5.3.1",
50
+ "@rollup/plugin-node-resolve": "^13.3.0",
36
51
  "@types/react": "^18.2.43",
37
- "react": "^18.2.0"
52
+ "react": "^18.2.0",
53
+ "rollup-plugin-copy": "^3.4.0",
54
+ "rollup": "^2.79.1"
38
55
  },
39
56
  "peerDependencies": {
40
57
  "react": ">=18"
@@ -0,0 +1,102 @@
1
+ import path from 'node:path';
2
+ import babel from '@rollup/plugin-babel';
3
+ import nodeResolve from '@rollup/plugin-node-resolve';
4
+ import copy from 'rollup-plugin-copy';
5
+
6
+ /** @returns {import("rollup").RollupOptions[]} */
7
+ function configurePackage() {
8
+ let sourceDir = '.';
9
+ let outputDir = sourceDir;
10
+
11
+ /** @type {import("rollup").RollupOptions} */
12
+ let ESM = {
13
+ external(id) {
14
+ return !id.startsWith('.') && !path.isAbsolute(id);
15
+ },
16
+ input: `${sourceDir}/index.ts`,
17
+ output: {
18
+ dir: outputDir,
19
+ format: 'esm',
20
+ preserveModules: true,
21
+ entryFileNames: '[name].mjs',
22
+ },
23
+ plugins: [
24
+ babel({
25
+ babelrc: false,
26
+ configFile: false,
27
+ presets: [
28
+ [
29
+ '@babel/preset-env',
30
+ {
31
+ targets: {
32
+ node: '16',
33
+ esmodules: true,
34
+ },
35
+ },
36
+ ],
37
+ ['@babel/preset-react', { runtime: 'automatic' }],
38
+ '@babel/preset-typescript',
39
+ ],
40
+ plugins: [],
41
+ babelHelpers: 'bundled',
42
+ exclude: /node_modules/,
43
+ extensions: ['.ts', '.tsx'],
44
+ }),
45
+ nodeResolve({
46
+ extensions: ['.ts', '.tsx'],
47
+ }),
48
+ copy({
49
+ targets: [
50
+ { src: `../../README`, dest: sourceDir },
51
+ { src: `../../LICENSE`, dest: sourceDir },
52
+ ],
53
+ }),
54
+ ],
55
+ };
56
+
57
+ /** @type {import("rollup").RollupOptions} */
58
+ let CJS = {
59
+ external(id) {
60
+ return !id.startsWith('.') && !path.isAbsolute(id);
61
+ },
62
+ input: `${sourceDir}/index.ts`,
63
+ output: {
64
+ dir: outputDir,
65
+ format: 'cjs',
66
+ preserveModules: true,
67
+ exports: 'auto',
68
+ },
69
+ plugins: [
70
+ babel({
71
+ babelrc: false,
72
+ configFile: false,
73
+ presets: [
74
+ [
75
+ '@babel/preset-env',
76
+ {
77
+ targets: {
78
+ node: '16',
79
+ esmodules: true,
80
+ },
81
+ },
82
+ ],
83
+ ['@babel/preset-react', { runtime: 'automatic' }],
84
+ '@babel/preset-typescript',
85
+ ],
86
+ plugins: [],
87
+ babelHelpers: 'bundled',
88
+ exclude: /node_modules/,
89
+ extensions: ['.ts', '.tsx'],
90
+ }),
91
+ nodeResolve({
92
+ extensions: ['.ts', '.tsx'],
93
+ }),
94
+ ],
95
+ };
96
+
97
+ return [ESM, CJS];
98
+ }
99
+
100
+ export default function rollup() {
101
+ return configurePackage();
102
+ }