2023-03-06 15:52:01 +01:00
|
|
|
import { ComponentMeta, ComponentStory } from "@storybook/react";
|
|
|
|
|
import React from "react";
|
2023-05-04 15:04:47 +02:00
|
|
|
import { Checkbox, CheckboxGroup } from ":/components/Forms/Checkbox/index";
|
2023-03-06 15:52:01 +01:00
|
|
|
|
|
|
|
|
export default {
|
2023-04-20 14:57:22 +02:00
|
|
|
title: "Components/Forms/Checkbox",
|
2023-03-06 15:52:01 +01:00
|
|
|
component: Checkbox,
|
|
|
|
|
} as ComponentMeta<typeof Checkbox>;
|
|
|
|
|
|
|
|
|
|
const Template: ComponentStory<typeof Checkbox> = (args) => (
|
|
|
|
|
<Checkbox {...args} aria-label="Checkbox" />
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
export const Default = Template.bind({});
|
|
|
|
|
Default.args = {};
|
|
|
|
|
|
2023-04-20 14:57:22 +02:00
|
|
|
export const Checked = Template.bind({});
|
|
|
|
|
Checked.args = {
|
|
|
|
|
checked: true,
|
|
|
|
|
};
|
|
|
|
|
|
2023-03-06 15:52:01 +01:00
|
|
|
export const Indeterminate = Template.bind({});
|
|
|
|
|
Indeterminate.args = {
|
|
|
|
|
indeterminate: true,
|
|
|
|
|
};
|
|
|
|
|
|
2023-04-20 14:57:22 +02:00
|
|
|
export const WithLabel = Template.bind({});
|
|
|
|
|
WithLabel.args = {
|
|
|
|
|
label: "Label",
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export const LabelChecked = Template.bind({});
|
|
|
|
|
LabelChecked.args = {
|
|
|
|
|
checked: true,
|
|
|
|
|
label: "Label",
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export const WithTexts = Template.bind({});
|
|
|
|
|
WithTexts.args = {
|
2023-03-06 15:52:01 +01:00
|
|
|
checked: true,
|
2023-04-20 14:57:22 +02:00
|
|
|
label: "Label",
|
|
|
|
|
text: "This is an optional text",
|
2023-03-06 15:52:01 +01:00
|
|
|
};
|
2023-04-20 14:57:22 +02:00
|
|
|
|
|
|
|
|
export const Disabled = Template.bind({});
|
|
|
|
|
Disabled.args = {
|
|
|
|
|
disabled: true,
|
|
|
|
|
label: "Label",
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export const DisabledChecked = Template.bind({});
|
|
|
|
|
DisabledChecked.args = {
|
|
|
|
|
checked: true,
|
|
|
|
|
disabled: true,
|
|
|
|
|
label: "Label",
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export const Error = Template.bind({});
|
|
|
|
|
Error.args = {
|
|
|
|
|
checked: true,
|
|
|
|
|
label: "Label",
|
|
|
|
|
text: "This is an optional text",
|
|
|
|
|
state: "error",
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export const Success = Template.bind({});
|
|
|
|
|
Success.args = {
|
|
|
|
|
checked: true,
|
|
|
|
|
label: "Label",
|
|
|
|
|
text: "This is an optional text",
|
|
|
|
|
state: "success",
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export const Group = () => (
|
|
|
|
|
<div>
|
|
|
|
|
<div className="fs-l fw-bold mb-t">Your offices</div>
|
|
|
|
|
<CheckboxGroup>
|
|
|
|
|
<Checkbox label="Paris" />
|
|
|
|
|
<Checkbox label="New York" text="United States" checked={true} />
|
|
|
|
|
<Checkbox label="Hong Kong" text="Really long text to write something" />
|
|
|
|
|
<Checkbox label="Singapour" checked={true} />
|
|
|
|
|
<Checkbox label="London" text="Offices closed" disabled={true} />
|
|
|
|
|
</CheckboxGroup>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
export const GroupError = () => (
|
|
|
|
|
<div>
|
|
|
|
|
<div className="fs-l fw-bold mb-t">Your offices</div>
|
|
|
|
|
<CheckboxGroup state="error" text="An important error message">
|
|
|
|
|
<Checkbox label="Paris" />
|
|
|
|
|
<Checkbox label="New York" text="United States" checked={true} />
|
|
|
|
|
<Checkbox label="Hong Kong" text="Really long text to write something" />
|
|
|
|
|
<Checkbox label="Singapour" checked={true} />
|
|
|
|
|
<Checkbox label="London" text="Offices closed" disabled={true} />
|
|
|
|
|
</CheckboxGroup>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
export const GroupSuccess = () => (
|
|
|
|
|
<div>
|
|
|
|
|
<div className="fs-l fw-bold mb-t">Your offices</div>
|
|
|
|
|
<CheckboxGroup state="success" text="Success message !">
|
|
|
|
|
<Checkbox label="Paris" />
|
|
|
|
|
<Checkbox label="New York" text="United States" checked={true} />
|
|
|
|
|
<Checkbox label="Hong Kong" text="Really long text to write something" />
|
|
|
|
|
<Checkbox label="Singapour" checked={true} />
|
|
|
|
|
<Checkbox label="London" text="Offices closed" disabled={true} />
|
|
|
|
|
</CheckboxGroup>
|
|
|
|
|
</div>
|
|
|
|
|
);
|