import PropTypes from "prop-types"; import React from "react"; import HelpPopover from "../../HelpPopover"; import classNames from "classnames"; export interface FormSectionProps { children: any; /** CSS class names. */ className?: string; /** Description for Form Section */ description?: string; /** Indicates whether to include a help popover */ helpIcon?: boolean; /** Indicates whether to include the "optional" tag to the section */ isOptional?: boolean; /** Indicates whether to include a required asterisk */ isRequired?: boolean; /** Text for popover */ popoverText?: string; /** Title for popover */ popoverTitle?: string; testSection?: string; /** Title for Section */ title?: string; } const Section = ({ // eslint-disable-line @typescript-eslint/explicit-function-return-type children, className, description, helpIcon, isOptional, isRequired, popoverText, popoverTitle, testSection, title, ...props }: FormSectionProps) => { const headerClasses = classNames("push--bottom", { "oui-label--required": isRequired }); return (
{title && (

{title} {isOptional && } {helpIcon && (

{popoverText}

)}

)} {description &&
{description}
} {children}
); }; Section.propTypes = { children: PropTypes.node.isRequired, /** CSS class names. */ className: PropTypes.string, /** Description for Form Section */ description: PropTypes.node, /** Indicates whether to include a help popover */ helpIcon: PropTypes.bool, /** Indicates whether to include the "optional" tag to the section */ isOptional: PropTypes.bool, /** Indicates whether to include a required asterisk */ isRequired: PropTypes.bool, /** Text for popover */ popoverText: PropTypes.string, /** Title for popover */ popoverTitle: PropTypes.string, testSection: PropTypes.string, /** Title for Section */ title: PropTypes.string, }; export default Section;