@factorialco/f0-react 1.362.2 → 1.363.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/ai.d.ts CHANGED
@@ -1157,11 +1157,6 @@ declare module "gridstack" {
1157
1157
  }
1158
1158
 
1159
1159
 
1160
- declare namespace Calendar {
1161
- var displayName: string;
1162
- }
1163
-
1164
-
1165
1160
  declare module "@tiptap/core" {
1166
1161
  interface Commands<ReturnType> {
1167
1162
  aiBlock: {
@@ -1198,3 +1193,8 @@ declare module "@tiptap/core" {
1198
1193
  };
1199
1194
  }
1200
1195
  }
1196
+
1197
+
1198
+ declare namespace Calendar {
1199
+ var displayName: string;
1200
+ }
@@ -6627,11 +6627,6 @@ declare module "gridstack" {
6627
6627
  }
6628
6628
 
6629
6629
 
6630
- declare namespace Calendar {
6631
- var displayName: string;
6632
- }
6633
-
6634
-
6635
6630
  declare module "@tiptap/core" {
6636
6631
  interface Commands<ReturnType> {
6637
6632
  aiBlock: {
@@ -6668,3 +6663,8 @@ declare module "@tiptap/core" {
6668
6663
  };
6669
6664
  }
6670
6665
  }
6666
+
6667
+
6668
+ declare namespace Calendar {
6669
+ var displayName: string;
6670
+ }
@@ -3,8 +3,8 @@ import { eH as RL, eG as FL, eF as ML, eM as PL, eN as zL, eJ as $L, eI as jL, e
3
3
  import { jsx as l, jsxs as g, Fragment as ee } from "react/jsx-runtime";
4
4
  import * as Fe from "react";
5
5
  import Q, { createContext as Pt, forwardRef as J, useRef as W, useEffect as V, useContext as zt, PureComponent as o0, useTransition as l0, useState as F, useLayoutEffect as Gn, useId as Al, useCallback as ne, useMemo as z, useImperativeHandle as Lu, memo as is, Fragment as Mn, isValidElement as Ou, cloneElement as Tl, createElement as Oa, Children as Ru } from "react";
6
- import { f as En, aO as fr, j as Ur, aP as a0, b as $s, aQ as c0, A as d0, d as Gr, i as u0, m as f0, G as h0, g as Ra, aR as m0, l as Fa, aS as p0, p as g0, aT as Fu, aU as Mu, aV as b0, aW as xo, C as v0, aH as x0, ak as Pn, D as Me, aX as mt, aY as Nt, aZ as Ue, a_ as y0, a$ as li, b0 as it, b1 as Pu, b2 as Qe, b3 as El, b4 as ct, b5 as Ma, b6 as w0, b7 as zu, b8 as Be, b9 as Ze, ba as hr, bb as Ii, bc as $u, bd as k0, be as gn, bf as C0, bg as N0, bh as S0, bi as ss, bj as os, bk as Dl, bl as I0, bm as ju, bn as Bu, bo as Hu, bp as A0, bq as Vu, br as Wu, bs as Uu, bt as Gu, bu as qu, bv as Ku, bw as yo, bx as T0, by as E0, bz as D0, bA as _0, t as L0, x as O0, y as R0, F as F0, M as Pa, N as za, O as M0, P as P0, a3 as z0, a4 as $0, bB as j0, bC as B0, a6 as H0, ah as V0, a8 as W0, a9 as U0, bD as G0, aa as q0, ab as K0, ac as J0, ag as Y0, af as Q0, bE as Ju, bF as X0, bG as Z0, bH as ev, aC as _l, at as Ll, bI as Ol, bJ as Yu, as as wo, bK as tv, bL as nv, ar as Qu, a2 as Or, an as rv, bM as iv, bN as sv, bO as ov, aw as Rl, bP as lv, aL as av, bQ as ko, bR as cv, bS as Ai, bT as dv, aM as uv, bU as fv, aK as Xu, aJ as hv, aI as mv, bV as pv, bW as gv, bX as bv, bY as vv, bZ as xv, b_ as yv, b$ as wv, c0 as kv, c1 as Cv, c2 as Nv, c3 as Sv, c4 as Iv, c5 as Av, c6 as Tv, c7 as Ev, aN as Zu, aA as ef, c8 as Dv, R as _v, T as Lv, V as Ov, W as Rv, Z as Fv, U as Mv, c9 as $a, ca as Pv, cb as zv, n as $v } from "./DataCollectionStorageProvider-buKfoPNx.js";
7
- import { ao as UL, cc as GL, ad as qL, aj as KL, ai as JL, cg as YL, cf as QL, cd as XL, ce as ZL, a5 as eO, ae as tO, ax as nO, ay as rO } from "./DataCollectionStorageProvider-buKfoPNx.js";
6
+ import { f as En, aO as fr, j as Ur, aP as a0, b as $s, aQ as c0, A as d0, d as Gr, i as u0, m as f0, G as h0, g as Ra, aR as m0, l as Fa, aS as p0, p as g0, aT as Fu, aU as Mu, aV as b0, aW as xo, C as v0, aH as x0, ak as Pn, D as Me, aX as mt, aY as Nt, aZ as Ue, a_ as y0, a$ as li, b0 as it, b1 as Pu, b2 as Qe, b3 as El, b4 as ct, b5 as Ma, b6 as w0, b7 as zu, b8 as Be, b9 as Ze, ba as hr, bb as Ii, bc as $u, bd as k0, be as gn, bf as C0, bg as N0, bh as S0, bi as ss, bj as os, bk as Dl, bl as I0, bm as ju, bn as Bu, bo as Hu, bp as A0, bq as Vu, br as Wu, bs as Uu, bt as Gu, bu as qu, bv as Ku, bw as yo, bx as T0, by as E0, bz as D0, bA as _0, t as L0, x as O0, y as R0, F as F0, M as Pa, N as za, O as M0, P as P0, a3 as z0, a4 as $0, bB as j0, bC as B0, a6 as H0, ah as V0, a8 as W0, a9 as U0, bD as G0, aa as q0, ab as K0, ac as J0, ag as Y0, af as Q0, bE as Ju, bF as X0, bG as Z0, bH as ev, aC as _l, at as Ll, bI as Ol, bJ as Yu, as as wo, bK as tv, bL as nv, ar as Qu, a2 as Or, an as rv, bM as iv, bN as sv, bO as ov, aw as Rl, bP as lv, aL as av, bQ as ko, bR as cv, bS as Ai, bT as dv, aM as uv, bU as fv, aK as Xu, aJ as hv, aI as mv, bV as pv, bW as gv, bX as bv, bY as vv, bZ as xv, b_ as yv, b$ as wv, c0 as kv, c1 as Cv, c2 as Nv, c3 as Sv, c4 as Iv, c5 as Av, c6 as Tv, c7 as Ev, aN as Zu, aA as ef, c8 as Dv, R as _v, T as Lv, V as Ov, W as Rv, Z as Fv, U as Mv, c9 as $a, ca as Pv, cb as zv, n as $v } from "./DataCollectionStorageProvider-Hpk54uGn.js";
7
+ import { ao as UL, cc as GL, ad as qL, aj as KL, ai as JL, cg as YL, cf as QL, cd as XL, ce as ZL, a5 as eO, ae as tO, ax as nO, ay as rO } from "./DataCollectionStorageProvider-Hpk54uGn.js";
8
8
  import './experimental.css';function tf(t, e) {
9
9
  const n = Hd(e()), r = () => n.set(e());
10
10
  return r(), Wp(() => {
@@ -11467,12 +11467,6 @@ const yN = oe("Reactions", xN), zc = (t) => {
11467
11467
  stopPropagation: !0,
11468
11468
  href: "#",
11469
11469
  children: n.title
11470
- }), l("span", {
11471
- className: "hidden text-f1-foreground-secondary md:inline",
11472
- children: "·"
11473
- }), l("span", {
11474
- className: "text-f1-foreground-secondary",
11475
- children: x
11476
11470
  })]
11477
11471
  }), g("div", {
11478
11472
  className: "flex flex-row gap-2",
@@ -11485,7 +11479,8 @@ const yN = oe("Reactions", xN), zc = (t) => {
11485
11479
  variant: "outline",
11486
11480
  size: "md",
11487
11481
  onClick: S.onClick,
11488
- label: S.label
11482
+ label: S.label,
11483
+ title: S.label
11489
11484
  }, S.label)), p?.length && l(Me, {
11490
11485
  items: p,
11491
11486
  icon: Ni,
@@ -11503,6 +11498,9 @@ const yN = oe("Reactions", xN), zc = (t) => {
11503
11498
  })
11504
11499
  })]
11505
11500
  })]
11501
+ }), l("span", {
11502
+ className: "-mt-3 text-sm text-f1-foreground-secondary",
11503
+ children: x
11506
11504
  }), g("div", {
11507
11505
  className: "flex flex-col gap-1 text-f1-foreground",
11508
11506
  children: [l("p", {
package/dist/f0.d.ts CHANGED
@@ -106,6 +106,7 @@ import { TrackReferenceOrPlaceholder } from '@livekit/components-react';
106
106
  import { ValueDisplayRendererContext } from '../../../ui/value-display';
107
107
  import { VariantProps } from 'cva';
108
108
  import { z } from 'zod';
109
+ import { ZodEffects } from 'zod';
109
110
  import { ZodRawShape } from 'zod';
110
111
  import { ZodTypeAny } from 'zod';
111
112
 
@@ -3415,28 +3416,78 @@ declare type F0CustomFieldConfigWithConfig<TValue = unknown, TConfig = unknown>
3415
3416
  /**
3416
3417
  * F0 config options specific to date fields
3417
3418
  *
3418
- * Note: `minDate`, `maxDate`, and `clearable` are derived from the Zod schema:
3419
+ * Note: `clearable` is derived from the Zod schema:
3420
+ * - `z.date().optional()` or `z.date().nullable()` → clearable
3421
+ *
3422
+ * Static minDate/maxDate can also be derived from the Zod schema:
3419
3423
  * - `z.date().min(date)` → minDate
3420
3424
  * - `z.date().max(date)` → maxDate
3421
- * - `z.date().optional()` or `z.date().nullable()` → clearable
3425
+ *
3426
+ * For dynamic constraints based on other fields, use function syntax:
3427
+ * @example
3428
+ * ```ts
3429
+ * endDate: f0FormField(z.date(), {
3430
+ * label: "End Date",
3431
+ * minDate: ({ values }) => values.startDate, // Dynamic: after start date
3432
+ * })
3433
+ * ```
3422
3434
  */
3423
3435
  export declare interface F0DateConfig {
3424
3436
  /** Available granularities for the date picker */
3425
3437
  granularities?: DateGranularity[];
3426
3438
  /** Preset date options to display */
3427
3439
  presets?: DatePreset[];
3440
+ /**
3441
+ * Minimum selectable date.
3442
+ * Can be a static Date or a function that receives form values for dynamic constraints.
3443
+ * Overrides z.date().min() if provided.
3444
+ * @example
3445
+ * // Static constraint
3446
+ * minDate: new Date("2024-01-01")
3447
+ *
3448
+ * // Dynamic constraint based on another field
3449
+ * minDate: ({ values }) => values.startDate
3450
+ */
3451
+ minDate?: F0DateConstraintProp;
3452
+ /**
3453
+ * Maximum selectable date.
3454
+ * Can be a static Date or a function that receives form values for dynamic constraints.
3455
+ * Overrides z.date().max() if provided.
3456
+ * @example
3457
+ * // Static constraint
3458
+ * maxDate: new Date("2025-12-31")
3459
+ *
3460
+ * // Dynamic constraint based on another field
3461
+ * maxDate: ({ values }) => values.endDate
3462
+ */
3463
+ maxDate?: F0DateConstraintProp;
3428
3464
  }
3429
3465
 
3466
+ /**
3467
+ * Function type for dynamic date constraint evaluation based on form values.
3468
+ * Used for minDate/maxDate that depend on other field values.
3469
+ *
3470
+ * @example
3471
+ * ```ts
3472
+ * // End date must be after start date
3473
+ * minDate: ({ values }) => values.startDate
3474
+ * ```
3475
+ */
3476
+ declare type F0DateConstraintFunction = (context: {
3477
+ values: Record<string, unknown>;
3478
+ }) => Date | undefined;
3479
+
3480
+ /**
3481
+ * Date constraint can be a static Date or a function that receives form values
3482
+ */
3483
+ declare type F0DateConstraintProp = Date | F0DateConstraintFunction;
3484
+
3430
3485
  /**
3431
3486
  * Date field with all properties for rendering
3432
3487
  * Includes properties derived from Zod schema
3433
3488
  */
3434
3489
  export declare type F0DateField = F0BaseField & F0DateConfig & {
3435
3490
  type: "date";
3436
- /** Minimum selectable date (derived from z.date().min()) */
3437
- minDate?: Date;
3438
- /** Maximum selectable date (derived from z.date().max()) */
3439
- maxDate?: Date;
3440
3491
  /** Whether the date can be cleared (derived from optional/nullable) */
3441
3492
  clearable?: boolean;
3442
3493
  /** Conditional rendering based on another field's value */
@@ -3509,9 +3560,7 @@ export declare type F0DateRangeFieldConfig = F0BaseConfig & F0DateRangeConfig &
3509
3560
  /**
3510
3561
  * F0 config options specific to datetime fields
3511
3562
  *
3512
- * Note: `minDate`, `maxDate`, and `clearable` are derived from the Zod schema:
3513
- * - `z.date().min(date)` → minDate
3514
- * - `z.date().max(date)` → maxDate
3563
+ * Note: `clearable` is derived from the Zod schema:
3515
3564
  * - `z.date().optional()` or `z.date().nullable()` → clearable
3516
3565
  */
3517
3566
  export declare interface F0DateTimeConfig {
@@ -3519,6 +3568,18 @@ export declare interface F0DateTimeConfig {
3519
3568
  granularities?: DateGranularity[];
3520
3569
  /** Preset date options to display in the date picker */
3521
3570
  presets?: DatePreset[];
3571
+ /**
3572
+ * Minimum selectable datetime.
3573
+ * Can be a static Date or a function that receives form values for dynamic constraints.
3574
+ * Overrides z.date().min() if provided.
3575
+ */
3576
+ minDate?: F0DateConstraintProp;
3577
+ /**
3578
+ * Maximum selectable datetime.
3579
+ * Can be a static Date or a function that receives form values for dynamic constraints.
3580
+ * Overrides z.date().max() if provided.
3581
+ */
3582
+ maxDate?: F0DateConstraintProp;
3522
3583
  }
3523
3584
 
3524
3585
  /**
@@ -3527,10 +3588,6 @@ export declare interface F0DateTimeConfig {
3527
3588
  */
3528
3589
  export declare type F0DateTimeField = F0BaseField & F0DateTimeConfig & {
3529
3590
  type: "datetime";
3530
- /** Minimum selectable datetime (derived from z.date().min()) */
3531
- minDate?: Date;
3532
- /** Maximum selectable datetime (derived from z.date().max()) */
3533
- maxDate?: Date;
3534
3591
  /** Whether the datetime can be cleared (derived from optional/nullable) */
3535
3592
  clearable?: boolean;
3536
3593
  /** Conditional rendering based on another field's value */
@@ -3707,7 +3764,7 @@ export declare interface F0FilterPickerContentProps<Filters extends FiltersDefin
3707
3764
  /**
3708
3765
  * @experimental This is an experimental component, use it at your own risk
3709
3766
  */
3710
- export declare const F0Form: <TSchema extends z.ZodObject<ZodRawShape>>(props: F0FormProps<TSchema>) => React.ReactElement;
3767
+ export declare const F0Form: <TSchema extends F0FormSchema>(props: F0FormProps<TSchema>) => React.ReactElement;
3711
3768
 
3712
3769
  /**
3713
3770
  * Submit configuration for action bar type
@@ -3851,6 +3908,7 @@ export declare function f0FormField<T extends ZodTypeAny, V extends string | num
3851
3908
  * Props for the F0Form component
3852
3909
  *
3853
3910
  * @typeParam TSchema - The Zod object schema type. The form data type is inferred from this.
3911
+ * Can be a plain ZodObject or a refined ZodObject (using .refine()).
3854
3912
  *
3855
3913
  * @example
3856
3914
  * ```tsx
@@ -3867,20 +3925,17 @@ export declare function f0FormField<T extends ZodTypeAny, V extends string | num
3867
3925
  * onSubmit={(data) => ({ success: true })}
3868
3926
  * />
3869
3927
  *
3870
- * // Action bar with discard button
3871
- * <F0Form
3872
- * name="my-form"
3873
- * schema={schema}
3874
- * submitConfig={{
3875
- * type: "action-bar",
3876
- * discardable: true,
3877
- * }}
3878
- * defaultValues={{ name: "" }}
3879
- * onSubmit={(data) => ({ success: true })}
3880
- * />
3928
+ * // With cross-field validation using .refine()
3929
+ * const schemaWithRefine = z.object({
3930
+ * startDate: f0FormField(z.date(), { label: "Start" }),
3931
+ * endDate: f0FormField(z.date(), { label: "End" }),
3932
+ * }).refine((data) => data.endDate > data.startDate, {
3933
+ * message: "End date must be after start date",
3934
+ * path: ["endDate"],
3935
+ * })
3881
3936
  * ```
3882
3937
  */
3883
- export declare interface F0FormProps<TSchema extends z.ZodObject<ZodRawShape>> {
3938
+ export declare interface F0FormProps<TSchema extends F0FormSchema> {
3884
3939
  /** Unique name for the form, used for generating anchor links (e.g., #forms.[name].[sectionId].[fieldId]) */
3885
3940
  name: string;
3886
3941
  /** Zod object schema with F0 field configurations */
@@ -3945,9 +4000,9 @@ export declare interface F0FormRef {
3945
4000
  }
3946
4001
 
3947
4002
  /**
3948
- * Type helper for creating a form schema with F0 fields
4003
+ * Type for F0Form schemas - can be a plain ZodObject or a refined ZodObject (ZodEffects)
3949
4004
  */
3950
- export declare type F0FormSchema<T extends Record<string, ZodTypeAny>> = z.ZodObject<T>;
4005
+ export declare type F0FormSchema<T extends ZodRawShape = ZodRawShape> = z.ZodObject<T> | ZodEffects<z.ZodObject<T>>;
3951
4006
 
3952
4007
  /**
3953
4008
  * Callback to update form state in the hook
@@ -4626,6 +4681,16 @@ export declare type F0ThinkingProps = {
4626
4681
  * - `z.string().optional()` or `z.string().nullable()` → clearable
4627
4682
  */
4628
4683
  export declare interface F0TimeConfig {
4684
+ /**
4685
+ * Minimum selectable time.
4686
+ * Can be a static Date or a function that receives form values for dynamic constraints.
4687
+ */
4688
+ minDate?: F0DateConstraintProp;
4689
+ /**
4690
+ * Maximum selectable time.
4691
+ * Can be a static Date or a function that receives form values for dynamic constraints.
4692
+ */
4693
+ maxDate?: F0DateConstraintProp;
4629
4694
  }
4630
4695
 
4631
4696
  /**
@@ -4634,10 +4699,6 @@ export declare interface F0TimeConfig {
4634
4699
  */
4635
4700
  export declare type F0TimeField = F0BaseField & F0TimeConfig & {
4636
4701
  type: "time";
4637
- /** Minimum selectable date/time (derived from z.date().min()) */
4638
- minDate?: Date;
4639
- /** Maximum selectable date/time (derived from z.date().max()) */
4640
- maxDate?: Date;
4641
4702
  /** Whether the time can be cleared (derived from optional/nullable) */
4642
4703
  clearable?: boolean;
4643
4704
  /** Conditional rendering based on another field's value */
@@ -4920,7 +4981,7 @@ export declare function getF0Config(schema: ZodTypeAny): F0FieldConfig | undefin
4920
4981
  * @param sections - Optional section configurations keyed by section ID
4921
4982
  * @returns Array of form definition items
4922
4983
  */
4923
- export declare function getSchemaDefinition(schema: z.ZodObject<ZodRawShape>, sections?: Record<string, F0SectionConfig>): FormDefinitionItem[];
4984
+ export declare function getSchemaDefinition(schema: F0FormSchema, sections?: Record<string, F0SectionConfig>): FormDefinitionItem[];
4924
4985
 
4925
4986
  declare interface GranularityDefinition {
4926
4987
  calendarMode?: CalendarMode;
@@ -7434,7 +7495,7 @@ export declare const useReducedMotion: () => boolean;
7434
7495
  * })
7435
7496
  * ```
7436
7497
  */
7437
- export declare function useSchemaDefinition(schema: z.ZodObject<ZodRawShape>, sections?: Record<string, F0SectionConfig>): FormDefinitionItem[];
7498
+ export declare function useSchemaDefinition(schema: F0FormSchema, sections?: Record<string, F0SectionConfig>): FormDefinitionItem[];
7438
7499
 
7439
7500
  /**
7440
7501
  * Custom hook to manage selection state for items and groups in a data table
@@ -7634,7 +7695,7 @@ declare interface WithTooltipDescription {
7634
7695
  * Zod type names for type checking without instanceof
7635
7696
  * Using _def.typeName is more reliable across module boundaries than instanceof
7636
7697
  */
7637
- declare type ZodTypeName = "ZodString" | "ZodNumber" | "ZodBoolean" | "ZodDate" | "ZodEnum" | "ZodArray" | "ZodObject" | "ZodOptional" | "ZodNullable" | "ZodDefault" | "ZodLiteral";
7698
+ declare type ZodTypeName = "ZodString" | "ZodNumber" | "ZodBoolean" | "ZodDate" | "ZodEnum" | "ZodArray" | "ZodObject" | "ZodOptional" | "ZodNullable" | "ZodDefault" | "ZodLiteral" | "ZodEffects";
7638
7699
 
7639
7700
  export { }
7640
7701
 
@@ -7676,11 +7737,6 @@ declare module "gridstack" {
7676
7737
  }
7677
7738
 
7678
7739
 
7679
- declare namespace Calendar {
7680
- var displayName: string;
7681
- }
7682
-
7683
-
7684
7740
  declare module "@tiptap/core" {
7685
7741
  interface Commands<ReturnType> {
7686
7742
  aiBlock: {
@@ -7717,3 +7773,8 @@ declare module "@tiptap/core" {
7717
7773
  };
7718
7774
  }
7719
7775
  }
7776
+
7777
+
7778
+ declare namespace Calendar {
7779
+ var displayName: string;
7780
+ }