import React, {Component} from 'react'
import NonExclusiveField from './non_exclusive_field'
import {hash_with_key} from 'common/utilities'

class ExclusiveField extends Component {
  render() {
    let selected_value = hash_with_key(this.props.values)[this.props.selected]
    return (
      <NonExclusiveField
        {...this.props}
        selected_values={selected_value ? [selected_value] : []}
        on_deselect_value={this.props.on_clear}
        />
    )
  }
}

export default ExclusiveField
