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.

60 lines (55 loc) 2.62 kB
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; } import * as React from "react"; import styled from "styled-components"; import defaultTokens from "../defaultTokens"; import TYPE_OPTIONS from "./consts"; const StyledFormFeedback = styled((_ref) => { let { theme, type } = _ref, 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:", "px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;& a{color:", ";font-weight:", ";text-decoration:underline;cursor:pointer;}strong,b{font-weight:", ";color:", ";}"], ({ theme, type }) => type === TYPE_OPTIONS.ERROR ? theme.orbit.colorTextError : theme.orbit.colorTextSecondary, ({ theme }) => theme.orbit.fontFamily, ({ theme }) => theme.orbit.fontSizeFormFeedback, ({ theme, type }) => type === TYPE_OPTIONS.ERROR ? theme.orbit.fontWeightMedium : theme.orbit.fontWeightNormal, ({ theme }) => theme.orbit.lineHeightText, ({ theme }) => Math.floor(theme.orbit.lineHeightText * parseInt(theme.orbit.fontSizeFormFeedback, 10)), ({ theme, type }) => type === TYPE_OPTIONS.ERROR ? theme.orbit.colorTextError : theme.orbit.colorTextAttention, ({ theme }) => theme.orbit.fontWeightMedium, ({ theme }) => theme.fontWeightMedium, ({ theme }) => theme.paletteInkNormal); StyledFormFeedback.defaultProps = { theme: defaultTokens }; const FormFeedback = props => { const { children, type = TYPE_OPTIONS.HELP, dataTest } = props; return React.createElement(StyledFormFeedback, { type: type, "data-test": dataTest }, children); }; export default FormFeedback;