1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

update components

This commit is contained in:
Luke Pulverenti 2015-07-13 17:26:11 -04:00
parent 697257670c
commit 02ae9ec81e
123 changed files with 13600 additions and 531 deletions

View file

@ -1,6 +1,6 @@
{
"name": "paper-input",
"version": "1.0.5",
"version": "1.0.6",
"description": "Material design text fields",
"authors": [
"The Polymer Authors"
@ -42,11 +42,11 @@
"web-component-tester": "*",
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
},
"_release": "1.0.5",
"_release": "1.0.6",
"_resolution": {
"type": "version",
"tag": "v1.0.5",
"commit": "72821a081710d9d5443e7b2311ff561def260807"
"tag": "v1.0.6",
"commit": "327605642c1bfa5366c0d3effc638b81f24c3adc"
},
"_source": "git://github.com/PolymerElements/paper-input.git",
"_target": "^1.0.0",

View file

@ -1,6 +1,6 @@
{
"name": "paper-input",
"version": "1.0.5",
"version": "1.0.6",
"description": "Material design text fields",
"authors": [
"The Polymer Authors"

View file

@ -230,6 +230,24 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
type: Number
},
// Nonstandard attributes for binding if needed
/**
* Bind this to the `<input is="iron-input">`'s `autocapitalize` property.
*/
autocapitalize: {
type: String,
value: 'none'
},
/**
* Bind this to the `<input is="iron-input">`'s `autocorrect` property.
*/
autocorrect: {
type: String,
value: 'off'
},
_ariaDescribedBy: {
type: String,
value: ''
@ -241,6 +259,10 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
'addon-attached': '_onAddonAttached'
},
observers: [
'_focusedControlStateChanged(focused)'
],
/**
* Returns a reference to the input element.
*/
@ -305,6 +327,24 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
return placeholder || alwaysFloatLabel;
},
_focusedControlStateChanged: function(focused) {
// IronControlState stops the focus and blur events in order to redispatch them on the host
// element, but paper-input-container listens to those events. Since there are more
// pending work on focus/blur in IronControlState, I'm putting in this hack to get the
// input focus state working for now.
if (!this.$.container) {
this.$.container = Polymer.dom(this.root).querySelector('paper-input-container');
if (!this.$.container) {
return;
}
}
if (focused) {
this.$.container._onFocus();
} else {
this.$.container._onBlur();
}
},
_updateAriaLabelledBy: function() {
var label = Polymer.dom(this.root).querySelector('label');
if (!label) {
@ -323,6 +363,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
};
/** @polymerBehavior */
Polymer.PaperInputBehavior = [Polymer.IronControlState, Polymer.PaperInputBehaviorImpl];
</script>

View file

@ -65,7 +65,11 @@ Custom property | Description | Default
`--paper-input-container-input-color` | Input foreground color | `--primary-text-color`
`--paper-input-container` | Mixin applied to the container | `{}`
`--paper-input-container-label` | Mixin applied to the label | `{}`
`--paper-input-container-label-focus` | Mixin applied to the label when the input is focused | `{}`
`--paper-input-container-input` | Mixin applied to the input | `{}`
`--paper-input-container-underline` | Mixin applied to the underline | `{}`
`--paper-input-container-underline-focus` | Mixin applied to the underline when the input is focued | `{}`
`--paper-input-container-underline-disabled` | Mixin applied to the underline when the input is disabled | `{}`
This element is `display:block` by default, but you can set the `inline` attribute to make it
`display:inline-block`.
@ -107,6 +111,8 @@ This element is `display:block` by default, but you can set the `inline` attribu
transform: scale3d(0,1,1);
background: var(--paper-input-container-focus-color, --default-primary-color);
@apply(--paper-input-container-underline-focus);
}
.underline.is-highlighted .focused-line {
@ -132,12 +138,16 @@ This element is `display:block` by default, but you can set the `inline` attribu
.unfocused-line {
height: 1px;
background: var(--paper-input-container-color, --secondary-text-color);
@apply(--paper-input-container-underline);
}
:host([disabled]) .unfocused-line {
border-bottom: 1px dashed;
border-color: var(--paper-input-container-color, --secondary-text-color);
background: transparent;
@apply(--paper-input-container-underline-disabled);
}
.input-content {
@ -172,6 +182,8 @@ This element is `display:block` by default, but you can set the `inline` attribu
.input-content.label-is-highlighted ::content label,
.input-content.label-is-highlighted ::content .paper-input-label {
color: var(--paper-input-container-focus-color, --default-primary-color);
@apply(--paper-input-container-label-focus);
}
.input-content.is-invalid ::content label,

View file

@ -35,8 +35,8 @@ Custom property | Description | Default
<style>
:host {
/* need to use display: none for role="alert" */
display: none;
display: inline-block;
visibility: hidden;
float: left;
color: var(--paper-input-container-invalid-color, --google-red-500);
@ -46,7 +46,7 @@ Custom property | Description | Default
}
:host([invalid]) {
display: inline-block;
visibility: visible;
};
</style>
@ -71,10 +71,6 @@ Custom property | Description | Default
Polymer.PaperInputAddonBehavior
],
hostAttributes: {
'role': 'alert'
},
properties: {
/**

View file

@ -91,7 +91,9 @@ style this element.
placeholder$="[[placeholder]]"
readonly$="[[readonly]]"
list$="[[list]]"
size$="[[size]]">
size$="[[size]]"
autocapitalize$="[[autocapitalize]]"
autocorrect$="[[autocorrect]]">
<template is="dom-if" if="[[errorMessage]]">
<paper-input-error>[[errorMessage]]</paper-input-error>
@ -116,6 +118,7 @@ style this element.
is: 'paper-input',
behaviors: [
Polymer.IronFormElementBehavior,
Polymer.PaperInputBehavior,
Polymer.IronControlState
]

View file

@ -9,7 +9,6 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
-->
<link rel="import" href="../polymer/polymer.html">
<link rel="import" href="../iron-autogrow-textarea/iron-autogrow-textarea.html">
<link rel="import" href="../iron-form-element-behavior/iron-form-element-behavior.html">
<link rel="import" href="paper-input-behavior.html">
<link rel="import" href="paper-input-container.html">
<link rel="import" href="paper-input-error.html">
@ -48,7 +47,8 @@ style this element.
placeholder$="[[placeholder]]"
readonly$="[[readonly]]"
required$="[[required]]"
maxlength$="[[maxlength]]"></iron-autogrow-textarea>
maxlength$="[[maxlength]]"
autocapitalize$="[[autocapitalize]]"></iron-autogrow-textarea>
<template is="dom-if" if="[[errorMessage]]">
<paper-input-error>[[errorMessage]]</paper-input-error>
@ -73,8 +73,7 @@ style this element.
is: 'paper-textarea',
behaviors: [
Polymer.PaperInputBehavior,
Polymer.IronFormElementBehavior
Polymer.PaperInputBehavior
],
properties: {

View file

@ -21,6 +21,8 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
<script src="../../web-component-tester/browser.js"></script>
<script src="../../test-fixture/test-fixture-mocha.js"></script>
<script src="../../iron-test-helpers/mock-interactions.js"></script>
<link rel="import" href="../../test-fixture/test-fixture.html">
<link rel="import" href="../../iron-input/iron-input.html">
<link rel="import" href="../paper-input-container.html">
@ -141,11 +143,8 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
var label = Polymer.dom(container).querySelector('#l');
var input = Polymer.dom(container).querySelector('#i');
var inputContent = Polymer.dom(container.root).querySelector('.input-content');
input.focus();
// 'focus' event isn't firing on windows ff for some reason when you call focus()
container._onFocus();
MockInteractions.focus(input);
requestAnimationFrame(function() {
assert.equal(document.activeElement, input, 'input is focused');
assert.isTrue(container.focused, 'focused is true');
assert.isTrue(inputContent.classList.contains('label-is-highlighted'), 'label is highlighted when input has focus');
done();
@ -157,8 +156,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
var label = Polymer.dom(container).querySelector('#l');
var input = Polymer.dom(container).querySelector('#i');
var inputContent = Polymer.dom(container.root).querySelector('.input-content');
input.focus();
container._onFocus();
MockInteractions.focus(input);
requestAnimationFrame(function() {
assert.isFalse(inputContent.classList.contains('label-is-highlighted'), 'label is not highlighted when input has focus and has null value');
done();
@ -170,10 +168,8 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
var input = Polymer.dom(container).querySelector('#i');
var line = Polymer.dom(container.root).querySelector('.underline');
assert.isFalse(line.classList.contains('is-highlighted'), 'line is not highlighted when input is not focused');
input.focus();
container._onFocus();
MockInteractions.focus(input);
requestAnimationFrame(function() {
assert.equal(document.activeElement, input, 'input is focused');
assert.isTrue(line.classList.contains('is-highlighted'), 'line is highlighted when input is focused');
done();
});

View file

@ -52,9 +52,9 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
var container = fixture('auto-validate-numbers');
var input = Polymer.dom(container).querySelector('#i');
var error = Polymer.dom(container).querySelector('#e');
assert.equal(getComputedStyle(error).display, 'none', 'error is display:none');
assert.equal(getComputedStyle(error).visibility, 'hidden', 'error is visibility:hidden');
input.bindValue = 'foobar';
assert.notEqual(getComputedStyle(error).display, 'none', 'error is not display:none');
assert.notEqual(getComputedStyle(error).visibility, 'hidden', 'error is not visibility:hidden');
});
test('error message add on is registered', function() {

View file

@ -22,6 +22,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
<script src="../../test-fixture/test-fixture-mocha.js"></script>
<script src="../../iron-test-helpers/test-helpers.js"></script>
<script src="../../iron-test-helpers/mock-interactions.js"></script>
<link rel="import" href="../../test-fixture/test-fixture.html">
<link rel="import" href="../paper-input.html">
@ -42,6 +43,12 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
</template>
</test-fixture>
<test-fixture id="label-has-value">
<template>
<paper-input label="foo" value="bar"></paper-input>
</template>
</test-fixture>
<test-fixture id="error">
<template>
<paper-input auto-validate pattern="[0-9]*" value="foobar" error-message="error"></paper-input>
@ -177,7 +184,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
// setTimeout to wait for potentially more, erroneous events
setTimeout(function() {
assert.equal(nFocusEvents, 1, 'one focus event fired');
input.inputElement.blur();
MockInteractions.blur(input.inputElement);
});
});
input.addEventListener('blur', function() {
@ -188,11 +195,28 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
done();
});
});
input.inputElement.focus();
MockInteractions.focus(input.inputElement);
});
});
suite('focused styling (integration test)', function() {
test('underline is colored when input is focused', function(done) {
var input = fixture('basic');
var container = Polymer.dom(input.root).querySelector('paper-input-container');
var line = Polymer.dom(container.root).querySelector('.underline');
assert.isFalse(line.classList.contains('is-highlighted'), 'line is not highlighted when input is not focused');
MockInteractions.focus(input.inputElement);
requestAnimationFrame(function() {
assert.isTrue(line.classList.contains('is-highlighted'), 'line is highlighted when input is focused');
done();
});
});
});
suite('validation', function() {
test('invalid attribute updated after calling validate()', function() {

View file

@ -22,6 +22,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
<script src="../../test-fixture/test-fixture-mocha.js"></script>
<script src="../../iron-test-helpers/test-helpers.js"></script>
<script src="../../iron-test-helpers/mock-interactions.js"></script>
<link rel="import" href="../../test-fixture/test-fixture.html">
<link rel="import" href="../paper-textarea.html">
@ -140,23 +141,17 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
test('focus/blur events fired on host element', function(done) {
var nFocusEvents = 0;
var nBlurEvents = 0;
input.addEventListener('focus', function() {
input.addEventListener('focus', function(event) {
nFocusEvents += 1;
// setTimeout to wait for potentially more, erroneous events
setTimeout(function() {
assert.equal(nFocusEvents, 1, 'one focus event fired');
input.inputElement.textarea.blur();
});
MockInteractions.blur(input.inputElement.textarea);
});
input.addEventListener('blur', function() {
nBlurEvents += 1;
// setTimeout to wait for potentially more, erroneous events
setTimeout(function() {
assert.equal(nBlurEvents, 1, 'one blur event fired');
done();
});
assert.isTrue(nFocusEvents >= 1, 'focus event fired');
assert.isTrue(nBlurEvents >= 1, 'blur event fired');
done();
});
input.inputElement.textarea.focus();
MockInteractions.focus(input.inputElement.textarea);
});
});