import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { FormControl, InputLabel, MenuItem, Radio, Select } from '@mui/material';
import { FormattedMessage } from 'react-intl';
import { useThemeProps } from '@mui/system';
import { PREFIX } from './constants';
import { styled } from '@mui/material/styles';
import { SCEventLocationFilterType } from '@selfcommunity/types';
import classNames from 'classnames';
const classes = {
    root: `${PREFIX}-root`
};
const Root = styled(FormControl, {
    name: PREFIX,
    slot: 'Root'
})(() => ({}));
const locationOptions = [
    {
        value: SCEventLocationFilterType.ANY,
        label: _jsx(FormattedMessage, { id: "ui.events.location.select.any", defaultMessage: "ui.events.location.select.any" })
    },
    {
        value: SCEventLocationFilterType.PERSON,
        label: _jsx(FormattedMessage, { id: "ui.eventInfoDetails.location.inPerson", defaultMessage: "ui.eventInfoDetails.location.inPerson" })
    },
    {
        value: SCEventLocationFilterType.ONLINE,
        label: _jsx(FormattedMessage, { id: "ui.eventInfoDetails.location.virtual", defaultMessage: "ui.eventInfoDetails.location.virtual" })
    }
];
export default function LocationEventsFilter(inProps) {
    // PROPS
    const props = useThemeProps({
        props: inProps,
        name: PREFIX
    });
    const { className, value, disabled = false, autoHide = false, handleOnChange } = props;
    if (autoHide) {
        return null;
    }
    return (_jsxs(Root, Object.assign({ className: classNames(classes.root, className), fullWidth: true }, { children: [_jsx(InputLabel, { children: _jsx(FormattedMessage, { id: "ui.events.filterByLocation", defaultMessage: "ui.events.filterByLocation" }) }), _jsx(Select, Object.assign({ disabled: disabled, size: 'small', label: _jsx(FormattedMessage, { id: "ui.events.location", defaultMessage: "ui.events.location" }), value: value, onChange: handleOnChange, renderValue: (selected) => locationOptions.find((option) => option.value === selected).label }, { children: locationOptions.map((option) => (_jsxs(MenuItem, Object.assign({ value: option.value }, { children: [_jsx(Radio, { checked: value === option.value, value: option.value, name: "radio-button-select", inputProps: { 'aria-label': option.label } }), option.label] }), option.value))) }))] })));
}
