import { Meta } from "@storybook/react";
import { DateRangePickerProps } from "./DateRangePickerProps";
import DateRangePicker from "./DateRangePicker";

export default {
  title: "Design System/Date Inputs/DateRangePicker",
  component: DateRangePicker,
  tags: ["autodocs"],
  parameters: {
    docs: {
      description: {
        component:
          'The KendoReact DateRangePicker combines the KendoReact DateInput and MultiViewCalendar components and enables the user to enter or pick a date-range value. \n\n```javascript\nimport { DateRangePicker } from "@renault-ui-library"\n```',
      },
    },
  },
  argTypes: {
    dataTestId: {
      control: { type: "text" },
      description: "Specifies the data-test-id attribute for testing purposes.",
    },
    adaptive: {
      control: { type: "boolean" },
      description:
        "Providing different rendering of the popup element based on the screen dimensions.",
    },
    adaptiveTitle: {
      control: { type: "string" },
      description:
        "Specifies the text that is rendered as title in the adaptive popup.",
    },
    allowReverse: {
      control: { type: "boolean" },
      description:
        "If allowReverse is set to true, the component skips the validation of whether the from value is after the to value.",
    },
    ariaDescribedBy: {
      control: { type: "string" },
      description:
        "Identifies the element(s) which will describe the component, similar to HTML aria-describedby attribute.",
    },
    ariaLabelledBy: {
      control: { type: "string" },
      description: "Identifies the element(s) which will label the component.",
    },
    calendar: {
      control: { type: "object" },
      description:
        "Enables the customization or the override of the default Calendar which is rendered by the DateRangePicker.",
    },
    calendarSettings: {
      control: { type: "object" },
      description:
        "Represents the additional props that can be passed to the MultiViewCalendar inside the DateRangePicker.",
    },
    className: {
      control: { type: "string" },
      description: "Sets the className of the DateRangePicker.",
    },
    defaultShow: {
      control: { type: "boolean" },
      description: "Sets the default state of the DateRangePicker upon render.",
    },
    defaultValue: {
      control: { type: "object" },
      description: "Sets the default value of the DateRangePicker.",
    },
    disabled: {
      control: { type: "boolean" },
      description: "Determines whether the DateRangePicker is disabled.",
    },
    endDateInput: {
      control: { type: "object" },
      description:
        "Enables the customization or the override of the default end DateInput which is rendered by the DateRangePicker.",
    },
    endDateInputSettings: {
      control: { type: "object" },
      description:
        "Represents the additional props that can be passed to the end-date DateInput inside the DateRangePicker.",
    },
    focusedDate: {
      control: { type: "date" },
      description: "Specifies the focused date of the DateRangePicker.",
    },
    format: {
      control: { type: "string" },
      description:
        "Specifies the date format which is used for formatting the value of the DateInput.",
    },
    id: {
      control: { type: "string" },
      description: "Specifies the id of the DateRangePicker.",
    },
    max: {
      control: { type: "date" },
      description: "Specifies the greatest valid date.",
    },
    min: {
      control: { type: "date" },
      description: "Specifies the smallest valid date.",
    },
    popup: {
      control: { type: "object" },
      description:
        "Enables the customization or the override of the default Popup which is rendered by the DateRangePicker.",
    },
    popupSettings: {
      control: { type: "object" },
      description:
        "Represents the additional props that will be passed to the Popup inside the DateRangePicker.",
    },
    show: {
      control: { type: "boolean" },
      description: "Specifies if the calendar will be displayed.",
    },
    startDateInput: {
      control: { type: "object" },
      description:
        "Enables the customization or the override of the default start DateInput which is rendered by the DateRangePicker.",
    },
    startDateInputSettings: {
      control: { type: "object" },
      description:
        "Represents the additional props that can be passed to the start-date DateInput inside the DateRangePicker.",
    },
    style: {
      control: { type: "object" },
      description:
        "Specifies the additional styles that will be applied to the wrapping DateRangePicker element.",
    },
    swapButton: {
      control: { type: "boolean" },
      description:
        "Determines whether the DateRangePicker will display a Swap Value button.",
    },
    tabIndex: {
      control: { type: "number" },
      description: "Sets the tabIndex property of the DatePicker.",
    },
    valid: {
      control: { type: "boolean" },
      description: "Overrides the validity state of the component.",
    },
    value: {
      control: { type: "object" },
      description: "Specifies the selected date range of the DateRangePicker.",
    },
    onBlur: {
      control: { type: "function" },
      description:
        "Fires each time any of the DateRangePicker elements gets blurred.",
    },
    onCancel: {
      control: { type: "function" },
      description:
        "Fires each time the popup of the DateRangePicker is about to cancel in (adaptive mode).",
    },
    onChange: {
      control: { type: "function" },
      description: "Fires each time the user selects a part of a date range.",
    },
    onClose: {
      control: { type: "function" },
      description: "Fires each time the popup is closed.",
    },
    onFocus: {
      control: { type: "function" },
      description:
        "Fires each time the user focuses any of the DateRangePicker elements.",
    },
    onOpen: {
      control: { type: "function" },
      description: "Fires each time the popup is opened.",
    },
  },
} as Meta;

export const Default = (args: DateRangePickerProps): JSX.Element => (
  <DateRangePicker {...args} />
);

Default.args = {
  dataTestId: "drp-data-testid",
  adaptive: true,
  disabled: false,
  format: "MM/dd/yyyy",
};
