Skip to content

Commit c749f1f

Browse files
fix(list): focus styles (#15718)
* fix(list): focus styles * refactor(list-sample): add panning option --------- Co-authored-by: Simeon Simeonoff <[email protected]>
1 parent 7993b5d commit c749f1f

File tree

4 files changed

+59
-8
lines changed

4 files changed

+59
-8
lines changed

projects/igniteui-angular/src/lib/core/styles/components/list/_list-theme.scss

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,6 @@
425425
justify-content: center;
426426
border-radius: var-get($theme, 'item-border-radius');
427427
color: var-get($theme, 'item-text-color');
428-
background: var-get($theme, 'item-background');
429428

430429
@if $bootstrap-theme or $variant == 'fluent' {
431430
border-bottom: var-get($theme, 'border-width') solid var-get($theme, 'border-color');
@@ -436,9 +435,6 @@
436435
}
437436

438437
&:hover {
439-
color: var-get($theme, 'item-text-color-hover');
440-
background: var-get($theme, 'item-background-hover');
441-
442438
%igx-list__item-lines {
443439
color: currentColor;
444440
}
@@ -544,9 +540,15 @@
544540
align-items: center;
545541
position: relative;
546542
border-radius: var-get($theme, 'item-border-radius');
547-
background: inherit;
543+
background: var-get($theme, 'item-background');
548544
z-index: 2;
549545
gap: if($variant == 'indigo', rem(8px), rem(16px));
546+
547+
&:hover,
548+
&:focus-within {
549+
color: var-get($theme, 'item-text-color-hover');
550+
background: var-get($theme, 'item-background-hover');
551+
}
550552
}
551553

552554
%igx-list-header,

src/app/list/list.sample.html

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,17 @@
22
<section class="sample-content" [igSize]="properties.size">
33
<article class="sample-column">
44
<h5 class="sample-title">Angular List</h5>
5-
<igx-list>
5+
<igx-list [allowLeftPanning]="properties.enablePanning" [allowRightPanning]="properties.enablePanning">
6+
<ng-template igxListItemLeftPanning>
7+
<div class="pan pan--left">
8+
<igx-icon>delete</igx-icon>Delete
9+
</div>
10+
</ng-template>
11+
<ng-template igxListItemRightPanning>
12+
<div class="pan pan--right">
13+
<igx-icon>call</igx-icon>Dial
14+
</div>
15+
</ng-template>
616
<igx-list-item [isHeader]="true" selected>Employees List</igx-list-item>
717
@for (employee of employeeItems; track employee) {
818
<igx-list-item [selected]="employee.selected">

src/app/list/list.sample.scss

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,21 @@
11
.sample-title {
22
text-align: center;
33
}
4+
5+
.pan {
6+
display: flex;
7+
color: white;
8+
width: 100%;
9+
padding-left: 10px;
10+
align-items: center;
11+
}
12+
13+
.pan--left {
14+
flex-direction: row-reverse;
15+
background-color:orange;
16+
}
17+
18+
.pan--right {
19+
flex-direction: row;
20+
background-color:limegreen;
21+
}

src/app/list/list.sample.ts

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ import {
3030
PropertyChangeService,
3131
PropertyPanelConfig,
3232
} from '../properties-panel/property-change.service';
33+
import { HAMMER_GESTURE_CONFIG, HammerModule } from '@angular/platform-browser';
34+
import Hammer from 'hammerjs';
3335

3436
defineComponents(
3537
IgcListComponent,
@@ -79,15 +81,27 @@ interface Employee {
7981
IgxAvatarComponent,
8082
IgxButtonModule,
8183
IgxButtonDirective,
82-
IgSizeDirective
84+
IgSizeDirective,
85+
HammerModule
86+
],
87+
providers: [
88+
{
89+
provide: HAMMER_GESTURE_CONFIG,
90+
useClass: class {
91+
public overrides = {
92+
pan: { direction: Hammer.DIRECTION_HORIZONTAL }
93+
}
94+
}
95+
}
8396
]
8497
})
8598
export class ListSampleComponent {
8699
public panelConfig: PropertyPanelConfig = {
87100
size: {
88101
control: {
89102
type: 'button-group',
90-
options: ['small', 'medium', 'large']
103+
options: ['small', 'medium', 'large'],
104+
defaultValue: 'medium'
91105
}
92106
},
93107
hideTitle: {
@@ -145,6 +159,13 @@ export class ListSampleComponent {
145159
type: 'boolean',
146160
defaultValue: false
147161
}
162+
},
163+
enablePanning: {
164+
label: 'Item Panning',
165+
control: {
166+
type: 'boolean',
167+
defaultValue: false
168+
}
148169
}
149170
}
150171

0 commit comments

Comments
 (0)