import * as React from 'react' import styled from 'styled-components' import { theme, spacingPx, text } from '@planview/pv-utilities' const Fieldset = styled.fieldset` border: 0; margin: 0; padding: 0; color: ${theme.textPrimary}; padding-bottom: ${spacingPx.xsmall}; &:first-child { margin-top: ${spacingPx.medium}; } &:last-child { margin-bottom: ${spacingPx.medium}; } ` const Legend = styled.legend` ${text.title}; margin: 0; padding: 0; padding-bottom: ${spacingPx.small}; display: flex; ` type FormSectionProps = { /** * Text label for section, to explain the group of fields in the section */ label: string children: React.ReactNode } const _FormSection: React.ForwardRefRenderFunction< HTMLFieldSetElement, FormSectionProps > = ({ label, children }, ref) => (
{label} {children}
) /** * Implementation of the [Form Sections specification](https://design.planview.com/components/forms/form-sections) * * `import { FormSection } from '@planview/pv-form'` * * Form sections are recommended to structure the information clearly in larger forms. They are usually * displayed on an entire page, such as user settings, but can also work in smaller areas like a modal. * * Each section has its own header built in. */ const FormSection = React.forwardRef(_FormSection) /** * @deprecated Use `FormSection` instead. * * Implementation of the [Form Sections specification](https://design.planview.com/components/forms/form-sections) * * `import { FormSection } from '@planview/pv-form'` * * Form sections are recommended to structure the information clearly in larger forms. They are usually * displayed on an entire page, such as user settings, but can also work in smaller areas like a modal. * * Each section has its own header built in. */ const Section = FormSection export type { FormSectionProps } export { FormSection, Section } export default FormSection