@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 • 2.03 kB
JavaScript
import * as React from "react";
import styled from "styled-components";
import defaultTheme from "../defaultTheme";
var StyledAsterisk = styled.span.withConfig({
displayName: "FormLabel__StyledAsterisk",
componentId: "sc-1927civ-0"
})(["font-weight:", ";color:", ";font-size:", ";vertical-align:top;"], function (_ref) {
var theme = _ref.theme;
return theme.orbit.fontWeightBold;
}, function (_ref2) {
var theme = _ref2.theme,
filled = _ref2.filled;
return !filled ? theme.orbit.colorTextError : theme.orbit.colorFormLabelFilled;
}, function (_ref3) {
var theme = _ref3.theme;
return theme.orbit.fontSizeFormLabel;
});
StyledAsterisk.defaultProps = {
theme: defaultTheme
};
var FormLabel = styled(function (_ref4) {
var className = _ref4.className,
children = _ref4.children,
required = _ref4.required,
filled = _ref4.filled,
dataTest = _ref4.dataTest,
id = _ref4.id;
return /*#__PURE__*/React.createElement("span", {
className: className,
"data-test": dataTest,
id: id
}, required && /*#__PURE__*/React.createElement(StyledAsterisk, {
"aria-hidden": "true",
filled: filled
}, "*", " "), /*#__PURE__*/React.createElement("span", null, children));
}).withConfig({
displayName: "FormLabel",
componentId: "sc-1927civ-1"
})(["display:block;font-family:", ";font-size:", ";color:", ";line-height:", ";margin-bottom:", ";"], function (_ref5) {
var theme = _ref5.theme;
return theme.orbit.fontFamily;
}, function (_ref6) {
var theme = _ref6.theme;
return theme.orbit.fontSizeFormLabel;
}, function (_ref7) {
var theme = _ref7.theme,
filled = _ref7.filled,
disabled = _ref7.disabled;
return !filled || disabled ? theme.orbit.colorFormLabel : theme.orbit.colorFormLabelFilled;
}, function (_ref8) {
var theme = _ref8.theme;
return theme.orbit.lineHeightTextSmall;
}, function (_ref9) {
var theme = _ref9.theme;
return theme.orbit.spaceXXSmall;
});
FormLabel.defaultProps = {
theme: defaultTheme
};
export default FormLabel;