import { useState } from "react";
import type { Meta, StoryObj } from "@storybook/react-vite";
import { FormField } from "@shared/components/FormField";
import { Input } from "@shared/components/Input";
import { Select } from "@shared/components/Select";
import { Checkbox } from "@shared/components/Checkbox";
import { RadioGroup } from "@shared/components/Radio";
import { Slider } from "@shared/components/Slider";
import { Stack } from "@shared/components/Stack";
import { Inline } from "@shared/components/Inline";
// Inline icon to avoid a cross-layer import; shared/ must not depend on portal/.
function SearchIcon({ size = 14 }: { size?: number }) {
return (
);
}
const meta: Meta = {
title: "Primitives/Forms",
parameters: { layout: "padded" },
decorators: [
(S) => (
),
],
};
export default meta;
type Story = StoryObj;
export const Input_Default: Story = {
render: () => (
),
};
export const Input_WithIcon: Story = {
render: () => (
}
placeholder="Search Stirling…"
/>
),
};
export const Input_Error: Story = {
render: () => (
{}} />
),
};
export const Select_Default: Story = {
render: () => (
),
};
export const Checkbox_Single: Story = {
render: () => (
),
};
export const Checkbox_GridOfCategories: Story = {
render: () => (
{["SSN", "DOB", "Accounts", "Contacts", "Names", "Addresses"].map(
(c) => (
),
)}
),
};
export const Radio_Group: Story = {
render: () => {
function Bound() {
const [mode, setMode] = useState<"stirling" | "byok" | "hyok">(
"stirling",
);
return (
);
}
return ;
},
};
export const Radio_Horizontal: Story = {
render: () => {
function Bound() {
const [v, setV] = useState("us");
return (
);
}
return ;
},
};
export const Slider_Confidence: Story = {
render: () => {
function Bound() {
const [v, setV] = useState(0.85);
return (
x.toFixed(2)}
/>
);
}
return ;
},
};
export const Slider_Retention: Story = {
render: () => {
function Bound() {
const [days, setDays] = useState(90);
return (
`${d} days`}
/>
);
}
return ;
},
};
export const FullForm: Story = {
render: () => {
function Form() {
const [name, setName] = useState("");
const [retention, setRetention] = useState("90");
const [mode, setMode] = useState<"stirling" | "byok" | "hyok">(
"stirling",
);
const [conf, setConf] = useState(0.85);
const [notify, setNotify] = useState(true);
const [review, setReview] = useState(false);
return (
setName(e.target.value)}
placeholder="e.g. coi-compliance"
/>
v.toFixed(2)}
/>
setNotify(e.target.checked)}
label="Notify on failure"
/>
setReview(e.target.checked)}
label="Send low-confidence to review"
/>
);
}
return ;
},
};