@factorialco/f0-react 1.279.2 → 1.281.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
@@ -1386,6 +1407,29 @@ declare interface ClockInGraphProps {
1386
1407
 
1387
1408
  declare type ClockInStatus = "clocked-in" | "break" | "clocked-out";
1388
1409
 
1410
+ export declare const CoCreationForm: ({ elements, isEditMode, onChange, }: CoCreationFormProps) => JSX_2.Element;
1411
+
1412
+ export declare type CoCreationFormCallbacks = {
1413
+ onQuestionChange?: (params: OnChangeQuestionParams) => void;
1414
+ onSectionChange?: (params: OnChangeSectionParams) => void;
1415
+ onAddNewElement?: (params: OnAddNewElementParams) => void;
1416
+ onDuplicateElement?: (params: OnDuplicateElementParams) => void;
1417
+ };
1418
+
1419
+ export declare type CoCreationFormElement = {
1420
+ type: "section";
1421
+ section: SectionElement;
1422
+ } | {
1423
+ type: "question";
1424
+ question: QuestionElement;
1425
+ };
1426
+
1427
+ export declare type CoCreationFormProps = {
1428
+ elements: CoCreationFormElement[];
1429
+ onChange: (elements: CoCreationFormElement[]) => void;
1430
+ isEditMode?: boolean;
1431
+ };
1432
+
1389
1433
  declare type ColId = string;
1390
1434
 
1391
1435
  /**
@@ -1487,7 +1531,7 @@ declare const CompanyItem: ForwardRefExoticComponent<CompanyItemProps & RefAttri
1487
1531
  declare type CompanyItemProps = {
1488
1532
  name: string;
1489
1533
  avatarUrl?: URL_2;
1490
- action?: ActionType;
1534
+ action?: ActionType_2;
1491
1535
  };
1492
1536
 
1493
1537
  export declare function CompanySelector({ companies, selected, onChange, isLoading, withNotification, additionalOptions, }: CompanySelectorProps): JSX_2.Element;
@@ -1908,6 +1952,10 @@ export declare interface DatePreset {
1908
1952
  value: DateRange | (() => DateRange);
1909
1953
  }
1910
1954
 
1955
+ declare type DateQuestionProps = BaseQuestionPropsForOtherQuestionComponents & {
1956
+ value?: Date | null;
1957
+ };
1958
+
1911
1959
  export declare type DateRange = {
1912
1960
  from: Date;
1913
1961
  to?: Date;
@@ -2320,6 +2368,56 @@ declare const defaultTranslations: {
2320
2368
  readonly greaterThan: "It should be greater than {{min}}";
2321
2369
  readonly lessThan: "It should be less than {{max}}";
2322
2370
  };
2371
+ readonly coCreationForm: {
2372
+ readonly actions: {
2373
+ readonly actions: "Actions";
2374
+ readonly duplicateQuestion: "Duplicate question";
2375
+ readonly deleteQuestion: "Delete question";
2376
+ readonly duplicateSection: "Duplicate section";
2377
+ readonly deleteSection: "Delete section";
2378
+ };
2379
+ readonly questionTypes: {
2380
+ readonly section: "Section";
2381
+ readonly rating: "Rating";
2382
+ readonly multipleChoice: "Multiple choice";
2383
+ readonly singleChoice: "Single choice";
2384
+ readonly text: "Text";
2385
+ readonly longText: "Long text";
2386
+ readonly numeric: "Numeric";
2387
+ readonly link: "Link";
2388
+ readonly date: "Date";
2389
+ };
2390
+ readonly selectQuestion: {
2391
+ readonly addOption: "Add option";
2392
+ readonly newOption: "New option {{number}}";
2393
+ readonly markAsCorrect: "Mark as correct";
2394
+ readonly remove: "Remove";
2395
+ readonly correct: "Correct";
2396
+ readonly optionPlaceholder: "Type anything you want here...";
2397
+ };
2398
+ readonly answer: {
2399
+ readonly label: "Answer";
2400
+ readonly placeholder: "Respondent's answer";
2401
+ };
2402
+ readonly labels: {
2403
+ readonly endOfSection: "End of section";
2404
+ readonly title: "Title";
2405
+ readonly titlePlaceholder: "Question title";
2406
+ readonly description: "Description";
2407
+ readonly questionDescriptionPlaceholder: "Describe the question in a few words";
2408
+ readonly sectionDescriptionPlaceholder: "Describe the section in a few words";
2409
+ readonly required: "Required";
2410
+ readonly questionType: "Question type";
2411
+ readonly questionOptions: "Question options";
2412
+ readonly actions: "Actions";
2413
+ readonly sectionTitlePlaceholder: "Section title";
2414
+ };
2415
+ readonly defaults: {
2416
+ readonly newSection: "New Section";
2417
+ readonly newQuestion: "New Question";
2418
+ readonly newQuestionDescription: "New question description";
2419
+ };
2420
+ };
2323
2421
  };
2324
2422
 
2325
2423
  export declare const DetailsItem: ForwardRefExoticComponent<DetailsItemType & RefAttributes<HTMLDivElement>>;
@@ -2388,7 +2486,7 @@ declare type DropdownInternalProps = {
2388
2486
  icon?: IconType;
2389
2487
  size?: F0ButtonProps["size"];
2390
2488
  children?: default_2.ReactNode;
2391
- align?: "start" | "end";
2489
+ align?: "start" | "end" | "center";
2392
2490
  open?: boolean;
2393
2491
  onOpenChange?: (open: boolean) => void;
2394
2492
  } & DataAttributes_2;
@@ -2426,11 +2524,13 @@ export declare type editorStateType = {
2426
2524
  json: JSONContent | null;
2427
2525
  };
2428
2526
 
2527
+ export declare type ElementType = QuestionType | "section";
2528
+
2429
2529
  declare type EmployeeItemProps = {
2430
2530
  firstName: string;
2431
2531
  lastName: string;
2432
2532
  avatarUrl?: URL_2;
2433
- action?: ActionType;
2533
+ action?: ActionType_2;
2434
2534
  };
2435
2535
 
2436
2536
  declare type EmptyState = {
@@ -3357,7 +3457,7 @@ declare type ItemDefinition = {
3357
3457
  declare type ItemProps = {
3358
3458
  text: string;
3359
3459
  icon?: IconType;
3360
- action?: ActionType;
3460
+ action?: ActionType_2;
3361
3461
  };
3362
3462
 
3363
3463
  declare type Items = typeof Item_2 | typeof PersonItem | typeof CompanyItem | typeof TeamItem;
@@ -3419,6 +3519,10 @@ declare type LinkProps = AnchorHTMLAttributes<HTMLAnchorElement> & {
3419
3519
  disabled?: boolean;
3420
3520
  };
3421
3521
 
3522
+ declare type LinkQuestionProps = BaseQuestionPropsForOtherQuestionComponents & {
3523
+ value?: string | null;
3524
+ };
3525
+
3422
3526
  /**
3423
3527
  * Group List: Renders the list for a group
3424
3528
  */
@@ -3872,6 +3976,10 @@ export declare type NumberInputProps = Omit<InputProps<string>, "value" | "type"
3872
3976
  units?: string;
3873
3977
  };
3874
3978
 
3979
+ declare type NumericQuestionProps = BaseQuestionPropsForOtherQuestionComponents & {
3980
+ value?: number | null;
3981
+ };
3982
+
3875
3983
  export declare function OmniButton({ label, options, hasNewUpdate }: OmniButtonProps): JSX_2.Element;
3876
3984
 
3877
3985
  declare interface OmniButtonProps {
@@ -3880,11 +3988,53 @@ declare interface OmniButtonProps {
3880
3988
  hasNewUpdate?: boolean;
3881
3989
  }
3882
3990
 
3991
+ export declare type OnAddNewElementParams = {
3992
+ type: ElementType;
3993
+ afterId?: string;
3994
+ };
3995
+
3883
3996
  export declare type OnBulkActionCallback<Record extends RecordType, Filters extends FiltersDefinition> = (...args: [
3884
3997
  action: BulkAction,
3885
3998
  ...Parameters<OnSelectItemsCallback<Record, Filters>>
3886
3999
  ]) => void;
3887
4000
 
4001
+ declare type OnChangeQuestionParams = BaseQuestionOnChangeParams & ({
4002
+ type: "text" | "longText";
4003
+ value?: string | null;
4004
+ } | {
4005
+ type: "rating";
4006
+ value: number;
4007
+ } | {
4008
+ type: "select";
4009
+ value?: string | null;
4010
+ options: SelectQuestionOption[];
4011
+ } | {
4012
+ type: "multi-select";
4013
+ value?: string[] | null;
4014
+ options: SelectQuestionOption[];
4015
+ } | {
4016
+ type: "numeric";
4017
+ value?: number | null;
4018
+ } | {
4019
+ type: "link";
4020
+ value?: string | null;
4021
+ } | {
4022
+ type: "date";
4023
+ value?: Date | null;
4024
+ });
4025
+
4026
+ export declare type OnChangeSectionParams = {
4027
+ id: string;
4028
+ title: string;
4029
+ description?: string;
4030
+ questions?: QuestionElement[];
4031
+ };
4032
+
4033
+ export declare type OnDuplicateElementParams = {
4034
+ elementId: string;
4035
+ type: ElementType;
4036
+ };
4037
+
3888
4038
  export declare const OneAlert: ({ title, description, action, link, icon, variant, }: AlertProps) => JSX_2.Element;
3889
4039
 
3890
4040
  export declare const OneApprovalHistory: FC<OneApprovalHistoryProps>;
@@ -4607,6 +4757,28 @@ declare type Pulse = (typeof pulses)[number];
4607
4757
 
4608
4758
  declare const pulses: readonly ["superNegative", "negative", "neutral", "positive", "superPositive"];
4609
4759
 
4760
+ export declare type QuestionActionParams = {
4761
+ questionId: string;
4762
+ type: ActionType;
4763
+ index: number;
4764
+ };
4765
+
4766
+ export declare type QuestionElement = Omit<TextQuestionProps, QuestionPropsToOmit> | Omit<RatingQuestionProps & {
4767
+ type: "rating";
4768
+ }, QuestionPropsToOmit> | Omit<SelectQuestionProps & {
4769
+ type: "select" | "multi-select";
4770
+ }, QuestionPropsToOmit> | Omit<NumericQuestionProps & {
4771
+ type: "numeric";
4772
+ }, QuestionPropsToOmit> | Omit<LinkQuestionProps & {
4773
+ type: "link";
4774
+ }, QuestionPropsToOmit> | Omit<DateQuestionProps & {
4775
+ type: "date";
4776
+ }, QuestionPropsToOmit>;
4777
+
4778
+ declare type QuestionPropsToOmit = "onAction" | "onChange" | "onAddNewElement";
4779
+
4780
+ export declare type QuestionType = "rating" | "select" | "multi-select" | "text" | "longText" | "numeric" | "link" | "date";
4781
+
4610
4782
  /**
4611
4783
  * @experimental This is an experimental component use it at your own risk
4612
4784
  */
@@ -4624,6 +4796,15 @@ export declare type RadarChartProps<K extends ChartConfig> = {
4624
4796
 
4625
4797
  export declare const rangeSeparator = "\u2192";
4626
4798
 
4799
+ declare type RatingQuestionProps = BaseQuestionPropsForOtherQuestionComponents & {
4800
+ value?: number;
4801
+ } & {
4802
+ options: {
4803
+ value: number;
4804
+ label: string;
4805
+ }[];
4806
+ };
4807
+
4627
4808
  declare interface ReactionProps {
4628
4809
  emoji: string;
4629
4810
  initialCount: number;
@@ -4792,9 +4973,25 @@ export declare type secondaryActionType = (actionType | toggleActionType) & {
4792
4973
  type?: "button" | "switch";
4793
4974
  };
4794
4975
 
4976
+ export declare type SectionActionParams = {
4977
+ sectionId: string;
4978
+ type: ActionType;
4979
+ index: number;
4980
+ };
4981
+
4982
+ export declare type SectionElement = Omit<SectionProps, "onAction" | "onChange">;
4983
+
4795
4984
  export declare const SectionHeader: ({ title, description, action, link, separator, }: Props_2) => JSX_2.Element;
4796
4985
 
4797
4986
  declare type SectionProps = {
4987
+ id: string;
4988
+ title: string;
4989
+ description?: string;
4990
+ locked?: boolean;
4991
+ questions?: QuestionElement[];
4992
+ };
4993
+
4994
+ declare type SectionProps_2 = {
4798
4995
  title: string;
4799
4996
  items: Omit<ActivityItemProps, "onClick">[];
4800
4997
  onClickItem: (id: string) => void;
@@ -4888,6 +5085,23 @@ export declare type SelectProps<T extends string, R = unknown> = {
4888
5085
  options: SelectItemProps<T, unknown>[];
4889
5086
  }) & Pick<InputFieldProps<T>, "required" | "loading" | "hideLabel" | "clearable" | "labelIcon" | "size" | "label" | "icon" | "placeholder" | "disabled" | "name" | "error" | "status" | "hint">;
4890
5087
 
5088
+ export declare type SelectQuestionOption = {
5089
+ id?: string;
5090
+ value: string;
5091
+ label: string;
5092
+ correct?: boolean;
5093
+ };
5094
+
5095
+ declare type SelectQuestionProps = BaseQuestionPropsForOtherQuestionComponents & {
5096
+ options: SelectQuestionOption[];
5097
+ } & ({
5098
+ type: "select";
5099
+ value?: string | null;
5100
+ } | {
5101
+ type: "multi-select";
5102
+ value?: string[] | null;
5103
+ });
5104
+
4891
5105
  export declare const selectSizes: readonly ["sm", "md"];
4892
5106
 
4893
5107
  export declare function Shortcut({ keys, variant }: ShortcutProps): JSX_2.Element | null;
@@ -5319,7 +5533,7 @@ declare const TeamItem: ForwardRefExoticComponent<TeamItemProps & RefAttributes<
5319
5533
 
5320
5534
  declare type TeamItemProps = {
5321
5535
  name: string;
5322
- action?: ActionType;
5536
+ action?: ActionType_2;
5323
5537
  };
5324
5538
 
5325
5539
  export declare const Textarea: React.FC<TextareaProps>;
@@ -5330,6 +5544,11 @@ declare const Textarea_2: React_2.ForwardRefExoticComponent<Omit<React_2.Textare
5330
5544
 
5331
5545
  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
5546
 
5547
+ declare type TextQuestionProps = BaseQuestionPropsForOtherQuestionComponents & {
5548
+ type: "text" | "longText";
5549
+ value?: string | null;
5550
+ };
5551
+
5333
5552
  declare const THEMES: {
5334
5553
  readonly light: "";
5335
5554
  readonly dark: ".dark";
@@ -5963,6 +6182,11 @@ declare module "@tiptap/core" {
5963
6182
  }
5964
6183
 
5965
6184
 
6185
+ declare namespace Calendar {
6186
+ var displayName: string;
6187
+ }
6188
+
6189
+
5966
6190
  declare module "@tiptap/core" {
5967
6191
  interface Commands<ReturnType> {
5968
6192
  moodTracker: {
@@ -5970,8 +6194,3 @@ declare module "@tiptap/core" {
5970
6194
  };
5971
6195
  }
5972
6196
  }
5973
-
5974
-
5975
- declare namespace Calendar {
5976
- var displayName: string;
5977
- }