diff --git a/src/ActionBar/ActionBar.js b/src/ActionBar/ActionBar.js index 99544201a..d3148f86b 100644 --- a/src/ActionBar/ActionBar.js +++ b/src/ActionBar/ActionBar.js @@ -11,7 +11,7 @@ export const ActionBar = ({ mobile, width, children, className, ...props }) => { return ( {mobile ? ( -
+
{children}
) : ( @@ -27,6 +27,10 @@ ActionBar.propTypes = { width: PropTypes.string }; +ActionBar.defaultProps = { + width: '319px' +}; + ActionBar.propDescriptions = { mobile: 'Set to **true** for mobile view of the Action Bar.', width: 'The width of the Action Bar in mobile view.' @@ -65,18 +69,20 @@ export const ActionBarHeader = ({ className, description, descriptionProps, titl

{title}

-

{description}

+ {description && +

{description}

+ }
); }; ActionBarHeader.propTypes = { + title: PropTypes.string.isRequired, className: PropTypes.string, description: PropTypes.string, descriptionProps: PropTypes.object, - title: PropTypes.string, titleProps: PropTypes.object }; diff --git a/src/ActionBar/ActionBar.test.js b/src/ActionBar/ActionBar.test.js index 14eccbdd4..60f2060b2 100644 --- a/src/ActionBar/ActionBar.test.js +++ b/src/ActionBar/ActionBar.test.js @@ -114,7 +114,12 @@ describe('', () => { }); test('should allow props to be spread to the ActionBarHeader component', () => { - const element = mount(); + const element = mount( + + ); expect( element.getDOMNode().attributes['data-sample'].value @@ -122,7 +127,12 @@ describe('', () => { }); test('should allow props to be spread to the ActionBarHeader component\'s h1 element', () => { - const element = mount(); + const element = mount( + + ); expect( element.find('h1').getDOMNode().attributes['data-sample'].value @@ -130,7 +140,12 @@ describe('', () => { }); test('should allow props to be spread to the ActionBarHeader component\'s p element', () => { - const element = mount(); + const element = mount( + + ); expect( element.find('p').getDOMNode().attributes['data-sample'].value diff --git a/src/ActionBar/__snapshots__/ActionBar.test.js.snap b/src/ActionBar/__snapshots__/ActionBar.test.js.snap index b562e2439..33da7a377 100644 --- a/src/ActionBar/__snapshots__/ActionBar.test.js.snap +++ b/src/ActionBar/__snapshots__/ActionBar.test.js.snap @@ -23,7 +23,6 @@ exports[` create basic Action Bar 1`] = ` className="fd-action-bar__description" > Action Bar Description -

create basic Action Bar 2`] = ` className="fd-action-bar__description" > Action Bar Description -

create basic mobile Action Bar 1`] = ` className="fd-action-bar__description" > Action Bar Description -

create basic mobile Action Bar 2`] = ` className="fd-action-bar__description" > Action Bar Description -

{ } ]}> + linkText='link'> Default alert with a{' '} diff --git a/src/Badge/Badge.js b/src/Badge/Badge.js index a6438baae..896c061cf 100644 --- a/src/Badge/Badge.js +++ b/src/Badge/Badge.js @@ -1,7 +1,7 @@ import classnames from 'classnames'; import PropTypes from 'prop-types'; import React from 'react'; -import {BADGE_TYPES, LABEL_TYPES, STATUS_TYPES} from '../utils/constants'; +import {BADGE_MODIFIERS, BADGE_TYPES, LABEL_TYPES, STATUS_TYPES} from '../utils/constants'; export const Badge = ({ type, modifier, children, className, ...props }) => { @@ -23,7 +23,7 @@ export const Badge = ({ type, modifier, children, className, ...props }) => { Badge.propTypes = { className: PropTypes.string, - modifier: PropTypes.oneOf(['', 'pill', 'filled']), + modifier: PropTypes.oneOf(BADGE_MODIFIERS), type: PropTypes.oneOf(BADGE_TYPES) }; diff --git a/src/Button/Button.js b/src/Button/Button.js index 85d2c4aaa..0be512c0d 100644 --- a/src/Button/Button.js +++ b/src/Button/Button.js @@ -34,13 +34,15 @@ export const Button = ({ ); return (); }; Button.propTypes = { + children: PropTypes.node, + className: PropTypes.string, compact: PropTypes.bool, disabled: PropTypes.bool, dropdown: PropTypes.bool, diff --git a/src/Button/__snapshots__/Button.test.js.snap b/src/Button/__snapshots__/Button.test.js.snap index 835318a11..7c87481e6 100644 --- a/src/Button/__snapshots__/Button.test.js.snap +++ b/src/Button/__snapshots__/Button.test.js.snap @@ -8,18 +8,13 @@ exports[`
`; @@ -27,8 +22,6 @@ exports[` @@ -37,8 +30,6 @@ exports[` @@ -47,8 +38,6 @@ exports[` @@ -57,8 +46,6 @@ exports[` @@ -67,8 +54,6 @@ exports[` @@ -77,7 +62,6 @@ exports[` @@ -97,8 +80,6 @@ exports[` @@ -107,8 +88,6 @@ exports[` diff --git a/src/Calendar/Calendar.js b/src/Calendar/Calendar.js index 06c011190..ce7ef25de 100644 --- a/src/Calendar/Calendar.js +++ b/src/Calendar/Calendar.js @@ -373,13 +373,7 @@ export class Calendar extends Component { } returnDateSelected = (dates) => { - if (typeof this.props.onChange !== 'undefined') { - if (this.props.enableRangeSelection === true) { - this.props.onChange(dates); - } else { - this.props.onChange(dates); - } - } + this.props.onChange(dates); } generateNavigation = () => { @@ -559,7 +553,12 @@ Calendar.propTypes = { tableBodyProps: PropTypes.object, tableHeaderProps: PropTypes.object, tableProps: PropTypes.object, - yearListProps: PropTypes.object + yearListProps: PropTypes.object, + onChange: PropTypes.func +}; + +Calendar.defaultProps = { + onChange: () => {} }; Calendar.propDescriptions = { diff --git a/src/ComboboxInput/ComboboxInput.js b/src/ComboboxInput/ComboboxInput.js index 1ccb5c43f..3e716852d 100644 --- a/src/ComboboxInput/ComboboxInput.js +++ b/src/ComboboxInput/ComboboxInput.js @@ -60,11 +60,6 @@ ComboboxInput.propTypes = { popoverProps: PropTypes.object }; -ComboboxInput.defaultTypes = { - compact: false, - placeholder: '' -}; - ComboboxInput.propDescriptions = { menu: 'An object containing a `Menu` component.' }; diff --git a/src/DatePicker/DatePicker.js b/src/DatePicker/DatePicker.js index cb306c8db..7025a93ed 100644 --- a/src/DatePicker/DatePicker.js +++ b/src/DatePicker/DatePicker.js @@ -439,7 +439,6 @@ export class DatePicker extends Component { DatePicker.propTypes = { ...Calendar.basePropTypes, - buttonProps: PropTypes.object, compact: PropTypes.bool, enableRangeSelection: PropTypes.bool, diff --git a/src/Dropdown/__snapshots__/Dropdown.test.js.snap b/src/Dropdown/__snapshots__/Dropdown.test.js.snap index ecbaa7ce8..796c4c50e 100644 --- a/src/Dropdown/__snapshots__/Dropdown.test.js.snap +++ b/src/Dropdown/__snapshots__/Dropdown.test.js.snap @@ -14,8 +14,6 @@ exports[` create dropdown component 1`] = ` > @@ -83,8 +81,6 @@ exports[` create dropdown component 2`] = ` > @@ -152,8 +148,6 @@ exports[` create dropdown component 3`] = ` > @@ -222,8 +216,6 @@ exports[` create dropdown component 4`] = ` > @@ -295,7 +287,6 @@ exports[` create dropdown component 5`] = ` diff --git a/src/Forms/Forms.js b/src/Forms/Forms.js index 1df05f01a..8b7fa7304 100644 --- a/src/Forms/Forms.js +++ b/src/Forms/Forms.js @@ -1,4 +1,5 @@ import classnames from 'classnames'; +import { FORM_MESSAGE_TYPES } from '../utils/constants'; import PropTypes from 'prop-types'; import React, { Component } from 'react'; @@ -98,7 +99,7 @@ export const FormMessage = ({ type, children, className, ...props }) => { FormMessage.propTypes = { children: PropTypes.node, className: PropTypes.string, - type: PropTypes.oneOf(['', 'error', 'warning', 'help']) + type: PropTypes.oneOf(FORM_MESSAGE_TYPES) }; // ------------------------------------------------- Form Input ---------------------------------------------- @@ -197,7 +198,7 @@ export const FormSelect = ({ disabled, children, className, ...props }) => { ); @@ -237,7 +238,7 @@ export class FormRadio extends Component { create form item 1`] = ` create form item 3`] = ` create form item 3`] = ` create form item 4`] = ` create form item 4`] = ` create form item 4`] = ` create form item 4`] = ` create form item 4`] = ` create form item 4`] = ` { ); }; -Icon.defaultProps = { - clickHandler: () => {} -}; - Icon.propTypes = { glyph: PropTypes.string.isRequired, className: PropTypes.string, diff --git a/src/Icon/__snapshots__/Icon.test.js.snap b/src/Icon/__snapshots__/Icon.test.js.snap index b129d1974..7feee51d7 100644 --- a/src/Icon/__snapshots__/Icon.test.js.snap +++ b/src/Icon/__snapshots__/Icon.test.js.snap @@ -10,6 +10,5 @@ exports[` create icon 1`] = ` exports[` create icon 2`] = ` `; diff --git a/src/InputGroup/InputGroup.js b/src/InputGroup/InputGroup.js index ff57ca542..c0d7f101c 100644 --- a/src/InputGroup/InputGroup.js +++ b/src/InputGroup/InputGroup.js @@ -16,8 +16,8 @@ export class InputGroup extends Component { super(props); this.state = { - value: this.props.inputValue || '', - searchValue: this.props.inputValue || '' + value: this.props.inputValue, + searchValue: this.props.inputValue }; } @@ -267,6 +267,12 @@ InputGroup.propTypes = { searchButtonProps: PropTypes.object }; +InputGroup.defaultProps = { + addonPos: 'after', + inputType: 'text', + inputValue: '' +}; + InputGroup.propDescriptions = { actions: 'Set to **true** to enable an input with actions. Actions can be shown with a text label or icon.', addon: 'The value of the add-on.', diff --git a/src/InputGroup/__snapshots__/InputGroup.test.js.snap b/src/InputGroup/__snapshots__/InputGroup.test.js.snap index 444a65d22..2a56df382 100644 --- a/src/InputGroup/__snapshots__/InputGroup.test.js.snap +++ b/src/InputGroup/__snapshots__/InputGroup.test.js.snap @@ -271,8 +271,6 @@ exports[` create input group items 13`] = ` > @@ -295,8 +293,6 @@ exports[` create input group items 14`] = ` > diff --git a/src/ListGroup/__snapshots__/ListGroup.test.js.snap b/src/ListGroup/__snapshots__/ListGroup.test.js.snap index 5ac54ee45..94ae791a1 100644 --- a/src/ListGroup/__snapshots__/ListGroup.test.js.snap +++ b/src/ListGroup/__snapshots__/ListGroup.test.js.snap @@ -49,8 +49,6 @@ exports[` create list group 1`] = ` > @@ -162,8 +160,6 @@ exports[` create panels 3`] = ` > diff --git a/src/Popover/__snapshots__/Popover.test.js.snap b/src/Popover/__snapshots__/Popover.test.js.snap index 29ee4d6ec..b17f6c3f4 100644 --- a/src/Popover/__snapshots__/Popover.test.js.snap +++ b/src/Popover/__snapshots__/Popover.test.js.snap @@ -11,7 +11,6 @@ exports[` create Popover 1`] = ` >
create Popover 2`] = ` >
create Popover 3`] = ` >
create Popover 4`] = ` >
{} +}; + SearchInput.propDescriptions = { noSearchBtn: 'Set to **true** to render without a search button.', onEnter: 'Callback function when the user hits the key.', diff --git a/src/Shellbar/Shellbar.js b/src/Shellbar/Shellbar.js index 8c2c50dfb..d02928942 100644 --- a/src/Shellbar/Shellbar.js +++ b/src/Shellbar/Shellbar.js @@ -404,10 +404,6 @@ Shellbar.propTypes = { subtitle: PropTypes.string }; -Shellbar.defaultProps = { - actions: null -}; - Shellbar.propDescriptions = { actions: 'Holds all product actions and links.', copilot: 'For use with applications that utilize CoPilot.', diff --git a/src/Shellbar/__snapshots__/Shellbar.test.js.snap b/src/Shellbar/__snapshots__/Shellbar.test.js.snap index 4524318a1..6384ad209 100644 --- a/src/Shellbar/__snapshots__/Shellbar.test.js.snap +++ b/src/Shellbar/__snapshots__/Shellbar.test.js.snap @@ -76,7 +76,6 @@ exports[` create shellbar 1`] = ` >     Settings @@ -89,7 +88,6 @@ exports[` create shellbar 1`] = ` >     Sign Out @@ -182,7 +180,6 @@ exports[` create shellbar 2`] = ` >     Settings @@ -195,7 +192,6 @@ exports[` create shellbar 2`] = ` >     Sign Out @@ -268,7 +264,6 @@ exports[` create shellbar 3`] = ` >     Application A @@ -541,7 +536,6 @@ exports[` create shellbar 3`] = ` > Search @@ -554,7 +548,6 @@ exports[` create shellbar 3`] = ` > create shellbar 3`] = ` > create shellbar 3`] = ` > Product Switcher @@ -651,7 +642,6 @@ exports[` create shellbar 3`] = ` >     Settings @@ -664,7 +654,6 @@ exports[` create shellbar 3`] = ` >     Sign Out @@ -803,7 +792,6 @@ exports[` create shellbar 4`] = ` >     Application A @@ -1052,7 +1040,6 @@ exports[` create shellbar 4`] = ` > Search @@ -1065,7 +1052,6 @@ exports[` create shellbar 4`] = ` > create shellbar 4`] = ` > Notifications @@ -1098,7 +1083,6 @@ exports[` create shellbar 4`] = ` > Product Switcher @@ -1155,7 +1139,6 @@ exports[` create shellbar 4`] = ` >     Settings @@ -1168,7 +1151,6 @@ exports[` create shellbar 4`] = ` >     Sign Out @@ -1307,7 +1289,6 @@ exports[` create shellbar 5`] = ` >     Application A @@ -1510,7 +1491,6 @@ exports[` create shellbar 5`] = ` > Search @@ -1523,7 +1503,6 @@ exports[` create shellbar 5`] = ` > create shellbar 5`] = ` > Notifications @@ -1556,7 +1534,6 @@ exports[` create shellbar 5`] = ` > Product Switcher @@ -1613,7 +1590,6 @@ exports[` create shellbar 5`] = ` >     Settings @@ -1626,7 +1602,6 @@ exports[` create shellbar 5`] = ` >     Sign Out @@ -1765,7 +1740,6 @@ exports[` create shellbar 6`] = ` >     Application A @@ -1992,7 +1966,6 @@ exports[` create shellbar 6`] = ` > Search @@ -2005,7 +1978,6 @@ exports[` create shellbar 6`] = ` > create shellbar 6`] = ` > create shellbar 6`] = ` > Product Switcher @@ -2105,7 +2075,6 @@ exports[` create shellbar 6`] = ` >     Settings @@ -2118,7 +2087,6 @@ exports[` create shellbar 6`] = ` >     Sign Out diff --git a/src/SideNavigation/SideNavigation.js b/src/SideNavigation/SideNavigation.js index 124b4bd14..403e1dd5b 100644 --- a/src/SideNavigation/SideNavigation.js +++ b/src/SideNavigation/SideNavigation.js @@ -198,7 +198,7 @@ export const SideNavGroup = props => { }; SideNavGroup.propTypes = { + title: PropTypes.string.isRequired, className: PropTypes.string, - title: PropTypes.string, titleProps: PropTypes.object }; diff --git a/src/SideNavigation/SideNavigation.test.js b/src/SideNavigation/SideNavigation.test.js index 5fd61513b..c57c3192c 100644 --- a/src/SideNavigation/SideNavigation.test.js +++ b/src/SideNavigation/SideNavigation.test.js @@ -218,7 +218,7 @@ describe('', () => { }); test('should allow props to be spread to the SideNavGroup component', () => { - const element = mount(); + const element = mount(); expect( element.getDOMNode().attributes['data-sample'].value @@ -226,7 +226,7 @@ describe('', () => { }); test('should allow props to be spread to the SideNavGroup component\'s h1 element', () => { - const element = mount(); + const element = mount(); expect( element.find('h1').getDOMNode().attributes['data-sample'].value diff --git a/src/Table/Table.js b/src/Table/Table.js index 8d40d528a..51b00b58d 100644 --- a/src/Table/Table.js +++ b/src/Table/Table.js @@ -50,13 +50,13 @@ export const Table = props => { }; Table.propTypes = { + headers: PropTypes.array.isRequired, tableData: PropTypes.arrayOf( PropTypes.shape({ rowData: PropTypes.array }).isRequired ).isRequired, className: PropTypes.string, - headers: PropTypes.array, tableBodyProps: PropTypes.object, tableBodyRowProps: PropTypes.oneOfType([ PropTypes.object, diff --git a/src/Tile/Tile.js b/src/Tile/Tile.js index 78f762a86..f3a6db486 100644 --- a/src/Tile/Tile.js +++ b/src/Tile/Tile.js @@ -69,8 +69,8 @@ export const TileContent = props => { }; TileContent.propTypes = { + title: PropTypes.string.isRequired, className: PropTypes.string, - title: PropTypes.string, titleProps: PropTypes.object }; @@ -85,6 +85,11 @@ export const TileMedia = props => { return
{children}
; }; +TileMedia.propTypes = { + children: PropTypes.node, + className: PropTypes.string +}; + export const TileActions = props => { const { children, className, ...rest } = props; @@ -96,6 +101,11 @@ export const TileActions = props => { return
{children}
; }; +TileActions.propTypes = { + children: PropTypes.node, + className: PropTypes.string +}; + export const ProductTile = props => { const { disabled, children, className, ...rest } = props; @@ -117,6 +127,7 @@ export const ProductTile = props => { }; ProductTile.propTypes = { + children: PropTypes.node, className: PropTypes.string, disabled: PropTypes.bool }; @@ -173,10 +184,7 @@ export const TileGrid = props => { const tileGridClasses = classnames( 'fd-tile-grid', - { - [`fd-tile-grid--${col}col`]: !!col, - 'fd-tile-grid--3col': !col - }, + `fd-tile-grid--${col}col`, className ); @@ -190,6 +198,11 @@ export const TileGrid = props => { }; TileGrid.propTypes = { + children: PropTypes.node, className: PropTypes.string, col: CustomPropTypes.range(1, 6) }; + +TileGrid.defaultProps = { + col: 3 +}; diff --git a/src/Tile/Tile.test.js b/src/Tile/Tile.test.js index 606231064..b7a14330d 100644 --- a/src/Tile/Tile.test.js +++ b/src/Tile/Tile.test.js @@ -191,7 +191,7 @@ describe('', () => { }); test('should allow props to be spread to the TileContent component', () => { - const element = mount(); + const element = mount(); expect( element.getDOMNode().attributes['data-sample'].value @@ -199,7 +199,7 @@ describe('', () => { }); test('should allow props to be spread to the TileContent component\'s h2 element', () => { - const element = mount(); + const element = mount(); expect( element.find('h2').getDOMNode().attributes['data-sample'].value diff --git a/src/Tile/__snapshots__/Tile.test.js.snap b/src/Tile/__snapshots__/Tile.test.js.snap index fb74dbf81..9a4b2869e 100644 --- a/src/Tile/__snapshots__/Tile.test.js.snap +++ b/src/Tile/__snapshots__/Tile.test.js.snap @@ -92,8 +92,6 @@ exports[` create tile component 4`] = ` >
create tile component 6`] = ` >
{} }; export class Time extends Component { @@ -309,10 +307,8 @@ export class Time extends Component { this.setState(prevState => ({ ...prevState.time })); - // - if (this.props.onChange) { - this.props.onChange(this.state.time); - } + + this.props.onChange(this.state.time); }; // onUpdateTime = () => { // this.props.onUpdateTime(); @@ -468,12 +464,10 @@ Time.propTypes = { }; Time.defaultProps = { - id: '', + onChange: () => {}, showHour: true, showMinute: true, showSecond: true, - format12Hours: false, - disabled: false, spinners: true, time: { hour: '00', diff --git a/src/Time/__snapshots__/Time.test.js.snap b/src/Time/__snapshots__/Time.test.js.snap index f1bdd1e5c..3ba886cda 100644 --- a/src/Time/__snapshots__/Time.test.js.snap +++ b/src/Time/__snapshots__/Time.test.js.snap @@ -3,7 +3,6 @@ exports[`
@@ -67,7 +62,6 @@ exports[`