wix-style-react
Version:
wix-style-react
29 lines (25 loc) • 731 B
JavaScript
import inputWithOptionsDriverFactory from '../InputWithOptions/InputWithOptions.driver';
const multiSelectCheckboxDriverFactory = ({ element, component }) => {
const {
driver,
inputDriver,
dropdownLayoutDriver,
} = inputWithOptionsDriverFactory({ element });
const multiSelectCheckboxDriver = Object.assign(driver, {
getNumOfLabels() {
return this.getLabels().length;
},
getLabels: () => {
return inputDriver.getValue().split(component.props.delimiter);
},
getLabelAt(index) {
return this.getLabels()[index];
},
});
return {
driver: multiSelectCheckboxDriver,
inputDriver,
dropdownLayoutDriver,
};
};
export default multiSelectCheckboxDriverFactory;