@dr.pogodin/react-utils 1.43.23 → 1.43.24
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/TextArea/index.js +6 -1
- package/build/development/shared/components/TextArea/index.js.map +1 -1
- package/build/development/style.css +6 -1
- package/build/development/web.bundle.js +2 -2
- package/build/production/shared/components/TextArea/index.js +2 -2
- 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/TextArea/index.d.ts +2 -1
- package/build/types-scss/src/shared/components/TextArea/style.scss.d.ts +1 -0
- package/package.json +1 -1
- package/src/shared/components/TextArea/index.tsx +4 -0
- package/src/shared/components/TextArea/style.scss +7 -1
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { type ChangeEventHandler, type FocusEventHandler, type KeyboardEventHandler } from 'react';
|
|
2
2
|
import { type Theme } from '@dr.pogodin/react-themes';
|
|
3
|
-
type ThemeKeyT = 'container' | 'hidden' | 'textarea';
|
|
3
|
+
type ThemeKeyT = 'container' | 'hidden' | 'label' | 'textarea';
|
|
4
4
|
type Props = {
|
|
5
5
|
disabled?: boolean;
|
|
6
|
+
label?: string;
|
|
6
7
|
onBlur?: FocusEventHandler<HTMLTextAreaElement>;
|
|
7
8
|
onChange?: ChangeEventHandler<HTMLTextAreaElement>;
|
|
8
9
|
onKeyDown?: KeyboardEventHandler<HTMLTextAreaElement>;
|
package/package.json
CHANGED
|
@@ -16,10 +16,12 @@ import defaultTheme from './style.scss';
|
|
|
16
16
|
type ThemeKeyT =
|
|
17
17
|
| 'container'
|
|
18
18
|
| 'hidden'
|
|
19
|
+
| 'label'
|
|
19
20
|
| 'textarea';
|
|
20
21
|
|
|
21
22
|
type Props = {
|
|
22
23
|
disabled?: boolean;
|
|
24
|
+
label?: string;
|
|
23
25
|
onBlur?: FocusEventHandler<HTMLTextAreaElement>;
|
|
24
26
|
onChange?: ChangeEventHandler<HTMLTextAreaElement>;
|
|
25
27
|
onKeyDown?: KeyboardEventHandler<HTMLTextAreaElement>;
|
|
@@ -31,6 +33,7 @@ type Props = {
|
|
|
31
33
|
|
|
32
34
|
const TextArea: FunctionComponent<Props> = ({
|
|
33
35
|
disabled,
|
|
36
|
+
label,
|
|
34
37
|
onBlur,
|
|
35
38
|
onChange,
|
|
36
39
|
onKeyDown,
|
|
@@ -75,6 +78,7 @@ const TextArea: FunctionComponent<Props> = ({
|
|
|
75
78
|
|
|
76
79
|
return (
|
|
77
80
|
<div className={theme.container}>
|
|
81
|
+
{label === undefined ? null : <div className={theme.label}>{label}</div>}
|
|
78
82
|
<textarea
|
|
79
83
|
className={`${theme.textarea} ${theme.hidden}`}
|
|
80
84
|
|
|
@@ -8,6 +8,10 @@
|
|
|
8
8
|
position: relative;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
+
&.label {
|
|
12
|
+
margin: 0 0.3em;
|
|
13
|
+
}
|
|
14
|
+
|
|
11
15
|
&.textarea {
|
|
12
16
|
background: white;
|
|
13
17
|
border: 1px solid gray;
|
|
@@ -39,7 +43,9 @@
|
|
|
39
43
|
}
|
|
40
44
|
|
|
41
45
|
&.hidden {
|
|
46
|
+
// NOTE: We hide it this way, as setting "display: none" will interfere
|
|
47
|
+
// with measurements, making the hidden input height zero.
|
|
48
|
+
opacity: 0;
|
|
42
49
|
position: absolute;
|
|
43
|
-
z-index: -1;
|
|
44
50
|
}
|
|
45
51
|
}
|