@dr.pogodin/react-utils 1.53.1 → 1.54.1
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/client/index.js +2 -0
- package/build/development/client/index.js.map +1 -1
- package/build/development/index.js +2 -2
- package/build/development/index.js.map +1 -1
- package/build/development/shared/components/Button/index.js +149 -71
- package/build/development/shared/components/Button/index.js.map +1 -1
- package/build/development/shared/components/Checkbox/index.js +77 -24
- package/build/development/shared/components/Checkbox/index.js.map +1 -1
- package/build/development/shared/components/GenericLink/index.js +133 -54
- package/build/development/shared/components/GenericLink/index.js.map +1 -1
- package/build/development/shared/components/Input/index.js +168 -45
- package/build/development/shared/components/Input/index.js.map +1 -1
- package/build/development/shared/components/Link.js +23 -13
- package/build/development/shared/components/Link.js.map +1 -1
- package/build/development/shared/components/Modal/index.js +203 -87
- package/build/development/shared/components/Modal/index.js.map +1 -1
- package/build/development/shared/components/NavLink.js +16 -7
- package/build/development/shared/components/NavLink.js.map +1 -1
- package/build/development/shared/components/PageLayout/index.js +77 -15
- package/build/development/shared/components/PageLayout/index.js.map +1 -1
- package/build/development/shared/components/TextArea/index.js +169 -68
- package/build/development/shared/components/TextArea/index.js.map +1 -1
- package/build/development/shared/components/Throbber/index.js +51 -13
- package/build/development/shared/components/Throbber/index.js.map +1 -1
- package/build/development/shared/components/WithTooltip/Tooltip.js +73 -34
- package/build/development/shared/components/WithTooltip/Tooltip.js.map +1 -1
- package/build/development/shared/components/WithTooltip/index.js +19 -19
- package/build/development/shared/components/WithTooltip/index.js.map +1 -1
- package/build/development/shared/components/YouTubeVideo/index.js +66 -23
- package/build/development/shared/components/YouTubeVideo/index.js.map +1 -1
- package/build/development/shared/components/selectors/CustomDropdown/Options/index.js +104 -56
- package/build/development/shared/components/selectors/CustomDropdown/Options/index.js.map +1 -1
- package/build/development/shared/components/selectors/CustomDropdown/index.js +173 -75
- package/build/development/shared/components/selectors/CustomDropdown/index.js.map +1 -1
- package/build/development/shared/components/selectors/Switch/index.js +86 -36
- package/build/development/shared/components/selectors/Switch/index.js.map +1 -1
- package/build/development/shared/utils/globalState.js +2 -2
- package/build/development/shared/utils/globalState.js.map +1 -1
- package/build/development/shared/utils/index.js +2 -2
- package/build/development/shared/utils/index.js.map +1 -1
- package/build/development/shared/utils/jest/index.js +19 -7
- package/build/development/shared/utils/jest/index.js.map +1 -1
- package/build/development/shared/utils/splitComponent.js +125 -55
- package/build/development/shared/utils/splitComponent.js.map +1 -1
- package/build/development/shared/utils/time.js +55 -20
- package/build/development/shared/utils/time.js.map +1 -1
- package/build/production/client/index.js +2 -2
- package/build/production/client/index.js.map +1 -1
- package/build/production/index.js +1 -1
- package/build/production/index.js.map +1 -1
- package/build/production/shared/components/Button/index.js +2 -13
- package/build/production/shared/components/Button/index.js.map +1 -1
- package/build/production/shared/components/Checkbox/index.js +1 -1
- package/build/production/shared/components/Checkbox/index.js.map +1 -1
- package/build/production/shared/components/GenericLink/index.js +2 -15
- package/build/production/shared/components/GenericLink/index.js.map +1 -1
- package/build/production/shared/components/Input/index.js +2 -11
- package/build/production/shared/components/Input/index.js.map +1 -1
- package/build/production/shared/components/Link.js +2 -4
- package/build/production/shared/components/Link.js.map +1 -1
- package/build/production/shared/components/Modal/index.js +2 -10
- package/build/production/shared/components/Modal/index.js.map +1 -1
- package/build/production/shared/components/NavLink.js +1 -4
- package/build/production/shared/components/NavLink.js.map +1 -1
- package/build/production/shared/components/PageLayout/index.js +2 -2
- package/build/production/shared/components/PageLayout/index.js.map +1 -1
- package/build/production/shared/components/TextArea/index.js +1 -21
- package/build/production/shared/components/TextArea/index.js.map +1 -1
- package/build/production/shared/components/Throbber/index.js +2 -2
- package/build/production/shared/components/Throbber/index.js.map +1 -1
- package/build/production/shared/components/WithTooltip/Tooltip.js +2 -7
- package/build/production/shared/components/WithTooltip/Tooltip.js.map +1 -1
- package/build/production/shared/components/WithTooltip/index.js +3 -3
- package/build/production/shared/components/WithTooltip/index.js.map +1 -1
- package/build/production/shared/components/YouTubeVideo/index.js +2 -5
- package/build/production/shared/components/YouTubeVideo/index.js.map +1 -1
- package/build/production/shared/components/selectors/CustomDropdown/Options/index.js +1 -6
- package/build/production/shared/components/selectors/CustomDropdown/Options/index.js.map +1 -1
- package/build/production/shared/components/selectors/CustomDropdown/index.js +1 -7
- package/build/production/shared/components/selectors/CustomDropdown/index.js.map +1 -1
- package/build/production/shared/components/selectors/Switch/index.js +1 -1
- package/build/production/shared/components/selectors/Switch/index.js.map +1 -1
- package/build/production/shared/utils/globalState.js +1 -1
- package/build/production/shared/utils/globalState.js.map +1 -1
- package/build/production/shared/utils/index.js +1 -1
- package/build/production/shared/utils/index.js.map +1 -1
- package/build/production/shared/utils/jest/index.js +10 -3
- package/build/production/shared/utils/jest/index.js.map +1 -1
- package/build/production/shared/utils/splitComponent.js +3 -10
- package/build/production/shared/utils/splitComponent.js.map +1 -1
- package/build/production/shared/utils/time.js +2 -2
- package/build/production/shared/utils/time.js.map +1 -1
- package/build/types-code/index.d.ts +2 -2
- package/build/types-code/shared/utils/globalState.d.ts +2 -2
- package/build/types-code/shared/utils/index.d.ts +2 -2
- package/build/types-code/shared/utils/splitComponent.d.ts +1 -0
- package/build/web/client/index.js +2 -2
- package/build/web/client/index.js.map +1 -1
- package/build/web/index.js +1 -1
- package/build/web/index.js.map +1 -1
- package/build/web/shared/components/Button/index.js +2 -13
- package/build/web/shared/components/Button/index.js.map +1 -1
- package/build/web/shared/components/Checkbox/index.js +1 -1
- package/build/web/shared/components/Checkbox/index.js.map +1 -1
- package/build/web/shared/components/GenericLink/index.js +2 -15
- package/build/web/shared/components/GenericLink/index.js.map +1 -1
- package/build/web/shared/components/Input/index.js +2 -11
- package/build/web/shared/components/Input/index.js.map +1 -1
- package/build/web/shared/components/Link.js +2 -4
- package/build/web/shared/components/Link.js.map +1 -1
- package/build/web/shared/components/Modal/index.js +2 -10
- package/build/web/shared/components/Modal/index.js.map +1 -1
- package/build/web/shared/components/NavLink.js +1 -4
- package/build/web/shared/components/NavLink.js.map +1 -1
- package/build/web/shared/components/PageLayout/index.js +2 -2
- package/build/web/shared/components/PageLayout/index.js.map +1 -1
- package/build/web/shared/components/TextArea/index.js +1 -21
- package/build/web/shared/components/TextArea/index.js.map +1 -1
- package/build/web/shared/components/Throbber/index.js +2 -2
- package/build/web/shared/components/Throbber/index.js.map +1 -1
- package/build/web/shared/components/WithTooltip/Tooltip.js +2 -7
- package/build/web/shared/components/WithTooltip/Tooltip.js.map +1 -1
- package/build/web/shared/components/WithTooltip/index.js +3 -3
- package/build/web/shared/components/WithTooltip/index.js.map +1 -1
- package/build/web/shared/components/YouTubeVideo/index.js +2 -5
- package/build/web/shared/components/YouTubeVideo/index.js.map +1 -1
- package/build/web/shared/components/selectors/CustomDropdown/Options/index.js +1 -6
- package/build/web/shared/components/selectors/CustomDropdown/Options/index.js.map +1 -1
- package/build/web/shared/components/selectors/CustomDropdown/index.js +1 -7
- package/build/web/shared/components/selectors/CustomDropdown/index.js.map +1 -1
- package/build/web/shared/components/selectors/Switch/index.js +1 -1
- package/build/web/shared/components/selectors/Switch/index.js.map +1 -1
- package/build/web/shared/utils/globalState.js +1 -1
- package/build/web/shared/utils/globalState.js.map +1 -1
- package/build/web/shared/utils/index.js +1 -1
- package/build/web/shared/utils/index.js.map +1 -1
- package/build/web/shared/utils/jest/index.js +10 -3
- package/build/web/shared/utils/jest/index.js.map +1 -1
- package/build/web/shared/utils/splitComponent.js +3 -10
- package/build/web/shared/utils/splitComponent.js.map +1 -1
- package/build/web/shared/utils/time.js +2 -2
- package/build/web/shared/utils/time.js.map +1 -1
- package/config/babel/webpack.d.ts +1 -0
- package/config/babel/webpack.js +10 -12
- package/package.json +6 -4
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { c as _c } from "react/compiler-runtime";
|
|
1
2
|
import { useEffect, useLayoutEffect, useRef, useState } from "react";
|
|
2
3
|
import { useTheme } from "@dr.pogodin/react-themes";
|
|
3
4
|
const defaultTheme = {
|
|
@@ -12,94 +13,194 @@ const defaultTheme = {
|
|
|
12
13
|
"hidden": "-dr-pogodin-react-utils___build-web-shared-components-TextArea-style___hidden___-UyujK"
|
|
13
14
|
};
|
|
14
15
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
15
|
-
const TextArea =
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
16
|
+
const TextArea = t0 => {
|
|
17
|
+
const $ = _c(36);
|
|
18
|
+
const {
|
|
19
|
+
disabled,
|
|
20
|
+
error,
|
|
21
|
+
label,
|
|
22
|
+
onBlur,
|
|
23
|
+
onChange,
|
|
24
|
+
onKeyDown,
|
|
25
|
+
placeholder,
|
|
26
|
+
testId,
|
|
27
|
+
theme,
|
|
28
|
+
value
|
|
29
|
+
} = t0;
|
|
27
30
|
const custom = useTheme("TextArea", defaultTheme, theme);
|
|
28
31
|
const hiddenAreaRef = useRef(null);
|
|
29
32
|
const [height, setHeight] = useState();
|
|
30
33
|
const textAreaRef = useRef(null);
|
|
31
34
|
const [localValue, setLocalValue] = useState(value ?? "");
|
|
32
|
-
if (value !== undefined && localValue !== value)
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
if (value !== undefined && localValue !== value) {
|
|
36
|
+
setLocalValue(value);
|
|
37
|
+
}
|
|
38
|
+
let t1;
|
|
39
|
+
let t2;
|
|
40
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
41
|
+
t1 = () => {
|
|
42
|
+
const el = hiddenAreaRef.current;
|
|
43
|
+
if (!el) {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
const cb = () => {
|
|
47
|
+
setHeight(el.scrollHeight);
|
|
48
|
+
};
|
|
49
|
+
const observer = new ResizeObserver(cb);
|
|
50
|
+
observer.observe(el);
|
|
51
|
+
return () => {
|
|
52
|
+
observer.disconnect();
|
|
53
|
+
};
|
|
38
54
|
};
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
55
|
+
t2 = [];
|
|
56
|
+
$[0] = t1;
|
|
57
|
+
$[1] = t2;
|
|
58
|
+
} else {
|
|
59
|
+
t1 = $[0];
|
|
60
|
+
t2 = $[1];
|
|
61
|
+
}
|
|
62
|
+
useEffect(t1, t2);
|
|
63
|
+
let t3;
|
|
64
|
+
if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
|
|
65
|
+
t3 = () => {
|
|
66
|
+
const el_0 = hiddenAreaRef.current;
|
|
67
|
+
if (el_0) {
|
|
68
|
+
setHeight(el_0.scrollHeight);
|
|
69
|
+
}
|
|
43
70
|
};
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
71
|
+
$[2] = t3;
|
|
72
|
+
} else {
|
|
73
|
+
t3 = $[2];
|
|
74
|
+
}
|
|
75
|
+
let t4;
|
|
76
|
+
if ($[3] !== localValue) {
|
|
77
|
+
t4 = [localValue];
|
|
78
|
+
$[3] = localValue;
|
|
79
|
+
$[4] = t4;
|
|
80
|
+
} else {
|
|
81
|
+
t4 = $[4];
|
|
82
|
+
}
|
|
83
|
+
useLayoutEffect(t3, t4);
|
|
55
84
|
let containerClassName = custom.container;
|
|
56
|
-
if (error)
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
85
|
+
if (error) {
|
|
86
|
+
containerClassName = containerClassName + ` ${custom.error}`;
|
|
87
|
+
}
|
|
88
|
+
let t5;
|
|
89
|
+
if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
|
|
90
|
+
t5 = () => {
|
|
60
91
|
textAreaRef.current?.focus();
|
|
61
|
-
}
|
|
62
|
-
|
|
92
|
+
};
|
|
93
|
+
$[5] = t5;
|
|
94
|
+
} else {
|
|
95
|
+
t5 = $[5];
|
|
96
|
+
}
|
|
97
|
+
let t6;
|
|
98
|
+
if ($[6] !== custom.label || $[7] !== label) {
|
|
99
|
+
t6 = label === undefined ? null : /*#__PURE__*/_jsx("div", {
|
|
63
100
|
className: custom.label,
|
|
64
101
|
children: label
|
|
65
|
-
})
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
102
|
+
});
|
|
103
|
+
$[6] = custom.label;
|
|
104
|
+
$[7] = label;
|
|
105
|
+
$[8] = t6;
|
|
106
|
+
} else {
|
|
107
|
+
t6 = $[8];
|
|
108
|
+
}
|
|
109
|
+
const t7 = `${custom.textarea} ${custom.hidden}`;
|
|
110
|
+
const t8 = localValue || " ";
|
|
111
|
+
let t9;
|
|
112
|
+
if ($[9] !== t7 || $[10] !== t8) {
|
|
113
|
+
t9 = /*#__PURE__*/_jsx("textarea", {
|
|
114
|
+
className: t7,
|
|
70
115
|
readOnly: true,
|
|
71
|
-
ref: hiddenAreaRef
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
116
|
+
ref: hiddenAreaRef,
|
|
117
|
+
tabIndex: -1,
|
|
118
|
+
value: t8
|
|
119
|
+
});
|
|
120
|
+
$[9] = t7;
|
|
121
|
+
$[10] = t8;
|
|
122
|
+
$[11] = t9;
|
|
123
|
+
} else {
|
|
124
|
+
t9 = $[11];
|
|
125
|
+
}
|
|
126
|
+
const t10 = process.env.NODE_ENV === "production" ? undefined : testId;
|
|
127
|
+
let t11;
|
|
128
|
+
if ($[12] !== onChange || $[13] !== value) {
|
|
129
|
+
t11 = value === undefined ? e => {
|
|
130
|
+
setLocalValue(e.target.value);
|
|
131
|
+
} : onChange;
|
|
132
|
+
$[12] = onChange;
|
|
133
|
+
$[13] = value;
|
|
134
|
+
$[14] = t11;
|
|
135
|
+
} else {
|
|
136
|
+
t11 = $[14];
|
|
137
|
+
}
|
|
138
|
+
let t12;
|
|
139
|
+
if ($[15] !== height) {
|
|
140
|
+
t12 = {
|
|
141
|
+
height
|
|
142
|
+
};
|
|
143
|
+
$[15] = height;
|
|
144
|
+
$[16] = t12;
|
|
145
|
+
} else {
|
|
146
|
+
t12 = $[16];
|
|
147
|
+
}
|
|
148
|
+
let t13;
|
|
149
|
+
if ($[17] !== custom.textarea || $[18] !== disabled || $[19] !== localValue || $[20] !== onBlur || $[21] !== onKeyDown || $[22] !== placeholder || $[23] !== t10 || $[24] !== t11 || $[25] !== t12) {
|
|
150
|
+
t13 = /*#__PURE__*/_jsx("textarea", {
|
|
81
151
|
className: custom.textarea,
|
|
82
|
-
"data-testid":
|
|
152
|
+
"data-testid": t10,
|
|
83
153
|
disabled: disabled,
|
|
84
|
-
onBlur: onBlur
|
|
85
|
-
|
|
86
|
-
// to work.
|
|
87
|
-
,
|
|
88
|
-
onChange: value === undefined ? e => {
|
|
89
|
-
setLocalValue(e.target.value);
|
|
90
|
-
} : onChange,
|
|
154
|
+
onBlur: onBlur,
|
|
155
|
+
onChange: t11,
|
|
91
156
|
onKeyDown: onKeyDown,
|
|
92
157
|
placeholder: placeholder,
|
|
93
158
|
ref: textAreaRef,
|
|
94
|
-
style:
|
|
95
|
-
height
|
|
96
|
-
},
|
|
159
|
+
style: t12,
|
|
97
160
|
value: localValue
|
|
98
|
-
})
|
|
161
|
+
});
|
|
162
|
+
$[17] = custom.textarea;
|
|
163
|
+
$[18] = disabled;
|
|
164
|
+
$[19] = localValue;
|
|
165
|
+
$[20] = onBlur;
|
|
166
|
+
$[21] = onKeyDown;
|
|
167
|
+
$[22] = placeholder;
|
|
168
|
+
$[23] = t10;
|
|
169
|
+
$[24] = t11;
|
|
170
|
+
$[25] = t12;
|
|
171
|
+
$[26] = t13;
|
|
172
|
+
} else {
|
|
173
|
+
t13 = $[26];
|
|
174
|
+
}
|
|
175
|
+
let t14;
|
|
176
|
+
if ($[27] !== custom.errorMessage || $[28] !== error) {
|
|
177
|
+
t14 = error && error !== true ? /*#__PURE__*/_jsx("div", {
|
|
99
178
|
className: custom.errorMessage,
|
|
100
179
|
children: error
|
|
101
|
-
}) : null
|
|
102
|
-
|
|
180
|
+
}) : null;
|
|
181
|
+
$[27] = custom.errorMessage;
|
|
182
|
+
$[28] = error;
|
|
183
|
+
$[29] = t14;
|
|
184
|
+
} else {
|
|
185
|
+
t14 = $[29];
|
|
186
|
+
}
|
|
187
|
+
let t15;
|
|
188
|
+
if ($[30] !== containerClassName || $[31] !== t13 || $[32] !== t14 || $[33] !== t6 || $[34] !== t9) {
|
|
189
|
+
t15 = /*#__PURE__*/_jsxs("div", {
|
|
190
|
+
className: containerClassName,
|
|
191
|
+
onFocus: t5,
|
|
192
|
+
children: [t6, t9, t13, t14]
|
|
193
|
+
});
|
|
194
|
+
$[30] = containerClassName;
|
|
195
|
+
$[31] = t13;
|
|
196
|
+
$[32] = t14;
|
|
197
|
+
$[33] = t6;
|
|
198
|
+
$[34] = t9;
|
|
199
|
+
$[35] = t15;
|
|
200
|
+
} else {
|
|
201
|
+
t15 = $[35];
|
|
202
|
+
}
|
|
203
|
+
return t15;
|
|
103
204
|
};
|
|
104
205
|
export default TextArea;
|
|
105
206
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["useEffect","useLayoutEffect","useRef","useState","useTheme","defaultTheme","jsx","_jsx","jsxs","_jsxs","TextArea","disabled","error","label","onBlur","onChange","onKeyDown","placeholder","testId","theme","value","custom","hiddenAreaRef","height","setHeight","textAreaRef","localValue","setLocalValue","undefined","el","current","cb","scrollHeight","observer","ResizeObserver","observe","disconnect","containerClassName","container","className","onFocus","focus","children","textarea","hidden","readOnly","ref","tabIndex","process","env","NODE_ENV","e","target","style","errorMessage"],"sources":["../../../../../src/shared/components/TextArea/index.tsx"],"sourcesContent":["import {\n type ChangeEventHandler,\n type FocusEventHandler,\n type FunctionComponent,\n type KeyboardEventHandler,\n type ReactNode,\n useEffect,\n useLayoutEffect,\n useRef,\n useState,\n} from 'react';\n\nimport { type Theme, useTheme } from '@dr.pogodin/react-themes';\n\nimport defaultTheme from './style.scss';\n\ntype ThemeKeyT = 'container' | 'error' | 'errorMessage' | 'hidden' | 'label'\n | 'textarea';\n\ntype Props = {\n disabled?: boolean;\n error?: ReactNode;\n label?: string;\n onBlur?: FocusEventHandler<HTMLTextAreaElement>;\n onChange?: ChangeEventHandler<HTMLTextAreaElement>;\n onKeyDown?: KeyboardEventHandler<HTMLTextAreaElement>;\n placeholder?: string;\n testId?: string;\n theme?: Theme<ThemeKeyT>;\n value?: string;\n};\n\nconst TextArea: FunctionComponent<Props> = ({\n disabled,\n error,\n label,\n onBlur,\n onChange,\n onKeyDown,\n placeholder,\n testId,\n theme,\n value,\n}) => {\n const custom = useTheme('TextArea', defaultTheme, theme);\n\n const hiddenAreaRef = useRef<HTMLTextAreaElement>(null);\n const [height, setHeight] = useState<number | undefined>();\n\n const textAreaRef = useRef<HTMLTextAreaElement>(null);\n\n const [localValue, setLocalValue] = useState(value ?? '');\n if (value !== undefined && localValue !== value) setLocalValue(value);\n\n // This resizes text area's height when its width is changed for any reason.\n useEffect(() => {\n const el = hiddenAreaRef.current;\n if (!el) return undefined;\n\n const cb = () => {\n setHeight(el.scrollHeight);\n };\n const observer = new ResizeObserver(cb);\n observer.observe(el);\n\n return () => {\n observer.disconnect();\n };\n }, []);\n\n // Resizes the text area when its content is modified.\n //\n // NOTE: useLayoutEffect() instead of useEffect() makes difference here,\n // as it helps to avoid visible \"content/height\" jumps (i.e. with just\n // useEffect() it becomes visible how the content is modified first,\n // and then input height is incremented, if necessary).\n // See: https://github.com/birdofpreyru/react-utils/issues/313\n useLayoutEffect(() => {\n const el = hiddenAreaRef.current;\n if (el) setHeight(el.scrollHeight);\n }, [localValue]);\n\n let containerClassName = custom.container;\n if (error) containerClassName += ` ${custom.error}`;\n\n return (\n <div\n className={containerClassName}\n onFocus={() => {\n textAreaRef.current?.focus();\n }}\n >\n {label === undefined ? null : <div className={custom.label}>{label}</div>}\n <textarea\n className={`${custom.textarea} ${custom.hidden}`}\n\n // This text area is hidden underneath the primary one below,\n // and it is used for text measurements, to implement auto-scaling\n // of the primary textarea's height.\n readOnly\n ref={hiddenAreaRef}\n\n // The \"-1\" value of \"tabIndex\" removes this hidden text area from\n // the tab-focus-chain.\n tabIndex={-1}\n\n // NOTE: With empty string value (\"\") the scrolling height of this text\n // area is zero, thus collapsing <TextArea> height below the single line\n // input height. To avoid it we fallback to whitespace (\" \") character\n // here.\n value={localValue || ' '}\n />\n <textarea\n className={custom.textarea}\n data-testid={process.env.NODE_ENV === 'production' ? undefined : testId}\n disabled={disabled}\n onBlur={onBlur}\n\n // When value is \"undefined\" the text area is not-managed, and we should\n // manage it internally for the measurement / resizing functionality\n // to work.\n onChange={\n value === undefined\n ? (e) => {\n setLocalValue(e.target.value);\n } : onChange\n }\n onKeyDown={onKeyDown}\n placeholder={placeholder}\n ref={textAreaRef}\n style={{ height }}\n value={localValue}\n />\n {error && error !== true\n ? <div className={custom.errorMessage}>{error}</div>\n : null}\n </div>\n );\n};\n\nexport default TextArea;\n"],"mappings":"AAAA,SAMEA,SAAS,EACTC,eAAe,EACfC,MAAM,EACNC,QAAQ,QACH,OAAO;AAEd,SAAqBC,QAAQ,QAAQ,0BAA0B;AAE/D,MAAAC,YAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;AAAA;AAAwC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAkBxC,MAAMC,QAAkC,GAAGA,CAAC;EAC1CC,QAAQ;EACRC,KAAK;EACLC,KAAK;EACLC,MAAM;EACNC,QAAQ;EACRC,SAAS;EACTC,WAAW;EACXC,MAAM;EACNC,KAAK;EACLC;AACF,CAAC,KAAK;EACJ,MAAMC,MAAM,GAAGjB,QAAQ,CAAC,U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outEffect","useRef","useState","useTheme","defaultTheme","jsx","_jsx","jsxs","_jsxs","TextArea","t0","$","_c","disabled","error","label","onBlur","onChange","onKeyDown","placeholder","testId","theme","value","custom","hiddenAreaRef","height","setHeight","textAreaRef","localValue","setLocalValue","undefined","t1","t2","Symbol","for","el","current","cb","scrollHeight","observer","ResizeObserver","observe","disconnect","t3","el_0","t4","containerClassName","container","t5","focus","t6","className","children","t7","textarea","hidden","t8","t9","readOnly","ref","tabIndex","t10","process","env","NODE_ENV","t11","e","target","t12","t13","style","t14","errorMessage","t15","onFocus"],"sources":["../../../../../src/shared/components/TextArea/index.tsx"],"sourcesContent":["import {\n type ChangeEventHandler,\n type FocusEventHandler,\n type FunctionComponent,\n type KeyboardEventHandler,\n type ReactNode,\n useEffect,\n useLayoutEffect,\n useRef,\n useState,\n} from 'react';\n\nimport { type Theme, useTheme } from '@dr.pogodin/react-themes';\n\nimport defaultTheme from './style.scss';\n\ntype ThemeKeyT = 'container' | 'error' | 'errorMessage' | 'hidden' | 'label'\n | 'textarea';\n\ntype Props = {\n disabled?: boolean;\n error?: ReactNode;\n label?: string;\n onBlur?: FocusEventHandler<HTMLTextAreaElement>;\n onChange?: ChangeEventHandler<HTMLTextAreaElement>;\n onKeyDown?: KeyboardEventHandler<HTMLTextAreaElement>;\n placeholder?: string;\n testId?: string;\n theme?: Theme<ThemeKeyT>;\n value?: string;\n};\n\nconst TextArea: FunctionComponent<Props> = ({\n disabled,\n error,\n label,\n onBlur,\n onChange,\n onKeyDown,\n placeholder,\n testId,\n theme,\n value,\n}) => {\n const custom = useTheme('TextArea', defaultTheme, theme);\n\n const hiddenAreaRef = useRef<HTMLTextAreaElement>(null);\n const [height, setHeight] = useState<number | undefined>();\n\n const textAreaRef = useRef<HTMLTextAreaElement>(null);\n\n const [localValue, setLocalValue] = useState(value ?? '');\n if (value !== undefined && localValue !== value) setLocalValue(value);\n\n // This resizes text area's height when its width is changed for any reason.\n useEffect(() => {\n const el = hiddenAreaRef.current;\n if (!el) return undefined;\n\n const cb = () => {\n setHeight(el.scrollHeight);\n };\n const observer = new ResizeObserver(cb);\n observer.observe(el);\n\n return () => {\n observer.disconnect();\n };\n }, []);\n\n // Resizes the text area when its content is modified.\n //\n // NOTE: useLayoutEffect() instead of useEffect() makes difference here,\n // as it helps to avoid visible \"content/height\" jumps (i.e. with just\n // useEffect() it becomes visible how the content is modified first,\n // and then input height is incremented, if necessary).\n // See: https://github.com/birdofpreyru/react-utils/issues/313\n useLayoutEffect(() => {\n const el = hiddenAreaRef.current;\n if (el) setHeight(el.scrollHeight);\n }, [localValue]);\n\n let containerClassName = custom.container;\n if (error) containerClassName += ` ${custom.error}`;\n\n return (\n <div\n className={containerClassName}\n onFocus={() => {\n textAreaRef.current?.focus();\n }}\n >\n {label === undefined ? null : <div className={custom.label}>{label}</div>}\n <textarea\n className={`${custom.textarea} ${custom.hidden}`}\n\n // This text area is hidden underneath the primary one below,\n // and it is used for text measurements, to implement auto-scaling\n // of the primary textarea's height.\n readOnly\n ref={hiddenAreaRef}\n\n // The \"-1\" value of \"tabIndex\" removes this hidden text area from\n // the tab-focus-chain.\n tabIndex={-1}\n\n // NOTE: With empty string value (\"\") the scrolling height of this text\n // area is zero, thus collapsing <TextArea> height below the single line\n // input height. To avoid it we fallback to whitespace (\" \") character\n // here.\n value={localValue || ' '}\n />\n <textarea\n className={custom.textarea}\n data-testid={process.env.NODE_ENV === 'production' ? undefined : testId}\n disabled={disabled}\n onBlur={onBlur}\n\n // When value is \"undefined\" the text area is not-managed, and we should\n // manage it internally for the measurement / resizing functionality\n // to work.\n onChange={\n value === undefined\n ? (e) => {\n setLocalValue(e.target.value);\n } : onChange\n }\n onKeyDown={onKeyDown}\n placeholder={placeholder}\n ref={textAreaRef}\n style={{ height }}\n value={localValue}\n />\n {error && error !== true\n ? <div className={custom.errorMessage}>{error}</div>\n : null}\n </div>\n );\n};\n\nexport default TextArea;\n"],"mappings":";AAAA,SAMEA,SAAS,EACTC,eAAe,EACfC,MA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4D,GAAA;EAAA,IAAA5D,CAAA,SAAAY,MAAA,CAAAiD,YAAA,IAAA7D,CAAA,SAAAG,KAAA;IACDyD,GAAA,GAAAzD,KAAuB,IAAdA,KAAK,KAAK,IAEZ,gBAFPR,IAAA;MACmB6C,SAAmB,EAAnB5B,MAAM,CAAAiD,YAAa;MAAApB,QAAA,EAAGtC;IAAK,CACxC,CAAC,GAFP,IAEO;IAAAH,CAAA,OAAAY,MAAA,CAAAiD,YAAA;IAAA7D,CAAA,OAAAG,KAAA;IAAAH,CAAA,OAAA4D,GAAA;EAAA;IAAAA,GAAA,GAAA5D,CAAA;EAAA;EAAA,IAAA8D,GAAA;EAAA,IAAA9D,CAAA,SAAAmC,kBAAA,IAAAnC,CAAA,SAAA0D,GAAA,IAAA1D,CAAA,SAAA4D,GAAA,IAAA5D,CAAA,SAAAuC,EAAA,IAAAvC,CAAA,SAAA8C,EAAA;IAjDVgB,GAAA,gBAAAjE,KAAA;MACa2C,SAAkB,EAAlBL,kBAAkB;MACpB4B,OAER,EAFQ1B,EAER;MAAAI,QAAA,GAEAF,EAAwE,EACzEO,EAkBE,EACFY,GAoBE,EACDE,GAEO;IAAA,CACL,CAAC;IAAA5D,CAAA,OAAAmC,kBAAA;IAAAnC,CAAA,OAAA0D,GAAA;IAAA1D,CAAA,OAAA4D,GAAA;IAAA5D,CAAA,OAAAuC,EAAA;IAAAvC,CAAA,OAAA8C,EAAA;IAAA9C,CAAA,OAAA8D,GAAA;EAAA;IAAAA,GAAA,GAAA9D,CAAA;EAAA;EAAA,OAlDN8D,GAkDM;AAAA,CAET;AAED,eAAehE,QAAQ","ignoreList":[]}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { c as _c } from "react/compiler-runtime";
|
|
1
2
|
import { useTheme } from "@dr.pogodin/react-themes";
|
|
2
3
|
const defaultTheme = {
|
|
3
4
|
"context": "-dr-pogodin-react-utils___build-web-shared-components-Throbber-theme___context___eVCJf-",
|
|
@@ -16,23 +17,60 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; /**
|
|
|
16
17
|
* @param {...any} [props....]
|
|
17
18
|
* [Other theming properties](https://www.npmjs.com/package/@dr.pogodin/react-themes#themed-component-properties)
|
|
18
19
|
*/
|
|
19
|
-
const Throbber =
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
const custom = useTheme("Throbber", defaultTheme, theme, {
|
|
20
|
+
const Throbber = t0 => {
|
|
21
|
+
const $ = _c(11);
|
|
22
|
+
const {
|
|
23
|
+
theme,
|
|
24
24
|
themePriority
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
25
|
+
} = t0;
|
|
26
|
+
let t1;
|
|
27
|
+
if ($[0] !== themePriority) {
|
|
28
|
+
t1 = {
|
|
29
|
+
themePriority
|
|
30
|
+
};
|
|
31
|
+
$[0] = themePriority;
|
|
32
|
+
$[1] = t1;
|
|
33
|
+
} else {
|
|
34
|
+
t1 = $[1];
|
|
35
|
+
}
|
|
36
|
+
const custom = useTheme("Throbber", defaultTheme, theme, t1);
|
|
37
|
+
let t2;
|
|
38
|
+
let t3;
|
|
39
|
+
let t4;
|
|
40
|
+
if ($[2] !== custom.circle) {
|
|
41
|
+
t2 = /*#__PURE__*/_jsx("span", {
|
|
29
42
|
className: custom.circle
|
|
30
|
-
})
|
|
43
|
+
});
|
|
44
|
+
t3 = /*#__PURE__*/_jsx("span", {
|
|
31
45
|
className: custom.circle
|
|
32
|
-
})
|
|
46
|
+
});
|
|
47
|
+
t4 = /*#__PURE__*/_jsx("span", {
|
|
33
48
|
className: custom.circle
|
|
34
|
-
})
|
|
35
|
-
|
|
49
|
+
});
|
|
50
|
+
$[2] = custom.circle;
|
|
51
|
+
$[3] = t2;
|
|
52
|
+
$[4] = t3;
|
|
53
|
+
$[5] = t4;
|
|
54
|
+
} else {
|
|
55
|
+
t2 = $[3];
|
|
56
|
+
t3 = $[4];
|
|
57
|
+
t4 = $[5];
|
|
58
|
+
}
|
|
59
|
+
let t5;
|
|
60
|
+
if ($[6] !== custom.container || $[7] !== t2 || $[8] !== t3 || $[9] !== t4) {
|
|
61
|
+
t5 = /*#__PURE__*/_jsxs("span", {
|
|
62
|
+
className: custom.container,
|
|
63
|
+
children: [t2, t3, t4]
|
|
64
|
+
});
|
|
65
|
+
$[6] = custom.container;
|
|
66
|
+
$[7] = t2;
|
|
67
|
+
$[8] = t3;
|
|
68
|
+
$[9] = t4;
|
|
69
|
+
$[10] = t5;
|
|
70
|
+
} else {
|
|
71
|
+
t5 = $[10];
|
|
72
|
+
}
|
|
73
|
+
return t5;
|
|
36
74
|
};
|
|
37
75
|
export default Throbber;
|
|
38
76
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["useTheme","defaultTheme","jsx","_jsx","jsxs","_jsxs","Throbber","theme","themePriority","custom","
|
|
1
|
+
{"version":3,"file":"index.js","names":["useTheme","defaultTheme","jsx","_jsx","jsxs","_jsxs","Throbber","t0","$","_c","theme","themePriority","t1","custom","t2","t3","t4","circle","className","t5","container","children"],"sources":["../../../../../src/shared/components/Throbber/index.tsx"],"sourcesContent":["import type { FunctionComponent } from 'react';\n\nimport { type PRIORITY, type Theme, useTheme } from '@dr.pogodin/react-themes';\n\nimport defaultTheme from './theme.scss';\n\ntype ThemeKeyT = 'bouncing' | 'circle' | 'container';\n\ntype PropsT = {\n theme?: Theme<ThemeKeyT>;\n themePriority?: PRIORITY;\n};\n\n/**\n * Throbber is an \"action in progress\" indicator, which renders\n * three bouncing circles as a simple pending activity indicator,\n * and can be further themed to a certain degree.\n * @param {object} [props] Component properties.\n * @param {ThrobberTheme} [props.theme] _Ad hoc_ theme.\n * @param {...any} [props....]\n * [Other theming properties](https://www.npmjs.com/package/@dr.pogodin/react-themes#themed-component-properties)\n */\nconst Throbber: FunctionComponent<PropsT> = ({ theme, themePriority }) => {\n const custom = useTheme('Throbber', defaultTheme, theme, {\n themePriority,\n });\n\n return (\n <span className={custom.container}>\n <span className={custom.circle} />\n <span className={custom.circle} />\n <span className={custom.circle} />\n </span>\n );\n};\n\nexport default Throbber;\n"],"mappings":";AAEA,SAAoCA,QAAQ,QAAQ,0BAA0B;AAE9E,MAAAC,YAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;AAAA;AAAwC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA,4BASxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,QAAmC,GAAGC,EAAA;EAAA,MAAAC,CAAA,GAAAC,EAAA;EAAC;IAAAC,KAAA;IAAAC;EAAA,IAAAJ,EAAwB;EAAA,IAAAK,EAAA;EAAA,IAAAJ,CAAA,QAAAG,aAAA;IACVC,EAAA;MAAAD;IAEzD,CAAC;IAAAH,CAAA,MAAAG,aAAA;IAAAH,CAAA,MAAAI,EAAA;EAAA;IAAAA,EAAA,GAAAJ,CAAA;EAAA;EAFD,MAAAK,MAAA,GAAeb,QAAQ,CAAC,UAAU,EAAEC,YAAY,EAAES,KAAK,EAAEE,EAExD,CAAC;EAAC,IAAAE,EAAA;EAAA,IAAAC,EAAA;EAAA,IAAAC,EAAA;EAAA,IAAAR,CAAA,QAAAK,MAAA,CAAAI,MAAA;IAICH,EAAA,gBAAAX,IAAA;MAAiBe,SAAa,EAAbL,MAAM,CAAAI;IAAO,CAAG,CAAC;IAClCF,EAAA,gBAAAZ,IAAA;MAAiBe,SAAa,EAAbL,MAAM,CAAAI;IAAO,CAAG,CAAC;IAClCD,EAAA,gBAAAb,IAAA;MAAiBe,SAAa,EAAbL,MAAM,CAAAI;IAAO,CAAG,CAAC;IAAAT,CAAA,MAAAK,MAAA,CAAAI,MAAA;IAAAT,CAAA,MAAAM,EAAA;IAAAN,CAAA,MAAAO,EAAA;IAAAP,CAAA,MAAAQ,EAAA;EAAA;IAAAF,EAAA,GAAAN,CAAA;IAAAO,EAAA,GAAAP,CAAA;IAAAQ,EAAA,GAAAR,CAAA;EAAA;EAAA,IAAAW,EAAA;EAAA,IAAAX,CAAA,QAAAK,MAAA,CAAAO,SAAA,IAAAZ,CAAA,QAAAM,EAAA,IAAAN,CAAA,QAAAO,EAAA,IAAAP,CAAA,QAAAQ,EAAA;IAHpCG,EAAA,gBAAAd,KAAA;MAAiBa,SAAgB,EAAhBL,MAAM,CAAAO,SAAU;MAAAC,QAAA,GAC/BP,EAAkC,EAClCC,EAAkC,EAClCC,EAAkC;IAAA,CAC9B,CAAC;IAAAR,CAAA,MAAAK,MAAA,CAAAO,SAAA;IAAAZ,CAAA,MAAAM,EAAA;IAAAN,CAAA,MAAAO,EAAA;IAAAP,CAAA,MAAAQ,EAAA;IAAAR,CAAA,OAAAW,EAAA;EAAA;IAAAA,EAAA,GAAAX,CAAA;EAAA;EAAA,OAJPW,EAIO;AAAA,CAEV;AAED,eAAeb,QAAQ","ignoreList":[]}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { c as _c } from "react/compiler-runtime"; /**
|
|
2
|
+
* The actual tooltip component. It is rendered outside the regular document
|
|
3
|
+
* hierarchy, and with sub-components managed without React to achieve the best
|
|
4
|
+
* performance during animation.
|
|
5
|
+
*/
|
|
6
|
+
import { useImperativeHandle, useRef } from "react";
|
|
6
7
|
import { createPortal } from "react-dom";
|
|
7
8
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; /**
|
|
8
9
|
* Valid placements of the rendered tooltip. They will be overriden when
|
|
@@ -161,44 +162,82 @@ function setComponentPositions(pageX, pageY, placement, element, tooltip) {
|
|
|
161
162
|
const arrowStyle = `${pos.baseArrowStyle};left:${pos.arrowX}px;top:${pos.arrowY}px`;
|
|
162
163
|
tooltip.arrow.setAttribute("style", arrowStyle);
|
|
163
164
|
} /* The Tooltip component itself. */
|
|
164
|
-
const Tooltip =
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
// rendering cycles, and only then it can be correctly measured and positioned.
|
|
172
|
-
// Thus, when we create the <Tooltip> we have to record its target positioning
|
|
173
|
-
// details, and then apply them when it is created.
|
|
165
|
+
const Tooltip = t0 => {
|
|
166
|
+
const $ = _c(11);
|
|
167
|
+
const {
|
|
168
|
+
children,
|
|
169
|
+
ref,
|
|
170
|
+
theme
|
|
171
|
+
} = t0;
|
|
174
172
|
const arrowRef = useRef(null);
|
|
175
173
|
const containerRef = useRef(null);
|
|
176
174
|
const contentRef = useRef(null);
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
175
|
+
let t1;
|
|
176
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
177
|
+
t1 = (pageX, pageY, placement, element) => {
|
|
178
|
+
if (!arrowRef.current || !containerRef.current || !contentRef.current) {
|
|
179
|
+
throw Error("Internal error");
|
|
180
|
+
}
|
|
181
|
+
setComponentPositions(pageX, pageY, placement, element, {
|
|
182
|
+
arrow: arrowRef.current,
|
|
183
|
+
container: containerRef.current,
|
|
184
|
+
content: contentRef.current
|
|
185
|
+
});
|
|
186
|
+
};
|
|
187
|
+
$[0] = t1;
|
|
188
|
+
} else {
|
|
189
|
+
t1 = $[0];
|
|
190
|
+
}
|
|
191
|
+
const pointTo = t1;
|
|
192
|
+
let t2;
|
|
193
|
+
if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
|
|
194
|
+
t2 = () => ({
|
|
195
|
+
pointTo
|
|
185
196
|
});
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
197
|
+
$[1] = t2;
|
|
198
|
+
} else {
|
|
199
|
+
t2 = $[1];
|
|
200
|
+
}
|
|
201
|
+
useImperativeHandle(ref, t2);
|
|
202
|
+
let t3;
|
|
203
|
+
if ($[2] !== theme.arrow) {
|
|
204
|
+
t3 = /*#__PURE__*/_jsx("div", {
|
|
194
205
|
className: theme.arrow,
|
|
195
206
|
ref: arrowRef
|
|
196
|
-
})
|
|
207
|
+
});
|
|
208
|
+
$[2] = theme.arrow;
|
|
209
|
+
$[3] = t3;
|
|
210
|
+
} else {
|
|
211
|
+
t3 = $[3];
|
|
212
|
+
}
|
|
213
|
+
let t4;
|
|
214
|
+
if ($[4] !== children || $[5] !== theme.content) {
|
|
215
|
+
t4 = /*#__PURE__*/_jsx("div", {
|
|
197
216
|
className: theme.content,
|
|
198
217
|
ref: contentRef,
|
|
199
218
|
children: children
|
|
200
|
-
})
|
|
201
|
-
|
|
219
|
+
});
|
|
220
|
+
$[4] = children;
|
|
221
|
+
$[5] = theme.content;
|
|
222
|
+
$[6] = t4;
|
|
223
|
+
} else {
|
|
224
|
+
t4 = $[6];
|
|
225
|
+
}
|
|
226
|
+
let t5;
|
|
227
|
+
if ($[7] !== t3 || $[8] !== t4 || $[9] !== theme.container) {
|
|
228
|
+
t5 = /*#__PURE__*/createPortal(/*#__PURE__*/_jsxs("div", {
|
|
229
|
+
className: theme.container,
|
|
230
|
+
ref: containerRef,
|
|
231
|
+
children: [t3, t4]
|
|
232
|
+
}), document.body);
|
|
233
|
+
$[7] = t3;
|
|
234
|
+
$[8] = t4;
|
|
235
|
+
$[9] = theme.container;
|
|
236
|
+
$[10] = t5;
|
|
237
|
+
} else {
|
|
238
|
+
t5 = $[10];
|
|
239
|
+
}
|
|
240
|
+
return t5;
|
|
202
241
|
};
|
|
203
242
|
export default Tooltip;
|
|
204
243
|
//# sourceMappingURL=Tooltip.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tooltip.js","names":["useImperativeHandle","useRef","createPortal","jsx","_jsx","jsxs","_jsxs","PLACEMENTS","ARROW_STYLE_DOWN","join","ARROW_STYLE_UP","calcTooltipRects","tooltip","arrow","getBoundingClientRect","container","calcViewportRect","scrollX","scrollY","window","documentElement","clientHeight","clientWidth","document","bottom","left","right","top","calcPositionAboveXY","x","y","tooltipRects","arrowX","width","arrowY","height","containerX","containerY","baseArrowStyle","setComponentPositions","pageX","pageY","placement","element","viewportRect","pos","Math","max","maxX","min","containerStyle","setAttribute","arrowStyle","Tooltip","children","ref","theme","arrowRef","containerRef","contentRef","pointTo","current","Error","content","className","body"],"sources":["../../../../../src/shared/components/WithTooltip/Tooltip.tsx"],"sourcesContent":["/**\n * The actual tooltip component. It is rendered outside the regular document\n * hierarchy, and with sub-components managed without React to achieve the best\n * performance during animation.\n */\n\nimport {\n type FunctionComponent,\n type ReactNode,\n type RefObject,\n useImperativeHandle,\n useRef,\n} from 'react';\n\nimport { createPortal } from 'react-dom';\n\nimport type { Theme } from '@dr.pogodin/react-themes';\n\n/**\n * Valid placements of the rendered tooltip. They will be overriden when\n * necessary to fit the tooltip within the viewport.\n */\nexport enum PLACEMENTS {\n ABOVE_CURSOR = 'ABOVE_CURSOR',\n ABOVE_ELEMENT = 'ABOVE_ELEMENT',\n BELOW_CURSOR = 'BELOW_CURSOR',\n BELOW_ELEMENT = 'BELOW_ELEMENT',\n}\n\nconst ARROW_STYLE_DOWN = [\n 'border-bottom-color:transparent',\n 'border-left-color:transparent',\n 'border-right-color:transparent',\n].join(';');\n\nconst ARROW_STYLE_UP = [\n 'border-top-color:transparent',\n 'border-left-color:transparent',\n 'border-right-color:transparent',\n].join(';');\n\ntype ComponentsT = {\n arrow: HTMLDivElement;\n container: HTMLDivElement;\n content: HTMLDivElement;\n};\n\nexport type ThemeKeysT = 'appearance' | 'arrow' | 'container' | 'content';\n\ntype TooltipThemeT = Theme<ThemeKeysT>;\n\ntype TooltipRectsT = {\n arrow: DOMRect;\n container: DOMRect;\n};\n\n/**\n * Generates bounding client rectangles for tooltip components.\n * @ignore\n * @param tooltip DOM references to the tooltip components.\n * @param tooltip.arrow\n * @param tooltip.container\n * @return Object holding tooltip rectangles in\n * two fields.\n */\nfunction calcTooltipRects(tooltip: ComponentsT): TooltipRectsT {\n return {\n arrow: tooltip.arrow.getBoundingClientRect(),\n container: tooltip.container.getBoundingClientRect(),\n };\n}\n\n/**\n * Calculates the document viewport size.\n * @ignore\n * @return {{x, y, width, height}}\n */\nfunction calcViewportRect() {\n const { scrollX, scrollY } = window;\n const { documentElement: { clientHeight, clientWidth } } = document;\n return {\n bottom: scrollY + clientHeight,\n left: scrollX,\n right: scrollX + clientWidth,\n top: scrollY,\n };\n}\n\n/**\n * Calculates tooltip and arrow positions for the placement just above\n * the cursor.\n * @ignore\n * @param {number} x Cursor page-x position.\n * @param {number} y Cursor page-y position.\n * @param {object} tooltipRects Bounding client rectangles of tooltip parts.\n * @param {object} tooltipRects.arrow\n * @param {object} tooltipRects.container\n * @return {object} Contains the following fields:\n * - {number} arrowX\n * - {number} arrowY\n * - {number} containerX\n * - {number} containerY\n * - {string} baseArrowStyle\n */\nfunction calcPositionAboveXY(\n x: number,\n y: number,\n tooltipRects: TooltipRectsT,\n) {\n const { arrow, container } = tooltipRects;\n return {\n arrowX: 0.5 * (container.width - arrow.width),\n arrowY: container.height,\n containerX: x - container.width / 2,\n containerY: y - container.height - arrow.height / 1.5,\n\n // TODO: Instead of already setting the base style here, we should\n // introduce a set of constants for arrow directions, which will help\n // to do checks dependant on the arrow direction.\n baseArrowStyle: ARROW_STYLE_DOWN,\n };\n}\n\n// const HIT = {\n// NONE: false,\n// LEFT: 'LEFT',\n// RIGHT: 'RIGHT',\n// TOP: 'TOP',\n// BOTTOM: 'BOTTOM',\n// };\n\n/**\n * Checks whether\n * @param {object} pos\n * @param {object} tooltipRects\n * @param {object} viewportRect\n * @return {HIT}\n */\n// function checkViewportFit(pos, tooltipRects, viewportRect) {\n// const { containerX, containerY } = pos;\n// if (containerX < viewportRect.left + 6) return HIT.LEFT;\n// if (containerX > viewportRect.right - 6) return HIT.RIGHT;\n// return HIT.NONE;\n// }\n\n/**\n * Shifts tooltip horizontally to fit into the viewport, while keeping\n * the arrow pointed to the XY point.\n * @param {number} x\n * @param {number} y\n * @param {object} pos\n * @param {number} pageXOffset\n * @param {number} pageXWidth\n */\n// function xPageFitCorrection(x, y, pos, pageXOffset, pageXWidth) {\n// if (pos.containerX < pageXOffset + 6) {\n// pos.containerX = pageXOffset + 6;\n// pos.arrowX = Math.max(6, pageX - containerX - arrowRect.width / 2);\n// } else {\n// const maxX = pageXOffset + docRect.width - containerRect.width - 6;\n// if (containerX > maxX) {\n// containerX = maxX;\n// arrowX = Math.min(\n// containerRect.width - 6,\n// pageX - containerX - arrowRect.width / 2,\n// );\n// }\n// }\n// }\n\n/**\n * Sets positions of tooltip components to point the tooltip to the specified\n * page point.\n * @ignore\n * @param pageX\n * @param pageY\n * @param placement\n * @param element DOM reference to the element wrapped by the tooltip.\n * @param tooltip\n * @param tooltip.arrow DOM reference to the tooltip arrow.\n * @param tooltip.container DOM reference to the tooltip container.\n */\nfunction setComponentPositions(\n pageX: number,\n pageY: number,\n placement: PLACEMENTS | undefined,\n element: HTMLElement | undefined,\n tooltip: ComponentsT,\n) {\n const tooltipRects = calcTooltipRects(tooltip);\n const viewportRect = calcViewportRect();\n\n /* Default container coords: tooltip at the top. */\n const pos = calcPositionAboveXY(pageX, pageY, tooltipRects);\n\n if (pos.containerX < viewportRect.left + 6) {\n pos.containerX = viewportRect.left + 6;\n pos.arrowX = Math.max(\n 6,\n pageX - pos.containerX - tooltipRects.arrow.width / 2,\n );\n } else {\n const maxX = viewportRect.right - 6 - tooltipRects.container.width;\n if (pos.containerX > maxX) {\n pos.containerX = maxX;\n pos.arrowX = Math.min(\n tooltipRects.container.width - 6,\n pageX - pos.containerX - tooltipRects.arrow.width / 2,\n );\n }\n }\n\n /* If tooltip has not enough space on top - make it bottom tooltip. */\n if (pos.containerY < viewportRect.top + 6) {\n pos.containerY += tooltipRects.container.height\n + 2 * tooltipRects.arrow.height;\n pos.arrowY -= tooltipRects.container.height\n + tooltipRects.arrow.height;\n pos.baseArrowStyle = ARROW_STYLE_UP;\n }\n\n const containerStyle = `left:${pos.containerX}px;top:${pos.containerY}px`;\n tooltip.container.setAttribute('style', containerStyle);\n\n const arrowStyle = `${pos.baseArrowStyle};left:${pos.arrowX}px;top:${pos.arrowY}px`;\n tooltip.arrow.setAttribute('style', arrowStyle);\n}\n\n/* The Tooltip component itself. */\nconst Tooltip: FunctionComponent<{\n children?: ReactNode;\n ref?: RefObject<unknown>;\n theme: TooltipThemeT;\n}> = ({ children, ref, theme }) => {\n // NOTE: The way it has to be implemented, for clean mounting and unmounting\n // at the client side, the <Tooltip> is fully mounted into DOM in the next\n // rendering cycles, and only then it can be correctly measured and positioned.\n // Thus, when we create the <Tooltip> we have to record its target positioning\n // details, and then apply them when it is created.\n\n const arrowRef = useRef<HTMLDivElement>(null);\n const containerRef = useRef<HTMLDivElement>(null);\n const contentRef = useRef<HTMLDivElement>(null);\n\n const pointTo = (\n pageX: number,\n pageY: number,\n placement: PLACEMENTS,\n element: HTMLElement,\n ) => {\n if (!arrowRef.current || !containerRef.current || !contentRef.current) {\n throw Error('Internal error');\n }\n\n setComponentPositions(pageX, pageY, placement, element, {\n arrow: arrowRef.current,\n container: containerRef.current,\n content: contentRef.current,\n });\n };\n useImperativeHandle(ref, () => ({ pointTo }));\n\n return createPortal(\n (\n <div className={theme.container} ref={containerRef}>\n <div className={theme.arrow} ref={arrowRef} />\n <div className={theme.content} ref={contentRef}>{children}</div>\n </div>\n ),\n document.body,\n );\n};\n\nexport default Tooltip;\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA,GAEA,SAIEA,mBAAmB,EACnBC,MAAM,QACD,OAAO;AAEd,SAASC,YAAY,QAAQ,WAAW;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA,4BAIzC;AACA;AACA;AACA;AACA,WAAYC,UAAU,0BAAVA,UAAU;EAAVA,UAAU;EAAVA,UAAU;EAAVA,UAAU;EAAVA,UAAU;EAAA,OAAV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bC,SAAqB,EACrBC,OAAoB,KACjB;IACH,IAAI,CAACc,QAAQ,CAACI,OAAO,IAAI,CAACH,YAAY,CAACG,OAAO,IAAI,CAACF,UAAU,CAACE,OAAO,EAAE;MACrE,MAAMC,KAAK,CAAC,gBAAgB,CAAC;IAC/B;IAEAvB,qBAAqB,CAACC,KAAK,EAAEC,KAAK,EAAEC,SAAS,EAAEC,OAAO,EAAE;MACtD9B,KAAK,EAAE4C,QAAQ,CAACI,OAAO;MACvB9C,SAAS,EAAE2C,YAAY,CAACG,OAAO;MAC/BE,OAAO,EAAEJ,UAAU,CAACE;IACtB,CAAC,CAAC;EACJ,CAAC;EACD7D,mBAAmB,CAACuD,GAAG,EAAE,OAAO;IAAEK;EAAQ,CAAC,CAAC,CAAC;EAE7C,oBAAO1D,YAAY,cAEfI,KAAA;IAAK0D,SAAS,EAAER,KAAK,CAACzC,SAAU;IAACwC,GAAG,EAAEG,YAAa;IAAAJ,QAAA,gBACjDlD,IAAA;MAAK4D,SAAS,EAAER,KAAK,CAAC3C,KAAM;MAAC0C,GAAG,EAAEE;IAAS,CAAE,CAAC,eAC9CrD,IAAA;MAAK4D,SAAS,EAAER,KAAK,CAACO,OAAQ;MAACR,GAAG,EAAEI,UAAW;MAAAL,QAAA,EAAEA;IAAQ,CAAM,CAAC;EAAA,CAC7D,CAAC,EAER/B,QAAQ,CAAC0C,IACX,CAAC;AACH,CAAC;AAED,eAAeZ,OAAO","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"Tooltip.js","names":["useImperativeHandle","useRef","createPortal","jsx","_jsx","jsxs","_jsxs","PLACEMENTS","ARROW_STYLE_DOWN","join","ARROW_STYLE_UP","calcTooltipRects","tooltip","arrow","getBoundingClientRect","container","calcViewportRect","scrollX","scrollY","window","documentElement","clientHeight","clientWidth","document","bottom","left","right","top","calcPositionAboveXY","x","y","tooltipRects","arrowX","width","arrowY","height","containerX","containerY","baseArrowStyle","setComponentPositions","pageX","pageY","placement","element","viewportRect","pos","Math","max","maxX","min","containerStyle","setAttribute","arrowStyle","Tooltip","t0","$","_c","children","ref","theme","arrowRef","containerRef","contentRef","t1","Symbol","for","current","Error","content","pointTo","t2","t3","className","t4","t5","body"],"sources":["../../../../../src/shared/components/WithTooltip/Tooltip.tsx"],"sourcesContent":["/**\n * The actual tooltip component. It is rendered outside the regular document\n * hierarchy, and with sub-components managed without React to achieve the best\n * performance during animation.\n */\n\nimport {\n type FunctionComponent,\n type ReactNode,\n type RefObject,\n useImperativeHandle,\n useRef,\n} from 'react';\n\nimport { createPortal } from 'react-dom';\n\nimport type { Theme } from '@dr.pogodin/react-themes';\n\n/**\n * Valid placements of the rendered tooltip. They will be overriden when\n * necessary to fit the tooltip within the viewport.\n */\nexport enum PLACEMENTS {\n ABOVE_CURSOR = 'ABOVE_CURSOR',\n ABOVE_ELEMENT = 'ABOVE_ELEMENT',\n BELOW_CURSOR = 'BELOW_CURSOR',\n BELOW_ELEMENT = 'BELOW_ELEMENT',\n}\n\nconst ARROW_STYLE_DOWN = [\n 'border-bottom-color:transparent',\n 'border-left-color:transparent',\n 'border-right-color:transparent',\n].join(';');\n\nconst ARROW_STYLE_UP = [\n 'border-top-color:transparent',\n 'border-left-color:transparent',\n 'border-right-color:transparent',\n].join(';');\n\ntype ComponentsT = {\n arrow: HTMLDivElement;\n container: HTMLDivElement;\n content: HTMLDivElement;\n};\n\nexport type ThemeKeysT = 'appearance' | 'arrow' | 'container' | 'content';\n\ntype TooltipThemeT = Theme<ThemeKeysT>;\n\ntype TooltipRectsT = {\n arrow: DOMRect;\n container: DOMRect;\n};\n\n/**\n * Generates bounding client rectangles for tooltip components.\n * @ignore\n * @param tooltip DOM references to the tooltip components.\n * @param tooltip.arrow\n * @param tooltip.container\n * @return Object holding tooltip rectangles in\n * two fields.\n */\nfunction calcTooltipRects(tooltip: ComponentsT): TooltipRectsT {\n return {\n arrow: tooltip.arrow.getBoundingClientRect(),\n container: tooltip.container.getBoundingClientRect(),\n };\n}\n\n/**\n * Calculates the document viewport size.\n * @ignore\n * @return {{x, y, width, height}}\n */\nfunction calcViewportRect() {\n const { scrollX, scrollY } = window;\n const { documentElement: { clientHeight, clientWidth } } = document;\n return {\n bottom: scrollY + clientHeight,\n left: scrollX,\n right: scrollX + clientWidth,\n top: scrollY,\n };\n}\n\n/**\n * Calculates tooltip and arrow positions for the placement just above\n * the cursor.\n * @ignore\n * @param {number} x Cursor page-x position.\n * @param {number} y Cursor page-y position.\n * @param {object} tooltipRects Bounding client rectangles of tooltip parts.\n * @param {object} tooltipRects.arrow\n * @param {object} tooltipRects.container\n * @return {object} Contains the following fields:\n * - {number} arrowX\n * - {number} arrowY\n * - {number} containerX\n * - {number} containerY\n * - {string} baseArrowStyle\n */\nfunction calcPositionAboveXY(\n x: number,\n y: number,\n tooltipRects: TooltipRectsT,\n) {\n const { arrow, container } = tooltipRects;\n return {\n arrowX: 0.5 * (container.width - arrow.width),\n arrowY: container.height,\n containerX: x - container.width / 2,\n containerY: y - container.height - arrow.height / 1.5,\n\n // TODO: Instead of already setting the base style here, we should\n // introduce a set of constants for arrow directions, which will help\n // to do checks dependant on the arrow direction.\n baseArrowStyle: ARROW_STYLE_DOWN,\n };\n}\n\n// const HIT = {\n// NONE: false,\n// LEFT: 'LEFT',\n// RIGHT: 'RIGHT',\n// TOP: 'TOP',\n// BOTTOM: 'BOTTOM',\n// };\n\n/**\n * Checks whether\n * @param {object} pos\n * @param {object} tooltipRects\n * @param {object} viewportRect\n * @return {HIT}\n */\n// function checkViewportFit(pos, tooltipRects, viewportRect) {\n// const { containerX, containerY } = pos;\n// if (containerX < viewportRect.left + 6) return HIT.LEFT;\n// if (containerX > viewportRect.right - 6) return HIT.RIGHT;\n// return HIT.NONE;\n// }\n\n/**\n * Shifts tooltip horizontally to fit into the viewport, while keeping\n * the arrow pointed to the XY point.\n * @param {number} x\n * @param {number} y\n * @param {object} pos\n * @param {number} pageXOffset\n * @param {number} pageXWidth\n */\n// function xPageFitCorrection(x, y, pos, pageXOffset, pageXWidth) {\n// if (pos.containerX < pageXOffset + 6) {\n// pos.containerX = pageXOffset + 6;\n// pos.arrowX = Math.max(6, pageX - containerX - arrowRect.width / 2);\n// } else {\n// const maxX = pageXOffset + docRect.width - containerRect.width - 6;\n// if (containerX > maxX) {\n// containerX = maxX;\n// arrowX = Math.min(\n// containerRect.width - 6,\n// pageX - containerX - arrowRect.width / 2,\n// );\n// }\n// }\n// }\n\n/**\n * Sets positions of tooltip components to point the tooltip to the specified\n * page point.\n * @ignore\n * @param pageX\n * @param pageY\n * @param placement\n * @param element DOM reference to the element wrapped by the tooltip.\n * @param tooltip\n * @param tooltip.arrow DOM reference to the tooltip arrow.\n * @param tooltip.container DOM reference to the tooltip container.\n */\nfunction setComponentPositions(\n pageX: number,\n pageY: number,\n placement: PLACEMENTS | undefined,\n element: HTMLElement | undefined,\n tooltip: ComponentsT,\n) {\n const tooltipRects = calcTooltipRects(tooltip);\n const viewportRect = calcViewportRect();\n\n /* Default container coords: tooltip at the top. */\n const pos = calcPositionAboveXY(pageX, pageY, tooltipRects);\n\n if (pos.containerX < viewportRect.left + 6) {\n pos.containerX = viewportRect.left + 6;\n pos.arrowX = Math.max(\n 6,\n pageX - pos.containerX - tooltipRects.arrow.width / 2,\n );\n } else {\n const maxX = viewportRect.right - 6 - tooltipRects.container.width;\n if (pos.containerX > maxX) {\n pos.containerX = maxX;\n pos.arrowX = Math.min(\n tooltipRects.container.width - 6,\n pageX - pos.containerX - tooltipRects.arrow.width / 2,\n );\n }\n }\n\n /* If tooltip has not enough space on top - make it bottom tooltip. */\n if (pos.containerY < viewportRect.top + 6) {\n pos.containerY += tooltipRects.container.height\n + 2 * tooltipRects.arrow.height;\n pos.arrowY -= tooltipRects.container.height\n + tooltipRects.arrow.height;\n pos.baseArrowStyle = ARROW_STYLE_UP;\n }\n\n const containerStyle = `left:${pos.containerX}px;top:${pos.containerY}px`;\n tooltip.container.setAttribute('style', containerStyle);\n\n const arrowStyle = `${pos.baseArrowStyle};left:${pos.arrowX}px;top:${pos.arrowY}px`;\n tooltip.arrow.setAttribute('style', arrowStyle);\n}\n\n/* The Tooltip component itself. */\nconst Tooltip: FunctionComponent<{\n children?: ReactNode;\n ref?: RefObject<unknown>;\n theme: TooltipThemeT;\n}> = ({ children, ref, theme }) => {\n // NOTE: The way it has to be implemented, for clean mounting and unmounting\n // at the client side, the <Tooltip> is fully mounted into DOM in the next\n // rendering cycles, and only then it can be correctly measured and positioned.\n // Thus, when we create the <Tooltip> we have to record its target positioning\n // details, and then apply them when it is created.\n\n const arrowRef = useRef<HTMLDivElement>(null);\n const containerRef = useRef<HTMLDivElement>(null);\n const contentRef = useRef<HTMLDivElement>(null);\n\n const pointTo = (\n pageX: number,\n pageY: number,\n placement: PLACEMENTS,\n element: HTMLElement,\n ) => {\n if (!arrowRef.current || !containerRef.current || !contentRef.current) {\n throw Error('Internal error');\n }\n\n setComponentPositions(pageX, pageY, placement, element, {\n arrow: arrowRef.current,\n container: containerRef.current,\n content: contentRef.current,\n });\n };\n useImperativeHandle(ref, () => ({ pointTo }));\n\n return createPortal(\n (\n <div className={theme.container} ref={containerRef}>\n <div className={theme.arrow} ref={arrowRef} />\n <div className={theme.content} ref={contentRef}>{children}</div>\n </div>\n ),\n document.body,\n );\n};\n\nexport default Tooltip;\n"],"mappings":"iDAAA;AACA;AACA;AACA;AACA;AAEA,SAIEA,mBAAmB,EACnBC,MAAM,QACD,OAAO;AAEd,SAASC,YAAY,QAAQ,WAAW;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA,4BAIzC;AACA;AACA;AACA;AACA,WAAYC,UAAU,0BAAVA,UAAU;EAAVA,UAAU;EAAVA,UAAU;EAAVA,UAAU;EAAVA,UAAU;EAAA,OAAVA,UAAU;AAAA;AAOtB,MAAMC,gBAAgB,GAAG,CACvB,iCAAiC,EACjC,+BAA+B,EAC/B,gCAAgC,CACjC,CAACC,IAAI,CAAC,GAAG,CAAC;AAEX,MAAMC,cAAc,GA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