@lehnihon/bit-form 2.2.9 → 2.2.10
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/angular/index.cjs +1 -1
- package/dist/angular/index.d.cts +19 -52
- package/dist/angular/index.d.ts +19 -52
- package/dist/angular/index.js +1 -1
- package/dist/angular/index.js.map +1 -1
- package/dist/bus-BFOBGmd9.d.ts +41 -0
- package/dist/bus-DzTqgkZ4.d.cts +41 -0
- package/dist/chunk-2AFWJAQG.js +2 -0
- package/dist/chunk-2AFWJAQG.js.map +1 -0
- package/dist/chunk-4RQFECC7.cjs +2 -0
- package/dist/{chunk-J5ALITQW.cjs.map → chunk-4RQFECC7.cjs.map} +1 -1
- package/dist/chunk-FLFIOW75.js +2 -0
- package/dist/chunk-FLFIOW75.js.map +1 -0
- package/dist/chunk-G2FQQDRK.js +2 -0
- package/dist/chunk-G2FQQDRK.js.map +1 -0
- package/dist/{chunk-X5UCRGYJ.cjs → chunk-GPMAT4PT.cjs} +2 -2
- package/dist/{chunk-X5UCRGYJ.cjs.map → chunk-GPMAT4PT.cjs.map} +1 -1
- package/dist/{chunk-J5GQLEVA.js → chunk-GQ2QJCBF.js} +2 -2
- package/dist/{chunk-GGZPA7AO.cjs → chunk-IVPCXKYW.cjs} +2 -2
- package/dist/{chunk-GGZPA7AO.cjs.map → chunk-IVPCXKYW.cjs.map} +1 -1
- package/dist/{chunk-N4HCGMMM.js → chunk-LX4GSDUV.js} +2 -2
- package/dist/chunk-NVFZ22A7.cjs +2 -0
- package/dist/chunk-NVFZ22A7.cjs.map +1 -0
- package/dist/{chunk-2QLQPMCZ.js → chunk-OPC7HFNN.js} +2 -2
- package/dist/chunk-PA43XYOW.cjs +2 -0
- package/dist/{chunk-IV32WXCF.cjs.map → chunk-PA43XYOW.cjs.map} +1 -1
- package/dist/chunk-PG7ZH32Z.js +2 -0
- package/dist/chunk-PG7ZH32Z.js.map +1 -0
- package/dist/chunk-VBX5I5XG.cjs +2 -0
- package/dist/chunk-VBX5I5XG.cjs.map +1 -0
- package/dist/{chunk-OLQVH24Z.cjs → chunk-ZKAFHJPU.cjs} +2 -2
- package/dist/{chunk-OLQVH24Z.cjs.map → chunk-ZKAFHJPU.cjs.map} +1 -1
- package/dist/cli/index.cjs +5 -5
- package/dist/{types-SOg9xEce.d.cts → config-types-5eR82k2V.d.cts} +40 -169
- package/dist/{types-CRCP4Pgq.d.ts → config-types-D9n-rQLk.d.ts} +40 -169
- package/dist/core/bindings.cjs +1 -1
- package/dist/core/bindings.d.cts +15 -11
- package/dist/core/bindings.d.ts +15 -11
- package/dist/core/bindings.js +1 -1
- package/dist/core/status.d.cts +3 -4
- package/dist/core/status.d.ts +3 -4
- package/dist/core/store.cjs +1 -1
- package/dist/core/store.d.cts +8 -6
- package/dist/core/store.d.ts +8 -6
- package/dist/core/store.js +1 -1
- package/dist/core/utils.cjs +1 -1
- package/dist/core/utils.d.cts +1 -2
- package/dist/core/utils.d.ts +1 -2
- package/dist/core/utils.js +1 -1
- package/dist/core.cjs +1 -1
- package/dist/core.d.cts +10 -9
- package/dist/core.d.ts +10 -9
- package/dist/core.js +1 -1
- package/dist/devtools/bridge.cjs +1 -1
- package/dist/devtools/bridge.d.cts +2 -3
- package/dist/devtools/bridge.d.ts +2 -3
- package/dist/devtools/bridge.js +1 -1
- package/dist/devtools/index.cjs +2 -2
- package/dist/devtools/index.d.cts +5 -3
- package/dist/devtools/index.d.ts +5 -3
- package/dist/devtools/index.js +1 -1
- package/dist/{field-binding-MX6jVQbT.d.ts → field-binding-Bi1g-D8X.d.ts} +1 -1
- package/dist/{field-binding-B_OX3bjp.d.cts → field-binding-X5TkvfUt.d.cts} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +7 -5
- package/dist/index.d.ts +7 -5
- package/dist/index.js +1 -1
- package/dist/mask.d.cts +2 -2
- package/dist/mask.d.ts +2 -2
- package/dist/meta-types-BC1VLABk.d.cts +28 -0
- package/dist/meta-types-BC1VLABk.d.ts +28 -0
- package/dist/react/index.cjs +1 -1
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.d.cts +12 -12
- package/dist/react/index.d.ts +12 -12
- package/dist/react/index.js +1 -1
- package/dist/react/index.js.map +1 -1
- package/dist/react-native/index.cjs +1 -1
- package/dist/react-native/index.d.cts +10 -9
- package/dist/react-native/index.d.ts +10 -9
- package/dist/react-native/index.js +1 -1
- package/dist/resolvers/index.d.cts +2 -3
- package/dist/resolvers/index.d.ts +2 -3
- package/dist/resolvers/joi.d.cts +2 -3
- package/dist/resolvers/joi.d.ts +2 -3
- package/dist/resolvers/yup.d.cts +2 -3
- package/dist/resolvers/yup.d.ts +2 -3
- package/dist/resolvers/zod.d.cts +2 -3
- package/dist/resolvers/zod.d.ts +2 -3
- package/dist/runtime-types-D1SRZr-n.d.cts +43 -0
- package/dist/runtime-types-D1SRZr-n.d.ts +43 -0
- package/dist/state-types-8bUndWfg.d.cts +42 -0
- package/dist/state-types-8bUndWfg.d.ts +42 -0
- package/dist/{store-api-types-Bm3EAqR_.d.cts → store-api-types-Bozwlwyb.d.ts} +9 -5
- package/dist/{store-api-types-DfTFy2h4.d.ts → store-api-types-DSgYwMS3.d.cts} +9 -5
- package/dist/{types-D8DgIUhJ.d.cts → types-CUXh7PqD.d.cts} +1 -1
- package/dist/{types-D8DgIUhJ.d.ts → types-CUXh7PqD.d.ts} +1 -1
- package/dist/upload-C4JqIaU2.d.cts +89 -0
- package/dist/upload-ao6skK9K.d.ts +89 -0
- package/dist/{use-bit-persist-BDMZmxBh.d.ts → use-bit-persist-Bd1H2fge.d.ts} +12 -45
- package/dist/{use-bit-persist-CBTZIMc5.d.cts → use-bit-persist-DDxV21AN.d.cts} +12 -45
- package/dist/utils.cjs +1 -1
- package/dist/utils.js +1 -1
- package/dist/vue/index.cjs +1 -1
- package/dist/vue/index.d.cts +18 -51
- package/dist/vue/index.d.ts +18 -51
- package/dist/vue/index.js +1 -1
- package/dist/vue/index.js.map +1 -1
- package/package.json +2 -2
- package/dist/array-controller-C61ByyG6.d.ts +0 -23
- package/dist/array-controller-CtlqjA0e.d.cts +0 -23
- package/dist/bus-BKuMV3E7.d.ts +0 -19
- package/dist/bus-WOHGxuVy.d.cts +0 -19
- package/dist/chunk-6LNXTSZ6.cjs +0 -2
- package/dist/chunk-6LNXTSZ6.cjs.map +0 -1
- package/dist/chunk-IV32WXCF.cjs +0 -2
- package/dist/chunk-J5ALITQW.cjs +0 -2
- package/dist/chunk-KDHPLXZF.cjs +0 -2
- package/dist/chunk-KDHPLXZF.cjs.map +0 -1
- package/dist/chunk-O5UPA33R.js +0 -2
- package/dist/chunk-O5UPA33R.js.map +0 -1
- package/dist/chunk-QX2IVNMK.js +0 -2
- package/dist/chunk-QX2IVNMK.js.map +0 -1
- package/dist/chunk-UARLAXZX.js +0 -2
- package/dist/chunk-UARLAXZX.js.map +0 -1
- package/dist/chunk-Y3XVQGCU.js +0 -2
- package/dist/chunk-Y3XVQGCU.js.map +0 -1
- package/dist/meta-types-Bzmm21TP.d.cts +0 -18
- package/dist/meta-types-Bzmm21TP.d.ts +0 -18
- package/dist/upload-C2mpfhp1.d.cts +0 -17
- package/dist/upload-C2mpfhp1.d.ts +0 -17
- /package/dist/{chunk-J5GQLEVA.js.map → chunk-GQ2QJCBF.js.map} +0 -0
- /package/dist/{chunk-N4HCGMMM.js.map → chunk-LX4GSDUV.js.map} +0 -0
- /package/dist/{chunk-2QLQPMCZ.js.map → chunk-OPC7HFNN.js.map} +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as x,b as P,c as v,d as B,e as y,f as h,g as V,h as T,i as S}from"../chunk-
|
|
1
|
+
import{a as x,b as P,c as v,d as B,e as y,f as h,g as V,h as T,i as S}from"../chunk-GQ2QJCBF.js";import"../chunk-5NA2TFPG.js";import"../chunk-G2FQQDRK.js";import{h as m}from"../chunk-2AFWJAQG.js";import"../chunk-W2E5UIXT.js";import"../chunk-UIKO6GGW.js";import{a as p}from"../chunk-ICYXODTQ.js";import"../chunk-OPC7HFNN.js";import"../chunk-FLFIOW75.js";import"../chunk-3NUJVIAM.js";import{useMemo as c,useCallback as a}from"react";function g(i){let{fieldState:r,setBlur:o,store:l}=B(i),{fieldController:t}=c(()=>m(l,i),[l,i]),u=c(()=>t.displayValue(r.value),[r.value,t]),d=a(s=>t.setValue(s),[t]),F=a(s=>t.setValue(s),[t]),{value:f}=r,e=p(r),n=a(()=>{o()},[o]);return{value:f,displayValue:u,setValue:F,setBlur:o,onChangeText:d,onBlur:n,meta:{error:e.error,touched:e.touched,invalid:e.invalid,isValidating:e.isValidating,isDirty:e.isDirty,isHidden:e.isHidden,isRequired:e.isRequired,hasError:e.hasError},props:{value:u,onChangeText:d,onBlur:n}}}export{x as BitFormProvider,y as useBitArray,g as useBitField,v as useBitForm,S as useBitPersist,h as useBitScope,V as useBitSteps,P as useBitStore,T as useBitWatch};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -3,8 +3,7 @@ export { zodResolver } from './zod.cjs';
|
|
|
3
3
|
export { yupResolver } from './yup.cjs';
|
|
4
4
|
export { BitJoiResolverConfig, BitResolverScopeOptions, BitYupResolverConfig, BitZodResolverConfig } from './types.cjs';
|
|
5
5
|
import 'joi';
|
|
6
|
-
import '../types-
|
|
7
|
-
import '../
|
|
8
|
-
import '../bus-WOHGxuVy.cjs';
|
|
6
|
+
import '../state-types-8bUndWfg.cjs';
|
|
7
|
+
import '../bus-DzTqgkZ4.cjs';
|
|
9
8
|
import 'zod';
|
|
10
9
|
import 'yup';
|
|
@@ -3,8 +3,7 @@ export { zodResolver } from './zod.js';
|
|
|
3
3
|
export { yupResolver } from './yup.js';
|
|
4
4
|
export { BitJoiResolverConfig, BitResolverScopeOptions, BitYupResolverConfig, BitZodResolverConfig } from './types.js';
|
|
5
5
|
import 'joi';
|
|
6
|
-
import '../types-
|
|
7
|
-
import '../
|
|
8
|
-
import '../bus-BKuMV3E7.js';
|
|
6
|
+
import '../state-types-8bUndWfg.js';
|
|
7
|
+
import '../bus-BFOBGmd9.js';
|
|
9
8
|
import 'zod';
|
|
10
9
|
import 'yup';
|
package/dist/resolvers/joi.d.cts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { ObjectSchema } from 'joi';
|
|
2
|
-
import {
|
|
3
|
-
import '../bus-
|
|
2
|
+
import { b as BitErrors } from '../state-types-8bUndWfg.cjs';
|
|
3
|
+
import '../bus-DzTqgkZ4.cjs';
|
|
4
4
|
import { BitJoiResolverConfig, BitResolverScopeOptions } from './types.cjs';
|
|
5
|
-
import '../types-D8DgIUhJ.cjs';
|
|
6
5
|
|
|
7
6
|
declare const joiResolver: <T extends object>(schema: ObjectSchema<T>, config?: BitJoiResolverConfig) => (values: T, options?: BitResolverScopeOptions) => Promise<BitErrors<T>>;
|
|
8
7
|
|
package/dist/resolvers/joi.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { ObjectSchema } from 'joi';
|
|
2
|
-
import {
|
|
3
|
-
import '../bus-
|
|
2
|
+
import { b as BitErrors } from '../state-types-8bUndWfg.js';
|
|
3
|
+
import '../bus-BFOBGmd9.js';
|
|
4
4
|
import { BitJoiResolverConfig, BitResolverScopeOptions } from './types.js';
|
|
5
|
-
import '../types-D8DgIUhJ.js';
|
|
6
5
|
|
|
7
6
|
declare const joiResolver: <T extends object>(schema: ObjectSchema<T>, config?: BitJoiResolverConfig) => (values: T, options?: BitResolverScopeOptions) => Promise<BitErrors<T>>;
|
|
8
7
|
|
package/dist/resolvers/yup.d.cts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { Schema } from 'yup';
|
|
2
|
-
import {
|
|
3
|
-
import '../bus-
|
|
2
|
+
import { b as BitErrors } from '../state-types-8bUndWfg.cjs';
|
|
3
|
+
import '../bus-DzTqgkZ4.cjs';
|
|
4
4
|
import { BitYupResolverConfig, BitResolverScopeOptions } from './types.cjs';
|
|
5
|
-
import '../types-D8DgIUhJ.cjs';
|
|
6
5
|
|
|
7
6
|
declare const yupResolver: <T extends object>(schema: Schema<T>, config?: BitYupResolverConfig) => (values: T, options?: BitResolverScopeOptions) => Promise<BitErrors<T>>;
|
|
8
7
|
|
package/dist/resolvers/yup.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { Schema } from 'yup';
|
|
2
|
-
import {
|
|
3
|
-
import '../bus-
|
|
2
|
+
import { b as BitErrors } from '../state-types-8bUndWfg.js';
|
|
3
|
+
import '../bus-BFOBGmd9.js';
|
|
4
4
|
import { BitYupResolverConfig, BitResolverScopeOptions } from './types.js';
|
|
5
|
-
import '../types-D8DgIUhJ.js';
|
|
6
5
|
|
|
7
6
|
declare const yupResolver: <T extends object>(schema: Schema<T>, config?: BitYupResolverConfig) => (values: T, options?: BitResolverScopeOptions) => Promise<BitErrors<T>>;
|
|
8
7
|
|
package/dist/resolvers/zod.d.cts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { ZodSchema } from 'zod';
|
|
2
|
-
import {
|
|
3
|
-
import '../bus-
|
|
2
|
+
import { b as BitErrors } from '../state-types-8bUndWfg.cjs';
|
|
3
|
+
import '../bus-DzTqgkZ4.cjs';
|
|
4
4
|
import { BitZodResolverConfig, BitResolverScopeOptions } from './types.cjs';
|
|
5
|
-
import '../types-D8DgIUhJ.cjs';
|
|
6
5
|
|
|
7
6
|
declare const zodResolver: <T extends object>(schema: ZodSchema<T>, _config?: BitZodResolverConfig) => (values: T, options?: BitResolverScopeOptions) => Promise<BitErrors<T>>;
|
|
8
7
|
|
package/dist/resolvers/zod.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { ZodSchema } from 'zod';
|
|
2
|
-
import {
|
|
3
|
-
import '../bus-
|
|
2
|
+
import { b as BitErrors } from '../state-types-8bUndWfg.js';
|
|
3
|
+
import '../bus-BFOBGmd9.js';
|
|
4
4
|
import { BitZodResolverConfig, BitResolverScopeOptions } from './types.js';
|
|
5
|
-
import '../types-D8DgIUhJ.js';
|
|
6
5
|
|
|
7
6
|
declare const zodResolver: <T extends object>(schema: ZodSchema<T>, _config?: BitZodResolverConfig) => (values: T, options?: BitResolverScopeOptions) => Promise<BitErrors<T>>;
|
|
8
7
|
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pluggable scheduler used for validation debounce.
|
|
3
|
+
* Replace the default (setTimeout-based) with a framework-aware scheduler.
|
|
4
|
+
*/
|
|
5
|
+
interface BitScheduler {
|
|
6
|
+
schedule(fn: () => void, delayMs: number): () => void;
|
|
7
|
+
}
|
|
8
|
+
interface BitIdFactoryContext {
|
|
9
|
+
scope: "store" | "array";
|
|
10
|
+
path?: string;
|
|
11
|
+
index?: number;
|
|
12
|
+
storeName?: string;
|
|
13
|
+
}
|
|
14
|
+
type BitIdFactory = (context: BitIdFactoryContext) => string;
|
|
15
|
+
type BitSubmitResult = {
|
|
16
|
+
status: "submitted";
|
|
17
|
+
} | {
|
|
18
|
+
status: "invalid";
|
|
19
|
+
} | {
|
|
20
|
+
status: "failed";
|
|
21
|
+
error: unknown;
|
|
22
|
+
} | {
|
|
23
|
+
status: "blocked";
|
|
24
|
+
reason: "isSubmitting" | "validating";
|
|
25
|
+
};
|
|
26
|
+
/** Return type of BitStore.getScopeStatus, used by useBitScope/injectBitScope. */
|
|
27
|
+
interface ScopeStatus {
|
|
28
|
+
hasErrors: boolean;
|
|
29
|
+
isDirty: boolean;
|
|
30
|
+
errors: Record<string, string>;
|
|
31
|
+
}
|
|
32
|
+
/** Return type of scope validation helpers, used by useBitScope/injectBitScope. */
|
|
33
|
+
interface ValidateScopeResult {
|
|
34
|
+
valid: boolean;
|
|
35
|
+
errors: Record<string, string>;
|
|
36
|
+
}
|
|
37
|
+
interface DevToolsOptions {
|
|
38
|
+
enabled?: boolean;
|
|
39
|
+
mode?: "local" | "remote";
|
|
40
|
+
url?: string;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export type { BitScheduler as B, DevToolsOptions as D, ScopeStatus as S, ValidateScopeResult as V, BitSubmitResult as a, BitIdFactory as b };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pluggable scheduler used for validation debounce.
|
|
3
|
+
* Replace the default (setTimeout-based) with a framework-aware scheduler.
|
|
4
|
+
*/
|
|
5
|
+
interface BitScheduler {
|
|
6
|
+
schedule(fn: () => void, delayMs: number): () => void;
|
|
7
|
+
}
|
|
8
|
+
interface BitIdFactoryContext {
|
|
9
|
+
scope: "store" | "array";
|
|
10
|
+
path?: string;
|
|
11
|
+
index?: number;
|
|
12
|
+
storeName?: string;
|
|
13
|
+
}
|
|
14
|
+
type BitIdFactory = (context: BitIdFactoryContext) => string;
|
|
15
|
+
type BitSubmitResult = {
|
|
16
|
+
status: "submitted";
|
|
17
|
+
} | {
|
|
18
|
+
status: "invalid";
|
|
19
|
+
} | {
|
|
20
|
+
status: "failed";
|
|
21
|
+
error: unknown;
|
|
22
|
+
} | {
|
|
23
|
+
status: "blocked";
|
|
24
|
+
reason: "isSubmitting" | "validating";
|
|
25
|
+
};
|
|
26
|
+
/** Return type of BitStore.getScopeStatus, used by useBitScope/injectBitScope. */
|
|
27
|
+
interface ScopeStatus {
|
|
28
|
+
hasErrors: boolean;
|
|
29
|
+
isDirty: boolean;
|
|
30
|
+
errors: Record<string, string>;
|
|
31
|
+
}
|
|
32
|
+
/** Return type of scope validation helpers, used by useBitScope/injectBitScope. */
|
|
33
|
+
interface ValidateScopeResult {
|
|
34
|
+
valid: boolean;
|
|
35
|
+
errors: Record<string, string>;
|
|
36
|
+
}
|
|
37
|
+
interface DevToolsOptions {
|
|
38
|
+
enabled?: boolean;
|
|
39
|
+
mode?: "local" | "remote";
|
|
40
|
+
url?: string;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export type { BitScheduler as B, DevToolsOptions as D, ScopeStatus as S, ValidateScopeResult as V, BitSubmitResult as a, BitIdFactory as b };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type-safe path utilities for form structures.
|
|
3
|
+
*/
|
|
4
|
+
type Primitive = string | number | boolean | bigint | symbol | null | undefined;
|
|
5
|
+
type BitPath<T, Prefix extends string = ""> = T extends Primitive ? never : T extends readonly (infer U)[] ? Prefix extends "" ? `${number}` | `${number}.${BitPath<U>}` : `${Prefix}.${number}` | `${Prefix}.${number}.${BitPath<U>}` : {
|
|
6
|
+
[K in keyof T & (string | number)]: T[K] extends Primitive ? Prefix extends "" ? `${K & (string | number)}` : `${Prefix}.${K & (string | number)}` : Prefix extends "" ? `${K & (string | number)}` | `${K & (string | number)}.${BitPath<T[K]>}` : `${Prefix}.${K & (string | number)}` | `${Prefix}.${K & (string | number)}.${BitPath<T[K]>}`;
|
|
7
|
+
}[keyof T & (string | number)];
|
|
8
|
+
type BitPathValue<T, P extends string> = P extends `${infer K}.${infer Rest}` ? K extends `${number}` ? T extends readonly (infer U)[] ? BitPathValue<U, Rest> : never : K extends keyof T ? BitPathValue<T[K], Rest> : never : P extends `${number}` ? T extends readonly (infer U)[] ? U : never : P extends keyof T ? T[P] : never;
|
|
9
|
+
type BitArrayPath<T> = BitPath<T> extends infer P ? P extends string ? BitPathValue<T, P> extends readonly unknown[] ? P : never : never : never;
|
|
10
|
+
type BitArrayItem<A> = A extends readonly (infer U)[] ? U : A extends (infer U)[] ? U : never;
|
|
11
|
+
|
|
12
|
+
type DeepPartial<T> = T extends object ? {
|
|
13
|
+
[P in keyof T]?: DeepPartial<T[P]>;
|
|
14
|
+
} : T;
|
|
15
|
+
type BitErrors<T extends object> = Partial<Record<BitPath<T>, string | undefined>>;
|
|
16
|
+
type BitTouched<T extends object> = Partial<Record<BitPath<T>, boolean | undefined>>;
|
|
17
|
+
interface BitPersistMetadata {
|
|
18
|
+
isSaving: boolean;
|
|
19
|
+
isRestoring: boolean;
|
|
20
|
+
error: Error | null;
|
|
21
|
+
}
|
|
22
|
+
interface BitState<T extends object> {
|
|
23
|
+
values: T;
|
|
24
|
+
errors: BitErrors<T>;
|
|
25
|
+
touched: BitTouched<T>;
|
|
26
|
+
isValidating: Record<string, boolean>;
|
|
27
|
+
persist: BitPersistMetadata;
|
|
28
|
+
isValid: boolean;
|
|
29
|
+
isSubmitting: boolean;
|
|
30
|
+
isDirty: boolean;
|
|
31
|
+
}
|
|
32
|
+
interface BitFieldState<_T extends object = Record<string, unknown>, TValue = unknown> {
|
|
33
|
+
value: TValue;
|
|
34
|
+
error: string | undefined;
|
|
35
|
+
touched: boolean;
|
|
36
|
+
isHidden: boolean;
|
|
37
|
+
isRequired: boolean;
|
|
38
|
+
isDirty: boolean;
|
|
39
|
+
isValidating: boolean;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export type { BitArrayItem as B, DeepPartial as D, BitArrayPath as a, BitErrors as b, BitFieldState as c, BitPath as d, BitPathValue as e, BitPersistMetadata as f, BitState as g, BitTouched as h };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type-safe path utilities for form structures.
|
|
3
|
+
*/
|
|
4
|
+
type Primitive = string | number | boolean | bigint | symbol | null | undefined;
|
|
5
|
+
type BitPath<T, Prefix extends string = ""> = T extends Primitive ? never : T extends readonly (infer U)[] ? Prefix extends "" ? `${number}` | `${number}.${BitPath<U>}` : `${Prefix}.${number}` | `${Prefix}.${number}.${BitPath<U>}` : {
|
|
6
|
+
[K in keyof T & (string | number)]: T[K] extends Primitive ? Prefix extends "" ? `${K & (string | number)}` : `${Prefix}.${K & (string | number)}` : Prefix extends "" ? `${K & (string | number)}` | `${K & (string | number)}.${BitPath<T[K]>}` : `${Prefix}.${K & (string | number)}` | `${Prefix}.${K & (string | number)}.${BitPath<T[K]>}`;
|
|
7
|
+
}[keyof T & (string | number)];
|
|
8
|
+
type BitPathValue<T, P extends string> = P extends `${infer K}.${infer Rest}` ? K extends `${number}` ? T extends readonly (infer U)[] ? BitPathValue<U, Rest> : never : K extends keyof T ? BitPathValue<T[K], Rest> : never : P extends `${number}` ? T extends readonly (infer U)[] ? U : never : P extends keyof T ? T[P] : never;
|
|
9
|
+
type BitArrayPath<T> = BitPath<T> extends infer P ? P extends string ? BitPathValue<T, P> extends readonly unknown[] ? P : never : never : never;
|
|
10
|
+
type BitArrayItem<A> = A extends readonly (infer U)[] ? U : A extends (infer U)[] ? U : never;
|
|
11
|
+
|
|
12
|
+
type DeepPartial<T> = T extends object ? {
|
|
13
|
+
[P in keyof T]?: DeepPartial<T[P]>;
|
|
14
|
+
} : T;
|
|
15
|
+
type BitErrors<T extends object> = Partial<Record<BitPath<T>, string | undefined>>;
|
|
16
|
+
type BitTouched<T extends object> = Partial<Record<BitPath<T>, boolean | undefined>>;
|
|
17
|
+
interface BitPersistMetadata {
|
|
18
|
+
isSaving: boolean;
|
|
19
|
+
isRestoring: boolean;
|
|
20
|
+
error: Error | null;
|
|
21
|
+
}
|
|
22
|
+
interface BitState<T extends object> {
|
|
23
|
+
values: T;
|
|
24
|
+
errors: BitErrors<T>;
|
|
25
|
+
touched: BitTouched<T>;
|
|
26
|
+
isValidating: Record<string, boolean>;
|
|
27
|
+
persist: BitPersistMetadata;
|
|
28
|
+
isValid: boolean;
|
|
29
|
+
isSubmitting: boolean;
|
|
30
|
+
isDirty: boolean;
|
|
31
|
+
}
|
|
32
|
+
interface BitFieldState<_T extends object = Record<string, unknown>, TValue = unknown> {
|
|
33
|
+
value: TValue;
|
|
34
|
+
error: string | undefined;
|
|
35
|
+
touched: boolean;
|
|
36
|
+
isHidden: boolean;
|
|
37
|
+
isRequired: boolean;
|
|
38
|
+
isDirty: boolean;
|
|
39
|
+
isValidating: boolean;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export type { BitArrayItem as B, DeepPartial as D, BitArrayPath as a, BitErrors as b, BitFieldState as c, BitPath as d, BitPathValue as e, BitPersistMetadata as f, BitState as g, BitTouched as h };
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import { B as BitMask } from './types-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { B as BitMask } from './types-CUXh7PqD.js';
|
|
2
|
+
import { c as BitFormGlobal } from './bus-BFOBGmd9.js';
|
|
3
|
+
import { e as BitConfig, V as ValidatorFn, i as BitFieldDefinition, v as BitPersistResolvedConfig, p as BitPlugin, w as BitOperationalErrorSource } from './config-types-D9n-rQLk.js';
|
|
4
|
+
import { g as BitState, d as BitPath, c as BitFieldState, e as BitPathValue, f as BitPersistMetadata, D as DeepPartial, b as BitErrors, a as BitArrayPath, B as BitArrayItem } from './state-types-8bUndWfg.js';
|
|
5
|
+
import { D as DevToolsOptions, b as BitIdFactory, B as BitScheduler, S as ScopeStatus, a as BitSubmitResult } from './runtime-types-D1SRZr-n.js';
|
|
6
|
+
import { a as BitHistoryMetadata, B as BitFormMeta, c as BitServerErrorOptions, b as BitValidationOptions } from './meta-types-BC1VLABk.js';
|
|
4
7
|
|
|
5
8
|
interface BitValidationTriggerOptions {
|
|
6
9
|
forceDebounce?: boolean;
|
|
@@ -76,10 +79,10 @@ interface BitFormWriteApi<T extends object = Record<string, unknown>> {
|
|
|
76
79
|
}): void;
|
|
77
80
|
setError(path: string, message: string | undefined): void;
|
|
78
81
|
setErrors(errors: BitErrors<T>): void;
|
|
79
|
-
setServerErrors(serverErrors: Record<string, string[] | string
|
|
82
|
+
setServerErrors(serverErrors: Record<string, string[] | string>, options?: BitServerErrorOptions): void;
|
|
80
83
|
reset(): void;
|
|
81
84
|
transaction<TResult>(callback: () => TResult): TResult;
|
|
82
|
-
submit(onSuccess: (values: T, dirtyValues?: Partial<T>) =>
|
|
85
|
+
submit(onSuccess: (values: T, dirtyValues?: Partial<T>) => unknown | Promise<unknown>): Promise<BitSubmitResult>;
|
|
83
86
|
}
|
|
84
87
|
interface BitStoreLifecycleApi {
|
|
85
88
|
cleanup(): void;
|
|
@@ -103,6 +106,7 @@ interface BitStoreArrayFeatureApi<T extends object = Record<string, unknown>> {
|
|
|
103
106
|
swapItems<P extends BitArrayPath<T>>(path: P, indexA: number, indexB: number): void;
|
|
104
107
|
replaceItems<P extends BitArrayPath<T>>(path: P, items: BitArrayItem<BitPathValue<T, P>>[]): void;
|
|
105
108
|
clearItems<P extends BitArrayPath<T>>(path: P): void;
|
|
109
|
+
getArrayItemIds<P extends BitArrayPath<T>>(path: P, length?: number): string[];
|
|
106
110
|
}
|
|
107
111
|
interface BitStoreHistoryFeatureApi {
|
|
108
112
|
readonly canUndo: boolean;
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import { B as BitMask } from './types-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { B as BitMask } from './types-CUXh7PqD.cjs';
|
|
2
|
+
import { c as BitFormGlobal } from './bus-DzTqgkZ4.cjs';
|
|
3
|
+
import { e as BitConfig, V as ValidatorFn, i as BitFieldDefinition, v as BitPersistResolvedConfig, p as BitPlugin, w as BitOperationalErrorSource } from './config-types-5eR82k2V.cjs';
|
|
4
|
+
import { g as BitState, d as BitPath, c as BitFieldState, e as BitPathValue, f as BitPersistMetadata, D as DeepPartial, b as BitErrors, a as BitArrayPath, B as BitArrayItem } from './state-types-8bUndWfg.cjs';
|
|
5
|
+
import { D as DevToolsOptions, b as BitIdFactory, B as BitScheduler, S as ScopeStatus, a as BitSubmitResult } from './runtime-types-D1SRZr-n.cjs';
|
|
6
|
+
import { a as BitHistoryMetadata, B as BitFormMeta, c as BitServerErrorOptions, b as BitValidationOptions } from './meta-types-BC1VLABk.cjs';
|
|
4
7
|
|
|
5
8
|
interface BitValidationTriggerOptions {
|
|
6
9
|
forceDebounce?: boolean;
|
|
@@ -76,10 +79,10 @@ interface BitFormWriteApi<T extends object = Record<string, unknown>> {
|
|
|
76
79
|
}): void;
|
|
77
80
|
setError(path: string, message: string | undefined): void;
|
|
78
81
|
setErrors(errors: BitErrors<T>): void;
|
|
79
|
-
setServerErrors(serverErrors: Record<string, string[] | string
|
|
82
|
+
setServerErrors(serverErrors: Record<string, string[] | string>, options?: BitServerErrorOptions): void;
|
|
80
83
|
reset(): void;
|
|
81
84
|
transaction<TResult>(callback: () => TResult): TResult;
|
|
82
|
-
submit(onSuccess: (values: T, dirtyValues?: Partial<T>) =>
|
|
85
|
+
submit(onSuccess: (values: T, dirtyValues?: Partial<T>) => unknown | Promise<unknown>): Promise<BitSubmitResult>;
|
|
83
86
|
}
|
|
84
87
|
interface BitStoreLifecycleApi {
|
|
85
88
|
cleanup(): void;
|
|
@@ -103,6 +106,7 @@ interface BitStoreArrayFeatureApi<T extends object = Record<string, unknown>> {
|
|
|
103
106
|
swapItems<P extends BitArrayPath<T>>(path: P, indexA: number, indexB: number): void;
|
|
104
107
|
replaceItems<P extends BitArrayPath<T>>(path: P, items: BitArrayItem<BitPathValue<T, P>>[]): void;
|
|
105
108
|
clearItems<P extends BitArrayPath<T>>(path: P): void;
|
|
109
|
+
getArrayItemIds<P extends BitArrayPath<T>>(path: P, length?: number): string[];
|
|
106
110
|
}
|
|
107
111
|
interface BitStoreHistoryFeatureApi {
|
|
108
112
|
readonly canUndo: boolean;
|
|
@@ -24,4 +24,4 @@ interface DateMaskConfig extends PatternMaskOptions {
|
|
|
24
24
|
format?: "DD/MM/YYYY" | "YYYY-MM-DD";
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
export type { BitMask as B, CurrencyMaskConfig as C, DateMaskConfig as D, PatternMaskOptions as P,
|
|
27
|
+
export type { BitMask as B, CurrencyMaskConfig as C, DateMaskConfig as D, PatternMaskOptions as P, BitBuiltInMaskName as a, BitMaskName as b };
|
|
@@ -24,4 +24,4 @@ interface DateMaskConfig extends PatternMaskOptions {
|
|
|
24
24
|
format?: "DD/MM/YYYY" | "YYYY-MM-DD";
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
export type { BitMask as B, CurrencyMaskConfig as C, DateMaskConfig as D, PatternMaskOptions as P,
|
|
27
|
+
export type { BitMask as B, CurrencyMaskConfig as C, DateMaskConfig as D, PatternMaskOptions as P, BitBuiltInMaskName as a, BitMaskName as b };
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { a as BitArrayPath, B as BitArrayItem, e as BitPathValue } from './state-types-8bUndWfg.cjs';
|
|
2
|
+
|
|
3
|
+
interface BitArrayBindingField<TItem> {
|
|
4
|
+
key: string;
|
|
5
|
+
value: TItem;
|
|
6
|
+
index: number;
|
|
7
|
+
}
|
|
8
|
+
interface BitArrayBinding<TForm extends object, P extends BitArrayPath<TForm>> {
|
|
9
|
+
readItems(): BitArrayItem<BitPathValue<TForm, P>>[];
|
|
10
|
+
getFields(items: BitArrayItem<BitPathValue<TForm, P>>[]): BitArrayBindingField<BitArrayItem<BitPathValue<TForm, P>>>[];
|
|
11
|
+
append(value: BitArrayItem<BitPathValue<TForm, P>>): void;
|
|
12
|
+
prepend(value: BitArrayItem<BitPathValue<TForm, P>>): void;
|
|
13
|
+
insert(index: number, value: BitArrayItem<BitPathValue<TForm, P>>): void;
|
|
14
|
+
remove(index: number): void;
|
|
15
|
+
move(from: number, to: number): void;
|
|
16
|
+
swap(indexA: number, indexB: number): void;
|
|
17
|
+
replace(items: BitArrayItem<BitPathValue<TForm, P>>[]): void;
|
|
18
|
+
clear(): void;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Shared framework adapter contracts.
|
|
23
|
+
*
|
|
24
|
+
* These contracts define shape only; each framework provides its own reactive wrappers.
|
|
25
|
+
*/
|
|
26
|
+
interface BitStepsAdapterResult<TStep, TStepIndex, TScope, TBoolean, TStatus, TErrors, TValidateResult> {
|
|
27
|
+
step: TStep;
|
|
28
|
+
stepIndex: TStepIndex;
|
|
29
|
+
scope: TScope;
|
|
30
|
+
next: () => Promise<boolean>;
|
|
31
|
+
prev: () => void;
|
|
32
|
+
goTo: (step: number) => void;
|
|
33
|
+
isFirst: TBoolean;
|
|
34
|
+
isLast: TBoolean;
|
|
35
|
+
status: TStatus;
|
|
36
|
+
errors: TErrors;
|
|
37
|
+
isValid: TBoolean;
|
|
38
|
+
isDirty: TBoolean;
|
|
39
|
+
validate: () => Promise<TValidateResult>;
|
|
40
|
+
getErrors: () => Record<string, string>;
|
|
41
|
+
}
|
|
42
|
+
interface BitHistoryAdapterResult<TCanUndo, TCanRedo, THistoryIndex, THistorySize> {
|
|
43
|
+
canUndo: TCanUndo;
|
|
44
|
+
canRedo: TCanRedo;
|
|
45
|
+
historyIndex: THistoryIndex;
|
|
46
|
+
historySize: THistorySize;
|
|
47
|
+
undo: () => void;
|
|
48
|
+
redo: () => void;
|
|
49
|
+
}
|
|
50
|
+
interface BitPersistAdapterResult<TMeta> {
|
|
51
|
+
restore: () => Promise<boolean>;
|
|
52
|
+
save: () => Promise<void>;
|
|
53
|
+
clear: () => Promise<void>;
|
|
54
|
+
meta: TMeta;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Upload Integration Types
|
|
59
|
+
*
|
|
60
|
+
* Core types for backend-first upload integration.
|
|
61
|
+
*/
|
|
62
|
+
/** Upload result with URL and key for reference/deletion. */
|
|
63
|
+
interface BitUploadResult<TMetadata extends Record<string, unknown> = Record<string, unknown>> {
|
|
64
|
+
url: string;
|
|
65
|
+
key: string;
|
|
66
|
+
metadata?: TMetadata;
|
|
67
|
+
}
|
|
68
|
+
/** Upload function contract (backend-first). All context is managed by the caller. */
|
|
69
|
+
type BitUploadFn<TMetadata extends Record<string, unknown> = Record<string, unknown>> = (file: File) => Promise<BitUploadResult<TMetadata>>;
|
|
70
|
+
/** Optional delete function contract. */
|
|
71
|
+
type BitDeleteUploadFn = (key: string) => Promise<void>;
|
|
72
|
+
/** Canonical value used by upload bindings across frameworks. */
|
|
73
|
+
type BitUploadValue = string | File | null;
|
|
74
|
+
/** Input accepted by upload handlers. */
|
|
75
|
+
type BitUploadInput = File | null | undefined;
|
|
76
|
+
/**
|
|
77
|
+
* Base upload contract for framework adapters.
|
|
78
|
+
* Frameworks specialize `value`, `error`, and `isValidating` with their reactive wrappers.
|
|
79
|
+
*/
|
|
80
|
+
interface BitUploadAdapterResult<TValue, TError, TIsValidating> {
|
|
81
|
+
value: TValue;
|
|
82
|
+
setValue: (value: BitUploadValue) => void;
|
|
83
|
+
error: TError;
|
|
84
|
+
isValidating: TIsValidating;
|
|
85
|
+
upload: (file: BitUploadInput) => Promise<void>;
|
|
86
|
+
remove: () => Promise<void>;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export type { BitArrayBinding as B, BitArrayBindingField as a, BitDeleteUploadFn as b, BitHistoryAdapterResult as c, BitPersistAdapterResult as d, BitStepsAdapterResult as e, BitUploadAdapterResult as f, BitUploadFn as g, BitUploadInput as h, BitUploadResult as i, BitUploadValue as j };
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { a as BitArrayPath, B as BitArrayItem, e as BitPathValue } from './state-types-8bUndWfg.js';
|
|
2
|
+
|
|
3
|
+
interface BitArrayBindingField<TItem> {
|
|
4
|
+
key: string;
|
|
5
|
+
value: TItem;
|
|
6
|
+
index: number;
|
|
7
|
+
}
|
|
8
|
+
interface BitArrayBinding<TForm extends object, P extends BitArrayPath<TForm>> {
|
|
9
|
+
readItems(): BitArrayItem<BitPathValue<TForm, P>>[];
|
|
10
|
+
getFields(items: BitArrayItem<BitPathValue<TForm, P>>[]): BitArrayBindingField<BitArrayItem<BitPathValue<TForm, P>>>[];
|
|
11
|
+
append(value: BitArrayItem<BitPathValue<TForm, P>>): void;
|
|
12
|
+
prepend(value: BitArrayItem<BitPathValue<TForm, P>>): void;
|
|
13
|
+
insert(index: number, value: BitArrayItem<BitPathValue<TForm, P>>): void;
|
|
14
|
+
remove(index: number): void;
|
|
15
|
+
move(from: number, to: number): void;
|
|
16
|
+
swap(indexA: number, indexB: number): void;
|
|
17
|
+
replace(items: BitArrayItem<BitPathValue<TForm, P>>[]): void;
|
|
18
|
+
clear(): void;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Shared framework adapter contracts.
|
|
23
|
+
*
|
|
24
|
+
* These contracts define shape only; each framework provides its own reactive wrappers.
|
|
25
|
+
*/
|
|
26
|
+
interface BitStepsAdapterResult<TStep, TStepIndex, TScope, TBoolean, TStatus, TErrors, TValidateResult> {
|
|
27
|
+
step: TStep;
|
|
28
|
+
stepIndex: TStepIndex;
|
|
29
|
+
scope: TScope;
|
|
30
|
+
next: () => Promise<boolean>;
|
|
31
|
+
prev: () => void;
|
|
32
|
+
goTo: (step: number) => void;
|
|
33
|
+
isFirst: TBoolean;
|
|
34
|
+
isLast: TBoolean;
|
|
35
|
+
status: TStatus;
|
|
36
|
+
errors: TErrors;
|
|
37
|
+
isValid: TBoolean;
|
|
38
|
+
isDirty: TBoolean;
|
|
39
|
+
validate: () => Promise<TValidateResult>;
|
|
40
|
+
getErrors: () => Record<string, string>;
|
|
41
|
+
}
|
|
42
|
+
interface BitHistoryAdapterResult<TCanUndo, TCanRedo, THistoryIndex, THistorySize> {
|
|
43
|
+
canUndo: TCanUndo;
|
|
44
|
+
canRedo: TCanRedo;
|
|
45
|
+
historyIndex: THistoryIndex;
|
|
46
|
+
historySize: THistorySize;
|
|
47
|
+
undo: () => void;
|
|
48
|
+
redo: () => void;
|
|
49
|
+
}
|
|
50
|
+
interface BitPersistAdapterResult<TMeta> {
|
|
51
|
+
restore: () => Promise<boolean>;
|
|
52
|
+
save: () => Promise<void>;
|
|
53
|
+
clear: () => Promise<void>;
|
|
54
|
+
meta: TMeta;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Upload Integration Types
|
|
59
|
+
*
|
|
60
|
+
* Core types for backend-first upload integration.
|
|
61
|
+
*/
|
|
62
|
+
/** Upload result with URL and key for reference/deletion. */
|
|
63
|
+
interface BitUploadResult<TMetadata extends Record<string, unknown> = Record<string, unknown>> {
|
|
64
|
+
url: string;
|
|
65
|
+
key: string;
|
|
66
|
+
metadata?: TMetadata;
|
|
67
|
+
}
|
|
68
|
+
/** Upload function contract (backend-first). All context is managed by the caller. */
|
|
69
|
+
type BitUploadFn<TMetadata extends Record<string, unknown> = Record<string, unknown>> = (file: File) => Promise<BitUploadResult<TMetadata>>;
|
|
70
|
+
/** Optional delete function contract. */
|
|
71
|
+
type BitDeleteUploadFn = (key: string) => Promise<void>;
|
|
72
|
+
/** Canonical value used by upload bindings across frameworks. */
|
|
73
|
+
type BitUploadValue = string | File | null;
|
|
74
|
+
/** Input accepted by upload handlers. */
|
|
75
|
+
type BitUploadInput = File | null | undefined;
|
|
76
|
+
/**
|
|
77
|
+
* Base upload contract for framework adapters.
|
|
78
|
+
* Frameworks specialize `value`, `error`, and `isValidating` with their reactive wrappers.
|
|
79
|
+
*/
|
|
80
|
+
interface BitUploadAdapterResult<TValue, TError, TIsValidating> {
|
|
81
|
+
value: TValue;
|
|
82
|
+
setValue: (value: BitUploadValue) => void;
|
|
83
|
+
error: TError;
|
|
84
|
+
isValidating: TIsValidating;
|
|
85
|
+
upload: (file: BitUploadInput) => Promise<void>;
|
|
86
|
+
remove: () => Promise<void>;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export type { BitArrayBinding as B, BitArrayBindingField as a, BitDeleteUploadFn as b, BitHistoryAdapterResult as c, BitPersistAdapterResult as d, BitStepsAdapterResult as e, BitUploadAdapterResult as f, BitUploadFn as g, BitUploadInput as h, BitUploadResult as i, BitUploadValue as j };
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import { b as BitFrameworkStoreApi, e as BitStoreApi } from './store-api-types-
|
|
4
|
-
import './bus-
|
|
5
|
-
import {
|
|
6
|
-
import { a as BitArrayBindingField } from './
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
3
|
+
import { b as BitFrameworkStoreApi, e as BitStoreApi } from './store-api-types-Bozwlwyb.js';
|
|
4
|
+
import './bus-BFOBGmd9.js';
|
|
5
|
+
import { d as BitPath, e as BitPathValue, f as BitPersistMetadata, b as BitErrors, h as BitTouched, D as DeepPartial, a as BitArrayPath, B as BitArrayItem } from './state-types-8bUndWfg.js';
|
|
6
|
+
import { c as BitHistoryAdapterResult, d as BitPersistAdapterResult, e as BitStepsAdapterResult, f as BitUploadAdapterResult, a as BitArrayBindingField } from './upload-ao6skK9K.js';
|
|
7
|
+
import { S as ScopeStatus, V as ValidateScopeResult } from './runtime-types-D1SRZr-n.js';
|
|
8
|
+
import { a as BitHistoryMetadata, b as BitValidationOptions } from './meta-types-BC1VLABk.js';
|
|
9
|
+
import { B as BitFieldInputEvent } from './field-binding-Bi1g-D8X.js';
|
|
9
10
|
|
|
10
11
|
declare const BitFormProvider: ({ store, children, }: {
|
|
11
12
|
store: BitFrameworkStoreApi<any> | BitStoreApi<any>;
|
|
@@ -52,52 +53,18 @@ interface UseBitFieldResult<TForm extends object = any, P extends BitPath<TForm>
|
|
|
52
53
|
* Result from useBitSteps hook.
|
|
53
54
|
* Provides multi-step form navigation and validation.
|
|
54
55
|
*/
|
|
55
|
-
|
|
56
|
-
step: number;
|
|
57
|
-
stepIndex: number;
|
|
58
|
-
scope: string;
|
|
59
|
-
next: () => Promise<boolean>;
|
|
60
|
-
prev: () => void;
|
|
61
|
-
goTo: (step: number) => void;
|
|
62
|
-
isFirst: boolean;
|
|
63
|
-
isLast: boolean;
|
|
64
|
-
status: ScopeStatus;
|
|
65
|
-
errors: Record<string, string>;
|
|
66
|
-
isValid: boolean;
|
|
67
|
-
isDirty: boolean;
|
|
68
|
-
validate: () => Promise<ValidateScopeResult>;
|
|
69
|
-
getErrors: () => Record<string, string>;
|
|
70
|
-
}
|
|
56
|
+
type UseBitStepsResult = BitStepsAdapterResult<number, number, string, boolean, ScopeStatus, Record<string, string>, ValidateScopeResult>;
|
|
71
57
|
/**
|
|
72
58
|
* Result from useBitUpload hook.
|
|
73
59
|
* Provides file upload functionality with integrated validation.
|
|
74
60
|
*/
|
|
75
|
-
|
|
76
|
-
value: string | File | null;
|
|
77
|
-
setValue: (value: string | File | null) => void;
|
|
78
|
-
error?: string;
|
|
79
|
-
isValidating: boolean;
|
|
80
|
-
upload: (file: File | null | undefined) => Promise<void>;
|
|
81
|
-
remove: () => Promise<void>;
|
|
82
|
-
}
|
|
61
|
+
type UseBitUploadResult = BitUploadAdapterResult<string | File | null, string | undefined, boolean>;
|
|
83
62
|
/**
|
|
84
63
|
* Result from useBitHistory hook.
|
|
85
64
|
* Provides form history undo/redo capabilities.
|
|
86
65
|
*/
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
canRedo: BitHistoryMetadata["canRedo"];
|
|
90
|
-
historyIndex: BitHistoryMetadata["historyIndex"];
|
|
91
|
-
historySize: BitHistoryMetadata["historySize"];
|
|
92
|
-
undo: () => void;
|
|
93
|
-
redo: () => void;
|
|
94
|
-
}
|
|
95
|
-
interface UseBitPersistResult {
|
|
96
|
-
restore: () => Promise<boolean>;
|
|
97
|
-
save: () => Promise<void>;
|
|
98
|
-
clear: () => Promise<void>;
|
|
99
|
-
meta: BitPersistMetadata;
|
|
100
|
-
}
|
|
66
|
+
type UseBitHistoryResult = BitHistoryAdapterResult<BitHistoryMetadata["canUndo"], BitHistoryMetadata["canRedo"], BitHistoryMetadata["historyIndex"], BitHistoryMetadata["historySize"]>;
|
|
67
|
+
type UseBitPersistResult = BitPersistAdapterResult<BitPersistMetadata>;
|
|
101
68
|
interface UseBitFormMeta {
|
|
102
69
|
isValid: boolean;
|
|
103
70
|
isDirty: boolean;
|
|
@@ -111,7 +78,7 @@ interface UseBitFormResult<T extends object = any> {
|
|
|
111
78
|
getErrors: () => BitErrors<T>;
|
|
112
79
|
getTouched: () => BitTouched<T>;
|
|
113
80
|
getDirtyValues: () => Partial<T>;
|
|
114
|
-
submit: (onSuccess: (values: T, dirtyValues?: Partial<T>) =>
|
|
81
|
+
submit: (onSuccess: (values: T, dirtyValues?: Partial<T>) => unknown | Promise<unknown>) => (e?: {
|
|
115
82
|
preventDefault: () => void;
|
|
116
83
|
}) => Promise<void>;
|
|
117
84
|
onSubmit: (handler: (values: T, dirtyValues?: Partial<T>) => Promise<unknown>) => (e?: {
|