@polymer/iron-validatable-behavior
Advanced tools
Comparing version 3.0.0-pre.4 to 3.0.0-pre.6
import '../../polymer/polymer.js'; | ||
import { IronValidatorBehavior } from '../../iron-validator-behavior/iron-validator-behavior.js'; | ||
import { Polymer } from '../../polymer/lib/legacy/polymer-fn.js'; | ||
import '../../iron-validator-behavior/iron-validator-behavior.js'; | ||
@@ -19,3 +18,3 @@ /** | ||
behaviors: [ | ||
IronValidatorBehavior | ||
Polymer.IronValidatorBehavior | ||
], | ||
@@ -22,0 +21,0 @@ |
@@ -1,4 +0,3 @@ | ||
import { html } from '../../polymer/polymer.js'; | ||
import { IronValidatableBehavior } from '../iron-validatable-behavior.js'; | ||
import { Polymer } from '../../polymer/lib/legacy/polymer-fn.js'; | ||
import '../../polymer/polymer.js'; | ||
import '../iron-validatable-behavior.js'; | ||
/** | ||
@@ -14,3 +13,3 @@ @license | ||
Polymer({ | ||
_template: html` | ||
_template: Polymer.html` | ||
<style> | ||
@@ -41,3 +40,3 @@ :host { | ||
behaviors: [ | ||
IronValidatableBehavior | ||
Polymer.IronValidatableBehavior | ||
], | ||
@@ -44,0 +43,0 @@ |
import '../polymer/polymer.js'; | ||
import { IronMeta } from '../iron-meta/iron-meta.js'; | ||
export let IronValidatableBehaviorMeta = null; | ||
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; | ||
export const IronValidatableBehavior = { | ||
/** | ||
* `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 = { | ||
@@ -28,3 +64,3 @@ properties: { | ||
registered: function() { | ||
IronValidatableBehaviorMeta = new IronMeta({type: 'validator'}); | ||
Polymer.IronValidatableBehaviorMeta = new Polymer.IronMeta({type: 'validator'}); | ||
}, | ||
@@ -43,4 +79,4 @@ | ||
get _validator() { | ||
return IronValidatableBehaviorMeta && | ||
IronValidatableBehaviorMeta.byKey(this.validator); | ||
return Polymer.IronValidatableBehaviorMeta && | ||
Polymer.IronValidatableBehaviorMeta.byKey(this.validator); | ||
}, | ||
@@ -47,0 +83,0 @@ |
{ | ||
"name": "@polymer/iron-validatable-behavior", | ||
"flat": true, | ||
"version": "3.0.0-pre.4", | ||
"version": "3.0.0-pre.6", | ||
"description": "Provides a behavior for an element that validates user input", | ||
@@ -21,12 +21,12 @@ "contributors": "The Polymer Authors", | ||
"dependencies": { | ||
"@polymer/iron-meta": "^3.0.0-pre.4", | ||
"@polymer/polymer": "^3.0.0-pre.4" | ||
"@polymer/iron-meta": "^3.0.0-pre.6", | ||
"@polymer/polymer": "^3.0.0-pre.6" | ||
}, | ||
"devDependencies": { | ||
"@polymer/iron-component-page": "^3.0.0-pre.4", | ||
"@polymer/iron-demo-helpers": "^3.0.0-pre.4", | ||
"@polymer/iron-validator-behavior": "^3.0.0-pre.4", | ||
"@polymer/paper-styles": "^3.0.0-pre.4", | ||
"@polymer/test-fixture": "^3.0.0-pre.4", | ||
"wct-browser-legacy": "0.0.1-pre.10", | ||
"@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", | ||
"wct-browser-legacy": "0.0.1-pre.11", | ||
"@webcomponents/webcomponentsjs": "^1.0.0" | ||
@@ -33,0 +33,0 @@ }, |
import '../../polymer/polymer.js'; | ||
import { IronValidatorBehavior } from '../../iron-validator-behavior/iron-validator-behavior.js'; | ||
import { Polymer } from '../../polymer/lib/legacy/polymer-fn.js'; | ||
import '../../iron-validator-behavior/iron-validator-behavior.js'; | ||
@@ -19,3 +18,3 @@ /** | ||
behaviors: [ | ||
IronValidatorBehavior | ||
Polymer.IronValidatorBehavior | ||
], | ||
@@ -22,0 +21,0 @@ |
import '../../polymer/polymer.js'; | ||
import { IronValidatorBehavior } from '../../iron-validator-behavior/iron-validator-behavior.js'; | ||
import { Polymer } from '../../polymer/lib/legacy/polymer-fn.js'; | ||
import '../../iron-validator-behavior/iron-validator-behavior.js'; | ||
@@ -19,3 +18,3 @@ /** | ||
behaviors: [ | ||
IronValidatorBehavior | ||
Polymer.IronValidatorBehavior | ||
], | ||
@@ -22,0 +21,0 @@ |
@@ -1,4 +0,2 @@ | ||
import { IronValidatableBehavior } from '../iron-validatable-behavior.js'; | ||
import { Polymer } from '../../polymer/lib/legacy/polymer-fn.js'; | ||
import { html } from '../../polymer/polymer.js'; | ||
import '../iron-validatable-behavior.js'; | ||
@@ -15,3 +13,3 @@ /** | ||
Polymer({ | ||
_template: html` | ||
_template: Polymer.html` | ||
<slot></slot> | ||
@@ -23,4 +21,4 @@ `, | ||
behaviors: [ | ||
IronValidatableBehavior | ||
Polymer.IronValidatableBehavior | ||
] | ||
}); |
27046
310