Skip to content

Commit 868f89b

Browse files
author
kylegerber94
authored
Added slot names, updated iron input to 2.0 syntax, and added input styling.
1 parent 45abc00 commit 868f89b

File tree

1 file changed

+78
-14
lines changed

1 file changed

+78
-14
lines changed

pmp-simple-date-input.html

Lines changed: 78 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,32 +18,96 @@
1818
:host {
1919
display: block;
2020
}
21+
input {
22+
position: relative; /* to make a stacking context */
23+
outline: none;
24+
box-shadow: none;
25+
margin: 0;
26+
padding: 0;
27+
width: 100%;
28+
max-width: 100%;
29+
background: transparent;
30+
border: none;
31+
color: var(--paper-input-container-input-color, var(--primary-text-color));
32+
-webkit-appearance: none;
33+
text-align: inherit;
34+
vertical-align: bottom;
35+
36+
/* Firefox sets a min-width on the input, which can cause layout issues */
37+
min-width: 0;
38+
39+
@apply --paper-font-subhead;
40+
@apply --paper-input-container-input;
41+
}
42+
43+
input:disabled {
44+
@apply --paper-input-container-input-disabled;
45+
}
46+
47+
input::-webkit-outer-spin-button,
48+
input::-webkit-inner-spin-button {
49+
@apply --paper-input-container-input-webkit-spinner;
50+
}
51+
52+
input::-webkit-clear-button {
53+
@apply --paper-input-container-input-webkit-clear;
54+
}
55+
56+
input::-webkit-calendar-picker-indicator {
57+
@apply --paper-input-container-input-webkit-calendar-picker-indicator;
58+
}
59+
60+
input::-webkit-input-placeholder {
61+
color: var(--paper-input-container-color, var(--secondary-text-color));
62+
}
63+
64+
input:-moz-placeholder {
65+
color: var(--paper-input-container-color, var(--secondary-text-color));
66+
}
67+
68+
input::-moz-placeholder {
69+
color: var(--paper-input-container-color, var(--secondary-text-color));
70+
}
71+
72+
input::-ms-clear {
73+
@apply --paper-input-container-ms-clear;
74+
}
75+
76+
input::-ms-reveal {
77+
@apply --paper-input-container-ms-reveal;
78+
}
79+
80+
input:-ms-input-placeholder {
81+
color: var(--paper-input-container-color, var(--secondary-text-color));
82+
}
2183
</style>
2284

2385
<paper-input-container id="container"
2486
disabled$="[[disabled]]"
2587
always-float-label="[[_computeAlwaysFloatLabel(alwaysFloatLabel,placeholder)]]"
2688
invalid="[[invalid]]">
2789

28-
<label hidden$="[[!label]]">[[label]]</label>
90+
<label hidden$="[[!label]]" slot="label">[[label]]</label>
2991

30-
<input is="iron-input" id="input"
31-
aria-labelledby$="[[_ariaLabelledBy]]"
32-
aria-describedby$="[[_ariaDescribedBy]]"
33-
disabled$="[[disabled]]"
34-
bind-value="{{value}}"
35-
required$="[[required]]"
36-
name$="[[name]]"
37-
prevent-invalid-input
38-
invalid="{{invalid}}"
39-
autofocus$="[[autofocus]]"
40-
inputmode$="[[inputmode]]"
92+
<iron-input bind-value="{{value}}" slot="input"
93+
id="input"
4194
maxlength$="[[maxlength]]"
4295
allowed-pattern="[0-9\/]"
43-
placeholder$="[[placeholder]]">
96+
invalid="{{invalid}}">
97+
<input aria-labelledby$="[[_ariaLabelledBy]]"
98+
aria-describedby$="[[_ariaDescribedBy]]"
99+
disabled$="[[disabled]]"
100+
bind-value="{{value}}"
101+
required$="[[required]]"
102+
name$="[[name]]"
103+
prevent-invalid-input
104+
autofocus$="[[autofocus]]"
105+
inputmode$="[[inputmode]]"
106+
placeholder$="[[placeholder]]">
107+
</iron-input>
44108

45109
<template is="dom-if" if="[[errorMessage]]">
46-
<paper-input-error id="error">[[errorMessage]]</paper-input-error>
110+
<paper-input-error id="error" slot="error">[[errorMessage]]</paper-input-error>
47111
</template>
48112

49113
</paper-input-container>

0 commit comments

Comments
 (0)