@dr.pogodin/react-utils 1.43.28 → 1.43.29
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/build/development/shared/components/Input/index.js +25 -15
- package/build/development/shared/components/Input/index.js.map +1 -1
- package/build/development/shared/components/TextArea/index.js +5 -0
- package/build/development/shared/components/TextArea/index.js.map +1 -1
- package/build/development/style.css +2 -0
- package/build/development/web.bundle.js +2 -2
- package/build/production/shared/components/Input/index.js +6 -3
- package/build/production/shared/components/Input/index.js.map +1 -1
- package/build/production/shared/components/TextArea/index.js +3 -3
- package/build/production/shared/components/TextArea/index.js.map +1 -1
- package/build/production/style.css +1 -1
- package/build/production/style.css.map +1 -1
- package/build/production/web.bundle.js +1 -1
- package/build/production/web.bundle.js.map +1 -1
- package/build/types-code/shared/components/Input/index.d.ts +1 -1
- package/package.json +3 -3
- package/src/shared/components/Input/index.tsx +26 -14
- package/src/shared/components/Input/theme.scss +1 -0
- package/src/shared/components/TextArea/index.tsx +9 -1
- package/src/shared/components/selectors/NativeDropdown/theme.scss +1 -0
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.43.
|
|
2
|
+
"version": "1.43.29",
|
|
3
3
|
"bin": {
|
|
4
4
|
"react-utils-build": "bin/build.js",
|
|
5
5
|
"react-utils-setup": "bin/setup.js"
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"@dr.pogodin/react-helmet": "^3.0.2",
|
|
17
17
|
"@dr.pogodin/react-themes": "^1.9.2",
|
|
18
18
|
"@jest/environment": "^30.0.5",
|
|
19
|
-
"axios": "^1.
|
|
19
|
+
"axios": "^1.11.0",
|
|
20
20
|
"commander": "^14.0.0",
|
|
21
21
|
"compression": "^1.8.1",
|
|
22
22
|
"config": "^4.0.1",
|
|
@@ -107,7 +107,7 @@
|
|
|
107
107
|
"source-map-loader": "^5.0.0",
|
|
108
108
|
"stylelint": "^16.22.0",
|
|
109
109
|
"stylelint-config-standard-scss": "^15.0.1",
|
|
110
|
-
"supertest": "^7.1.
|
|
110
|
+
"supertest": "^7.1.4",
|
|
111
111
|
"tsc-alias": "1.8.16",
|
|
112
112
|
"tstyche": "^4.3.0",
|
|
113
113
|
"typed-scss-modules": "^8.1.1",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type FunctionComponent, type Ref, useRef } from 'react';
|
|
2
2
|
|
|
3
3
|
import themed, { type Theme } from '@dr.pogodin/react-themes';
|
|
4
4
|
|
|
@@ -27,19 +27,31 @@ const Input: FunctionComponent<PropsT> = ({
|
|
|
27
27
|
testId,
|
|
28
28
|
theme,
|
|
29
29
|
...rest
|
|
30
|
-
}) =>
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
<
|
|
34
|
-
className={theme.
|
|
35
|
-
|
|
36
|
-
|
|
30
|
+
}) => {
|
|
31
|
+
const localRef = useRef<HTMLInputElement>(null);
|
|
32
|
+
return (
|
|
33
|
+
<span
|
|
34
|
+
className={theme.container}
|
|
35
|
+
onFocus={() => {
|
|
36
|
+
// TODO: It does not really work if a callback-style `ref` is passed in,
|
|
37
|
+
// we need a more complex logic to cover that case, but for now this serves
|
|
38
|
+
// the case we need it for.
|
|
39
|
+
if (typeof ref === 'object') ref?.current?.focus();
|
|
40
|
+
else localRef.current?.focus();
|
|
41
|
+
}}
|
|
42
|
+
>
|
|
43
|
+
{label === undefined ? null : <div className={theme.label}>{label}</div>}
|
|
44
|
+
<input
|
|
45
|
+
className={theme.input}
|
|
46
|
+
data-testid={process.env.NODE_ENV === 'production' ? undefined : testId}
|
|
47
|
+
ref={ref ?? localRef}
|
|
37
48
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
);
|
|
49
|
+
// TODO: Avoid the spreading later.
|
|
50
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
51
|
+
{...rest}
|
|
52
|
+
/>
|
|
53
|
+
</span>
|
|
54
|
+
);
|
|
55
|
+
};
|
|
44
56
|
|
|
45
57
|
export default themed(Input, 'Input', defaultTheme);
|
|
@@ -41,6 +41,8 @@ const TextArea: FunctionComponent<Props> = ({
|
|
|
41
41
|
const hiddenAreaRef = useRef<HTMLTextAreaElement>(null);
|
|
42
42
|
const [height, setHeight] = useState<number | undefined>();
|
|
43
43
|
|
|
44
|
+
const textAreaRef = useRef<HTMLTextAreaElement>(null);
|
|
45
|
+
|
|
44
46
|
const [localValue, setLocalValue] = useState(value ?? '');
|
|
45
47
|
if (value !== undefined && localValue !== value) setLocalValue(value);
|
|
46
48
|
|
|
@@ -73,7 +75,12 @@ const TextArea: FunctionComponent<Props> = ({
|
|
|
73
75
|
}, [localValue]);
|
|
74
76
|
|
|
75
77
|
return (
|
|
76
|
-
<div
|
|
78
|
+
<div
|
|
79
|
+
className={theme.container}
|
|
80
|
+
onFocus={() => {
|
|
81
|
+
textAreaRef.current?.focus();
|
|
82
|
+
}}
|
|
83
|
+
>
|
|
77
84
|
{label === undefined ? null : <div className={theme.label}>{label}</div>}
|
|
78
85
|
<textarea
|
|
79
86
|
className={`${theme.textarea} ${theme.hidden}`}
|
|
@@ -111,6 +118,7 @@ const TextArea: FunctionComponent<Props> = ({
|
|
|
111
118
|
}
|
|
112
119
|
onKeyDown={onKeyDown}
|
|
113
120
|
placeholder={placeholder}
|
|
121
|
+
ref={textAreaRef}
|
|
114
122
|
style={{ height }}
|
|
115
123
|
value={localValue}
|
|
116
124
|
/>
|