Compare commits

..

5 Commits
1.0.0 ... main

Author SHA1 Message Date
pk
783795aa3e Add part 2025-02-11 23:41:05 +01:00
pk
99468efa3f Add css part 2024-08-04 22:55:14 +02:00
pk
65f1e6808e Update deps 2023-09-18 13:03:20 +02:00
pk
c16d2020ca Fixes. 2023-09-02 00:19:12 +02:00
pk
1ce3fbc453 Fixes. 2023-09-02 00:18:57 +02:00
2 changed files with 18 additions and 12 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "@tp/tp-tabs", "name": "@tp/tp-tabs",
"version": "1.0.0", "version": "1.3.0",
"description": "", "description": "",
"main": "tp-tabs.js", "main": "tp-tabs.js",
"scripts": { "scripts": {
@ -13,7 +13,7 @@
"author": "trading_peter", "author": "trading_peter",
"license": "Apache-2.0", "license": "Apache-2.0",
"dependencies": { "dependencies": {
"lit": "^2.2.0", "lit": "^2.8.0",
"@tp/helpers": "^1.0.0" "@tp/helpers": "^2.1.0"
} }
} }

View File

@ -5,31 +5,37 @@ This program is available under Apache License Version 2.0
*/ */
import { closest } from '@tp/helpers'; import { closest } from '@tp/helpers';
import { LitElement, html, css } from 'lit-element'; import { LitElement, html, css } from 'lit';
class TpTabs extends LitElement { class TpTabs extends LitElement {
static get properties() {
return {
orientation: { type: String, reflect: true }
};
}
static get styles() { static get styles() {
return css` return css`
:host {
display: block;
}
:host([orientation="vertical"]) .tabs { :host([orientation="vertical"]) .tabs {
flex-direction: column; flex-direction: column;
} }
.tabs { .tabs {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
} }
.tab {
slot::slotted(.tab) {
cursor: pointer; cursor: pointer;
padding: 8px; padding: 8px;
} }
`; `;
} }
static get properties() {
return {
orientation: { type: String, reflect: true }
};
}
constructor() { constructor() {
super(); super();
this.orientation = 'horizontal'; this.orientation = 'horizontal';
@ -37,7 +43,7 @@ class TpTabs extends LitElement {
render() { render() {
return html` return html`
<div class="tabs" @click="${this.selectTab}"> <div class="tabs" part="wrap" @click="${this.selectTab}">
<slot></slot> <slot></slot>
</div> </div>
`; `;