@talend/react-forms
Version:
React forms library based on json schema form.
37 lines • 1.12 kB
JavaScript
import classnames from 'classnames';
import { ButtonIcon, Popover, StackHorizontal } from '@talend/design-system';
import styles from './labels.module.scss';
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
export const getLabelProps = (title, labelProps, hint, required) => {
if (!hint) {
return {
children: title,
...labelProps
};
}
return {
children: /*#__PURE__*/_jsxs(StackHorizontal, {
gap: "XXS",
align: "center",
children: [/*#__PURE__*/_jsx("span", {
className: classnames({
[styles.required]: required
}),
children: title
}), /*#__PURE__*/_jsx(Popover, {
position: hint.overlayPlacement || 'auto',
"data-test": hint['data-test'],
isFixed: hint.overlayIsFixed,
disclosure: /*#__PURE__*/_jsx(ButtonIcon, {
"data-test": hint['icon-data-test'],
size: "XS",
icon: hint.icon || 'talend-info-circle'
}),
children: hint.overlayComponent
})]
}),
...labelProps,
required: false
};
};
//# sourceMappingURL=labels.js.map