jellyfin-web/dashboard-ui/bower_components/paper-button/paper-button.html

173 lines
5.0 KiB
HTML
Raw Normal View History

2015-06-15 21:52:01 -07:00
<!--
@license
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
2015-12-14 08:43:03 -07:00
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
2015-06-15 21:52:01 -07:00
Code distributed by Google as part of the polymer project is also
2015-12-14 08:43:03 -07:00
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
2015-06-15 21:52:01 -07:00
-->
<link rel="import" href="../polymer/polymer.html">
<link rel="import" href="../paper-material/paper-material.html">
<link rel="import" href="../paper-ripple/paper-ripple.html">
<link rel="import" href="../paper-behaviors/paper-button-behavior.html">
2015-09-22 09:06:27 -07:00
<link rel="import" href="../iron-flex-layout/iron-flex-layout.html">
2015-06-15 21:52:01 -07:00
<!--
2015-10-07 18:49:40 -07:00
Material design: [Buttons](https://www.google.com/design/spec/components/buttons.html)
2015-06-15 21:52:01 -07:00
`paper-button` is a button. When the user touches the button, a ripple effect emanates
from the point of contact. It may be flat or raised. A raised button is styled with a
shadow.
Example:
2015-09-22 09:06:27 -07:00
<paper-button>Flat button</paper-button>
<paper-button raised>Raised button</paper-button>
2015-06-15 21:52:01 -07:00
<paper-button noink>No ripple effect</paper-button>
2015-09-22 09:06:27 -07:00
<paper-button toggles>Toggle-able button</paper-button>
2015-07-13 14:26:11 -07:00
A button that has `toggles` true will remain `active` after being clicked (and
will have an `active` attribute set). For more information, see the `Polymer.IronButtonState`
behavior.
2015-06-15 21:52:01 -07:00
You may use custom DOM in the button body to create a variety of buttons. For example, to
create a button with an icon and some text:
<paper-button>
2015-06-26 13:40:30 -07:00
<iron-icon icon="favorite"></iron-icon>
2015-06-15 21:52:01 -07:00
custom button content
</paper-button>
### Styling
Style the button with CSS as you would a normal DOM element.
2015-09-22 09:06:27 -07:00
paper-button.fancy {
background: green;
color: yellow;
2015-06-15 21:52:01 -07:00
}
2015-09-22 09:06:27 -07:00
paper-button.fancy:hover {
background: lime;
}
2015-06-15 21:52:01 -07:00
2015-09-22 09:06:27 -07:00
paper-button[disabled],
paper-button[toggles][active] {
background: red;
2015-06-15 21:52:01 -07:00
}
2015-09-22 09:06:27 -07:00
By default, the ripple is the same color as the foreground at 25% opacity. You may
customize the color using the `--paper-button-ink-color` custom property.
2015-06-15 21:52:01 -07:00
The following custom properties and mixins are also available for styling:
Custom property | Description | Default
----------------|-------------|----------
2015-09-22 09:06:27 -07:00
`--paper-button-ink-color` | Background color of the ripple | `Based on the button's color`
2015-06-15 21:52:01 -07:00
`--paper-button` | Mixin applied to the button | `{}`
2015-09-22 09:06:27 -07:00
`--paper-button-disabled` | Mixin applied to the disabled button. Note that you can also use the `paper-button[disabled]` selector | `{}`
`--paper-button-flat-keyboard-focus` | Mixin applied to a flat button after it's been focused using the keyboard | `{}`
`--paper-button-raised-keyboard-focus` | Mixin applied to a raised button after it's been focused using the keyboard | `{}`
2015-06-15 21:52:01 -07:00
@demo demo/index.html
-->
<dom-module id="paper-button">
2015-10-07 18:49:40 -07:00
<template strip-whitespace>
2015-06-15 21:52:01 -07:00
2015-10-07 18:49:40 -07:00
<style include="paper-material">
2015-09-03 21:33:31 -07:00
:host {
display: inline-block;
position: relative;
box-sizing: border-box;
min-width: 5.14em;
margin: 0 0.29em;
background: transparent;
text-align: center;
font: inherit;
text-transform: uppercase;
outline-width: 0;
border-radius: 3px;
-moz-user-select: none;
-ms-user-select: none;
-webkit-user-select: none;
user-select: none;
cursor: pointer;
z-index: 0;
2015-09-22 09:06:27 -07:00
padding: 0.7em 0.57em;
2015-09-03 21:33:31 -07:00
@apply(--paper-button);
}
2015-06-15 21:52:01 -07:00
2015-10-07 18:49:40 -07:00
:host([raised].keyboard-focus) {
2015-09-22 09:06:27 -07:00
font-weight: bold;
2015-09-22 21:00:30 -07:00
@apply(--paper-button-raised-keyboard-focus);
2015-09-22 09:06:27 -07:00
}
2015-10-07 18:49:40 -07:00
:host(:not([raised]).keyboard-focus) {
2015-09-03 21:33:31 -07:00
font-weight: bold;
2015-09-22 21:00:30 -07:00
@apply(--paper-button-flat-keyboard-focus);
2015-09-03 21:33:31 -07:00
}
2015-06-15 21:52:01 -07:00
2015-09-03 21:33:31 -07:00
:host([disabled]) {
background: #eaeaea;
color: #a8a8a8;
cursor: auto;
pointer-events: none;
2015-06-15 21:52:01 -07:00
2015-09-03 21:33:31 -07:00
@apply(--paper-button-disabled);
}
2015-06-15 21:52:01 -07:00
2015-09-22 09:06:27 -07:00
paper-ripple {
color: var(--paper-button-ink-color);
}
2015-10-07 18:49:40 -07:00
:host > ::content * {
2015-09-03 21:33:31 -07:00
text-transform: inherit;
}
</style>
2015-10-07 18:49:40 -07:00
<content></content>
2015-06-15 21:52:01 -07:00
</template>
</dom-module>
<script>
Polymer({
is: 'paper-button',
behaviors: [
Polymer.PaperButtonBehavior
],
properties: {
/**
* If true, the button should be styled with a shadow.
*/
raised: {
type: Boolean,
reflectToAttribute: true,
value: false,
observer: '_calculateElevation'
}
},
_calculateElevation: function() {
if (!this.raised) {
2015-12-14 08:43:03 -07:00
this._setElevation(0);
2015-06-15 21:52:01 -07:00
} else {
Polymer.PaperButtonBehaviorImpl._calculateElevation.apply(this);
}
}
2015-12-14 08:43:03 -07:00
/**
Fired when the animation finishes.
This is useful if you want to wait until
the ripple animation finishes to perform some action.
@event transitionend
@param {{node: Object}} detail Contains the animated node.
*/
2015-06-15 21:52:01 -07:00
});
</script>