@factorialco/f0-react 1.436.0 → 1.437.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/experimental.d.ts +6 -4
- package/dist/experimental.js +2 -2
- package/dist/f0.d.ts +90 -10
- package/dist/f0.js +6098 -5821
- package/dist/{index-B0hDgrco.js → index-CFs2gP7X.js} +3529 -3500
- package/package.json +1 -1
package/dist/experimental.d.ts
CHANGED
|
@@ -1432,6 +1432,8 @@ export declare interface CardSelectableItem<T extends CardSelectableValue> {
|
|
|
1432
1432
|
href: string;
|
|
1433
1433
|
label?: string;
|
|
1434
1434
|
};
|
|
1435
|
+
/** Custom content rendered inside the card when it is selected, with an expand/collapse animation */
|
|
1436
|
+
selectedContent?: ReactNode;
|
|
1435
1437
|
}
|
|
1436
1438
|
|
|
1437
1439
|
export declare interface CardSelectableMultipleProps<T extends CardSelectableValue> {
|
|
@@ -6406,11 +6408,11 @@ declare const spinnerVariants: (props?: ({
|
|
|
6406
6408
|
|
|
6407
6409
|
export declare const Split: ForwardRefExoticComponent<Omit<HTMLAttributes<HTMLDivElement> & VariantProps<(props?: ({
|
|
6408
6410
|
overflow?: "hidden" | "auto" | undefined;
|
|
6409
|
-
paddingX?: "none" | "p-
|
|
6411
|
+
paddingX?: "none" | "p-4" | "p-2" | "p-8" | "p-12" | "p-16" | undefined;
|
|
6410
6412
|
maxWidth?: "md" | "sm" | "xs" | "xl" | "screen-sm" | "screen-md" | "screen-lg" | "screen-xl" | "screen-2xl" | undefined;
|
|
6411
6413
|
height?: "auto" | "full" | undefined;
|
|
6412
6414
|
width?: "auto" | "full" | undefined;
|
|
6413
|
-
paddingY?: "none" | "p-
|
|
6415
|
+
paddingY?: "none" | "p-4" | "p-2" | "p-8" | "p-12" | "p-16" | undefined;
|
|
6414
6416
|
basis?: "0" | undefined;
|
|
6415
6417
|
inline?: boolean | undefined;
|
|
6416
6418
|
justifyContent?: "center" | "end" | "start" | "space-between" | "stretch" | undefined;
|
|
@@ -6436,11 +6438,11 @@ className?: ClassValue;
|
|
|
6436
6438
|
|
|
6437
6439
|
export declare const Stack: ForwardRefExoticComponent<Omit<HTMLAttributes<HTMLDivElement> & VariantProps<(props?: ({
|
|
6438
6440
|
overflow?: "hidden" | "auto" | undefined;
|
|
6439
|
-
paddingX?: "none" | "p-
|
|
6441
|
+
paddingX?: "none" | "p-4" | "p-2" | "p-8" | "p-12" | "p-16" | undefined;
|
|
6440
6442
|
maxWidth?: "md" | "sm" | "xs" | "xl" | "screen-sm" | "screen-md" | "screen-lg" | "screen-xl" | "screen-2xl" | undefined;
|
|
6441
6443
|
height?: "auto" | "full" | undefined;
|
|
6442
6444
|
width?: "auto" | "full" | undefined;
|
|
6443
|
-
paddingY?: "none" | "p-
|
|
6445
|
+
paddingY?: "none" | "p-4" | "p-2" | "p-8" | "p-12" | "p-16" | undefined;
|
|
6444
6446
|
basis?: "0" | undefined;
|
|
6445
6447
|
inline?: boolean | undefined;
|
|
6446
6448
|
justifyContent?: "center" | "end" | "start" | "space-between" | "stretch" | undefined;
|
package/dist/experimental.js
CHANGED
|
@@ -3,8 +3,8 @@ import { f1 as jN, f0 as VN, ai as WN, e_ as UN, fl as GN, az as KN, e$ as qN, a
|
|
|
3
3
|
import { jsx as c, jsxs as g, Fragment as re } from "react/jsx-runtime";
|
|
4
4
|
import * as he from "react";
|
|
5
5
|
import ne, { forwardRef as F, useRef as K, useTransition as op, useState as L, useLayoutEffect as Ca, useContext as Es, createContext as Ds, useCallback as J, useMemo as ee, useEffect as W, useId as Sa, useImperativeHandle as Na, memo as Ia, Fragment as lp, isValidElement as ap, cloneElement as Aa, Children as _a } from "react";
|
|
6
|
-
import { C as cp, m as dp, N as He, o as ot, q as Te, t as up, v as sr, w as Ue, x as Ta, y as Oe, z as Rs, E as $e, G as wo, H as fp, I as Ea, J as Ie, K as ze, O as vn, Q as vr, U as Da, W as hp, X as Ht, Y as pp, Z as mp, a0 as gp, a1 as Fn, a2 as zn, a3 as Ls, a4 as bp, a5 as Ra, a6 as La, a7 as Ma, a8 as wp, a9 as Oa, aa as Fa, ab as za, ac as Pa, ad as $a, ae as Ba, n as xo, af as xp, ag as yo, ah as yp, ai as vp, aj as kp, ak as Ha, al as Cp, am as Sp, an as Np, ao as ja, e as Ri, ap as Ip, aq as Ap, ar as _p, as as Tp, at as Ep, au as Dp, av as Rp, M as Lp, aw as Mp, ax as Op, ay as Fp, az as zp, u as Va, aA as Pp, aB as $p, aC as Bp, aD as Hp, aE as jp, aF as Vp, aG as vo, aH as Wp, aI as Up, aJ as Gp } from "./index-
|
|
7
|
-
import { A as xI, f as yI, B as vI, a as kI, g as CI, j as SI, D as NI, F as II, b as AI, aM as _I, aK as TI, aL as EI, L as DI, h as RI, i as LI, k as MI, c as OI, R as FI, S as zI, T as PI, V as $I, _ as BI, l as HI, p as jI, s as VI } from "./index-
|
|
6
|
+
import { C as cp, m as dp, N as He, o as ot, q as Te, t as up, v as sr, w as Ue, x as Ta, y as Oe, z as Rs, E as $e, G as wo, H as fp, I as Ea, J as Ie, K as ze, O as vn, Q as vr, U as Da, W as hp, X as Ht, Y as pp, Z as mp, a0 as gp, a1 as Fn, a2 as zn, a3 as Ls, a4 as bp, a5 as Ra, a6 as La, a7 as Ma, a8 as wp, a9 as Oa, aa as Fa, ab as za, ac as Pa, ad as $a, ae as Ba, n as xo, af as xp, ag as yo, ah as yp, ai as vp, aj as kp, ak as Ha, al as Cp, am as Sp, an as Np, ao as ja, e as Ri, ap as Ip, aq as Ap, ar as _p, as as Tp, at as Ep, au as Dp, av as Rp, M as Lp, aw as Mp, ax as Op, ay as Fp, az as zp, u as Va, aA as Pp, aB as $p, aC as Bp, aD as Hp, aE as jp, aF as Vp, aG as vo, aH as Wp, aI as Up, aJ as Gp } from "./index-CFs2gP7X.js";
|
|
7
|
+
import { A as xI, f as yI, B as vI, a as kI, g as CI, j as SI, D as NI, F as II, b as AI, aM as _I, aK as TI, aL as EI, L as DI, h as RI, i as LI, k as MI, c as OI, R as FI, S as zI, T as PI, V as $I, _ as BI, l as HI, p as jI, s as VI } from "./index-CFs2gP7X.js";
|
|
8
8
|
import './experimental.css';const Kp = Uu("Search", [
|
|
9
9
|
["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }],
|
|
10
10
|
["path", { d: "m21 21-4.3-4.3", key: "1qie3q" }]
|
package/dist/f0.d.ts
CHANGED
|
@@ -1774,6 +1774,8 @@ export declare interface CardSelectableItem<T extends CardSelectableValue> {
|
|
|
1774
1774
|
href: string;
|
|
1775
1775
|
label?: string;
|
|
1776
1776
|
};
|
|
1777
|
+
/** Custom content rendered inside the card when it is selected, with an expand/collapse animation */
|
|
1778
|
+
selectedContent?: ReactNode;
|
|
1777
1779
|
}
|
|
1778
1780
|
|
|
1779
1781
|
export declare interface CardSelectableMultipleProps<T extends CardSelectableValue> {
|
|
@@ -1820,6 +1822,26 @@ export declare interface CardSelectableSingleProps<T extends CardSelectableValue
|
|
|
1820
1822
|
|
|
1821
1823
|
export declare type CardSelectableValue = string | number;
|
|
1822
1824
|
|
|
1825
|
+
declare type CardSelectFieldRenderIf = CardSelectRenderIfCondition | CommonRenderIfCondition | F0BaseFieldRenderIfFunction;
|
|
1826
|
+
|
|
1827
|
+
declare interface CardSelectOption {
|
|
1828
|
+
value: string;
|
|
1829
|
+
label: string;
|
|
1830
|
+
description?: string;
|
|
1831
|
+
}
|
|
1832
|
+
|
|
1833
|
+
declare interface CardSelectRenderIfBase {
|
|
1834
|
+
fieldId: string;
|
|
1835
|
+
}
|
|
1836
|
+
|
|
1837
|
+
declare type CardSelectRenderIfCondition = CardSelectRenderIfBase & ({
|
|
1838
|
+
equalsTo: string;
|
|
1839
|
+
} | {
|
|
1840
|
+
notEqualsTo: string;
|
|
1841
|
+
} | {
|
|
1842
|
+
isEmpty: boolean;
|
|
1843
|
+
});
|
|
1844
|
+
|
|
1823
1845
|
declare type CardVisualizationOptions<T, _Filters extends FiltersDefinition, _Sortings extends SortingsDefinition> = {
|
|
1824
1846
|
cardProperties: ReadonlyArray<CardPropertyDefinition<T>>;
|
|
1825
1847
|
title: (record: T) => string;
|
|
@@ -5037,6 +5059,26 @@ compact?: boolean;
|
|
|
5037
5059
|
|
|
5038
5060
|
export declare type F0CardProps = Omit<CardInternalProps, (typeof privateProps_3)[number]>;
|
|
5039
5061
|
|
|
5062
|
+
declare interface F0CardSelectConfig {
|
|
5063
|
+
options: CardSelectOption[];
|
|
5064
|
+
hideLabel?: boolean;
|
|
5065
|
+
/**
|
|
5066
|
+
* When false, renders each option as a separate bordered card
|
|
5067
|
+
* instead of a single container with dividers.
|
|
5068
|
+
* @default true
|
|
5069
|
+
*/
|
|
5070
|
+
grouped?: boolean;
|
|
5071
|
+
}
|
|
5072
|
+
|
|
5073
|
+
declare type F0CardSelectField = F0BaseField & {
|
|
5074
|
+
type: "cardSelect";
|
|
5075
|
+
options: CardSelectOption[];
|
|
5076
|
+
hideLabel?: boolean;
|
|
5077
|
+
/** When false, renders each option as a separate bordered card */
|
|
5078
|
+
grouped?: boolean;
|
|
5079
|
+
renderIf?: CardSelectFieldRenderIf;
|
|
5080
|
+
};
|
|
5081
|
+
|
|
5040
5082
|
/**
|
|
5041
5083
|
* @experimental This is an experimental component use it at your own risk
|
|
5042
5084
|
*/
|
|
@@ -5838,7 +5880,7 @@ export declare function F0EventCatcherProvider({ children, onEvent, enabled, cat
|
|
|
5838
5880
|
/**
|
|
5839
5881
|
* Union of all F0 field types used for rendering
|
|
5840
5882
|
*/
|
|
5841
|
-
export declare type F0Field = F0TextField | F0NumberField | F0DurationField | F0TextareaField | F0SelectField | F0CheckboxField | F0SwitchField | F0DateField | F0TimeField | F0DateTimeField | F0DateRangeField | F0RichTextField | F0FileField | F0CustomField;
|
|
5883
|
+
export declare type F0Field = F0TextField | F0NumberField | F0DurationField | F0TextareaField | F0SelectField | F0CheckboxField | F0SwitchField | F0DateField | F0TimeField | F0DateTimeField | F0DateRangeField | F0RichTextField | F0FileField | F0CardSelectField | F0CustomField;
|
|
5842
5884
|
|
|
5843
5885
|
/**
|
|
5844
5886
|
* Alert configuration for a field.
|
|
@@ -5873,12 +5915,12 @@ export declare type F0FieldAlertProps = Omit<F0AlertProps, "variant"> & {
|
|
|
5873
5915
|
* @typeParam T - The value type for select fields (string or number)
|
|
5874
5916
|
* @typeParam R - Record type for data source (when using source instead of options)
|
|
5875
5917
|
*/
|
|
5876
|
-
export declare type F0FieldConfig<T extends string | number = string | number, R extends Record<string, unknown> = Record<string, unknown>> = F0StringConfig<string, undefined, R> | F0NumberFieldConfig<R> | F0BooleanConfig | F0DateFieldConfig | F0TimeFieldConfig | F0DateTimeFieldConfig | F0ArrayConfig<T, R> | F0FileFieldConfig | F0ObjectConfig;
|
|
5918
|
+
export declare type F0FieldConfig<T extends string | number = string | number, R extends Record<string, unknown> = Record<string, unknown>> = F0StringConfig<string, undefined, R> | F0NumberFieldConfig<R> | F0BooleanConfig | F0DateFieldConfig | F0TimeFieldConfig | F0DateTimeFieldConfig | F0ArrayConfig<T, R> | F0FileFieldConfig | F0ObjectConfig | F0StringCardSelectConfig;
|
|
5877
5919
|
|
|
5878
5920
|
/**
|
|
5879
5921
|
* Field types for rendering
|
|
5880
5922
|
*/
|
|
5881
|
-
export declare type F0FieldType = "text" | "number" | "duration" | "textarea" | "select" | "checkbox" | "switch" | "date" | "time" | "datetime" | "daterange" | "richtext" | "file" | "custom";
|
|
5923
|
+
export declare type F0FieldType = "text" | "number" | "duration" | "textarea" | "select" | "checkbox" | "switch" | "date" | "time" | "datetime" | "daterange" | "richtext" | "file" | "cardSelect" | "custom";
|
|
5882
5924
|
|
|
5883
5925
|
/**
|
|
5884
5926
|
* F0 config options specific to file fields
|
|
@@ -5899,8 +5941,15 @@ export declare interface F0FileConfig {
|
|
|
5899
5941
|
multiple?: boolean;
|
|
5900
5942
|
/** Helper text shown in the dropzone area */
|
|
5901
5943
|
description?: string;
|
|
5902
|
-
/**
|
|
5903
|
-
|
|
5944
|
+
/**
|
|
5945
|
+
* Consumer-provided upload hook.
|
|
5946
|
+
*
|
|
5947
|
+
* When used inside `<F0Form>`, the form-level `useUpload` is preferred.
|
|
5948
|
+
* This prop is primarily for standalone file fields rendered outside of
|
|
5949
|
+
* `<F0Form>` / `F0FormContext.Provider`, where the upload hook cannot be
|
|
5950
|
+
* supplied via context.
|
|
5951
|
+
*/
|
|
5952
|
+
useUpload?: UseFileUpload;
|
|
5904
5953
|
}
|
|
5905
5954
|
|
|
5906
5955
|
/**
|
|
@@ -5916,8 +5965,11 @@ export declare type F0FileField = F0BaseField & {
|
|
|
5916
5965
|
multiple?: boolean;
|
|
5917
5966
|
/** Dropzone description text */
|
|
5918
5967
|
description?: string;
|
|
5919
|
-
/**
|
|
5920
|
-
|
|
5968
|
+
/**
|
|
5969
|
+
* Consumer-provided upload hook for standalone usage.
|
|
5970
|
+
* When inside `<F0Form>`, the form-level `useUpload` takes precedence.
|
|
5971
|
+
*/
|
|
5972
|
+
useUpload?: UseFileUpload;
|
|
5921
5973
|
/** Conditional rendering */
|
|
5922
5974
|
renderIf?: FileFieldRenderIf;
|
|
5923
5975
|
};
|
|
@@ -6110,7 +6162,7 @@ export declare function f0FormField<T extends z.ZodDate>(schema: T, config: F0Da
|
|
|
6110
6162
|
* Enum field - select
|
|
6111
6163
|
* @typeParam R - Record type for data source (when using source instead of options)
|
|
6112
6164
|
*/
|
|
6113
|
-
export declare function f0FormField<T extends z.ZodEnum<[string, ...string[]]>, R extends Record<string, unknown> = Record<string, unknown>>(schema: T, config: F0StringSelectConfig<R>): T & F0ZodType<T>;
|
|
6165
|
+
export declare function f0FormField<T extends z.ZodEnum<[string, ...string[]]>, R extends Record<string, unknown> = Record<string, unknown>>(schema: T, config: F0StringSelectConfig<R> | F0StringCardSelectConfig): T & F0ZodType<T>;
|
|
6114
6166
|
|
|
6115
6167
|
/**
|
|
6116
6168
|
* Array field - multi-select
|
|
@@ -6217,6 +6269,8 @@ export declare interface F0FormPropsWithPerSectionDefinition<T extends F0PerSect
|
|
|
6217
6269
|
styling?: F0FormStylingConfig;
|
|
6218
6270
|
formRef?: React.MutableRefObject<F0FormRef | null>;
|
|
6219
6271
|
initialFiles?: InitialFile[];
|
|
6272
|
+
/** Upload hook shared by all file fields in the form. */
|
|
6273
|
+
useUpload?: UseFileUpload;
|
|
6220
6274
|
/**
|
|
6221
6275
|
* Callback that renders custom fields identified by `customFieldName`.
|
|
6222
6276
|
* When a field has `customFieldName`, this function is called instead of the inline `render`.
|
|
@@ -6271,6 +6325,10 @@ export declare interface F0FormPropsWithPerSectionSchema<T extends F0PerSectionS
|
|
|
6271
6325
|
* `defaultValues` against `InitialFile.value`.
|
|
6272
6326
|
*/
|
|
6273
6327
|
initialFiles?: InitialFile[];
|
|
6328
|
+
/**
|
|
6329
|
+
* Upload hook shared by all file fields in the form.
|
|
6330
|
+
*/
|
|
6331
|
+
useUpload?: UseFileUpload;
|
|
6274
6332
|
/**
|
|
6275
6333
|
* Callback that renders custom fields identified by `customFieldName`.
|
|
6276
6334
|
* When a field has `customFieldName`, this function is called instead of the inline `render`.
|
|
@@ -6326,6 +6384,11 @@ export declare interface F0FormPropsWithSingleSchema<TSchema extends F0FormSchem
|
|
|
6326
6384
|
* `defaultValues` against `InitialFile.value`.
|
|
6327
6385
|
*/
|
|
6328
6386
|
initialFiles?: InitialFile[];
|
|
6387
|
+
/**
|
|
6388
|
+
* Upload hook shared by all file fields in the form.
|
|
6389
|
+
* Called once per file to obtain an independent upload instance.
|
|
6390
|
+
*/
|
|
6391
|
+
useUpload?: UseFileUpload;
|
|
6329
6392
|
/**
|
|
6330
6393
|
* Callback that renders custom fields identified by `customFieldName`.
|
|
6331
6394
|
* When a field has `customFieldName`, this function is called instead of the inline `render`.
|
|
@@ -6360,6 +6423,8 @@ export declare interface F0FormPropsWithSingleSchemaDefinition<TSchema extends F
|
|
|
6360
6423
|
styling?: F0FormStylingConfig;
|
|
6361
6424
|
formRef?: React.MutableRefObject<F0FormRef | null>;
|
|
6362
6425
|
initialFiles?: InitialFile[];
|
|
6426
|
+
/** Upload hook shared by all file fields in the form. */
|
|
6427
|
+
useUpload?: UseFileUpload;
|
|
6363
6428
|
/**
|
|
6364
6429
|
* Callback that renders custom fields identified by `customFieldName`.
|
|
6365
6430
|
* When a field has `customFieldName`, this function is called instead of the inline `render`.
|
|
@@ -6993,6 +7058,13 @@ export declare type F0SelectTagProp = string | {
|
|
|
6993
7058
|
src?: string;
|
|
6994
7059
|
};
|
|
6995
7060
|
|
|
7061
|
+
/**
|
|
7062
|
+
* Config for string fields rendered as grouped radio cards
|
|
7063
|
+
*/
|
|
7064
|
+
declare type F0StringCardSelectConfig = F0BaseConfig & F0CardSelectConfig & {
|
|
7065
|
+
fieldType: "cardSelect";
|
|
7066
|
+
};
|
|
7067
|
+
|
|
6996
7068
|
/**
|
|
6997
7069
|
* Union of all string field configs
|
|
6998
7070
|
*
|
|
@@ -7000,7 +7072,7 @@ export declare type F0SelectTagProp = string | {
|
|
|
7000
7072
|
* @typeParam TConfig - Type of the fieldConfig object (for custom fields)
|
|
7001
7073
|
* @typeParam R - Record type for data source (when using source instead of options)
|
|
7002
7074
|
*/
|
|
7003
|
-
export declare type F0StringConfig<TValue = string, TConfig = undefined, R extends Record<string, unknown> = Record<string, unknown>> = F0StringTextConfig | F0StringTextareaConfig | F0StringSelectConfig<R> | F0StringFileConfig | F0CustomFieldConfig<TValue, TConfig>;
|
|
7075
|
+
export declare type F0StringConfig<TValue = string, TConfig = undefined, R extends Record<string, unknown> = Record<string, unknown>> = F0StringTextConfig | F0StringTextareaConfig | F0StringSelectConfig<R> | F0StringCardSelectConfig | F0StringFileConfig | F0CustomFieldConfig<TValue, TConfig>;
|
|
7004
7076
|
|
|
7005
7077
|
/**
|
|
7006
7078
|
* Config for file fields (single file upload, form value is a string identifier)
|
|
@@ -7043,6 +7115,12 @@ export declare interface F0SwitchConfig {
|
|
|
7043
7115
|
* moreInfoLink: { href: "https://help.example.com/article", label: "Learn more" }
|
|
7044
7116
|
*/
|
|
7045
7117
|
moreInfoLink?: F0MoreInfoLink;
|
|
7118
|
+
/**
|
|
7119
|
+
* When false, prevents this switch from being grouped with adjacent switches
|
|
7120
|
+
* into a single bordered container. Renders as a standalone field instead.
|
|
7121
|
+
* @default true
|
|
7122
|
+
*/
|
|
7123
|
+
grouped?: boolean;
|
|
7046
7124
|
}
|
|
7047
7125
|
|
|
7048
7126
|
/**
|
|
@@ -7052,6 +7130,8 @@ export declare type F0SwitchField = F0BaseField & {
|
|
|
7052
7130
|
type: "switch";
|
|
7053
7131
|
/** Link displayed below the help text, typically pointing to external documentation */
|
|
7054
7132
|
moreInfoLink?: F0MoreInfoLink;
|
|
7133
|
+
/** When false, renders as a standalone field instead of grouping with adjacent switches */
|
|
7134
|
+
grouped?: boolean;
|
|
7055
7135
|
/** Conditional rendering based on another field's value */
|
|
7056
7136
|
renderIf?: SwitchFieldRenderIf;
|
|
7057
7137
|
};
|
|
@@ -7382,7 +7462,7 @@ export declare function fieldsToSeconds(fields: DurationFields): number;
|
|
|
7382
7462
|
/**
|
|
7383
7463
|
* Field types for rendering
|
|
7384
7464
|
*/
|
|
7385
|
-
export declare type FieldType = "text" | "number" | "duration" | "textarea" | "select" | "checkbox" | "switch" | "date" | "time" | "datetime" | "daterange" | "richtext" | "file" | "custom";
|
|
7465
|
+
export declare type FieldType = "text" | "number" | "duration" | "textarea" | "select" | "checkbox" | "switch" | "date" | "time" | "datetime" | "daterange" | "richtext" | "file" | "cardSelect" | "custom";
|
|
7386
7466
|
|
|
7387
7467
|
export declare type FileAvatarVariant = Extract<AvatarVariant, {
|
|
7388
7468
|
type: "file";
|