"use strict";

var _react = _interopRequireDefault(require("react"));

var _reactOuiIcons = _interopRequireDefault(require("react-oui-icons"));

var _react2 = require("@storybook/react");

var _addonActions = require("@storybook/addon-actions");

var _addonKnobs = require("@storybook/addon-knobs");

var _index = _interopRequireDefault(require("./index"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }

var stories = (0, _react2.storiesOf)("Forms|Input", module);
stories.addDecorator(_addonKnobs.withKnobs).addDecorator(function (story) {
  return _react["default"].createElement("div", {
    id: "root-preview"
  }, story());
});
stories.add("Input with knobs", function () {
  return _react["default"].createElement(_index["default"], {
    defaultValue: (0, _addonKnobs.text)("defaultValue", "some default value"),
    displayError: (0, _addonKnobs["boolean"])("displayError", false),
    hasSpellCheck: (0, _addonKnobs["boolean"])("hasSpellCheck", false),
    id: "input-01",
    isFilter: (0, _addonKnobs["boolean"])("isFilter", false),
    isDropdown: (0, _addonKnobs["boolean"])("isDropdown", true),
    isOptional: (0, _addonKnobs["boolean"])("isOptional", false),
    label: (0, _addonKnobs.text)("Label", "Always Include a Label"),
    max: (0, _addonKnobs.number)("max", 50),
    maxLength: (0, _addonKnobs.number)("maxLength", 250),
    min: (0, _addonKnobs.number)("min", 10),
    onChange: (0, _addonActions.action)("on change"),
    onBlur: (0, _addonActions.action)("on blur"),
    onKeyDown: (0, _addonActions.action)("on key press"),
    placeholder: (0, _addonKnobs.text)("placeholder", "just a placeholder"),
    isRequired: (0, _addonKnobs["boolean"])("isRequired", false),
    type: (0, _addonKnobs.select)("type", ["text", "password", "number", "date"], "text")
  });
}).add("Inputs", function () {
  return _react["default"].createElement("div", null, _react["default"].createElement("fieldset", null, _react["default"].createElement(_index["default"], {
    id: "input-01",
    label: "Field label",
    note: "A short description or note about this field.",
    placeholder: "Just a placeholder",
    type: "text"
  })), _react["default"].createElement("fieldset", null, _react["default"].createElement(_index["default"], {
    id: "input-02",
    label: "Label for required field",
    isRequired: true,
    note: "A short description or note about this field.",
    placeholder: "Just a placeholder",
    type: "text"
  })), _react["default"].createElement("fieldset", null, _react["default"].createElement(_index["default"], {
    id: "input-03",
    label: "Field label",
    placeholder: "Just a placeholder",
    type: "text"
  })), _react["default"].createElement("fieldset", null, _react["default"].createElement(_index["default"], {
    id: "input-04",
    label: "Field label",
    note: "A short description or note about this field.",
    placeholder: "Just a placeholder",
    type: "text"
  })), _react["default"].createElement("fieldset", null, _react["default"].createElement(_index["default"], {
    id: "input-05",
    label: "Field label",
    placeholder: "Just a placeholder",
    type: "text"
  })), _react["default"].createElement("fieldset", null, _react["default"].createElement(_index["default"], {
    id: "input-06",
    label: "Field label",
    placeholder: "Has an error",
    note: "A short description or note describing the error.",
    type: "text",
    displayError: true
  })), _react["default"].createElement("fieldset", null, _react["default"].createElement(_index["default"], {
    id: "input-07",
    label: "Start Time",
    type: "time"
  })));
}).add("Error states", function () {
  return _react["default"].createElement("div", null, _react["default"].createElement("fieldset", null, _react["default"].createElement(_index["default"], {
    id: "input-01",
    label: "Field label",
    displayError: true,
    note: "A short description or note about this field.",
    placeholder: "Just a placeholder",
    type: "text"
  })), _react["default"].createElement("fieldset", null, _react["default"].createElement(_index["default"], {
    id: "input-02",
    label: "Field label",
    displayError: true,
    placeholder: "Just a placeholder",
    type: "text"
  })), _react["default"].createElement("fieldset", null, _react["default"].createElement(_index["default"], {
    id: "input-03",
    label: "Field Label",
    displayError: true,
    note: "A short description or note about this field.",
    placeholder: "Just a placeholder",
    type: "text"
  })));
}).add("With Icons or Clear Button", function () {
  return _react["default"].createElement("div", {
    className: "flex flex--column flex-justified--between",
    style: {
      height: "500px"
    }
  }, _react["default"].createElement(_index["default"], {
    leftIconName: "search",
    id: "input-01",
    label: "With leftIconName",
    note: "A short description or note about this field.",
    placeholder: "Just a placeholder",
    type: "text"
  }), _react["default"].createElement(_index["default"], {
    rightIconName: "search",
    id: "input-02",
    label: "With rightIconName",
    note: "A short description or note about this field.",
    placeholder: "Just a placeholder",
    type: "text"
  }), _react["default"].createElement(_index["default"], {
    leftIconName: "calendar",
    rightIconName: "exclamation",
    id: "input-03",
    label: "With both leftIconName and rightIconName",
    note: "A short description or note about this field.",
    placeholder: "Just a placeholder",
    type: "text"
  }), _react["default"].createElement(_index["default"], {
    id: "input-03",
    label: "With RightContainer",
    note: "A short description or note about this field.",
    placeholder: "Just a placeholder",
    type: "text",
    RightContainer: RightContainer
  }), _react["default"].createElement(_index["default"], {
    id: "input-04",
    label: "Input with Clear Button",
    hasClearButton: true,
    placeholder: "Just a placeholder",
    type: "text"
  }), _react["default"].createElement(_index["default"], {
    id: "input-05",
    label: "Search with Icon and Clear Button",
    leftIconName: "search",
    hasClearButton: true,
    placeholder: "Just a placeholder",
    type: "text"
  }));
});

var RightContainer = function RightContainer() {
  return _react["default"].createElement(_reactOuiIcons["default"], {
    name: "align-right"
  });
};