api-console-assets
Version:
This repo only exists to publish api console components to npm
175 lines (150 loc) • 5.04 kB
HTML
<!--
@license
Copyright 2016 The Advanced REST client authors <arc@mulesoft.com>
Licensed under the Apache License, Version 2.0 (the "License"); you may not
use this file except in compliance with the License. You may obtain a copy of
the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
License for the specific language governing permissions and limitations under
the License.
-->
<link rel="import" href="../polymer/polymer.html">
<link rel="import" href="../iron-form-element-behavior/iron-form-element-behavior.html">
<link rel="import" href="../iron-input/iron-input.html">
<link rel="import" href="paper-input-container.html">
<link rel="import" href="paper-input-behavior.html">
<link rel="import" href="paper-input-error.html">
<!--
`<paper-input>` single line text input styled for the Anypoint platform as a Polymer
powered web component
It may include an optional error message.
```
<paper-input required error-message="Value is required"></paper-input>
```
It may include a custom validator(s).
```
<paper-input validator="my-validator" error-message="Value is required"></paper-input>
```
See `Anypoint.AnypointValidatableBehavior` for API and examples.
### Styling
See `anypoint-text-container` for styling options.
@group Anypoint Elements
@element paper-input
@demo demo/index.html
-->
<dom-module id="paper-input">
<template>
<style>
:host {
display: block;
}
:host {
display: block;
}
:host([focused]) {
outline: none;
}
:host([hidden]) {
display: none ;
}
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
@apply(--paper-input-container-input-webkit-spinner);
}
input::-webkit-clear-button {
@apply(--paper-input-container-input-webkit-clear);
}
input::-webkit-input-placeholder {
color: var(--paper-input-container-color, --secondary-text-color);
}
input:-moz-placeholder {
color: var(--paper-input-container-color, --secondary-text-color);
}
input::-moz-placeholder {
color: var(--paper-input-container-color, --secondary-text-color);
}
input:-ms-input-placeholder {
color: var(--paper-input-container-color, --secondary-text-color);
}
label {
pointer-events: none;
}
paper-input-error {
-webkit-transform-origin: center center;
transform-origin: center center;
-webkit-transition: all .2s ease-out;
transition: all .2s ease-out;
}
:host(:not([focused])) paper-input-error {
transform: translate(-2px);
}
</style>
<paper-input-container
no-label-float="[[noLabelFloat]]"
always-float-label="[[_computeAlwaysFloatLabel(alwaysFloatLabel,placeholder)]]"
auto-validate$="[[autoValidate]]"
disabled$="[[disabled]]"
invalid="[[invalid]]">
<content select="[prefix]"></content>
<label hidden$="[[!label]]" aria-hidden="true" for$="[[_inputId]]">[[label]]</label>
<input is="iron-input"
id$="[[_inputId]]"
aria-labelledby$="[[_ariaLabelledBy]]"
aria-describedby$="[[_ariaDescribedBy]]"
disabled$="[[disabled]]"
title$="[[title]]"
bind-value="{{value}}"
invalid="{{invalid}}"
prevent-invalid-input="[[preventInvalidInput]]"
allowed-pattern="[[allowedPattern]]"
validator="[[validator]]"
type$="[[type]]"
pattern$="[[pattern]]"
required$="[[required]]"
autocomplete$="[[autocomplete]]"
autofocus$="[[autofocus]]"
inputmode$="[[inputmode]]"
minlength$="[[minlength]]"
maxlength$="[[maxlength]]"
min$="[[min]]"
max$="[[max]]"
step$="[[step]]"
name$="[[name]]"
placeholder$="[[placeholder]]"
readonly$="[[readonly]]"
list$="[[list]]"
size$="[[size]]"
autocapitalize$="[[autocapitalize]]"
autocorrect$="[[autocorrect]]"
on-change="_onChange"
tabindex$="[[tabindex]]"
autosave$="[[autosave]]"
results$="[[results]]"
accept$="[[accept]]"
multiple$="[[multiple]]"
validation-states="{{validationStates}}">
<content select="[suffix]"></content>
<template is="dom-if" if="[[hasValidationMessage]]">
<paper-input-error
aria-live="assertive"
error-message="[[errorMessage]]"
invalid="[[invalid]]"
focused="[[focused]]"
validation-states="{{validationStates}}"
horizontal-align="right"></paper-input-error>
</template>
</paper-input-container>
</template>
<script>
Polymer({
is: 'paper-input',
behaviors: [
Polymer.IronFormElementBehavior,
Polymer.PaperInputBehavior
]
});
</script>
</dom-module>