diff --git a/.storybook/preview-head.html b/.storybook/preview-head.html
index 09b2e63435b..56dd2cec306 100644
--- a/.storybook/preview-head.html
+++ b/.storybook/preview-head.html
@@ -176,6 +176,14 @@
padding-block: 0;
}
+ /*ObjectStatus "InListOrTable" story */
+ .interactive-table-row:active .object-status,
+ .interactive-li[active] .object-status {
+ --ui5wcr-object-status-icon-color: var(--sapList_Active_TextColor);
+ color: var(--sapList_Active_TextColor);
+ text-shadow: none;
+ }
+
/* TODO remove this workaround as soon as https://github.com/storybookjs/storybook/issues/20497 is fixed */
.docs-story > div > div[scale] {
min-height: 20px;
diff --git a/packages/main/src/components/AnalyticalTable/AnalyticalTable.module.css b/packages/main/src/components/AnalyticalTable/AnalyticalTable.module.css
index 2e2c3e3717b..ff57acc5790 100644
--- a/packages/main/src/components/AnalyticalTable/AnalyticalTable.module.css
+++ b/packages/main/src/components/AnalyticalTable/AnalyticalTable.module.css
@@ -182,10 +182,17 @@
.tr[data-is-selected],
.trActive:hover {
& [data-component-name='ObjectStatus'][data-inverted='false']:not([data-state^='Indication']) {
+ --ui5wcr-object-status-icon-color: var(--sapContent_ContrastTextColor);
color: var(--sapContent_ContrastTextColor);
+ text-shadow: none;
}
}
}
+.trActive:active [data-component-name='ObjectStatus'][data-inverted='false'] {
+ --ui5wcr-object-status-icon-color: var(--sapList_Active_TextColor);
+ color: var(--sapList_Active_TextColor);
+ text-shadow: none;
+}
.trActive {
cursor: pointer;
diff --git a/packages/main/src/components/ObjectStatus/ObjectStatus.cy.tsx b/packages/main/src/components/ObjectStatus/ObjectStatus.cy.tsx
index b2ea5209f82..1958375e24e 100644
--- a/packages/main/src/components/ObjectStatus/ObjectStatus.cy.tsx
+++ b/packages/main/src/components/ObjectStatus/ObjectStatus.cy.tsx
@@ -8,7 +8,16 @@ import ValueState from '@ui5/webcomponents-base/dist/types/ValueState.js';
import { ThemingParameters } from '@ui5/webcomponents-react-base';
import type { IndicationColor } from '../../enums/index.js';
import { INDICATION_COLOR } from '../../i18n/i18n-defaults.js';
-import { Icon } from '../../webComponents/index.js';
+import { Icon } from '../../webComponents/Icon/index.js';
+import { List } from '../../webComponents/List/index.js';
+import { ListItemCustom } from '../../webComponents/ListItemCustom/index.js';
+import { Table } from '../../webComponents/Table/index.js';
+import { TableCell } from '../../webComponents/TableCell/index.js';
+import { TableHeaderCell } from '../../webComponents/TableHeaderCell/index.js';
+import { TableHeaderRow } from '../../webComponents/TableHeaderRow/index.js';
+import { TableRow } from '../../webComponents/TableRow/index.js';
+import { TableSelectionSingle } from '../../webComponents/TableSelectionSingle/index.js';
+import { AnalyticalTable } from '../AnalyticalTable/index.js';
import { ObjectStatus } from './index.js';
import { cssVarToRgb, cypressPassThroughTestsFactory } from '@/cypress/support/utils';
@@ -324,5 +333,97 @@ describe('ObjectStatus', () => {
cy.get('[ui5-icon]').should('have.css', 'height', '24px');
});
+ it('active state in interactive lists and tables', () => {
+ cy.document().then((doc) => {
+ const style = doc.createElement('style');
+ style.textContent = `
+ .interactive-table-row:active .object-status,
+ .interactive-li[active] .object-status {
+ --ui5wcr-object-status-icon-color: var(--sapList_Active_TextColor);
+ color: var(--sapList_Active_TextColor);
+ text-shadow: none;
+ }
+ `;
+ doc.head.appendChild(style);
+ });
+
+ const activeTextColor = cssVarToRgb(ThemingParameters.sapList_Active_TextColor);
+ const atData = [{ os1: 'ObjectStatus', os2: 'ObjectStatus' }];
+ const args = { state: ValueState.Positive, inverted: false, showDefaultIcon: true, children: 'ObjectStatus' };
+ const atCols = [
+ {
+ accessor: 'os1',
+ Header: 'ObjectStatus (controllable)',
+ Cell: () => ,
+ },
+ {
+ accessor: 'os2',
+ Header: 'ObjectStatus ("Negative")',
+ Cell: () => ,
+ },
+ ];
+
+ cy.mount(
+ <>
+
+ ObjectStatus (controllable)
+ ObjectStatus ("Negative")
+
+ }
+ features={}
+ >
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ >,
+ );
+
+ cy.get('.interactive-table-row').realMouseDown();
+ cy.findByTestId('os-table').should('have.css', 'color', activeTextColor);
+ cy.findByTestId('os-table')
+ .find('[data-component-name="ObjectStatusDefaultIcon"]')
+ .should('have.css', 'color', activeTextColor);
+ cy.get('.interactive-table-row').realMouseUp();
+
+ cy.get('.interactive-li').realMouseDown();
+ cy.findByTestId('os-list').should('have.css', 'color', activeTextColor);
+ cy.findByTestId('os-list')
+ .find('[data-component-name="ObjectStatusDefaultIcon"]')
+ .should('have.css', 'color', activeTextColor);
+ cy.get('.interactive-li').realMouseUp();
+
+ cy.get('[data-testid="at"] [role="row"]')
+ .eq(1)
+ .realMouseDown({ position: { x: 100, y: 10 } }); // don't click in the middle as there's the resizer
+ cy.findByTestId('os-at').should('have.css', 'color', activeTextColor);
+ cy.findByTestId('os-at')
+ .find('[data-component-name="ObjectStatusDefaultIcon"]')
+ .should('have.css', 'color', activeTextColor);
+ cy.get('[data-testid="at"] [role="row"]')
+ .eq(1)
+ .realMouseUp({ position: { x: 100, y: 10 } });
+ });
+
cypressPassThroughTestsFactory(ObjectStatus);
});
diff --git a/packages/main/src/components/ObjectStatus/ObjectStatus.mdx b/packages/main/src/components/ObjectStatus/ObjectStatus.mdx
index 458340c7d96..e6af34ba77e 100644
--- a/packages/main/src/components/ObjectStatus/ObjectStatus.mdx
+++ b/packages/main/src/components/ObjectStatus/ObjectStatus.mdx
@@ -22,22 +22,116 @@ import * as ComponentStories from './ObjectStatus.stories';
-## ObjectStatus with default icons
+## ObjectStatus With Default Icons
-## ObjectStatus with custom Icon
+## ObjectStatus With Custom Icon
-## ObjectStatus with Icon only
+## ObjectStatus With Icon Only
-## All ObjectStatus states
+## All ObjectStatus States
**Note:** Only the `inverted` `ObjectStatus` supports `IndicationColor`s 11-20. For non-inverted `ObjectStatus`, these colors default to the `"None"` `state` color and should **not** be used.
+## ObjectStatus in Interactive Lists or Tables
+
+**Applicable since v2.17.0**
+
+The `AnalyticalTable` component includes active state styling for `ObjectStatus` out of the box, as it is developed within project and can be styled accordingly.
+For lists or tables from `@ui5/webcomponents(-fiori/-ai/-compat)` (e.g., `List`, `Table`), custom CSS is required to override the text and icon `color` and `text-shadow` to ensure proper styling when rows are in active state:
+
+```css
+.object-status {
+ --ui5wcr-object-status-icon-color: var(--sapList_Active_TextColor);
+ color: var(--sapList_Active_TextColor);
+ text-shadow: none;
+}
+```
+
+
+
+
+
+ Show Static Code
+
+ ```css
+ .interactive-table-row:active .object-status,
+ .interactive-li[active] .object-status {
+ --ui5wcr-object-status-icon-color: var(--sapList_Active_TextColor);
+ color: var(--sapList_Active_TextColor);
+ text-shadow: none;
+ }
+ ```
+
+ ```tsx
+ function ObjectStatusInListOrTable(objectStatusProps: Omit) {
+ const atCols: AnalyticalTableColumnDefinition[] = useMemo(
+ () => [
+ {
+ accessor: 'os1',
+ Header: 'ObjectStatus (controllable)',
+ Cell: () => ,
+ },
+ {
+ accessor: 'os2',
+ Header: 'ObjectStatus ("Negative")',
+ Cell: () => ,
+ },
+ ],
+ [objectStatusProps],
+ );
+ return (
+ <>
+ Table
+
+ ObjectStatus (controllable)
+ ObjectStatus ("Negative")
+
+ }
+ features={}
+ >
+
+
+
+
+
+
+
+
+
+
+ List
+
+
+
+
+
+
+ AnalyticalTable
+
+ >
+ );
+ }
+ ```
+
+
+
+
+
+
diff --git a/packages/main/src/components/ObjectStatus/ObjectStatus.module.css b/packages/main/src/components/ObjectStatus/ObjectStatus.module.css
index 9623912ea50..291b7f09076 100644
--- a/packages/main/src/components/ObjectStatus/ObjectStatus.module.css
+++ b/packages/main/src/components/ObjectStatus/ObjectStatus.module.css
@@ -3,6 +3,7 @@
}
.objectStatus {
+ --ui5wcr-object-status-icon-color: var(--sapNeutralElementColor);
--_ui5wcr-ObjectStatus-focs-outline: 0.125rem var(--sapContent_FocusColor);
--_ui5wcr-ObjectStatus-focs-background: var(--sapContent_FocusColor);
@@ -18,7 +19,7 @@
color: var(--sapNeutralTextColor);
[ui5-icon] {
- color: var(--sapNeutralElementColor);
+ color: var(--ui5wcr-object-status-icon-color);
}
}
@@ -38,7 +39,6 @@
line-height: 1rem;
vertical-align: top;
padding-inline-end: 0.25rem;
- text-shadow: var(--sapContent_TextShadow);
&[data-icon-only='true'] {
padding-inline-end: 0;
@@ -66,115 +66,73 @@
}
.positive {
+ --ui5wcr-object-status-icon-color: var(--sapPositiveElementColor);
color: var(--sapPositiveTextColor);
-
- [ui5-icon] {
- color: var(--sapPositiveElementColor);
- }
}
.critical {
+ --ui5wcr-object-status-icon-color: var(--sapCriticalElementColor);
color: var(--sapCriticalTextColor);
-
- [ui5-icon] {
- color: var(--sapCriticalElementColor);
- }
}
.negative {
+ --ui5wcr-object-status-icon-color: var(--sapNegativeElementColor);
color: var(--sapNegativeTextColor);
-
- [ui5-icon] {
- color: var(--sapNegativeElementColor);
- }
}
.information {
+ --ui5wcr-object-status-icon-color: var(--sapInformativeElementColor);
color: var(--sapInformativeTextColor);
-
- [ui5-icon] {
- color: var(--sapInformativeElementColor);
- }
}
.indication01 {
+ --ui5wcr-object-status-icon-color: var(--sapIndicationColor_1);
color: var(--sapIndicationColor_1);
-
- [ui5-icon] {
- color: var(--sapIndicationColor_1);
- }
}
.indication02 {
+ --ui5wcr-object-status-icon-color: var(--sapIndicationColor_2);
color: var(--sapIndicationColor_2);
-
- [ui5-icon] {
- color: var(--sapIndicationColor_2);
- }
}
.indication03 {
+ --ui5wcr-object-status-icon-color: var(--sapIndicationColor_3);
color: var(--sapIndicationColor_3);
-
- [ui5-icon] {
- color: var(--sapIndicationColor_3);
- }
}
.indication04 {
+ --ui5wcr-object-status-icon-color: var(--sapIndicationColor_4);
color: var(--sapIndicationColor_4);
-
- [ui5-icon] {
- color: var(--sapIndicationColor_4);
- }
}
.indication05 {
+ --ui5wcr-object-status-icon-color: var(--sapIndicationColor_5);
color: var(--sapIndicationColor_5);
-
- [ui5-icon] {
- color: var(--sapIndicationColor_5);
- }
}
.indication06 {
+ --ui5wcr-object-status-icon-color: var(--sapIndicationColor_6);
color: var(--sapIndicationColor_6);
-
- [ui5-icon] {
- color: var(--sapIndicationColor_6);
- }
}
.indication07 {
+ --ui5wcr-object-status-icon-color: var(--sapIndicationColor_7);
color: var(--sapIndicationColor_7);
-
- [ui5-icon] {
- color: var(--sapIndicationColor_7);
- }
}
.indication08 {
+ --ui5wcr-object-status-icon-color: var(--sapIndicationColor_8);
color: var(--sapIndicationColor_8);
-
- [ui5-icon] {
- color: var(--sapIndicationColor_8);
- }
}
.indication09 {
+ --ui5wcr-object-status-icon-color: var(--sapIndicationColor_9);
color: var(--sapIndicationColor_9);
-
- [ui5-icon] {
- color: var(--sapIndicationColor_9);
- }
}
.indication10 {
+ --ui5wcr-object-status-icon-color: var(--sapIndicationColor_10);
color: var(--sapIndicationColor_10);
-
- [ui5-icon] {
- color: var(--sapIndicationColor_10);
- }
}
.active {
diff --git a/packages/main/src/components/ObjectStatus/ObjectStatus.stories.tsx b/packages/main/src/components/ObjectStatus/ObjectStatus.stories.tsx
index c5c9f7b6b73..52f0392ab3d 100644
--- a/packages/main/src/components/ObjectStatus/ObjectStatus.stories.tsx
+++ b/packages/main/src/components/ObjectStatus/ObjectStatus.stories.tsx
@@ -3,10 +3,21 @@ import IconMode from '@ui5/webcomponents/dist/types/IconMode.js';
import ValueState from '@ui5/webcomponents-base/dist/types/ValueState.js';
import cancelIcon from '@ui5/webcomponents-icons/dist/sys-cancel.js';
import { ThemingParameters } from '@ui5/webcomponents-react-base';
+import { useMemo } from 'react';
import { IndicationColor } from '../../enums/IndicationColor.js';
import { Icon } from '../../webComponents/Icon/index.js';
import { Label } from '../../webComponents/Label/index.js';
+import { List } from '../../webComponents/List/index.js';
+import { ListItemCustom } from '../../webComponents/ListItemCustom/index.js';
+import { Table } from '../../webComponents/Table/index.js';
+import { TableCell } from '../../webComponents/TableCell/index.js';
+import { TableHeaderCell } from '../../webComponents/TableHeaderCell/index.js';
+import { TableHeaderRow } from '../../webComponents/TableHeaderRow/index.js';
+import { TableRow } from '../../webComponents/TableRow/index.js';
+import { TableSelectionSingle } from '../../webComponents/TableSelectionSingle/index.js';
import { Text } from '../../webComponents/Text/index.js';
+import type { AnalyticalTableColumnDefinition } from '../AnalyticalTable/index.js';
+import { AnalyticalTable } from '../AnalyticalTable/index.js';
import type { ObjectStatusPropTypes } from './index.js';
import { ObjectStatus } from './index.js';
@@ -135,3 +146,66 @@ export const InvertedObjectStatus: Story = {
);
},
};
+
+const atData = [{ os1: 'ObjectStatus', os2: 'ObjectStatus' }];
+
+export const InListOrTable: Story = {
+ args: { state: 'Positive', inverted: false },
+ argTypes: { inverted: { control: false, table: { disable: false } } },
+ render(args) {
+ const atCols: AnalyticalTableColumnDefinition[] = useMemo(
+ () => [
+ {
+ accessor: 'os1',
+ Header: 'ObjectStatus (controllable)',
+ Cell: () => ,
+ },
+ {
+ accessor: 'os2',
+ Header: 'ObjectStatus ("Negative")',
+ Cell: () => ,
+ },
+ ],
+ [args],
+ );
+ return (
+ <>
+ Table
+
+ ObjectStatus (controllable)
+ ObjectStatus ("Negative")
+
+ }
+ features={}
+ >
+
+
+
+
+
+
+
+
+
+
+ List
+
+
+
+
+
+
+ AnalyticalTable
+
+ >
+ );
+ },
+};
diff --git a/packages/main/src/components/ObjectStatus/index.tsx b/packages/main/src/components/ObjectStatus/index.tsx
index 2653b2f27ba..4e039b1ce79 100644
--- a/packages/main/src/components/ObjectStatus/index.tsx
+++ b/packages/main/src/components/ObjectStatus/index.tsx
@@ -161,6 +161,8 @@ const getStateSpecifics = (state, showDefaultIcon, userIcon, stateAnnouncementTe
/**
* Status information that can be either text with a value state, or an icon.
+ *
+ * __Note:__ When used in interactive lists or tables, consider overriding the active state styling. Learn more [here](https://ui5.github.io/webcomponents-react/v2/?path=/docs/data-display-objectstatus--docs#objectstatus-in-interactive-lists-or-tables).
*/
const ObjectStatus = forwardRef((props, ref) => {
const {