UNPKG

wix-style-react

Version:
32 lines (26 loc) 1.05 kB
import inputWithOptionsDriverFactory from '../InputWithOptions/InputWithOptions.driver'; var multiSelectCheckboxDriverFactory = function multiSelectCheckboxDriverFactory(_ref) { var element = _ref.element, component = _ref.component; var _inputWithOptionsDriv = inputWithOptionsDriverFactory({ element: element }), driver = _inputWithOptionsDriv.driver, inputDriver = _inputWithOptionsDriv.inputDriver, dropdownLayoutDriver = _inputWithOptionsDriv.dropdownLayoutDriver; var multiSelectCheckboxDriver = Object.assign(driver, { getNumOfLabels: function getNumOfLabels() { return this.getLabels().length; }, getLabels: function getLabels() { return inputDriver.getValue().split(component.props.delimiter); }, getLabelAt: function getLabelAt(index) { return this.getLabels()[index]; } }); return { driver: multiSelectCheckboxDriver, inputDriver: inputDriver, dropdownLayoutDriver: dropdownLayoutDriver }; }; export default multiSelectCheckboxDriverFactory;