metis-desk/packages/rdx-ui/src/components/form-step-actions.tsx
David 2149ecb17b feat: implement step-by-step asset creation process
- Added a new layout for asset creation that guides users through three steps: template selection, field completion, and final review.
- Introduced `AssetCreateProgress` component to display current step and instructions.
- Updated `AssetForm` to handle step navigation and validation.
- Integrated `FormStepActions` for navigation between steps and submission handling.
- Enhanced localization for new steps and descriptions in both English and Spanish.
- Refactored asset form components to separate identity and field sections for better clarity and usability.
- Added helper functions for validating required fields and suggesting asset names based on input.
2026-10-16 10:55:12 +02:00

44 lines
1.1 KiB
TypeScript

import { Button } from "@repo/shadcn-ui/components/button";
import { ChevronLeftIcon, ChevronRightIcon } from "../lib/icons";
import { FormActions } from "./form-dialog";
/** Acciones de formulario completo o por pasos; el consumidor aporta navegación y textos. */
export function FormStepActions({
step,
total,
pending,
canContinue,
onPrevious,
previousLabel,
nextLabel,
saveLabel,
}: {
step: number | undefined;
total: number;
pending: boolean;
canContinue: boolean;
onPrevious: () => void;
previousLabel: string;
nextLabel: string;
saveLabel: string;
}) {
const hasNext = step !== undefined && step < total;
return (
<FormActions>
{step !== undefined && step > 1 && (
<Button disabled={pending} onClick={onPrevious} type="button" variant="outline">
<ChevronLeftIcon aria-hidden="true" className="size-4" />
{previousLabel}
</Button>
)}
<Button disabled={pending || (step === 1 && !canContinue)} type="submit">
{hasNext ? nextLabel : saveLabel}
{hasNext && <ChevronRightIcon aria-hidden="true" className="size-4" />}
</Button>
</FormActions>
);
}