Skip to content

Commit

Permalink
Merge pull request #625 from PolymerElements/shared-style-mixin
Browse files Browse the repository at this point in the history
fix the shared-input-style which was in the wrong spot
  • Loading branch information
notwaldorf authored Mar 7, 2018
2 parents c9c87e8 + fdb5624 commit 6972d38
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 18 deletions.
21 changes: 21 additions & 0 deletions demo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
<link rel="import" href="../../iron-demo-helpers/demo-snippet.html">
<link rel="import" href="../../iron-icon/iron-icon.html">
<link rel="import" href="../../iron-icons/iron-icons.html">
<link rel="import" href="../../iron-input/iron-input.html">
<link rel="import" href="../../paper-icon-button/paper-icon-button.html">
<link rel="import" href="../../paper-styles/color.html">
<link rel="import" href="../paper-input-container.html">
Expand Down Expand Up @@ -141,6 +142,26 @@ <h3>Inputs can have custom logic</h3>
</paper-input-container>
</template>
</demo-snippet>

<h3>You can use <code>paper-input-container</code> directly if you want more control
over the input (for example, if you want to use this in a native <code>form</code>, etc.)</h3>
<demo-snippet>
<template>
<custom-style>
<style is="custom-style">
input.my-input {
@apply --paper-input-container-shared-input-style;
}
</style>
</custom-style>
<paper-input-container>
<label slot="label">This is a label</label>
<iron-input slot="input">
<input class="my-input">
</iron-input>
</paper-input-container>
</template>
</demo-snippet>
</div>

<script>
Expand Down
41 changes: 23 additions & 18 deletions paper-input-container.html
Original file line number Diff line number Diff line change
Expand Up @@ -116,30 +116,35 @@
`display:inline-block`.
-->

<custom-style>
<style is="custom-style">
html {
--paper-input-container-shared-input-style: {
position: relative; /* to make a stacking context */
outline: none;
box-shadow: none;
padding: 0;
width: 100%;
max-width: 100%;
background: transparent;
border: none;
color: var(--paper-input-container-input-color, var(--primary-text-color));
-webkit-appearance: none;
text-align: inherit;
vertical-align: bottom;

@apply --paper-font-subhead;
};
}
</style>
</custom-style>

<dom-module id="paper-input-container">
<template>
<style>
:host {
display: block;
padding: 8px 0;

--paper-input-container-shared-input-style: {
position: relative; /* to make a stacking context */
outline: none;
box-shadow: none;
padding: 0;
width: 100%;
max-width: 100%;
background: transparent;
border: none;
color: var(--paper-input-container-input-color, var(--primary-text-color));
-webkit-appearance: none;
text-align: inherit;
vertical-align: bottom;

@apply --paper-font-subhead;
};

@apply --paper-input-container;
}

Expand Down

0 comments on commit 6972d38

Please sign in to comment.