Skip to content

Commit f70f127

Browse files
authored
Merge branch 'master' into docs/filter-bar
2 parents 7d864a5 + 7087886 commit f70f127

File tree

3 files changed

+116
-42
lines changed

3 files changed

+116
-42
lines changed
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
import { ArgsTable, Canvas, Meta, Story } from '@storybook/addon-docs/blocks';
2+
import { ObjectStatus } from '@ui5/webcomponents-react/lib/ObjectStatus';
3+
import { createSelectArgTypes } from '@shared/stories/createSelectArgTypes';
4+
import { ValueState } from '@ui5/webcomponents-react/lib/ValueState';
5+
import { Icon } from '@ui5/webcomponents-react/lib/Icon';
6+
import { DocsHeader } from '@shared/stories/DocsHeader';
7+
import { DocsCommonProps } from '@shared/stories/DocsCommonProps';
8+
9+
<Meta
10+
title="Components / ObjectStatus"
11+
component={ObjectStatus}
12+
argTypes={{
13+
...createSelectArgTypes({ state: ValueState }),
14+
children: { control: 'text' },
15+
...DocsCommonProps
16+
}}
17+
args={{
18+
state: ValueState.None,
19+
children: 'ObjectStatus',
20+
showDefaultIcon: true,
21+
style: {},
22+
className: '',
23+
tooltip: '',
24+
slot: '',
25+
ref: null
26+
}}
27+
/>
28+
29+
<DocsHeader />
30+
31+
<Canvas>
32+
<Story name="Default">
33+
{(args) => {
34+
return <ObjectStatus {...args} />;
35+
}}
36+
</Story>
37+
</Canvas>
38+
39+
<ArgsTable story="Default" />
40+
41+
<br />
42+
43+
# Stories
44+
45+
<br />
46+
47+
## ObjectStatus with default icons
48+
49+
<Canvas>
50+
<Story name="None" args={{ state: ValueState.None, children: `Value State: ${ValueState.None}` }}>
51+
{(args) => {
52+
return <ObjectStatus {...args} />;
53+
}}
54+
</Story>
55+
<Story
56+
name="Information"
57+
args={{ state: ValueState.Information, children: `Value State: ${ValueState.Information}` }}
58+
>
59+
{(args) => {
60+
return <ObjectStatus {...args} />;
61+
}}
62+
</Story>
63+
<Story name="Success" args={{ state: ValueState.Success, children: `Value State: ${ValueState.Success}` }}>
64+
{(args) => {
65+
return <ObjectStatus {...args} />;
66+
}}
67+
</Story>
68+
<Story name="Warning" args={{ state: ValueState.Warning, children: `Value State: ${ValueState.Warning}` }}>
69+
{(args) => {
70+
return <ObjectStatus {...args} />;
71+
}}
72+
</Story>
73+
<Story name="Error" args={{ state: ValueState.Error, children: `Value State: ${ValueState.Error}` }}>
74+
{(args) => {
75+
return <ObjectStatus {...args} />;
76+
}}
77+
</Story>
78+
</Canvas>
79+
80+
## ObjectStatus with custom Icon
81+
82+
<Canvas>
83+
<Story name="with custom Icon" args={{ icon: <Icon name="sys-cancel" /> }}>
84+
{(args) => {
85+
return <ObjectStatus {...args} />;
86+
}}
87+
</Story>
88+
</Canvas>
89+
90+
## ObjectStatus with Icon only
91+
92+
<Canvas>
93+
<Story name="with Icon only" args={{ icon: <Icon name="sys-cancel" />, children: null }}>
94+
{(args) => {
95+
return <ObjectStatus {...args} />;
96+
}}
97+
</Story>
98+
</Canvas>

packages/main/src/components/ObjectStatus/demo.stories.tsx

Lines changed: 0 additions & 41 deletions
This file was deleted.

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

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,24 @@ import { CommonProps } from '../../interfaces/CommonProps';
1313
import styles from './ObjectStatus.jss';
1414

1515
export interface ObjectStatusPropTypes extends CommonProps {
16+
/**
17+
* Defines the text of the `ObjectStatus`.<br />
18+
* __Note:__ Although this slot accepts HTML Elements, it is strongly recommended that you only use text in order to preserve the intended design.
19+
*/
1620
children?: string | number | ReactNode;
21+
/**
22+
* Defines the icon in front of the `ObjectStatus` text.<br />
23+
* __Note:__ Although this slot accepts HTML Elements, it is strongly recommended that you only use `Icon` in order to preserve the intended design.
24+
*/
1725
icon?: ReactNode;
26+
/**
27+
* Defines the value state of the <code>ObjectStatus</code>. <br><br> Available options are: <ul> <li><code>None</code></li> <li><code>Error</code></li> <li><code>Warning</code></li> <li><code>Success</code></li> <li><code>Information</code></li> </ul>
28+
*/
1829
state?: ValueState;
30+
/**
31+
* Defines whether the default icon for each `ValueState` should be displayed.<br />
32+
* __Note:__ If the `icon` prop was set, `showDefaultIcon` has no effect.
33+
*/
1934
showDefaultIcon?: boolean;
2035
}
2136

@@ -39,7 +54,9 @@ const getDefaultIcon = (state) => {
3954
};
4055

4156
const useStyles = createComponentStyles(styles, { name: 'ObjectStatus' });
42-
57+
/**
58+
* Status information that can be either text with a value state, or an icon.
59+
*/
4360
const ObjectStatus: FC<ObjectStatusPropTypes> = forwardRef((props: ObjectStatusPropTypes, ref: Ref<HTMLDivElement>) => {
4461
const { state, showDefaultIcon, children, icon, className, style, tooltip, slot } = props;
4562
const iconToRender = useMemo(() => {

0 commit comments

Comments
 (0)