import { Meta } from "@storybook/react";
import { ComboBoxProps } from "./ComboBoxProps";
import ComboBox from "./ComboBox";
export default {
  title: "Design System/Dropdowns/ComboBox",
  component: ComboBox,
  tags: ["autodocs"],
  parameters: {
    docs: {
      description: {
        component:
          'The KendoReact ComboBox 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, virtualization, and entering of custom values. \n\n```javascript\nimport { ComboBox } from "@renault-ui-library"\n```',
      },
    },
  },
  argTypes: {
    dataTestId: {
      control: { type: "text" },
      description: "Specifies the data-test-id attribute for testing purposes.",
    },
    id: {
      control: { type: "text" },
      description: "Specifies the id of the component.",
    },
    accessKey: {
      control: { type: "text" },
      description: "Specifies the accessKey of the ComboBox.",
    },
    adaptive: {
      control: { type: "boolean" },
      description:
        "Providing different rendering of the popup element based on the screen dimensions.",
    },
    adaptiveFilter: {
      control: { type: "text" },
      description:
        "Sets the value of the adaptive filtering input of the of ComboBox.",
    },
    adaptiveTitle: {
      control: { type: "text" },
      description:
        "Specifies the text that is rendered as title in the adaptive popup.",
    },
    allowCustom: {
      control: { type: "boolean" },
      description:
        "Specifies whether the ComboBox allows user-defined values that are not present in the dataset.",
    },
    ariaDescribedBy: {
      control: { type: "text" },
      description:
        "Identifies the element(s) which will describe the component, similar to HTML aria-describedby attribute.",
    },
    ariaLabelledBy: {
      control: { type: "text" },
      description: "Identifies the element(s) which will label the component.",
    },
    className: {
      control: { type: "text" },
      description: "Sets additional classes to the ComboBox.",
    },
    clearButton: {
      control: { type: "boolean" },
      description:
        "If clearButton is set to true, the ComboBox renders a button on hovering over the component.",
    },
    data: {
      control: { type: "object" },
      description: "Sets the data of the ComboBox.",
    },
    dataItemKey: {
      control: { type: "text" },
      description: "Sets the key for comparing the data items of the ComboBox.",
    },
    defaultValue: {
      control: { type: "text" },
      description:
        "Sets the default value of the ComboBox. Similar to the native select HTML element.",
    },
    dir: {
      control: { type: "text" },
      description: "Represents the dir HTML attribute.",
    },
    disabled: {
      control: { type: "boolean" },
      description: "Sets the disabled state of the ComboBox.",
    },
    fillMode: {
      control: { type: "text" },
      description: "Configures the fillMode of the ComboBox.",
    },
    filter: {
      control: { type: "text" },
      description: "Sets the value of ComboBox input.",
    },
    filterable: {
      control: { type: "boolean" },
      description: "Enables the filtering functionality of the ComboBox.",
    },
    footer: {
      control: { type: "text" },
      description: "Sets the footer component of the ComboBox.",
    },
    groupField: {
      control: { type: "text" },
      description:
        "Sets the data item field that represents the start of a group.",
    },
    groupMode: {
      control: { type: "text" },
      description:
        "Defines the classic or modern type of the grouping's visualization.",
    },
    header: {
      control: { type: "text" },
      description: "Sets the header component of the ComboBox.",
    },
    iconClassName: {
      control: { type: "text" },
      description: "Sets CSS classes to the expand icon DOM element.",
    },
    label: {
      control: { type: "text" },
      description: "Renders a floating label for the ComboBox.",
    },
    loading: {
      control: { type: "boolean" },
      description: "Sets the loading state of the ComboBox.",
    },
    name: {
      control: { type: "text" },
      description: "Specifies the name property of the input DOM element.",
    },
    opened: {
      control: { type: "boolean" },
      description: "Sets the opened and closed state of the ComboBox.",
    },
    placeholder: {
      control: { type: "text" },
      description: "The hint that is displayed when the ComboBox is empty.",
    },
    popupSettings: {
      control: { type: "object" },
      description: "Configures the popup of the ComboBox.",
    },
    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 ComboBox.",
    },
    size: {
      control: { type: "text" },
      description: "Configures the size of the ComboBox.",
    },
    skipDisabledItems: {
      control: { type: "boolean" },
      description:
        "Defines if Combobox'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 ComboBox.",
    },
    suggest: {
      control: { type: "boolean" },
      description:
        "Enables the auto-completion of the text based on the first data item.",
    },
    svgIcon: {
      control: { type: "object" },
      description: "Sets the specified SVG icon.",
    },
    tabIndex: {
      control: { type: "number" },
      description: "Specifies the tabIndex of the ComboBox.",
    },
    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 underlying input element of the ComboBox.",
    },
    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: "text" },
      description: "Sets the value of the ComboBox.",
    },
    virtual: {
      control: { type: "object" },
      description: "Configures the virtual scrolling of the ComboBox.",
    },
    onBlur: { action: "Fires each time the ComboBox gets blurred." },
    onChange: {
      action: "Fires each time the value of the ComboBox is about to change.",
    },
    onClose: {
      action: "Fires each time the popup of the ComboBox is about to close.",
    },
    onFilterChange: {
      action: "Fires each time the user types in the filter input.",
    },
    onFocus: { action: "Fires each time the user focuses the ComboBox." },
    onOpen: {
      action: "Fires each time the popup of the ComboBox is about to open.",
    },
    onPageChange: {
      action:
        "Fires when both the virtual scrolling of the ComboBox is enabled and the component requires data for another page.",
    },
    focusedItemIndex: {
      control: { type: "function" },
      description:
        "If set, the ComboBox will use it to get the focused item index.",
    },
    groupHeaderItemRender: {
      control: { type: "function" },
      description:
        "Fires when a ComboBox group header item is about to be rendered. Used to override the default appearance of the group headers.",
    },
    groupStickyHeaderItemRender: {
      control: { type: "function" },
      description:
        "Fires when a ComboBox sticky group header item is about to be rendered. Used to override the default appearance of the sticky group header.",
    },
    itemRender: {
      control: { type: "function" },
      description:
        "Fires when a ComboBox list item is about to be rendered. Used to override the default appearance of the list items.",
    },
    listNoDataRender: {
      control: { type: "function" },
      description:
        "Fires when the element which indicates no data in the popup is about to be rendered. Used to override the default appearance of the element.",
    },
    valueRender: {
      control: { type: "object" },
      description:
        "Fires when the ComboBox input element is about to be rendered. Use it to override the default appearance of the component",
    },
  },
} as Meta;
export const Default = (args: ComboBoxProps): JSX.Element => (
  <ComboBox {...args} />
);
Default.args = {
  dataTestId: "card-data-testid",
  data: [
    { id: 1, name: "Baseball" },
    { id: 2, name: "Football" },
    { id: 3, name: "Volleyball" },
  ],
  textField: "name",
};
