@umbraco-ui/uui-card-user 0.0.2 → 0.1.0
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/README.md +6 -2
- package/custom-elements.json +16 -6
- package/lib/index.d.ts +1 -1
- package/lib/index.js +16 -7
- package/lib/uui-card-user.element.d.ts +10 -3
- package/package.json +8 -7
- package/lib/uui-card-user.element.js +0 -117
package/README.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# uui-card-user
|
|
2
2
|
|
|
3
|
+
### See it in action
|
|
4
|
+
|
|
5
|
+
Preview the component on [Storybook](https://uui.umbraco.com/?path=/story/uui-card-user)
|
|
6
|
+
|
|
3
7
|
## Usage
|
|
4
8
|
|
|
5
9
|
```zsh
|
|
@@ -9,13 +13,13 @@ npm i @umbraco-ui/uui-card-user
|
|
|
9
13
|
Import the registration of `<uui-card-user>` via:
|
|
10
14
|
|
|
11
15
|
```javascript
|
|
12
|
-
import '@umbraco-ui/uui-card-user
|
|
16
|
+
import '@umbraco-ui/uui-card-user';
|
|
13
17
|
```
|
|
14
18
|
|
|
15
19
|
When looking to leverage the `UUICardUserElement` base class as a type and/or for extension purposes, do so via:
|
|
16
20
|
|
|
17
21
|
```javascript
|
|
18
|
-
import { UUICardUserElement } from '@umbraco-ui/uui-card-user
|
|
22
|
+
import { UUICardUserElement } from '@umbraco-ui/uui-card-user';
|
|
19
23
|
```
|
|
20
24
|
|
|
21
25
|
## Example
|
package/custom-elements.json
CHANGED
|
@@ -90,20 +90,30 @@
|
|
|
90
90
|
"events": [
|
|
91
91
|
{
|
|
92
92
|
"name": "open",
|
|
93
|
-
"description": "fires when the
|
|
93
|
+
"description": "fires when the card title is clicked"
|
|
94
94
|
},
|
|
95
95
|
{
|
|
96
96
|
"name": "selected",
|
|
97
|
-
"description": "fires when the card is selected"
|
|
98
|
-
},
|
|
99
|
-
{
|
|
100
|
-
"name": "select",
|
|
101
97
|
"description": "fires when the media card is selected"
|
|
102
98
|
},
|
|
103
99
|
{
|
|
104
|
-
"name": "
|
|
100
|
+
"name": "unselected",
|
|
105
101
|
"description": "fires when the media card is unselected"
|
|
106
102
|
}
|
|
103
|
+
],
|
|
104
|
+
"slots": [
|
|
105
|
+
{
|
|
106
|
+
"name": "",
|
|
107
|
+
"description": "slot for the default content area"
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
"name": "tag",
|
|
111
|
+
"description": "slot for the tag with support for `<uui-tag>` elements"
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
"name": "actions",
|
|
115
|
+
"description": "slot for the actions with support for the `<uui-action-bar>` element"
|
|
116
|
+
}
|
|
107
117
|
]
|
|
108
118
|
}
|
|
109
119
|
]
|
package/lib/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export * from './uui-card-user.element';
|
package/lib/index.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import { defineElement } from '@umbraco-ui/uui-base/lib/registration';
|
|
2
|
+
import { demandCustomElement } from '@umbraco-ui/uui-base/lib/utils';
|
|
3
|
+
import { UUICardElement } from '@umbraco-ui/uui-card/lib';
|
|
1
4
|
import { css, html, nothing } from 'lit';
|
|
2
5
|
import { property } from 'lit/decorators.js';
|
|
3
|
-
import { UUICardElement } from '@umbraco-ui/uui-card/lib/uui-card.element';
|
|
4
6
|
|
|
5
7
|
var __defProp = Object.defineProperty;
|
|
6
8
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -13,15 +15,17 @@ var __decorateClass = (decorators, target, key, kind) => {
|
|
|
13
15
|
__defProp(target, key, result);
|
|
14
16
|
return result;
|
|
15
17
|
};
|
|
16
|
-
|
|
18
|
+
let UUICardUserElement = class extends UUICardElement {
|
|
17
19
|
constructor() {
|
|
18
20
|
super(...arguments);
|
|
19
21
|
this.name = "";
|
|
20
22
|
}
|
|
23
|
+
connectedCallback() {
|
|
24
|
+
super.connectedCallback();
|
|
25
|
+
demandCustomElement(this, "uui-avatar");
|
|
26
|
+
}
|
|
21
27
|
render() {
|
|
22
28
|
return html`
|
|
23
|
-
<slot name="tag"></slot>
|
|
24
|
-
<slot name="actions"></slot>
|
|
25
29
|
<uui-avatar id="avatar" name=${this.name} size="m"></uui-avatar>
|
|
26
30
|
<div
|
|
27
31
|
id="open-part"
|
|
@@ -31,9 +35,11 @@ class UUICardUserElement extends UUICardElement {
|
|
|
31
35
|
<span> ${this.name} </span>
|
|
32
36
|
</div>
|
|
33
37
|
<slot></slot>
|
|
38
|
+
<slot name="tag"></slot>
|
|
39
|
+
<slot name="actions"></slot>
|
|
34
40
|
`;
|
|
35
41
|
}
|
|
36
|
-
}
|
|
42
|
+
};
|
|
37
43
|
UUICardUserElement.styles = [
|
|
38
44
|
...UUICardElement.styles,
|
|
39
45
|
css`
|
|
@@ -46,7 +52,7 @@ UUICardUserElement.styles = [
|
|
|
46
52
|
}
|
|
47
53
|
|
|
48
54
|
slot:not([name])::slotted(*) {
|
|
49
|
-
font-size: var(--uui-size
|
|
55
|
+
font-size: var(--uui-type-small-size,12px);
|
|
50
56
|
line-height: var(--uui-size-6,18px);
|
|
51
57
|
}
|
|
52
58
|
|
|
@@ -113,5 +119,8 @@ UUICardUserElement.styles = [
|
|
|
113
119
|
__decorateClass([
|
|
114
120
|
property({ type: String })
|
|
115
121
|
], UUICardUserElement.prototype, "name", 2);
|
|
122
|
+
UUICardUserElement = __decorateClass([
|
|
123
|
+
defineElement("uui-card-user")
|
|
124
|
+
], UUICardUserElement);
|
|
116
125
|
|
|
117
|
-
|
|
126
|
+
export { UUICardUserElement };
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { UUICardElement } from '@umbraco-ui/uui-card/lib
|
|
1
|
+
import { UUICardElement } from '@umbraco-ui/uui-card/lib';
|
|
2
2
|
/**
|
|
3
3
|
* @element uui-card-user
|
|
4
|
-
* @fires {UUICardEvent} open - fires when the user card title is clicked
|
|
5
|
-
* @fires {UUICardEvent} selected - fires when the card is selected
|
|
6
4
|
* @description - Card component for displaying a user node.
|
|
5
|
+
* @slot - slot for the default content area
|
|
6
|
+
* @slot tag - slot for the tag with support for `<uui-tag>` elements
|
|
7
|
+
* @slot actions - slot for the actions with support for the `<uui-action-bar>` element
|
|
7
8
|
*/
|
|
8
9
|
export declare class UUICardUserElement extends UUICardElement {
|
|
9
10
|
static styles: import("lit").CSSResult[];
|
|
@@ -14,5 +15,11 @@ export declare class UUICardUserElement extends UUICardElement {
|
|
|
14
15
|
* @default ''
|
|
15
16
|
*/
|
|
16
17
|
name: string;
|
|
18
|
+
connectedCallback(): void;
|
|
17
19
|
render(): import("lit-html").TemplateResult<1>;
|
|
18
20
|
}
|
|
21
|
+
declare global {
|
|
22
|
+
interface HTMLElementTagNameMap {
|
|
23
|
+
'uui-card-user': UUICardUserElement;
|
|
24
|
+
}
|
|
25
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umbraco-ui/uui-card-user",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Umbraco",
|
|
@@ -20,19 +20,20 @@
|
|
|
20
20
|
"bugs": {
|
|
21
21
|
"url": "https://github.com/umbraco/Umbraco.UI/issues"
|
|
22
22
|
},
|
|
23
|
-
"main": "./
|
|
23
|
+
"main": "./lib/index.js",
|
|
24
24
|
"module": "./lib/index.js",
|
|
25
|
+
"types": "./lib/index.d.ts",
|
|
26
|
+
"type": "module",
|
|
25
27
|
"customElements": "custom-elements.json",
|
|
26
28
|
"files": [
|
|
27
|
-
"dist",
|
|
28
29
|
"lib/**/*.d.ts",
|
|
29
30
|
"lib/**/*.js",
|
|
30
31
|
"custom-elements.json"
|
|
31
32
|
],
|
|
32
33
|
"dependencies": {
|
|
33
|
-
"@umbraco-ui/uui-avatar": "
|
|
34
|
-
"@umbraco-ui/uui-base": "0.0
|
|
35
|
-
"@umbraco-ui/uui-card": "0.0
|
|
34
|
+
"@umbraco-ui/uui-avatar": "0.1.0",
|
|
35
|
+
"@umbraco-ui/uui-base": "0.1.0",
|
|
36
|
+
"@umbraco-ui/uui-card": "0.1.0"
|
|
36
37
|
},
|
|
37
38
|
"scripts": {
|
|
38
39
|
"build": "npm run analyze && tsc --build --force && rollup -c rollup.config.js",
|
|
@@ -43,5 +44,5 @@
|
|
|
43
44
|
"access": "public"
|
|
44
45
|
},
|
|
45
46
|
"homepage": "https://uui.umbraco.com/?path=/story/uui-card-user",
|
|
46
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "9ed7860ce865d310b85bd1718f37b59db873aefd"
|
|
47
48
|
}
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
import { css, html, nothing } from 'lit';
|
|
2
|
-
import { property } from 'lit/decorators.js';
|
|
3
|
-
import { UUICardElement } from '@umbraco-ui/uui-card/lib/uui-card.element';
|
|
4
|
-
|
|
5
|
-
var __defProp = Object.defineProperty;
|
|
6
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
7
|
-
var __decorateClass = (decorators, target, key, kind) => {
|
|
8
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
9
|
-
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
10
|
-
if (decorator = decorators[i])
|
|
11
|
-
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
12
|
-
if (kind && result)
|
|
13
|
-
__defProp(target, key, result);
|
|
14
|
-
return result;
|
|
15
|
-
};
|
|
16
|
-
class UUICardUserElement extends UUICardElement {
|
|
17
|
-
constructor() {
|
|
18
|
-
super(...arguments);
|
|
19
|
-
this.name = "";
|
|
20
|
-
}
|
|
21
|
-
render() {
|
|
22
|
-
return html`
|
|
23
|
-
<slot name="tag"></slot>
|
|
24
|
-
<slot name="actions"></slot>
|
|
25
|
-
<uui-avatar id="avatar" name=${this.name} size="m"></uui-avatar>
|
|
26
|
-
<div
|
|
27
|
-
id="open-part"
|
|
28
|
-
tabindex=${this.disabled ? nothing : "0"}
|
|
29
|
-
@click=${this.handleOpenClick}
|
|
30
|
-
@keydown=${this.handleOpenKeydown}>
|
|
31
|
-
<span> ${this.name} </span>
|
|
32
|
-
</div>
|
|
33
|
-
<slot></slot>
|
|
34
|
-
`;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
UUICardUserElement.styles = [
|
|
38
|
-
...UUICardElement.styles,
|
|
39
|
-
css`
|
|
40
|
-
:host {
|
|
41
|
-
min-width: 250px;
|
|
42
|
-
flex-direction: column;
|
|
43
|
-
justify-content: space-between;
|
|
44
|
-
padding: var(--uui-size-3,9px);
|
|
45
|
-
align-items: center;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
slot:not([name])::slotted(*) {
|
|
49
|
-
font-size: var(--uui-size-4,12px);
|
|
50
|
-
line-height: var(--uui-size-6,18px);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
::slotted(*) {
|
|
54
|
-
text-align: center;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
slot[name='tag'] {
|
|
58
|
-
position: absolute;
|
|
59
|
-
top: 6px;
|
|
60
|
-
right: 6px;
|
|
61
|
-
display: flex;
|
|
62
|
-
justify-content: right;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
slot[name='actions'] {
|
|
66
|
-
position: absolute;
|
|
67
|
-
top: var(--uui-size-4,12px);
|
|
68
|
-
right: var(--uui-size-4,12px);
|
|
69
|
-
display: flex;
|
|
70
|
-
justify-content: right;
|
|
71
|
-
|
|
72
|
-
opacity: 0;
|
|
73
|
-
transition: opacity 120ms;
|
|
74
|
-
}
|
|
75
|
-
:host(:focus) slot[name='actions'],
|
|
76
|
-
:host(:focus-within) slot[name='actions'],
|
|
77
|
-
:host(:hover) slot[name='actions'] {
|
|
78
|
-
opacity: 1;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
#avatar {
|
|
82
|
-
margin: var(--uui-size-3,9px);
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
slot[name='icon']::slotted(*) {
|
|
86
|
-
font-size: 1.2em;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
#open-part {
|
|
90
|
-
display: flex;
|
|
91
|
-
position: relative;
|
|
92
|
-
font-weight: 700;
|
|
93
|
-
align-items: center;
|
|
94
|
-
cursor: pointer;
|
|
95
|
-
margin: 0 0 3px 0;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
:host([disabled]) #open-part {
|
|
99
|
-
pointer-events: none;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
#open-part > span {
|
|
103
|
-
vertical-align: center;
|
|
104
|
-
margin-top: 3px;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
#open-part:hover {
|
|
108
|
-
text-decoration: underline;
|
|
109
|
-
color: var(--uui-interface-contrast-hover,#1b264f);
|
|
110
|
-
}
|
|
111
|
-
`
|
|
112
|
-
];
|
|
113
|
-
__decorateClass([
|
|
114
|
-
property({ type: String })
|
|
115
|
-
], UUICardUserElement.prototype, "name", 2);
|
|
116
|
-
|
|
117
|
-
export { UUICardUserElement };
|