import hideButKeepRequireBehavior from "../util/hideButKeepRequireBehavior";

const handler = (el, defaultOptions, libs) => {
    console.log(libs.getLib('choicesjs'));
    let ChoicesJs = libs.getLib('choicesjs');
    var aaFormComponent = new ChoicesJs(el, defaultOptions);
    hideButKeepRequireBehavior(el);
    el.removeAttribute('hidden');// bothering style on this attribute, both in bootstrap and choices.js styles

    return aaFormComponent;
};

AAForm.addTypeHandler('aa-ft-select-rich', handler)
AAForm.setTypeDefaultOptions('aa-ft-select-rich', AAFormConfig.config['aa-ft-select-rich'])

AAForm.addTypeHandler('aa-ft-rich-entity', handler)
AAForm.setTypeDefaultOptions('aa-ft-rich-entity', AAFormConfig.config['aa-ft-rich-entity'])