@neovici/cosmoz-tabs 8.1.0 → 8.3.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.3.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
  }
@@ -49,7 +49,11 @@ const CosmozTabCard = (host) => {
49
49
  ${when(
50
50
  collapsable,
51
51
  () => html`
52
- <div @click=${toggleCollapsed} part="collapse-icon">
52
+ <div
53
+ @click=${toggleCollapsed}
54
+ class="collapse-icon"
55
+ part="collapse-icon"
56
+ >
53
57
  <slot name="collapse-icon">${collapseIcon}</slot>
54
58
  </div>
55
59
  `,
@@ -60,9 +64,11 @@ const CosmozTabCard = (host) => {
60
64
  <slot name="card-actions"></slot>
61
65
  </div>
62
66
 
63
- <div id="content" part="content">
64
- <cosmoz-collapse ?opened=${!collapsed}><slot></slot></cosmoz-collapse>
65
- </div>`;
67
+ <cosmoz-collapse ?opened=${!collapsed}>
68
+ <div id="content" part="content">
69
+ <slot></slot>
70
+ </div>
71
+ </cosmoz-collapse> `;
66
72
  };
67
73
 
68
74
  const style = css`
@@ -102,17 +108,17 @@ const style = css`
102
108
  flex: 1;
103
109
  }
104
110
 
105
- [part='collapse-icon'] {
111
+ .collapse-icon {
106
112
  order: var(--cosmoz-tab-card-collapse-icon-order);
107
113
  transition: transform 250ms linear;
108
114
  transform: rotate(90deg);
109
115
  }
110
116
 
111
- :host([collapsed]) [part='collapse-icon'] {
117
+ :host([collapsed]) .collapse-icon {
112
118
  transform: rotate(0deg);
113
119
  }
114
120
 
115
- :host([collapsable]) [part='collapse-icon'],
121
+ :host([collapsable]) .collapse-icon,
116
122
  :host([collapsable]) .heading {
117
123
  cursor: pointer;
118
124
  user-select: none;
@@ -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
+ });