@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.
- package/babel.config.js +1 -1
- package/babel.module.config.js +11 -0
- package/bin/build.js +8 -4
- package/bin/setup.js +2 -3
- package/build/development/client/getInj.js +57 -44
- package/build/development/client/getInj.js.map +1 -1
- package/build/development/client/index.js +15 -21
- package/build/development/client/index.js.map +1 -1
- package/build/development/client/init.js +2 -6
- package/build/development/client/init.js.map +1 -1
- package/build/development/index.js +3 -183
- package/build/development/index.js.map +1 -1
- package/build/development/server/Cache.js +1 -8
- package/build/development/server/Cache.js.map +1 -1
- package/build/development/server/index.js +22 -50
- package/build/development/server/index.js.map +1 -1
- package/build/development/server/renderer.js +83 -92
- package/build/development/server/renderer.js.map +1 -1
- package/build/development/server/server.js +58 -62
- package/build/development/server/server.js.map +1 -1
- package/build/development/server/utils/errors.js +8 -31
- package/build/development/server/utils/errors.js.map +1 -1
- package/build/development/server/utils/index.js +2 -9
- package/build/development/server/utils/index.js.map +1 -1
- package/build/development/shared/components/Button/index.js +9 -16
- package/build/development/shared/components/Button/index.js.map +1 -1
- package/build/development/shared/components/Checkbox/index.js +6 -13
- package/build/development/shared/components/Checkbox/index.js.map +1 -1
- package/build/development/shared/components/GenericLink/index.js +4 -10
- package/build/development/shared/components/GenericLink/index.js.map +1 -1
- package/build/development/shared/components/Input/index.js +11 -18
- package/build/development/shared/components/Input/index.js.map +1 -1
- package/build/development/shared/components/Link.js +6 -13
- package/build/development/shared/components/Link.js.map +1 -1
- package/build/development/shared/components/Modal/index.js +16 -22
- package/build/development/shared/components/Modal/index.js.map +1 -1
- package/build/development/shared/components/NavLink.js +6 -13
- package/build/development/shared/components/NavLink.js.map +1 -1
- package/build/development/shared/components/PageLayout/index.js +7 -14
- package/build/development/shared/components/PageLayout/index.js.map +1 -1
- package/build/development/shared/components/TextArea/index.js +15 -22
- package/build/development/shared/components/TextArea/index.js.map +1 -1
- package/build/development/shared/components/Throbber/index.js +7 -14
- package/build/development/shared/components/Throbber/index.js.map +1 -1
- package/build/development/shared/components/WithTooltip/Tooltip.js +12 -18
- package/build/development/shared/components/WithTooltip/Tooltip.js.map +1 -1
- package/build/development/shared/components/WithTooltip/index.js +16 -23
- package/build/development/shared/components/WithTooltip/index.js.map +1 -1
- package/build/development/shared/components/YouTubeVideo/index.js +10 -17
- package/build/development/shared/components/YouTubeVideo/index.js.map +1 -1
- package/build/development/shared/components/index.js +16 -130
- package/build/development/shared/components/index.js.map +1 -1
- package/build/development/shared/components/selectors/CustomDropdown/Options/index.js +18 -19
- package/build/development/shared/components/selectors/CustomDropdown/Options/index.js.map +1 -1
- package/build/development/shared/components/selectors/CustomDropdown/index.js +24 -28
- package/build/development/shared/components/selectors/CustomDropdown/index.js.map +1 -1
- package/build/development/shared/components/selectors/NativeDropdown/index.js +19 -19
- package/build/development/shared/components/selectors/NativeDropdown/index.js.map +1 -1
- package/build/development/shared/components/selectors/Switch/index.js +12 -17
- package/build/development/shared/components/selectors/Switch/index.js.map +1 -1
- package/build/development/shared/components/selectors/common.js +1 -7
- package/build/development/shared/components/selectors/common.js.map +1 -1
- package/build/development/shared/components/selectors/index.js +3 -27
- package/build/development/shared/components/selectors/index.js.map +1 -1
- package/build/development/shared/utils/config.js +40 -21
- package/build/development/shared/utils/config.js.map +1 -1
- package/build/development/shared/utils/globalState.js +3 -8
- package/build/development/shared/utils/globalState.js.map +1 -1
- package/build/development/shared/utils/index.js +12 -89
- package/build/development/shared/utils/index.js.map +1 -1
- package/build/development/shared/utils/isomorphy/buildInfo.js +2 -9
- package/build/development/shared/utils/isomorphy/buildInfo.js.map +1 -1
- package/build/development/shared/utils/isomorphy/environment-check.js +2 -8
- package/build/development/shared/utils/isomorphy/environment-check.js.map +1 -1
- package/build/development/shared/utils/isomorphy/index.js +7 -32
- package/build/development/shared/utils/isomorphy/index.js.map +1 -1
- package/build/development/shared/utils/jest/E2eSsrEnv.js +24 -31
- package/build/development/shared/utils/jest/E2eSsrEnv.js.map +1 -1
- package/build/development/shared/utils/jest/global.js +1 -7
- package/build/development/shared/utils/jest/global.js.map +1 -1
- package/build/development/shared/utils/jest/index.js +20 -44
- package/build/development/shared/utils/jest/index.js.map +1 -1
- package/build/development/shared/utils/splitComponent.js +54 -46
- package/build/development/shared/utils/splitComponent.js.map +1 -1
- package/build/development/shared/utils/time.js +22 -31
- package/build/development/shared/utils/time.js.map +1 -1
- package/build/development/shared/utils/webpack.js +17 -16
- package/build/development/shared/utils/webpack.js.map +1 -1
- package/build/production/client/getInj.js +13 -11
- package/build/production/client/getInj.js.map +1 -1
- package/build/production/client/index.js +3 -3
- package/build/production/client/index.js.map +1 -1
- package/build/production/client/init.js +2 -2
- package/build/production/client/init.js.map +1 -1
- package/build/production/index.js +2 -6
- package/build/production/index.js.map +1 -1
- package/build/production/server/Cache.js +3 -3
- package/build/production/server/Cache.js.map +1 -1
- package/build/production/server/index.js +8 -8
- package/build/production/server/index.js.map +1 -1
- package/build/production/server/renderer.js +24 -25
- package/build/production/server/renderer.js.map +1 -1
- package/build/production/server/server.js +9 -11
- package/build/production/server/server.js.map +1 -1
- package/build/production/server/utils/errors.js +9 -9
- package/build/production/server/utils/errors.js.map +1 -1
- package/build/production/server/utils/index.js +2 -1
- package/build/production/server/utils/index.js.map +1 -1
- package/build/production/shared/components/Button/index.js +4 -4
- 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 +4 -4
- package/build/production/shared/components/GenericLink/index.js.map +1 -1
- package/build/production/shared/components/Input/index.js +5 -5
- package/build/production/shared/components/Input/index.js.map +1 -1
- package/build/production/shared/components/Link.js +3 -3
- package/build/production/shared/components/Link.js.map +1 -1
- package/build/production/shared/components/Modal/index.js +7 -7
- package/build/production/shared/components/Modal/index.js.map +1 -1
- package/build/production/shared/components/NavLink.js +2 -2
- 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 +5 -5
- 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 +4 -4
- package/build/production/shared/components/WithTooltip/Tooltip.js.map +1 -1
- package/build/production/shared/components/WithTooltip/index.js +4 -4
- package/build/production/shared/components/WithTooltip/index.js.map +1 -1
- package/build/production/shared/components/YouTubeVideo/index.js +4 -4
- package/build/production/shared/components/YouTubeVideo/index.js.map +1 -1
- package/build/production/shared/components/index.js +3 -1
- package/build/production/shared/components/index.js.map +1 -1
- package/build/production/shared/components/selectors/CustomDropdown/Options/index.js +2 -2
- package/build/production/shared/components/selectors/CustomDropdown/Options/index.js.map +1 -1
- package/build/production/shared/components/selectors/CustomDropdown/index.js +2 -2
- package/build/production/shared/components/selectors/CustomDropdown/index.js.map +1 -1
- package/build/production/shared/components/selectors/NativeDropdown/index.js +4 -4
- package/build/production/shared/components/selectors/NativeDropdown/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/components/selectors/common.js +2 -2
- package/build/production/shared/components/selectors/common.js.map +1 -1
- package/build/production/shared/components/selectors/index.js +1 -1
- package/build/production/shared/components/selectors/index.js.map +1 -1
- package/build/production/shared/utils/config.js +8 -6
- package/build/production/shared/utils/config.js.map +1 -1
- package/build/production/shared/utils/globalState.js +2 -2
- 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/isomorphy/buildInfo.js +3 -3
- package/build/production/shared/utils/isomorphy/buildInfo.js.map +1 -1
- package/build/production/shared/utils/isomorphy/environment-check.js +3 -3
- package/build/production/shared/utils/isomorphy/environment-check.js.map +1 -1
- package/build/production/shared/utils/isomorphy/index.js +4 -4
- package/build/production/shared/utils/isomorphy/index.js.map +1 -1
- package/build/production/shared/utils/jest/E2eSsrEnv.js +14 -14
- package/build/production/shared/utils/jest/E2eSsrEnv.js.map +1 -1
- package/build/production/shared/utils/jest/global.js +1 -1
- package/build/production/shared/utils/jest/global.js.map +1 -1
- package/build/production/shared/utils/jest/index.js +11 -11
- package/build/production/shared/utils/jest/index.js.map +1 -1
- package/build/production/shared/utils/splitComponent.js +11 -22
- package/build/production/shared/utils/splitComponent.js.map +1 -1
- package/build/production/shared/utils/time.js +3 -3
- package/build/production/shared/utils/time.js.map +1 -1
- package/build/production/shared/utils/webpack.js +6 -6
- package/build/production/shared/utils/webpack.js.map +1 -1
- package/build/types-code/client/getInj.d.ts +1 -2
- package/build/types-code/client/index.d.ts +1 -1
- package/build/types-code/index.d.ts +1 -7
- package/build/types-code/server/index.d.ts +6 -11
- package/build/types-code/server/utils/index.d.ts +1 -1
- package/build/types-code/shared/utils/config.d.ts +4 -2
- package/build/types-code/shared/utils/index.d.ts +2 -2
- package/build/types-code/shared/utils/splitComponent.d.ts +6 -4
- package/build/web/client/getInj.js +55 -44
- package/build/web/client/getInj.js.map +1 -1
- package/build/web/client/index.js +15 -21
- package/build/web/client/index.js.map +1 -1
- package/build/web/client/init.js +2 -4
- package/build/web/client/init.js.map +1 -1
- package/build/web/index.js +1 -15
- package/build/web/index.js.map +1 -1
- package/build/web/server/index.js +12 -21
- package/build/web/server/index.js.map +1 -1
- package/build/web/server/renderer.js +34 -40
- package/build/web/server/renderer.js.map +1 -1
- package/build/web/server/server.js +14 -11
- package/build/web/server/server.js.map +1 -1
- package/build/web/server/utils/index.js +1 -1
- package/build/web/server/utils/index.js.map +1 -1
- package/build/web/shared/components/Button/index.js +1 -1
- 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/Input/index.js +1 -1
- package/build/web/shared/components/Input/index.js.map +1 -1
- package/build/web/shared/components/Modal/index.js +3 -3
- package/build/web/shared/components/Modal/index.js.map +1 -1
- package/build/web/shared/components/PageLayout/index.js +1 -1
- package/build/web/shared/components/PageLayout/index.js.map +1 -1
- package/build/web/shared/components/TextArea/index.js +1 -1
- package/build/web/shared/components/TextArea/index.js.map +1 -1
- package/build/web/shared/components/Throbber/index.js +1 -1
- package/build/web/shared/components/Throbber/index.js.map +1 -1
- package/build/web/shared/components/WithTooltip/index.js +1 -1
- package/build/web/shared/components/WithTooltip/index.js.map +1 -1
- package/build/web/shared/components/YouTubeVideo/index.js +1 -1
- package/build/web/shared/components/YouTubeVideo/index.js.map +1 -1
- package/build/web/shared/components/selectors/CustomDropdown/Options/index.js +3 -0
- package/build/web/shared/components/selectors/CustomDropdown/Options/index.js.map +1 -1
- package/build/web/shared/components/selectors/CustomDropdown/index.js +3 -1
- package/build/web/shared/components/selectors/CustomDropdown/index.js.map +1 -1
- package/build/web/shared/components/selectors/NativeDropdown/index.js +4 -1
- package/build/web/shared/components/selectors/NativeDropdown/index.js.map +1 -1
- package/build/web/shared/components/selectors/Switch/index.js +2 -1
- package/build/web/shared/components/selectors/Switch/index.js.map +1 -1
- package/build/web/shared/utils/config.js +38 -14
- package/build/web/shared/utils/config.js.map +1 -1
- package/build/web/shared/utils/index.js +2 -2
- package/build/web/shared/utils/index.js.map +1 -1
- package/build/web/shared/utils/jest/E2eSsrEnv.js +3 -2
- package/build/web/shared/utils/jest/E2eSsrEnv.js.map +1 -1
- package/build/web/shared/utils/splitComponent.js +27 -20
- package/build/web/shared/utils/splitComponent.js.map +1 -1
- package/build/web/shared/utils/webpack.js +13 -7
- package/build/web/shared/utils/webpack.js.map +1 -1
- package/config/babel/node-ssr.js +12 -6
- package/config/babel/webpack.js +6 -1
- package/config/jest/default.js +8 -2
- package/config/jest/setup.js +8 -1
- package/config/webpack/app-base.js +23 -15
- package/config/webpack/app-development.js +2 -3
- package/config/webpack/lib-base.js +1 -2
- package/package.json +35 -25
- package/types.d.ts +1 -6
- package/node-entry.js +0 -15
- package/src/client/getInj.ts +0 -51
- package/src/client/index.tsx +0 -43
- package/src/client/init.ts +0 -52
- package/src/index.ts +0 -79
- package/src/server/Cache.ts +0 -61
- package/src/server/index.ts +0 -249
- package/src/server/renderer.tsx +0 -653
- package/src/server/server.ts +0 -332
- package/src/server/utils/errors.ts +0 -122
- package/src/server/utils/index.ts +0 -3
- package/src/shared/components/Button/index.tsx +0 -130
- package/src/shared/components/Button/style.scss +0 -54
- package/src/shared/components/Checkbox/index.tsx +0 -53
- package/src/shared/components/Checkbox/theme.scss +0 -63
- package/src/shared/components/GenericLink/index.tsx +0 -141
- package/src/shared/components/GenericLink/style.scss +0 -3
- package/src/shared/components/Input/index.tsx +0 -96
- package/src/shared/components/Input/theme.scss +0 -52
- package/src/shared/components/Link.tsx +0 -25
- package/src/shared/components/Modal/base-theme.scss +0 -38
- package/src/shared/components/Modal/index.tsx +0 -177
- package/src/shared/components/Modal/styles.scss +0 -3
- package/src/shared/components/NavLink.tsx +0 -18
- package/src/shared/components/PageLayout/base-theme.scss +0 -30
- package/src/shared/components/PageLayout/index.tsx +0 -51
- package/src/shared/components/TextArea/index.tsx +0 -139
- package/src/shared/components/TextArea/style.scss +0 -68
- package/src/shared/components/Throbber/index.tsx +0 -28
- package/src/shared/components/Throbber/theme.scss +0 -26
- package/src/shared/components/WithTooltip/Tooltip.tsx +0 -274
- package/src/shared/components/WithTooltip/default-theme.scss +0 -36
- package/src/shared/components/WithTooltip/index.tsx +0 -186
- package/src/shared/components/YouTubeVideo/base.scss +0 -15
- package/src/shared/components/YouTubeVideo/index.tsx +0 -73
- package/src/shared/components/YouTubeVideo/throbber.scss +0 -11
- package/src/shared/components/index.ts +0 -20
- package/src/shared/components/selectors/CustomDropdown/Options/index.tsx +0 -124
- package/src/shared/components/selectors/CustomDropdown/Options/style.scss +0 -6
- package/src/shared/components/selectors/CustomDropdown/index.tsx +0 -146
- package/src/shared/components/selectors/CustomDropdown/theme.scss +0 -118
- package/src/shared/components/selectors/NativeDropdown/index.tsx +0 -90
- package/src/shared/components/selectors/NativeDropdown/theme.scss +0 -81
- package/src/shared/components/selectors/Switch/index.tsx +0 -74
- package/src/shared/components/selectors/Switch/theme.scss +0 -39
- package/src/shared/components/selectors/common.ts +0 -57
- package/src/shared/components/selectors/index.ts +0 -8
- package/src/shared/utils/config.ts +0 -28
- package/src/shared/utils/globalState.ts +0 -44
- package/src/shared/utils/index.ts +0 -45
- package/src/shared/utils/isomorphy/buildInfo.ts +0 -50
- package/src/shared/utils/isomorphy/environment-check.ts +0 -18
- package/src/shared/utils/isomorphy/index.ts +0 -36
- package/src/shared/utils/jest/E2eSsrEnv.ts +0 -305
- package/src/shared/utils/jest/global.ts +0 -17
- package/src/shared/utils/jest/index.ts +0 -215
- package/src/shared/utils/splitComponent.tsx +0 -275
- package/src/shared/utils/time.ts +0 -101
- package/src/shared/utils/webpack.ts +0 -74
- package/src/styles/_global/reset.css +0 -52
- package/src/styles/_mixins/fonts.scss +0 -40
- package/src/styles/_mixins/media.scss +0 -150
- package/src/styles/_mixins/typography.scss +0 -83
- package/src/styles/global.scss +0 -11
- package/src/styles/mixins.scss +0 -6
|
@@ -1,14 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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 ?
|
|
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 += `?${
|
|
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__*/(
|
|
52
|
+
return /*#__PURE__*/_jsxs("div", {
|
|
60
53
|
className: theme.container,
|
|
61
|
-
children: [/*#__PURE__*/(
|
|
54
|
+
children: [/*#__PURE__*/_jsx(Throbber, {
|
|
62
55
|
theme: throbberTheme
|
|
63
|
-
}), /*#__PURE__*/(
|
|
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
|
-
|
|
66
|
+
export default /* #__PURE__ */themed(YouTubeVideo, 'YouTubeVideo', baseTheme);
|
|
74
67
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["
|
|
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
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Just an aggregation of all exported components into a single module.
|
|
3
|
+
*/
|
|
2
4
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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":["
|
|
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
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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
|
-
|
|
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 =
|
|
29
|
-
|
|
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] =
|
|
45
|
-
optionNodes.push(/*#__PURE__*/(
|
|
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__*/(
|
|
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__*/(
|
|
80
|
+
children: /*#__PURE__*/_jsx("div", {
|
|
82
81
|
ref: opsRef,
|
|
83
82
|
children: optionNodes
|
|
84
83
|
})
|
|
85
84
|
});
|
|
86
85
|
};
|
|
87
|
-
|
|
86
|
+
export default Options;
|
|
88
87
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["
|
|
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,SA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AACC,MAAM,EAAEC,KAAK,CAAC,GAAGvC,eAAe,CAACqC,MAAM,CAAC;MAC/CD,WAAW,CAACI,IAAI,cACdrC,IAAA;QACEsC,SAAS,EAAEzB,WAAY;QAEvB0B,OAAO,EAAGrB,CAAC,IAAK;UACdN,QAAQ,CAACuB,MAAM,CAAC;UAChBjB,CAAC,CAACsB,eAAe,CAAC,CAAC;QACrB,CAAE;QACFC,SAAS,EAAGvB,CAAC,IAAK;UAChB,IAAIA,CAAC,CAACwB,GAAG,KAAK,OAAO,EAAE;YACrB9B,QAAQ,CAACuB,MAAM,CAAC;YAChBjB,CAAC,CAACsB,eAAe,CAAC,CAAC;UACrB;QACF,CAAE;QACFG,IAAI,EAAC,QAAQ;QACbC,QAAQ,EAAE,CAAE;QAAAC,QAAA,EAEXT;MAAK,GAdDD,MAeF,CACP,CAAC;IACH;EACF;EAEA,oBACEnC,IAAA,CAACJ;EACC;EACA;EACA;EACA;EACA;EAAA;IACAkD,iBAAiB;IACjBC,oBAAoB;IACpBpC,QAAQ,EAAEA,QAAS;IACnBa,KAAK,EAAEf,cAAe;IACtBuC,KAAK,EAAE;MACLC,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
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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] =
|
|
36
|
-
const dropdownRef =
|
|
37
|
-
const opsRef =
|
|
38
|
-
const [opsPos, setOpsPos] =
|
|
39
|
-
const [upward, setUpward] =
|
|
40
|
-
|
|
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 =>
|
|
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__*/(
|
|
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] =
|
|
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__*/(
|
|
102
|
+
return /*#__PURE__*/_jsxs("div", {
|
|
107
103
|
className: containerClassName,
|
|
108
|
-
children: [label === undefined ? null : /*#__PURE__*/(
|
|
104
|
+
children: [label === undefined ? null : /*#__PURE__*/_jsx("div", {
|
|
109
105
|
className: theme.label,
|
|
110
106
|
children: label
|
|
111
|
-
}), /*#__PURE__*/(
|
|
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__*/(
|
|
116
|
+
children: [selected, /*#__PURE__*/_jsx("div", {
|
|
121
117
|
className: theme.arrow
|
|
122
118
|
})]
|
|
123
|
-
}), active ? /*#__PURE__*/(
|
|
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
|
-
|
|
135
|
+
export default /* #__PURE__ */themed(BaseCustomDropdown, 'CustomDropdown', defaultTheme);
|
|
140
136
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["
|
|
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 = <>‌</>;\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,G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G4D,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
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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] =
|
|
58
|
+
const [iValue, iName] = optionValueName(option);
|
|
59
59
|
isValidValue ||= iValue === value;
|
|
60
|
-
optionElements.push(/*#__PURE__*/(
|
|
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__*/(
|
|
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__*/(
|
|
80
|
+
return /*#__PURE__*/_jsxs("div", {
|
|
81
81
|
className: theme.container,
|
|
82
|
-
children: [label === undefined ? null : /*#__PURE__*/(
|
|
82
|
+
children: [label === undefined ? null : /*#__PURE__*/_jsx("div", {
|
|
83
83
|
className: theme.label,
|
|
84
84
|
children: label
|
|
85
|
-
}), /*#__PURE__*/(
|
|
85
|
+
}), /*#__PURE__*/_jsxs("div", {
|
|
86
86
|
className: theme.dropdown,
|
|
87
|
-
children: [/*#__PURE__*/(
|
|
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__*/(
|
|
93
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
94
94
|
className: theme.arrow
|
|
95
95
|
})]
|
|
96
96
|
})]
|
|
97
97
|
});
|
|
98
98
|
};
|
|
99
|
-
|
|
99
|
+
export default /* #__PURE__ */themed(Dropdown, 'Dropdown', defaultTheme);
|
|
100
100
|
//# sourceMappingURL=index.js.map
|