Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(64)

Unified Diff: third_party/polymer/v0_8/components/paper-checkbox/paper-checkbox.html

Issue 1162563004: Upgrade to 1.0 and switch clients to dom-repeat where needed. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix a layout import and remove the gzipped webanimation in reproduce.sh Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/polymer/v0_8/components/paper-checkbox/paper-checkbox.html
diff --git a/third_party/polymer/v0_8/components/paper-checkbox/paper-checkbox.html b/third_party/polymer/v0_8/components/paper-checkbox/paper-checkbox.html
index 8dfb4b3d05cdcf894667ee830e81ffdf6e6975ca..2deb9a80170d8a4e4103ee4875fd8eb8f598dec3 100644
--- a/third_party/polymer/v0_8/components/paper-checkbox/paper-checkbox.html
+++ b/third_party/polymer/v0_8/components/paper-checkbox/paper-checkbox.html
@@ -14,6 +14,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
<link rel="import" href="../paper-behaviors/paper-radio-button-behavior.html">
<!--
+
`paper-checkbox` is a button that can be either checked or unchecked. User
can tap the checkbox to check or uncheck it. Usually you use checkboxes
to allow user to select multiple options from a set. If you have a single
@@ -26,41 +27,40 @@ Example:
<paper-checkbox checked> label</paper-checkbox>
-Styling a checkbox:
+### Styling
-<style is="x-style">
- * {
- /* Unhecked state colors. */
- --paper-checkbox-unchecked-color: #5a5a5a;
- --paper-checkbox-unchecked-ink-color: #5a5a5a;
+The following custom properties and mixins are available for styling:
- /* Checked state colors. */
- --paper-checkbox-checked-color: #009688;
- --paper-checkbox-checked-ink-color: #009688;
- }
-</style>
+Custom property | Description | Default
+----------------|-------------|----------
+`--paper-checkbox-unchecked-color` | Checkbox color when the input is not checked | `--primary-text-color`
+`--paper-checkbox-unchecked-ink-color` | Selected/focus ripple color when the input is not checked | `--primary-text-color`
+`--paper-checkbox-checked-color` | Checkbox color when the input is checked | `--default-primary-color`
+`--paper-checkbox-checked-ink-color` | Selected/focus ripple color when the input is checked | `--default-primary-color`
+`--paper-checkbox-label-color` | Label color | `--primary-text-color`
-@group Paper Elements
-@class paper-checkbox
+@demo demo/index.html
-->
-<dom-module id="paper-checkbox">
- <style is="x-style">
- * {
- --paper-checkbox-unchecked-color: var(--primary-text-color);
- --paper-checkbox-unchecked-ink-color: var(--primary-text-color);
+<style is="custom-style">
+ :root {
+ --paper-checkbox-unchecked-color: var(--primary-text-color);
+ --paper-checkbox-unchecked-ink-color: var(--primary-text-color);
+
+ --paper-checkbox-checked-color: var(--default-primary-color);
+ --paper-checkbox-checked-ink-color: var(--default-primary-color);
- --paper-checkbox-checked-color: var(--default-primary-color);
- --paper-checkbox-checked-ink-color: var(--default-primary-color);
- }
- </style>
+ --paper-checkbox-label-color: var(--primary-text-color);
+ }
+</style>
+<dom-module id="paper-checkbox">
<link rel="import" type="css" href="paper-checkbox.css">
<template>
<div id="checkboxContainer">
- <paper-ripple id="ink" class="circle" recenters checked$="[[checked]]"></paper-ripple>
+ <paper-ripple id="ink" class="circle" center checked$="[[checked]]"></paper-ripple>
<div id="checkbox" class$="[[_computeCheckboxClass(checked)]]">
<div id="checkmark" class$="[[_computeCheckmarkClass(checked)]]"></div>
</div>
@@ -69,96 +69,93 @@ Styling a checkbox:
<div id="checkboxLabel" aria-hidden="true"><content></content></div>
</template>
-</dom-module>
-<script>
- Polymer({
- is: 'paper-checkbox',
-
- // The custom properties shim is currently an opt-in feature.
- enableCustomStyleProperties: true,
-
- behaviors: [
- Polymer.PaperRadioButtonBehavior
- ],
-
- hostAttributes: {
- role: 'checkbox',
- 'aria-checked': false,
- tabindex: 0
- },
-
- properties: {
- /**
- * Fired when the checked state changes due to user interaction.
- *
- * @event change
- */
-
- /**
- * Fired when the checked state changes.
- *
- * @event iron-change
- */
-
- /**
- * Gets or sets the state, `true` is checked and `false` is unchecked.
- *
- * @attribute checked
- * @type boolean
- * @default false
- */
- checked: {
- type: Boolean,
- value: false,
- reflectToAttribute: true,
- notify: true,
- observer: '_checkedChanged'
+ <script>
+ Polymer({
+ is: 'paper-checkbox',
+
+ behaviors: [
+ Polymer.PaperRadioButtonBehavior
+ ],
+
+ hostAttributes: {
+ role: 'checkbox',
+ 'aria-checked': false,
+ tabindex: 0
},
- /**
- * If true, the user cannot interact with this element.
- *
- * @attribute disabled
- * @type boolean
- * @default false
- */
- disabled: {
- type: Boolean
- }
- },
+ properties: {
+ /**
+ * Fired when the checked state changes due to user interaction.
+ *
+ * @event change
+ */
+
+ /**
+ * Fired when the checked state changes.
+ *
+ * @event iron-change
+ */
+
+ /**
+ * Gets or sets the state, `true` is checked and `false` is unchecked.
+ */
+ checked: {
+ type: Boolean,
+ value: false,
+ reflectToAttribute: true,
+ notify: true,
+ observer: '_checkedChanged'
+ },
+
+ /**
+ * If true, the button toggles the active state with each tap or press
+ * of the spacebar.
+ */
+ toggles: {
+ type: Boolean,
+ value: true,
+ reflectToAttribute: true
+ }
+ },
- ready: function() {
- this.toggles = true;
+ ready: function() {
+ if (Polymer.dom(this).textContent == '') {
+ this.$.checkboxLabel.hidden = true;
+ } else {
+ this.setAttribute('aria-label', Polymer.dom(this).textContent);
+ }
+ this._isReady = true;
+ },
- if (this.$.checkboxLabel.textContent == '') {
- this.$.checkboxLabel.hidden = true;
- } else {
- this.setAttribute('aria-label', this.$.checkboxLabel.textContent);
- }
- },
-
- // button-behavior hook
- _buttonStateChanged: function() {
- this.checked = this.active;
- },
-
- _checkedChanged: function(checked) {
- this.setAttribute('aria-checked', this.checked ? 'true' : 'false');
- this.active = this.checked;
- this.fire('iron-change');
- },
-
- _computeCheckboxClass: function(checked) {
- if (checked) {
- return 'checked';
- }
- },
+ // button-behavior hook
+ _buttonStateChanged: function() {
+ if (this.disabled) {
+ return;
+ }
+ if (this._isReady) {
+ this.checked = this.active;
+ }
+ },
- _computeCheckmarkClass: function(checked) {
- if (!checked) {
- return 'hidden';
+ _checkedChanged: function(checked) {
+ this.setAttribute('aria-checked', this.checked ? 'true' : 'false');
+ this.active = this.checked;
+ this.fire('iron-change');
+ },
+
+ _computeCheckboxClass: function(checked) {
+ if (checked) {
+ return 'checked';
+ }
+ },
+
+ _computeCheckmarkClass: function(checked) {
+ if (!checked) {
+ return 'hidden';
+ }
}
- }
- })
-</script>
+ })
+ </script>
+
+</dom-module>

Powered by Google App Engine
This is Rietveld 408576698