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-icon-button/paper -icon-button.html"> |
10 <link rel="import" href="chrome://resources/polymer/v1_0/paper-input/paper-input .html"> | |
10 <link rel="import" href="chrome://resources/polymer/v1_0/paper-styles/color.html "> | 11 <link rel="import" href="chrome://resources/polymer/v1_0/paper-styles/color.html "> |
11 <link rel="import" href="chrome://resources/polymer/v1_0/iron-icon/iron-icon.htm l"> | 12 <link rel="import" href="chrome://resources/polymer/v1_0/iron-icon/iron-icon.htm l"> |
12 <link rel="import" href="chrome://resources/polymer/v1_0/iron-iconset-svg/iron-i conset-svg.html"> | 13 <link rel="import" href="chrome://resources/polymer/v1_0/iron-iconset-svg/iron-i conset-svg.html"> |
13 | 14 |
14 <iron-iconset-svg name="pin-keyboard" size="24"> | 15 <iron-iconset-svg name="pin-keyboard" size="24"> |
15 <svg> | 16 <svg> |
16 <defs> | 17 <defs> |
17 <!-- | 18 <!-- |
18 Inlined from Polymer's iron-icons to avoid importing everything. | 19 Inlined from Polymer's iron-icons to avoid importing everything. |
19 See http://goo.gl/Y1OdAq for instructions on adding additional icons. | 20 See http://goo.gl/Y1OdAq for instructions on adding additional icons. |
20 --> | 21 --> |
21 <g id="arrow-forward"> | 22 <g id="arrow-forward"> |
22 <path d="M12 4l-1.41 1.41L16.17 11H4v2h12.17l-5.58 5.59L12 20l8-8z"> | 23 <path d="M12 4l-1.41 1.41L16.17 11H4v2h12.17l-5.58 5.59L12 20l8-8z"> |
23 </path> | 24 </path> |
24 </g> | 25 </g> |
25 <g id="backspace"> | 26 <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 <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 </g> |
28 </defs> | 29 </defs> |
29 </svg> | 30 </svg> |
30 </iron-iconset-svg> | 31 </iron-iconset-svg> |
31 | 32 |
32 <dom-module id="pin-keyboard"> | 33 <dom-module id="pin-keyboard"> |
33 <template> | 34 <template> |
34 <style> | 35 <style> |
35 :host { | 36 :host { |
36 outline: none; | 37 outline: none; |
37 } | 38 } |
38 | 39 |
40 :host(:not([enable-submit-button])) #pinInput { | |
41 left: 0; | |
42 text-align: center; | |
43 width: 180px; | |
44 } | |
45 | |
39 #root { | 46 #root { |
40 direction: ltr; | 47 direction: ltr; |
41 display: flex; | 48 display: flex; |
42 } | 49 } |
43 | 50 |
44 .row { | 51 .row { |
45 display: flex; | 52 display: flex; |
46 } | 53 } |
47 | 54 |
48 .digit-button { | 55 .digit-button { |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
110 opacity: 0.26; | 117 opacity: 0.26; |
111 } | 118 } |
112 | 119 |
113 .digit-button inner-text { | 120 .digit-button inner-text { |
114 color: var(--paper-blue-grey-700); | 121 color: var(--paper-blue-grey-700); |
115 display: flex; | 122 display: flex; |
116 flex-direction: column; | 123 flex-direction: column; |
117 height: 52px; | 124 height: 52px; |
118 } | 125 } |
119 | 126 |
120 #pin-input { | 127 #pinInput { |
121 -webkit-text-security: disc; | |
122 background-color: white; | 128 background-color: white; |
123 border: 0; | 129 border: 0; |
124 box-sizing: border-box; | 130 box-sizing: border-box; |
125 font-face: Roboto-Regular; | 131 font-face: Roboto-Regular; |
126 font-size: 13px; | 132 font-size: 13px; |
127 height: 43px; | 133 height: 43px; |
128 left: 10px; | 134 left: 10px; |
129 opacity: var(--dark-secondary-opacity); | 135 opacity: var(--dark-secondary-opacity); |
130 outline: 0; | 136 outline: 0; |
131 position: relative; | 137 position: relative; |
132 width: 127px; | 138 width: 127px; |
139 | |
140 --paper-input-container-input: { | |
141 caret-color: var(--paper-input-container-focus-color); | |
142 } | |
133 } | 143 } |
134 | 144 |
135 #pin-input[has-content] { | 145 #pinInput[has-content] { |
136 opacity: var(--dark-primary-opacity); | 146 opacity: var(--dark-primary-opacity); |
137 } | 147 } |
138 | 148 |
139 #pin-input[is-input-rtl] { | 149 #pinInput[is-input-rtl] { |
140 direction: rtl; | 150 direction: rtl; |
141 } | 151 } |
142 | 152 |
143 :host(:not([enable-submit-button])) #pin-input { | 153 #pinInput[type=number]::-webkit-inner-spin-button, |
144 left: 0; | 154 #pinInput[type=number]::-webkit-outer-spin-button { |
145 text-align: center; | 155 -webkit-appearance: none; |
146 width: 180px; | 156 margin: 0; |
147 } | 157 } |
148 | 158 |
149 hr { | 159 .separator { |
150 border: 0; | |
151 border-bottom: 1px solid #000; | 160 border-bottom: 1px solid #000; |
stevenjb
2017/05/08 19:30:30
@apply(--cr-separator-line) ? Opacity is .06 inste
sammiequon
2017/05/08 21:06:38
Done.
| |
152 left: 10px; | 161 left: 10px; |
153 margin: 0; | |
154 opacity: 0.14; | 162 opacity: 0.14; |
155 position: relative; | 163 position: relative; |
156 width: 160px; | 164 width: 160px; |
stevenjb
2017/05/08 19:30:30
Using a fixed width is less than ideal, but is may
sammiequon
2017/05/08 21:06:38
I think the dialog is fixed at 180px so this works
| |
157 } | 165 } |
158 | 166 |
159 #pin-input[type=number]::-webkit-inner-spin-button, | |
160 #pin-input[type=number]::-webkit-outer-spin-button { | |
161 -webkit-appearance: none; | |
162 margin: 0; | |
163 } | |
164 | |
165 /* Ensure that all children of paper-button do not consume events. This | 167 /* Ensure that all children of paper-button do not consume events. This |
166 * simplifies the event handler code. */ | 168 * simplifies the event handler code. */ |
167 paper-button * { | 169 paper-button * { |
168 pointer-events: none; | 170 pointer-events: none; |
169 } | 171 } |
170 </style> | 172 </style> |
171 | 173 |
172 <div id="root"> | 174 <div id="root"> |
173 <div id="container-constrained-width"> | 175 <div id="container-constrained-width"> |
174 <div class="row first-row"> | 176 <div class="row first-row"> |
175 <input id="pin-input" type="password" | 177 <paper-input id="pinInput" type="password" no-label-float |
176 is-input-rtl$="[[isInputRtl_(value)]]" | 178 value="{{value}}" |
sammiequon
2017/05/08 19:16:49
Added this because previously, using the clear but
stevenjb
2017/05/08 19:30:30
Does [[value]] work? I'd be worried that the two-w
sammiequon
2017/05/08 21:06:38
Works. Done.
| |
177 has-content$="[[hasInput_(value)]]" | 179 is-input-rtl$="[[isInputRtl_(value)]]" |
178 placeholder="[[getInputPlaceholder_(enablePassword)]]" | 180 has-content$="[[hasInput_(value)]]" |
179 on-keydown="onInputKeyDown_"> | 181 label="[[getInputPlaceholder_(enablePassword)]]" |
180 </input> | 182 on-keydown="onInputKeyDown_" |
183 hidden="[[!showPinInput_]]"> | |
184 </paper-input> | |
181 </div> | 185 </div> |
182 <hr> | 186 <div class="separator" hidden="[[showPinInput_]]"></div> |
183 <div class="row keyboard"> | 187 <div class="row keyboard"> |
184 <paper-button class="digit-button" on-tap="onNumberTap_" value="1" | 188 <paper-button class="digit-button" on-tap="onNumberTap_" value="1" |
185 noink> | 189 noink> |
186 <inner-text>$i18n{pinKeyboard1}</inner-text> | 190 <inner-text>$i18n{pinKeyboard1}</inner-text> |
187 <paper-ripple> | 191 <paper-ripple> |
188 </paper-button> | 192 </paper-button> |
189 <paper-button class="digit-button" on-tap="onNumberTap_" value="2" | 193 <paper-button class="digit-button" on-tap="onNumberTap_" value="2" |
190 noink> | 194 noink> |
191 <inner-text>$i18n{pinKeyboard2}</inner-text> | 195 <inner-text>$i18n{pinKeyboard2}</inner-text> |
192 <paper-ripple> | 196 <paper-ripple> |
193 </paper-button> | 197 </paper-button> |
194 <paper-button class="digit-button" on-tap="onNumberTap_" value="3" | 198 <paper-button class="digit-button" on-tap="onNumberTap_" value="3" |
195 noink> | 199 noink> |
196 <inner-text>$i18n{pinKeyboard3}</inner-text> | 200 <inner-text>$i18n{pinKeyboard3}</inner-text> |
197 <paper-ripple> | 201 <paper-ripple> |
198 </paper-button> | 202 </paper-button> |
199 </div> | 203 </div> |
200 <div class="row keyboard"> | 204 <div class="row keyboard"> |
201 <paper-button class="digit-button" on-tap="onNumberTap_" value="4" | 205 <paper-button class="digit-button" on-tap="onNumberTap_" value="4" |
202 noink> | 206 noink> |
203 <inner-text>$i18n{pinKeyboard4}</inner-text> | 207 <inner-text>$i18n{pinKeyboard4}</inner-text> |
204 <paper-ripple> | 208 <paper-ripple> |
205 </paper-button> | 209 </paper-button> |
206 <paper-button class="digit-button" on-tap="onNumberTap_" value="5" | 210 <paper-button class="digit-button" on-tap="onNumberTap_" value="5" |
207 noink> | 211 noink> |
208 <inner-text>$i18n{pinKeyboard5}</inner-text> | 212 <inner-text>$i18n{pinKeyboard5}</inner-text> |
209 <paper-ripple> | 213 <paper-ripple> |
210 </paper-button> | 214 </paper-button> |
211 <paper-button class="digit-button" on-tap="onNumberTap_" value="6" | 215 <paper-button class="digit-button" on-tap="onNumberTap_" value="6" |
212 noink> | 216 noink> |
213 <inner-text>$i18n{pinKeyboard6}</inner-text> | 217 <inner-text>$i18n{pinKeyboard6}</inner-text> |
214 <paper-ripple> | 218 <paper-ripple> |
215 </paper-button> | 219 </paper-button> |
216 </div> | 220 </div> |
217 <div class="row keyboard"> | 221 <div class="row keyboard"> |
218 <paper-button class="digit-button" on-tap="onNumberTap_" value="7" | 222 <paper-button class="digit-button" on-tap="onNumberTap_" value="7" |
219 noink> | 223 noink> |
220 <inner-text>$i18n{pinKeyboard7}</inner-text> | 224 <inner-text>$i18n{pinKeyboard7}</inner-text> |
221 <paper-ripple> | 225 <paper-ripple> |
222 </paper-button> | 226 </paper-button> |
223 <paper-button class="digit-button" on-tap="onNumberTap_" value="8" | 227 <paper-button class="digit-button" on-tap="onNumberTap_" value="8" |
224 noink> | 228 noink> |
225 <inner-text>$i18n{pinKeyboard8}</inner-text> | 229 <inner-text>$i18n{pinKeyboard8}</inner-text> |
226 <paper-ripple> | 230 <paper-ripple> |
227 </paper-button> | 231 </paper-button> |
228 <paper-button class="digit-button" on-tap="onNumberTap_" value="9" | 232 <paper-button class="digit-button" on-tap="onNumberTap_" value="9" |
229 noink> | 233 noink> |
230 <inner-text>$i18n{pinKeyboard9}</inner-text> | 234 <inner-text>$i18n{pinKeyboard9}</inner-text> |
231 <paper-ripple> | 235 <paper-ripple> |
232 </paper-button> | 236 </paper-button> |
233 </div> | 237 </div> |
234 <div class="row keyboard bottom-row"> | 238 <div class="row keyboard bottom-row"> |
235 <div class="digit-button"></div> | 239 <div class="digit-button"></div> |
236 <paper-button class="digit-button" on-tap="onNumberTap_" value="0" | 240 <paper-button class="digit-button" on-tap="onNumberTap_" value="0" |
237 noink> | 241 noink> |
238 <inner-text>$i18n{pinKeyboard0}</inner-text> | 242 <inner-text>$i18n{pinKeyboard0}</inner-text> |
239 <paper-ripple> | 243 <paper-ripple> |
240 </paper-button> | 244 </paper-button> |
241 <div class="backspace-button-container"> | 245 <div class="backspace-button-container"> |
242 <paper-icon-button class="digit-button backspace-button" | 246 <paper-icon-button class="digit-button backspace-button" |
243 has-content$="[[hasInput_(value)]]" | 247 has-content$="[[hasInput_(value)]]" |
244 icon="pin-keyboard:backspace" | 248 icon="pin-keyboard:backspace" |
245 on-pointerdown="onBackspacePointerDown_" | 249 on-pointerdown="onBackspacePointerDown_" |
246 on-pointerout="onBackspacePointerOut_" | 250 on-pointerout="onBackspacePointerOut_" |
247 on-pointerup="onBackspacePointerUp_" | 251 on-pointerup="onBackspacePointerUp_" |
248 aria-label="$i18n{pinKeyboardDeleteAccessibleName }" | 252 aria-label="$i18n{pinKeyboardDeleteAccessibleName}" |
249 noink> | 253 noink> |
250 </paper-icon-button> | 254 </paper-icon-button> |
251 <paper-ripple> | 255 <paper-ripple> |
252 </div> | 256 </div> |
253 </div> | 257 </div> |
254 </div> | 258 </div> |
255 </div> | 259 </div> |
256 </template> | 260 </template> |
257 <script src="pin_keyboard.js"></script> | 261 <script src="pin_keyboard.js"></script> |
258 </dom-module> | 262 </dom-module> |
OLD | NEW |