taskforge-forms 0.0.1

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 (96) hide show
  1. package/README.md +189 -0
  2. package/dist/excel/Options sheet.xlsx +0 -0
  3. package/dist/excel/list_sheet.xlsx +0 -0
  4. package/dist/excel/table_sheet.xlsx +0 -0
  5. package/dist/index.css +1 -0
  6. package/dist/place.png +0 -0
  7. package/dist/taskforge-forms.es.js +8253 -0
  8. package/dist/taskforge-forms.umd.js +60 -0
  9. package/dist/vite.svg +1 -0
  10. package/package.json +92 -0
  11. package/types/App.d.ts +3 -0
  12. package/types/assets/svgs/back.d.ts +1 -0
  13. package/types/assets/svgs/calendar.d.ts +1 -0
  14. package/types/assets/svgs/close.d.ts +1 -0
  15. package/types/components/ApiExample.d.ts +2 -0
  16. package/types/components/ColumnExample.d.ts +2 -0
  17. package/types/components/CustomSearchSelect.d.ts +14 -0
  18. package/types/components/CustomSelect.d.ts +23 -0
  19. package/types/components/CutomDatePicker.d.ts +16 -0
  20. package/types/components/DataTable/index.d.ts +22 -0
  21. package/types/components/DocumentSign.d.ts +2 -0
  22. package/types/components/FileReaderComponent.d.ts +8 -0
  23. package/types/components/ImageViewer.d.ts +4 -0
  24. package/types/components/Loader.d.ts +2 -0
  25. package/types/components/MultiSelectInput.d.ts +13 -0
  26. package/types/components/OptionsExample.d.ts +2 -0
  27. package/types/components/PhoneInput.d.ts +19 -0
  28. package/types/components/SearchSelect.d.ts +21 -0
  29. package/types/components/TableInputColumns.d.ts +1 -0
  30. package/types/components/TableInputElement.d.ts +6 -0
  31. package/types/components/UniversalFileViewer.d.ts +1 -0
  32. package/types/components/ValidateExample.d.ts +2 -0
  33. package/types/components/editor/bottom-bar.d.ts +5 -0
  34. package/types/components/editor/element-canvas.d.ts +17 -0
  35. package/types/components/editor/element-render.d.ts +3 -0
  36. package/types/components/editor/form-preview.d.ts +4 -0
  37. package/types/components/editor/index.d.ts +2 -0
  38. package/types/components/editor/layout.d.ts +16 -0
  39. package/types/components/editor/main.d.ts +5 -0
  40. package/types/components/editor/preview-modal.d.ts +9 -0
  41. package/types/components/editor/sidebar.d.ts +2 -0
  42. package/types/components/editor/topbar.d.ts +10 -0
  43. package/types/components/elements/amount-input.d.ts +4 -0
  44. package/types/components/elements/basic-text.d.ts +4 -0
  45. package/types/components/elements/cascade-dropdown.d.ts +25 -0
  46. package/types/components/elements/checkbox-input.d.ts +4 -0
  47. package/types/components/elements/country-bank.d.ts +6 -0
  48. package/types/components/elements/data-grid.d.ts +4 -0
  49. package/types/components/elements/date-input.d.ts +4 -0
  50. package/types/components/elements/divider.d.ts +3 -0
  51. package/types/components/elements/document-sign.d.ts +17 -0
  52. package/types/components/elements/element-container.d.ts +13 -0
  53. package/types/components/elements/element-editor.d.ts +8 -0
  54. package/types/components/elements/email-input.d.ts +4 -0
  55. package/types/components/elements/file-input.d.ts +4 -0
  56. package/types/components/elements/grid-input.d.ts +20 -0
  57. package/types/components/elements/header.d.ts +4 -0
  58. package/types/components/elements/link-element.d.ts +5 -0
  59. package/types/components/elements/long-text.d.ts +4 -0
  60. package/types/components/elements/matrix-input.d.ts +4 -0
  61. package/types/components/elements/multi-input-options.d.ts +13 -0
  62. package/types/components/elements/multi-input.d.ts +15 -0
  63. package/types/components/elements/multi-select-input.d.ts +5 -0
  64. package/types/components/elements/password-input.d.ts +4 -0
  65. package/types/components/elements/phone-input.d.ts +4 -0
  66. package/types/components/elements/radio-input.d.ts +4 -0
  67. package/types/components/elements/rating-input.d.ts +13 -0
  68. package/types/components/elements/section-editor.d.ts +7 -0
  69. package/types/components/elements/section-input.d.ts +4 -0
  70. package/types/components/elements/select-input.d.ts +4 -0
  71. package/types/components/elements/spacer.d.ts +3 -0
  72. package/types/components/elements/table-input.d.ts +4 -0
  73. package/types/components/elements/text-input.d.ts +5 -0
  74. package/types/components/elements/validate-input.d.ts +4 -0
  75. package/types/components/elements/visibility-editor.d.ts +1 -0
  76. package/types/components/forms/dynamic-input.d.ts +24 -0
  77. package/types/components/forms/file-uploader.d.ts +18 -0
  78. package/types/components/ui/AppButton.d.ts +18 -0
  79. package/types/components/ui/AppIcon.d.ts +5 -0
  80. package/types/components/ui/AppTab.d.ts +17 -0
  81. package/types/components/viewer/elements-render.d.ts +4 -0
  82. package/types/components/viewer/index.d.ts +21 -0
  83. package/types/components/viewer/multi-page.d.ts +5 -0
  84. package/types/components/viewer/single-page.d.ts +5 -0
  85. package/types/components/viewer/validation.d.ts +25 -0
  86. package/types/context/editor-context.d.ts +38 -0
  87. package/types/index.d.ts +3 -0
  88. package/types/main.d.ts +1 -0
  89. package/types/pages/builder/index.d.ts +3 -0
  90. package/types/pages/viewer/index.d.ts +16 -0
  91. package/types/utils/contants.d.ts +123 -0
  92. package/types/utils/getAllQuestions.d.ts +8 -0
  93. package/types/utils/isValidImage.d.ts +1 -0
  94. package/types/utils/localStorageControl.d.ts +4 -0
  95. package/types/utils/mapIdToValue.d.ts +1 -0
  96. package/types/utils/normalizeRows.d.ts +4 -0
@@ -0,0 +1,13 @@
1
+ import React from "react";
2
+ interface RatingProps {
3
+ value?: number;
4
+ max?: number;
5
+ readOnly?: boolean;
6
+ onChange?: (rating: number) => void;
7
+ size?: number;
8
+ className?: string;
9
+ element: any;
10
+ validationData: any;
11
+ }
12
+ declare const Rating: React.FC<RatingProps>;
13
+ export default Rating;
@@ -0,0 +1,7 @@
1
+ import React from "react";
2
+ declare const SectionEditorModal: React.FC<{
3
+ isOpen: boolean;
4
+ onClose: () => void;
5
+ section: any;
6
+ }>;
7
+ export default SectionEditorModal;
@@ -0,0 +1,4 @@
1
+ export default function SectionInput({ element, state, }: {
2
+ element: string;
3
+ state: string;
4
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,4 @@
1
+ export default function SelectInput({ element, validationData, }: {
2
+ element: any;
3
+ validationData?: any;
4
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,3 @@
1
+ export default function Spacer({ element }: {
2
+ element: any;
3
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,4 @@
1
+ export default function TableInput({ element, validationData, }: {
2
+ element: any;
3
+ validationData: any;
4
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,5 @@
1
+ export default function TextInput({ element, validationData, }: {
2
+ element: any;
3
+ validationData: any;
4
+ state?: string;
5
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,4 @@
1
+ export default function ValidateInput({ element, validationData, }: {
2
+ element: any;
3
+ validationData: any;
4
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1 @@
1
+ export default function VisibilityEditor({ register, setValue, trigger, watch, id, }: any): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,24 @@
1
+ import { UseFormRegister, FieldErrors } from "react-hook-form";
2
+ interface InputProps {
3
+ label: string;
4
+ name: string;
5
+ register?: UseFormRegister<any>;
6
+ errors?: FieldErrors;
7
+ element?: any;
8
+ type?: "text" | "checkbox" | "number" | "amount" | "textarea";
9
+ placeholder?: string;
10
+ className?: string;
11
+ isFloating?: boolean;
12
+ setValue?: any;
13
+ value?: any;
14
+ trigger?: any;
15
+ prefix?: string;
16
+ disabled?: boolean;
17
+ watch?: any;
18
+ min?: number;
19
+ max?: number;
20
+ description?: string;
21
+ onChange?: (e: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
22
+ }
23
+ export declare const DynamicInput: ({ label, name, register, errors, className, type, placeholder, isFloating, setValue, value, trigger, prefix, disabled, watch, min, max, description, onChange, }: InputProps) => import("react/jsx-runtime").JSX.Element;
24
+ export {};
@@ -0,0 +1,18 @@
1
+ type FileItem = {
2
+ base64: string;
3
+ type: string;
4
+ name: string;
5
+ };
6
+ interface FileUploadProps {
7
+ onFileLoaded: (data: FileItem[] | null) => void;
8
+ disabled?: boolean;
9
+ handleDeleteFile?: () => void;
10
+ multiple?: boolean;
11
+ list?: FileItem[] | null;
12
+ accept?: {
13
+ value: string;
14
+ label: string;
15
+ }[];
16
+ }
17
+ export default function FileUpload({ onFileLoaded, disabled, handleDeleteFile, multiple, list, accept, }: FileUploadProps): import("react/jsx-runtime").JSX.Element;
18
+ export {};
@@ -0,0 +1,18 @@
1
+ import React from "react";
2
+ interface ButtonProps {
3
+ text?: string;
4
+ isDisabled?: boolean;
5
+ isLoading?: boolean;
6
+ btnClass?: string;
7
+ icon?: string;
8
+ iconPosition?: "left" | "right";
9
+ iconClass?: string;
10
+ loadingClass?: string;
11
+ link?: string;
12
+ div?: boolean;
13
+ type?: "button" | "submit" | "reset";
14
+ onClick?: () => void;
15
+ style?: React.CSSProperties;
16
+ }
17
+ declare const Button: React.FC<ButtonProps>;
18
+ export default Button;
@@ -0,0 +1,5 @@
1
+ import { IconifyIcon } from "@iconify/react";
2
+ export default function AppIcon({ icon, iconClass, }: {
3
+ icon: string | IconifyIcon;
4
+ iconClass?: string;
5
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,17 @@
1
+ import { FC } from "react";
2
+ interface Tab {
3
+ key: string;
4
+ title: string;
5
+ }
6
+ interface TabsComponentProps {
7
+ tabs: Tab[];
8
+ className?: string;
9
+ count?: {
10
+ [key: string]: number;
11
+ };
12
+ setActiveTab: (key: string) => void;
13
+ activeTab: string;
14
+ btnClass?: string;
15
+ }
16
+ declare const TabsComponent: FC<TabsComponentProps>;
17
+ export default TabsComponent;
@@ -0,0 +1,4 @@
1
+ export declare const RenderElement: ({ element, validationData }: {
2
+ element: any;
3
+ validationData?: any;
4
+ }) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,21 @@
1
+ import React, { ReactNode } from "react";
2
+ export interface AnswerElement {
3
+ id: string;
4
+ value: any;
5
+ [key: string]: any;
6
+ }
7
+ export type RenderType = "multi" | "single";
8
+ export interface FormRendererProps {
9
+ form_data: any[];
10
+ answerData?: any[];
11
+ ignoreValidation?: boolean;
12
+ onSubmitData?: (data: any[]) => void;
13
+ onGetValues?: (data: any[]) => void;
14
+ isReadOnly?: boolean;
15
+ renderType?: RenderType;
16
+ children?: ReactNode;
17
+ hideFooter?: boolean;
18
+ uploadUrl?: string;
19
+ }
20
+ declare const _default: React.NamedExoticComponent<FormRendererProps>;
21
+ export default _default;
@@ -0,0 +1,5 @@
1
+ export default function MultiPage({ form_data, options, current }: {
2
+ form_data: any;
3
+ options: any;
4
+ current: any;
5
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,5 @@
1
+ export declare const getElementOptions: (element: any, options: any) => any;
2
+ export default function SinglePage({ form_data, options }: {
3
+ form_data: any;
4
+ options: any;
5
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,25 @@
1
+ import * as yup from "yup";
2
+ interface QuestionData {
3
+ id: string;
4
+ type: "textField" | "longText" | "numberField" | "amountField" | "selectField" | "checkbox" | "email" | "date" | "matrix" | "url";
5
+ isRequired?: boolean;
6
+ requiredMessage?: string;
7
+ minLength?: number;
8
+ maxLength?: number;
9
+ minAmount?: number;
10
+ maxAmount?: number;
11
+ minLengthMessage?: string;
12
+ maxLengthMessage?: string;
13
+ minAmountMessage?: string;
14
+ maxAmountMessage?: string;
15
+ isDisabled?: boolean;
16
+ }
17
+ interface Section {
18
+ questionData: QuestionData[];
19
+ }
20
+ export declare function generateDynamicSchema(data: Section[]): yup.ObjectSchema<{
21
+ [x: string]: any;
22
+ }, yup.AnyObject, {
23
+ [x: string]: any;
24
+ }, "">;
25
+ export {};
@@ -0,0 +1,38 @@
1
+ import React from "react";
2
+ interface EditorProviderProps {
3
+ children: React.ReactNode;
4
+ }
5
+ declare const EditorContext: React.Context<{
6
+ showPreview: boolean;
7
+ setShowPreview: React.Dispatch<React.SetStateAction<boolean>>;
8
+ formData: any;
9
+ setFormData: React.Dispatch<React.SetStateAction<any>>;
10
+ handleDragStop: (e: any, elementId: string) => void;
11
+ removeElement: (elementId: string, sectionId: string) => void;
12
+ updateElementPosition: (updatedFormData: any[], sectionId: string) => void;
13
+ addElement: (element: any, sectionId: string) => void;
14
+ addElementInPosition: (element: any, sectionId: string, index: any) => void;
15
+ updateElement: (value: any, sectionId: string) => void;
16
+ updateSection: (value: any, sectionId: string) => void;
17
+ setIsDragging: (value: boolean) => void;
18
+ isDragging: boolean;
19
+ uploadUrl: string;
20
+ setUploadUrl: (e: string) => void;
21
+ /**
22
+ * Universal element move:
23
+ * - canvas → canvas (reorder by index)
24
+ * - grid → canvas (eject; targetIndex = insertion point)
25
+ * - canvas → grid (inject into col; targetGridId + targetCol required)
26
+ * - grid → grid (transfer between cells)
27
+ */
28
+ moveElement: (opts: {
29
+ draggedId: string;
30
+ sectionId: string;
31
+ targetIndex?: number;
32
+ targetId?: string;
33
+ targetGridId?: string;
34
+ targetCol?: number;
35
+ }) => void;
36
+ }>;
37
+ export declare const EditorProvider: React.FC<EditorProviderProps>;
38
+ export default EditorContext;
@@ -0,0 +1,3 @@
1
+ import './index.css';
2
+ export { default as FormBuilder } from "./pages/builder";
3
+ export { default as FormViewer } from "./pages/viewer";
@@ -0,0 +1 @@
1
+ import "./index.css";
@@ -0,0 +1,3 @@
1
+ import { BuilderProps } from "../../components/editor/layout";
2
+ declare const HomePage: ({ onSubmit, questionData, isReadOnly, config, title, loading, goBackUrl, onPublish, previewLoading, saveLoading, publishLoading, onTitleChange, uploadUrl, }: BuilderProps) => import("react/jsx-runtime").JSX.Element;
3
+ export default HomePage;
@@ -0,0 +1,16 @@
1
+ import { ReactNode } from "react";
2
+ export interface RenderProps {
3
+ onSubmit?: (e: any) => void;
4
+ answerData?: any;
5
+ isReadOnly?: boolean;
6
+ form_data?: any;
7
+ ignoreValidation?: boolean;
8
+ loading?: boolean;
9
+ config?: any;
10
+ renderType?: "multi" | "single";
11
+ children?: ReactNode;
12
+ hideFooter?: boolean;
13
+ onGetValues?: (e: any) => void;
14
+ uploadUrl?: string;
15
+ }
16
+ export default function Viewer({ answerData, form_data, ignoreValidation, onSubmit, isReadOnly, loading, config, renderType, children, hideFooter, onGetValues, uploadUrl, }: RenderProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,123 @@
1
+ export declare enum ElementKind {
2
+ BASIC_TEXT = "basicText",
3
+ TEXT = "textField",
4
+ LONG_TEXT = "longText",
5
+ SELECT = "selectField",
6
+ CASCADE_SELECT = "cascadeSelect",
7
+ MULTI_SELECT = "multiSelect",
8
+ VALIDATE_INPUT = "validateInput",
9
+ NUMBER = "numberField",
10
+ AMOUNT = "amountField",
11
+ DATE = "date",
12
+ URL = "url",
13
+ PASSWORD = "password",
14
+ CHECKBOX = "checkbox",
15
+ PHONE = "phoneField",
16
+ RADIO = "radio",
17
+ EMAIL = "email",
18
+ FILE = "file",
19
+ COUNTRY = "country",
20
+ RATING = "rating",
21
+ DATA_GRID = "dataGrid",
22
+ TABLE_INPUT = "tableInput",
23
+ DIVIDER = "divider",
24
+ SPACER = "spacer",
25
+ SECTION = "section",
26
+ GRID = "grid",
27
+ MATRIX = "matrix"
28
+ }
29
+ export interface DataColumnType {
30
+ field: string;
31
+ headerName: string;
32
+ width?: number;
33
+ editable?: boolean;
34
+ type?: string;
35
+ validate?: boolean;
36
+ id: string;
37
+ }
38
+ export interface OptionType {
39
+ label: string;
40
+ value: any;
41
+ id: string;
42
+ key?: string;
43
+ }
44
+ export interface ElementType {
45
+ type: ElementKind;
46
+ label: string;
47
+ icon: string;
48
+ inputLabel: string;
49
+ inputType: string;
50
+ required?: boolean;
51
+ placeholder?: string;
52
+ description?: string;
53
+ value?: any;
54
+ maxLength?: number | null;
55
+ minLength?: number | null;
56
+ maxAmount?: number | null;
57
+ minAmount?: number | null;
58
+ isReadOnly?: boolean;
59
+ isDisabled?: boolean;
60
+ isRequired?: boolean;
61
+ requiredMessage?: string;
62
+ minLengthMessage?: string;
63
+ maxLengthMessage?: string;
64
+ minAmountMessage?: string;
65
+ maxAmountMessage?: string;
66
+ options?: OptionType[];
67
+ options1?: OptionType[];
68
+ options2?: OptionType[];
69
+ columns?: number;
70
+ dataColumns?: DataColumnType[];
71
+ prefix?: string | null;
72
+ inputMode?: string;
73
+ pattern?: string;
74
+ selectType?: string;
75
+ dateType?: string;
76
+ dateFormat?: string;
77
+ minDate?: string | null;
78
+ maxDate?: string | null;
79
+ canHaveDateRange?: boolean;
80
+ allowYearPicker?: boolean;
81
+ url?: string;
82
+ method?: string;
83
+ responseType?: string;
84
+ customClass?: string | null;
85
+ elementClass?: string;
86
+ gridPosition?: any;
87
+ gridId?: string | null;
88
+ isHidden: boolean;
89
+ visibilityDependentFields?: string;
90
+ visibilityDependentFieldsValue?: any;
91
+ isMultiple: boolean;
92
+ acceptedFiles: any[];
93
+ showState?: boolean;
94
+ }
95
+ export declare const countryOptions: OptionType[];
96
+ export declare const Elements: ElementType[];
97
+ export declare const CategorizedElements: Readonly<{
98
+ textFields: ElementKind[];
99
+ selectionFields: ElementKind[];
100
+ dateAndTime: ElementKind[];
101
+ fileAndMedia: ElementKind[];
102
+ layoutAndDisplay: ElementKind[];
103
+ advancedData: ElementKind[];
104
+ }>;
105
+ export declare const dateFormats: {
106
+ label: string;
107
+ value: string;
108
+ }[];
109
+ export declare const AllowValidationPrefix: string[];
110
+ export declare const AllowValidationMaxMin: string[];
111
+ export declare const AllowValidationPlaceholder: string[];
112
+ export declare const AllowValidationAmount: string[];
113
+ export declare const noAllowValidation: string[];
114
+ export declare const AllowOptions: string[];
115
+ export declare const AllowApiOptions: string[];
116
+ export declare const AllowTableOptions: string[];
117
+ export declare const AllowTextOptions: string[];
118
+ export declare const noAllowEdit: string[];
119
+ export declare const allowValue: string[];
120
+ export declare const FileTypes: {
121
+ value: string;
122
+ label: string;
123
+ }[];
@@ -0,0 +1,8 @@
1
+ type Section = {
2
+ id: string;
3
+ title: string;
4
+ description: string;
5
+ questionData?: any[];
6
+ };
7
+ export declare function getAllQuestionData(sections: Section[]): any[];
8
+ export {};
@@ -0,0 +1 @@
1
+ export declare function isValidImage(value: any): boolean;
@@ -0,0 +1,4 @@
1
+ declare const getItem: (key: any) => any;
2
+ declare const setItem: (key: any, value: any) => void;
3
+ declare const removeItem: (key: any) => void;
4
+ export { getItem, setItem, removeItem };
@@ -0,0 +1 @@
1
+ export declare function mapIdToValue(answerData: any): any;
@@ -0,0 +1,4 @@
1
+ export declare const slugify: (text: string) => string;
2
+ /** Ensure every row has a `value` — derive from `label` if missing or empty. */
3
+ export declare const normalizeRows: (rows: any[]) => any[];
4
+ export declare const normalizeGridRows: (rows: any[]) => any[];