diff --git a/src/components/list-item/list-item.tsx b/src/components/list-item/list-item.tsx index 833bb523d81..c949b488dbd 100644 --- a/src/components/list-item/list-item.tsx +++ b/src/components/list-item/list-item.tsx @@ -175,6 +175,8 @@ export class ListItem implements InteractiveComponent, LoadableComponent { @State() hasActionsEnd = false; + @State() hasContent = false; + @State() hasContentStart = false; @State() hasContentEnd = false; @@ -321,6 +323,15 @@ export class ListItem implements InteractiveComponent, LoadableComponent { ); } + renderContent(): VNode { + const { hasContent } = this; + return ( + + ); + } + renderContentEnd(): VNode { const { hasContentEnd } = this; return ( @@ -330,10 +341,10 @@ export class ListItem implements InteractiveComponent, LoadableComponent { ); } - renderContent(): VNode { - const { label, description } = this; + renderContentProperties(): VNode { + const { label, description, hasContent } = this; - return !!label || !!description ? ( + return !hasContent && (!!label || !!description) ? (
{label ? (
@@ -350,9 +361,14 @@ export class ListItem implements InteractiveComponent, LoadableComponent { } renderContentContainer(): VNode { - const { description, label, selectionMode } = this; - const hasCenterContent = !!label || !!description; - const content = [this.renderContentStart(), this.renderContent(), this.renderContentEnd()]; + const { description, label, selectionMode, hasContent } = this; + const hasCenterContent = hasContent || !!label || !!description; + const content = [ + this.renderContentStart(), + this.renderContent(), + this.renderContentProperties(), + this.renderContentEnd() + ]; return ( { + this.hasContent = slotChangeHasAssignedElement(event); + }; + handleActionsStartSlotChange = (event: Event): void => { this.hasActionsStart = slotChangeHasAssignedElement(event); }; diff --git a/src/components/list-item/resources.ts b/src/components/list-item/resources.ts index c7a00dc5646..46f80db6ada 100644 --- a/src/components/list-item/resources.ts +++ b/src/components/list-item/resources.ts @@ -21,6 +21,7 @@ export const CSS = { export const SLOTS = { actionsStart: "actions-start", contentStart: "content-start", + content: "content", contentEnd: "content-end", actionsEnd: "actions-end" };