dees-catalog/ts_web/elements/dees-input-typelist.ts

99 lines
2.1 KiB
TypeScript
Raw Permalink Normal View History

2024-01-09 12:57:53 +00:00
import {
customElement,
DeesElement,
type TemplateResult,
state,
html,
domtools,
property,
css,
cssManager,
} from '@design.estate/dees-element';
2024-01-10 04:11:55 +00:00
const { demoFunc } = await import('./dees-input-typelist.demo.js');
2024-01-09 12:57:53 +00:00
2024-01-10 04:11:55 +00:00
@customElement('dees-input-typelist')
export class DeesInputTypelist extends DeesElement {
2024-01-09 12:57:53 +00:00
public static demo = demoFunc;
2024-01-18 01:08:19 +00:00
// INSTANCE
@property({
type: String,
})
public label: string;
2024-01-09 12:57:53 +00:00
constructor() {
super();
}
public static styles = [
cssManager.defaultStyles,
css`
:host {
2024-01-18 01:08:19 +00:00
display: block;
color: ${cssManager.bdTheme('#333', '#fff')};
margin: 8px 0px 24px 0px;
2024-01-09 12:57:53 +00:00
}
.label {
font-size: 14px;
2024-01-18 01:08:19 +00:00
margin-bottom: 8px;
2024-01-09 12:57:53 +00:00
}
.mainbox {
border-radius: 3px;
background: #222;
overflow: hidden;
border-top: ${cssManager.bdTheme('1px solid #CCC', '1px solid #444')};
border-bottom: ${cssManager.bdTheme('1px solid #CCC', '1px solid #333')};
border-right: ${cssManager.bdTheme('1px solid #CCC', 'none')};
border-left: ${cssManager.bdTheme('1px solid #CCC', 'none')};
}
2024-01-15 11:57:49 +00:00
.tags {
padding: 16px;
cursor: default;
}
.notags {
text-align: center;
opacity: 0.5;
font-size: 12px;
2024-01-09 12:57:53 +00:00
}
input {
2024-01-15 11:57:49 +00:00
display: block;
box-sizing: border-box;
2024-01-09 12:57:53 +00:00
background: #181818;
width: 100%;
outline: none;
border: none;
color: inherit;
2024-01-15 11:57:49 +00:00
padding: 0px 16px;
overflow: hidden;
line-height: 32px;
height: 0px;
transition: height 0.2s;
}
input:focus {
height: 32px;
2024-01-09 12:57:53 +00:00
}
`,
];
public render(): TemplateResult {
return html`
2024-01-18 01:08:19 +00:00
<div class="label">${this.label}</div>
2024-01-09 12:57:53 +00:00
<div class="mainbox">
2024-01-15 11:57:49 +00:00
<div class="tags" @click=${() => {
this.shadowRoot.querySelector('input').focus();
}}>
<div class="notags">No tags yet</div>
2024-01-09 12:57:53 +00:00
</div>
2024-01-15 11:57:49 +00:00
<input type="text" placeholder="Type, press Enter to add it..." />
2024-01-09 12:57:53 +00:00
</div>
`;
}
}