1 | "use strict";
|
2 |
|
3 | Object.defineProperty(exports, "__esModule", {
|
4 | value: true
|
5 | });
|
6 | exports.default = void 0;
|
7 |
|
8 | var _react = _interopRequireDefault(require("react"));
|
9 |
|
10 | var _propTypes = _interopRequireDefault(require("prop-types"));
|
11 |
|
12 | var _Shimmer = _interopRequireDefault(require("./Shimmer"));
|
13 |
|
14 | var _reactWithStyles = require("react-with-styles");
|
15 |
|
16 | var _withStyles = require("../helpers/withStyles");
|
17 |
|
18 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
19 |
|
20 | function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
21 |
|
22 | 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; }
|
23 |
|
24 | 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; }
|
25 |
|
26 | var propTypes = _objectSpread({}, _reactWithStyles.withStylesPropTypes, {
|
27 | actionLink: _propTypes.default.string,
|
28 | compact: _propTypes.default.bool,
|
29 | borderless: _propTypes.default.bool,
|
30 | disabled: _propTypes.default.bool,
|
31 | focusBorderless: _propTypes.default.bool,
|
32 | id: _propTypes.default.string,
|
33 | inline: _propTypes.default.bool,
|
34 | invalid: _propTypes.default.bool,
|
35 | inverse: _propTypes.default.bool,
|
36 | large: _propTypes.default.bool,
|
37 | maxLength: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]),
|
38 | minRows: _propTypes.default.number,
|
39 | name: _propTypes.default.string.isRequired,
|
40 | onBlur: _propTypes.default.func,
|
41 | onChange: _propTypes.default.func,
|
42 | onFocus: _propTypes.default.func,
|
43 | placeholder: _propTypes.default.string,
|
44 | readOnly: _propTypes.default.bool,
|
45 | removeMargins: _propTypes.default.bool,
|
46 | shimmer: _propTypes.default.bool,
|
47 | showCount: _propTypes.default.bool,
|
48 | showFakeValuePlaceholder: _propTypes.default.bool,
|
49 | showOverflowEllipsis: _propTypes.default.bool,
|
50 | small: _propTypes.default.bool,
|
51 | value: _propTypes.default.string
|
52 | });
|
53 |
|
54 | var defaultProps = {
|
55 | minRows: 4
|
56 | };
|
57 |
|
58 | var TextAreaOnly = function TextAreaOnly(_ref) {
|
59 | var actionLink = _ref.actionLink,
|
60 | compact = _ref.compact,
|
61 | borderless = _ref.borderless,
|
62 | css = _ref.css,
|
63 | disabled = _ref.disabled,
|
64 | extraPadding = _ref.extraPadding,
|
65 | focusBorderless = _ref.focusBorderless,
|
66 | id = _ref.id,
|
67 | inline = _ref.inline,
|
68 | invalid = _ref.invalid,
|
69 | inverse = _ref.inverse,
|
70 | large = _ref.large,
|
71 | maxLength = _ref.maxLength,
|
72 | minRows = _ref.minRows,
|
73 | name = _ref.name,
|
74 | onBlur = _ref.onBlur,
|
75 | onChange = _ref.onChange,
|
76 | onFocus = _ref.onFocus,
|
77 | placeholder = _ref.placeholder,
|
78 | readOnly = _ref.readOnly,
|
79 | removeMargins = _ref.removeMargins,
|
80 | shimmer = _ref.shimmer,
|
81 | showCount = _ref.showCount,
|
82 | showFakeValuePlaceholder = _ref.showFakeValuePlaceholder,
|
83 | showOverflowEllipsis = _ref.showOverflowEllipsis,
|
84 | small = _ref.small,
|
85 | styles = _ref.styles,
|
86 | value = _ref.value;
|
87 | return _react.default.createElement("div", css(styles.textAreaOnly, !inline && styles.block, borderless && styles.borderless, disabled && styles.textAreaOnly_disabled, invalid && styles.textAreaOnly_invalid, small && styles.textAreaOnly_small, removeMargins && styles.textAreaOnly_noMargin), shimmer && _react.default.createElement("div", css(styles.shimmer), _react.default.createElement(_Shimmer.default, {
|
88 | width: "100%",
|
89 | height: "100%"
|
90 | })), _react.default.createElement("textarea", _extends({}, css(styles.textAreaOnly__input, extraPadding && styles.textAreaOnly__input_extraPadding, showOverflowEllipsis && styles.textAreaOnly__input_ellipsis, showFakeValuePlaceholder ? styles.textAreaOnly__input_fakeValuePlaceholder : styles.textAreaOnly__input_defaultPlaceholder), {
|
91 | disabled: disabled,
|
92 | id: id,
|
93 | maxLength: maxLength,
|
94 | name: name,
|
95 | onBlur: onBlur,
|
96 | onChange: onChange,
|
97 | onFocus: onFocus,
|
98 | placeholder: placeholder,
|
99 | value: value,
|
100 | readOnly: readOnly,
|
101 | "aria-readonly": readOnly
|
102 | })));
|
103 | };
|
104 |
|
105 | TextAreaOnly.propTypes = propTypes;
|
106 | TextAreaOnly.defaultProps = defaultProps;
|
107 | var TextAreaOnlyWithStyles = (0, _withStyles.withStyles)(function (_ref2) {
|
108 | var input = _ref2.input,
|
109 | color = _ref2.color,
|
110 | units = _ref2.units;
|
111 | return {
|
112 | textAreaOnly: _objectSpread({}, input.default, {
|
113 | display: 'inline-flex',
|
114 | position: 'relative',
|
115 | zIndex: 0,
|
116 | flexWrap: 'nowrap',
|
117 | alignItems: 'center',
|
118 | ':focus-within': _objectSpread({}, input.focus)
|
119 | }),
|
120 | textAreaOnly_disabled: _objectSpread({}, input.disabled),
|
121 | textAreaOnly_invalid: _objectSpread({}, input.invalid),
|
122 | textAreaOnly_small: _objectSpread({}, input.small),
|
123 | textAreaOnly_noMargin: {
|
124 | marginTop: 0,
|
125 | marginRight: 0,
|
126 | marginBottom: 0,
|
127 | marginLeft: 0
|
128 | },
|
129 | textAreaOnly__input: _objectSpread({}, input.default, {
|
130 | border: 0,
|
131 | margin: 0,
|
132 | background: color.transparent,
|
133 | width: '100%',
|
134 | height: 'auto',
|
135 | paddingTop: input.verticalPadding,
|
136 | paddingRight: input.horizontalPadding,
|
137 | paddingBottom: input.verticalPadding,
|
138 | paddingLeft: input.horizontalPadding,
|
139 | boxSizing: 'border-box',
|
140 | '::-ms-clear': {
|
141 | display: 'none'
|
142 | },
|
143 | ':focus': {
|
144 | outline: 'none',
|
145 | boxShadow: 'none',
|
146 | border: 0
|
147 | }
|
148 | }),
|
149 | textAreaOnly__input_extraPadding: {},
|
150 | textAreaOnly__input_ellipsis: {
|
151 | textOverflow: 'ellipsis'
|
152 | },
|
153 | textAreaOnly__input_defaultPlaceholder: {
|
154 | '::placeholder': {
|
155 | color: input.placeholderColor,
|
156 | opacity: 1
|
157 | }
|
158 | },
|
159 | textAreaOnly__input_fakeValuePlaceholder: {
|
160 | '::placeholder': {
|
161 | color: input.color,
|
162 | opacity: 1
|
163 | }
|
164 | },
|
165 | textAreaOnly__input_inversePlaceholder: {
|
166 | '::placeholder': {
|
167 | color: color.white,
|
168 | opacity: 1
|
169 | }
|
170 | },
|
171 | block: {
|
172 | display: 'flex',
|
173 | width: '100%'
|
174 | },
|
175 | borderless: {
|
176 | borderColor: input.background
|
177 | },
|
178 | shimmer: {
|
179 | position: 'absolute',
|
180 | width: '100%',
|
181 | height: '100%',
|
182 | top: 0,
|
183 | right: 0,
|
184 | bottom: 0,
|
185 | left: 0
|
186 | }
|
187 | };
|
188 | })(TextAreaOnly);
|
189 | var _default = TextAreaOnlyWithStyles;
|
190 | exports.default = _default; |
\ | No newline at end of file |