@dr.pogodin/react-utils 1.47.0-alpha.1 → 1.47.0-alpha.11

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.
Files changed (306) hide show
  1. package/babel.config.js +1 -1
  2. package/babel.module.config.js +11 -0
  3. package/bin/build.js +8 -4
  4. package/bin/setup.js +2 -3
  5. package/build/development/client/getInj.js +57 -44
  6. package/build/development/client/getInj.js.map +1 -1
  7. package/build/development/client/index.js +15 -21
  8. package/build/development/client/index.js.map +1 -1
  9. package/build/development/client/init.js +2 -6
  10. package/build/development/client/init.js.map +1 -1
  11. package/build/development/index.js +3 -183
  12. package/build/development/index.js.map +1 -1
  13. package/build/development/server/Cache.js +1 -8
  14. package/build/development/server/Cache.js.map +1 -1
  15. package/build/development/server/index.js +22 -50
  16. package/build/development/server/index.js.map +1 -1
  17. package/build/development/server/renderer.js +83 -92
  18. package/build/development/server/renderer.js.map +1 -1
  19. package/build/development/server/server.js +58 -62
  20. package/build/development/server/server.js.map +1 -1
  21. package/build/development/server/utils/errors.js +8 -31
  22. package/build/development/server/utils/errors.js.map +1 -1
  23. package/build/development/server/utils/index.js +2 -9
  24. package/build/development/server/utils/index.js.map +1 -1
  25. package/build/development/shared/components/Button/index.js +9 -16
  26. package/build/development/shared/components/Button/index.js.map +1 -1
  27. package/build/development/shared/components/Checkbox/index.js +6 -13
  28. package/build/development/shared/components/Checkbox/index.js.map +1 -1
  29. package/build/development/shared/components/GenericLink/index.js +4 -10
  30. package/build/development/shared/components/GenericLink/index.js.map +1 -1
  31. package/build/development/shared/components/Input/index.js +11 -18
  32. package/build/development/shared/components/Input/index.js.map +1 -1
  33. package/build/development/shared/components/Link.js +6 -13
  34. package/build/development/shared/components/Link.js.map +1 -1
  35. package/build/development/shared/components/Modal/index.js +16 -22
  36. package/build/development/shared/components/Modal/index.js.map +1 -1
  37. package/build/development/shared/components/NavLink.js +6 -13
  38. package/build/development/shared/components/NavLink.js.map +1 -1
  39. package/build/development/shared/components/PageLayout/index.js +7 -14
  40. package/build/development/shared/components/PageLayout/index.js.map +1 -1
  41. package/build/development/shared/components/TextArea/index.js +15 -22
  42. package/build/development/shared/components/TextArea/index.js.map +1 -1
  43. package/build/development/shared/components/Throbber/index.js +7 -14
  44. package/build/development/shared/components/Throbber/index.js.map +1 -1
  45. package/build/development/shared/components/WithTooltip/Tooltip.js +12 -18
  46. package/build/development/shared/components/WithTooltip/Tooltip.js.map +1 -1
  47. package/build/development/shared/components/WithTooltip/index.js +16 -23
  48. package/build/development/shared/components/WithTooltip/index.js.map +1 -1
  49. package/build/development/shared/components/YouTubeVideo/index.js +10 -17
  50. package/build/development/shared/components/YouTubeVideo/index.js.map +1 -1
  51. package/build/development/shared/components/index.js +16 -130
  52. package/build/development/shared/components/index.js.map +1 -1
  53. package/build/development/shared/components/selectors/CustomDropdown/Options/index.js +18 -19
  54. package/build/development/shared/components/selectors/CustomDropdown/Options/index.js.map +1 -1
  55. package/build/development/shared/components/selectors/CustomDropdown/index.js +24 -28
  56. package/build/development/shared/components/selectors/CustomDropdown/index.js.map +1 -1
  57. package/build/development/shared/components/selectors/NativeDropdown/index.js +19 -19
  58. package/build/development/shared/components/selectors/NativeDropdown/index.js.map +1 -1
  59. package/build/development/shared/components/selectors/Switch/index.js +12 -17
  60. package/build/development/shared/components/selectors/Switch/index.js.map +1 -1
  61. package/build/development/shared/components/selectors/common.js +1 -7
  62. package/build/development/shared/components/selectors/common.js.map +1 -1
  63. package/build/development/shared/components/selectors/index.js +3 -27
  64. package/build/development/shared/components/selectors/index.js.map +1 -1
  65. package/build/development/shared/utils/config.js +40 -21
  66. package/build/development/shared/utils/config.js.map +1 -1
  67. package/build/development/shared/utils/globalState.js +3 -8
  68. package/build/development/shared/utils/globalState.js.map +1 -1
  69. package/build/development/shared/utils/index.js +12 -89
  70. package/build/development/shared/utils/index.js.map +1 -1
  71. package/build/development/shared/utils/isomorphy/buildInfo.js +2 -9
  72. package/build/development/shared/utils/isomorphy/buildInfo.js.map +1 -1
  73. package/build/development/shared/utils/isomorphy/environment-check.js +2 -8
  74. package/build/development/shared/utils/isomorphy/environment-check.js.map +1 -1
  75. package/build/development/shared/utils/isomorphy/index.js +7 -32
  76. package/build/development/shared/utils/isomorphy/index.js.map +1 -1
  77. package/build/development/shared/utils/jest/E2eSsrEnv.js +24 -31
  78. package/build/development/shared/utils/jest/E2eSsrEnv.js.map +1 -1
  79. package/build/development/shared/utils/jest/global.js +1 -7
  80. package/build/development/shared/utils/jest/global.js.map +1 -1
  81. package/build/development/shared/utils/jest/index.js +20 -44
  82. package/build/development/shared/utils/jest/index.js.map +1 -1
  83. package/build/development/shared/utils/splitComponent.js +54 -46
  84. package/build/development/shared/utils/splitComponent.js.map +1 -1
  85. package/build/development/shared/utils/time.js +22 -31
  86. package/build/development/shared/utils/time.js.map +1 -1
  87. package/build/development/shared/utils/webpack.js +17 -16
  88. package/build/development/shared/utils/webpack.js.map +1 -1
  89. package/build/production/client/getInj.js +13 -11
  90. package/build/production/client/getInj.js.map +1 -1
  91. package/build/production/client/index.js +3 -3
  92. package/build/production/client/index.js.map +1 -1
  93. package/build/production/client/init.js +2 -2
  94. package/build/production/client/init.js.map +1 -1
  95. package/build/production/index.js +2 -6
  96. package/build/production/index.js.map +1 -1
  97. package/build/production/server/Cache.js +3 -3
  98. package/build/production/server/Cache.js.map +1 -1
  99. package/build/production/server/index.js +8 -8
  100. package/build/production/server/index.js.map +1 -1
  101. package/build/production/server/renderer.js +24 -25
  102. package/build/production/server/renderer.js.map +1 -1
  103. package/build/production/server/server.js +9 -11
  104. package/build/production/server/server.js.map +1 -1
  105. package/build/production/server/utils/errors.js +9 -9
  106. package/build/production/server/utils/errors.js.map +1 -1
  107. package/build/production/server/utils/index.js +2 -1
  108. package/build/production/server/utils/index.js.map +1 -1
  109. package/build/production/shared/components/Button/index.js +4 -4
  110. package/build/production/shared/components/Button/index.js.map +1 -1
  111. package/build/production/shared/components/Checkbox/index.js +1 -1
  112. package/build/production/shared/components/Checkbox/index.js.map +1 -1
  113. package/build/production/shared/components/GenericLink/index.js +4 -4
  114. package/build/production/shared/components/GenericLink/index.js.map +1 -1
  115. package/build/production/shared/components/Input/index.js +5 -5
  116. package/build/production/shared/components/Input/index.js.map +1 -1
  117. package/build/production/shared/components/Link.js +3 -3
  118. package/build/production/shared/components/Link.js.map +1 -1
  119. package/build/production/shared/components/Modal/index.js +7 -7
  120. package/build/production/shared/components/Modal/index.js.map +1 -1
  121. package/build/production/shared/components/NavLink.js +2 -2
  122. package/build/production/shared/components/NavLink.js.map +1 -1
  123. package/build/production/shared/components/PageLayout/index.js +2 -2
  124. package/build/production/shared/components/PageLayout/index.js.map +1 -1
  125. package/build/production/shared/components/TextArea/index.js +5 -5
  126. package/build/production/shared/components/TextArea/index.js.map +1 -1
  127. package/build/production/shared/components/Throbber/index.js +2 -2
  128. package/build/production/shared/components/Throbber/index.js.map +1 -1
  129. package/build/production/shared/components/WithTooltip/Tooltip.js +4 -4
  130. package/build/production/shared/components/WithTooltip/Tooltip.js.map +1 -1
  131. package/build/production/shared/components/WithTooltip/index.js +4 -4
  132. package/build/production/shared/components/WithTooltip/index.js.map +1 -1
  133. package/build/production/shared/components/YouTubeVideo/index.js +4 -4
  134. package/build/production/shared/components/YouTubeVideo/index.js.map +1 -1
  135. package/build/production/shared/components/index.js +3 -1
  136. package/build/production/shared/components/index.js.map +1 -1
  137. package/build/production/shared/components/selectors/CustomDropdown/Options/index.js +2 -2
  138. package/build/production/shared/components/selectors/CustomDropdown/Options/index.js.map +1 -1
  139. package/build/production/shared/components/selectors/CustomDropdown/index.js +2 -2
  140. package/build/production/shared/components/selectors/CustomDropdown/index.js.map +1 -1
  141. package/build/production/shared/components/selectors/NativeDropdown/index.js +4 -4
  142. package/build/production/shared/components/selectors/NativeDropdown/index.js.map +1 -1
  143. package/build/production/shared/components/selectors/Switch/index.js +1 -1
  144. package/build/production/shared/components/selectors/Switch/index.js.map +1 -1
  145. package/build/production/shared/components/selectors/common.js +2 -2
  146. package/build/production/shared/components/selectors/common.js.map +1 -1
  147. package/build/production/shared/components/selectors/index.js +1 -1
  148. package/build/production/shared/components/selectors/index.js.map +1 -1
  149. package/build/production/shared/utils/config.js +8 -6
  150. package/build/production/shared/utils/config.js.map +1 -1
  151. package/build/production/shared/utils/globalState.js +2 -2
  152. package/build/production/shared/utils/globalState.js.map +1 -1
  153. package/build/production/shared/utils/index.js +1 -1
  154. package/build/production/shared/utils/index.js.map +1 -1
  155. package/build/production/shared/utils/isomorphy/buildInfo.js +3 -3
  156. package/build/production/shared/utils/isomorphy/buildInfo.js.map +1 -1
  157. package/build/production/shared/utils/isomorphy/environment-check.js +3 -3
  158. package/build/production/shared/utils/isomorphy/environment-check.js.map +1 -1
  159. package/build/production/shared/utils/isomorphy/index.js +4 -4
  160. package/build/production/shared/utils/isomorphy/index.js.map +1 -1
  161. package/build/production/shared/utils/jest/E2eSsrEnv.js +14 -14
  162. package/build/production/shared/utils/jest/E2eSsrEnv.js.map +1 -1
  163. package/build/production/shared/utils/jest/global.js +1 -1
  164. package/build/production/shared/utils/jest/global.js.map +1 -1
  165. package/build/production/shared/utils/jest/index.js +11 -11
  166. package/build/production/shared/utils/jest/index.js.map +1 -1
  167. package/build/production/shared/utils/splitComponent.js +11 -22
  168. package/build/production/shared/utils/splitComponent.js.map +1 -1
  169. package/build/production/shared/utils/time.js +3 -3
  170. package/build/production/shared/utils/time.js.map +1 -1
  171. package/build/production/shared/utils/webpack.js +6 -6
  172. package/build/production/shared/utils/webpack.js.map +1 -1
  173. package/build/types-code/client/getInj.d.ts +1 -2
  174. package/build/types-code/client/index.d.ts +1 -1
  175. package/build/types-code/index.d.ts +1 -7
  176. package/build/types-code/server/index.d.ts +6 -11
  177. package/build/types-code/server/utils/index.d.ts +1 -1
  178. package/build/types-code/shared/utils/config.d.ts +4 -2
  179. package/build/types-code/shared/utils/index.d.ts +2 -2
  180. package/build/types-code/shared/utils/splitComponent.d.ts +6 -4
  181. package/build/web/client/getInj.js +55 -44
  182. package/build/web/client/getInj.js.map +1 -1
  183. package/build/web/client/index.js +15 -21
  184. package/build/web/client/index.js.map +1 -1
  185. package/build/web/client/init.js +2 -4
  186. package/build/web/client/init.js.map +1 -1
  187. package/build/web/index.js +1 -15
  188. package/build/web/index.js.map +1 -1
  189. package/build/web/server/index.js +12 -21
  190. package/build/web/server/index.js.map +1 -1
  191. package/build/web/server/renderer.js +34 -40
  192. package/build/web/server/renderer.js.map +1 -1
  193. package/build/web/server/server.js +14 -11
  194. package/build/web/server/server.js.map +1 -1
  195. package/build/web/server/utils/index.js +1 -1
  196. package/build/web/server/utils/index.js.map +1 -1
  197. package/build/web/shared/components/Button/index.js +1 -1
  198. package/build/web/shared/components/Button/index.js.map +1 -1
  199. package/build/web/shared/components/Checkbox/index.js +1 -1
  200. package/build/web/shared/components/Checkbox/index.js.map +1 -1
  201. package/build/web/shared/components/Input/index.js +1 -1
  202. package/build/web/shared/components/Input/index.js.map +1 -1
  203. package/build/web/shared/components/Modal/index.js +3 -3
  204. package/build/web/shared/components/Modal/index.js.map +1 -1
  205. package/build/web/shared/components/PageLayout/index.js +1 -1
  206. package/build/web/shared/components/PageLayout/index.js.map +1 -1
  207. package/build/web/shared/components/TextArea/index.js +1 -1
  208. package/build/web/shared/components/TextArea/index.js.map +1 -1
  209. package/build/web/shared/components/Throbber/index.js +1 -1
  210. package/build/web/shared/components/Throbber/index.js.map +1 -1
  211. package/build/web/shared/components/WithTooltip/index.js +1 -1
  212. package/build/web/shared/components/WithTooltip/index.js.map +1 -1
  213. package/build/web/shared/components/YouTubeVideo/index.js +1 -1
  214. package/build/web/shared/components/YouTubeVideo/index.js.map +1 -1
  215. package/build/web/shared/components/selectors/CustomDropdown/Options/index.js +3 -0
  216. package/build/web/shared/components/selectors/CustomDropdown/Options/index.js.map +1 -1
  217. package/build/web/shared/components/selectors/CustomDropdown/index.js +3 -1
  218. package/build/web/shared/components/selectors/CustomDropdown/index.js.map +1 -1
  219. package/build/web/shared/components/selectors/NativeDropdown/index.js +4 -1
  220. package/build/web/shared/components/selectors/NativeDropdown/index.js.map +1 -1
  221. package/build/web/shared/components/selectors/Switch/index.js +2 -1
  222. package/build/web/shared/components/selectors/Switch/index.js.map +1 -1
  223. package/build/web/shared/utils/config.js +38 -14
  224. package/build/web/shared/utils/config.js.map +1 -1
  225. package/build/web/shared/utils/index.js +2 -2
  226. package/build/web/shared/utils/index.js.map +1 -1
  227. package/build/web/shared/utils/jest/E2eSsrEnv.js +3 -2
  228. package/build/web/shared/utils/jest/E2eSsrEnv.js.map +1 -1
  229. package/build/web/shared/utils/splitComponent.js +27 -20
  230. package/build/web/shared/utils/splitComponent.js.map +1 -1
  231. package/build/web/shared/utils/webpack.js +13 -7
  232. package/build/web/shared/utils/webpack.js.map +1 -1
  233. package/config/babel/node-ssr.js +12 -6
  234. package/config/babel/webpack.js +6 -1
  235. package/config/jest/default.js +8 -2
  236. package/config/jest/setup.js +8 -1
  237. package/config/webpack/app-base.js +23 -15
  238. package/config/webpack/app-development.js +2 -3
  239. package/config/webpack/lib-base.js +1 -2
  240. package/package.json +35 -25
  241. package/types.d.ts +1 -6
  242. package/node-entry.js +0 -15
  243. package/src/client/getInj.ts +0 -51
  244. package/src/client/index.tsx +0 -43
  245. package/src/client/init.ts +0 -52
  246. package/src/index.ts +0 -79
  247. package/src/server/Cache.ts +0 -61
  248. package/src/server/index.ts +0 -249
  249. package/src/server/renderer.tsx +0 -653
  250. package/src/server/server.ts +0 -332
  251. package/src/server/utils/errors.ts +0 -122
  252. package/src/server/utils/index.ts +0 -3
  253. package/src/shared/components/Button/index.tsx +0 -130
  254. package/src/shared/components/Button/style.scss +0 -54
  255. package/src/shared/components/Checkbox/index.tsx +0 -53
  256. package/src/shared/components/Checkbox/theme.scss +0 -63
  257. package/src/shared/components/GenericLink/index.tsx +0 -141
  258. package/src/shared/components/GenericLink/style.scss +0 -3
  259. package/src/shared/components/Input/index.tsx +0 -96
  260. package/src/shared/components/Input/theme.scss +0 -52
  261. package/src/shared/components/Link.tsx +0 -25
  262. package/src/shared/components/Modal/base-theme.scss +0 -38
  263. package/src/shared/components/Modal/index.tsx +0 -177
  264. package/src/shared/components/Modal/styles.scss +0 -3
  265. package/src/shared/components/NavLink.tsx +0 -18
  266. package/src/shared/components/PageLayout/base-theme.scss +0 -30
  267. package/src/shared/components/PageLayout/index.tsx +0 -51
  268. package/src/shared/components/TextArea/index.tsx +0 -139
  269. package/src/shared/components/TextArea/style.scss +0 -68
  270. package/src/shared/components/Throbber/index.tsx +0 -28
  271. package/src/shared/components/Throbber/theme.scss +0 -26
  272. package/src/shared/components/WithTooltip/Tooltip.tsx +0 -274
  273. package/src/shared/components/WithTooltip/default-theme.scss +0 -36
  274. package/src/shared/components/WithTooltip/index.tsx +0 -186
  275. package/src/shared/components/YouTubeVideo/base.scss +0 -15
  276. package/src/shared/components/YouTubeVideo/index.tsx +0 -73
  277. package/src/shared/components/YouTubeVideo/throbber.scss +0 -11
  278. package/src/shared/components/index.ts +0 -20
  279. package/src/shared/components/selectors/CustomDropdown/Options/index.tsx +0 -124
  280. package/src/shared/components/selectors/CustomDropdown/Options/style.scss +0 -6
  281. package/src/shared/components/selectors/CustomDropdown/index.tsx +0 -146
  282. package/src/shared/components/selectors/CustomDropdown/theme.scss +0 -118
  283. package/src/shared/components/selectors/NativeDropdown/index.tsx +0 -90
  284. package/src/shared/components/selectors/NativeDropdown/theme.scss +0 -81
  285. package/src/shared/components/selectors/Switch/index.tsx +0 -74
  286. package/src/shared/components/selectors/Switch/theme.scss +0 -39
  287. package/src/shared/components/selectors/common.ts +0 -57
  288. package/src/shared/components/selectors/index.ts +0 -8
  289. package/src/shared/utils/config.ts +0 -28
  290. package/src/shared/utils/globalState.ts +0 -44
  291. package/src/shared/utils/index.ts +0 -45
  292. package/src/shared/utils/isomorphy/buildInfo.ts +0 -50
  293. package/src/shared/utils/isomorphy/environment-check.ts +0 -18
  294. package/src/shared/utils/isomorphy/index.ts +0 -36
  295. package/src/shared/utils/jest/E2eSsrEnv.ts +0 -305
  296. package/src/shared/utils/jest/global.ts +0 -17
  297. package/src/shared/utils/jest/index.ts +0 -215
  298. package/src/shared/utils/splitComponent.tsx +0 -275
  299. package/src/shared/utils/time.ts +0 -101
  300. package/src/shared/utils/webpack.ts +0 -74
  301. package/src/styles/_global/reset.css +0 -52
  302. package/src/styles/_mixins/fonts.scss +0 -40
  303. package/src/styles/_mixins/media.scss +0 -150
  304. package/src/styles/_mixins/typography.scss +0 -83
  305. package/src/styles/global.scss +0 -11
  306. package/src/styles/mixins.scss +0 -6
@@ -1,14 +1,6 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.default = void 0;
8
- var _qs = _interopRequireDefault(require("qs"));
9
- var _reactThemes = _interopRequireDefault(require("@dr.pogodin/react-themes"));
10
- var _Throbber = _interopRequireDefault(require("../Throbber"));
11
- var _jsxRuntime = require("react/jsx-runtime");
1
+ import qs from 'qs';
2
+ import themed from '@dr.pogodin/react-themes';
3
+ import Throbber from "../Throbber/index.js";
12
4
  const baseTheme = {
13
5
  "context": "-dr-pogodin-react-utils___build-web-shared-components-YouTubeVideo-base___context___Pa7GiX",
14
6
  "ad": "-dr-pogodin-react-utils___build-web-shared-components-YouTubeVideo-base___ad___NikZ57",
@@ -22,6 +14,7 @@ const throbberTheme = {
22
14
  "hoc": "-dr-pogodin-react-utils___build-web-shared-components-YouTubeVideo-throbber___hoc___T5TGzT",
23
15
  "container": "-dr-pogodin-react-utils___build-web-shared-components-YouTubeVideo-throbber___container___IgN6Uf"
24
16
  };
17
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
25
18
  /**
26
19
  * A component for embeding a YouTube video.
27
20
  * @param [props] Component properties.
@@ -46,21 +39,21 @@ const YouTubeVideo = ({
46
39
  const srcParts = src.split('?');
47
40
  let [url] = srcParts;
48
41
  const [, queryString] = srcParts;
49
- const query = queryString ? _qs.default.parse(queryString) : {};
42
+ const query = queryString ? qs.parse(queryString) : {};
50
43
  const videoId = query.v ?? url?.match(/\/([a-zA-Z0-9-_]*)$/)?.[1];
51
44
  url = `https://www.youtube.com/embed/${videoId}`;
52
45
  delete query.v;
53
46
  query.autoplay = autoplay ? '1' : '0';
54
- url += `?${_qs.default.stringify(query)}`;
47
+ url += `?${qs.stringify(query)}`;
55
48
 
56
49
  // TODO: https://developers.google.com/youtube/player_parameters
57
50
  // More query parameters can be exposed via the component props.
58
51
 
59
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
52
+ return /*#__PURE__*/_jsxs("div", {
60
53
  className: theme.container,
61
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Throbber.default, {
54
+ children: [/*#__PURE__*/_jsx(Throbber, {
62
55
  theme: throbberTheme
63
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("iframe", {
56
+ }), /*#__PURE__*/_jsx("iframe", {
64
57
  // eslint-disable-line react/iframe-missing-sandbox
65
58
  allow: "autoplay",
66
59
  allowFullScreen: true,
@@ -70,5 +63,5 @@ const YouTubeVideo = ({
70
63
  })]
71
64
  });
72
65
  };
73
- var _default = exports.default = (0, _reactThemes.default)(YouTubeVideo, 'YouTubeVideo', baseTheme);
66
+ export default /* #__PURE__ */themed(YouTubeVideo, 'YouTubeVideo', baseTheme);
74
67
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_qs","_interopRequireDefault","require","_reactThemes","_Throbber","_jsxRuntime","baseTheme","throbberTheme","YouTubeVideo","autoplay","src","theme","title","srcParts","split","url","queryString","query","qs","parse","videoId","v","match","stringify","_jsxs","className","container","children","_jsx","Throbber","allow","allowFullScreen","video","_default","exports","default","themed"],"sources":["../../../../../src/shared/components/YouTubeVideo/index.tsx"],"sourcesContent":["import qs from 'qs';\n\nimport themed, { type Theme } from '@dr.pogodin/react-themes';\n\nimport Throbber from 'components/Throbber';\n\nimport baseTheme from './base.scss';\nimport throbberTheme from './throbber.scss';\n\ntype ComponentThemeT = Theme<'container' | 'video'>;\n\ntype PropsT = {\n autoplay?: boolean;\n src: string;\n theme: ComponentThemeT;\n title?: string;\n};\n\n/**\n * A component for embeding a YouTube video.\n * @param [props] Component properties.\n * @param [props.autoplay] If `true` the video will start to play\n * automatically once loaded.\n * @param [props.src] URL of the video to play. Can be in any of\n * the following formats, and keeps any additional query parameters understood\n * by the YouTube IFrame player:\n * - `https://www.youtube.com/watch?v=NdF6Rmt6Ado`\n * - `https://youtu.be/NdF6Rmt6Ado`\n * - `https://www.youtube.com/embed/NdF6Rmt6Ado`\n * @param [props.theme] _Ad hoc_ theme.\n * @param [props.title] The `title` attribute to add to the player\n * IFrame.\n */\nconst YouTubeVideo: React.FunctionComponent<PropsT> = ({\n autoplay,\n src,\n theme,\n title,\n}) => {\n const srcParts = src.split('?');\n let [url] = srcParts;\n const [, queryString] = srcParts;\n const query = queryString ? qs.parse(queryString) : {};\n\n const videoId = query.v ?? url?.match(/\\/([a-zA-Z0-9-_]*)$/)?.[1];\n url = `https://www.youtube.com/embed/${videoId as string}`;\n\n delete query.v;\n query.autoplay = autoplay ? '1' : '0';\n url += `?${qs.stringify(query)}`;\n\n // TODO: https://developers.google.com/youtube/player_parameters\n // More query parameters can be exposed via the component props.\n\n return (\n <div className={theme.container}>\n <Throbber theme={throbberTheme} />\n {/* TODO: I guess, we better add the sanbox, but right now I don't have\n time to carefully explore which restrictions should be lifted to allow\n embed YouTube player to work... sometime later we'll take care of it */\n }\n <iframe // eslint-disable-line react/iframe-missing-sandbox\n allow=\"autoplay\"\n allowFullScreen\n className={theme.video}\n src={url}\n title={title}\n />\n </div>\n );\n};\n\nexport default themed(YouTubeVideo, 'YouTubeVideo', baseTheme);\n"],"mappings":";;;;;;;AAAA,IAAAA,GAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,YAAA,GAAAF,sBAAA,CAAAC,OAAA;AAEA,I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;IAAM,CACd,CAAC;EAAA,CACC,CAAC;AAEV,CAAC;AAAA,IAAAqB,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEc,IAAAC,oBAAM,EAAC5B,YAAY,EAAE,cAAc,EAAEF,SAAS,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["qs","themed","Throbber","baseTheme","throbberTheme","jsx","_jsx","jsxs","_jsxs","YouTubeVideo","autoplay","src","theme","title","srcParts","split","url","queryString","query","parse","videoId","v","match","stringify","className","container","children","allow","allowFullScreen","video"],"sources":["../../../../../src/shared/components/YouTubeVideo/index.tsx"],"sourcesContent":["import qs from 'qs';\n\nimport themed, { type Theme } from '@dr.pogodin/react-themes';\n\nimport Throbber from 'components/Throbber';\n\nimport baseTheme from './base.scss';\nimport throbberTheme from './throbber.scss';\n\ntype ComponentThemeT = Theme<'container' | 'video'>;\n\ntype PropsT = {\n autoplay?: boolean;\n src: string;\n theme: ComponentThemeT;\n title?: string;\n};\n\n/**\n * A component for embeding a YouTube video.\n * @param [props] Component properties.\n * @param [props.autoplay] If `true` the video will start to play\n * automatically once loaded.\n * @param [props.src] URL of the video to play. Can be in any of\n * the following formats, and keeps any additional query parameters understood\n * by the YouTube IFrame player:\n * - `https://www.youtube.com/watch?v=NdF6Rmt6Ado`\n * - `https://youtu.be/NdF6Rmt6Ado`\n * - `https://www.youtube.com/embed/NdF6Rmt6Ado`\n * @param [props.theme] _Ad hoc_ theme.\n * @param [props.title] The `title` attribute to add to the player\n * IFrame.\n */\nconst YouTubeVideo: React.FunctionComponent<PropsT> = ({\n autoplay,\n src,\n theme,\n title,\n}) => {\n const srcParts = src.split('?');\n let [url] = srcParts;\n const [, queryString] = srcParts;\n const query = queryString ? qs.parse(queryString) : {};\n\n const videoId = query.v ?? url?.match(/\\/([a-zA-Z0-9-_]*)$/)?.[1];\n url = `https://www.youtube.com/embed/${videoId as string}`;\n\n delete query.v;\n query.autoplay = autoplay ? '1' : '0';\n url += `?${qs.stringify(query)}`;\n\n // TODO: https://developers.google.com/youtube/player_parameters\n // More query parameters can be exposed via the component props.\n\n return (\n <div className={theme.container}>\n <Throbber theme={throbberTheme} />\n {/* TODO: I guess, we better add the sanbox, but right now I don't have\n time to carefully explore which restrictions should be lifted to allow\n embed YouTube player to work... sometime later we'll take care of it */\n }\n <iframe // eslint-disable-line react/iframe-missing-sandbox\n allow=\"autoplay\"\n allowFullScreen\n className={theme.video}\n src={url}\n title={title}\n />\n </div>\n );\n};\n\nexport default /* #__PURE__ */ themed(YouTubeVideo, 'YouTubeVideo', baseTheme);\n"],"mappings":"AAAA,OAAOA,EAAE,MAAM,IAAI;AAEnB,OAAOC,MAAM,MAAsB,0BAA0B;AAAA,OAEtDC,QAAQ;AAAA,MAAAC,SAAA;EAAA;EAAA;EAAA;EAAA;EAAA;AAAA;AAAA,MAAAC,aAAA;EAAA;EAAA;EAAA;EAAA;AAAA;AAG6B,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAW5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,YAA6C,GAAGA,CAAC;EACrDC,QAAQ;EACRC,GAAG;EACHC,KAAK;EACLC;AACF,CAAC,KAAK;EACJ,MAAMC,QAAQ,GAAGH,GAAG,CAACI,KAAK,CAAC,GAAG,CAAC;EAC/B,IAAI,CAACC,GAAG,CAAC,GAAGF,QAAQ;EACpB,MAAM,GAAGG,WAAW,CAAC,GAAGH,QAAQ;EAChC,MAAMI,KAAK,GAAGD,WAAW,GAAGjB,EAAE,CAACmB,KAAK,CAACF,WAAW,CAAC,GAAG,CAAC,CAAC;EAEtD,MAAMG,OAAO,GAAGF,KAAK,CAACG,CAAC,IAAIL,GAAG,EAAEM,KAAK,CAAC,qBAAqB,CAAC,GAAG,CAAC,CAAC;EACjEN,GAAG,GAAG,iCAAiCI,OAAO,EAAY;EAE1D,OAAOF,KAAK,CAACG,CAAC;EACdH,KAAK,CAACR,QAAQ,GAAGA,QAAQ,GAAG,GAAG,GAAG,GAAG;EACrCM,GAAG,IAAI,IAAIhB,EAAE,CAACuB,SAAS,CAACL,KAAK,CAAC,EAAE;;EAEhC;EACA;;EAEA,oBACEV,KAAA;IAAKgB,SAAS,EAAEZ,KAAK,CAACa,SAAU;IAAAC,QAAA,gBAC9BpB,IAAA,CAACJ,QAAQ;MAACU,KAAK,EAAER;IAAc,CAAE,CAAC,eAKlCE,IAAA;MAAQ;MACNqB,KAAK,EAAC,UAAU;MAChBC,eAAe;MACfJ,SAAS,EAAEZ,KAAK,CAACiB,KAAM;MACvBlB,GAAG,EAAEK,GAAI;MACTH,KAAK,EAAEA;IAAM,CACd,CAAC;EAAA,CACC,CAAC;AAEV,CAAC;AAED,eAAe,eAAgBZ,MAAM,CAACQ,YAAY,EAAE,cAAc,EAAEN,SAAS,CAAC","ignoreList":[]}
@@ -1,132 +1,18 @@
1
- "use strict";
1
+ /**
2
+ * Just an aggregation of all exported components into a single module.
3
+ */
2
4
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- var _exportNames = {
8
- MetaTags: true,
9
- Button: true,
10
- BaseButton: true,
11
- Checkbox: true,
12
- Input: true,
13
- Link: true,
14
- PageLayout: true,
15
- Modal: true,
16
- BaseModal: true,
17
- NavLink: true,
18
- Throbber: true,
19
- WithTooltip: true,
20
- YouTubeVideo: true,
21
- TextArea: true
22
- };
23
- Object.defineProperty(exports, "BaseButton", {
24
- enumerable: true,
25
- get: function () {
26
- return _Button.BaseButton;
27
- }
28
- });
29
- Object.defineProperty(exports, "BaseModal", {
30
- enumerable: true,
31
- get: function () {
32
- return _Modal.BaseModal;
33
- }
34
- });
35
- Object.defineProperty(exports, "Button", {
36
- enumerable: true,
37
- get: function () {
38
- return _Button.default;
39
- }
40
- });
41
- Object.defineProperty(exports, "Checkbox", {
42
- enumerable: true,
43
- get: function () {
44
- return _Checkbox.default;
45
- }
46
- });
47
- Object.defineProperty(exports, "Input", {
48
- enumerable: true,
49
- get: function () {
50
- return _Input.default;
51
- }
52
- });
53
- Object.defineProperty(exports, "Link", {
54
- enumerable: true,
55
- get: function () {
56
- return _Link.default;
57
- }
58
- });
59
- Object.defineProperty(exports, "MetaTags", {
60
- enumerable: true,
61
- get: function () {
62
- return _reactHelmet.MetaTags;
63
- }
64
- });
65
- Object.defineProperty(exports, "Modal", {
66
- enumerable: true,
67
- get: function () {
68
- return _Modal.default;
69
- }
70
- });
71
- Object.defineProperty(exports, "NavLink", {
72
- enumerable: true,
73
- get: function () {
74
- return _NavLink.default;
75
- }
76
- });
77
- Object.defineProperty(exports, "PageLayout", {
78
- enumerable: true,
79
- get: function () {
80
- return _PageLayout.default;
81
- }
82
- });
83
- Object.defineProperty(exports, "TextArea", {
84
- enumerable: true,
85
- get: function () {
86
- return _TextArea.default;
87
- }
88
- });
89
- Object.defineProperty(exports, "Throbber", {
90
- enumerable: true,
91
- get: function () {
92
- return _Throbber.default;
93
- }
94
- });
95
- Object.defineProperty(exports, "WithTooltip", {
96
- enumerable: true,
97
- get: function () {
98
- return _WithTooltip.default;
99
- }
100
- });
101
- Object.defineProperty(exports, "YouTubeVideo", {
102
- enumerable: true,
103
- get: function () {
104
- return _YouTubeVideo.default;
105
- }
106
- });
107
- var _reactHelmet = require("@dr.pogodin/react-helmet");
108
- var _selectors = require("./selectors");
109
- Object.keys(_selectors).forEach(function (key) {
110
- if (key === "default" || key === "__esModule") return;
111
- if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
112
- if (key in exports && exports[key] === _selectors[key]) return;
113
- Object.defineProperty(exports, key, {
114
- enumerable: true,
115
- get: function () {
116
- return _selectors[key];
117
- }
118
- });
119
- });
120
- var _Button = _interopRequireWildcard(require("./Button"));
121
- var _Checkbox = _interopRequireDefault(require("./Checkbox"));
122
- var _Input = _interopRequireDefault(require("./Input"));
123
- var _Link = _interopRequireDefault(require("./Link"));
124
- var _PageLayout = _interopRequireDefault(require("./PageLayout"));
125
- var _Modal = _interopRequireWildcard(require("./Modal"));
126
- var _NavLink = _interopRequireDefault(require("./NavLink"));
127
- var _Throbber = _interopRequireDefault(require("./Throbber"));
128
- var _WithTooltip = _interopRequireDefault(require("./WithTooltip"));
129
- var _YouTubeVideo = _interopRequireDefault(require("./YouTubeVideo"));
130
- var _TextArea = _interopRequireDefault(require("./TextArea"));
131
- function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
5
+ export { MetaTags } from '@dr.pogodin/react-helmet';
6
+ export * from "./selectors/index.js";
7
+ export { default as Button, BaseButton } from "./Button/index.js";
8
+ export { default as Checkbox } from "./Checkbox/index.js";
9
+ export { default as Input } from "./Input/index.js";
10
+ export { default as Link } from "./Link.js";
11
+ export { default as PageLayout } from "./PageLayout/index.js";
12
+ export { default as Modal, BaseModal } from "./Modal/index.js";
13
+ export { default as NavLink } from "./NavLink.js";
14
+ export { default as Throbber } from "./Throbber/index.js";
15
+ export { default as WithTooltip } from "./WithTooltip/index.js";
16
+ export { default as YouTubeVideo } from "./YouTubeVideo/index.js";
17
+ export { default as TextArea } from "./TextArea/index.js";
132
18
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_reactHelmet","require","_selectors","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_Button","_interopRequireWildcard","_Checkbox","_interopRequireDefault","_Input","_Link","_PageLayout","_Modal","_NavLink","_Throbber","_WithTooltip","_YouTubeVideo","_TextArea","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","set","getOwnPropertyDescriptor"],"sources":["../../../../src/shared/components/index.ts"],"sourcesContent":["/**\n * Just an aggregation of all exported components into a single module.\n */\n\nexport { MetaTags } from '@dr.pogodin/react-helmet';\n\nexport * from 'components/selectors';\n\nexport { default as Button, BaseButton } from 'components/Button';\nexport { default as Checkbox } from 'components/Checkbox';\nexport { default as Input } from 'components/Input';\nexport { default as Link } from 'components/Link';\nexport { default as PageLayout } from 'components/PageLayout';\nexport { default as Modal, BaseModal } from 'components/Modal';\nexport { default as NavLink } from 'components/NavLink';\nexport { default as Throbber } from 'components/Throbber';\nexport { default as WithTooltip } from 'components/WithTooltip';\nexport { default as YouTubeVideo } from 'components/YouTubeVideo';\n\nexport { default as TextArea } from './TextArea';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,IAAAA,YAAA,GAAAC,OAAA;AAEA,IAAAC,UAAA,GAAAD,OAAA;AAAAE,MAAA,CAAAC,IAAA,CAAAF,UAAA,EAAAG,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAJ,UAAA,CAAAI,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAZ,UAAA,CAAAI,GAAA;IAAA;EAAA;AAAA;AAEA,IAAAS,OAAA,GAAAC,uBAAA,CAAAf,OAAA;AACA,IAAAgB,SAAA,GAAAC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AAA,IAAAqB,CAAA,CAAAK,GAAA,IAAAN,CAAA,CAAAE,CAAA,EAAAP,CAAA,EAAAM,CAAA,IAAAC,CAAA,CAAAP,CAAA,IAAAD,CAAA,CAAAC,CAAA,WAAAO,CAAA,KAAAR,CAAA,EAAAC,CAAA","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["MetaTags","default","Button","BaseButton","Checkbox","Input","Link","PageLayout","Modal","BaseModal","NavLink","Throbber","WithTooltip","YouTubeVideo","TextArea"],"sources":["../../../../src/shared/components/index.ts"],"sourcesContent":["/**\n * Just an aggregation of all exported components into a single module.\n */\n\nexport { MetaTags } from '@dr.pogodin/react-helmet';\n\nexport * from 'components/selectors';\n\nexport { default as Button, BaseButton } from 'components/Button';\nexport { default as Checkbox } from 'components/Checkbox';\nexport { default as Input } from 'components/Input';\nexport { default as Link } from 'components/Link';\nexport { default as PageLayout } from 'components/PageLayout';\nexport { default as Modal, BaseModal } from 'components/Modal';\nexport { default as NavLink } from 'components/NavLink';\nexport { default as Throbber } from 'components/Throbber';\nexport { default as WithTooltip } from 'components/WithTooltip';\nexport { default as YouTubeVideo } from 'components/YouTubeVideo';\n\nexport { default as TextArea } from './TextArea';\n"],"mappings":"AAAA;AACA;AACA;;AAEA,SAASA,QAAQ,QAAQ,0BAA0B;AAAA;AAAA,SAI1CC,OAAO,IAAIC,MAAM,EAAEC,UAAU;AAAA,SAC7BF,OAAO,IAAIG,QAAQ;AAAA,SACnBH,OAAO,IAAII,KAAK;AAAA,SAChBJ,OAAO,IAAIK,IAAI;AAAA,SACfL,OAAO,IAAIM,UAAU;AAAA,SACrBN,OAAO,IAAIO,KAAK,EAAEC,SAAS;AAAA,SAC3BR,OAAO,IAAIS,OAAO;AAAA,SAClBT,OAAO,IAAIU,QAAQ;AAAA,SACnBV,OAAO,IAAIW,WAAW;AAAA,SACtBX,OAAO,IAAIY,YAAY;AAAA,SAEvBZ,OAAO,IAAIa,QAAQ","ignoreList":[]}
@@ -1,18 +1,17 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.areEqual = areEqual;
7
- exports.default = void 0;
8
- var _react = require("react");
9
- var _Modal = require("../../../Modal");
10
- var _common = require("../../common");
11
- var _jsxRuntime = require("react/jsx-runtime");
1
+ import "core-js/modules/es.array.push.js";
2
+ import "core-js/modules/es.iterator.constructor.js";
3
+ import "core-js/modules/es.iterator.filter.js";
4
+ import "core-js/modules/es.array.push.js";
5
+ import "core-js/modules/es.iterator.constructor.js";
6
+ import "core-js/modules/es.iterator.filter.js";
7
+ import { useImperativeHandle, useRef } from 'react';
8
+ import { BaseModal } from "../../../Modal/index.js";
9
+ import { optionValueName } from "../../common.js";
12
10
  const S = {
13
11
  "overlay": "-dr-pogodin-react-utils___build-web-shared-components-selectors-CustomDropdown-Options-style___overlay___ntZ5My"
14
12
  };
15
- function areEqual(a, b) {
13
+ import { jsx as _jsx } from "react/jsx-runtime";
14
+ export function areEqual(a, b) {
16
15
  return a?.left === b?.left && a?.top === b?.top && a?.width === b?.width;
17
16
  }
18
17
  const Options = ({
@@ -25,8 +24,8 @@ const Options = ({
25
24
  options,
26
25
  ref
27
26
  }) => {
28
- const opsRef = (0, _react.useRef)(null);
29
- (0, _react.useImperativeHandle)(ref, () => ({
27
+ const opsRef = useRef(null);
28
+ useImperativeHandle(ref, () => ({
30
29
  measure: () => {
31
30
  const e = opsRef.current?.parentElement;
32
31
  if (!e) return undefined;
@@ -41,8 +40,8 @@ const Options = ({
41
40
  const optionNodes = [];
42
41
  for (const option of options) {
43
42
  if (!filter || filter(option)) {
44
- const [iValue, iName] = (0, _common.optionValueName)(option);
45
- optionNodes.push(/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
43
+ const [iValue, iName] = optionValueName(option);
44
+ optionNodes.push(/*#__PURE__*/_jsx("div", {
46
45
  className: optionClass,
47
46
  onClick: e => {
48
47
  onChange(iValue);
@@ -60,7 +59,7 @@ const Options = ({
60
59
  }, iValue));
61
60
  }
62
61
  }
63
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Modal.BaseModal
62
+ return /*#__PURE__*/_jsx(BaseModal
64
63
  // Closes the dropdown (cancels the selection) on any page scrolling attempt.
65
64
  // This is the same native <select> elements do on scrolling, and at least for
66
65
  // now we have no reason to deal with complications needed to support open
@@ -78,11 +77,11 @@ const Options = ({
78
77
  hoc: '',
79
78
  overlay: S.overlay
80
79
  },
81
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
80
+ children: /*#__PURE__*/_jsx("div", {
82
81
  ref: opsRef,
83
82
  children: optionNodes
84
83
  })
85
84
  });
86
85
  };
87
- var _default = exports.default = Options;
86
+ export default Options;
88
87
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_react","require","_Modal","_common","_jsxRuntime","S","areEqual","a","b","left","top","width","Options","containerClass","containerStyle","filter","onCancel","onChange","optionClass","options","ref","opsRef","useRef","useImperativeHandle","measure","e","current","parentElement","undefined","rect","getBoundingClientRect","style","window","getComputedStyle","mBottom","parseFloat","marginBottom","mTop","marginTop","height","optionNodes","option","iValue","iName","optionValueName","push","_jsx","className","onClick","stopPropagation","onKeyDown","key","role","tabIndex","children","BaseModal","cancelOnScrolling","dontDisableScrolling","theme","ad","container","context","hoc","overlay","_default","exports","default"],"sources":["../../../../../../../src/shared/components/selectors/CustomDropdown/Options/index.tsx"],"sourcesContent":["import {\n type FunctionComponent,\n type ReactNode,\n type RefObject,\n useImperativeHandle,\n useRef,\n} from 'react';\n\nimport { BaseModal } from 'components/Modal';\n\nimport {\n type OptionT,\n type OptionsT,\n type ValueT,\n optionValueName,\n} from '../../common';\n\nimport S from './style.scss';\n\nexport type ContainerPosT = {\n left: number;\n top: number;\n width: number;\n};\n\nexport function areEqual(a?: ContainerPosT, b?: ContainerPosT): boolean {\n return a?.left === b?.left && a?.top === b?.top && a?.width === b?.width;\n}\n\nexport type RefT = {\n measure: () => DOMRect | undefined;\n};\n\ntype PropsT = {\n containerClass: string;\n containerStyle?: ContainerPosT;\n filter?: (item: OptionT<ReactNode> | ValueT) => boolean;\n optionClass: string;\n options: Readonly<OptionsT<ReactNode>>;\n onCancel: () => void;\n onChange: (value: ValueT) => void;\n ref?: RefObject<RefT | null>;\n};\n\nconst Options: FunctionComponent<PropsT> = ({\n containerClass,\n containerStyle,\n filter,\n onCancel,\n onChange,\n optionClass,\n options,\n ref,\n}) => {\n const opsRef = useRef<HTMLDivElement>(null);\n\n useImperativeHandle(ref, () => ({\n measure: () => {\n const e = opsRef.current?.parentElement;\n if (!e) return undefined;\n\n const rect = opsRef.current!.getBoundingClientRect();\n const style = window.getComputedStyle(e);\n const mBottom = parseFloat(style.marginBottom);\n const mTop = parseFloat(style.marginTop);\n\n rect.height += mBottom + mTop;\n\n return rect;\n },\n }), []);\n\n const optionNodes: ReactNode[] = [];\n for (const option of options) {\n if (!filter || filter(option)) {\n const [iValue, iName] = optionValueName(option);\n optionNodes.push(\n <div\n className={optionClass}\n key={iValue}\n onClick={(e) => {\n onChange(iValue);\n e.stopPropagation();\n }}\n onKeyDown={(e) => {\n if (e.key === 'Enter') {\n onChange(iValue);\n e.stopPropagation();\n }\n }}\n role=\"button\"\n tabIndex={0}\n >\n {iName}\n </div>,\n );\n }\n }\n\n return (\n <BaseModal\n // Closes the dropdown (cancels the selection) on any page scrolling attempt.\n // This is the same native <select> elements do on scrolling, and at least for\n // now we have no reason to deal with complications needed to support open\n // dropdowns during the scrolling (that would need to re-position it in\n // response to the position changes of the root dropdown element).\n cancelOnScrolling\n dontDisableScrolling\n onCancel={onCancel}\n style={containerStyle}\n theme={{\n ad: '',\n container: containerClass,\n context: '',\n hoc: '',\n overlay: S.overlay,\n }}\n >\n <div ref={opsRef}>{optionNodes}</div>\n </BaseModal>\n );\n};\n\nexport default Options;\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAQA,IAAAC,MAAA,GAAAD,OAAA;AAEA,IAAAE,OAAA,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AAM,EAAEC,KAAK,CAAC,GAAG,IAAAC,uBAAe,EAACH,MAAM,CAAC;MAC/CD,WAAW,CAACK,IAAI,cACd,IAAAC,eAAA;QACEC,SAAS,EAAE7B,WAAY;QAEvB8B,OAAO,EAAGvB,CAAC,IAAK;UACdR,QAAQ,CAACyB,MAAM,CAAC;UAChBjB,CAAC,CAACwB,eAAe,CAAC,CAAC;QACrB,CAAE;QACFC,SAAS,EAAGzB,CAAC,IAAK;UAChB,IAAIA,CAAC,CAAC0B,GAAG,KAAK,OAAO,EAAE;YACrBlC,QAAQ,CAACyB,MAAM,CAAC;YAChBjB,CAAC,CAACwB,eAAe,CAAC,CAAC;UACrB;QACF,CAAE;QACFG,IAAI,EAAC,QAAQ;QACbC,QAAQ,EAAE,CAAE;QAAAC,QAAA,EAEXX;MAAK,GAdDD,MAeF,CACP,CAAC;IACH;EACF;EAEA,oBACE,IAAAI,eAAA,EAACS;EACC;EACA;EACA;EACA;EACA;EAAA;IACAC,iBAAiB;IACjBC,oBAAoB;IACpBzC,QAAQ,EAAEA,QAAS;IACnBe,KAAK,EAAEjB,cAAe;IACtB4C,KAAK,EAAE;MACLC,EAAE,EAAE,EAAE;MACNC,SAAS,EAAE/C,cAAc;MACzBgD,OAAO,EAAE,EAAE;MACXC,GAAG,EAAE,EAAE;MACPC,OAAO,EAAE1D,CAAC,CAAC0D;IACb,CAAE;IAAAT,QAAA,eAEF,IAAAR,eAAA;MAAK1B,GAAG,EAAEC,MAAO;MAAAiC,QAAA,EAAEd;IAAW,CAAM;EAAC,CAC5B,CAAC;AAEhB,CAAC;AAAA,IAAAwB,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEctD,OAAO","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["useImperativeHandle","useRef","BaseModal","optionValueName","S","jsx","_jsx","areEqual","a","b","left","top","width","Options","containerClass","containerStyle","filter","onCancel","onChange","optionClass","options","ref","opsRef","measure","e","current","parentElement","undefined","rect","getBoundingClientRect","style","window","getComputedStyle","mBottom","parseFloat","marginBottom","mTop","marginTop","height","optionNodes","option","iValue","iName","push","className","onClick","stopPropagation","onKeyDown","key","role","tabIndex","children","cancelOnScrolling","dontDisableScrolling","theme","ad","container","context","hoc","overlay"],"sources":["../../../../../../../src/shared/components/selectors/CustomDropdown/Options/index.tsx"],"sourcesContent":["import {\n type FunctionComponent,\n type ReactNode,\n type RefObject,\n useImperativeHandle,\n useRef,\n} from 'react';\n\nimport { BaseModal } from 'components/Modal';\n\nimport {\n type OptionT,\n type OptionsT,\n type ValueT,\n optionValueName,\n} from '../../common';\n\nimport S from './style.scss';\n\nexport type ContainerPosT = {\n left: number;\n top: number;\n width: number;\n};\n\nexport function areEqual(a?: ContainerPosT, b?: ContainerPosT): boolean {\n return a?.left === b?.left && a?.top === b?.top && a?.width === b?.width;\n}\n\nexport type RefT = {\n measure: () => DOMRect | undefined;\n};\n\ntype PropsT = {\n containerClass: string;\n containerStyle?: ContainerPosT;\n filter?: (item: OptionT<ReactNode> | ValueT) => boolean;\n optionClass: string;\n options: Readonly<OptionsT<ReactNode>>;\n onCancel: () => void;\n onChange: (value: ValueT) => void;\n ref?: RefObject<RefT | null>;\n};\n\nconst Options: FunctionComponent<PropsT> = ({\n containerClass,\n containerStyle,\n filter,\n onCancel,\n onChange,\n optionClass,\n options,\n ref,\n}) => {\n const opsRef = useRef<HTMLDivElement>(null);\n\n useImperativeHandle(ref, () => ({\n measure: () => {\n const e = opsRef.current?.parentElement;\n if (!e) return undefined;\n\n const rect = opsRef.current!.getBoundingClientRect();\n const style = window.getComputedStyle(e);\n const mBottom = parseFloat(style.marginBottom);\n const mTop = parseFloat(style.marginTop);\n\n rect.height += mBottom + mTop;\n\n return rect;\n },\n }), []);\n\n const optionNodes: ReactNode[] = [];\n for (const option of options) {\n if (!filter || filter(option)) {\n const [iValue, iName] = optionValueName(option);\n optionNodes.push(\n <div\n className={optionClass}\n key={iValue}\n onClick={(e) => {\n onChange(iValue);\n e.stopPropagation();\n }}\n onKeyDown={(e) => {\n if (e.key === 'Enter') {\n onChange(iValue);\n e.stopPropagation();\n }\n }}\n role=\"button\"\n tabIndex={0}\n >\n {iName}\n </div>,\n );\n }\n }\n\n return (\n <BaseModal\n // Closes the dropdown (cancels the selection) on any page scrolling attempt.\n // This is the same native <select> elements do on scrolling, and at least for\n // now we have no reason to deal with complications needed to support open\n // dropdowns during the scrolling (that would need to re-position it in\n // response to the position changes of the root dropdown element).\n cancelOnScrolling\n dontDisableScrolling\n onCancel={onCancel}\n style={containerStyle}\n theme={{\n ad: '',\n container: containerClass,\n context: '',\n hoc: '',\n overlay: S.overlay,\n }}\n >\n <div ref={opsRef}>{optionNodes}</div>\n </BaseModal>\n );\n};\n\nexport default Options;\n"],"mappings":";;;;;;AAAA,SAIEA,mBAAmB,EACnBC,MAAM,QACD,OAAO;AAAA,SAELC,SAAS;AAAA,SAMhBC,eAAe;AAAA,MAAAC,CAAA;EAAA;AAAA;AAGY,SAAAC,GAAA,IAAAC,IAAA;AAQ7B,OAAO,SAASC,QAAQA,CAACC,CAAiB,EAAEC,CAAiB,EAAW;EACtE,OAAOD,CAAC,EAAEE,IAAI,KAAKD,CAAC,EAAEC,IAAI,IAAIF,CAAC,EAAEG,GAAG,KAAKF,CAAC,EAAEE,GAAG,IAAIH,CAAC,EAAEI,KAAK,KAAKH,CAAC,EAAEG,KAAK;AAC1E;AAiBA,MAAMC,OAAkC,GAAGA,CAAC;EAC1CC,cAAc;EACdC,cAAc;EACdC,MAAM;EACNC,QAAQ;EACRC,QAAQ;EACRC,WAAW;EACXC,OAAO;EACPC;AACF,CAAC,KAAK;EACJ,MAAMC,MAAM,GAAGrB,MAAM,CAAiB,IAAI,CAAC;EAE3CD,mBAAmB,CAACqB,GAAG,EAAE,OAAO;IAC9BE,OAAO,EAAEA,CAAA,KAAM;MACb,MAAMC,CAAC,GAAGF,MAAM,CAACG,OAAO,EAAEC,aAAa;MACvC,IAAI,CAACF,CAAC,EAAE,OAAOG,SAAS;MAExB,MA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C,EAAE,EAAE,EAAE;MACNC,SAAS,EAAE1C,cAAc;MACzB2C,OAAO,EAAE,EAAE;MACXC,GAAG,EAAE,EAAE;MACPC,OAAO,EAAEvD,CAAC,CAACuD;IACb,CAAE;IAAAR,QAAA,eAEF7C,IAAA;MAAKe,GAAG,EAAEC,MAAO;MAAA6B,QAAA,EAAEZ;IAAW,CAAM;EAAC,CAC5B,CAAC;AAEhB,CAAC;AAED,eAAe1B,OAAO","ignoreList":[]}
@@ -1,16 +1,11 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.default = void 0;
8
- var _react = require("react");
9
- var _reactThemes = _interopRequireDefault(require("@dr.pogodin/react-themes"));
10
- var _common = require("../common");
11
- var _Options = _interopRequireWildcard(require("./Options"));
12
- var _jsxRuntime = require("react/jsx-runtime");
13
- function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
1
+ import "core-js/modules/es.iterator.constructor.js";
2
+ import "core-js/modules/es.iterator.filter.js";
3
+ import "core-js/modules/es.iterator.constructor.js";
4
+ import "core-js/modules/es.iterator.filter.js";
5
+ import { useEffect, useRef, useState } from 'react';
6
+ import themed from '@dr.pogodin/react-themes';
7
+ import { optionValueName } from "../common.js";
8
+ import Options, { areEqual } from "./Options/index.js";
14
9
  const defaultTheme = {
15
10
  "context": "-dr-pogodin-react-utils___build-web-shared-components-selectors-CustomDropdown-theme___context___SNj3wp",
16
11
  "ad": "-dr-pogodin-react-utils___build-web-shared-components-selectors-CustomDropdown-theme___ad___T6eOJ-",
@@ -24,6 +19,7 @@ const defaultTheme = {
24
19
  "active": "-dr-pogodin-react-utils___build-web-shared-components-selectors-CustomDropdown-theme___active___RoOAZK",
25
20
  "upward": "-dr-pogodin-react-utils___build-web-shared-components-selectors-CustomDropdown-theme___upward___--5Xpy"
26
21
  };
22
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
27
23
  const BaseCustomDropdown = ({
28
24
  filter,
29
25
  label,
@@ -32,12 +28,12 @@ const BaseCustomDropdown = ({
32
28
  theme,
33
29
  value
34
30
  }) => {
35
- const [active, setActive] = (0, _react.useState)(false);
36
- const dropdownRef = (0, _react.useRef)(null);
37
- const opsRef = (0, _react.useRef)(null);
38
- const [opsPos, setOpsPos] = (0, _react.useState)();
39
- const [upward, setUpward] = (0, _react.useState)(false);
40
- (0, _react.useEffect)(() => {
31
+ const [active, setActive] = useState(false);
32
+ const dropdownRef = useRef(null);
33
+ const opsRef = useRef(null);
34
+ const [opsPos, setOpsPos] = useState();
35
+ const [upward, setUpward] = useState(false);
36
+ useEffect(() => {
41
37
  if (!active) return undefined;
42
38
  let id;
43
39
  const cb = () => {
@@ -57,7 +53,7 @@ const BaseCustomDropdown = ({
57
53
  top: anchor.bottom,
58
54
  width: anchor.width
59
55
  };
60
- setOpsPos(now => (0, _Options.areEqual)(now, pos) ? now : pos);
56
+ setOpsPos(now => areEqual(now, pos) ? now : pos);
61
57
  }
62
58
  id = requestAnimationFrame(cb);
63
59
  };
@@ -84,12 +80,12 @@ const BaseCustomDropdown = ({
84
80
  });
85
81
  e.stopPropagation();
86
82
  };
87
- let selected = /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
83
+ let selected = /*#__PURE__*/_jsx(_Fragment, {
88
84
  children: "\u200C"
89
85
  });
90
86
  for (const option of options) {
91
87
  if (!filter || filter(option)) {
92
- const [iValue, iName] = (0, _common.optionValueName)(option);
88
+ const [iValue, iName] = optionValueName(option);
93
89
  if (iValue === value) {
94
90
  selected = iName;
95
91
  break;
@@ -103,12 +99,12 @@ const BaseCustomDropdown = ({
103
99
  containerClassName += ` ${theme.upward}`;
104
100
  opsContainerClass += ` ${theme.upward}`;
105
101
  }
106
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
102
+ return /*#__PURE__*/_jsxs("div", {
107
103
  className: containerClassName,
108
- children: [label === undefined ? null : /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
104
+ children: [label === undefined ? null : /*#__PURE__*/_jsx("div", {
109
105
  className: theme.label,
110
106
  children: label
111
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
107
+ }), /*#__PURE__*/_jsxs("div", {
112
108
  className: theme.dropdown,
113
109
  onClick: openList,
114
110
  onKeyDown: e => {
@@ -117,10 +113,10 @@ const BaseCustomDropdown = ({
117
113
  ref: dropdownRef,
118
114
  role: "listbox",
119
115
  tabIndex: 0,
120
- children: [selected, /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
116
+ children: [selected, /*#__PURE__*/_jsx("div", {
121
117
  className: theme.arrow
122
118
  })]
123
- }), active ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_Options.default, {
119
+ }), active ? /*#__PURE__*/_jsx(Options, {
124
120
  containerClass: opsContainerClass,
125
121
  containerStyle: opsPos,
126
122
  onCancel: () => {
@@ -136,5 +132,5 @@ const BaseCustomDropdown = ({
136
132
  }) : null]
137
133
  });
138
134
  };
139
- var _default = exports.default = (0, _reactThemes.default)(BaseCustomDropdown, 'CustomDropdown', defaultTheme);
135
+ export default /* #__PURE__ */themed(BaseCustomDropdown, 'CustomDropdown', defaultTheme);
140
136
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_react","require","_reactThemes","_interopRequireDefault","_common","_Options","_interopRequireWildcard","_jsxRuntime","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","defaultTheme","BaseCustomDropdown","filter","label","onChange","options","theme","value","active","setActive","useState","dropdownRef","useRef","opsRef","opsPos","setOpsPos","upward","setUpward","useEffect","undefined","id","cb","anchor","current","getBoundingClientRect","opsRect","measure","fitsDown","bottom","height","window","visualViewport","fitsUp","top","up","pos","left","width","now","areEqual","requestAnimationFrame","cancelAnimationFrame","openList","view","rect","stopPropagation","selected","_jsx","_Fragment","children","option","iValue","iName","optionValueName","containerClassName","container","opsContainerClass","select","_jsxs","className","dropdown","onClick","onKeyDown","key","ref","role","tabIndex","arrow","Options","containerClass","containerStyle","onCancel","newValue","optionClass","_default","exports","themed"],"sources":["../../../../../../src/shared/components/selectors/CustomDropdown/index.tsx"],"sourcesContent":["import { useEffect, useRef, useState } from 'react';\n\nimport themed 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 BaseCustomDropdown: React.FunctionComponent<\n PropsT<React.ReactNode, (value: ValueT) => void>\n> = ({\n filter,\n label,\n onChange,\n options,\n theme,\n value,\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 = <>&zwnj;</>;\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 = theme.container;\n if (active) containerClassName += ` ${theme.active}`;\n\n let opsContainerClass = theme.select ?? '';\n if (upward) {\n containerClassName += ` ${theme.upward}`;\n opsContainerClass += ` ${theme.upward}`;\n }\n\n return (\n <div className={containerClassName}>\n {label === undefined ? null\n : <div className={theme.label}>{label}</div>}\n <div\n className={theme.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={theme.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={theme.option ?? ''}\n options={options}\n ref={opsRef}\n />\n ) : null\n }\n </div>\n );\n};\n\nexport default themed(BaseCustomDropdown, 'CustomDropdown', defaultTheme);\n"],"mappings":";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,CAAC;MAClB,CAAE;MACFL,QAAQ,EAAGoE,QAAQ,IAAK;QACtB/D,SAAS,CAAC,KAAK,CAAC;QAChB,IAAIL,QAAQ,EAAEA,QAAQ,CAACoE,QAAQ,CAAC;MAClC,CAAE;MACFC,WAAW,EAAEnE,KAAK,CAAC4C,MAAM,IAAI,EAAG;MAChC7C,OAAO,EAAEA,OAAQ;MACjB2D,GAAG,EAAEnD;IAAO,CACb,CAAC,GACA,IAAI;EAAA,CAEP,CAAC;AAEV,CAAC;AAAA,IAAA6D,QAAA,GAAAC,OAAA,CAAApF,OAAA,GAEc,IAAAqF,oBAAM,EAAC3E,kBAAkB,EAAE,gBAAgB,EAAED,YAAY,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["useEffect","useRef","useState","themed","optionValueName","Options","areEqual","defaultTheme","Fragment","_Fragment","jsx","_jsx","jsxs","_jsxs","BaseCustomDropdown","filter","label","onChange","options","theme","value","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 { useEffect, useRef, useState } from 'react';\n\nimport themed 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 BaseCustomDropdown: React.FunctionComponent<\n PropsT<React.ReactNode, (value: ValueT) => void>\n> = ({\n filter,\n label,\n onChange,\n options,\n theme,\n value,\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 = <>&zwnj;</>;\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 = theme.container;\n if (active) containerClassName += ` ${theme.active}`;\n\n let opsContainerClass = theme.select ?? '';\n if (upward) {\n containerClassName += ` ${theme.upward}`;\n opsContainerClass += ` ${theme.upward}`;\n }\n\n return (\n <div className={containerClassName}>\n {label === undefined ? null\n : <div className={theme.label}>{label}</div>}\n <div\n className={theme.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={theme.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={theme.option ?? ''}\n options={options}\n ref={opsRef}\n />\n ) : null\n }\n </div>\n );\n};\n\nexport default /* #__PURE__ */ themed(BaseCustomDropdown, 'CustomDropdown', defaultTheme);\n"],"mappings":";;;;AAAA,SAASA,SAAS,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AAEnD,OAAOC,MAAM,MAAM,0BAA0B;AAAA,SAEVC,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,kBAEL,GAAGA,CAAC;EACHC,MAAM;EACNC,KAAK;EACLC,QAAQ;EACRC,OAAO;EACPC,KAAK;EACLC;AACF,CAAC,KAAK;EACJ,MAAM,CAACC,MAAM,EAAEC,SAAS,CAAC,GAAGpB,QAAQ,CAAC,KAAK,CAAC;EAE3C,MAAMqB,WAAW,GAAGtB,MAAM,CAAiB,IAAI,CAAC;EAChD,MAAMuB,MAAM,GAAGvB,MAAM,CAAO,IAAI,CAAC;EAEjC,MAAM,CAACwB,MAAM,EAAEC,SAAS,CAAC,GAAGxB,QAAQ,CAAgB,CAAC;EACrD,MAAM,CAACyB,MAAM,EAAEC,SAAS,CAAC,GAAG1B,QAAQ,CAAC,KAAK,CAAC;EAE3CF,SAAS,CAAC,MA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SAAS,GAAG,IAAI,gBACvBlB,IAAA;MAAKsD,SAAS,EAAE9C,KAAK,CAACH,KAAM;MAAAyC,QAAA,EAAEzC;IAAK,CAAM,CAAC,eAC9CH,KAAA;MACEoD,SAAS,EAAE9C,KAAK,CAAC+C,QAAS;MAC1BC,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,eACT7C,IAAA;QAAKsD,SAAS,EAAE9C,KAAK,CAACsD;MAAM,CAAE,CAAC;IAAA,CAC5B,CAAC,EAEJpD,MAAM,gBACJV,IAAA,CAACN,OAAO;MACNqE,cAAc,EAAEX,iBAAkB;MAClCY,cAAc,EAAElD,MAAO;MACvBmD,QAAQ,EAAEA,CAAA,KAAM;QACdtD,SAAS,CAAC,KAAK,CAAC;MAClB,CAAE;MACFL,QAAQ,EAAG4D,QAAQ,IAAK;QACtBvD,SAAS,CAAC,KAAK,CAAC;QAChB,IAAIL,QAAQ,EAAEA,QAAQ,CAAC4D,QAAQ,CAAC;MAClC,CAAE;MACFC,WAAW,EAAE3D,KAAK,CAACuC,MAAM,IAAI,EAAG;MAChCxC,OAAO,EAAEA,OAAQ;MACjBoD,GAAG,EAAE9C;IAAO,CACb,CAAC,GACA,IAAI;EAAA,CAEP,CAAC;AAEV,CAAC;AAED,eAAe,eAAgBrB,MAAM,CAACW,kBAAkB,EAAE,gBAAgB,EAAEP,YAAY,CAAC","ignoreList":[]}
@@ -1,14 +1,13 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.default = void 0;
8
- var _reactThemes = _interopRequireDefault(require("@dr.pogodin/react-themes"));
9
- var _common = require("../common");
10
- var _jsxRuntime = require("react/jsx-runtime");
1
+ import "core-js/modules/es.array.push.js";
2
+ import "core-js/modules/es.iterator.constructor.js";
3
+ import "core-js/modules/es.iterator.filter.js";
4
+ import "core-js/modules/es.array.push.js";
5
+ import "core-js/modules/es.iterator.constructor.js";
6
+ import "core-js/modules/es.iterator.filter.js";
11
7
  // Implements dropdown based on the native HTML <select> element.
8
+
9
+ import themed from '@dr.pogodin/react-themes';
10
+ import { optionValueName } from "../common.js";
12
11
  const defaultTheme = {
13
12
  "context": "-dr-pogodin-react-utils___build-web-shared-components-selectors-NativeDropdown-theme___context___WbwY1Y",
14
13
  "ad": "-dr-pogodin-react-utils___build-web-shared-components-selectors-NativeDropdown-theme___ad___AP5hsY",
@@ -42,6 +41,7 @@ const defaultTheme = {
42
41
  * @param [props....]
43
42
  * [Other theming properties](https://www.npmjs.com/package/@dr.pogodin/react-themes#themed-component-properties)
44
43
  */
44
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
45
45
  const Dropdown = ({
46
46
  filter,
47
47
  label,
@@ -55,9 +55,9 @@ const Dropdown = ({
55
55
  const optionElements = [];
56
56
  for (const option of options) {
57
57
  if (!filter || filter(option)) {
58
- const [iValue, iName] = (0, _common.optionValueName)(option);
58
+ const [iValue, iName] = optionValueName(option);
59
59
  isValidValue ||= iValue === value;
60
- optionElements.push(/*#__PURE__*/(0, _jsxRuntime.jsx)("option", {
60
+ optionElements.push(/*#__PURE__*/_jsx("option", {
61
61
  className: theme.option,
62
62
  value: iValue,
63
63
  children: iName
@@ -69,7 +69,7 @@ const Dropdown = ({
69
69
  // any valid option. In Chrome, and some other browsers, we are able to hide
70
70
  // it from the opened dropdown; in others, e.g. Safari, the best we can do is
71
71
  // to show it as disabled.
72
- const hiddenOption = isValidValue ? null : /*#__PURE__*/(0, _jsxRuntime.jsx)("option", {
72
+ const hiddenOption = isValidValue ? null : /*#__PURE__*/_jsx("option", {
73
73
  className: theme.hiddenOption,
74
74
  disabled: true,
75
75
  value: value,
@@ -77,24 +77,24 @@ const Dropdown = ({
77
77
  }, "__reactUtilsHiddenOption");
78
78
  let selectClassName = theme.select;
79
79
  if (!isValidValue) selectClassName += ` ${theme.invalid}`;
80
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
80
+ return /*#__PURE__*/_jsxs("div", {
81
81
  className: theme.container,
82
- children: [label === undefined ? null : /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
82
+ children: [label === undefined ? null : /*#__PURE__*/_jsx("div", {
83
83
  className: theme.label,
84
84
  children: label
85
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
85
+ }), /*#__PURE__*/_jsxs("div", {
86
86
  className: theme.dropdown,
87
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("select", {
87
+ children: [/*#__PURE__*/_jsxs("select", {
88
88
  className: selectClassName,
89
89
  "data-testid": process.env.NODE_ENV === 'production' ? undefined : testId,
90
90
  onChange: onChange,
91
91
  value: value,
92
92
  children: [hiddenOption, optionElements]
93
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
93
+ }), /*#__PURE__*/_jsx("div", {
94
94
  className: theme.arrow
95
95
  })]
96
96
  })]
97
97
  });
98
98
  };
99
- var _default = exports.default = (0, _reactThemes.default)(Dropdown, 'Dropdown', defaultTheme);
99
+ export default /* #__PURE__ */themed(Dropdown, 'Dropdown', defaultTheme);
100
100
  //# sourceMappingURL=index.js.map