import React from "react"; import { ClassNames as IntentClassNames, IntentTypes } from "../../common/Intent"; import { CLASSPREFIX as eccgui } from "../../configuration/constants"; export interface FieldSetProps extends Omit, "title"> { /** * Displays the fieldset inside a box. * Background color of the box is set automatically regarding the set intent state. */ boxed?: boolean; /** * Intent state of the field item. */ intent?: IntentTypes; /** * Optional helper text. If given then it is displayed after the title. */ helperText?: string | React.JSX.Element; /** * Optional notification text. * If given then it is displayed before the fieldset content and is colored reagarding the set intent state. */ messageText?: string | React.JSX.Element; /** * Optional title, set the fieldset legend and if given it is display on top, colored reagarding the set intent state. * */ title?: string | React.JSX.Element; } /** * Displays a group of input elements. */ export const FieldSet = ({ boxed = false, children, className, intent, helperText, messageText, title, ...otherProps }: FieldSetProps) => { const userhelp = helperText && (typeof helperText === "string" ? (

{helperText}

) : (
{helperText}
)); const notification = messageText && (typeof messageText === "string" ? (

{messageText}

) : (
{messageText}
)); const fielditems = children &&
{children}
; return (
{title && {title}} {userhelp} {notification} {fielditems}
); }; export default FieldSet;