awips2/components/core-menu-button/core-menu-button.html
2016-04-03 22:04:09 -05:00

85 lines
2.3 KiB
HTML

<!--
Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
-->
<!--
`core-menu-button` works together with a button and `core-dropdown` to implement
an button that displays a drop-down when tapped on.
The child element with the class `dropdown` will be used as the drop-down
menu. It should be a `core-dropdown` or other overlay element.
Example:
<core-menu-button>
<core-icon-button icon="menu"></core-icon-button>
<core-dropdown class="dropdown" layered>
<core-menu>
<core-item>Share</core-item>
<core-item>Settings</core-item>
<core-item>Help</core-item>
</core-menu>
</core-dropdown>
</core-menu-button>
@module Polymer Core Elements
@element core-menu-button
@extends core-dropdown-base
@status beta
@homepage github.io
-->
<link href="../polymer/polymer.html" rel="import">
<link href="../core-a11y-keys/core-a11y-keys.html" rel="import">
<link href="../core-dropdown/core-dropdown-base.html" rel="import">
<link href="../core-focusable/core-focusable.html" rel="import">
<polymer-element name="core-menu-button" extends="core-dropdown-base" relative>
<template>
<style>
:host {
display: inline-block;
}
:host([disabled]) {
pointer-events: none;
color: #a8a8a8;
}
polyfill-next-selector { content: ':host([disabled]) *'; }
:host([disabled]) ::content * {
pointer-events: none;
}
</style>
<core-a11y-keys target="{{}}" keys="enter space" on-keys-pressed="{{toggleOverlay}}"></core-a11y-keys>
<content></content>
</template>
<script>
var p = {
overlayListeners: {
'core-overlay-open': 'openAction',
'core-activate': 'activateAction'
},
activateAction: function() {
this.opened = false;
}
};
Polymer.mixin2(p, Polymer.CoreFocusable);
Polymer(p);
</script>
</polymer-element>