Skip to content

Commit 0fc8dbc

Browse files
committed
fix(uui-box): add a getter to headlineVariant to support Lit 3
1 parent 6fbd27b commit 0fc8dbc

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

packages/uui-box/lib/uui-box.element.ts

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { defineElement } from '@umbraco-ui/uui-base/lib/registration';
33
import { property, state } from 'lit/decorators.js';
44
import { UUITextStyles } from '@umbraco-ui/uui-css/lib';
55
import type { UUIInterfaceHeading } from '@umbraco-ui/uui-base/lib';
6-
import { StaticValue, html, literal, unsafeStatic } from 'lit/static-html.js';
6+
import { html, unsafeStatic } from 'lit/static-html.js';
77

88
function slotHasContent(target: EventTarget | null): boolean {
99
return target
@@ -42,15 +42,14 @@ export class UUIBoxElement extends LitElement {
4242
*/
4343
@property({ attribute: 'headline-variant' })
4444
set headlineVariant(value: UUIInterfaceHeading) {
45-
if (!value) {
46-
this._headlineVariantTag = literal`h5`;
47-
} else {
48-
this._headlineVariantTag = unsafeStatic(value);
49-
}
45+
this._headlineVariantTag = value;
46+
}
47+
get headlineVariant() {
48+
return this._headlineVariantTag;
5049
}
5150

5251
@state()
53-
private _headlineVariantTag: StaticValue = literal`h5`;
52+
private _headlineVariantTag: UUIInterfaceHeading = 'h5';
5453

5554
@state()
5655
private _headlineSlotHasContent = false;
@@ -89,7 +88,7 @@ export class UUIBoxElement extends LitElement {
8988
? ''
9089
: 'display: none'
9190
}>
92-
<${this._headlineVariantTag}
91+
<${unsafeStatic(this._headlineVariantTag)}
9392
id="headline"
9493
class="uui-h5"
9594
style=${
@@ -99,7 +98,7 @@ export class UUIBoxElement extends LitElement {
9998
}>
10099
${this.headline}
101100
<slot name="headline" @slotchange=${this._headlineSlotChanged}></slot>
102-
</${this._headlineVariantTag}>
101+
</${unsafeStatic(this._headlineVariantTag)}>
103102
<slot name="header" @slotchange=${this._headerSlotChanged}></slot>
104103
<slot name="header-actions" @slotchange=${
105104
this._headerActionsSlotChanged

0 commit comments

Comments
 (0)