@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.
49 lines (48 loc) • 1.91 kB
JavaScript
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
exports.__esModule = true;
exports.default = void 0;
var React = _interopRequireWildcard(require("react"));
var _clsx = _interopRequireDefault(require("clsx"));
var _AlertCircle = _interopRequireDefault(require("../icons/AlertCircle"));
var _InformationCircle = _interopRequireDefault(require("../icons/InformationCircle"));
const FormLabel = ({
className,
children,
required,
filled,
dataTest,
id,
error,
help,
onMouseEnter,
onMouseLeave,
iconRef,
inlineLabel,
labelRef,
disabled
}) => /*#__PURE__*/React.createElement("span", {
className: (0, _clsx.default)(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.default, {
ariaLabel: "error",
color: "critical",
size: "small"
}), !error && help && /*#__PURE__*/React.createElement(_InformationCircle.default, {
ariaLabel: "help",
color: "info",
size: "small"
})), required && !error && /*#__PURE__*/React.createElement("span", {
className: (0, _clsx.default)("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));
var _default = FormLabel;
exports.default = _default;