| OLD | NEW |
| (Empty) | |
| 1 <!-- |
| 2 @license |
| 3 Copyright (c) 2015 The Polymer Project Authors. All rights reserved. |
| 4 This code may only be used under the BSD style license found at http://polymer.g
ithub.io/LICENSE.txt |
| 5 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt |
| 6 The complete set of contributors may be found at http://polymer.github.io/CONTRI
BUTORS.txt |
| 7 Code distributed by Google as part of the polymer project is also |
| 8 subject to an additional IP rights grant found at http://polymer.github.io/PATEN
TS.txt |
| 9 --> |
| 10 <link rel="import" href="../../polymer/polymer.html"> |
| 11 <link rel="import" href="../../iron-input/iron-input.html"> |
| 12 <link rel="import" href="ssn-validator.html"> |
| 13 |
| 14 <dom-module id="ssn-input"> |
| 15 |
| 16 <style> |
| 17 |
| 18 :host { |
| 19 display: inline-block; |
| 20 } |
| 21 |
| 22 input[is="iron-input"] { |
| 23 font: inherit; |
| 24 outline: none; |
| 25 box-shadow: none; |
| 26 border: none; |
| 27 width: auto; |
| 28 text-align: center; |
| 29 } |
| 30 |
| 31 </style> |
| 32 |
| 33 <template> |
| 34 |
| 35 <ssn-validator></ssn-validator> |
| 36 |
| 37 <input is="iron-input" maxlength="3" bind-value="{{_ssn1}}" size="3" aria-la
bel="First 3 digits of social security number"> |
| 38 - |
| 39 <input is="iron-input" maxlength="2" bind-value="{{_ssn2}}" size="2" aria-la
bel="Middle 2 digits of social security number"> |
| 40 - |
| 41 <input is="iron-input" maxlength="4" bind-value="{{_ssn3}}" size="4" aria-la
bel="Last 4 digits of social security number"> |
| 42 |
| 43 </template> |
| 44 |
| 45 </dom-module> |
| 46 |
| 47 <script> |
| 48 (function() { |
| 49 |
| 50 Polymer({ |
| 51 |
| 52 is: 'ssn-input', |
| 53 |
| 54 behaviors: [ |
| 55 Polymer.IronValidatableBehavior |
| 56 ], |
| 57 |
| 58 properties: { |
| 59 |
| 60 value: { |
| 61 notify: true, |
| 62 type: String |
| 63 }, |
| 64 |
| 65 _ssn1: { |
| 66 type: String |
| 67 }, |
| 68 |
| 69 _ssn2: { |
| 70 type: String |
| 71 }, |
| 72 |
| 73 _ssn3: { |
| 74 type: String |
| 75 }, |
| 76 |
| 77 validator: { |
| 78 type: String, |
| 79 value: 'ssn-validator' |
| 80 } |
| 81 |
| 82 }, |
| 83 |
| 84 observers: [ |
| 85 '_computeValue(_ssn1,_ssn2,_ssn3)' |
| 86 ], |
| 87 |
| 88 _computeValue: function(ssn1, ssn2, ssn3) { |
| 89 this.value = ssn1.trim() + '-' + ssn2.trim() + '-' + ssn3.trim(); |
| 90 } |
| 91 |
| 92 }) |
| 93 })(); |
| 94 </script> |
| OLD | NEW |