blob: 483882ff588dc20874fdccf32b2752628abc6ca9 [file] [log] [blame]
<!--
Copyright (C) 2016 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<link rel="import" href="../../../bower_components/polymer/polymer.html">
<link rel="import" href="../../../behaviors/gr-tooltip-behavior/gr-tooltip-behavior.html">
<link rel="import" href="../../../behaviors/keyboard-shortcut-behavior/keyboard-shortcut-behavior.html">
<link rel="import" href="../../../bower_components/paper-button/paper-button.html">
<link rel="import" href="../../../styles/shared-styles.html">
<dom-module id="gr-button">
<template strip-whitespace>
<style include="shared-styles">
/* general styles for all buttons */
:host {
display: inline-block;
font-family: var(--font-family-bold);
font-size: 12px;
position: relative;
}
:host([hidden]) {
display: none;
}
:host([no-uppercase]) paper-button {
text-transform: none;
}
paper-button {
/* Some of these are overridden for link style buttons since buttons
without the link attribute are raised */
background-color: var(--gr-button-background, #fff);
color: var(--gr-button-color, var(--color-link));
display: flex;
align-items: center;
justify-content: center;
margin: 0;
min-width: 0;
padding: .4em .85em;
@apply --gr-button;
}
paper-button:hover,
paper-button:focus {
color: var(--gr-button-hover-color, var(--color-button-hover));
}
:host([disabled]) paper-button {
color: #a8a8a8;
cursor: wait;
}
/* styles for the optional down arrow */
:host:not([down-arrow]) .downArrow {display: none; }
:host([down-arrow]) .downArrow {
border-top: .36em solid var(--gr-button-arrow-color, #ccc);
border-left: .36em solid transparent;
border-right: .36em solid transparent;
margin-bottom: .05em;
margin-left: .5em;
transition: border-top-color 200ms;
}
:host([down-arrow]) paper-button:hover .downArrow {
border-top-color: var(--gr-button-arrow-hover-color, #666);
}
/* styles for raised buttons specifically*/
:host([primary]) paper-button[raised],
:host([secondary]) paper-button[raised] {
background-color: var(--color-link);
color: #fff;
}
:host([primary]) paper-button[raised]:hover,
:host([primary]) paper-button[raised]:focus,
:host([secondary]) paper-button[raised]:hover,
:host([secondary]) paper-button[raised]:focus {
background-color: var(--gr-button-hover-background-color, var(--color-button-hover));
color: var(--gr-button-color, #fff);
}
:host([disabled]) paper-button[raised] {
background-color: #eaeaea;
color: #a8a8a8;
}
/* styles for link buttons specifically */
:host([link]) {
background-color: transparent;
border: none;
color: var(--color-link);
font-size: inherit;
font-family: var(--font-family-bold);
text-transform: none;
}
:host([link][tertiary]) {
color: var(--color-link-tertiary);
}
:host([link]) paper-button {
background-color: transparent;
margin: 0;
padding: 0;
--paper-button: {
padding: 0;
}
@apply --gr-button;
}
:host([disabled][link]) paper-button {
background-color: transparent;
}
:host([link]) paper-button:hover,
:host([link]) paper-button:focus {
color: var(--gr-button-hover-color, var(--color-button-hover));
}
</style>
<paper-button
raised="[[!link]]"
disabled="[[_computeDisabled(disabled, loading)]]"
tabindex="-1">
<content></content>
<i class="downArrow"></i>
</paper-button>
</template>
<script src="gr-button.js"></script>
</dom-module>