indicator-ui 0.0.207 → 0.0.208

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -12078,19 +12078,34 @@ __webpack_require__.r(__webpack_exports__);
12078
12078
  /* harmony export */ "default": () => (/* binding */ TextareaField)
12079
12079
  /* harmony export */ });
12080
12080
  /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react/jsx-runtime */ "./node_modules/react/jsx-runtime.js");
12081
- /* harmony import */ var clsx__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! clsx */ "./node_modules/clsx/dist/clsx.mjs");
12082
- /* harmony import */ var _styles__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../styles */ "./src/ui/InputFields/TextareaField/styles/index.ts");
12081
+ /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ "react");
12082
+ /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);
12083
+ /* harmony import */ var clsx__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! clsx */ "./node_modules/clsx/dist/clsx.mjs");
12084
+ /* harmony import */ var _styles__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../styles */ "./src/ui/InputFields/TextareaField/styles/index.ts");
12085
+
12083
12086
 
12084
12087
 
12085
12088
 
12086
- function TextareaField({ value, name, placeholder, onChange, required = false, disabled = false, isError = false, offFocus = false, additionStyles, }) {
12089
+ function TextareaField({ value, name, placeholder, onChange, required = false, disabled = false, isError = false, offFocus = false, autoResize = false, additionStyles, }) {
12090
+ const textareaRef = (0,react__WEBPACK_IMPORTED_MODULE_1__.useRef)(null);
12091
+ const resizeTextarea = () => {
12092
+ if (autoResize) {
12093
+ const textarea = textareaRef.current;
12094
+ if (textarea) {
12095
+ textarea.style.height = 'auto';
12096
+ textarea.style.height = textarea.scrollHeight + 'px';
12097
+ }
12098
+ }
12099
+ };
12100
+ (0,react__WEBPACK_IMPORTED_MODULE_1__.useEffect)(() => {
12101
+ resizeTextarea();
12102
+ }, []);
12087
12103
  const handleOnChange = (e) => {
12088
12104
  e.preventDefault();
12089
12105
  onChange && onChange(e.target.value);
12106
+ resizeTextarea();
12090
12107
  };
12091
- return ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("textarea", { name: name, placeholder: placeholder, value: value ?? undefined, onChange: handleOnChange, required: required, disabled: disabled, className: (0,clsx__WEBPACK_IMPORTED_MODULE_1__["default"])(_styles__WEBPACK_IMPORTED_MODULE_2__.TextareaFieldStyle.textareaField, {
12092
- [_styles__WEBPACK_IMPORTED_MODULE_2__.TextareaFieldStyle.isError]: isError,
12093
- }, additionStyles) }));
12108
+ return ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("textarea", { name: name, placeholder: placeholder, value: value, onChange: handleOnChange, required: required, disabled: disabled, className: (0,clsx__WEBPACK_IMPORTED_MODULE_2__["default"])(_styles__WEBPACK_IMPORTED_MODULE_3__.TextareaFieldStyle.textareaField, { [_styles__WEBPACK_IMPORTED_MODULE_3__.TextareaFieldStyle.isError]: isError }, additionStyles), ref: textareaRef }));
12094
12109
  }
12095
12110
 
12096
12111