-
-
Notifications
You must be signed in to change notification settings - Fork 333
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
df788e1
commit 9c4b874
Showing
10 changed files
with
127 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
/** | ||
* @module ember-paper | ||
*/ | ||
import Ember from 'ember'; | ||
import layout from '../templates/components/paper-radio-base'; | ||
import FocusableMixin from 'ember-paper/mixins/focusable-mixin'; | ||
import RippleMixin from 'ember-paper/mixins/ripple-mixin'; | ||
import ColorMixin from 'ember-paper/mixins/color-mixin'; | ||
|
||
const { Component, computed, assert } = Ember; | ||
|
||
/** | ||
* @class PaperRadio | ||
* @extends Ember.Component | ||
* @uses FocusableMixin | ||
* @uses ColorMixin | ||
* @uses RippleMixin | ||
*/ | ||
export default Component.extend(FocusableMixin, RippleMixin, ColorMixin, { | ||
layout, | ||
tagName: 'md-radio-button', | ||
classNames: ['md-default-theme'], | ||
classNameBindings: ['checked:md-checked'], | ||
|
||
tabindex: null, | ||
|
||
toggle: false, | ||
|
||
/* Ripple Overrides */ | ||
rippleContainerSelector: '.md-container', | ||
center: true, | ||
dimBackground: false, | ||
fitRipple: true, | ||
|
||
/* FocusableMixin Overrides */ | ||
focusOnlyOnKey: true, | ||
|
||
// Lifecycle hooks | ||
init() { | ||
assert('{{paper-radio}} requires an `onChange` action or null for no action.', this.get('onChange') !== undefined); | ||
this._super(...arguments); | ||
}, | ||
|
||
checked: computed('groupValue', 'value', function() { | ||
return this.get('groupValue') === this.get('value'); | ||
}), | ||
|
||
click() { | ||
if (!this.get('disabled')) { | ||
if (this.get('toggle')) { | ||
this.sendAction('onChange', this.get('checked') ? null : this.get('value')); | ||
} else { | ||
this.sendAction('onChange', this.get('value')); | ||
} | ||
} | ||
// Prevent bubbling, if specified. If undefined, the event will bubble. | ||
return this.get('bubbles'); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/** | ||
* @module ember-paper | ||
*/ | ||
import PaperRadioBaseComponent from './paper-radio-base'; | ||
import ProxiableMixin from 'ember-paper/mixins/proxiable-mixin'; | ||
|
||
/** | ||
* @class PaperRadio | ||
* @extends PaperRadioBaseComponent | ||
* @uses ProxiableMixin | ||
*/ | ||
export default PaperRadioBaseComponent.extend(ProxiableMixin, { | ||
processProxy() { | ||
this.click(); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,64 +1,14 @@ | ||
/** | ||
* @module ember-paper | ||
*/ | ||
import Ember from 'ember'; | ||
import layout from '../templates/components/paper-radio'; | ||
import FocusableMixin from 'ember-paper/mixins/focusable-mixin'; | ||
import RippleMixin from 'ember-paper/mixins/ripple-mixin'; | ||
import ColorMixin from 'ember-paper/mixins/color-mixin'; | ||
import PaperRadioBaseComponent from './paper-radio-base'; | ||
import { ChildMixin } from 'ember-composability-tools'; | ||
|
||
const { Component, computed, assert } = Ember; | ||
|
||
/** | ||
* @class PaperRadio | ||
* @extends Ember.Component | ||
* @uses FocusableMixin | ||
* @uses ColorMixin | ||
* @uses RippleMixin | ||
* @extends PaperRadioBaseComponent | ||
* @uses ChildMixin | ||
*/ | ||
export default Component.extend(FocusableMixin, RippleMixin, ColorMixin, ChildMixin, { | ||
layout, | ||
tagName: 'md-radio-button', | ||
classNames: ['md-default-theme'], | ||
classNameBindings: ['checked:md-checked'], | ||
|
||
tabindex: null, | ||
|
||
toggle: false, | ||
|
||
/* Ripple Overrides */ | ||
rippleContainerSelector: '.md-container', | ||
center: true, | ||
dimBackground: false, | ||
fitRipple: true, | ||
|
||
/* FocusableMixin Overrides */ | ||
focusOnlyOnKey: true, | ||
|
||
/* ChildMixin Overrides */ | ||
shouldRegister: false, | ||
|
||
// Lifecycle hooks | ||
init() { | ||
assert('{{paper-radio}} requires an `onChange` action or null for no action.', this.get('onChange') !== undefined); | ||
this._super(...arguments); | ||
}, | ||
|
||
checked: computed('groupValue', 'value', function() { | ||
return this.get('groupValue') === this.get('value'); | ||
}), | ||
|
||
click() { | ||
if (!this.get('disabled')) { | ||
if (this.get('toggle')) { | ||
this.sendAction('onChange', this.get('checked') ? null : this.get('value')); | ||
} else { | ||
this.sendAction('onChange', this.get('value')); | ||
} | ||
} | ||
// Prevent bubbling, if specified. If undefined, the event will bubble. | ||
return this.get('bubbles'); | ||
} | ||
export default PaperRadioBaseComponent.extend(ChildMixin, { | ||
shouldRegister: false | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1 @@ | ||
import PaperRadioGroup from 'ember-paper/components/paper-radio-group'; | ||
|
||
export default PaperRadioGroup; | ||
export { default } from 'ember-paper/components/paper-radio-group'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { default } from 'ember-paper/components/paper-radio-proxiable'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1 @@ | ||
import PaperRadio from 'ember-paper/components/paper-radio'; | ||
|
||
export default PaperRadio; | ||
export { default } from 'ember-paper/components/paper-radio'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters