@factorialco/f0-react 1.360.0 → 1.361.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.
Files changed (3) hide show
  1. package/dist/f0.d.ts +82 -19
  2. package/dist/f0.js +2157 -2124
  3. package/package.json +1 -1
package/dist/f0.d.ts CHANGED
@@ -1263,7 +1263,7 @@ export declare const ChatSpinner: ForwardRefExoticComponent<Omit<SVGProps<SVGSVG
1263
1263
  /**
1264
1264
  * All valid renderIf conditions for checkbox fields
1265
1265
  */
1266
- declare type CheckboxFieldRenderIf = BooleanRenderIfCondition | CommonRenderIfCondition;
1266
+ declare type CheckboxFieldRenderIf = BooleanRenderIfCondition | CommonRenderIfCondition | F0BaseFieldRenderIfFunction;
1267
1267
 
1268
1268
  declare interface CheckboxProps extends DataAttributes_2 {
1269
1269
  /**
@@ -1520,7 +1520,7 @@ export declare type CurrentFilters<F extends FilterOptions<string>> = F extends
1520
1520
  /**
1521
1521
  * All valid renderIf conditions for custom fields
1522
1522
  */
1523
- declare type CustomFieldRenderIf = CommonRenderIfCondition;
1523
+ declare type CustomFieldRenderIf = CommonRenderIfCondition | F0BaseFieldRenderIfFunction;
1524
1524
 
1525
1525
  /**
1526
1526
  * Props passed to the custom field render function
@@ -1840,7 +1840,7 @@ export declare type DataSourceDefinition<R extends RecordType = RecordType, Filt
1840
1840
  /**
1841
1841
  * All valid renderIf conditions for date fields
1842
1842
  */
1843
- declare type DateFieldRenderIf = DateRenderIfCondition | CommonRenderIfCondition;
1843
+ declare type DateFieldRenderIf = DateRenderIfCondition | CommonRenderIfCondition | F0BaseFieldRenderIfFunction;
1844
1844
 
1845
1845
  export declare type DateFilterDefinition = BaseFilterDefinition<"date"> & {
1846
1846
  options?: DateFilterOptions_2;
@@ -1925,7 +1925,7 @@ declare type DateRangeComplete = Required<DateRange>;
1925
1925
  /**
1926
1926
  * All valid renderIf conditions for date range fields
1927
1927
  */
1928
- declare type DateRangeFieldRenderIf = DateRangeRenderIfCondition | CommonRenderIfCondition;
1928
+ declare type DateRangeFieldRenderIf = DateRangeRenderIfCondition | CommonRenderIfCondition | F0BaseFieldRenderIfFunction;
1929
1929
 
1930
1930
  /**
1931
1931
  * Base for date range-specific conditions
@@ -2674,9 +2674,9 @@ export declare interface ErrorMessageProps {
2674
2674
  }
2675
2675
 
2676
2676
  /**
2677
- * Evaluate a renderIf condition against the current form values
2677
+ * Evaluate a renderIf property which can be a condition object or a function
2678
2678
  */
2679
- export declare function evaluateRenderIf(condition: RenderIfCondition, values: Record<string, unknown>): boolean;
2679
+ export declare function evaluateRenderIf(renderIf: F0BaseFieldRenderIfProp, values: Record<string, unknown>): boolean;
2680
2680
 
2681
2681
  declare type EventCatcherFunction = (eventName: EventName, params: EventParams) => void;
2682
2682
 
@@ -3040,12 +3040,36 @@ export declare interface F0BaseConfig {
3040
3040
  placeholder?: string;
3041
3041
  /** Helper text displayed below the field */
3042
3042
  helpText?: string;
3043
- /** Whether the field is disabled */
3044
- disabled?: boolean;
3043
+ /**
3044
+ * Whether the field is disabled.
3045
+ * Can be a boolean or a function that receives form values.
3046
+ * @example
3047
+ * // Static disabled
3048
+ * disabled: true
3049
+ *
3050
+ * // Dynamic disabled based on other field values
3051
+ * disabled: ({ values }) => values.status === 'readonly'
3052
+ */
3053
+ disabled?: F0BaseFieldDisabledProp;
3054
+ /**
3055
+ * When true, resets the field to its default value when it becomes disabled.
3056
+ * Useful for clearing dependent fields when their controlling field changes.
3057
+ * @default false
3058
+ */
3059
+ resetOnDisable?: boolean;
3045
3060
  /** Row ID for horizontal grouping with other fields */
3046
3061
  row?: string;
3047
- /** Conditional rendering based on another field's value */
3048
- renderIf?: RenderIfCondition;
3062
+ /**
3063
+ * Conditional rendering based on another field's value.
3064
+ * Can be a condition object or a function that receives form values.
3065
+ * @example
3066
+ * // Condition object
3067
+ * renderIf: { fieldId: 'status', equalsTo: 'active' }
3068
+ *
3069
+ * // Dynamic renderIf based on form values
3070
+ * renderIf: ({ values }) => values.status === 'active'
3071
+ */
3072
+ renderIf?: F0BaseFieldRenderIfProp;
3049
3073
  }
3050
3074
 
3051
3075
  /**
@@ -3062,10 +3086,49 @@ export declare interface F0BaseField {
3062
3086
  helpText?: string;
3063
3087
  /** Placeholder text for the input */
3064
3088
  placeholder?: string;
3065
- /** Whether the field is disabled */
3066
- disabled?: boolean;
3089
+ /**
3090
+ * Whether the field is disabled.
3091
+ * Can be a boolean or a function that receives form values.
3092
+ * @example
3093
+ * // Static disabled
3094
+ * disabled: true
3095
+ *
3096
+ * // Dynamic disabled based on other field values
3097
+ * disabled: ({ values }) => values.status === 'readonly'
3098
+ */
3099
+ disabled?: F0BaseFieldDisabledProp;
3100
+ /**
3101
+ * When true, resets the field to its default value when it becomes disabled.
3102
+ * Useful for clearing dependent fields when their controlling field changes.
3103
+ * @default false
3104
+ */
3105
+ resetOnDisable?: boolean;
3067
3106
  }
3068
3107
 
3108
+ /**
3109
+ * Function type for dynamic disabled evaluation based on form values
3110
+ */
3111
+ declare type F0BaseFieldDisabledFunction = (context: {
3112
+ values: Record<string, unknown>;
3113
+ }) => boolean;
3114
+
3115
+ /**
3116
+ * Disabled property can be a boolean or a function that receives form values
3117
+ */
3118
+ declare type F0BaseFieldDisabledProp = boolean | F0BaseFieldDisabledFunction;
3119
+
3120
+ /**
3121
+ * Function type for dynamic renderIf evaluation based on form values
3122
+ */
3123
+ declare type F0BaseFieldRenderIfFunction = (context: {
3124
+ values: Record<string, unknown>;
3125
+ }) => boolean;
3126
+
3127
+ /**
3128
+ * RenderIf property can be a condition object or a function that receives form values
3129
+ */
3130
+ declare type F0BaseFieldRenderIfProp = RenderIfCondition | F0BaseFieldRenderIfFunction;
3131
+
3069
3132
  export declare const F0BigNumber: {
3070
3133
  ({ label, ...props }: BigNumberProps_2): JSX_2.Element;
3071
3134
  displayName: string;
@@ -5512,7 +5575,7 @@ export declare interface NextStepsProps {
5512
5575
  /**
5513
5576
  * All valid renderIf conditions for number fields
5514
5577
  */
5515
- declare type NumberFieldRenderIf = NumberRenderIfCondition | CommonRenderIfCondition;
5578
+ declare type NumberFieldRenderIf = NumberRenderIfCondition | CommonRenderIfCondition | F0BaseFieldRenderIfFunction;
5516
5579
 
5517
5580
  export declare type NumberFilterDefinition = BaseFilterDefinition<"number"> & {
5518
5581
  options?: NumberFilterOptions_2;
@@ -6212,7 +6275,7 @@ export declare interface ResponsiveStyleProps {
6212
6275
  /**
6213
6276
  * All valid renderIf conditions for richtext fields
6214
6277
  */
6215
- declare type RichTextFieldRenderIf = CommonRenderIfCondition;
6278
+ declare type RichTextFieldRenderIf = CommonRenderIfCondition | F0BaseFieldRenderIfFunction;
6216
6279
 
6217
6280
  /**
6218
6281
  * Rich text editor result value type
@@ -6272,7 +6335,7 @@ declare type SecondaryActionsItems = SecondaryActionItem[] | SecondaryActionItem
6272
6335
  /**
6273
6336
  * Conditional rendering for sections - can be a condition object or a function
6274
6337
  */
6275
- export declare type SectionRenderIf = RenderIfCondition | ((values: Record<string, unknown>) => boolean);
6338
+ export declare type SectionRenderIf = RenderIfCondition | F0BaseFieldRenderIfFunction;
6276
6339
 
6277
6340
  /**
6278
6341
  * Represents a collection of selected items.
@@ -6315,7 +6378,7 @@ export declare type SelectedState = {
6315
6378
  /**
6316
6379
  * All valid renderIf conditions for select fields
6317
6380
  */
6318
- declare type SelectFieldRenderIf = SelectRenderIfCondition | CommonRenderIfCondition;
6381
+ declare type SelectFieldRenderIf = SelectRenderIfCondition | CommonRenderIfCondition | F0BaseFieldRenderIfFunction;
6319
6382
 
6320
6383
  export declare type SelectionId = number | string;
6321
6384
 
@@ -6471,7 +6534,7 @@ declare type SummaryType = "sum";
6471
6534
  /**
6472
6535
  * All valid renderIf conditions for switch fields
6473
6536
  */
6474
- declare type SwitchFieldRenderIf = BooleanRenderIfCondition | CommonRenderIfCondition;
6537
+ declare type SwitchFieldRenderIf = BooleanRenderIfCondition | CommonRenderIfCondition | F0BaseFieldRenderIfFunction;
6475
6538
 
6476
6539
  export declare function Table({ children, ...props }: React.HTMLAttributes<HTMLTableElement>): JSX_2.Element;
6477
6540
 
@@ -6745,12 +6808,12 @@ declare type TeamTagProps = ComponentProps<typeof F0TagTeam>;
6745
6808
  /**
6746
6809
  * All valid renderIf conditions for textarea fields
6747
6810
  */
6748
- declare type TextareaFieldRenderIf = TextRenderIfCondition | CommonRenderIfCondition;
6811
+ declare type TextareaFieldRenderIf = TextRenderIfCondition | CommonRenderIfCondition | F0BaseFieldRenderIfFunction;
6749
6812
 
6750
6813
  /**
6751
6814
  * All valid renderIf conditions for text fields
6752
6815
  */
6753
- declare type TextFieldRenderIf = TextRenderIfCondition | CommonRenderIfCondition;
6816
+ declare type TextFieldRenderIf = TextRenderIfCondition | CommonRenderIfCondition | F0BaseFieldRenderIfFunction;
6754
6817
 
6755
6818
  declare interface TextProps extends Omit<default_2.HTMLAttributes<HTMLElement>, "className">, default_2.RefAttributes<HTMLElement> {
6756
6819
  /**