Compare commits

..

2 Commits

Author SHA1 Message Date
pk
5138a5c279 Add the menu divider 2025-02-06 22:26:55 +01:00
pk
58885dea0d Add part for the icon 2025-02-05 13:09:27 +01:00
3 changed files with 40 additions and 2 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "@tp/tp-popup", "name": "@tp/tp-popup",
"version": "1.0.7", "version": "1.1.0",
"description": "", "description": "",
"main": "tp-popup.js", "main": "tp-popup.js",
"scripts": { "scripts": {

38
tp-popup-menu-divider.js Normal file
View File

@ -0,0 +1,38 @@
/**
@license
Copyright (c) 2025 trading_peter
This program is available under Apache License Version 2.0
*/
import '@tp/tp-icon/tp-icon.js';
import { LitElement, html, css } from 'lit';
class TpPopupMenuDivider extends LitElement {
static get styles() {
return [
css`
:host {
display: block;
--tp-popup-menu-divider-spacing: 5px;
}
.divider {
margin-top: var(--tp-popup-menu-divider-spacing-top, var(--tp-popup-menu-divider-spacing));
margin-bottom: var(--tp-popup-menu-divider-spacing-bottom, var(--tp-popup-menu-divider-spacing));
height: var(--tp-popup-menu-divider-width, 2px);
background: var(--tp-popup-menu-divider-color, #000);
}
`
];
}
render() {
const { icon } = this;
return html`
<div class="divider"></div>
`;
}
}
window.customElements.define('tp-popup-menu-divider', TpPopupMenuDivider);

View File

@ -40,7 +40,7 @@ class TpPopupMenuItem extends LitElement {
return html` return html`
<div class="wrap" ?noicon=${!icon}> <div class="wrap" ?noicon=${!icon}>
${icon ? html` ${icon ? html`
<tp-icon .icon=${icon}></tp-icon> <tp-icon part="icon" .icon=${icon}></tp-icon>
` : null} ` : null}
<div class="label"> <div class="label">
<slot></slot> <slot></slot>