-
Notifications
You must be signed in to change notification settings - Fork 53
/
Copy pathuui-ref-node-package.element.ts
60 lines (53 loc) · 1.79 KB
/
uui-ref-node-package.element.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import { UUIRefNodeElement } from '@umbraco-ui/uui-ref-node/lib';
import { defineElement } from '@umbraco-ui/uui-base/lib/registration';
import { html } from 'lit';
import { property } from 'lit/decorators.js';
/**
* @element uui-ref-node-package
* @fires {UUIRefEvent} open - fires when the ref title is clicked
* @fires {UUIRefEvent} selected - fires when the ref is selected
* @fires {UUIRefEvent} deselected - fires when the ref is deselected
* @description - Component for displaying a reference to a Package node.
*/
@defineElement('uui-ref-node-package')
export class UUIRefNodePackageElement extends UUIRefNodeElement {
protected fallbackIcon =
'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M161.08 106.29l-70.073 40.452 165.498 95.545 70.076-40.453L161.08 106.29zm259.851 41.077L255.435 51.815l-63.578 36.709 165.499 95.542 63.575-36.699zm-150.11 122.19V459.43l164.966-95.238V174.32l-164.966 95.237zM75.082 364.191l164.959 95.234V268.32L75.082 173.09v191.101z"></path></svg>';
/**
* Package version
* @type {string}
* @attr
* @default ''
*/
@property({ type: String })
version = '';
/**
* Package author
* @type {string}
* @attr
* @default ''
*/
@property({ type: String })
author = '';
protected renderDetail() {
const details: string[] = [];
if (this.detail !== '') {
details.push(this.detail);
}
if (this.version !== '') {
details.push(this.version);
}
if (this.author !== '') {
details.push(this.author);
}
return html`<small id="detail"
>${details.join(' | ')}<slot name="detail"></slot
></small>`;
}
static styles = [...UUIRefNodeElement.styles];
}
declare global {
interface HTMLElementTagNameMap {
'uui-ref-node-package': UUIRefNodePackageElement;
}
}