all files / addon/components/ el-radio.js

0% Statements 0/4
0% Branches 0/4
0% Functions 0/3
0% Lines 0/4
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49                                                                                                 
import Component from '@ember/component';
import layout from '../templates/components/el-radio';
import {computed} from '@ember/object';
 
export default Component.extend({
  layout,
 
  tagName: 'label',
  classNames: ['el-radio'],
 
  classNameBindings: [
    'isChecked:is-checked',
    'disabled:is-disabled',
    'border:is-bordered',
    'sizeClass',
  ],
 
  attributeBindings: [
    'role',
    'isChecked:aria-checked'
  ],
  role: 'radio',
 
  model: null,
  label: null,
  name: null,
  change: null,
  border: false,
  item: '',
  size: '',
 
  isChecked: computed('model', 'label', function () {
    return this.get('model') === this.get('label');
  }),
 
  sizeClass: computed('size', function () {
    return (this.get('size')) ? 'el-radio--' + this.get('size') : "";
  }),
 
  actions: {
    changed(value, name) {
      if (this.get('action')) {
        this.get('action')(value, name);
      }
    }
  }
});