diff --git a/components/icons/images/tier1/arrow-expand-small.svg b/components/icons/images/tier1/arrow-expand-small.svg index b28ba0790a2..29fee66feb4 100644 --- a/components/icons/images/tier1/arrow-expand-small.svg +++ b/components/icons/images/tier1/arrow-expand-small.svg @@ -1,3 +1,3 @@ - + diff --git a/components/list/demo/demo-list-nested.js b/components/list/demo/demo-list-nested.js index 46d51949638..021c068cd93 100644 --- a/components/list/demo/demo-list-nested.js +++ b/components/list/demo/demo-list-nested.js @@ -32,6 +32,7 @@ class ListDemoNested extends LitElement { showLoadMore: { type: Boolean, attribute: 'show-load-more' }, noPrimaryAction: { type: Boolean, attribute: 'no-primary-action' }, disableListGrid: { type: Boolean, attribute: 'disable-list-grid' }, + linear: { type: Boolean }, _items: { state: true }, _loadedItems: { state: true }, _remainingItemCount: { state: true }, @@ -201,6 +202,7 @@ class ListDemoNested extends LitElement { const hasChildren = item?.items?.length > 0; return html` item.key, (item) => html` Add Button +

Linear Grid

+ + + + + +

Linear Nested Grid

+ + + + + diff --git a/components/list/list-item-content.js b/components/list/list-item-content.js index 438dadb7d08..f65b9f7c302 100644 --- a/components/list/list-item-content.js +++ b/components/list/list-item-content.js @@ -10,6 +10,15 @@ import { css, html, LitElement } from 'lit'; */ class ListItemContent extends LitElement { + static get properties() { + return { + /** + * @ignore + */ + linear: { type: Boolean, reflect: true } + }; + } + static get styles() { return [ bodySmallStyles, bodyCompactStyles, css` :host { @@ -20,6 +29,13 @@ class ListItemContent extends LitElement { margin: 0; } + :host([linear]) .d2l-list-item-content-text > div, + :host([linear]) .d2l-list-item-content-text ::slotted(*) { + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + } + .d2l-list-item-content-text > div { border-radius: var(--d2l-list-item-content-text-border-radius); color: var(--d2l-list-item-content-text-color); @@ -47,14 +63,17 @@ class ListItemContent extends LitElement { .d2l-list-item-content-text-supporting-info ::slotted(*) { margin-top: 0.15rem; } + `]; } render() { return html`
+ ${this.linear ? null : html`
+ `} `; } diff --git a/components/list/list-item-mixin.js b/components/list/list-item-mixin.js index 55f981a97d8..d2b954318c6 100644 --- a/components/list/list-item-mixin.js +++ b/components/list/list-item-mixin.js @@ -69,6 +69,11 @@ export const ListItemMixin = superclass => class extends composeMixins( * @type {boolean} */ dragTargetHandleOnly: { type: Boolean, attribute: 'drag-target-handle-only' }, + /** + * Whether to display the list item on a single line + * @type {boolean} + */ + linear: { type: Boolean, attribute: 'linear' }, /** * Whether to disable rendering the entire item as the primary action. Required if slotted content is interactive. * @type {boolean} @@ -140,6 +145,24 @@ export const ListItemMixin = superclass => class extends composeMixins( bottom: -1px; } + :host([linear]) d2l-list-item-generic-layout > [slot="content"] { + height: 2.6rem; + } + + :host([linear]) d2l-list-item-generic-layout > [slot] { + align-content: center; + padding-block: 0; + } + + :host([linear]) [slot="content"] { + align-items: center; + } + + :host([linear]) [slot="content"] ::slotted([slot="illustration"]) { + max-height: calc(100% - 0.5rem); + overflow: hidden; + } + :host(:first-of-type[_separators="between"]) [slot="control-container"]::before, :host(:last-of-type[_separators="between"]) [slot="control-container"]::after, :host([_separators="none"]) [slot="control-container"]::before, @@ -467,6 +490,10 @@ export const ListItemMixin = superclass => class extends composeMixins( if (changedProperties.has('_siblingHasColor') || changedProperties.has('color')) { this._hasColorSlot = this.color || this._siblingHasColor; } + if (changedProperties.has('linear')) { + const content = this.querySelector('d2l-list-item-content'); + if (content) content.linear = this.linear; + } } focus() {