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; | |
56 } | 80 } |
57 | 81 |
58 .digit-button.submit-button.submit-button-hidden { | 82 .digit-button.submit-button.submit-button-hidden { |
59 display: none; | 83 display: none; |
60 } | 84 } |
61 | 85 |
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 { | 86 .digit-button inner-text { |
95 color: var(--paper-blue-grey-700); | 87 color: var(--paper-blue-grey-700); |
96 display: flex; | 88 display: flex; |
97 flex-direction: column; | 89 flex-direction: column; |
98 height: 52px; | 90 height: 52px; |
99 } | 91 } |
100 | 92 |
101 .first-row { | |
102 height: 64px; | |
103 min-height: 64px; | |
104 padding: 28px 15px 12px 15px; | |
105 } | |
106 | |
107 #pin-input { | 93 #pin-input { |
108 -webkit-text-security: disc; | 94 -webkit-text-security: disc; |
109 background-color: white; | 95 background-color: white; |
110 border: 0; | 96 border: 0; |
111 box-sizing: border-box; | 97 box-sizing: border-box; |
112 font-size: 18px; | 98 font-face: Roboto-Regular; |
113 height: 64px; | 99 font-size: 13px; |
114 left: 20px; | 100 height: 43px; |
101 left: 10px; | |
102 opacity: var(--dark-secondary-opacity); | |
115 outline: 0; | 103 outline: 0; |
116 padding: 28px 3px 12px 3px; | |
117 position: relative; | 104 position: relative; |
105 text-color: #000; | |
106 width: 127px; | |
107 } | |
108 | |
109 #pin-input.ready-background { | |
jdufault
2016/08/08 21:12:42
What about 'has-content' instead of 'ready-backgro
sammiequon
2016/08/08 23:36:12
Done.
| |
110 opacity: var(--dark-primary-opacity); | |
111 } | |
112 | |
113 #pin-input.submit-button-hidden { | |
114 left: 0; | |
115 text-align: center; | |
118 width: 180px; | 116 width: 180px; |
119 } | 117 } |
120 | 118 |
121 #pin-input.submit-button-hidden { | 119 hr { |
122 border-bottom: 2px; | 120 border: 0; |
123 border-bottom-style: solid; | 121 border-bottom: 1px solid #000; |
124 text-align: center; | 122 left: 10px; |
125 width: 230px; | 123 margin: 0; |
124 opacity: 0.14; | |
125 position: relative; | |
126 width: 160px; | |
126 } | 127 } |
127 | 128 |
128 #pin-input[type=number]::-webkit-inner-spin-button, | 129 #pin-input[type=number]::-webkit-inner-spin-button, |
129 #pin-input[type=number]::-webkit-outer-spin-button { | 130 #pin-input[type=number]::-webkit-outer-spin-button { |
130 -webkit-appearance: none; | 131 -webkit-appearance: none; |
131 margin: 0; | 132 margin: 0; |
132 } | 133 } |
133 | 134 |
134 /* Ensure that all children of paper-button do not consume events. This | 135 /* Ensure that all children of paper-button do not consume events. This |
135 * simplifies the event handler code. */ | 136 * simplifies the event handler code. */ |
136 paper-button * { | 137 paper-button * { |
137 pointer-events: none; | 138 pointer-events: none; |
138 } | 139 } |
139 </style> | 140 </style> |
140 | 141 |
141 <div id="root"> | 142 <div id="root"> |
142 <div id="container-constrained-width"> | 143 <div id="container-constrained-width"> |
143 <div class="row horizontal-center"> | 144 <div class="row"> |
144 <input id="pin-input" type="[[getInputType_(enablePassword)]]" | 145 <input id="pin-input" type="[[getInputType_(enablePassword)]]" |
145 class$="[[getInputClass_(value)]] | 146 class$="[[getInputClass_(value)]] |
146 [[getSubmitHiddenClass_(enableSubmitButton)]]" | 147 [[getSubmitClass_(enableSubmitButton)]] |
148 [[getPasswordReadyClass_(value)]]" | |
147 placeholder="[[getInputPlaceholder_(enablePassword)]]" | 149 placeholder="[[getInputPlaceholder_(enablePassword)]]" |
148 value="{{value::input}}" | 150 value="{{value::input}}" |
149 on-keydown="onInputKeyDown_"></input> | 151 on-keydown="onInputKeyDown_"></input> |
150 <paper-button class$="digit-button first-row submit-button | 152 <paper-icon-button icon="icons:arrow-forward" |
151 [[getSubmitHiddenClass_(enableSubmitButton)]]" | 153 class$="digit-button submit-button |
152 on-tap="firePinSubmitEvent_"> | 154 [[getSubmitClass_(enableSubmitButton)]]" |
153 <div class$="icon-container [[getSubmitClass_(value)]]"> | 155 disabled="[[hasNoInput_(value)]]" |
154 <iron-icon class="icon" icon="icons:forward"><iron-icon> | 156 on-tap="firePinSubmitEvent_"> |
155 </div> | 157 </paper-icon-button> |
156 </paper-button> | |
157 </div> | 158 </div> |
158 | 159 <hr> |
jdufault
2016/08/08 21:12:42
<hr />
sammiequon
2016/08/08 23:36:11
Presumbit says do not close single tags.
| |
159 <div class="row keyboard"> | 160 <div class="row keyboard top-row"> |
160 <paper-button class="digit-button" on-tap="onNumberTap_" value="1"> | 161 <paper-button class="digit-button" on-tap="onNumberTap_" value="1"> |
161 <inner-text>$i18n{pinKeyboard1}</inner-text> | 162 <inner-text>$i18n{pinKeyboard1}</inner-text> |
162 </paper-button> | 163 </paper-button> |
163 <paper-button class="digit-button center-button" on-tap="onNumberTap_" | 164 <paper-button class="digit-button" on-tap="onNumberTap_" value="2"> |
164 value="2"> | |
165 <inner-text>$i18n{pinKeyboard2}</inner-text> | 165 <inner-text>$i18n{pinKeyboard2}</inner-text> |
166 </paper-button> | 166 </paper-button> |
167 <paper-button class="digit-button" on-tap="onNumberTap_" value="3"> | 167 <paper-button class="digit-button" on-tap="onNumberTap_" value="3"> |
168 <inner-text>$i18n{pinKeyboard3}</inner-text> | 168 <inner-text>$i18n{pinKeyboard3}</inner-text> |
169 </paper-button> | 169 </paper-button> |
170 </div> | 170 </div> |
171 <div class="row keyboard"> | 171 <div class="row keyboard"> |
172 <paper-button class="digit-button" on-tap="onNumberTap_" value="4"> | 172 <paper-button class="digit-button" on-tap="onNumberTap_" value="4"> |
173 <inner-text>$i18n{pinKeyboard4}</inner-text> | 173 <inner-text>$i18n{pinKeyboard4}</inner-text> |
174 </paper-button> | 174 </paper-button> |
175 <paper-button class="digit-button center-button" on-tap="onNumberTap_" | 175 <paper-button class="digit-button" on-tap="onNumberTap_" value="5"> |
176 value="5"> | |
177 <inner-text>$i18n{pinKeyboard5}</inner-text> | 176 <inner-text>$i18n{pinKeyboard5}</inner-text> |
178 </paper-button> | 177 </paper-button> |
179 <paper-button class="digit-button" on-tap="onNumberTap_" value="6"> | 178 <paper-button class="digit-button" on-tap="onNumberTap_" value="6"> |
180 <inner-text>$i18n{pinKeyboard6}</inner-text> | 179 <inner-text>$i18n{pinKeyboard6}</inner-text> |
181 </paper-button> | 180 </paper-button> |
182 </div> | 181 </div> |
183 <div class="row keyboard"> | 182 <div class="row keyboard"> |
184 <paper-button class="digit-button" on-tap="onNumberTap_" value="7"> | 183 <paper-button class="digit-button" on-tap="onNumberTap_" value="7"> |
185 <inner-text>$i18n{pinKeyboard7}</inner-text> | 184 <inner-text>$i18n{pinKeyboard7}</inner-text> |
186 </paper-button> | 185 </paper-button> |
187 <paper-button class="digit-button center-button" on-tap="onNumberTap_" | 186 <paper-button class="digit-button" on-tap="onNumberTap_" value="8"> |
188 value="8"> | |
189 <inner-text>$i18n{pinKeyboard8}</inner-text> | 187 <inner-text>$i18n{pinKeyboard8}</inner-text> |
190 </paper-button> | 188 </paper-button> |
191 <paper-button class="digit-button" on-tap="onNumberTap_" value="9"> | 189 <paper-button class="digit-button" on-tap="onNumberTap_" value="9"> |
192 <inner-text>$i18n{pinKeyboard9}</inner-text> | 190 <inner-text>$i18n{pinKeyboard9}</inner-text> |
193 </paper-button> | 191 </paper-button> |
194 </div> | 192 </div> |
195 <div class="row keyboard"> | 193 <div class="row keyboard bottom-row"> |
196 <div class="digit-button"></div> | 194 <div class="digit-button"></div> |
197 <paper-button class="digit-button center-button" on-tap="onNumberTap_" | 195 <paper-button class="digit-button" on-tap="onNumberTap_" value="0"> |
198 value="0"> | |
199 <inner-text>$i18n{pinKeyboard0}</inner-text> | 196 <inner-text>$i18n{pinKeyboard0}</inner-text> |
200 </paper-button> | 197 </paper-button> |
201 <paper-button class="digit-button clear-button" on-tap="onPinClear_"> | 198 <paper-icon-button class="digit-button backspace-button" |
202 <div class="icon-container"> | 199 disabled="[[hasNoInput_(value)]]" |
jdufault
2016/08/08 21:12:42
!hasInput_(value)
Generally prefer not having the
sammiequon
2016/08/08 23:36:11
Done.
| |
203 <iron-icon class="icon" icon="icons:clear"><iron-icon> | 200 on-tap="onPinClear_" icon="icons:backspace"> |
204 </div> | |
205 <inner-text class="icon-subheading"> | |
206 $i18n{pinKeyboardClear} | |
207 </inner-text> | |
208 </paper-button> | 201 </paper-button> |
209 </div> | 202 </div> |
210 </div> | 203 </div> |
211 </div> | 204 </div> |
212 </template> | 205 </template> |
213 <script src="pin_keyboard.js"></script> | 206 <script src="pin_keyboard.js"></script> |
214 </dom-module> | 207 </dom-module> |
OLD | NEW |