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.

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