import * as React from "react";
import { action } from "@storybook/addon-actions";
import { withKnobs, text, boolean, select } from "@storybook/addon-knobs";
import { IListItem } from "../FormFields/types";

import LiveFormField from "./LiveFormField";
import { FormFieldTypes } from "../types";

export default {
  title: "Modules|CRUD/FormBuilder/Loaders/LiveFormField",
  component: LiveFormField,
  excludeStories: /.*Data$/,
  decorators: [withKnobs],
};

const data: IListItem[] = [
  { id: "1", label: "Kyle" },
  { id: "2", label: "Linda" },
  { id: "3", label: "Mikel" },
  { id: "4", label: "Nevaeh" },
];

export const Default: any = () => (
  <LiveFormField
    type={select("Form Field Type", FormFieldTypes, FormFieldTypes.TEXT)}
    items={data}
  >
    Sample Content
  </LiveFormField>
);

Default.story = {
  parameters: {
    jest: ["LiveFormField"],
  },
};
