@conform-to/react 0.8.0-pre.2 → 0.8.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/README.md +6 -6
- package/hooks.js +1 -0
- package/hooks.mjs +1 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -270,7 +270,7 @@ function Example() {
|
|
|
270
270
|
))}
|
|
271
271
|
|
|
272
272
|
{/* Setup a button that can append a new row with optional default value */}
|
|
273
|
-
<button {...list.
|
|
273
|
+
<button {...list.insert(items.name, { defaultValue: '' })}>add</button>
|
|
274
274
|
</fieldset>
|
|
275
275
|
);
|
|
276
276
|
}
|
|
@@ -502,11 +502,11 @@ import { list } from '@conform-to/react';
|
|
|
502
502
|
function Example() {
|
|
503
503
|
return (
|
|
504
504
|
<form>
|
|
505
|
-
{/*
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
<button {...list.
|
|
505
|
+
{/*
|
|
506
|
+
To insert a new row with optional defaultValue at a given index.
|
|
507
|
+
If no index is given, then the element will be appended at the end of the list.
|
|
508
|
+
*/}
|
|
509
|
+
<button {...list.insert('name', { index, defaultValue })}>Insert</button>
|
|
510
510
|
|
|
511
511
|
{/* To remove a row by index */}
|
|
512
512
|
<button {...list.remove('name', { index })}>Remove</button>
|
package/hooks.js
CHANGED
|
@@ -374,6 +374,7 @@ function useFieldList(ref, config) {
|
|
|
374
374
|
switch (intent.payload.operation) {
|
|
375
375
|
case 'append':
|
|
376
376
|
case 'prepend':
|
|
377
|
+
case 'insert':
|
|
377
378
|
case 'replace':
|
|
378
379
|
return dom.updateList(list, _rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, intent.payload), {}, {
|
|
379
380
|
defaultValue: [
|
package/hooks.mjs
CHANGED
|
@@ -370,6 +370,7 @@ function useFieldList(ref, config) {
|
|
|
370
370
|
switch (intent.payload.operation) {
|
|
371
371
|
case 'append':
|
|
372
372
|
case 'prepend':
|
|
373
|
+
case 'insert':
|
|
373
374
|
case 'replace':
|
|
374
375
|
return updateList(list, _objectSpread2(_objectSpread2({}, intent.payload), {}, {
|
|
375
376
|
defaultValue: [
|
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": "0.8.
|
|
6
|
+
"version": "0.8.1",
|
|
7
7
|
"main": "index.js",
|
|
8
8
|
"module": "index.mjs",
|
|
9
9
|
"types": "index.d.ts",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"url": "https://github.com/edmundhung/conform/issues"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@conform-to/dom": "0.8.
|
|
33
|
+
"@conform-to/dom": "0.8.1"
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
36
|
"react": ">=16.8"
|