Skip to content

Commit

Permalink
chore(react-md): Remove prop-types package and usage
Browse files Browse the repository at this point in the history
BREAKING CHANGE: There will no longer be run-time prop validation with
the `prop-types` package.
  • Loading branch information
mlaursen committed Nov 24, 2021
1 parent 30cf056 commit 2637a6f
Show file tree
Hide file tree
Showing 175 changed files with 3 additions and 4,021 deletions.
3 changes: 0 additions & 3 deletions packages/alert/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,6 @@
"react": ">= 16.14",
"react-dom": ">= 16.14"
},
"optionalDependencies": {
"prop-types": ">= 15.6"
},
"publishConfig": {
"access": "public"
}
Expand Down
14 changes: 0 additions & 14 deletions packages/alert/src/MessageQueue.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,17 +78,3 @@ export function MessageQueue<M extends ToastMessage = ToastMessage>({
</AddMessageContext.Provider>
);
}

/* istanbul ignore next */
if (process.env.NODE_ENV !== "production") {
try {
const PropTypes = require("prop-types");
MessageQueue.propTypes = {
timeout: PropTypes.number,
duplicates: PropTypes.oneOf(["allow", "restart", "prevent"]),
defaultQueue: PropTypes.array,
onActionClick: PropTypes.func,
children: PropTypes.node.isRequired,
};
} catch (e) {}
}
17 changes: 0 additions & 17 deletions packages/alert/src/Snackbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,20 +56,3 @@ export const Snackbar = forwardRef<HTMLDivElement, SnackbarProps>(
);
}
);

/* istanbul ignore next */
if (process.env.NODE_ENV !== "production") {
try {
const PropTypes = require("prop-types");

Snackbar.propTypes = {
id: PropTypes.string.isRequired,
className: PropTypes.string,
children: PropTypes.node,
position: PropTypes.oneOf(["bottom", "top"]),
portal: PropTypes.bool,
portalInto: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
portalIntoId: PropTypes.string,
};
} catch (e) {}
}
42 changes: 0 additions & 42 deletions packages/alert/src/Toast.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,45 +102,3 @@ export const Toast = forwardRef<HTMLDivElement, ToastProps>(function Toast(
</CSSTransition>
);
});

/* istanbul ignore next */
if (process.env.NODE_ENV !== "production") {
try {
const PropTypes = require("prop-types");

Toast.propTypes = {
visible: PropTypes.bool.isRequired,
action: PropTypes.element,
stacked: PropTypes.bool,
twoLines: PropTypes.bool,
className: PropTypes.string,
classNames: PropTypes.oneOfType([
PropTypes.string,
PropTypes.shape({
appear: PropTypes.string,
appearActive: PropTypes.string,
enter: PropTypes.string,
enterActive: PropTypes.string,
enterDone: PropTypes.string,
exit: PropTypes.string,
exitActive: PropTypes.string,
exitDone: PropTypes.string,
}),
]),
timeout: PropTypes.oneOfType([
PropTypes.number,
PropTypes.shape({
enter: PropTypes.number,
exit: PropTypes.number,
}),
]),
children: PropTypes.node,
onEnter: PropTypes.func,
onEntering: PropTypes.func,
onEntered: PropTypes.func,
onExit: PropTypes.func,
onExiting: PropTypes.func,
onExited: PropTypes.func,
};
} catch (e) {}
}
3 changes: 0 additions & 3 deletions packages/app-bar/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,6 @@
"react": ">= 16.14",
"react-dom": ">= 16.14"
},
"optionalDependencies": {
"prop-types": ">= 15.6"
},
"publishConfig": {
"access": "public"
}
Expand Down
30 changes: 0 additions & 30 deletions packages/app-bar/src/AppBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -165,33 +165,3 @@ export const AppBar = forwardRef<HTMLDivElement, AppBarProps>(function AppBar(
</ParentContext.Provider>
);
});

/* istanbul ignore next */
if (process.env.NODE_ENV !== "production") {
try {
const PropTypes = require("prop-types");

AppBar.propTypes = {
className: PropTypes.string,
component: PropTypes.oneOfType([
PropTypes.string,
PropTypes.func,
PropTypes.object,
]),
height: PropTypes.oneOf([
"none",
"normal",
"dense",
"prominent",
"prominent-dense",
]),
flexWrap: PropTypes.bool,
children: PropTypes.node,
fixed: PropTypes.bool,
fixedPosition: PropTypes.oneOf(["top", "bottom"]),
fixedElevation: PropTypes.bool,
inheritColor: PropTypes.bool,
theme: PropTypes.oneOf(["primary", "secondary", "default", "clear"]),
};
} catch (e) {}
}
29 changes: 0 additions & 29 deletions packages/app-bar/src/AppBarAction.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,32 +46,3 @@ export const AppBarAction = forwardRef<HTMLButtonElement, AppBarActionProps>(
);
}
);

/* istanbul ignore next */
if (process.env.NODE_ENV !== "production") {
try {
const PropTypes = require("prop-types");

AppBarAction.propTypes = {
className: PropTypes.string,
children: PropTypes.node,
first: PropTypes.bool,
last: PropTypes.bool,
theme: PropTypes.oneOf([
"primary",
"secondary",
"warning",
"error",
"clear",
]),
buttonType: PropTypes.oneOf(["text", "icon"]),
floating: PropTypes.oneOf([
"top-left",
"top-right",
"bottom-left",
"bottom-right",
]),
inheritColor: PropTypes.bool,
};
} catch (e) {}
}
1 change: 0 additions & 1 deletion packages/app-bar/src/AppBarNav.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable react/prop-types */
import { forwardRef } from "react";
import cn from "classnames";
import { Button, ButtonProps } from "@react-md/button";
Expand Down
15 changes: 0 additions & 15 deletions packages/app-bar/src/AppBarTitle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,18 +57,3 @@ export const AppBarTitle = forwardRef<HTMLHeadingElement, AppBarTitleProps>(
);
}
);

/* istanbul ignore next */
if (process.env.NODE_ENV !== "production") {
try {
const PropTypes = require("prop-types");

AppBarTitle.propTypes = {
className: PropTypes.string,
children: PropTypes.node,
keyline: PropTypes.bool,
noWrap: PropTypes.bool,
inheritColor: PropTypes.bool,
};
} catch (e) {}
}
3 changes: 0 additions & 3 deletions packages/autocomplete/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,6 @@
"react": ">= 16.14",
"react-dom": ">= 16.14"
},
"optionalDependencies": {
"prop-types": ">= 15.6"
},
"publishConfig": {
"access": "public"
}
Expand Down
92 changes: 0 additions & 92 deletions packages/autocomplete/src/AutoComplete.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -221,95 +221,3 @@ export const AutoComplete = forwardRef<HTMLInputElement, AutoCompleteProps>(
);
}
);

/* istanbul ignore next */
if (process.env.NODE_ENV !== "production") {
try {
const PropTypes = require("prop-types");

AutoComplete.propTypes = {
id: PropTypes.string.isRequired,
data: PropTypes.arrayOf(
PropTypes.oneOfType([PropTypes.string, PropTypes.object])
).isRequired,
filter: PropTypes.oneOfType([
PropTypes.oneOf(["none", "fuzzy", "case-insensitive"]),
PropTypes.func,
]),
filterOptions: PropTypes.object,
filterOnNoValue: PropTypes.bool,
labelKey: PropTypes.string,
valueKey: PropTypes.string,
getResultId: PropTypes.func,
getResultLabel: PropTypes.func,
getResultValue: PropTypes.func,
highlight: PropTypes.bool,
autoComplete: PropTypes.oneOf(["none", "inline", "list", "both"]),
onAutoComplete: PropTypes.func,
clearOnAutoComplete: PropTypes.bool,
portal: PropTypes.bool,
portalInto: PropTypes.oneOfType([
PropTypes.func,
PropTypes.string,
PropTypes.object,
]),
portalIntoId: PropTypes.string,
anchor: PropTypes.shape({
x: PropTypes.oneOf([
"inner-left",
"inner-right",
"center",
"left",
"right",
]),
y: PropTypes.oneOf(["above", "below", "center", "top", "bottom"]),
}),
listboxWidth: PropTypes.oneOf(["auto", "equal", "min"]),
vwMargin: PropTypes.number,
vhMargin: PropTypes.number,
xMargin: PropTypes.number,
yMargin: PropTypes.number,
transformOrigin: PropTypes.bool,
preventOverlap: PropTypes.bool,
disableSwapping: PropTypes.bool,
disableVHBounds: PropTypes.bool,
closeOnResize: PropTypes.bool,
closeOnScroll: PropTypes.bool,
style: PropTypes.object,
className: PropTypes.string,
inputStyle: PropTypes.object,
inputClassName: PropTypes.string,
labelStyle: PropTypes.object,
labelClassName: PropTypes.string,
label: PropTypes.node,
theme: PropTypes.oneOf(["none", "underline", "filled", "outline"]),
dense: PropTypes.bool,
error: PropTypes.bool,
inline: PropTypes.bool,
disabled: PropTypes.bool,
placeholder: PropTypes.string,
underlineDirection: PropTypes.oneOf(["left", "center", "right"]),
leftChildren: PropTypes.node,
rightChildren: PropTypes.node,
isLeftAddon: PropTypes.bool,
isRightAddon: PropTypes.bool,