@neovici/cosmoz-bottom-bar 4.5.2 → 5.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -17,7 +17,7 @@ Example:
17
17
  <custom-element-demo>
18
18
  <template>
19
19
  <script src="../webcomponentsjs/webcomponents-lite.js"></script>
20
- <link rel="import" href="cosmoz-bottom-bar-view.html">
20
+ <link rel="import" href="cosmoz-bottom-bar.html">
21
21
  <link rel="import" href="../paper-button/paper-button.html">
22
22
  <style>
23
23
  body {
@@ -38,27 +38,27 @@ Example:
38
38
  ```
39
39
  -->
40
40
  ```html
41
- <cosmoz-bottom-bar-view>
42
- <div slot="scroller-content" style="padding: 0 18px;">
43
- <h3>Sample page</h3>
44
- <p>Nam non enim vitae mauris pharetra semper nec sed lectus.</p>
45
- <p>Maecenas gravida sollicitudin mauris, id gravida odio commodo iaculis.</p>
46
- <p>Nulla pulvinar justo vel sodales sollicitudin.</p>
47
- <p>Proin turpis tortor, sagittis sit amet consequat ut, tempor non velit.</p>
48
- <p>Proin finibus elit libero, vitae scelerisque lacus maximus ac.</p>
49
- <p>Vivamus ut finibus ligula. Mauris sollicitudin vitae orci eu scelerisque.</p>
50
- <p>Duis nec placerat mauris, at tincidunt libero.</p>
51
- <p>Nullam non magna eget mauris porta tempor.</p>
52
- <p>Proin non sagittis enim.</p>
53
- <p>Sed pharetra ante ipsum, in porta dolor sagittis non.</p>
54
- <p>Cras odio quam, pretium consectetur finibus eu, elementum at risus.</p>
55
- <p>Proin feugiat vitae sem eu imperdiet.</p>
56
- </div>
41
+ <div style="padding: 0 18px;">
42
+ <h3>Sample page</h3>
43
+ <p>Nam non enim vitae mauris pharetra semper nec sed lectus.</p>
44
+ <p>Maecenas gravida sollicitudin mauris, id gravida odio commodo iaculis.</p>
45
+ <p>Nulla pulvinar justo vel sodales sollicitudin.</p>
46
+ <p>Proin turpis tortor, sagittis sit amet consequat ut, tempor non velit.</p>
47
+ <p>Proin finibus elit libero, vitae scelerisque lacus maximus ac.</p>
48
+ <p>Vivamus ut finibus ligula. Mauris sollicitudin vitae orci eu scelerisque.</p>
49
+ <p>Duis nec placerat mauris, at tincidunt libero.</p>
50
+ <p>Nullam non magna eget mauris porta tempor.</p>
51
+ <p>Proin non sagittis enim.</p>
52
+ <p>Sed pharetra ante ipsum, in porta dolor sagittis non.</p>
53
+ <p>Cras odio quam, pretium consectetur finibus eu, elementum at risus.</p>
54
+ <p>Proin feugiat vitae sem eu imperdiet.</p>
55
+ </div>
56
+ <cosmoz-bottom-bar active>
57
57
  <div slot="info">5 dummy actions</div>
58
58
  <paper-button>Action 1</paper-button>
59
59
  <paper-button>Action 2</paper-button>
60
60
  <paper-button>Action 3</paper-button>
61
61
  <paper-button>Action 4</paper-button>
62
62
  <paper-button>Action 5</paper-button>
63
- </cosmoz-bottom-bar-view>
64
- ```
63
+ </cosmoz-bottom-bar>
64
+ ```
@@ -5,14 +5,13 @@ export default html`
5
5
  <style>
6
6
  :host {
7
7
  display: block;
8
- position: absolute;
9
8
  bottom: 0;
10
9
  left: 0;
11
10
  width: 100%;
12
11
  max-width: 100%; /* Firefox fix */
13
12
  background-color: inherit;
14
13
  transition: max-height 0.3s ease;
15
- z-index: 10;
14
+ flex: none;
16
15
  background-color: var(--cosmoz-bottom-bar-bg-color, rgba(230, 230, 230, 0.8));
17
16
  box-shadow: var(--cosmoz-bottom-bar-shadow, none);
18
17
 
@@ -29,6 +28,9 @@ export default html`
29
28
  padding: 0;
30
29
  };
31
30
  }
31
+ :host([force-open]) {
32
+ transition: none;
33
+ }
32
34
  [hidden], ::slotted([hidden]) {
33
35
  display: none !important;
34
36
  }
@@ -130,6 +130,11 @@ class CosmozBottomBar extends PolymerElement {
130
130
  type: Number
131
131
  },
132
132
 
133
+ forceOpen: {
134
+ type: Boolean,
135
+ value: false
136
+ },
137
+
133
138
  /**
134
139
  * Whether the bar is visible (has actions and is `active`)
135
140
  */
@@ -137,7 +142,7 @@ class CosmozBottomBar extends PolymerElement {
137
142
  type: Boolean,
138
143
  notify: true,
139
144
  readOnly: true,
140
- computed: '_computeVisible(hasActions, active, hasExtraItems)'
145
+ computed: '_computeVisible(hasActions, active, hasExtraItems, forceOpen)'
141
146
  },
142
147
 
143
148
  /**
@@ -230,8 +235,8 @@ class CosmozBottomBar extends PolymerElement {
230
235
  return barHeight;
231
236
  }
232
237
 
233
- _computeVisible(hasActions, active, hasExtraItems) {
234
- return (hasActions || hasExtraItems) && active;
238
+ _computeVisible(hasActions, active, hasExtraItems, forceOpen) {
239
+ return forceOpen || ((hasActions || hasExtraItems) && active);
235
240
  }
236
241
 
237
242
  _debounceLayoutActions() {
@@ -268,7 +273,7 @@ class CosmozBottomBar extends PolymerElement {
268
273
  return FlattenedNodesObserver.getFlattenedNodes(this)
269
274
  .filter(this._isActionNode)
270
275
  .filter(element => !element.hidden)
271
- .sort((a, b) => a.dataset.index - b.dataset.index);
276
+ .sort((a, b) => (a.dataset.index ?? 0) - (b.dataset.index ?? 0 ));
272
277
  }
273
278
  /**
274
279
  * Layout the actions available as buttons or menu items
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neovici/cosmoz-bottom-bar",
3
- "version": "4.5.2",
3
+ "version": "5.1.1",
4
4
  "description": "A responsive bottom-bar that can house buttons/actions and a menu for the buttons that won't fit the available width.",
5
5
  "keywords": [
6
6
  "polymer",
@@ -1,54 +0,0 @@
1
- import { component } from 'haunted';
2
- import { html } from 'lit-html';
3
- import { ifDefined } from 'lit-html/directives/if-defined';
4
- import { bottomBarSlots } from './cosmoz-bottom-bar';
5
-
6
- /**
7
- * `cosmoz-bottom-bar-view` contains a content section and a bottom bar with actions.
8
- *
9
- * __Important:__ Because `cosmoz-bottom-bar-view` is handling scrolling of its content, it must be explicitly sized.
10
- * By "explicitly sized", we mean it either has an explicit CSS height property set via a class or inline style,
11
- * or else is sized by other layout means (e.g. the flex or fit classes).
12
- *
13
- * @demo demo/bottom-bar-view.html Basic Demo
14
- */
15
-
16
- const CosmozBottomBarView = ({
17
- active = true,
18
- barHeight
19
- }) => html`
20
- <style>
21
- :host {
22
- position: relative;
23
- display: flex;
24
- flex-direction: column;
25
- flex: var(--cosmoz-bottom-bar-view-flex, auto);
26
- overflow: hidden;
27
- }
28
-
29
- #content {
30
- display: flex;
31
- flex-direction: column;
32
- flex: auto;
33
- -webkit-overflow-scrolling: touch;
34
- overflow-y: auto;
35
- }
36
-
37
- #bar {
38
- background-color: var(--cosmoz-bottom-bar-view-bar-color, rgba(230, 230, 230, 0.8));
39
- box-shadow: var(--cosmoz-bottom-bar-view-bar-shadow, none);
40
- position: static;
41
- flex: none;
42
- }
43
- </style>
44
- <div id="content" part="content">
45
- <slot name="content"></slot>
46
- <slot name="scroller-content"></slot>
47
- </div>
48
- <cosmoz-bottom-bar id="bar" ?active=${ active } bar-height=${ ifDefined(barHeight) } part="bar">
49
- <slot></slot>
50
- ${ bottomBarSlots }
51
- </cosmoz-bottom-bar>
52
- `;
53
- customElements.define('cosmoz-bottom-bar-view', component(CosmozBottomBarView));
54
-