"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.FormLabel = void 0;
var _react = _interopRequireDefault(require("react"));
var _styledComponents = _interopRequireDefault(require("styled-components"));
var _ = require("../..");
var _VisuallyHidden = require("../VisuallyHidden");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var StyledLabel = _styledComponents.default.label.withConfig({
  displayName: "FormLabel__StyledLabel",
  componentId: "sc-skax1c-0"
})(["", " text-overflow:ellipsis;white-space:nowrap;cursor:", ";"], function (p) {
  return p.hidden ? _VisuallyHidden.visuallyHiddenCss : '';
}, function (_ref) {
  var $disabled = _ref.$disabled;
  return $disabled ? 'not-allowed' : 'pointer';
});
var FormLabel = exports.FormLabel = function FormLabel(_ref2) {
  var as = _ref2.as,
    children = _ref2.children,
    className = _ref2.className,
    forId = _ref2.forId,
    hideLabel = _ref2.hideLabel,
    disabled = _ref2.disabled;
  return _react.default.createElement(StyledLabel, {
    as: as,
    className: className,
    htmlFor: forId,
    hidden: Boolean(hideLabel),
    $disabled: disabled
  }, _react.default.createElement(_.Typography, {
    type: "secondary",
    color: function color(t) {
      return disabled ? t.color.disabledText : t.color.label;
    }
  }, children));
};
FormLabel.displayName = 'FormLabel';