@umbraco-ui/uui-card-user 0.0.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/LICENSE +21 -0
- package/README.md +25 -0
- package/custom-elements.json +99 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +120 -0
- package/lib/uui-card-user.element.d.ts +18 -0
- package/lib/uui-card-user.element.js +120 -0
- package/package.json +49 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2020 uui-app
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# uui-card-user
|
|
2
|
+
|
|
3
|
+
## Usage
|
|
4
|
+
|
|
5
|
+
```zsh
|
|
6
|
+
npm i @umbraco-ui/uui-card-user
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
Import the registration of `<uui-card-user>` via:
|
|
10
|
+
|
|
11
|
+
```javascript
|
|
12
|
+
import '@umbraco-ui/uui-card-user/lib';
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
When looking to leverage the `UUICardUserElement` base class as a type and/or for extension purposes, do so via:
|
|
16
|
+
|
|
17
|
+
```javascript
|
|
18
|
+
import { UUICardUserElement } from '@umbraco-ui/uui-card-user/lib/uui-card-user.element';
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Example
|
|
22
|
+
|
|
23
|
+
```html
|
|
24
|
+
INSERT EXAMPLE
|
|
25
|
+
```
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "experimental",
|
|
3
|
+
"tags": [
|
|
4
|
+
{
|
|
5
|
+
"name": "uui-card-user",
|
|
6
|
+
"path": "./lib/uui-card-user.element.ts",
|
|
7
|
+
"attributes": [
|
|
8
|
+
{
|
|
9
|
+
"name": "name",
|
|
10
|
+
"description": "User name",
|
|
11
|
+
"type": "string",
|
|
12
|
+
"default": "\"''\""
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"name": "disabled",
|
|
16
|
+
"description": "Set to true to prevent opening of this item.\nThis does not prevent selection, selection is controlled by property 'selectable'",
|
|
17
|
+
"type": "boolean",
|
|
18
|
+
"default": "\"false\""
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"name": "error",
|
|
22
|
+
"description": "Set to true to highlight there is an error with this item.",
|
|
23
|
+
"type": "boolean",
|
|
24
|
+
"default": "\"false\""
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"name": "selectable",
|
|
28
|
+
"description": "Set to true if you want to be able to select this particular element on.",
|
|
29
|
+
"type": "boolean"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"name": "selected",
|
|
33
|
+
"description": "Attribute applied when the element is selected.",
|
|
34
|
+
"type": "boolean",
|
|
35
|
+
"default": "false"
|
|
36
|
+
}
|
|
37
|
+
],
|
|
38
|
+
"properties": [
|
|
39
|
+
{
|
|
40
|
+
"name": "name",
|
|
41
|
+
"attribute": "name",
|
|
42
|
+
"description": "User name",
|
|
43
|
+
"type": "string",
|
|
44
|
+
"default": "\"''\""
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"name": "styles",
|
|
48
|
+
"type": "CSSResult[]",
|
|
49
|
+
"default": "[null,null]"
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
"name": "disabled",
|
|
53
|
+
"attribute": "disabled",
|
|
54
|
+
"description": "Set to true to prevent opening of this item.\nThis does not prevent selection, selection is controlled by property 'selectable'",
|
|
55
|
+
"type": "boolean",
|
|
56
|
+
"default": "\"false\""
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"name": "error",
|
|
60
|
+
"attribute": "error",
|
|
61
|
+
"description": "Set to true to highlight there is an error with this item.",
|
|
62
|
+
"type": "boolean",
|
|
63
|
+
"default": "\"false\""
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
"name": "selectable",
|
|
67
|
+
"attribute": "selectable",
|
|
68
|
+
"description": "Set to true if you want to be able to select this particular element on.",
|
|
69
|
+
"type": "boolean"
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
"name": "selected",
|
|
73
|
+
"attribute": "selected",
|
|
74
|
+
"description": "Attribute applied when the element is selected.",
|
|
75
|
+
"type": "boolean",
|
|
76
|
+
"default": "false"
|
|
77
|
+
}
|
|
78
|
+
],
|
|
79
|
+
"events": [
|
|
80
|
+
{
|
|
81
|
+
"name": "open",
|
|
82
|
+
"description": "fires when the user card title is clicked"
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
"name": "selected",
|
|
86
|
+
"description": "fires when the card is selected"
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
"name": "select",
|
|
90
|
+
"description": "fires when the media card is selected"
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
"name": "unselect",
|
|
94
|
+
"description": "fires when the media card is unselected"
|
|
95
|
+
}
|
|
96
|
+
]
|
|
97
|
+
}
|
|
98
|
+
]
|
|
99
|
+
}
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { css, html } 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
|
+
typeof require !== "undefined" ? require : (x) => {
|
|
8
|
+
throw new Error('Dynamic require of "' + x + '" is not supported');
|
|
9
|
+
};
|
|
10
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
11
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
12
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
13
|
+
if (decorator = decorators[i])
|
|
14
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
15
|
+
if (kind && result)
|
|
16
|
+
__defProp(target, key, result);
|
|
17
|
+
return result;
|
|
18
|
+
};
|
|
19
|
+
class UUICardUserElement extends UUICardElement {
|
|
20
|
+
constructor() {
|
|
21
|
+
super(...arguments);
|
|
22
|
+
this.name = "";
|
|
23
|
+
}
|
|
24
|
+
render() {
|
|
25
|
+
return html`
|
|
26
|
+
<slot name="tag"></slot>
|
|
27
|
+
<slot name="actions"></slot>
|
|
28
|
+
<uui-avatar id="avatar" title=${this.name} size="m"></uui-avatar>
|
|
29
|
+
<div
|
|
30
|
+
id="open-part"
|
|
31
|
+
tabindex=${this.disabled ? "-1" : "0"}
|
|
32
|
+
@click=${this.handleOpenClick}
|
|
33
|
+
@keydown=${this.handleOpenKeydown}>
|
|
34
|
+
<span> ${this.name} </span>
|
|
35
|
+
</div>
|
|
36
|
+
<slot></slot>
|
|
37
|
+
`;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
UUICardUserElement.styles = [
|
|
41
|
+
...UUICardElement.styles,
|
|
42
|
+
css`
|
|
43
|
+
:host {
|
|
44
|
+
min-width: 250px;
|
|
45
|
+
flex-direction: column;
|
|
46
|
+
justify-content: space-between;
|
|
47
|
+
padding: var(--uui-size-3,9px);
|
|
48
|
+
align-items: center;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
slot:not([name])::slotted(*) {
|
|
52
|
+
font-size: var(--uui-size-4,12px);
|
|
53
|
+
line-height: var(--uui-size-6,18px);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
::slotted(*) {
|
|
57
|
+
text-align: center;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
slot[name='tag'] {
|
|
61
|
+
position: absolute;
|
|
62
|
+
top: 6px;
|
|
63
|
+
right: 6px;
|
|
64
|
+
display: flex;
|
|
65
|
+
justify-content: right;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
slot[name='actions'] {
|
|
69
|
+
position: absolute;
|
|
70
|
+
top: var(--uui-size-4,12px);
|
|
71
|
+
right: var(--uui-size-4,12px);
|
|
72
|
+
display: flex;
|
|
73
|
+
justify-content: right;
|
|
74
|
+
|
|
75
|
+
opacity: 0;
|
|
76
|
+
transition: opacity 120ms;
|
|
77
|
+
}
|
|
78
|
+
:host(:focus) slot[name='actions'],
|
|
79
|
+
:host(:focus-within) slot[name='actions'],
|
|
80
|
+
:host(:hover) slot[name='actions'] {
|
|
81
|
+
opacity: 1;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
#avatar {
|
|
85
|
+
margin: var(--uui-size-3,9px);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
slot[name='icon']::slotted(*) {
|
|
89
|
+
font-size: 1.2em;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
#open-part {
|
|
93
|
+
display: flex;
|
|
94
|
+
position: relative;
|
|
95
|
+
font-weight: 700;
|
|
96
|
+
align-items: center;
|
|
97
|
+
cursor: pointer;
|
|
98
|
+
margin: 0 0 3px 0;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
:host([disabled]) #open-part {
|
|
102
|
+
pointer-events: none;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
#open-part > span {
|
|
106
|
+
vertical-align: center;
|
|
107
|
+
margin-top: 3px;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
#open-part:hover {
|
|
111
|
+
text-decoration: underline;
|
|
112
|
+
color: var(--uui-interface-contrast-hover,#1b264f);
|
|
113
|
+
}
|
|
114
|
+
`
|
|
115
|
+
];
|
|
116
|
+
__decorateClass([
|
|
117
|
+
property({ type: String })
|
|
118
|
+
], UUICardUserElement.prototype, "name", 2);
|
|
119
|
+
|
|
120
|
+
customElements.define("uui-card-user", UUICardUserElement);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { UUICardElement } from '@umbraco-ui/uui-card/lib/uui-card.element';
|
|
2
|
+
/**
|
|
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
|
+
* @description - Card component for displaying a user node.
|
|
7
|
+
*/
|
|
8
|
+
export declare class UUICardUserElement extends UUICardElement {
|
|
9
|
+
static styles: import("lit").CSSResult[];
|
|
10
|
+
/**
|
|
11
|
+
* User name
|
|
12
|
+
* @type {string}
|
|
13
|
+
* @attr name
|
|
14
|
+
* @default ''
|
|
15
|
+
*/
|
|
16
|
+
name: string;
|
|
17
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
18
|
+
}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { css, html } 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
|
+
typeof require !== "undefined" ? require : (x) => {
|
|
8
|
+
throw new Error('Dynamic require of "' + x + '" is not supported');
|
|
9
|
+
};
|
|
10
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
11
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
12
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
13
|
+
if (decorator = decorators[i])
|
|
14
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
15
|
+
if (kind && result)
|
|
16
|
+
__defProp(target, key, result);
|
|
17
|
+
return result;
|
|
18
|
+
};
|
|
19
|
+
class UUICardUserElement extends UUICardElement {
|
|
20
|
+
constructor() {
|
|
21
|
+
super(...arguments);
|
|
22
|
+
this.name = "";
|
|
23
|
+
}
|
|
24
|
+
render() {
|
|
25
|
+
return html`
|
|
26
|
+
<slot name="tag"></slot>
|
|
27
|
+
<slot name="actions"></slot>
|
|
28
|
+
<uui-avatar id="avatar" title=${this.name} size="m"></uui-avatar>
|
|
29
|
+
<div
|
|
30
|
+
id="open-part"
|
|
31
|
+
tabindex=${this.disabled ? "-1" : "0"}
|
|
32
|
+
@click=${this.handleOpenClick}
|
|
33
|
+
@keydown=${this.handleOpenKeydown}>
|
|
34
|
+
<span> ${this.name} </span>
|
|
35
|
+
</div>
|
|
36
|
+
<slot></slot>
|
|
37
|
+
`;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
UUICardUserElement.styles = [
|
|
41
|
+
...UUICardElement.styles,
|
|
42
|
+
css`
|
|
43
|
+
:host {
|
|
44
|
+
min-width: 250px;
|
|
45
|
+
flex-direction: column;
|
|
46
|
+
justify-content: space-between;
|
|
47
|
+
padding: var(--uui-size-3,9px);
|
|
48
|
+
align-items: center;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
slot:not([name])::slotted(*) {
|
|
52
|
+
font-size: var(--uui-size-4,12px);
|
|
53
|
+
line-height: var(--uui-size-6,18px);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
::slotted(*) {
|
|
57
|
+
text-align: center;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
slot[name='tag'] {
|
|
61
|
+
position: absolute;
|
|
62
|
+
top: 6px;
|
|
63
|
+
right: 6px;
|
|
64
|
+
display: flex;
|
|
65
|
+
justify-content: right;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
slot[name='actions'] {
|
|
69
|
+
position: absolute;
|
|
70
|
+
top: var(--uui-size-4,12px);
|
|
71
|
+
right: var(--uui-size-4,12px);
|
|
72
|
+
display: flex;
|
|
73
|
+
justify-content: right;
|
|
74
|
+
|
|
75
|
+
opacity: 0;
|
|
76
|
+
transition: opacity 120ms;
|
|
77
|
+
}
|
|
78
|
+
:host(:focus) slot[name='actions'],
|
|
79
|
+
:host(:focus-within) slot[name='actions'],
|
|
80
|
+
:host(:hover) slot[name='actions'] {
|
|
81
|
+
opacity: 1;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
#avatar {
|
|
85
|
+
margin: var(--uui-size-3,9px);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
slot[name='icon']::slotted(*) {
|
|
89
|
+
font-size: 1.2em;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
#open-part {
|
|
93
|
+
display: flex;
|
|
94
|
+
position: relative;
|
|
95
|
+
font-weight: 700;
|
|
96
|
+
align-items: center;
|
|
97
|
+
cursor: pointer;
|
|
98
|
+
margin: 0 0 3px 0;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
:host([disabled]) #open-part {
|
|
102
|
+
pointer-events: none;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
#open-part > span {
|
|
106
|
+
vertical-align: center;
|
|
107
|
+
margin-top: 3px;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
#open-part:hover {
|
|
111
|
+
text-decoration: underline;
|
|
112
|
+
color: var(--uui-interface-contrast-hover,#1b264f);
|
|
113
|
+
}
|
|
114
|
+
`
|
|
115
|
+
];
|
|
116
|
+
__decorateClass([
|
|
117
|
+
property({ type: String })
|
|
118
|
+
], UUICardUserElement.prototype, "name", 2);
|
|
119
|
+
|
|
120
|
+
export { UUICardUserElement };
|
package/package.json
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@umbraco-ui/uui-card-user",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"Umbraco",
|
|
7
|
+
"Custom elements",
|
|
8
|
+
"Web components",
|
|
9
|
+
"UI",
|
|
10
|
+
"Lit",
|
|
11
|
+
"card",
|
|
12
|
+
"user"
|
|
13
|
+
],
|
|
14
|
+
"description": "",
|
|
15
|
+
"repository": {
|
|
16
|
+
"type": "git",
|
|
17
|
+
"url": "https://github.com/umbraco/Umbraco.UI.git",
|
|
18
|
+
"directory": "packages/uui-card-user"
|
|
19
|
+
},
|
|
20
|
+
"bugs": {
|
|
21
|
+
"url": "https://github.com/umbraco/Umbraco.UI/issues"
|
|
22
|
+
},
|
|
23
|
+
"main": "./dist/index.js",
|
|
24
|
+
"module": "./lib/index.js",
|
|
25
|
+
"customElements": "custom-elements.json",
|
|
26
|
+
"files": [
|
|
27
|
+
"dist",
|
|
28
|
+
"lib/**/*.d.ts",
|
|
29
|
+
"lib/**/*.js",
|
|
30
|
+
"custom-elements.json"
|
|
31
|
+
],
|
|
32
|
+
"dependencies": {
|
|
33
|
+
"@umbraco-ui/uui-base": "0.0.14"
|
|
34
|
+
},
|
|
35
|
+
"peerDependencies": {
|
|
36
|
+
"@umbraco-ui/uui-avatar": "~0.0.15",
|
|
37
|
+
"@umbraco-ui/uui-card": "~0.0.0"
|
|
38
|
+
},
|
|
39
|
+
"scripts": {
|
|
40
|
+
"build": "npm run analyze && tsc --build --force && rollup -c rollup.config.js",
|
|
41
|
+
"clean": "tsc --build --clean && rimraf dist lib/*.js lib/**/*.js custom-elements.json",
|
|
42
|
+
"analyze": "web-component-analyzer **/*.element.ts --outFile custom-elements.json"
|
|
43
|
+
},
|
|
44
|
+
"publishConfig": {
|
|
45
|
+
"access": "public"
|
|
46
|
+
},
|
|
47
|
+
"homepage": "https://uui.umbraco.com/?path=/story/uui-card-user",
|
|
48
|
+
"gitHead": "27d48bb352dcac2b08d55958ecba92b28c11d957"
|
|
49
|
+
}
|