cf-component-card
Advanced tools
Comparing version 0.2.3 to 1.0.0
"use strict"; | ||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -10,2 +12,3 @@ | ||
var React = require('react'); | ||
var PropTypes = React.PropTypes; | ||
@@ -18,12 +21,15 @@ var Card = function (_React$Component) { | ||
return _possibleConstructorReturn(this, _React$Component.apply(this, arguments)); | ||
return _possibleConstructorReturn(this, (Card.__proto__ || Object.getPrototypeOf(Card)).apply(this, arguments)); | ||
} | ||
Card.prototype.render = function render() { | ||
return React.createElement( | ||
"section", | ||
{ className: "cf-card" }, | ||
this.props.children | ||
); | ||
}; | ||
_createClass(Card, [{ | ||
key: "render", | ||
value: function render() { | ||
return React.createElement( | ||
"section", | ||
{ className: "cf-card" }, | ||
this.props.children | ||
); | ||
} | ||
}]); | ||
@@ -33,2 +39,6 @@ return Card; | ||
Card.propTypes = { | ||
children: PropTypes.node | ||
}; | ||
module.exports = Card; |
"use strict"; | ||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -18,22 +20,25 @@ | ||
return _possibleConstructorReturn(this, _React$Component.apply(this, arguments)); | ||
return _possibleConstructorReturn(this, (CardContent.__proto__ || Object.getPrototypeOf(CardContent)).apply(this, arguments)); | ||
} | ||
CardContent.prototype.render = function render() { | ||
return React.createElement( | ||
"div", | ||
{ className: "cf-card__content" }, | ||
React.createElement( | ||
"h3", | ||
{ className: "cf-card__title" }, | ||
this.props.title | ||
), | ||
this.props.children, | ||
this.props.footerMessage ? React.createElement( | ||
_createClass(CardContent, [{ | ||
key: "render", | ||
value: function render() { | ||
return React.createElement( | ||
"div", | ||
{ className: "cf-card__footer_message" }, | ||
this.props.footerMessage | ||
) : null | ||
); | ||
}; | ||
{ className: "cf-card__content" }, | ||
React.createElement( | ||
"h3", | ||
{ className: "cf-card__title" }, | ||
this.props.title | ||
), | ||
this.props.children, | ||
this.props.footerMessage ? React.createElement( | ||
"div", | ||
{ className: "cf-card__footer_message" }, | ||
this.props.footerMessage | ||
) : null | ||
); | ||
} | ||
}]); | ||
@@ -45,6 +50,6 @@ return CardContent; | ||
title: PropTypes.any.isRequired, | ||
footerMessage: PropTypes.string | ||
footerMessage: PropTypes.string, | ||
children: PropTypes.node | ||
}; | ||
module.exports = CardContent; |
"use strict"; | ||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -10,2 +12,3 @@ | ||
var React = require('react'); | ||
var PropTypes = React.PropTypes; | ||
@@ -18,12 +21,15 @@ var CardControl = function (_React$Component) { | ||
return _possibleConstructorReturn(this, _React$Component.apply(this, arguments)); | ||
return _possibleConstructorReturn(this, (CardControl.__proto__ || Object.getPrototypeOf(CardControl)).apply(this, arguments)); | ||
} | ||
CardControl.prototype.render = function render() { | ||
return React.createElement( | ||
"div", | ||
{ className: "cf-card__control" }, | ||
this.props.children | ||
); | ||
}; | ||
_createClass(CardControl, [{ | ||
key: "render", | ||
value: function render() { | ||
return React.createElement( | ||
"div", | ||
{ className: "cf-card__control" }, | ||
this.props.children | ||
); | ||
} | ||
}]); | ||
@@ -33,2 +39,6 @@ return CardControl; | ||
CardControl.propTypes = { | ||
children: PropTypes.node | ||
}; | ||
module.exports = CardControl; |
'use strict'; | ||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -22,70 +24,70 @@ | ||
function CardDrawers() { | ||
var _temp, _this, _ret; | ||
function CardDrawers(props) { | ||
_classCallCheck(this, CardDrawers); | ||
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { | ||
args[_key] = arguments[_key]; | ||
} | ||
var _this = _possibleConstructorReturn(this, (CardDrawers.__proto__ || Object.getPrototypeOf(CardDrawers)).call(this, props)); | ||
return _ret = (_temp = (_this = _possibleConstructorReturn(this, _React$Component.call.apply(_React$Component, [this].concat(args))), _this), _this._cardId = UNIQUE_ID++, _temp), _possibleConstructorReturn(_this, _ret); | ||
_this._cardId = UNIQUE_ID++; | ||
return _this; | ||
} | ||
CardDrawers.prototype.render = function render() { | ||
var _this2 = this; | ||
_createClass(CardDrawers, [{ | ||
key: 'render', | ||
value: function render() { | ||
var _this2 = this; | ||
var links = []; | ||
var drawers = []; | ||
var links = []; | ||
var drawers = []; | ||
this.props.drawers.forEach(function (drawer) { | ||
var isActive = drawer.id === _this2.props.active; | ||
var id = 'card-' + _this2._cardId + '-drawer-' + drawer.id; | ||
this.props.drawers.forEach(function (drawer) { | ||
var isActive = drawer.id === _this2.props.active; | ||
var id = 'card-' + _this2._cardId + '-drawer-' + drawer.id; | ||
links.push(React.createElement( | ||
CardToolbarLink, | ||
{ | ||
key: drawer.id, | ||
id: id, | ||
isActive: isActive, | ||
onClick: _this2.props.onClick.bind(null, drawer.id) }, | ||
drawer.name | ||
)); | ||
links.push(React.createElement( | ||
CardToolbarLink, | ||
{ | ||
key: drawer.id, | ||
id: id, | ||
isActive: isActive, | ||
onClick: _this2.props.onClick.bind(null, drawer.id) }, | ||
drawer.name | ||
)); | ||
var className = 'cf-card__drawer'; | ||
var className = 'cf-card__drawer'; | ||
if (isActive) { | ||
className += ' cf-card__drawer--active'; | ||
} | ||
if (isActive) { | ||
className += ' cf-card__drawer--active'; | ||
} | ||
drawers.push(React.createElement( | ||
'div', | ||
{ | ||
key: drawer.id, | ||
role: 'tabpanel', | ||
'aria-labelledby': id, | ||
'aria-hidden': isActive ? 'false' : 'true', | ||
className: className }, | ||
isActive && drawer.content | ||
)); | ||
}); | ||
drawers.push(React.createElement( | ||
'div', | ||
{ | ||
key: drawer.id, | ||
role: 'tabpanel', | ||
'aria-labelledby': id, | ||
'aria-hidden': isActive ? 'false' : 'true', | ||
className: className }, | ||
isActive && drawer.content | ||
)); | ||
}); | ||
var containerClassName = 'cf-card__drawers_container'; | ||
var containerClassName = 'cf-card__drawers_container'; | ||
if (this.props.active) { | ||
containerClassName += ' cf-card__drawers_container--open'; | ||
if (this.props.active) { | ||
containerClassName += ' cf-card__drawers_container--open'; | ||
} | ||
return React.createElement( | ||
CardSection, | ||
null, | ||
React.createElement(CardToolbar, { controls: this.props.controls, links: links }), | ||
React.createElement( | ||
'div', | ||
{ className: containerClassName }, | ||
drawers | ||
) | ||
); | ||
} | ||
}]); | ||
return React.createElement( | ||
CardSection, | ||
null, | ||
React.createElement(CardToolbar, { controls: this.props.controls, links: links }), | ||
React.createElement( | ||
'div', | ||
{ className: containerClassName }, | ||
drawers | ||
) | ||
); | ||
}; | ||
return CardDrawers; | ||
@@ -104,3 +106,2 @@ }(React.Component); | ||
module.exports = CardDrawers; |
"use strict"; | ||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -17,8 +19,11 @@ | ||
return _possibleConstructorReturn(this, _React$Component.apply(this, arguments)); | ||
return _possibleConstructorReturn(this, (CardLoadingText.__proto__ || Object.getPrototypeOf(CardLoadingText)).apply(this, arguments)); | ||
} | ||
CardLoadingText.prototype.render = function render() { | ||
return React.createElement("div", { className: "cf-card__loading_text" }); | ||
}; | ||
_createClass(CardLoadingText, [{ | ||
key: "render", | ||
value: function render() { | ||
return React.createElement("div", { className: "cf-card__loading_text" }); | ||
} | ||
}]); | ||
@@ -25,0 +30,0 @@ return CardLoadingText; |
@@ -1,3 +0,5 @@ | ||
'use strict'; | ||
"use strict"; | ||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -18,18 +20,21 @@ | ||
return _possibleConstructorReturn(this, _React$Component.apply(this, arguments)); | ||
return _possibleConstructorReturn(this, (CardMessages.__proto__ || Object.getPrototypeOf(CardMessages)).apply(this, arguments)); | ||
} | ||
CardMessages.prototype.render = function render() { | ||
return React.createElement( | ||
'div', | ||
{ className: 'cf-card__messages' }, | ||
this.props.messages.map(function (message, index) { | ||
return React.createElement( | ||
'div', | ||
{ key: index, role: 'alert', className: 'cf-card__message cf-card__message--' + message.type }, | ||
message.content | ||
); | ||
}) | ||
); | ||
}; | ||
_createClass(CardMessages, [{ | ||
key: "render", | ||
value: function render() { | ||
return React.createElement( | ||
"div", | ||
{ className: "cf-card__messages" }, | ||
this.props.messages.map(function (message, index) { | ||
return React.createElement( | ||
"div", | ||
{ key: index, role: "alert", className: 'cf-card__message cf-card__message--' + message.type }, | ||
message.content | ||
); | ||
}) | ||
); | ||
} | ||
}]); | ||
@@ -46,3 +51,2 @@ return CardMessages; | ||
module.exports = CardMessages; |
'use strict'; | ||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -18,12 +20,15 @@ | ||
return _possibleConstructorReturn(this, _React$Component.apply(this, arguments)); | ||
return _possibleConstructorReturn(this, (CardSection.__proto__ || Object.getPrototypeOf(CardSection)).apply(this, arguments)); | ||
} | ||
CardSection.prototype.render = function render() { | ||
return React.createElement( | ||
'div', | ||
{ className: 'cf-card__section cf-card__section--' + this.props.status }, | ||
this.props.children | ||
); | ||
}; | ||
_createClass(CardSection, [{ | ||
key: 'render', | ||
value: function render() { | ||
return React.createElement( | ||
'div', | ||
{ className: 'cf-card__section cf-card__section--' + this.props.status }, | ||
this.props.children | ||
); | ||
} | ||
}]); | ||
@@ -34,4 +39,6 @@ return CardSection; | ||
CardSection.propTypes = { | ||
status: PropTypes.oneOf(['default', 'error']) | ||
status: PropTypes.oneOf(['default', 'error']), | ||
children: PropTypes.node | ||
}; | ||
CardSection.defaultProps = { | ||
@@ -41,3 +48,2 @@ status: 'default' | ||
module.exports = CardSection; |
"use strict"; | ||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -18,21 +20,24 @@ | ||
return _possibleConstructorReturn(this, _React$Component.apply(this, arguments)); | ||
return _possibleConstructorReturn(this, (CardToolbar.__proto__ || Object.getPrototypeOf(CardToolbar)).apply(this, arguments)); | ||
} | ||
CardToolbar.prototype.render = function render() { | ||
return React.createElement( | ||
"div", | ||
{ className: "cf-card__toolbar" }, | ||
React.createElement( | ||
_createClass(CardToolbar, [{ | ||
key: "render", | ||
value: function render() { | ||
return React.createElement( | ||
"div", | ||
{ className: "cf-card__toolbar_controls" }, | ||
this.props.controls | ||
), | ||
React.createElement( | ||
"div", | ||
{ className: "cf-card__toolbar_links", role: "tablist" }, | ||
this.props.links | ||
) | ||
); | ||
}; | ||
{ className: "cf-card__toolbar" }, | ||
React.createElement( | ||
"div", | ||
{ className: "cf-card__toolbar_controls" }, | ||
this.props.controls | ||
), | ||
React.createElement( | ||
"div", | ||
{ className: "cf-card__toolbar_links", role: "tablist" }, | ||
this.props.links | ||
) | ||
); | ||
} | ||
}]); | ||
@@ -47,3 +52,2 @@ return CardToolbar; | ||
module.exports = CardToolbar; |
'use strict'; | ||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -16,31 +18,34 @@ | ||
function CardToolbarLink() { | ||
var _temp, _this, _ret; | ||
function CardToolbarLink(props) { | ||
_classCallCheck(this, CardToolbarLink); | ||
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { | ||
args[_key] = arguments[_key]; | ||
} | ||
var _this = _possibleConstructorReturn(this, (CardToolbarLink.__proto__ || Object.getPrototypeOf(CardToolbarLink)).call(this, props)); | ||
return _ret = (_temp = (_this = _possibleConstructorReturn(this, _React$Component.call.apply(_React$Component, [this].concat(args))), _this), _this.handleClick = function (e) { | ||
e.preventDefault(); | ||
_this.props.onClick(); | ||
}, _temp), _possibleConstructorReturn(_this, _ret); | ||
_this.handleClick = _this.handleClick.bind(_this); | ||
return _this; | ||
} | ||
CardToolbarLink.prototype.render = function render() { | ||
var className = 'cf-card__toolbar_link'; | ||
_createClass(CardToolbarLink, [{ | ||
key: 'handleClick', | ||
value: function handleClick(e) { | ||
e.preventDefault(); | ||
this.props.onClick(); | ||
} | ||
}, { | ||
key: 'render', | ||
value: function render() { | ||
var className = 'cf-card__toolbar_link'; | ||
if (this.props.isActive) { | ||
className += ' cf-card__toolbar_link--open'; | ||
if (this.props.isActive) { | ||
className += ' cf-card__toolbar_link--open'; | ||
} | ||
return React.createElement( | ||
Link, | ||
{ role: 'tab', id: this.props.id, className: className, onClick: this.handleClick }, | ||
this.props.children | ||
); | ||
} | ||
}]); | ||
return React.createElement( | ||
Link, | ||
{ role: 'tab', id: this.props.id, className: className, onClick: this.handleClick }, | ||
this.props.children | ||
); | ||
}; | ||
return CardToolbarLink; | ||
@@ -52,6 +57,6 @@ }(React.Component); | ||
isActive: PropTypes.bool.isRequired, | ||
id: PropTypes.string | ||
id: PropTypes.string, | ||
children: PropTypes.node | ||
}; | ||
module.exports = CardToolbarLink; |
{ | ||
"name": "cf-component-card", | ||
"description": "CloudFlare Card Component", | ||
"version": "0.2.3", | ||
"version": "1.0.0", | ||
"main": "lib/index.js", | ||
@@ -12,10 +12,10 @@ "author": "James Kyle <jkyle@cloudflare.com>", | ||
"dependencies": { | ||
"cf-component-link": "^3.0.2", | ||
"react": "^0.14.2" | ||
"cf-component-link": "^4.0.0", | ||
"react": "^0.14.2 || ^15.0.0-0" | ||
}, | ||
"devDependencies": { | ||
"assert-equal-jsx": "^1.0.0", | ||
"cf-component-button": "^2.2.3", | ||
"react-dom": "^0.14.2" | ||
"cf-component-button": "^3.0.0", | ||
"react-dom": "^15.0.0-0" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
24532
383
1
+ Addedcf-component-link@4.2.3(transitive)
+ Addedcf-util-route-handler@4.2.5(transitive)
+ Addedcreate-react-class@15.7.0(transitive)
+ Addedencoding@0.1.13(transitive)
+ Addedfbjs@0.8.18(transitive)
+ Addediconv-lite@0.6.3(transitive)
+ Addedis-stream@1.1.0(transitive)
+ Addedisomorphic-fetch@2.2.1(transitive)
+ Addednode-fetch@1.7.3(transitive)
+ Addedobject-assign@4.1.1(transitive)
+ Addedprop-types@15.8.1(transitive)
+ Addedreact@15.7.0(transitive)
+ Addedreact-is@16.13.1(transitive)
+ Addedsetimmediate@1.0.5(transitive)
+ Addedwhatwg-fetch@3.6.20(transitive)
- Removedacorn@5.7.4(transitive)
- Removedamdefine@1.0.1(transitive)
- Removedast-types@0.9.6(transitive)
- Removedbalanced-match@1.0.2(transitive)
- Removedbase62@1.2.8(transitive)
- Removedbrace-expansion@1.1.11(transitive)
- Removedcf-component-link@3.0.2(transitive)
- Removedcf-util-route-handler@3.0.0(transitive)
- Removedcommander@2.20.3(transitive)
- Removedcommoner@0.10.8(transitive)
- Removedconcat-map@0.0.1(transitive)
- Removeddefined@1.0.1(transitive)
- Removeddetective@4.7.1(transitive)
- Removedenvify@3.4.1(transitive)
- Removedesprima@3.1.3(transitive)
- Removedesprima-fb@15001.1.0-dev-harmony-fb(transitive)
- Removedfbjs@0.6.1(transitive)
- Removedglob@5.0.15(transitive)
- Removedgraceful-fs@4.2.11(transitive)
- Removediconv-lite@0.4.24(transitive)
- Removedinflight@1.0.6(transitive)
- Removedinherits@2.0.4(transitive)
- Removedjstransform@11.0.3(transitive)
- Removedminimatch@3.1.2(transitive)
- Removedminimist@1.2.8(transitive)
- Removedmkdirp@0.5.6(transitive)
- Removedobject-assign@2.1.1(transitive)
- Removedonce@1.4.0(transitive)
- Removedpath-is-absolute@1.0.1(transitive)
- Removedprivate@0.1.8(transitive)
- Removedq@1.5.1(transitive)
- Removedreact@0.14.10(transitive)
- Removedrecast@0.11.23(transitive)
- Removedsource-map@0.4.40.5.7(transitive)
- Removedthrough@2.3.8(transitive)
- Removedwhatwg-fetch@0.9.0(transitive)
- Removedwrappy@1.0.2(transitive)
Updatedcf-component-link@^4.0.0
Updatedreact@^0.14.2 || ^15.0.0-0