import { Meta } from "@storybook/react";
import { DateInputProps } from "./DateInputProps";
import DateInput from "./DateInput";

export default {
  title: "Design System/Date Inputs/DateInput",
  component: DateInput,
  tags: ["autodocs"],
  parameters: {
    docs: {
      description: {
        component:
          'The KendoReact DateInput represents an input field that recognizes and formats scheduling values such as dates. \n\n```javascript\nimport { DateInput } from "@renault-ui-library"\n```',
      },
    },
  },
  argTypes: {
    dataTestId: {
      control: { type: "text" },
      description: "Specifies the data-test-id attribute for testing purposes.",
    },
    ariaControls: {
      control: { type: "text" },
      description:
        "Identifies the element whose contents or presence are controlled by the current element.",
    },
    ariaDescribedBy: {
      control: { type: "text" },
      description:
        "Identifies the element(s) which will describe the component, similar to HTML aria-describedby attribute.",
    },
    ariaExpanded: {
      control: { type: "boolean" },
      description:
        "Indicates whether the element is currently expanded or collapsed.",
    },
    ariaHasPopup: {
      control: { type: "text" },
      description:
        "Indicates the availability of interactive popup element that can be triggered by an element.",
    },
    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.",
    },
    ariaRole: {
      control: { type: "text" },
      description: "Specifies the role of the DateInput.",
    },
    className: {
      control: { type: "text" },
      description: "Sets a class of the DateInput DOM element.",
    },
    defaultValue: {
      control: { type: "date" },
      description: "Specifies the default value of the DateInput.",
    },
    dir: {
      control: { type: "text" },
      description: "Represents the dir HTML attribute.",
    },
    disabled: {
      control: { type: "boolean" },
      description: "Determines whether the DateInput is disabled.",
    },
    fillMode: {
      control: { type: "text" },
      description: "Configures the fillMode of the DateInput.",
    },
    format: {
      control: { type: "text" },
      description:
        "Specifies the date format which is used for formatting the value.",
    },
    formatPlaceholder: {
      control: { type: "text" },
      description:
        "Specifies the descriptions of the format sections in the input field.",
    },
    id: {
      control: { type: "text" },
      description: "Sets the id of the input DOM element.",
    },
    label: {
      control: { type: "text" },
      description: "Renders a floating label for the DateInput.",
    },
    max: {
      control: { type: "date" },
      description: "Specifies the greatest date that is valid.",
    },
    maxTime: {
      control: { type: "date" },
      description: "Specifies the greatest time that is valid.",
    },
    min: {
      control: { type: "date" },
      description: "Specifies the smallest date that is valid.",
    },
    minTime: {
      control: { type: "date" },
      description: "Specifies the smallest time that is valid.",
    },
    name: {
      control: { type: "text" },
      description: "Specifies the name property of the input DOM element.",
    },
    placeholder: {
      control: { type: "text" },
      description:
        "Specifies the hint the DateInput displays when its value is null or there is no partial selection.",
    },
    readonly: {
      control: { type: "boolean" },
      description:
        "Determines whether the DateInput is in its read-only state.",
    },
    required: {
      control: { type: "boolean" },
      description: "Specifies if null is a valid value for the component.",
    },
    rounded: {
      control: { type: "text" },
      description: "Configures the roundness of the DateInput.",
    },
    size: {
      control: { type: "text" },
      description: "Configures the size of the DateInput.",
    },
    spinners: {
      control: { type: "boolean" },
      description:
        "Specifies whether the Up and Down spin buttons will be rendered.",
    },
    steps: {
      control: { type: "object" },
      description: "Specifies the incremental steps of the DateInput.",
    },
    tabIndex: {
      control: { type: "number" },
      description: "Sets the tabIndex property of the DateInput.",
    },
    title: {
      control: { type: "text" },
      description: "Sets the title of the input element of the DateInput.",
    },
    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 DateInput.",
    },
    width: {
      control: { type: "text" },
      description: "Specifies the width of the DateInput.",
    },
    onChange: {
      control: { type: "function" },
      description:
        "Determines the event handler that will be fired when the user edits the value.",
    },
  },
} as Meta;

export const Default = (args: DateInputProps): JSX.Element => (
  <div>
    <p>Birth date:</p>
    <DateInput {...args} />
  </div>
);

Default.args = {
  dataTestId: "date-input-data-testid",
  placeholder: "Type in your birth date...",
  width: "240px",
};
