@umbraco-ui/uui-card-content-node 1.11.0 → 1.12.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/custom-elements.json +13 -0
- package/lib/index.js +78 -27
- package/lib/uui-card-content-node.element.d.ts +8 -0
- package/package.json +5 -5
package/custom-elements.json
CHANGED
|
@@ -11,6 +11,12 @@
|
|
|
11
11
|
"type": "string",
|
|
12
12
|
"default": "\"''\""
|
|
13
13
|
},
|
|
14
|
+
{
|
|
15
|
+
"name": "detail",
|
|
16
|
+
"description": "Node details",
|
|
17
|
+
"type": "string",
|
|
18
|
+
"default": "\"''\""
|
|
19
|
+
},
|
|
14
20
|
{
|
|
15
21
|
"name": "disabled",
|
|
16
22
|
"description": "Set to true to prevent opening of this item.\nThis does not prevent selection, selection is controlled by property 'selectable'",
|
|
@@ -66,6 +72,13 @@
|
|
|
66
72
|
"type": "string",
|
|
67
73
|
"default": "\"''\""
|
|
68
74
|
},
|
|
75
|
+
{
|
|
76
|
+
"name": "detail",
|
|
77
|
+
"attribute": "detail",
|
|
78
|
+
"description": "Node details",
|
|
79
|
+
"type": "string",
|
|
80
|
+
"default": "\"''\""
|
|
81
|
+
},
|
|
69
82
|
{
|
|
70
83
|
"name": "disabled",
|
|
71
84
|
"attribute": "disabled",
|
package/lib/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { defineElement } from '@umbraco-ui/uui-base/lib/registration';
|
|
2
2
|
import { demandCustomElement } from '@umbraco-ui/uui-base/lib/utils';
|
|
3
3
|
import { UUICardElement } from '@umbraco-ui/uui-card/lib';
|
|
4
|
-
import {
|
|
4
|
+
import { html, css, nothing } from 'lit';
|
|
5
5
|
import { property, state } from 'lit/decorators.js';
|
|
6
6
|
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
7
7
|
|
|
@@ -21,14 +21,26 @@ var __decorateClass = (decorators, target, key, kind) => {
|
|
|
21
21
|
var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
|
|
22
22
|
var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
23
23
|
var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
|
|
24
|
-
var _UUICardContentNodeElement_instances, renderButton_fn, renderLink_fn;
|
|
24
|
+
var _UUICardContentNodeElement_instances, renderContent_fn, renderButton_fn, renderLink_fn;
|
|
25
25
|
let UUICardContentNodeElement = class extends UUICardElement {
|
|
26
26
|
constructor() {
|
|
27
27
|
super(...arguments);
|
|
28
28
|
__privateAdd(this, _UUICardContentNodeElement_instances);
|
|
29
29
|
this.name = "";
|
|
30
|
+
this.detail = "";
|
|
30
31
|
this._iconSlotHasContent = false;
|
|
31
|
-
this.fallbackIcon =
|
|
32
|
+
this.fallbackIcon = `<svg
|
|
33
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
34
|
+
viewBox="0 0 24 24"
|
|
35
|
+
fill="none"
|
|
36
|
+
stroke="currentColor"
|
|
37
|
+
stroke-width="1.75"
|
|
38
|
+
stroke-linecap="round"
|
|
39
|
+
stroke-linejoin="round"
|
|
40
|
+
id="icon">
|
|
41
|
+
<path d="M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z" />
|
|
42
|
+
<path d="M14 2v4a2 2 0 0 0 2 2h4" />
|
|
43
|
+
</svg>`;
|
|
32
44
|
}
|
|
33
45
|
_onSlotIconChange(event) {
|
|
34
46
|
this._iconSlotHasContent = event.target.assignedNodes({ flatten: true }).length > 0;
|
|
@@ -37,31 +49,45 @@ let UUICardContentNodeElement = class extends UUICardElement {
|
|
|
37
49
|
demandCustomElement(this, "uui-icon");
|
|
38
50
|
return html`<uui-icon .svg="${this.fallbackIcon}"></uui-icon>`;
|
|
39
51
|
}
|
|
52
|
+
renderDetail() {
|
|
53
|
+
return html`<small id="detail"
|
|
54
|
+
>${this.detail}<slot name="detail"></slot></small
|
|
55
|
+
><slot id="default"></slot>`;
|
|
56
|
+
}
|
|
40
57
|
render() {
|
|
41
58
|
return html`
|
|
42
59
|
${this.href ? __privateMethod(this, _UUICardContentNodeElement_instances, renderLink_fn).call(this) : __privateMethod(this, _UUICardContentNodeElement_instances, renderButton_fn).call(this)}
|
|
43
60
|
<!-- Select border must be right after #open-part -->
|
|
44
61
|
<div id="select-border"></div>
|
|
45
62
|
|
|
46
|
-
<slot></slot>
|
|
47
63
|
<slot name="tag"></slot>
|
|
48
64
|
<slot name="actions"></slot>
|
|
49
65
|
`;
|
|
50
66
|
}
|
|
51
67
|
};
|
|
52
68
|
_UUICardContentNodeElement_instances = new WeakSet();
|
|
69
|
+
renderContent_fn = function() {
|
|
70
|
+
return html`
|
|
71
|
+
<span id="content">
|
|
72
|
+
<span id="item">
|
|
73
|
+
<span id="icon">
|
|
74
|
+
<slot name="icon" @slotchange=${this._onSlotIconChange}></slot>
|
|
75
|
+
${this._iconSlotHasContent === false ? this._renderFallbackIcon() : ""}
|
|
76
|
+
</span>
|
|
77
|
+
<div id="name">${this.name}<slot name="name"></slot></div>
|
|
78
|
+
</span>
|
|
79
|
+
${this.renderDetail()}
|
|
80
|
+
</span>
|
|
81
|
+
`;
|
|
82
|
+
};
|
|
53
83
|
renderButton_fn = function() {
|
|
54
|
-
return html`<
|
|
84
|
+
return html`<button
|
|
55
85
|
id="open-part"
|
|
56
86
|
tabindex=${this.disabled ? nothing : 0}
|
|
57
87
|
@click=${this.handleOpenClick}
|
|
58
88
|
@keydown=${this.handleOpenKeydown}>
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
${this._iconSlotHasContent === false ? this._renderFallbackIcon() : ""}
|
|
62
|
-
</span>
|
|
63
|
-
<span id="name"> ${this.name} </span>
|
|
64
|
-
</div>`;
|
|
89
|
+
${__privateMethod(this, _UUICardContentNodeElement_instances, renderContent_fn).call(this)}
|
|
90
|
+
</button>`;
|
|
65
91
|
};
|
|
66
92
|
renderLink_fn = function() {
|
|
67
93
|
return html`<a
|
|
@@ -74,11 +100,7 @@ renderLink_fn = function() {
|
|
|
74
100
|
this.target === "_blank" ? "noopener noreferrer" : void 0
|
|
75
101
|
)
|
|
76
102
|
)}>
|
|
77
|
-
|
|
78
|
-
<slot name="icon" @slotchange=${this._onSlotIconChange}></slot>
|
|
79
|
-
${this._iconSlotHasContent === false ? this._renderFallbackIcon() : ""}
|
|
80
|
-
</span>
|
|
81
|
-
<span id="name"> ${this.name} </span>
|
|
103
|
+
${__privateMethod(this, _UUICardContentNodeElement_instances, renderContent_fn).call(this)}
|
|
82
104
|
</a>`;
|
|
83
105
|
};
|
|
84
106
|
UUICardContentNodeElement.styles = [
|
|
@@ -88,7 +110,6 @@ UUICardContentNodeElement.styles = [
|
|
|
88
110
|
min-width: 250px;
|
|
89
111
|
flex-direction: column;
|
|
90
112
|
justify-content: space-between;
|
|
91
|
-
padding: var(--uui-size-3,9px) var(--uui-size-4,12px);
|
|
92
113
|
}
|
|
93
114
|
|
|
94
115
|
slot[name='tag'] {
|
|
@@ -126,36 +147,66 @@ UUICardContentNodeElement.styles = [
|
|
|
126
147
|
line-height: calc(2 * var(--uui-size-3,9px));
|
|
127
148
|
}
|
|
128
149
|
|
|
129
|
-
#icon {
|
|
130
|
-
font-size: 1.2em;
|
|
131
|
-
margin-right: var(--uui-size-1,3px);
|
|
132
|
-
}
|
|
133
|
-
|
|
134
150
|
#open-part {
|
|
135
151
|
display: flex;
|
|
136
152
|
position: relative;
|
|
137
153
|
font-weight: 700;
|
|
138
154
|
align-items: center;
|
|
139
155
|
cursor: pointer;
|
|
156
|
+
flex-grow: 1;
|
|
157
|
+
padding: var(--uui-size-space-4,12px) var(--uui-size-space-5,18px);
|
|
140
158
|
}
|
|
141
159
|
|
|
142
|
-
|
|
160
|
+
#content {
|
|
161
|
+
align-self: stretch;
|
|
162
|
+
display: flex;
|
|
163
|
+
flex-direction: column;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
#item {
|
|
167
|
+
position: relative;
|
|
168
|
+
display: flex;
|
|
169
|
+
align-self: stretch;
|
|
170
|
+
line-height: normal;
|
|
171
|
+
align-items: center;
|
|
172
|
+
margin-top: var(--uui-size-1,3px);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
#icon {
|
|
176
|
+
font-size: 1.2em;
|
|
177
|
+
margin-right: var(--uui-size-1,3px);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
:host([selectable]) #open-part {
|
|
181
|
+
padding: 0;
|
|
182
|
+
margin: var(--uui-size-space-4,12px) var(--uui-size-space-5,18px);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
:host([disabled]) #name {
|
|
143
186
|
pointer-events: none;
|
|
144
187
|
}
|
|
145
188
|
|
|
146
|
-
#open-part:hover {
|
|
189
|
+
:host(:not([disabled])) #open-part:hover #icon {
|
|
190
|
+
color: var(--uui-color-interactive-emphasis,#3544b1);
|
|
191
|
+
}
|
|
192
|
+
:host(:not([disabled])) #open-part:hover #name {
|
|
147
193
|
text-decoration: underline;
|
|
148
194
|
color: var(--uui-color-interactive-emphasis,#3544b1);
|
|
149
195
|
}
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
196
|
+
:host(:not([disabled])) #open-part:hover #detail {
|
|
197
|
+
color: var(--uui-color-interactive-emphasis,#3544b1);
|
|
198
|
+
}
|
|
199
|
+
:host(:not([disabled])) #open-part:hover #default {
|
|
200
|
+
color: var(--uui-color-interactive-emphasis,#3544b1);
|
|
153
201
|
}
|
|
154
202
|
`
|
|
155
203
|
];
|
|
156
204
|
__decorateClass([
|
|
157
205
|
property({ type: String })
|
|
158
206
|
], UUICardContentNodeElement.prototype, "name", 2);
|
|
207
|
+
__decorateClass([
|
|
208
|
+
property({ type: String })
|
|
209
|
+
], UUICardContentNodeElement.prototype, "detail", 2);
|
|
159
210
|
__decorateClass([
|
|
160
211
|
state()
|
|
161
212
|
], UUICardContentNodeElement.prototype, "_iconSlotHasContent", 2);
|
|
@@ -16,10 +16,18 @@ export declare class UUICardContentNodeElement extends UUICardElement {
|
|
|
16
16
|
* @default ''
|
|
17
17
|
*/
|
|
18
18
|
name: string;
|
|
19
|
+
/**
|
|
20
|
+
* Node details
|
|
21
|
+
* @type {string}
|
|
22
|
+
* @attr
|
|
23
|
+
* @default ''
|
|
24
|
+
*/
|
|
25
|
+
detail: string;
|
|
19
26
|
private _iconSlotHasContent;
|
|
20
27
|
protected fallbackIcon: string;
|
|
21
28
|
private _onSlotIconChange;
|
|
22
29
|
private _renderFallbackIcon;
|
|
30
|
+
protected renderDetail(): import("lit-html").TemplateResult<1>;
|
|
23
31
|
render(): import("lit-html").TemplateResult<1>;
|
|
24
32
|
static styles: import("lit").CSSResult[];
|
|
25
33
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umbraco-ui/uui-card-content-node",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.12.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Umbraco",
|
|
@@ -30,9 +30,9 @@
|
|
|
30
30
|
"custom-elements.json"
|
|
31
31
|
],
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@umbraco-ui/uui-base": "1.
|
|
34
|
-
"@umbraco-ui/uui-card": "1.
|
|
35
|
-
"@umbraco-ui/uui-icon": "1.
|
|
33
|
+
"@umbraco-ui/uui-base": "1.12.1",
|
|
34
|
+
"@umbraco-ui/uui-card": "1.12.1",
|
|
35
|
+
"@umbraco-ui/uui-icon": "1.12.1"
|
|
36
36
|
},
|
|
37
37
|
"scripts": {
|
|
38
38
|
"build": "npm run analyze && tsc --build && rollup -c rollup.config.js",
|
|
@@ -43,5 +43,5 @@
|
|
|
43
43
|
"access": "public"
|
|
44
44
|
},
|
|
45
45
|
"homepage": "https://uui.umbraco.com/?path=/story/uui-card-content-node",
|
|
46
|
-
"gitHead": "
|
|
46
|
+
"gitHead": "a7d67a9f6b60b8c0b351b21d5dac49cdfc764f44"
|
|
47
47
|
}
|