diff --git a/packages/netlify-cms-backend-bitbucket/src/AuthenticationPage.js b/packages/netlify-cms-backend-bitbucket/src/AuthenticationPage.js index d14d5113..3f7fd729 100644 --- a/packages/netlify-cms-backend-bitbucket/src/AuthenticationPage.js +++ b/packages/netlify-cms-backend-bitbucket/src/AuthenticationPage.js @@ -12,6 +12,9 @@ export default class BitbucketAuthenticationPage extends React.Component { static propTypes = { onLogin: PropTypes.func.isRequired, inProgress: PropTypes.bool, + base_url: PropTypes.string, + siteId: PropTypes.string, + authEndpoint: PropTypes.string, }; state = {}; diff --git a/packages/netlify-cms-backend-git-gateway/src/AuthenticationPage.js b/packages/netlify-cms-backend-git-gateway/src/AuthenticationPage.js index be967c6f..3982abf6 100644 --- a/packages/netlify-cms-backend-git-gateway/src/AuthenticationPage.js +++ b/packages/netlify-cms-backend-git-gateway/src/AuthenticationPage.js @@ -99,6 +99,7 @@ export default class GitGatewayAuthenticationPage extends React.Component { static propTypes = { onLogin: PropTypes.func.isRequired, inProgress: PropTypes.bool.isRequired, + error: PropTypes.node, }; state = { email: '', password: '', errors: {} }; diff --git a/packages/netlify-cms-backend-github/src/AuthenticationPage.js b/packages/netlify-cms-backend-github/src/AuthenticationPage.js index e8ff0577..b88faec4 100644 --- a/packages/netlify-cms-backend-github/src/AuthenticationPage.js +++ b/packages/netlify-cms-backend-github/src/AuthenticationPage.js @@ -1,5 +1,6 @@ import React from 'react'; import PropTypes from 'prop-types'; +import ImmutablePropTypes from 'react-immutable-proptypes'; import styled from 'react-emotion'; import { NetlifyAuthenticator } from 'netlify-cms-lib-auth'; import { AuthenticationPage, Icon } from 'netlify-cms-ui-default'; @@ -15,6 +16,8 @@ export default class GitHubAuthenticationPage extends React.Component { base_url: PropTypes.string, siteId: PropTypes.string, authEndpoint: PropTypes.string, + config: ImmutablePropTypes.map, + clearHash: PropTypes.function, }; state = {}; diff --git a/packages/netlify-cms-backend-gitlab/src/AuthenticationPage.js b/packages/netlify-cms-backend-gitlab/src/AuthenticationPage.js index b4a4761f..a049ed07 100644 --- a/packages/netlify-cms-backend-gitlab/src/AuthenticationPage.js +++ b/packages/netlify-cms-backend-gitlab/src/AuthenticationPage.js @@ -1,5 +1,6 @@ import React from 'react'; import PropTypes from 'prop-types'; +import ImmutablePropTypes from 'react-immutable-proptypes'; import styled from 'react-emotion'; import { NetlifyAuthenticator, ImplicitAuthenticator } from 'netlify-cms-lib-auth'; import { AuthenticationPage, Icon } from 'netlify-cms-ui-default'; @@ -12,6 +13,11 @@ export default class GitLabAuthenticationPage extends React.Component { static propTypes = { onLogin: PropTypes.func.isRequired, inProgress: PropTypes.bool, + base_url: PropTypes.string, + siteId: PropTypes.string, + authEndpoint: PropTypes.string, + config: ImmutablePropTypes.map, + clearHash: PropTypes.function, }; state = {}; diff --git a/packages/netlify-cms-core/src/components/App/App.js b/packages/netlify-cms-core/src/components/App/App.js index ee702482..d75bcbdc 100644 --- a/packages/netlify-cms-core/src/components/App/App.js +++ b/packages/netlify-cms-core/src/components/App/App.js @@ -59,6 +59,7 @@ class App extends React.Component { isFetching: PropTypes.bool.isRequired, publishMode: PropTypes.oneOf([SIMPLE, EDITORIAL_WORKFLOW]), siteId: PropTypes.string, + openMediaLibrary: PropTypes.func.isRequired, }; static configError(config) { diff --git a/packages/netlify-cms-core/src/components/App/Header.js b/packages/netlify-cms-core/src/components/App/Header.js index c56d4e73..609514f0 100644 --- a/packages/netlify-cms-core/src/components/App/Header.js +++ b/packages/netlify-cms-core/src/components/App/Header.js @@ -105,6 +105,8 @@ export default class Header extends React.Component { collections: ImmutablePropTypes.orderedMap.isRequired, onCreateEntryClick: PropTypes.func.isRequired, onLogoutClick: PropTypes.func.isRequired, + openMediaLibrary: PropTypes.func.isRequired, + hasWorkflow: PropTypes.bool.isRequired, displayUrl: PropTypes.string, }; diff --git a/packages/netlify-cms-core/src/components/Collection/Collection.js b/packages/netlify-cms-core/src/components/Collection/Collection.js index 3c659cc0..198f5b46 100644 --- a/packages/netlify-cms-core/src/components/Collection/Collection.js +++ b/packages/netlify-cms-core/src/components/Collection/Collection.js @@ -1,4 +1,5 @@ import React from 'react'; +import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; import styled from 'react-emotion'; import { connect } from 'react-redux'; @@ -20,6 +21,9 @@ const CollectionMain = styled.main` class Collection extends React.Component { static propTypes = { + searchTerm: PropTypes.string, + collectionName: PropTypes.string, + isSearchResults: PropTypes.bool, collection: ImmutablePropTypes.map.isRequired, collections: ImmutablePropTypes.orderedMap.isRequired, }; diff --git a/packages/netlify-cms-core/src/components/Collection/CollectionTop.js b/packages/netlify-cms-core/src/components/Collection/CollectionTop.js index 71893271..6704301e 100644 --- a/packages/netlify-cms-core/src/components/Collection/CollectionTop.js +++ b/packages/netlify-cms-core/src/components/Collection/CollectionTop.js @@ -105,7 +105,10 @@ const CollectionTop = ({ CollectionTop.propTypes = { collectionLabel: PropTypes.string.isRequired, + collectionLabelSingular: PropTypes.string, collectionDescription: PropTypes.string, + viewStyle: PropTypes.oneOf([VIEW_STYLE_LIST, VIEW_STYLE_GRID]).isRequired, + onChangeViewStyle: PropTypes.func.isRequired, newEntryUrl: PropTypes.string, }; diff --git a/packages/netlify-cms-core/src/components/Collection/Entries/EntryListing.js b/packages/netlify-cms-core/src/components/Collection/Entries/EntryListing.js index 1eeb3fd8..cd76565d 100644 --- a/packages/netlify-cms-core/src/components/Collection/Entries/EntryListing.js +++ b/packages/netlify-cms-core/src/components/Collection/Entries/EntryListing.js @@ -18,10 +18,11 @@ const CardsGrid = styled.ul` export default class EntryListing extends React.Component { static propTypes = { publicFolder: PropTypes.string.isRequired, - collections: PropTypes.oneOfType([ImmutablePropTypes.map, ImmutablePropTypes.iterable]) - .isRequired, + collections: ImmutablePropTypes.iterable.isRequired, entries: ImmutablePropTypes.list, viewStyle: PropTypes.string, + cursor: PropTypes.any.isRequired, + handleCursorActions: PropTypes.func.isRequired, }; handleLoadMore = () => { diff --git a/packages/netlify-cms-core/src/components/Collection/Sidebar.js b/packages/netlify-cms-core/src/components/Collection/Sidebar.js index ff3b8bc1..5cf1ce8f 100644 --- a/packages/netlify-cms-core/src/components/Collection/Sidebar.js +++ b/packages/netlify-cms-core/src/components/Collection/Sidebar.js @@ -1,4 +1,5 @@ import React from 'react'; +import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; import styled, { css } from 'react-emotion'; import { NavLink } from 'react-router-dom'; @@ -89,9 +90,14 @@ const SidebarNavLink = styled(NavLink)` export default class Sidebar extends React.Component { static propTypes = { collections: ImmutablePropTypes.orderedMap.isRequired, + searchTerm: PropTypes.string, }; - state = { query: this.props.searchTerm || '' }; + static defaultProps = { + searchTerm: '', + }; + + state = { query: this.props.searchTerm }; renderLink = collection => { const collectionName = collection.get('name'); diff --git a/packages/netlify-cms-core/src/components/Editor/Editor.js b/packages/netlify-cms-core/src/components/Editor/Editor.js index e4c5bca9..7bbb9d2c 100644 --- a/packages/netlify-cms-core/src/components/Editor/Editor.js +++ b/packages/netlify-cms-core/src/components/Editor/Editor.js @@ -61,8 +61,14 @@ class Editor extends React.Component { updateUnpublishedEntryStatus: PropTypes.func.isRequired, publishUnpublishedEntry: PropTypes.func.isRequired, deleteUnpublishedEntry: PropTypes.func.isRequired, - currentStatus: PropTypes.string, logoutUser: PropTypes.func.isRequired, + loadEntries: PropTypes.func.isRequired, + currentStatus: PropTypes.string, + user: ImmutablePropTypes.map.isRequired, + location: PropTypes.shape({ + pathname: PropTypes.string, + }), + hasChanged: PropTypes.bool, }; componentDidMount() { diff --git a/packages/netlify-cms-core/src/components/Editor/EditorControlPane/EditorControl.js b/packages/netlify-cms-core/src/components/Editor/EditorControlPane/EditorControl.js index db5d82cc..afeb300e 100644 --- a/packages/netlify-cms-core/src/components/Editor/EditorControlPane/EditorControl.js +++ b/packages/netlify-cms-core/src/components/Editor/EditorControlPane/EditorControl.js @@ -1,4 +1,6 @@ import React from 'react'; +import PropTypes from 'prop-types'; +import ImmutablePropTypes from 'react-immutable-proptypes'; import styled, { css, cx } from 'react-emotion'; import { partial, uniqueId } from 'lodash'; import { connect } from 'react-redux'; @@ -113,6 +115,30 @@ export const ControlHint = styled.p` `; class EditorControl extends React.Component { + static propTypes = { + value: PropTypes.oneOfType([ + PropTypes.node, + PropTypes.object, + PropTypes.string, + PropTypes.bool, + ]), + field: ImmutablePropTypes.map.isRequired, + fieldsMetaData: ImmutablePropTypes.map, + fieldsErrors: ImmutablePropTypes.map, + mediaPaths: ImmutablePropTypes.map.isRequired, + boundGetAsset: PropTypes.func.isRequired, + onChange: PropTypes.func.isRequired, + openMediaLibrary: PropTypes.func.isRequired, + addAsset: PropTypes.func.isRequired, + removeInsertedMedia: PropTypes.func.isRequired, + onValidate: PropTypes.func, + processControlRef: PropTypes.func, + query: PropTypes.func.isRequired, + queryHits: PropTypes.oneOfType([PropTypes.array, PropTypes.object]), + isFetching: PropTypes.bool, + clearSearch: PropTypes.func.isRequired, + }; + state = { activeLabel: false, }; diff --git a/packages/netlify-cms-core/src/components/Editor/EditorControlPane/Widget.js b/packages/netlify-cms-core/src/components/Editor/EditorControlPane/Widget.js index 99642208..4bc179d1 100644 --- a/packages/netlify-cms-core/src/components/Editor/EditorControlPane/Widget.js +++ b/packages/netlify-cms-core/src/components/Editor/EditorControlPane/Widget.js @@ -44,6 +44,8 @@ export default class Widget extends Component { query: PropTypes.func.isRequired, clearSearch: PropTypes.func.isRequired, queryHits: PropTypes.oneOfType([PropTypes.array, PropTypes.object]), + editorControl: PropTypes.func.isRequired, + uniqueFieldId: PropTypes.string.isRequired, }; shouldComponentUpdate(nextProps) { diff --git a/packages/netlify-cms-core/src/components/Editor/EditorInterface.js b/packages/netlify-cms-core/src/components/Editor/EditorInterface.js index 1e4fe33a..2a5683d7 100644 --- a/packages/netlify-cms-core/src/components/Editor/EditorInterface.js +++ b/packages/netlify-cms-core/src/components/Editor/EditorInterface.js @@ -281,7 +281,7 @@ EditorInterface.propTypes = { onDeleteUnpublishedChanges: PropTypes.func.isRequired, onPublish: PropTypes.func.isRequired, onChangeStatus: PropTypes.func.isRequired, - user: ImmutablePropTypes.map, + user: ImmutablePropTypes.map.isRequired, hasChanged: PropTypes.bool, displayUrl: PropTypes.string, hasWorkflow: PropTypes.bool, diff --git a/packages/netlify-cms-core/src/components/Editor/EditorPreviewPane/EditorPreviewContent.js b/packages/netlify-cms-core/src/components/Editor/EditorPreviewPane/EditorPreviewContent.js index abe5e693..0828d670 100644 --- a/packages/netlify-cms-core/src/components/Editor/EditorPreviewPane/EditorPreviewContent.js +++ b/packages/netlify-cms-core/src/components/Editor/EditorPreviewPane/EditorPreviewContent.js @@ -25,4 +25,9 @@ PreviewContent.contextTypes = { document: PropTypes.any, }; +PreviewContent.propTypes = { + previewComponent: PropTypes.func.isRequired, + previewProps: PropTypes.object, +}; + export default PreviewContent; diff --git a/packages/netlify-cms-core/src/components/Editor/EditorPreviewPane/PreviewHOC.js b/packages/netlify-cms-core/src/components/Editor/EditorPreviewPane/PreviewHOC.js index e2bdc997..38919a68 100644 --- a/packages/netlify-cms-core/src/components/Editor/EditorPreviewPane/PreviewHOC.js +++ b/packages/netlify-cms-core/src/components/Editor/EditorPreviewPane/PreviewHOC.js @@ -1,4 +1,6 @@ import React from 'react'; +import PropTypes from 'prop-types'; +import ImmutablePropTypes from 'react-immutable-proptypes'; class PreviewHOC extends React.Component { /** @@ -17,4 +19,10 @@ class PreviewHOC extends React.Component { } } +PreviewHOC.propTypes = { + previewComponent: PropTypes.func.isRequired, + field: ImmutablePropTypes.map.isRequired, + value: PropTypes.oneOfType([PropTypes.node, PropTypes.object, PropTypes.string, PropTypes.bool]), +}; + export default PreviewHOC; diff --git a/packages/netlify-cms-core/src/components/Editor/EditorToolbar.js b/packages/netlify-cms-core/src/components/Editor/EditorToolbar.js index 8bc2573a..e4980f9e 100644 --- a/packages/netlify-cms-core/src/components/Editor/EditorToolbar.js +++ b/packages/netlify-cms-core/src/components/Editor/EditorToolbar.js @@ -180,7 +180,7 @@ export default class EditorToolbar extends React.Component { onChangeStatus: PropTypes.func.isRequired, onPublish: PropTypes.func.isRequired, onPublishAndNew: PropTypes.func.isRequired, - user: ImmutablePropTypes.map, + user: ImmutablePropTypes.map.isRequired, hasChanged: PropTypes.bool, displayUrl: PropTypes.string, collection: ImmutablePropTypes.map.isRequired, diff --git a/packages/netlify-cms-core/src/components/MediaLibrary/MediaLibrary.js b/packages/netlify-cms-core/src/components/MediaLibrary/MediaLibrary.js index 3d4b5f5b..daf3dc12 100644 --- a/packages/netlify-cms-core/src/components/MediaLibrary/MediaLibrary.js +++ b/packages/netlify-cms-core/src/components/MediaLibrary/MediaLibrary.js @@ -1,4 +1,6 @@ import React from 'react'; +import PropTypes from 'prop-types'; +import ImmutablePropTypes from 'react-immutable-proptypes'; import { connect } from 'react-redux'; import { orderBy, map } from 'lodash'; import { Map } from 'immutable'; @@ -21,7 +23,41 @@ import MediaLibraryModal from './MediaLibraryModal'; const IMAGE_EXTENSIONS_VIEWABLE = ['jpg', 'jpeg', 'webp', 'gif', 'png', 'bmp', 'tiff', 'svg']; const IMAGE_EXTENSIONS = [...IMAGE_EXTENSIONS_VIEWABLE]; +const fileShape = { + key: PropTypes.string.isRequired, + name: PropTypes.string.isRequired, + size: PropTypes.number.isRequired, + queryOrder: PropTypes.number, + url: PropTypes.string.isRequired, + urlIsPublicPath: PropTypes.bool, +}; + class MediaLibrary extends React.Component { + static propTypes = { + isVisible: PropTypes.bool, + loadMediaDisplayURL: PropTypes.func, + displayURLs: ImmutablePropTypes.map, + canInsert: PropTypes.bool, + files: PropTypes.arrayOf(PropTypes.shape(fileShape)).isRequired, + dynamicSearch: PropTypes.bool, + dynamicSearchActive: PropTypes.bool, + forImage: PropTypes.bool, + isLoading: PropTypes.bool, + isPersisting: PropTypes.bool, + isDeleting: PropTypes.bool, + hasNextPage: PropTypes.bool, + isPaginating: PropTypes.bool, + privateUpload: PropTypes.bool, + loadMedia: PropTypes.func.isRequired, + dynamicSearchQuery: PropTypes.string, + page: PropTypes.number, + persistMedia: PropTypes.func.isRequired, + deleteMedia: PropTypes.func.isRequired, + insertMedia: PropTypes.func.isRequired, + publicFolder: PropTypes.string, + closeMediaLibrary: PropTypes.func.isRequired, + }; + /** * The currently selected file and query are tracked in component state as * they do not impact the rest of the application. diff --git a/packages/netlify-cms-core/src/components/UI/DragDrop.js b/packages/netlify-cms-core/src/components/UI/DragDrop.js index a2b95d74..0e86a61a 100644 --- a/packages/netlify-cms-core/src/components/UI/DragDrop.js +++ b/packages/netlify-cms-core/src/components/UI/DragDrop.js @@ -25,6 +25,7 @@ export const DragSource = ({ namespace, ...props }) => { return React.createElement(DragComponent, props, props.children); }; DragSource.propTypes = { + namespace: PropTypes.any.isRequired, children: PropTypes.func.isRequired, }; @@ -46,6 +47,7 @@ export const DropTarget = ({ onDrop, namespace, ...props }) => { }; DropTarget.propTypes = { onDrop: PropTypes.func.isRequired, + namespace: PropTypes.any.isRequired, children: PropTypes.func.isRequired, }; diff --git a/packages/netlify-cms-core/src/components/UI/ErrorBoundary.js b/packages/netlify-cms-core/src/components/UI/ErrorBoundary.js index a4e7eb3d..11c4bfff 100644 --- a/packages/netlify-cms-core/src/components/UI/ErrorBoundary.js +++ b/packages/netlify-cms-core/src/components/UI/ErrorBoundary.js @@ -1,4 +1,5 @@ import React from 'react'; +import PropTypes from 'prop-types'; import { css } from 'react-emotion'; import { colors } from 'netlify-cms-ui-default'; @@ -14,6 +15,10 @@ const styles = { }; export class ErrorBoundary extends React.Component { + static propTypes = { + children: PropTypes.node, + }; + state = { hasError: false, errorMessage: '', diff --git a/packages/netlify-cms-core/src/components/UI/FileUploadButton.js b/packages/netlify-cms-core/src/components/UI/FileUploadButton.js index 5438b609..4df00867 100644 --- a/packages/netlify-cms-core/src/components/UI/FileUploadButton.js +++ b/packages/netlify-cms-core/src/components/UI/FileUploadButton.js @@ -14,6 +14,7 @@ export const FileUploadButton = ({ label, imagesOnly, onChange, disabled, classN ); FileUploadButton.propTypes = { + className: PropTypes.string, label: PropTypes.string.isRequired, imagesOnly: PropTypes.bool, onChange: PropTypes.func.isRequired, diff --git a/packages/netlify-cms-core/src/components/UI/SettingsDropdown.js b/packages/netlify-cms-core/src/components/UI/SettingsDropdown.js index ef4da684..ac121e75 100644 --- a/packages/netlify-cms-core/src/components/UI/SettingsDropdown.js +++ b/packages/netlify-cms-core/src/components/UI/SettingsDropdown.js @@ -1,4 +1,5 @@ import React from 'react'; +import PropTypes from 'prop-types'; import styled, { css } from 'react-emotion'; import { Icon, Dropdown, DropdownItem, DropdownButton, colors } from 'netlify-cms-ui-default'; import { stripProtocol } from 'Lib/urlHelper'; @@ -42,6 +43,10 @@ const Avatar = ({ imageUrl }) => ( ); +Avatar.propTypes = { + imageUrl: PropTypes.string, +}; + const SettingsDropdown = ({ displayUrl, imageUrl, onLogoutClick }) => ( {displayUrl ? ( @@ -64,4 +69,10 @@ const SettingsDropdown = ({ displayUrl, imageUrl, onLogoutClick }) => ( ); +SettingsDropdown.propTypes = { + displayUrl: PropTypes.string, + imageUrl: PropTypes.string, + onLogoutClick: PropTypes.func.isRequired, +}; + export default SettingsDropdown; diff --git a/packages/netlify-cms-core/src/components/Workflow/WorkflowCard.js b/packages/netlify-cms-core/src/components/Workflow/WorkflowCard.js index 756031b7..b7be3e32 100644 --- a/packages/netlify-cms-core/src/components/Workflow/WorkflowCard.js +++ b/packages/netlify-cms-core/src/components/Workflow/WorkflowCard.js @@ -1,4 +1,5 @@ import React from 'react'; +import PropTypes from 'prop-types'; import styled, { css } from 'react-emotion'; import { Link } from 'react-router-dom'; import { components, colors, colorsRaw, transitions, buttons } from 'netlify-cms-ui-default'; @@ -127,4 +128,17 @@ const WorkflowCard = ({ ); +WorkflowCard.propTypes = { + collectionName: PropTypes.string.isRequired, + title: PropTypes.string.isRequired, + authorLastChange: PropTypes.string.isRequired, + body: PropTypes.string.isRequired, + isModification: PropTypes.bool, + editLink: PropTypes.string.isRequired, + timestamp: PropTypes.string.isRequired, + onDelete: PropTypes.func.isRequired, + canPublish: PropTypes.bool.isRequired, + onPublish: PropTypes.func.isRequired, +}; + export default WorkflowCard; diff --git a/packages/netlify-cms-ui-default/src/AuthenticationPage.js b/packages/netlify-cms-ui-default/src/AuthenticationPage.js index 9b3446f1..2cc14bab 100644 --- a/packages/netlify-cms-ui-default/src/AuthenticationPage.js +++ b/packages/netlify-cms-ui-default/src/AuthenticationPage.js @@ -1,4 +1,5 @@ import React from 'react'; +import PropTypes from 'prop-types'; import styled from 'react-emotion'; import Icon from './Icon'; import { buttons, shadows } from './styles'; @@ -50,4 +51,12 @@ const AuthenticationPage = ({ ); }; +AuthenticationPage.propTypes = { + onLogin: PropTypes.func, + loginDisabled: PropTypes.bool, + loginErrorMessage: PropTypes.node, + renderButtonContent: PropTypes.func, + renderPageContent: PropTypes.func, +}; + export default AuthenticationPage; diff --git a/packages/netlify-cms-ui-default/src/Dropdown.js b/packages/netlify-cms-ui-default/src/Dropdown.js index a97c016f..d9e53bbb 100644 --- a/packages/netlify-cms-ui-default/src/Dropdown.js +++ b/packages/netlify-cms-ui-default/src/Dropdown.js @@ -1,4 +1,5 @@ import React from 'react'; +import PropTypes from 'prop-types'; import styled, { css } from 'react-emotion'; import { Wrapper, Button as DropdownButton, Menu, MenuItem } from 'react-aria-menubutton'; import { buttons, components } from './styles'; @@ -76,6 +77,15 @@ const Dropdown = ({ ); }; +Dropdown.propTypes = { + renderButton: PropTypes.func.isRequired, + dropdownWidth: PropTypes.string, + dropdownPosition: PropTypes.string, + dropdownTopOverlap: PropTypes.string, + className: PropTypes.string, + children: PropTypes.node, +}; + const DropdownItem = ({ label, icon, iconDirection, onClick, className }) => ( {label} @@ -87,4 +97,12 @@ const DropdownItem = ({ label, icon, iconDirection, onClick, className }) => ( ); +DropdownItem.propTypes = { + label: PropTypes.string, + icon: PropTypes.string, + iconDirection: PropTypes.string, + onClick: PropTypes.func, + className: PropTypes.string, +}; + export { Dropdown as default, DropdownItem, DropdownButton, StyledDropdownButton }; diff --git a/packages/netlify-cms-ui-default/src/Icon.js b/packages/netlify-cms-ui-default/src/Icon.js index e893dab1..dc36bb4f 100644 --- a/packages/netlify-cms-ui-default/src/Icon.js +++ b/packages/netlify-cms-ui-default/src/Icon.js @@ -1,4 +1,5 @@ import React from 'react'; +import PropTypes from 'prop-types'; import styled from 'react-emotion'; import icons from './Icon/icons'; @@ -59,4 +60,11 @@ const Icon = ({ type, direction, size = 'medium', className }) => ( /> ); +Icon.propTypes = { + type: PropTypes.string.isRequired, + direction: PropTypes.oneOf(['right', 'down', 'left', 'up']), + size: PropTypes.string, + className: PropTypes.string, +}; + export default styled(Icon)``; diff --git a/packages/netlify-cms-ui-default/src/ListItemTopBar.js b/packages/netlify-cms-ui-default/src/ListItemTopBar.js index 2f7493bb..2b6f0705 100644 --- a/packages/netlify-cms-ui-default/src/ListItemTopBar.js +++ b/packages/netlify-cms-ui-default/src/ListItemTopBar.js @@ -1,4 +1,5 @@ import React from 'react'; +import PropTypes from 'prop-types'; import styled from 'react-emotion'; import Icon from './Icon'; import { colors, lengths, buttons } from './styles'; @@ -58,6 +59,13 @@ const ListItemTopBar = ({ className, collapsed, onCollapseToggle, onRemove, drag ); +ListItemTopBar.propTypes = { + className: PropTypes.string, + collapsed: PropTypes.bool, + onCollapseToggle: PropTypes.func, + onRemove: PropTypes.func, +}; + const StyledListItemTopBar = styled(ListItemTopBar)` display: flex; justify-content: space-between; diff --git a/packages/netlify-cms-ui-default/src/Loader.js b/packages/netlify-cms-ui-default/src/Loader.js index b531fcb6..73f45898 100644 --- a/packages/netlify-cms-ui-default/src/Loader.js +++ b/packages/netlify-cms-ui-default/src/Loader.js @@ -1,4 +1,5 @@ import React from 'react'; +import PropTypes from 'prop-types'; import styled, { css, keyframes } from 'react-emotion'; import CSSTransition from 'react-transition-group/CSSTransition'; import { colors } from './styles'; @@ -54,6 +55,11 @@ const LoaderItem = styled.div` `; export class Loader extends React.Component { + static propTypes = { + children: PropTypes.node, + className: PropTypes.string, + }; + state = { currentItem: 0, }; diff --git a/packages/netlify-cms-ui-default/src/ObjectWidgetTopBar.js b/packages/netlify-cms-ui-default/src/ObjectWidgetTopBar.js index 081098d3..995e33b1 100644 --- a/packages/netlify-cms-ui-default/src/ObjectWidgetTopBar.js +++ b/packages/netlify-cms-ui-default/src/ObjectWidgetTopBar.js @@ -1,4 +1,5 @@ import React from 'react'; +import PropTypes from 'prop-types'; import styled, { css } from 'react-emotion'; import Icon from './Icon'; import { colors, buttons } from './styles'; @@ -73,4 +74,13 @@ const ObjectWidgetTopBar = ({ ); +ObjectWidgetTopBar.propTypes = { + allowAdd: PropTypes.bool, + onAdd: PropTypes.func, + onCollapseToggle: PropTypes.func, + collapsed: PropTypes.bool, + heading: PropTypes.node, + label: PropTypes.string, +}; + export default ObjectWidgetTopBar; diff --git a/packages/netlify-cms-ui-default/src/Toggle.js b/packages/netlify-cms-ui-default/src/Toggle.js index be534ff0..0bada64e 100644 --- a/packages/netlify-cms-ui-default/src/Toggle.js +++ b/packages/netlify-cms-ui-default/src/Toggle.js @@ -1,4 +1,5 @@ import React from 'react'; +import PropTypes from 'prop-types'; import styled, { css } from 'react-emotion'; import ReactToggled from 'react-toggled'; import { colors, colorsRaw, shadows, transitions } from './styles'; @@ -65,6 +66,17 @@ const Toggle = ({ ); +Toggle.propTypes = { + active: PropTypes.bool, + onChange: PropTypes.func, + onFocus: PropTypes.func, + onBlur: PropTypes.func, + className: PropTypes.string, + Container: PropTypes.func, + Background: PropTypes.func, + Handle: PropTypes.func, +}; + const StyledToggle = styled(Toggle)``; export { StyledToggle as default, ToggleContainer, ToggleBackground, ToggleHandle }; diff --git a/packages/netlify-cms-widget-list/src/ListControl.js b/packages/netlify-cms-widget-list/src/ListControl.js index ae6c175b..e82278cc 100644 --- a/packages/netlify-cms-widget-list/src/ListControl.js +++ b/packages/netlify-cms-widget-list/src/ListControl.js @@ -61,6 +61,7 @@ const valueTypes = { export default class ListControl extends React.Component { static propTypes = { + metadata: ImmutablePropTypes.map, onChange: PropTypes.func.isRequired, onChangeObject: PropTypes.func.isRequired, value: ImmutablePropTypes.list, @@ -74,6 +75,8 @@ export default class ListControl extends React.Component { classNameWrapper: PropTypes.string.isRequired, setActiveStyle: PropTypes.func.isRequired, setInactiveStyle: PropTypes.func.isRequired, + editorControl: PropTypes.func.isRequired, + resolveWidget: PropTypes.func.isRequired, }; static defaultProps = { diff --git a/packages/netlify-cms-widget-markdown/src/MarkdownControl/RawEditor.js b/packages/netlify-cms-widget-markdown/src/MarkdownControl/RawEditor.js index eb9099ca..c93f58bb 100644 --- a/packages/netlify-cms-widget-markdown/src/MarkdownControl/RawEditor.js +++ b/packages/netlify-cms-widget-markdown/src/MarkdownControl/RawEditor.js @@ -99,5 +99,5 @@ RawEditor.propTypes = { onMode: PropTypes.func.isRequired, className: PropTypes.string.isRequired, value: PropTypes.string, - field: ImmutablePropTypes.map, + field: ImmutablePropTypes.map.isRequired, }; diff --git a/packages/netlify-cms-widget-markdown/src/MarkdownControl/Shortcode.js b/packages/netlify-cms-widget-markdown/src/MarkdownControl/Shortcode.js index e38b4d53..a4d72c54 100644 --- a/packages/netlify-cms-widget-markdown/src/MarkdownControl/Shortcode.js +++ b/packages/netlify-cms-widget-markdown/src/MarkdownControl/Shortcode.js @@ -1,3 +1,5 @@ +/* eslint-disable react/prop-types */ + import React from 'react'; import { Map } from 'immutable'; import styled, { css } from 'react-emotion'; diff --git a/packages/netlify-cms-widget-markdown/src/MarkdownControl/Toolbar.js b/packages/netlify-cms-widget-markdown/src/MarkdownControl/Toolbar.js index 4549bf8a..b5ff37b5 100644 --- a/packages/netlify-cms-widget-markdown/src/MarkdownControl/Toolbar.js +++ b/packages/netlify-cms-widget-markdown/src/MarkdownControl/Toolbar.js @@ -64,6 +64,12 @@ export default class Toolbar extends React.Component { onAddAsset: PropTypes.func, getAsset: PropTypes.func, disabled: PropTypes.bool, + onMarkClick: PropTypes.func, + onBlockClick: PropTypes.func, + onLinkClick: PropTypes.func, + selectionHasMark: PropTypes.func, + selectionHasBlock: PropTypes.func, + selectionHasLink: PropTypes.func, }; isHidden = button => { diff --git a/packages/netlify-cms-widget-markdown/src/MarkdownControl/ToolbarButton.js b/packages/netlify-cms-widget-markdown/src/MarkdownControl/ToolbarButton.js index f6673072..f1cd15ec 100644 --- a/packages/netlify-cms-widget-markdown/src/MarkdownControl/ToolbarButton.js +++ b/packages/netlify-cms-widget-markdown/src/MarkdownControl/ToolbarButton.js @@ -46,6 +46,7 @@ ToolbarButton.propTypes = { icon: PropTypes.string, onClick: PropTypes.func, isActive: PropTypes.func, + isHidden: PropTypes.bool, disabled: PropTypes.bool, }; diff --git a/packages/netlify-cms-widget-markdown/src/MarkdownControl/VisualEditor.js b/packages/netlify-cms-widget-markdown/src/MarkdownControl/VisualEditor.js index 30829e42..deef342e 100644 --- a/packages/netlify-cms-widget-markdown/src/MarkdownControl/VisualEditor.js +++ b/packages/netlify-cms-widget-markdown/src/MarkdownControl/VisualEditor.js @@ -40,7 +40,8 @@ export default class Editor extends React.Component { onMode: PropTypes.func.isRequired, className: PropTypes.string.isRequired, value: PropTypes.string, - field: ImmutablePropTypes.map, + field: ImmutablePropTypes.map.isRequired, + getEditorComponents: PropTypes.func.isRequired, }; constructor(props) { diff --git a/packages/netlify-cms-widget-markdown/src/MarkdownControl/index.js b/packages/netlify-cms-widget-markdown/src/MarkdownControl/index.js index f4d0e27a..bb887bfd 100644 --- a/packages/netlify-cms-widget-markdown/src/MarkdownControl/index.js +++ b/packages/netlify-cms-widget-markdown/src/MarkdownControl/index.js @@ -1,5 +1,6 @@ import React from 'react'; import PropTypes from 'prop-types'; +import ImmutablePropTypes from 'react-immutable-proptypes'; import RawEditor from './RawEditor'; import VisualEditor from './VisualEditor'; @@ -19,6 +20,8 @@ export default class MarkdownControl extends React.Component { classNameWrapper: PropTypes.string.isRequired, editorControl: PropTypes.func.isRequired, value: PropTypes.string, + field: ImmutablePropTypes.map.isRequired, + getEditorComponents: PropTypes.func, }; static defaultProps = { diff --git a/packages/netlify-cms-widget-markdown/src/MarkdownControl/renderers.js b/packages/netlify-cms-widget-markdown/src/MarkdownControl/renderers.js index e2410368..ee83fa9c 100644 --- a/packages/netlify-cms-widget-markdown/src/MarkdownControl/renderers.js +++ b/packages/netlify-cms-widget-markdown/src/MarkdownControl/renderers.js @@ -1,3 +1,5 @@ +/* eslint-disable react/prop-types */ + import React from 'react'; import Shortcode from './Shortcode'; diff --git a/packages/netlify-cms-widget-number/src/NumberControl.js b/packages/netlify-cms-widget-number/src/NumberControl.js index 1a721c82..c926611e 100644 --- a/packages/netlify-cms-widget-number/src/NumberControl.js +++ b/packages/netlify-cms-widget-number/src/NumberControl.js @@ -1,8 +1,10 @@ import React from 'react'; import PropTypes from 'prop-types'; +import ImmutablePropTypes from 'react-immutable-proptypes'; export default class NumberControl extends React.Component { static propTypes = { + field: ImmutablePropTypes.map.isRequired, onChange: PropTypes.func.isRequired, classNameWrapper: PropTypes.string.isRequired, setActiveStyle: PropTypes.func.isRequired,