@neovici/cosmoz-tabs 8.1.0 → 8.2.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neovici/cosmoz-tabs",
3
- "version": "8.1.0",
3
+ "version": "8.2.0",
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"
@@ -78,8 +78,8 @@
78
78
  "lit-html": "^2.0.0 || ^3.0.0"
79
79
  },
80
80
  "devDependencies": {
81
- "@commitlint/cli": "^18.0.0",
82
- "@commitlint/config-conventional": "^18.0.0",
81
+ "@commitlint/cli": "^19.0.0",
82
+ "@commitlint/config-conventional": "^19.0.0",
83
83
  "@neovici/cfg": "^1.11.0",
84
84
  "@open-wc/testing": "^4.0.0",
85
85
  "@polymer/iron-list": "^3.1.0",
@@ -88,7 +88,7 @@
88
88
  "@storybook/storybook-deployer": "^2.8.0",
89
89
  "@web/dev-server-storybook": "^2.0.0",
90
90
  "husky": "^8.0.0",
91
- "semantic-release": "^22.0.0",
91
+ "semantic-release": "^23.0.0",
92
92
  "sinon": "^17.0.0",
93
93
  "typescript": "^5.0.0"
94
94
  }
@@ -3,6 +3,7 @@ import { html, useMemo, useCallback, useRef } from '@pionjs/pion';
3
3
  import { ifDefined } from 'lit-html/directives/if-defined.js';
4
4
  /* eslint-disable-next-line import/no-unresolved */
5
5
  import { useHashParam } from '@neovici/cosmoz-router/use-hash-param';
6
+ import { invoke } from '@neovici/cosmoz-utils/function';
6
7
 
7
8
  const isValid = (tab) => !tab.hidden && !tab.disabled,
8
9
  valid = (tabs) =>
@@ -42,20 +43,21 @@ export const useTabs = (tabs, { hashParam, onActivate }) => {
42
43
  onActivate?.(name);
43
44
  activate(name);
44
45
  },
45
- [activate, onActivate]
46
+ [activate, onActivate],
46
47
  ),
47
48
  };
48
49
  };
49
50
 
50
51
  export const renderTabs = ({ tabs, active, onActivate }) =>
51
- tabs.map(
52
- (tab) => html`<cosmoz-tab-next
52
+ tabs.map((tab) => {
53
+ const title = invoke(tab.title);
54
+ return html`<cosmoz-tab-next
53
55
  name=${tab.name}
54
56
  ?active=${active.name === tab.name}
55
57
  ?hidden=${tab.hidden}
56
58
  ?disabled=${tab.disabled}
57
- title=${ifDefined(typeof tab.title === 'string' ? tab.title : undefined)}
59
+ title=${ifDefined(typeof title === 'string' ? title : undefined)}
58
60
  @click=${onActivate}
59
- >${tab.content ?? tab.title}</cosmoz-tab-next
60
- >`
61
- );
61
+ >${tab.content ?? title}</cosmoz-tab-next
62
+ >`;
63
+ });