@factorialco/f0-react 1.457.1 → 1.458.1

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/ai.d.ts CHANGED
@@ -3209,6 +3209,11 @@ declare module "gridstack" {
3209
3209
  }
3210
3210
 
3211
3211
 
3212
+ declare namespace Calendar {
3213
+ var displayName: string;
3214
+ }
3215
+
3216
+
3212
3217
  declare module "@tiptap/core" {
3213
3218
  interface Commands<ReturnType> {
3214
3219
  aiBlock: {
@@ -3221,9 +3226,8 @@ declare module "@tiptap/core" {
3221
3226
 
3222
3227
  declare module "@tiptap/core" {
3223
3228
  interface Commands<ReturnType> {
3224
- enhanceHighlight: {
3225
- setEnhanceHighlight: (from: number, to: number) => ReturnType;
3226
- clearEnhanceHighlight: () => ReturnType;
3229
+ moodTracker: {
3230
+ insertMoodTracker: (data: MoodTrackerData) => ReturnType;
3227
3231
  };
3228
3232
  }
3229
3233
  }
@@ -3231,8 +3235,9 @@ declare module "@tiptap/core" {
3231
3235
 
3232
3236
  declare module "@tiptap/core" {
3233
3237
  interface Commands<ReturnType> {
3234
- moodTracker: {
3235
- insertMoodTracker: (data: MoodTrackerData) => ReturnType;
3238
+ enhanceHighlight: {
3239
+ setEnhanceHighlight: (from: number, to: number) => ReturnType;
3240
+ clearEnhanceHighlight: () => ReturnType;
3236
3241
  };
3237
3242
  }
3238
3243
  }
@@ -3256,8 +3261,3 @@ declare module "@tiptap/core" {
3256
3261
  };
3257
3262
  }
3258
3263
  }
3259
-
3260
-
3261
- declare namespace Calendar {
3262
- var displayName: string;
3263
- }
package/dist/ai.js CHANGED
@@ -1,6 +1,6 @@
1
- import { l as t, k as e, F as r, a as o, C as i, b as n, m as F, n as u, d as A, I as c, g as C, c as m, h, e as l, u as d, j as I, i as f, f as T } from "./F0AiChat-DlxuT_0M.js";
1
+ import { l as t, k as e, F as r, a as o, C as i, b as n, m as F, n as u, d as A, I as c, g as C, c as m, h, e as l, u as d, j as I, i as f, f as T } from "./F0AiChat-bGx-xe3c.js";
2
2
  import { defaultTranslations as S } from "./i18n-provider-defaults.js";
3
- import { A as v, e as x, F as P, c as V, d as k, b as O, a as b, f as y, o as M, u as j } from "./types-XZM346Yy.js";
3
+ import { A as v, e as x, F as P, c as V, d as k, b as O, a as b, f as y, o as M, u as j } from "./types-BgSqIwvg.js";
4
4
  export {
5
5
  v as AiChatTranslationsProvider,
6
6
  t as ChatSpinner,
@@ -8015,6 +8015,11 @@ declare module "gridstack" {
8015
8015
  }
8016
8016
 
8017
8017
 
8018
+ declare namespace Calendar {
8019
+ var displayName: string;
8020
+ }
8021
+
8022
+
8018
8023
  declare module "@tiptap/core" {
8019
8024
  interface Commands<ReturnType> {
8020
8025
  aiBlock: {
@@ -8027,9 +8032,8 @@ declare module "@tiptap/core" {
8027
8032
 
8028
8033
  declare module "@tiptap/core" {
8029
8034
  interface Commands<ReturnType> {
8030
- enhanceHighlight: {
8031
- setEnhanceHighlight: (from: number, to: number) => ReturnType;
8032
- clearEnhanceHighlight: () => ReturnType;
8035
+ moodTracker: {
8036
+ insertMoodTracker: (data: MoodTrackerData) => ReturnType;
8033
8037
  };
8034
8038
  }
8035
8039
  }
@@ -8037,8 +8041,9 @@ declare module "@tiptap/core" {
8037
8041
 
8038
8042
  declare module "@tiptap/core" {
8039
8043
  interface Commands<ReturnType> {
8040
- moodTracker: {
8041
- insertMoodTracker: (data: MoodTrackerData) => ReturnType;
8044
+ enhanceHighlight: {
8045
+ setEnhanceHighlight: (from: number, to: number) => ReturnType;
8046
+ clearEnhanceHighlight: () => ReturnType;
8042
8047
  };
8043
8048
  }
8044
8049
  }
@@ -8062,8 +8067,3 @@ declare module "@tiptap/core" {
8062
8067
  };
8063
8068
  }
8064
8069
  }
8065
-
8066
-
8067
- declare namespace Calendar {
8068
- var displayName: string;
8069
- }
@@ -1,9 +1,9 @@
1
- import { a9 as oa, aa as ca, ab as da, ac as ua, ad as Ft, ae as Te, af as fa, ag as ht, ah as rt, ai as Be, O as b, W as Z, P as be, u as se, aj as ma, ak as ha, al as pa, am as ba, an as ga, a5 as oe, ao as xa, U as Ee, ap as va, aq as wa, ar as $, as as ya, at as Na, M as _e, au as ln, av as Ca, aw as ka, Q as B, ax as sn, a8 as E, ay as ge, az as Sa, aA as Ia, aB as Fa, aC as Aa, aD as La, aE as Ce, aF as on, aG as Ea, aH as xe, aI as $e, aJ as _a, aK as pt, n as cn, aL as Ne, aM as Oa, aN as dn, a6 as ne, aO as H, R as un, aP as fn, aQ as Ta, aR as mn, aS as me, a7 as ee, aT as Da, aU as za, aV as Pa, aW as Ra, X as pe, aX as Ge, aY as Ba, aZ as $a, a_ as Wa, a$ as Ma, b0 as He, b1 as hn, b2 as ja, b3 as Va, b4 as Ga, b5 as We, b6 as Ha, b7 as Ua, b8 as Ka, b9 as qa, ba as Ya, bb as Za, bc as Xa, bd as Ja, be as Qa, bf as er, bg as lt, bh as it, bi as pn, bj as tr, bk as nr, bl as bn, bm as ar, bn as rr, T as Ue, bo as bt, bp as gn, bq as lr, br as xn, bs as ir, bt as sr, bu as or, bv as Le, bw as cr, bx as De, by as At, bz as st, bA as dr, bB as ur, a as fr, c as mr, bC as hr, bD as vn, bE as pr, bF as br, F as gr, bG as wn, _ as xr, bH as yn, bI as vr, bJ as Lt, bK as wr, bL as yr, bM as Nr, bN as Cr, bO as Nn, bP as kr, bQ as Sr, bR as Ir, bS as Fr, bT as Ar, Y as Cn, bU as ue, bV as kn, bW as gt, bX as xt, bY as vt, bZ as Sn, b_ as wt, b$ as In, $ as Fn, c0 as Lr, c1 as Er, c2 as _r, c3 as Or, c4 as Tr, c5 as Dr, c6 as zr, c7 as Pr, c8 as Rr, c9 as Br, ca as $r, cb as Et, cc as _t, cd as Ot, ce as Wr, cf as Mr, cg as jr, ch as Vr, ci as An, cj as Gr, ck as Hr, cl as Ur } from "./F0AiChat-DlxuT_0M.js";
2
- import { cF as Ac, cE as Lc, co as Ec, cR as _c, cy as Oc, cz as Tc, cn as Dc, cB as zc, cp as Pc, d1 as Rc, c$ as Bc, cq as $c, cC as Wc, cD as Mc, cA as jc, cr as Vc, cN as Gc, cO as Hc, cS as Uc, cZ as Kc, c_ as qc, d0 as Yc, cx as Zc, cs as Xc, cH as Jc, cG as Qc, ct as ed, cu as td, cv as nd, cP as ad, d2 as rd, cm as ld, cQ as id, cU as sd, cV as od, cM as cd, cJ as dd, cL as ud, cI as fd, cw as md, cK as hd, cW as pd, cX as bd, cT as gd, cY as xd } from "./F0AiChat-DlxuT_0M.js";
1
+ import { a9 as oa, aa as ca, ab as da, ac as ua, ad as Ft, ae as Te, af as fa, ag as ht, ah as rt, ai as Be, O as b, W as Z, P as be, u as se, aj as ma, ak as ha, al as pa, am as ba, an as ga, a5 as oe, ao as xa, U as Ee, ap as va, aq as wa, ar as $, as as ya, at as Na, M as _e, au as ln, av as Ca, aw as ka, Q as B, ax as sn, a8 as E, ay as ge, az as Sa, aA as Ia, aB as Fa, aC as Aa, aD as La, aE as Ce, aF as on, aG as Ea, aH as xe, aI as $e, aJ as _a, aK as pt, n as cn, aL as Ne, aM as Oa, aN as dn, a6 as ne, aO as H, R as un, aP as fn, aQ as Ta, aR as mn, aS as me, a7 as ee, aT as Da, aU as za, aV as Pa, aW as Ra, X as pe, aX as Ge, aY as Ba, aZ as $a, a_ as Wa, a$ as Ma, b0 as He, b1 as hn, b2 as ja, b3 as Va, b4 as Ga, b5 as We, b6 as Ha, b7 as Ua, b8 as Ka, b9 as qa, ba as Ya, bb as Za, bc as Xa, bd as Ja, be as Qa, bf as er, bg as lt, bh as it, bi as pn, bj as tr, bk as nr, bl as bn, bm as ar, bn as rr, T as Ue, bo as bt, bp as gn, bq as lr, br as xn, bs as ir, bt as sr, bu as or, bv as Le, bw as cr, bx as De, by as At, bz as st, bA as dr, bB as ur, a as fr, c as mr, bC as hr, bD as vn, bE as pr, bF as br, F as gr, bG as wn, _ as xr, bH as yn, bI as vr, bJ as Lt, bK as wr, bL as yr, bM as Nr, bN as Cr, bO as Nn, bP as kr, bQ as Sr, bR as Ir, bS as Fr, bT as Ar, Y as Cn, bU as ue, bV as kn, bW as gt, bX as xt, bY as vt, bZ as Sn, b_ as wt, b$ as In, $ as Fn, c0 as Lr, c1 as Er, c2 as _r, c3 as Or, c4 as Tr, c5 as Dr, c6 as zr, c7 as Pr, c8 as Rr, c9 as Br, ca as $r, cb as Et, cc as _t, cd as Ot, ce as Wr, cf as Mr, cg as jr, ch as Vr, ci as An, cj as Gr, ck as Hr, cl as Ur } from "./F0AiChat-bGx-xe3c.js";
2
+ import { cF as Ac, cE as Lc, co as Ec, cR as _c, cy as Oc, cz as Tc, cn as Dc, cB as zc, cp as Pc, d1 as Rc, c$ as Bc, cq as $c, cC as Wc, cD as Mc, cA as jc, cr as Vc, cN as Gc, cO as Hc, cS as Uc, cZ as Kc, c_ as qc, d0 as Yc, cx as Zc, cs as Xc, cH as Jc, cG as Qc, ct as ed, cu as td, cv as nd, cP as ad, d2 as rd, cm as ld, cQ as id, cU as sd, cV as od, cM as cd, cJ as dd, cL as ud, cI as fd, cw as md, cK as hd, cW as pd, cX as bd, cT as gd, cY as xd } from "./F0AiChat-bGx-xe3c.js";
3
3
  import { jsx as e, jsxs as o, Fragment as U } from "react/jsx-runtime";
4
4
  import re, { forwardRef as j, useRef as V, useTransition as Kr, useState as _, useLayoutEffect as Ln, useContext as Ke, createContext as yt, useCallback as Q, useMemo as K, useEffect as W, useId as qr, Fragment as Yr, isValidElement as Zr, cloneElement as En, Children as _n } from "react";
5
- import { C as Xr, P as Jr, g as On, c as Qr, F as ot, f as el, a as tl, A as nl, B as al, L as rl, b as ll, V as il, d as sl, e as Tt, h as ol, i as cl } from "./index-DyFWCdmS.js";
6
- import { l as wd, m as yd, j as Nd, n as Cd, s as kd, D as Sd, k as Id, o as Fd, w as Ad, x as Ld, N as Ed, y as _d, p as Od, r as Td, R as Dd, u as zd, q as Pd, _ as Rd, v as Bd, t as $d } from "./index-DyFWCdmS.js";
5
+ import { C as Xr, P as Jr, g as On, c as Qr, F as ot, f as el, a as tl, A as nl, B as al, L as rl, b as ll, V as il, d as sl, e as Tt, h as ol, i as cl } from "./index-D_y183Vy.js";
6
+ import { l as wd, m as yd, j as Nd, n as Cd, s as kd, D as Sd, k as Id, o as Fd, w as Ad, x as Ld, N as Ed, y as _d, p as Od, r as Td, R as Dd, u as zd, q as Pd, _ as Rd, v as Bd, t as $d } from "./index-D_y183Vy.js";
7
7
  const dl = oa("Search", [
8
8
  ["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }],
9
9
  ["path", { d: "m21 21-4.3-4.3", key: "1qie3q" }]
package/dist/f0.d.ts CHANGED
@@ -161,6 +161,7 @@ import { WithDataTestIdReturnType as WithDataTestIdReturnType_7 } from './f0';
161
161
  import { WithDataTestIdReturnType as WithDataTestIdReturnType_8 } from './f0';
162
162
  import { z } from 'zod';
163
163
  import { ZodEffects } from 'zod';
164
+ import { ZodErrorMap } from 'zod';
164
165
  import { ZodRawShape } from 'zod';
165
166
  import { ZodType } from 'zod';
166
167
  import { ZodTypeAny } from 'zod';
@@ -2825,6 +2826,98 @@ export declare function createAtlaskitDriver(instanceId: symbol): DndDriver;
2825
2826
  */
2826
2827
  export declare const createDataSourceDefinition: <R extends RecordType = RecordType, FiltersSchema extends FiltersDefinition = FiltersDefinition, Sortings extends SortingsDefinition = SortingsDefinition, Grouping extends GroupingDefinition<R> = GroupingDefinition<R>>(definition: DataSourceDefinition<R, FiltersSchema, Sortings, Grouping>) => DataSourceDefinition<R, FiltersSchema, Sortings, Grouping>;
2827
2828
 
2829
+ /**
2830
+ * Creates a headless form tester from a form definition object returned by
2831
+ * `useF0FormDefinition`. Extracts the `schema` and `defaultValues` from the
2832
+ * definition and delegates to `createF0FormTester`.
2833
+ *
2834
+ * This is the recommended way to unit-test the validation logic of a form
2835
+ * definition hook without mounting any React components.
2836
+ *
2837
+ * @example
2838
+ * ```ts
2839
+ * // useEmployeeForm.ts
2840
+ * export function useEmployeeForm(employee: Employee) {
2841
+ * return useF0FormDefinition({
2842
+ * name: "employee-form",
2843
+ * schema: employeeSchema,
2844
+ * defaultValues: { name: employee.name, email: employee.email },
2845
+ * onSubmit: async ({ data }) => updateEmployee(data),
2846
+ * })
2847
+ * }
2848
+ *
2849
+ * // useEmployeeForm.test.ts
2850
+ * it("requires name and email", async () => {
2851
+ * const { result } = zeroRenderHook(() =>
2852
+ * useEmployeeForm({ name: "", email: "" })
2853
+ * )
2854
+ * const tester = createF0FormDefinitionTester(result.current)
2855
+ *
2856
+ * const { errors } = await tester.validate()
2857
+ * expect(errors).toHaveProperty("name")
2858
+ * expect(errors).toHaveProperty("email")
2859
+ * })
2860
+ *
2861
+ * it("is valid when required fields are filled", async () => {
2862
+ * const { result } = zeroRenderHook(() =>
2863
+ * useEmployeeForm({ name: "", email: "" })
2864
+ * )
2865
+ * const tester = createF0FormDefinitionTester(result.current)
2866
+ *
2867
+ * const { valid } = await tester.validate({ name: "Alice", email: "alice@example.com" })
2868
+ * expect(valid).toBe(true)
2869
+ * })
2870
+ * ```
2871
+ *
2872
+ * @remarks
2873
+ * This utility only supports **single-schema** form definitions
2874
+ * (`F0FormDefinitionSingleSchema`). If your form uses per-section definitions
2875
+ * (the array variant returned by {@link useF0FormDefinition}), you must create
2876
+ * a {@link createF0FormTester} for each section's schema directly.
2877
+ */
2878
+ export declare function createF0FormDefinitionTester<TSchema extends F0FormSchema>(definition: F0FormDefinitionSingleSchema<TSchema>, options?: Pick<CreateF0FormTesterOptions<TSchema>, "errorMap">): F0FormTester<TSchema>;
2879
+
2880
+ /**
2881
+ * Create a headless form tester that validates a schema using the same
2882
+ * conditional resolver logic that real F0Form uses internally.
2883
+ *
2884
+ * No React, no DOM, no providers required.
2885
+ *
2886
+ * @example
2887
+ * ```ts
2888
+ * const schema = z.object({
2889
+ * name: f0FormField(z.string().min(1), { label: "Name" }),
2890
+ * email: f0FormField(z.string().email(), { label: "Email" }),
2891
+ * })
2892
+ *
2893
+ * const tester = createF0FormTester({ schema })
2894
+ *
2895
+ * const { errors } = await tester.validate()
2896
+ * expect(errors).toHaveProperty("name")
2897
+ * expect(errors).toHaveProperty("email")
2898
+ *
2899
+ * const { valid } = await tester.validate({ name: "Alice", email: "alice@example.com" })
2900
+ * expect(valid).toBe(true)
2901
+ * ```
2902
+ */
2903
+ export declare function createF0FormTester<TSchema extends F0FormSchema>(options: CreateF0FormTesterOptions<TSchema>): F0FormTester<TSchema>;
2904
+
2905
+ export declare interface CreateF0FormTesterOptions<TSchema extends F0FormSchema> {
2906
+ schema: TSchema;
2907
+ defaultValues?: Partial<z.infer<TSchema>>;
2908
+ /**
2909
+ * Optional submit handler. When provided, `tester.submit(values)` will run
2910
+ * schema validation first and then call this handler if validation passes.
2911
+ * Mirrors the signature used inside F0Form — the tester supplies `data`.
2912
+ */
2913
+ onSubmit?: (data: z.infer<TSchema>) => Promise<F0FormSubmitResult> | F0FormSubmitResult;
2914
+ /**
2915
+ * Optional Zod errorMap. Defaults to Zod's built-in English messages.
2916
+ * Pass a custom errorMap to get localised messages in assertions.
2917
+ */
2918
+ errorMap?: ZodErrorMap;
2919
+ }
2920
+
2828
2921
  export declare const createPageLayoutBlock: <Props = unknown>(displayName: string, Component: React.ComponentType<Props>) => React.ComponentType<Props> & PageLayoutBlockComponent;
2829
2922
 
2830
2923
  export declare const createPageLayoutBlockGroup: <Props = unknown>(displayName: string, Component: React.ComponentType<Props>) => React.ComponentType<Props> & PageLayoutGroupComponent;
@@ -7239,6 +7332,77 @@ export declare type F0FormSubmitResult = {
7239
7332
  errors?: Record<string, string>;
7240
7333
  };
7241
7334
 
7335
+ export declare interface F0FormTester<TSchema extends F0FormSchema> {
7336
+ /**
7337
+ * Run validation against the schema.
7338
+ *
7339
+ * Provided `values` are merged on top of the tester's `defaultValues` so
7340
+ * you can test incremental fills:
7341
+ *
7342
+ * ```ts
7343
+ * const { errors } = await tester.validate() // all required errors
7344
+ * const { errors } = await tester.validate({ name: "Alice" }) // remaining errors
7345
+ * const { valid } = await tester.validate({ name: "Alice", email: "a@b.com" }) // valid
7346
+ * ```
7347
+ *
7348
+ * Fields with `renderIf` conditions that evaluate to `false` for the given
7349
+ * values are skipped — matching real F0Form behaviour.
7350
+ */
7351
+ validate(values?: Record<string, unknown>): Promise<F0FormValidationResult>;
7352
+ /**
7353
+ * Validate a single field in isolation.
7354
+ * Returns `{ valid, errors }` where `errors` contains at most one entry.
7355
+ */
7356
+ validateField(fieldName: string, values?: Record<string, unknown>): Promise<F0FormValidationResult>;
7357
+ /**
7358
+ * Return field descriptions for all fields in the schema.
7359
+ * Delegates to `describeFormSchema()` — useful for asserting field metadata.
7360
+ */
7361
+ describeFields(): FormFieldDescription[];
7362
+ /**
7363
+ * Return the default values this tester was created with, if any.
7364
+ */
7365
+ getDefaultValues(): Partial<z.infer<TSchema>> | undefined;
7366
+ /**
7367
+ * Return the names of fields that are currently visible (renderIf === true)
7368
+ * for the given values, merged with the tester's defaultValues.
7369
+ */
7370
+ getVisibleFields(values?: Record<string, unknown>): string[];
7371
+ /**
7372
+ * Run schema validation and, if it passes, call the `onSubmit` handler
7373
+ * provided in the options. Useful for testing server-side errors that an
7374
+ * `onSubmit` returns (e.g. duplicate email, insufficient permissions).
7375
+ *
7376
+ * If schema validation fails the handler is never called and the result
7377
+ * is `{ success: false, errors: <validation errors> }`.
7378
+ *
7379
+ * Requires `onSubmit` to be set in `createF0FormTesterOptions`.
7380
+ *
7381
+ * @example
7382
+ * ```ts
7383
+ * const tester = createF0FormDefinitionTester(result.current)
7384
+ *
7385
+ * const result = await tester.submit({ name: "Alice", email: "taken@example.com" })
7386
+ * expect(result.success).toBe(false)
7387
+ * expect((result as { errors: Record<string,string> }).errors.email)
7388
+ * .toBe("Email already registered")
7389
+ * ```
7390
+ */
7391
+ submit(values?: Record<string, unknown>): Promise<F0FormSubmitResult>;
7392
+ }
7393
+
7394
+ export declare interface F0FormValidationResult {
7395
+ /** Whether all visible fields pass validation */
7396
+ valid: boolean;
7397
+ /** Flat map of field name → error message for every failing field */
7398
+ errors: Record<string, string>;
7399
+ /**
7400
+ * Root-level Zod error message (if any). Corresponds to issues with
7401
+ * `path.length === 0` — e.g. from `.refine()` calls at the object level.
7402
+ */
7403
+ rootError?: string;
7404
+ }
7405
+
7242
7406
  export declare const F0GridStack: WithDataTestIdReturnType_7< {
7243
7407
  ({ options, widgets, onChange, className, static: isStatic, forcePositionSync, }: F0GridStackProps_2): JSX_2.Element;
7244
7408
  displayName: string;
@@ -13096,6 +13260,11 @@ declare module "gridstack" {
13096
13260
  }
13097
13261
 
13098
13262
 
13263
+ declare namespace Calendar {
13264
+ var displayName: string;
13265
+ }
13266
+
13267
+
13099
13268
  declare module "@tiptap/core" {
13100
13269
  interface Commands<ReturnType> {
13101
13270
  aiBlock: {
@@ -13108,9 +13277,8 @@ declare module "@tiptap/core" {
13108
13277
 
13109
13278
  declare module "@tiptap/core" {
13110
13279
  interface Commands<ReturnType> {
13111
- enhanceHighlight: {
13112
- setEnhanceHighlight: (from: number, to: number) => ReturnType;
13113
- clearEnhanceHighlight: () => ReturnType;
13280
+ moodTracker: {
13281
+ insertMoodTracker: (data: MoodTrackerData) => ReturnType;
13114
13282
  };
13115
13283
  }
13116
13284
  }
@@ -13118,8 +13286,9 @@ declare module "@tiptap/core" {
13118
13286
 
13119
13287
  declare module "@tiptap/core" {
13120
13288
  interface Commands<ReturnType> {
13121
- moodTracker: {
13122
- insertMoodTracker: (data: MoodTrackerData) => ReturnType;
13289
+ enhanceHighlight: {
13290
+ setEnhanceHighlight: (from: number, to: number) => ReturnType;
13291
+ clearEnhanceHighlight: () => ReturnType;
13123
13292
  };
13124
13293
  }
13125
13294
  }
@@ -13143,8 +13312,3 @@ declare module "@tiptap/core" {
13143
13312
  };
13144
13313
  }
13145
13314
  }
13146
-
13147
-
13148
- declare namespace Calendar {
13149
- var displayName: string;
13150
- }