import classNames from 'classnames';
import { PayPalCheckbox, PayPalRdb } from './index';
const OptionSelector = ( {
multiSelect = false,
options,
value,
onChange,
} ) => (
{ options.map(
( {
value: itemValue,
title,
description,
contents,
isDisabled = false,
} ) => {
let isSelected;
if ( Array.isArray( value ) ) {
isSelected = value.includes( itemValue );
} else {
isSelected = value === itemValue;
}
return (
{ contents }
);
}
) }
);
export default OptionSelector;
const OptionItem = ( {
itemTitle,
itemDescription,
itemValue,
onChange,
isMulti,
isSelected,
children,
isDisabled = false,
} ) => {
const boxClassName = classNames( 'ppcp-r-select-box', {
'ppcp--selected': isSelected,
'ppcp--multiselect': isMulti,
'ppcp--no-title': ! itemTitle,
} );
return (
// eslint-disable-next-line jsx-a11y/label-has-associated-control -- label has a nested input control.
);
};
const InputField = ( { value, onChange, isRadio, isSelected, isDisabled } ) => {
if ( isRadio ) {
return (
);
}
return (
);
};