import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { Icon, SwitchField, Tooltip } from '../../basic';
import FormUtils from '../../functions/FormUtils';
import './style.scss';
export default function AppSwitchGroup({ fields, form, onToggle, hasRole = () => true, className, }) {
    const visibleFields = FormUtils.filterFieldsByUserRole(fields, hasRole).filter((field) => field.type === 'switch');
    return (_jsx("div", { className: `app-switch-group-container ${className || ''}`, children: visibleFields.map((field) => (_jsxs("div", { className: "app-switch-group-row", children: [_jsx(SwitchField, { attr: field.attr, label: field.name, createdForm: form, disabled: field.disabled, onChange: (value) => onToggle(field.attr, value) }), field.tooltip && field.tooltipText && (_jsx(Tooltip, { title: field.tooltipText, children: _jsx("span", { className: "app-switch-group-tooltip", children: _jsx(Icon, { name: "help", size: "x-small" }) }) }))] }, field.attr))) }));
}
