pixelize-design-library 1.1.53 → 1.1.55
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.
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { NoteTextAreaProps } from "./NoteTextAreaProps";
|
|
3
|
-
export default function NoteTextArea({ width, handleSubmit, handleCancel, value, title, file, isEditable, saveButtonLoading, maxFileSize, maxFilesSizeError, maxNoteWordCount, }: NoteTextAreaProps): React.JSX.Element;
|
|
3
|
+
export default function NoteTextArea({ width, handleSubmit, handleCancel, value, title, file, isEditable, saveButtonLoading, maxFileSize, maxFilesSizeError, maxNoteWordCount, onChange, ref, }: NoteTextAreaProps): React.JSX.Element;
|
|
@@ -98,7 +98,7 @@ var countWords = function (text) {
|
|
|
98
98
|
return text.trim().split(/\s+/).length;
|
|
99
99
|
};
|
|
100
100
|
function NoteTextArea(_a) {
|
|
101
|
-
var _b = _a.width, width = _b === void 0 ? "100%" : _b, handleSubmit = _a.handleSubmit, handleCancel = _a.handleCancel, value = _a.value, title = _a.title, file = _a.file, _c = _a.isEditable, isEditable = _c === void 0 ? false : _c, saveButtonLoading = _a.saveButtonLoading, _d = _a.maxFileSize, maxFileSize = _d === void 0 ? 1 * 1024 * 1024 : _d, _e = _a.maxFilesSizeError, maxFilesSizeError = _e === void 0 ? "Some files are too large. Maximum allowed size is" : _e, _f = _a.maxNoteWordCount, maxNoteWordCount = _f === void 0 ? 15 : _f;
|
|
101
|
+
var _b = _a.width, width = _b === void 0 ? "100%" : _b, handleSubmit = _a.handleSubmit, handleCancel = _a.handleCancel, value = _a.value, title = _a.title, file = _a.file, _c = _a.isEditable, isEditable = _c === void 0 ? false : _c, saveButtonLoading = _a.saveButtonLoading, _d = _a.maxFileSize, maxFileSize = _d === void 0 ? 1 * 1024 * 1024 : _d, _e = _a.maxFilesSizeError, maxFilesSizeError = _e === void 0 ? "Some files are too large. Maximum allowed size is" : _e, _f = _a.maxNoteWordCount, maxNoteWordCount = _f === void 0 ? 15 : _f, onChange = _a.onChange, ref = _a.ref;
|
|
102
102
|
var theme = (0, useCustomTheme_1.useCustomTheme)();
|
|
103
103
|
var noteAreaRef = (0, react_1.useRef)(null);
|
|
104
104
|
var _g = (0, react_1.useState)(false), isActive = _g[0], setIsActive = _g[1];
|
|
@@ -169,6 +169,7 @@ function NoteTextArea(_a) {
|
|
|
169
169
|
};
|
|
170
170
|
var handleNoteChange = function (event) {
|
|
171
171
|
setNoteValue(event.target.value);
|
|
172
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(event.target.value);
|
|
172
173
|
adjustHeight();
|
|
173
174
|
};
|
|
174
175
|
(0, react_1.useEffect)(function () {
|
|
@@ -213,7 +214,7 @@ function NoteTextArea(_a) {
|
|
|
213
214
|
react_1.default.createElement(PlaceholderText, { isActive: !isActive, onClick: handleTextArea },
|
|
214
215
|
react_1.default.createElement("span", null, "Add a note...")),
|
|
215
216
|
react_1.default.createElement(TextAreaContainer, { isActive: isActive },
|
|
216
|
-
titleShow && (react_1.default.createElement(InputTitle, { value: titleValue, onChange: handleTitleChange, placeholder: "Add a title..." })),
|
|
217
|
+
titleShow && (react_1.default.createElement(InputTitle, { value: titleValue, onChange: handleTitleChange, placeholder: "Add a title...", ref: ref })),
|
|
217
218
|
react_1.default.createElement(NotesTextArea, { ref: noteAreaRef, isActive: isActive, noteValue: noteValue, value: noteValue, onChange: handleNoteChange, placeholder: "Add a note..." })),
|
|
218
219
|
isActive && (react_1.default.createElement(react_1.default.Fragment, null,
|
|
219
220
|
react_1.default.createElement("hr", { style: { margin: 0 } }),
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { LegacyRef } from "react";
|
|
1
2
|
export type NoteTextAreaProps = {
|
|
2
3
|
width: number | string;
|
|
3
4
|
handleSubmit: (noteValue: string, titleValue: string, file: File[], resetState: void) => void;
|
|
@@ -10,4 +11,6 @@ export type NoteTextAreaProps = {
|
|
|
10
11
|
maxFileSize?: number;
|
|
11
12
|
maxFilesSizeError?: string;
|
|
12
13
|
maxNoteWordCount?: number;
|
|
14
|
+
onChange?: (value: string) => void;
|
|
15
|
+
ref?: LegacyRef<HTMLInputElement>;
|
|
13
16
|
};
|