OLD | NEW |
1 <!-- | 1 <!-- |
2 @license | 2 @license |
3 Copyright (c) 2016 The Polymer Project Authors. All rights reserved. | 3 Copyright (c) 2016 The Polymer Project Authors. All rights reserved. |
4 This code may only be used under the BSD style license found at http://polymer.g
ithub.io/LICENSE.txt | 4 This code may only be used under the BSD style license found at http://polymer.g
ithub.io/LICENSE.txt |
5 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt | 5 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt |
6 The complete set of contributors may be found at http://polymer.github.io/CONTRI
BUTORS.txt | 6 The complete set of contributors may be found at http://polymer.github.io/CONTRI
BUTORS.txt |
7 Code distributed by Google as part of the polymer project is also | 7 Code distributed by Google as part of the polymer project is also |
8 subject to an additional IP rights grant found at http://polymer.github.io/PATEN
TS.txt | 8 subject to an additional IP rights grant found at http://polymer.github.io/PATEN
TS.txt |
9 --><html><head><link rel="import" href="../polymer/polymer.html"> | 9 --><html><head><link rel="import" href="../polymer/polymer.html"> |
10 <link rel="import" href="../paper-styles/default-theme.html"> | 10 <link rel="import" href="../paper-styles/default-theme.html"> |
11 <link rel="import" href="../paper-styles/color.html"> | |
12 <link rel="import" href="../paper-behaviors/paper-checked-element-behavior.html"
> | 11 <link rel="import" href="../paper-behaviors/paper-checked-element-behavior.html"
> |
13 | 12 |
14 <!-- | 13 <!-- |
15 Material design: [Checkbox](https://www.google.com/design/spec/components/select
ion-controls.html#selection-controls-checkbox) | 14 Material design: [Checkbox](https://www.google.com/design/spec/components/select
ion-controls.html#selection-controls-checkbox) |
16 | 15 |
17 `paper-checkbox` is a button that can be either checked or unchecked. User | 16 `paper-checkbox` is a button that can be either checked or unchecked. User |
18 can tap the checkbox to check or uncheck it. Usually you use checkboxes | 17 can tap the checkbox to check or uncheck it. Usually you use checkboxes |
19 to allow user to select multiple options from a set. If you have a single | 18 to allow user to select multiple options from a set. If you have a single |
20 ON/OFF option, avoid using a single checkbox and use `paper-toggle-button` | 19 ON/OFF option, avoid using a single checkbox and use `paper-toggle-button` |
21 instead. | 20 instead. |
(...skipping 11 matching lines...) Expand all Loading... |
33 Custom property | Description | Default | 32 Custom property | Description | Default |
34 ----------------|-------------|---------- | 33 ----------------|-------------|---------- |
35 `--paper-checkbox-unchecked-background-color` | Checkbox background color when t
he input is not checked | `transparent` | 34 `--paper-checkbox-unchecked-background-color` | Checkbox background color when t
he input is not checked | `transparent` |
36 `--paper-checkbox-unchecked-color` | Checkbox border color when the input is not
checked | `--primary-text-color` | 35 `--paper-checkbox-unchecked-color` | Checkbox border color when the input is not
checked | `--primary-text-color` |
37 `--paper-checkbox-unchecked-ink-color` | Selected/focus ripple color when the in
put is not checked | `--primary-text-color` | 36 `--paper-checkbox-unchecked-ink-color` | Selected/focus ripple color when the in
put is not checked | `--primary-text-color` |
38 `--paper-checkbox-checked-color` | Checkbox color when the input is checked | `-
-primary-color` | 37 `--paper-checkbox-checked-color` | Checkbox color when the input is checked | `-
-primary-color` |
39 `--paper-checkbox-checked-ink-color` | Selected/focus ripple color when the inpu
t is checked | `--primary-color` | 38 `--paper-checkbox-checked-ink-color` | Selected/focus ripple color when the inpu
t is checked | `--primary-color` |
40 `--paper-checkbox-checkmark-color` | Checkmark color | `white` | 39 `--paper-checkbox-checkmark-color` | Checkmark color | `white` |
41 `--paper-checkbox-label-color` | Label color | `--primary-text-color` | 40 `--paper-checkbox-label-color` | Label color | `--primary-text-color` |
42 `--paper-checkbox-label-spacing` | Spacing between the label and the checkbox |
`8px` | 41 `--paper-checkbox-label-spacing` | Spacing between the label and the checkbox |
`8px` |
43 `--paper-checkbox-error-color` | Checkbox color when invalid | `--google-red-500
` | 42 `--paper-checkbox-error-color` | Checkbox color when invalid | `--error-color` |
44 `--paper-checkbox-size` | Size of the checkbox | `18px` | 43 `--paper-checkbox-size` | Size of the checkbox | `18px` |
45 | 44 |
46 This element applies the mixin `--paper-font-common-base` but does not import `p
aper-styles/typography.html`. | 45 This element applies the mixin `--paper-font-common-base` but does not import `p
aper-styles/typography.html`. |
47 In order to apply the `Roboto` font to this element, make sure you've imported `
paper-styles/typography.html`. | 46 In order to apply the `Roboto` font to this element, make sure you've imported `
paper-styles/typography.html`. |
48 | 47 |
49 @demo demo/index.html | 48 @demo demo/index.html |
50 --> | 49 --> |
51 | 50 |
52 </head><body><dom-module id="paper-checkbox"> | 51 </head><body><dom-module id="paper-checkbox"> |
53 <template strip-whitespace=""> | 52 <template strip-whitespace=""> |
54 <style> | 53 <style> |
55 :host { | 54 :host { |
56 display: inline-block; | 55 display: inline-block; |
57 white-space: nowrap; | 56 white-space: nowrap; |
58 cursor: pointer; | 57 cursor: pointer; |
59 --calculated-paper-checkbox-size: var(--paper-checkbox-size, 18px); | 58 --calculated-paper-checkbox-size: var(--paper-checkbox-size, 18px); |
60 @apply(--paper-font-common-base); | 59 @apply(--paper-font-common-base); |
| 60 line-height: 0; |
61 } | 61 } |
62 | 62 |
63 :host(:focus) { | 63 :host(:focus) { |
64 outline: none; | 64 outline: none; |
65 } | 65 } |
66 | 66 |
67 .hidden { | 67 .hidden { |
68 display: none; | 68 display: none; |
69 } | 69 } |
70 | 70 |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 transform-origin: 50% 14%; | 162 transform-origin: 50% 14%; |
163 } | 163 } |
164 | 164 |
165 /* label */ | 165 /* label */ |
166 #checkboxLabel { | 166 #checkboxLabel { |
167 position: relative; | 167 position: relative; |
168 display: inline-block; | 168 display: inline-block; |
169 vertical-align: middle; | 169 vertical-align: middle; |
170 padding-left: var(--paper-checkbox-label-spacing, 8px); | 170 padding-left: var(--paper-checkbox-label-spacing, 8px); |
171 white-space: normal; | 171 white-space: normal; |
172 pointer-events: none; | 172 line-height: normal; |
173 color: var(--paper-checkbox-label-color, --primary-text-color); | 173 color: var(--paper-checkbox-label-color, --primary-text-color); |
174 } | 174 } |
175 | 175 |
176 :host-context([dir="rtl"]) #checkboxLabel { | 176 :host-context([dir="rtl"]) #checkboxLabel { |
177 padding-right: var(--paper-checkbox-label-spacing, 8px); | 177 padding-right: var(--paper-checkbox-label-spacing, 8px); |
178 padding-left: 0; | 178 padding-left: 0; |
179 } | 179 } |
180 | 180 |
181 #checkboxLabel[hidden] { | 181 #checkboxLabel[hidden] { |
182 display: none; | 182 display: none; |
183 } | 183 } |
184 | 184 |
185 /* disabled state */ | 185 /* disabled state */ |
186 :host([disabled]) { | |
187 pointer-events: none; | |
188 } | |
189 | 186 |
190 :host([disabled]) #checkbox { | 187 :host([disabled]) #checkbox { |
191 opacity: 0.5; | 188 opacity: 0.5; |
192 border-color: var(--paper-checkbox-unchecked-color, --primary-text-color
); | 189 border-color: var(--paper-checkbox-unchecked-color, --primary-text-color
); |
193 } | 190 } |
194 | 191 |
195 :host([disabled][checked]) #checkbox { | 192 :host([disabled][checked]) #checkbox { |
196 background-color: var(--paper-checkbox-unchecked-color, --primary-text-c
olor); | 193 background-color: var(--paper-checkbox-unchecked-color, --primary-text-c
olor); |
197 opacity: 0.5; | 194 opacity: 0.5; |
198 } | 195 } |
199 | 196 |
200 :host([disabled]) #checkboxLabel { | 197 :host([disabled]) #checkboxLabel { |
201 opacity: 0.65; | 198 opacity: 0.65; |
202 } | 199 } |
203 | 200 |
204 /* invalid state */ | 201 /* invalid state */ |
205 #checkbox.invalid:not(.checked) { | 202 #checkbox.invalid:not(.checked) { |
206 border-color: var(--paper-checkbox-error-color, --google-red-500); | 203 border-color: var(--paper-checkbox-error-color, --error-color); |
207 } | 204 } |
208 </style> | 205 </style> |
209 | 206 |
210 <div id="checkboxContainer"> | 207 <div id="checkboxContainer"> |
211 <div id="checkbox" class$="[[_computeCheckboxClass(checked, invalid)]]"> | 208 <div id="checkbox" class$="[[_computeCheckboxClass(checked, invalid)]]"> |
212 <div id="checkmark" class$="[[_computeCheckmarkClass(checked)]]"></div> | 209 <div id="checkmark" class$="[[_computeCheckmarkClass(checked)]]"></div> |
213 </div> | 210 </div> |
214 </div> | 211 </div> |
215 | 212 |
216 <div id="checkboxLabel"><content></content></div> | 213 <div id="checkboxLabel"><content></content></div> |
217 </template> | 214 </template> |
218 | 215 |
219 </dom-module> | 216 </dom-module> |
220 <script src="paper-checkbox-extracted.js"></script></body></html> | 217 <script src="paper-checkbox-extracted.js"></script></body></html> |
OLD | NEW |