easycomments 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +1 -0
- data/.rspec +2 -0
- data/Gemfile +14 -0
- data/LICENSE +21 -0
- data/README.md +92 -0
- data/Rakefile +49 -0
- data/_config.yml +28 -0
- data/bin/ec +45 -0
- data/config.ru +12 -0
- data/dashboard.rb +57 -0
- data/easycomments.gemspec +22 -0
- data/ec.rb +43 -0
- data/lib/easycomments/ec_configuration.rb +42 -0
- data/lib/easycomments/ec_dashboard_model.rb +70 -0
- data/lib/easycomments/ec_model.rb +47 -0
- data/lib/easycomments.rb +14 -0
- data/public/bower.json +32 -0
- data/public/bower_components/core-a11y-keys/.bower.json +28 -0
- data/public/bower_components/core-a11y-keys/README.md +4 -0
- data/public/bower_components/core-a11y-keys/bower.json +18 -0
- data/public/bower_components/core-a11y-keys/core-a11y-keys.html +335 -0
- data/public/bower_components/core-a11y-keys/demo.html +41 -0
- data/public/bower_components/core-a11y-keys/index.html +22 -0
- data/public/bower_components/core-ajax/.bower.json +22 -0
- data/public/bower_components/core-ajax/README.md +4 -0
- data/public/bower_components/core-ajax/bower.json +11 -0
- data/public/bower_components/core-ajax/core-ajax.html +434 -0
- data/public/bower_components/core-ajax/core-xhr.html +116 -0
- data/public/bower_components/core-ajax/demo-progress.html +65 -0
- data/public/bower_components/core-ajax/demo.html +43 -0
- data/public/bower_components/core-ajax/index.html +22 -0
- data/public/bower_components/core-ajax/metadata.html +23 -0
- data/public/bower_components/core-ajax/test/core-ajax-progress.html +108 -0
- data/public/bower_components/core-ajax/test/core-ajax-race.html +81 -0
- data/public/bower_components/core-ajax/test/core-ajax.html +287 -0
- data/public/bower_components/core-ajax/test/index.html +17 -0
- data/public/bower_components/core-collapse/.bower.json +21 -0
- data/public/bower_components/core-collapse/README.md +4 -0
- data/public/bower_components/core-collapse/bower.json +11 -0
- data/public/bower_components/core-collapse/core-collapse.css +16 -0
- data/public/bower_components/core-collapse/core-collapse.html +298 -0
- data/public/bower_components/core-collapse/demo.html +75 -0
- data/public/bower_components/core-collapse/index.html +22 -0
- data/public/bower_components/core-collapse/test/basic.html +85 -0
- data/public/bower_components/core-collapse/test/index.html +24 -0
- data/public/bower_components/core-component-page/.bower.json +19 -0
- data/public/bower_components/core-component-page/README.md +6 -0
- data/public/bower_components/core-component-page/bowager-logo.png +0 -0
- data/public/bower_components/core-component-page/bower.json +9 -0
- data/public/bower_components/core-component-page/core-component-page.html +37 -0
- data/public/bower_components/core-component-page/demo.html +23 -0
- data/public/bower_components/core-component-page/index.html +22 -0
- data/public/bower_components/core-drawer-panel/.bower.json +19 -0
- data/public/bower_components/core-drawer-panel/README.md +4 -0
- data/public/bower_components/core-drawer-panel/bower.json +9 -0
- data/public/bower_components/core-drawer-panel/core-drawer-panel.css +160 -0
- data/public/bower_components/core-drawer-panel/core-drawer-panel.html +418 -0
- data/public/bower_components/core-drawer-panel/demo.html +68 -0
- data/public/bower_components/core-drawer-panel/index.html +22 -0
- data/public/bower_components/core-drawer-panel/metadata.html +37 -0
- data/public/bower_components/core-focusable/.bower.json +18 -0
- data/public/bower_components/core-focusable/README.md +6 -0
- data/public/bower_components/core-focusable/bower.json +8 -0
- data/public/bower_components/core-focusable/core-focusable.html +4 -0
- data/public/bower_components/core-focusable/core-focusable.js +134 -0
- data/public/bower_components/core-focusable/demo.html +109 -0
- data/public/bower_components/core-focusable/polymer-mixin.js +35 -0
- data/public/bower_components/core-header-panel/.bower.json +18 -0
- data/public/bower_components/core-header-panel/README.md +4 -0
- data/public/bower_components/core-header-panel/bower.json +8 -0
- data/public/bower_components/core-header-panel/core-header-panel.css +78 -0
- data/public/bower_components/core-header-panel/core-header-panel.html +277 -0
- data/public/bower_components/core-header-panel/demo.html +100 -0
- data/public/bower_components/core-header-panel/index.html +23 -0
- data/public/bower_components/core-header-panel/metadata.html +37 -0
- data/public/bower_components/core-icon/.bower.json +19 -0
- data/public/bower_components/core-icon/README.md +4 -0
- data/public/bower_components/core-icon/bower.json +9 -0
- data/public/bower_components/core-icon/core-icon.css +16 -0
- data/public/bower_components/core-icon/core-icon.html +201 -0
- data/public/bower_components/core-icon/demo.html +44 -0
- data/public/bower_components/core-icon/index.html +22 -0
- data/public/bower_components/core-icon/metadata.html +21 -0
- data/public/bower_components/core-icon-button/.bower.json +18 -0
- data/public/bower_components/core-icon-button/README.md +4 -0
- data/public/bower_components/core-icon-button/bower.json +8 -0
- data/public/bower_components/core-icon-button/core-icon-button.css +75 -0
- data/public/bower_components/core-icon-button/core-icon-button.html +81 -0
- data/public/bower_components/core-icon-button/demo.html +35 -0
- data/public/bower_components/core-icon-button/index.html +22 -0
- data/public/bower_components/core-icon-button/metadata.html +20 -0
- data/public/bower_components/core-icons/.bower.json +24 -0
- data/public/bower_components/core-icons/.gitignore +2 -0
- data/public/bower_components/core-icons/README.md +8 -0
- data/public/bower_components/core-icons/av-icons.html +65 -0
- data/public/bower_components/core-icons/bower.json +14 -0
- data/public/bower_components/core-icons/communication-icons.html +54 -0
- data/public/bower_components/core-icons/core-icons.html +278 -0
- data/public/bower_components/core-icons/demo.html +98 -0
- data/public/bower_components/core-icons/device-icons.html +90 -0
- data/public/bower_components/core-icons/editor-icons.html +67 -0
- data/public/bower_components/core-icons/hardware-icons.html +56 -0
- data/public/bower_components/core-icons/image-icons.html +152 -0
- data/public/bower_components/core-icons/index.html +22 -0
- data/public/bower_components/core-icons/maps-icons.html +70 -0
- data/public/bower_components/core-icons/notification-icons.html +49 -0
- data/public/bower_components/core-icons/social-icons.html +39 -0
- data/public/bower_components/core-iconset/.bower.json +20 -0
- data/public/bower_components/core-iconset/README.md +4 -0
- data/public/bower_components/core-iconset/bower.json +10 -0
- data/public/bower_components/core-iconset/core-iconset.html +241 -0
- data/public/bower_components/core-iconset/demo.html +62 -0
- data/public/bower_components/core-iconset/index.html +22 -0
- data/public/bower_components/core-iconset/my-icons-big.png +0 -0
- data/public/bower_components/core-iconset/my-icons.png +0 -0
- data/public/bower_components/core-iconset-svg/.bower.json +19 -0
- data/public/bower_components/core-iconset-svg/README.md +4 -0
- data/public/bower_components/core-iconset-svg/bower.json +9 -0
- data/public/bower_components/core-iconset-svg/core-iconset-svg.html +168 -0
- data/public/bower_components/core-iconset-svg/demo.html +66 -0
- data/public/bower_components/core-iconset-svg/index.html +22 -0
- data/public/bower_components/core-iconset-svg/svg-sample-icons.html +68 -0
- data/public/bower_components/core-input/.bower.json +20 -0
- data/public/bower_components/core-input/README.md +2 -0
- data/public/bower_components/core-input/bower.json +10 -0
- data/public/bower_components/core-input/core-input.css +41 -0
- data/public/bower_components/core-input/core-input.html +148 -0
- data/public/bower_components/core-input/demo.html +62 -0
- data/public/bower_components/core-input/index.html +22 -0
- data/public/bower_components/core-input/metadata.html +23 -0
- data/public/bower_components/core-input/test/a11y.html +55 -0
- data/public/bower_components/core-input/test/basic.html +60 -0
- data/public/bower_components/core-input/test/index.html +25 -0
- data/public/bower_components/core-item/.bower.json +19 -0
- data/public/bower_components/core-item/README.md +4 -0
- data/public/bower_components/core-item/bower.json +9 -0
- data/public/bower_components/core-item/core-item.css +45 -0
- data/public/bower_components/core-item/core-item.html +73 -0
- data/public/bower_components/core-item/demo.html +92 -0
- data/public/bower_components/core-item/index.html +22 -0
- data/public/bower_components/core-item/metadata.html +24 -0
- data/public/bower_components/core-media-query/.bower.json +18 -0
- data/public/bower_components/core-media-query/README.md +4 -0
- data/public/bower_components/core-media-query/bower.json +8 -0
- data/public/bower_components/core-media-query/core-media-query.html +87 -0
- data/public/bower_components/core-media-query/demo.html +44 -0
- data/public/bower_components/core-media-query/index.html +22 -0
- data/public/bower_components/core-menu/.bower.json +22 -0
- data/public/bower_components/core-menu/README.md +4 -0
- data/public/bower_components/core-menu/bower.json +11 -0
- data/public/bower_components/core-menu/core-menu.css +18 -0
- data/public/bower_components/core-menu/core-menu.html +73 -0
- data/public/bower_components/core-menu/core-submenu.css +43 -0
- data/public/bower_components/core-menu/core-submenu.html +126 -0
- data/public/bower_components/core-menu/demo.html +101 -0
- data/public/bower_components/core-menu/index.html +22 -0
- data/public/bower_components/core-menu/metadata.html +62 -0
- data/public/bower_components/core-meta/.bower.json +18 -0
- data/public/bower_components/core-meta/README.md +4 -0
- data/public/bower_components/core-meta/bower.json +8 -0
- data/public/bower_components/core-meta/core-meta.html +145 -0
- data/public/bower_components/core-meta/demo.html +58 -0
- data/public/bower_components/core-meta/index.html +22 -0
- data/public/bower_components/core-overlay/.bower.json +20 -0
- data/public/bower_components/core-overlay/README.md +4 -0
- data/public/bower_components/core-overlay/bower.json +10 -0
- data/public/bower_components/core-overlay/core-key-helper.html +22 -0
- data/public/bower_components/core-overlay/core-overlay-layer.html +116 -0
- data/public/bower_components/core-overlay/core-overlay.html +776 -0
- data/public/bower_components/core-overlay/demo.html +155 -0
- data/public/bower_components/core-overlay/gulpfile.js +2 -0
- data/public/bower_components/core-overlay/index.html +22 -0
- data/public/bower_components/core-overlay/tests/html/core-overlay-basic.html +127 -0
- data/public/bower_components/core-overlay/tests/html/core-overlay-positioning-margin.html +153 -0
- data/public/bower_components/core-overlay/tests/html/core-overlay-positioning.html +167 -0
- data/public/bower_components/core-overlay/tests/html/core-overlay-quick-close.html +45 -0
- data/public/bower_components/core-overlay/tests/html/core-overlay-scroll.html +130 -0
- data/public/bower_components/core-overlay/tests/js/htmltests.js +7 -0
- data/public/bower_components/core-overlay/tests/runner.html +14 -0
- data/public/bower_components/core-overlay/tests/tests.json +6 -0
- data/public/bower_components/core-pages/.bower.json +19 -0
- data/public/bower_components/core-pages/README.md +4 -0
- data/public/bower_components/core-pages/bower.json +8 -0
- data/public/bower_components/core-pages/core-pages.css +30 -0
- data/public/bower_components/core-pages/core-pages.html +44 -0
- data/public/bower_components/core-pages/demo.html +136 -0
- data/public/bower_components/core-pages/index.html +22 -0
- data/public/bower_components/core-pages/metadata.html +25 -0
- data/public/bower_components/core-resizable/.bower.json +18 -0
- data/public/bower_components/core-resizable/README.md +4 -0
- data/public/bower_components/core-resizable/bower.json +8 -0
- data/public/bower_components/core-resizable/core-resizable.html +248 -0
- data/public/bower_components/core-resizable/index.html +22 -0
- data/public/bower_components/core-resizable/test/basic.html +504 -0
- data/public/bower_components/core-resizable/test/index.html +16 -0
- data/public/bower_components/core-resizable/test/test-elements.html +66 -0
- data/public/bower_components/core-scaffold/.bower.json +22 -0
- data/public/bower_components/core-scaffold/README.md +4 -0
- data/public/bower_components/core-scaffold/bower.json +11 -0
- data/public/bower_components/core-scaffold/core-scaffold.html +252 -0
- data/public/bower_components/core-scaffold/demo.html +82 -0
- data/public/bower_components/core-scaffold/index.html +22 -0
- data/public/bower_components/core-scaffold/metadata.html +52 -0
- data/public/bower_components/core-selection/.bower.json +21 -0
- data/public/bower_components/core-selection/README.md +4 -0
- data/public/bower_components/core-selection/bower.json +11 -0
- data/public/bower_components/core-selection/core-selection.html +149 -0
- data/public/bower_components/core-selection/demo.html +59 -0
- data/public/bower_components/core-selection/index.html +22 -0
- data/public/bower_components/core-selection/test/basic.html +62 -0
- data/public/bower_components/core-selection/test/index.html +25 -0
- data/public/bower_components/core-selection/test/multi.html +63 -0
- data/public/bower_components/core-selector/.bower.json +22 -0
- data/public/bower_components/core-selector/.gitignore +2 -0
- data/public/bower_components/core-selector/README.md +4 -0
- data/public/bower_components/core-selector/bower.json +12 -0
- data/public/bower_components/core-selector/core-selector.html +548 -0
- data/public/bower_components/core-selector/demo.html +106 -0
- data/public/bower_components/core-selector/index.html +22 -0
- data/public/bower_components/core-selector/metadata.html +20 -0
- data/public/bower_components/core-selector/test/activate-event.html +63 -0
- data/public/bower_components/core-selector/test/basic.html +126 -0
- data/public/bower_components/core-selector/test/content.html +101 -0
- data/public/bower_components/core-selector/test/index.html +30 -0
- data/public/bower_components/core-selector/test/multi.html +115 -0
- data/public/bower_components/core-selector/test/next-previous.html +113 -0
- data/public/bower_components/core-selector/test/selected-attr-prop.html +62 -0
- data/public/bower_components/core-selector/test/template-repeat.html +63 -0
- data/public/bower_components/core-style/.bower.json +18 -0
- data/public/bower_components/core-style/README.md +4 -0
- data/public/bower_components/core-style/bower.json +8 -0
- data/public/bower_components/core-style/core-style.html +387 -0
- data/public/bower_components/core-style/demo.html +58 -0
- data/public/bower_components/core-style/elements.html +55 -0
- data/public/bower_components/core-style/index.html +22 -0
- data/public/bower_components/core-style/my-theme.html +73 -0
- data/public/bower_components/core-toolbar/.bower.json +19 -0
- data/public/bower_components/core-toolbar/README.md +4 -0
- data/public/bower_components/core-toolbar/bower.json +9 -0
- data/public/bower_components/core-toolbar/core-toolbar.css +117 -0
- data/public/bower_components/core-toolbar/core-toolbar.html +155 -0
- data/public/bower_components/core-toolbar/demo.html +119 -0
- data/public/bower_components/core-toolbar/index.html +22 -0
- data/public/bower_components/core-toolbar/metadata.html +28 -0
- data/public/bower_components/core-toolbar/test/basic.html +86 -0
- data/public/bower_components/core-toolbar/test/index.html +24 -0
- data/public/bower_components/core-transition/.bower.json +19 -0
- data/public/bower_components/core-transition/README.md +2 -0
- data/public/bower_components/core-transition/bower.json +9 -0
- data/public/bower_components/core-transition/core-transition-css.html +220 -0
- data/public/bower_components/core-transition/core-transition-overlay.css +46 -0
- data/public/bower_components/core-transition/core-transition.html +140 -0
- data/public/bower_components/core-transition/demo.html +87 -0
- data/public/bower_components/core-transition/index.html +22 -0
- data/public/bower_components/font-roboto/.bower.json +15 -0
- data/public/bower_components/font-roboto/roboto.html +9 -0
- data/public/bower_components/paper-button/.bower.json +27 -0
- data/public/bower_components/paper-button/README.md +4 -0
- data/public/bower_components/paper-button/bower.json +16 -0
- data/public/bower_components/paper-button/demo.html +157 -0
- data/public/bower_components/paper-button/index.html +22 -0
- data/public/bower_components/paper-button/metadata.html +17 -0
- data/public/bower_components/paper-button/paper-button-base.html +164 -0
- data/public/bower_components/paper-button/paper-button.html +197 -0
- data/public/bower_components/paper-button/test/index.html +24 -0
- data/public/bower_components/paper-button/test/paper-button.html +112 -0
- data/public/bower_components/paper-icon-button/.bower.json +25 -0
- data/public/bower_components/paper-icon-button/README.md +4 -0
- data/public/bower_components/paper-icon-button/bower.json +15 -0
- data/public/bower_components/paper-icon-button/demo.html +150 -0
- data/public/bower_components/paper-icon-button/index.html +22 -0
- data/public/bower_components/paper-icon-button/metadata.html +21 -0
- data/public/bower_components/paper-icon-button/paper-icon-button.html +154 -0
- data/public/bower_components/paper-icon-button/test/a11y.html +68 -0
- data/public/bower_components/paper-icon-button/test/basic.html +50 -0
- data/public/bower_components/paper-icon-button/test/index.html +25 -0
- data/public/bower_components/paper-input/.bower.json +26 -0
- data/public/bower_components/paper-input/.gitignore +1 -0
- data/public/bower_components/paper-input/README.md +4 -0
- data/public/bower_components/paper-input/bower.json +15 -0
- data/public/bower_components/paper-input/demo.html +236 -0
- data/public/bower_components/paper-input/index.html +22 -0
- data/public/bower_components/paper-input/metadata.html +20 -0
- data/public/bower_components/paper-input/paper-autogrow-textarea.html +162 -0
- data/public/bower_components/paper-input/paper-char-counter.html +121 -0
- data/public/bower_components/paper-input/paper-input-decorator.css +132 -0
- data/public/bower_components/paper-input/paper-input-decorator.html +547 -0
- data/public/bower_components/paper-input/paper-input.html +145 -0
- data/public/bower_components/paper-input/test/index.html +26 -0
- data/public/bower_components/paper-input/test/paper-autogrow-textarea.html +146 -0
- data/public/bower_components/paper-input/test/paper-input-decorator.html +240 -0
- data/public/bower_components/paper-input/test/paper-input.html +68 -0
- data/public/bower_components/paper-input/test/util.js +15 -0
- data/public/bower_components/paper-radio-button/.bower.json +22 -0
- data/public/bower_components/paper-radio-button/README.md +4 -0
- data/public/bower_components/paper-radio-button/bower.json +12 -0
- data/public/bower_components/paper-radio-button/demo.html +84 -0
- data/public/bower_components/paper-radio-button/index.html +22 -0
- data/public/bower_components/paper-radio-button/metadata.html +17 -0
- data/public/bower_components/paper-radio-button/paper-radio-button.css +108 -0
- data/public/bower_components/paper-radio-button/paper-radio-button.html +166 -0
- data/public/bower_components/paper-ripple/.bower.json +23 -0
- data/public/bower_components/paper-ripple/README.md +4 -0
- data/public/bower_components/paper-ripple/bower.json +13 -0
- data/public/bower_components/paper-ripple/demo.html +414 -0
- data/public/bower_components/paper-ripple/index.html +22 -0
- data/public/bower_components/paper-ripple/metadata.html +20 -0
- data/public/bower_components/paper-ripple/paper-ripple.html +477 -0
- data/public/bower_components/paper-ripple/test/index.html +24 -0
- data/public/bower_components/paper-ripple/test/position.html +109 -0
- data/public/bower_components/paper-shadow/.bower.json +22 -0
- data/public/bower_components/paper-shadow/README.md +4 -0
- data/public/bower_components/paper-shadow/bower.json +11 -0
- data/public/bower_components/paper-shadow/demo.html +134 -0
- data/public/bower_components/paper-shadow/index.html +22 -0
- data/public/bower_components/paper-shadow/metadata.html +17 -0
- data/public/bower_components/paper-shadow/paper-shadow.css +66 -0
- data/public/bower_components/paper-shadow/paper-shadow.html +86 -0
- data/public/bower_components/paper-shadow/test/basic.html +62 -0
- data/public/bower_components/paper-shadow/test/index.html +24 -0
- data/public/bower_components/paper-tabs/.bower.json +26 -0
- data/public/bower_components/paper-tabs/README.md +4 -0
- data/public/bower_components/paper-tabs/bower.json +15 -0
- data/public/bower_components/paper-tabs/demo.html +242 -0
- data/public/bower_components/paper-tabs/index.html +22 -0
- data/public/bower_components/paper-tabs/metadata.html +58 -0
- data/public/bower_components/paper-tabs/paper-tab.css +59 -0
- data/public/bower_components/paper-tabs/paper-tab.html +82 -0
- data/public/bower_components/paper-tabs/paper-tabs.css +80 -0
- data/public/bower_components/paper-tabs/paper-tabs.html +353 -0
- data/public/bower_components/paper-toast/.bower.json +22 -0
- data/public/bower_components/paper-toast/README.md +4 -0
- data/public/bower_components/paper-toast/bower.json +11 -0
- data/public/bower_components/paper-toast/demo.html +63 -0
- data/public/bower_components/paper-toast/index.html +22 -0
- data/public/bower_components/paper-toast/metadata.html +20 -0
- data/public/bower_components/paper-toast/paper-toast.css +80 -0
- data/public/bower_components/paper-toast/paper-toast.html +296 -0
- data/public/bower_components/paper-toggle-button/.bower.json +20 -0
- data/public/bower_components/paper-toggle-button/README.md +4 -0
- data/public/bower_components/paper-toggle-button/bower.json +9 -0
- data/public/bower_components/paper-toggle-button/demo.html +97 -0
- data/public/bower_components/paper-toggle-button/index.html +22 -0
- data/public/bower_components/paper-toggle-button/metadata.html +17 -0
- data/public/bower_components/paper-toggle-button/paper-toggle-button.css +95 -0
- data/public/bower_components/paper-toggle-button/paper-toggle-button.html +179 -0
- data/public/bower_components/polymer/.bower.json +32 -0
- data/public/bower_components/polymer/README.md +21 -0
- data/public/bower_components/polymer/bower.json +23 -0
- data/public/bower_components/polymer/build.log +26 -0
- data/public/bower_components/polymer/layout.html +286 -0
- data/public/bower_components/polymer/polymer.html +12 -0
- data/public/bower_components/polymer/polymer.js +11859 -0
- data/public/bower_components/polymer/polymer.min.js +14 -0
- data/public/bower_components/webcomponentsjs/.bower.json +23 -0
- data/public/bower_components/webcomponentsjs/CustomElements.js +634 -0
- data/public/bower_components/webcomponentsjs/CustomElements.min.js +11 -0
- data/public/bower_components/webcomponentsjs/HTMLImports.js +764 -0
- data/public/bower_components/webcomponentsjs/HTMLImports.min.js +11 -0
- data/public/bower_components/webcomponentsjs/README.md +73 -0
- data/public/bower_components/webcomponentsjs/ShadowDOM.js +4277 -0
- data/public/bower_components/webcomponentsjs/ShadowDOM.min.js +13 -0
- data/public/bower_components/webcomponentsjs/bower.json +14 -0
- data/public/bower_components/webcomponentsjs/build.log +31 -0
- data/public/bower_components/webcomponentsjs/package.json +31 -0
- data/public/bower_components/webcomponentsjs/webcomponents-lite.js +1728 -0
- data/public/bower_components/webcomponentsjs/webcomponents-lite.min.js +11 -0
- data/public/bower_components/webcomponentsjs/webcomponents.js +6114 -0
- data/public/bower_components/webcomponentsjs/webcomponents.min.js +14 -0
- data/public/css/main.css +41 -0
- data/public/elements/ec-dashboard/ec-dashboard.html +269 -0
- data/public/polymer-loader.html +24 -0
- data/public/polymer-loader.vulcanized.html +19 -0
- data/spec/ec/ec_dashboard_spec.rb +78 -0
- data/spec/ec/ec_spec.rb +78 -0
- data/spec/spec_helper.rb +27 -0
- data/views/index.html +88 -0
- metadata +464 -0
@@ -0,0 +1,547 @@
|
|
1
|
+
<!--
|
2
|
+
Copyright (c) 2014 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
|
4
|
+
The complete set of authors may be found at http://polymer.github.io/AUTHORS
|
5
|
+
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS
|
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
|
8
|
+
-->
|
9
|
+
|
10
|
+
<!--
|
11
|
+
|
12
|
+
Material Design: <a href="http://www.google.com/design/spec/components/text-fields.html">Text fields</a>
|
13
|
+
|
14
|
+
`paper-input-decorator` adds Material Design input field styling and animations to an element.
|
15
|
+
|
16
|
+
Example:
|
17
|
+
|
18
|
+
<paper-input-decorator label="Your Name">
|
19
|
+
<input is="core-input">
|
20
|
+
</paper-input-decorator>
|
21
|
+
|
22
|
+
<paper-input-decorator floatingLabel label="Your address">
|
23
|
+
<textarea></textarea>
|
24
|
+
</paper-input-decorator>
|
25
|
+
|
26
|
+
Theming
|
27
|
+
-------
|
28
|
+
|
29
|
+
`paper-input-decorator` uses `core-style` for global theming. The following options are available:
|
30
|
+
|
31
|
+
- `CoreStyle.g.paperInput.labelColor` - The inline label, floating label, error message and error icon color when the input does not have focus.
|
32
|
+
- `CoreStyle.g.paperInput.focusedColor` - The floating label and the underline color when the input has focus.
|
33
|
+
- `CoreStyle.g.paperInput.invalidColor` - The error message, the error icon, the floating label and the underline's color when the input is invalid and has focus.
|
34
|
+
|
35
|
+
To add custom styling to only some elements, use these selectors:
|
36
|
+
|
37
|
+
paper-input-decorator /deep/ .label-text,
|
38
|
+
paper-input-decorator /deep/ .error {
|
39
|
+
/* inline label, floating label, error message and error icon color when the input is unfocused */
|
40
|
+
color: green;
|
41
|
+
}
|
42
|
+
|
43
|
+
paper-input-decorator /deep/ ::-webkit-input-placeholder {
|
44
|
+
/* platform specific rules for placeholder text */
|
45
|
+
color: green;
|
46
|
+
}
|
47
|
+
paper-input-decorator /deep/ ::-moz-placeholder {
|
48
|
+
color: green;
|
49
|
+
}
|
50
|
+
paper-input-decorator /deep/ :-ms-input-placeholder {
|
51
|
+
color: green;
|
52
|
+
}
|
53
|
+
|
54
|
+
paper-input-decorator /deep/ .unfocused-underline {
|
55
|
+
/* line color when the input is unfocused */
|
56
|
+
background-color: green;
|
57
|
+
}
|
58
|
+
|
59
|
+
paper-input-decorator[focused] /deep/ .floating-label .label-text {
|
60
|
+
/* floating label color when the input is focused */
|
61
|
+
color: orange;
|
62
|
+
}
|
63
|
+
|
64
|
+
paper-input-decorator /deep/ .focused-underline {
|
65
|
+
/* line color when the input is focused */
|
66
|
+
background-color: orange;
|
67
|
+
}
|
68
|
+
|
69
|
+
paper-input-decorator.invalid[focused] /deep/ .floated-label .label-text,
|
70
|
+
paper-input-decorator[focused] /deep/ .error {
|
71
|
+
/* floating label, error message nad error icon color when the input is invalid and focused */
|
72
|
+
color: salmon;
|
73
|
+
}
|
74
|
+
|
75
|
+
paper-input-decorator.invalid /deep/ .focused-underline {
|
76
|
+
/* line and color when the input is invalid and focused */
|
77
|
+
background-color: salmon;
|
78
|
+
}
|
79
|
+
|
80
|
+
Form submission
|
81
|
+
---------------
|
82
|
+
|
83
|
+
You can use inputs decorated with this element in a `form` as usual.
|
84
|
+
|
85
|
+
Validation
|
86
|
+
----------
|
87
|
+
|
88
|
+
Because you provide the `input` element to `paper-input-decorator`, you can use any validation library
|
89
|
+
or the <a href="https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/HTML5/Constraint_validation">HTML5 Constraints Validation API</a>
|
90
|
+
to implement validation. Set the `isInvalid` attribute when the input is validated, and provide an
|
91
|
+
error message in the `error` attribute.
|
92
|
+
|
93
|
+
Example:
|
94
|
+
|
95
|
+
<paper-input-decorator id="paper1" error="Value must start with a number!">
|
96
|
+
<input id="input1" is="core-input" pattern="^[0-9].*">
|
97
|
+
</paper-input-decorator>
|
98
|
+
<button onclick="validate()"></button>
|
99
|
+
<script>
|
100
|
+
function validate() {
|
101
|
+
var decorator = document.getElementById('paper1');
|
102
|
+
var input = document.getElementById('input1');
|
103
|
+
decorator.isInvalid = !input.validity.valid;
|
104
|
+
}
|
105
|
+
</script>
|
106
|
+
|
107
|
+
Example to validate as the user types:
|
108
|
+
|
109
|
+
<template is="auto-binding">
|
110
|
+
<paper-input-decorator id="paper2" error="Value must start with a number!" isInvalid="{{!$.input2.validity.valid}}">
|
111
|
+
<input id="input2" is="core-input" pattern="^[0-9].*">
|
112
|
+
</paper-input-decorator>
|
113
|
+
</template>
|
114
|
+
|
115
|
+
Accessibility
|
116
|
+
-------------
|
117
|
+
|
118
|
+
`paper-input-decorator` will automatically set the `aria-label` attribute on the nested input
|
119
|
+
to the value of `label`. Do not set the `placeholder` attribute on the nested input, as it will
|
120
|
+
conflict with this element.
|
121
|
+
|
122
|
+
@group Paper Elements
|
123
|
+
@element paper-input-decorator
|
124
|
+
@homepage github.io
|
125
|
+
-->
|
126
|
+
<link href="../polymer/polymer.html" rel="import">
|
127
|
+
<link href="../core-icon/core-icon.html" rel="import">
|
128
|
+
<link href="../core-icons/core-icons.html" rel="import">
|
129
|
+
<link href="../core-input/core-input.html" rel="import">
|
130
|
+
<link href="../core-style/core-style.html" rel="import">
|
131
|
+
|
132
|
+
<core-style id="paper-input-decorator">
|
133
|
+
|
134
|
+
.label-text,
|
135
|
+
.error {
|
136
|
+
color: {{g.paperInput.labelColor}};
|
137
|
+
}
|
138
|
+
|
139
|
+
::-webkit-input-placeholder {
|
140
|
+
color: {{g.paperInput.labelColor}};
|
141
|
+
}
|
142
|
+
|
143
|
+
::-moz-placeholder {
|
144
|
+
color: {{g.paperInput.labelColor}};
|
145
|
+
}
|
146
|
+
|
147
|
+
:-ms-input-placeholder {
|
148
|
+
color: {{g.paperInput.labelColor}};
|
149
|
+
}
|
150
|
+
|
151
|
+
.unfocused-underline {
|
152
|
+
background-color: {{g.paperInput.labelColor}};
|
153
|
+
}
|
154
|
+
|
155
|
+
:host([focused]) .floated-label .label-text {
|
156
|
+
color: {{g.paperInput.focusedColor}};
|
157
|
+
}
|
158
|
+
|
159
|
+
.focused-underline {
|
160
|
+
background-color: {{g.paperInput.focusedColor}};
|
161
|
+
}
|
162
|
+
|
163
|
+
:host(.invalid) .floated-label .label-text,
|
164
|
+
.error {
|
165
|
+
color: {{g.paperInput.invalidColor}};
|
166
|
+
}
|
167
|
+
|
168
|
+
:host(.invalid) .unfocused-underline,
|
169
|
+
:host(.invalid) .focused-underline {
|
170
|
+
background-color: {{g.paperInput.invalidColor}};
|
171
|
+
}
|
172
|
+
|
173
|
+
</core-style>
|
174
|
+
|
175
|
+
<polymer-element name="paper-input-decorator" layout vertical
|
176
|
+
on-transitionEnd="{{transitionEndAction}}" on-webkitTransitionEnd="{{transitionEndAction}}"
|
177
|
+
on-input="{{inputAction}}"
|
178
|
+
on-down="{{downAction}}"
|
179
|
+
on-tap="{{tapAction}}"
|
180
|
+
on-char-counter-error="{{charCounterErrorAction}}">
|
181
|
+
|
182
|
+
<template>
|
183
|
+
|
184
|
+
<link href="paper-input-decorator.css" rel="stylesheet">
|
185
|
+
<core-style ref="paper-input-decorator"></core-style>
|
186
|
+
|
187
|
+
<div class="floated-label" aria-hidden="true" hidden?="{{!floatingLabel}}" invisible?="{{!floatingLabelVisible || labelAnimated}}">
|
188
|
+
<!-- needed for floating label animation measurement -->
|
189
|
+
<span id="floatedLabelText" class="label-text">{{label}}</span>
|
190
|
+
</div>
|
191
|
+
|
192
|
+
<div class="input-body" flex auto relative>
|
193
|
+
|
194
|
+
<div class="label" fit invisible aria-hidden="true">
|
195
|
+
<!-- needed for floating label animation measurement -->
|
196
|
+
<span id="labelText" class="label-text" invisible?="{{!_labelVisible}}" animated?="{{labelAnimated}}">{{label}}</span>
|
197
|
+
</div>
|
198
|
+
|
199
|
+
<content select="*:not(.counter)"></content>
|
200
|
+
|
201
|
+
</div>
|
202
|
+
|
203
|
+
<div id="underline" class="underline" relative>
|
204
|
+
<div class="unfocused-underline" fit invisible?="{{disabled}}"></div>
|
205
|
+
<div id="focusedUnderline" class="focused-underline" fit invisible?="{{!underlineVisible}}" animated?="{{underlineAnimated}}"></div>
|
206
|
+
</div>
|
207
|
+
|
208
|
+
<div class="footer" layout horizontal end-justified>
|
209
|
+
<div class="error" flex layout horizontal center hidden?="{{!isInvalid}}">
|
210
|
+
<div class="error-text" flex auto role="alert" aria-hidden="{{!isInvalid}}">{{error}}</div>
|
211
|
+
<core-icon id="errorIcon" class="error-icon" icon="warning"></core-icon>
|
212
|
+
</div>
|
213
|
+
<div aria-hidden="true">
|
214
|
+
<content select=".counter"></content>
|
215
|
+
</div>
|
216
|
+
</div>
|
217
|
+
|
218
|
+
</template>
|
219
|
+
|
220
|
+
<script>
|
221
|
+
|
222
|
+
(function() {
|
223
|
+
|
224
|
+
var paperInput = CoreStyle.g.paperInput = CoreStyle.g.paperInput || {};
|
225
|
+
|
226
|
+
paperInput.labelColor = '#757575';
|
227
|
+
paperInput.focusedColor = '#4059a9';
|
228
|
+
paperInput.invalidColor = '#d34336';
|
229
|
+
|
230
|
+
Polymer({
|
231
|
+
|
232
|
+
publish: {
|
233
|
+
|
234
|
+
/**
|
235
|
+
* The label for this input. It normally appears as grey text inside
|
236
|
+
* the text input and disappears once the user enters text.
|
237
|
+
*
|
238
|
+
* @attribute label
|
239
|
+
* @type string
|
240
|
+
* @default ''
|
241
|
+
*/
|
242
|
+
label: '',
|
243
|
+
|
244
|
+
/**
|
245
|
+
* If true, the label will "float" above the text input once the
|
246
|
+
* user enters text instead of disappearing.
|
247
|
+
*
|
248
|
+
* @attribute floatingLabel
|
249
|
+
* @type boolean
|
250
|
+
* @default false
|
251
|
+
*/
|
252
|
+
floatingLabel: false,
|
253
|
+
|
254
|
+
/**
|
255
|
+
* Set to true to style the element as disabled.
|
256
|
+
*
|
257
|
+
* @attribute disabled
|
258
|
+
* @type boolean
|
259
|
+
* @default false
|
260
|
+
*/
|
261
|
+
disabled: {value: false, reflect: true},
|
262
|
+
|
263
|
+
/**
|
264
|
+
* Use this property to override the automatic label visibility.
|
265
|
+
* If this property is set to `true` or `false`, the label visibility
|
266
|
+
* will respect this value instead of be based on whether there is
|
267
|
+
* a non-null value in the input.
|
268
|
+
*
|
269
|
+
* @attribute labelVisible
|
270
|
+
* @type boolean
|
271
|
+
* @default false
|
272
|
+
*/
|
273
|
+
labelVisible: null,
|
274
|
+
|
275
|
+
/**
|
276
|
+
* Set this property to true to show the error message.
|
277
|
+
*
|
278
|
+
* @attribute isInvalid
|
279
|
+
* @type boolean
|
280
|
+
* @default false
|
281
|
+
*/
|
282
|
+
isInvalid: false,
|
283
|
+
|
284
|
+
/**
|
285
|
+
* Set this property to true to validate the input as the user types.
|
286
|
+
* This will not validate when changing the input programmatically; call
|
287
|
+
* `validate()` instead.
|
288
|
+
*
|
289
|
+
* @attribute autoValidate
|
290
|
+
* @type boolean
|
291
|
+
* @default false
|
292
|
+
*/
|
293
|
+
autoValidate: false,
|
294
|
+
|
295
|
+
/**
|
296
|
+
* The message to display if the input value fails validation. If this
|
297
|
+
* is unset or the empty string, a default message is displayed depending
|
298
|
+
* on the type of validation error.
|
299
|
+
*
|
300
|
+
* @attribute error
|
301
|
+
* @type string
|
302
|
+
*/
|
303
|
+
error: '',
|
304
|
+
|
305
|
+
focused: {value: false, reflect: true}
|
306
|
+
|
307
|
+
},
|
308
|
+
|
309
|
+
computed: {
|
310
|
+
floatingLabelVisible: 'floatingLabel && !_labelVisible',
|
311
|
+
_labelVisible: '(labelVisible === true || labelVisible === false) ? labelVisible : _autoLabelVisible'
|
312
|
+
},
|
313
|
+
|
314
|
+
ready: function() {
|
315
|
+
// Delegate focus/blur events
|
316
|
+
Polymer.addEventListener(this, 'focus', this.focusAction.bind(this), true);
|
317
|
+
Polymer.addEventListener(this, 'blur', this.blurAction.bind(this), true);
|
318
|
+
},
|
319
|
+
|
320
|
+
attached: function() {
|
321
|
+
this.input = this.querySelector('input,textarea');
|
322
|
+
|
323
|
+
this.mo = new MutationObserver(function() {
|
324
|
+
this.input = this.querySelector('input,textarea');
|
325
|
+
}.bind(this));
|
326
|
+
this.mo.observe(this, {childList: true});
|
327
|
+
},
|
328
|
+
|
329
|
+
detached: function() {
|
330
|
+
this.mo.disconnect();
|
331
|
+
this.mo = null;
|
332
|
+
},
|
333
|
+
|
334
|
+
prepareLabelTransform: function() {
|
335
|
+
var toRect = this.$.floatedLabelText.getBoundingClientRect();
|
336
|
+
var fromRect = this.$.labelText.getBoundingClientRect();
|
337
|
+
if (toRect.width !== 0) {
|
338
|
+
var sy = toRect.height / fromRect.height;
|
339
|
+
this.$.labelText.cachedTransform =
|
340
|
+
'scale3d(' + (toRect.width / fromRect.width) + ',' + sy + ',1) ' +
|
341
|
+
'translate3d(0,' + (toRect.top - fromRect.top) / sy + 'px,0)';
|
342
|
+
}
|
343
|
+
},
|
344
|
+
|
345
|
+
animateFloatingLabel: function() {
|
346
|
+
if (!this.floatingLabel || this.labelAnimated) {
|
347
|
+
return false;
|
348
|
+
}
|
349
|
+
|
350
|
+
if (!this.$.labelText.cachedTransform) {
|
351
|
+
this.prepareLabelTransform();
|
352
|
+
}
|
353
|
+
|
354
|
+
// If there's still no cached transform, the input is invisible so don't
|
355
|
+
// do the animation.
|
356
|
+
if (!this.$.labelText.cachedTransform) {
|
357
|
+
return false;
|
358
|
+
}
|
359
|
+
|
360
|
+
this.labelAnimated = true;
|
361
|
+
// Handle interrupted animation
|
362
|
+
this.async(function() {
|
363
|
+
this.transitionEndAction();
|
364
|
+
}, null, 250);
|
365
|
+
|
366
|
+
if (this._labelVisible) {
|
367
|
+
// Handle if the label started out floating
|
368
|
+
if (!this.$.labelText.style.webkitTransform && !this.$.labelText.style.transform) {
|
369
|
+
this.$.labelText.style.webkitTransform = this.$.labelText.cachedTransform;
|
370
|
+
this.$.labelText.style.transform = this.$.labelText.cachedTransform;
|
371
|
+
this.$.labelText.offsetTop;
|
372
|
+
}
|
373
|
+
this.$.labelText.style.webkitTransform = '';
|
374
|
+
this.$.labelText.style.transform = '';
|
375
|
+
} else {
|
376
|
+
this.$.labelText.style.webkitTransform = this.$.labelText.cachedTransform;
|
377
|
+
this.$.labelText.style.transform = this.$.labelText.cachedTransform;
|
378
|
+
this.input.placeholder = '';
|
379
|
+
}
|
380
|
+
|
381
|
+
return true;
|
382
|
+
},
|
383
|
+
|
384
|
+
animateUnderline: function(e) {
|
385
|
+
if (this.focused) {
|
386
|
+
var rect = this.$.underline.getBoundingClientRect();
|
387
|
+
var right = e.x - rect.left;
|
388
|
+
this.$.focusedUnderline.style.mozTransformOrigin = right + 'px';
|
389
|
+
this.$.focusedUnderline.style.webkitTransformOrigin = right + 'px ';
|
390
|
+
this.$.focusedUnderline.style.transformOriginX = right + 'px';
|
391
|
+
|
392
|
+
// Animations only run when the user interacts with the input
|
393
|
+
this.underlineAnimated = true;
|
394
|
+
}
|
395
|
+
},
|
396
|
+
|
397
|
+
/**
|
398
|
+
* Validate the input using HTML5 Constraints.
|
399
|
+
*
|
400
|
+
* @method validate
|
401
|
+
* @return {boolean} True if the input is valid.
|
402
|
+
*/
|
403
|
+
validate: function() {
|
404
|
+
this.isInvalid = !this.input.validity.valid;
|
405
|
+
return this.input.validity.valid;
|
406
|
+
},
|
407
|
+
|
408
|
+
_labelVisibleChanged: function(old) {
|
409
|
+
// do not do the animation on first render
|
410
|
+
if (old !== undefined) {
|
411
|
+
if (!this.animateFloatingLabel()) {
|
412
|
+
this.updateInputLabel(this.input, this.label);
|
413
|
+
}
|
414
|
+
}
|
415
|
+
},
|
416
|
+
|
417
|
+
labelVisibleChanged: function() {
|
418
|
+
if (this.labelVisible === 'true') {
|
419
|
+
this.labelVisible = true;
|
420
|
+
} else if (this.labelVisible === 'false') {
|
421
|
+
this.labelVisible = false;
|
422
|
+
}
|
423
|
+
},
|
424
|
+
|
425
|
+
labelChanged: function() {
|
426
|
+
if (this.input) {
|
427
|
+
this.updateInputLabel(this.input, this.label);
|
428
|
+
}
|
429
|
+
},
|
430
|
+
|
431
|
+
isInvalidChanged: function() {
|
432
|
+
this.classList.toggle('invalid', this.isInvalid);
|
433
|
+
},
|
434
|
+
|
435
|
+
focusedChanged: function() {
|
436
|
+
this.updateLabelVisibility(this.input && this.input.value);
|
437
|
+
if (this.lastEvent) {
|
438
|
+
this.animateUnderline(this.lastEvent);
|
439
|
+
this.lastEvent = null;
|
440
|
+
}
|
441
|
+
this.underlineVisible = this.focused;
|
442
|
+
},
|
443
|
+
|
444
|
+
inputChanged: function(old) {
|
445
|
+
if (this.input) {
|
446
|
+
this.updateLabelVisibility(this.input.value);
|
447
|
+
this.updateInputLabel(this.input, this.label);
|
448
|
+
|
449
|
+
if (this.autoValidate) {
|
450
|
+
this.validate();
|
451
|
+
}
|
452
|
+
}
|
453
|
+
if (old) {
|
454
|
+
this.updateInputLabel(old, '');
|
455
|
+
}
|
456
|
+
},
|
457
|
+
|
458
|
+
focusAction: function() {
|
459
|
+
this.focused = true;
|
460
|
+
},
|
461
|
+
|
462
|
+
blurAction: function() {
|
463
|
+
this.focused = false;
|
464
|
+
},
|
465
|
+
|
466
|
+
/**
|
467
|
+
* Updates the label visibility based on a value. This is handled automatically
|
468
|
+
* if the user is typing, but if you imperatively set the input value you need
|
469
|
+
* to call this function.
|
470
|
+
*
|
471
|
+
* @method updateLabelVisibility
|
472
|
+
* @param {string} value
|
473
|
+
*/
|
474
|
+
updateLabelVisibility: function(value) {
|
475
|
+
var v = (value !== null && value !== undefined) ? String(value) : value;
|
476
|
+
this._autoLabelVisible = (!this.focused && !v) || (!this.floatingLabel && !v);
|
477
|
+
},
|
478
|
+
|
479
|
+
updateInputLabel: function(input, label) {
|
480
|
+
if (this._labelVisible) {
|
481
|
+
this.input.placeholder = this.label;
|
482
|
+
} else {
|
483
|
+
this.input.placeholder = '';
|
484
|
+
}
|
485
|
+
if (label) {
|
486
|
+
input.setAttribute('aria-label', label);
|
487
|
+
} else {
|
488
|
+
input.removeAttribute('aria-label');
|
489
|
+
}
|
490
|
+
},
|
491
|
+
|
492
|
+
inputAction: function() {
|
493
|
+
this.updateLabelVisibility(this.input.value);
|
494
|
+
if (this.autoValidate) {
|
495
|
+
this.validate();
|
496
|
+
}
|
497
|
+
},
|
498
|
+
|
499
|
+
downAction: function(e) {
|
500
|
+
// eat the event and do nothing if already focused
|
501
|
+
if (e.target !== this.input && this.focused) {
|
502
|
+
e.preventDefault();
|
503
|
+
return;
|
504
|
+
}
|
505
|
+
// cache the event here because "down" fires before "focus" when tapping on
|
506
|
+
// the input and the underline animation runs on focus change
|
507
|
+
this.lastEvent = e;
|
508
|
+
},
|
509
|
+
|
510
|
+
tapAction: function(e) {
|
511
|
+
if (this.disabled) {
|
512
|
+
return;
|
513
|
+
}
|
514
|
+
|
515
|
+
if (this.focused) {
|
516
|
+
return;
|
517
|
+
}
|
518
|
+
|
519
|
+
if (this.input) {
|
520
|
+
this.input.focus();
|
521
|
+
e.preventDefault();
|
522
|
+
}
|
523
|
+
},
|
524
|
+
|
525
|
+
transitionEndAction: function() {
|
526
|
+
this.underlineAnimated = false;
|
527
|
+
this.labelAnimated = false;
|
528
|
+
if (this._labelVisible) {
|
529
|
+
this.input.placeholder = this.label;
|
530
|
+
}
|
531
|
+
},
|
532
|
+
|
533
|
+
charCounterErrorAction: function(e) {
|
534
|
+
this.isInvalid = e.detail.hasError;
|
535
|
+
|
536
|
+
// If the allowed characters have been exceeded, show either the error
|
537
|
+
// icon, or the character counter, but not both.
|
538
|
+
this.$.errorIcon.hidden = e.detail.hideErrorIcon;
|
539
|
+
}
|
540
|
+
|
541
|
+
});
|
542
|
+
|
543
|
+
}());
|
544
|
+
|
545
|
+
</script>
|
546
|
+
|
547
|
+
</polymer-element>
|
@@ -0,0 +1,145 @@
|
|
1
|
+
<!--
|
2
|
+
Copyright (c) 2014 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
|
4
|
+
The complete set of authors may be found at http://polymer.github.io/AUTHORS
|
5
|
+
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS
|
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
|
8
|
+
-->
|
9
|
+
|
10
|
+
<!--
|
11
|
+
|
12
|
+
Material Design: <a href="http://www.google.com/design/spec/components/text-fields.html#text-fields-single-line-text-field">Single line text field</a>
|
13
|
+
|
14
|
+
`paper-input` is a single-line text field for user input. It is a convenience element composed of
|
15
|
+
a `paper-input-decorator` and a `input is="core-input"`.
|
16
|
+
|
17
|
+
Example:
|
18
|
+
|
19
|
+
<paper-input label="Your Name"></paper-input>
|
20
|
+
|
21
|
+
If you need more control over the `input` element, use `paper-input-decorator`.
|
22
|
+
|
23
|
+
Theming
|
24
|
+
-------
|
25
|
+
|
26
|
+
`paper-input` can be styled similarly to `paper-input-decorator`.
|
27
|
+
|
28
|
+
Form submission
|
29
|
+
---------------
|
30
|
+
|
31
|
+
Unlike inputs using `paper-input-decorator` directly, `paper-input` does not work out of
|
32
|
+
the box with the native `form` element. This is because the native `form` is not aware of
|
33
|
+
shadow DOM and does not treat `paper-input` as a form element.
|
34
|
+
|
35
|
+
Use `paper-input-decorator` directly, or see
|
36
|
+
<a href="https://github.com/garstasio/ajax-form">`ajax-form`</a> for a possible solution
|
37
|
+
to submitting a `paper-input`.
|
38
|
+
|
39
|
+
Validation
|
40
|
+
----------
|
41
|
+
|
42
|
+
Use `paper-input-decorator` if you would like to implement validation.
|
43
|
+
|
44
|
+
@group Paper Elements
|
45
|
+
@element paper-input
|
46
|
+
@homepage github.io
|
47
|
+
-->
|
48
|
+
<link href="../polymer/polymer.html" rel="import">
|
49
|
+
<link href="../core-input/core-input.html" rel="import">
|
50
|
+
|
51
|
+
<link href="paper-input-decorator.html" rel="import">
|
52
|
+
|
53
|
+
<polymer-element name="paper-input">
|
54
|
+
|
55
|
+
<template>
|
56
|
+
|
57
|
+
<style>
|
58
|
+
:host {
|
59
|
+
display: inline-block;
|
60
|
+
}
|
61
|
+
</style>
|
62
|
+
|
63
|
+
<paper-input-decorator id="decorator" label="{{label}}" floatingLabel="{{floatingLabel}}" value="{{value}}" disabled?="{{disabled}}">
|
64
|
+
<input is="core-input" id="input" value="{{value}}" committedValue="{{committedValue}}" on-change="{{changeAction}}" disabled?="{{disabled}}">
|
65
|
+
</paper-input-decorator>
|
66
|
+
|
67
|
+
</template>
|
68
|
+
|
69
|
+
<script>
|
70
|
+
|
71
|
+
Polymer('paper-input', {
|
72
|
+
|
73
|
+
publish: {
|
74
|
+
/**
|
75
|
+
* The label for this input. It normally appears as grey text inside
|
76
|
+
* the text input and disappears once the user enters text.
|
77
|
+
*
|
78
|
+
* @attribute label
|
79
|
+
* @type string
|
80
|
+
* @default ''
|
81
|
+
*/
|
82
|
+
label: '',
|
83
|
+
|
84
|
+
/**
|
85
|
+
* If true, the label will "float" above the text input once the
|
86
|
+
* user enters text instead of disappearing.
|
87
|
+
*
|
88
|
+
* @attribute floatingLabel
|
89
|
+
* @type boolean
|
90
|
+
* @default false
|
91
|
+
*/
|
92
|
+
floatingLabel: false,
|
93
|
+
|
94
|
+
/**
|
95
|
+
* Set to true to style the element as disabled.
|
96
|
+
*
|
97
|
+
* @attribute disabled
|
98
|
+
* @type boolean
|
99
|
+
* @default false
|
100
|
+
*/
|
101
|
+
disabled: {value: false, reflect: true},
|
102
|
+
|
103
|
+
/**
|
104
|
+
* The current value of the input.
|
105
|
+
*
|
106
|
+
* @attribute value
|
107
|
+
* @type String
|
108
|
+
* @default ''
|
109
|
+
*/
|
110
|
+
value: '',
|
111
|
+
|
112
|
+
/**
|
113
|
+
* The most recently committed value of the input.
|
114
|
+
*
|
115
|
+
* @attribute committedValue
|
116
|
+
* @type String
|
117
|
+
* @default ''
|
118
|
+
*/
|
119
|
+
committedValue: ''
|
120
|
+
|
121
|
+
},
|
122
|
+
|
123
|
+
/**
|
124
|
+
* Focuses the `input`.
|
125
|
+
*
|
126
|
+
* @method focus
|
127
|
+
*/
|
128
|
+
focus: function() {
|
129
|
+
this.$.input.focus();
|
130
|
+
},
|
131
|
+
|
132
|
+
valueChanged: function() {
|
133
|
+
this.$.decorator.updateLabelVisibility(this.value);
|
134
|
+
},
|
135
|
+
|
136
|
+
changeAction: function(e) {
|
137
|
+
// re-fire event that does not bubble across shadow roots
|
138
|
+
this.fire('change', null, this);
|
139
|
+
}
|
140
|
+
|
141
|
+
});
|
142
|
+
|
143
|
+
</script>
|
144
|
+
|
145
|
+
</polymer-element>
|