tp-react-elements-dev 1.12.23 → 1.12.25
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/README.md +196 -167
- package/dist/assets/icons/flaticon_hvc.css +71 -70
- package/dist/assets/icons/flaticon_hvc.scss +126 -124
- package/dist/auth/authContext.d.ts +19 -0
- package/dist/auth/authContext.esm.js +26 -0
- package/dist/components/Button/Button.d.ts +7 -0
- package/dist/components/Button/Button.esm.js +15 -0
- package/dist/components/Button/index.d.ts +1 -0
- package/dist/components/Button/index.esm.js +1 -0
- package/dist/components/CheckBox/index.d.ts +1 -0
- package/dist/components/CheckBox/index.esm.js +1 -0
- package/dist/components/CheckBoxGroup/index.d.ts +1 -0
- package/dist/components/CheckBoxGroup/index.esm.js +1 -0
- package/dist/components/DatePicker/index.d.ts +4 -0
- package/dist/components/DatePicker/index.esm.js +4 -0
- package/dist/components/Delete/index.d.ts +1 -0
- package/dist/components/Delete/index.esm.js +1 -0
- package/dist/components/DeleteComponent/DeleteField.d.ts +0 -1
- package/dist/components/DeleteComponent/{DeleteField.js → DeleteField.esm.js} +6 -6
- package/dist/components/DeleteComponent/index.d.ts +1 -0
- package/dist/components/DeleteComponent/index.esm.js +1 -0
- package/dist/components/Feedback/index.d.ts +5 -0
- package/dist/components/Feedback/index.esm.js +7 -0
- package/dist/components/FileUpload/index.d.ts +2 -0
- package/dist/components/FileUpload/index.esm.js +2 -0
- package/dist/components/Form/Form.styles.d.ts +8 -26
- package/dist/components/Form/Form.styles.esm.js +111 -0
- package/dist/components/Form/FormActiveSwitch.d.ts +1 -2
- package/dist/components/Form/FormActiveSwitch.esm.js +11 -0
- package/dist/components/Form/FormConstants.d.ts +2 -3
- package/dist/components/Form/{FormConstants.js → FormConstants.esm.js} +89 -103
- package/dist/components/Form/FormContainer.d.ts +2 -3
- package/dist/components/Form/FormContainer.esm.js +3 -0
- package/dist/components/Form/FormRender.d.ts +11 -4
- package/dist/components/Form/FormRender.esm.js +130 -0
- package/dist/components/Form/FormRenderConstants.d.ts +0 -1
- package/dist/components/Form/FormRenderWrapper.d.ts +37 -5
- package/dist/components/Form/FormRenderWrapper.esm.js +33 -0
- package/dist/components/Form/index.d.ts +6 -0
- package/dist/components/Form/index.esm.js +5 -0
- package/dist/components/FormComponents/DatePicker/DatepickerWrapperV2.d.ts +1 -2
- package/dist/components/FormComponents/DatePicker/DatepickerWrapperV2.esm.js +72 -0
- package/dist/components/FormComponents/DatePicker/MonthPicker.d.ts +0 -1
- package/dist/components/FormComponents/DatePicker/{MonthPicker.js → MonthPicker.esm.js} +3 -3
- package/dist/components/FormComponents/DatePicker/Monthpickerrender.d.ts +1 -2
- package/dist/components/FormComponents/DatePicker/Monthpickerrender.esm.js +70 -0
- package/dist/components/FormComponents/FileUpload/FormRenderFileUpload.d.ts +1 -2
- package/dist/components/FormComponents/FileUpload/FormRenderFileUpload.esm.js +71 -0
- package/dist/components/FormComponents/FileUpload/FormRenderMultiFileUpload.d.ts +1 -2
- package/dist/components/FormComponents/FileUpload/FormRenderMultiFileUpload.esm.js +85 -0
- package/dist/components/FormComponents/FormBottomField/FormBottomField.d.ts +15 -2
- package/dist/components/FormComponents/FormBottomField/FormBottomField.esm.js +22 -0
- package/dist/components/FormComponents/FormCheckBox/FormCheckBox.d.ts +20 -2
- package/dist/components/FormComponents/FormCheckBox/FormCheckBox.esm.js +32 -0
- package/dist/components/FormComponents/FormCheckBoxGroup/FormCheckBoxGroup.d.ts +20 -2
- package/dist/components/FormComponents/FormCheckBoxGroup/FormCheckBoxGroup.esm.js +42 -0
- package/dist/components/FormComponents/FormErrorField/FormErrorField.d.ts +14 -2
- package/dist/components/FormComponents/FormErrorField/FormErrorField.esm.js +21 -0
- package/dist/components/FormComponents/FormNumberField/FormNumberField.d.ts +40 -3
- package/dist/components/FormComponents/FormNumberField/FormNumberField.esm.js +102 -0
- package/dist/components/FormComponents/FormNumberField/FormNumberFieldDecimal.d.ts +1 -2
- package/dist/components/FormComponents/FormNumberField/FormNumberFieldDecimal.esm.js +50 -0
- package/dist/components/FormComponents/FormRadioGroup/FormRadioGroup.d.ts +21 -3
- package/dist/components/FormComponents/FormRadioGroup/FormRadioGroup.esm.js +44 -0
- package/dist/components/FormComponents/FormTextAreaField/FormTextAreaField.d.ts +20 -2
- package/dist/components/FormComponents/FormTextAreaField/FormTextAreaField.esm.js +65 -0
- package/dist/components/FormComponents/FormTextAreaField/FormTextAreaField.styles.d.ts +1 -4
- package/dist/components/FormComponents/FormTextAreaField/FormTextAreaField.styles.esm.js +35 -0
- package/dist/components/FormComponents/FormTextField/FormTextField.d.ts +39 -3
- package/dist/components/FormComponents/FormTextField/FormTextField.esm.js +111 -0
- package/dist/components/FormComponents/FormTextField/FormTextField.styles.d.ts +10 -4
- package/dist/components/FormComponents/FormTextField/FormTextField.styles.esm.js +27 -0
- package/dist/components/FormComponents/HelperText/HelperText.d.ts +14 -2
- package/dist/components/FormComponents/HelperText/HelperText.esm.js +23 -0
- package/dist/components/FormComponents/PasswordField/PasswordField.d.ts +21 -3
- package/dist/components/FormComponents/PasswordField/PasswordField.esm.js +91 -0
- package/dist/components/FormComponents/RichTextEditor/RichTextEditor.d.ts +1 -2
- package/dist/components/FormComponents/RichTextEditor/{RichTextEditor.js → RichTextEditor.esm.js} +50 -31
- package/dist/components/FormComponents/RichTextEditor/RichTextEditorWrapper.d.ts +1 -2
- package/dist/components/FormComponents/RichTextEditor/{RichTextEditorWrapper.js → RichTextEditorWrapper.esm.js} +4 -3
- package/dist/components/FormComponents/RichTextEditor/jodit.index.d.ts +5 -10
- package/dist/components/FormComponents/RichTextEditor/jodit.index.esm.js +23 -0
- package/dist/components/FormComponents/Select/MultiSelect.d.ts +0 -1
- package/dist/components/FormComponents/Select/MultiSelectv1.d.ts +1 -2
- package/dist/components/FormComponents/Select/{MultiSelectv1.js → MultiSelectv1.esm.js} +54 -61
- package/dist/components/FormComponents/Select/SingleSelect.d.ts +2 -3
- package/dist/components/FormComponents/Select/SingleSelect.esm.js +61 -0
- package/dist/components/FormComponents/Select/SingleSelectNonAutoComplete.d.ts +1 -2
- package/dist/components/FormComponents/Select/SingleSelectNonAutoComplete.esm.js +32 -0
- package/dist/components/FormComponents/Select/SingleSelectSearchApi.d.ts +2 -3
- package/dist/components/FormComponents/Select/{SingleSelectSearchApi.js → SingleSelectSearchApi.esm.js} +2 -6
- package/dist/components/FormComponents/TimePicker/TimePicker.d.ts +1 -2
- package/dist/components/FormComponents/TimePicker/TimePicker.esm.js +70 -0
- package/dist/components/FormComponents/YearPickerField/YearPickerField.d.ts +2 -3
- package/dist/components/FormComponents/YearPickerField/{YearPickerField.js → YearPickerField.esm.js} +2 -6
- package/dist/components/FormComponents/index.d.ts +16 -25
- package/dist/components/FormComponents/{index.js → index.esm.js} +24 -26
- package/dist/components/Global.styles.d.ts +7 -22
- package/dist/components/{Global.styles.js → Global.styles.esm.js} +2 -2
- package/dist/components/ModalField/ConfirmationDialog.d.ts +2 -11
- package/dist/components/ModalField/ConfirmationDialog.esm.js +46 -0
- package/dist/components/ModalField/ModalField.d.ts +2 -3
- package/dist/components/ModalField/{ModalField.js → ModalField.esm.js} +10 -10
- package/dist/components/ModalField/index.d.ts +2 -0
- package/dist/components/ModalField/index.esm.js +2 -0
- package/dist/components/NumberField/index.d.ts +2 -0
- package/dist/components/NumberField/index.esm.js +2 -0
- package/dist/components/PasswordField/index.d.ts +1 -0
- package/dist/components/PasswordField/index.esm.js +1 -0
- package/dist/components/RadioGroup/index.d.ts +1 -0
- package/dist/components/RadioGroup/index.esm.js +1 -0
- package/dist/components/RichTextEditor/index.d.ts +2 -0
- package/dist/components/RichTextEditor/index.esm.js +2 -0
- package/dist/components/Select/index.d.ts +6 -0
- package/dist/components/Select/index.esm.js +8 -0
- package/dist/components/SelectField/MultiSelectField.d.ts +1 -0
- package/dist/components/SelectField/MultiSelectFieldComponent.d.ts +0 -1
- package/dist/components/SelectField/{MultiSelectFieldComponent.js → MultiSelectFieldComponent.esm.js} +36 -45
- package/dist/components/SelectField/index.d.ts +2 -0
- package/dist/components/SelectField/index.esm.js +1 -0
- package/dist/components/SessionTimeOut/SessionTimeOut.d.ts +1 -3
- package/dist/components/SessionTimeOut/{SessionTimeOut.js → SessionTimeOut.esm.js} +6 -7
- package/dist/components/SessionTimeOut/index.d.ts +1 -0
- package/dist/components/SessionTimeOut/index.esm.js +1 -0
- package/dist/components/TextAreaField/index.d.ts +1 -0
- package/dist/components/TextAreaField/index.esm.js +1 -0
- package/dist/components/TextField/index.d.ts +1 -0
- package/dist/components/TextField/index.esm.js +1 -0
- package/dist/components/TimePicker/index.d.ts +1 -0
- package/dist/components/TimePicker/index.esm.js +1 -0
- package/dist/components/TimePickerField/TimePickerField.d.ts +0 -1
- package/dist/components/TimePickerField/TimePickerField.esm.js +11 -0
- package/dist/components/TimePickerField/index.d.ts +1 -0
- package/dist/components/TimePickerField/index.esm.js +1 -0
- package/dist/index.d.ts +14 -9
- package/dist/index.esm.css +1 -0
- package/dist/index.esm.js +14 -0
- package/dist/theme/index.d.ts +0 -2
- package/dist/theme/{index.js → index.esm.js} +4 -7
- package/dist/types/index.d.ts +3 -4
- package/dist/utils/Constants/FormConstants.d.ts +40 -0
- package/dist/utils/Constants/FormConstants.esm.js +78 -0
- package/dist/{lib → utils}/Constants/FunctionConstants.d.ts +6 -7
- package/dist/{lib/Constants/FunctionConstants.js → utils/Constants/FunctionConstants.esm.js} +46 -54
- package/dist/utils/Constants/FunctionConstants.test.d.ts +1 -0
- package/dist/utils/Constants/crypto-js.d.ts +29 -0
- package/dist/utils/Constants/date-pickers.d.ts +29 -0
- package/dist/utils/Constants/date-pickers.esm.js +33 -0
- package/dist/utils/Constants/file-saver.d.ts +14 -0
- package/dist/utils/Constants/file-saver.esm.js +22 -0
- package/dist/utils/Constants/index.d.ts +5 -0
- package/dist/utils/Constants/xlsx-js-style.d.ts +22 -0
- package/dist/utils/Constants/xlsx-js-style.esm.js +46 -0
- package/dist/{lib → utils}/Interface/FormInterface.d.ts +11 -8
- package/dist/utils/Interface/MainInterface.d.ts +17 -0
- package/dist/utils/Interface/ModalInterface.d.ts +12 -0
- package/dist/utils/Interface/index.d.ts +3 -0
- package/dist/{lib → utils}/index.d.ts +3 -4
- package/dist/{lib/index.js → utils/index.esm.js} +2 -2
- package/dist/validation/index.d.ts +1 -0
- package/dist/validation/index.esm.js +1 -0
- package/dist/validation/schemas.d.ts +65 -6
- package/dist/validation/schemas.esm.js +111 -0
- package/package.json +62 -27
- package/scripts/install-deps.js +103 -46
- package/dist/assets/types.d.ts +0 -62
- package/dist/components/DeleteComponent/DeleteField.d.ts.map +0 -1
- package/dist/components/Form/Form.styles.d.ts.map +0 -1
- package/dist/components/Form/Form.styles.js +0 -111
- package/dist/components/Form/FormActiveSwitch.d.ts.map +0 -1
- package/dist/components/Form/FormActiveSwitch.js +0 -27
- package/dist/components/Form/FormConstants.d.ts.map +0 -1
- package/dist/components/Form/FormContainer.d.ts.map +0 -1
- package/dist/components/Form/FormRender.d.ts.map +0 -1
- package/dist/components/Form/FormRender.js +0 -96
- package/dist/components/Form/FormRenderConstants.d.ts.map +0 -1
- package/dist/components/Form/FormRenderWrapper.d.ts.map +0 -1
- package/dist/components/Form/FormRenderWrapper.js +0 -13
- package/dist/components/FormComponents/DatePicker/DateRangePicker.d.ts +0 -7
- package/dist/components/FormComponents/DatePicker/DateRangePicker.d.ts.map +0 -1
- package/dist/components/FormComponents/DatePicker/DatepickerWrapperV2.d.ts.map +0 -1
- package/dist/components/FormComponents/DatePicker/DatepickerWrapperV2.js +0 -58
- package/dist/components/FormComponents/DatePicker/MonthPicker.d.ts.map +0 -1
- package/dist/components/FormComponents/DatePicker/Monthpickerrender.d.ts.map +0 -1
- package/dist/components/FormComponents/DatePicker/Monthpickerrender.js +0 -61
- package/dist/components/FormComponents/FileUpload/FormRenderFileUpload.d.ts.map +0 -1
- package/dist/components/FormComponents/FileUpload/FormRenderFileUpload.js +0 -86
- package/dist/components/FormComponents/FileUpload/FormRenderMultiFileUpload.d.ts.map +0 -1
- package/dist/components/FormComponents/FileUpload/FormRenderMultiFileUpload.js +0 -96
- package/dist/components/FormComponents/FormBottomField/FormBottomField.d.ts.map +0 -1
- package/dist/components/FormComponents/FormBottomField/FormBottomField.js +0 -9
- package/dist/components/FormComponents/FormCheckBox/FormCheckBox.d.ts.map +0 -1
- package/dist/components/FormComponents/FormCheckBox/FormCheckBox.js +0 -10
- package/dist/components/FormComponents/FormCheckBoxGroup/FormCheckBoxGroup.d.ts.map +0 -1
- package/dist/components/FormComponents/FormCheckBoxGroup/FormCheckBoxGroup.js +0 -23
- package/dist/components/FormComponents/FormErrorField/FormErrorField.d.ts.map +0 -1
- package/dist/components/FormComponents/FormErrorField/FormErrorField.js +0 -9
- package/dist/components/FormComponents/FormNumberField/FormNumberField.d.ts.map +0 -1
- package/dist/components/FormComponents/FormNumberField/FormNumberField.js +0 -49
- package/dist/components/FormComponents/FormNumberField/FormNumberFieldDecimal.d.ts.map +0 -1
- package/dist/components/FormComponents/FormNumberField/FormNumberFieldDecimal.js +0 -45
- package/dist/components/FormComponents/FormRadioGroup/FormRadioGroup.d.ts.map +0 -1
- package/dist/components/FormComponents/FormRadioGroup/FormRadioGroup.js +0 -26
- package/dist/components/FormComponents/FormTextAreaField/FormTextAreaField.d.ts.map +0 -1
- package/dist/components/FormComponents/FormTextAreaField/FormTextAreaField.js +0 -31
- package/dist/components/FormComponents/FormTextAreaField/FormTextAreaField.styles.d.ts.map +0 -1
- package/dist/components/FormComponents/FormTextAreaField/FormTextAreaField.styles.js +0 -35
- package/dist/components/FormComponents/FormTextField/FormTextField.d.ts.map +0 -1
- package/dist/components/FormComponents/FormTextField/FormTextField.js +0 -46
- package/dist/components/FormComponents/FormTextField/FormTextField.styles.d.ts.map +0 -1
- package/dist/components/FormComponents/FormTextField/FormTextField.styles.js +0 -22
- package/dist/components/FormComponents/HelperText/HelperText.d.ts.map +0 -1
- package/dist/components/FormComponents/HelperText/HelperText.js +0 -10
- package/dist/components/FormComponents/PasswordField/PasswordField.d.ts.map +0 -1
- package/dist/components/FormComponents/PasswordField/PasswordField.js +0 -49
- package/dist/components/FormComponents/RichTextEditor/RichTextEditor.d.ts.map +0 -1
- package/dist/components/FormComponents/RichTextEditor/RichTextEditorWrapper.d.ts.map +0 -1
- package/dist/components/FormComponents/RichTextEditor/jodit.index.d.ts.map +0 -1
- package/dist/components/FormComponents/RichTextEditor/jodit.index.js +0 -27
- package/dist/components/FormComponents/Select/MultiSelect.d.ts.map +0 -1
- package/dist/components/FormComponents/Select/MultiSelectv1.d.ts.map +0 -1
- package/dist/components/FormComponents/Select/SingleSelect.d.ts.map +0 -1
- package/dist/components/FormComponents/Select/SingleSelect.js +0 -51
- package/dist/components/FormComponents/Select/SingleSelectNonAutoComplete.d.ts.map +0 -1
- package/dist/components/FormComponents/Select/SingleSelectNonAutoComplete.js +0 -27
- package/dist/components/FormComponents/Select/SingleSelectSearchApi.d.ts.map +0 -1
- package/dist/components/FormComponents/TimePicker/TimePicker.d.ts.map +0 -1
- package/dist/components/FormComponents/TimePicker/TimePicker.js +0 -55
- package/dist/components/FormComponents/YearPickerField/YearPickerField.d.ts.map +0 -1
- package/dist/components/FormComponents/index.d.ts.map +0 -1
- package/dist/components/Global.styles.d.ts.map +0 -1
- package/dist/components/ModalField/ConfirmationDialog.d.ts.map +0 -1
- package/dist/components/ModalField/ConfirmationDialog.js +0 -48
- package/dist/components/ModalField/ModalField.d.ts.map +0 -1
- package/dist/components/SelectField/MultiSelectFieldComponent.d.ts.map +0 -1
- package/dist/components/SessionTimeOut/SessionTimeOut.d.ts.map +0 -1
- package/dist/components/TimePickerField/TimePickerField.d.ts.map +0 -1
- package/dist/components/index.d.ts +0 -8
- package/dist/components/index.d.ts.map +0 -1
- package/dist/index.css +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -16
- package/dist/lib/Constants/FormConstants.d.ts +0 -11
- package/dist/lib/Constants/FormConstants.d.ts.map +0 -1
- package/dist/lib/Constants/FormConstants.js +0 -54
- package/dist/lib/Constants/FunctionConstants.d.ts.map +0 -1
- package/dist/lib/Interface/FormInterface.d.ts.map +0 -1
- package/dist/lib/index.d.ts.map +0 -1
- package/dist/theme/index.d.ts.map +0 -1
- package/dist/types/index.d.ts.map +0 -1
- package/dist/validation/schemas.d.ts.map +0 -1
- package/dist/validation/schemas.js +0 -60
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# tp-
|
|
1
|
+
# tp-react-elements-dev
|
|
2
2
|
|
|
3
3
|
A comprehensive React form library built with Material-UI and React Hook Form, designed for enterprise applications.
|
|
4
4
|
|
|
@@ -14,16 +14,16 @@ A comprehensive React form library built with Material-UI and React Hook Form, d
|
|
|
14
14
|
|
|
15
15
|
## 📋 Requirements
|
|
16
16
|
|
|
17
|
-
- **Node.js**:
|
|
18
|
-
- **React**:
|
|
19
|
-
- **TypeScript**:
|
|
17
|
+
- **Node.js**: v18.17+ or v20.11+ (LTS recommended)
|
|
18
|
+
- **React**: v18.x or v19.x
|
|
19
|
+
- **TypeScript**: v5.x (recommended)
|
|
20
20
|
|
|
21
21
|
## 🔗 Supported Versions
|
|
22
22
|
|
|
23
23
|
| Package | Supported Versions |
|
|
24
24
|
| ----------------- | ------------------ |
|
|
25
|
-
| React |
|
|
26
|
-
| React DOM |
|
|
25
|
+
| React | >=18 <20 |
|
|
26
|
+
| React DOM | >=18 <20 |
|
|
27
27
|
| React Hook Form | 7.x |
|
|
28
28
|
| Material-UI | 7.x |
|
|
29
29
|
| Material-UI Icons | 7.x |
|
|
@@ -36,105 +36,67 @@ This library uses **peer dependencies** to avoid version conflicts and reduce bu
|
|
|
36
36
|
|
|
37
37
|
### 🚀 Quick Install (Recommended)
|
|
38
38
|
|
|
39
|
-
Install the library
|
|
39
|
+
Install the library, then install only the core peer dependencies. Optional features (Rich Text, Session Timeout) can be added separately.
|
|
40
40
|
|
|
41
41
|
```bash
|
|
42
|
-
npm install tp-
|
|
43
|
-
|
|
44
|
-
|
|
42
|
+
npm install tp-react-elements-dev
|
|
43
|
+
# installs only core peers (no rich text, no idle timer)
|
|
44
|
+
npx install-tp-form-deps
|
|
45
45
|
|
|
46
|
-
|
|
46
|
+
# if you need Rich Text Editor
|
|
47
|
+
npx install-tp-form-deps --with-richtext
|
|
47
48
|
|
|
48
|
-
|
|
49
|
-
npm install
|
|
50
|
-
npx install-tp-form-deps
|
|
49
|
+
# or install optional peers manually
|
|
50
|
+
npm install jodit@^4.6.2 jodit-react@^5.2.19
|
|
51
51
|
```
|
|
52
52
|
|
|
53
|
-
|
|
53
|
+
## 🔍 Optimized Imports
|
|
54
54
|
|
|
55
|
-
|
|
55
|
+
To reduce bundle size, you can import only the components you need using subpath imports:
|
|
56
56
|
|
|
57
|
-
|
|
57
|
+
```js
|
|
58
|
+
// Import a specific component (top-level component folders only)
|
|
59
|
+
import { ModalField } from 'tp-react-elements-dev/components/ModalField';
|
|
58
60
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
```
|
|
61
|
+
// Import Form module shortcuts
|
|
62
|
+
import { RenderForm } from 'tp-react-elements-dev/form';
|
|
62
63
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
```bash
|
|
66
|
-
# Only install if you need session timeout functionality
|
|
67
|
-
npm install react-idle-timer@^5.7.2
|
|
64
|
+
// Import utilities
|
|
65
|
+
import * as Utils from 'tp-react-elements-dev/utils';
|
|
68
66
|
```
|
|
69
67
|
|
|
70
|
-
|
|
68
|
+
See our [Subpath Imports Guide](./docs/subpath-imports.md) for detailed instructions on optimizing your imports.
|
|
71
69
|
|
|
72
|
-
|
|
73
|
-
npm install tp-form-elements
|
|
74
|
-
```
|
|
70
|
+
### 📋 Manual Installation
|
|
75
71
|
|
|
76
|
-
|
|
72
|
+
#### Step 1: Install Required Dependencies (Core)
|
|
77
73
|
|
|
78
74
|
```bash
|
|
79
|
-
npm install
|
|
75
|
+
npm install react@^19.1.1 react-dom@^19.1.1 \
|
|
76
|
+
react-hook-form@^7.62.0 \
|
|
77
|
+
@mui/material@^7.3.1 @mui/icons-material@^7.3.1 \
|
|
78
|
+
@emotion/react@^11.14.0 @emotion/styled@^11.14.1 \
|
|
79
|
+
@mui/x-date-pickers@^8.10.2 \
|
|
80
|
+
@hookform/error-message@^2.0.1 @hookform/resolvers@^5.2.1 \
|
|
81
|
+
date-fns@^4.1.0 dayjs@^1.11.13 \
|
|
82
|
+
yup@^1.7.0 \
|
|
83
|
+
crypto-js@^4.2.0 file-saver@^2.0.5 xlsx-js-style@^1.2.0
|
|
80
84
|
```
|
|
81
85
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
If you're contributing to this library or setting up for development:
|
|
85
|
-
|
|
86
|
-
### Development Setup
|
|
86
|
+
#### Step 2: Optional Dependencies
|
|
87
87
|
|
|
88
88
|
```bash
|
|
89
|
-
#
|
|
90
|
-
|
|
91
|
-
cd form-elements
|
|
92
|
-
|
|
93
|
-
# Install all dependencies (including devDependencies)
|
|
94
|
-
npm install
|
|
89
|
+
# Rich Text Editor (optional)
|
|
90
|
+
npm install jodit@^4.6.2 jodit-react@^5.2.19
|
|
95
91
|
|
|
96
|
-
#
|
|
97
|
-
npm
|
|
98
|
-
|
|
99
|
-
# Run tests
|
|
100
|
-
npm test
|
|
101
|
-
|
|
102
|
-
# Build the library
|
|
103
|
-
npm run build
|
|
92
|
+
# Session timeout (optional)
|
|
93
|
+
npm install react-idle-timer@^5.7.2
|
|
104
94
|
```
|
|
105
95
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
- **`peerDependencies`**: Required by library consumers, must be installed separately
|
|
109
|
-
- **`devDependencies`**: Required for development, testing, and building the library
|
|
110
|
-
- **`dependencies`**: Empty (following library best practices)
|
|
111
|
-
|
|
112
|
-
### Why Peer Dependencies?
|
|
113
|
-
|
|
114
|
-
1. **Avoid Version Conflicts**: Prevents multiple versions of React, MUI, etc.
|
|
115
|
-
2. **Smaller Bundle Size**: No duplicate packages in consumer projects
|
|
116
|
-
3. **Version Control**: Users control which versions they use
|
|
117
|
-
4. **Industry Standard**: Same pattern used by MUI, React Hook Form, etc.
|
|
118
|
-
|
|
119
|
-
### ⚠️ Known Issues & Future Improvements
|
|
120
|
-
|
|
121
|
-
#### `DateRangePicker` Component Status
|
|
122
|
-
|
|
123
|
-
- **Current Status**: DateRangePicker component temporarily disabled
|
|
124
|
-
- **Reason**: Removed `mui-daterange-picker@1.0.5` due to React 18 compatibility issues
|
|
125
|
-
- **Impact**: DateRangePicker component will show a placeholder message
|
|
126
|
-
- **TODO**: Migrate to `@mui/x-date-pickers` DateRangePicker component for better React 18 support
|
|
127
|
-
- **Timeline**: Migration planned for next major version
|
|
128
|
-
|
|
129
|
-
**For Developers**: DateRangePicker will display a placeholder message until the migration is complete.
|
|
130
|
-
|
|
131
|
-
### 🔄 Updating Dependencies
|
|
132
|
-
|
|
133
|
-
When updating to a new version of the library:
|
|
96
|
+
#### Step 3: Install the Library
|
|
134
97
|
|
|
135
98
|
```bash
|
|
136
|
-
npm
|
|
137
|
-
npm run install-peers # Updates peer dependencies to compatible versions
|
|
99
|
+
npm install tp-react-elements-dev
|
|
138
100
|
```
|
|
139
101
|
|
|
140
102
|
## 🎯 Quick Start
|
|
@@ -144,8 +106,8 @@ import React from "react";
|
|
|
144
106
|
import { useForm } from "react-hook-form";
|
|
145
107
|
import { yupResolver } from "@hookform/resolvers/yup";
|
|
146
108
|
import * as yup from "yup";
|
|
147
|
-
import { Input } from "tp-
|
|
148
|
-
import { ThemeProvider } from "@mui/material/styles";
|
|
109
|
+
import { Input } from "tp-react-elements-dev";
|
|
110
|
+
import { ThemeProvider, createTheme } from "@mui/material/styles";
|
|
149
111
|
import CssBaseline from "@mui/material/CssBaseline";
|
|
150
112
|
|
|
151
113
|
const schema = yup.object({
|
|
@@ -163,7 +125,7 @@ function LoginForm() {
|
|
|
163
125
|
};
|
|
164
126
|
|
|
165
127
|
return (
|
|
166
|
-
<ThemeProvider theme={
|
|
128
|
+
<ThemeProvider theme={createTheme()}>
|
|
167
129
|
<CssBaseline />
|
|
168
130
|
<form onSubmit={handleSubmit(onSubmit)}>
|
|
169
131
|
<Input
|
|
@@ -191,116 +153,183 @@ function LoginForm() {
|
|
|
191
153
|
|
|
192
154
|
## 📋 Components
|
|
193
155
|
|
|
194
|
-
|
|
156
|
+
The library provides a comprehensive set of form components that integrate seamlessly with React Hook Form and Material-UI:
|
|
157
|
+
|
|
158
|
+
- **Input** - Text input fields with various types (text, email, password, etc.)
|
|
159
|
+
- **Select** - Single and multi-select dropdowns with autocomplete
|
|
160
|
+
- **DatePicker** - Calendar-based date selection
|
|
161
|
+
- **TimePicker** - Time selection with various formats
|
|
162
|
+
- **FileUpload** - File upload with preview and validation
|
|
163
|
+
- **RichTextEditor** - WYSIWYG editor for formatted text
|
|
164
|
+
- **Checkbox** - Single and group checkbox components
|
|
165
|
+
- **RadioGroup** - Radio button selection groups
|
|
166
|
+
- **Switch** - Toggle switches for boolean values
|
|
167
|
+
- **Form** - Container component with built-in validation
|
|
168
|
+
|
|
169
|
+
Refer to our Storybook documentation for detailed API documentation and examples.
|
|
170
|
+
|
|
171
|
+
## 🏗️ Best Practices for Code Structure and Organization
|
|
172
|
+
|
|
173
|
+
### Component Organization
|
|
174
|
+
|
|
175
|
+
- **Feature-Based Organization**: Group related components together in feature-based directories for better organization.
|
|
176
|
+
|
|
177
|
+
```
|
|
178
|
+
src/
|
|
179
|
+
features/
|
|
180
|
+
text-inputs/
|
|
181
|
+
date-pickers/
|
|
182
|
+
selects/
|
|
183
|
+
file-uploads/
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
- **Component Documentation**: Add JSDoc comments to all components and functions, describing their purpose, props, and usage examples.
|
|
187
|
+
|
|
188
|
+
- **Component Factories**: Implement factory patterns for similar components to reduce code duplication.
|
|
189
|
+
|
|
190
|
+
```typescript
|
|
191
|
+
// Example of a component factory
|
|
192
|
+
const createFormField = (FieldComponent) => {
|
|
193
|
+
return ({ name, control, label, ...props }) => (
|
|
194
|
+
<Controller
|
|
195
|
+
name={name}
|
|
196
|
+
control={control}
|
|
197
|
+
render={({ field, fieldState }) => (
|
|
198
|
+
<FieldComponent
|
|
199
|
+
{...field}
|
|
200
|
+
label={label}
|
|
201
|
+
error={!!fieldState.error}
|
|
202
|
+
helperText={fieldState.error?.message}
|
|
203
|
+
{...props}
|
|
204
|
+
/>
|
|
205
|
+
)}
|
|
206
|
+
/>
|
|
207
|
+
);
|
|
208
|
+
};
|
|
209
|
+
```
|
|
195
210
|
|
|
196
|
-
|
|
211
|
+
- **Barrel Exports**: Use barrel files (index.ts) to simplify imports for consumers.
|
|
197
212
|
|
|
198
|
-
|
|
199
|
-
<Input
|
|
200
|
-
name="email"
|
|
201
|
-
control={control}
|
|
202
|
-
label="Email Address"
|
|
203
|
-
type="email"
|
|
204
|
-
placeholder="your@email.com"
|
|
205
|
-
helpText="We'll never share your email"
|
|
206
|
-
required
|
|
207
|
-
fullWidth
|
|
208
|
-
/>
|
|
209
|
-
```
|
|
213
|
+
- **Naming Conventions**: Adopt consistent naming conventions across the codebase (PascalCase for components, camelCase for utilities).
|
|
210
214
|
|
|
211
|
-
|
|
215
|
+
## ⚡ Performance Optimization
|
|
212
216
|
|
|
213
|
-
-
|
|
214
|
-
- `control` - React Hook Form control object (optional for uncontrolled)
|
|
215
|
-
- `label` - Input label
|
|
216
|
-
- `type` - Input type (text, email, password, number, etc.)
|
|
217
|
-
- `placeholder` - Placeholder text
|
|
218
|
-
- `helpText` - Helper text shown below input
|
|
219
|
-
- `required` - Whether field is required
|
|
220
|
-
- `disabled` - Whether field is disabled
|
|
221
|
-
- `multiline` - Render as textarea
|
|
222
|
-
- `transform` - Transform function for input value
|
|
223
|
-
- All Material-UI TextField props are supported
|
|
217
|
+
- **Component Memoization**: Use React.memo for complex components to prevent unnecessary re-renders.
|
|
224
218
|
|
|
225
|
-
|
|
219
|
+
```typescript
|
|
220
|
+
const MemoizedFormField = React.memo(FormField, (prevProps, nextProps) => {
|
|
221
|
+
return prevProps.value === nextProps.value && prevProps.error === nextProps.error;
|
|
222
|
+
});
|
|
223
|
+
```
|
|
226
224
|
|
|
227
|
-
|
|
225
|
+
- **Code Splitting**: Implement dynamic imports for larger components to reduce initial load time.
|
|
228
226
|
|
|
229
|
-
```
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
palette: {
|
|
234
|
-
primary: {
|
|
235
|
-
main: "#your-primary-color",
|
|
236
|
-
},
|
|
237
|
-
},
|
|
238
|
-
});
|
|
227
|
+
```typescript
|
|
228
|
+
// Use dynamic imports for complex components
|
|
229
|
+
const RichTextEditor = React.lazy(() => import('./RichTextEditor'));
|
|
230
|
+
```
|
|
239
231
|
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
232
|
+
- **Tree-Shaking Friendly Exports**: Ensure all exports are compatible with tree-shaking.
|
|
233
|
+
|
|
234
|
+
- **Debounced Validation**: Implement debounced validation for fields with expensive validation operations.
|
|
235
|
+
|
|
236
|
+
```typescript
|
|
237
|
+
const debouncedValidate = useCallback(
|
|
238
|
+
debounce((value) => validateField(value), 300),
|
|
239
|
+
[]
|
|
245
240
|
);
|
|
246
|
-
|
|
247
|
-
```
|
|
241
|
+
```
|
|
248
242
|
|
|
249
|
-
|
|
243
|
+
- **Virtual Rendering**: For components that render large lists, implement virtualization to improve performance.
|
|
250
244
|
|
|
251
|
-
|
|
245
|
+
- **Context Optimization**: Split context providers to minimize re-renders when state changes.
|
|
252
246
|
|
|
253
|
-
```
|
|
254
|
-
|
|
255
|
-
|
|
247
|
+
```typescript
|
|
248
|
+
// Split form context into smaller, focused contexts
|
|
249
|
+
const FormValuesContext = createContext({});
|
|
250
|
+
const FormErrorsContext = createContext({});
|
|
251
|
+
```
|
|
256
252
|
|
|
257
|
-
|
|
258
|
-
npm run build:lib:esm # ES Module build with TypeScript declarations
|
|
259
|
-
npm run build:lib:cjs # CommonJS build only
|
|
260
|
-
npm run build:types # Generate TypeScript declarations only
|
|
253
|
+
## 📚 Documentation and Usability
|
|
261
254
|
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
255
|
+
- **Interactive Examples**: Enhance Storybook documentation with interactive examples for common use cases.
|
|
256
|
+
|
|
257
|
+
- **Component Playground**: Create an online playground for experimenting with components in real-time.
|
|
258
|
+
|
|
259
|
+
- **Migration Guides**: Provide comprehensive migration guides for major version updates.
|
|
266
260
|
|
|
267
|
-
|
|
261
|
+
- **Enhanced Type Definitions**: Improve TypeScript definitions with descriptive comments and examples.
|
|
268
262
|
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
263
|
+
```typescript
|
|
264
|
+
/**
|
|
265
|
+
* Props for the Input component
|
|
266
|
+
* @example
|
|
267
|
+
* <Input
|
|
268
|
+
* name="email"
|
|
269
|
+
* control={control}
|
|
270
|
+
* label="Email Address"
|
|
271
|
+
* required
|
|
272
|
+
* />
|
|
273
|
+
*/
|
|
274
|
+
export interface InputProps {
|
|
275
|
+
/** Field name in the form */
|
|
276
|
+
name: string;
|
|
277
|
+
/** Form control from useForm hook */
|
|
278
|
+
control: Control<any>;
|
|
279
|
+
// ... other props
|
|
280
|
+
}
|
|
281
|
+
```
|
|
273
282
|
|
|
274
|
-
|
|
283
|
+
- **Theme Customization Guide**: Document how to customize the theme to match brand guidelines.
|
|
284
|
+
|
|
285
|
+
- **Accessibility Documentation**: Add specific documentation about accessibility features and how to maintain accessibility when customizing components.
|
|
286
|
+
|
|
287
|
+
- **Performance Best Practices**: Document performance considerations for using the library in large applications.
|
|
288
|
+
|
|
289
|
+
## 🔧 For Library Developers
|
|
290
|
+
|
|
291
|
+
If you're contributing to this library or setting up for development:
|
|
275
292
|
|
|
276
|
-
|
|
293
|
+
### Development Setup
|
|
277
294
|
|
|
278
295
|
```bash
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
296
|
+
# Clone the repository
|
|
297
|
+
git clone https://github.com/your-office/form-elements.git
|
|
298
|
+
cd form-elements
|
|
299
|
+
|
|
300
|
+
# Install all dependencies (including devDependencies)
|
|
301
|
+
npm install
|
|
302
|
+
|
|
303
|
+
# Start development server
|
|
304
|
+
npm run dev
|
|
305
|
+
|
|
306
|
+
# Run tests
|
|
307
|
+
npm test
|
|
308
|
+
|
|
309
|
+
# Build the library
|
|
310
|
+
npm run build
|
|
282
311
|
```
|
|
283
312
|
|
|
284
|
-
|
|
313
|
+
### Dependency Structure
|
|
285
314
|
|
|
286
|
-
-
|
|
287
|
-
-
|
|
288
|
-
-
|
|
315
|
+
- **`peerDependencies`**: Required by library consumers, must be installed separately
|
|
316
|
+
- **`devDependencies`**: Required for development, testing, and building the library
|
|
317
|
+
- **`dependencies`**: Empty (following library best practices)
|
|
289
318
|
|
|
290
|
-
|
|
319
|
+
### Why Peer Dependencies?
|
|
291
320
|
|
|
292
|
-
1.
|
|
293
|
-
2.
|
|
294
|
-
3.
|
|
295
|
-
4.
|
|
296
|
-
5. Submit a pull request
|
|
321
|
+
1. **Avoid Version Conflicts**: Prevents multiple versions of React, MUI, etc.
|
|
322
|
+
2. **Smaller Bundle Size**: No duplicate packages in consumer projects
|
|
323
|
+
3. **Version Control**: Users control which versions they use
|
|
324
|
+
4. **Industry Standard**: Same pattern used by MUI, React Hook Form, etc.
|
|
297
325
|
|
|
298
|
-
|
|
326
|
+
### Reducing “Wide” Peer Dependencies
|
|
299
327
|
|
|
300
|
-
|
|
328
|
+
- Make non-core peers optional: Rich text (`jodit`, `jodit-react`) and session timeout (`react-idle-timer`) are optional and not installed by default via `install-tp-form-deps`.
|
|
329
|
+
- Feature subpackages (advanced): Move heavy features into dedicated entry points (e.g., `tp-react-elements-dev/richtext`) with their own peer sets.
|
|
330
|
+
- Thin wrappers (advanced): Provide adapters that lazy-load optional features so apps that don’t use them never import those packages.
|
|
331
|
+
- Clear installer flags: Use `--with-richtext` and `--with-idle` (or `--all`) to explicitly include optional peers only when needed.
|
|
301
332
|
|
|
302
|
-
##
|
|
333
|
+
## 📝 License
|
|
303
334
|
|
|
304
|
-
|
|
305
|
-
- File issues on [GitHub](https://github.com/your-office/form-elements/issues)
|
|
306
|
-
- Internal Slack: #form-library-support
|
|
335
|
+
MIT
|