primereact
Version:
PrimeReact is an open source UI library for React featuring a rich set of 90+ components, a theme designer, various theme alternatives such as Material, Bootstrap, Tailwind, premium templates and professional support. In addition, it integrates with Prime
33 lines (30 loc) • 958 B
JavaScript
'use client';
import { ObjectUtils, classNames } from 'primereact/utils';
var IconBase = {
defaultProps: {
__TYPE: 'IconBase',
className: null,
label: null,
spin: false
},
getProps: function getProps(props) {
return ObjectUtils.getMergedProps(props, IconBase.defaultProps);
},
getOtherProps: function getOtherProps(props) {
return ObjectUtils.getDiffProps(props, IconBase.defaultProps);
},
getPTI: function getPTI(props) {
var isLabelEmpty = ObjectUtils.isEmpty(props.label);
var otherProps = IconBase.getOtherProps(props);
var ptiProps = {
className: classNames('p-icon', {
'p-icon-spin': props.spin
}, props.className),
role: !isLabelEmpty ? 'img' : undefined,
'aria-label': !isLabelEmpty ? props.label : undefined,
'aria-hidden': props.label ? isLabelEmpty : undefined
};
return ObjectUtils.getMergedProps(otherProps, ptiProps);
}
};
export { IconBase };