blob: 21884cb58456fa32a2d97b1069e9ecdc7309de25 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
<!-- Copyright 2015 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file. -->
<link rel="import" href="chrome://resources/polymer/v1_0/iron-flex-layout/classes/iron-flex-layout.html">
<link rel="import" href="chrome://resources/polymer/v1_0/iron-input/iron-input.html">
<link rel="import" href="chrome://resources/polymer/v1_0/paper-input/paper-input-container.html">
<link rel="import" href="chrome://resources/polymer/v1_0/paper-input/paper-input-error.html">
<link rel="import" href="chrome://resources/polymer/v1_0/paper-styles/color.html">
<link rel="import" href="chrome://resources/polymer/v1_0/polymer/polymer.html">
<!--
Material desing input field, that supports different input types and email
validation and matches GAIA's visual style.
Examples:
<gaia-input value="Simple text input" required></gaia-input>
<gaia-input type="email" domain="example.com"></gaia-input>
Attributes:
'label' - same as <paper-input>'s 'label'.
'value' - same as <input>'s 'value'.
'type' - same as <input>'s 'type'.
'domain' - optional attribute for email input. The domain is displayed in
the end of input field, if user is not provided any.
'error' - error message displayed in case if 'isInvalid' is true.
'isInvalid' - whether input data is invalid. Note: it is not changed
automatically. Can be changed manually or with checkValidity()
method.
'required' - whether empty field is invalid.
Methods:
'focus' - focuses input field.
'checkValidity' - returns current validity state of the input form. Updates
'isInvalid' at the end.
-->
<dom-module name="gaia-input">
<link rel="stylesheet" href="gaia_input.css">
<template>
<paper-input-container id="decorator" on-tap="onTap"
invalid="[[isInvalid]]" disabled$="[[disabled]]">
<label><span>[[label]]</span></label>
<div id="container" class="horizontal layout">
<input id="input" is="iron-input" on-keydown="onKeyDown"
bind-value="{{value}}" invalid="[[isInvalid]]"
required$="[[required]]" disabled$="[[disabled]]" class="flex">
<span id="domainLabel">[[domain]]</span>
</div>
<template is="dom-if" if="[[error]]">
<paper-input-error>[[error]]</paper-input-error>
</template>
</paper-input-container>
</template>
</dom-module>
|