Skip to content

Commit ba7a966

Browse files
authored
fix(AnalyticalTable): fix inactive row hover styles, implement ObjectStatus deltas (#7781)
Fixes #7778
1 parent fa5577a commit ba7a966

File tree

3 files changed

+28
-6
lines changed

3 files changed

+28
-6
lines changed

packages/main/src/components/AnalyticalTable/AnalyticalTable.module.css

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -173,10 +173,6 @@
173173
box-sizing: border-box;
174174
display: flex;
175175

176-
&:hover:not([data-empty-row]) {
177-
background-color: var(--sapList_Hover_Background);
178-
}
179-
180176
&[data-is-selected] {
181177
border-block-end: 1px solid var(--sapList_SelectionBorderColor);
182178
background-color: var(--sapList_SelectionBackgroundColor);
@@ -187,8 +183,22 @@
187183
}
188184
}
189185

186+
/* ObjectStatus deltas */
187+
[data-sap-theme^='sap_'][data-sap-theme$='_hcw'],
188+
[data-sap-theme^='sap_'][data-sap-theme$='_hcb'] {
189+
.tr[data-is-selected],
190+
.trActive:hover {
191+
& [data-component-name='ObjectStatus'][data-inverted='false']:not([data-state^='Indication']) {
192+
color: var(--sapContent_ContrastTextColor);
193+
}
194+
}
195+
}
196+
190197
.trActive {
191198
cursor: pointer;
199+
&:hover:not([data-empty-row]) {
200+
background-color: var(--sapList_Hover_Background);
201+
}
192202
}
193203

194204
.tableGroupHeader.tr {

packages/main/src/components/AnalyticalTable/AnalyticalTable.stories.tsx

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,11 @@ import { Select } from '../../webComponents/Select/index.js';
3030
import { Tag } from '../../webComponents/Tag/index.js';
3131
import { Text } from '../../webComponents/Text/index.js';
3232
import { FlexBox } from '../FlexBox/index.js';
33-
import type { AnalyticalTableColumnDefinition } from './index.js';
33+
import { ObjectStatus } from '../ObjectStatus/index.js';
34+
import type { AnalyticalTableColumnDefinition, AnalyticalTablePropTypes } from './index.js';
3435
import { AnalyticalTable } from './index.js';
3536

36-
const kitchenSinkArgs = {
37+
const kitchenSinkArgs: AnalyticalTablePropTypes = {
3738
data: dataLarge,
3839
columns: [
3940
{
@@ -91,6 +92,14 @@ const kitchenSinkArgs = {
9192
);
9293
},
9394
},
95+
{
96+
Header: 'Status',
97+
id: 'os',
98+
Cell: (instance) => {
99+
const state = instance.row.index % 2 === 0 ? 'Positive' : 'Negative';
100+
return <ObjectStatus state={state}>{state}</ObjectStatus>;
101+
},
102+
},
94103
{
95104
id: 'actions',
96105
Header: 'Actions',

packages/main/src/components/ObjectStatus/index.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,9 @@ const ObjectStatus = forwardRef<HTMLDivElement | HTMLButtonElement, ObjectStatus
236236
role={interactive ? undefined : 'group'}
237237
aria-roledescription={roleDesc || undefined}
238238
{...rest}
239+
data-component-name="ObjectStatus"
240+
data-state={state}
241+
data-inverted={`${!!inverted}`}
239242
>
240243
{!interactive && (
241244
<span

0 commit comments

Comments
 (0)