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
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
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
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
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
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
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
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
@@ -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
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
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
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,
onBlur: PropTypes.func,
onFocus: PropTypes.func,
onClick: PropTypes.func,
onKeyDown: PropTypes.func,
onChange: PropTypes.func,
containerProps: PropTypes.object,
listboxStyle: PropTypes.object,
listboxClassName: PropTypes.string,
highlightReapeating: PropTypes.bool,
highlightStyle: PropTypes.object,
highlightClassName: PropTypes.string,
disableShowOnFocus: PropTypes.bool,
omitKeys: PropTypes.arrayOf(PropTypes.string),
value: PropTypes.string,
defaultValue: PropTypes.string,
beforeResultsChildren: PropTypes.node,
afterResultsChildren: PropTypes.node,
};
} catch (e) {}
}
18 changes: 0 additions & 18 deletions packages/autocomplete/src/HighlightedResult.tsx
Expand Up @@ -102,21 +102,3 @@ export function HighlightedResult({
</>
);
}

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

HighlightedResult.propTypes = {
id: PropTypes.string,
index: PropTypes.number,
value: PropTypes.string.isRequired,
style: PropTypes.object,
className: PropTypes.string,
children: PropTypes.node,
enabled: PropTypes.bool,
repeatable: PropTypes.bool,
};
} catch (e) {}
}
3 changes: 0 additions & 3 deletions packages/avatar/package.json
Expand Up @@ -41,9 +41,6 @@
"peerDependencies": {
"react": ">= 16.14"
},
"optionalDependencies": {
"prop-types": ">= 15.6"
},
"publishConfig": {
"access": "public"
}
Expand Down
19 changes: 0 additions & 19 deletions packages/avatar/src/Avatar.tsx
Expand Up @@ -101,22 +101,3 @@ export const Avatar = forwardRef<HTMLSpanElement, AvatarProps>(function Avatar(
</span>
);
});

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

Avatar.propTypes = {
alt: PropTypes.string,
src: PropTypes.string,
color: PropTypes.string,
className: PropTypes.string,
children: PropTypes.node,
// Note: The MDN website has a lot more values, but this is what Typescript
// says is valid at the time of writing this
referrerPolicy: PropTypes.oneOf(["no-referrer", "origin", "unsafe-url"]),
imgProps: PropTypes.object,
};
} catch (e) {}
}
3 changes: 0 additions & 3 deletions packages/badge/package.json
Expand Up @@ -45,9 +45,6 @@
"react": ">= 16.14",
"react-dom": ">= 16.14"
},
"optionalDependencies": {
"prop-types": ">= 15.6"
},
"publishConfig": {
"access": "public"
}
Expand Down
15 changes: 0 additions & 15 deletions packages/badge/src/Badge.tsx
Expand Up @@ -63,18 +63,3 @@ export const Badge = forwardRef<HTMLSpanElement, BadgeProps>(function Badge(
</span>
);
});

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

Badge.propTypes = {
id: PropTypes.string.isRequired,
theme: PropTypes.oneOf(["primary", "secondary", "default", "clear"]),
className: PropTypes.string,
children: PropTypes.node,
disableNullOnZero: PropTypes.bool,
};
} catch (e) {}
}
1 change: 0 additions & 1 deletion packages/badge/src/BadgeContainer.tsx
@@ -1,4 +1,3 @@
/* eslint-disable react/prop-types */
import { forwardRef, HTMLAttributes, ReactElement, Ref } from "react";
import cn from "classnames";
import { bem } from "@react-md/utils";
Expand Down

0 comments on commit 2637a6f

Please sign in to comment.