From 54d737cd437f94d51874d7a7a2ecd868362259ae Mon Sep 17 00:00:00 2001 From: Danny Gleckler Date: Wed, 25 Sep 2024 17:41:01 -0400 Subject: [PATCH 1/5] Add linear list item --- components/list/demo/demo-list-nested.js | 2 ++ components/list/demo/list-drag-and-drop.html | 8 ++++++++ components/list/list-item-content.js | 15 +++++++++++++++ components/list/list-item-generic-layout.js | 5 +++++ components/list/list-item-mixin.js | 13 +++++++++++++ 5 files changed, 43 insertions(+) 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` Add Button +

Linear Items

+ + + + + diff --git a/components/list/list-item-content.js b/components/list/list-item-content.js index 438dadb7d08..115eb432c1a 100644 --- a/components/list/list-item-content.js +++ b/components/list/list-item-content.js @@ -47,6 +47,21 @@ class ListItemContent extends LitElement { .d2l-list-item-content-text-supporting-info ::slotted(*) { margin-top: 0.15rem; } + + :host-context(d2l-list-item[linear]) .d2l-list-item-content-text { + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + } + + :host-context(d2l-list-item[linear]) .d2l-list-item-content-text * { + display: inline; + } + + :host-context(d2l-list-item[linear]) slot[name] { + display: none; + } + `]; } diff --git a/components/list/list-item-generic-layout.js b/components/list/list-item-generic-layout.js index 22ac38c009c..41325d53aaa 100644 --- a/components/list/list-item-generic-layout.js +++ b/components/list/list-item-generic-layout.js @@ -39,6 +39,11 @@ class ListItemGenericLayout extends RtlMixin(LitElement) { * @type {'content'|'control'} */ alignNested: { type: String, reflect: true, attribute: 'align-nested' }, + /** + * Specifies whether lineat mode is active or not + * @type {boolean} + */ + linear: { type: Boolean, attribute: 'linear' }, /** * Whether to constrain actions so they do not fill the item. Required if slotted content is interactive. * @type {boolean} diff --git a/components/list/list-item-mixin.js b/components/list/list-item-mixin.js index 55f981a97d8..c4d33ecc912 100644 --- a/components/list/list-item-mixin.js +++ b/components/list/list-item-mixin.js @@ -140,6 +140,19 @@ export const ListItemMixin = superclass => class extends composeMixins( bottom: -1px; } + :host([linear]) d2l-list-item-generic-layout > [slot] { + align-content: center; + padding-block: 0px; + } + + :host([linear]) [slot="content"] { + align-items: center; + } + + :host([linear]) [slot="content"] ::slotted([slot="illustration"]) { + max-height: 1.5rem; + } + :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, From dd32fe39d27f00c189c81ae13bab235eaf8645a4 Mon Sep 17 00:00:00 2001 From: Danny Gleckler Date: Wed, 25 Sep 2024 20:21:12 -0400 Subject: [PATCH 2/5] Replace host-context --- .../list/demo/list-drag-and-drop-position.js | 4 ++- components/list/demo/list-drag-and-drop.html | 10 ++++++- components/list/list-item-content.js | 29 ++++++++++--------- components/list/list-item-generic-layout.js | 5 ---- components/list/list-item-mixin.js | 16 +++++++++- 5 files changed, 42 insertions(+), 22 deletions(-) diff --git a/components/list/demo/list-drag-and-drop-position.js b/components/list/demo/list-drag-and-drop-position.js index 6b24852ac5e..c8e23fab54c 100644 --- a/components/list/demo/list-drag-and-drop-position.js +++ b/components/list/demo/list-drag-and-drop-position.js @@ -14,7 +14,8 @@ class ListDemoDragAndDropPosition extends LitElement { // below are for demonstration only grid: { type: Boolean }, hrefs: { type: Boolean }, - selectable: { type: Boolean } + selectable: { type: Boolean }, + linear: { type: Boolean } }; } @@ -77,6 +78,7 @@ class ListDemoDragAndDropPosition extends LitElement { ${repeat(this.list, (item) => item.key, (item) => html` Add Button -

Linear Items

+

Linear Grid

+ + + + + +

Linear Nested Grid