UNPKG

@activecollab/components

Version:

ActiveCollab Components

33 lines 1.43 kB
import _extends from "@babel/runtime/helpers/esm/extends"; import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose"; const _excluded = ["invalid", "required", "size", "children", "className", "weight", "htmlFor"]; import React, { forwardRef } from "react"; import classNames from "classnames"; import { Typography } from "../Typography/Typography"; export const Label = /*#__PURE__*/forwardRef((_ref, ref) => { let _ref$invalid = _ref.invalid, invalid = _ref$invalid === void 0 ? false : _ref$invalid, _ref$required = _ref.required, required = _ref$required === void 0 ? false : _ref$required, _ref$size = _ref.size, size = _ref$size === void 0 ? "regular" : _ref$size, children = _ref.children, className = _ref.className, _ref$weight = _ref.weight, weight = _ref$weight === void 0 ? "bold" : _ref$weight, htmlFor = _ref.htmlFor, props = _objectWithoutPropertiesLoose(_ref, _excluded); const color = invalid ? "alert" : "primary"; const variant = size === "regular" ? "Body 2" : "Caption 1"; return /*#__PURE__*/React.createElement(Typography, _extends({ as: "label", className: classNames("c-label", className), variant: variant, color: color, weight: weight, ref: ref, htmlFor: htmlFor }, props), children, required ? "*" : null); }); Label.displayName = "Label"; //# sourceMappingURL=Label.js.map