Skip to content
This repository was archived by the owner on Jan 21, 2019. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 9 additions & 23 deletions components/BannerNotification.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ var Icon = function Icon(_ref) {
className = _ref.className,
small = _ref.small,
tiny = _ref.tiny,
props = _objectWithoutProperties(_ref, ["name", "className", "small", "tiny"]);
rest = _objectWithoutProperties(_ref, ["name", "className", "small", "tiny"]);

var isSmall = small || /-small$/.test(name);
var isTiny = tiny || /-tiny$/.test(name);
Expand All @@ -79,30 +79,22 @@ var Icon = function Icon(_ref) {
}).join(' ');
return React.createElement("svg", _extends({
className: classes
}, props), React.createElement("use", {
}, rest), React.createElement("use", {
xlinkHref: "#wds-icons-".concat(name)
}));
};

Icon.propTypes = {
/**
* Icon name - both `-small` and `-tiny` prefix are also updating class name
*/
/** Additional class name */
className: PropTypes.string,

/**
* Additional class name
*/
/** name - both `-small` and `-tiny` prefix are also updating class name */
name: PropTypes.string.isRequired,

/**
* `wds-icon-small` flag for the class name (but not for the icon name)
*/
/** `wds-icon-small` flag for the class name (but not for the icon name) */
small: PropTypes.bool,

/**
* `wds-icon-tiny` flag for the class name (but not for the icon name)
*/
/** `wds-icon-tiny` flag for the class name (but not for the icon name) */
tiny: PropTypes.bool
};
Icon.defaultProps = {
Expand Down Expand Up @@ -169,20 +161,14 @@ var BannerNotification = function BannerNotification(_ref) {
};

BannerNotification.propTypes = {
/**
* @ignore
*/
/** Children to display */
children: PropTypes.node,

/**
* An additional class name
*/
/** An additional class name */
className: PropTypes.string,
onClose: PropTypes.func,

/**
* Text to display if there are no children.
*/
/** Text to display if there are no children. */
text: PropTypes.string,
type: PropTypes.oneOf(['alert', 'warning', 'success', 'message']).isRequired
};
Expand Down
93 changes: 46 additions & 47 deletions components/BannerNotifications.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,21 @@ function _createClass(Constructor, protoProps, staticProps) {
return Constructor;
}

function _defineProperty(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}

return obj;
}

function _extends() {
_extends = Object.assign || function (target) {
for (var i = 1; i < arguments.length; i++) {
Expand Down Expand Up @@ -139,7 +154,7 @@ var Icon = function Icon(_ref) {
className = _ref.className,
small = _ref.small,
tiny = _ref.tiny,
props = _objectWithoutProperties(_ref, ["name", "className", "small", "tiny"]);
rest = _objectWithoutProperties(_ref, ["name", "className", "small", "tiny"]);

var isSmall = small || /-small$/.test(name);
var isTiny = tiny || /-tiny$/.test(name);
Expand All @@ -148,30 +163,22 @@ var Icon = function Icon(_ref) {
}).join(' ');
return React.createElement("svg", _extends({
className: classes
}, props), React.createElement("use", {
}, rest), React.createElement("use", {
xlinkHref: "#wds-icons-".concat(name)
}));
};

Icon.propTypes = {
/**
* Icon name - both `-small` and `-tiny` prefix are also updating class name
*/
/** Additional class name */
className: PropTypes.string,

/**
* Additional class name
*/
/** name - both `-small` and `-tiny` prefix are also updating class name */
name: PropTypes.string.isRequired,

/**
* `wds-icon-small` flag for the class name (but not for the icon name)
*/
/** `wds-icon-small` flag for the class name (but not for the icon name) */
small: PropTypes.bool,

/**
* `wds-icon-tiny` flag for the class name (but not for the icon name)
*/
/** `wds-icon-tiny` flag for the class name (but not for the icon name) */
tiny: PropTypes.bool
};
Icon.defaultProps = {
Expand Down Expand Up @@ -238,20 +245,14 @@ var BannerNotification = function BannerNotification(_ref) {
};

BannerNotification.propTypes = {
/**
* @ignore
*/
/** Children to display */
children: PropTypes.node,

/**
* An additional class name
*/
/** An additional class name */
className: PropTypes.string,
onClose: PropTypes.func,

/**
* Text to display if there are no children.
*/
/** Text to display if there are no children. */
text: PropTypes.string,
type: PropTypes.oneOf(['alert', 'warning', 'success', 'message']).isRequired
};
Expand Down Expand Up @@ -291,23 +292,28 @@ var BannerNotifications =
function (_React$Component) {
_inherits(BannerNotifications, _React$Component);

function BannerNotifications(props) {
function BannerNotifications() {
var _getPrototypeOf2;

var _this;

_classCallCheck(this, BannerNotifications);

_this = _possibleConstructorReturn(this, _getPrototypeOf(BannerNotifications).call(this, props));
_this.onClose = _this.onClose.bind(_assertThisInitialized(_assertThisInitialized(_this)));
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}

_this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(BannerNotifications)).call.apply(_getPrototypeOf2, [this].concat(args)));

_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "onClose", function (id) {
var onClose = _this.props.onClose;
onClose(id);
});

return _this;
}

_createClass(BannerNotifications, [{
key: "onClose",
value: function onClose(id) {
var onClose = this.props.onClose;
onClose(id);
}
}, {
key: "renderNotification",
value: function renderNotification(_ref) {
var _this2 = this;
Expand Down Expand Up @@ -356,26 +362,19 @@ function (_React$Component) {
return BannerNotifications;
}(React.Component);

BannerNotifications.propTypes = {
/**
* An additional class name
*/
_defineProperty(BannerNotifications, "propTypes", {
/** An additional class name */
className: PropTypes.string,

/**
* An array of `bannerNotificationsMessageType` objects
* @type {bannerNotificationsMessageType}
*/
/** An array of `bannerNotificationsMessageType` objects */
messages: PropTypes.arrayOf(messageType).isRequired,

/**
* Action invoked when close button is clicked
* @type {[type]}
*/
/** Action invoked when close button is clicked */
onClose: PropTypes.func.isRequired
};
BannerNotifications.defaultProps = {
});

_defineProperty(BannerNotifications, "defaultProps", {
className: ''
};
});

module.exports = BannerNotifications;
37 changes: 9 additions & 28 deletions components/Button.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,50 +90,31 @@ var Button = function Button(_ref) {
};

Button.propTypes = {
/**
* @ignore
*/
/** @ignore */
children: PropTypes.node,

/**
* href attribute.
* Button uses `<a>` tag if it's present.
*/
/** Additional class name */
className: PropTypes.string,

/**
* Additional class name
*/
/** Disabled attribute for the `<button>` */
disabled: PropTypes.bool,

/**
* Disabled attribute for the `<button>`
*/
/** Full width flag */
fullwidth: PropTypes.bool,

/**
* Secondary flag
*/
/** href attribute - `<Button/>` uses `<a>` tag if it's present */
href: PropTypes.string,

/**
* Square flag
*/
/** Callback for the `<button>` */
onClick: PropTypes.func,

/**
* Text flag
*/
/** Secondary flag */
secondary: PropTypes.bool,

/**
* Full width flag
*/
/** Square flag */
square: PropTypes.bool,

/**
* Callback for the `<button>`
*/
/** Text flag */
text: PropTypes.bool
};
Button.defaultProps = {
Expand Down
8 changes: 2 additions & 6 deletions components/ButtonGroup.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,10 @@ var ButtonGroup = function ButtonGroup(_ref) {
};

ButtonGroup.propTypes = {
/**
* @ignore
*/
/** @ignore */
children: PropTypes.node,

/**
* Additional class name
*/
/** Additional class name */
className: PropTypes.string
};
ButtonGroup.defaultProps = {
Expand Down
70 changes: 61 additions & 9 deletions components/ContentWell.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,79 @@ function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'defau
var React = _interopDefault(require('react'));
var PropTypes = _interopDefault(require('prop-types'));

function _extends() {
_extends = Object.assign || function (target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];

for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}

return target;
};

return _extends.apply(this, arguments);
}

function _objectWithoutPropertiesLoose(source, excluded) {
if (source == null) return {};
var target = {};
var sourceKeys = Object.keys(source);
var key, i;

for (i = 0; i < sourceKeys.length; i++) {
key = sourceKeys[i];
if (excluded.indexOf(key) >= 0) continue;
target[key] = source[key];
}

return target;
}

function _objectWithoutProperties(source, excluded) {
if (source == null) return {};

var target = _objectWithoutPropertiesLoose(source, excluded);

var key, i;

if (Object.getOwnPropertySymbols) {
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);

for (i = 0; i < sourceSymbolKeys.length; i++) {
key = sourceSymbolKeys[i];
if (excluded.indexOf(key) >= 0) continue;
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
target[key] = source[key];
}
}

return target;
}

/**
* ContentWell wraps `children` in `wds-content-well` CSS mixin.
*/

var ContentWell = function ContentWell(_ref) {
var className = _ref.className,
children = _ref.children;
return React.createElement("div", {
children = _ref.children,
rest = _objectWithoutProperties(_ref, ["className", "children"]);

return React.createElement("div", _extends({
className: "wds-content-well ".concat(className)
}, children);
}, rest), children);
};

ContentWell.propTypes = {
/**
* @ignore
*/
/** @ignore */
children: PropTypes.node,

/**
* Additional class name
*/
/** Additional class name */
className: PropTypes.string
};
ContentWell.defaultProps = {
Expand Down
Loading