jellyfin-web/dashboard-ui/bower_components/paper-input/demo/ssn-input.html

97 lines
2.3 KiB
HTML
Raw Normal View History

2015-06-26 20:27:38 -07:00
<!--
@license
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
-->
<link rel="import" href="../../polymer/polymer.html">
<link rel="import" href="../../iron-input/iron-input.html">
2016-03-10 13:07:23 -07:00
<link rel="import" href="../../iron-flex-layout/iron-flex-layout.html">
2015-06-26 20:27:38 -07:00
<link rel="import" href="ssn-validator.html">
<dom-module id="ssn-input">
2015-09-03 21:33:31 -07:00
<template>
2015-06-26 20:27:38 -07:00
2015-09-03 21:33:31 -07:00
<style>
:host {
display: inline-block;
}
2015-06-26 20:27:38 -07:00
2016-06-22 22:25:16 -07:00
:host([hidden]) {
display: none !important;
}
2015-09-03 21:33:31 -07:00
input[is="iron-input"] {
font: inherit;
outline: none;
box-shadow: none;
border: none;
width: auto;
text-align: center;
}
2016-03-10 13:07:23 -07:00
.container {
@apply(--layout-horizontal);
}
2015-09-03 21:33:31 -07:00
</style>
2015-06-26 20:27:38 -07:00
<ssn-validator></ssn-validator>
2016-03-10 13:07:23 -07:00
<div class="container">
<input is="iron-input" maxlength="3" bind-value="{{_ssn1}}" size="3" aria-label="First 3 digits of social security number">
-
<input is="iron-input" maxlength="2" bind-value="{{_ssn2}}" size="2" aria-label="Middle 2 digits of social security number">
-
<input is="iron-input" maxlength="4" bind-value="{{_ssn3}}" size="4" aria-label="Last 4 digits of social security number">
</div>
2015-06-26 20:27:38 -07:00
</template>
</dom-module>
<script>
Polymer({
is: 'ssn-input',
behaviors: [
Polymer.IronValidatableBehavior
],
properties: {
value: {
notify: true,
type: String
},
_ssn1: {
type: String
},
_ssn2: {
type: String
},
_ssn3: {
type: String
},
validator: {
type: String,
value: 'ssn-validator'
}
},
observers: [
'_computeValue(_ssn1,_ssn2,_ssn3)'
],
_computeValue: function(ssn1, ssn2, ssn3) {
this.value = ssn1.trim() + '-' + ssn2.trim() + '-' + ssn3.trim();
}
2015-09-03 21:33:31 -07:00
});
2015-06-26 20:27:38 -07:00
</script>