| 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/polymer/v1_0/paper-button/paper-butt
on.html"> | 5 <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-icon-button/paper
-icon-button.html"> | 6 <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-styles/paper-styl
es.html"> | 7 <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/iron-icons/iron-icons.h
tml"> | 8 <link rel="import" href="chrome://resources/polymer/v1_0/iron-icons/iron-icons.h
tml"> |
| 9 | 9 |
| 10 <dom-module id="pin-keyboard"> | 10 <dom-module id="pin-keyboard"> |
| 11 <template> | 11 <template> |
| 12 <style> | 12 <style> |
| 13 #root { | 13 #root { |
| 14 display: flex; | 14 display: flex; |
| 15 } | 15 } |
| 16 | 16 |
| 17 /* TODO(jdufault): Remove this CSS once we inline the PIN element with the | |
| 18 * user-pod. */ | |
| 19 #container-constrained-width { | |
| 20 -webkit-tap-highlight-color: transparent; | |
| 21 background: white; | |
| 22 border-radius: 2px; | |
| 23 box-shadow: 0 4px 23px 5px rgba(0, 0, 0, 0.2), | |
| 24 0 2px 6px rgba(0, 0, 0, 0.15), | |
| 25 0 3px 0 rgba(0, 0, 0, 0.08); | |
| 26 cursor: pointer; | |
| 27 flex-direction: column; | |
| 28 outline: none; | |
| 29 } | |
| 30 | |
| 31 .row { | 17 .row { |
| 32 display: flex; | 18 display: flex; |
| 33 } | 19 } |
| 34 | 20 |
| 35 .row.horizontal-center { | 21 .row.horizontal-center { |
| 36 justify-content: center; | 22 justify-content: center; |
| 37 } | 23 } |
| 38 | 24 |
| 39 .digit-button { | 25 .digit-button { |
| 40 align-items: center; | 26 align-items: center; |
| 41 background: none; | 27 background: none; |
| 42 border-radius: 50px; | 28 border-radius: 50px; |
| 29 box-sizing: border-box; |
| 43 display: flex; | 30 display: flex; |
| 31 flex-direction: column; |
| 44 font-size: 30px; | 32 font-size: 30px; |
| 33 height: 70px; |
| 45 justify-content: center; | 34 justify-content: center; |
| 46 margin: 5px; | 35 margin: 0; |
| 47 min-width: 94px; | 36 min-height: 70px; |
| 48 width: 94px; | 37 min-width: 85px; |
| 38 padding: 15px 20px; |
| 39 width: 85px; |
| 40 } |
| 41 |
| 42 .digit-button.clear-button { |
| 43 display: block; |
| 44 } |
| 45 |
| 46 .digit-button .icon-container { |
| 47 background: var(--paper-grey-500); |
| 48 border-radius: 100px; |
| 49 height: 24px; |
| 50 margin: auto; |
| 51 width: 24px; |
| 52 } |
| 53 |
| 54 .digit-button .icon-container .icon { |
| 55 color: white; |
| 56 display: block; |
| 57 height: 16px; |
| 58 left: 4px; |
| 59 top: 4px; |
| 60 width: 16px; |
| 61 } |
| 62 |
| 63 .digit-button .icon-subheading { |
| 64 color: var(--paper-grey-500); |
| 65 font-size: 10px; |
| 66 padding: 10px; |
| 67 text-transform: capitalize; |
| 49 } | 68 } |
| 50 | 69 |
| 51 .digit-button inner-text { | 70 .digit-button inner-text { |
| 52 display: flex; | 71 display: flex; |
| 53 flex-direction: column; | 72 flex-direction: column; |
| 54 height: 52px; | 73 height: 52px; |
| 55 } | 74 } |
| 56 | 75 |
| 57 .digit-button inner-text subhead { | 76 .first-row { |
| 58 color: var(--paper-grey-500); | 77 height: 54px; |
| 59 font-size: 16px; | 78 min-height: 54px; |
| 60 } | |
| 61 | |
| 62 .digit-button .submit-button { | |
| 63 background: var(--paper-blue-a400); | |
| 64 color: white; | |
| 65 font-size: 20px; | |
| 66 height: 60px; | |
| 67 min-width: 0; | |
| 68 width: 60px; | |
| 69 } | 79 } |
| 70 | 80 |
| 71 #pin-input { | 81 #pin-input { |
| 72 -webkit-text-security: disc; | 82 -webkit-text-security: disc; |
| 73 border-bottom-color: lightgray; | 83 border: 0; |
| 74 border-left: none; | |
| 75 border-right: none; | |
| 76 border-top: none; | |
| 77 font-size: 20px; | 84 font-size: 20px; |
| 78 height: 30px; | 85 height: 54px; |
| 79 margin-top: 10px; | |
| 80 text-align: center; | 86 text-align: center; |
| 81 width: 95%; | 87 width: 171px; |
| 82 } | 88 } |
| 83 | 89 |
| 84 #pin-input[type=number]::-webkit-inner-spin-button, | 90 #pin-input[type=number]::-webkit-inner-spin-button, |
| 85 #pin-input[type=number]::-webkit-outer-spin-button { | 91 #pin-input[type=number]::-webkit-outer-spin-button { |
| 86 -webkit-appearance: none; | 92 -webkit-appearance: none; |
| 87 margin: 0; | 93 margin: 0; |
| 88 } | 94 } |
| 89 | 95 |
| 90 /* Ensure that all children of paper-button do not consume events. This | 96 /* Ensure that all children of paper-button do not consume events. This |
| 91 * simplifies the event handler code. */ | 97 * simplifies the event handler code. */ |
| 92 paper-button * { | 98 paper-button * { |
| 93 pointer-events: none; | 99 pointer-events: none; |
| 94 } | 100 } |
| 95 </style> | 101 </style> |
| 96 | 102 |
| 97 <div id="root"> | 103 <div id="root"> |
| 98 <div id="container-constrained-width"> | 104 <div id="container-constrained-width"> |
| 99 <div class="row horizontal-center"> | 105 <div class="row horizontal-center"> |
| 100 <input id="pin-input" type="number" placeholder="Enter PIN" | 106 <input id="pin-input" type="number" placeholder="Enter PIN" |
| 101 value="{{value::input}}" | 107 value="{{value::input}}" |
| 102 on-keydown="onInputKeyDown_"></input> | 108 on-keydown="onInputKeyDown_"></input> |
| 109 <div class="digit-button first-row"> |
| 110 <paper-button class="digit-button submit-button" |
| 111 on-tap="firePinSubmitEvent_"> |
| 112 <div class="icon-container"> |
| 113 <iron-icon class="icon" icon="icons:forward"><iron-icon> |
| 114 </div> |
| 115 </paper-button> |
| 116 </div> |
| 103 </div> | 117 </div> |
| 104 | 118 |
| 105 <div class="row keyboard"> | 119 <div class="row keyboard"> |
| 106 <paper-button class="digit-button" on-tap="onNumberTap_" value="1"> | 120 <paper-button class="digit-button" on-tap="onNumberTap_" value="1"> |
| 107 <inner-text>1</inner-text> | 121 <inner-text>1</inner-text> |
| 108 </paper-button> | 122 </paper-button> |
| 109 <paper-button class="digit-button" on-tap="onNumberTap_" value="2"> | 123 <paper-button class="digit-button" on-tap="onNumberTap_" value="2"> |
| 110 <inner-text>2<subhead>ABC</subhead></inner-text> | 124 <inner-text>2</inner-text> |
| 111 </paper-button> | 125 </paper-button> |
| 112 <paper-button class="digit-button" on-tap="onNumberTap_" value="3"> | 126 <paper-button class="digit-button" on-tap="onNumberTap_" value="3"> |
| 113 <inner-text>3<subhead>DEF</subhead></inner-text> | 127 <inner-text>3</inner-text> |
| 114 </paper-button> | 128 </paper-button> |
| 115 </div> | 129 </div> |
| 116 <div class="row keyboard"> | 130 <div class="row keyboard"> |
| 117 <paper-button class="digit-button" on-tap="onNumberTap_" value="4"> | 131 <paper-button class="digit-button" on-tap="onNumberTap_" value="4"> |
| 118 <inner-text>4<subhead>GHI</subhead></inner-text> | 132 <inner-text>4</inner-text> |
| 119 </paper-button> | 133 </paper-button> |
| 120 <paper-button class="digit-button" on-tap="onNumberTap_" value="5"> | 134 <paper-button class="digit-button" on-tap="onNumberTap_" value="5"> |
| 121 <inner-text>5<subhead>JKL</subhead></inner-text> | 135 <inner-text>5</inner-text> |
| 122 </paper-button> | 136 </paper-button> |
| 123 <paper-button class="digit-button" on-tap="onNumberTap_" value="6"> | 137 <paper-button class="digit-button" on-tap="onNumberTap_" value="6"> |
| 124 <inner-text>6<subhead>MNO</subhead></inner-text> | 138 <inner-text>6</inner-text> |
| 125 </paper-button> | 139 </paper-button> |
| 126 </div> | 140 </div> |
| 127 <div class="row keyboard"> | 141 <div class="row keyboard"> |
| 128 <paper-button class="digit-button" on-tap="onNumberTap_" value="7"> | 142 <paper-button class="digit-button" on-tap="onNumberTap_" value="7"> |
| 129 <inner-text>7<subhead>PQRS</subhead></inner-text> | 143 <inner-text>7</inner-text> |
| 130 </paper-button> | 144 </paper-button> |
| 131 <paper-button class="digit-button" on-tap="onNumberTap_" value="8"> | 145 <paper-button class="digit-button" on-tap="onNumberTap_" value="8"> |
| 132 <inner-text>8<subhead>TUV</subhead></inner-text> | 146 <inner-text>8</inner-text> |
| 133 </paper-button> | 147 </paper-button> |
| 134 <paper-button class="digit-button" on-tap="onNumberTap_" value="9"> | 148 <paper-button class="digit-button" on-tap="onNumberTap_" value="9"> |
| 135 <inner-text>9<subhead>WXYZ</subhead></inner-text> | 149 <inner-text>9</inner-text> |
| 136 </paper-button> | 150 </paper-button> |
| 137 </div> | 151 </div> |
| 138 <div class="row keyboard"> | 152 <div class="row keyboard"> |
| 139 <div class="digit-button"></div> | 153 <div class="digit-button"></div> |
| 140 <paper-button class="digit-button" on-tap="onNumberTap_" value="0"> | 154 <paper-button class="digit-button" on-tap="onNumberTap_" value="0"> |
| 141 <inner-text>0</inner-text> | 155 <inner-text>0</inner-text> |
| 142 </paper-button> | 156 </paper-button> |
| 143 <div class="digit-button"> | 157 <paper-button class="digit-button clear-button" on-tap="onPinClear_"> |
| 144 <paper-icon-button class="digit-button submit-button" | 158 <div class="icon-container"> |
| 145 icon="icons:check" on-tap="firePinSubmitEvent_"> | 159 <iron-icon class="icon" icon="icons:clear"><iron-icon> |
| 146 </paper-icon-button> | 160 </div> |
| 147 </div> | 161 <inner-text class="icon-subheading">Clear</inner-text> |
| 162 </paper-button> |
| 148 </div> | 163 </div> |
| 149 </div> | 164 </div> |
| 150 </div> | 165 </div> |
| 151 </template> | 166 </template> |
| 152 <script src="pin_keyboard.js"></script> | 167 <script src="pin_keyboard.js"></script> |
| 153 </dom-module> | 168 </dom-module> |
| OLD | NEW |