'use strict';

var clsx = require('clsx');
var Label_messages = require('./Label.messages.js');
var reactIntl = require('react-intl');
var Body = require('../body/Body.js');
var React = require('react');
var jsxRuntime = require('react/jsx-runtime');

const Label = /*#__PURE__*/React.forwardRef(({
  className,
  children,
  htmlFor,
  id
}, ref) => {
  return /*#__PURE__*/jsxRuntime.jsx("label", {
    ref: ref,
    id: id,
    htmlFor: htmlFor,
    className: clsx.clsx('np-label d-flex flex-column np-text-body-default-bold text-primary m-b-0', className),
    children: children
  });
});
Label.displayName = 'Label';
const Optional = function Optional({
  children,
  className
}) {
  const {
    formatMessage
  } = reactIntl.useIntl();
  return /*#__PURE__*/jsxRuntime.jsxs("div", {
    children: [children, /*#__PURE__*/jsxRuntime.jsx(Body.default, {
      as: "span",
      className: clsx.clsx('text-secondary', 'm-l-1', className),
      children: formatMessage(Label_messages.default.optionalLabel)
    })]
  });
};
const Description = function Description({
  id,
  children,
  className
}) {
  return children ? /*#__PURE__*/jsxRuntime.jsx(Body.default, {
    id: id,
    className: clsx.clsx('text-secondary', className),
    children: children
  }) : null;
};
// eslint-disable-next-line functional/immutable-data
const LabelNamespace = Object.assign(Label, {
  Optional,
  Description
});

exports.Label = LabelNamespace;
//# sourceMappingURL=Label.js.map
