"use strict";

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

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

var _react2 = _interopRequireWildcard(require("react"));

var _ = require(".");

var _Box = require("../Box");

function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }

function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

var __jsx = _react2["default"].createElement;
var stories = (0, _react.storiesOf)('NumberInput', module);
stories.add('version2', function () {
  return __jsx(_Box.Box, {
    maxWidth: "sm",
    mx: "auto",
    mt: 5
  }, __jsx(_.NumberInput, {
    size: "sm",
    max: 35,
    min: 0,
    step: 4,
    onChange: (0, _addonActions.action)('onChange') // precision={2}

  }));
});

var ContolledEx = function ContolledEx() {
  var _useState = (0, _react2.useState)(null),
      val = _useState[0],
      setVal = _useState[1];

  return __jsx(_.NumberInput, {
    size: "md",
    max: 35,
    min: 0,
    step: 4,
    value: val,
    precision: 2,
    onChange: setVal
  }, __jsx(_.NumberInputField, null), __jsx(_.NumberInputStepper, null, __jsx(_.NumberIncrementStepper, null, "+"), __jsx(_.NumberDecrementStepper, null, "-")));
};

stories.add('v2 controlled', function () {
  return __jsx(_Box.Box, {
    maxWidth: "sm",
    mx: "auto",
    mt: 5
  }, __jsx(ContolledEx, null));
});
stories.add('allow out of range', function () {
  return __jsx(_Box.Box, {
    maxWidth: "sm",
    mx: "auto",
    mt: 5
  }, __jsx(_.NumberInput, {
    defaultValue: 15,
    max: 10,
    clampValueOnBlur: false,
    keepWithinRange: false
  }, __jsx(_.NumberInputField, null), __jsx(_.NumberInputStepper, null, __jsx(_.NumberIncrementStepper, null), __jsx(_.NumberDecrementStepper, null))));
});
//# sourceMappingURL=examples.js.map