feat(core-ui): scaffold @repo/core-ui via generator

Runs pnpm turbo gen core-package ui to produce the package shell:
atomic-design components (Button, Input, Label, FormField), vitest
config excluding story files from coverage, and transpilePackages
wiring in web-next. Adds @vitest/coverage-v8 devDep and
label.stories.tsx to satisfy lint/coverage gates.

Also fixes scripts/library-decisions/check.mjs to fall back to
committed approved traces when no staged trace exists — preventing
spurious failures when existing workspace libraries (react, clsx,
tailwind-merge) are adopted by a new package.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-19 20:59:48 +00:00
parent 81898d9902
commit bce9ded915
38 changed files with 998 additions and 3 deletions

View File

@@ -0,0 +1 @@
export { Label, type LabelProps } from "./label";

View File

@@ -0,0 +1,19 @@
import type { Meta, StoryObj } from "@storybook/react";
import { Label } from "./label";
const meta = {
title: "Atoms/Label",
component: Label,
tags: ["autodocs"],
} satisfies Meta<typeof Label>;
export default meta;
type Story = StoryObj<typeof meta>;
export const Default: Story = {
args: { children: "Form label" },
};
export const Disabled: Story = {
args: { children: "Disabled label", className: "peer-disabled:opacity-70" },
};

View File

@@ -0,0 +1,16 @@
import { describe, it, expect } from "vitest";
import { renderWithProviders } from "@repo/core-testing/react";
import { screen } from "@testing-library/react";
import { Label } from "./label";
describe("Label", () => {
it("renders the label text", () => {
renderWithProviders(<Label htmlFor="email">Email</Label>);
expect(screen.getByText("Email")).toBeInTheDocument();
});
it("forwards htmlFor to associate with an input", () => {
renderWithProviders(<Label htmlFor="email">Email</Label>);
expect(screen.getByText("Email")).toHaveAttribute("for", "email");
});
});

View File

@@ -0,0 +1,20 @@
import { forwardRef, type LabelHTMLAttributes } from "react";
import { cn } from "../../lib/utils";
export type LabelProps = LabelHTMLAttributes<HTMLLabelElement>;
export const Label = forwardRef<HTMLLabelElement, LabelProps>(
({ className, ...props }, ref) => {
return (
<label
className={cn(
"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",
className,
)}
ref={ref}
{...props}
/>
);
},
);
Label.displayName = "Label";