@kiwicom/orbit-components
Version:
Orbit-components is a React component library which provides developers with the easiest possible way of building Kiwi.com’s products.
84 lines (71 loc) • 4.09 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = exports.StyledFormFeedback = void 0;
var React = _interopRequireWildcard(require("react"));
var _styledComponents = _interopRequireDefault(require("styled-components"));
var _defaultTheme = _interopRequireDefault(require("../defaultTheme"));
var _consts = _interopRequireDefault(require("./consts"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
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; }
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; }
var StyledFormFeedback = (0, _styledComponents.default)(function (_ref) {
var theme = _ref.theme,
type = _ref.type,
props = _objectWithoutProperties(_ref, ["theme", "type"]);
return React.createElement("div", props);
}).withConfig({
displayName: "FormFeedback__StyledFormFeedback",
componentId: "sc-1lhzkwp-0"
})(["color:", ";font-family:", ";font-size:", ";font-weight:", ";line-height:", ";width:100%;margin-top:2px;position:absolute;top:100%;max-height:", ";overflow:hidden;white-space:nowrap;text-overflow:ellipsis;& a{color:", ";font-weight:", ";text-decoration:underline;cursor:pointer;}strong,b{font-weight:", ";color:", ";}"], function (_ref2) {
var theme = _ref2.theme,
type = _ref2.type;
return type === _consts.default.ERROR ? theme.orbit.colorTextError : theme.orbit.colorTextSecondary;
}, function (_ref3) {
var theme = _ref3.theme;
return theme.orbit.fontFamily;
}, function (_ref4) {
var theme = _ref4.theme;
return theme.orbit.fontSizeFormFeedback;
}, function (_ref5) {
var theme = _ref5.theme,
type = _ref5.type;
return type === _consts.default.ERROR ? theme.orbit.fontWeightMedium : theme.orbit.fontWeightNormal;
}, function (_ref6) {
var theme = _ref6.theme;
return theme.orbit.lineHeightTextSmall;
}, function (_ref7) {
var theme = _ref7.theme;
return theme.orbit.lineHeightTextSmall;
}, function (_ref8) {
var theme = _ref8.theme,
type = _ref8.type;
return type === _consts.default.ERROR ? theme.orbit.colorTextError : theme.orbit.colorTextPrimary;
}, function (_ref9) {
var theme = _ref9.theme;
return theme.orbit.fontWeightMedium;
}, function (_ref10) {
var theme = _ref10.theme;
return theme.fontWeightMedium;
}, function (_ref11) {
var theme = _ref11.theme;
return theme.paletteInkNormal;
});
exports.StyledFormFeedback = StyledFormFeedback;
StyledFormFeedback.defaultProps = {
theme: _defaultTheme.default
};
var FormFeedback = function FormFeedback(props) {
var children = props.children,
_props$type = props.type,
type = _props$type === void 0 ? _consts.default.HELP : _props$type,
dataTest = props.dataTest;
return React.createElement(StyledFormFeedback, {
type: type,
"data-test": dataTest
}, children);
};
var _default = FormFeedback;
exports.default = _default;