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.
Files changed (188) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +51 -0
  3. data/Rakefile +1 -0
  4. data/app/assets/components/iron-a11y-announcer/iron-a11y-announcer.html +125 -0
  5. data/app/assets/components/iron-a11y-keys-behavior/iron-a11y-keys-behavior.html +418 -0
  6. data/app/assets/components/iron-autogrow-textarea/hero.svg +33 -0
  7. data/app/assets/components/iron-autogrow-textarea/iron-autogrow-textarea.html +263 -0
  8. data/app/assets/components/iron-behaviors/iron-button-state.html +195 -0
  9. data/app/assets/components/iron-behaviors/iron-control-state.html +102 -0
  10. data/app/assets/components/iron-fit-behavior/iron-fit-behavior.html +230 -0
  11. data/app/assets/components/iron-flex-layout/classes/iron-flex-layout.html +307 -0
  12. data/app/assets/components/iron-flex-layout/classes/iron-shadow-flex-layout.html +302 -0
  13. data/app/assets/components/iron-flex-layout/iron-flex-layout.html +313 -0
  14. data/app/assets/components/iron-form-element-behavior/iron-form-element-behavior.html +50 -0
  15. data/app/assets/components/iron-icon/hero.svg +19 -0
  16. data/app/assets/components/iron-icon/iron-icon.html +187 -0
  17. data/app/assets/components/iron-icons/av-icons.html +73 -0
  18. data/app/assets/components/iron-icons/communication-icons.html +59 -0
  19. data/app/assets/components/iron-icons/device-icons.html +94 -0
  20. data/app/assets/components/iron-icons/editor-icons.html +70 -0
  21. data/app/assets/components/iron-icons/hardware-icons.html +61 -0
  22. data/app/assets/components/iron-icons/hero.svg +35 -0
  23. data/app/assets/components/iron-icons/image-icons.html +164 -0
  24. data/app/assets/components/iron-icons/iron-icons.html +303 -0
  25. data/app/assets/components/iron-icons/maps-icons.html +71 -0
  26. data/app/assets/components/iron-icons/notification-icons.html +62 -0
  27. data/app/assets/components/iron-icons/social-icons.html +40 -0
  28. data/app/assets/components/iron-iconset-svg/iron-iconset-svg.html +191 -0
  29. data/app/assets/components/iron-input/hero.svg +19 -0
  30. data/app/assets/components/iron-input/iron-input.html +235 -0
  31. data/app/assets/components/iron-media-query/hero.svg +29 -0
  32. data/app/assets/components/iron-media-query/iron-media-query.html +84 -0
  33. data/app/assets/components/iron-menu-behavior/iron-menu-behavior.html +214 -0
  34. data/app/assets/components/iron-menu-behavior/iron-menubar-behavior.html +65 -0
  35. data/app/assets/components/iron-meta/hero.svg +33 -0
  36. data/app/assets/components/iron-meta/iron-meta.html +352 -0
  37. data/app/assets/components/iron-overlay-behavior/iron-overlay-backdrop.html +132 -0
  38. data/app/assets/components/iron-overlay-behavior/iron-overlay-behavior.html +432 -0
  39. data/app/assets/components/iron-overlay-behavior/iron-overlay-manager.html +107 -0
  40. data/app/assets/components/iron-range-behavior/iron-range-behavior.html +101 -0
  41. data/app/assets/components/iron-resizable-behavior/iron-resizable-behavior.html +139 -0
  42. data/app/assets/components/iron-selector/iron-multi-selectable.html +120 -0
  43. data/app/assets/components/iron-selector/iron-selectable.html +307 -0
  44. data/app/assets/components/iron-selector/iron-selection.html +115 -0
  45. data/app/assets/components/iron-selector/iron-selector.html +71 -0
  46. data/app/assets/components/iron-validatable-behavior/iron-validatable-behavior.html +100 -0
  47. data/app/assets/components/neon-animation/animations/cascaded-animation.html +84 -0
  48. data/app/assets/components/neon-animation/animations/fade-in-animation.html +49 -0
  49. data/app/assets/components/neon-animation/animations/fade-out-animation.html +49 -0
  50. data/app/assets/components/neon-animation/animations/hero-animation.html +83 -0
  51. data/app/assets/components/neon-animation/animations/opaque-animation.html +46 -0
  52. data/app/assets/components/neon-animation/animations/ripple-animation.html +92 -0
  53. data/app/assets/components/neon-animation/animations/scale-down-animation.html +65 -0
  54. data/app/assets/components/neon-animation/animations/scale-up-animation.html +58 -0
  55. data/app/assets/components/neon-animation/animations/slide-down-animation.html +59 -0
  56. data/app/assets/components/neon-animation/animations/slide-from-left-animation.html +60 -0
  57. data/app/assets/components/neon-animation/animations/slide-from-right-animation.html +60 -0
  58. data/app/assets/components/neon-animation/animations/slide-left-animation.html +59 -0
  59. data/app/assets/components/neon-animation/animations/slide-right-animation.html +59 -0
  60. data/app/assets/components/neon-animation/animations/slide-up-animation.html +59 -0
  61. data/app/assets/components/neon-animation/animations/transform-animation.html +61 -0
  62. data/app/assets/components/neon-animation/guides/neon-animation.md +313 -0
  63. data/app/assets/components/neon-animation/neon-animatable-behavior.html +156 -0
  64. data/app/assets/components/neon-animation/neon-animatable.html +54 -0
  65. data/app/assets/components/neon-animation/neon-animated-pages.html +208 -0
  66. data/app/assets/components/neon-animation/neon-animation-behavior.html +88 -0
  67. data/app/assets/components/neon-animation/neon-animation-runner-behavior.html +110 -0
  68. data/app/assets/components/neon-animation/neon-animation.html +17 -0
  69. data/app/assets/components/neon-animation/neon-animations.html +25 -0
  70. data/app/assets/components/neon-animation/neon-shared-element-animatable-behavior.html +37 -0
  71. data/app/assets/components/neon-animation/neon-shared-element-animation-behavior.html +66 -0
  72. data/app/assets/components/neon-animation/web-animations.html +11 -0
  73. data/app/assets/components/paper-behaviors/paper-button-behavior.html +55 -0
  74. data/app/assets/components/paper-behaviors/paper-inky-focus-behavior.html +44 -0
  75. data/app/assets/components/paper-button/paper-button.html +177 -0
  76. data/app/assets/components/paper-checkbox/metadata.html +17 -0
  77. data/app/assets/components/paper-checkbox/paper-checkbox.css +149 -0
  78. data/app/assets/components/paper-checkbox/paper-checkbox.html +163 -0
  79. data/app/assets/components/paper-dialog-behavior/hero.svg +51 -0
  80. data/app/assets/components/paper-dialog-behavior/paper-dialog-behavior.html +236 -0
  81. data/app/assets/components/paper-dialog-behavior/paper-dialog-common.css +58 -0
  82. data/app/assets/components/paper-dialog-scrollable/hero.svg +69 -0
  83. data/app/assets/components/paper-dialog-scrollable/paper-dialog-scrollable.html +150 -0
  84. data/app/assets/components/paper-dialog/hero.svg +58 -0
  85. data/app/assets/components/paper-dialog/paper-dialog.html +122 -0
  86. data/app/assets/components/paper-drawer-panel/hero.svg +21 -0
  87. data/app/assets/components/paper-drawer-panel/paper-drawer-panel.css +142 -0
  88. data/app/assets/components/paper-drawer-panel/paper-drawer-panel.html +585 -0
  89. data/app/assets/components/paper-fab/paper-fab.html +159 -0
  90. data/app/assets/components/paper-header-panel/hero.svg +38 -0
  91. data/app/assets/components/paper-header-panel/paper-header-panel.html +496 -0
  92. data/app/assets/components/paper-icon-button/paper-icon-button.html +141 -0
  93. data/app/assets/components/paper-input/all-imports.html +12 -0
  94. data/app/assets/components/paper-input/hero.svg +19 -0
  95. data/app/assets/components/paper-input/paper-input-addon-behavior.html +43 -0
  96. data/app/assets/components/paper-input/paper-input-behavior.html +293 -0
  97. data/app/assets/components/paper-input/paper-input-char-counter.html +95 -0
  98. data/app/assets/components/paper-input/paper-input-container.html +495 -0
  99. data/app/assets/components/paper-input/paper-input-error.html +99 -0
  100. data/app/assets/components/paper-input/paper-input.html +126 -0
  101. data/app/assets/components/paper-input/paper-textarea.html +100 -0
  102. data/app/assets/components/paper-item/all-imports.html +13 -0
  103. data/app/assets/components/paper-item/paper-icon-item.html +86 -0
  104. data/app/assets/components/paper-item/paper-item-body.html +93 -0
  105. data/app/assets/components/paper-item/paper-item-shared.css +19 -0
  106. data/app/assets/components/paper-item/paper-item.html +95 -0
  107. data/app/assets/components/paper-material/paper-material.html +98 -0
  108. data/app/assets/components/paper-menu/hero.svg +35 -0
  109. data/app/assets/components/paper-menu/paper-menu.html +133 -0
  110. data/app/assets/components/paper-progress/hero.svg +21 -0
  111. data/app/assets/components/paper-progress/paper-progress.html +199 -0
  112. data/app/assets/components/paper-radio-button/hero.svg +22 -0
  113. data/app/assets/components/paper-radio-button/paper-radio-button.css +109 -0
  114. data/app/assets/components/paper-radio-button/paper-radio-button.html +148 -0
  115. data/app/assets/components/paper-radio-group/hero.svg +25 -0
  116. data/app/assets/components/paper-radio-group/paper-radio-group.html +186 -0
  117. data/app/assets/components/paper-ripple/hero.svg +30 -0
  118. data/app/assets/components/paper-ripple/paper-ripple.html +714 -0
  119. data/app/assets/components/paper-scroll-header-panel/hero.svg +41 -0
  120. data/app/assets/components/paper-scroll-header-panel/paper-scroll-header-panel.html +455 -0
  121. data/app/assets/components/paper-slider/hero.svg +20 -0
  122. data/app/assets/components/paper-slider/paper-slider.css +252 -0
  123. data/app/assets/components/paper-slider/paper-slider.html +449 -0
  124. data/app/assets/components/paper-spinner/hero.svg +27 -0
  125. data/app/assets/components/paper-spinner/paper-spinner.css +325 -0
  126. data/app/assets/components/paper-spinner/paper-spinner.html +222 -0
  127. data/app/assets/components/paper-styles/classes/global.html +96 -0
  128. data/app/assets/components/paper-styles/classes/shadow-layout.html +302 -0
  129. data/app/assets/components/paper-styles/classes/shadow.html +39 -0
  130. data/app/assets/components/paper-styles/classes/typography.html +171 -0
  131. data/app/assets/components/paper-styles/color.html +333 -0
  132. data/app/assets/components/paper-styles/default-theme.html +39 -0
  133. data/app/assets/components/paper-styles/paper-styles-classes.html +14 -0
  134. data/app/assets/components/paper-styles/paper-styles.html +17 -0
  135. data/app/assets/components/paper-styles/shadow.html +61 -0
  136. data/app/assets/components/paper-styles/typography.html +240 -0
  137. data/app/assets/components/paper-tabs/hero.svg +23 -0
  138. data/app/assets/components/paper-tabs/paper-tab.html +158 -0
  139. data/app/assets/components/paper-tabs/paper-tabs-icons.html +18 -0
  140. data/app/assets/components/paper-tabs/paper-tabs.html +483 -0
  141. data/app/assets/components/paper-toast/hero.svg +20 -0
  142. data/app/assets/components/paper-toast/paper-toast.html +164 -0
  143. data/app/assets/components/paper-toggle-button/hero.svg +22 -0
  144. data/app/assets/components/paper-toggle-button/paper-toggle-button.css +108 -0
  145. data/app/assets/components/paper-toggle-button/paper-toggle-button.html +183 -0
  146. data/app/assets/components/paper-toolbar/paper-toolbar.html +375 -0
  147. data/app/assets/components/polymer-gestures/Gruntfile.js +60 -0
  148. data/app/assets/components/polymer-gestures/banner.txt +9 -0
  149. data/app/assets/components/polymer-gestures/build.json +17 -0
  150. data/app/assets/components/polymer-gestures/conf/karma.conf.js +39 -0
  151. data/app/assets/components/polymer-gestures/package.json +20 -0
  152. data/app/assets/components/polymer-gestures/polymer-gestures.html +21 -0
  153. data/app/assets/components/polymer-gestures/polymer-gestures.js +46 -0
  154. data/app/assets/components/polymer-gestures/src/dispatcher.js +474 -0
  155. data/app/assets/components/polymer-gestures/src/eventFactory.js +127 -0
  156. data/app/assets/components/polymer-gestures/src/hold.js +129 -0
  157. data/app/assets/components/polymer-gestures/src/mouse.js +135 -0
  158. data/app/assets/components/polymer-gestures/src/ms.js +80 -0
  159. data/app/assets/components/polymer-gestures/src/pinch.js +186 -0
  160. data/app/assets/components/polymer-gestures/src/platform-events.js +39 -0
  161. data/app/assets/components/polymer-gestures/src/pointer.js +68 -0
  162. data/app/assets/components/polymer-gestures/src/pointermap.js +67 -0
  163. data/app/assets/components/polymer-gestures/src/scope.js +10 -0
  164. data/app/assets/components/polymer-gestures/src/tap.js +103 -0
  165. data/app/assets/components/polymer-gestures/src/targetfind.js +244 -0
  166. data/app/assets/components/polymer-gestures/src/touch-action.js +60 -0
  167. data/app/assets/components/polymer-gestures/src/touch.js +341 -0
  168. data/app/assets/components/polymer-gestures/src/track.js +230 -0
  169. data/app/assets/components/web-animations-js/web-animations-next-lite.min.js +17 -0
  170. data/app/assets/components/web-animations-js/web-animations-next.min.js +17 -0
  171. data/app/assets/components/web-animations-js/web-animations.min.js +17 -0
  172. data/app/assets/components/webcomponentsjs/CustomElements.js +956 -0
  173. data/app/assets/components/webcomponentsjs/CustomElements.min.js +11 -0
  174. data/app/assets/components/webcomponentsjs/HTMLImports.js +1078 -0
  175. data/app/assets/components/webcomponentsjs/HTMLImports.min.js +11 -0
  176. data/app/assets/components/webcomponentsjs/MutationObserver.js +344 -0
  177. data/app/assets/components/webcomponentsjs/MutationObserver.min.js +11 -0
  178. data/app/assets/components/webcomponentsjs/ShadowDOM.js +4414 -0
  179. data/app/assets/components/webcomponentsjs/ShadowDOM.min.js +15 -0
  180. data/app/assets/components/webcomponentsjs/package.json +31 -0
  181. data/app/assets/components/webcomponentsjs/webcomponents-lite.js +2300 -0
  182. data/app/assets/components/webcomponentsjs/webcomponents-lite.min.js +13 -0
  183. data/app/assets/components/webcomponentsjs/webcomponents.js +7112 -0
  184. data/app/assets/components/webcomponentsjs/webcomponents.min.js +15 -0
  185. data/lib/polymer-paper-elements-rails.rb +2 -0
  186. data/lib/polymer-paper-elements-rails/engine.rb +4 -0
  187. data/lib/polymer-paper-elements-rails/version.rb +3 -0
  188. metadata +272 -0
@@ -0,0 +1,33 @@
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
+ <path d="M140,47c-3,0-4.7-2.4-6.2-4.4c-1.3-1.9-2.4-3.6-4.7-3.6c-2.3,0-3.4,1.7-4.7,3.6c-1.5,2.1-3.1,4.4-6.4,4.4
13
+ c-3.3,0-4.9-2.4-6.4-4.4c-1.3-1.9-2.5-3.6-4.8-3.6c-2.3,0-3.4,1.7-4.8,3.6c-1.5,2.1-3.1,4.4-6.4,4.4s-5.2-2.4-6.7-4.4
14
+ c-1.3-1.9-2-3.6-5-3.6v-2c4,0,5.2,2.4,6.7,4.4c1.3,1.9,2.6,3.6,4.9,3.6c2.3,0,3.5-1.7,4.8-3.6c1.5-2.1,3.1-4.4,6.5-4.4
15
+ s5,2.4,6.4,4.4c1.3,1.9,2.5,3.6,4.8,3.6c2.3,0,3.4-1.7,4.8-3.6c1.5-2.1,3.1-4.4,6.4-4.4c3.3,0,4.7,2.4,6.2,4.4
16
+ c1.3,1.9,2.5,3.6,4.5,3.6V47z"/>
17
+ <path d="M140,65c-3,0-4.7-2.4-6.2-4.4c-1.3-1.9-2.4-3.6-4.7-3.6c-2.3,0-3.4,1.7-4.7,3.6c-1.5,2.1-3.1,4.4-6.4,4.4
18
+ c-3.3,0-4.9-2.4-6.4-4.4c-1.3-1.9-2.5-3.6-4.8-3.6c-2.3,0-3.4,1.7-4.8,3.6c-1.5,2.1-3.1,4.4-6.4,4.4s-5.2-2.4-6.7-4.4
19
+ c-1.3-1.9-2-3.6-5-3.6v-2c4,0,5.2,2.4,6.7,4.4c1.3,1.9,2.6,3.6,4.9,3.6c2.3,0,3.5-1.7,4.8-3.6c1.5-2.1,3.1-4.4,6.5-4.4
20
+ s5,2.4,6.4,4.4c1.3,1.9,2.5,3.6,4.8,3.6c2.3,0,3.4-1.7,4.8-3.6c1.5-2.1,3.1-4.4,6.4-4.4c3.3,0,4.7,2.4,6.2,4.4
21
+ c1.3,1.9,2.5,3.6,4.5,3.6V65z"/>
22
+ <path d="M140,83c-3,0-4.7-2.4-6.2-4.4c-1.3-1.9-2.4-3.6-4.7-3.6c-2.3,0-3.4,1.7-4.7,3.6c-1.5,2.1-3.1,4.4-6.4,4.4
23
+ c-3.3,0-4.9-2.4-6.4-4.4c-1.3-1.9-2.5-3.6-4.8-3.6c-2.3,0-3.4,1.7-4.8,3.6c-1.5,2.1-3.1,4.4-6.4,4.4s-5.2-2.4-6.7-4.4
24
+ c-1.3-1.9-2-3.6-5-3.6v-2c4,0,5.2,2.4,6.7,4.4c1.3,1.9,2.6,3.6,4.9,3.6c2.3,0,3.5-1.7,4.8-3.6c1.5-2.1,3.1-4.4,6.5-4.4
25
+ s5,2.4,6.4,4.4c1.3,1.9,2.5,3.6,4.8,3.6c2.3,0,3.4-1.7,4.8-3.6c1.5-2.1,3.1-4.4,6.4-4.4c3.3,0,4.7,2.4,6.2,4.4
26
+ c1.3,1.9,2.5,3.6,4.5,3.6V83z"/>
27
+ <g id="ic_x5F_add_x0D_">
28
+ </g>
29
+ <path d="M151,102H73V24h78V102z M75,100h74V26H75V100z"/>
30
+ </g>
31
+ <g id="Guides">
32
+ </g>
33
+ </svg>
@@ -0,0 +1,263 @@
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-flex-layout/classes/iron-flex-layout.html">
13
+ <link rel="import" href="../iron-validatable-behavior/iron-validatable-behavior.html">
14
+
15
+ <!--
16
+ `iron-autogrow-textarea` is an element containing a textarea that grows in height as more
17
+ lines of input are entered. Unless an explicit height or the `maxRows` property is set, it will
18
+ never scroll.
19
+
20
+ Example:
21
+
22
+ <iron-autogrow-textarea id="a1">
23
+ <textarea id="t1"></textarea>
24
+ </iron-autogrow-textarea>
25
+
26
+ Because the `textarea`'s `value` property is not observable, you should use
27
+ this element's `bind-value` instead for imperative updates.
28
+
29
+ @group Iron Elements
30
+ @hero hero.svg
31
+ @demo demo/index.html
32
+ -->
33
+
34
+ <dom-module id="iron-autogrow-textarea">
35
+
36
+ <style>
37
+ :host {
38
+ display: inline-block;
39
+ position: relative;
40
+ width: 400px;
41
+ border: 1px solid;
42
+ padding: 2px;
43
+ -moz-appearance: textarea;
44
+ -webkit-appearance: textarea;
45
+ }
46
+
47
+ .mirror-text {
48
+ visibility: hidden;
49
+ word-wrap: break-word;
50
+ }
51
+
52
+ textarea {
53
+ position: relative;
54
+ outline: none;
55
+ border: none;
56
+ resize: none;
57
+ background: inherit;
58
+ /* see comments in template */
59
+ width: 100%;
60
+ height: 100%;
61
+ font-size: inherit;
62
+ font-family: inherit;
63
+ }
64
+
65
+ ::content textarea:invalid {
66
+ box-shadow: none;
67
+ }
68
+
69
+ </style>
70
+ <template>
71
+ <!-- the mirror sizes the input/textarea so it grows with typing -->
72
+ <div id="mirror" class="mirror-text" aria-hidden="true">&nbsp;</div>
73
+
74
+ <!-- size the input/textarea with a div, because the textarea has intrinsic size in ff -->
75
+ <div class="textarea-container fit">
76
+ <textarea id="textarea"
77
+ autocomplete$="[[autocomplete]]"
78
+ autofocus$="[[autofocus]]"
79
+ inputmode$="[[inputmode]]"
80
+ name$="[[name]]"
81
+ placeholder$="[[placeholder]]"
82
+ readonly$="[[readonly]]"
83
+ required$="[[required]]"
84
+ rows$="[[rows]]"
85
+ maxlength$="[[maxlength]]"></textarea>
86
+ </div>
87
+ </template>
88
+
89
+ <script>
90
+
91
+ Polymer({
92
+
93
+ is: 'iron-autogrow-textarea',
94
+
95
+ behaviors: [
96
+ Polymer.IronValidatableBehavior
97
+ ],
98
+
99
+ properties: {
100
+
101
+ /**
102
+ * Use this property instead of `value` for two-way data binding.
103
+ */
104
+ bindValue: {
105
+ observer: '_bindValueChanged',
106
+ type: String
107
+ },
108
+
109
+ /**
110
+ * The initial number of rows.
111
+ *
112
+ * @attribute rows
113
+ * @type number
114
+ * @default 1
115
+ */
116
+ rows: {
117
+ type: Number,
118
+ value: 1,
119
+ observer: '_updateCached'
120
+ },
121
+
122
+ /**
123
+ * The maximum number of rows this element can grow to until it
124
+ * scrolls. 0 means no maximum.
125
+ *
126
+ * @attribute maxRows
127
+ * @type number
128
+ * @default 0
129
+ */
130
+ maxRows: {
131
+ type: Number,
132
+ value: 0,
133
+ observer: '_updateCached'
134
+ },
135
+
136
+ /**
137
+ * Bound to the textarea's `autocomplete` attribute.
138
+ */
139
+ autocomplete: {
140
+ type: String,
141
+ value: 'off'
142
+ },
143
+
144
+ /**
145
+ * Bound to the textarea's `autofocus` attribute.
146
+ */
147
+ autofocus: {
148
+ type: String,
149
+ value: 'off'
150
+ },
151
+
152
+ /**
153
+ * Bound to the textarea's `inputmode` attribute.
154
+ */
155
+ inputmode: {
156
+ type: String
157
+ },
158
+
159
+ /**
160
+ * Bound to the textarea's `name` attribute.
161
+ */
162
+ name: {
163
+ type: String
164
+ },
165
+
166
+ /**
167
+ * Bound to the textarea's `placeholder` attribute.
168
+ */
169
+ placeholder: {
170
+ type: String
171
+ },
172
+
173
+ /**
174
+ * Bound to the textarea's `readonly` attribute.
175
+ */
176
+ readonly: {
177
+ type: String
178
+ },
179
+
180
+ /**
181
+ * Set to true to mark the textarea as required.
182
+ */
183
+ required: {
184
+ type: Boolean
185
+ },
186
+
187
+ /**
188
+ * The maximum length of the input value.
189
+ */
190
+ maxlength: {
191
+ type: Number
192
+ }
193
+
194
+ },
195
+
196
+ listeners: {
197
+ 'input': '_onInput'
198
+ },
199
+
200
+ /**
201
+ * Returns the underlying textarea.
202
+ */
203
+ get textarea() {
204
+ return this.$.textarea;
205
+ },
206
+
207
+ _update: function() {
208
+ this.$.mirror.innerHTML = this._valueForMirror();
209
+
210
+ var textarea = this.textarea;
211
+ // If the value of the textarea was updated imperatively, then we
212
+ // need to manually update bindValue as well.
213
+ if (textarea && this.bindValue != textarea.value) {
214
+ this.bindValue = textarea.value;
215
+ }
216
+ },
217
+
218
+ _bindValueChanged: function() {
219
+ var textarea = this.textarea;
220
+ if (!textarea) {
221
+ return;
222
+ }
223
+
224
+ textarea.value = this.bindValue;
225
+ this._update();
226
+ // manually notify because we don't want to notify until after setting value
227
+ this.fire('bind-value-changed', {value: this.bindValue});
228
+ },
229
+
230
+ _onInput: function(event) {
231
+ this.bindValue = event.path ? event.path[0].value : event.target.value;
232
+ this._update();
233
+ },
234
+
235
+ _constrain: function(tokens) {
236
+ var _tokens;
237
+ tokens = tokens || [''];
238
+ // Enforce the min and max heights for a multiline input to avoid measurement
239
+ if (this.maxRows > 0 && tokens.length > this.maxRows) {
240
+ _tokens = tokens.slice(0, this.maxRows);
241
+ } else {
242
+ _tokens = tokens.slice(0);
243
+ }
244
+ while (this.rows > 0 && _tokens.length < this.rows) {
245
+ _tokens.push('');
246
+ }
247
+ return _tokens.join('<br>') + '&nbsp;';
248
+ },
249
+
250
+ _valueForMirror: function() {
251
+ var input = this.textarea;
252
+ if (!input) {
253
+ return;
254
+ }
255
+ this.tokens = (input && input.value) ? input.value.replace(/&/gm, '&amp;').replace(/"/gm, '&quot;').replace(/'/gm, '&#39;').replace(/</gm, '&lt;').replace(/>/gm, '&gt;').split('\n') : [''];
256
+ return this._constrain(this.tokens);
257
+ },
258
+
259
+ _updateCached: function() {
260
+ this.$.mirror.innerHTML = this._constrain(this.tokens);
261
+ }
262
+ })
263
+ </script>
@@ -0,0 +1,195 @@
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-a11y-keys-behavior/iron-a11y-keys-behavior.html">
13
+ <link rel="import" href="iron-control-state.html">
14
+
15
+ <script>
16
+
17
+ /** @polymerBehavior Polymer.IronButtonState */
18
+ Polymer.IronButtonStateImpl = {
19
+
20
+ properties: {
21
+
22
+ /**
23
+ * If true, the user is currently holding down the button.
24
+ *
25
+ * @attribute pressed
26
+ * @type boolean
27
+ * @default false
28
+ */
29
+ pressed: {
30
+ type: Boolean,
31
+ readOnly: true,
32
+ value: false,
33
+ reflectToAttribute: true,
34
+ observer: '_pressedChanged'
35
+ },
36
+
37
+ /**
38
+ * If true, the button toggles the active state with each tap or press
39
+ * of the spacebar.
40
+ *
41
+ * @attribute toggles
42
+ * @type boolean
43
+ * @default false
44
+ */
45
+ toggles: {
46
+ type: Boolean,
47
+ value: false,
48
+ reflectToAttribute: true
49
+ },
50
+
51
+ /**
52
+ * If true, the button is a toggle and is currently in the active state.
53
+ *
54
+ * @attribute active
55
+ * @type boolean
56
+ * @default false
57
+ */
58
+ active: {
59
+ type: Boolean,
60
+ value: false,
61
+ notify: true,
62
+ reflectToAttribute: true,
63
+ observer: '_activeChanged'
64
+ },
65
+
66
+ /**
67
+ * True if the element is currently being pressed by a "pointer," which
68
+ * is loosely defined as mouse or touch input (but specifically excluding
69
+ * keyboard input).
70
+ */
71
+ pointerDown: {
72
+ type: Boolean,
73
+ readOnly: true,
74
+ value: false
75
+ },
76
+
77
+ /**
78
+ * True if the input device that caused the element to receive focus
79
+ * was a keyboard.
80
+ */
81
+ receivedFocusFromKeyboard: {
82
+ type: Boolean,
83
+ readOnly: true
84
+ }
85
+ },
86
+
87
+ listeners: {
88
+ down: '_downHandler',
89
+ up: '_upHandler',
90
+ tap: '_tapHandler'
91
+ },
92
+
93
+ observers: [
94
+ '_detectKeyboardFocus(focused)'
95
+ ],
96
+
97
+ keyBindings: {
98
+ 'enter:keydown': '_asyncClick',
99
+ 'space:keydown': '_spaceKeyDownHandler',
100
+ 'space:keyup': '_spaceKeyUpHandler',
101
+ },
102
+
103
+ _tapHandler: function() {
104
+ if (this.toggles) {
105
+ // a tap is needed to toggle the active state
106
+ this._userActivate(!this.active);
107
+ } else {
108
+ this.active = false;
109
+ }
110
+ },
111
+
112
+ _detectKeyboardFocus: function(focused) {
113
+ this._setReceivedFocusFromKeyboard(!this.pointerDown && focused);
114
+ },
115
+
116
+ // to emulate native checkbox, (de-)activations from a user interaction fire
117
+ // 'change' events
118
+ _userActivate: function(active) {
119
+ this.active = active;
120
+ this.fire('change');
121
+ },
122
+
123
+ _downHandler: function() {
124
+ this._setPointerDown(true);
125
+ this._setPressed(true);
126
+ this._setReceivedFocusFromKeyboard(false);
127
+ },
128
+
129
+ _upHandler: function() {
130
+ this._setPointerDown(false);
131
+ this._setPressed(false);
132
+ },
133
+
134
+ _spaceKeyDownHandler: function(event) {
135
+ var keyboardEvent = event.detail.keyboardEvent;
136
+ keyboardEvent.preventDefault();
137
+ keyboardEvent.stopImmediatePropagation();
138
+ this._setPressed(true);
139
+ },
140
+
141
+ _spaceKeyUpHandler: function() {
142
+ if (this.pressed) {
143
+ this._asyncClick();
144
+ }
145
+ this._setPressed(false);
146
+ },
147
+
148
+ // trigger click asynchronously, the asynchrony is useful to allow one
149
+ // event handler to unwind before triggering another event
150
+ _asyncClick: function() {
151
+ this.async(function() {
152
+ this.click();
153
+ }, 1);
154
+ },
155
+
156
+ // any of these changes are considered a change to button state
157
+
158
+ _pressedChanged: function(pressed) {
159
+ this._changedButtonState();
160
+ },
161
+
162
+ _activeChanged: function(active) {
163
+ if (this.toggles) {
164
+ this.setAttribute('aria-pressed', active ? 'true' : 'false');
165
+ } else {
166
+ this.removeAttribute('aria-pressed');
167
+ }
168
+ this._changedButtonState();
169
+ },
170
+
171
+ _controlStateChanged: function() {
172
+ if (this.disabled) {
173
+ this._setPressed(false);
174
+ } else {
175
+ this._changedButtonState();
176
+ }
177
+ },
178
+
179
+ // provide hook for follow-on behaviors to react to button-state
180
+
181
+ _changedButtonState: function() {
182
+ if (this._buttonStateChanged) {
183
+ this._buttonStateChanged(); // abstract
184
+ }
185
+ }
186
+
187
+ };
188
+
189
+ /** @polymerBehavior Polymer.IronButtonState */
190
+ Polymer.IronButtonState = [
191
+ Polymer.IronA11yKeysBehavior,
192
+ Polymer.IronButtonStateImpl
193
+ ];
194
+
195
+ </script>