@polymer/iron-validatable-behavior
Advanced tools
Comparing version 3.0.0-pre.6 to 3.0.0-pre.7
import '../../polymer/polymer.js'; | ||
import '../../iron-validator-behavior/iron-validator-behavior.js'; | ||
import { IronValidatorBehavior } from '../../iron-validator-behavior/iron-validator-behavior.js'; | ||
import { Polymer } from '../../polymer/lib/legacy/polymer-fn.js'; | ||
@@ -18,3 +19,3 @@ /** | ||
behaviors: [ | ||
Polymer.IronValidatorBehavior | ||
IronValidatorBehavior | ||
], | ||
@@ -21,0 +22,0 @@ |
@@ -1,3 +0,4 @@ | ||
import '../../polymer/polymer.js'; | ||
import '../iron-validatable-behavior.js'; | ||
import { html } from '../../polymer/polymer.js'; | ||
import { IronValidatableBehavior } from '../iron-validatable-behavior.js'; | ||
import { Polymer } from '../../polymer/lib/legacy/polymer-fn.js'; | ||
/** | ||
@@ -13,3 +14,3 @@ @license | ||
Polymer({ | ||
_template: Polymer.html` | ||
_template: html` | ||
<style> | ||
@@ -40,3 +41,3 @@ :host { | ||
behaviors: [ | ||
Polymer.IronValidatableBehavior | ||
IronValidatableBehavior | ||
], | ||
@@ -43,0 +44,0 @@ |
import '../polymer/polymer.js'; | ||
import '../iron-meta/iron-meta.js'; | ||
/** | ||
* Singleton IronMeta instance. | ||
*/ | ||
/** | ||
@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 | ||
*/ | ||
Polymer.IronValidatableBehaviorMeta = null; | ||
import { IronMeta } from '../iron-meta/iron-meta.js'; | ||
export let IronValidatableBehaviorMeta = null; | ||
/** | ||
* `Use Polymer.IronValidatableBehavior` to implement an element that validates user input. | ||
* Use the related `Polymer.IronValidatorBehavior` to add custom validation logic to an iron-input. | ||
* | ||
* By default, an `<iron-form>` element validates its fields when the user presses the submit button. | ||
* To validate a form imperatively, call the form's `validate()` method, which in turn will | ||
* call `validate()` on all its children. By using `Polymer.IronValidatableBehavior`, your | ||
* custom element will get a public `validate()`, which | ||
* will return the validity of the element, and a corresponding `invalid` attribute, | ||
* which can be used for styling. | ||
* | ||
* To implement the custom validation logic of your element, you must override | ||
* the protected `_getValidity()` method of this behaviour, rather than `validate()`. | ||
* See [this](https://github.com/PolymerElements/iron-form/blob/master/demo/simple-element.html) | ||
* for an example. | ||
* | ||
* ### Accessibility | ||
* | ||
* Changing the `invalid` property, either manually or by calling `validate()` will update the | ||
* `aria-invalid` attribute. | ||
* | ||
* @demo demo/index.html | ||
* @polymerBehavior | ||
*/ | ||
Polymer.IronValidatableBehavior = { | ||
export const IronValidatableBehavior = { | ||
@@ -64,3 +28,3 @@ properties: { | ||
registered: function() { | ||
Polymer.IronValidatableBehaviorMeta = new Polymer.IronMeta({type: 'validator'}); | ||
IronValidatableBehaviorMeta = new IronMeta({type: 'validator'}); | ||
}, | ||
@@ -79,4 +43,4 @@ | ||
get _validator() { | ||
return Polymer.IronValidatableBehaviorMeta && | ||
Polymer.IronValidatableBehaviorMeta.byKey(this.validator); | ||
return IronValidatableBehaviorMeta && | ||
IronValidatableBehaviorMeta.byKey(this.validator); | ||
}, | ||
@@ -83,0 +47,0 @@ |
{ | ||
"name": "@polymer/iron-validatable-behavior", | ||
"flat": true, | ||
"version": "3.0.0-pre.6", | ||
"version": "3.0.0-pre.7", | ||
"description": "Provides a behavior for an element that validates user input", | ||
@@ -21,11 +21,11 @@ "contributors": "The Polymer Authors", | ||
"dependencies": { | ||
"@polymer/iron-meta": "^3.0.0-pre.6", | ||
"@polymer/polymer": "^3.0.0-pre.6" | ||
"@polymer/iron-meta": "^3.0.0-pre.7", | ||
"@polymer/polymer": "^3.0.0-pre.7" | ||
}, | ||
"devDependencies": { | ||
"@polymer/iron-component-page": "^3.0.0-pre.6", | ||
"@polymer/iron-demo-helpers": "^3.0.0-pre.6", | ||
"@polymer/iron-validator-behavior": "^3.0.0-pre.6", | ||
"@polymer/paper-styles": "^3.0.0-pre.6", | ||
"@polymer/test-fixture": "^3.0.0-pre.6", | ||
"@polymer/iron-component-page": "^3.0.0-pre.7", | ||
"@polymer/iron-demo-helpers": "^3.0.0-pre.7", | ||
"@polymer/iron-validator-behavior": "^3.0.0-pre.7", | ||
"@polymer/paper-styles": "^3.0.0-pre.7", | ||
"@polymer/test-fixture": "^3.0.0-pre.7", | ||
"wct-browser-legacy": "0.0.1-pre.11", | ||
@@ -32,0 +32,0 @@ "@webcomponents/webcomponentsjs": "^1.0.0" |
import '../../polymer/polymer.js'; | ||
import '../../iron-validator-behavior/iron-validator-behavior.js'; | ||
import { IronValidatorBehavior } from '../../iron-validator-behavior/iron-validator-behavior.js'; | ||
import { Polymer } from '../../polymer/lib/legacy/polymer-fn.js'; | ||
@@ -18,3 +19,3 @@ /** | ||
behaviors: [ | ||
Polymer.IronValidatorBehavior | ||
IronValidatorBehavior | ||
], | ||
@@ -21,0 +22,0 @@ |
import '../../polymer/polymer.js'; | ||
import '../../iron-validator-behavior/iron-validator-behavior.js'; | ||
import { IronValidatorBehavior } from '../../iron-validator-behavior/iron-validator-behavior.js'; | ||
import { Polymer } from '../../polymer/lib/legacy/polymer-fn.js'; | ||
@@ -18,3 +19,3 @@ /** | ||
behaviors: [ | ||
Polymer.IronValidatorBehavior | ||
IronValidatorBehavior | ||
], | ||
@@ -21,0 +22,0 @@ |
@@ -1,2 +0,4 @@ | ||
import '../iron-validatable-behavior.js'; | ||
import { IronValidatableBehavior } from '../iron-validatable-behavior.js'; | ||
import { Polymer } from '../../polymer/lib/legacy/polymer-fn.js'; | ||
import { html } from '../../polymer/polymer.js'; | ||
@@ -13,3 +15,3 @@ /** | ||
Polymer({ | ||
_template: Polymer.html` | ||
_template: html` | ||
<slot></slot> | ||
@@ -21,4 +23,4 @@ `, | ||
behaviors: [ | ||
Polymer.IronValidatableBehavior | ||
IronValidatableBehavior | ||
] | ||
}); |
17
25874
280