feat: add core UI components and baseline tests

This commit is contained in:
2026-03-19 16:56:27 +08:00
parent 12642e0a92
commit 063179933c
73 changed files with 5756 additions and 2 deletions
@@ -0,0 +1,57 @@
import { Label, Switch } from "@ai-ui/ui";
import type { Meta, StoryObj } from "@storybook/react";
const meta = {
title: "Components/Switch",
component: Switch,
args: {
defaultChecked: true
},
argTypes: {
className: {
control: false
},
defaultChecked: {
control: "boolean"
},
disabled: {
control: "boolean"
},
invalid: {
control: "boolean"
}
},
parameters: {
layout: "centered"
},
tags: ["autodocs"]
} satisfies Meta<typeof Switch>;
export default meta;
type Story = StoryObj<typeof meta>;
export const Playground: Story = {};
export const States: Story = {
render: () => (
<div className="grid gap-4">
<div className="flex items-center gap-3">
<Switch defaultChecked id="switch-live" />
<Label htmlFor="switch-live">Live publishing</Label>
</div>
<div className="flex items-center gap-3">
<Switch id="switch-draft" />
<Label htmlFor="switch-draft">Draft only</Label>
</div>
<div className="flex items-center gap-3">
<Switch disabled id="switch-disabled" />
<Label htmlFor="switch-disabled">Disabled</Label>
</div>
<div className="flex items-center gap-3">
<Switch id="switch-invalid" invalid />
<Label htmlFor="switch-invalid">Invalid state</Label>
</div>
</div>
)
};