@factorialco/f0-react 1.280.0 → 1.282.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.
@@ -283,7 +283,7 @@ declare type ActionSize = (typeof actionSizes)[number];
283
283
 
284
284
  declare const actionSizes: readonly ["sm", "md", "lg"];
285
285
 
286
- declare type ActionType = CopyActionType | NavigateActionType | OpenLinkActionType;
286
+ export declare type ActionType = "duplicate" | "delete";
287
287
 
288
288
  export declare type actionType = {
289
289
  label: string;
@@ -293,6 +293,8 @@ export declare type actionType = {
293
293
  icon?: IconType;
294
294
  };
295
295
 
296
+ declare type ActionType_2 = CopyActionType | NavigateActionType | OpenLinkActionType;
297
+
296
298
  declare type actionType_2 = {
297
299
  label: string;
298
300
  onClick: () => void;
@@ -310,7 +312,7 @@ export declare const ActivityItemList: (({ items, loadingMoreItems, onClickItem,
310
312
  Skeleton: () => default_2.JSX.Element;
311
313
  };
312
314
 
313
- export declare type ActivityItemListProps = Pick<SectionProps, "items" | "onClickItem"> & {
315
+ export declare type ActivityItemListProps = Pick<SectionProps_2, "items" | "onClickItem"> & {
314
316
  onEndReached?: () => void;
315
317
  onEndReachedItemsThreshold?: number;
316
318
  loadingMoreItems?: boolean;
@@ -832,6 +834,25 @@ export declare type BasePaginatedResponse<R> = BaseResponse<R> & {
832
834
  perPage: number;
833
835
  };
834
836
 
837
+ export declare type BaseQuestionOnChangeParams = {
838
+ id: string;
839
+ title?: string;
840
+ description?: string;
841
+ required?: boolean;
842
+ };
843
+
844
+ declare type BaseQuestionProps = {
845
+ id: string;
846
+ title: string;
847
+ description?: string;
848
+ type: QuestionType;
849
+ children: React.ReactNode;
850
+ required?: boolean;
851
+ locked?: boolean;
852
+ };
853
+
854
+ declare type BaseQuestionPropsForOtherQuestionComponents = Omit<BaseQuestionProps, "children" | "onChange">;
855
+
835
856
  /**
836
857
  * Base response type for collection data
837
858
  * @template R - The type of records in the collection
@@ -1316,13 +1337,7 @@ export declare const ChartWidgetEmptyState: ForwardRefExoticComponent<Props_5 &
1316
1337
 
1317
1338
  export declare type ChatWidgetEmptyStateProps = Props_5;
1318
1339
 
1319
- declare type ChildrenResponse<R extends RecordType> = BaseResponse<R> | R[] | {
1320
- records: R[] & {
1321
- type?: ChildrenResponseType;
1322
- };
1323
- };
1324
-
1325
- declare type ChildrenResponseType = "basic" | "detailed";
1340
+ declare type ChildrenResponse<R extends RecordType> = BaseResponse<R> | R[] | NestedResponseWithType<R>;
1326
1341
 
1327
1342
  export declare function ClockInControls({ trackedMinutes, remainingMinutes, data, labels, locationId, locations, canShowLocation, locationSelectorDisabled, onClockIn, onClockOut, onBreak, breakTypes, onChangeBreakTypeId, canShowBreakButton, canSeeGraph, canSeeRemainingTime, onChangeLocationId, canShowProject, projectSelectorElement, breakTypeName, }: ClockInControlsProps): JSX_2.Element;
1328
1343
 
@@ -1386,6 +1401,29 @@ declare interface ClockInGraphProps {
1386
1401
 
1387
1402
  declare type ClockInStatus = "clocked-in" | "break" | "clocked-out";
1388
1403
 
1404
+ export declare const CoCreationForm: ({ elements, isEditMode, onChange, }: CoCreationFormProps) => JSX_2.Element;
1405
+
1406
+ export declare type CoCreationFormCallbacks = {
1407
+ onQuestionChange?: (params: OnChangeQuestionParams) => void;
1408
+ onSectionChange?: (params: OnChangeSectionParams) => void;
1409
+ onAddNewElement?: (params: OnAddNewElementParams) => void;
1410
+ onDuplicateElement?: (params: OnDuplicateElementParams) => void;
1411
+ };
1412
+
1413
+ export declare type CoCreationFormElement = {
1414
+ type: "section";
1415
+ section: SectionElement;
1416
+ } | {
1417
+ type: "question";
1418
+ question: QuestionElement;
1419
+ };
1420
+
1421
+ export declare type CoCreationFormProps = {
1422
+ elements: CoCreationFormElement[];
1423
+ onChange: (elements: CoCreationFormElement[]) => void;
1424
+ isEditMode?: boolean;
1425
+ };
1426
+
1389
1427
  declare type ColId = string;
1390
1428
 
1391
1429
  /**
@@ -1487,7 +1525,7 @@ declare const CompanyItem: ForwardRefExoticComponent<CompanyItemProps & RefAttri
1487
1525
  declare type CompanyItemProps = {
1488
1526
  name: string;
1489
1527
  avatarUrl?: URL_2;
1490
- action?: ActionType;
1528
+ action?: ActionType_2;
1491
1529
  };
1492
1530
 
1493
1531
  export declare function CompanySelector({ companies, selected, onChange, isLoading, withNotification, additionalOptions, }: CompanySelectorProps): JSX_2.Element;
@@ -1908,6 +1946,10 @@ export declare interface DatePreset {
1908
1946
  value: DateRange | (() => DateRange);
1909
1947
  }
1910
1948
 
1949
+ declare type DateQuestionProps = BaseQuestionPropsForOtherQuestionComponents & {
1950
+ value?: Date | null;
1951
+ };
1952
+
1911
1953
  export declare type DateRange = {
1912
1954
  from: Date;
1913
1955
  to?: Date;
@@ -2320,6 +2362,56 @@ declare const defaultTranslations: {
2320
2362
  readonly greaterThan: "It should be greater than {{min}}";
2321
2363
  readonly lessThan: "It should be less than {{max}}";
2322
2364
  };
2365
+ readonly coCreationForm: {
2366
+ readonly actions: {
2367
+ readonly actions: "Actions";
2368
+ readonly duplicateQuestion: "Duplicate question";
2369
+ readonly deleteQuestion: "Delete question";
2370
+ readonly duplicateSection: "Duplicate section";
2371
+ readonly deleteSection: "Delete section";
2372
+ };
2373
+ readonly questionTypes: {
2374
+ readonly section: "Section";
2375
+ readonly rating: "Rating";
2376
+ readonly multipleChoice: "Multiple choice";
2377
+ readonly singleChoice: "Single choice";
2378
+ readonly text: "Text";
2379
+ readonly longText: "Long text";
2380
+ readonly numeric: "Numeric";
2381
+ readonly link: "Link";
2382
+ readonly date: "Date";
2383
+ };
2384
+ readonly selectQuestion: {
2385
+ readonly addOption: "Add option";
2386
+ readonly newOption: "New option {{number}}";
2387
+ readonly markAsCorrect: "Mark as correct";
2388
+ readonly remove: "Remove";
2389
+ readonly correct: "Correct";
2390
+ readonly optionPlaceholder: "Type anything you want here...";
2391
+ };
2392
+ readonly answer: {
2393
+ readonly label: "Answer";
2394
+ readonly placeholder: "Respondent's answer";
2395
+ };
2396
+ readonly labels: {
2397
+ readonly endOfSection: "End of section";
2398
+ readonly title: "Title";
2399
+ readonly titlePlaceholder: "Question title";
2400
+ readonly description: "Description";
2401
+ readonly questionDescriptionPlaceholder: "Describe the question in a few words";
2402
+ readonly sectionDescriptionPlaceholder: "Describe the section in a few words";
2403
+ readonly required: "Required";
2404
+ readonly questionType: "Question type";
2405
+ readonly questionOptions: "Question options";
2406
+ readonly actions: "Actions";
2407
+ readonly sectionTitlePlaceholder: "Section title";
2408
+ };
2409
+ readonly defaults: {
2410
+ readonly newSection: "New Section";
2411
+ readonly newQuestion: "New Question";
2412
+ readonly newQuestionDescription: "New question description";
2413
+ };
2414
+ };
2323
2415
  };
2324
2416
 
2325
2417
  export declare const DetailsItem: ForwardRefExoticComponent<DetailsItemType & RefAttributes<HTMLDivElement>>;
@@ -2388,7 +2480,7 @@ declare type DropdownInternalProps = {
2388
2480
  icon?: IconType;
2389
2481
  size?: F0ButtonProps["size"];
2390
2482
  children?: default_2.ReactNode;
2391
- align?: "start" | "end";
2483
+ align?: "start" | "end" | "center";
2392
2484
  open?: boolean;
2393
2485
  onOpenChange?: (open: boolean) => void;
2394
2486
  } & DataAttributes_2;
@@ -2426,11 +2518,13 @@ export declare type editorStateType = {
2426
2518
  json: JSONContent | null;
2427
2519
  };
2428
2520
 
2521
+ export declare type ElementType = QuestionType | "section";
2522
+
2429
2523
  declare type EmployeeItemProps = {
2430
2524
  firstName: string;
2431
2525
  lastName: string;
2432
2526
  avatarUrl?: URL_2;
2433
- action?: ActionType;
2527
+ action?: ActionType_2;
2434
2528
  };
2435
2529
 
2436
2530
  declare type EmptyState = {
@@ -3357,7 +3451,7 @@ declare type ItemDefinition = {
3357
3451
  declare type ItemProps = {
3358
3452
  text: string;
3359
3453
  icon?: IconType;
3360
- action?: ActionType;
3454
+ action?: ActionType_2;
3361
3455
  };
3362
3456
 
3363
3457
  declare type Items = typeof Item_2 | typeof PersonItem | typeof CompanyItem | typeof TeamItem;
@@ -3419,6 +3513,10 @@ declare type LinkProps = AnchorHTMLAttributes<HTMLAnchorElement> & {
3419
3513
  disabled?: boolean;
3420
3514
  };
3421
3515
 
3516
+ declare type LinkQuestionProps = BaseQuestionPropsForOtherQuestionComponents & {
3517
+ value?: string | null;
3518
+ };
3519
+
3422
3520
  /**
3423
3521
  * Group List: Renders the list for a group
3424
3522
  */
@@ -3792,6 +3890,13 @@ declare type NestedKeyOf<T> = {
3792
3890
  } ? `${K}` | `${K}-${NestedKeyOf<T[K]>}` : `${K}-${NestedKeyOf<T[K]>}` : K extends "DEFAULT" ? never : `${K}`;
3793
3891
  }[keyof T & string];
3794
3892
 
3893
+ declare type NestedResponseWithType<R extends RecordType> = {
3894
+ records: R[];
3895
+ type?: NestedVariant;
3896
+ };
3897
+
3898
+ declare type NestedVariant = "basic" | "detailed";
3899
+
3795
3900
  declare type NewColor = Extract<BaseColor, "viridian" | "malibu" | "yellow" | "purple" | "lilac" | "barbie" | "smoke" | "army" | "flubber" | "indigo" | "camel">;
3796
3901
 
3797
3902
  declare type NextDepth<T> = T extends 1 ? 2 : T extends 2 ? 3 : T extends 3 ? 4 : never;
@@ -3872,6 +3977,10 @@ export declare type NumberInputProps = Omit<InputProps<string>, "value" | "type"
3872
3977
  units?: string;
3873
3978
  };
3874
3979
 
3980
+ declare type NumericQuestionProps = BaseQuestionPropsForOtherQuestionComponents & {
3981
+ value?: number | null;
3982
+ };
3983
+
3875
3984
  export declare function OmniButton({ label, options, hasNewUpdate }: OmniButtonProps): JSX_2.Element;
3876
3985
 
3877
3986
  declare interface OmniButtonProps {
@@ -3880,11 +3989,53 @@ declare interface OmniButtonProps {
3880
3989
  hasNewUpdate?: boolean;
3881
3990
  }
3882
3991
 
3992
+ export declare type OnAddNewElementParams = {
3993
+ type: ElementType;
3994
+ afterId?: string;
3995
+ };
3996
+
3883
3997
  export declare type OnBulkActionCallback<Record extends RecordType, Filters extends FiltersDefinition> = (...args: [
3884
3998
  action: BulkAction,
3885
3999
  ...Parameters<OnSelectItemsCallback<Record, Filters>>
3886
4000
  ]) => void;
3887
4001
 
4002
+ declare type OnChangeQuestionParams = BaseQuestionOnChangeParams & ({
4003
+ type: "text" | "longText";
4004
+ value?: string | null;
4005
+ } | {
4006
+ type: "rating";
4007
+ value: number;
4008
+ } | {
4009
+ type: "select";
4010
+ value?: string | null;
4011
+ options: SelectQuestionOption[];
4012
+ } | {
4013
+ type: "multi-select";
4014
+ value?: string[] | null;
4015
+ options: SelectQuestionOption[];
4016
+ } | {
4017
+ type: "numeric";
4018
+ value?: number | null;
4019
+ } | {
4020
+ type: "link";
4021
+ value?: string | null;
4022
+ } | {
4023
+ type: "date";
4024
+ value?: Date | null;
4025
+ });
4026
+
4027
+ export declare type OnChangeSectionParams = {
4028
+ id: string;
4029
+ title: string;
4030
+ description?: string;
4031
+ questions?: QuestionElement[];
4032
+ };
4033
+
4034
+ export declare type OnDuplicateElementParams = {
4035
+ elementId: string;
4036
+ type: ElementType;
4037
+ };
4038
+
3888
4039
  export declare const OneAlert: ({ title, description, action, link, icon, variant, }: AlertProps) => JSX_2.Element;
3889
4040
 
3890
4041
  export declare const OneApprovalHistory: FC<OneApprovalHistoryProps>;
@@ -4607,6 +4758,28 @@ declare type Pulse = (typeof pulses)[number];
4607
4758
 
4608
4759
  declare const pulses: readonly ["superNegative", "negative", "neutral", "positive", "superPositive"];
4609
4760
 
4761
+ export declare type QuestionActionParams = {
4762
+ questionId: string;
4763
+ type: ActionType;
4764
+ index: number;
4765
+ };
4766
+
4767
+ export declare type QuestionElement = Omit<TextQuestionProps, QuestionPropsToOmit> | Omit<RatingQuestionProps & {
4768
+ type: "rating";
4769
+ }, QuestionPropsToOmit> | Omit<SelectQuestionProps & {
4770
+ type: "select" | "multi-select";
4771
+ }, QuestionPropsToOmit> | Omit<NumericQuestionProps & {
4772
+ type: "numeric";
4773
+ }, QuestionPropsToOmit> | Omit<LinkQuestionProps & {
4774
+ type: "link";
4775
+ }, QuestionPropsToOmit> | Omit<DateQuestionProps & {
4776
+ type: "date";
4777
+ }, QuestionPropsToOmit>;
4778
+
4779
+ declare type QuestionPropsToOmit = "onAction" | "onChange" | "onAddNewElement";
4780
+
4781
+ export declare type QuestionType = "rating" | "select" | "multi-select" | "text" | "longText" | "numeric" | "link" | "date";
4782
+
4610
4783
  /**
4611
4784
  * @experimental This is an experimental component use it at your own risk
4612
4785
  */
@@ -4624,6 +4797,15 @@ export declare type RadarChartProps<K extends ChartConfig> = {
4624
4797
 
4625
4798
  export declare const rangeSeparator = "\u2192";
4626
4799
 
4800
+ declare type RatingQuestionProps = BaseQuestionPropsForOtherQuestionComponents & {
4801
+ value?: number;
4802
+ } & {
4803
+ options: {
4804
+ value: number;
4805
+ label: string;
4806
+ }[];
4807
+ };
4808
+
4627
4809
  declare interface ReactionProps {
4628
4810
  emoji: string;
4629
4811
  initialCount: number;
@@ -4792,9 +4974,25 @@ export declare type secondaryActionType = (actionType | toggleActionType) & {
4792
4974
  type?: "button" | "switch";
4793
4975
  };
4794
4976
 
4977
+ export declare type SectionActionParams = {
4978
+ sectionId: string;
4979
+ type: ActionType;
4980
+ index: number;
4981
+ };
4982
+
4983
+ export declare type SectionElement = Omit<SectionProps, "onAction" | "onChange">;
4984
+
4795
4985
  export declare const SectionHeader: ({ title, description, action, link, separator, }: Props_2) => JSX_2.Element;
4796
4986
 
4797
4987
  declare type SectionProps = {
4988
+ id: string;
4989
+ title: string;
4990
+ description?: string;
4991
+ locked?: boolean;
4992
+ questions?: QuestionElement[];
4993
+ };
4994
+
4995
+ declare type SectionProps_2 = {
4798
4996
  title: string;
4799
4997
  items: Omit<ActivityItemProps, "onClick">[];
4800
4998
  onClickItem: (id: string) => void;
@@ -4888,6 +5086,23 @@ export declare type SelectProps<T extends string, R = unknown> = {
4888
5086
  options: SelectItemProps<T, unknown>[];
4889
5087
  }) & Pick<InputFieldProps<T>, "required" | "loading" | "hideLabel" | "clearable" | "labelIcon" | "size" | "label" | "icon" | "placeholder" | "disabled" | "name" | "error" | "status" | "hint">;
4890
5088
 
5089
+ export declare type SelectQuestionOption = {
5090
+ id?: string;
5091
+ value: string;
5092
+ label: string;
5093
+ correct?: boolean;
5094
+ };
5095
+
5096
+ declare type SelectQuestionProps = BaseQuestionPropsForOtherQuestionComponents & {
5097
+ options: SelectQuestionOption[];
5098
+ } & ({
5099
+ type: "select";
5100
+ value?: string | null;
5101
+ } | {
5102
+ type: "multi-select";
5103
+ value?: string[] | null;
5104
+ });
5105
+
4891
5106
  export declare const selectSizes: readonly ["sm", "md"];
4892
5107
 
4893
5108
  export declare function Shortcut({ keys, variant }: ShortcutProps): JSX_2.Element | null;
@@ -5319,7 +5534,7 @@ declare const TeamItem: ForwardRefExoticComponent<TeamItemProps & RefAttributes<
5319
5534
 
5320
5535
  declare type TeamItemProps = {
5321
5536
  name: string;
5322
- action?: ActionType;
5537
+ action?: ActionType_2;
5323
5538
  };
5324
5539
 
5325
5540
  export declare const Textarea: React.FC<TextareaProps>;
@@ -5330,6 +5545,11 @@ declare const Textarea_2: React_2.ForwardRefExoticComponent<Omit<React_2.Textare
5330
5545
 
5331
5546
  export declare type TextareaProps = Pick<ComponentProps<typeof Textarea_2>, "disabled" | "onChange" | "value" | "placeholder" | "rows" | "cols" | "label" | "labelIcon" | "icon" | "hideLabel" | "maxLength" | "clearable" | "onBlur" | "onFocus" | "name" | "status" | "hint" | "error">;
5332
5547
 
5548
+ declare type TextQuestionProps = BaseQuestionPropsForOtherQuestionComponents & {
5549
+ type: "text" | "longText";
5550
+ value?: string | null;
5551
+ };
5552
+
5333
5553
  declare const THEMES: {
5334
5554
  readonly light: "";
5335
5555
  readonly dark: ".dark";
@@ -5911,6 +6131,31 @@ declare global {
5911
6131
  }
5912
6132
 
5913
6133
 
6134
+ declare module "gridstack" {
6135
+ interface GridStackWidget {
6136
+ id?: string;
6137
+ allowedSizes?: Array<{
6138
+ w: number;
6139
+ h: number;
6140
+ }>;
6141
+ renderFn?: () => React.ReactElement | null;
6142
+ meta?: Record<string, unknown>;
6143
+ }
6144
+ interface GridStackNode {
6145
+ id?: string;
6146
+ w?: number;
6147
+ h?: number;
6148
+ x?: number;
6149
+ y?: number;
6150
+ allowedSizes?: Array<{
6151
+ w: number;
6152
+ h: number;
6153
+ }>;
6154
+ renderFn?: () => React.ReactElement | null;
6155
+ }
6156
+ }
6157
+
6158
+
5914
6159
  declare module "@tiptap/core" {
5915
6160
  interface Commands<ReturnType> {
5916
6161
  aiBlock: {
@@ -5938,31 +6183,6 @@ declare module "@tiptap/core" {
5938
6183
  }
5939
6184
 
5940
6185
 
5941
- declare module "gridstack" {
5942
- interface GridStackWidget {
5943
- id?: string;
5944
- allowedSizes?: Array<{
5945
- w: number;
5946
- h: number;
5947
- }>;
5948
- renderFn?: () => React.ReactElement | null;
5949
- meta?: Record<string, unknown>;
5950
- }
5951
- interface GridStackNode {
5952
- id?: string;
5953
- w?: number;
5954
- h?: number;
5955
- x?: number;
5956
- y?: number;
5957
- allowedSizes?: Array<{
5958
- w: number;
5959
- h: number;
5960
- }>;
5961
- renderFn?: () => React.ReactElement | null;
5962
- }
5963
- }
5964
-
5965
-
5966
6186
  declare module "@tiptap/core" {
5967
6187
  interface Commands<ReturnType> {
5968
6188
  moodTracker: {