@factorialco/f0-react 1.359.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.
@@ -710,7 +710,7 @@ export declare const BaseCelebration: ({ link, firstName, lastName, src, onClick
710
710
 
711
711
  declare type BaseColor = keyof typeof baseColors;
712
712
 
713
- export declare const BaseCommunityPost: ({ id, author, group, createdAt, title, description, onClick, mediaUrl, event, counters, reactions, inLabel, comment, dropdownItems, noReactionsButton, }: CommunityPostProps) => JSX_2.Element;
713
+ export declare const BaseCommunityPost: ({ id, author, group, createdAt, title, description, onClick, mediaUrl, event, counters, reactions, inLabel, comment, actions, dropdownItems, noReactionsButton, }: CommunityPostProps) => JSX_2.Element;
714
714
 
715
715
  /**
716
716
  * Base data adapter configuration for non-paginated collections
@@ -1569,10 +1569,16 @@ declare const columnWidths: {
1569
1569
  readonly fit: 1;
1570
1570
  };
1571
1571
 
1572
- export declare const CommunityPost: (({ id, author, group, createdAt, title, description, onClick, mediaUrl, event, counters, reactions, inLabel, comment, dropdownItems, noReactionsButton, }: CommunityPostProps) => JSX_2.Element) & {
1572
+ export declare const CommunityPost: (({ id, author, group, createdAt, title, description, onClick, mediaUrl, event, counters, reactions, inLabel, comment, actions, dropdownItems, noReactionsButton, }: CommunityPostProps) => JSX_2.Element) & {
1573
1573
  Skeleton: ({ withEvent, withImage, }: CommunityPostSkeletonProps) => JSX_2.Element;
1574
1574
  };
1575
1575
 
1576
+ export declare type CommunityPostAction = {
1577
+ label: string;
1578
+ icon?: IconType;
1579
+ onClick: () => void;
1580
+ };
1581
+
1576
1582
  export declare type CommunityPostProps = {
1577
1583
  id: string;
1578
1584
  author?: {
@@ -1600,6 +1606,7 @@ export declare type CommunityPostProps = {
1600
1606
  label: string;
1601
1607
  onClick: () => void;
1602
1608
  };
1609
+ actions?: CommunityPostAction[];
1603
1610
  noVideoPreload?: boolean;
1604
1611
  onClick: (id: string) => void;
1605
1612
  noReactionsButton?: boolean;
@@ -11398,20 +11398,20 @@ const yN = oe("Reactions", xN), zc = (t) => {
11398
11398
  })]
11399
11399
  })]
11400
11400
  })]
11401
- }), Nh = Ne(NN, SN), IN = ({ id: t, author: e, group: n, createdAt: r, title: i, description: s, onClick: o, mediaUrl: a, event: c, counters: d, reactions: f, inLabel: u, comment: h, dropdownItems: m, noReactionsButton: p = !1 }) => {
11402
- const b = [d.views, d.comments].filter(Boolean).join(" · "), v = Ju(r), x = () => {
11401
+ }), Nh = Ne(NN, SN), IN = ({ id: t, author: e, group: n, createdAt: r, title: i, description: s, onClick: o, mediaUrl: a, event: c, counters: d, reactions: f, inLabel: u, comment: h, actions: m, dropdownItems: p, noReactionsButton: b = !1 }) => {
11402
+ const v = [d.views, d.comments].filter(Boolean).join(" · "), x = Ju(r), w = () => {
11403
11403
  o(t);
11404
- }, w = (T) => {
11405
- T.stopPropagation();
11406
- }, y = e ? `${e.firstName} ${e.lastName}` : void 0;
11404
+ }, y = (S) => {
11405
+ S.stopPropagation();
11406
+ }, T = e ? `${e.firstName} ${e.lastName}` : void 0;
11407
11407
  return g("div", {
11408
11408
  className: "flex w-full cursor-pointer flex-row gap-3 rounded-xl border border-solid border-transparent p-3 pt-2 hover:bg-f1-background-hover focus:border-f1-border-secondary focus:outline focus:outline-1 focus:outline-offset-1 focus:outline-f1-border-selected-bold md:pb-4 md:pt-3",
11409
- onClick: x,
11409
+ onClick: w,
11410
11410
  children: [l("div", {
11411
11411
  className: "hidden md:block",
11412
11412
  children: e ? l(Tn, {
11413
11413
  href: e.url || "#",
11414
- title: y,
11414
+ title: T,
11415
11415
  stopPropagation: !0,
11416
11416
  children: l(wt, {
11417
11417
  firstName: e.firstName,
@@ -11433,7 +11433,7 @@ const yN = oe("Reactions", xN), zc = (t) => {
11433
11433
  children: [l(Tn, {
11434
11434
  href: e.url,
11435
11435
  className: "block md:hidden",
11436
- title: y,
11436
+ title: T,
11437
11437
  stopPropagation: !0,
11438
11438
  children: l("span", {
11439
11439
  className: "flex items-center",
@@ -11446,10 +11446,10 @@ const yN = oe("Reactions", xN), zc = (t) => {
11446
11446
  })
11447
11447
  }), l(Tn, {
11448
11448
  href: e.url,
11449
- title: y,
11449
+ title: T,
11450
11450
  className: "font-medium text-f1-foreground no-underline visited:text-f1-foreground",
11451
11451
  stopPropagation: !0,
11452
- children: y
11452
+ children: T
11453
11453
  })]
11454
11454
  }) : l("div", {
11455
11455
  className: "block md:hidden",
@@ -11472,24 +11472,32 @@ const yN = oe("Reactions", xN), zc = (t) => {
11472
11472
  children: "·"
11473
11473
  }), l("span", {
11474
11474
  className: "text-f1-foreground-secondary",
11475
- children: v
11475
+ children: x
11476
11476
  })]
11477
11477
  }), g("div", {
11478
11478
  className: "flex flex-row gap-2",
11479
- children: [l("div", {
11479
+ children: [g("div", {
11480
11480
  className: "hidden flex-row gap-2 md:flex",
11481
- children: m?.length && l(Me, {
11482
- items: m,
11481
+ children: [m?.map((S) => l(j, {
11482
+ ...S.icon && {
11483
+ icon: S.icon
11484
+ },
11485
+ variant: "outline",
11486
+ size: "md",
11487
+ onClick: S.onClick,
11488
+ label: S.label
11489
+ }, S.label)), p?.length && l(Me, {
11490
+ items: p,
11483
11491
  icon: Ni,
11484
11492
  size: "sm"
11485
- })
11493
+ })]
11486
11494
  }), l("div", {
11487
11495
  className: "md:hidden",
11488
11496
  children: l(Me, {
11489
11497
  items: [{
11490
11498
  label: h.label,
11491
11499
  onClick: h.onClick
11492
- }, ...m ?? []],
11500
+ }, ...p ?? []],
11493
11501
  icon: Ni,
11494
11502
  size: "sm"
11495
11503
  })
@@ -11510,7 +11518,7 @@ const yN = oe("Reactions", xN), zc = (t) => {
11510
11518
  children: Ch(a) ? l("video", {
11511
11519
  controls: !0,
11512
11520
  className: "aspect-video h-full w-full bg-f1-background-secondary object-cover",
11513
- onClick: w,
11521
+ onClick: y,
11514
11522
  children: l("source", {
11515
11523
  src: a
11516
11524
  })
@@ -11531,8 +11539,8 @@ const yN = oe("Reactions", xN), zc = (t) => {
11531
11539
  })
11532
11540
  }), l("p", {
11533
11541
  className: "text-f1-foreground-secondary",
11534
- children: b
11535
- }), !p && l(yN, {
11542
+ children: v
11543
+ }), !b && l(yN, {
11536
11544
  items: f?.items ?? [],
11537
11545
  onInteraction: f?.onInteraction,
11538
11546
  action: {
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
  /**