@neovici/cosmoz-tabs 5.4.0 → 6.0.0-beta.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
@@ -1,5 +1,4 @@
1
1
  [![Build Status](https://github.com/Neovici/cosmoz-tabs/workflows/Github%20CI/badge.svg)](https://github.com/Neovici/cosmoz-tabs/actions?workflow=Github+CI)
2
- [![Code Climate](https://codeclimate.com/github/codeclimate/codeclimate/badges/gpa.svg)](https://codeclimate.com/github/Neovici/cosmoz-tabs)
3
2
  [![Published on webcomponents.org](https://img.shields.io/badge/webcomponents.org-published-blue.svg)](https://www.webcomponents.org/element/Neovici/cosmoz-tabs)
4
3
  [![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)
5
4
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neovici/cosmoz-tabs",
3
- "version": "5.4.0",
3
+ "version": "6.0.0-beta.1",
4
4
  "description": "A multi views container element that allow navigation between the views using tabs or an accordion.",
5
5
  "keywords": [
6
6
  "web-components"
@@ -60,19 +60,19 @@
60
60
  "./next/*": "./src/next/*"
61
61
  },
62
62
  "dependencies": {
63
- "@neovici/cosmoz-page-router": "^8.0.0",
64
- "@neovici/cosmoz-utils": "^3.25.0",
63
+ "@neovici/cosmoz-page-router": "^9.0.0-beta.3",
64
+ "@neovici/cosmoz-utils": "^4.0.0-beta.2",
65
65
  "@polymer/iron-icon": "^3.0.0",
66
66
  "@polymer/iron-icons": "^3.0.0",
67
67
  "compute-scroll-into-view": "^1.0.17",
68
- "haunted": "^4.8.0",
69
- "lit-html": "^1.4.0"
68
+ "haunted": "^5.0.0",
69
+ "lit-html": "^2.0.0"
70
70
  },
71
71
  "devDependencies": {
72
72
  "@commitlint/cli": "^17.0.0",
73
73
  "@commitlint/config-conventional": "^17.0.0",
74
74
  "@neovici/cfg": "^1.11.0",
75
- "@open-wc/testing": "^2.5.0",
75
+ "@open-wc/testing": "^3.0.0",
76
76
  "@polymer/iron-list": "^3.1.0",
77
77
  "@semantic-release/changelog": "^6.0.0",
78
78
  "@semantic-release/git": "^10.0.0",
@@ -1,6 +1,6 @@
1
1
  import { component, useEffect, useLayoutEffect } from 'haunted';
2
2
  import { html, nothing } from 'lit-html';
3
- import { ifDefined } from 'lit-html/directives/if-defined';
3
+ import { ifDefined } from 'lit-html/directives/if-defined.js';
4
4
  import computeScroll from 'compute-scroll-into-view';
5
5
 
6
6
  import style from './cosmoz-tab.css';
@@ -1,8 +1,10 @@
1
1
  /* eslint-disable import/group-exports */
2
2
  import { html, useMemo, useCallback, useRef } from 'haunted';
3
- import { useHashParam } from '@neovici/cosmoz-page-router/lib/use-hash-param';
3
+ import { ifDefined } from 'lit-html/directives/if-defined.js';
4
+ /* eslint-disable-next-line import/no-unresolved */
5
+ import { useHashParam } from '@neovici/cosmoz-page-router/use-hash-param';
4
6
 
5
- const isValid = (tab) => !tab.hidden && !tab.disabled,
7
+ const isValid = (tab) => !tab.hidden && !tab.disaebled,
6
8
  valid = (tabs) => tabs.find(isValid),
7
9
  choose = (tabs, name) => {
8
10
  const tab = name && tabs.find((tab) => tab.name === name);
@@ -22,7 +24,10 @@ export const useTabs = (tabs, { hashParam }) => {
22
24
  if (e.button !== 0 || e.metaKey || e.ctrlKey) {
23
25
  return;
24
26
  }
25
- const { name } = e.currentTarget;
27
+ const name = e.currentTarget?.getAttribute('name');
28
+ if (!name) {
29
+ return;
30
+ }
26
31
  activate(name);
27
32
  },
28
33
  [activate]
@@ -44,7 +49,8 @@ export const renderTabs = ({ tabs, active, onActivate }) =>
44
49
  ?active=${active.name === tab.name}
45
50
  ?hidden=${tab.hidden}
46
51
  ?disabled=${tab.disabled}
52
+ title=${ifDefined(typeof tab.title === 'string' ? tab.title : undefined)}
47
53
  @click=${onActivate}
48
- >${tab.title}</cosmoz-tab-next
54
+ >${tab.content ?? tab.title}</cosmoz-tab-next
49
55
  >`
50
56
  );
package/src/render.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { html } from 'haunted';
2
- import { ifDefined } from 'lit-html/directives/if-defined';
2
+ import { ifDefined } from 'lit-html/directives/if-defined.js';
3
3
  import { getIcon, getIconStyle } from './utils';
4
4
 
5
5
  const style = `
package/src/use-tabs.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import { useState, useEffect, useMemo, useCallback } from 'haunted';
2
2
  import { notifyProperty } from '@neovici/cosmoz-utils/lib/hooks/use-notify-property';
3
- import { useHashParam, link } from '@neovici/cosmoz-page-router/lib/use-hash-param';
3
+ /* eslint-disable-next-line import/no-unresolved */
4
+ import { useHashParam, link } from '@neovici/cosmoz-page-router/use-hash-param';
4
5
  import { choose, collect, getName, isValid } from './utils';
5
6
  import computeScroll from 'compute-scroll-into-view';
6
7