@umbraco-ui/uui-card-user 1.10.0 → 1.12.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.
Files changed (2) hide show
  1. package/lib/index.js +48 -34
  2. package/package.json +5 -5
package/lib/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { defineElement } from '@umbraco-ui/uui-base/lib/registration';
2
2
  import { slotHasContent, demandCustomElement } from '@umbraco-ui/uui-base/lib/utils';
3
3
  import { UUICardElement } from '@umbraco-ui/uui-card/lib';
4
- import { css, html, nothing } from 'lit';
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,7 +21,7 @@ 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 _UUICardUserElement_instances, renderButton_fn, renderLink_fn;
24
+ var _UUICardUserElement_instances, renderButton_fn, renderLink_fn, renderContent_fn;
25
25
  let UUICardUserElement = class extends UUICardElement {
26
26
  constructor() {
27
27
  super(...arguments);
@@ -38,16 +38,9 @@ let UUICardUserElement = class extends UUICardElement {
38
38
  }
39
39
  render() {
40
40
  return html`
41
- ${this._avatarSlotHasContent ? nothing : html`<uui-avatar
42
- id="avatar"
43
- name=${this.name}
44
- size="m"></uui-avatar>`}
45
- <slot
46
- name="avatar"
47
- id="avatar"
48
- @slotchange=${this._avatarSlotChanged}></slot>
49
41
  ${this.href ? __privateMethod(this, _UUICardUserElement_instances, renderLink_fn).call(this) : __privateMethod(this, _UUICardUserElement_instances, renderButton_fn).call(this)}
50
- <slot></slot>
42
+ <!-- Select border must be right after #open-part -->
43
+ <div id="select-border"></div>
51
44
  <slot name="tag"></slot>
52
45
  <slot name="actions"></slot>
53
46
  `;
@@ -60,7 +53,7 @@ renderButton_fn = function() {
60
53
  tabindex=${this.disabled ? nothing : "0"}
61
54
  @click=${this.handleOpenClick}
62
55
  @keydown=${this.handleOpenKeydown}>
63
- <span> ${this.name} </span>
56
+ ${__privateMethod(this, _UUICardUserElement_instances, renderContent_fn).call(this)}
64
57
  </div>`;
65
58
  };
66
59
  renderLink_fn = function() {
@@ -74,18 +67,28 @@ renderLink_fn = function() {
74
67
  this.target === "_blank" ? "noopener noreferrer" : void 0
75
68
  )
76
69
  )}>
77
- <span>${this.name}</span>
70
+ ${__privateMethod(this, _UUICardUserElement_instances, renderContent_fn).call(this)}
78
71
  </a>`;
79
72
  };
73
+ renderContent_fn = function() {
74
+ return html`<div id="content">
75
+ ${this._avatarSlotHasContent ? nothing : html`<uui-avatar
76
+ class="avatar"
77
+ name=${this.name}
78
+ size="m"></uui-avatar>`}
79
+ <slot
80
+ name="avatar"
81
+ class="avatar"
82
+ @slotchange=${this._avatarSlotChanged}></slot>
83
+ <span>${this.name}</span>
84
+ <slot></slot>
85
+ </div>`;
86
+ };
80
87
  UUICardUserElement.styles = [
81
88
  ...UUICardElement.styles,
82
89
  css`
83
90
  :host {
84
91
  min-width: 250px;
85
- flex-direction: column;
86
- justify-content: space-between;
87
- padding: var(--uui-size-3,9px);
88
- align-items: center;
89
92
  }
90
93
 
91
94
  slot:not([name])::slotted(*) {
@@ -107,8 +110,8 @@ UUICardUserElement.styles = [
107
110
 
108
111
  slot[name='actions'] {
109
112
  position: absolute;
110
- top: var(--uui-size-4,12px);
111
- right: var(--uui-size-4,12px);
113
+ top: var(--uui-size-space-4,12px);
114
+ right: var(--uui-size-space-4,12px);
112
115
  display: flex;
113
116
  justify-content: right;
114
117
 
@@ -121,35 +124,46 @@ UUICardUserElement.styles = [
121
124
  opacity: 1;
122
125
  }
123
126
 
124
- #avatar {
125
- margin: var(--uui-size-3,9px);
127
+ #open-part {
128
+ cursor: pointer;
129
+ flex-grow: 1;
130
+ padding: var(--uui-size-space-5,18px) var(--uui-size-space-4,12px);
131
+ }
132
+
133
+ :host([disabled]) #open-part {
134
+ pointer-events: none;
126
135
  }
127
136
 
128
- slot[name='icon']::slotted(*) {
129
- font-size: 1.2em;
137
+ #open-part:hover #content {
138
+ color: var(--uui-color-interactive-emphasis,#3544b1);
139
+ }
140
+ #open-part:hover #content > span {
141
+ text-decoration: underline;
130
142
  }
131
143
 
132
- #open-part {
144
+ :host([selectable]) #open-part {
145
+ padding: 0;
146
+ margin: var(--uui-size-space-5,18px) var(--uui-size-space-4,12px);
147
+ }
148
+
149
+ #content {
133
150
  display: flex;
151
+ flex-direction: column;
134
152
  position: relative;
135
- font-weight: 700;
136
153
  align-items: center;
137
- cursor: pointer;
138
154
  margin: 0 0 3px 0;
139
155
  }
140
156
 
141
- :host([disabled]) #open-part {
142
- pointer-events: none;
143
- }
144
-
145
- #open-part > span {
157
+ #content > span {
146
158
  vertical-align: center;
147
159
  margin-top: 3px;
160
+ font-weight: 700;
148
161
  }
149
162
 
150
- #open-part:hover {
151
- text-decoration: underline;
152
- color: var(--uui-color-interactive-emphasis,#3544b1);
163
+ .avatar {
164
+ font-size: 1.5em;
165
+ margin-top: var(--uui-size-space-1,3px);
166
+ margin-bottom: var(--uui-size-space-2,6px);
153
167
  }
154
168
  `
155
169
  ];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umbraco-ui/uui-card-user",
3
- "version": "1.10.0",
3
+ "version": "1.12.0",
4
4
  "license": "MIT",
5
5
  "keywords": [
6
6
  "Umbraco",
@@ -31,9 +31,9 @@
31
31
  "custom-elements.json"
32
32
  ],
33
33
  "dependencies": {
34
- "@umbraco-ui/uui-avatar": "1.10.0",
35
- "@umbraco-ui/uui-base": "1.10.0",
36
- "@umbraco-ui/uui-card": "1.10.0"
34
+ "@umbraco-ui/uui-avatar": "1.12.0",
35
+ "@umbraco-ui/uui-base": "1.12.0",
36
+ "@umbraco-ui/uui-card": "1.12.0"
37
37
  },
38
38
  "scripts": {
39
39
  "build": "npm run analyze && tsc --build && rollup -c rollup.config.js",
@@ -44,5 +44,5 @@
44
44
  "access": "public"
45
45
  },
46
46
  "homepage": "https://uui.umbraco.com/?path=/story/uui-card-user",
47
- "gitHead": "fc19b5d3cd80cf4205ec56d14403ae0e926d6aed"
47
+ "gitHead": "0ac5219b2765bf6c90fe4943a6620b46a7fced4e"
48
48
  }