@umbraco-ui/uui-card-block-type 1.12.2 → 1.13.0-rc.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/lib/index.js CHANGED
@@ -3,7 +3,6 @@ import { UUICardElement } from '@umbraco-ui/uui-card/lib';
3
3
  import { html, css, nothing } from 'lit';
4
4
  import { property } from 'lit/decorators.js';
5
5
  import { ifDefined } from 'lit/directives/if-defined.js';
6
- import { styleMap } from 'lit/directives/style-map.js';
7
6
 
8
7
  var __defProp = Object.defineProperty;
9
8
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -21,21 +20,25 @@ var __decorateClass = (decorators, target, key, kind) => {
21
20
  var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
22
21
  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
22
  var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
24
- var _UUICardBlockTypeElement_instances, renderButton_fn, renderLink_fn;
23
+ var _UUICardBlockTypeElement_instances, renderButton_fn, renderLink_fn, renderMedia_fn, renderContent_fn;
25
24
  let UUICardBlockTypeElement = class extends UUICardElement {
26
25
  constructor() {
27
26
  super(...arguments);
28
27
  __privateAdd(this, _UUICardBlockTypeElement_instances);
29
28
  this.name = "";
30
29
  }
30
+ get background() {
31
+ return void 0;
32
+ }
33
+ set background(value) {
34
+ this.style.backgroundColor = value ?? "";
35
+ }
31
36
  render() {
32
37
  return html`
33
- <div
34
- id="portrait"
35
- style=${styleMap({ backgroundColor: this.background })}>
36
- <slot></slot>
37
- </div>
38
+ ${__privateMethod(this, _UUICardBlockTypeElement_instances, renderMedia_fn).call(this)}
38
39
  ${this.href ? __privateMethod(this, _UUICardBlockTypeElement_instances, renderLink_fn).call(this) : __privateMethod(this, _UUICardBlockTypeElement_instances, renderButton_fn).call(this)}
40
+ <!-- Select border must be right after #open-part -->
41
+ <div id="select-border"></div>
39
42
 
40
43
  <slot name="tag"></slot>
41
44
  <slot name="actions"></slot>
@@ -47,10 +50,11 @@ renderButton_fn = function() {
47
50
  return html`
48
51
  <button
49
52
  id="open-part"
53
+ class="uui-text"
50
54
  tabindex=${this.disabled ? nothing : "0"}
51
55
  @click=${this.handleOpenClick}
52
56
  @keydown=${this.handleOpenKeydown}>
53
- <strong>${this.name}</strong><small>${this.description}</small>
57
+ ${__privateMethod(this, _UUICardBlockTypeElement_instances, renderContent_fn).call(this)}
54
58
  </button>
55
59
  `;
56
60
  };
@@ -58,6 +62,7 @@ renderLink_fn = function() {
58
62
  return html`
59
63
  <a
60
64
  id="open-part"
65
+ class="uui-text"
61
66
  tabindex=${this.disabled ? nothing : "0"}
62
67
  href=${ifDefined(!this.disabled ? this.href : void 0)}
63
68
  target=${ifDefined(this.target || void 0)}
@@ -66,54 +71,83 @@ renderLink_fn = function() {
66
71
  this.target === "_blank" ? "noopener noreferrer" : void 0
67
72
  )
68
73
  )}>
69
- <strong>${this.name}</strong><small>${this.description}</small>
74
+ ${__privateMethod(this, _UUICardBlockTypeElement_instances, renderContent_fn).call(this)}
70
75
  </a>
71
76
  `;
72
77
  };
78
+ renderMedia_fn = function() {
79
+ return html`<div id="portrait">
80
+ <slot></slot>
81
+ </div> `;
82
+ };
83
+ renderContent_fn = function() {
84
+ return html`
85
+ <div id="content">
86
+ <span id="name">${this.name}</span>
87
+ <small>${this.description}<slot name="description"></slot></small>
88
+ </div></div>
89
+ `;
90
+ };
73
91
  UUICardBlockTypeElement.styles = [
74
92
  ...UUICardElement.styles,
75
93
  css`
76
94
  :host {
77
- flex-direction: column;
78
- justify-content: flex-start;
95
+ background-color: var(--uui-color-surface-alt,#f3f3f5);
79
96
  }
80
97
 
81
- :host(:hover) #info {
82
- color: var(--uui-color-interactive-emphasis,#3544b1);
98
+ slot[name='tag'] {
99
+ position: absolute;
100
+ top: var(--uui-size-4,12px);
101
+ right: var(--uui-size-4,12px);
102
+ display: flex;
103
+ justify-content: right;
104
+ z-index: 2;
105
+ }
106
+
107
+ slot[name='actions'] {
108
+ position: absolute;
109
+ top: var(--uui-size-4,12px);
110
+ right: var(--uui-size-4,12px);
111
+ display: flex;
112
+ justify-content: right;
113
+ z-index: 2;
114
+ opacity: 0;
115
+ transition: opacity 120ms;
116
+ }
117
+ :host(:focus) slot[name='actions'],
118
+ :host(:focus-within) slot[name='actions'],
119
+ :host(:hover) slot[name='actions'] {
120
+ opacity: 1;
83
121
  }
84
122
 
85
123
  #portrait {
86
- background-color: var(--uui-color-surface-alt,#f3f3f5);
87
124
  display: flex;
88
125
  justify-content: center;
89
126
  min-height: 150px;
90
127
  max-height: 150px;
128
+ width: 100%;
129
+ margin-bottom: var(--uui-size-layout-2,30px);
91
130
  }
92
131
 
93
132
  slot:not([name])::slotted(*) {
94
133
  align-self: center;
95
- font-size: var(--uui-size-8,24px);
96
134
  border-radius: var(--uui-border-radius,3px);
97
135
  object-fit: cover;
98
136
  max-width: 100%;
99
137
  max-height: 100%;
138
+ font-size: var(--uui-size-8,24px);
100
139
  }
101
140
 
102
141
  #open-part {
103
- text-align: left;
104
- background-color: var(--uui-color-surface,#fff);
105
- cursor: pointer;
142
+ position: absolute;
143
+ z-index: 1;
144
+ inset: 0;
106
145
  color: var(--uui-color-interactive,#1b264f);
107
146
  border: none;
108
- border-top: 1px solid var(--uui-color-divider,#f6f6f7);
109
- border-radius: 0 0 var(--uui-border-radius,3px) var(--uui-border-radius,3px);
110
- font-family: inherit;
111
- font-size: var(--uui-type-small-size,12px);
112
- box-sizing: border-box;
113
- padding: var(--uui-size-2,6px) var(--uui-size-4,12px);
147
+ cursor: pointer;
114
148
  display: flex;
115
149
  flex-direction: column;
116
- line-height: var(--uui-size-6,18px);
150
+ justify-content: flex-end;
117
151
  }
118
152
 
119
153
  :host([disabled]) #open-part {
@@ -122,35 +156,43 @@ UUICardBlockTypeElement.styles = [
122
156
  color: var(--uui-color-contrast-disabled);
123
157
  }
124
158
 
125
- #open-part:hover strong {
126
- text-decoration: underline;
127
- }
128
159
  #open-part:hover {
129
160
  color: var(--uui-color-interactive-emphasis,#3544b1);
130
161
  }
162
+ #open-part:hover #name {
163
+ text-decoration: underline;
164
+ }
131
165
 
132
166
  :host([image]:not([image=''])) #open-part {
133
167
  transition: opacity 0.5s 0.5s;
134
168
  opacity: 0;
135
169
  }
136
- slot[name='tag'] {
137
- position: absolute;
138
- top: var(--uui-size-4,12px);
139
- right: var(--uui-size-4,12px);
170
+
171
+ #content {
172
+ position: relative;
140
173
  display: flex;
141
- justify-content: right;
174
+ flex-direction: column;
175
+ width: 100%;
176
+ font-family: inherit;
177
+ font-size: var(--uui-type-small-size,12px);
178
+ box-sizing: border-box;
179
+ text-align: left;
180
+ word-break: break-word;
181
+ padding-top: var(--uui-size-space-3,9px);
142
182
  }
143
183
 
144
- slot[name='actions'] {
184
+ #content::before {
185
+ content: '';
145
186
  position: absolute;
146
- top: var(--uui-size-4,12px);
147
- right: var(--uui-size-4,12px);
148
- display: flex;
149
- justify-content: right;
150
-
151
- opacity: 0;
152
- transition: opacity 120ms;
187
+ inset: 0;
188
+ z-index: -1;
189
+ border-top: 1px solid var(--uui-color-divider,#f6f6f7);
190
+ border-radius: 0 0 var(--uui-border-radius,3px) var(--uui-border-radius,3px);
191
+ background-color: var(--uui-color-surface,#fff);
192
+ pointer-events: none;
193
+ opacity: 0.96;
153
194
  }
195
+
154
196
  :host(:focus) slot[name='actions'],
155
197
  :host(:focus-within) slot[name='actions'],
156
198
  :host(:hover) slot[name='actions'] {
@@ -169,6 +211,18 @@ UUICardBlockTypeElement.styles = [
169
211
  transition-duration: 120ms;
170
212
  transition-delay: 0s;
171
213
  }
214
+
215
+ :host([selectable]) #open-part {
216
+ inset: var(--uui-size-space-3,9px) var(--uui-size-space-4,12px);
217
+ }
218
+ :host(:not([selectable])) #content {
219
+ padding: var(--uui-size-space-3,9px) var(--uui-size-space-4,12px);
220
+ }
221
+ :host([selectable]) #content::before {
222
+ inset: calc(var(--uui-size-space-3,9px) * -1)
223
+ calc(var(--uui-size-space-4,12px) * -1);
224
+ top: 0;
225
+ }
172
226
  `
173
227
  ];
174
228
  __decorateClass([
@@ -179,7 +233,7 @@ __decorateClass([
179
233
  ], UUICardBlockTypeElement.prototype, "description", 2);
180
234
  __decorateClass([
181
235
  property({ type: String, attribute: "background" })
182
- ], UUICardBlockTypeElement.prototype, "background", 2);
236
+ ], UUICardBlockTypeElement.prototype, "background", 1);
183
237
  UUICardBlockTypeElement = __decorateClass([
184
238
  defineElement("uui-card-block-type")
185
239
  ], UUICardBlockTypeElement);
@@ -25,7 +25,8 @@ export declare class UUICardBlockTypeElement extends UUICardElement {
25
25
  * @default undefined
26
26
  */
27
27
  description?: string;
28
- background?: string;
28
+ get background(): string | undefined;
29
+ set background(value: string | undefined);
29
30
  render(): import("lit-html").TemplateResult<1>;
30
31
  static styles: import("lit").CSSResult[];
31
32
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umbraco-ui/uui-card-block-type",
3
- "version": "1.12.2",
3
+ "version": "1.13.0-rc.0",
4
4
  "license": "MIT",
5
5
  "keywords": [
6
6
  "Umbraco",
@@ -30,8 +30,8 @@
30
30
  "custom-elements.json"
31
31
  ],
32
32
  "dependencies": {
33
- "@umbraco-ui/uui-base": "1.12.2",
34
- "@umbraco-ui/uui-card": "1.12.2"
33
+ "@umbraco-ui/uui-base": "1.13.0-rc.0",
34
+ "@umbraco-ui/uui-card": "1.13.0-rc.0"
35
35
  },
36
36
  "scripts": {
37
37
  "build": "npm run analyze && tsc --build && rollup -c rollup.config.js",
@@ -42,5 +42,5 @@
42
42
  "access": "public"
43
43
  },
44
44
  "homepage": "https://uui.umbraco.com/?path=/story/uui-card-block-type",
45
- "gitHead": "207119ec53a655eeddfa1d626155490490336753"
45
+ "gitHead": "864afa6c182c2a73c479237732dadc1abc69a4a0"
46
46
  }