@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.
42 lines • 1.46 kB
JavaScript
import * as React from "react";
import cx from "clsx";
import AlertCircle from "../icons/AlertCircle";
import InformationCircle from "../icons/InformationCircle";
const FormLabel = ({
className,
children,
required,
filled,
dataTest,
id,
error,
help,
onMouseEnter,
onMouseLeave,
iconRef,
inlineLabel,
labelRef,
disabled
}) => /*#__PURE__*/React.createElement("span", {
className: cx(className, "orbit-form-label", "font-base text-normal mb-xxs ms-xxs de:ms-0 inline-flex font-medium leading-normal", !filled || disabled ? "text-form-element-label-foreground" : "text-form-element-label-filled-foreground"),
"data-test": dataTest,
id: id,
ref: labelRef,
onMouseEnter: onMouseEnter,
onMouseLeave: onMouseLeave
}, !inlineLabel && (error || help) && /*#__PURE__*/React.createElement("span", {
className: "me-xxs inline-flex items-center",
ref: iconRef
}, error && /*#__PURE__*/React.createElement(AlertCircle, {
ariaLabel: "error",
color: "critical",
size: "small"
}), !error && help && /*#__PURE__*/React.createElement(InformationCircle, {
ariaLabel: "help",
color: "info",
size: "small"
})), required && !error && /*#__PURE__*/React.createElement("span", {
className: cx("text-normal align-top font-bold", filled ? "text-form-element-label-filled-foreground" : "text-critical-foreground"),
"aria-hidden": "true"
}, "*"), /*#__PURE__*/React.createElement("span", null, children));
export default FormLabel;