UNPKG

@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.

67 lines (63 loc) 2.62 kB
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties"; import * as React from "react"; import styled from "styled-components"; import defaultTheme from "../defaultTheme"; import TYPE_OPTIONS from "./consts"; export var StyledFormFeedback = styled(function (_ref) { var theme = _ref.theme, type = _ref.type, props = _objectWithoutProperties(_ref, ["theme", "type"]); return /*#__PURE__*/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 === TYPE_OPTIONS.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 === TYPE_OPTIONS.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 === TYPE_OPTIONS.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; }); // $FlowFixMe: https://github.com/flow-typed/flow-typed/issues/3653#issuecomment-568539198 StyledFormFeedback.defaultProps = { theme: defaultTheme }; var FormFeedback = function FormFeedback(_ref12) { var error = _ref12.error, help = _ref12.help, dataTest = _ref12.dataTest; var isHelp = help && !error; if (!error && !help) return null; return /*#__PURE__*/React.createElement(StyledFormFeedback, { type: isHelp ? "help" : error && "error", "data-test": dataTest, "aria-live": "polite" }, isHelp ? help : error && error); }; export default FormFeedback;