Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 <!-- TODO(crbug.com/603217): Use i18n instead of string literals. Figure out | 1 <!-- TODO(crbug.com/603217): Use i18n instead of string literals. Figure out |
| 2 what i18n to use for keypad, ie, does 1 ABC make | 2 what i18n to use for keypad, ie, does 1 ABC make |
| 3 sense in every scenario? --> | 3 sense in every scenario? --> |
| 4 | 4 |
| 5 <link rel="import" href="chrome://resources/cr_elements/icons.html"> | 5 <link rel="import" href="chrome://resources/cr_elements/icons.html"> |
| 6 <link rel="import" href="chrome://resources/html/i18n_behavior.html"> | 6 <link rel="import" href="chrome://resources/html/i18n_behavior.html"> |
| 7 <link rel="import" href="chrome://resources/html/polymer.html"> | 7 <link rel="import" href="chrome://resources/html/polymer.html"> |
| 8 <link rel="import" href="chrome://resources/polymer/v1_0/paper-button/paper-butt on.html"> | 8 <link rel="import" href="chrome://resources/polymer/v1_0/paper-button/paper-butt on.html"> |
| 9 <link rel="import" href="chrome://resources/polymer/v1_0/paper-icon-button/paper -icon-button.html"> | |
| 9 <link rel="import" href="chrome://resources/polymer/v1_0/paper-styles/color.html "> | 10 <link rel="import" href="chrome://resources/polymer/v1_0/paper-styles/color.html "> |
| 10 <link rel="import" href="chrome://resources/polymer/v1_0/iron-icon/iron-icon.htm l"> | 11 <link rel="import" href="chrome://resources/polymer/v1_0/iron-icon/iron-icon.htm l"> |
| 11 <link rel="import" href="chrome://resources/polymer/v1_0/iron-iconset-svg/iron-i conset-svg.html"> | 12 <link rel="import" href="chrome://resources/polymer/v1_0/iron-iconset-svg/iron-i conset-svg.html"> |
| 12 | 13 |
| 13 <iron-iconset-svg name="pin-keyboard" size="24"> | 14 <iron-iconset-svg name="pin-keyboard" size="24"> |
| 14 <svg> | 15 <svg> |
| 15 <defs> | 16 <defs> |
| 16 <!-- | 17 <!-- |
| 17 Inlined from Polymer's iron-icons to avoid importing everything. | 18 Inlined from Polymer's iron-icons to avoid importing everything. |
| 18 See http://goo.gl/Y1OdAq for instructions on adding additional icons. | 19 See http://goo.gl/Y1OdAq for instructions on adding additional icons. |
| 19 --> | 20 --> |
| 20 <g id="forward"><path d="M12 8V4l8 8-8 8v-4H4V8z"></path></g> | 21 <g id="arrow-forward"> |
| 21 </defs> | 22 <path d="M12 4l-1.41 1.41L16.17 11H4v2h12.17l-5.58 5.59L12 20l8-8z"> |
| 22 </svg> | 23 </path> |
| 24 </g> | |
| 25 <g id="backspace"> | |
| 26 <path d="M22 3H7c-.69 0-1.23.35-1.59.88L0 12l5.41 8.11c.36.53.9.89 1.59. 89h15c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-3 12.59L17.59 17 14 13.41 10.41 17 9 15. 59 12.59 12 9 8.41 10.41 7 14 10.59 17.59 7 19 8.41 15.41 12 19 15.59z"> | |
| 27 </g> | |
| 28 </defs> | |
|
jdufault
2016/08/26 19:59:18
Undo indent changes
sammiequon
2016/08/26 21:56:44
Done.
| |
| 29 </svg> | |
| 23 </iron-iconset-svg> | 30 </iron-iconset-svg> |
| 24 | 31 |
| 25 <dom-module id="pin-keyboard"> | 32 <dom-module id="pin-keyboard"> |
| 26 <template> | 33 <template> |
| 27 <style> | 34 <style> |
| 28 #root { | 35 #root { |
| 29 direction: ltr; | 36 direction: ltr; |
| 30 display: flex; | 37 display: flex; |
| 31 } | 38 } |
| 32 | 39 |
| 33 .input-non-pin { | |
| 34 direction: rtl; | |
| 35 } | |
| 36 | |
| 37 .row { | 40 .row { |
| 38 display: flex; | 41 display: flex; |
| 39 } | 42 } |
| 40 | 43 |
| 41 .digit-button { | 44 .digit-button { |
| 42 align-items: center; | 45 align-items: center; |
| 43 background: none; | 46 background: none; |
| 44 border-radius: 20px; | 47 border-radius: 100px; |
| 45 box-sizing: border-box; | 48 box-sizing: border-box; |
| 46 color: var(--paper-blue-grey-700); | 49 color: #000; |
| 47 display: flex; | 50 display: flex; |
| 48 flex-direction: column; | 51 flex-direction: column; |
| 49 font-size: 32px; | 52 font-size: 18px; |
| 50 height: 70px; | 53 height: 48px; |
| 51 justify-content: center; | 54 justify-content: center; |
| 52 margin: 0; | 55 margin: 0 6px; |
| 53 min-height: 70px; | 56 min-height: 48px; |
| 54 min-width: 70px; | 57 min-width: 48px; |
| 55 padding: 15px 20px; | 58 opacity: 0.87; |
| 56 width: 70px; | 59 padding: 15px; |
| 60 width: 48px; | |
| 57 } | 61 } |
| 58 | 62 |
| 59 .digit-button.clear-button { | 63 .digit-button[hidden] { |
|
xiyuan
2016/08/26 21:11:31
nit: Should we use [hidden=true]? Would it work as
jdufault
2016/08/26 21:25:29
+1, also pull it away from just .digit-button, ie,
sammiequon
2016/08/26 21:56:44
Done.
sammiequon
2016/08/26 21:56:44
Done.
| |
| 60 display: block; | 64 display: none; |
| 61 } | 65 } |
| 62 | 66 |
| 63 .digit-button.center-button { | 67 .bottom-row { |
| 64 margin: 0 30px; | 68 margin-bottom: 6px; |
| 69 } | |
| 70 | |
| 71 .top-row { | |
| 72 margin-top: 6px; | |
| 73 } | |
| 74 | |
| 75 .digit-button.backspace-button { | |
| 76 opacity: var(--dark-primary-opacity); | |
| 77 } | |
| 78 | |
| 79 .digit-button.backspace-button[disabled] { | |
| 80 color: #000; | |
| 81 opacity: 0.26; | |
| 82 padding: 14px; | |
| 65 } | 83 } |
| 66 | 84 |
| 67 .digit-button.submit-button { | 85 .digit-button.submit-button { |
| 68 left: 20px; | 86 color: var(--google-blue-500); |
| 69 position: relative; | 87 height: 43px; |
| 88 left: 137px; | |
| 89 margin: 0; | |
| 90 min-height: 43px; | |
| 91 min-width: 43px; | |
| 92 opacity: var(--light-primary-opacity); | |
| 93 padding: 11.5px 10px; | |
| 94 position: absolute; | |
| 95 width: 43px; | |
| 70 } | 96 } |
| 71 | 97 |
| 72 .digit-button.submit-button.submit-button-hidden { | 98 .digit-button.submit-button[disabled] { |
| 73 display: none; | 99 color: #000; |
| 74 } | 100 opacity: 0.26; |
| 75 | |
| 76 .digit-button .icon-container { | |
| 77 background: var(--paper-grey-400); | |
| 78 border-radius: 100px; | |
| 79 height: 24px; | |
| 80 margin: auto; | |
| 81 width: 24px; | |
| 82 } | |
| 83 | |
| 84 .digit-button .icon-container.ready-background { | |
| 85 background: var(--paper-blue-800); | |
| 86 } | |
| 87 | |
| 88 .digit-button .icon-container .icon { | |
| 89 color: white; | |
| 90 display: block; | |
| 91 height: 16px; | |
| 92 left: 4px; | |
| 93 top: 4px; | |
| 94 width: 16px; | |
| 95 } | |
| 96 | |
| 97 .digit-button .icon-subheading { | |
| 98 color: var(--paper-grey-400); | |
| 99 font-size: 10px; | |
| 100 left: 0; | |
| 101 position: absolute; | |
| 102 text-align: center; | |
| 103 text-transform: capitalize; | |
| 104 top: 44px; | |
| 105 width: 100%; | |
| 106 } | 101 } |
| 107 | 102 |
| 108 .digit-button inner-text { | 103 .digit-button inner-text { |
| 109 color: var(--paper-blue-grey-700); | 104 color: var(--paper-blue-grey-700); |
| 110 display: flex; | 105 display: flex; |
| 111 flex-direction: column; | 106 flex-direction: column; |
| 112 height: 52px; | 107 height: 52px; |
| 113 } | 108 } |
| 114 | 109 |
| 115 .first-row { | |
| 116 height: 64px; | |
| 117 min-height: 64px; | |
| 118 padding: 28px 15px 12px 15px; | |
| 119 } | |
| 120 | |
| 121 #pin-input { | 110 #pin-input { |
| 122 -webkit-text-security: disc; | 111 -webkit-text-security: disc; |
| 123 background-color: white; | 112 background-color: white; |
| 124 border: 0; | 113 border: 0; |
| 125 box-sizing: border-box; | 114 box-sizing: border-box; |
| 126 font-size: 18px; | 115 font-face: Roboto-Regular; |
| 127 height: 64px; | 116 font-size: 13px; |
| 128 left: 20px; | 117 height: 43px; |
| 118 left: 10px; | |
| 119 opacity: var(--dark-secondary-opacity); | |
| 129 outline: 0; | 120 outline: 0; |
| 130 padding: 28px 3px 12px 3px; | |
| 131 position: relative; | 121 position: relative; |
| 122 text-color: #000; | |
| 123 width: 127px; | |
| 124 } | |
| 125 | |
| 126 #pin-input[has-content] { | |
| 127 opacity: var(--dark-primary-opacity); | |
| 128 } | |
| 129 | |
| 130 #pin-input[is-input-rtl] { | |
| 131 direction: rtl; | |
| 132 } | |
| 133 | |
| 134 :host(:not([enable-submit-button])) #pin-input { | |
| 135 left: 0; | |
| 136 text-align: center; | |
| 132 width: 180px; | 137 width: 180px; |
| 133 } | 138 } |
| 134 | 139 |
| 135 #pin-input.submit-button-hidden { | 140 hr { |
| 136 border-bottom: 2px; | 141 border: 0; |
| 137 border-bottom-style: solid; | 142 border-bottom: 1px solid #000; |
| 138 text-align: center; | 143 left: 10px; |
| 139 width: 230px; | 144 margin: 0; |
| 145 opacity: 0.14; | |
| 146 position: relative; | |
| 147 width: 160px; | |
| 140 } | 148 } |
| 141 | 149 |
| 142 #pin-input[type=number]::-webkit-inner-spin-button, | 150 #pin-input[type=number]::-webkit-inner-spin-button, |
| 143 #pin-input[type=number]::-webkit-outer-spin-button { | 151 #pin-input[type=number]::-webkit-outer-spin-button { |
| 144 -webkit-appearance: none; | 152 -webkit-appearance: none; |
| 145 margin: 0; | 153 margin: 0; |
| 146 } | 154 } |
| 147 | 155 |
| 148 /* Ensure that all children of paper-button do not consume events. This | 156 /* Ensure that all children of paper-button do not consume events. This |
| 149 * simplifies the event handler code. */ | 157 * simplifies the event handler code. */ |
| 150 paper-button * { | 158 paper-button * { |
| 151 pointer-events: none; | 159 pointer-events: none; |
| 152 } | 160 } |
| 153 </style> | 161 </style> |
| 154 | 162 |
| 155 <div id="root"> | 163 <div id="root"> |
| 156 <div id="container-constrained-width"> | 164 <div id="container-constrained-width"> |
| 157 <div class="row"> | 165 <div class="row"> |
| 158 <input id="pin-input" type="[[getInputType_(enablePassword)]]" | 166 <input id="pin-input" type="[[getInputType_(enablePassword)]]" |
| 159 class$="[[getInputClass_(value)]] | 167 is-input-rtl$="[[isInputRtl_(value)]]" |
| 160 [[getSubmitHiddenClass_(enableSubmitButton)]]" | 168 has-content$="[[hasInput_(value)]]" |
| 161 placeholder="[[getInputPlaceholder_(enablePassword)]]" | 169 placeholder="[[getInputPlaceholder_(enablePassword)]]" |
| 162 value="{{value::input}}" | 170 value="{{value::input}}" |
| 163 on-keydown="onInputKeyDown_"></input> | 171 on-keydown="onInputKeyDown_"> |
| 164 <paper-button class$="digit-button first-row submit-button | 172 </input> |
| 165 [[getSubmitHiddenClass_(enableSubmitButton)]]" | 173 <paper-icon-button icon="pin-keyboard:arrow-forward" |
| 166 on-tap="firePinSubmitEvent_"> | 174 class="digit-button submit-button" |
| 167 <div class$="icon-container [[getSubmitClass_(value)]]"> | 175 disabled="[[!hasInput_(value)]]" |
| 168 <iron-icon class="icon" icon="pin-keyboard:forward"><iron-icon> | 176 hidden="[[!enableSubmitButton]]" |
| 169 </div> | 177 on-tap="firePinSubmitEvent_"> |
| 170 </paper-button> | 178 </paper-icon-button> |
| 171 </div> | 179 </div> |
| 172 | 180 <hr> |
| 173 <div class="row keyboard"> | 181 <div class="row keyboard top-row"> |
| 174 <paper-button class="digit-button" on-tap="onNumberTap_" value="1"> | 182 <paper-button class="digit-button" on-tap="onNumberTap_" value="1"> |
| 175 <inner-text>$i18n{pinKeyboard1}</inner-text> | 183 <inner-text>$i18n{pinKeyboard1}</inner-text> |
| 176 </paper-button> | 184 </paper-button> |
| 177 <paper-button class="digit-button center-button" on-tap="onNumberTap_" | 185 <paper-button class="digit-button" on-tap="onNumberTap_" value="2"> |
| 178 value="2"> | |
| 179 <inner-text>$i18n{pinKeyboard2}</inner-text> | 186 <inner-text>$i18n{pinKeyboard2}</inner-text> |
| 180 </paper-button> | 187 </paper-button> |
| 181 <paper-button class="digit-button" on-tap="onNumberTap_" value="3"> | 188 <paper-button class="digit-button" on-tap="onNumberTap_" value="3"> |
| 182 <inner-text>$i18n{pinKeyboard3}</inner-text> | 189 <inner-text>$i18n{pinKeyboard3}</inner-text> |
| 183 </paper-button> | 190 </paper-button> |
| 184 </div> | 191 </div> |
| 185 <div class="row keyboard"> | 192 <div class="row keyboard"> |
| 186 <paper-button class="digit-button" on-tap="onNumberTap_" value="4"> | 193 <paper-button class="digit-button" on-tap="onNumberTap_" value="4"> |
| 187 <inner-text>$i18n{pinKeyboard4}</inner-text> | 194 <inner-text>$i18n{pinKeyboard4}</inner-text> |
| 188 </paper-button> | 195 </paper-button> |
| 189 <paper-button class="digit-button center-button" on-tap="onNumberTap_" | 196 <paper-button class="digit-button" on-tap="onNumberTap_" value="5"> |
| 190 value="5"> | |
| 191 <inner-text>$i18n{pinKeyboard5}</inner-text> | 197 <inner-text>$i18n{pinKeyboard5}</inner-text> |
| 192 </paper-button> | 198 </paper-button> |
| 193 <paper-button class="digit-button" on-tap="onNumberTap_" value="6"> | 199 <paper-button class="digit-button" on-tap="onNumberTap_" value="6"> |
| 194 <inner-text>$i18n{pinKeyboard6}</inner-text> | 200 <inner-text>$i18n{pinKeyboard6}</inner-text> |
| 195 </paper-button> | 201 </paper-button> |
| 196 </div> | 202 </div> |
| 197 <div class="row keyboard"> | 203 <div class="row keyboard"> |
| 198 <paper-button class="digit-button" on-tap="onNumberTap_" value="7"> | 204 <paper-button class="digit-button" on-tap="onNumberTap_" value="7"> |
| 199 <inner-text>$i18n{pinKeyboard7}</inner-text> | 205 <inner-text>$i18n{pinKeyboard7}</inner-text> |
| 200 </paper-button> | 206 </paper-button> |
| 201 <paper-button class="digit-button center-button" on-tap="onNumberTap_" | 207 <paper-button class="digit-button" on-tap="onNumberTap_" value="8"> |
| 202 value="8"> | |
| 203 <inner-text>$i18n{pinKeyboard8}</inner-text> | 208 <inner-text>$i18n{pinKeyboard8}</inner-text> |
| 204 </paper-button> | 209 </paper-button> |
| 205 <paper-button class="digit-button" on-tap="onNumberTap_" value="9"> | 210 <paper-button class="digit-button" on-tap="onNumberTap_" value="9"> |
| 206 <inner-text>$i18n{pinKeyboard9}</inner-text> | 211 <inner-text>$i18n{pinKeyboard9}</inner-text> |
| 207 </paper-button> | 212 </paper-button> |
| 208 </div> | 213 </div> |
| 209 <div class="row keyboard"> | 214 <div class="row keyboard bottom-row"> |
| 210 <div class="digit-button"></div> | 215 <div class="digit-button"></div> |
| 211 <paper-button class="digit-button center-button" on-tap="onNumberTap_" | 216 <paper-button class="digit-button" on-tap="onNumberTap_" value="0"> |
| 212 value="0"> | |
| 213 <inner-text>$i18n{pinKeyboard0}</inner-text> | 217 <inner-text>$i18n{pinKeyboard0}</inner-text> |
| 214 </paper-button> | 218 </paper-button> |
| 215 <paper-button class="digit-button clear-button" on-tap="onPinClear_"> | 219 <paper-icon-button class="digit-button backspace-button" |
| 216 <div class="icon-container"> | 220 disabled="[[!hasInput_(value)]]" |
| 217 <iron-icon class="icon" icon="cr:clear"><iron-icon> | 221 on-tap="onPinClear_" icon="pin-keyboard:backspace"> |
| 218 </div> | 222 </paper-icon-button> |
| 219 <inner-text class="icon-subheading"> | |
| 220 $i18n{pinKeyboardClear} | |
| 221 </inner-text> | |
| 222 </paper-button> | |
| 223 </div> | 223 </div> |
| 224 </div> | 224 </div> |
| 225 </div> | 225 </div> |
| 226 </template> | 226 </template> |
| 227 <script src="pin_keyboard.js"></script> | 227 <script src="pin_keyboard.js"></script> |
| 228 </dom-module> | 228 </dom-module> |
| OLD | NEW |