@bigbinary/neetoui
Version:
neetoUI drives the experience at all neeto products
46 lines (43 loc) • 2.31 kB
JavaScript
import _defineProperty from '@babel/runtime/helpers/defineProperty';
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
import { forwardRef } from 'react';
import classnames from 'classnames';
import { jsxs, jsx } from 'react/jsx-runtime';
var _excluded = ["icon", "style", "className", "children"];
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
var STYLES = {
info: "info",
warning: "warning",
danger: "danger",
success: "success"
};
var Callout = /*#__PURE__*/forwardRef(function (_ref, ref) {
var _ref$icon = _ref.icon,
icon = _ref$icon === void 0 ? null : _ref$icon,
_ref$style = _ref.style,
style = _ref$style === void 0 ? STYLES.info : _ref$style,
_ref$className = _ref.className,
className = _ref$className === void 0 ? "" : _ref$className,
children = _ref.children,
otherProps = _objectWithoutProperties(_ref, _excluded);
var Icon = icon;
return /*#__PURE__*/jsxs("div", _objectSpread(_objectSpread({
ref: ref,
className: classnames("neeto-ui-callout", _defineProperty({
"neeto-ui-callout--info": style === STYLES.info,
"neeto-ui-callout--warning": style === STYLES.warning,
"neeto-ui-callout--danger": style === STYLES.danger,
"neeto-ui-callout--success": style === STYLES.success
}, className, className))
}, otherProps), {}, {
children: [icon && /*#__PURE__*/jsx("div", {
className: "neeto-ui-callout__icon",
"data-testid": "callout-icon",
children: /*#__PURE__*/jsx(Icon, {})
}), children]
}));
});
Callout.displayName = "Callout";
export { Callout as default };
//# sourceMappingURL=Callout.js.map