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,141 @@
|
|
|
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
|
|
5
|
+
The complete set of authors may be found at http://polymer.github.io/AUTHORS
|
|
6
|
+
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS
|
|
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
|
|
9
|
+
-->
|
|
10
|
+
|
|
11
|
+
<link rel="import" href="../polymer/polymer.html">
|
|
12
|
+
<link rel="import" href="../iron-icon/iron-icon.html">
|
|
13
|
+
<link rel="import" href="../iron-flex-layout/iron-flex-layout.html">
|
|
14
|
+
<link rel="import" href="../paper-styles/default-theme.html">
|
|
15
|
+
<link rel="import" href="../paper-behaviors/paper-button-behavior.html">
|
|
16
|
+
<link rel="import" href="../paper-behaviors/paper-inky-focus-behavior.html">
|
|
17
|
+
<link rel="import" href="../paper-ripple/paper-ripple.html">
|
|
18
|
+
|
|
19
|
+
<style is="custom-style">
|
|
20
|
+
:root {
|
|
21
|
+
--paper-icon-button-disabled-text: var(--disabled-text-color);
|
|
22
|
+
}
|
|
23
|
+
</style>
|
|
24
|
+
|
|
25
|
+
<!--
|
|
26
|
+
Material Design: <a href="http://www.google.com/design/spec/components/buttons.html">Buttons</a>
|
|
27
|
+
|
|
28
|
+
`paper-icon-button` is a button with an image placed at the center. When the user touches
|
|
29
|
+
the button, a ripple effect emanates from the center of the button.
|
|
30
|
+
|
|
31
|
+
`paper-icon-button` includes a default icon set. Use `icon` to specify which icon
|
|
32
|
+
from the icon set to use.
|
|
33
|
+
|
|
34
|
+
<paper-icon-button icon="menu"></paper-icon-button>
|
|
35
|
+
|
|
36
|
+
See [`iron-iconset`](#iron-iconset) for more information about
|
|
37
|
+
how to use a custom icon set.
|
|
38
|
+
|
|
39
|
+
Example:
|
|
40
|
+
|
|
41
|
+
<link href="path/to/iron-icons/iron-icons.html" rel="import">
|
|
42
|
+
|
|
43
|
+
<paper-icon-button icon="favorite"></paper-icon-button>
|
|
44
|
+
<paper-icon-button src="star.png"></paper-icon-button>
|
|
45
|
+
|
|
46
|
+
###Styling
|
|
47
|
+
|
|
48
|
+
Style the button with CSS as you would a normal DOM element. If you are using the icons
|
|
49
|
+
provided by `iron-icons`, they will inherit the foreground color of the button.
|
|
50
|
+
|
|
51
|
+
/* make a red "favorite" button */
|
|
52
|
+
<paper-icon-button icon="favorite" style="color: red;"></paper-icon-button>
|
|
53
|
+
|
|
54
|
+
By default, the ripple is the same color as the foreground at 25% opacity. You may
|
|
55
|
+
customize the color using this selector:
|
|
56
|
+
|
|
57
|
+
/* make #my-button use a blue ripple instead of foreground color */
|
|
58
|
+
#my-button::shadow #ripple {
|
|
59
|
+
color: blue;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
The opacity of the ripple is not customizable via CSS.
|
|
63
|
+
|
|
64
|
+
The following custom properties and mixins are available for styling:
|
|
65
|
+
|
|
66
|
+
Custom property | Description | Default
|
|
67
|
+
----------------|-------------|----------
|
|
68
|
+
`--paper-icon-button-disabled-text` | The color of the disabled button | `--primary-text-color`
|
|
69
|
+
`--paper-icon-button-ink-color` | Selected/focus ripple color | `--default-primary-color`
|
|
70
|
+
`--paper-icon-button` | Mixin for a button | `{}`
|
|
71
|
+
`--paper-icon-button-disabled` | Mixin for a disabled button | `{}`
|
|
72
|
+
|
|
73
|
+
@group Paper Elements
|
|
74
|
+
@element paper-icon-button
|
|
75
|
+
@demo demo/index.html
|
|
76
|
+
-->
|
|
77
|
+
|
|
78
|
+
<dom-module id="paper-icon-button">
|
|
79
|
+
<style>
|
|
80
|
+
|
|
81
|
+
:host {
|
|
82
|
+
display: inline-block;
|
|
83
|
+
position: relative;
|
|
84
|
+
padding: 8px;
|
|
85
|
+
outline: none;
|
|
86
|
+
-webkit-user-select: none;
|
|
87
|
+
-moz-user-select: none;
|
|
88
|
+
-ms-user-select: none;
|
|
89
|
+
user-select: none;
|
|
90
|
+
cursor: pointer;
|
|
91
|
+
z-index: 0;
|
|
92
|
+
|
|
93
|
+
@apply(--paper-icon-button);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
:host #ink {
|
|
97
|
+
color: var(--paper-icon-button-ink-color, --primary-text-color);
|
|
98
|
+
opacity: 0.6;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
:host([disabled]) {
|
|
102
|
+
color: var(--paper-icon-button-disabled-text, #fff);
|
|
103
|
+
pointer-events: none;
|
|
104
|
+
cursor: auto;
|
|
105
|
+
@apply(--paper-icon-button-disabled);
|
|
106
|
+
}
|
|
107
|
+
</style>
|
|
108
|
+
<template>
|
|
109
|
+
<paper-ripple id="ink" class="circle" center></paper-ripple>
|
|
110
|
+
<iron-icon id="icon" src="[[src]]" icon="[[icon]]"></iron-icon>
|
|
111
|
+
</template>
|
|
112
|
+
</dom-module>
|
|
113
|
+
<script>
|
|
114
|
+
Polymer({
|
|
115
|
+
is: 'paper-icon-button',
|
|
116
|
+
|
|
117
|
+
behaviors: [
|
|
118
|
+
Polymer.PaperButtonBehavior,
|
|
119
|
+
Polymer.PaperInkyFocusBehavior
|
|
120
|
+
],
|
|
121
|
+
|
|
122
|
+
properties: {
|
|
123
|
+
/**
|
|
124
|
+
* The URL of an image for the icon. If the src property is specified,
|
|
125
|
+
* the icon property should not be.
|
|
126
|
+
*/
|
|
127
|
+
src: {
|
|
128
|
+
type: String
|
|
129
|
+
},
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Specifies the icon name or index in the set of icons available in
|
|
133
|
+
* the icon's icon set. If the icon property is specified,
|
|
134
|
+
* the src property should not be.
|
|
135
|
+
*/
|
|
136
|
+
icon: {
|
|
137
|
+
type: String
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
</script>
|
|
@@ -0,0 +1,12 @@
|
|
|
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="paper-input.html">
|
|
12
|
+
<link rel="import" href="paper-textarea.html">
|
|
@@ -0,0 +1,19 @@
|
|
|
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
|
+
<rect x="49" y="53" width="2" height="18"/>
|
|
13
|
+
<path d="M188,78H37V44h151V78z M39,76h147V46H39V76z"/>
|
|
14
|
+
<g id="ic_x5F_add_x0D_">
|
|
15
|
+
</g>
|
|
16
|
+
</g>
|
|
17
|
+
<g id="Guides">
|
|
18
|
+
</g>
|
|
19
|
+
</svg>
|
|
@@ -0,0 +1,43 @@
|
|
|
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
|
+
|
|
13
|
+
<script>
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Use `Polymer.PaperInputAddonBehavior` to implement an add-on for `<paper-input-container>`. A
|
|
17
|
+
* add-on appears below the input, and may display information based on the input value and
|
|
18
|
+
* validity such as a character counter or an error message.
|
|
19
|
+
* @polymerBehavior
|
|
20
|
+
*/
|
|
21
|
+
Polymer.PaperInputAddonBehavior = {
|
|
22
|
+
|
|
23
|
+
hostAttributes: {
|
|
24
|
+
'add-on': ''
|
|
25
|
+
},
|
|
26
|
+
|
|
27
|
+
attached: function() {
|
|
28
|
+
this.fire('addon-attached');
|
|
29
|
+
},
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* The function called by `<paper-input-container>` when the input value or validity changes.
|
|
33
|
+
* @param {Object} state All properties are optional.
|
|
34
|
+
* @param {Node} state.inputElement The input element.
|
|
35
|
+
* @param {String} state.value The input value.
|
|
36
|
+
* @param {Boolean} state.invalid True if the input value is invalid.
|
|
37
|
+
*/
|
|
38
|
+
update: function(state) {
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
</script>
|
|
@@ -0,0 +1,293 @@
|
|
|
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
|
+
<link rel="import" href="../polymer/polymer.html">
|
|
11
|
+
|
|
12
|
+
<script>
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Use `Polymer.PaperInputBehavior` to implement inputs with `<paper-input-container>`. This
|
|
16
|
+
* behavior is implemented by `<paper-input>`. It exposes a number of properties from
|
|
17
|
+
* `<paper-input-container>` and `<input is="iron-input">` and they should be bound in your
|
|
18
|
+
* template.
|
|
19
|
+
*
|
|
20
|
+
* The input element can be accessed by the `inputElement` property if you need to access
|
|
21
|
+
* properties or methods that are not exposed.
|
|
22
|
+
* @polymerBehavior
|
|
23
|
+
*/
|
|
24
|
+
Polymer.PaperInputBehavior = {
|
|
25
|
+
|
|
26
|
+
properties: {
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* The label for this input. Bind this to `<paper-input-container>`'s `label` property.
|
|
30
|
+
*/
|
|
31
|
+
label: {
|
|
32
|
+
type: String
|
|
33
|
+
},
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* The value for this input. Bind this to the `<input is="iron-input">`'s `bindValue`
|
|
37
|
+
* property, or the value property of your input that is `notify:true`.
|
|
38
|
+
*/
|
|
39
|
+
value: {
|
|
40
|
+
notify: true,
|
|
41
|
+
type: String
|
|
42
|
+
},
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Set to true to disable this input. Bind this to both the `<paper-input-container>`'s
|
|
46
|
+
* and the input's `disabled` property.
|
|
47
|
+
*/
|
|
48
|
+
disabled: {
|
|
49
|
+
type: Boolean,
|
|
50
|
+
value: false
|
|
51
|
+
},
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Returns true if the value is invalid. Bind this to both the `<paper-input-container>`'s
|
|
55
|
+
* and the input's `invalid` property.
|
|
56
|
+
*/
|
|
57
|
+
invalid: {
|
|
58
|
+
type: Boolean,
|
|
59
|
+
value: false
|
|
60
|
+
},
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Set to true to prevent the user from entering invalid input. Bind this to the
|
|
64
|
+
* `<input is="iron-input">`'s `preventInvalidInput` property.
|
|
65
|
+
*/
|
|
66
|
+
preventInvalidInput: {
|
|
67
|
+
type: Boolean
|
|
68
|
+
},
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Set this to specify the pattern allowed by `preventInvalidInput`. Bind this to the
|
|
72
|
+
* `<input is="iron-input">`'s `allowedPattern` property.
|
|
73
|
+
*/
|
|
74
|
+
allowedPattern: {
|
|
75
|
+
type: String
|
|
76
|
+
},
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* The type of the input. The supported types are `text`, `number` and `password`. Bind this
|
|
80
|
+
* to the `<input is="iron-input">`'s `type` property.
|
|
81
|
+
*/
|
|
82
|
+
type: {
|
|
83
|
+
type: String
|
|
84
|
+
},
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* A pattern to validate the `input` with. Bind this to the `<input is="iron-input">`'s
|
|
88
|
+
* `pattern` property.
|
|
89
|
+
*/
|
|
90
|
+
pattern: {
|
|
91
|
+
type: String
|
|
92
|
+
},
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Set to true to mark the input as required. Bind this to the `<input is="iron-input">`'s
|
|
96
|
+
* `required` property.
|
|
97
|
+
*/
|
|
98
|
+
required: {
|
|
99
|
+
type: Boolean,
|
|
100
|
+
value: false
|
|
101
|
+
},
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* The maximum length of the input value. Bind this to the `<input is="iron-input">`'s
|
|
105
|
+
* `maxlength` property.
|
|
106
|
+
*/
|
|
107
|
+
maxlength: {
|
|
108
|
+
type: Number
|
|
109
|
+
},
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* The error message to display when the input is invalid. Bind this to the
|
|
113
|
+
* `<paper-input-error>`'s content, if using.
|
|
114
|
+
*/
|
|
115
|
+
errorMessage: {
|
|
116
|
+
type: String
|
|
117
|
+
},
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Set to true to show a character counter.
|
|
121
|
+
*/
|
|
122
|
+
charCounter: {
|
|
123
|
+
type: Boolean,
|
|
124
|
+
value: false
|
|
125
|
+
},
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Set to true to disable the floating label. Bind this to the `<paper-input-container>`'s
|
|
129
|
+
* `noLabelFloat` property.
|
|
130
|
+
*/
|
|
131
|
+
noLabelFloat: {
|
|
132
|
+
type: Boolean,
|
|
133
|
+
value: false
|
|
134
|
+
},
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Set to true to always float the label. Bind this to the `<paper-input-container>`'s
|
|
138
|
+
* `alwaysFloatLabel` property.
|
|
139
|
+
*/
|
|
140
|
+
alwaysFloatLabel: {
|
|
141
|
+
type: Boolean,
|
|
142
|
+
value: false
|
|
143
|
+
},
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Set to true to auto-validate the input value. Bind this to the `<paper-input-container>`'s
|
|
147
|
+
* `autoValidate` property.
|
|
148
|
+
*/
|
|
149
|
+
autoValidate: {
|
|
150
|
+
type: Boolean,
|
|
151
|
+
value: false
|
|
152
|
+
},
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Name of the validator to use. Bind this to the `<input is="iron-input">`'s `validator`
|
|
156
|
+
* property.
|
|
157
|
+
*/
|
|
158
|
+
validator: {
|
|
159
|
+
type: String
|
|
160
|
+
},
|
|
161
|
+
|
|
162
|
+
// HTMLInputElement attributes for binding if needed
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* Bind this to the `<input is="iron-input">`'s `autocomplete` property.
|
|
166
|
+
*/
|
|
167
|
+
autocomplete: {
|
|
168
|
+
type: String,
|
|
169
|
+
value: 'off'
|
|
170
|
+
},
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Bind this to the `<input is="iron-input">`'s `autofocus` property.
|
|
174
|
+
*/
|
|
175
|
+
autofocus: {
|
|
176
|
+
type: Boolean
|
|
177
|
+
},
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* Bind this to the `<input is="iron-input">`'s `inputmode` property.
|
|
181
|
+
*/
|
|
182
|
+
inputmode: {
|
|
183
|
+
type: String
|
|
184
|
+
},
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* Bind this to the `<input is="iron-input">`'s `minlength` property.
|
|
188
|
+
*/
|
|
189
|
+
minlength: {
|
|
190
|
+
type: Number
|
|
191
|
+
},
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* Bind this to the `<input is="iron-input">`'s `name` property.
|
|
195
|
+
*/
|
|
196
|
+
name: {
|
|
197
|
+
type: String
|
|
198
|
+
},
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* A placeholder string in addition to the label. If this is set, the label will always float.
|
|
202
|
+
*/
|
|
203
|
+
placeholder: {
|
|
204
|
+
type: String
|
|
205
|
+
},
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* Bind this to the `<input is="iron-input">`'s `readonly` property.
|
|
209
|
+
*/
|
|
210
|
+
readonly: {
|
|
211
|
+
type: Boolean,
|
|
212
|
+
value: false
|
|
213
|
+
},
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* Bind this to the `<input is="iron-input">`'s `size` property.
|
|
217
|
+
*/
|
|
218
|
+
size: {
|
|
219
|
+
type: Number
|
|
220
|
+
},
|
|
221
|
+
|
|
222
|
+
_ariaDescribedBy: {
|
|
223
|
+
type: String,
|
|
224
|
+
value: ''
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
},
|
|
228
|
+
|
|
229
|
+
listeners: {
|
|
230
|
+
'addon-attached': '_onAddonAttached'
|
|
231
|
+
},
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* Returns a reference to the input element.
|
|
235
|
+
*/
|
|
236
|
+
get inputElement() {
|
|
237
|
+
return this.$.input;
|
|
238
|
+
},
|
|
239
|
+
|
|
240
|
+
attached: function() {
|
|
241
|
+
this._updateAriaLabelledBy();
|
|
242
|
+
},
|
|
243
|
+
|
|
244
|
+
_appendStringWithSpace: function(str, more) {
|
|
245
|
+
if (str) {
|
|
246
|
+
str = str + ' ' + more;
|
|
247
|
+
} else {
|
|
248
|
+
str = more;
|
|
249
|
+
}
|
|
250
|
+
return str;
|
|
251
|
+
},
|
|
252
|
+
|
|
253
|
+
_onAddonAttached: function(event) {
|
|
254
|
+
var target = event.path ? event.path[0] : event.target;
|
|
255
|
+
if (target.id) {
|
|
256
|
+
this._ariaDescribedBy = this._appendStringWithSpace(this._ariaDescribedBy, target.id);
|
|
257
|
+
} else {
|
|
258
|
+
var id = 'paper-input-add-on-' + Math.floor((Math.random() * 100000));
|
|
259
|
+
target.id = id;
|
|
260
|
+
this._ariaDescribedBy = this._appendStringWithSpace(this._ariaDescribedBy, id);
|
|
261
|
+
}
|
|
262
|
+
},
|
|
263
|
+
|
|
264
|
+
/**
|
|
265
|
+
* Validates the input element and sets an error style if needed.
|
|
266
|
+
*/
|
|
267
|
+
validate: function () {
|
|
268
|
+
return this.inputElement.validate();
|
|
269
|
+
},
|
|
270
|
+
|
|
271
|
+
_computeAlwaysFloatLabel: function(alwaysFloatLabel, placeholder) {
|
|
272
|
+
return placeholder || alwaysFloatLabel;
|
|
273
|
+
},
|
|
274
|
+
|
|
275
|
+
_updateAriaLabelledBy: function() {
|
|
276
|
+
var label = Polymer.dom(this.root).querySelector('label');
|
|
277
|
+
if (!label) {
|
|
278
|
+
this._ariaLabelledBy = '';
|
|
279
|
+
return;
|
|
280
|
+
}
|
|
281
|
+
var labelledBy;
|
|
282
|
+
if (label.id) {
|
|
283
|
+
labelledBy = label.id;
|
|
284
|
+
} else {
|
|
285
|
+
labelledBy = 'paper-input-label-' + new Date().getUTCMilliseconds();
|
|
286
|
+
label.id = labelledBy;
|
|
287
|
+
}
|
|
288
|
+
this._ariaLabelledBy = labelledBy;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
};
|
|
292
|
+
|
|
293
|
+
</script>
|