@conform-to/react 1.14.0 → 1.15.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/README.md CHANGED
@@ -7,7 +7,7 @@
7
7
  ╚══════╝ ╚═════╝ ╚═╝ ╚══╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝
8
8
  ```
9
9
 
10
- Version 1.14.0 / License MIT / Copyright (c) 2025 Edmund Hung
10
+ Version 1.15.0 / License MIT / Copyright (c) 2025 Edmund Hung
11
11
 
12
12
  Progressively enhance HTML forms with React. Build resilient, type-safe forms with no hassle using web standards.
13
13
 
@@ -1,6 +1,6 @@
1
- import { type FormValue, type Serialize, type SubmissionResult, createGlobalFormsObserver } from '@conform-to/dom/future';
1
+ import { type FieldName, type FormValue, type Serialize, type SubmissionResult, createGlobalFormsObserver } from '@conform-to/dom/future';
2
2
  import { useEffect } from 'react';
3
- import type { FormContext, IntentDispatcher, FormMetadata, Fieldset, GlobalFormOptions, FormOptions, FieldName, FieldMetadata, Control, Selector, UseFormDataOptions, ValidateHandler, ErrorHandler, SubmitHandler, FormState, FormRef, BaseErrorShape, DefaultErrorShape, BaseSchemaType, InferInput, InferOutput } from './types';
3
+ import type { FormContext, IntentDispatcher, FormMetadata, Fieldset, GlobalFormOptions, FormOptions, FieldMetadata, Control, Selector, UseFormDataOptions, ValidateHandler, ErrorHandler, SubmitHandler, FormState, FormRef, BaseErrorShape, DefaultErrorShape, BaseSchemaType, InferInput, InferOutput } from './types';
4
4
  import { StandardSchemaV1 } from './standard-schema';
5
5
  export declare const INITIAL_KEY = "INITIAL_KEY";
6
6
  export declare const GlobalFormOptionsContext: import("react").Context<GlobalFormOptions & {
@@ -1,6 +1,6 @@
1
- export type { FormError, FormValue, Submission, SubmissionResult, } from '@conform-to/dom/future';
2
- export { parseSubmission, report, isDirty } from '@conform-to/dom/future';
3
- export type { Control, DefaultValue, BaseMetadata, CustomMetadata, CustomMetadataDefinition, BaseErrorShape, CustomTypes, FormContext, FormMetadata, FormOptions, FormRef, FieldMetadata, FieldName, Fieldset, IntentDispatcher, } from './types';
1
+ export type { FieldName, FormError, FormValue, Submission, SubmissionResult, } from '@conform-to/dom/future';
2
+ export { getFieldValue, parseSubmission, report, isDirty, } from '@conform-to/dom/future';
3
+ export type { Control, DefaultValue, BaseMetadata, CustomMetadata, CustomMetadataDefinition, BaseErrorShape, CustomTypes, FormContext, FormMetadata, FormOptions, FormRef, FieldMetadata, Fieldset, IntentDispatcher, } from './types';
4
4
  export { FormProvider, FormOptionsProvider, useControl, useField, useForm, useFormData, useFormMetadata, useIntent, } from './hooks';
5
5
  export { memoize } from './memoize';
6
6
  //# sourceMappingURL=index.d.ts.map
@@ -8,6 +8,10 @@ var memoize = require('./memoize.js');
8
8
 
9
9
 
10
10
 
11
+ Object.defineProperty(exports, 'getFieldValue', {
12
+ enumerable: true,
13
+ get: function () { return future.getFieldValue; }
14
+ });
11
15
  Object.defineProperty(exports, 'isDirty', {
12
16
  enumerable: true,
13
17
  get: function () { return future.isDirty; }
@@ -1,3 +1,3 @@
1
- export { isDirty, parseSubmission, report } from '@conform-to/dom/future';
1
+ export { getFieldValue, isDirty, parseSubmission, report } from '@conform-to/dom/future';
2
2
  export { FormOptionsProvider, FormProvider, useControl, useField, useForm, useFormData, useFormMetadata, useIntent } from './hooks.mjs';
3
3
  export { memoize } from './memoize.mjs';
@@ -1,5 +1,5 @@
1
- import { type ValidationAttributes, type Serialize } from '@conform-to/dom/future';
2
- import type { FieldMetadata, FieldName, Fieldset, FormContext, FormMetadata, FormState, FormAction, UnknownIntent, ActionHandler, CustomMetadataDefinition } from './types';
1
+ import { type FieldName, type ValidationAttributes, type Serialize } from '@conform-to/dom/future';
2
+ import type { FieldMetadata, Fieldset, FormContext, FormMetadata, FormState, FormAction, UnknownIntent, ActionHandler, CustomMetadataDefinition } from './types';
3
3
  export declare function initializeState<ErrorShape>(options?: {
4
4
  defaultValue?: Record<string, unknown> | null | undefined;
5
5
  resetKey?: string | undefined;
@@ -1,4 +1,4 @@
1
- import type { FormError, FormValue, Serialize, SubmissionResult, ValidationAttributes } from '@conform-to/dom/future';
1
+ import type { FieldName, FormError, FormValue, Serialize, SubmissionResult, ValidationAttributes } from '@conform-to/dom/future';
2
2
  import type { StandardSchemaV1 } from './standard-schema';
3
3
  export type Prettify<T> = {
4
4
  [K in keyof T]: T[K];
@@ -128,9 +128,6 @@ export type NonPartial<T> = {
128
128
  [K in keyof Required<T>]: T[K];
129
129
  };
130
130
  export type RequireKey<T, K extends keyof T> = Prettify<T & Pick<NonPartial<T>, K>>;
131
- export type RequireOneOf<T, K extends keyof T> = Prettify<{
132
- [K in keyof T]-?: RequireKey<T, K>;
133
- }[K]>;
134
131
  export type BaseSchemaType = StandardSchemaV1<any, any>;
135
132
  export type InferInput<Schema> = Schema extends StandardSchemaV1<infer input, any> ? input : unknown;
136
133
  export type InferOutput<Schema> = Schema extends StandardSchemaV1<any, infer output> ? output : undefined;
@@ -170,7 +167,7 @@ export type BaseFormOptions<FormShape extends Record<string, any> = Record<strin
170
167
  /** Custom validation handler. Can be skipped if using the schema property, or combined with schema to customize validation errors. */
171
168
  onValidate?: ValidateHandler<ErrorShape, Value, InferOutput<Schema>> | undefined;
172
169
  };
173
- export type FormOptions<FormShape extends Record<string, any> = Record<string, any>, ErrorShape extends BaseErrorShape = string extends BaseErrorShape ? string : BaseErrorShape, Value = undefined, Schema = undefined, RequiredKeys extends keyof BaseFormOptions<FormShape, ErrorShape, Value, Schema> = never> = RequireOneOf<RequireKey<BaseFormOptions<FormShape, ErrorShape, Value, Schema>, RequiredKeys>, 'onSubmit' | 'lastResult'>;
170
+ export type FormOptions<FormShape extends Record<string, any> = Record<string, any>, ErrorShape extends BaseErrorShape = string extends BaseErrorShape ? string : BaseErrorShape, Value = undefined, Schema = undefined, RequiredKeys extends keyof BaseFormOptions<FormShape, ErrorShape, Value, Schema> = never> = RequireKey<BaseFormOptions<FormShape, ErrorShape, Value, Schema>, RequiredKeys>;
174
171
  export interface FormContext<ErrorShape extends BaseErrorShape = DefaultErrorShape> {
175
172
  /** The form's unique identifier */
176
173
  formId: string;
@@ -185,10 +182,6 @@ export interface FormContext<ErrorShape extends BaseErrorShape = DefaultErrorSha
185
182
  /** Blur event handler for form-wide blur events */
186
183
  handleBlur: (event: React.FocusEvent) => void;
187
184
  }
188
- /** The name of an input field with type information for TypeScript inference. */
189
- export type FieldName<FieldShape> = string & {
190
- '~shape'?: FieldShape;
191
- };
192
185
  export type UnknownIntent = {
193
186
  type: string;
194
187
  payload?: unknown;
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.14.0",
6
+ "version": "1.15.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.14.0"
44
+ "@conform-to/dom": "1.15.0"
45
45
  },
46
46
  "devDependencies": {
47
47
  "@babel/core": "^7.17.8",