metis-desk/packages/rdx-ui/src/components/field-help.tsx
David 832d69c6fa feat: enhance form components with field help and tabbed sections
- Added FieldHelp component to display help text for form fields.
- Integrated help text into AssetCharacteristicControl and ResourceCharacteristicControl.
- Updated AssetForm to utilize TabbedFieldSections for better organization of characteristics.
- Modified BrandSelect to include help text.
- Improved CatalogFieldForm with descriptive hints for the description field.
- Refactored FieldSections to support different layouts and improved styling.
- Introduced fieldHelpById utility to manage help text for fields.
- Updated localization files to include new help text strings.
- Enhanced tests to cover new features and ensure functionality.
2026-10-10 22:00:45 +02:00

21 lines
563 B
TypeScript

import { FieldDescription } from "@repo/shadcn-ui/components/field";
export function fieldHelpId(controlId: string, text: string | undefined) {
return text?.trim() ? `${controlId}-help` : undefined;
}
/** Ayuda discreta y accesible; nunca presenta bloques vacíos. */
export function FieldHelp({ id, text }: { id?: string | undefined; text?: string | undefined }) {
const help = text?.trim();
if (!help) {
return null;
}
return (
<FieldDescription className="text-xs whitespace-pre-line" id={id}>
{help}
</FieldDescription>
);
}