MacViews: Get c/b/ui/views/tabs to build on Mac
[chromium-blink-merge.git] / third_party / polymer / components-chromium / core-dropdown / core-dropdown-extracted.js
blobf44acb8b3df28c270f33f897c42aebb7c0dcd526
3 Polymer('core-dropdown',{
5 publish: {
7 /**
8 * True if the menu is open.
10 * @attribute opened
11 * @type boolean
12 * @default false
14 opened: false,
16 /**
17 * A label for the control. The label is displayed if no item is selected.
19 * @attribute label
20 * @type string
21 * @default 'Select an item'
23 label: 'Select an item',
25 /**
26 * The currently selected element. By default this is the index of the item element.
27 * If you want a specific attribute value of the element to be used instead of the
28 * index, set `valueattr` to that attribute name.
30 * @attribute selected
31 * @type Object
32 * @default null
34 selected: null,
36 /**
37 * Specifies the attribute to be used for "selected" attribute.
39 * @attribute valueattr
40 * @type string
41 * @default 'name'
43 valueattr: 'name',
45 /**
46 * Specifies the CSS class to be used to add to the selected element.
48 * @attribute selectedClass
49 * @type string
50 * @default 'core-selected'
52 selectedClass: 'core-selected',
54 /**
55 * Specifies the property to be used to set on the selected element
56 * to indicate its active state.
58 * @attribute selectedProperty
59 * @type string
60 * @default ''
62 selectedProperty: '',
64 /**
65 * Specifies the attribute to set on the selected element to indicate
66 * its active state.
68 * @attribute selectedAttribute
69 * @type string
70 * @default 'active'
72 selectedAttribute: 'selected',
74 /**
75 * The currently selected element.
77 * @attribute selectedItem
78 * @type Object
79 * @default null
81 selectedItem: null,
83 /**
84 * Horizontally align the overlay with the control.
85 * @attribute halign
86 * @type "left"|"right"
87 * @default "left"
89 halign: {value: 'left', reflect: true},
91 /**
92 * Vertically align the dropdown menu with the control.
93 * @attribute valign
94 * @type "top"|"bottom"
95 * @default "bottom"
97 valign: {value: 'bottom', reflect: true}
101 toggle: function() {
102 this.opened = !this.opened;
105 openAction: function(e) {
106 if (e.detail) {
107 var rect = this.$.control.getBoundingClientRect();
108 if (this.valign === 'top') {
109 this.$.menu.style.top = 'auto';
110 this.$.menu.style.bottom = rect.height + 'px';
111 this.$.menu.style.maxHeight = (window.innerHeight - (window.innerHeight - rect.top) - 12) + 'px';
112 } else {
113 this.$.menu.style.top = rect.height + 'px';
114 this.$.menu.style.bottom = 'auto';
115 this.$.menu.style.maxHeight = (window.innerHeight - rect.height - rect.top - 12) + 'px';
117 this.$.menu.style.minWidth = rect.width + 'px';
121 selectAction: function() {
122 this.opened = false;