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/html/i18n_behavior.html"> | 5 <link rel="import" href="chrome://resources/html/i18n_behavior.html"> |
| 6 <link rel="import" href="chrome://resources/polymer/v1_0/paper-button/paper-butt on.html"> | 6 <link rel="import" href="chrome://resources/polymer/v1_0/paper-button/paper-butt on.html"> |
| 7 <link rel="import" href="chrome://resources/polymer/v1_0/paper-icon-button/paper -icon-button.html"> | 7 <link rel="import" href="chrome://resources/polymer/v1_0/paper-icon-button/paper -icon-button.html"> |
| 8 <link rel="import" href="chrome://resources/polymer/v1_0/paper-styles/paper-styl es.html"> | 8 <link rel="import" href="chrome://resources/polymer/v1_0/paper-styles/paper-styl es.html"> |
| 9 <link rel="import" href="chrome://resources/polymer/v1_0/iron-icons/iron-icons.h tml"> | 9 <link rel="import" href="chrome://resources/polymer/v1_0/iron-icons/iron-icons.h tml"> |
| 10 | 10 |
| 11 <dom-module id="pin-keyboard"> | 11 <dom-module id="pin-keyboard"> |
| 12 <template> | 12 <template> |
| 13 <style> | 13 <style> |
| 14 #root { | 14 #root { |
| 15 direction: ltr; | 15 direction: ltr; |
| 16 display: flex; | 16 display: flex; |
| 17 } | 17 } |
| 18 | 18 |
| 19 .input-non-pin { | 19 .input-non-pin { |
| 20 direction: rtl; | 20 direction: rtl; |
| 21 } | 21 } |
| 22 | 22 |
| 23 .row { | 23 .row { |
| 24 display: flex; | 24 display: flex; |
| 25 } | 25 } |
| 26 | 26 |
| 27 .digit-button { | 27 .digit-button { |
| 28 align-items: center; | 28 align-items: center; |
| 29 background: none; | 29 background: none; |
| 30 border-radius: 20px; | 30 border-radius: 100px; |
| 31 box-sizing: border-box; | 31 box-sizing: border-box; |
| 32 color: var(--paper-blue-grey-700); | 32 color: #000; |
| 33 display: flex; | 33 display: flex; |
| 34 flex-direction: column; | 34 flex-direction: column; |
| 35 font-size: 32px; | 35 font-size: 18px; |
| 36 height: 70px; | 36 height: 48px; |
| 37 justify-content: center; | 37 justify-content: center; |
| 38 margin: 0; | 38 margin: 0 6px; |
| 39 min-height: 70px; | 39 min-height: 48px; |
| 40 min-width: 70px; | 40 min-width: 48px; |
| 41 padding: 15px 20px; | 41 opacity: 0.87; |
| 42 width: 70px; | 42 padding: 15px; |
| 43 width: 48px; | |
| 43 } | 44 } |
| 44 | 45 |
| 45 .digit-button.clear-button { | 46 .bottom-row { |
| 46 display: block; | 47 margin-bottom: 6px; |
| 47 } | 48 } |
| 48 | 49 |
| 49 .digit-button.center-button { | 50 .top-row { |
| 50 margin: 0 30px; | 51 margin-top: 6px; |
| 52 } | |
| 53 | |
| 54 .digit-button.backspace-button { | |
| 55 opacity: var(--dark-primary-opacity); | |
| 56 } | |
| 57 | |
| 58 .digit-button.backspace-button[disabled] { | |
| 59 color: #000; | |
| 60 opacity: 0.26; | |
| 61 padding: 14px; | |
| 51 } | 62 } |
| 52 | 63 |
| 53 .digit-button.submit-button { | 64 .digit-button.submit-button { |
| 54 left: 20px; | 65 color: var(--google-blue-500); |
| 55 position: relative; | 66 height: 43px; |
| 67 left: 137px; | |
| 68 margin: 0; | |
| 69 min-height: 43px; | |
| 70 min-width: 43px; | |
| 71 opacity: var(--light-primary-opacity); | |
| 72 padding: 11.5px 10px; | |
| 73 position: absolute; | |
| 74 width: 43px; | |
| 75 } | |
| 76 | |
| 77 .digit-button.submit-button[disabled] { | |
| 78 color: #000; | |
| 79 opacity: 0.26; | |
| 80 } | |
| 81 | |
| 82 .digit-button.submit-button.error-show, | |
| 83 .digit-button.submit-button.error-show[disabled] { | |
| 84 color: var(--google-red-700); | |
| 85 opacity: 1; | |
| 56 } | 86 } |
| 57 | 87 |
| 58 .digit-button.submit-button.submit-button-hidden { | 88 .digit-button.submit-button.submit-button-hidden { |
| 59 display: none; | 89 display: none; |
| 60 } | 90 } |
| 61 | 91 |
| 62 .digit-button .icon-container { | |
| 63 background: var(--paper-grey-400); | |
| 64 border-radius: 100px; | |
| 65 height: 24px; | |
| 66 margin: auto; | |
| 67 width: 24px; | |
| 68 } | |
| 69 | |
| 70 .digit-button .icon-container.ready-background { | |
| 71 background: var(--paper-blue-800); | |
| 72 } | |
| 73 | |
| 74 .digit-button .icon-container .icon { | |
| 75 color: white; | |
| 76 display: block; | |
| 77 height: 16px; | |
| 78 left: 4px; | |
| 79 top: 4px; | |
| 80 width: 16px; | |
| 81 } | |
| 82 | |
| 83 .digit-button .icon-subheading { | |
| 84 color: var(--paper-grey-400); | |
| 85 font-size: 10px; | |
| 86 left: 0; | |
| 87 position: absolute; | |
| 88 text-align: center; | |
| 89 text-transform: capitalize; | |
| 90 top: 44px; | |
| 91 width: 100%; | |
| 92 } | |
| 93 | |
| 94 .digit-button inner-text { | 92 .digit-button inner-text { |
| 95 color: var(--paper-blue-grey-700); | 93 color: var(--paper-blue-grey-700); |
| 96 display: flex; | 94 display: flex; |
| 97 flex-direction: column; | 95 flex-direction: column; |
| 98 height: 52px; | 96 height: 52px; |
| 99 } | 97 } |
| 100 | 98 |
| 101 .first-row { | 99 .error-message { |
| 102 height: 64px; | 100 color: var(--google-red-700); |
| 103 min-height: 64px; | 101 display: none; |
| 104 padding: 28px 15px 12px 15px; | 102 font-size: 12px; |
| 103 height: 12px; | |
| 104 left: 0; | |
| 105 padding: 0 10px; | |
| 106 position: absolute; | |
| 107 width: 100%; | |
| 108 } | |
| 109 | |
| 110 .error-message.error-show { | |
| 111 display: block; | |
| 105 } | 112 } |
| 106 | 113 |
| 107 #pin-input { | 114 #pin-input { |
| 108 -webkit-text-security: disc; | 115 -webkit-text-security: disc; |
| 109 background-color: white; | 116 background-color: white; |
| 110 border: 0; | 117 border: 0; |
| 111 box-sizing: border-box; | 118 box-sizing: border-box; |
| 112 font-size: 18px; | 119 font-face: Roboto-Regular; |
| 113 height: 64px; | 120 font-size: 13px; |
| 114 left: 20px; | 121 height: 43px; |
| 122 left: 10px; | |
| 123 opacity: var(--dark-secondary-opacity); | |
| 115 outline: 0; | 124 outline: 0; |
| 116 padding: 28px 3px 12px 3px; | |
| 117 position: relative; | 125 position: relative; |
| 126 text-color: #000; | |
| 127 width: 127px; | |
| 128 } | |
| 129 | |
| 130 #pin-input.has-content { | |
| 131 opacity: var(--dark-primary-opacity); | |
| 132 } | |
| 133 | |
| 134 #pin-input.submit-button-hidden { | |
| 135 left: 0; | |
| 136 text-align: center; | |
| 118 width: 180px; | 137 width: 180px; |
| 119 } | 138 } |
| 120 | 139 |
| 121 #pin-input.submit-button-hidden { | 140 hr { |
| 122 border-bottom: 2px; | 141 border: 0; |
| 123 border-bottom-style: solid; | 142 border-bottom: 1px solid #000; |
| 124 text-align: center; | 143 left: 10px; |
| 125 width: 230px; | 144 margin: 0; |
| 145 opacity: 0.14; | |
| 146 position: relative; | |
| 147 width: 160px; | |
| 126 } | 148 } |
| 127 | 149 |
| 128 #pin-input[type=number]::-webkit-inner-spin-button, | 150 #pin-input[type=number]::-webkit-inner-spin-button, |
| 129 #pin-input[type=number]::-webkit-outer-spin-button { | 151 #pin-input[type=number]::-webkit-outer-spin-button { |
| 130 -webkit-appearance: none; | 152 -webkit-appearance: none; |
| 131 margin: 0; | 153 margin: 0; |
| 132 } | 154 } |
| 133 | 155 |
| 134 /* 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 |
| 135 * simplifies the event handler code. */ | 157 * simplifies the event handler code. */ |
| 136 paper-button * { | 158 paper-button * { |
| 137 pointer-events: none; | 159 pointer-events: none; |
| 138 } | 160 } |
| 139 </style> | 161 </style> |
| 140 | 162 |
| 141 <div id="root"> | 163 <div id="root"> |
| 142 <div id="container-constrained-width"> | 164 <div id="container-constrained-width"> |
| 143 <div class="row horizontal-center"> | 165 <div class="row"> |
| 144 <input id="pin-input" type="[[getInputType_(enablePassword)]]" | 166 <input id="pin-input" type="[[getInputType_(enablePassword)]]" |
| 145 class$="[[getInputClass_(value)]] | 167 class$="[[getInputClass_(value)]] |
| 146 [[getSubmitHiddenClass_(enableSubmitButton)]]" | 168 [[getSubmitClass_(enableSubmitButton)]] |
| 169 [[getContentClass_(value)]]" | |
| 147 placeholder="[[getInputPlaceholder_(enablePassword)]]" | 170 placeholder="[[getInputPlaceholder_(enablePassword)]]" |
| 148 value="{{value::input}}" | 171 value="{{value::input}}" |
| 149 on-keydown="onInputKeyDown_"></input> | 172 on-keydown="onInputKeyDown_"></input> |
| 150 <paper-button class$="digit-button first-row submit-button | 173 <paper-icon-button icon="icons:arrow-forward" |
| 151 [[getSubmitHiddenClass_(enableSubmitButton)]]" | 174 class$="digit-button submit-button |
| 152 on-tap="firePinSubmitEvent_"> | 175 [[getSubmitClass_(enableSubmitButton)]] |
| 153 <div class$="icon-container [[getSubmitClass_(value)]]"> | 176 [[getErrorClass_(enableError)]]" |
| 154 <iron-icon class="icon" icon="icons:forward"><iron-icon> | 177 disabled="[[!hasInput_(value)]]" |
| 155 </div> | 178 on-tap="firePinSubmitEvent_"> |
| 156 </paper-button> | 179 </paper-icon-button> |
| 157 </div> | 180 </div> |
| 158 | 181 <hr> |
| 159 <div class="row keyboard"> | 182 <div class$="error-message [[getErrorClass_(enableError)]]"> |
|
jdufault
2016/08/08 23:47:25
The error message also needs to be customizable. I
jdufault
2016/08/08 23:47:25
Use a <dom-if> instead of the error class.
<templ
sammiequon
2016/08/11 01:03:06
Done.
sammiequon
2016/08/11 01:03:07
Added a public function in pin_keyboard.js which c
| |
| 183 Pin or password incorrect. | |
|
jdufault
2016/08/08 23:47:25
Make sure to localize any strings you include.
sammiequon
2016/08/11 01:03:06
Done.
| |
| 184 </div> | |
| 185 <div class="row keyboard top-row"> | |
| 160 <paper-button class="digit-button" on-tap="onNumberTap_" value="1"> | 186 <paper-button class="digit-button" on-tap="onNumberTap_" value="1"> |
| 161 <inner-text>$i18n{pinKeyboard1}</inner-text> | 187 <inner-text>$i18n{pinKeyboard1}</inner-text> |
| 162 </paper-button> | 188 </paper-button> |
| 163 <paper-button class="digit-button center-button" on-tap="onNumberTap_" | 189 <paper-button class="digit-button" on-tap="onNumberTap_" value="2"> |
| 164 value="2"> | |
| 165 <inner-text>$i18n{pinKeyboard2}</inner-text> | 190 <inner-text>$i18n{pinKeyboard2}</inner-text> |
| 166 </paper-button> | 191 </paper-button> |
| 167 <paper-button class="digit-button" on-tap="onNumberTap_" value="3"> | 192 <paper-button class="digit-button" on-tap="onNumberTap_" value="3"> |
| 168 <inner-text>$i18n{pinKeyboard3}</inner-text> | 193 <inner-text>$i18n{pinKeyboard3}</inner-text> |
| 169 </paper-button> | 194 </paper-button> |
| 170 </div> | 195 </div> |
| 171 <div class="row keyboard"> | 196 <div class="row keyboard"> |
| 172 <paper-button class="digit-button" on-tap="onNumberTap_" value="4"> | 197 <paper-button class="digit-button" on-tap="onNumberTap_" value="4"> |
| 173 <inner-text>$i18n{pinKeyboard4}</inner-text> | 198 <inner-text>$i18n{pinKeyboard4}</inner-text> |
| 174 </paper-button> | 199 </paper-button> |
| 175 <paper-button class="digit-button center-button" on-tap="onNumberTap_" | 200 <paper-button class="digit-button" on-tap="onNumberTap_" value="5"> |
| 176 value="5"> | |
| 177 <inner-text>$i18n{pinKeyboard5}</inner-text> | 201 <inner-text>$i18n{pinKeyboard5}</inner-text> |
| 178 </paper-button> | 202 </paper-button> |
| 179 <paper-button class="digit-button" on-tap="onNumberTap_" value="6"> | 203 <paper-button class="digit-button" on-tap="onNumberTap_" value="6"> |
| 180 <inner-text>$i18n{pinKeyboard6}</inner-text> | 204 <inner-text>$i18n{pinKeyboard6}</inner-text> |
| 181 </paper-button> | 205 </paper-button> |
| 182 </div> | 206 </div> |
| 183 <div class="row keyboard"> | 207 <div class="row keyboard"> |
| 184 <paper-button class="digit-button" on-tap="onNumberTap_" value="7"> | 208 <paper-button class="digit-button" on-tap="onNumberTap_" value="7"> |
| 185 <inner-text>$i18n{pinKeyboard7}</inner-text> | 209 <inner-text>$i18n{pinKeyboard7}</inner-text> |
| 186 </paper-button> | 210 </paper-button> |
| 187 <paper-button class="digit-button center-button" on-tap="onNumberTap_" | 211 <paper-button class="digit-button" on-tap="onNumberTap_" value="8"> |
| 188 value="8"> | |
| 189 <inner-text>$i18n{pinKeyboard8}</inner-text> | 212 <inner-text>$i18n{pinKeyboard8}</inner-text> |
| 190 </paper-button> | 213 </paper-button> |
| 191 <paper-button class="digit-button" on-tap="onNumberTap_" value="9"> | 214 <paper-button class="digit-button" on-tap="onNumberTap_" value="9"> |
| 192 <inner-text>$i18n{pinKeyboard9}</inner-text> | 215 <inner-text>$i18n{pinKeyboard9}</inner-text> |
| 193 </paper-button> | 216 </paper-button> |
| 194 </div> | 217 </div> |
| 195 <div class="row keyboard"> | 218 <div class="row keyboard bottom-row"> |
| 196 <div class="digit-button"></div> | 219 <div class="digit-button"></div> |
| 197 <paper-button class="digit-button center-button" on-tap="onNumberTap_" | 220 <paper-button class="digit-button" on-tap="onNumberTap_" value="0"> |
| 198 value="0"> | |
| 199 <inner-text>$i18n{pinKeyboard0}</inner-text> | 221 <inner-text>$i18n{pinKeyboard0}</inner-text> |
| 200 </paper-button> | 222 </paper-button> |
| 201 <paper-button class="digit-button clear-button" on-tap="onPinClear_"> | 223 <paper-icon-button class="digit-button backspace-button" |
| 202 <div class="icon-container"> | 224 disabled="[[!hasInput_(value)]]" |
| 203 <iron-icon class="icon" icon="icons:clear"><iron-icon> | 225 on-tap="onPinClear_" icon="icons:backspace"> |
| 204 </div> | |
| 205 <inner-text class="icon-subheading"> | |
| 206 $i18n{pinKeyboardClear} | |
| 207 </inner-text> | |
| 208 </paper-button> | 226 </paper-button> |
| 209 </div> | 227 </div> |
| 210 </div> | 228 </div> |
| 211 </div> | 229 </div> |
| 212 </template> | 230 </template> |
| 213 <script src="pin_keyboard.js"></script> | 231 <script src="pin_keyboard.js"></script> |
| 214 </dom-module> | 232 </dom-module> |
| OLD | NEW |