var _examples$SIMPLE_EXAM;

function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }

function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }

/*
Copyright (c) 2018 Uber Technologies, Inc.

This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
*/
import * as React from 'react';
import { withStyle } from 'styletron-react';
import { styled } from '../styles/index.js';
import { withProps } from '../helpers/index.js';
import { StatefulTextarea as Textarea, Textarea as ControlledTextarea, StyledTextarea, SIZE } from './index.js';
import examples from './examples-list.js';
var Button = styled('button', function (_ref) {
  var $theme = _ref.$theme;
  return _objectSpread({}, $theme.typography.font300, {
    display: 'block',
    paddingTop: '10px',
    paddingRight: '12px',
    paddingBottom: '10px',
    paddingLeft: '12px',
    marginTop: '8px',
    width: '100%',
    borderRadius: $theme.sizing.scale100,
    borderWidth: 'none'
  });
});
Button.displayName = "Button";
var TextareaWithStyle = withStyle(StyledTextarea, function (props) {
  var $disabled = props.$disabled,
      $error = props.$error,
      $isFocused = props.$isFocused,
      _props$$theme = props.$theme,
      colors = _props$$theme.colors,
      sizing = _props$$theme.sizing;
  return {
    borderColor: $disabled ? colors.borderAlt : $error ? colors.borderError : $isFocused ? 'darkseagreen' : colors.border,
    boxShadow: "0 0 ".concat(sizing.scale100, " ").concat($disabled ? 'transparent' : $error ? colors.shadowError : $isFocused ? 'lightseagreen' : 'transparent')
  };
});
TextareaWithStyle.displayName = "TextareaWithStyle";
var TextareaWithProps = withProps(StyledTextarea, {
  'data-test': 'test'
});
export default (_examples$SIMPLE_EXAM = {}, _defineProperty(_examples$SIMPLE_EXAM, examples.SIMPLE_EXAMPLE, function Story1() {
  return React.createElement(React.Fragment, null, React.createElement(ControlledTextarea, {
    placeholder: "Controlled textarea"
  }), React.createElement("br", null), React.createElement(Textarea, {
    placeholder: "Uncontrolled textarea",
    initialState: {
      value: 'initial value'
    }
  }));
}), _defineProperty(_examples$SIMPLE_EXAM, examples.SIZE_EXAMPLE, function Story2() {
  return React.createElement(React.Fragment, null, React.createElement(Textarea, {
    placeholder: "Default textarea"
  }), React.createElement("br", null), React.createElement(Textarea, {
    size: SIZE.compact,
    placeholder: "Compact textarea"
  }));
}), _defineProperty(_examples$SIMPLE_EXAM, examples.STATE_EXAMPLE, function Story3() {
  return React.createElement(React.Fragment, null, React.createElement(Textarea, {
    size: SIZE.compact,
    placeholder: "Placeholder"
  }), React.createElement("br", null), React.createElement(Textarea, {
    size: SIZE.compact,
    placeholder: "Focused",
    autoFocus: true
  }), React.createElement("br", null), React.createElement(Textarea, {
    initialState: {
      value: 'uber'
    },
    size: SIZE.compact,
    placeholder: "Placeholder"
  }), React.createElement("br", null), React.createElement(Textarea, {
    size: SIZE.compact,
    error: true,
    placeholder: "Placeholder"
  }), React.createElement("br", null), React.createElement(Textarea, {
    size: SIZE.compact,
    disabled: true,
    placeholder: "Disabled textarea"
  }));
}), _defineProperty(_examples$SIMPLE_EXAM, examples.OVERRIDES_EXAMPLE, function Story4() {
  return React.createElement(React.Fragment, null, React.createElement(Textarea, {
    overrides: {
      Input: TextareaWithStyle
    },
    placeholder: "With style overrides on the textarea element"
  }), React.createElement("br", null), React.createElement(Textarea, {
    label: "Input with extra props",
    overrides: {
      Input: TextareaWithProps
    },
    placeholder: "With a 'data-test' attrs passes to the input element"
  }));
}), _defineProperty(_examples$SIMPLE_EXAM, examples.REF_EXAMPLE, function Story5() {
  var inputRef = React.createRef();
  return React.createElement(React.Fragment, null, React.createElement(Textarea, {
    inputRef: inputRef,
    placeholder: "With textarea input ref"
  }), React.createElement(Button, {
    onClick: function onClick() {
      inputRef.current && inputRef.current.focus();
    }
  }, "Click here to focus input"));
}), _examples$SIMPLE_EXAM);