Remove the 'gyp_config' concept from MB.
[chromium-blink-merge.git] / third_party / polymer / v1_0 / components-chromium / paper-radio-group / paper-radio-group-extracted.js
blobd5bef8b85be65a49e4b065fda0508f6029a83ae4
1 Polymer({
2 is: 'paper-radio-group',
4 behaviors: [
5 Polymer.IronA11yKeysBehavior,
6 Polymer.IronSelectableBehavior
7 ],
9 hostAttributes: {
10 role: 'radiogroup',
11 tabindex: 0
14 properties: {
15 /**
16 * Overriden from Polymer.IronSelectableBehavior
18 attrForSelected: {
19 type: String,
20 value: 'name'
23 /**
24 * Overriden from Polymer.IronSelectableBehavior
26 selectedAttribute: {
27 type: String,
28 value: 'checked'
31 /**
32 * Overriden from Polymer.IronSelectableBehavior
34 selectable: {
35 type: String,
36 value: 'paper-radio-button'
40 keyBindings: {
41 'left up': 'selectPrevious',
42 'right down': 'selectNext',
45 /**
46 * Selects the given value.
48 select: function(value) {
49 if (this.selected) {
50 var oldItem = this._valueToItem(this.selected);
52 // Do not allow unchecking the selected item.
53 if (this.selected == value) {
54 oldItem.checked = true;
55 return;
58 if (oldItem)
59 oldItem.checked = false;
62 Polymer.IronSelectableBehavior.select.apply(this, [value]);
63 this.fire('paper-radio-group-changed');
66 /**
67 * Selects the previous item. If the previous item is disabled, then it is
68 * skipped, and its previous item is selected
70 selectPrevious: function() {
71 var length = this.items.length;
72 var newIndex = Number(this._valueToIndex(this.selected));
74 do {
75 newIndex = (newIndex - 1 + length) % length;
76 } while (this.items[newIndex].disabled)
78 this.select(this._indexToValue(newIndex));
81 /**
82 * Selects the next item. If the next item is disabled, then it is
83 * skipped, and the next item after it is selected.
85 selectNext: function() {
86 var length = this.items.length;
87 var newIndex = Number(this._valueToIndex(this.selected));
89 do {
90 newIndex = (newIndex + 1 + length) % length;
91 } while (this.items[newIndex].disabled)
93 this.select(this._indexToValue(newIndex));
95 });