@valfuse-node/form 0.2.0 → 0.3.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/dist/index.d.mts CHANGED
@@ -257,8 +257,10 @@ type SetErrorsInput<TFieldName extends string = string> = ValfuseFieldErrors<TFi
257
257
  * | `onSubmit` | Validate only when the form is submitted (default) |
258
258
  * | `onBlur` | Validate when a field loses focus |
259
259
  * | `onChange` | Validate on every keystroke / value change |
260
+ * | `onTouched` | Validate on the first blur; after that validate on every change |
261
+ * | `all` | Validate on both `onChange` and `onBlur` |
260
262
  */
261
- type ValfuseFormMode = "onSubmit" | "onBlur" | "onChange";
263
+ type ValfuseFormMode = "onSubmit" | "onBlur" | "onChange" | "onTouched" | "all";
262
264
  /** A single field error */
263
265
  interface ValfuseFieldError {
264
266
  message: string;
@@ -274,11 +276,11 @@ type ValfuseFormErrors<TSchema extends Record<string, unknown>> = {
274
276
  };
275
277
  /** Map of dirty fields (value changed from default) */
276
278
  type ValfuseDirtyFields<TSchema extends Record<string, unknown>> = {
277
- [K in keyof TSchema]?: true;
279
+ [K in keyof TSchema]?: boolean;
278
280
  };
279
281
  /** Map of touched fields (user interacted with) */
280
282
  type ValfuseTouchedFields<TSchema extends Record<string, unknown>> = {
281
- [K in keyof TSchema]?: true;
283
+ [K in keyof TSchema]?: boolean;
282
284
  };
283
285
  /** Reactive form state exposed to consumers */
284
286
  interface ValfuseFormState<TSchema extends Record<string, unknown>> {
package/dist/index.d.ts CHANGED
@@ -257,8 +257,10 @@ type SetErrorsInput<TFieldName extends string = string> = ValfuseFieldErrors<TFi
257
257
  * | `onSubmit` | Validate only when the form is submitted (default) |
258
258
  * | `onBlur` | Validate when a field loses focus |
259
259
  * | `onChange` | Validate on every keystroke / value change |
260
+ * | `onTouched` | Validate on the first blur; after that validate on every change |
261
+ * | `all` | Validate on both `onChange` and `onBlur` |
260
262
  */
261
- type ValfuseFormMode = "onSubmit" | "onBlur" | "onChange";
263
+ type ValfuseFormMode = "onSubmit" | "onBlur" | "onChange" | "onTouched" | "all";
262
264
  /** A single field error */
263
265
  interface ValfuseFieldError {
264
266
  message: string;
@@ -274,11 +276,11 @@ type ValfuseFormErrors<TSchema extends Record<string, unknown>> = {
274
276
  };
275
277
  /** Map of dirty fields (value changed from default) */
276
278
  type ValfuseDirtyFields<TSchema extends Record<string, unknown>> = {
277
- [K in keyof TSchema]?: true;
279
+ [K in keyof TSchema]?: boolean;
278
280
  };
279
281
  /** Map of touched fields (user interacted with) */
280
282
  type ValfuseTouchedFields<TSchema extends Record<string, unknown>> = {
281
- [K in keyof TSchema]?: true;
283
+ [K in keyof TSchema]?: boolean;
282
284
  };
283
285
  /** Reactive form state exposed to consumers */
284
286
  interface ValfuseFormState<TSchema extends Record<string, unknown>> {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@valfuse-node/form",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "Form domain package for valfuse-node — schema, validation, transformation, rules, state, and methods",
5
5
  "license": "MIT",
6
6
  "sideEffects": false,