polymer-paper-elements-rails 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/README.md +51 -0
- data/Rakefile +1 -0
- data/app/assets/components/iron-a11y-announcer/iron-a11y-announcer.html +125 -0
- data/app/assets/components/iron-a11y-keys-behavior/iron-a11y-keys-behavior.html +418 -0
- data/app/assets/components/iron-autogrow-textarea/hero.svg +33 -0
- data/app/assets/components/iron-autogrow-textarea/iron-autogrow-textarea.html +263 -0
- data/app/assets/components/iron-behaviors/iron-button-state.html +195 -0
- data/app/assets/components/iron-behaviors/iron-control-state.html +102 -0
- data/app/assets/components/iron-fit-behavior/iron-fit-behavior.html +230 -0
- data/app/assets/components/iron-flex-layout/classes/iron-flex-layout.html +307 -0
- data/app/assets/components/iron-flex-layout/classes/iron-shadow-flex-layout.html +302 -0
- data/app/assets/components/iron-flex-layout/iron-flex-layout.html +313 -0
- data/app/assets/components/iron-form-element-behavior/iron-form-element-behavior.html +50 -0
- data/app/assets/components/iron-icon/hero.svg +19 -0
- data/app/assets/components/iron-icon/iron-icon.html +187 -0
- data/app/assets/components/iron-icons/av-icons.html +73 -0
- data/app/assets/components/iron-icons/communication-icons.html +59 -0
- data/app/assets/components/iron-icons/device-icons.html +94 -0
- data/app/assets/components/iron-icons/editor-icons.html +70 -0
- data/app/assets/components/iron-icons/hardware-icons.html +61 -0
- data/app/assets/components/iron-icons/hero.svg +35 -0
- data/app/assets/components/iron-icons/image-icons.html +164 -0
- data/app/assets/components/iron-icons/iron-icons.html +303 -0
- data/app/assets/components/iron-icons/maps-icons.html +71 -0
- data/app/assets/components/iron-icons/notification-icons.html +62 -0
- data/app/assets/components/iron-icons/social-icons.html +40 -0
- data/app/assets/components/iron-iconset-svg/iron-iconset-svg.html +191 -0
- data/app/assets/components/iron-input/hero.svg +19 -0
- data/app/assets/components/iron-input/iron-input.html +235 -0
- data/app/assets/components/iron-media-query/hero.svg +29 -0
- data/app/assets/components/iron-media-query/iron-media-query.html +84 -0
- data/app/assets/components/iron-menu-behavior/iron-menu-behavior.html +214 -0
- data/app/assets/components/iron-menu-behavior/iron-menubar-behavior.html +65 -0
- data/app/assets/components/iron-meta/hero.svg +33 -0
- data/app/assets/components/iron-meta/iron-meta.html +352 -0
- data/app/assets/components/iron-overlay-behavior/iron-overlay-backdrop.html +132 -0
- data/app/assets/components/iron-overlay-behavior/iron-overlay-behavior.html +432 -0
- data/app/assets/components/iron-overlay-behavior/iron-overlay-manager.html +107 -0
- data/app/assets/components/iron-range-behavior/iron-range-behavior.html +101 -0
- data/app/assets/components/iron-resizable-behavior/iron-resizable-behavior.html +139 -0
- data/app/assets/components/iron-selector/iron-multi-selectable.html +120 -0
- data/app/assets/components/iron-selector/iron-selectable.html +307 -0
- data/app/assets/components/iron-selector/iron-selection.html +115 -0
- data/app/assets/components/iron-selector/iron-selector.html +71 -0
- data/app/assets/components/iron-validatable-behavior/iron-validatable-behavior.html +100 -0
- data/app/assets/components/neon-animation/animations/cascaded-animation.html +84 -0
- data/app/assets/components/neon-animation/animations/fade-in-animation.html +49 -0
- data/app/assets/components/neon-animation/animations/fade-out-animation.html +49 -0
- data/app/assets/components/neon-animation/animations/hero-animation.html +83 -0
- data/app/assets/components/neon-animation/animations/opaque-animation.html +46 -0
- data/app/assets/components/neon-animation/animations/ripple-animation.html +92 -0
- data/app/assets/components/neon-animation/animations/scale-down-animation.html +65 -0
- data/app/assets/components/neon-animation/animations/scale-up-animation.html +58 -0
- data/app/assets/components/neon-animation/animations/slide-down-animation.html +59 -0
- data/app/assets/components/neon-animation/animations/slide-from-left-animation.html +60 -0
- data/app/assets/components/neon-animation/animations/slide-from-right-animation.html +60 -0
- data/app/assets/components/neon-animation/animations/slide-left-animation.html +59 -0
- data/app/assets/components/neon-animation/animations/slide-right-animation.html +59 -0
- data/app/assets/components/neon-animation/animations/slide-up-animation.html +59 -0
- data/app/assets/components/neon-animation/animations/transform-animation.html +61 -0
- data/app/assets/components/neon-animation/guides/neon-animation.md +313 -0
- data/app/assets/components/neon-animation/neon-animatable-behavior.html +156 -0
- data/app/assets/components/neon-animation/neon-animatable.html +54 -0
- data/app/assets/components/neon-animation/neon-animated-pages.html +208 -0
- data/app/assets/components/neon-animation/neon-animation-behavior.html +88 -0
- data/app/assets/components/neon-animation/neon-animation-runner-behavior.html +110 -0
- data/app/assets/components/neon-animation/neon-animation.html +17 -0
- data/app/assets/components/neon-animation/neon-animations.html +25 -0
- data/app/assets/components/neon-animation/neon-shared-element-animatable-behavior.html +37 -0
- data/app/assets/components/neon-animation/neon-shared-element-animation-behavior.html +66 -0
- data/app/assets/components/neon-animation/web-animations.html +11 -0
- data/app/assets/components/paper-behaviors/paper-button-behavior.html +55 -0
- data/app/assets/components/paper-behaviors/paper-inky-focus-behavior.html +44 -0
- data/app/assets/components/paper-button/paper-button.html +177 -0
- data/app/assets/components/paper-checkbox/metadata.html +17 -0
- data/app/assets/components/paper-checkbox/paper-checkbox.css +149 -0
- data/app/assets/components/paper-checkbox/paper-checkbox.html +163 -0
- data/app/assets/components/paper-dialog-behavior/hero.svg +51 -0
- data/app/assets/components/paper-dialog-behavior/paper-dialog-behavior.html +236 -0
- data/app/assets/components/paper-dialog-behavior/paper-dialog-common.css +58 -0
- data/app/assets/components/paper-dialog-scrollable/hero.svg +69 -0
- data/app/assets/components/paper-dialog-scrollable/paper-dialog-scrollable.html +150 -0
- data/app/assets/components/paper-dialog/hero.svg +58 -0
- data/app/assets/components/paper-dialog/paper-dialog.html +122 -0
- data/app/assets/components/paper-drawer-panel/hero.svg +21 -0
- data/app/assets/components/paper-drawer-panel/paper-drawer-panel.css +142 -0
- data/app/assets/components/paper-drawer-panel/paper-drawer-panel.html +585 -0
- data/app/assets/components/paper-fab/paper-fab.html +159 -0
- data/app/assets/components/paper-header-panel/hero.svg +38 -0
- data/app/assets/components/paper-header-panel/paper-header-panel.html +496 -0
- data/app/assets/components/paper-icon-button/paper-icon-button.html +141 -0
- data/app/assets/components/paper-input/all-imports.html +12 -0
- data/app/assets/components/paper-input/hero.svg +19 -0
- data/app/assets/components/paper-input/paper-input-addon-behavior.html +43 -0
- data/app/assets/components/paper-input/paper-input-behavior.html +293 -0
- data/app/assets/components/paper-input/paper-input-char-counter.html +95 -0
- data/app/assets/components/paper-input/paper-input-container.html +495 -0
- data/app/assets/components/paper-input/paper-input-error.html +99 -0
- data/app/assets/components/paper-input/paper-input.html +126 -0
- data/app/assets/components/paper-input/paper-textarea.html +100 -0
- data/app/assets/components/paper-item/all-imports.html +13 -0
- data/app/assets/components/paper-item/paper-icon-item.html +86 -0
- data/app/assets/components/paper-item/paper-item-body.html +93 -0
- data/app/assets/components/paper-item/paper-item-shared.css +19 -0
- data/app/assets/components/paper-item/paper-item.html +95 -0
- data/app/assets/components/paper-material/paper-material.html +98 -0
- data/app/assets/components/paper-menu/hero.svg +35 -0
- data/app/assets/components/paper-menu/paper-menu.html +133 -0
- data/app/assets/components/paper-progress/hero.svg +21 -0
- data/app/assets/components/paper-progress/paper-progress.html +199 -0
- data/app/assets/components/paper-radio-button/hero.svg +22 -0
- data/app/assets/components/paper-radio-button/paper-radio-button.css +109 -0
- data/app/assets/components/paper-radio-button/paper-radio-button.html +148 -0
- data/app/assets/components/paper-radio-group/hero.svg +25 -0
- data/app/assets/components/paper-radio-group/paper-radio-group.html +186 -0
- data/app/assets/components/paper-ripple/hero.svg +30 -0
- data/app/assets/components/paper-ripple/paper-ripple.html +714 -0
- data/app/assets/components/paper-scroll-header-panel/hero.svg +41 -0
- data/app/assets/components/paper-scroll-header-panel/paper-scroll-header-panel.html +455 -0
- data/app/assets/components/paper-slider/hero.svg +20 -0
- data/app/assets/components/paper-slider/paper-slider.css +252 -0
- data/app/assets/components/paper-slider/paper-slider.html +449 -0
- data/app/assets/components/paper-spinner/hero.svg +27 -0
- data/app/assets/components/paper-spinner/paper-spinner.css +325 -0
- data/app/assets/components/paper-spinner/paper-spinner.html +222 -0
- data/app/assets/components/paper-styles/classes/global.html +96 -0
- data/app/assets/components/paper-styles/classes/shadow-layout.html +302 -0
- data/app/assets/components/paper-styles/classes/shadow.html +39 -0
- data/app/assets/components/paper-styles/classes/typography.html +171 -0
- data/app/assets/components/paper-styles/color.html +333 -0
- data/app/assets/components/paper-styles/default-theme.html +39 -0
- data/app/assets/components/paper-styles/paper-styles-classes.html +14 -0
- data/app/assets/components/paper-styles/paper-styles.html +17 -0
- data/app/assets/components/paper-styles/shadow.html +61 -0
- data/app/assets/components/paper-styles/typography.html +240 -0
- data/app/assets/components/paper-tabs/hero.svg +23 -0
- data/app/assets/components/paper-tabs/paper-tab.html +158 -0
- data/app/assets/components/paper-tabs/paper-tabs-icons.html +18 -0
- data/app/assets/components/paper-tabs/paper-tabs.html +483 -0
- data/app/assets/components/paper-toast/hero.svg +20 -0
- data/app/assets/components/paper-toast/paper-toast.html +164 -0
- data/app/assets/components/paper-toggle-button/hero.svg +22 -0
- data/app/assets/components/paper-toggle-button/paper-toggle-button.css +108 -0
- data/app/assets/components/paper-toggle-button/paper-toggle-button.html +183 -0
- data/app/assets/components/paper-toolbar/paper-toolbar.html +375 -0
- data/app/assets/components/polymer-gestures/Gruntfile.js +60 -0
- data/app/assets/components/polymer-gestures/banner.txt +9 -0
- data/app/assets/components/polymer-gestures/build.json +17 -0
- data/app/assets/components/polymer-gestures/conf/karma.conf.js +39 -0
- data/app/assets/components/polymer-gestures/package.json +20 -0
- data/app/assets/components/polymer-gestures/polymer-gestures.html +21 -0
- data/app/assets/components/polymer-gestures/polymer-gestures.js +46 -0
- data/app/assets/components/polymer-gestures/src/dispatcher.js +474 -0
- data/app/assets/components/polymer-gestures/src/eventFactory.js +127 -0
- data/app/assets/components/polymer-gestures/src/hold.js +129 -0
- data/app/assets/components/polymer-gestures/src/mouse.js +135 -0
- data/app/assets/components/polymer-gestures/src/ms.js +80 -0
- data/app/assets/components/polymer-gestures/src/pinch.js +186 -0
- data/app/assets/components/polymer-gestures/src/platform-events.js +39 -0
- data/app/assets/components/polymer-gestures/src/pointer.js +68 -0
- data/app/assets/components/polymer-gestures/src/pointermap.js +67 -0
- data/app/assets/components/polymer-gestures/src/scope.js +10 -0
- data/app/assets/components/polymer-gestures/src/tap.js +103 -0
- data/app/assets/components/polymer-gestures/src/targetfind.js +244 -0
- data/app/assets/components/polymer-gestures/src/touch-action.js +60 -0
- data/app/assets/components/polymer-gestures/src/touch.js +341 -0
- data/app/assets/components/polymer-gestures/src/track.js +230 -0
- data/app/assets/components/web-animations-js/web-animations-next-lite.min.js +17 -0
- data/app/assets/components/web-animations-js/web-animations-next.min.js +17 -0
- data/app/assets/components/web-animations-js/web-animations.min.js +17 -0
- data/app/assets/components/webcomponentsjs/CustomElements.js +956 -0
- data/app/assets/components/webcomponentsjs/CustomElements.min.js +11 -0
- data/app/assets/components/webcomponentsjs/HTMLImports.js +1078 -0
- data/app/assets/components/webcomponentsjs/HTMLImports.min.js +11 -0
- data/app/assets/components/webcomponentsjs/MutationObserver.js +344 -0
- data/app/assets/components/webcomponentsjs/MutationObserver.min.js +11 -0
- data/app/assets/components/webcomponentsjs/ShadowDOM.js +4414 -0
- data/app/assets/components/webcomponentsjs/ShadowDOM.min.js +15 -0
- data/app/assets/components/webcomponentsjs/package.json +31 -0
- data/app/assets/components/webcomponentsjs/webcomponents-lite.js +2300 -0
- data/app/assets/components/webcomponentsjs/webcomponents-lite.min.js +13 -0
- data/app/assets/components/webcomponentsjs/webcomponents.js +7112 -0
- data/app/assets/components/webcomponentsjs/webcomponents.min.js +15 -0
- data/lib/polymer-paper-elements-rails.rb +2 -0
- data/lib/polymer-paper-elements-rails/engine.rb +4 -0
- data/lib/polymer-paper-elements-rails/version.rb +3 -0
- metadata +272 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<!-- Generator: Adobe Illustrator 17.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
|
3
|
+
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
|
4
|
+
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
|
5
|
+
viewBox="0 0 225 126" enable-background="new 0 0 225 126" xml:space="preserve">
|
|
6
|
+
<g id="background" display="none">
|
|
7
|
+
<rect display="inline" fill="#B0BEC5" width="225" height="126"/>
|
|
8
|
+
</g>
|
|
9
|
+
<g id="label">
|
|
10
|
+
</g>
|
|
11
|
+
<g id="art">
|
|
12
|
+
<g>
|
|
13
|
+
<circle cx="112.5" cy="63" r="8"/>
|
|
14
|
+
<path d="M112.5,80c-9.4,0-17-7.6-17-17s7.6-17,17-17s17,7.6,17,17S121.9,80,112.5,80z M112.5,48c-8.3,0-15,6.7-15,15s6.7,15,15,15
|
|
15
|
+
s15-6.7,15-15S120.8,48,112.5,48z"/>
|
|
16
|
+
</g>
|
|
17
|
+
<g id="ic_x5F_add_x0D_">
|
|
18
|
+
</g>
|
|
19
|
+
</g>
|
|
20
|
+
<g id="Guides">
|
|
21
|
+
</g>
|
|
22
|
+
</svg>
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
|
|
3
|
+
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
|
|
4
|
+
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
|
|
5
|
+
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
|
|
6
|
+
Code distributed by Google as part of the polymer project is also
|
|
7
|
+
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
:host {
|
|
11
|
+
display: inline-block;
|
|
12
|
+
white-space: nowrap;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
:host(:focus) {
|
|
16
|
+
outline: none;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
#radioContainer {
|
|
20
|
+
display: inline-block;
|
|
21
|
+
position: relative;
|
|
22
|
+
width: 16px;
|
|
23
|
+
height: 16px;
|
|
24
|
+
cursor: pointer;
|
|
25
|
+
vertical-align: middle;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
:host #ink {
|
|
29
|
+
position: absolute;
|
|
30
|
+
top: -16px;
|
|
31
|
+
left: -16px;
|
|
32
|
+
width: 48px;
|
|
33
|
+
height: 48px;
|
|
34
|
+
color: var(--paper-radio-button-unchecked-ink-color);
|
|
35
|
+
opacity: 0.6;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
:host #ink[checked] {
|
|
39
|
+
color: var(--paper-radio-button-checked-ink-color);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
:host #offRadio {
|
|
43
|
+
position: absolute;
|
|
44
|
+
top: 0px;
|
|
45
|
+
left: 0px;
|
|
46
|
+
width: 12px;
|
|
47
|
+
height: 12px;
|
|
48
|
+
border-radius: 50%;
|
|
49
|
+
border: solid 2px;
|
|
50
|
+
border-color: var(--paper-radio-button-unchecked-color);
|
|
51
|
+
transition: border-color 0.28s;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
:host #onRadio {
|
|
55
|
+
position: absolute;
|
|
56
|
+
top: 4px;
|
|
57
|
+
left: 4px;
|
|
58
|
+
width: 8px;
|
|
59
|
+
height: 8px;
|
|
60
|
+
border-radius: 50%;
|
|
61
|
+
background-color: var(--paper-radio-button-checked-color);
|
|
62
|
+
-webkit-transform: scale(0);
|
|
63
|
+
transform: scale(0);
|
|
64
|
+
transition: -webkit-transform ease 0.28s;
|
|
65
|
+
transition: transform ease 0.28s;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
:host([checked]) #offRadio {
|
|
69
|
+
border-color: var(--paper-radio-button-checked-color);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
:host([checked]) #onRadio {
|
|
73
|
+
-webkit-transform: scale(1);
|
|
74
|
+
transform: scale(1);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
#radioLabel {
|
|
78
|
+
position: relative;
|
|
79
|
+
display: inline-block;
|
|
80
|
+
vertical-align: middle;
|
|
81
|
+
margin-left: 10px;
|
|
82
|
+
white-space: normal;
|
|
83
|
+
pointer-events: none;
|
|
84
|
+
color: var(--paper-radio-button-label-color);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
#radioLabel[hidden] {
|
|
88
|
+
display: none;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/* disabled state */
|
|
92
|
+
:host([disabled]) {
|
|
93
|
+
pointer-events: none;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
:host([disabled]) #offRadio {
|
|
97
|
+
border-color: var(--paper-radio-button-unchecked-color);
|
|
98
|
+
opacity: 0.5;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
:host([disabled][checked]) #onRadio {
|
|
102
|
+
background-color: var(--paper-radio-button-unchecked-color);
|
|
103
|
+
opacity: 0.5;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
:host([disabled]) #radioLabel {
|
|
107
|
+
/* slightly darker than the button, so that it's readable */
|
|
108
|
+
opacity: 0.65;
|
|
109
|
+
}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
|
|
3
|
+
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
|
|
4
|
+
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
|
|
5
|
+
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
|
|
6
|
+
Code distributed by Google as part of the polymer project is also
|
|
7
|
+
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
|
|
8
|
+
-->
|
|
9
|
+
|
|
10
|
+
<link rel="import" href="../polymer/polymer.html">
|
|
11
|
+
<link rel="import" href="../paper-ripple/paper-ripple.html">
|
|
12
|
+
<link rel="import" href="../paper-styles/default-theme.html">
|
|
13
|
+
<link rel="import" href="../paper-behaviors/paper-inky-focus-behavior.html">
|
|
14
|
+
|
|
15
|
+
<!--
|
|
16
|
+
`paper-radio-button` is a button that can be either checked or unchecked.
|
|
17
|
+
User can tap the radio button to check it. But it cannot be unchecked by
|
|
18
|
+
tapping once checked.
|
|
19
|
+
|
|
20
|
+
Use `paper-radio-group` to group a set of radio buttons. When radio buttons
|
|
21
|
+
are inside a radio group, only one radio button in the group can be checked.
|
|
22
|
+
|
|
23
|
+
Example:
|
|
24
|
+
|
|
25
|
+
<paper-radio-button></paper-radio-button>
|
|
26
|
+
|
|
27
|
+
### Styling
|
|
28
|
+
|
|
29
|
+
The following custom properties and mixins are available for styling:
|
|
30
|
+
|
|
31
|
+
Custom property | Description | Default
|
|
32
|
+
----------------|-------------|----------
|
|
33
|
+
`--paper-radio-button-unchecked-color` | Radio button color when the input is not checked | `--primary-text-color`
|
|
34
|
+
`--paper-radio-button-unchecked-ink-color` | Selected/focus ripple color when the input is not checked | `--primary-text-color`
|
|
35
|
+
`--paper-radio-button-checked-color` | Radio button color when the input is checked | `--default-primary-color`
|
|
36
|
+
`--paper-radio-button-checked-ink-color` | Selected/focus ripple color when the input is checked | `--default-primary-color`
|
|
37
|
+
`--paper-radio-button-label-color` | Label color | `--primary-text-color`
|
|
38
|
+
|
|
39
|
+
@group Paper Elements
|
|
40
|
+
@element paper-radio-button
|
|
41
|
+
@hero hero.svg
|
|
42
|
+
@demo demo/index.html
|
|
43
|
+
-->
|
|
44
|
+
|
|
45
|
+
<style is="custom-style">
|
|
46
|
+
:root {
|
|
47
|
+
--paper-radio-button-unchecked-color: var(--primary-text-color);
|
|
48
|
+
--paper-radio-button-unchecked-ink-color: var(--primary-text-color);
|
|
49
|
+
|
|
50
|
+
--paper-radio-button-checked-color: var(--default-primary-color);
|
|
51
|
+
--paper-radio-button-checked-ink-color: var(--default-primary-color);
|
|
52
|
+
|
|
53
|
+
--paper-radio-button-label-color: var(--primary-text-color);
|
|
54
|
+
}
|
|
55
|
+
</style>
|
|
56
|
+
|
|
57
|
+
<dom-module id="paper-radio-button">
|
|
58
|
+
|
|
59
|
+
<link rel="import" type="css" href="paper-radio-button.css">
|
|
60
|
+
|
|
61
|
+
<template>
|
|
62
|
+
|
|
63
|
+
<div id="radioContainer">
|
|
64
|
+
<div id="offRadio"></div>
|
|
65
|
+
<div id="onRadio"></div>
|
|
66
|
+
<paper-ripple id="ink" class="circle" center checked$="[[checked]]"></paper-ripple>
|
|
67
|
+
</div>
|
|
68
|
+
|
|
69
|
+
<div id="radioLabel" aria-hidden="true"><content></content></div>
|
|
70
|
+
|
|
71
|
+
</template>
|
|
72
|
+
|
|
73
|
+
<script>
|
|
74
|
+
Polymer({
|
|
75
|
+
is: 'paper-radio-button',
|
|
76
|
+
|
|
77
|
+
behaviors: [
|
|
78
|
+
Polymer.PaperInkyFocusBehavior
|
|
79
|
+
],
|
|
80
|
+
|
|
81
|
+
hostAttributes: {
|
|
82
|
+
role: 'radio',
|
|
83
|
+
'aria-checked': false,
|
|
84
|
+
tabindex: 0
|
|
85
|
+
},
|
|
86
|
+
|
|
87
|
+
properties: {
|
|
88
|
+
/**
|
|
89
|
+
* Fired when the checked state changes due to user interaction.
|
|
90
|
+
*
|
|
91
|
+
* @event change
|
|
92
|
+
*/
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Fired when the checked state changes.
|
|
96
|
+
*
|
|
97
|
+
* @event iron-change
|
|
98
|
+
*/
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Gets or sets the state, `true` is checked and `false` is unchecked.
|
|
102
|
+
*/
|
|
103
|
+
checked: {
|
|
104
|
+
type: Boolean,
|
|
105
|
+
value: false,
|
|
106
|
+
reflectToAttribute: true,
|
|
107
|
+
notify: true,
|
|
108
|
+
observer: '_checkedChanged'
|
|
109
|
+
},
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* If true, the button toggles the active state with each tap or press
|
|
113
|
+
* of the spacebar.
|
|
114
|
+
*/
|
|
115
|
+
toggles: {
|
|
116
|
+
type: Boolean,
|
|
117
|
+
value: true,
|
|
118
|
+
reflectToAttribute: true
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
|
|
122
|
+
ready: function() {
|
|
123
|
+
if (Polymer.dom(this).textContent == '') {
|
|
124
|
+
this.$.radioLabel.hidden = true;
|
|
125
|
+
} else {
|
|
126
|
+
this.setAttribute('aria-label', Polymer.dom(this).textContent);
|
|
127
|
+
}
|
|
128
|
+
this._isReady = true;
|
|
129
|
+
},
|
|
130
|
+
|
|
131
|
+
_buttonStateChanged: function() {
|
|
132
|
+
if (this.disabled) {
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
if (this._isReady) {
|
|
136
|
+
this.checked = this.active;
|
|
137
|
+
}
|
|
138
|
+
},
|
|
139
|
+
|
|
140
|
+
_checkedChanged: function() {
|
|
141
|
+
this.setAttribute('aria-checked', this.checked ? 'true' : 'false');
|
|
142
|
+
this.active = this.checked;
|
|
143
|
+
this.fire('iron-change');
|
|
144
|
+
}
|
|
145
|
+
})
|
|
146
|
+
</script>
|
|
147
|
+
|
|
148
|
+
</dom-module>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<!-- Generator: Adobe Illustrator 17.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
|
3
|
+
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
|
4
|
+
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
|
5
|
+
viewBox="0 0 225 126" enable-background="new 0 0 225 126" xml:space="preserve">
|
|
6
|
+
<g id="background" display="none">
|
|
7
|
+
<rect display="inline" fill="#B0BEC5" width="225" height="126"/>
|
|
8
|
+
</g>
|
|
9
|
+
<g id="label">
|
|
10
|
+
</g>
|
|
11
|
+
<g id="art">
|
|
12
|
+
<g>
|
|
13
|
+
<circle cx="112.5" cy="41" r="8"/>
|
|
14
|
+
<path d="M112.5,58c-9.4,0-17-7.6-17-17s7.6-17,17-17s17,7.6,17,17S121.9,58,112.5,58z M112.5,26c-8.3,0-15,6.7-15,15s6.7,15,15,15
|
|
15
|
+
s15-6.7,15-15S120.8,26,112.5,26z"/>
|
|
16
|
+
<circle cx="112.5" cy="85" r="8"/>
|
|
17
|
+
<path d="M112.5,102c-9.4,0-17-7.6-17-17s7.6-17,17-17s17,7.6,17,17S121.9,102,112.5,102z M112.5,70c-8.3,0-15,6.7-15,15
|
|
18
|
+
s6.7,15,15,15s15-6.7,15-15S120.8,70,112.5,70z"/>
|
|
19
|
+
</g>
|
|
20
|
+
<g id="ic_x5F_add_x0D_">
|
|
21
|
+
</g>
|
|
22
|
+
</g>
|
|
23
|
+
<g id="Guides">
|
|
24
|
+
</g>
|
|
25
|
+
</svg>
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
@license
|
|
3
|
+
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
|
|
4
|
+
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.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/CONTRIBUTORS.txt
|
|
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/PATENTS.txt
|
|
9
|
+
-->
|
|
10
|
+
|
|
11
|
+
<link rel="import" href="../polymer/polymer.html">
|
|
12
|
+
<link rel="import" href="../iron-selector/iron-selector.html">
|
|
13
|
+
<link rel="import" href="../paper-radio-button/paper-radio-button.html">
|
|
14
|
+
<link rel="import" href="../iron-a11y-keys-behavior/iron-a11y-keys-behavior.html">
|
|
15
|
+
|
|
16
|
+
<!--
|
|
17
|
+
`paper-radio-group` allows user to select only one radio button from a set.
|
|
18
|
+
Checking one radio button that belongs to a radio group unchecks any
|
|
19
|
+
previously checked radio button within the same group. Use
|
|
20
|
+
`selected` to get or set the selected radio button.
|
|
21
|
+
|
|
22
|
+
Example:
|
|
23
|
+
|
|
24
|
+
<paper-radio-group selected="small">
|
|
25
|
+
<paper-radio-button name="small" label="Small"></paper-radio-button>
|
|
26
|
+
<paper-radio-button name="medium" label="Medium"></paper-radio-button>
|
|
27
|
+
<paper-radio-button name="large" label="Large"></paper-radio-button>
|
|
28
|
+
</paper-radio-group>
|
|
29
|
+
|
|
30
|
+
See <a href="paper-radio-button.html">paper-radio-button</a> for more
|
|
31
|
+
information about `paper-radio-button`.
|
|
32
|
+
|
|
33
|
+
@group Paper Elements
|
|
34
|
+
@element paper-radio-group
|
|
35
|
+
@hero hero.svg
|
|
36
|
+
@demo demo/index.html
|
|
37
|
+
-->
|
|
38
|
+
|
|
39
|
+
<dom-module name="paper-radio-group">
|
|
40
|
+
<style>
|
|
41
|
+
:host {
|
|
42
|
+
display: inline-block;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
iron-selector ::content > * {
|
|
46
|
+
padding: 12px;
|
|
47
|
+
}
|
|
48
|
+
</style>
|
|
49
|
+
|
|
50
|
+
<template>
|
|
51
|
+
<iron-selector selected="{{selected}}" attr-for-selected="name"
|
|
52
|
+
selectable="paper-radio-button">
|
|
53
|
+
<content id="items" select="*"></content>
|
|
54
|
+
</iron-selector>
|
|
55
|
+
</template>
|
|
56
|
+
|
|
57
|
+
</dom-module>
|
|
58
|
+
|
|
59
|
+
<script>
|
|
60
|
+
Polymer({
|
|
61
|
+
is: 'paper-radio-group',
|
|
62
|
+
|
|
63
|
+
behaviors: [
|
|
64
|
+
Polymer.IronA11yKeysBehavior
|
|
65
|
+
],
|
|
66
|
+
|
|
67
|
+
hostAttributes: {
|
|
68
|
+
role: 'radiogroup',
|
|
69
|
+
tabindex: 0
|
|
70
|
+
},
|
|
71
|
+
|
|
72
|
+
properties: {
|
|
73
|
+
/**
|
|
74
|
+
* Fired when the selected element changes to user interaction.
|
|
75
|
+
*
|
|
76
|
+
* @event paper-radio-group-changed
|
|
77
|
+
*/
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Gets or sets the selected element. Use the `name` attribute of the
|
|
81
|
+
* <paper-radio-button> that should be selected.
|
|
82
|
+
*
|
|
83
|
+
* @attribute selected
|
|
84
|
+
* @type String
|
|
85
|
+
* @default null
|
|
86
|
+
*/
|
|
87
|
+
|
|
88
|
+
selected: {
|
|
89
|
+
type: String,
|
|
90
|
+
value: null,
|
|
91
|
+
notify: true,
|
|
92
|
+
reflectToAttribute: true,
|
|
93
|
+
observer: "_selectedChanged"
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
|
|
97
|
+
keyBindings: {
|
|
98
|
+
'left up': '_selectPrevious',
|
|
99
|
+
'right down': '_selectNext',
|
|
100
|
+
},
|
|
101
|
+
|
|
102
|
+
_selectedChanged: function() {
|
|
103
|
+
// TODO: This only needs to be async while a domReady event is unavailable.
|
|
104
|
+
this.async(function() {
|
|
105
|
+
this._selectIndex(this._valueToIndex(this.items, this.selected));
|
|
106
|
+
this.fire('paper-radio-group-changed');
|
|
107
|
+
});
|
|
108
|
+
},
|
|
109
|
+
|
|
110
|
+
_selectNext: function() {
|
|
111
|
+
this.selected = this._nextNode();
|
|
112
|
+
},
|
|
113
|
+
|
|
114
|
+
_selectPrevious: function() {
|
|
115
|
+
this.selected = this._previousNode();
|
|
116
|
+
},
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Returns an array of all items.
|
|
120
|
+
*
|
|
121
|
+
* @property items
|
|
122
|
+
* @type array
|
|
123
|
+
*/
|
|
124
|
+
get items() {
|
|
125
|
+
return Polymer.dom(this.$.items).getDistributedNodes();
|
|
126
|
+
},
|
|
127
|
+
|
|
128
|
+
_nextNode: function() {
|
|
129
|
+
var items = this.items;
|
|
130
|
+
var index = this._selectedIndex;
|
|
131
|
+
var newIndex = index;
|
|
132
|
+
do {
|
|
133
|
+
newIndex = (newIndex + 1) % items.length;
|
|
134
|
+
if (newIndex === index) {
|
|
135
|
+
break;
|
|
136
|
+
}
|
|
137
|
+
} while (items[newIndex].disabled);
|
|
138
|
+
return this._valueForNode(items[newIndex]);
|
|
139
|
+
},
|
|
140
|
+
|
|
141
|
+
_previousNode: function() {
|
|
142
|
+
var items = this.items;
|
|
143
|
+
var index = this._selectedIndex;
|
|
144
|
+
var newIndex = index;
|
|
145
|
+
do {
|
|
146
|
+
newIndex = (newIndex || items.length) - 1;
|
|
147
|
+
if (newIndex === index) {
|
|
148
|
+
break;
|
|
149
|
+
}
|
|
150
|
+
} while (items[newIndex].disabled);
|
|
151
|
+
return this._valueForNode(items[newIndex]);
|
|
152
|
+
},
|
|
153
|
+
|
|
154
|
+
_selectIndex: function(index) {
|
|
155
|
+
if (index == this._selectedIndex)
|
|
156
|
+
return;
|
|
157
|
+
|
|
158
|
+
var nodes = this.items;
|
|
159
|
+
|
|
160
|
+
// If there was a previously selected node, deselect it.
|
|
161
|
+
if (nodes[this._selectedIndex]) {
|
|
162
|
+
nodes[this._selectedIndex].checked = false;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
// Select a new node.
|
|
166
|
+
nodes[index].checked = true;
|
|
167
|
+
nodes[index].focus();
|
|
168
|
+
this._selectedIndex = index;
|
|
169
|
+
},
|
|
170
|
+
|
|
171
|
+
_valueForNode: function(node) {
|
|
172
|
+
return node["name"] || node.getAttribute("name");
|
|
173
|
+
},
|
|
174
|
+
|
|
175
|
+
// Finds an item with value == |value| and return its index.
|
|
176
|
+
_valueToIndex: function(items, value) {
|
|
177
|
+
for (var index = 0, node; (node = items[index]); index++) {
|
|
178
|
+
if (this._valueForNode(node) == value) {
|
|
179
|
+
return index;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
// If no item found, the value itself is probably the index.
|
|
183
|
+
return value;
|
|
184
|
+
}
|
|
185
|
+
});
|
|
186
|
+
</script>
|