import { Meta } from "@storybook/react";
import { DropDownListProps } from "./DropDownListProps";
import DropDownList from "./DropDownList";

export default {
  title: "Design System/Dropdowns/DropDownList",
  component: DropDownList,
  tags: ["autodocs"],
  parameters: {
    docs: {
      description: {
        component:
          'The KendoReact DropDownList is a form component that lets you choose a single predefined value from a list and is a richer version of the select element and supports filtering, default items, and virtualization. \n\n```javascript\nimport { DropDownList } from "@renault-ui-library"\n```',
      },
    },
  },
  argTypes: {
    dataTestId: {
      control: { type: "text" },
      description: "Specifies the data-test-id attribute for testing purposes.",
    },
    accessKey: {
      control: { type: "text" },
      description: "Specifies the accessKey of the DropDownList.",
    },
    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.",
    },
    className: {
      control: { type: "text" },
      description: "Sets additional classes to the DropDownList.",
    },
    data: {
      control: { type: "object" },
      description: "Sets the data of the DropDownList.",
    },
    dataItemKey: {
      control: { type: "text" },
      description:
        "Sets the key for comparing the data items of the DropDownList.",
    },
    defaultItem: {
      control: { type: "object" },
      description: "Sets the text of the default empty item.",
    },
    defaultValue: {
      control: { type: "object" },
      description: "Sets the default value of the DropDownList.",
    },
    delay: {
      control: { type: "number" },
      description: "Sets the delay before an item search is performed.",
    },
    dir: {
      control: { type: "text" },
      description: "Represents the dir HTML attribute.",
    },
    disabled: {
      control: { type: "boolean" },
      description: "Sets the disabled state of the DropDownList.",
    },
    fillMode: {
      control: {
        type: "select",
        options: ["null", "flat", "outline", "solid"],
      },
      description: "Configures the fillMode of the DropDownList.",
    },
    filter: {
      control: { type: "text" },
      description: "Sets the value of filtering input.",
    },
    filterable: {
      control: { type: "boolean" },
      description: "Enables the filtering functionality of the DropDownList.",
    },
    footer: {
      control: { type: "object" },
      description: "Sets the footer component of the DropDownList.",
    },
    groupField: {
      control: { type: "text" },
      description:
        "Sets the data item field that represents the start of a group.",
    },
    header: {
      control: { type: "object" },
      description: "Sets the header component of the DropDownList.",
    },
    iconClassName: {
      control: { type: "text" },
      description: "Sets CSS classes to the expand icon DOM element.",
    },
    id: {
      control: { type: "text" },
      description: "Specifies the id of the component.",
    },
    ignoreCase: {
      control: { type: "boolean" },
      description: "Enables a case-insensitive search.",
    },
    label: {
      control: { type: "text" },
      description: "Renders a floating label for the DropDownList.",
    },
    leftRightKeysNavigation: {
      control: { type: "boolean" },
      description:
        "If set to false, the DropDownList will not navigate over its data through left and right keys.",
    },
    loading: {
      control: { type: "boolean" },
      description: "Sets the loading state of the DropDownList.",
    },
    name: {
      control: { type: "text" },
      description: "Specifies the name property of the select DOM element.",
    },
    opened: {
      control: { type: "boolean" },
      description: "Sets the opened and closed state of the DropDownList.",
    },
    popupSettings: {
      control: { type: "object" },
      description: "Configures the popup of the DropDownList.",
    },
    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 DropDownList.",
    },
    size: {
      control: {
        type: "select",
        options: ["null", "small", "medium", "large"],
      },
      description: "Configures the size of the DropDownList.",
    },
    skipDisabledItems: {
      control: { type: "boolean" },
      description:
        "Defines if DropDownList's disabled items will be skipped or focused when navigating through the list of items using a keyboard.",
    },
    style: {
      control: { type: "object" },
      description: "The styles that are applied to the DropDownList.",
    },
    svgIcon: {
      control: { type: "object" },
      description: "Sets the specified SVG icon.",
    },
    tabIndex: {
      control: { type: "number" },
      description: "Specifies the tabIndex of the DropDownList.",
    },
    textField: {
      control: { type: "text" },
      description: "Sets the data item field that represents the item text.",
    },
    title: {
      control: { type: "text" },
      description: "Sets the title attribute to the DropDownList DOM element.",
    },
    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: "object" },
      description: "Sets the value of the DropDownList.",
    },
    virtual: {
      control: { type: "object" },
      description: "Configures the virtual scrolling of the DropDownList.",
    },
    focusedItemIndex: {
      control: { type: "function" },
      description:
        "If set, the DropDownList will use it to get the focused item index.",
    },
    groupHeaderItemRender: {
      control: { type: "function" },
      description:
        "Fires when a DropDownList's group header item is about to be rendered.",
    },
    groupStickyHeaderItemRender: {
      control: { type: "function" },
      description:
        "Fires when a DropDownList's sticky group header item is about to be rendered.",
    },
    itemRender: {
      control: { type: "function" },
      description: "Fires when a DropDownList item is about to be rendered.",
    },
    listNoDataRender: {
      control: { type: "function" },
      description:
        "Fires when the element which indicates no data in the popup is about to be rendered.",
    },
    onBlur: {
      control: { type: "function" },
      description: "Fires each time the DropDownList gets blurred.",
    },
    onChange: {
      control: { type: "function" },
      description:
        "Fires each time the value of the DropDownList is about to change.",
    },
    onClose: {
      control: { type: "function" },
      description:
        "Fires each time the popup of the DropDownList is about to close.",
    },
    onFilterChange: {
      control: { type: "function" },
      description: "Fires each time the user types in the filter input.",
    },
    onFocus: {
      control: { type: "function" },
      description: "Fires each time the DropDownList gets focused.",
    },
    onOpen: {
      control: { type: "function" },
      description:
        "Fires each time the popup of the DropDownList is about to open.",
    },
    onPageChange: {
      control: { type: "function" },
      description: "Fires when the DropDownList is about to paginate.",
    },
    valueMap: {
      control: { type: "function" },
      description:
        "If set, the DropDownList will use it to get the data items.",
    },
    valueRender: {
      control: { type: "function" },
      description: "Fires when the selected value is about to be rendered.",
    },
  },
} as Meta;

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

Default.args = {
  dataTestId: "dropdownlist-data-testid",
  data: ["Pizza", "Burger", "Pasta", "Burrito"],
  defaultValue: "Pizza",
  style: { width: "240px" },
  filterable: false,
  fillMode: "solid",
  rounded: "medium",
  size: "large",
  disabled: false,
  label: "Favorite Food",
};
