feat: add sheet component and docs qa baseline

This commit is contained in:
2026-03-19 18:46:20 +08:00
parent 71ebb010b9
commit f318f94c9a
28 changed files with 1799 additions and 91 deletions
+23 -1
View File
@@ -1,6 +1,18 @@
import { Button } from "@ai-ui/ui";
import type { Meta, StoryObj } from "@storybook/react";
function getButtonFromCanvas(canvasElement: HTMLElement, name: string) {
const buttons = canvasElement.querySelectorAll("button, a");
for (const element of buttons) {
if (element.textContent?.trim().includes(name)) {
return element;
}
}
throw new Error(`Expected to find an interactive control containing "${name}".`);
}
const meta = {
title: "Components/Button",
component: Button,
@@ -61,7 +73,17 @@ export default meta;
type Story = StoryObj<typeof meta>;
export const Playground: Story = {};
export const Playground: Story = {
play: async ({ canvasElement }) => {
const button = getButtonFromCanvas(canvasElement, "Save changes");
button.dispatchEvent(new MouseEvent("click", { bubbles: true }));
if (button instanceof HTMLElement) {
button.focus();
}
}
};
export const Variants: Story = {
render: () => (