Skip to content
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
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased]
### Added
- #### List
- The `igc-list-item` component exposes a new `selected` property. When set on a list item, the item will become visually highlighted.

## [5.2.4] - 2025-02-24
### Changed
- #### Carousel - **Potential visual breaking change.**
Expand Down
8 changes: 8 additions & 0 deletions src/components/list/list-item.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { LitElement, html } from 'lit';

import { property } from 'lit/decorators.js';
import { themes } from '../../theming/theming-decorator.js';
import { registerComponent } from '../common/definitions/register.js';
import { styles } from './themes/item.base.css.js';
Expand Down Expand Up @@ -35,6 +36,13 @@ export default class IgcListItemComponent extends LitElement {
registerComponent(IgcListItemComponent);
}

/**
* Defines if the list item is selected or not.
* @attr
*/
@property({ type: Boolean, reflect: true })
public selected = false;

private _internals: ElementInternals;

constructor() {
Expand Down
24 changes: 23 additions & 1 deletion src/components/list/themes/shared/item/list-item.common.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ $theme: $material;
border-radius: var-get($theme, 'item-border-radius');
color: var-get($theme, 'item-text-color');
background: var-get($theme, 'item-background');
border-bottom: var-get($theme, 'border-width') solid var-get($theme, 'border-color');
border-bottom: var-get($theme, 'border-width') solid
var-get($theme, 'border-color');
}

:host(:last-of-type) {
Expand All @@ -30,6 +31,27 @@ $theme: $material;
color: var-get($theme, 'item-action-color');
}

:host([selected]) {
color: var-get($theme, 'item-text-color-selected');
background: var-get($theme, 'item-background-selected');

[part='title'] {
color: var-get($theme, 'item-title-color-selected');
}

[part='subtitle'] {
color: var-get($theme, 'item-subtitle-color-selected');
}

[part='start'] {
color: var-get($theme, 'item-thumbnail-color-selected');
}

[part='end'] {
color: var-get($theme, 'item-action-color-selected');
}
}

:host(:hover),
:host(:focus-within) {
background: var-get($theme, 'item-background-hover');
Expand Down
6 changes: 0 additions & 6 deletions stories/avatar.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import {
IgcAvatarComponent,
IgcIconComponent,
defineComponents,
registerIcon,
} from 'igniteui-webcomponents';
import { html } from 'lit';

Expand Down Expand Up @@ -63,11 +62,6 @@ interface IgcAvatarArgs {
}
type Story = StoryObj<IgcAvatarArgs>;

registerIcon(
'home',
'https://unpkg.com/material-design-icons@3.0.1/action/svg/production/ic_home_24px.svg'
);

// endregion

export const Image: Story = {
Expand Down