import { Meta, Preview, Props, Story } from "@storybook/addon-docs/blocks";
import { boolean, object, text, withKnobs } from "@storybook/addon-knobs";
import SelectNoValidation from "../../SelectNoValidation";

<Meta title="Forms/SelectNoValidation" component={SelectNoValidation} decorators={[withKnobs]} />

# Select

## Demo

<Preview>
  <Story name="Demo"  parameters={{
    options: {
      showPanel: true
    }
  }}>
    {{
      components: {
        "h-select-no-validation": SelectNoValidation
      },
      props: {
        options: {
          default() {
            return object("options", {
              one: "one",
              two: "two",
              three: {
                value: "three",
                text: "three",
              },
              label: [
                "four",
                {
                  value: "five",
                  text: "five",
                },
                {
                  value: "six",
                  text: "six",
                },
              ],
            });
          },
        },
        placeholder: {
          default: text("placeholder", "Default placeholder"),
        },
        label: {
          default: text("label", "Default label"),
        },
        name: {
          default: text("name", "select-name"),
        },
        disabled: {
          default: boolean("disabled", false),
        },
        required: {
          default: boolean("required", false),
        },
      },
      data() {
        return {
          selected: null,
        };
      },
      template: `
        <div>
          <h-select-no-validation
            v-model="selected"
            :options="options"
            :required="required"
            :placeholder="placeholder"
            :label="label"
            :name="name"
            :disabled="disabled"
          />
          <div>selected = {{ selected }}</div>
        </div>
      `,
    }}
  </Story>
</Preview>

## Props

<Props of={SelectNoValidation} />
