Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(list): closed list-items no longer render extra space #9031

Merged
merged 1 commit into from
Apr 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@
--calcite-list-item-spacing-indent: theme("spacing.4");
}

:host([filter-hidden]) {
@apply hidden;
}

@include disabled();

.container {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -653,6 +653,7 @@ export class ListItem
selectionMode,
closed,
visualLevel,
filterHidden,
} = this;

const showBorder = selectionMode !== "none" && selectionAppearance === "border";
Expand All @@ -676,7 +677,7 @@ export class ListItem
[CSS.containerBorderSelected]: borderSelected,
[CSS.containerBorderUnselected]: borderUnselected,
}}
hidden={closed}
hidden={closed || filterHidden}
onFocus={this.focusCellNull}
onFocusin={this.emitInternalListItemActive}
onKeyDown={this.handleItemKeyDown}
Expand Down
2 changes: 1 addition & 1 deletion packages/calcite-components/src/components/list/list.scss
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
--calcite-stack-padding-block: 0;
}

::slotted(calcite-list-item) {
::slotted(calcite-list-item:not([filter-hidden], [closed])) {
@apply shadow-border-top;
margin-block-start: 1px;
}
Expand Down
64 changes: 64 additions & 0 deletions packages/calcite-components/src/components/list/list.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -954,3 +954,67 @@ export const nestingLists_TestOnly = (): string => html`<h4>Nesting List Items</
</calcite-list>
</calcite-list-item>
</calcite-list>`;

export const closedItems_TestOnly = (): string =>
html` <calcite-list>
<calcite-list-item
closable
label="Hiking trails"
description="Designated routes for hikers to use."
value="hiking-trails"
>
</calcite-list-item>
<calcite-list-item closed closable label="Waterfalls" description="Vertical drops from a river." value="waterfalls">
</calcite-list-item>
<calcite-list-item
closed
closable
label="Rivers"
description="Large naturally flowing watercourses."
value="rivers"
>
</calcite-list-item>
<calcite-list-item
closed
closable
label="Hiking trails"
description="Designated routes for hikers to use."
value="hiking-trails"
>
</calcite-list-item>
<calcite-list-item closed closable label="Waterfalls" description="Vertical drops from a river." value="waterfalls">
</calcite-list-item>
<calcite-list-item
closed
closable
label="Rivers"
description="Large naturally flowing watercourses."
value="rivers"
>
</calcite-list-item>
<calcite-list-item
closed
closable
label="Hiking trails"
description="Designated routes for hikers to use."
value="hiking-trails"
>
</calcite-list-item>
<calcite-list-item closed closable label="Waterfalls" description="Vertical drops from a river." value="waterfalls">
</calcite-list-item>
<calcite-list-item
closed
closable
label="Rivers"
description="Large naturally flowing watercourses."
value="rivers"
>
</calcite-list-item>
<calcite-list-item
closable
label="Hiking trails"
description="Designated routes for hikers to use."
value="hiking-trails"
>
</calcite-list-item>
</calcite-list>`;
Loading