Skip to content
This repository was archived by the owner on Mar 13, 2018. It is now read-only.

Commit 7e31331

Browse files
author
Yvonne Yip
committed
use core-style
1 parent b4bebc3 commit 7e31331

File tree

3 files changed

+43
-17
lines changed

3 files changed

+43
-17
lines changed

bower.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"private": true,
44
"dependencies": {
55
"polymer": "Polymer/polymer#master",
6-
"core-input": "Polymer/core-input#master"
6+
"core-input": "Polymer/core-input#master",
7+
"core-style": "Polymer/core-style#master"
78
}
89
}

paper-input.css

-16
Original file line numberDiff line numberDiff line change
@@ -40,21 +40,6 @@
4040
resize: none;
4141
}
4242

43-
.focusedColor {
44-
color: #4059a9;
45-
background: #4059a9;
46-
}
47-
48-
:host(.invalid) #underline,
49-
:host(.invalid) #underlineHighlight,
50-
:host(.invalid) .focusedColor {
51-
color: #d34336;
52-
background: #d34336;
53-
}
54-
:host(.invalid) #floatedLabel {
55-
color: #d34336;
56-
}
57-
5843
#floatedLabel {
5944
font-size: 0.75em;
6045
background: transparent;
@@ -111,7 +96,6 @@
11196
#error {
11297
-webkit-flex: 1;
11398
flex: 1;
114-
color: #d34336;
11599
font-size: 0.75em;
116100
padding: 0.5em 0;
117101
}

paper-input.html

+41
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,53 @@
1616
<paper-input label="Your Name"></paper-input>
1717
<paper-input multiline label="Enter multiple lines here"></paper-input>
1818
19+
Theming
20+
--------
21+
22+
Set `CoreStyle.g.paperInput.focusedColor` and `CoreStyle.g.paperInput.invalidColor` to theme
23+
the focused and invalid states.
24+
1925
@group Paper Elements
2026
@element paper-input
2127
@extends core-input
2228
@homepage github.io
2329
-->
2430
<link href="../polymer/polymer.html" rel="import">
2531
<link href="../core-input/core-input.html" rel="import">
32+
<link href="../core-style/core-style.html" rel="import">
33+
34+
<core-style id="paper-input">
35+
36+
#label.focused,
37+
#floatedLabel.focused {
38+
color: {{g.paperInput.focusedColor}};
39+
}
40+
41+
#underlineHighlight.focused,
42+
#caretInner {
43+
background-color: {{g.paperInput.focusedColor}};
44+
}
45+
46+
#error,
47+
:host(.invalid) #label.focused,
48+
:host(.invalid) #floatedLabel.focused {
49+
color: {{g.paperInput.invalidColor}};
50+
}
51+
:host(.invalid) #underlineHighlight.focused,
52+
:host(.invalid) #caretInner {
53+
background-color: {{g.paperInput.invalidColor}};
54+
}
55+
56+
</core-style>
2657

2758
<polymer-element name="paper-input" extends="core-input" attributes="label floatingLabel maxRows error" on-down="{{downAction}}" on-up="{{upAction}}">
2859

2960
<template>
3061

3162
<link href="paper-input.css" rel="stylesheet">
3263

64+
<core-style ref="paper-input"></core-style>
65+
3366
<div id="floatedLabel" class="hidden" hidden?="{{!floatingLabel}}"><span id="floatedLabelSpan">{{label}}</span></div>
3467

3568
<div id="container" on-transitionend="{{transitionEndAction}}" on-webkitTransitionEnd="{{transitionEndAction}}">
@@ -71,6 +104,12 @@
71104

72105
<script>
73106

107+
(function() {
108+
109+
var paperInput = CoreStyle.g.paperInput = CoreStyle.g.paperInput || {};
110+
paperInput.focusedColor = '#4059a9';
111+
paperInput.invalidColor = '#d34336';
112+
74113
Polymer('paper-input', {
75114

76115
/**
@@ -336,6 +375,8 @@
336375

337376
});
338377

378+
}());
379+
339380
</script>
340381

341382
</polymer-element>

0 commit comments

Comments
 (0)