Skip to content

Commit 81f4200

Browse files
authored
docs(AnalyticalCard): mark component as deprecated (#4860)
1 parent f7a5dcf commit 81f4200

File tree

5 files changed

+103
-4
lines changed

5 files changed

+103
-4
lines changed

packages/main/src/components/AnalyticalCard/AnalyticalCard.mdx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,26 @@ import { Canvas, Description, Markdown, Meta } from '@storybook/blocks';
44
import '@ui5/webcomponents-icons/dist/person-placeholder.js';
55
import { AnalyticalCardHeader } from '../AnalyticalCardHeader';
66
import { NumericSideIndicator } from '../NumericSideIndicator';
7+
import { MessageStrip } from '../../webComponents/MessageStrip/index';
8+
import { MessageStripDesign } from '../../enums/MessageStripDesign';
79
import * as ComponentStories from './AnalyticalCard.stories';
810

911
<Meta of={ComponentStories} subcomponents={{ AnalyticalCardHeader, NumericSideIndicator }} />
1012

1113
<DocsHeader />
1214

15+
<MessageStrip
16+
design={MessageStripDesign.Warning}
17+
children={
18+
<>
19+
This component is deprecated and will be removed with our next major release (v2.0.0)! Please use the
20+
<ui5-link href={'https://sap.github.io/ui5-webcomponents-react/?path=/docs/data-display-card'}>
21+
Card
22+
</ui5-link> instead.
23+
</>
24+
}
25+
/>
26+
1327
**Note:** The `AnalyticalCard` was mainly made to display KPIs and complex data. If you want to implement a simple card, the `Card` component probably is more suitable.
1428

1529
<br />

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

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
'use client';
22

3-
import { useStylesheet } from '@ui5/webcomponents-react-base';
3+
import { deprecationNotice, useStylesheet } from '@ui5/webcomponents-react-base';
44
import type { ReactNode } from 'react';
5-
import React, { forwardRef } from 'react';
5+
import React, { forwardRef, useEffect } from 'react';
66
import type { CommonProps } from '../../interfaces/index.js';
77
import type { CardDomRef } from '../../webComponents/index.js';
88
import { Card } from '../../webComponents/index.js';
@@ -21,12 +21,21 @@ export interface AnalyticalCardPropTypes extends CommonProps {
2121

2222
/**
2323
* The `AnalyticalCard` is mainly used for data visualization. It consists of two areas – a header area and a chart area with a visual representation of the data.<br />
24+
*
25+
* @deprecated This component is deprecated and will be removed with our next major release (v2.0.0)! Please use the [Card](https://sap.github.io/ui5-webcomponents-react/?path=/docs/data-display-card) instead.
2426
*/
2527
const AnalyticalCard = forwardRef<CardDomRef, AnalyticalCardPropTypes>((props, ref) => {
2628
const { children, header, ...rest } = props;
2729

2830
useStylesheet(styleData, AnalyticalCard.displayName);
2931

32+
useEffect(() => {
33+
deprecationNotice(
34+
'AnalyticalCard',
35+
'This component is deprecated and will be removed with our next major release (v2.0.0)! Please use the Card component instead.'
36+
);
37+
}, []);
38+
3039
return (
3140
<Card ref={ref} {...rest}>
3241
{header}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,9 @@ const deviationMap = new Map<AnalyticalCardHeaderPropTypes['trend'], any>([
9191
]);
9292

9393
/**
94-
* The `AnalyticalCardHeader` component serves as layout for the header prop of the `AnalyticalCard`.
94+
* The `AnalyticalCardHeader` is a KPI header, enabling the AnalyticalCard representation. If this header is used, the `Card` should only receive a chart as content and no footer area.
9595
*
96-
* It should only be used as header for the `AnalyticalCard` component.
96+
* __Note:__ This component should only be used as header for the `Card` component.
9797
*/
9898
export const AnalyticalCardHeader = forwardRef<HTMLDivElement, AnalyticalCardHeaderPropTypes>((props, ref) => {
9999
const {

packages/main/src/webComponents/Card/Card.mdx

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { CardHeader } from '../CardHeader';
55
import CardHeaderDescription from '../CardHeader/CardHeaderDescription.md?raw';
66
import * as ComponentStories from './Card.stories';
77
import CardDescription from './CardDescription.md?raw';
8+
import { AnalyticalCardHeader } from '../../components/AnalyticalCardHeader/index';
89

910
<Meta of={ComponentStories} />
1011

@@ -22,6 +23,14 @@ import CardDescription from './CardDescription.md?raw';
2223

2324
<Markdown>{CardDescription}</Markdown>
2425

26+
## More Examples
27+
28+
### Card with AnalyticalCardHeader
29+
30+
**Note:** The `AnalyticalCardHeader` is a pure React component developed exclusively in the ui5-webcomponents-react repo.
31+
32+
<ControlsWithNote of={ComponentStories.WithAnalyticalCardHeader} />
33+
2534
<Markdown>{SubcomponentsSection}</Markdown>
2635

2736
## CardHeader
@@ -30,4 +39,12 @@ import CardDescription from './CardDescription.md?raw';
3039
<ArgTypesWithNote of={CardHeader} />
3140
<Markdown>{CardHeaderDescription}</Markdown>
3241

42+
## AnalyticalCardHeader
43+
44+
<Description of={AnalyticalCardHeader} />
45+
46+
**Note:** The `AnalyticalCardHeader` is a pure React component developed exclusively in the ui5-webcomponents-react repo.
47+
48+
<ArgTypesWithNote of={AnalyticalCardHeader} />
49+
3350
<Footer />

packages/main/src/webComponents/Card/Card.stories.tsx

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
import type { Meta, StoryObj } from '@storybook/react';
22
import personIcon from '@ui5/webcomponents-icons/dist/person-placeholder.js';
3+
import { LineChart } from '@ui5/webcomponents-react-charts';
4+
import { AnalyticalCardHeader } from '../../components/AnalyticalCardHeader';
5+
import { NumericSideIndicator } from '../../components/NumericSideIndicator';
6+
import { DeviationIndicator, ValueColor } from '../../enums';
37
import { CardHeader } from '../CardHeader';
48
import { Icon } from '../Icon';
59
import { List } from '../List';
@@ -42,3 +46,58 @@ export const Default: Story = {
4246
);
4347
}
4448
};
49+
50+
const simpleDataSet = [
51+
{
52+
name: 'January',
53+
users: 76
54+
},
55+
{
56+
name: 'February',
57+
users: 230
58+
},
59+
{
60+
name: 'March',
61+
users: 240
62+
},
63+
{
64+
name: 'April',
65+
users: 280
66+
},
67+
{
68+
name: 'May',
69+
users: 100
70+
}
71+
];
72+
73+
export const WithAnalyticalCardHeader = {
74+
render: (args) => {
75+
return (
76+
<Card
77+
header={
78+
<AnalyticalCardHeader
79+
titleText="Project Cloud Transformation"
80+
subtitleText="Revenue"
81+
unitOfMeasurement="EUR"
82+
trend={DeviationIndicator.Down}
83+
value="65.34"
84+
state={ValueColor.Error}
85+
scale="K"
86+
description="Q1, 2018"
87+
>
88+
<NumericSideIndicator titleText="Target" number="100" unit="k" />
89+
<NumericSideIndicator titleText="Deviation" number="34.7" unit="%" state={ValueColor.Critical} />
90+
</AnalyticalCardHeader>
91+
}
92+
>
93+
<LineChart
94+
className="chromatic-ignore"
95+
noLegend
96+
dimensions={[{ accessor: 'name' }]}
97+
measures={[{ accessor: 'users', formatter: (val) => `${val}k` }]}
98+
dataset={simpleDataSet}
99+
/>
100+
</Card>
101+
);
102+
}
103+
};

0 commit comments

Comments
 (0)