@sap-ux/ui-components
Version:
SAP UI Components Library
58 lines • 1.71 kB
JavaScript
import React from 'react';
import { Label } from '@fluentui/react';
import { REQUIRED_LABEL_INDICATOR } from '../types.js';
export const labelGlobalStyle = {
fontWeight: 'bold',
fontSize: '13px',
color: 'var(--vscode-input-foreground)',
padding: '4px 0'
};
/**
* UILabel component
* based on https://developer.microsoft.com/en-us/fluentui#/controls/web/label
*
* @exports
* @class UILabel
* @extends {React.Component<ILabelProps, {}>}
*/
export class UILabel extends React.Component {
/**
* Initializes component properties.
*
* @param {UILabelProps} props
*/
constructor(props) {
super(props);
}
/**
* @returns {JSX.Element}
*/
render() {
const labelStyles = (props) => {
return {
...{
root: [
{
marginTop: 25,
...labelGlobalStyle
},
props.disabled && {
opacity: '0.4'
},
props.required && {
selectors: {
'::after': {
content: REQUIRED_LABEL_INDICATOR,
color: 'var(--vscode-inputValidation-errorBorder)',
paddingRight: 12
}
}
}
]
}
};
};
return React.createElement(Label, { ...this.props, styles: labelStyles });
}
}
//# sourceMappingURL=UILabel.js.map