import { Meta } from "@storybook/react";
import { DatePickerProps } from "./DatePickerProps";
import DatePicker from "./DatePicker";

export default {
  title: "Design System/Date Inputs/DatePicker",
  component: DatePicker,
  tags: ["autodocs"],
  parameters: {
    docs: {
      description: {
        component:
          'The KendoReact Date Inputs enable the user to pick up dates for scheduling appointments. \n\n```javascript\nimport { DatePicker } 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: "text" },
      description:
        "Specifies the text that is rendered as title in the adaptive popup.",
    },
    ariaDescribedBy: {
      control: { type: "text" },
      description:
        "Identifies the element(s) which will describe the component, similar to HTML aria-describedby attribute.",
    },
    ariaLabel: {
      control: { type: "text" },
      description: "The accessible label of the component.",
    },
    ariaLabelledBy: {
      control: { type: "text" },
      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 DatePicker.",
    },
    className: {
      control: { type: "text" },
      description: "Sets the className of the DatePicker.",
    },
    dateInput: {
      control: { type: "object" },
      description:
        "Enables the customization or the override of the default DateInput which is rendered by the DatePicker.",
    },
    defaultShow: {
      control: { type: "boolean" },
      description: "Sets the default state of the DatePicker upon render.",
    },
    defaultValue: {
      control: { type: "date" },
      description: "Sets the default value of the DatePicker.",
    },
    disabled: {
      control: { type: "boolean" },
      description: "Determines whether the DatePicker is disabled.",
    },
    fillMode: {
      control: {
        type: "select",
        options: ["null", "flat", "outline", "solid"],
      },
      description: "Configures the fillMode of the DatePicker.",
    },
    focusedDate: {
      control: { type: "date" },
      description: "Specifies the focused date of the DatePicker.",
    },
    format: {
      control: { type: "text" },
      description:
        "Specifies the date format that is used to display the input value.",
    },
    formatPlaceholder: {
      control: { type: "object" },
      description:
        "Defines the descriptions of the format sections in the input field.",
    },
    id: {
      control: { type: "text" },
      description: "Specifies the id of the DatePicker.",
    },
    label: {
      control: { type: "text" },
      description: "Renders a floating label for the DatePicker.",
    },
    max: {
      control: { type: "date" },
      description: "Specifies the greatest valid date.",
    },
    min: {
      control: { type: "date" },
      description: "Specifies the smallest valid date.",
    },
    name: {
      control: { type: "text" },
      description: "Specifies the name property of the input DOM element.",
    },
    pickerWrap: {
      control: { type: "object" },
      description: "Customization or the override of the default PickerWrap.",
    },
    placeholder: {
      control: { type: "text" },
      description:
        "Specifies the hint the DateInput displays when its value is null or there is no partial selection.",
    },
    popup: {
      control: { type: "object" },
      description:
        "Enables the customization or the override of the default Popup which is rendered by the DatePicker.",
    },
    popupSettings: {
      control: { type: "object" },
      description: "Configures the popup options of the DatePicker.",
    },
    required: {
      control: { type: "boolean" },
      description: "Specifies if null is a valid value for the component.",
    },
    rounded: {
      control: {
        type: "select",
        options: ["null", "small", "medium", "full", "large"],
      },
      description: "Configures the roundness of the DatePicker.",
    },
    show: {
      control: { type: "boolean" },
      description: "Specifies if the calendar will be displayed.",
    },
    size: {
      control: {
        type: "select",
        options: ["null", "small", "medium", "large"],
      },
      description: "Configures the size of the DatePicker.",
    },
    tabIndex: {
      control: { type: "number" },
      description: "Sets the tabIndex property of the DatePicker.",
    },
    title: {
      control: { type: "text" },
      description: "Sets the title of the input element of the DatePicker.",
    },
    toggleButton: {
      control: { type: "object" },
      description:
        "Enables the customization or the override of the default Toggle button which is rendered by the DatePicker.",
    },
    valid: {
      control: { type: "boolean" },
      description: "Overrides the validity state of the component.",
    },
    validationMessage: {
      control: { type: "text" },
      description: "Controls the form error message of the component.",
    },
    validityStyles: {
      control: { type: "boolean" },
      description:
        "If set to false, no visual representation of the invalid state of the component will be applied.",
    },
    value: {
      control: { type: "date" },
      description: "Specifies the value of the DatePicker.",
    },
    weekNumber: {
      control: { type: "boolean" },
      description:
        "Determines whether to display a week number column in the month view of the Calendar.",
    },
    width: {
      control: { type: "text" },
      description: "Specifies the width of the DatePicker.",
    },
    onBlur: {
      control: { type: "action" },
      description:
        "Fires each time any of the DatePicker elements gets blurred.",
    },
    onChange: {
      control: { type: "action" },
      description: "Fires each time the user selects a new value.",
    },
    onClose: {
      control: { type: "action" },
      description: "Fires each time the popup is closed.",
    },
    onFocus: {
      control: { type: "action" },
      description:
        "Fires each time the user focuses any of the DatePicker elements.",
    },
    onOpen: {
      control: { type: "action" },
      description: "Fires each time the popup is opened.",
    },
  },
} as Meta;

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

Default.args = {
  dataTestId: "date-picker-data-testid",
  placeholder: "Choose a date...",
  disabled: false,
  format: "MM/dd/yyyy",
  formatPlaceholder: { year: "y", month: "M", day: "d" },
  label: "Date",
  width: "240px",
};
