import type { Meta, StoryFn } from '@storybook/react-vite';
import { fn } from 'storybook/test';
import SandBox from '..';

const meta: Meta< typeof SandBox > = {
	tags: [ 'manifest' ],
	component: SandBox,
	title: 'Components/@wordpress-components/Utilities/SandBox',
	id: 'components-sandbox',
	argTypes: {
		onFocus: { control: false },
	},
	args: {
		onFocus: fn(),
	},
	parameters: {
		controls: { expanded: true },
		docs: { canvas: { sourceState: 'shown' } },
		componentStatus: {
			status: 'recommended',
			whereUsed: 'global',
		},
	},
};
export default meta;

const Template: StoryFn< typeof SandBox > = ( args ) => <SandBox { ...args } />;

export const Default = Template.bind( {} );
Default.args = {
	title: 'Sandbox preview',
	html: '<p>Arbitrary HTML content</p>',
	allowForms: false,
};

export const WithForm = Template.bind( {} );
WithForm.args = {
	title: 'Sandbox preview with form',
	html: '<form action="#"><label for="name">Name</label><input id="name" type="text" /><button type="submit">Submit</button></form>',
	allowForms: true,
};
