import Component from '@ember/component';
import { observer } from '@ember/object';
import { equal } from '@ember/object/computed';

export default Component.extend({
  classNames: ['upf-checkbox'],
  classNameBindings: [
    'hasLabel:upf-checkbox--has-label',
    'sizeSmall:upf-checkbox--sm',
    'disabled:upf-checkbox--disabled'
  ],
  attributeBindings: ['data-control-name'],

  sizeSmall: equal('size', 'sm'),
  disabled: false,

  onValueChange: null,
  onToggleAttempt: null,

  _: observer('value', function () {
    if (this.onValueChange) {
      this.onValueChange(this.value);
    }
  }),

  click(e) {
    if (this.preventDefault) {
      e.preventDefault();
    }
    e.stopPropagation();

    if (this.disabled && this.onToggleAttempt) {
      e.preventDefault();
      this.onToggleAttempt();
    }
  }
});

import Component from '@ember/component';
import { observer } from '@ember/object';
import { equal } from '@ember/object/computed';

export default Component.extend({
  classNames: ['upf-checkbox'],
  classNameBindings: [
    'hasLabel:upf-checkbox--has-label', 'sizeSmall:upf-checkbox--sm',
    'disabled:upf-checkbox--disabled'
  ],
  attributeBindings: ['data-control-name'],

  sizeSmall: equal('size', 'sm'),
  disabled: false,

  onValueChange: null,
  onToggleAttempt: null,

  _: observer('value', function() {
    if (this.onValueChange) {
      this.onValueChange(this.value);
    }
  }),

  click(e) {
    e.stopPropagation();

    if (this.disabled && this.onToggleAttempt) {
      e.preventDefault();
      this.onToggleAttempt();
    }
  }
});

--- 
+++ 
@@ -5,7 +5,8 @@
 export default Component.extend({
   classNames: ['upf-checkbox'],
   classNameBindings: [
-    'hasLabel:upf-checkbox--has-label', 'sizeSmall:upf-checkbox--sm',
+    'hasLabel:upf-checkbox--has-label',
+    'sizeSmall:upf-checkbox--sm',
     'disabled:upf-checkbox--disabled'
   ],
   attributeBindings: ['data-control-name'],
@@ -16,13 +17,16 @@
   onValueChange: null,
   onToggleAttempt: null,
 
-  _: observer('value', function() {
+  _: observer('value', function () {
     if (this.onValueChange) {
       this.onValueChange(this.value);
     }
   }),
 
   click(e) {
+    if (this.preventDefault) {
+      e.preventDefault();
+    }
     e.stopPropagation();
 
     if (this.disabled && this.onToggleAttempt) {
Add preventDefault argument for UpfCheckbox

