"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const jsx_runtime_1 = require("react/jsx-runtime");
const react_1 = tslib_1.__importDefault(require("react"));
const styles_1 = require("@mui/material/styles");
const material_1 = require("@mui/material");
const react_intl_1 = require("react-intl");
const UserProfile_1 = require("../../constants/UserProfile");
const PublicInfo_1 = tslib_1.__importDefault(require("./Section/PublicInfo"));
const Account_1 = tslib_1.__importDefault(require("./Section/Account"));
const Settings_1 = tslib_1.__importDefault(require("./Section/Settings"));
const classnames_1 = tslib_1.__importDefault(require("classnames"));
const system_1 = require("@mui/system");
const constants_1 = require("./constants");
const classes = {
    root: `${constants_1.PREFIX}-root`,
    tabs: `${constants_1.PREFIX}-tabs`,
    tabContent: `${constants_1.PREFIX}-tab-content`,
    publicInfo: `${constants_1.PREFIX}-public-info`,
    account: `${constants_1.PREFIX}-account`,
    settings: `${constants_1.PREFIX}-settings`
};
const Root = (0, styles_1.styled)(material_1.Box, {
    name: constants_1.PREFIX,
    slot: 'Root'
})(() => ({}));
/**
 * > API documentation for the Community-JS User Profile Edit component. Learn about the available props and the CSS API.
 *
 *
 * This component renders a section composed of different tabs where the user can edit the settings about its public information, account and notifications.
 * Take a look at our <strong>demo</strong> component [here](/docs/sdk/community-js/react-ui/Components/UserProfileEdit)

 #### Import

 ```jsx
 import {UserProfileEdit} from '@selfcommunity/react-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.|
 |tabs|.SCUserProfileEdit-tabs|Styles applied to the tab elements.|
 |tabsContent|.SCUserProfileEdit-tabs-content|Styles applied to tab content elements.|

 * @param inProps
 */
function UserProfileEdit(inProps) {
    // PROPS
    const props = (0, system_1.useThemeProps)({
        props: inProps,
        name: constants_1.PREFIX
    });
    const { id = null, className = null, fields = [...UserProfile_1.DEFAULT_FIELDS], settings = [...UserProfile_1.DEFAULT_SETTINGS], UserProfileEditSectionPublicInfoProps = {}, UserProfileEditSectionAccountProps = {
        showCredentialsSection: true,
        showSocialAccountSection: true
    }, UserProfileEditSectionSettingsProps = {} } = props, rest = tslib_1.__rest(props, ["id", "className", "fields", "settings", "UserProfileEditSectionPublicInfoProps", "UserProfileEditSectionAccountProps", "UserProfileEditSectionSettingsProps"]);
    // STATE
    const [tab, setTab] = react_1.default.useState(0);
    const handleChange = (event, newValue) => {
        setTab(newValue);
    };
    // RENDER
    return ((0, jsx_runtime_1.jsxs)(Root, Object.assign({ className: (0, classnames_1.default)(classes.root, className) }, rest, { children: [(0, jsx_runtime_1.jsxs)(material_1.Tabs, Object.assign({ className: classes.tabs, value: tab, onChange: handleChange, variant: "scrollable", scrollButtons: "auto", allowScrollButtonsMobile: true }, { children: [(0, jsx_runtime_1.jsx)(material_1.Tab, { label: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.userProfileEdit.info", defaultMessage: "ui.userProfileEdit.info" }) }), (0, jsx_runtime_1.jsx)(material_1.Tab, { label: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.userProfileEdit.account", defaultMessage: "ui.userProfileEdit.account" }) }), (0, jsx_runtime_1.jsx)(material_1.Tab, { label: (0, jsx_runtime_1.jsx)(react_intl_1.FormattedMessage, { id: "ui.userProfileEdit.notification", defaultMessage: "ui.userProfileEdit.notification" }) })] })), (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.tabContent }, { children: [tab === 0 && (0, jsx_runtime_1.jsx)(PublicInfo_1.default, Object.assign({ className: classes.publicInfo, fields: fields }, UserProfileEditSectionPublicInfoProps)), tab === 1 && (0, jsx_runtime_1.jsx)(Account_1.default, Object.assign({ className: classes.account }, UserProfileEditSectionAccountProps)), tab === 2 && (0, jsx_runtime_1.jsx)(Settings_1.default, Object.assign({ settings: settings, className: classes.settings }, UserProfileEditSectionSettingsProps))] }))] })));
}
exports.default = UserProfileEdit;
