Skip to content

Commit

Permalink
refactor(react-formio): remove props-type dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
Romakita committed Dec 29, 2024
1 parent b719151 commit 43742f1
Show file tree
Hide file tree
Showing 18 changed files with 23 additions and 168 deletions.
2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@
"@types/jest": "27.0.2",
"@types/lodash": "4.14.168",
"@types/node": "^20.14.8",
"@types/prop-types": "^15.7.5",
"@types/react-dnd": "3.0.2",
"@types/react-dnd-html5-backend": "3.0.2",
"@typescript-eslint/eslint-plugin": "8.18.2",
Expand Down Expand Up @@ -116,7 +115,6 @@
"postcss-nested": "7.0.2",
"postcss-normalize": "13.0.1",
"prettier": "3.4.2",
"prop-types": "^15.8.1",
"react": "18.3.1",
"react-dom": "18.3.1",
"rimraf": "^3.0.2",
Expand Down
4 changes: 1 addition & 3 deletions packages/integration/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,12 @@
},
"dependencies": {
"classnames": "^2.3.1",
"eventemitter2": "^6.4.3",
"prop-types": "15.8.1"
"eventemitter2": "^6.4.3"
},
"peerDependencies": {
"@formio/choices.js": ">=9.0.1",
"formiojs": ">=4.0.0",
"lodash": ">=4.17.20",
"prop-types": ">=15.7.2",
"react": ">=16.14.0",
"react-dnd": ">=16.0.1",
"react-dnd-html5-backend": ">=16.0.1",
Expand Down
7 changes: 2 additions & 5 deletions packages/react-formio-container/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
"file-saver": "^2.0.5",
"formiojs": "^4.21.6",
"lodash": "^4.17.21",
"prop-types": "^15.8.1",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-is": "^17.0.1",
Expand Down Expand Up @@ -71,9 +70,6 @@
"lodash": {
"optional": false
},
"prop-types": {
"optional": false
},
"react": {
"optional": false
},
Expand Down Expand Up @@ -101,5 +97,6 @@
"tooltip.js": {
"optional": false
}
}
},
"dependencies": {}
}
1 change: 0 additions & 1 deletion packages/react-formio-stores/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
"@formio/choices.js": ">=9.0.1",
"formiojs": ">=4.0.0",
"lodash": ">=4.17.20",
"prop-types": ">=15.7.2",
"react": ">=16.14.0",
"react-dom": ">=16.14.0",
"react-table": ">=7.6.3",
Expand Down
4 changes: 1 addition & 3 deletions packages/react-formio/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,13 @@
},
"dependencies": {
"classnames": "^2.3.1",
"eventemitter2": "^6.4.3",
"prop-types": "15.8.1"
"eventemitter2": "^6.4.3"
},
"peerDependencies": {
"@formio/choices.js": ">=9.0.1",
"formiojs": ">=4.0.0",
"lodash": ">=4.17.20",
"moment": ">=2.30.1",
"prop-types": ">=15.7.2",
"react": ">=16.14.0",
"react-dnd": ">=16.0.1",
"react-dnd-html5-backend": ">=16.0.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import Components from "formiojs/components/Components";
import FormioFormBuilder from "formiojs/FormBuilder";
import cloneDeep from "lodash/cloneDeep";
import noop from "lodash/noop";
import PropTypes from "prop-types";
import { Component } from "react";

import { callLast } from "../../utils/callLast";
Expand Down Expand Up @@ -79,23 +78,6 @@ export class FormBuilder extends Component<FormBuilderProps, any> {
onDestroy: noop
};

static propTypes = {
components: PropTypes.array,
display: PropTypes.string,
options: PropTypes.object,
onChange: PropTypes.func,
onAddComponent: PropTypes.func,
onUpdateComponent: PropTypes.func,
onRemoveComponent: PropTypes.func,
onSaveComponent: PropTypes.func,
onCancelComponent: PropTypes.func,
onMoveComponent: PropTypes.func,
onEditComponent: PropTypes.func,
onEditJson: PropTypes.func,
onCopyComponent: PropTypes.func,
onPasteComponent: PropTypes.func
};

private elRef: any;
private builderRef: any;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import PropTypes from "prop-types";
import { ReactElement } from "react";

import { useTooltip } from "../../hooks/useTooltip";
Expand All @@ -11,11 +10,11 @@ export interface FormEditCTAsProps extends Record<string, unknown> {
hasUndo?: boolean;
hasRedo?: boolean;
disabled?: boolean;
onCopy?: Function;
onSubmit?: Function;
onReset?: Function;
onUndo?: Function;
onRedo?: Function;
onCopy?: () => void;
onSubmit?: () => void;
onReset?: () => void;
onUndo?: () => void;
onRedo?: () => void;
}

export function FormEditCTAs({
Expand Down Expand Up @@ -93,14 +92,3 @@ export function FormEditCTAs({
</div>
);
}

FormEditCTAs.propTypes = {
saveText: PropTypes.string,
options: PropTypes.object,
hasUndo: PropTypes.bool,
hasRedo: PropTypes.bool,
disabled: PropTypes.bool,
onCopy: PropTypes.func,
onSubmit: PropTypes.func,
onReset: PropTypes.func
};
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import PropTypes from "prop-types";

import { FormOptions } from "../../interfaces/FormOptions";
import { FormBuilder } from "../form-builder/formBuilder.component";
import { FormEditCTAs } from "./formCtas.component";
Expand Down Expand Up @@ -48,12 +46,3 @@ export function FormEdit(props: FormEditProps) {
</div>
);
}

FormEdit.propTypes = {
form: PropTypes.object.isRequired,
options: PropTypes.object,
typeChoices: PropTypes.array,
displayChoices: PropTypes.array,
enableTags: PropTypes.bool,
onSubmit: PropTypes.func
};
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import PropTypes from "prop-types";
import { ReactElement } from "react";

import { FormSchema } from "../../interfaces/FormSchema";
Expand Down Expand Up @@ -101,12 +100,3 @@ export function FormParameters({
</div>
);
}

FormParameters.propTypes = {
onChange: PropTypes.func,
form: PropTypes.object,
enableTags: PropTypes.bool,
typeChoices: PropTypes.array,
displayChoices: PropTypes.array,
className: PropTypes.string
};
52 changes: 0 additions & 52 deletions packages/react-formio/src/components/form/form.component.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { Components } from "formiojs";
import AllComponents from "formiojs/components";
import PropTypes from "prop-types";

import { useForm, UseFormHookProps } from "./useForm.hook";

Expand All @@ -19,54 +18,3 @@ export function Form<Data = any>(props: Partial<FormProps<Data>>) {

return <div data-testid={`formioContainer${props.name || ""}`} ref={element} className={props.className} />;
}

Form.propTypes = {
name: PropTypes.string,
className: PropTypes.string,
/**
*
*/
src: PropTypes.string,
/**
* url to fetch form
*/
url: PropTypes.string,
/**
* Raw form object
*/
form: PropTypes.object,
/**
* Data submission
*/
submission: PropTypes.object,
/**
* Configuration option
*/
options: PropTypes.shape({
readOnly: PropTypes.bool,
noAlerts: PropTypes.bool,
i18n: PropTypes.any,
template: PropTypes.string,
saveDraft: PropTypes.bool,
hooks: PropTypes.any
}),
onPrevPage: PropTypes.func,
onNextPage: PropTypes.func,
onCancel: PropTypes.func,
onChange: PropTypes.func,
onCustomEvent: PropTypes.func,
onComponentChange: PropTypes.func,
onSubmit: PropTypes.func,
onAsyncSubmit: PropTypes.func,
onSubmitDone: PropTypes.func,
onFormLoad: PropTypes.func,
onError: PropTypes.func,
onRender: PropTypes.func,
onAttach: PropTypes.func,
onBuild: PropTypes.func,
onFocus: PropTypes.func,
onBlur: PropTypes.func,
onInitialized: PropTypes.func,
onFormReady: PropTypes.func,
formioform: PropTypes.any
};
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import Choices from "@formio/choices.js";
import uniq from "lodash/uniq";
import PropTypes from "prop-types";
import { useEffect, useRef } from "react";

import { FormControl, FormControlProps } from "../form-control/formControl.component";
Expand Down Expand Up @@ -48,11 +47,3 @@ export function InputTags({ name, value = [], label, onChange, required, descrip
</FormControl>
);
}

InputTags.propTypes = {
label: PropTypes.string,
name: PropTypes.string.isRequired,
value: PropTypes.array,
required: PropTypes.bool,
onChange: PropTypes.func
};
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import classnames from "classnames";
import PropTypes from "prop-types";
import { useEffect, useMemo, useState } from "react";

import { callLast } from "../../utils/callLast";
Expand Down Expand Up @@ -71,15 +70,3 @@ export function InputText<T = any>({
</FormControl>
);
}

InputText.propTypes = {
label: PropTypes.string,
type: PropTypes.string,
name: PropTypes.string.isRequired,
value: PropTypes.any,
size: PropTypes.string,
required: PropTypes.bool,
onChange: PropTypes.func,
prefix: PropTypes.any,
suffix: PropTypes.any
};
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import classnames from "classnames";
import PropTypes from "prop-types";
import { PropsWithChildren } from "react";

import { iconClass } from "../../utils/iconClass";
Expand All @@ -26,10 +25,3 @@ export function Loader({ isActive, color = "blue", icon = "radio-circle", classN
}
return null;
}

Loader.propTypes = {
isActive: PropTypes.bool,
icon: PropTypes.string,
color: PropTypes.string,
className: PropTypes.string
};
3 changes: 2 additions & 1 deletion packages/redux-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,6 @@
"peerDependencies": {
"react": "^18.3.1",
"redux": "^4.0.5"
}
},
"dependencies": {}
}
4 changes: 3 additions & 1 deletion packages/tailwind-formio/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,7 @@
"last 1 firefox version",
"last 1 safari version"
]
}
},
"dependencies": {},
"peerDependencies": {}
}
5 changes: 4 additions & 1 deletion tools/typescript/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,8 @@
"main": "index.js",
"exports": {
"./tsconfig.web.json": "./tsconfig.web.json"
}
},
"dependencies": {},
"devDependencies": {},
"peerDependencies": {}
}
4 changes: 3 additions & 1 deletion tools/vitest/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,7 @@
},
"scripts": {
"generate": "node index.js"
}
},
"dependencies": {},
"peerDependencies": {}
}
Loading

0 comments on commit 43742f1

Please sign in to comment.