2024-01-21 01:12:57 +01:00
|
|
|
import * as plugins from './00plugins.js';
|
|
|
|
import * as colors from './00colors.js';
|
|
|
|
|
|
|
|
import {
|
|
|
|
customElement,
|
|
|
|
html,
|
|
|
|
css,
|
|
|
|
cssManager,
|
|
|
|
DeesElement,
|
|
|
|
property,
|
|
|
|
unsafeCSS,
|
|
|
|
query,
|
|
|
|
} from '@design.estate/dees-element';
|
|
|
|
|
|
|
|
import { demoFunc } from './dees-label.demo.js';
|
|
|
|
|
|
|
|
@customElement('dees-label')
|
|
|
|
export class DeesLabel extends DeesElement {
|
|
|
|
public static demo = demoFunc;
|
|
|
|
|
|
|
|
// INSTANCE
|
|
|
|
|
|
|
|
@property({
|
|
|
|
type: String,
|
|
|
|
reflect: true,
|
|
|
|
})
|
|
|
|
public label = '';
|
|
|
|
|
|
|
|
@property({
|
|
|
|
type: String,
|
|
|
|
reflect: true,
|
|
|
|
})
|
|
|
|
public description: string;
|
|
|
|
|
2025-06-27 16:20:06 +00:00
|
|
|
@property({
|
|
|
|
type: Boolean,
|
|
|
|
reflect: true,
|
|
|
|
})
|
|
|
|
public required: boolean = false;
|
|
|
|
|
2024-01-21 01:12:57 +01:00
|
|
|
public static styles = [
|
|
|
|
cssManager.defaultStyles,
|
|
|
|
css`
|
2025-06-27 16:20:06 +00:00
|
|
|
:host {
|
|
|
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
|
|
|
|
}
|
|
|
|
|
2024-01-21 01:12:57 +01:00
|
|
|
.label {
|
2025-06-27 16:20:06 +00:00
|
|
|
display: inline-block;
|
|
|
|
color: ${cssManager.bdTheme('hsl(0 0% 15%)', 'hsl(0 0% 90%)')};
|
2024-01-21 01:12:57 +01:00
|
|
|
font-size: 14px;
|
2025-06-27 16:20:06 +00:00
|
|
|
font-weight: 500;
|
|
|
|
line-height: 1.5;
|
|
|
|
margin-bottom: 6px;
|
2024-01-21 01:12:57 +01:00
|
|
|
cursor: default;
|
|
|
|
user-select: none;
|
2025-06-27 16:20:06 +00:00
|
|
|
letter-spacing: -0.01em;
|
|
|
|
}
|
|
|
|
|
|
|
|
.required {
|
|
|
|
color: ${cssManager.bdTheme('hsl(0 84.2% 60.2%)', 'hsl(0 72.2% 50.6%)')};
|
|
|
|
margin-left: 2px;
|
2024-01-21 01:12:57 +01:00
|
|
|
}
|
2025-06-27 16:20:06 +00:00
|
|
|
|
2024-01-21 01:12:57 +01:00
|
|
|
dees-icon {
|
|
|
|
display: inline-block;
|
2025-06-27 16:20:06 +00:00
|
|
|
font-size: 12px;
|
|
|
|
transform: translateY(1px);
|
|
|
|
margin-left: 4px;
|
|
|
|
color: ${cssManager.bdTheme('hsl(0 0% 45.1%)', 'hsl(0 0% 63.9%)')};
|
|
|
|
cursor: help;
|
2024-01-21 01:12:57 +01:00
|
|
|
}
|
|
|
|
`,
|
|
|
|
];
|
|
|
|
|
|
|
|
public render() {
|
|
|
|
return html`
|
|
|
|
${this.label
|
|
|
|
? html`
|
|
|
|
<div class="label">
|
|
|
|
${this.label}
|
2025-06-27 16:20:06 +00:00
|
|
|
${this.required ? html`<span class="required">*</span>` : ''}
|
2024-01-21 01:12:57 +01:00
|
|
|
${this.description
|
|
|
|
? html`
|
2025-06-27 16:20:06 +00:00
|
|
|
<dees-icon .iconName=${'lucideInfo'}></dees-icon>
|
2024-01-21 01:12:57 +01:00
|
|
|
<dees-speechbubble .text=${this.description}></dees-speechbubble>
|
|
|
|
`
|
|
|
|
: html``}
|
|
|
|
</div>
|
|
|
|
`
|
|
|
|
: html``}
|
|
|
|
`;
|
|
|
|
}
|
|
|
|
}
|