@bigbinary/neeto-form-frontend 1.0.3 → 1.0.5

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/index.js +442 -950
  2. package/index.d.ts +81 -0
  3. package/package.json +4 -2
package/index.d.ts ADDED
@@ -0,0 +1,81 @@
1
+ import { ButtonProps, TypographyProps } from "@bigbinary/neetoui";
2
+ import React, { FormHTMLAttributes, HTMLAttributes } from "react";
3
+
4
+ interface BuildFormProps {
5
+ id: string;
6
+ onUpdate?: (data: any) => void;
7
+ buildRequestArgs?: any;
8
+ showAddQuestionDivider?: boolean;
9
+ nonRemovableFields?: string[];
10
+ requiredFields?: string[];
11
+ formDomProps?: FormHTMLAttributes<HTMLFormElement>;
12
+ showActionBlock?: boolean;
13
+ submitButtonProps?: HTMLAttributes<HTMLButtonElement>;
14
+ cancelButtonProps?: HTMLAttributes<HTMLButtonElement>;
15
+ }
16
+
17
+ interface ExternalFormProps {
18
+ preview?: boolean;
19
+ formId: string;
20
+ submissionId: string;
21
+ customSubmitHandler?: (data: any) => void;
22
+ onBeforeSubmit?: (data: any) => void;
23
+ onSubmitSuccess?: (data: any) => void;
24
+ showTitle?: boolean;
25
+ formTitle?: string;
26
+ titleProps?: TypographyProps;
27
+ submitRequestArgs?: any;
28
+ footer?: React.ReactNode;
29
+ submitButtonProps?: ButtonProps;
30
+ cancelButtonProps?: ButtonProps;
31
+ resetButtonProps?: ButtonProps;
32
+ showPrefixIcons?: boolean;
33
+ displayThankYou?: boolean;
34
+ showSuccessToastr?: boolean;
35
+ showEmptyState?: boolean;
36
+ className?: string;
37
+ preserveValues?: boolean;
38
+ clearValuesOnReset?: boolean;
39
+ clearValuesOnSubmit?: boolean;
40
+ formDomProps?: FormHTMLAttributes<HTMLFormElement>;
41
+ }
42
+
43
+ interface SubmissionProps {
44
+ formId: string;
45
+ submissionId: string;
46
+ className?: string;
47
+ questionLabelProps?: TypographyProps;
48
+ answerProps?: TypographyProps;
49
+ }
50
+
51
+ interface IBuildFormState {
52
+ values: any;
53
+ dirty: boolean;
54
+ isSubmitting: boolean;
55
+ isValid: boolean;
56
+ errors: { [key: string]: string }[];
57
+ submitForm: () => void;
58
+ resetForm: () => void;
59
+ }
60
+
61
+ interface ISubmission {
62
+ responses: {
63
+ label: string;
64
+ value: string;
65
+ kind: string;
66
+ }[];
67
+ }
68
+
69
+ export const BuildForm: React.FC<BuildFormProps>;
70
+ export const ExternalForm: React.FC<ExternalFormProps>;
71
+ export const Submission: React.FC<SubmissionProps>;
72
+ export const NeetoFormProvider: React.FC;
73
+
74
+ export const useBuildFormState: () => IBuildFormState;
75
+ export const useFormSubmission: (args: {
76
+ formId: string;
77
+ submissionId: string;
78
+ }) => {
79
+ submission: ISubmission;
80
+ isLoading: boolean;
81
+ };
package/package.json CHANGED
@@ -1,12 +1,13 @@
1
1
  {
2
2
  "name": "@bigbinary/neeto-form-frontend",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
4
4
  "description": "Neeto Form Engine Frontend",
5
5
  "author": "BigBinary",
6
6
  "license": "MIT",
7
7
  "repository": "https://github.com/bigbinary/neeto-form-frontend",
8
8
  "main": "dist/index.js",
9
9
  "module": "dist/index.js",
10
+ "types": "./index.d.ts",
10
11
  "engines": {
11
12
  "node": ">=10"
12
13
  },
@@ -109,6 +110,7 @@
109
110
  "yup": "^1.0.0"
110
111
  },
111
112
  "files": [
112
- "dist"
113
+ "dist",
114
+ "index.d.ts"
113
115
  ]
114
116
  }