polymer-gold-rails 1.0.0.pre.rc.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 +36 -0
- data/Rakefile +1 -0
- data/app/assets/components/gold-cc-cvc-input/README.md +24 -0
- data/app/assets/components/gold-cc-cvc-input/bower.json +39 -0
- data/app/assets/components/gold-cc-cvc-input/cvc_hint.png +0 -0
- data/app/assets/components/gold-cc-cvc-input/cvc_hint_amex.png +0 -0
- data/app/assets/components/gold-cc-cvc-input/demo/index.html +54 -0
- data/app/assets/components/gold-cc-cvc-input/gold-cc-cvc-input.html +195 -0
- data/app/assets/components/gold-cc-cvc-input/hero.svg +36 -0
- data/app/assets/components/gold-cc-cvc-input/index.html +26 -0
- data/app/assets/components/gold-cc-cvc-input/test/basic.html +125 -0
- data/app/assets/components/gold-cc-cvc-input/test/index.html +25 -0
- data/app/assets/components/gold-cc-expiration-input/README.md +10 -0
- data/app/assets/components/gold-cc-expiration-input/bower.json +40 -0
- data/app/assets/components/gold-cc-expiration-input/date-input.html +157 -0
- data/app/assets/components/gold-cc-expiration-input/date-validator.html +38 -0
- data/app/assets/components/gold-cc-expiration-input/demo/index.html +53 -0
- data/app/assets/components/gold-cc-expiration-input/gold-cc-expiration-input.html +131 -0
- data/app/assets/components/gold-cc-expiration-input/hero.svg +58 -0
- data/app/assets/components/gold-cc-expiration-input/index.html +28 -0
- data/app/assets/components/gold-cc-expiration-input/test/basic.html +126 -0
- data/app/assets/components/gold-cc-expiration-input/test/index.html +25 -0
- data/app/assets/components/gold-cc-input/README.md +9 -0
- data/app/assets/components/gold-cc-input/bower.json +39 -0
- data/app/assets/components/gold-cc-input/cc-validator.js +192 -0
- data/app/assets/components/gold-cc-input/demo/index.html +48 -0
- data/app/assets/components/gold-cc-input/gold-cc-input.html +215 -0
- data/app/assets/components/gold-cc-input/hero.svg +52 -0
- data/app/assets/components/gold-cc-input/images/amex.png +0 -0
- data/app/assets/components/gold-cc-input/images/diners_club.png +0 -0
- data/app/assets/components/gold-cc-input/images/discover.png +0 -0
- data/app/assets/components/gold-cc-input/images/jcb.png +0 -0
- data/app/assets/components/gold-cc-input/images/mastercard.png +0 -0
- data/app/assets/components/gold-cc-input/images/visa.png +0 -0
- data/app/assets/components/gold-cc-input/index.html +28 -0
- data/app/assets/components/gold-cc-input/test/basic.html +136 -0
- data/app/assets/components/gold-cc-input/test/index.html +25 -0
- data/app/assets/components/gold-elements/README.md +12 -0
- data/app/assets/components/gold-elements/bower.json +42 -0
- data/app/assets/components/gold-elements/demo/complex-form.html +127 -0
- data/app/assets/components/gold-elements/demo/index.html +94 -0
- data/app/assets/components/gold-elements/demo/item-card.html +59 -0
- data/app/assets/components/gold-elements/demo/simple-form.css +55 -0
- data/app/assets/components/gold-elements/demo/simple-form.html +93 -0
- data/app/assets/components/gold-elements/screenshot.png +0 -0
- data/app/assets/components/gold-email-input/README.md +8 -0
- data/app/assets/components/gold-email-input/bower.json +40 -0
- data/app/assets/components/gold-email-input/demo/index.html +46 -0
- data/app/assets/components/gold-email-input/email-validator.html +31 -0
- data/app/assets/components/gold-email-input/gold-email-input.html +108 -0
- data/app/assets/components/gold-email-input/hero.svg +59 -0
- data/app/assets/components/gold-email-input/index.html +28 -0
- data/app/assets/components/gold-email-input/test/basic.html +97 -0
- data/app/assets/components/gold-email-input/test/index.html +25 -0
- data/app/assets/components/gold-phone-input/README.md +13 -0
- data/app/assets/components/gold-phone-input/bower.json +39 -0
- data/app/assets/components/gold-phone-input/demo/index.html +53 -0
- data/app/assets/components/gold-phone-input/gold-phone-input.html +197 -0
- data/app/assets/components/gold-phone-input/hero.svg +63 -0
- data/app/assets/components/gold-phone-input/index.html +28 -0
- data/app/assets/components/gold-phone-input/test/basic.html +117 -0
- data/app/assets/components/gold-phone-input/test/index.html +25 -0
- data/app/assets/components/gold-zip-input/README.md +8 -0
- data/app/assets/components/gold-zip-input/bower.json +40 -0
- data/app/assets/components/gold-zip-input/demo/index.html +54 -0
- data/app/assets/components/gold-zip-input/gold-zip-input.html +113 -0
- data/app/assets/components/gold-zip-input/hero.svg +43 -0
- data/app/assets/components/gold-zip-input/index.html +28 -0
- data/app/assets/components/gold-zip-input/test/basic.html +116 -0
- data/app/assets/components/gold-zip-input/test/index.html +25 -0
- data/app/assets/components/gold-zip-input/zip-validator.html +32 -0
- data/app/assets/components/iron-autogrow-textarea/README.md +24 -0
- data/app/assets/components/iron-autogrow-textarea/bower.json +37 -0
- data/app/assets/components/iron-autogrow-textarea/demo/index.html +81 -0
- data/app/assets/components/iron-autogrow-textarea/hero.svg +33 -0
- data/app/assets/components/iron-autogrow-textarea/index.html +30 -0
- data/app/assets/components/iron-autogrow-textarea/iron-autogrow-textarea.html +263 -0
- data/app/assets/components/iron-autogrow-textarea/test/basic.html +94 -0
- data/app/assets/components/iron-autogrow-textarea/test/index.html +25 -0
- data/app/assets/components/iron-flex-layout/README.md +4 -0
- data/app/assets/components/iron-flex-layout/bower.json +21 -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/demo/index.html +40 -0
- data/app/assets/components/iron-flex-layout/demo/x-app.html +106 -0
- data/app/assets/components/iron-flex-layout/iron-flex-layout.html +313 -0
- data/app/assets/components/iron-form-element-behavior/README.md +2 -0
- data/app/assets/components/iron-form-element-behavior/bower.json +27 -0
- data/app/assets/components/iron-form-element-behavior/demo/index.html +53 -0
- data/app/assets/components/iron-form-element-behavior/demo/simple-element.html +27 -0
- data/app/assets/components/iron-form-element-behavior/demo/simple-form.html +42 -0
- data/app/assets/components/iron-form-element-behavior/index.html +30 -0
- data/app/assets/components/iron-form-element-behavior/iron-form-element-behavior.html +50 -0
- data/app/assets/components/iron-icon/README.md +56 -0
- data/app/assets/components/iron-icon/bower.json +29 -0
- data/app/assets/components/iron-icon/demo/index.html +28 -0
- data/app/assets/components/iron-icon/demo/location.png +0 -0
- data/app/assets/components/iron-icon/hero.svg +19 -0
- data/app/assets/components/iron-icon/index.html +26 -0
- data/app/assets/components/iron-icon/iron-icon.html +187 -0
- data/app/assets/components/iron-icon/test/index.html +31 -0
- data/app/assets/components/iron-icon/test/iron-icon.html +120 -0
- data/app/assets/components/iron-input/README.md +16 -0
- data/app/assets/components/iron-input/bower.json +36 -0
- data/app/assets/components/iron-input/demo/index.html +87 -0
- data/app/assets/components/iron-input/hero.svg +19 -0
- data/app/assets/components/iron-input/index.html +30 -0
- data/app/assets/components/iron-input/iron-input.html +235 -0
- data/app/assets/components/iron-input/test/index.html +24 -0
- data/app/assets/components/iron-input/test/iron-input.html +139 -0
- data/app/assets/components/iron-input/test/letters-only.html +30 -0
- data/app/assets/components/iron-meta/README.md +46 -0
- data/app/assets/components/iron-meta/bower.json +28 -0
- data/app/assets/components/iron-meta/demo/index.html +45 -0
- data/app/assets/components/iron-meta/hero.svg +33 -0
- data/app/assets/components/iron-meta/index.html +27 -0
- data/app/assets/components/iron-meta/iron-meta.html +352 -0
- data/app/assets/components/iron-meta/test/basic.html +48 -0
- data/app/assets/components/iron-meta/test/index.html +30 -0
- data/app/assets/components/iron-meta/test/iron-meta.html +186 -0
- data/app/assets/components/iron-validatable-behavior/README.md +3 -0
- data/app/assets/components/iron-validatable-behavior/bower.json +35 -0
- data/app/assets/components/iron-validatable-behavior/demo/cats-only.html +46 -0
- data/app/assets/components/iron-validatable-behavior/demo/index.html +71 -0
- data/app/assets/components/iron-validatable-behavior/demo/validatable-input.html +46 -0
- data/app/assets/components/iron-validatable-behavior/index.html +30 -0
- data/app/assets/components/iron-validatable-behavior/iron-validatable-behavior.html +101 -0
- data/app/assets/components/iron-validatable-behavior/test/index.html +35 -0
- data/app/assets/components/iron-validatable-behavior/test/iron-validatable-behavior.html +52 -0
- data/app/assets/components/iron-validatable-behavior/test/test-validatable.html +28 -0
- data/app/assets/components/iron-validator-behavior/README.md +4 -0
- data/app/assets/components/iron-validator-behavior/bower.json +34 -0
- data/app/assets/components/iron-validator-behavior/demo/cats-only.html +46 -0
- data/app/assets/components/iron-validator-behavior/demo/index.html +144 -0
- data/app/assets/components/iron-validator-behavior/index.html +30 -0
- data/app/assets/components/iron-validator-behavior/iron-validator-behavior.html +61 -0
- data/app/assets/components/iron-validator-behavior/test/index.html +34 -0
- data/app/assets/components/iron-validator-behavior/test/iron-validator-behavior.html +47 -0
- data/app/assets/components/iron-validator-behavior/test/simple-validator.html +26 -0
- data/app/assets/components/paper-input/README.md +5 -0
- data/app/assets/components/paper-input/all-imports.html +12 -0
- data/app/assets/components/paper-input/bower.json +44 -0
- data/app/assets/components/paper-input/demo/index.html +96 -0
- data/app/assets/components/paper-input/demo/ssn-input.html +94 -0
- data/app/assets/components/paper-input/demo/ssn-validator.html +31 -0
- data/app/assets/components/paper-input/hero.svg +19 -0
- data/app/assets/components/paper-input/index.html +28 -0
- data/app/assets/components/paper-input/paper-input-addon-behavior.html +47 -0
- data/app/assets/components/paper-input/paper-input-behavior.html +317 -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 +106 -0
- data/app/assets/components/paper-input/test/index.html +28 -0
- data/app/assets/components/paper-input/test/letters-only.html +30 -0
- data/app/assets/components/paper-input/test/paper-input-char-counter.html +112 -0
- data/app/assets/components/paper-input/test/paper-input-container.html +237 -0
- data/app/assets/components/paper-input/test/paper-input-error.html +60 -0
- data/app/assets/components/paper-input/test/paper-input.html +213 -0
- data/app/assets/components/paper-input/test/paper-textarea.html +169 -0
- data/app/assets/components/paper-styles/README.md +3 -0
- data/app/assets/components/paper-styles/bower.json +27 -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/demo-pages.html +72 -0
- data/app/assets/components/paper-styles/demo.css +25 -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/polymer/LICENSE.txt +27 -0
- data/app/assets/components/polymer/bower.json +26 -0
- data/app/assets/components/polymer/build.log +27 -0
- data/app/assets/components/polymer/polymer-micro.html +523 -0
- data/app/assets/components/polymer/polymer-mini.html +1368 -0
- data/app/assets/components/polymer/polymer.html +3768 -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/README.md +125 -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/bower.json +14 -0
- data/app/assets/components/webcomponentsjs/build.log +33 -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-gold-rails.rb +2 -0
- data/lib/polymer-gold-rails/enigne.rb +4 -0
- data/lib/polymer-gold-rails/version.rb +3 -0
- metadata +312 -0
@@ -0,0 +1,99 @@
|
|
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="../paper-styles/paper-styles.html">
|
13
|
+
<link rel="import" href="paper-input-addon-behavior.html">
|
14
|
+
|
15
|
+
<!--
|
16
|
+
`<paper-input-error>` is an error message for use with `<paper-input-container>`. The error is
|
17
|
+
displayed when the `<paper-input-container>` is `invalid`.
|
18
|
+
|
19
|
+
<paper-input-container>
|
20
|
+
<input is="iron-input" pattern="[0-9]*">
|
21
|
+
<paper-input-error>Only numbers are allowed!</paper-input-error>
|
22
|
+
</paper-input-container>
|
23
|
+
|
24
|
+
### Styling
|
25
|
+
|
26
|
+
The following custom properties and mixins are available for styling:
|
27
|
+
|
28
|
+
Custom property | Description | Default
|
29
|
+
----------------|-------------|----------
|
30
|
+
`--paper-input-container-invalid-color` | The foreground color of the error | `--google-red-500`
|
31
|
+
`--paper-input-error` | Mixin applied to the error | `{}`
|
32
|
+
-->
|
33
|
+
<dom-module id="paper-input-error">
|
34
|
+
|
35
|
+
<style>
|
36
|
+
|
37
|
+
:host {
|
38
|
+
/* need to use display: none for role="alert" */
|
39
|
+
display: none;
|
40
|
+
float: left;
|
41
|
+
|
42
|
+
color: var(--paper-input-container-invalid-color, --google-red-500);
|
43
|
+
|
44
|
+
@apply(--paper-font-caption);
|
45
|
+
@apply(--paper-input-error);
|
46
|
+
}
|
47
|
+
|
48
|
+
:host([invalid]) {
|
49
|
+
display: inline-block;
|
50
|
+
};
|
51
|
+
|
52
|
+
</style>
|
53
|
+
|
54
|
+
<template>
|
55
|
+
|
56
|
+
<content></content>
|
57
|
+
|
58
|
+
</template>
|
59
|
+
|
60
|
+
</dom-module>
|
61
|
+
|
62
|
+
<script>
|
63
|
+
|
64
|
+
(function() {
|
65
|
+
|
66
|
+
Polymer({
|
67
|
+
|
68
|
+
is: 'paper-input-error',
|
69
|
+
|
70
|
+
behaviors: [
|
71
|
+
Polymer.PaperInputAddonBehavior
|
72
|
+
],
|
73
|
+
|
74
|
+
hostAttributes: {
|
75
|
+
'role': 'alert'
|
76
|
+
},
|
77
|
+
|
78
|
+
properties: {
|
79
|
+
|
80
|
+
/**
|
81
|
+
* True if the error is showing.
|
82
|
+
*/
|
83
|
+
invalid: {
|
84
|
+
readOnly: true,
|
85
|
+
reflectToAttribute: true,
|
86
|
+
type: Boolean
|
87
|
+
}
|
88
|
+
|
89
|
+
},
|
90
|
+
|
91
|
+
update: function(state) {
|
92
|
+
this._setInvalid(state.invalid);
|
93
|
+
}
|
94
|
+
|
95
|
+
})
|
96
|
+
|
97
|
+
})();
|
98
|
+
|
99
|
+
</script>
|
@@ -0,0 +1,126 @@
|
|
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
|
+
<link rel="import" href="../iron-input/iron-input.html">
|
12
|
+
<link rel="import" href="../iron-form-element-behavior/iron-form-element-behavior.html">
|
13
|
+
<link rel="import" href="paper-input-behavior.html">
|
14
|
+
<link rel="import" href="paper-input-container.html">
|
15
|
+
<link rel="import" href="paper-input-error.html">
|
16
|
+
<link rel="import" href="paper-input-char-counter.html">
|
17
|
+
|
18
|
+
<!--
|
19
|
+
`<paper-input>` is a single-line text field with Material Design styling.
|
20
|
+
|
21
|
+
<paper-input label="Input label"></paper-input>
|
22
|
+
|
23
|
+
It may include an optional error message or character counter.
|
24
|
+
|
25
|
+
<paper-input error-message="Invalid input!" label="Input label"></paper-input>
|
26
|
+
<paper-input char-counter label="Input label"></paper-input>
|
27
|
+
|
28
|
+
See `Polymer.PaperInputBehavior` for more API docs.
|
29
|
+
|
30
|
+
### Styling
|
31
|
+
|
32
|
+
See `Polymer.PaperInputContainer` for a list of custom properties used to
|
33
|
+
style this element.
|
34
|
+
|
35
|
+
@group Paper Elements
|
36
|
+
@element paper-input
|
37
|
+
@hero hero.svg
|
38
|
+
@demo demo/index.html
|
39
|
+
-->
|
40
|
+
|
41
|
+
<dom-module id="paper-input">
|
42
|
+
|
43
|
+
<style>
|
44
|
+
|
45
|
+
:host {
|
46
|
+
display: block;
|
47
|
+
}
|
48
|
+
|
49
|
+
input::-webkit-input-placeholder {
|
50
|
+
color: var(--paper-input-container-color, --secondary-text-color);
|
51
|
+
}
|
52
|
+
|
53
|
+
input:-moz-placeholder {
|
54
|
+
color: var(--paper-input-container-color, --secondary-text-color);
|
55
|
+
}
|
56
|
+
|
57
|
+
input::-moz-placeholder {
|
58
|
+
color: var(--paper-input-container-color, --secondary-text-color);
|
59
|
+
}
|
60
|
+
|
61
|
+
input:-ms-input-placeholder {
|
62
|
+
color: var(--paper-input-container-color, --secondary-text-color);
|
63
|
+
}
|
64
|
+
|
65
|
+
</style>
|
66
|
+
|
67
|
+
<template>
|
68
|
+
|
69
|
+
<paper-input-container no-label-float="[[noLabelFloat]]" always-float-label="[[_computeAlwaysFloatLabel(alwaysFloatLabel,placeholder)]]" auto-validate$="[[autoValidate]]" disabled$="[[disabled]]" invalid="[[invalid]]">
|
70
|
+
|
71
|
+
<label hidden$="[[!label]]">[[label]]</label>
|
72
|
+
|
73
|
+
<input is="iron-input" id="input"
|
74
|
+
aria-labelledby$="[[_ariaLabelledBy]]"
|
75
|
+
aria-describedby$="[[_ariaDescribedBy]]"
|
76
|
+
disabled$="[[disabled]]"
|
77
|
+
bind-value="{{value}}"
|
78
|
+
invalid="{{invalid}}"
|
79
|
+
prevent-invalid-input="[[preventInvalidInput]]"
|
80
|
+
allowed-pattern="[[allowedPattern]]"
|
81
|
+
validator="[[validator]]"
|
82
|
+
type$="[[type]]"
|
83
|
+
pattern$="[[pattern]]"
|
84
|
+
maxlength$="[[maxlength]]"
|
85
|
+
required$="[[required]]"
|
86
|
+
autocomplete$="[[autocomplete]]"
|
87
|
+
autofocus$="[[autofocus]]"
|
88
|
+
inputmode$="[[inputmode]]"
|
89
|
+
minlength$="[[minlength]]"
|
90
|
+
name$="[[name]]"
|
91
|
+
placeholder$="[[placeholder]]"
|
92
|
+
readonly$="[[readonly]]"
|
93
|
+
size$="[[size]]">
|
94
|
+
|
95
|
+
<template is="dom-if" if="[[errorMessage]]">
|
96
|
+
<paper-input-error>[[errorMessage]]</paper-input-error>
|
97
|
+
</template>
|
98
|
+
|
99
|
+
<template is="dom-if" if="[[charCounter]]">
|
100
|
+
<paper-input-char-counter></paper-input-char-counter>
|
101
|
+
</template>
|
102
|
+
|
103
|
+
</paper-input-container>
|
104
|
+
|
105
|
+
</template>
|
106
|
+
|
107
|
+
</dom-module>
|
108
|
+
|
109
|
+
<script>
|
110
|
+
|
111
|
+
(function() {
|
112
|
+
|
113
|
+
Polymer({
|
114
|
+
|
115
|
+
is: 'paper-input',
|
116
|
+
|
117
|
+
behaviors: [
|
118
|
+
Polymer.PaperInputBehavior,
|
119
|
+
Polymer.IronFormElementBehavior
|
120
|
+
]
|
121
|
+
|
122
|
+
})
|
123
|
+
|
124
|
+
})();
|
125
|
+
|
126
|
+
</script>
|
@@ -0,0 +1,106 @@
|
|
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
|
+
<link rel="import" href="../iron-autogrow-textarea/iron-autogrow-textarea.html">
|
12
|
+
<link rel="import" href="../iron-form-element-behavior/iron-form-element-behavior.html">
|
13
|
+
<link rel="import" href="paper-input-behavior.html">
|
14
|
+
<link rel="import" href="paper-input-container.html">
|
15
|
+
<link rel="import" href="paper-input-error.html">
|
16
|
+
<link rel="import" href="paper-input-char-counter.html">
|
17
|
+
|
18
|
+
<!--
|
19
|
+
`<paper-textarea>` is a multi-line text field with Material Design styling.
|
20
|
+
|
21
|
+
<paper-textarea label="Textarea label"></paper-textarea>
|
22
|
+
|
23
|
+
See `Polymer.PaperInputBehavior` for more API docs.
|
24
|
+
|
25
|
+
### Validation
|
26
|
+
|
27
|
+
Currently only `required` and `maxlength` validation is supported.
|
28
|
+
|
29
|
+
### Styling
|
30
|
+
|
31
|
+
See `Polymer.PaperInputContainer` for a list of custom properties used to
|
32
|
+
style this element.
|
33
|
+
-->
|
34
|
+
|
35
|
+
<dom-module id="paper-textarea">
|
36
|
+
<template>
|
37
|
+
|
38
|
+
<paper-input-container no-label-float$="[[noLabelFloat]]" always-float-label="[[_computeAlwaysFloatLabel(alwaysFloatLabel,placeholder)]]" auto-validate$="[[autoValidate]]" disabled$="[[disabled]]" invalid="[[invalid]]">
|
39
|
+
|
40
|
+
<label hidden$="[[!label]]">[[label]]</label>
|
41
|
+
|
42
|
+
<iron-autogrow-textarea id="input" class="paper-input-input"
|
43
|
+
bind-value="{{value}}"
|
44
|
+
autocomplete$="[[autocomplete]]"
|
45
|
+
autofocus$="[[autofocus]]"
|
46
|
+
inputmode$="[[inputmode]]"
|
47
|
+
name$="[[name]]"
|
48
|
+
placeholder$="[[placeholder]]"
|
49
|
+
readonly$="[[readonly]]"
|
50
|
+
required$="[[required]]"
|
51
|
+
maxlength$="[[maxlength]]"></iron-autogrow-textarea>
|
52
|
+
|
53
|
+
<template is="dom-if" if="[[errorMessage]]">
|
54
|
+
<paper-input-error>[[errorMessage]]</paper-input-error>
|
55
|
+
</template>
|
56
|
+
|
57
|
+
<template is="dom-if" if="[[charCounter]]">
|
58
|
+
<paper-input-char-counter></paper-input-char-counter>
|
59
|
+
</template>
|
60
|
+
|
61
|
+
</paper-input-container>
|
62
|
+
|
63
|
+
</template>
|
64
|
+
|
65
|
+
</dom-module>
|
66
|
+
|
67
|
+
<script>
|
68
|
+
|
69
|
+
(function() {
|
70
|
+
|
71
|
+
Polymer({
|
72
|
+
|
73
|
+
is: 'paper-textarea',
|
74
|
+
|
75
|
+
behaviors: [
|
76
|
+
Polymer.PaperInputBehavior,
|
77
|
+
Polymer.IronFormElementBehavior
|
78
|
+
],
|
79
|
+
|
80
|
+
properties: {
|
81
|
+
|
82
|
+
_ariaLabelledBy: {
|
83
|
+
observer: '_ariaLabelledByChanged',
|
84
|
+
type: String
|
85
|
+
},
|
86
|
+
|
87
|
+
_ariaDescribedBy: {
|
88
|
+
observer: '_ariaDescribedByChanged',
|
89
|
+
type: String
|
90
|
+
}
|
91
|
+
|
92
|
+
},
|
93
|
+
|
94
|
+
_ariaLabelledByChanged: function(ariaLabelledBy) {
|
95
|
+
this.$.input.textarea.setAttribute('aria-labelledby', ariaLabelledBy);
|
96
|
+
},
|
97
|
+
|
98
|
+
_ariaDescribedByChanged: function(ariaDescribedBy) {
|
99
|
+
this.$.input.textarea.setAttribute('aria-describedby', ariaDescribedBy);
|
100
|
+
}
|
101
|
+
|
102
|
+
});
|
103
|
+
|
104
|
+
})();
|
105
|
+
|
106
|
+
</script>
|
@@ -0,0 +1,28 @@
|
|
1
|
+
<!doctype html>
|
2
|
+
<!--
|
3
|
+
Copyright (c) 2014 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
|
+
<html>
|
11
|
+
<head>
|
12
|
+
<meta charset="UTF-8">
|
13
|
+
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes">
|
14
|
+
<title>paper-input tests</title>
|
15
|
+
<script src="../../web-component-tester/browser.js"></script>
|
16
|
+
</head>
|
17
|
+
<body>
|
18
|
+
<script>
|
19
|
+
WCT.loadSuites([
|
20
|
+
'paper-input.html',
|
21
|
+
'paper-textarea.html',
|
22
|
+
'paper-input-container.html',
|
23
|
+
'paper-input-error.html',
|
24
|
+
'paper-input-char-counter.html'
|
25
|
+
]);
|
26
|
+
</script>
|
27
|
+
</body>
|
28
|
+
</html>
|
@@ -0,0 +1,30 @@
|
|
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-validator-behavior/iron-validator-behavior.html">
|
13
|
+
|
14
|
+
<script>
|
15
|
+
|
16
|
+
Polymer({
|
17
|
+
|
18
|
+
is: 'letters-only',
|
19
|
+
|
20
|
+
behaviors: [
|
21
|
+
Polymer.IronValidatorBehavior
|
22
|
+
],
|
23
|
+
|
24
|
+
validate: function(value) {
|
25
|
+
return !value || value.match(/^[a-zA-Z]*$/) !== null;
|
26
|
+
}
|
27
|
+
|
28
|
+
});
|
29
|
+
|
30
|
+
</script>
|
@@ -0,0 +1,112 @@
|
|
1
|
+
<!doctype html>
|
2
|
+
<!--
|
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
|
+
<html>
|
11
|
+
<head>
|
12
|
+
|
13
|
+
<title>paper-input-counter tests</title>
|
14
|
+
|
15
|
+
<meta charset="utf-8">
|
16
|
+
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
17
|
+
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1, user-scalable=yes">
|
18
|
+
|
19
|
+
<script src="../../webcomponentsjs/webcomponents-lite.js"></script>
|
20
|
+
|
21
|
+
<script src="../../web-component-tester/browser.js"></script>
|
22
|
+
<script src="../../test-fixture/test-fixture-mocha.js"></script>
|
23
|
+
|
24
|
+
<script src="../../iron-test-helpers/test-helpers.js"></script>
|
25
|
+
|
26
|
+
<link rel="import" href="../../test-fixture/test-fixture.html">
|
27
|
+
<link rel="import" href="../../iron-input/iron-input.html">
|
28
|
+
<link rel="import" href="../paper-input-container.html">
|
29
|
+
<link rel="import" href="../paper-input-char-counter.html">
|
30
|
+
<link rel="import" href="../paper-textarea.html">
|
31
|
+
|
32
|
+
</head>
|
33
|
+
<body>
|
34
|
+
|
35
|
+
<test-fixture id="counter">
|
36
|
+
<template>
|
37
|
+
<paper-input-container>
|
38
|
+
<label id="l">label</label>
|
39
|
+
<input id="i" value="foobar">
|
40
|
+
<paper-input-char-counter id="c"></paper-input-char-counter>
|
41
|
+
</paper-input-container>
|
42
|
+
</template>
|
43
|
+
</test-fixture>
|
44
|
+
|
45
|
+
<test-fixture id="counter-with-max">
|
46
|
+
<template>
|
47
|
+
<paper-input-container>
|
48
|
+
<label id="l">label</label>
|
49
|
+
<input id="i" value="foobar" maxlength="10">
|
50
|
+
<paper-input-char-counter id="c"></paper-input-char-counter>
|
51
|
+
</paper-input-container>
|
52
|
+
</template>
|
53
|
+
</test-fixture>
|
54
|
+
|
55
|
+
<test-fixture id="textarea">
|
56
|
+
<template>
|
57
|
+
<paper-textarea char-counter value="foobar"></paper-textarea>
|
58
|
+
</template>
|
59
|
+
</test-fixture>
|
60
|
+
|
61
|
+
<test-fixture id="textarea-with-max">
|
62
|
+
<template>
|
63
|
+
<paper-textarea char-counter value="foobar" maxlength="100"></paper-textarea>
|
64
|
+
</template>
|
65
|
+
</test-fixture>
|
66
|
+
|
67
|
+
<script>
|
68
|
+
|
69
|
+
suite('basic', function() {
|
70
|
+
|
71
|
+
test('character counter shows the value length', function() {
|
72
|
+
var container = fixture('counter');
|
73
|
+
var input = Polymer.dom(container).querySelector('#i');
|
74
|
+
var counter = Polymer.dom(container).querySelector('#c');
|
75
|
+
assert.equal(counter._charCounterStr, input.value.length, 'character counter shows input value length');
|
76
|
+
});
|
77
|
+
|
78
|
+
test('character counter shows the value length with maxlength', function() {
|
79
|
+
var container = fixture('counter-with-max');
|
80
|
+
var input = Polymer.dom(container).querySelector('#i');
|
81
|
+
var counter = Polymer.dom(container).querySelector('#c');
|
82
|
+
assert.equal(counter._charCounterStr, input.value.length + '/' + input.maxLength, 'character counter shows input value length and maxLength');
|
83
|
+
});
|
84
|
+
|
85
|
+
test('character counter shows the value length with maxlength', function() {
|
86
|
+
var input = fixture('textarea-with-max');
|
87
|
+
forceXIfStamp(input);
|
88
|
+
|
89
|
+
var counter = Polymer.dom(input.root).querySelector('paper-input-char-counter');
|
90
|
+
assert.ok(counter, 'paper-input-char-counter exists');
|
91
|
+
|
92
|
+
assert.equal(counter._charCounterStr, input.value.length + '/' + input.inputElement.textarea.getAttribute('maxlength'), 'character counter shows input value length and maxLength');
|
93
|
+
});
|
94
|
+
|
95
|
+
test('character counter counts new lines in textareas correctly', function() {
|
96
|
+
var input = fixture('textarea');
|
97
|
+
input.value = 'foo\nbar';
|
98
|
+
forceXIfStamp(input);
|
99
|
+
|
100
|
+
var counter = Polymer.dom(input.root).querySelector('paper-input-char-counter')
|
101
|
+
assert.ok(counter, 'paper-input-char-counter exists');
|
102
|
+
|
103
|
+
// A new line counts as two characters.
|
104
|
+
assert.equal(counter._charCounterStr, input.value.length + 1, 'character counter shows the value length');
|
105
|
+
});
|
106
|
+
|
107
|
+
});
|
108
|
+
|
109
|
+
</script>
|
110
|
+
|
111
|
+
</body>
|
112
|
+
</html>
|