import { Meta, StoryFn } from "@storybook/react"; import React, { useState } from "react"; import { CunninghamProvider } from ":/components/Provider"; import { Button } from ":/components/Button"; import DateRangePicker from ":/components/Forms/DatePicker/DateRangePicker"; import DatePicker from ":/components/Forms/DatePicker/DatePicker"; import { StringOrDate, StringsOrDateRange, } from ":/components/Forms/DatePicker/types"; export default { title: "Components/Forms/DatePicker", component: DatePicker, } as Meta; const Template: StoryFn = (args) => ( ); export const Default = () => (
); export const Disabled = { render: Template, args: { disabled: true }, }; export const DefaultValue = { render: Template, args: { defaultValue: "2023-05-24" }, }; export const DisabledValue = { render: Template, args: { disabled: true, defaultValue: "2023-05-24" }, }; export const Error = { render: Template, args: { defaultValue: "2023-05-24", state: "error", text: "Something went wrong", }, }; export const Success = { render: Template, args: { defaultValue: "2023-05-24", state: "success", text: "Well done", }, }; export const MinMaxValue = { render: Template, args: { defaultValue: "2023-05-24", minValue: "2023-04-23", maxValue: "2023-06-23", }, }; export const InvalidValue = { render: Template, args: { defaultValue: "2023-02-24", minValue: "2023-04-23", maxValue: "2023-06-23", }, }; export const WithText = { render: Template, args: { defaultValue: "2023-05-24", text: "This is a text, you can display anything you want here like warnings, information or errors.", }, }; export const Controlled = () => { const [value, setValue] = useState("2023-05-26"); return (
Value: {value?.toString()}
{ setValue(e); }} />
); }; export const RangeDefault = () => { return (
); }; export const RangeDefaultValue = () => { return ( ); }; export const RangeControlled = () => { const [value, setValue] = useState([ "2023-05-23", "2023-06-23", ]); return (
Value: {value?.join(" ")}
setValue(e)} />
); };