@conform-to/react 1.17.1 → 1.19.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.
@@ -1,4 +1,4 @@
1
- import type { FormError } from '@conform-to/dom/future';
1
+ import type { CustomSerialize, FormError, Serialize } from '@conform-to/dom/future';
2
2
  import type { StandardSchemaV1 } from './standard-schema';
3
3
  import { ValidateHandler, ValidateResult, BaseFieldMetadata, ConditionalFieldMetadata } from './types';
4
4
  export declare function isUndefined(value: unknown): value is undefined;
@@ -6,22 +6,18 @@ export declare function isString(value: unknown): value is string;
6
6
  export declare function isNumber(value: unknown): value is number;
7
7
  export declare function isNullable<T>(value: unknown, typeGuard: (value: unknown) => value is T): value is T | null;
8
8
  export declare function isOptional<T>(value: unknown, typeGuard: (value: unknown) => value is T): value is T | undefined;
9
- export declare function getArrayAtPath<Type>(formValue: Record<string, Type> | null, name: string): Array<Type>;
9
+ export declare function getPathArray<Type>(formValue: Record<string, Type> | null, name: string): Array<Type>;
10
10
  /**
11
11
  * Immutably updates a value at the specified path.
12
12
  * Empty path replaces the entire object.
13
13
  */
14
- export declare function updateValueAtPath<Data>(data: Record<string, Data>, name: string, value: Data | Record<string, Data>): Record<string, Data>;
14
+ export declare function updatePathValue<Data>(data: Record<string, Data>, name: string, value: Data | Record<string, Data>): Record<string, Data>;
15
15
  /**
16
16
  * Creates a function that updates array indices in field paths.
17
17
  * Returns null to remove fields, or updated path with new index.
18
18
  */
19
19
  export declare function createPathIndexUpdater(listName: string, update: (index: number) => number | null): (name: string) => string | null;
20
- /**
21
- * Returns null if error object has no actual error messages,
22
- * otherwise returns the error as-is.
23
- */
24
- export declare function normalizeFormError<ErrorShape>(error: FormError<ErrorShape> | null): FormError<ErrorShape> | null;
20
+ export declare function resolveSerialize(customSerialize: CustomSerialize | undefined, defaultSerialize: Serialize): Serialize;
25
21
  export declare function normalizeValidateResult<ErrorShape, Value>(result: ValidateResult<ErrorShape, Value>): {
26
22
  error: FormError<ErrorShape> | null;
27
23
  value?: Value;
@@ -46,7 +42,7 @@ export declare function resolveValidateResult<ErrorShape, Value>(result: ReturnT
46
42
  * Resolves a StandardSchema validation result to conform's format.
47
43
  */
48
44
  export declare function resolveStandardSchemaResult<Value>(result: StandardSchemaV1.Result<Value>): {
49
- error: FormError<string> | null;
45
+ error: FormError<string[]> | null;
50
46
  value?: Value;
51
47
  };
52
48
  /**
@@ -79,14 +75,14 @@ export declare function generateUniqueKey(): string;
79
75
  * - `isError`: Specify the error shape for type inference
80
76
  * - `when`: Narrow field metadata to specific shapes for conditional props
81
77
  *
82
- * @example Specify error shape
78
+ * **Example: Specify error shape**
83
79
  * ```ts
84
80
  * configureForms({
85
- * isError: shape<string>(), // errors are strings
81
+ * isError: shape<string[]>(), // errors are string arrays
86
82
  * });
87
83
  * ```
88
84
  *
89
- * @example Conditional field metadata
85
+ * **Example: Conditional field metadata**
90
86
  * ```ts
91
87
  * extendFieldMetadata(metadata, { when }) {
92
88
  * return {
@@ -19,9 +19,9 @@ function isNullable(value, typeGuard) {
19
19
  function isOptional(value, typeGuard) {
20
20
  return isUndefined(value) || typeGuard(value);
21
21
  }
22
- function getArrayAtPath(formValue, name) {
23
- var _getValueAtPath;
24
- var value = (_getValueAtPath = future.getValueAtPath(formValue, name)) !== null && _getValueAtPath !== void 0 ? _getValueAtPath : [];
22
+ function getPathArray(formValue, name) {
23
+ var _getPathValue;
24
+ var value = (_getPathValue = future.getPathValue(formValue, name)) !== null && _getPathValue !== void 0 ? _getPathValue : [];
25
25
  if (!Array.isArray(value)) {
26
26
  throw new Error("The value of \"".concat(name, "\" is not an array"));
27
27
  }
@@ -32,14 +32,14 @@ function getArrayAtPath(formValue, name) {
32
32
  * Immutably updates a value at the specified path.
33
33
  * Empty path replaces the entire object.
34
34
  */
35
- function updateValueAtPath(data, name, value) {
35
+ function updatePathValue(data, name, value) {
36
36
  if (name === '') {
37
37
  if (!future.isPlainObject(value)) {
38
38
  throw new Error('The value must be an object');
39
39
  }
40
40
  return value;
41
41
  }
42
- return future.setValueAtPath(data, future.getPathSegments(name), value, {
42
+ return future.setPathValue(data, future.parsePath(name), value, {
43
43
  clone: true
44
44
  });
45
45
  }
@@ -49,9 +49,9 @@ function updateValueAtPath(data, name, value) {
49
49
  * Returns null to remove fields, or updated path with new index.
50
50
  */
51
51
  function createPathIndexUpdater(listName, update) {
52
- var listPaths = future.getPathSegments(listName);
52
+ var listPaths = future.parsePath(listName);
53
53
  return name => {
54
- var paths = future.getPathSegments(name);
54
+ var paths = future.parsePath(name);
55
55
  if (paths.length > listPaths.length && listPaths.every((path, index) => paths[index] === path)) {
56
56
  var currentIndex = paths[listPaths.length];
57
57
  if (typeof currentIndex === 'number') {
@@ -63,36 +63,33 @@ function createPathIndexUpdater(listName, update) {
63
63
  if (newIndex !== currentIndex) {
64
64
  // Replace the index
65
65
  paths.splice(listPaths.length, 1, newIndex);
66
- return future.formatPathSegments(paths);
66
+ return future.formatPath(paths);
67
67
  }
68
68
  }
69
69
  }
70
70
  return name;
71
71
  };
72
72
  }
73
-
74
- /**
75
- * Returns null if error object has no actual error messages,
76
- * otherwise returns the error as-is.
77
- */
78
- function normalizeFormError(error) {
79
- if (error && error.formErrors.length === 0 && Object.entries(error.fieldErrors).every(_ref => {
80
- var [, messages] = _ref;
81
- return Array.isArray(messages) ? messages.length === 0 : !messages;
82
- })) {
83
- return null;
73
+ function resolveSerialize(customSerialize, _defaultSerialize) {
74
+ if (typeof customSerialize === 'undefined') {
75
+ return _defaultSerialize;
84
76
  }
85
- return error;
77
+ return function serializeValue(value, context) {
78
+ return customSerialize(value, {
79
+ name: context.name,
80
+ defaultSerialize: value => _defaultSerialize(value, context)
81
+ });
82
+ };
86
83
  }
87
84
  function normalizeValidateResult(result) {
88
85
  if (result !== null && 'error' in result) {
89
86
  return {
90
- error: normalizeFormError(result.error),
87
+ error: future.normalizeFormError(result.error),
91
88
  value: result.value
92
89
  };
93
90
  }
94
91
  return {
95
- error: normalizeFormError(result)
92
+ error: future.normalizeFormError(result)
96
93
  };
97
94
  }
98
95
 
@@ -138,8 +135,8 @@ function resolveStandardSchemaResult(result) {
138
135
  * Create a copy of the object with the updated properties if there is any change
139
136
  */
140
137
  function merge(obj, update) {
141
- if (obj === update || Object.entries(update).every(_ref2 => {
142
- var [key, value] = _ref2;
138
+ if (obj === update || Object.entries(update).every(_ref => {
139
+ var [key, value] = _ref;
143
140
  return obj[key] === value;
144
141
  })) {
145
142
  return obj;
@@ -201,14 +198,14 @@ function generateUniqueKey() {
201
198
  * - `isError`: Specify the error shape for type inference
202
199
  * - `when`: Narrow field metadata to specific shapes for conditional props
203
200
  *
204
- * @example Specify error shape
201
+ * **Example: Specify error shape**
205
202
  * ```ts
206
203
  * configureForms({
207
- * isError: shape<string>(), // errors are strings
204
+ * isError: shape<string[]>(), // errors are string arrays
208
205
  * });
209
206
  * ```
210
207
  *
211
- * @example Conditional field metadata
208
+ * **Example: Conditional field metadata**
212
209
  * ```ts
213
210
  * extendFieldMetadata(metadata, { when }) {
214
211
  * return {
@@ -248,7 +245,7 @@ exports.appendUniqueItem = appendUniqueItem;
248
245
  exports.compactMap = compactMap;
249
246
  exports.createPathIndexUpdater = createPathIndexUpdater;
250
247
  exports.generateUniqueKey = generateUniqueKey;
251
- exports.getArrayAtPath = getArrayAtPath;
248
+ exports.getPathArray = getPathArray;
252
249
  exports.isNullable = isNullable;
253
250
  exports.isNumber = isNumber;
254
251
  exports.isOptional = isOptional;
@@ -256,12 +253,12 @@ exports.isStandardSchemaV1 = isStandardSchemaV1;
256
253
  exports.isString = isString;
257
254
  exports.isUndefined = isUndefined;
258
255
  exports.merge = merge;
259
- exports.normalizeFormError = normalizeFormError;
260
256
  exports.normalizeValidateResult = normalizeValidateResult;
257
+ exports.resolveSerialize = resolveSerialize;
261
258
  exports.resolveStandardSchemaResult = resolveStandardSchemaResult;
262
259
  exports.resolveValidateResult = resolveValidateResult;
263
260
  exports.shape = shape;
264
261
  exports.transformKeys = transformKeys;
265
- exports.updateValueAtPath = updateValueAtPath;
262
+ exports.updatePathValue = updatePathValue;
266
263
  exports.validateStandardSchemaV1 = validateStandardSchemaV1;
267
264
  exports.when = when;
@@ -1,4 +1,4 @@
1
- import { formatIssues, getValueAtPath, isPlainObject, setValueAtPath, getPathSegments, formatPathSegments } from '@conform-to/dom/future';
1
+ import { formatIssues, normalizeFormError, getPathValue, isPlainObject, setPathValue, parsePath, formatPath } from '@conform-to/dom/future';
2
2
 
3
3
  function isUndefined(value) {
4
4
  return value === undefined;
@@ -15,9 +15,9 @@ function isNullable(value, typeGuard) {
15
15
  function isOptional(value, typeGuard) {
16
16
  return isUndefined(value) || typeGuard(value);
17
17
  }
18
- function getArrayAtPath(formValue, name) {
19
- var _getValueAtPath;
20
- var value = (_getValueAtPath = getValueAtPath(formValue, name)) !== null && _getValueAtPath !== void 0 ? _getValueAtPath : [];
18
+ function getPathArray(formValue, name) {
19
+ var _getPathValue;
20
+ var value = (_getPathValue = getPathValue(formValue, name)) !== null && _getPathValue !== void 0 ? _getPathValue : [];
21
21
  if (!Array.isArray(value)) {
22
22
  throw new Error("The value of \"".concat(name, "\" is not an array"));
23
23
  }
@@ -28,14 +28,14 @@ function getArrayAtPath(formValue, name) {
28
28
  * Immutably updates a value at the specified path.
29
29
  * Empty path replaces the entire object.
30
30
  */
31
- function updateValueAtPath(data, name, value) {
31
+ function updatePathValue(data, name, value) {
32
32
  if (name === '') {
33
33
  if (!isPlainObject(value)) {
34
34
  throw new Error('The value must be an object');
35
35
  }
36
36
  return value;
37
37
  }
38
- return setValueAtPath(data, getPathSegments(name), value, {
38
+ return setPathValue(data, parsePath(name), value, {
39
39
  clone: true
40
40
  });
41
41
  }
@@ -45,9 +45,9 @@ function updateValueAtPath(data, name, value) {
45
45
  * Returns null to remove fields, or updated path with new index.
46
46
  */
47
47
  function createPathIndexUpdater(listName, update) {
48
- var listPaths = getPathSegments(listName);
48
+ var listPaths = parsePath(listName);
49
49
  return name => {
50
- var paths = getPathSegments(name);
50
+ var paths = parsePath(name);
51
51
  if (paths.length > listPaths.length && listPaths.every((path, index) => paths[index] === path)) {
52
52
  var currentIndex = paths[listPaths.length];
53
53
  if (typeof currentIndex === 'number') {
@@ -59,26 +59,23 @@ function createPathIndexUpdater(listName, update) {
59
59
  if (newIndex !== currentIndex) {
60
60
  // Replace the index
61
61
  paths.splice(listPaths.length, 1, newIndex);
62
- return formatPathSegments(paths);
62
+ return formatPath(paths);
63
63
  }
64
64
  }
65
65
  }
66
66
  return name;
67
67
  };
68
68
  }
69
-
70
- /**
71
- * Returns null if error object has no actual error messages,
72
- * otherwise returns the error as-is.
73
- */
74
- function normalizeFormError(error) {
75
- if (error && error.formErrors.length === 0 && Object.entries(error.fieldErrors).every(_ref => {
76
- var [, messages] = _ref;
77
- return Array.isArray(messages) ? messages.length === 0 : !messages;
78
- })) {
79
- return null;
69
+ function resolveSerialize(customSerialize, _defaultSerialize) {
70
+ if (typeof customSerialize === 'undefined') {
71
+ return _defaultSerialize;
80
72
  }
81
- return error;
73
+ return function serializeValue(value, context) {
74
+ return customSerialize(value, {
75
+ name: context.name,
76
+ defaultSerialize: value => _defaultSerialize(value, context)
77
+ });
78
+ };
82
79
  }
83
80
  function normalizeValidateResult(result) {
84
81
  if (result !== null && 'error' in result) {
@@ -134,8 +131,8 @@ function resolveStandardSchemaResult(result) {
134
131
  * Create a copy of the object with the updated properties if there is any change
135
132
  */
136
133
  function merge(obj, update) {
137
- if (obj === update || Object.entries(update).every(_ref2 => {
138
- var [key, value] = _ref2;
134
+ if (obj === update || Object.entries(update).every(_ref => {
135
+ var [key, value] = _ref;
139
136
  return obj[key] === value;
140
137
  })) {
141
138
  return obj;
@@ -197,14 +194,14 @@ function generateUniqueKey() {
197
194
  * - `isError`: Specify the error shape for type inference
198
195
  * - `when`: Narrow field metadata to specific shapes for conditional props
199
196
  *
200
- * @example Specify error shape
197
+ * **Example: Specify error shape**
201
198
  * ```ts
202
199
  * configureForms({
203
- * isError: shape<string>(), // errors are strings
200
+ * isError: shape<string[]>(), // errors are string arrays
204
201
  * });
205
202
  * ```
206
203
  *
207
- * @example Conditional field metadata
204
+ * **Example: Conditional field metadata**
208
205
  * ```ts
209
206
  * extendFieldMetadata(metadata, { when }) {
210
207
  * return {
@@ -240,4 +237,4 @@ function validateStandardSchemaV1(schema, payload) {
240
237
  return resolveStandardSchemaResult(result);
241
238
  }
242
239
 
243
- export { appendUniqueItem, compactMap, createPathIndexUpdater, generateUniqueKey, getArrayAtPath, isNullable, isNumber, isOptional, isStandardSchemaV1, isString, isUndefined, merge, normalizeFormError, normalizeValidateResult, resolveStandardSchemaResult, resolveValidateResult, shape, transformKeys, updateValueAtPath, validateStandardSchemaV1, when };
240
+ export { appendUniqueItem, compactMap, createPathIndexUpdater, generateUniqueKey, getPathArray, isNullable, isNumber, isOptional, isStandardSchemaV1, isString, isUndefined, merge, normalizeValidateResult, resolveSerialize, resolveStandardSchemaResult, resolveValidateResult, shape, transformKeys, updatePathValue, validateStandardSchemaV1, when };
package/dist/helpers.d.ts CHANGED
@@ -85,7 +85,7 @@ export declare function getAriaAttributes(metadata: Metadata<any, any, any>, opt
85
85
  * Derives the properties of a form element based on the form metadata,
86
86
  * including `id`, `onSubmit`, `noValidate`, and `aria-describedby`.
87
87
  *
88
- * @example
88
+ * **Example:**
89
89
  * ```tsx
90
90
  * <form {...getFormProps(metadata)} />
91
91
  * ```
@@ -101,7 +101,7 @@ export declare function getFormProps<Schema extends Record<string, any>, FormErr
101
101
  * Derives the properties of a fieldset element based on the field metadata,
102
102
  * including `id`, `name`, `form`, and `aria-describedby`.
103
103
  *
104
- * @example
104
+ * **Example:**
105
105
  * ```tsx
106
106
  * <fieldset {...getFieldsetProps(metadata)} />
107
107
  * ```
@@ -125,8 +125,9 @@ export declare function getFormControlProps<Schema>(metadata: FieldMetadata<Sche
125
125
  * Depends on the provided options, it will also set `defaultChecked` / `checked` if it is a checkbox or radio button,
126
126
  * or otherwise `defaultValue` / `value`.
127
127
  *
128
- * @see https://conform.guide/api/react/getInputProps
129
- * @example
128
+ * See https://conform.guide/api/react/getInputProps
129
+ *
130
+ * **Example:**
130
131
  * ```tsx
131
132
  * // To setup an uncontrolled input
132
133
  * <input {...getInputProps(metadata, { type: 'text' })} />
@@ -145,8 +146,9 @@ export declare function getInputProps<Schema, Options extends InputOptions>(meta
145
146
  * and constraint attributes such as `required` or `multiple`.
146
147
  * Depends on the provided options, it will also set `defaultValue` / `value`.
147
148
  *
148
- * @see https://conform.guide/api/react/getSelectProps
149
- * @example
149
+ * See https://conform.guide/api/react/getSelectProps
150
+ *
151
+ * **Example:**
150
152
  * ```tsx
151
153
  * // To setup an uncontrolled select
152
154
  * <select {...getSelectProps(metadata)} />
@@ -161,8 +163,9 @@ export declare function getSelectProps<Schema>(metadata: FieldMetadata<Schema, a
161
163
  * and constraint attributes such as `required`, `minLength` or `maxLength`.
162
164
  * Depends on the provided options, it will also set `defaultValue` / `value`.
163
165
  *
164
- * @see https://conform.guide/api/react/getTextareaProps
165
- * @example
166
+ * See https://conform.guide/api/react/getTextareaProps
167
+ *
168
+ * **Example:**
166
169
  * ```tsx
167
170
  * // To setup an uncontrolled textarea
168
171
  * <textarea {...getTextareaProps(metadata)} />
@@ -175,8 +178,9 @@ export declare function getTextareaProps<Schema>(metadata: FieldMetadata<Schema,
175
178
  * Derives the properties of a collection of checkboxes or radio buttons based on the field metadata,
176
179
  * including common form control attributes like `key`, `id`, `name`, `form`, `autoFocus`, `aria-invalid`, `aria-describedby` and `required`.
177
180
  *
178
- * @see https://conform.guide/api/react/getCollectionProps
179
- * @example
181
+ * See https://conform.guide/api/react/getCollectionProps
182
+ *
183
+ * **Example:**
180
184
  * ```tsx
181
185
  * <fieldset>
182
186
  * {getCollectionProps(metadata, {
package/dist/helpers.js CHANGED
@@ -38,7 +38,7 @@ function getAriaAttributes(metadata) {
38
38
  * Derives the properties of a form element based on the form metadata,
39
39
  * including `id`, `onSubmit`, `noValidate`, and `aria-describedby`.
40
40
  *
41
- * @example
41
+ * **Example:**
42
42
  * ```tsx
43
43
  * <form {...getFormProps(metadata)} />
44
44
  * ```
@@ -55,7 +55,7 @@ function getFormProps(metadata, options) {
55
55
  * Derives the properties of a fieldset element based on the field metadata,
56
56
  * including `id`, `name`, `form`, and `aria-describedby`.
57
57
  *
58
- * @example
58
+ * **Example:**
59
59
  * ```tsx
60
60
  * <fieldset {...getFieldsetProps(metadata)} />
61
61
  * ```
@@ -87,8 +87,9 @@ function getFormControlProps(metadata, options) {
87
87
  * Depends on the provided options, it will also set `defaultChecked` / `checked` if it is a checkbox or radio button,
88
88
  * or otherwise `defaultValue` / `value`.
89
89
  *
90
- * @see https://conform.guide/api/react/getInputProps
91
- * @example
90
+ * See https://conform.guide/api/react/getInputProps
91
+ *
92
+ * **Example:**
92
93
  * ```tsx
93
94
  * // To setup an uncontrolled input
94
95
  * <input {...getInputProps(metadata, { type: 'text' })} />
@@ -129,8 +130,9 @@ function getInputProps(metadata, options) {
129
130
  * and constraint attributes such as `required` or `multiple`.
130
131
  * Depends on the provided options, it will also set `defaultValue` / `value`.
131
132
  *
132
- * @see https://conform.guide/api/react/getSelectProps
133
- * @example
133
+ * See https://conform.guide/api/react/getSelectProps
134
+ *
135
+ * **Example:**
134
136
  * ```tsx
135
137
  * // To setup an uncontrolled select
136
138
  * <select {...getSelectProps(metadata)} />
@@ -156,8 +158,9 @@ function getSelectProps(metadata) {
156
158
  * and constraint attributes such as `required`, `minLength` or `maxLength`.
157
159
  * Depends on the provided options, it will also set `defaultValue` / `value`.
158
160
  *
159
- * @see https://conform.guide/api/react/getTextareaProps
160
- * @example
161
+ * See https://conform.guide/api/react/getTextareaProps
162
+ *
163
+ * **Example:**
161
164
  * ```tsx
162
165
  * // To setup an uncontrolled textarea
163
166
  * <textarea {...getTextareaProps(metadata)} />
@@ -182,8 +185,9 @@ function getTextareaProps(metadata) {
182
185
  * Derives the properties of a collection of checkboxes or radio buttons based on the field metadata,
183
186
  * including common form control attributes like `key`, `id`, `name`, `form`, `autoFocus`, `aria-invalid`, `aria-describedby` and `required`.
184
187
  *
185
- * @see https://conform.guide/api/react/getCollectionProps
186
- * @example
188
+ * See https://conform.guide/api/react/getCollectionProps
189
+ *
190
+ * **Example:**
187
191
  * ```tsx
188
192
  * <fieldset>
189
193
  * {getCollectionProps(metadata, {
package/dist/helpers.mjs CHANGED
@@ -34,7 +34,7 @@ function getAriaAttributes(metadata) {
34
34
  * Derives the properties of a form element based on the form metadata,
35
35
  * including `id`, `onSubmit`, `noValidate`, and `aria-describedby`.
36
36
  *
37
- * @example
37
+ * **Example:**
38
38
  * ```tsx
39
39
  * <form {...getFormProps(metadata)} />
40
40
  * ```
@@ -51,7 +51,7 @@ function getFormProps(metadata, options) {
51
51
  * Derives the properties of a fieldset element based on the field metadata,
52
52
  * including `id`, `name`, `form`, and `aria-describedby`.
53
53
  *
54
- * @example
54
+ * **Example:**
55
55
  * ```tsx
56
56
  * <fieldset {...getFieldsetProps(metadata)} />
57
57
  * ```
@@ -83,8 +83,9 @@ function getFormControlProps(metadata, options) {
83
83
  * Depends on the provided options, it will also set `defaultChecked` / `checked` if it is a checkbox or radio button,
84
84
  * or otherwise `defaultValue` / `value`.
85
85
  *
86
- * @see https://conform.guide/api/react/getInputProps
87
- * @example
86
+ * See https://conform.guide/api/react/getInputProps
87
+ *
88
+ * **Example:**
88
89
  * ```tsx
89
90
  * // To setup an uncontrolled input
90
91
  * <input {...getInputProps(metadata, { type: 'text' })} />
@@ -125,8 +126,9 @@ function getInputProps(metadata, options) {
125
126
  * and constraint attributes such as `required` or `multiple`.
126
127
  * Depends on the provided options, it will also set `defaultValue` / `value`.
127
128
  *
128
- * @see https://conform.guide/api/react/getSelectProps
129
- * @example
129
+ * See https://conform.guide/api/react/getSelectProps
130
+ *
131
+ * **Example:**
130
132
  * ```tsx
131
133
  * // To setup an uncontrolled select
132
134
  * <select {...getSelectProps(metadata)} />
@@ -152,8 +154,9 @@ function getSelectProps(metadata) {
152
154
  * and constraint attributes such as `required`, `minLength` or `maxLength`.
153
155
  * Depends on the provided options, it will also set `defaultValue` / `value`.
154
156
  *
155
- * @see https://conform.guide/api/react/getTextareaProps
156
- * @example
157
+ * See https://conform.guide/api/react/getTextareaProps
158
+ *
159
+ * **Example:**
157
160
  * ```tsx
158
161
  * // To setup an uncontrolled textarea
159
162
  * <textarea {...getTextareaProps(metadata)} />
@@ -178,8 +181,9 @@ function getTextareaProps(metadata) {
178
181
  * Derives the properties of a collection of checkboxes or radio buttons based on the field metadata,
179
182
  * including common form control attributes like `key`, `id`, `name`, `form`, `autoFocus`, `aria-invalid`, `aria-describedby` and `required`.
180
183
  *
181
- * @see https://conform.guide/api/react/getCollectionProps
182
- * @example
184
+ * See https://conform.guide/api/react/getCollectionProps
185
+ *
186
+ * **Example:**
183
187
  * ```tsx
184
188
  * <fieldset>
185
189
  * {getCollectionProps(metadata, {
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.17.1",
6
+ "version": "1.19.0",
7
7
  "main": "./dist/index.js",
8
8
  "module": "./dist/index.mjs",
9
9
  "types": "./dist/index.d.ts",
@@ -41,7 +41,7 @@
41
41
  "url": "https://github.com/edmundhung/conform/issues"
42
42
  },
43
43
  "dependencies": {
44
- "@conform-to/dom": "1.17.1"
44
+ "@conform-to/dom": "1.19.0"
45
45
  },
46
46
  "devDependencies": {
47
47
  "@babel/core": "^7.17.8",
@@ -60,7 +60,8 @@
60
60
  "vitest-browser-react": "^1.0.1"
61
61
  },
62
62
  "peerDependencies": {
63
- "react": ">=18"
63
+ "react": ">=18",
64
+ "react-dom": ">=18"
64
65
  },
65
66
  "keywords": [
66
67
  "constraint-validation",