@dr.pogodin/react-utils 1.53.0 → 1.54.0
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 +1 -1
- package/build/development/shared/utils/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/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 +1 -1
- 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/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 +10 -8
- package/tsconfig.json +1 -1
- package/tsconfig.types.json +1 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import "core-js/modules/es.iterator.filter.js";
|
|
2
2
|
import "core-js/modules/es.iterator.constructor.js";
|
|
3
3
|
import "core-js/modules/es.iterator.filter.js";
|
|
4
|
+
import { c as _c } from "react/compiler-runtime";
|
|
4
5
|
import { useEffect, useRef, useState } from "react";
|
|
5
6
|
import { useTheme } from "@dr.pogodin/react-themes";
|
|
6
7
|
import { optionValueName } from "../common.js";
|
|
@@ -19,102 +20,173 @@ const defaultTheme = {
|
|
|
19
20
|
"upward": "-dr-pogodin-react-utils___build-web-shared-components-selectors-CustomDropdown-theme___upward___--5Xpy"
|
|
20
21
|
};
|
|
21
22
|
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
22
|
-
const CustomDropdown =
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
23
|
+
const CustomDropdown = t0 => {
|
|
24
|
+
const $ = _c(31);
|
|
25
|
+
const {
|
|
26
|
+
filter,
|
|
27
|
+
label,
|
|
28
|
+
onChange,
|
|
29
|
+
options,
|
|
30
|
+
theme,
|
|
31
|
+
value
|
|
32
|
+
} = t0;
|
|
30
33
|
const custom = useTheme("CustomDropdown", defaultTheme, theme);
|
|
31
34
|
const [active, setActive] = useState(false);
|
|
32
35
|
const dropdownRef = useRef(null);
|
|
33
36
|
const opsRef = useRef(null);
|
|
34
37
|
const [opsPos, setOpsPos] = useState();
|
|
35
38
|
const [upward, setUpward] = useState(false);
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
if (anchor && opsRect) {
|
|
43
|
-
const fitsDown = anchor.bottom + opsRect.height < (window.visualViewport?.height ?? 0);
|
|
44
|
-
const fitsUp = anchor.top - opsRect.height > 0;
|
|
45
|
-
const up = !fitsDown && fitsUp;
|
|
46
|
-
setUpward(up);
|
|
47
|
-
const pos = up ? {
|
|
48
|
-
left: anchor.left,
|
|
49
|
-
top: anchor.top - opsRect.height - 1,
|
|
50
|
-
width: anchor.width
|
|
51
|
-
} : {
|
|
52
|
-
left: anchor.left,
|
|
53
|
-
top: anchor.bottom,
|
|
54
|
-
width: anchor.width
|
|
55
|
-
};
|
|
56
|
-
setOpsPos(now => areEqual(now, pos) ? now : pos);
|
|
39
|
+
let t1;
|
|
40
|
+
let t2;
|
|
41
|
+
if ($[0] !== active) {
|
|
42
|
+
t1 = () => {
|
|
43
|
+
if (!active) {
|
|
44
|
+
return;
|
|
57
45
|
}
|
|
58
|
-
id
|
|
46
|
+
let id;
|
|
47
|
+
const cb = () => {
|
|
48
|
+
const anchor = dropdownRef.current?.getBoundingClientRect();
|
|
49
|
+
const opsRect = opsRef.current?.measure();
|
|
50
|
+
if (anchor && opsRect) {
|
|
51
|
+
const fitsDown = anchor.bottom + opsRect.height < (window.visualViewport?.height ?? 0);
|
|
52
|
+
const fitsUp = anchor.top - opsRect.height > 0;
|
|
53
|
+
const up = !fitsDown && fitsUp;
|
|
54
|
+
setUpward(up);
|
|
55
|
+
const pos = up ? {
|
|
56
|
+
left: anchor.left,
|
|
57
|
+
top: anchor.top - opsRect.height - 1,
|
|
58
|
+
width: anchor.width
|
|
59
|
+
} : {
|
|
60
|
+
left: anchor.left,
|
|
61
|
+
top: anchor.bottom,
|
|
62
|
+
width: anchor.width
|
|
63
|
+
};
|
|
64
|
+
setOpsPos(now => areEqual(now, pos) ? now : pos);
|
|
65
|
+
}
|
|
66
|
+
id = requestAnimationFrame(cb);
|
|
67
|
+
};
|
|
68
|
+
requestAnimationFrame(cb);
|
|
69
|
+
return () => {
|
|
70
|
+
cancelAnimationFrame(id);
|
|
71
|
+
};
|
|
59
72
|
};
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
73
|
+
t2 = [active];
|
|
74
|
+
$[0] = active;
|
|
75
|
+
$[1] = t1;
|
|
76
|
+
$[2] = t2;
|
|
77
|
+
} else {
|
|
78
|
+
t1 = $[1];
|
|
79
|
+
t2 = $[2];
|
|
80
|
+
}
|
|
81
|
+
useEffect(t1, t2);
|
|
82
|
+
let t3;
|
|
83
|
+
if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
|
|
84
|
+
t3 = e => {
|
|
85
|
+
const view = window.visualViewport;
|
|
86
|
+
const rect = dropdownRef.current.getBoundingClientRect();
|
|
87
|
+
setActive(true);
|
|
88
|
+
setOpsPos({
|
|
89
|
+
left: view?.width ?? 0,
|
|
90
|
+
top: view?.height ?? 0,
|
|
91
|
+
width: rect.width
|
|
92
|
+
});
|
|
93
|
+
e.stopPropagation();
|
|
63
94
|
};
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
// react state, and not imperatively).
|
|
74
|
-
setOpsPos({
|
|
75
|
-
left: view?.width ?? 0,
|
|
76
|
-
top: view?.height ?? 0,
|
|
77
|
-
width: rect.width
|
|
95
|
+
$[3] = t3;
|
|
96
|
+
} else {
|
|
97
|
+
t3 = $[3];
|
|
98
|
+
}
|
|
99
|
+
const openList = t3;
|
|
100
|
+
let t4;
|
|
101
|
+
if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
|
|
102
|
+
t4 = /*#__PURE__*/_jsx(_Fragment, {
|
|
103
|
+
children: "\u200C"
|
|
78
104
|
});
|
|
79
|
-
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
105
|
+
$[4] = t4;
|
|
106
|
+
} else {
|
|
107
|
+
t4 = $[4];
|
|
108
|
+
}
|
|
109
|
+
let selected = t4;
|
|
110
|
+
if ($[5] !== filter || $[6] !== options || $[7] !== value) {
|
|
111
|
+
for (const option of options) {
|
|
112
|
+
if (!filter || filter(option)) {
|
|
113
|
+
const [iValue, iName] = optionValueName(option);
|
|
114
|
+
if (iValue === value) {
|
|
115
|
+
selected = iName;
|
|
116
|
+
break;
|
|
117
|
+
}
|
|
90
118
|
}
|
|
91
119
|
}
|
|
120
|
+
$[5] = filter;
|
|
121
|
+
$[6] = options;
|
|
122
|
+
$[7] = value;
|
|
123
|
+
$[8] = selected;
|
|
124
|
+
} else {
|
|
125
|
+
selected = $[8];
|
|
92
126
|
}
|
|
93
127
|
let containerClassName = custom.container;
|
|
94
|
-
if (active)
|
|
128
|
+
if (active) {
|
|
129
|
+
containerClassName = containerClassName + ` ${custom.active}`;
|
|
130
|
+
}
|
|
95
131
|
let opsContainerClass = custom.select ?? "";
|
|
96
132
|
if (upward) {
|
|
97
|
-
containerClassName
|
|
98
|
-
opsContainerClass
|
|
133
|
+
containerClassName = containerClassName + ` ${custom.upward}`;
|
|
134
|
+
opsContainerClass = opsContainerClass + ` ${custom.upward}`;
|
|
99
135
|
}
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
136
|
+
let t5;
|
|
137
|
+
if ($[9] !== custom.label || $[10] !== label) {
|
|
138
|
+
t5 = label === undefined ? null : /*#__PURE__*/_jsx("div", {
|
|
103
139
|
className: custom.label,
|
|
104
140
|
children: label
|
|
105
|
-
})
|
|
141
|
+
});
|
|
142
|
+
$[9] = custom.label;
|
|
143
|
+
$[10] = label;
|
|
144
|
+
$[11] = t5;
|
|
145
|
+
} else {
|
|
146
|
+
t5 = $[11];
|
|
147
|
+
}
|
|
148
|
+
let t6;
|
|
149
|
+
if ($[12] === Symbol.for("react.memo_cache_sentinel")) {
|
|
150
|
+
t6 = e_0 => {
|
|
151
|
+
if (e_0.key === "Enter") {
|
|
152
|
+
openList(e_0);
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
$[12] = t6;
|
|
156
|
+
} else {
|
|
157
|
+
t6 = $[12];
|
|
158
|
+
}
|
|
159
|
+
let t7;
|
|
160
|
+
if ($[13] !== custom.arrow) {
|
|
161
|
+
t7 = /*#__PURE__*/_jsx("div", {
|
|
162
|
+
className: custom.arrow
|
|
163
|
+
});
|
|
164
|
+
$[13] = custom.arrow;
|
|
165
|
+
$[14] = t7;
|
|
166
|
+
} else {
|
|
167
|
+
t7 = $[14];
|
|
168
|
+
}
|
|
169
|
+
let t8;
|
|
170
|
+
if ($[15] !== custom.dropdown || $[16] !== selected || $[17] !== t7) {
|
|
171
|
+
t8 = /*#__PURE__*/_jsxs("div", {
|
|
106
172
|
className: custom.dropdown,
|
|
107
173
|
onClick: openList,
|
|
108
|
-
onKeyDown:
|
|
109
|
-
if (e.key === "Enter") openList(e);
|
|
110
|
-
},
|
|
174
|
+
onKeyDown: t6,
|
|
111
175
|
ref: dropdownRef,
|
|
112
176
|
role: "listbox",
|
|
113
177
|
tabIndex: 0,
|
|
114
|
-
children: [selected,
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
178
|
+
children: [selected, t7]
|
|
179
|
+
});
|
|
180
|
+
$[15] = custom.dropdown;
|
|
181
|
+
$[16] = selected;
|
|
182
|
+
$[17] = t7;
|
|
183
|
+
$[18] = t8;
|
|
184
|
+
} else {
|
|
185
|
+
t8 = $[18];
|
|
186
|
+
}
|
|
187
|
+
let t9;
|
|
188
|
+
if ($[19] !== active || $[20] !== custom.option || $[21] !== onChange || $[22] !== opsContainerClass || $[23] !== opsPos || $[24] !== options) {
|
|
189
|
+
t9 = active ? /*#__PURE__*/_jsx(Options, {
|
|
118
190
|
containerClass: opsContainerClass,
|
|
119
191
|
containerStyle: opsPos,
|
|
120
192
|
onCancel: () => {
|
|
@@ -122,13 +194,39 @@ const CustomDropdown = ({
|
|
|
122
194
|
},
|
|
123
195
|
onChange: newValue => {
|
|
124
196
|
setActive(false);
|
|
125
|
-
if (onChange)
|
|
197
|
+
if (onChange) {
|
|
198
|
+
onChange(newValue);
|
|
199
|
+
}
|
|
126
200
|
},
|
|
127
201
|
optionClass: custom.option ?? "",
|
|
128
202
|
options: options,
|
|
129
203
|
ref: opsRef
|
|
130
|
-
}) : null
|
|
131
|
-
|
|
204
|
+
}) : null;
|
|
205
|
+
$[19] = active;
|
|
206
|
+
$[20] = custom.option;
|
|
207
|
+
$[21] = onChange;
|
|
208
|
+
$[22] = opsContainerClass;
|
|
209
|
+
$[23] = opsPos;
|
|
210
|
+
$[24] = options;
|
|
211
|
+
$[25] = t9;
|
|
212
|
+
} else {
|
|
213
|
+
t9 = $[25];
|
|
214
|
+
}
|
|
215
|
+
let t10;
|
|
216
|
+
if ($[26] !== containerClassName || $[27] !== t5 || $[28] !== t8 || $[29] !== t9) {
|
|
217
|
+
t10 = /*#__PURE__*/_jsxs("div", {
|
|
218
|
+
className: containerClassName,
|
|
219
|
+
children: [t5, t8, t9]
|
|
220
|
+
});
|
|
221
|
+
$[26] = containerClassName;
|
|
222
|
+
$[27] = t5;
|
|
223
|
+
$[28] = t8;
|
|
224
|
+
$[29] = t9;
|
|
225
|
+
$[30] = t10;
|
|
226
|
+
} else {
|
|
227
|
+
t10 = $[30];
|
|
228
|
+
}
|
|
229
|
+
return t10;
|
|
132
230
|
};
|
|
133
231
|
export default CustomDropdown;
|
|
134
232
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["useEffect","useRef","useState","useTheme","optionValueName","Options","areEqual","defaultTheme","Fragment","_Fragment","jsx","_jsx","jsxs","_jsxs","CustomDropdown","filter","label","onChange","options","theme","value","custom","active","setActive","dropdownRef","opsRef","opsPos","setOpsPos","upward","setUpward","undefined","id","cb","anchor","current","getBoundingClientRect","opsRect","measure","fitsDown","bottom","height","window","visualViewport","fitsUp","top","up","pos","left","width","now","requestAnimationFrame","cancelAnimationFrame","openList","e","view","rect","stopPropagation","selected","children","option","iValue","iName","containerClassName","container","opsContainerClass","select","className","dropdown","onClick","onKeyDown","key","ref","role","tabIndex","arrow","containerClass","containerStyle","onCancel","newValue","optionClass"],"sources":["../../../../../../src/shared/components/selectors/CustomDropdown/index.tsx"],"sourcesContent":["import {\n type FunctionComponent,\n type ReactNode,\n useEffect,\n useRef,\n useState,\n} from 'react';\n\nimport { useTheme } from '@dr.pogodin/react-themes';\n\nimport { type PropsT, type ValueT, optionValueName } from '../common';\n\nimport Options, { type ContainerPosT, type RefT, areEqual } from './Options';\n\nimport defaultTheme from './theme.scss';\n\nconst CustomDropdown: FunctionComponent<\n PropsT<ReactNode, (value: ValueT) => void>\n> = ({\n filter,\n label,\n onChange,\n options,\n theme,\n value,\n}) => {\n const custom = useTheme('CustomDropdown', defaultTheme, theme);\n\n const [active, setActive] = useState(false);\n\n const dropdownRef = useRef<HTMLDivElement>(null);\n const opsRef = useRef<RefT>(null);\n\n const [opsPos, setOpsPos] = useState<ContainerPosT>();\n const [upward, setUpward] = useState(false);\n\n useEffect(() => {\n if (!active) return undefined;\n\n let id: number;\n const cb = () => {\n const anchor = dropdownRef.current?.getBoundingClientRect();\n const opsRect = opsRef.current?.measure();\n if (anchor && opsRect) {\n const fitsDown = anchor.bottom + opsRect.height\n < (window.visualViewport?.height ?? 0);\n const fitsUp = anchor.top - opsRect.height > 0;\n\n const up = !fitsDown && fitsUp;\n setUpward(up);\n\n const pos = up ? {\n left: anchor.left,\n top: anchor.top - opsRect.height - 1,\n width: anchor.width,\n } : {\n left: anchor.left,\n top: anchor.bottom,\n width: anchor.width,\n };\n\n setOpsPos((now) => (areEqual(now, pos) ? now : pos));\n }\n id = requestAnimationFrame(cb);\n };\n requestAnimationFrame(cb);\n\n return () => {\n cancelAnimationFrame(id);\n };\n }, [active]);\n\n const openList = (\n e: React.KeyboardEvent<HTMLDivElement> | React.MouseEvent<HTMLDivElement>,\n ) => {\n const view = window.visualViewport;\n const rect = dropdownRef.current!.getBoundingClientRect();\n setActive(true);\n\n // NOTE: This first opens the dropdown off-screen, where it is measured\n // by an effect declared above, and then positioned below, or above\n // the original dropdown element, depending where it fits best\n // (if we first open it downward, it would flick if we immediately\n // move it above, at least with the current position update via local\n // react state, and not imperatively).\n setOpsPos({\n left: view?.width ?? 0,\n top: view?.height ?? 0,\n width: rect.width,\n });\n\n e.stopPropagation();\n };\n\n let selected: React.ReactNode = <>‌</>;\n for (const option of options) {\n if (!filter || filter(option)) {\n const [iValue, iName] = optionValueName(option);\n if (iValue === value) {\n selected = iName;\n break;\n }\n }\n }\n\n let containerClassName = custom.container;\n if (active) containerClassName += ` ${custom.active}`;\n\n let opsContainerClass = custom.select ?? '';\n if (upward) {\n containerClassName += ` ${custom.upward}`;\n opsContainerClass += ` ${custom.upward}`;\n }\n\n return (\n <div className={containerClassName}>\n {label === undefined ? null\n : <div className={custom.label}>{label}</div>}\n <div\n className={custom.dropdown}\n onClick={openList}\n onKeyDown={(e) => {\n if (e.key === 'Enter') openList(e);\n }}\n ref={dropdownRef}\n role=\"listbox\"\n tabIndex={0}\n >\n {selected}\n <div className={custom.arrow} />\n </div>\n {\n active ? (\n <Options\n containerClass={opsContainerClass}\n containerStyle={opsPos}\n onCancel={() => {\n setActive(false);\n }}\n onChange={(newValue) => {\n setActive(false);\n if (onChange) onChange(newValue);\n }}\n optionClass={custom.option ?? ''}\n options={options}\n ref={opsRef}\n />\n ) : null\n }\n </div>\n );\n};\n\nexport default CustomDropdown;\n"],"mappings":";;;AAAA,SAGEA,SAAS,EACTC,MAAM,EACNC,QAAQ,QACH,OAAO;AAEd,SAASC,QAAQ,QAAQ,0BAA0B;AAEnD,SAAmCC,eAAe;AAAA,OAE3CC,OAAO,IAAmCC,QAAQ;AAAA,MAAAC,YAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;AAAA;AAEjB,SAAAC,QAAA,IAAAC,SAAA,EAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAExC,MAAMC,cAEL,GAAGA,CAAC;EACHC,MAAM;EACNC,KAAK;EACLC,QAAQ;EACRC,OAAO;EACPC,KAAK;EACLC;AACF,CAAC,KAAK;EACJ,MAAMC,MAAM,GAAGlB,QAAQ,CAAC,gBAAgB,EAAEI,YAAY,EAAEY,KAAK,CAAC;EAE9D,MAAM,CAACG,MAAM,EAAEC,SAAS,CAAC,GAAGrB,QAAQ,CAAC,KAAK,CAAC;EAE3C,MAAMsB,WAAW,GAAGvB,MAAM,CAAiB,IAAI,CAAC;EAChD,MAAMwB,MAAM,GAAGxB,MAAM,CAAO,IAAI,CAAC;EAEjC,MAAM,CAACyB,MAAM,EAAEC,SAAS,CAAC,GAAGzB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C,MAAM,CAACO,MAAM,EAAE;EAC1C;EAEA,oBACEf,KAAA;IAAKqD,SAAS,EAAEJ,kBAAmB;IAAAJ,QAAA,GAChC1C,KAAK,KAAKc,SAAS,GAAG,IAAI,gBACvBnB,IAAA;MAAKuD,SAAS,EAAE7C,MAAM,CAACL,KAAM;MAAA0C,QAAA,EAAE1C;IAAK,CAAM,CAAC,eAC/CH,KAAA;MACEqD,SAAS,EAAE7C,MAAM,CAAC8C,QAAS;MAC3BC,OAAO,EAAEhB,QAAS;MAClBiB,SAAS,EAAGhB,CAAC,IAAK;QAChB,IAAIA,CAAC,CAACiB,GAAG,KAAK,OAAO,EAAElB,QAAQ,CAACC,CAAC,CAAC;MACpC,CAAE;MACFkB,GAAG,EAAE/C,WAAY;MACjBgD,IAAI,EAAC,SAAS;MACdC,QAAQ,EAAE,CAAE;MAAAf,QAAA,GAEXD,QAAQ,eACT9C,IAAA;QAAKuD,SAAS,EAAE7C,MAAM,CAACqD;MAAM,CAAE,CAAC;IAAA,CAC7B,CAAC,EAEJpD,MAAM,gBACJX,IAAA,CAACN,OAAO;MACNsE,cAAc,EAAEX,iBAAkB;MAClCY,cAAc,EAAElD,MAAO;MACvBmD,QAAQ,EAAEA,CAAA,KAAM;QACdtD,SAAS,CAAC,KAAK,CAAC;MAClB,CAAE;MACFN,QAAQ,EAAG6D,QAAQ,IAAK;QACtBvD,SAAS,CAAC,KAAK,CAAC;QAChB,IAAIN,QAAQ,EAAEA,QAAQ,CAAC6D,QAAQ,CAAC;MAClC,CAAE;MACFC,WAAW,EAAE1D,MAAM,CAACsC,MAAM,IAAI,EAAG;MACjCzC,OAAO,EAAEA,OAAQ;MACjBqD,GAAG,EAAE9C;IAAO,CACb,CAAC,GACA,IAAI;EAAA,CAEP,CAAC;AAEV,CAAC;AAED,eAAeX,cAAc","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"index.js","names":["useEffect","useRef","useState","useTheme","optionValueName","Options","areEqual","defaultTheme","Fragment","_Fragment","jsx","_jsx","jsxs","_jsxs","CustomDropdown","t0","$","_c","filter","label","onChange","options","theme","value","custom","active","setActive","dropdownRef","opsRef","opsPos","setOpsPos","upward","setUpward","t1","t2","id","cb","anchor","current","getBoundingClientRect","opsRect","measure","fitsDown","bottom","height","window","visualViewport","fitsUp","top","up","pos","left","width","now","requestAnimationFrame","cancelAnimationFrame","t3","Symbol","for","e","view","rect","stopPropagation","openList","t4","children","selected","option","iValue","iName","containerClassName","container","opsContainerClass","select","t5","undefined","className","t6","e_0","key","t7","arrow","t8","dropdown","onClick","onKeyDown","ref","role","tabIndex","t9","containerClass","containerStyle","onCancel","newValue","optionClass","t10"],"sources":["../../../../../../src/shared/components/selectors/CustomDropdown/index.tsx"],"sourcesContent":["import {\n type FunctionComponent,\n type ReactNode,\n useEffect,\n useRef,\n useState,\n} from 'react';\n\nimport { useTheme } from '@dr.pogodin/react-themes';\n\nimport { type PropsT, type ValueT, optionValueName } from '../common';\n\nimport Options, { type ContainerPosT, type RefT, areEqual } from './Options';\n\nimport defaultTheme from './theme.scss';\n\nconst CustomDropdown: FunctionComponent<\n PropsT<ReactNode, (value: ValueT) => void>\n> = ({\n filter,\n label,\n onChange,\n options,\n theme,\n value,\n}) => {\n const custom = useTheme('CustomDropdown', defaultTheme, theme);\n\n const [active, setActive] = useState(false);\n\n const dropdownRef = useRef<HTMLDivElement>(null);\n const opsRef = useRef<RefT>(null);\n\n const [opsPos, setOpsPos] = useState<ContainerPosT>();\n const [upward, setUpward] = useState(false);\n\n useEffect(() => {\n if (!active) return undefined;\n\n let id: number;\n const cb = () => {\n const anchor = dropdownRef.current?.getBoundingClientRect();\n const opsRect = opsRef.current?.measure();\n if (anchor && opsRect) {\n const fitsDown = anchor.bottom + opsRect.height\n < (window.visualViewport?.height ?? 0);\n const fitsUp = anchor.top - opsRect.height > 0;\n\n const up = !fitsDown && fitsUp;\n setUpward(up);\n\n const pos = up ? {\n left: anchor.left,\n top: anchor.top - opsRect.height - 1,\n width: anchor.width,\n } : {\n left: anchor.left,\n top: anchor.bottom,\n width: anchor.width,\n };\n\n setOpsPos((now) => (areEqual(now, pos) ? now : pos));\n }\n id = requestAnimationFrame(cb);\n };\n requestAnimationFrame(cb);\n\n return () => {\n cancelAnimationFrame(id);\n };\n }, [active]);\n\n const openList = (\n e: React.KeyboardEvent<HTMLDivElement> | React.MouseEvent<HTMLDivElement>,\n ) => {\n const view = window.visualViewport;\n const rect = dropdownRef.current!.getBoundingClientRect();\n setActive(true);\n\n // NOTE: This first opens the dropdown off-screen, where it is measured\n // by an effect declared above, and then positioned below, or above\n // the original dropdown element, depending where it fits best\n // (if we first open it downward, it would flick if we immediately\n // move it above, at least with the current position update via local\n // react state, and not imperatively).\n setOpsPos({\n left: view?.width ?? 0,\n top: view?.height ?? 0,\n width: rect.width,\n });\n\n e.stopPropagation();\n };\n\n let selected: React.ReactNode = <>‌</>;\n for (const option of options) {\n if (!filter || filter(option)) {\n const [iValue, iName] = optionValueName(option);\n if (iValue === value) {\n selected = iName;\n break;\n }\n }\n }\n\n let containerClassName = custom.container;\n if (active) containerClassName += ` ${custom.active}`;\n\n let opsContainerClass = custom.select ?? '';\n if (upward) {\n containerClassName += ` ${custom.upward}`;\n opsContainerClass += ` ${custom.upward}`;\n }\n\n return (\n <div className={containerClassName}>\n {label === undefined ? null\n : <div className={custom.label}>{label}</div>}\n <div\n className={custom.dropdown}\n onClick={openList}\n onKeyDown={(e) => {\n if (e.key === 'Enter') openList(e);\n }}\n ref={dropdownRef}\n role=\"listbox\"\n tabIndex={0}\n >\n {selected}\n <div className={custom.arrow} />\n </div>\n {\n active ? (\n <Options\n containerClass={opsContainerClass}\n containerStyle={opsPos}\n onCancel={() => {\n setActive(false);\n }}\n onChange={(newValue) => {\n setActive(false);\n if (onChange) onChange(newValue);\n }}\n optionClass={custom.option ?? ''}\n options={options}\n ref={opsRef}\n />\n ) : null\n }\n </div>\n );\n};\n\nexport default CustomDropdown;\n"],"mappings":";;;;AAAA,SAGEA,SAAS,EAC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MACvB9C,OAAO,EAAPA,OAAO;MACXiE,GAAM,EAAN1D;IAAM,CAER,CAAC,GAfR,IAeQ;IAAAZ,CAAA,OAAAS,MAAA;IAAAT,CAAA,OAAAQ,MAAA,CAAA2C,MAAA;IAAAnD,CAAA,OAAAI,QAAA;IAAAJ,CAAA,OAAAwD,iBAAA;IAAAxD,CAAA,OAAAa,MAAA;IAAAb,CAAA,OAAAK,OAAA;IAAAL,CAAA,OAAAyE,EAAA;EAAA;IAAAA,EAAA,GAAAzE,CAAA;EAAA;EAAA,IAAA+E,GAAA;EAAA,IAAA/E,CAAA,SAAAsD,kBAAA,IAAAtD,CAAA,SAAA0D,EAAA,IAAA1D,CAAA,SAAAkE,EAAA,IAAAlE,CAAA,SAAAyE,EAAA;IAhCZM,GAAA,gBAAAlF,KAAA;MAAgB+D,SAAkB,EAAlBN,kBAAkB;MAAAL,QAAA,GAC/BS,EAC8C,EAC/CQ,EAYM,EAEJO,EAeQ;IAAA,CAEP,CAAC;IAAAzE,CAAA,OAAAsD,kBAAA;IAAAtD,CAAA,OAAA0D,EAAA;IAAA1D,CAAA,OAAAkE,EAAA;IAAAlE,CAAA,OAAAyE,EAAA;IAAAzE,CAAA,OAAA+E,GAAA;EAAA;IAAAA,GAAA,GAAA/E,CAAA;EAAA;EAAA,OAlCN+E,GAkCM;AAAA,CAET;AAED,eAAejF,cAAc","ignoreList":[]}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import "core-js/modules/es.array.push.js";
|
|
2
|
+
import { c as _c } from "react/compiler-runtime";
|
|
2
3
|
import { useTheme } from "@dr.pogodin/react-themes";
|
|
3
4
|
import { optionValueName } from "../common.js";
|
|
4
5
|
const defaultTheme = {
|
|
@@ -11,48 +12,97 @@ const defaultTheme = {
|
|
|
11
12
|
"options": "-dr-pogodin-react-utils___build-web-shared-components-selectors-Switch-theme___options___9-eOZo"
|
|
12
13
|
};
|
|
13
14
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
|
-
export const Switch =
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
15
|
+
export const Switch = t0 => {
|
|
16
|
+
const $ = _c(16);
|
|
17
|
+
const {
|
|
18
|
+
label,
|
|
19
|
+
onChange,
|
|
20
|
+
options,
|
|
21
|
+
theme,
|
|
22
|
+
value
|
|
23
|
+
} = t0;
|
|
21
24
|
const composed = useTheme("Switch", defaultTheme, theme);
|
|
22
|
-
if (!options || !composed.option)
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
25
|
+
if (!options || !composed.option) {
|
|
26
|
+
throw Error("Internal error");
|
|
27
|
+
}
|
|
28
|
+
let optionNodes;
|
|
29
|
+
if ($[0] !== composed.option || $[1] !== composed.selected || $[2] !== onChange || $[3] !== options || $[4] !== value) {
|
|
30
|
+
optionNodes = [];
|
|
31
|
+
for (const option of options) {
|
|
32
|
+
const [iValue, iName] = optionValueName(option);
|
|
33
|
+
let className = composed.option;
|
|
34
|
+
let onPress;
|
|
35
|
+
if (iValue === value) {
|
|
36
|
+
className = className + ` ${composed.selected}`;
|
|
37
|
+
} else {
|
|
38
|
+
if (onChange) {
|
|
39
|
+
onPress = () => {
|
|
40
|
+
onChange(iValue);
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
optionNodes.push(onPress ? /*#__PURE__*/_jsx("div", {
|
|
45
|
+
className: className,
|
|
46
|
+
onClick: onPress,
|
|
47
|
+
onKeyDown: e => {
|
|
48
|
+
if (e.key === "Enter") {
|
|
49
|
+
onPress();
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
role: "button",
|
|
53
|
+
tabIndex: 0,
|
|
54
|
+
children: iName
|
|
55
|
+
}, iValue) : /*#__PURE__*/_jsx("div", {
|
|
56
|
+
className: className,
|
|
57
|
+
children: iName
|
|
58
|
+
}, iValue));
|
|
32
59
|
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
children: iName
|
|
42
|
-
}, iValue) : /*#__PURE__*/_jsx("div", {
|
|
43
|
-
className: className,
|
|
44
|
-
children: iName
|
|
45
|
-
}, iValue));
|
|
60
|
+
$[0] = composed.option;
|
|
61
|
+
$[1] = composed.selected;
|
|
62
|
+
$[2] = onChange;
|
|
63
|
+
$[3] = options;
|
|
64
|
+
$[4] = value;
|
|
65
|
+
$[5] = optionNodes;
|
|
66
|
+
} else {
|
|
67
|
+
optionNodes = $[5];
|
|
46
68
|
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
69
|
+
let t1;
|
|
70
|
+
if ($[6] !== composed.label || $[7] !== label) {
|
|
71
|
+
t1 = label ? /*#__PURE__*/_jsx("div", {
|
|
50
72
|
className: composed.label,
|
|
51
73
|
children: label
|
|
52
|
-
}) : null
|
|
74
|
+
}) : null;
|
|
75
|
+
$[6] = composed.label;
|
|
76
|
+
$[7] = label;
|
|
77
|
+
$[8] = t1;
|
|
78
|
+
} else {
|
|
79
|
+
t1 = $[8];
|
|
80
|
+
}
|
|
81
|
+
let t2;
|
|
82
|
+
if ($[9] !== composed.options || $[10] !== optionNodes) {
|
|
83
|
+
t2 = /*#__PURE__*/_jsx("div", {
|
|
53
84
|
className: composed.options,
|
|
54
85
|
children: optionNodes
|
|
55
|
-
})
|
|
56
|
-
|
|
86
|
+
});
|
|
87
|
+
$[9] = composed.options;
|
|
88
|
+
$[10] = optionNodes;
|
|
89
|
+
$[11] = t2;
|
|
90
|
+
} else {
|
|
91
|
+
t2 = $[11];
|
|
92
|
+
}
|
|
93
|
+
let t3;
|
|
94
|
+
if ($[12] !== composed.container || $[13] !== t1 || $[14] !== t2) {
|
|
95
|
+
t3 = /*#__PURE__*/_jsxs("div", {
|
|
96
|
+
className: composed.container,
|
|
97
|
+
children: [t1, t2]
|
|
98
|
+
});
|
|
99
|
+
$[12] = composed.container;
|
|
100
|
+
$[13] = t1;
|
|
101
|
+
$[14] = t2;
|
|
102
|
+
$[15] = t3;
|
|
103
|
+
} else {
|
|
104
|
+
t3 = $[15];
|
|
105
|
+
}
|
|
106
|
+
return t3;
|
|
57
107
|
};
|
|
58
108
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["useTheme","optionValueName","defaultTheme","jsx","_jsx","jsxs","_jsxs","Switch","label","onChange","options","theme","value","composed","option","Error","optionNodes","iValue","iName","className","onPress","
|
|
1
|
+
{"version":3,"file":"index.js","names":["useTheme","optionValueName","defaultTheme","jsx","_jsx","jsxs","_jsxs","Switch","t0","$","_c","label","onChange","options","theme","value","composed","option","Error","optionNodes","selected","iValue","iName","className","onPress","push","onClick","onKeyDown","e","key","role","tabIndex","children","t1","t2","t3","container"],"sources":["../../../../../../src/shared/components/selectors/Switch/index.tsx"],"sourcesContent":["import type { FunctionComponent, ReactNode } from 'react';\n\nimport { type Theme, useTheme } from '@dr.pogodin/react-themes';\n\nimport {\n type OptionsT,\n type ValueT,\n optionValueName,\n} from '../common';\n\nimport defaultTheme from './theme.scss';\n\ntype ThemeT = Theme<'container' | 'label' | 'option' | 'options' | 'selected'>;\n\ntype PropsT = {\n label?: ReactNode;\n onChange?: (value: ValueT) => void;\n options?: Readonly<OptionsT<ReactNode>>;\n theme?: ThemeT;\n value?: ValueT;\n};\n\nexport const Switch: FunctionComponent<PropsT> = ({\n label,\n onChange,\n options,\n theme,\n value,\n}) => {\n const composed = useTheme('Switch', defaultTheme, theme);\n\n if (!options || !composed.option) throw Error('Internal error');\n\n const optionNodes: React.ReactNode[] = [];\n for (const option of options) {\n const [iValue, iName] = optionValueName(option);\n\n let className: string = composed.option;\n let onPress: (() => void) | undefined;\n if (iValue === value) className += ` ${composed.selected}`;\n else if (onChange) {\n onPress = () => {\n onChange(iValue);\n };\n }\n\n optionNodes.push(\n onPress\n ? (\n <div\n className={className}\n key={iValue}\n onClick={onPress}\n onKeyDown={(e) => {\n if (e.key === 'Enter') onPress();\n }}\n role=\"button\"\n tabIndex={0}\n >\n {iName}\n </div>\n )\n : <div className={className} key={iValue}>{iName}</div>,\n );\n }\n\n return (\n <div className={composed.container}>\n {label ? <div className={composed.label}>{label}</div> : null}\n\n <div className={composed.options}>\n {optionNodes}\n </div>\n </div>\n );\n};\n"],"mappings":";;AAEA,SAAqBA,QAAQ,QAAQ,0BAA0B;AAE/D,SAGEC,eAAe;AAAA,MAAAC,YAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;AAAA;AAGuB,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAYxC,OAAO,MAAMC,MAAiC,GAAGC,EAAA;EAAA,MAAAC,CAAA,GAAAC,EAAA;EAAC;IAAAC,KAAA;IAAAC,QAAA;IAAAC,OAAA;IAAAC,KAAA;IAAAC;EAAA,IAAAP,EAMjD;EACC,MAAAQ,QAAA,GAAiBhB,QAAQ,CAAC,QAAQ,EAAEE,YAAY,EAAEY,KAAK,CAAC;EAExD,IAAI,CAACD,OAA2B,IAA5B,CAAaG,QAAQ,CAAAC,MAAO;IAAE,MAAMC,KAAK,CAAC,gBAAgB,CAAC;EAAC;EAAA,IAAAC,WAAA;EAAA,IAAAV,CAAA,QAAAO,QAAA,CAAAC,MAAA,IAAAR,CAAA,QAAAO,QAAA,CAAAI,QAAA,IAAAX,CAAA,QAAAG,QAAA,IAAAH,CAAA,QAAAI,OAAA,IAAAJ,CAAA,QAAAM,KAAA;IAEhEI,WAAA,GAAuC,EAAE;IACzC,KAAK,MAAAF,MAAY,IAAIJ,OAAO;MAC1B,OAAAQ,MAAA,EAAAC,KAAA,IAAwBrB,eAAe,CAACgB,MAAM,CAAC;MAE/C,IAAAM,SAAA,GAAwBP,QAAQ,CAAAC,MAAO;MACnC,IAAAO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AAA,IAAAyB,EAAA;EAAA,IAAAzB,CAAA,QAAAO,QAAA,CAAAH,OAAA,IAAAJ,CAAA,SAAAU,WAAA;IAE7De,EAAA,gBAAA9B,IAAA;MAAgBmB,SAAgB,EAAhBP,QAAQ,CAAAH,OAAQ;MAAAmB,QAAA,EAC7Bb;IAAW,CACT,CAAC;IAAAV,CAAA,MAAAO,QAAA,CAAAH,OAAA;IAAAJ,CAAA,OAAAU,WAAA;IAAAV,CAAA,OAAAyB,EAAA;EAAA;IAAAA,EAAA,GAAAzB,CAAA;EAAA;EAAA,IAAA0B,EAAA;EAAA,IAAA1B,CAAA,SAAAO,QAAA,CAAAoB,SAAA,IAAA3B,CAAA,SAAAwB,EAAA,IAAAxB,CAAA,SAAAyB,EAAA;IALRC,EAAA,gBAAA7B,KAAA;MAAgBiB,SAAkB,EAAlBP,QAAQ,CAAAoB,SAAU;MAAAJ,QAAA,GAC/BC,EAA4D,EAE7DC,EAEM;IAAA,CACH,CAAC;IAAAzB,CAAA,OAAAO,QAAA,CAAAoB,SAAA;IAAA3B,CAAA,OAAAwB,EAAA;IAAAxB,CAAA,OAAAyB,EAAA;IAAAzB,CAAA,OAAA0B,EAAA;EAAA;IAAAA,EAAA,GAAA1B,CAAA;EAAA;EAAA,OANN0B,EAMM;AAAA,CAET","ignoreList":[]}
|
|
@@ -3,7 +3,7 @@ import { withGlobalStateType } from "@dr.pogodin/react-global-state"; /** Mappin
|
|
|
3
3
|
// or do we really need it to be an interface. Keeping the interface for now.
|
|
4
4
|
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions
|
|
5
5
|
const {
|
|
6
|
-
|
|
6
|
+
useSsrContext
|
|
7
7
|
} = withGlobalStateType();
|
|
8
|
-
export {
|
|
8
|
+
export { useSsrContext };
|
|
9
9
|
//# sourceMappingURL=globalState.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"globalState.js","names":["withGlobalStateType","
|
|
1
|
+
{"version":3,"file":"globalState.js","names":["withGlobalStateType","useSsrContext"],"sources":["../../../../src/shared/utils/globalState.ts"],"sourcesContent":["import type { Request } from 'express';\n\nimport { type SsrContext, withGlobalStateType } from '@dr.pogodin/react-global-state';\n\n/** Mapping \"chunkName\" > array of asset paths. */\nexport type ChunkGroupsT = Record<string, string[]>;\n\n// The type of data object injected by server into generated markup.\nexport type InjT = {\n CHUNK_GROUPS?: ChunkGroupsT;\n CONFIG?: Record<string, unknown>;\n ISTATE?: unknown;\n};\n\ndeclare global {\n // eslint-disable-next-line @typescript-eslint/consistent-type-definitions\n interface Window {\n REACT_UTILS_INJECTION?: InjT;\n }\n}\n\n// TODO: Not 100% sure now, whether it indeed can be replaced by type,\n// or do we really need it to be an interface. Keeping the interface for now.\n// eslint-disable-next-line @typescript-eslint/consistent-type-definitions\nexport interface SsrContextT<StateT> extends SsrContext<StateT> {\n chunkGroups: ChunkGroupsT;\n chunks: string[];\n\n /** If set at the end of SSR, the rendered will trigger\n * server-side redirect to this URL (and use the status\n * code). */\n redirectTo?: string;\n\n req: Request;\n status: number;\n}\n\nconst {\n useSsrContext,\n} = withGlobalStateType<unknown, SsrContextT<unknown>>();\n\nexport {\n useSsrContext,\n};\n"],"mappings":"AAEA,SAA0BA,mBAAmB,QAAQ,gCAAgC,CAErF,oDAGA;AAcA;AACA;AACA;AAcA,MAAM;EACJC;AACF,CAAC,GAAGD,mBAAmB,CAAgC,CAAC;AAExD,SACEC,aAAa","ignoreList":[]}
|
|
@@ -4,7 +4,7 @@ import * as webpack from "./webpack.js";
|
|
|
4
4
|
export * from "./isomorphy/index.js";
|
|
5
5
|
export { Barrier, Cached, Emitter, Semaphore, assertEmptyObject, withRetries } from "@dr.pogodin/js-utils";
|
|
6
6
|
export { COMPOSE as THEME_COMPOSE, PRIORITY as THEME_PRIORITY, ThemeProvider, useTheme } from "@dr.pogodin/react-themes";
|
|
7
|
-
export {
|
|
7
|
+
export { useSsrContext } from "./globalState.js";
|
|
8
8
|
export { default as splitComponent } from "./splitComponent.js";
|
|
9
9
|
export { getConfig, time, webpack };
|
|
10
10
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["getConfig","time","webpack","Barrier","Cached","Emitter","Semaphore","assertEmptyObject","withRetries","COMPOSE","THEME_COMPOSE","PRIORITY","THEME_PRIORITY","ThemeProvider","useTheme","
|
|
1
|
+
{"version":3,"file":"index.js","names":["getConfig","time","webpack","Barrier","Cached","Emitter","Semaphore","assertEmptyObject","withRetries","COMPOSE","THEME_COMPOSE","PRIORITY","THEME_PRIORITY","ThemeProvider","useTheme","useSsrContext","default","splitComponent"],"sources":["../../../../src/shared/utils/index.ts"],"sourcesContent":["import { getConfig } from './config';\nimport time from './time';\nimport * as webpack from './webpack';\n\nexport * from './isomorphy';\n\nexport {\n Barrier,\n Cached,\n Emitter,\n type Listener,\n type ObjectKey,\n Semaphore,\n assertEmptyObject,\n withRetries,\n} from '@dr.pogodin/js-utils';\n\nexport {\n COMPOSE as THEME_COMPOSE,\n PRIORITY as THEME_PRIORITY,\n type Theme,\n ThemeProvider,\n useTheme,\n} from '@dr.pogodin/react-themes';\n\nexport { useSsrContext } from './globalState';\nexport { default as splitComponent } from './splitComponent';\n\nexport { getConfig, time, webpack };\n"],"mappings":"SAASA,SAAS;AAAA,OACXC,IAAI;AAAA,OACJ,KAAKC,OAAO;AAAA;AAInB,SACEC,OAAO,EACPC,MAAM,EACNC,OAAO,EAGPC,SAAS,EACTC,iBAAiB,EACjBC,WAAW,QACN,sBAAsB;AAE7B,SACEC,OAAO,IAAIC,aAAa,EACxBC,QAAQ,IAAIC,cAAc,EAE1BC,aAAa,EACbC,QAAQ,QACH,0BAA0B;AAEjC,SAASC,aAAa;AAAA,SACbC,OAAO,IAAIC,cAAc;AAElC,SAASjB,SAAS,EAAEC,IAAI,EAAEC,OAAO","ignoreList":[]}
|