OLD | NEW |
(Empty) | |
| 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 |
| 3 sense in every scenario? --> |
| 4 |
| 5 <link rel="import" href="chrome://resources/cr_elements/icons.html"> |
| 6 <link rel="import" href="chrome://resources/cr_elements/shared_vars_css.html"> |
| 7 <link rel="import" href="chrome://resources/html/i18n_behavior.html"> |
| 8 <link rel="import" href="chrome://resources/html/polymer.html"> |
| 9 <link rel="import" href="chrome://resources/polymer/v1_0/paper-button/paper-butt
on.html"> |
| 10 <link rel="import" href="chrome://resources/polymer/v1_0/paper-icon-button/paper
-icon-button.html"> |
| 11 <link rel="import" href="chrome://resources/polymer/v1_0/paper-input/paper-input
.html"> |
| 12 <link rel="import" href="chrome://resources/polymer/v1_0/paper-styles/color.html
"> |
| 13 <link rel="import" href="chrome://resources/polymer/v1_0/iron-icon/iron-icon.htm
l"> |
| 14 <link rel="import" href="chrome://resources/polymer/v1_0/iron-iconset-svg/iron-i
conset-svg.html"> |
| 15 |
| 16 <iron-iconset-svg name="pin-keyboard" size="24"> |
| 17 <svg> |
| 18 <defs> |
| 19 <!-- |
| 20 Inlined from Polymer's iron-icons to avoid importing everything. |
| 21 See http://goo.gl/Y1OdAq for instructions on adding additional icons. |
| 22 --> |
| 23 <g id="arrow-forward"> |
| 24 <path d="M12 4l-1.41 1.41L16.17 11H4v2h12.17l-5.58 5.59L12 20l8-8z"> |
| 25 </path> |
| 26 </g> |
| 27 <g id="backspace"> |
| 28 <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"> |
| 29 </g> |
| 30 </defs> |
| 31 </svg> |
| 32 </iron-iconset-svg> |
| 33 |
| 34 <dom-module id="pin-keyboard"> |
| 35 <template> |
| 36 <style include="cr-shared-style"> |
| 37 :host { |
| 38 outline: none; |
| 39 } |
| 40 |
| 41 :host(:not([enable-submit-button])) #pinInput { |
| 42 left: 0; |
| 43 text-align: center; |
| 44 width: 180px; |
| 45 } |
| 46 |
| 47 #root { |
| 48 direction: ltr; |
| 49 display: flex; |
| 50 } |
| 51 |
| 52 .row { |
| 53 display: flex; |
| 54 } |
| 55 |
| 56 .digit-button { |
| 57 align-items: center; |
| 58 background: none; |
| 59 border-radius: 0; |
| 60 box-sizing: border-box; |
| 61 color: #000; |
| 62 display: flex; |
| 63 flex-direction: column; |
| 64 font-size: 18px; |
| 65 height: 48px; |
| 66 justify-content: center; |
| 67 margin: 0; |
| 68 min-height: 48px; |
| 69 min-width: 48px; |
| 70 opacity: 0.87; |
| 71 padding: 15px 21px; |
| 72 width: 60px; |
| 73 } |
| 74 |
| 75 [hidden=true] { |
| 76 display: none; |
| 77 } |
| 78 |
| 79 .first-row { |
| 80 height: 43px; |
| 81 } |
| 82 |
| 83 .bottom-row { |
| 84 margin-bottom: 6px; |
| 85 } |
| 86 |
| 87 .top-row { |
| 88 margin-top: 6px; |
| 89 } |
| 90 |
| 91 .backspace-button-container { |
| 92 position: relative; |
| 93 } |
| 94 |
| 95 .backspace-button-container paper-ripple { |
| 96 position: absolute; |
| 97 top: 0; |
| 98 } |
| 99 |
| 100 paper-ripple { |
| 101 border-radius: 100px; |
| 102 color: #000; |
| 103 height: 48px; |
| 104 left: 6px; |
| 105 width: 48px; |
| 106 } |
| 107 |
| 108 .digit-button.backspace-button { |
| 109 left: 0; |
| 110 opacity: var(--dark-primary-opacity); |
| 111 padding: 14px; |
| 112 position: absolute; |
| 113 top: 0; |
| 114 } |
| 115 |
| 116 .digit-button.backspace-button:not([has-content]) { |
| 117 color: #000; |
| 118 opacity: 0.26; |
| 119 } |
| 120 |
| 121 .digit-button inner-text { |
| 122 color: var(--paper-blue-grey-700); |
| 123 display: flex; |
| 124 flex-direction: column; |
| 125 height: 52px; |
| 126 } |
| 127 |
| 128 #pinInput { |
| 129 background-color: white; |
| 130 border: 0; |
| 131 box-sizing: border-box; |
| 132 font-face: Roboto-Regular; |
| 133 font-size: 13px; |
| 134 height: 43px; |
| 135 left: 10px; |
| 136 opacity: var(--dark-secondary-opacity); |
| 137 outline: 0; |
| 138 position: relative; |
| 139 width: 127px; |
| 140 |
| 141 --paper-input-container-input: { |
| 142 caret-color: var(--paper-input-container-focus-color); |
| 143 } |
| 144 } |
| 145 |
| 146 #pinInput[has-content] { |
| 147 opacity: var(--dark-primary-opacity); |
| 148 } |
| 149 |
| 150 #pinInput[is-input-rtl] { |
| 151 direction: rtl; |
| 152 } |
| 153 |
| 154 #pinInput[type=number]::-webkit-inner-spin-button, |
| 155 #pinInput[type=number]::-webkit-outer-spin-button { |
| 156 -webkit-appearance: none; |
| 157 margin: 0; |
| 158 } |
| 159 |
| 160 .separator { |
| 161 border-bottom: var(--cr-separator-line); |
| 162 margin: 0 10px; |
| 163 position: relative; |
| 164 } |
| 165 |
| 166 /* Ensure that all children of paper-button do not consume events. This |
| 167 * simplifies the event handler code. */ |
| 168 paper-button * { |
| 169 pointer-events: none; |
| 170 } |
| 171 </style> |
| 172 |
| 173 <div id="root"> |
| 174 <div id="container-constrained-width"> |
| 175 <div class="row first-row"> |
| 176 <paper-input id="pinInput" type="password" no-label-float |
| 177 value="[[value]]" |
| 178 is-input-rtl$="[[isInputRtl_(value)]]" |
| 179 has-content$="[[hasInput_(value)]]" |
| 180 label="[[getInputPlaceholder_(enablePassword)]]" |
| 181 on-keydown="onInputKeyDown_" |
| 182 hidden="[[!showPinInput_]]"> |
| 183 </paper-input> |
| 184 </div> |
| 185 <div class="separator" hidden="[[showPinInput_]]"></div> |
| 186 <div class="row keyboard"> |
| 187 <paper-button class="digit-button" on-tap="onNumberTap_" value="1" |
| 188 noink> |
| 189 <inner-text>$i18n{pinKeyboard1}</inner-text> |
| 190 <paper-ripple> |
| 191 </paper-button> |
| 192 <paper-button class="digit-button" on-tap="onNumberTap_" value="2" |
| 193 noink> |
| 194 <inner-text>$i18n{pinKeyboard2}</inner-text> |
| 195 <paper-ripple> |
| 196 </paper-button> |
| 197 <paper-button class="digit-button" on-tap="onNumberTap_" value="3" |
| 198 noink> |
| 199 <inner-text>$i18n{pinKeyboard3}</inner-text> |
| 200 <paper-ripple> |
| 201 </paper-button> |
| 202 </div> |
| 203 <div class="row keyboard"> |
| 204 <paper-button class="digit-button" on-tap="onNumberTap_" value="4" |
| 205 noink> |
| 206 <inner-text>$i18n{pinKeyboard4}</inner-text> |
| 207 <paper-ripple> |
| 208 </paper-button> |
| 209 <paper-button class="digit-button" on-tap="onNumberTap_" value="5" |
| 210 noink> |
| 211 <inner-text>$i18n{pinKeyboard5}</inner-text> |
| 212 <paper-ripple> |
| 213 </paper-button> |
| 214 <paper-button class="digit-button" on-tap="onNumberTap_" value="6" |
| 215 noink> |
| 216 <inner-text>$i18n{pinKeyboard6}</inner-text> |
| 217 <paper-ripple> |
| 218 </paper-button> |
| 219 </div> |
| 220 <div class="row keyboard"> |
| 221 <paper-button class="digit-button" on-tap="onNumberTap_" value="7" |
| 222 noink> |
| 223 <inner-text>$i18n{pinKeyboard7}</inner-text> |
| 224 <paper-ripple> |
| 225 </paper-button> |
| 226 <paper-button class="digit-button" on-tap="onNumberTap_" value="8" |
| 227 noink> |
| 228 <inner-text>$i18n{pinKeyboard8}</inner-text> |
| 229 <paper-ripple> |
| 230 </paper-button> |
| 231 <paper-button class="digit-button" on-tap="onNumberTap_" value="9" |
| 232 noink> |
| 233 <inner-text>$i18n{pinKeyboard9}</inner-text> |
| 234 <paper-ripple> |
| 235 </paper-button> |
| 236 </div> |
| 237 <div class="row keyboard bottom-row"> |
| 238 <div class="digit-button"></div> |
| 239 <paper-button class="digit-button" on-tap="onNumberTap_" value="0" |
| 240 noink> |
| 241 <inner-text>$i18n{pinKeyboard0}</inner-text> |
| 242 <paper-ripple> |
| 243 </paper-button> |
| 244 <div class="backspace-button-container"> |
| 245 <paper-icon-button class="digit-button backspace-button" |
| 246 has-content$="[[hasInput_(value)]]" |
| 247 icon="pin-keyboard:backspace" |
| 248 on-pointerdown="onBackspacePointerDown_" |
| 249 on-pointerout="onBackspacePointerOut_" |
| 250 on-pointerup="onBackspacePointerUp_" |
| 251 aria-label="$i18n{pinKeyboardDeleteAccessibleName}" |
| 252 noink> |
| 253 </paper-icon-button> |
| 254 <paper-ripple> |
| 255 </div> |
| 256 </div> |
| 257 </div> |
| 258 </div> |
| 259 </template> |
| 260 <script src="pin_keyboard.js"></script> |
| 261 </dom-module> |
OLD | NEW |