/* * Copyright OpenSearch Contributors * SPDX-License-Identifier: Apache-2.0 */ import React from "react"; import { EuiDescribedFormGroup, EuiFormRow, EuiFormRowProps } from "@elastic/eui"; export type CustomFormRowProps = { position?: "top" | "bottom"; direction?: "hoz" | "ver"; isOptional?: boolean; } & Partial; export function OptionalLabel() { return – optional; } export default function CustomFormRow(props: CustomFormRowProps) { const { helpText, children, position = "top", direction = "ver", label, isOptional, ...others } = props; if (direction === "hoz") { return ( {label} {isOptional ? : null} } description={helpText} > {children ? {children} : null} ); } return ( {label} ) : ( label ) } helpText={position === "bottom" ? helpText : undefined} > <> {helpText && position === "top" ? (
{helpText}
) : null} {children}
); }