-
Notifications
You must be signed in to change notification settings - Fork 159
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #19 from PolymerElements/add-behavior
add paper-input-behavior
- Loading branch information
Showing
2 changed files
with
127 additions
and
99 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
<!-- | ||
@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"> | ||
|
||
<!-- | ||
Use `Polymer.PaperInputBehavior` to implement your own `<paper-input>`. | ||
--> | ||
|
||
<script> | ||
|
||
Polymer.PaperInputBehavior = { | ||
|
||
properties: { | ||
|
||
/** | ||
* The label for this input. | ||
*/ | ||
label: { | ||
type: String | ||
}, | ||
|
||
/** | ||
* The value for this input. | ||
*/ | ||
value: { | ||
notify: true, | ||
type: String | ||
}, | ||
|
||
/** | ||
* Set to true to disable this input. | ||
*/ | ||
disabled: { | ||
type: Boolean, | ||
value: false | ||
}, | ||
|
||
/** | ||
* Set to true to prevent the user from entering invalid input. | ||
*/ | ||
preventInvalidInput: { | ||
type: Boolean | ||
}, | ||
|
||
/** | ||
* The type of the input. The supported types are `text`, `number` and `password`. | ||
*/ | ||
type: { | ||
type: String | ||
}, | ||
|
||
/** | ||
* A pattern to validate the `input` with. | ||
*/ | ||
pattern: { | ||
type: String | ||
}, | ||
|
||
/** | ||
* Set to true to mark the input as required. | ||
*/ | ||
required: { | ||
type: Boolean, | ||
value: false | ||
}, | ||
|
||
/** | ||
* The maximum length of the input value. | ||
*/ | ||
maxlength: { | ||
type: Number | ||
}, | ||
|
||
/** | ||
* The error message to display when the input is invalid. | ||
*/ | ||
errorMessage: { | ||
type: String | ||
}, | ||
|
||
/** | ||
* Set to true to show a character counter. | ||
*/ | ||
charCounter: { | ||
type: Boolean, | ||
value: false | ||
}, | ||
|
||
/** | ||
* Set to true to disable the floating label. | ||
*/ | ||
noLabelFloat: { | ||
type: Boolean, | ||
value: false | ||
}, | ||
|
||
/** | ||
* Set to true to auto-validate the input value. | ||
*/ | ||
autoValidate: { | ||
type: Boolean, | ||
value: false | ||
} | ||
|
||
}, | ||
|
||
/** | ||
* Returns a reference to the input element. | ||
*/ | ||
get inputElement() { | ||
return this.$.input; | ||
} | ||
|
||
}; | ||
|
||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters