5 is: 'paper-dropdown-menu',
8 * Fired when the dropdown opens.
10 * @event paper-dropdown-open
14 * Fired when the dropdown closes.
16 * @event paper-dropdown-close
20 Polymer.IronControlState,
21 Polymer.IronButtonState
26 * The derived "label" of the currently selected item. This value
27 * is the `label` property on the selected item if set, or else the
28 * trimmed text content of the selected item.
33 computed: '_computeSelectedItemLabel(selectedItem)'
37 * The last selected item. An item is selected if the dropdown menu has
38 * a child with class `dropdown-content`, and that child triggers an
39 * `iron-activate` event with the selected `item` in the `detail`.
48 * The label for the dropdown.
55 * The placeholder for the dropdown.
62 * True if the dropdown is open. Otherwise, false.
71 * Set to true to disable the floating label. Bind this to the
72 * `<paper-input-container>`'s `noLabelFloat` property.
77 reflectToAttribute: true
81 * Set to true to always float the label. Bind this to the
82 * `<paper-input-container>`'s `alwaysFloatLabel` property.
90 * Set to true to disable animations when opening and closing the
110 'aria-haspopup': 'true'
114 * Show the dropdown content.
117 this.$.menuButton.open();
121 * Hide the dropdown content.
124 this.$.menuButton.close();
128 * A handler that is called when `iron-activate` is fired.
130 * @param {CustomEvent} event An `iron-activate` event.
132 _onIronActivate: function(event) {
133 this._setSelectedItem(event.detail.item);
137 * A handler that is called when the dropdown is tapped.
139 * @param {CustomEvent} event A tap event.
141 _onTap: function(event) {
142 if (Polymer.Gestures.findOriginalTarget(event) === this) {
148 * Compute the label for the dropdown given a selected item.
150 * @param {Element} selectedItem A selected Element item, with an
151 * optional `label` property.
153 _computeSelectedItemLabel: function(selectedItem) {
158 return selectedItem.label || selectedItem.textContent.trim();
162 * Compute the vertical offset of the menu based on the value of
165 * @param {boolean} noLabelFloat True if the label should not float
166 * above the input, otherwise false.
168 _computeMenuVerticalOffset: function(noLabelFloat) {
169 // NOTE(cdata): These numbers are somewhat magical because they are
170 // derived from the metrics of elements internal to `paper-input`'s
171 // template. The metrics will change depending on whether or not the
172 // input has a floating label.
173 return noLabelFloat ? -4 : 16;