diff --git a/demos/text-field.html b/demos/text-field.html
index 95b84903e00..41475412813 100644
--- a/demos/text-field.html
+++ b/demos/text-field.html
@@ -119,10 +119,6 @@
Full Functionality JS Component (Floating Label, Validation)
-
-
-
-
@@ -168,8 +164,7 @@
Outlined Text Field
-
+
Must be at least 8 characters
@@ -221,7 +216,7 @@ Outlined Text Field
Text Field box
+
+
+
+
@@ -383,6 +401,10 @@
Textarea
+
+
+
+
@@ -413,6 +435,14 @@
Full-Width Text Field and Textarea
+
+
+
+
+
+
+
+
@@ -447,6 +477,7 @@ Full-Width Text Field and Textarea
var wrapperOutlinedTrailing = document.getElementById('demo-tf-outlined-trailing-wrapper');
var tfIcons = document.querySelectorAll('.mdc-text-field__icon');
+ var tfInputs = tfIconContainer.querySelectorAll('.mdc-text-field__input');
document.getElementById('disable-leading-trailing').addEventListener('change', function(evt) {
tfBoxLeading.disabled = evt.target.checked;
@@ -498,12 +529,26 @@ Full-Width Text Field and Textarea
});
document.getElementById('required-leading-trailing').addEventListener('change', function(evt) {
- tfIconContainer.querySelectorAll('.mdc-text-field__input')
- .forEach(function(input) {
+ [].slice.call(tfInputs).forEach(function(input) {
input.required = evt.target.checked;
input.pattern = evt.target.checked ? '.{8,}' : '.*';
});
});
+
+ document.getElementById('leading-trailing-alternate-colors').addEventListener('change', function(evt) {
+ tfBoxLeadingEl.classList[evt.target.checked ? 'add' : 'remove']('demo-text-field-custom-colors');
+ tfBoxLeadingEl.classList[evt.target.checked ? 'add' : 'remove']('demo-text-field-custom-error-colors');
+ tfBoxLeading.layout();
+ tfBoxTrailingEl.classList[evt.target.checked ? 'add' : 'remove']('demo-text-field-custom-colors');
+ tfBoxTrailingEl.classList[evt.target.checked ? 'add' : 'remove']('demo-text-field-custom-error-colors');
+ tfBoxTrailing.layout();
+ tfOutlinedLeadingEl.classList[evt.target.checked ? 'add' : 'remove']('demo-text-field-custom-colors');
+ tfOutlinedLeadingEl.classList[evt.target.checked ? 'add' : 'remove']('demo-text-field-custom-error-colors');
+ tfOutlinedLeading.layout();
+ tfOutlinedTrailingEl.classList[evt.target.checked ? 'add' : 'remove']('demo-text-field-custom-colors');
+ tfOutlinedTrailingEl.classList[evt.target.checked ? 'add' : 'remove']('demo-text-field-custom-error-colors');
+ tfOutlinedTrailing.layout();
+ });
});
demoReady(function() {
@@ -539,9 +584,6 @@ Full-Width Text Field and Textarea
document.getElementById('alternate-colors').addEventListener('change', function (evt) {
var target = evt.target;
tfRoot.classList[target.checked ? 'add' : 'remove']('demo-text-field-custom-colors');
- });
- document.getElementById('alternate-error-colors').addEventListener('change', function (evt) {
- var target = evt.target;
tfRoot.classList[target.checked ? 'add' : 'remove']('demo-text-field-custom-error-colors');
});
document.getElementById('use-helper-text').addEventListener('change', function(evt) {
@@ -584,9 +626,18 @@ Full-Width Text Field and Textarea
var target = evt.target;
section.classList[target.checked ? 'add' : 'remove']('mdc-theme--dark');
});
+
+ document.getElementById('textarea-alternate-colors').addEventListener('change', function (evt) {
+ var target = evt.target;
+ tfRoot.classList[target.checked ? 'add' : 'remove']('demo-textarea');
+ });
+
document.getElementById('textarea-required').addEventListener('change', function(evt) {
var target = evt.target;
- tfRoot.querySelector('.mdc-text-field__input').required = target.checked;
+ [].slice.call(tfRoot.querySelectorAll('.mdc-text-field__input'))
+ .forEach(function(input) {
+ input.required = target.checked;
+ })
});
});
@@ -615,6 +666,20 @@ Full-Width Text Field and Textarea
var target = evt.target;
section.classList[target.checked ? 'add' : 'remove']('mdc-theme--dark');
});
+
+ document.getElementById('fullwidth-required').addEventListener('change', function(evt) {
+ var target = evt.target;
+ [].slice.call(section.querySelectorAll('.mdc-text-field__input'))
+ .forEach(function(input) {
+ input.required = target.checked;
+ })
+ });
+
+ document.getElementById('fullwidth-alternate-colors').addEventListener('change', function (evt) {
+ var target = evt.target;
+ tfRoot.classList[target.checked ? 'add' : 'remove']('demo-fullwidth-input');
+ tfMultiRoot.classList[target.checked ? 'add' : 'remove']('demo-textarea');
+ });
});