"use strict";

exports.__esModule = true;
exports.default = UserProfileEdit;

var _react = _interopRequireDefault(require("react"));

var _styles = require("@mui/material/styles");

var _material = require("@mui/material");

var _reactIntl = require("react-intl");

var _UserProfile = require("../../constants/UserProfile");

var _PublicInfo = _interopRequireDefault(require("./Section/PublicInfo"));

var _Settings = _interopRequireDefault(require("./Section/Settings"));

var _classnames = _interopRequireDefault(require("classnames"));

var _useThemeProps = _interopRequireDefault(require("@mui/material/styles/useThemeProps"));

const _excluded = ["id", "className", "fields", "AccordionProps"];

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }

function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }

const messages = (0, _reactIntl.defineMessages)({
  realName: {
    id: 'ui.userProfileEdit.realName',
    defaultMessage: 'ui.userProfileEdit.realName'
  },
  dateJoined: {
    id: 'ui.userProfileEdit.dateJoined',
    defaultMessage: 'ui.userProfileEdit.dateJoined'
  },
  bio: {
    id: 'ui.userProfileEdit.bio',
    defaultMessage: 'ui.userProfileEdit.bio'
  },
  location: {
    id: 'ui.userProfileEdit.location',
    defaultMessage: 'ui.userProfileEdit.location'
  },
  dateOfBirth: {
    id: 'ui.userProfileEdit.dateOfBirth',
    defaultMessage: 'ui.userProfileEdit.dateOfBirth'
  },
  description: {
    id: 'ui.userProfileEdit.description',
    defaultMessage: 'ui.userProfileEdit.description'
  },
  gender: {
    id: 'ui.userProfileEdit.gender',
    defaultMessage: 'ui.userProfileEdit.gender'
  },
  website: {
    id: 'ui.userProfileEdit.website',
    defaultMessage: 'ui.userProfileEdit.website'
  }
});
const PREFIX = 'SCUserProfileEdit';
const classes = {
  root: `${PREFIX}-root`,
  field: `${PREFIX}-field`
};
const Root = (0, _styles.styled)(_material.Box, {
  name: PREFIX,
  slot: 'Root',
  overridesResolver: (props, styles) => styles.root
})(({
  theme
}) => ({
  [`& .${classes.field}`]: {
    fontWeight: 'bold'
  }
}));

/**
 *
 > API documentation for the Community-UI User Profile Edit component. Learn about the available props and the CSS API.

 #### Import

 ```jsx
 import {UserProfileEdit} from '@selfcommunity/ui';
 ```

 #### Component Name

 The name `SCUserProfileEdit` can be used when providing style overrides in the theme.


 #### CSS

 |Rule Name|Global class|Description|
 |---|---|---|
 |root|.SCUserProfileEdit-root|Styles applied to the root element.|
 |field|.SCUserProfileEdit-field|Styles applied to the field element.|

 * @param inProps
 */
function UserProfileEdit(inProps) {
  // PROPS
  const props = (0, _useThemeProps.default)({
    props: inProps,
    name: PREFIX
  });

  const {
    id = null,
    className = null,
    fields = [..._UserProfile.DEFAULT_FIELDS],
    AccordionProps = {}
  } = props,
        rest = _objectWithoutPropertiesLoose(props, _excluded); // RENDER


  return /*#__PURE__*/_react.default.createElement(Root, _extends({
    id: id,
    className: (0, _classnames.default)(classes.root, className)
  }, rest), /*#__PURE__*/_react.default.createElement(_material.Accordion, _extends({
    defaultExpanded: true
  }, AccordionProps), /*#__PURE__*/_react.default.createElement(_material.AccordionSummary, {
    "aria-controls": "profile information"
  }, /*#__PURE__*/_react.default.createElement(_material.Typography, {
    variant: "body1"
  }, /*#__PURE__*/_react.default.createElement(_reactIntl.FormattedMessage, {
    id: "ui.userProfileEdit.info",
    defaultMessage: "ui.userProfileEdit.info"
  }))), /*#__PURE__*/_react.default.createElement(_material.AccordionDetails, null, /*#__PURE__*/_react.default.createElement(_PublicInfo.default, {
    fields: fields
  }))), /*#__PURE__*/_react.default.createElement(_material.Accordion, AccordionProps, /*#__PURE__*/_react.default.createElement(_material.AccordionSummary, {
    "aria-controls": "profile settings"
  }, /*#__PURE__*/_react.default.createElement(_material.Typography, {
    variant: "body1"
  }, /*#__PURE__*/_react.default.createElement(_reactIntl.FormattedMessage, {
    id: "ui.userProfileEdit.notification",
    defaultMessage: "ui.userProfileEdit.notification"
  }))), /*#__PURE__*/_react.default.createElement(_material.AccordionDetails, null, /*#__PURE__*/_react.default.createElement(_Settings.default, {
    fields: fields
  }))));
}