Skip to content

Commit

Permalink
Merge pull request #1 from PolymerElements/port-core-collapse
Browse files Browse the repository at this point in the history
Rename to iron-collapse
  • Loading branch information
notwaldorf committed Apr 16, 2015
2 parents f1d3a0b + 3bc774d commit c1f91dc
Show file tree
Hide file tree
Showing 9 changed files with 278 additions and 253 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
bower_components
5 changes: 1 addition & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
core-collapse
=============

See the [component page](http://polymer-project.org/docs/elements/core-elements.html#core-collapse) for more information.
# iron-collapse
31 changes: 22 additions & 9 deletions bower.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,32 @@
{
"name": "core-collapse",
"name": "iron-collapse",
"version": "0.8.0",
"private": true,
"main": "core-collapse.html",
"authors": [
"Frankie Fu <[email protected]>",
"The Polymer Authors"
],
"repository": "https://github.com/Polymer/core-collapse/tree/0.8-preview",
"keywords": [
"web-components",
"web-component",
"polymer"
],
"main": "index.html",
"private": true,
"repository": {
"type": "git",
"url": "https://github.com/PolymerElements/iron-collapse"
},
"license": "MIT",
"homepage": "https://github.com/PolymerElements/iron-collapse",
"ignore": [
],
"dependencies": {
"polymer": "Polymer/polymer#0.8-preview"
"polymer": "Polymer/polymer#v0.8.0-rc.4"
},
"devDependencies": {
"webcomponentsjs": "webcomponents/webcomponentsjs#master",
"webcomponentsjs": "webcomponents/webcomponentsjs#~0.6.1",
"web-component-tester": "Polymer/web-component-tester#^2.2.3",
"test-fixture": "Polymer/test-fixture#master"
"test-fixture": "PolymerElements/test-fixture#^0.8.0",
"iron-doc-viewer": "PolymerElements/iron-doc-viewer#^v0.8.0",
"paper-styles": "PolymerElements/paper-styles#^0.8.0"
}
}
}
99 changes: 50 additions & 49 deletions demo/index.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<!doctype html>
<!--
@license
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
Expand All @@ -9,63 +10,63 @@
-->

<html>
<head>
<head>

<title>core-collapse</title>
<title>iron-collapse demo</title>

<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">

<script src="../../../components/webcomponentsjs/webcomponents-lite.js"></script>
<link rel="import" href="../core-collapse.html">
<script src="../../../components/webcomponentsjs/webcomponents-lite.js"></script>
<link rel="import" href="../iron-collapse.html">
<link rel="stylesheet" href="../../paper-styles/demo.css">

<style>
<style>
.heading {
padding: 10px 15px;
margin-top: 20px;
background-color: #f3f3f3;
border: 1px solid #dedede;
border-top-left-radius: 5px;
border-top-right-radius: 5px;
font-size: 18px;
cursor: pointer;
-webkit-tap-highlight-color: rgba(0,0,0,0);
}

.heading {
padding: 10px 15px;
margin-top: 20px;
background-color: #f3f3f3;
border: 1px solid #dedede;
border-top-left-radius: 5px;
border-top-right-radius: 5px;
font-size: 18px;
cursor: pointer;
-webkit-tap-highlight-color: rgba(0,0,0,0);
}
.content {
padding: 15px;
border: 1px solid #dedede;
border-top: none;
border-bottom-left-radius: 5px;
border-bottom-right-radius: 5px;
}

.content {
padding: 15px;
border: 1px solid #dedede;
border-top: none;
border-bottom-left-radius: 5px;
border-bottom-right-radius: 5px;
}
</style>

</style>
</head>
<body>

</head>
<body>
<div class="heading" onclick="document.querySelector('#collapse1').toggle();">Collapse #1</div>
<iron-collapse id="collapse1">
<div class="content">
<div>Lorem ipsum dolor sit amet, per in nusquam nominavi periculis, sit elit oportere ea, id minim maiestatis incorrupte duo. Dolorum verterem ad ius, his et nullam verterem. Eu alia debet usu, an doming tritani est. Vix ad ponderum petentium suavitate, eum eu tempor populo, graece sententiae constituam vim ex. Cu torquatos reprimique neglegentur nec, voluptua periculis has ut, at eos discere deleniti sensibus. Lorem ipsum dolor sit amet, per in nusquam nominavi periculis, sit elit oportere ea, id minim maiestatis incorrupte duo. Dolorum verterem ad ius, his et nullam verterem. Eu alia debet usu, an doming tritani est. Vix ad ponderum petentium suavitate, eum eu tempor populo, graece sententiae constituam vim ex. Cu torquatos reprimique neglegentur nec, voluptua periculis has ut, at eos discere deleniti sensibus.</div>
</div>
</iron-collapse>

<div class="heading" onclick="document.querySelector('#collapse1').toggle();">Collapse #1</div>
<core-collapse id="collapse1">
<div class="content">
<div>Lorem ipsum dolor sit amet, per in nusquam nominavi periculis, sit elit oportere ea, id minim maiestatis incorrupte duo. Dolorum verterem ad ius, his et nullam verterem. Eu alia debet usu, an doming tritani est. Vix ad ponderum petentium suavitate, eum eu tempor populo, graece sententiae constituam vim ex. Cu torquatos reprimique neglegentur nec, voluptua periculis has ut, at eos discere deleniti sensibus. Lorem ipsum dolor sit amet, per in nusquam nominavi periculis, sit elit oportere ea, id minim maiestatis incorrupte duo. Dolorum verterem ad ius, his et nullam verterem. Eu alia debet usu, an doming tritani est. Vix ad ponderum petentium suavitate, eum eu tempor populo, graece sententiae constituam vim ex. Cu torquatos reprimique neglegentur nec, voluptua periculis has ut, at eos discere deleniti sensibus.</div>
</div>
</core-collapse>
<div class="heading" onclick="document.querySelector('#collapse2').toggle();">Collapse #2</div>
<iron-collapse id="collapse2">
<div class="content">
<div>Pro saepe pertinax ei, ad pri animal labores suscipiantur. Modus commodo minimum eum te, vero utinam assueverit per eu, zril oportere suscipiantur pri te. Partem percipitur deterruisset ad sea, at eam suas luptatum dissentiunt. No error alienum pro, erant senserit ex mei, pri semper alterum no. Ut habemus menandri vulputate mea. Feugiat verterem ut sed. Dolores maiestatis id per. Pro saepe pertinax ei, ad pri animal labores suscipiantur. Modus commodo minimum eum te, vero utinam assueverit per eu, zril oportere suscipiantur pri te. Partem percipitur deterruisset ad sea, at eam suas luptatum dissentiunt. No error alienum pro, erant senserit ex mei, pri semper alterum no. Ut habemus menandri vulputate mea. Feugiat verterem ut sed. Dolores maiestatis id per.</div>
<br>
<div class="heading" onclick="document.querySelector('#collapse3').toggle();">Collapse #3</div>
<iron-collapse id="collapse3">
<div class="content">
<div>Iisque perfecto dissentiet cum et, sit ut quot mandamus, ut vim tibique splendide instructior. Id nam odio natum malorum, tibique copiosae expetenda mel ea. Mea melius malorum ut. Ut nec tollit vocent timeam. Facer nonumy numquam id his, munere salutatus consequuntur eum et, eum cotidieque definitionem signiferumque id. Ei oblique graecis patrioque vis, et probatus dignissim inciderint vel. Sed id paulo erroribus, autem semper accusamus in mel. Iisque perfecto dissentiet cum et, sit ut quot mandamus, ut vim tibique splendide instructior. Id nam odio natum malorum, tibique copiosae expetenda mel ea. Mea melius malorum ut. Ut nec tollit vocent timeam. Facer nonumy numquam id his, munere salutatus consequuntur eum et, eum cotidieque definitionem signiferumque id. Ei oblique graecis patrioque vis, et probatus dignissim inciderint vel. Sed id paulo erroribus, autem semper accusamus in mel.</div>
</div>
</iron-collapse>
</div>
</iron-collapse>

<div class="heading" onclick="document.querySelector('#collapse2').toggle();">Collapse #2</div>
<core-collapse id="collapse2">
<div class="content">
<div>Pro saepe pertinax ei, ad pri animal labores suscipiantur. Modus commodo minimum eum te, vero utinam assueverit per eu, zril oportere suscipiantur pri te. Partem percipitur deterruisset ad sea, at eam suas luptatum dissentiunt. No error alienum pro, erant senserit ex mei, pri semper alterum no. Ut habemus menandri vulputate mea. Feugiat verterem ut sed. Dolores maiestatis id per. Pro saepe pertinax ei, ad pri animal labores suscipiantur. Modus commodo minimum eum te, vero utinam assueverit per eu, zril oportere suscipiantur pri te. Partem percipitur deterruisset ad sea, at eam suas luptatum dissentiunt. No error alienum pro, erant senserit ex mei, pri semper alterum no. Ut habemus menandri vulputate mea. Feugiat verterem ut sed. Dolores maiestatis id per.</div>
<br>
<div class="heading" onclick="document.querySelector('#collapse3').toggle();">Collapse #3</div>
<core-collapse id="collapse3">
<div class="content">
<div>Iisque perfecto dissentiet cum et, sit ut quot mandamus, ut vim tibique splendide instructior. Id nam odio natum malorum, tibique copiosae expetenda mel ea. Mea melius malorum ut. Ut nec tollit vocent timeam. Facer nonumy numquam id his, munere salutatus consequuntur eum et, eum cotidieque definitionem signiferumque id. Ei oblique graecis patrioque vis, et probatus dignissim inciderint vel. Sed id paulo erroribus, autem semper accusamus in mel. Iisque perfecto dissentiet cum et, sit ut quot mandamus, ut vim tibique splendide instructior. Id nam odio natum malorum, tibique copiosae expetenda mel ea. Mea melius malorum ut. Ut nec tollit vocent timeam. Facer nonumy numquam id his, munere salutatus consequuntur eum et, eum cotidieque definitionem signiferumque id. Ei oblique graecis patrioque vis, et probatus dignissim inciderint vel. Sed id paulo erroribus, autem semper accusamus in mel.</div>
</div>
</core-collapse>
</div>
</core-collapse>

</body>
</body>
</html>
28 changes: 21 additions & 7 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<!doctype html>
<!--
@license
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
Expand All @@ -9,15 +10,28 @@
-->

<html>
<head>
<head>

<script src="../webcomponentsjs/webcomponents-lite.js"></script>
<link rel="import" href="../core-component-page/core-component-page.html">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes">

</head>
<body>
<title>iron-collapse</title>

<core-component-page></core-component-page>
<script src="../webcomponentsjs/webcomponents-lite.js"></script>

</body>
<link rel="import" href="../polymer/polymer.html">
<link rel="import" href="../iron-doc-viewer/iron-doc-viewer.html">

<style>
body {
margin: 16px;
}
</style>

</head>
<body>

<iron-doc-viewer src="iron-collapse.html"></iron-doc-viewer>

</body>
</html>
35 changes: 18 additions & 17 deletions core-collapse.html → iron-collapse.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<!--
@license
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
Expand All @@ -7,23 +8,25 @@
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
-->

<link rel="import" href="../polymer/polymer.html">

<!--
`core-collapse` creates a collapsible block of content. By default, the content
`iron-collapse` creates a collapsible block of content. By default, the content
will be collapsed. Use `opened` or `toggle()` to show/hide the content.
<button on-click="{{toggle}}">toggle collapse</button>
<core-collapse id="collapse">
<iron-collapse id="collapse">
<div>Content goes here...</div>
</core-collapse>
</iron-collapse>
...
toggle: function() {
this.$.collapse.toggle();
}
`core-collapse` adjusts the height/width of the collapsible element to show/hide
`iron-collapse` adjusts the height/width of the collapsible element to show/hide
the content. So avoid putting padding/margin/border on the collapsible directly,
and instead put a div inside and style that.
Expand All @@ -34,19 +37,17 @@
}
</style>
<core-collapse>
<iron-collapse>
<div class="collapse-content">
<div>Content goes here...</div>
</div>
</core-collapse>
</iron-collapse>
@group Polymer Core Elements
@element core-collapse
@element iron-collapse
-->

<link rel="import" href="../polymer/polymer.html">

<dom-module id="core-collapse">
<dom-module id="iron-collapse">

<style>

Expand All @@ -55,11 +56,11 @@
transition-duration: 300ms;
}

:host(.core-collapse-closed) {
:host(.iron-collapse-closed) {
display: none;
}

:host(:not(.core-collapse-opened)) {
:host(:not(.iron-collapse-opened)) {
overflow: hidden;
}

Expand All @@ -77,7 +78,7 @@

Polymer({

is: 'core-collapse',
is: 'iron-collapse',

properties: {

Expand Down Expand Up @@ -138,7 +139,7 @@
},

show: function() {
this.toggleClass('core-collapse-closed', false);
this.toggleClass('iron-collapse-closed', false);
this.updateSize('auto', false);
var s = this.calcSize();
this.updateSize('0px', false);
Expand All @@ -148,7 +149,7 @@
},

hide: function() {
this.toggleClass('core-collapse-opened', false);
this.toggleClass('iron-collapse-opened', false);
this.updateSize(this.calcSize(), false);
// force layout to ensure transition will go
this.offsetHeight;
Expand Down Expand Up @@ -177,8 +178,8 @@
if (this.opened) {
this.updateSize('auto', false);
}
this.toggleClass('core-collapse-closed', !this.opened);
this.toggleClass('core-collapse-opened', this.opened);
this.toggleClass('iron-collapse-closed', !this.opened);
this.toggleClass('iron-collapse-opened', this.opened);
this.enableTransition(false);
}

Expand Down
Loading

0 comments on commit c1f91dc

Please sign in to comment.