1 | "use strict";
|
2 |
|
3 | var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
4 |
|
5 | exports.__esModule = true;
|
6 | exports["default"] = void 0;
|
7 |
|
8 | var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
9 |
|
10 | var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
11 |
|
12 | var _core = require("@emotion/core");
|
13 |
|
14 | var _react = require("react");
|
15 |
|
16 | var _FormControl = require("../FormControl");
|
17 |
|
18 | var _PseudoBox = _interopRequireDefault(require("../PseudoBox"));
|
19 |
|
20 | var _styles = _interopRequireDefault(require("./styles"));
|
21 |
|
22 |
|
23 | var Input = (0, _react.forwardRef)(function (props, ref) {
|
24 | var size = props.size,
|
25 | variant = props.variant,
|
26 | as = props.as,
|
27 | ariaLabel = props["aria-label"],
|
28 | ariaDescribedby = props["aria-describedby"],
|
29 | isReadOnly = props.isReadOnly,
|
30 | isFullWidth = props.isFullWidth,
|
31 | isDisabled = props.isDisabled,
|
32 | isInvalid = props.isInvalid,
|
33 | isRequired = props.isRequired,
|
34 | focusBorderColor = props.focusBorderColor,
|
35 | errorBorderColor = props.errorBorderColor,
|
36 | rest = (0, _objectWithoutPropertiesLoose2["default"])(props, ["size", "variant", "as", "aria-label", "aria-describedby", "isReadOnly", "isFullWidth", "isDisabled", "isInvalid", "isRequired", "focusBorderColor", "errorBorderColor"]);
|
37 | var inputStyleProps = (0, _styles["default"])(props);
|
38 | var formControl = (0, _FormControl.useFormControl)(props);
|
39 | return (0, _core.jsx)(_PseudoBox["default"], (0, _extends2["default"])({
|
40 | ref: ref,
|
41 | as: as,
|
42 | readOnly: formControl.isReadOnly,
|
43 | "aria-readonly": isReadOnly,
|
44 | disabled: formControl.isDisabled,
|
45 | "aria-label": ariaLabel,
|
46 | "aria-invalid": formControl.isInvalid,
|
47 | required: formControl.isRequired,
|
48 | "aria-required": formControl.isRequired,
|
49 | "aria-disabled": formControl.isDisabled,
|
50 | "aria-describedby": ariaDescribedby
|
51 | }, inputStyleProps, rest));
|
52 | });
|
53 | Input.displayName = "Input";
|
54 | Input.defaultProps = {
|
55 | size: "md",
|
56 | as: "input",
|
57 | variant: "outline",
|
58 | isFullWidth: true,
|
59 | focusBorderColor: "blue.500",
|
60 | errorBorderColor: "red.500"
|
61 | };
|
62 | var _default = Input;
|
63 | exports["default"] = _default; |
\ | No newline at end of file |