@neovici/cosmoz-bottom-bar 6.1.0 → 6.3.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.
@@ -290,10 +290,30 @@ class CosmozBottomBar extends PolymerElement {
290
290
  }
291
291
 
292
292
  _getElements() {
293
- return FlattenedNodesObserver.getFlattenedNodes(this)
293
+ const elements = FlattenedNodesObserver.getFlattenedNodes(this)
294
294
  .filter(this._isActionNode)
295
295
  .filter((element) => !element.hidden)
296
296
  .sort((a, b) => (a.dataset.index ?? 0) - (b.dataset.index ?? 0));
297
+
298
+ if (elements.length === 0) {
299
+ return elements;
300
+ }
301
+
302
+ const topPriorityAction = elements.reduce(
303
+ (top, element) => {
304
+ return parseInt(top.dataset.priority ?? 0, 10) >=
305
+ parseInt(element.dataset.priority ?? 0, 10)
306
+ ? top
307
+ : element;
308
+ },
309
+ { dataset: { priority: '-1000' } },
310
+ []
311
+ );
312
+
313
+ return [
314
+ topPriorityAction,
315
+ ...elements.filter((e) => e !== topPriorityAction),
316
+ ];
297
317
  }
298
318
  /**
299
319
  * 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": "6.1.0",
3
+ "version": "6.3.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",
@@ -51,7 +51,7 @@
51
51
  ]
52
52
  },
53
53
  "dependencies": {
54
- "@neovici/cosmoz-dropdown": "^2.0.0",
54
+ "@neovici/cosmoz-dropdown": "^3.0.0",
55
55
  "@polymer/polymer": "^3.3.0",
56
56
  "lit-html": "^2.0.0"
57
57
  },