@newtonschool/grauity 2.1.2-beta.2 → 2.1.2-beta.3
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.
- package/dist/index.d.ts +93 -19
- package/dist/index.d.ts.map +1 -1
- package/dist/main.cjs +1 -1
- package/dist/main.cjs.map +1 -1
- package/dist/module.mjs +1 -1
- package/dist/module.mjs.map +1 -1
- package/dist/ui/elements/Form/Checkbox/Checkbox.styles.d.ts.map +1 -1
- package/dist/ui/elements/Form/Dropdown/Dropdown.d.ts.map +1 -1
- package/dist/ui/elements/Form/Dropdown/DropdownTrigger.d.ts.map +1 -1
- package/dist/ui/elements/Form/Dropdown/types.d.ts +4 -0
- package/dist/ui/elements/Form/Dropdown/types.d.ts.map +1 -1
- package/dist/ui/elements/Form/useForm/FormField.d.ts.map +1 -0
- package/dist/ui/elements/Form/useForm/FormFieldWrappers/CheckboxWrapper.d.ts.map +1 -0
- package/dist/ui/elements/Form/useForm/FormFieldWrappers/DropdownMenuWrapper.d.ts.map +1 -0
- package/dist/ui/elements/Form/useForm/FormFieldWrappers/DropdownWrapper.d.ts.map +1 -0
- package/dist/ui/elements/Form/useForm/FormFieldWrappers/TextFieldWrapper.d.ts.map +1 -0
- package/dist/ui/elements/Form/useForm/FormRenderer.d.ts.map +1 -0
- package/dist/ui/elements/Form/useForm/index.d.ts +3 -0
- package/dist/ui/elements/Form/useForm/index.d.ts.map +1 -0
- package/dist/ui/elements/Form/useForm/types.d.ts +229 -0
- package/dist/ui/elements/Form/useForm/types.d.ts.map +1 -0
- package/dist/ui/elements/Form/useForm/useForm.d.ts +4 -0
- package/dist/ui/elements/Form/useForm/useForm.d.ts.map +1 -0
- package/dist/ui/elements/Form/{FormRenderer → useForm}/utils.d.ts +1 -1
- package/dist/ui/elements/Form/useForm/utils.d.ts.map +1 -0
- package/dist/ui/index.d.ts +1 -1
- package/dist/ui/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/ui/elements/Form/FormRenderer/FormField.d.ts.map +0 -1
- package/dist/ui/elements/Form/FormRenderer/FormFieldWrappers/CheckboxWrapper.d.ts.map +0 -1
- package/dist/ui/elements/Form/FormRenderer/FormFieldWrappers/DropdownMenuWrapper.d.ts.map +0 -1
- package/dist/ui/elements/Form/FormRenderer/FormFieldWrappers/DropdownWrapper.d.ts.map +0 -1
- package/dist/ui/elements/Form/FormRenderer/FormFieldWrappers/TextFieldWrapper.d.ts.map +0 -1
- package/dist/ui/elements/Form/FormRenderer/FormRenderer.d.ts.map +0 -1
- package/dist/ui/elements/Form/FormRenderer/index.d.ts +0 -3
- package/dist/ui/elements/Form/FormRenderer/index.d.ts.map +0 -1
- package/dist/ui/elements/Form/FormRenderer/types.d.ts +0 -152
- package/dist/ui/elements/Form/FormRenderer/types.d.ts.map +0 -1
- package/dist/ui/elements/Form/FormRenderer/useFormHook.d.ts +0 -4
- package/dist/ui/elements/Form/FormRenderer/useFormHook.d.ts.map +0 -1
- package/dist/ui/elements/Form/FormRenderer/utils.d.ts.map +0 -1
- /package/dist/ui/elements/Form/{FormRenderer → useForm}/FormField.d.ts +0 -0
- /package/dist/ui/elements/Form/{FormRenderer → useForm}/FormFieldWrappers/CheckboxWrapper.d.ts +0 -0
- /package/dist/ui/elements/Form/{FormRenderer → useForm}/FormFieldWrappers/DropdownMenuWrapper.d.ts +0 -0
- /package/dist/ui/elements/Form/{FormRenderer → useForm}/FormFieldWrappers/DropdownWrapper.d.ts +0 -0
- /package/dist/ui/elements/Form/{FormRenderer → useForm}/FormFieldWrappers/TextFieldWrapper.d.ts +0 -0
- /package/dist/ui/elements/Form/{FormRenderer → useForm}/FormRenderer.d.ts +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Checkbox.styles.d.ts","sourceRoot":"","sources":["../../../../../ui/elements/Form/Checkbox/Checkbox.styles.ts"],"names":[],"mappings":";AAGA,OAAO,EAAE,cAAc,EAAoB,MAAM,0BAA0B,CAAC;AAE5E,OAAO,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAC;AAEnD,eAAO,MAAM,yBAAyB,
|
|
1
|
+
{"version":3,"file":"Checkbox.styles.d.ts","sourceRoot":"","sources":["../../../../../ui/elements/Form/Checkbox/Checkbox.styles.ts"],"names":[],"mappings":";AAGA,OAAO,EAAE,cAAc,EAAoB,MAAM,0BAA0B,CAAC;AAE5E,OAAO,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAC;AAEnD,eAAO,MAAM,yBAAyB,mPAKrC,CAAC;AAEF,eAAO,MAAM,cAAc,mPAO1B,CAAC;AAEF,eAAO,MAAM,oBAAoB,yQA6JhC,CAAC;AAEF,eAAO,MAAM,mBAAmB,sQAa/B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dropdown.d.ts","sourceRoot":"","sources":["../../../../../ui/elements/Form/Dropdown/Dropdown.tsx"],"names":[],"mappings":"AAQA,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAGxC,QAAA,MAAM,QAAQ,UAAW,aAAa,
|
|
1
|
+
{"version":3,"file":"Dropdown.d.ts","sourceRoot":"","sources":["../../../../../ui/elements/Form/Dropdown/Dropdown.tsx"],"names":[],"mappings":"AAQA,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAGxC,QAAA,MAAM,QAAQ,UAAW,aAAa,gBA4DrC,CAAC;AAEF,eAAe,QAAQ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DropdownTrigger.d.ts","sourceRoot":"","sources":["../../../../../ui/elements/Form/Dropdown/DropdownTrigger.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqB,MAAM,OAAO,CAAC;AAO1C,OAAO,EAAE,4BAA4B,EAAE,MAAM,SAAS,CAAC;AAEvD,QAAA,MAAM,eAAe,
|
|
1
|
+
{"version":3,"file":"DropdownTrigger.d.ts","sourceRoot":"","sources":["../../../../../ui/elements/Form/Dropdown/DropdownTrigger.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqB,MAAM,OAAO,CAAC;AAO1C,OAAO,EAAE,4BAA4B,EAAE,MAAM,SAAS,CAAC;AAEvD,QAAA,MAAM,eAAe,qGAwCnB,CAAC;AAEH,eAAe,eAAe,CAAC"}
|
|
@@ -33,6 +33,10 @@ export interface DropdownTriggerProps {
|
|
|
33
33
|
* The error message to display when the dropdown field is invalid
|
|
34
34
|
*/
|
|
35
35
|
errorMessage?: string;
|
|
36
|
+
/**
|
|
37
|
+
* The function to call when the dropdown menu is closed
|
|
38
|
+
*/
|
|
39
|
+
onClose?: () => void;
|
|
36
40
|
}
|
|
37
41
|
export interface DropdownTriggerInternalProps extends DropdownTriggerProps {
|
|
38
42
|
onTriggerClick: () => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../ui/elements/Form/Dropdown/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAEvD,MAAM,WAAW,oBAAoB;IACjC;;;OAGG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB;;;;QAII;IACJ,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../ui/elements/Form/Dropdown/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAEvD,MAAM,WAAW,oBAAoB;IACjC;;;OAGG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB;;;;QAII;IACJ,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACxB;AAED,MAAM,WAAW,4BAA6B,SAAQ,oBAAoB;IACtE,cAAc,EAAE,MAAM,IAAI,CAAC;CAC9B;AAED,MAAM,WAAW,aAAc,SAAQ,oBAAoB,EAAE,iBAAiB;IAC1E;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormField.d.ts","sourceRoot":"","sources":["../../../../../ui/elements/Form/useForm/FormField.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqB,MAAM,OAAO,CAAC;AAO1C,OAAO,EAAE,cAAc,EAAiB,MAAM,SAAS,CAAC;AAExD,QAAA,MAAM,SAAS,uFAgCb,CAAC;AAEH,eAAe,SAAS,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CheckboxWrapper.d.ts","sourceRoot":"","sources":["../../../../../../ui/elements/Form/useForm/FormFieldWrappers/CheckboxWrapper.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,EAAsB,MAAM,UAAU,CAAC;AAG9D,QAAA,MAAM,eAAe,UAAW,cAAc,gBA2D7C,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DropdownMenuWrapper.d.ts","sourceRoot":"","sources":["../../../../../../ui/elements/Form/useForm/FormFieldWrappers/DropdownMenuWrapper.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAsB,MAAM,UAAU,CAAC;AAG9D,QAAA,MAAM,mBAAmB,UAAW,cAAc,gBAgEjD,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DropdownWrapper.d.ts","sourceRoot":"","sources":["../../../../../../ui/elements/Form/useForm/FormFieldWrappers/DropdownWrapper.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAsB,MAAM,UAAU,CAAC;AAG9D,QAAA,MAAM,eAAe,UAAW,cAAc,gBA4F7C,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextFieldWrapper.d.ts","sourceRoot":"","sources":["../../../../../../ui/elements/Form/useForm/FormFieldWrappers/TextFieldWrapper.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,EAAsB,MAAM,UAAU,CAAC;AAG9D,QAAA,MAAM,gBAAgB,UAAW,cAAc,gBAuD9C,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormRenderer.d.ts","sourceRoot":"","sources":["../../../../../ui/elements/Form/useForm/FormRenderer.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAG5C,QAAA,MAAM,YAAY,UAAW,iBAAiB,gBAwF7C,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { type ConditionalProp, type FieldName, type FormConfig, type FormErrors, type FormField, type FormFieldBaseProps, type FormFieldCheckboxProps, type FormFieldCustomProps, type FormFieldDatePickerProps, type FormFieldDropdownMenuProps, type FormFieldDropdownProps, type FormFieldIconButtonProps, type FormFields, type FormFieldTextFieldProps, FormFieldType, type FormRow, FormRowColumnCondition, type FormState, FormValidationType, type UseFormProps, type UseFormReturnProps, } from './types';
|
|
2
|
+
export { default as useForm } from './useForm';
|
|
3
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../ui/elements/Form/useForm/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EACH,KAAK,eAAe,EACpB,KAAK,SAAS,EACd,KAAK,UAAU,EACf,KAAK,UAAU,EACf,KAAK,SAAS,EACd,KAAK,kBAAkB,EACvB,KAAK,sBAAsB,EAC3B,KAAK,oBAAoB,EACzB,KAAK,wBAAwB,EAC7B,KAAK,0BAA0B,EAC/B,KAAK,sBAAsB,EAC3B,KAAK,wBAAwB,EAC7B,KAAK,UAAU,EACf,KAAK,uBAAuB,EAC5B,aAAa,EACb,KAAK,OAAO,EACZ,sBAAsB,EACtB,KAAK,SAAS,EACd,kBAAkB,EAClB,KAAK,YAAY,EACjB,KAAK,kBAAkB,GAC1B,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,WAAW,CAAC"}
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Schema } from 'yup';
|
|
3
|
+
import { ButtonProps, IconButtonProps } from '../../Button';
|
|
4
|
+
import { CheckboxProps } from '../Checkbox';
|
|
5
|
+
import { DropdownProps } from '../Dropdown';
|
|
6
|
+
import { TextFieldProps } from '../TextField';
|
|
7
|
+
export type FieldName = string;
|
|
8
|
+
export interface FormState {
|
|
9
|
+
[key: FieldName]: any;
|
|
10
|
+
}
|
|
11
|
+
export interface FormErrors {
|
|
12
|
+
[key: FieldName]: string;
|
|
13
|
+
}
|
|
14
|
+
export declare enum FormFieldType {
|
|
15
|
+
TEXTFIELD = "TEXTFIELD",
|
|
16
|
+
DATE_PICKER = "DATE_PICKER",
|
|
17
|
+
DROPDOWN = "DROPDOWN",
|
|
18
|
+
DROPDOWN_MENU = "DROPDOWN_MENU",
|
|
19
|
+
ICON_BUTTON = "ICON_BUTTON",
|
|
20
|
+
CHECKBOX = "CHECKBOX",
|
|
21
|
+
CUSTOM = "CUSTOM"
|
|
22
|
+
}
|
|
23
|
+
export interface ConditionalProp {
|
|
24
|
+
propName: string;
|
|
25
|
+
propValue: any;
|
|
26
|
+
conditions: Array<{
|
|
27
|
+
prop: string;
|
|
28
|
+
value: any;
|
|
29
|
+
}>;
|
|
30
|
+
}
|
|
31
|
+
export interface FormFieldBaseProps {
|
|
32
|
+
type: FormFieldType;
|
|
33
|
+
renderer?: (props: FormFieldProps) => React.ReactNode;
|
|
34
|
+
rendererProps?: any;
|
|
35
|
+
conditionalProps?: ConditionalProp[];
|
|
36
|
+
configProps?: any;
|
|
37
|
+
}
|
|
38
|
+
export interface FormFieldTextFieldProps extends FormFieldBaseProps {
|
|
39
|
+
type: FormFieldType.TEXTFIELD;
|
|
40
|
+
rendererProps: TextFieldProps;
|
|
41
|
+
}
|
|
42
|
+
export interface FormFieldDatePickerProps extends FormFieldBaseProps {
|
|
43
|
+
type: FormFieldType.DATE_PICKER;
|
|
44
|
+
rendererProps: TextFieldProps;
|
|
45
|
+
}
|
|
46
|
+
export interface FormFieldDropdownProps extends FormFieldBaseProps {
|
|
47
|
+
type: FormFieldType.DROPDOWN;
|
|
48
|
+
rendererProps: DropdownProps;
|
|
49
|
+
}
|
|
50
|
+
export interface FormFieldDropdownMenuProps extends FormFieldBaseProps {
|
|
51
|
+
type: FormFieldType.DROPDOWN_MENU;
|
|
52
|
+
rendererProps: DropdownProps;
|
|
53
|
+
}
|
|
54
|
+
export interface FormFieldIconButtonProps extends FormFieldBaseProps {
|
|
55
|
+
type: FormFieldType.ICON_BUTTON;
|
|
56
|
+
rendererProps: IconButtonProps;
|
|
57
|
+
}
|
|
58
|
+
export interface FormFieldCheckboxProps extends FormFieldBaseProps {
|
|
59
|
+
type: FormFieldType.CHECKBOX;
|
|
60
|
+
rendererProps: CheckboxProps;
|
|
61
|
+
}
|
|
62
|
+
export interface FormFieldCustomProps extends FormFieldBaseProps {
|
|
63
|
+
type: FormFieldType.CUSTOM;
|
|
64
|
+
rendererProps: any;
|
|
65
|
+
}
|
|
66
|
+
export type FormField = FormFieldTextFieldProps | FormFieldDatePickerProps | FormFieldDropdownProps | FormFieldDropdownMenuProps | FormFieldIconButtonProps | FormFieldCheckboxProps | FormFieldCustomProps;
|
|
67
|
+
export interface FormFields {
|
|
68
|
+
[key: FieldName]: FormField;
|
|
69
|
+
}
|
|
70
|
+
export interface FormRow {
|
|
71
|
+
widths?: string;
|
|
72
|
+
column?: FormRowColumnCondition;
|
|
73
|
+
items?: FormField[];
|
|
74
|
+
}
|
|
75
|
+
export declare enum FormRowColumnCondition {
|
|
76
|
+
ALWAYS_COLUMN = "ALWAYS_COLUMN",
|
|
77
|
+
ALWAYS_ROW = "ALWAYS_ROW",
|
|
78
|
+
COLUMN_ON_MOBILE = "COLUMN_ON_MOBILE"
|
|
79
|
+
}
|
|
80
|
+
export interface FormConfig {
|
|
81
|
+
fieldNames: FieldName[];
|
|
82
|
+
initialState: FormState;
|
|
83
|
+
rows: FormRow[];
|
|
84
|
+
schema?: Schema;
|
|
85
|
+
}
|
|
86
|
+
export declare enum FormValidationType {
|
|
87
|
+
ON_BLUR = "onBlur",
|
|
88
|
+
ON_CHANGE = "onChange"
|
|
89
|
+
}
|
|
90
|
+
export interface UseFormProps {
|
|
91
|
+
/**
|
|
92
|
+
* The form configuration object.
|
|
93
|
+
* - This object contains the form field names, initial state, and form rows.
|
|
94
|
+
* - `fieldNames`: An array of strings representing the field names.
|
|
95
|
+
* - `initialState`: An object with the field name as the key and the initial value as the value.
|
|
96
|
+
* - `rows`: An array of objects with the following properties:
|
|
97
|
+
* - `widths`: A string representing the column widths for the row. (Eg: '1fr 1fr')
|
|
98
|
+
* - `column`: A string representing the column condition for the row. (Options: 'ALWAYS_COLUMN', 'ALWAYS_ROW', 'COLUMN_ON_MOBILE')
|
|
99
|
+
* - `items`: An array of form field objects.
|
|
100
|
+
* - Each form field object contains the following properties:
|
|
101
|
+
* - `type`: A string representing the form field type. (Options: 'TEXTFIELD', 'DATE_PICKER', 'DROPDOWN', 'DROPDOWN_MENU', 'ICON_BUTTON', 'CHECKBOX', 'CUSTOM')
|
|
102
|
+
* - `renderer`: A function that returns a React node. (Props: formField, error, formData, handleChange)
|
|
103
|
+
* - `rendererProps`: Props required for the form field renderer. (Eg: name, label, placeholder, etc.)
|
|
104
|
+
* - `configProps`: An object with additional form field props required at user side.
|
|
105
|
+
* @required
|
|
106
|
+
*/
|
|
107
|
+
formConfig: FormConfig;
|
|
108
|
+
/**
|
|
109
|
+
* CSS properties to style the form rows.
|
|
110
|
+
* @default {}
|
|
111
|
+
*/
|
|
112
|
+
rowStyles?: React.CSSProperties;
|
|
113
|
+
/**
|
|
114
|
+
* The type of validation to be used for the form fields.
|
|
115
|
+
* - 'onBlur': Validate the form fields on blur.
|
|
116
|
+
* - 'onChange': Validate the form fields on change.
|
|
117
|
+
* - If not provided, all fields will be validated on submit.
|
|
118
|
+
* @default null
|
|
119
|
+
*/
|
|
120
|
+
whenToValidate?: FormValidationType;
|
|
121
|
+
/**
|
|
122
|
+
* Flag to indicate if the form is being viewed on a mobile device.
|
|
123
|
+
* @default false
|
|
124
|
+
*/
|
|
125
|
+
isMobileView?: boolean;
|
|
126
|
+
/**
|
|
127
|
+
* Flag to indicate if the form should focus on the first error when the form is validated.
|
|
128
|
+
* @default true
|
|
129
|
+
*/
|
|
130
|
+
shouldFocusOnFirstError?: boolean;
|
|
131
|
+
/**
|
|
132
|
+
* Flag to indicate if the form should submit on pressing the 'Enter' key.
|
|
133
|
+
* @default true
|
|
134
|
+
*/
|
|
135
|
+
shouldSubmitOnEnter?: boolean;
|
|
136
|
+
/**
|
|
137
|
+
* Flag to indicate if the form should show the submit button.
|
|
138
|
+
* - A default submit button will be rendered at the end of the form.
|
|
139
|
+
* - If set to false, the user can provide a custom submit button and call the `submit` function to submit the form.
|
|
140
|
+
* @default true
|
|
141
|
+
*/
|
|
142
|
+
shouldShowSubmitButton?: boolean;
|
|
143
|
+
/**
|
|
144
|
+
* Props for the submit button.
|
|
145
|
+
* - These props will be passed to the default submit button.
|
|
146
|
+
*/
|
|
147
|
+
submitButtonProps?: ButtonProps;
|
|
148
|
+
/**
|
|
149
|
+
* Function to be called when the form is submitted.
|
|
150
|
+
* - This function will be called after the form is validated and there are no errors.
|
|
151
|
+
* @param data - The form data to be submitted.
|
|
152
|
+
*/
|
|
153
|
+
onSubmit?: (data: FormState) => void;
|
|
154
|
+
}
|
|
155
|
+
export interface UseFormReturnProps {
|
|
156
|
+
/**
|
|
157
|
+
* The current state of the form.
|
|
158
|
+
*/
|
|
159
|
+
formData: FormState;
|
|
160
|
+
/**
|
|
161
|
+
* The form renderer to render the form fields.
|
|
162
|
+
* - This is a React node that renders the form fields based on the form configuration.
|
|
163
|
+
* - Place this node in the component to render the form.
|
|
164
|
+
*/
|
|
165
|
+
formRenderer: React.ReactNode;
|
|
166
|
+
/**
|
|
167
|
+
* Function to validate the form fields.
|
|
168
|
+
* @param fields - The form fields to validate. (Default: All fields)
|
|
169
|
+
* @param data - The form data to validate. (Default: Current form data)
|
|
170
|
+
*/
|
|
171
|
+
validate: (fields: FieldName[], data: FormState) => void;
|
|
172
|
+
/**
|
|
173
|
+
* Function to submit the form.
|
|
174
|
+
* - This function will validate the form fields and submit the form if there are no errors.
|
|
175
|
+
* - Will be called on pressing Enter key if the `shouldSubmitOnEnter` flag is set to true.
|
|
176
|
+
* - Will be called on pressing Submit button if the `shouldShowSubmitButton` flag is set to true.
|
|
177
|
+
* - If the `shouldShowSubmitButton` flag is set to false, the user can create a custom submit button and call this function to submit the form.
|
|
178
|
+
*/
|
|
179
|
+
submit: () => void;
|
|
180
|
+
/**
|
|
181
|
+
* Function to change the form data.
|
|
182
|
+
* @param newData - The new form data to update.
|
|
183
|
+
*/
|
|
184
|
+
changeFormData: (newData: FormState) => void;
|
|
185
|
+
}
|
|
186
|
+
export interface HandleFormFieldChangeProps {
|
|
187
|
+
name: string;
|
|
188
|
+
value: any;
|
|
189
|
+
}
|
|
190
|
+
export interface FormRendererProps {
|
|
191
|
+
formData?: FormState;
|
|
192
|
+
errors?: FormErrors;
|
|
193
|
+
formRows?: FormRow[];
|
|
194
|
+
rowStyles?: React.CSSProperties;
|
|
195
|
+
handleValidate?: (props: HandleFormFieldChangeProps) => void;
|
|
196
|
+
whenToValidate?: FormValidationType;
|
|
197
|
+
handleChange?: (props: HandleFormFieldChangeProps) => void;
|
|
198
|
+
handleSubmit?: () => void;
|
|
199
|
+
isMobileView?: boolean;
|
|
200
|
+
shouldFocusOnFirstError?: boolean;
|
|
201
|
+
shouldSubmitOnEnter?: boolean;
|
|
202
|
+
shouldShowSubmitButton?: boolean;
|
|
203
|
+
submitButtonProps?: ButtonProps;
|
|
204
|
+
}
|
|
205
|
+
export interface FormFieldProps {
|
|
206
|
+
formField: FormField;
|
|
207
|
+
error?: string;
|
|
208
|
+
formData: FormState;
|
|
209
|
+
handleChange: (props: HandleFormFieldChangeProps) => void;
|
|
210
|
+
whenToValidate?: FormValidationType;
|
|
211
|
+
handleValidate: (props: HandleFormFieldChangeProps) => void;
|
|
212
|
+
}
|
|
213
|
+
export interface CheckFieldValidationProps {
|
|
214
|
+
field: FieldName;
|
|
215
|
+
data: FormState;
|
|
216
|
+
schema: Schema;
|
|
217
|
+
}
|
|
218
|
+
export interface GetFormRowColumnValueProps {
|
|
219
|
+
column: FormRowColumnCondition;
|
|
220
|
+
isMobileView?: boolean;
|
|
221
|
+
}
|
|
222
|
+
export interface GetConditionalProps {
|
|
223
|
+
formField: FormField;
|
|
224
|
+
formData: FormState;
|
|
225
|
+
}
|
|
226
|
+
export interface GetConditionalPropsReturn {
|
|
227
|
+
[key: string]: any;
|
|
228
|
+
}
|
|
229
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources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AAM,WAAW,yBAAyB;IACtC,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACtB"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { UseFormProps, UseFormReturnProps } from './types';
|
|
2
|
+
declare const useForm: ({ formConfig, rowStyles, whenToValidate, isMobileView, shouldFocusOnFirstError, shouldSubmitOnEnter, shouldShowSubmitButton, submitButtonProps, onSubmit, }: UseFormProps) => UseFormReturnProps;
|
|
3
|
+
export default useForm;
|
|
4
|
+
//# sourceMappingURL=useForm.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useForm.d.ts","sourceRoot":"","sources":["../../../../../ui/elements/Form/useForm/useForm.tsx"],"names":[],"mappings":"AAIA,OAAO,EAKH,YAAY,EACZ,kBAAkB,EACrB,MAAM,SAAS,CAAC;AAGjB,QAAA,MAAM,OAAO,gKAUV,YAAY,KAAG,kBA8FjB,CAAC;AAEF,eAAe,OAAO,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CheckFieldValidationProps, GetConditionalProps, GetConditionalPropsReturn, GetFormRowColumnValueProps } from './types';
|
|
2
|
-
export declare function checkFieldValidation({ field, data, }: CheckFieldValidationProps): string;
|
|
2
|
+
export declare function checkFieldValidation({ field, data, schema, }: CheckFieldValidationProps): string;
|
|
3
3
|
export declare function getFormRowColumnValue({ column, isMobileView, }: GetFormRowColumnValueProps): boolean;
|
|
4
4
|
export declare function getConditionalProps({ formField, formData, }: GetConditionalProps): GetConditionalPropsReturn;
|
|
5
5
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../ui/elements/Form/useForm/utils.ts"],"names":[],"mappings":"AAEA,OAAO,EACH,yBAAyB,EAEzB,mBAAmB,EACnB,yBAAyB,EACzB,0BAA0B,EAC7B,MAAM,SAAS,CAAC;AAEjB,wBAAgB,oBAAoB,CAAC,EACjC,KAAK,EACL,IAAI,EACJ,MAAM,GACT,EAAE,yBAAyB,GAAG,MAAM,CAmBpC;AAED,wBAAgB,qBAAqB,CAAC,EAClC,MAAM,EACN,YAAoB,GACvB,EAAE,0BAA0B,WAW5B;AAED,wBAAgB,mBAAmB,CAAC,EAChC,SAAS,EACT,QAAQ,GACX,EAAE,mBAAmB,GAAG,yBAAyB,CAqBjD"}
|
package/dist/ui/index.d.ts
CHANGED
|
@@ -42,5 +42,5 @@ export { SuccessMessage as NSSuccessMessage, type SuccessMessageProps, } from '.
|
|
|
42
42
|
export { default as NSOtpInput, type OtpInputFieldProps, } from './elements/Form/OtpInputField';
|
|
43
43
|
export { default as NSDropdownMenu, type BaseItemDividerProps as NSDropdownMenuBaseItemDividerProps, type BaseItemOptionProps as NSDropdownMenuBaseItemOptionProps, type BaseItemProps as NSDropdownMenuBaseItemProps, type BaseItemSubHeaderProps as NSDropdownMenuBaseItemSubHeaderProps, BaseItemType as NSDropdownMenuBaseItemType, type DropdownMenuProps as NSDropdownMenuProps, } from './elements/DropdownMenu';
|
|
44
44
|
export { type DropdownProps, default as NSDropdown, } from './elements/Form/Dropdown';
|
|
45
|
-
export { type ConditionalProp as NSConditionalProp, type FormConfig as NSFormConfig, type FormErrors as NSFormErrors, type FormField as NSFormField, type FormFieldBaseProps as NSFormFieldBaseProps, type FormFieldCheckboxProps as NSFormFieldCheckboxProps, type FormFieldCustomProps as NSFormFieldCustomProps, type FormFieldDatePickerProps as NSFormFieldDatePickerProps, type FormFieldDropdownMenuProps as NSFormFieldDropdownMenuProps, type FormFieldDropdownProps as NSFormFieldDropdownProps, type FormFieldIconButtonProps as NSFormFieldIconButtonProps, type FormFields as NSFormFields, type FormFieldTextFieldProps as NSFormFieldTextFieldProps, FormFieldType as NSFormFieldType, FormRowColumnCondition as NSFormRowColumnCondition, type FormRow as NSFormRowProps, type FormState as NSFormState, type
|
|
45
|
+
export { type ConditionalProp as NSConditionalProp, type FieldName as NSFieldName, type FormConfig as NSFormConfig, type FormErrors as NSFormErrors, type FormField as NSFormField, type FormFieldBaseProps as NSFormFieldBaseProps, type FormFieldCheckboxProps as NSFormFieldCheckboxProps, type FormFieldCustomProps as NSFormFieldCustomProps, type FormFieldDatePickerProps as NSFormFieldDatePickerProps, type FormFieldDropdownMenuProps as NSFormFieldDropdownMenuProps, type FormFieldDropdownProps as NSFormFieldDropdownProps, type FormFieldIconButtonProps as NSFormFieldIconButtonProps, type FormFields as NSFormFields, type FormFieldTextFieldProps as NSFormFieldTextFieldProps, FormFieldType as NSFormFieldType, FormRowColumnCondition as NSFormRowColumnCondition, type FormRow as NSFormRowProps, type FormState as NSFormState, FormValidationType as NSFormValidationType, type UseFormProps as NSUseFormProps, type UseFormReturnProps as NSUseFormReturnProps, useForm as useNSForm, } from './elements/Form/useForm';
|
|
46
46
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/ui/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../ui/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAC9C,YAAY,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAGrC,OAAO,EACH,WAAW,IAAI,kBAAkB,EACjC,oBAAoB,EACpB,iBAAiB,IAAI,oBAAoB,EACzC,kBAAkB,IAAI,qBAAqB,EAC3C,WAAW,IAAI,aAAa,EAC5B,aAAa,IAAI,eAAe,EAChC,YAAY,IAAI,cAAc,EAC9B,YAAY,IAAI,cAAc,GACjC,MAAM,UAAU,CAAC;AAGlB,OAAO,EACH,cAAc,EACd,mBAAmB,EACnB,KAAK,UAAU,EACf,OAAO,IAAI,OAAO,GACrB,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EACH,KAAK,gBAAgB,EACrB,OAAO,IAAI,aAAa,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C3D,KAAK,0BAA0B,IAAI,4BAA4B,EAC/D,KAAK,sBAAsB,IAAI,wBAAwB,EACvD,KAAK,wBAAwB,IAAI,0BAA0B,EAC3D,KAAK,UAAU,IAAI,YAAY,EAC/B,KAAK,uBAAuB,IAAI,yBAAyB,EACzD,aAAa,IAAI,eAAe,EAChC,sBAAsB,IAAI,wBAAwB,EAClD,KAAK,OAAO,IAAI,cAAc,EAC9B,KAAK,SAAS,IAAI,WAAW,EAC7B,kBAAkB,IAAI,oBAAoB,EAC1C,KAAK,YAAY,IAAI,cAAc,EACnC,KAAK,kBAAkB,IAAI,oBAAoB,EAC/C,OAAO,IAAI,SAAS,GACvB,MAAM,yBAAyB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"FormField.d.ts","sourceRoot":"","sources":["../../../../../ui/elements/Form/FormRenderer/FormField.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqB,MAAM,OAAO,CAAC;AAO1C,OAAO,EAAE,cAAc,EAAiB,MAAM,SAAS,CAAC;AAExD,QAAA,MAAM,SAAS,uFAgCb,CAAC;AAEH,eAAe,SAAS,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CheckboxWrapper.d.ts","sourceRoot":"","sources":["../../../../../../ui/elements/Form/FormRenderer/FormFieldWrappers/CheckboxWrapper.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAG1C,QAAA,MAAM,eAAe,UAAW,cAAc,gBA6C7C,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DropdownMenuWrapper.d.ts","sourceRoot":"","sources":["../../../../../../ui/elements/Form/FormRenderer/FormFieldWrappers/DropdownMenuWrapper.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAG1C,QAAA,MAAM,mBAAmB,UAAW,cAAc,gBAsDjD,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DropdownWrapper.d.ts","sourceRoot":"","sources":["../../../../../../ui/elements/Form/FormRenderer/FormFieldWrappers/DropdownWrapper.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAG1C,QAAA,MAAM,eAAe,UAAW,cAAc,gBAyE7C,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TextFieldWrapper.d.ts","sourceRoot":"","sources":["../../../../../../ui/elements/Form/FormRenderer/FormFieldWrappers/TextFieldWrapper.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAG1C,QAAA,MAAM,gBAAgB,UAAW,cAAc,gBAkC9C,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"FormRenderer.d.ts","sourceRoot":"","sources":["../../../../../ui/elements/Form/FormRenderer/FormRenderer.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAG5C,QAAA,MAAM,YAAY,UAAW,iBAAiB,gBA8D7C,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
export { type ConditionalProp, type FormConfig, type FormErrors, type FormField, type FormFieldBaseProps, type FormFieldCheckboxProps, type FormFieldCustomProps, type FormFieldDatePickerProps, type FormFieldDropdownMenuProps, type FormFieldDropdownProps, type FormFieldIconButtonProps, type FormFields, type FormFieldTextFieldProps, FormFieldType, type FormRow, FormRowColumnCondition, type FormState, type UseFormHookProps, type UseFormHookReturnProps, } from './types';
|
|
2
|
-
export { default as useFormHook } from './useFormHook';
|
|
3
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../ui/elements/Form/FormRenderer/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EACH,KAAK,eAAe,EACpB,KAAK,UAAU,EACf,KAAK,UAAU,EACf,KAAK,SAAS,EACd,KAAK,kBAAkB,EACvB,KAAK,sBAAsB,EAC3B,KAAK,oBAAoB,EACzB,KAAK,wBAAwB,EAC7B,KAAK,0BAA0B,EAC/B,KAAK,sBAAsB,EAC3B,KAAK,wBAAwB,EAC7B,KAAK,UAAU,EACf,KAAK,uBAAuB,EAC5B,aAAa,EACb,KAAK,OAAO,EACZ,sBAAsB,EACtB,KAAK,SAAS,EACd,KAAK,gBAAgB,EACrB,KAAK,sBAAsB,GAC9B,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Schema } from 'yup';
|
|
3
|
-
import { IconButtonProps } from '../../Button';
|
|
4
|
-
import { CheckboxProps } from '../Checkbox';
|
|
5
|
-
import { DropdownProps } from '../Dropdown';
|
|
6
|
-
import { TextFieldProps } from '../TextField';
|
|
7
|
-
export interface FormState {
|
|
8
|
-
[key: string]: any;
|
|
9
|
-
}
|
|
10
|
-
export interface FormErrors {
|
|
11
|
-
[key: string]: string;
|
|
12
|
-
}
|
|
13
|
-
export declare enum FormFieldType {
|
|
14
|
-
TEXTFIELD = "TEXTFIELD",
|
|
15
|
-
DATE_PICKER = "DATE_PICKER",
|
|
16
|
-
DROPDOWN = "DROPDOWN",
|
|
17
|
-
DROPDOWN_MENU = "DROPDOWN_MENU",
|
|
18
|
-
ICON_BUTTON = "ICON_BUTTON",
|
|
19
|
-
CHECKBOX = "CHECKBOX",
|
|
20
|
-
CUSTOM = "CUSTOM"
|
|
21
|
-
}
|
|
22
|
-
export interface ConditionalProp {
|
|
23
|
-
propName: string;
|
|
24
|
-
propValue: any;
|
|
25
|
-
conditions: Array<{
|
|
26
|
-
prop: string;
|
|
27
|
-
value: any;
|
|
28
|
-
}>;
|
|
29
|
-
}
|
|
30
|
-
export interface FormFieldBaseProps {
|
|
31
|
-
type: FormFieldType;
|
|
32
|
-
renderer?: (props: FormFieldProps) => React.ReactNode;
|
|
33
|
-
rendererProps?: any;
|
|
34
|
-
schema?: Schema;
|
|
35
|
-
configProps?: any;
|
|
36
|
-
conditionalProps?: ConditionalProp[];
|
|
37
|
-
}
|
|
38
|
-
export interface FormFieldTextFieldProps extends FormFieldBaseProps {
|
|
39
|
-
type: FormFieldType.TEXTFIELD;
|
|
40
|
-
rendererProps: TextFieldProps;
|
|
41
|
-
}
|
|
42
|
-
export interface FormFieldDatePickerProps extends FormFieldBaseProps {
|
|
43
|
-
type: FormFieldType.DATE_PICKER;
|
|
44
|
-
rendererProps: TextFieldProps;
|
|
45
|
-
}
|
|
46
|
-
export interface FormFieldDropdownProps extends FormFieldBaseProps {
|
|
47
|
-
type: FormFieldType.DROPDOWN;
|
|
48
|
-
rendererProps: DropdownProps;
|
|
49
|
-
}
|
|
50
|
-
export interface FormFieldDropdownMenuProps extends FormFieldBaseProps {
|
|
51
|
-
type: FormFieldType.DROPDOWN_MENU;
|
|
52
|
-
rendererProps: DropdownProps;
|
|
53
|
-
}
|
|
54
|
-
export interface FormFieldIconButtonProps extends FormFieldBaseProps {
|
|
55
|
-
type: FormFieldType.ICON_BUTTON;
|
|
56
|
-
rendererProps: IconButtonProps;
|
|
57
|
-
}
|
|
58
|
-
export interface FormFieldCheckboxProps extends FormFieldBaseProps {
|
|
59
|
-
type: FormFieldType.CHECKBOX;
|
|
60
|
-
rendererProps: CheckboxProps;
|
|
61
|
-
}
|
|
62
|
-
export interface FormFieldCustomProps extends FormFieldBaseProps {
|
|
63
|
-
type: FormFieldType.CUSTOM;
|
|
64
|
-
rendererProps: any;
|
|
65
|
-
}
|
|
66
|
-
export type FormField = FormFieldTextFieldProps | FormFieldDatePickerProps | FormFieldDropdownProps | FormFieldDropdownMenuProps | FormFieldIconButtonProps | FormFieldCheckboxProps | FormFieldCustomProps;
|
|
67
|
-
export interface FormFields {
|
|
68
|
-
[key: string]: FormField;
|
|
69
|
-
}
|
|
70
|
-
export interface FormRow {
|
|
71
|
-
widths?: string;
|
|
72
|
-
column?: FormRowColumnCondition;
|
|
73
|
-
items?: FormField[];
|
|
74
|
-
}
|
|
75
|
-
export declare enum FormRowColumnCondition {
|
|
76
|
-
ALWAYS_COLUMN = "ALWAYS_COLUMN",
|
|
77
|
-
ALWAYS_ROW = "ALWAYS_ROW",
|
|
78
|
-
COLUMN_ON_MOBILE = "COLUMN_ON_MOBILE"
|
|
79
|
-
}
|
|
80
|
-
export interface FormConfig {
|
|
81
|
-
fields: FormFields;
|
|
82
|
-
initialState: FormState;
|
|
83
|
-
rows: FormRow[];
|
|
84
|
-
}
|
|
85
|
-
export interface UseFormHookProps {
|
|
86
|
-
/**
|
|
87
|
-
* The initial state of the form.
|
|
88
|
-
* @default {}
|
|
89
|
-
*/
|
|
90
|
-
initialState?: FormState;
|
|
91
|
-
/**
|
|
92
|
-
* An array of form rows to be rendered.
|
|
93
|
-
* @default []
|
|
94
|
-
*/
|
|
95
|
-
formRows?: FormRow[];
|
|
96
|
-
/**
|
|
97
|
-
* CSS properties to style the form rows.
|
|
98
|
-
* @default {}
|
|
99
|
-
*/
|
|
100
|
-
rowStyles?: React.CSSProperties;
|
|
101
|
-
/**
|
|
102
|
-
* Flag to indicate if the form is being viewed on a mobile device.
|
|
103
|
-
* @default false
|
|
104
|
-
*/
|
|
105
|
-
isMobileView?: boolean;
|
|
106
|
-
/**
|
|
107
|
-
* Flag to indicate if the form should focus on the first error when the form is validated.
|
|
108
|
-
* @default true
|
|
109
|
-
*/
|
|
110
|
-
shouldFocusOnFirstError?: boolean;
|
|
111
|
-
}
|
|
112
|
-
export interface UseFormHookReturnProps {
|
|
113
|
-
formData: FormState;
|
|
114
|
-
formRenderer: React.ReactNode;
|
|
115
|
-
validateFields: (fields: FormFields, data: FormState) => any;
|
|
116
|
-
changeFormData: (newData: FormState) => void;
|
|
117
|
-
}
|
|
118
|
-
export interface HandleFormFieldChangeProps {
|
|
119
|
-
name: string;
|
|
120
|
-
value: any;
|
|
121
|
-
}
|
|
122
|
-
export interface FormRendererProps {
|
|
123
|
-
formData?: FormState;
|
|
124
|
-
errors?: FormErrors;
|
|
125
|
-
formRows?: FormRow[];
|
|
126
|
-
rowStyles?: React.CSSProperties;
|
|
127
|
-
handleChange?: (props: HandleFormFieldChangeProps) => void;
|
|
128
|
-
isMobileView?: boolean;
|
|
129
|
-
shouldFocusOnFirstError?: boolean;
|
|
130
|
-
}
|
|
131
|
-
export interface FormFieldProps {
|
|
132
|
-
formField: FormField;
|
|
133
|
-
error?: string;
|
|
134
|
-
formData: FormState;
|
|
135
|
-
handleChange: (props: HandleFormFieldChangeProps) => void;
|
|
136
|
-
}
|
|
137
|
-
export interface CheckFieldValidationProps {
|
|
138
|
-
field: FormField;
|
|
139
|
-
data: any;
|
|
140
|
-
}
|
|
141
|
-
export interface GetFormRowColumnValueProps {
|
|
142
|
-
column: FormRowColumnCondition;
|
|
143
|
-
isMobileView?: boolean;
|
|
144
|
-
}
|
|
145
|
-
export interface GetConditionalProps {
|
|
146
|
-
formField: FormField;
|
|
147
|
-
formData: FormState;
|
|
148
|
-
}
|
|
149
|
-
export interface GetConditionalPropsReturn {
|
|
150
|
-
[key: string]: any;
|
|
151
|
-
}
|
|
152
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../ui/elements/Form/FormRenderer/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,MAAM,EAAE,MAAM,KAAK,CAAC;AAE7B,OAAO,EAAE,eAAe,EAAE,MA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ACvC,MAAM,EAAE,sBAAsB,CAAC;IAC/B,YAAY,CAAC,EAAE,OAAO,CAAC;CAC1B;AACD,MAAM,WAAW,mBAAmB;IAChC,SAAS,EAAE,SAAS,CAAC;IACrB,QAAQ,EAAE,SAAS,CAAC;CACvB;AACD,MAAM,WAAW,yBAAyB;IACtC,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACtB"}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { UseFormHookProps, UseFormHookReturnProps } from './types';
|
|
2
|
-
declare const useFormHook: ({ initialState, formRows, rowStyles, isMobileView, shouldFocusOnFirstError, }: UseFormHookProps) => UseFormHookReturnProps;
|
|
3
|
-
export default useFormHook;
|
|
4
|
-
//# sourceMappingURL=useFormHook.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useFormHook.d.ts","sourceRoot":"","sources":["../../../../../ui/elements/Form/FormRenderer/useFormHook.tsx"],"names":[],"mappings":"AAGA,OAAO,EAKH,gBAAgB,EAChB,sBAAsB,EACzB,MAAM,SAAS,CAAC;AAGjB,QAAA,MAAM,WAAW,kFAMd,gBAAgB,KAAG,sBAqDrB,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../ui/elements/Form/FormRenderer/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,yBAAyB,EAEzB,mBAAmB,EACnB,yBAAyB,EACzB,0BAA0B,EAC7B,MAAM,SAAS,CAAC;AAEjB,wBAAgB,oBAAoB,CAAC,EACjC,KAAK,EACL,IAAI,GACP,EAAE,yBAAyB,GAAG,MAAM,CAUpC;AAED,wBAAgB,qBAAqB,CAAC,EAClC,MAAM,EACN,YAAoB,GACvB,EAAE,0BAA0B,WAW5B;AAED,wBAAgB,mBAAmB,CAAC,EAChC,SAAS,EACT,QAAQ,GACX,EAAE,mBAAmB,GAAG,yBAAyB,CAqBjD"}
|
|
File without changes
|
/package/dist/ui/elements/Form/{FormRenderer → useForm}/FormFieldWrappers/CheckboxWrapper.d.ts
RENAMED
|
File without changes
|
/package/dist/ui/elements/Form/{FormRenderer → useForm}/FormFieldWrappers/DropdownMenuWrapper.d.ts
RENAMED
|
File without changes
|
/package/dist/ui/elements/Form/{FormRenderer → useForm}/FormFieldWrappers/DropdownWrapper.d.ts
RENAMED
|
File without changes
|
/package/dist/ui/elements/Form/{FormRenderer → useForm}/FormFieldWrappers/TextFieldWrapper.d.ts
RENAMED
|
File without changes
|
|
File without changes
|