refactor: remove core-ui from main (scaffoldable via gen core-package ui)
Removal across all three consumers: - apps/storybook: strips @repo/core-ui dep, clears stories glob (now []), removes globals.css import from preview.ts - apps/web-next: strips @repo/core-ui dep + transpilePackages entry - apps/web-tanstack: strips @repo/core-ui dep - packages/core-ui: deleted entirely (28 files) No app pages needed surgery — neither web-next nor web-tanstack source files imported @repo/core-ui directly. The storybook app referenced it only via the stories glob and the globals.css preview import. Gates: 40/40 tasks successful, all 4 e2e byte-identical reconstructions pass (realtime, events, trpc, ui). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,31 +0,0 @@
|
||||
import type { Meta, StoryObj } from "@storybook/react";
|
||||
import { FormField } from "./form-field";
|
||||
|
||||
const meta = {
|
||||
title: "Molecules/FormField",
|
||||
component: FormField,
|
||||
tags: ["autodocs"],
|
||||
} satisfies Meta<typeof FormField>;
|
||||
export default meta;
|
||||
|
||||
type Story = StoryObj<typeof meta>;
|
||||
|
||||
export const Default: Story = {
|
||||
args: { label: "Email", placeholder: "you@example.com", type: "email" },
|
||||
};
|
||||
|
||||
export const WithDescription: Story = {
|
||||
args: {
|
||||
label: "Username",
|
||||
placeholder: "johndoe",
|
||||
description: "Must be 3-31 characters",
|
||||
},
|
||||
};
|
||||
|
||||
export const WithError: Story = {
|
||||
args: {
|
||||
label: "Password",
|
||||
type: "password",
|
||||
error: "Password must be at least 6 characters",
|
||||
},
|
||||
};
|
||||
@@ -1,33 +0,0 @@
|
||||
import { describe, it, expect } from "vitest";
|
||||
import { renderWithProviders } from "@repo/core-testing/react";
|
||||
import { screen } from "@testing-library/react";
|
||||
import { FormField } from "./form-field";
|
||||
|
||||
describe("FormField", () => {
|
||||
it("renders label associated with input via auto-derived id", () => {
|
||||
renderWithProviders(<FormField label="Email Address" />);
|
||||
const input = screen.getByLabelText("Email Address");
|
||||
expect(input).toBeInTheDocument();
|
||||
expect(input).toHaveAttribute("id", "email-address");
|
||||
});
|
||||
|
||||
it("uses an explicit id over the derived one", () => {
|
||||
renderWithProviders(<FormField label="Email" id="custom-id" />);
|
||||
expect(screen.getByLabelText("Email")).toHaveAttribute("id", "custom-id");
|
||||
});
|
||||
|
||||
it("renders a description when provided", () => {
|
||||
renderWithProviders(<FormField label="Email" description="We never share it." />);
|
||||
expect(screen.getByText("We never share it.")).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("renders an error message when provided", () => {
|
||||
renderWithProviders(<FormField label="Email" error="Required" />);
|
||||
expect(screen.getByText("Required")).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("forwards input props (e.g., type) to the underlying input", () => {
|
||||
renderWithProviders(<FormField label="Email" type="email" />);
|
||||
expect(screen.getByLabelText("Email")).toHaveAttribute("type", "email");
|
||||
});
|
||||
});
|
||||
@@ -1,31 +0,0 @@
|
||||
import { Label } from "../../atoms/label/index";
|
||||
import { Input, type InputProps } from "../../atoms/input/index";
|
||||
import { cn } from "../../lib/utils";
|
||||
|
||||
export interface FormFieldProps extends InputProps {
|
||||
label: string;
|
||||
error?: string;
|
||||
description?: string;
|
||||
}
|
||||
|
||||
export function FormField({
|
||||
label,
|
||||
error,
|
||||
description,
|
||||
className,
|
||||
id,
|
||||
...inputProps
|
||||
}: FormFieldProps) {
|
||||
const fieldId = id ?? label.toLowerCase().replace(/\s+/g, "-");
|
||||
|
||||
return (
|
||||
<div className={cn("space-y-2", className)}>
|
||||
<Label htmlFor={fieldId}>{label}</Label>
|
||||
<Input id={fieldId} {...inputProps} />
|
||||
{description && (
|
||||
<p className="text-sm text-muted-foreground">{description}</p>
|
||||
)}
|
||||
{error && <p className="text-sm text-destructive">{error}</p>}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
export { FormField, type FormFieldProps } from "./form-field";
|
||||
@@ -1 +0,0 @@
|
||||
export { FormField, type FormFieldProps } from "./form-field/index";
|
||||
Reference in New Issue
Block a user