OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 /** | 5 /** |
6 * @fileoverview | 6 * @fileoverview |
7 * 'cr-expand-button' is a chrome-specific wrapper around paper-icon-button that | 7 * 'cr-expand-button' is a chrome-specific wrapper around paper-icon-button that |
8 * toggles between an opened (expanded) and closed state. | 8 * toggles between an opened (expanded) and closed state. |
9 * | 9 * |
10 * Example: | 10 * Example: |
11 * | 11 * |
12 * <cr-expand-button expanded="{{sectionIsExpanded}}"></cr-expand-button> | 12 * <cr-expand-button expanded="{{sectionIsExpanded}}"></cr-expand-button> |
13 */ | 13 */ |
14 Polymer({ | 14 Polymer({ |
15 is: 'cr-expand-button', | 15 is: 'cr-expand-button', |
16 | 16 |
17 properties: { | 17 properties: { |
18 /** | 18 /** |
19 * If true, the button is in the expanded state and will show the | 19 * If true, the button is in the expanded state and will show the |
20 * 'expand-less' icon. If false, the button shows the 'expand-more' icon. | 20 * 'expand-less' icon. If false, the button shows the 'expand-more' icon. |
21 */ | 21 */ |
22 expanded: { | 22 expanded: {type: Boolean, value: false, notify: true}, |
23 type: Boolean, | |
24 value: false, | |
25 notify: true | |
26 }, | |
27 | 23 |
28 /** | 24 /** |
29 * If true, the button will be disabled and greyed out. | 25 * If true, the button will be disabled and greyed out. |
30 */ | 26 */ |
31 disabled: { | 27 disabled: {type: Boolean, value: false, reflectToAttribute: true}, |
32 type: Boolean, | |
33 value: false, | |
34 reflectToAttribute: true | |
35 }, | |
36 | 28 |
37 /** A11y text descriptor for this control. */ | 29 /** A11y text descriptor for this control. */ |
38 alt: String, | 30 alt: String, |
39 }, | 31 }, |
40 | 32 |
41 iconName_: function(expanded) { | 33 iconName_: function(expanded) { |
42 return expanded ? 'cr:expand-less' : 'cr:expand-more'; | 34 return expanded ? 'cr:expand-less' : 'cr:expand-more'; |
43 }, | 35 }, |
44 | 36 |
45 /** | 37 /** |
46 * @param {Event} event | 38 * @param {Event} event |
47 * @private | 39 * @private |
48 */ | 40 */ |
49 stopTap_: function(event) { | 41 stopTap_: function(event) { event.stopPropagation(); }, |
50 event.stopPropagation(); | |
51 }, | |
52 }); | 42 }); |
OLD | NEW |