stardust
Advanced tools
Comparing version 0.42.6 to 0.43.0
@@ -37,3 +37,4 @@ 'use strict'; | ||
var detail = props.detail; | ||
var detailLink = props.detailLink; | ||
var detailAs = props.detailAs; | ||
var empty = props.empty; | ||
var floating = props.floating; | ||
@@ -43,3 +44,2 @@ var horizontal = props.horizontal; | ||
var image = props.image; | ||
var link = props.link; | ||
var onClick = props.onClick; | ||
@@ -53,3 +53,3 @@ var onDetailClick = props.onDetailClick; | ||
var tag = props.tag; | ||
var text = props.text; | ||
var content = props.content; | ||
@@ -67,10 +67,8 @@ | ||
var classes = (0, _classnames2.default)('ui', size, color, (0, _lib.useKeyOnly)(basic, 'basic'), (0, _lib.useKeyOnly)(floating, 'floating'), (0, _lib.useKeyOnly)(horizontal, 'horizontal'), (0, _lib.useKeyOnly)(tag, 'tag'), (0, _lib.useValueAndKey)(attached, 'attached'), (0, _lib.useKeyOrValueAndKey)(corner, 'corner'), (0, _lib.useKeyOrValueAndKey)(pointing, 'pointing'), (0, _lib.useKeyOrValueAndKey)(ribbon, 'ribbon'), circular && (children && 'circular' || 'empty circular'), | ||
var classes = (0, _classnames2.default)('ui', size, color, (0, _lib.useKeyOnly)(basic, 'basic'), (0, _lib.useKeyOnly)(circular, 'circular'), (0, _lib.useKeyOnly)(floating, 'floating'), (0, _lib.useKeyOnly)(horizontal, 'horizontal'), (0, _lib.useKeyOnly)(empty, 'empty'), (0, _lib.useKeyOnly)(tag, 'tag'), (0, _lib.useValueAndKey)(attached, 'attached'), (0, _lib.useKeyOrValueAndKey)(corner, 'corner'), (0, _lib.useKeyOrValueAndKey)(pointing, 'pointing'), (0, _lib.useKeyOrValueAndKey)(ribbon, 'ribbon'), | ||
// TODO how to handle image child with no image class? there are two image style labels. | ||
(image || _lib.childrenUtils.someByType(children, _.Image) || _lib.childrenUtils.someByType(children, 'img')) && 'image', 'label', className); | ||
var DetailComponent = (detailLink || onDetailClick) && 'a' || 'div'; | ||
var ElementType = (0, _lib.getElementType)(Label, props, function () { | ||
if (image || link || onClick) return 'a'; | ||
}); | ||
var DetailComponent = detailAs || 'div'; | ||
var ElementType = (0, _lib.getElementType)(Label, props); | ||
var rest = (0, _lib.getUnhandledProps)(Label, props); | ||
@@ -83,3 +81,3 @@ | ||
(0, _factories.createImage)(image), | ||
text, | ||
content, | ||
children, | ||
@@ -118,4 +116,4 @@ detail && _react2.default.createElement( | ||
/** Primary content of the label, same as text. */ | ||
children: _react.PropTypes.node, | ||
/** Primary content of the label, same as content. */ | ||
children: _lib.customPropTypes.every([_lib.customPropTypes.disallow(['icon', 'image', 'content']), _react.PropTypes.node]), | ||
@@ -134,5 +132,8 @@ /** Classes to add to the label className. */ | ||
/** Format the detail as a link. */ | ||
detailLink: _react.PropTypes.bool, | ||
/** An element type to render the 'detail' as (string or function). */ | ||
detailAs: _react.PropTypes.oneOfType([_react.PropTypes.string, _react.PropTypes.func]), | ||
/** Formats the label as a dot. */ | ||
empty: _lib.customPropTypes.every([_lib.customPropTypes.demand(['circular']), _react.PropTypes.bool]), | ||
/** Format a label to align better alongside text. */ | ||
@@ -144,3 +145,3 @@ horizontal: _react.PropTypes.bool, | ||
/** Make the label circular, or a dot if it is empty. */ | ||
/** Make the label circular, or a dot when used with 'empty' prop. */ | ||
circular: _react.PropTypes.bool, | ||
@@ -154,5 +155,2 @@ | ||
/** Format the label as a link on hover. */ | ||
link: _react.PropTypes.bool, | ||
/** Adds the link style when present, called with (event, props). */ | ||
@@ -182,6 +180,6 @@ onClick: _react.PropTypes.func, | ||
/** Primary text of the label, same as children. */ | ||
text: _react.PropTypes.node | ||
/** Primary content of the label, same as children. */ | ||
content: _react.PropTypes.node | ||
}; | ||
exports.default = Label; |
{ | ||
"name": "stardust", | ||
"version": "0.42.6", | ||
"version": "0.43.0", | ||
"description": "The official Semantic-UI-React integration.", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -5,2 +5,3 @@ import cx from 'classnames' | ||
import { | ||
customPropTypes, | ||
getElementType, | ||
@@ -23,4 +24,4 @@ getUnhandledProps, | ||
const { | ||
attached, basic, children, color, corner, className, circular, detail, detailLink, floating, horizontal, | ||
icon, image, link, onClick, onDetailClick, onRemove, pointing, removable, ribbon, size, tag, text, | ||
attached, basic, children, color, corner, className, circular, detail, detailAs, empty, floating, horizontal, | ||
icon, image, onClick, onDetailClick, onRemove, pointing, removable, ribbon, size, tag, content, | ||
} = props | ||
@@ -36,4 +37,6 @@ | ||
useKeyOnly(basic, 'basic'), | ||
useKeyOnly(circular, 'circular'), | ||
useKeyOnly(floating, 'floating'), | ||
useKeyOnly(horizontal, 'horizontal'), | ||
useKeyOnly(empty, 'empty'), | ||
useKeyOnly(tag, 'tag'), | ||
@@ -44,3 +47,2 @@ useValueAndKey(attached, 'attached'), | ||
useKeyOrValueAndKey(ribbon, 'ribbon'), | ||
circular && (children && 'circular' || 'empty circular'), | ||
// TODO how to handle image child with no image class? there are two image style labels. | ||
@@ -52,6 +54,4 @@ (image || childrenUtils.someByType(children, Image) || childrenUtils.someByType(children, 'img')) && 'image', | ||
const DetailComponent = (detailLink || onDetailClick) && 'a' || 'div' | ||
const ElementType = getElementType(Label, props, () => { | ||
if (image || link || onClick) return 'a' | ||
}) | ||
const DetailComponent = detailAs || 'div' | ||
const ElementType = getElementType(Label, props) | ||
const rest = getUnhandledProps(Label, props) | ||
@@ -63,3 +63,3 @@ | ||
{createImage(image)} | ||
{text} | ||
{content} | ||
{children} | ||
@@ -102,4 +102,7 @@ {detail && ( | ||
/** Primary content of the label, same as text. */ | ||
children: PropTypes.node, | ||
/** Primary content of the label, same as content. */ | ||
children: customPropTypes.every([ | ||
customPropTypes.disallow(['icon', 'image', 'content']), | ||
PropTypes.node, | ||
]), | ||
@@ -121,5 +124,14 @@ /** Classes to add to the label className. */ | ||
/** Format the detail as a link. */ | ||
detailLink: PropTypes.bool, | ||
/** An element type to render the 'detail' as (string or function). */ | ||
detailAs: PropTypes.oneOfType([ | ||
PropTypes.string, | ||
PropTypes.func, | ||
]), | ||
/** Formats the label as a dot. */ | ||
empty: customPropTypes.every([ | ||
customPropTypes.demand(['circular']), | ||
PropTypes.bool, | ||
]), | ||
/** Format a label to align better alongside text. */ | ||
@@ -131,3 +143,3 @@ horizontal: PropTypes.bool, | ||
/** Make the label circular, or a dot if it is empty. */ | ||
/** Make the label circular, or a dot when used with 'empty' prop. */ | ||
circular: PropTypes.bool, | ||
@@ -147,5 +159,2 @@ | ||
/** Format the label as a link on hover. */ | ||
link: PropTypes.bool, | ||
/** Adds the link style when present, called with (event, props). */ | ||
@@ -178,6 +187,6 @@ onClick: PropTypes.func, | ||
/** Primary text of the label, same as children. */ | ||
text: PropTypes.node, | ||
/** Primary content of the label, same as children. */ | ||
content: PropTypes.node, | ||
} | ||
export default Label |
Sorry, the diff of this file is too big to display
816351
18104