Skip to content

Commit

Permalink
Rename shorthand proptypes
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffcarbs committed Oct 5, 2016
1 parent df0b6ce commit 9928ccc
Show file tree
Hide file tree
Showing 52 changed files with 106 additions and 121 deletions.
6 changes: 3 additions & 3 deletions src/collections/Breadcrumb/Breadcrumb.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,18 +66,18 @@ Breadcrumb.propTypes = {
/** Shorthand for primary content of the Breadcrumb.Divider. */
divider: customPropTypes.every([
customPropTypes.disallow(['icon']),
customPropTypes.content,
customPropTypes.contentShorthand,
]),

/** For use with the sections prop. Render as an `Icon` component with `divider` class instead of a `div` in
* Breadcrumb.Divider. */
icon: customPropTypes.every([
customPropTypes.disallow(['divider']),
customPropTypes.item,
customPropTypes.itemShorthand,
]),

/** Shorthand array of props for Breadcrumb.Section. */
sections: customPropTypes.items,
sections: customPropTypes.collectionShorthand,

/** Size of Breadcrumb */
size: PropTypes.oneOf(Breadcrumb._meta.props.size),
Expand Down
2 changes: 1 addition & 1 deletion src/collections/Breadcrumb/BreadcrumbDivider.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ BreadcrumbDivider.propTypes = {
className: PropTypes.string,

/** Render as an `Icon` component with `divider` class instead of a `div`. */
icon: customPropTypes.item,
icon: customPropTypes.itemShorthand,
}

export default BreadcrumbDivider
2 changes: 1 addition & 1 deletion src/collections/Menu/Menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class Menu extends Component {
inverted: PropTypes.bool,

/** Shorthand array of props for Menu. */
items: customPropTypes.items,
items: customPropTypes.collectionShorthand,

/** onClick handler for MenuItem. Mutually exclusive with children. */
onItemClick: customPropTypes.every([
Expand Down
2 changes: 1 addition & 1 deletion src/collections/Menu/MenuHeader.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ MenuHeader.propTypes = {
className: PropTypes.string,

/** Shorthand for primary content. */
content: customPropTypes.content,
content: customPropTypes.contentShorthand,
}

export default MenuHeader
2 changes: 1 addition & 1 deletion src/collections/Menu/MenuItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export default class MenuItem extends Component {
color: PropTypes.oneOf(_meta.props.color),

/** Shorthand for primary content. */
content: customPropTypes.content,
content: customPropTypes.contentShorthand,

/** A menu item or menu can remove element padding, vertically or horizontally. */
fitted: PropTypes.oneOfType([
Expand Down
8 changes: 4 additions & 4 deletions src/collections/Message/Message.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,19 +116,19 @@ Message.propTypes = {
className: PropTypes.string,

/** Shorthand for primary content. */
content: customPropTypes.content,
content: customPropTypes.contentShorthand,

/** Shorthand for MessageHeader. */
header: customPropTypes.item,
header: customPropTypes.itemShorthand,

/** A message can contain an icon. */
icon: PropTypes.oneOfType([
PropTypes.bool,
customPropTypes.item,
customPropTypes.itemShorthand,
]),

/** Array of string items for the MessageList. Mutually exclusive with children. */
list: customPropTypes.items,
list: customPropTypes.collectionShorthand,

/**
* A message that the user can choose to hide.
Expand Down
4 changes: 2 additions & 2 deletions src/collections/Table/Table.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,10 +158,10 @@ Table.propTypes = {
fixed: PropTypes.bool,

/** Shorthand for a TableRow to be placed within Table.Footer. */
footerRow: customPropTypes.collection,
footerRow: customPropTypes.itemShorthand,

/** Shorthand for a TableRow to be placed within Table.Header. */
headerRow: customPropTypes.collection,
headerRow: customPropTypes.itemShorthand,

/** A table's colors can be inverted. */
inverted: PropTypes.bool,
Expand Down
4 changes: 2 additions & 2 deletions src/collections/Table/TableCell.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ TableCell.propTypes = {
collapsing: PropTypes.bool,

/** Shorthand for primary content. */
content: customPropTypes.content,
content: customPropTypes.contentShorthand,

/** A cell can be disabled. */
disabled: PropTypes.bool,
Expand All @@ -104,7 +104,7 @@ TableCell.propTypes = {
error: PropTypes.bool,

/** Add an Icon by name, props object, or pass an <Icon /> */
icon: customPropTypes.item,
icon: customPropTypes.itemShorthand,

/** A cell may let a user know whether a value is bad. */
negative: PropTypes.bool,
Expand Down
2 changes: 1 addition & 1 deletion src/collections/Table/TableRow.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ TableRow.propTypes = {
cellAs: customPropTypes.as,

/** Shorthand array of props for TableCell. */
cells: customPropTypes.items,
cells: customPropTypes.collectionShorthand,

/** Primary content. */
children: PropTypes.node,
Expand Down
2 changes: 1 addition & 1 deletion src/elements/Button/Button.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ Button.propTypes = {
className: PropTypes.string,

/** Shorthand for primary content. */
content: customPropTypes.content,
content: customPropTypes.contentShorthand,

/** A button can have different colors */
color: PropTypes.oneOf(Button._meta.props.color),
Expand Down
8 changes: 4 additions & 4 deletions src/elements/Header/Header.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,14 +97,14 @@ Header.propTypes = {
children: PropTypes.node,

/** Shorthand for primary content. */
content: customPropTypes.content,
content: customPropTypes.contentShorthand,

/** Add an icon by icon name or pass an <Icon /.> */
icon: customPropTypes.every([
customPropTypes.disallow(['image']),
PropTypes.oneOfType([
PropTypes.bool,
customPropTypes.item,
customPropTypes.itemShorthand,
]),
]),

Expand All @@ -113,7 +113,7 @@ Header.propTypes = {
customPropTypes.disallow(['icon']),
PropTypes.oneOfType([
PropTypes.bool,
customPropTypes.item,
customPropTypes.itemShorthand,
]),
]),

Expand Down Expand Up @@ -148,7 +148,7 @@ Header.propTypes = {
size: PropTypes.oneOf(Header._meta.props.size),

/** Shorthand for Header.Subheader. */
subheader: customPropTypes.item,
subheader: customPropTypes.itemShorthand,

/** Align header content */
textAlign: PropTypes.oneOf(Header._meta.props.textAlign),
Expand Down
2 changes: 1 addition & 1 deletion src/elements/Header/HeaderSubheader.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ HeaderSubheader.propTypes = {
className: PropTypes.string,

/** Shorthand for primary content. */
content: customPropTypes.content,
content: customPropTypes.contentShorthand,
}

export default HeaderSubheader
2 changes: 1 addition & 1 deletion src/elements/Image/Image.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ Image.propTypes = {
inline: PropTypes.bool,

/** Shorthand for Label. */
label: customPropTypes.item,
label: customPropTypes.itemShorthand,

/** An image may appear rounded or circular */
shape: PropTypes.oneOf(Image._meta.props.shape),
Expand Down
8 changes: 4 additions & 4 deletions src/elements/Input/Input.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ Input.propTypes = {
/** An Input can be formatted to alert the user to an action they may perform */
action: PropTypes.oneOfType([
PropTypes.bool,
customPropTypes.item,
customPropTypes.itemShorthand,
]),

/** An action can appear along side an Input on the left or right */
Expand All @@ -172,7 +172,7 @@ Input.propTypes = {
/** Optional Icon to display inside the Input */
icon: PropTypes.oneOfType([
PropTypes.bool,
customPropTypes.item,
customPropTypes.itemShorthand,
]),

/** An Icon can appear inside an Input on the left or right */
Expand All @@ -182,10 +182,10 @@ Input.propTypes = {
inverted: PropTypes.bool,

/** Shorthand for creating the HTML Input */
input: customPropTypes.item,
input: customPropTypes.itemShorthand,

/** Optional Label to display along side the Input */
label: customPropTypes.item,
label: customPropTypes.itemShorthand,

/** A Label can appear outside an Input on the left or right */
labelPosition: PropTypes.oneOf(Input._meta.props.labelPosition),
Expand Down
8 changes: 4 additions & 4 deletions src/elements/Label/Label.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export default class Label extends Component {
color: PropTypes.oneOf(_meta.props.color),

/** Shorthand for primary content. */
content: customPropTypes.content,
content: customPropTypes.contentShorthand,

/** A label can position itself in the corner of an element. */
corner: PropTypes.oneOfType([
Expand All @@ -68,7 +68,7 @@ export default class Label extends Component {
]),

/** Shorthand for LabelDetail. */
detail: customPropTypes.item,
detail: customPropTypes.itemShorthand,

/** Formats the label as a dot. */
empty: customPropTypes.every([
Expand All @@ -83,12 +83,12 @@ export default class Label extends Component {
horizontal: PropTypes.bool,

/** Shorthand for Icon. */
icon: customPropTypes.item,
icon: customPropTypes.itemShorthand,

/** A label can be formatted to emphasize an image or prop can be used as shorthand for Image. */
image: PropTypes.oneOfType([
PropTypes.bool,
customPropTypes.item,
customPropTypes.itemShorthand,
]),

/** A label can point to content next to it. */
Expand Down
2 changes: 1 addition & 1 deletion src/elements/Label/LabelDetail.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ LabelDetail.propTypes = {
className: PropTypes.string,

/** Shorthand for primary content. */
content: customPropTypes.content,
content: customPropTypes.contentShorthand,
}

export default LabelDetail
2 changes: 1 addition & 1 deletion src/elements/Loader/Loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ Loader.propTypes = {
size: PropTypes.oneOf(Loader._meta.props.size),

/** Shorthand for primary content. */
text: customPropTypes.content,
text: customPropTypes.contentShorthand,
}

export default Loader
6 changes: 3 additions & 3 deletions src/elements/Step/Step.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ export default class Step extends Component {
completed: PropTypes.bool,

/** Shorthand for StepDescription. */
description: customPropTypes.item,
description: customPropTypes.itemShorthand,

/** Show that the Loader is inactive. */
disabled: PropTypes.bool,

/** Shorthand for Icon. */
icon: customPropTypes.item,
icon: customPropTypes.itemShorthand,

/** A step can be link. */
link: PropTypes.bool,
Expand All @@ -57,7 +57,7 @@ export default class Step extends Component {
ordered: PropTypes.bool,

/** Shorthand for StepTitle. */
title: customPropTypes.item,
title: customPropTypes.itemShorthand,
}

static _meta = {
Expand Down
4 changes: 2 additions & 2 deletions src/elements/Step/StepContent.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ StepContent.propTypes = {
children: PropTypes.node,

/** Shorthand for StepDescription. */
description: customPropTypes.item,
description: customPropTypes.itemShorthand,

/** Shorthand for StepTitle. */
title: customPropTypes.item,
title: customPropTypes.itemShorthand,
}

export default StepContent
2 changes: 1 addition & 1 deletion src/elements/Step/StepDescription.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ StepDescription.propTypes = {
children: PropTypes.node,

/** Shorthand for primary content. */
description: customPropTypes.content,
description: customPropTypes.contentShorthand,
}

export default StepDescription
2 changes: 1 addition & 1 deletion src/elements/Step/StepGroup.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ StepGroup.propTypes = {
fluid: PropTypes.bool,

/** Shorthand array of props for Step. */
items: customPropTypes.items,
items: customPropTypes.collectionShorthand,

/** A step can show a ordered sequence of steps. */
ordered: PropTypes.bool,
Expand Down
2 changes: 1 addition & 1 deletion src/elements/Step/StepTitle.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ StepTitle.propTypes = {
children: PropTypes.node,

/** Shorthand for primary content. */
title: customPropTypes.content,
title: customPropTypes.contentShorthand,
}

export default StepTitle
27 changes: 6 additions & 21 deletions src/lib/customPropTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ export const demand = (requiredProps) => {
/**
* Ensure a component can render as a node passed as a prop value in place of children.
*/
export const content = (...args) => every([
export const contentShorthand = (...args) => every([
disallow(['children']),
PropTypes.node,
])(...args)
Expand All @@ -192,35 +192,20 @@ export const content = (...args) => every([
* Item shorthand is a description of a component that can be a literal,
* a props object, or an element.
*/
export const item = (...args) => every([
export const itemShorthand = (...args) => every([
disallow(['children']),
PropTypes.oneOfType([
PropTypes.element,
PropTypes.number,
PropTypes.node,
PropTypes.object,
PropTypes.string,
]),
])(...args)

/**
* ArrayOf shorthand ensures a prop is an array of item shorthand
* Collection shorthand ensures a prop is an array of item shorthand.
*/
export const items = (...args) => every([
export const itemsShorthand = (...args) => every([
disallow(['children']),
PropTypes.arrayOf(item),
])(...args)

/**
* Collection shorthand is a description of a component that can be an array of
* shorthand for the underlying items, a props object, or an element.
*/
export const collection = (...args) => every([
disallow(['children']),
PropTypes.oneOfType([
items,
PropTypes.element,
PropTypes.object,
]),
PropTypes.arrayOf(itemShorthand),
])(...args)

/**
Expand Down
4 changes: 2 additions & 2 deletions src/modules/Dropdown/DropdownHeader.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ DropdownHeader.propTypes = {
className: PropTypes.string,

/** Shorthand for primary content. */
content: customPropTypes.content,
content: customPropTypes.contentShorthand,

/** Shorthand for Icon. */
icon: customPropTypes.item,
icon: customPropTypes.itemShorthand,
}

export default DropdownHeader
Loading

0 comments on commit 9928ccc

Please sign in to comment.