UNPKG

@activecollab/components

Version:

ActiveCollab Components

31 lines 1.13 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 { invalid = false, required = false, size = "regular", children, className, weight = "bold", htmlFor } = _ref, 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