@conform-to/react 0.3.1 → 0.4.0-pre.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/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- export { type FormState, type FieldsetConstraint, type Schema, type Submission, createSubmission, createValidate, } from '@conform-to/dom';
1
+ export { type FieldsetConstraint, type FormState, type Submission, hasError, isFieldElement, parse, reportValidity, } from '@conform-to/dom';
2
2
  export * from './hooks';
3
3
  export * as conform from './helpers';
package/index.js CHANGED
@@ -8,13 +8,21 @@ var helpers = require('./helpers.js');
8
8
 
9
9
 
10
10
 
11
- Object.defineProperty(exports, 'createSubmission', {
11
+ Object.defineProperty(exports, 'hasError', {
12
12
  enumerable: true,
13
- get: function () { return dom.createSubmission; }
13
+ get: function () { return dom.hasError; }
14
14
  });
15
- Object.defineProperty(exports, 'createValidate', {
15
+ Object.defineProperty(exports, 'isFieldElement', {
16
16
  enumerable: true,
17
- get: function () { return dom.createValidate; }
17
+ get: function () { return dom.isFieldElement; }
18
+ });
19
+ Object.defineProperty(exports, 'parse', {
20
+ enumerable: true,
21
+ get: function () { return dom.parse; }
22
+ });
23
+ Object.defineProperty(exports, 'reportValidity', {
24
+ enumerable: true,
25
+ get: function () { return dom.reportValidity; }
18
26
  });
19
27
  exports.useControlledInput = hooks.useControlledInput;
20
28
  exports.useFieldList = hooks.useFieldList;
package/module/helpers.js CHANGED
@@ -18,7 +18,7 @@ function input(config) {
18
18
  multiple: config.multiple
19
19
  };
20
20
 
21
- if (typeof config.initialError !== 'undefined') {
21
+ if (config.initialError && config.initialError.length > 0) {
22
22
  attributes.autoFocus = true;
23
23
  }
24
24
 
@@ -39,11 +39,10 @@ function select(config) {
39
39
  form: config.form,
40
40
  defaultValue: config.multiple ? Array.isArray(config.defaultValue) ? config.defaultValue : [] : "".concat((_config$defaultValue = config.defaultValue) !== null && _config$defaultValue !== void 0 ? _config$defaultValue : ''),
41
41
  required: config.required,
42
- multiple: config.multiple,
43
- autoFocus: typeof config.initialError !== 'undefined' ? Boolean(config.initialError) : undefined
42
+ multiple: config.multiple
44
43
  };
45
44
 
46
- if (typeof config.initialError !== 'undefined') {
45
+ if (config.initialError && config.initialError.length > 0) {
47
46
  attributes.autoFocus = true;
48
47
  }
49
48
 
@@ -62,7 +61,7 @@ function textarea(config) {
62
61
  autoFocus: Boolean(config.initialError)
63
62
  };
64
63
 
65
- if (typeof config.initialError !== 'undefined') {
64
+ if (config.initialError && config.initialError.length > 0) {
66
65
  attributes.autoFocus = true;
67
66
  }
68
67