Skip to content

Commit 03835db

Browse files
authored
fix(ObjectStatus): apply latest available specs (#4939)
Fixes #4934
1 parent 6c1a882 commit 03835db

File tree

2 files changed

+50
-15
lines changed

2 files changed

+50
-15
lines changed

packages/main/src/components/ObjectStatus/ObjectStatus.jss.ts

Lines changed: 41 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { ThemingParameters } from '@ui5/webcomponents-react-base';
22

33
const createInvertedValueStateStyles = (baseColor: string) => ({
4+
textShadow: ThemingParameters.sapContent_ContrastTextShadow,
45
background: ThemingParameters[`${baseColor}_Background`],
56
color: ThemingParameters[`${baseColor}_TextColor`],
67
'& [ui5-icon]': {
@@ -23,6 +24,7 @@ const createInvertedValueStateStyles = (baseColor: string) => ({
2324
});
2425

2526
const createInvertedIndicationStyles = (baseColor: string) => ({
27+
textShadow: ThemingParameters.sapContent_ContrastTextShadow,
2628
color: ThemingParameters[`${baseColor}_TextColor`],
2729
backgroundColor: ThemingParameters[`${baseColor}`],
2830
'& [ui5-icon]': {
@@ -44,7 +46,32 @@ const styles = {
4446
position: 'relative',
4547
display: 'inline-block',
4648
verticalAlign: 'top',
47-
width: 'fit-content'
49+
width: 'fit-content',
50+
textShadow: ThemingParameters.sapContent_TextShadow
51+
},
52+
53+
active: {
54+
cursor: 'pointer',
55+
'&:not($inverted)': {
56+
'& $text': {
57+
textDecoration: 'underline'
58+
},
59+
'&:hover, &:active': {
60+
'& $text': {
61+
textDecoration: 'none'
62+
}
63+
},
64+
'&:focus': {
65+
textShadow: 'none',
66+
background: ThemingParameters.sapContent_FocusColor,
67+
color: ThemingParameters.sapContent_ContrastTextColor,
68+
borderRadius: '0.125rem',
69+
outline: `0.125rem ${ThemingParameters.sapContent_FocusColor}`,
70+
'& [ui5-icon]': {
71+
color: ThemingParameters.sapContent_ContrastTextColor
72+
}
73+
}
74+
}
4875
},
4976

5077
icon: {
@@ -147,28 +174,28 @@ const styles = {
147174
}
148175
},
149176

150-
active: {
151-
'&:hover, &:active': {
152-
cursor: 'pointer',
153-
'&:not($inverted) $text, $icon:only-child': {
154-
textDecoration: 'underline'
155-
}
156-
}
157-
},
158-
159177
inverted: {
160178
height: 'auto',
161179
minHeight: '1rem',
162-
minWidth: '1.25rem',
163-
padding: '0.0625rem 0.25rem',
164-
borderRadius: ThemingParameters.sapElement_BorderCornerRadius,
180+
minWidth: '1.375rem',
181+
padding: '0.1875rem 0.25rem',
182+
borderRadius: ThemingParameters.sapButton_BorderCornerRadius,
165183
fontFamily: ThemingParameters.sapFontBoldFamily,
166184
fontSize: ThemingParameters.sapFontSmallSize,
167185
'& [ui5-icon]': {
168-
paddingTop: '0.125rem',
186+
paddingBlockStart: '0.125rem',
169187
width: ThemingParameters.sapFontSmallSize,
170188
height: ThemingParameters.sapFontSmallSize
171189
},
190+
'&[data-icon-only="true"]': {
191+
display: 'flex',
192+
alignItems: 'center',
193+
justifyContent: 'center',
194+
padding: '0.1875rem 0.313rem'
195+
},
196+
'$active&:focus': {
197+
outline: `${ThemingParameters.sapContent_FocusColor} ${ThemingParameters.sapContent_FocusStyle} ${ThemingParameters.sapContent_FocusWidth}`
198+
},
172199
'&$error': createInvertedValueStateStyles('sapButton_Negative'),
173200
'&$warning': createInvertedValueStateStyles('sapButton_Critical'),
174201
'&$success': createInvertedValueStateStyles('sapButton_Success'),

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

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,15 @@ const ObjectStatus = forwardRef<HTMLDivElement, ObjectStatusPropTypes>((props, r
107107
);
108108

109109
return (
110-
<div ref={ref} className={objStatusClasses} style={style} onClick={active ? onClick : undefined} {...rest}>
110+
<div
111+
ref={ref}
112+
className={objStatusClasses}
113+
style={style}
114+
onClick={active ? onClick : undefined}
115+
tabIndex={active ? 0 : undefined}
116+
data-icon-only={!children}
117+
{...rest}
118+
>
111119
{iconToRender && <span className={classes.icon}>{iconToRender}</span>}
112120
{children && <span className={classes.text}>{children}</span>}
113121
</div>

0 commit comments

Comments
 (0)