Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(283)

Side by Side Diff: lib/src/paper-fab/paper-fab.html

Issue 1418513006: update elements and fix some bugs (Closed) Base URL: git@github.com:dart-lang/polymer_elements.git@master
Patch Set: code review updates Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 <!-- 1 <!--
2 @license 2 @license
3 Copyright (c) 2015 The Polymer Project Authors. All rights reserved. 3 Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
4 This code may only be used under the BSD style license found at http://polymer.g ithub.io/LICENSE.txt 4 This code may only be used under the BSD style license found at http://polymer.g ithub.io/LICENSE.txt
5 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt 5 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
6 The complete set of contributors may be found at http://polymer.github.io/CONTRI BUTORS.txt 6 The complete set of contributors may be found at http://polymer.github.io/CONTRI BUTORS.txt
7 Code distributed by Google as part of the polymer project is also 7 Code distributed by Google as part of the polymer project is also
8 subject to an additional IP rights grant found at http://polymer.github.io/PATEN TS.txt 8 subject to an additional IP rights grant found at http://polymer.github.io/PATEN TS.txt
9 --> 9 -->
10 10
11 <link rel="import" href="../polymer/polymer.html"> 11 <link rel="import" href="../polymer/polymer.html">
12 <link rel="import" href="../iron-flex-layout/classes/iron-flex-layout.html">
12 <link rel="import" href="../iron-icon/iron-icon.html"> 13 <link rel="import" href="../iron-icon/iron-icon.html">
13 <link rel="import" href="../iron-flex-layout/classes/iron-flex-layout.html"> 14 <link rel="import" href="../paper-behaviors/paper-button-behavior.html">
14 <link rel="import" href="../paper-styles/default-theme.html">
15 <link rel="import" href="../paper-styles/color.html">
16 <link rel="import" href="../paper-material/paper-material.html"> 15 <link rel="import" href="../paper-material/paper-material.html">
17 <link rel="import" href="../paper-ripple/paper-ripple.html"> 16 <link rel="import" href="../paper-ripple/paper-ripple.html">
18 <link rel="import" href="../paper-behaviors/paper-button-behavior.html"> 17 <link rel="import" href="../paper-styles/color.html">
18 <link rel="import" href="../paper-styles/default-theme.html">
19 19
20 <!-- 20 <!--
21 Material Design: <a href="http://www.google.com/design/spec/components/buttons.h tml">Button</a> 21 Material design: [Floating Action Button](https://www.google.com/design/spec/com ponents/buttons-floating-action-button.html)
22 22
23 `paper-fab` is a floating action button. It contains an image placed in the cent er and 23 `paper-fab` is a floating action button. It contains an image placed in the cent er and
24 comes in two sizes: regular size and a smaller size by applying the attribute `m ini`. When 24 comes in two sizes: regular size and a smaller size by applying the attribute `m ini`. When
25 the user touches the button, a ripple effect emanates from the center of the but ton. 25 the user touches the button, a ripple effect emanates from the center of the but ton.
26 26
27 You may import `iron-icons` to use with this element, or provide a URL to a cust om icon. 27 You may import `iron-icons` to use with this element, or provide a URL to a cust om icon.
28 See `iron-iconset` for more information about how to use a custom icon set. 28 See `iron-iconset` for more information about how to use a custom icon set.
29 29
30 Example: 30 Example:
31 31
(...skipping 10 matching lines...) Expand all
42 42
43 Custom property | Description | Default 43 Custom property | Description | Default
44 ----------------|-------------|---------- 44 ----------------|-------------|----------
45 `--paper-fab-background` | The background color of the button | `--accent-color` 45 `--paper-fab-background` | The background color of the button | `--accent-color`
46 `--paper-fab-keyboard-focus-background` | The background color of the button whe n focused | `--paper-pink-900` 46 `--paper-fab-keyboard-focus-background` | The background color of the button whe n focused | `--paper-pink-900`
47 `--paper-fab-disabled-background` | The background color of the button when it's disabled | `--paper-grey-300` 47 `--paper-fab-disabled-background` | The background color of the button when it's disabled | `--paper-grey-300`
48 `--paper-fab-disabled-text` | The text color of the button when it's disabled | `--paper-grey-500` 48 `--paper-fab-disabled-text` | The text color of the button when it's disabled | `--paper-grey-500`
49 `--paper-fab` | Mixin applied to the button | `{}` 49 `--paper-fab` | Mixin applied to the button | `{}`
50 `--paper-fab-mini` | Mixin applied to a mini button | `{}` 50 `--paper-fab-mini` | Mixin applied to a mini button | `{}`
51 `--paper-fab-disabled` | Mixin applied to a disabled button | `{}` 51 `--paper-fab-disabled` | Mixin applied to a disabled button | `{}`
52 `--paper-fab-iron-icon` | Mixin applied to the iron-icon within the button | `{} `
52 53
53 @group Paper Elements 54 @group Paper Elements
54 @demo demo/index.html 55 @demo demo/index.html
55 56
56 --> 57 -->
57 58
58 <dom-module id="paper-fab"> 59 <dom-module id="paper-fab">
59 <style> 60 <template strip-whitespace>
61 <style include="paper-material">
62 :host {
63 display: inline-block;
64 position: relative;
65 outline: none;
66 -moz-user-select: none;
67 -ms-user-select: none;
68 -webkit-user-select: none;
69 -webkit-tap-highlight-color: rgba(0,0,0,0);
70 user-select: none;
71 cursor: pointer;
60 72
61 :host { 73 box-sizing: border-box;
62 display: inline-block; 74 min-width: 0;
63 position: relative; 75 width: 56px;
64 outline: none; 76 height: 56px;
65 -moz-user-select: none; 77 background: var(--paper-fab-background, --accent-color);
66 -ms-user-select: none; 78 color: var(--text-primary-color);
67 -webkit-user-select: none; 79 border-radius: 50%;
68 -webkit-tap-highlight-color: rgba(0,0,0,0); 80 padding: 16px;
69 user-select: none;
70 cursor: pointer;
71 81
72 box-sizing: border-box; 82 z-index: 0;
73 min-width: 0;
74 width: 56px;
75 height: 56px;
76 background: var(--paper-fab-background, --accent-color);
77 color: var(--text-primary-color);
78 border-radius: 50%;
79 padding: 16px;
80 83
81 z-index: 0; 84 @apply(--layout-vertical);
85 @apply(--layout-center-center);
86 @apply(--paper-fab);
87 }
82 88
83 @apply(--paper-fab); 89 :host([mini]) {
84 } 90 width: 40px;
91 height: 40px;
92 padding: 8px;
85 93
86 :host([mini]) { 94 @apply(--paper-fab-mini);
87 width: 40px; 95 }
88 height: 40px;
89 padding: 8px;
90 96
91 @apply(--paper-fab-mini); 97 :host([disabled]) {
92 } 98 color: var(--paper-fab-disabled-text, --paper-grey-500);
99 background: var(--paper-fab-disabled-background, --paper-grey-300);
100 @apply(--paper-fab-disabled);
101 }
93 102
94 :host([disabled]) { 103 iron-icon {
95 color: var(--paper-fab-disabled-text, --paper-grey-500); 104 @apply(--paper-fab-iron-icon);
96 background: var(--paper-fab-disabled-background, --paper-grey-300); 105 }
97 @apply(--paper-fab-disabled);
98 }
99 106
100 paper-material { 107 :host(.keyboard-focus) {
101 border-radius: inherit; 108 background: var(--paper-fab-keyboard-focus-background, --paper-pink-900) ;
102 @apply(--layout-fit); 109 }
103 @apply(--layout-vertical); 110 </style>
104 @apply(--layout-center-center);
105 }
106 111
107 .keyboard-focus { 112 <iron-icon id="icon" src="[[src]]" icon="[[icon]]"></iron-icon>
108 background: var(--paper-fab-keyboard-focus-background, --paper-pink-900);
109 }
110 </style>
111 <template>
112 <paper-ripple></paper-ripple>
113 <paper-material class$="[[_computeContentClass(receivedFocusFromKeyboard)]]" elevation="[[_elevation]]" animated>
114 <iron-icon id="icon" src="[[src]]" icon="[[icon]]"></iron-icon>
115 </paper-material>
116 </template> 113 </template>
117 </dom-module> 114 </dom-module>
115
118 <script> 116 <script>
119 Polymer({ 117 Polymer({
120 is: 'paper-fab', 118 is: 'paper-fab',
121 119
122 behaviors: [ 120 behaviors: [
123 Polymer.PaperButtonBehavior 121 Polymer.PaperButtonBehavior
124 ], 122 ],
125 123
126 properties: { 124 properties: {
127 /** 125 /**
(...skipping 28 matching lines...) Expand all
156 * 154 *
157 * @attribute mini 155 * @attribute mini
158 * @type boolean 156 * @type boolean
159 * @default false 157 * @default false
160 */ 158 */
161 mini: { 159 mini: {
162 type: Boolean, 160 type: Boolean,
163 value: false, 161 value: false,
164 reflectToAttribute: true 162 reflectToAttribute: true
165 } 163 }
166 },
167
168 _computeContentClass: function(receivedFocusFromKeyboard) {
169 var className = 'content';
170 if (receivedFocusFromKeyboard) {
171 className += ' keyboard-focus';
172 }
173 return className;
174 } 164 }
175
176 }); 165 });
177 </script> 166 </script>
OLDNEW
« no previous file with comments | « lib/src/paper-dropdown-menu/test/paper-dropdown-menu.html ('k') | lib/src/paper-fab/test/a11y.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698