@polymer/iron-checked-element-behavior
Advanced tools
Comparing version 3.0.0-pre.21 to 3.0.0-pre.22
/** | ||
@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 | ||
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 | ||
*/ | ||
import '@polymer/polymer/polymer-legacy.js'; | ||
import '@polymer/paper-button/paper-button.js'; | ||
import '@polymer/paper-button/paper-button.js'; | ||
import { IronCheckedElementBehavior } from '../iron-checked-element-behavior.js'; | ||
import { Polymer } from '@polymer/polymer/lib/legacy/polymer-fn.js'; | ||
import { html } from '@polymer/polymer/lib/utils/html-tag.js'; | ||
import {Polymer} from '@polymer/polymer/lib/legacy/polymer-fn.js'; | ||
import {html} from '@polymer/polymer/lib/utils/html-tag.js'; | ||
import {IronCheckedElementBehavior} from '../iron-checked-element-behavior.js'; | ||
Polymer({ | ||
@@ -35,3 +38,3 @@ _template: html` | ||
<span id="labelText">{{label}}</span> | ||
<paper-button raised="" on-click="_onClick">validate</paper-button> | ||
<paper-button raised on-click="_onClick">validate</paper-button> | ||
`, | ||
@@ -38,0 +41,0 @@ |
/** | ||
@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 | ||
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 | ||
*/ | ||
import '@polymer/polymer/polymer-legacy.js'; | ||
import { IronValidatableBehavior } from '@polymer/iron-validatable-behavior/iron-validatable-behavior.js'; | ||
import { IronFormElementBehavior } from '@polymer/iron-form-element-behavior/iron-form-element-behavior.js'; | ||
import {IronFormElementBehavior} from '@polymer/iron-form-element-behavior/iron-form-element-behavior.js'; | ||
import {IronValidatableBehavior} from '@polymer/iron-validatable-behavior/iron-validatable-behavior.js'; | ||
/** | ||
* Use `Polymer.IronCheckedElementBehavior` to implement a custom element | ||
* that has a `checked` property, which can be used for validation if the | ||
* element is also `required`. Element instances implementing this behavior | ||
* will also be registered for use in an `iron-form` element. | ||
* Use `IronCheckedElementBehavior` to implement a custom element that has a | ||
* `checked` property, which can be used for validation if the element is also | ||
* `required`. Element instances implementing this behavior will also be | ||
* registered for use in an `iron-form` element. | ||
* | ||
* @demo demo/index.html | ||
* @polymerBehavior Polymer.IronCheckedElementBehavior | ||
* @polymerBehavior IronCheckedElementBehavior | ||
*/ | ||
@@ -50,3 +51,3 @@ export const IronCheckedElementBehaviorImpl = { | ||
/* Overriden from Polymer.IronFormElementBehavior */ | ||
/* Overriden from IronFormElementBehavior */ | ||
value: {type: String, value: 'on', observer: '_valueChanged'} | ||
@@ -103,3 +104,3 @@ }, | ||
/** @polymerBehavior Polymer.IronCheckedElementBehavior */ | ||
/** @polymerBehavior */ | ||
export const IronCheckedElementBehavior = [ | ||
@@ -106,0 +107,0 @@ IronFormElementBehavior, |
@@ -17,50 +17,24 @@ { | ||
"devDependencies": { | ||
"@polymer/gen-typescript-declarations": "^1.2.2", | ||
"bower": "^1.8.0", | ||
"webmat": "^0.2.0", | ||
"@polymer/paper-styles": "^3.0.0-pre.21", | ||
"@polymer/paper-button": "^3.0.0-pre.21", | ||
"@polymer/iron-component-page": "^3.0.0-pre.21", | ||
"@polymer/paper-button": "^3.0.0-pre.20", | ||
"@polymer/paper-styles": "^3.0.0-pre.20", | ||
"@webcomponents/webcomponentsjs": "^2.0.0", | ||
"wct-browser-legacy": "^1.0.1", | ||
"@webcomponents/webcomponentsjs": "^2.0.0" | ||
"webmat": "^0.2.2", | ||
"@polymer/gen-typescript-declarations": "^1.5.0" | ||
}, | ||
"scripts": { | ||
"update-types": "bower install && gen-typescript-declarations --deleteExisting --outDir .", | ||
"format": "webmat && npm run update-types" | ||
"format": "webmat", | ||
"generate-types": "gen-typescript-declarations --deleteExisting --outDir .", | ||
"prepack": "npm run generate-types" | ||
}, | ||
"version": "3.0.0-pre.21", | ||
"resolutions": { | ||
"inherits": "2.0.3", | ||
"samsam": "1.1.3", | ||
"supports-color": "3.1.2", | ||
"type-detect": "1.0.0", | ||
"@webcomponents/webcomponentsjs": "2.0.0-beta.2" | ||
}, | ||
"version": "3.0.0-pre.22", | ||
"main": "iron-checked-element-behavior.js", | ||
"contributors": [ | ||
"T", | ||
"h", | ||
"e", | ||
" ", | ||
"P", | ||
"o", | ||
"l", | ||
"y", | ||
"m", | ||
"e", | ||
"r", | ||
" ", | ||
"A", | ||
"u", | ||
"t", | ||
"h", | ||
"o", | ||
"r", | ||
"s" | ||
"The Polymer Authors" | ||
], | ||
"dependencies": { | ||
"@polymer/polymer": "^3.0.0", | ||
"@polymer/iron-validatable-behavior": "^3.0.0-pre.21", | ||
"@polymer/iron-form-element-behavior": "^3.0.0-pre.21" | ||
"@polymer/iron-validatable-behavior": "^3.0.0-pre.20", | ||
"@polymer/iron-form-element-behavior": "^3.0.0-pre.20" | ||
} | ||
} |
@@ -0,11 +1,85 @@ | ||
[![Published on NPM](https://img.shields.io/npm/v/@polymer/iron-checked-element-behavior.svg)](https://www.npmjs.com/package/@polymer/iron-checked-element-behavior) | ||
[![Build status](https://travis-ci.org/PolymerElements/iron-checked-element-behavior.svg?branch=master)](https://travis-ci.org/PolymerElements/iron-checked-element-behavior) | ||
[![Published on webcomponents.org](https://img.shields.io/badge/webcomponents.org-published-blue.svg)](https://webcomponents.org/element/@polymer/iron-checked-element-behavior) | ||
_[Demo and API docs](https://elements.polymer-project.org/elements/iron-checked-element-behavior)_ | ||
## IronCheckedElementBehavior | ||
Use `IronCheckedElementBehavior` to implement a custom element that has a | ||
`checked` property, which can be used for validation if the element is also | ||
`required`. Element instances implementing this behavior will also be | ||
registered for use in an `iron-form` element. | ||
##Polymer.IronCheckedElementBehavior | ||
See: [Documentation](https://www.webcomponents.org/element/@polymer/iron-checked-element-behavior), | ||
[Demo](https://www.webcomponents.org/element/@polymer/iron-checked-element-behavior/demo/demo/index.html). | ||
Use `Polymer.IronCheckedElementBehavior` to implement a custom element | ||
that has a `checked` property, which can be used for validation if the | ||
element is also `required`. Element instances implementing this behavior | ||
will also be registered for use in an `iron-form` element. | ||
## Usage | ||
### Installation | ||
``` | ||
npm install --save @polymer/iron-checked-element-behavior | ||
``` | ||
### In a Polymer 3 element | ||
```js | ||
import {PolymerElement} from '@polymer/polymer/polymer-element.js'; | ||
import {mixinBehaviors} from '@polymer/polymer/lib/legacy/class.js'; | ||
import {html} from '@polymer/polymer/lib/utils/html-tag.js'; | ||
import {IronCheckedElementBehavior} from '../iron-checked-element-behavior.js'; | ||
class SimpleCheckbox extends mixinBehaviors(IronCheckedElementBehavior, PolymerElement) { | ||
static get template() { | ||
return html` | ||
<style> | ||
:host([invalid]) { | ||
color: red; | ||
} | ||
</style> | ||
<button on-click="_checkValidity">validate</button> | ||
<input type="checkbox" id="checkbox" checked="{{checked::input}}"> | ||
<span id="labelText">{{label}}</span> | ||
`; | ||
} | ||
static get properties() { | ||
return {label: {type: String, value: 'not validated'}}; | ||
} | ||
_checkValidity() { | ||
this.validate(); | ||
this.label = this.invalid ? 'is invalid' : 'is valid'; | ||
} | ||
} | ||
customElements.define('simple-checkbox', SimpleCheckbox); | ||
``` | ||
## Contributing | ||
If you want to send a PR to this element, here are the instructions for running | ||
the tests and demo locally: | ||
### Installation | ||
```sh | ||
git clone https://github.com/PolymerElements/iron-checked-element-behavior | ||
cd iron-checked-element-behavior | ||
npm install | ||
npm install -g polymer-cli | ||
``` | ||
### Running the demo locally | ||
```sh | ||
polymer serve --npm | ||
open http://127.0.0.1:<port>/demo/ | ||
``` | ||
### Running the tests | ||
```sh | ||
polymer test --npm | ||
``` |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6
229
86
16349
8
1