@octanejs/textarea-autosize 0.0.28 → 0.0.30
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/package.json +3 -3
- package/src/index.tsrx +27 -29
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@octanejs/textarea-autosize",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.30",
|
|
4
4
|
"description": "react-textarea-autosize for Octane with matching measurement and lifecycle behavior.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -100,7 +100,7 @@
|
|
|
100
100
|
"node": ">=22.22.2"
|
|
101
101
|
},
|
|
102
102
|
"peerDependencies": {
|
|
103
|
-
"octane": "^0.
|
|
103
|
+
"octane": "^0.12.0"
|
|
104
104
|
},
|
|
105
105
|
"devDependencies": {
|
|
106
106
|
"@babel/preset-env": "7.29.7",
|
|
@@ -115,7 +115,7 @@
|
|
|
115
115
|
"babel-jest": "30.4.1",
|
|
116
116
|
"jest": "30.4.2",
|
|
117
117
|
"jest-environment-jsdom": "30.4.1",
|
|
118
|
-
"octane": "0.
|
|
118
|
+
"octane": "0.12.0",
|
|
119
119
|
"playwright": "^1.61.1",
|
|
120
120
|
"react": "19.2.7",
|
|
121
121
|
"react-dom": "19.2.7",
|
package/src/index.tsrx
CHANGED
|
@@ -13,18 +13,16 @@ import {
|
|
|
13
13
|
import { noop } from './utils.js';
|
|
14
14
|
|
|
15
15
|
type NativeTextareaProps = JSX.IntrinsicElements['textarea'];
|
|
16
|
-
type TextareaStyle =
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
};
|
|
16
|
+
type TextareaStyle = Omit<CSSProperties, 'maxHeight' | 'minHeight'> & {
|
|
17
|
+
height?: number;
|
|
18
|
+
};
|
|
20
19
|
type TextareaRef =
|
|
21
20
|
((value: HTMLTextAreaElement | null) => void) | { current: HTMLTextAreaElement | null } | null;
|
|
22
21
|
// OCTANE DIVERGENCE[native-input-event][differential:input]
|
|
23
|
-
type TextareaAutosizeChangeEvent =
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
};
|
|
22
|
+
type TextareaAutosizeChangeEvent = InputEvent & {
|
|
23
|
+
currentTarget: HTMLTextAreaElement;
|
|
24
|
+
target: HTMLTextAreaElement;
|
|
25
|
+
};
|
|
28
26
|
export type TextareaHeightChangeMeta = { rowHeight: number };
|
|
29
27
|
export interface TextareaAutosizeProps extends Omit<
|
|
30
28
|
NativeTextareaProps,
|
|
@@ -40,27 +38,27 @@ export interface TextareaAutosizeProps extends Omit<
|
|
|
40
38
|
ref?: TextareaRef;
|
|
41
39
|
}
|
|
42
40
|
|
|
43
|
-
export default function TextareaAutosize(
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
}: TextareaAutosizeProps = {},
|
|
56
|
-
) @{
|
|
41
|
+
export default function TextareaAutosize({
|
|
42
|
+
cacheMeasurements,
|
|
43
|
+
maxRows,
|
|
44
|
+
minRows,
|
|
45
|
+
onChange = noop,
|
|
46
|
+
onChangeCapture = noop,
|
|
47
|
+
onHeightChange = noop,
|
|
48
|
+
onInput,
|
|
49
|
+
onInputCapture,
|
|
50
|
+
ref: userRef,
|
|
51
|
+
...props
|
|
52
|
+
}: TextareaAutosizeProps = {}) @{
|
|
57
53
|
if (isDevelopment && props.style) {
|
|
58
|
-
if (
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
54
|
+
if ('maxHeight' in props.style)
|
|
55
|
+
throw new Error(
|
|
56
|
+
'Using `style.maxHeight` for <TextareaAutosize/> is not supported. Please use `maxRows`.',
|
|
57
|
+
);
|
|
58
|
+
if ('minHeight' in props.style)
|
|
59
|
+
throw new Error(
|
|
60
|
+
'Using `style.minHeight` for <TextareaAutosize/> is not supported. Please use `minRows`.',
|
|
61
|
+
);
|
|
64
62
|
}
|
|
65
63
|
const isControlled = props.value !== undefined;
|
|
66
64
|
const libRef = useRef<HTMLTextAreaElement | null>(null);
|