@formisch/react 0.4.0 → 0.4.2
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 +1 -1
- package/dist/index.d.ts +12 -8
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -32,7 +32,7 @@ export default function LoginPage() {
|
|
|
32
32
|
});
|
|
33
33
|
|
|
34
34
|
return (
|
|
35
|
-
<Form of={loginForm} onSubmit={(output) => console.log(output)}>
|
|
35
|
+
<Form of={loginForm} onSubmit={(output, event) => console.log(output)}>
|
|
36
36
|
<Field of={loginForm} path={['email']}>
|
|
37
37
|
{(field) => (
|
|
38
38
|
<div>
|
package/dist/index.d.ts
CHANGED
|
@@ -188,23 +188,27 @@ type InternalFieldStore = InternalArrayStore | InternalObjectStore | InternalVal
|
|
|
188
188
|
/**
|
|
189
189
|
* Checks if a type is `any`.
|
|
190
190
|
*/
|
|
191
|
-
type IsAny<
|
|
191
|
+
type IsAny<T> = 0 extends 1 & T ? true : false;
|
|
192
192
|
/**
|
|
193
193
|
* Checks if a type is `never`.
|
|
194
194
|
*/
|
|
195
|
-
type IsNever<
|
|
195
|
+
type IsNever<T> = [T] extends [never] ? true : false;
|
|
196
196
|
/**
|
|
197
197
|
* Constructs a type that is maybe a promise.
|
|
198
198
|
*/
|
|
199
|
-
type MaybePromise<
|
|
199
|
+
type MaybePromise<T> = T | Promise<T>;
|
|
200
200
|
/**
|
|
201
201
|
* Makes all properties deeply optional.
|
|
202
202
|
*/
|
|
203
|
-
type DeepPartial<TValue> = TValue extends
|
|
203
|
+
type DeepPartial<TValue> = TValue extends Record<PropertyKey, unknown> | readonly unknown[] ? { [TKey in keyof TValue]?: DeepPartial<TValue[TKey]> | undefined } : TValue | undefined;
|
|
204
204
|
/**
|
|
205
205
|
* Makes all value properties optional.
|
|
206
|
+
*
|
|
207
|
+
* Hint: For dynamic arrays, only plain objects and nested arrays have their
|
|
208
|
+
* values made optional. Primitives and class instances are kept as-is to avoid
|
|
209
|
+
* types like `(string | undefined)[]`.
|
|
206
210
|
*/
|
|
207
|
-
type PartialValues<TValue> = TValue extends readonly
|
|
211
|
+
type PartialValues<TValue> = TValue extends readonly (infer TItem)[] ? number extends TValue["length"] ? (TItem extends Record<PropertyKey, unknown> | readonly unknown[] ? { [TKey in keyof TItem]: PartialValues<TItem[TKey]> } : TItem)[] : { [TKey in keyof TValue]: PartialValues<TValue[TKey]> } : TValue extends Record<PropertyKey, unknown> ? { [TKey in keyof TValue]: PartialValues<TValue[TKey]> } : TValue | undefined;
|
|
208
212
|
//#endregion
|
|
209
213
|
//#region src/values.d.ts
|
|
210
214
|
/**
|
|
@@ -245,7 +249,7 @@ interface InternalFormStore<TSchema extends Schema = Schema> extends InternalObj
|
|
|
245
249
|
/**
|
|
246
250
|
* The element of the form.
|
|
247
251
|
*/
|
|
248
|
-
element?: HTMLFormElement;
|
|
252
|
+
element?: HTMLFormElement | undefined;
|
|
249
253
|
/**
|
|
250
254
|
* The number of active validators.
|
|
251
255
|
*/
|
|
@@ -321,7 +325,7 @@ type KeyOf<TValue> = IsAny<TValue> extends true ? never : TValue extends readonl
|
|
|
321
325
|
* properties that do not exist in all union options are not accessible
|
|
322
326
|
* and result in "any" when accessed.
|
|
323
327
|
*/
|
|
324
|
-
type MergeUnion<
|
|
328
|
+
type MergeUnion<TValue> = { [TKey in KeyOf<TValue>]: TValue extends Record<TKey, infer TItem> ? TItem : never };
|
|
325
329
|
/**
|
|
326
330
|
* Lazily evaluates only the first valid path segment based on the given value.
|
|
327
331
|
*/
|
|
@@ -652,7 +656,7 @@ interface ResetFieldConfig<TSchema extends Schema, TFieldPath extends RequiredPa
|
|
|
652
656
|
* The new initial input to reset the field to. If provided, replaces the
|
|
653
657
|
* field's initial input.
|
|
654
658
|
*/
|
|
655
|
-
readonly initialInput?: DeepPartial<PathValue<v.InferInput<TSchema>, TFieldPath
|
|
659
|
+
readonly initialInput?: DeepPartial<PathValue<v.InferInput<TSchema>, TFieldPath>> | undefined;
|
|
656
660
|
}
|
|
657
661
|
/**
|
|
658
662
|
* Resets a specific field or the entire form to its initial state. Provides
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@formisch/react",
|
|
3
3
|
"description": "The modular and type-safe form library for React",
|
|
4
|
-
"version": "0.4.
|
|
4
|
+
"version": "0.4.2",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Fabian Hiller",
|
|
7
7
|
"homepage": "https://formisch.dev",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"tsdown": "^0.16.8",
|
|
47
47
|
"typescript": "~5.9.3",
|
|
48
48
|
"vite": "^7.2.4",
|
|
49
|
-
"@formisch/core": "0.6.
|
|
49
|
+
"@formisch/core": "0.6.2",
|
|
50
50
|
"@formisch/methods": "0.7.0",
|
|
51
51
|
"@formisch/eslint-config": "0.1.0"
|
|
52
52
|
},
|