@dr.pogodin/react-utils 1.46.2 → 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 -0
- package/babel.libweb.config.js +16 -0
- package/babel.module.config.js +11 -0
- package/bin/build.js +21 -11
- package/bin/setup.js +11 -9
- 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 -177
- 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 -45
- package/build/development/server/index.js.map +1 -1
- package/build/development/server/renderer.js +84 -86
- package/build/development/server/renderer.js.map +1 -1
- package/build/development/server/server.js +58 -60
- 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 +15 -22
- package/build/development/shared/components/Button/index.js.map +1 -1
- package/build/development/shared/components/Checkbox/index.js +14 -21
- package/build/development/shared/components/Checkbox/index.js.map +1 -1
- package/build/development/shared/components/GenericLink/index.js +9 -11
- package/build/development/shared/components/GenericLink/index.js.map +1 -1
- package/build/development/shared/components/Input/index.js +21 -27
- 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 +24 -28
- 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 +13 -20
- package/build/development/shared/components/PageLayout/index.js.map +1 -1
- package/build/development/shared/components/TextArea/index.js +28 -31
- package/build/development/shared/components/TextArea/index.js.map +1 -1
- package/build/development/shared/components/Throbber/index.js +13 -20
- package/build/development/shared/components/Throbber/index.js.map +1 -1
- package/build/development/shared/components/WithTooltip/Tooltip.js +13 -18
- package/build/development/shared/components/WithTooltip/Tooltip.js.map +1 -1
- package/build/development/shared/components/WithTooltip/index.js +23 -30
- package/build/development/shared/components/WithTooltip/index.js.map +1 -1
- package/build/development/shared/components/YouTubeVideo/index.js +19 -26
- 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 +19 -20
- package/build/development/shared/components/selectors/CustomDropdown/Options/index.js.map +1 -1
- package/build/development/shared/components/selectors/CustomDropdown/index.js +35 -39
- package/build/development/shared/components/selectors/CustomDropdown/index.js.map +1 -1
- package/build/development/shared/components/selectors/NativeDropdown/index.js +31 -31
- package/build/development/shared/components/selectors/NativeDropdown/index.js.map +1 -1
- package/build/development/shared/components/selectors/Switch/index.js +19 -24
- 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 +34 -37
- 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 -45
- 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 -3
- 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 +16 -15
- 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 +65 -0
- package/build/web/client/getInj.js.map +1 -0
- package/{src/client/index.tsx → build/web/client/index.js} +13 -24
- package/build/web/client/index.js.map +1 -0
- package/{src/client/init.ts → build/web/client/init.js} +9 -14
- package/build/web/client/init.js.map +1 -0
- package/build/web/index.js +11 -0
- package/build/web/index.js.map +1 -0
- package/{src/server/Cache.ts → build/web/server/Cache.js} +15 -22
- package/build/web/server/Cache.js.map +1 -0
- package/{src/server/index.ts → build/web/server/index.js} +32 -81
- package/build/web/server/index.js.map +1 -0
- package/{src/server/renderer.tsx → build/web/server/renderer.js} +188 -333
- package/build/web/server/renderer.js.map +1 -0
- package/{src/server/server.ts → build/web/server/server.js} +82 -182
- package/build/web/server/server.js.map +1 -0
- package/{src/server/utils/errors.ts → build/web/server/utils/errors.js} +6 -25
- package/build/web/server/utils/errors.js.map +1 -0
- package/build/web/server/utils/index.js +4 -0
- package/build/web/server/utils/index.js.map +1 -0
- package/build/web/shared/components/Button/index.js +90 -0
- package/build/web/shared/components/Button/index.js.map +1 -0
- package/build/web/shared/components/Checkbox/index.js +35 -0
- package/build/web/shared/components/Checkbox/index.js.map +1 -0
- package/{src/shared/components/GenericLink/index.tsx → build/web/shared/components/GenericLink/index.js} +44 -78
- package/build/web/shared/components/GenericLink/index.js.map +1 -0
- package/build/web/shared/components/Input/index.js +71 -0
- package/build/web/shared/components/Input/index.js.map +1 -0
- package/build/web/shared/components/Link.js +20 -0
- package/build/web/shared/components/Link.js.map +1 -0
- package/{src → build/web}/shared/components/Modal/base-theme.scss +1 -1
- package/build/web/shared/components/Modal/index.js +128 -0
- package/build/web/shared/components/Modal/index.js.map +1 -0
- package/build/web/shared/components/NavLink.js +13 -0
- package/build/web/shared/components/NavLink.js.map +1 -0
- package/{src → build/web}/shared/components/PageLayout/base-theme.scss +1 -1
- package/{src/shared/components/PageLayout/index.tsx → build/web/shared/components/PageLayout/index.js} +20 -33
- package/build/web/shared/components/PageLayout/index.js.map +1 -0
- package/build/web/shared/components/TextArea/index.js +106 -0
- package/build/web/shared/components/TextArea/index.js.map +1 -0
- package/build/web/shared/components/Throbber/index.js +26 -0
- package/build/web/shared/components/Throbber/index.js.map +1 -0
- package/{src/shared/components/WithTooltip/Tooltip.tsx → build/web/shared/components/WithTooltip/Tooltip.js} +61 -109
- package/build/web/shared/components/WithTooltip/Tooltip.js.map +1 -0
- package/build/web/shared/components/WithTooltip/index.js +117 -0
- package/build/web/shared/components/WithTooltip/index.js.map +1 -0
- package/{src/shared/components/YouTubeVideo/index.tsx → build/web/shared/components/YouTubeVideo/index.js} +23 -40
- package/build/web/shared/components/YouTubeVideo/index.js.map +1 -0
- package/build/web/shared/components/index.js +18 -0
- package/build/web/shared/components/index.js.map +1 -0
- package/build/web/shared/components/selectors/CustomDropdown/Options/index.js +82 -0
- package/build/web/shared/components/selectors/CustomDropdown/Options/index.js.map +1 -0
- package/{src/shared/components/selectors/CustomDropdown/index.tsx → build/web/shared/components/selectors/CustomDropdown/index.js} +56 -80
- package/build/web/shared/components/selectors/CustomDropdown/index.js.map +1 -0
- package/{src/shared/components/selectors/NativeDropdown/index.tsx → build/web/shared/components/selectors/NativeDropdown/index.js} +39 -44
- package/build/web/shared/components/selectors/NativeDropdown/index.js.map +1 -0
- package/build/web/shared/components/selectors/Switch/index.js +50 -0
- package/build/web/shared/components/selectors/Switch/index.js.map +1 -0
- package/build/web/shared/components/selectors/common.js +12 -0
- package/build/web/shared/components/selectors/common.js.map +1 -0
- package/build/web/shared/components/selectors/index.js +4 -0
- package/build/web/shared/components/selectors/index.js.map +1 -0
- package/build/web/shared/utils/config.js +45 -0
- package/build/web/shared/utils/config.js.map +1 -0
- package/build/web/shared/utils/globalState.js +15 -0
- package/build/web/shared/utils/globalState.js.map +1 -0
- package/build/web/shared/utils/index.js +13 -0
- package/build/web/shared/utils/index.js.map +1 -0
- package/{src/shared/utils/isomorphy/buildInfo.ts → build/web/shared/utils/isomorphy/buildInfo.js} +4 -10
- package/build/web/shared/utils/isomorphy/buildInfo.js.map +1 -0
- package/build/web/shared/utils/isomorphy/environment-check.js +17 -0
- package/build/web/shared/utils/isomorphy/environment-check.js.map +1 -0
- package/{src/shared/utils/isomorphy/index.ts → build/web/shared/utils/isomorphy/index.js} +6 -6
- package/build/web/shared/utils/isomorphy/index.js.map +1 -0
- package/{src/shared/utils/jest/E2eSsrEnv.ts → build/web/shared/utils/jest/E2eSsrEnv.js} +73 -140
- package/build/web/shared/utils/jest/E2eSsrEnv.js.map +1 -0
- package/build/web/shared/utils/jest/global.js +4 -0
- package/build/web/shared/utils/jest/global.js.map +1 -0
- package/{src/shared/utils/jest/index.ts → build/web/shared/utils/jest/index.js} +33 -83
- package/build/web/shared/utils/jest/index.js.map +1 -0
- package/{src/shared/utils/splitComponent.tsx → build/web/shared/utils/splitComponent.js} +77 -124
- package/build/web/shared/utils/splitComponent.js.map +1 -0
- package/{src/shared/utils/time.ts → build/web/shared/utils/time.js} +21 -37
- package/build/web/shared/utils/time.js.map +1 -0
- package/build/web/shared/utils/webpack.js +67 -0
- package/build/web/shared/utils/webpack.js.map +1 -0
- package/config/babel/node-ssr.js +12 -3
- 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 +25 -14
- package/config/webpack/app-development.js +2 -2
- package/config/webpack/lib-base.js +1 -2
- package/package.json +41 -42
- package/types.d.ts +1 -6
- package/build/development/__chunk_groups__.json +0 -6
- package/build/development/style.css +0 -909
- package/build/development/web.bundle.js +0 -752
- package/build/production/__chunk_groups__.json +0 -6
- package/build/production/style.css +0 -2
- package/build/production/style.css.map +0 -1
- package/build/production/web.bundle.js +0 -3
- package/build/production/web.bundle.js.LICENSE.txt +0 -9
- package/build/production/web.bundle.js.map +0 -1
- package/dev-styles.js +0 -1
- package/node-entry.js +0 -15
- package/null.js +0 -1
- package/prod-styles.js +0 -1
- package/src/client/getInj.ts +0 -51
- package/src/index.ts +0 -73
- package/src/server/utils/index.ts +0 -3
- package/src/shared/components/Button/index.tsx +0 -130
- package/src/shared/components/Checkbox/index.tsx +0 -53
- package/src/shared/components/Input/index.tsx +0 -96
- package/src/shared/components/Link.tsx +0 -25
- package/src/shared/components/Modal/index.tsx +0 -177
- package/src/shared/components/NavLink.tsx +0 -18
- package/src/shared/components/TextArea/index.tsx +0 -139
- package/src/shared/components/Throbber/index.tsx +0 -28
- package/src/shared/components/WithTooltip/index.tsx +0 -186
- package/src/shared/components/index.ts +0 -20
- package/src/shared/components/selectors/CustomDropdown/Options/index.tsx +0 -124
- package/src/shared/components/selectors/Switch/index.tsx +0 -74
- 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/environment-check.ts +0 -18
- package/src/shared/utils/jest/global.ts +0 -17
- package/src/shared/utils/webpack.ts +0 -74
- /package/{src → build/web}/shared/components/Button/style.scss +0 -0
- /package/{src → build/web}/shared/components/Checkbox/theme.scss +0 -0
- /package/{src → build/web}/shared/components/GenericLink/style.scss +0 -0
- /package/{src → build/web}/shared/components/Input/theme.scss +0 -0
- /package/{src → build/web}/shared/components/Modal/styles.scss +0 -0
- /package/{src → build/web}/shared/components/TextArea/style.scss +0 -0
- /package/{src → build/web}/shared/components/Throbber/theme.scss +0 -0
- /package/{src → build/web}/shared/components/WithTooltip/default-theme.scss +0 -0
- /package/{src → build/web}/shared/components/YouTubeVideo/base.scss +0 -0
- /package/{src → build/web}/shared/components/YouTubeVideo/throbber.scss +0 -0
- /package/{src → build/web}/shared/components/selectors/CustomDropdown/Options/style.scss +0 -0
- /package/{src → build/web}/shared/components/selectors/CustomDropdown/theme.scss +0 -0
- /package/{src → build/web}/shared/components/selectors/NativeDropdown/theme.scss +0 -0
- /package/{src → build/web}/shared/components/selectors/Switch/theme.scss +0 -0
- /package/{src → build/web}/styles/_global/reset.css +0 -0
- /package/{src → build/web}/styles/_mixins/fonts.scss +0 -0
- /package/{src → build/web}/styles/_mixins/media.scss +0 -0
- /package/{src → build/web}/styles/_mixins/typography.scss +0 -0
- /package/{src → build/web}/styles/global.scss +0 -0
- /package/{src → build/web}/styles/mixins.scss +0 -0
|
@@ -1,24 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = exports.BaseModal = void 0;
|
|
8
|
-
var _react = require("react");
|
|
9
|
-
var _reactDom = _interopRequireDefault(require("react-dom"));
|
|
10
|
-
var _reactThemes = _interopRequireDefault(require("@dr.pogodin/react-themes"));
|
|
11
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
1
|
+
import { useEffect, useMemo, useRef } from 'react';
|
|
2
|
+
import { createPortal } from 'react-dom';
|
|
3
|
+
import themed from '@dr.pogodin/react-themes';
|
|
12
4
|
const baseTheme = {
|
|
13
|
-
"context": "-dr-pogodin-react-
|
|
14
|
-
"ad": "-dr-pogodin-react-
|
|
15
|
-
"hoc": "-dr-pogodin-react-
|
|
16
|
-
"overlay": "-dr-pogodin-react-
|
|
17
|
-
"container": "-dr-pogodin-react-
|
|
5
|
+
"context": "-dr-pogodin-react-utils___build-web-shared-components-Modal-base-theme___context___sCYXfW",
|
|
6
|
+
"ad": "-dr-pogodin-react-utils___build-web-shared-components-Modal-base-theme___ad___e0BH-f",
|
|
7
|
+
"hoc": "-dr-pogodin-react-utils___build-web-shared-components-Modal-base-theme___hoc___vqUuSP",
|
|
8
|
+
"overlay": "-dr-pogodin-react-utils___build-web-shared-components-Modal-base-theme___overlay___uAH4as",
|
|
9
|
+
"container": "-dr-pogodin-react-utils___build-web-shared-components-Modal-base-theme___container___zqpc6q"
|
|
18
10
|
};
|
|
19
11
|
const S = {
|
|
20
|
-
"scrollingDisabledByModal": "-dr-pogodin-react-
|
|
12
|
+
"scrollingDisabledByModal": "-dr-pogodin-react-utils___build-web-shared-components-Modal-styles___scrollingDisabledByModal___yfvOIZ"
|
|
21
13
|
};
|
|
14
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
22
15
|
/**
|
|
23
16
|
* The `<Modal>` component implements a simple themeable modal window, wrapped
|
|
24
17
|
* into the default theme. `<BaseModal>` exposes the base non-themed component.
|
|
@@ -42,11 +35,11 @@ const BaseModal = ({
|
|
|
42
35
|
testIdForOverlay,
|
|
43
36
|
theme
|
|
44
37
|
}) => {
|
|
45
|
-
const containerRef =
|
|
46
|
-
const overlayRef =
|
|
38
|
+
const containerRef = useRef(null);
|
|
39
|
+
const overlayRef = useRef(null);
|
|
47
40
|
|
|
48
41
|
// Sets up modal cancellation of scrolling, if opted-in.
|
|
49
|
-
|
|
42
|
+
useEffect(() => {
|
|
50
43
|
if (cancelOnScrolling && onCancel) {
|
|
51
44
|
window.addEventListener('scroll', onCancel);
|
|
52
45
|
window.addEventListener('wheel', onCancel);
|
|
@@ -60,7 +53,7 @@ const BaseModal = ({
|
|
|
60
53
|
}, [cancelOnScrolling, onCancel]);
|
|
61
54
|
|
|
62
55
|
// Disables window scrolling, if it is not opted-out.
|
|
63
|
-
|
|
56
|
+
useEffect(() => {
|
|
64
57
|
if (!dontDisableScrolling) {
|
|
65
58
|
document.body.classList.add(S.scrollingDisabledByModal);
|
|
66
59
|
}
|
|
@@ -70,7 +63,7 @@ const BaseModal = ({
|
|
|
70
63
|
}
|
|
71
64
|
};
|
|
72
65
|
}, [dontDisableScrolling]);
|
|
73
|
-
const focusLast =
|
|
66
|
+
const focusLast = useMemo(() => /*#__PURE__*/_jsx("div", {
|
|
74
67
|
onFocus: () => {
|
|
75
68
|
const elems = containerRef.current.querySelectorAll('*');
|
|
76
69
|
for (let i = elems.length - 1; i >= 0; --i) {
|
|
@@ -82,10 +75,11 @@ const BaseModal = ({
|
|
|
82
75
|
// TODO: Have a look at this later.
|
|
83
76
|
// eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex
|
|
84
77
|
,
|
|
78
|
+
|
|
85
79
|
tabIndex: 0
|
|
86
80
|
}), []);
|
|
87
|
-
return /*#__PURE__*/
|
|
88
|
-
children: [focusLast, /*#__PURE__*/(
|
|
81
|
+
return /*#__PURE__*/createPortal(/*#__PURE__*/_jsxs("div", {
|
|
82
|
+
children: [focusLast, /*#__PURE__*/_jsx("div", {
|
|
89
83
|
"aria-label": "Cancel",
|
|
90
84
|
className: theme.overlay,
|
|
91
85
|
"data-testid": process.env.NODE_ENV === 'production' ? undefined : testIdForOverlay,
|
|
@@ -110,7 +104,7 @@ const BaseModal = ({
|
|
|
110
104
|
role: "button",
|
|
111
105
|
style: overlayStyle,
|
|
112
106
|
tabIndex: 0
|
|
113
|
-
}), /*#__PURE__*/(
|
|
107
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
114
108
|
// eslint-disable-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions
|
|
115
109
|
"aria-modal": "true",
|
|
116
110
|
className: theme.container,
|
|
@@ -125,18 +119,20 @@ const BaseModal = ({
|
|
|
125
119
|
role: "dialog",
|
|
126
120
|
style: style ?? containerStyle,
|
|
127
121
|
children: children
|
|
128
|
-
}), /*#__PURE__*/(
|
|
122
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
129
123
|
onFocus: () => {
|
|
130
124
|
overlayRef.current?.focus();
|
|
131
125
|
}
|
|
132
126
|
// TODO: Have a look at this later.
|
|
133
127
|
// eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex
|
|
134
128
|
,
|
|
129
|
+
|
|
135
130
|
tabIndex: 0
|
|
136
131
|
}), focusLast]
|
|
137
132
|
}), document.body);
|
|
138
133
|
};
|
|
139
|
-
|
|
140
|
-
|
|
134
|
+
export default /* #__PURE__ */themed(BaseModal, 'Modal', baseTheme);
|
|
135
|
+
|
|
141
136
|
/* Non-themed version of the Modal. */
|
|
137
|
+
export { BaseModal };
|
|
142
138
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["
|
|
1
|
+
{"version":3,"file":"index.js","names":["useEffect","useMemo","useRef","createPortal","themed","baseTheme","S","jsx","_jsx","jsxs","_jsxs","BaseModal","cancelOnScrolling","children","containerStyle","dontDisableScrolling","onCancel","overlayStyle","style","testId","testIdForOverlay","theme","containerRef","overlayRef","window","addEventListener","removeEventListener","document","body","classList","add","scrollingDisabledByModal","remove","focusLast","onFocus","elems","current","querySelectorAll","i","length","focus","activeElement","tabIndex","className","overlay","process","env","NODE_ENV","undefined","onClick","e","stopPropagation","onKeyDown","key","ref","node","role","container","onWheel","event"],"sources":["../../../../../src/shared/components/Modal/index.tsx"],"sourcesContent":["import {\n type CSSProperties,\n type FunctionComponent,\n type ReactNode,\n useEffect,\n useMemo,\n useRef,\n} from 'react';\n\nimport { createPortal } from 'react-dom';\nimport themed, { type Theme } from '@dr.pogodin/react-themes';\n\nimport baseTheme from './base-theme.scss';\nimport S from './styles.scss';\n\ntype PropsT = {\n cancelOnScrolling?: boolean;\n children?: ReactNode;\n dontDisableScrolling?: boolean;\n onCancel?: () => void;\n overlayStyle?: CSSProperties;\n style?: CSSProperties;\n testId?: string;\n testIdForOverlay?: string;\n theme: Theme<'container' | 'overlay'>;\n\n /** @deprecated */\n containerStyle?: CSSProperties;\n};\n\n/**\n * The `<Modal>` component implements a simple themeable modal window, wrapped\n * into the default theme. `<BaseModal>` exposes the base non-themed component.\n * **Children:** Component children are rendered as the modal content.\n * @param {object} props Component properties. Beside props documented below,\n * [Other theming properties](https://www.npmjs.com/package/@dr.pogodin/react-themes#themed-component-properties) are supported as well.\n * @param {function} [props.onCancel] The callback to trigger when user\n * clicks outside the modal, or presses Escape. It is expected to hide the\n * modal.\n * @param {ModalTheme} [props.theme] _Ad hoc_ theme.\n */\nconst BaseModal: FunctionComponent<PropsT> = ({\n cancelOnScrolling,\n children,\n containerStyle,\n dontDisableScrolling,\n onCancel,\n overlayStyle,\n style,\n testId,\n testIdForOverlay,\n theme,\n}) => {\n const containerRef = useRef<HTMLDivElement | null>(null);\n const overlayRef = useRef<HTMLDivElement | null>(null);\n\n // Sets up modal cancellation of scrolling, if opted-in.\n useEffect(() => {\n if (cancelOnScrolling && onCancel) {\n window.addEventListener('scroll', onCancel);\n window.addEventListener('wheel', onCancel);\n }\n return () => {\n if (cancelOnScrolling && onCancel) {\n window.removeEventListener('scroll', onCancel);\n window.removeEventListener('wheel', onCancel);\n }\n };\n }, [cancelOnScrolling, onCancel]);\n\n // Disables window scrolling, if it is not opted-out.\n useEffect(() => {\n if (!dontDisableScrolling) {\n document.body.classList.add(S.scrollingDisabledByModal);\n }\n return () => {\n if (!dontDisableScrolling) {\n document.body.classList.remove(S.scrollingDisabledByModal);\n }\n };\n }, [dontDisableScrolling]);\n\n const focusLast = useMemo(() => (\n <div\n onFocus={() => {\n const elems = containerRef.current!.querySelectorAll('*');\n for (let i = elems.length - 1; i >= 0; --i) {\n (elems[i] as HTMLElement).focus();\n if (document.activeElement === elems[i]) return;\n }\n overlayRef.current?.focus();\n }}\n // TODO: Have a look at this later.\n // eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex\n tabIndex={0}\n />\n ), []);\n\n return createPortal(\n (\n <div>\n {focusLast}\n <div\n aria-label=\"Cancel\"\n className={theme.overlay}\n data-testid={\n process.env.NODE_ENV === 'production'\n ? undefined : testIdForOverlay\n }\n onClick={(e) => {\n if (onCancel) {\n onCancel();\n e.stopPropagation();\n }\n }}\n onKeyDown={(e) => {\n if (e.key === 'Escape' && onCancel) {\n onCancel();\n e.stopPropagation();\n }\n }}\n ref={(node) => {\n if (node && node !== overlayRef.current) {\n overlayRef.current = node;\n node.focus();\n }\n }}\n role=\"button\"\n style={overlayStyle}\n tabIndex={0}\n />\n {\n // NOTE: These rules are disabled because our intention is to keep\n // the element non-interactive (thus not on the keyboard focus chain),\n // and it has `onClick` handler merely to stop propagation of click\n // events to its parent container. This is needed because, for example\n // when the modal is wrapped into an interactive element we don't want\n // any clicks inside the modal to bubble-up to that parent element\n // (because visually and logically the modal dialog does not belong\n // to its parent container, where it technically belongs from\n // the HTML mark-up perpective).\n }\n <div // eslint-disable-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions\n aria-modal=\"true\"\n className={theme.container}\n data-testid={process.env.NODE_ENV === 'production' ? undefined : testId}\n onClick={(e) => {\n e.stopPropagation();\n }}\n onWheel={(event) => {\n event.stopPropagation();\n }}\n ref={containerRef}\n role=\"dialog\"\n style={style ?? containerStyle}\n >\n {children}\n </div>\n <div\n onFocus={() => {\n overlayRef.current?.focus();\n }}\n // TODO: Have a look at this later.\n // eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex\n tabIndex={0}\n />\n {focusLast}\n </div>\n ),\n document.body,\n );\n};\n\nexport default /* #__PURE__ */ themed(BaseModal, 'Modal', baseTheme);\n\n/* Non-themed version of the Modal. */\nexport { BaseModal };\n"],"mappings":"AAAA,SAIEA,SAAS,EACTC,OAAO,EACPC,MAAM,QACD,OAAO;AAEd,SAASC,YAAY,QAAQ,WAAW;AACxC,OAAOC,MAAM,MAAsB,0BAA0B;AAAA,MAAAC,SAAA;EAAA;EAAA;EAAA;EAAA;EAAA;AAAA;AAAA,MAAAC,CAAA;EAAA;AAAA;AAG/B,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAiB9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,SAAoC,GAAGA,CAAC;EAC5CC,iBAAiB;EACjBC,QAAQ;EACRC,cAAc;EACdC,oBAAoB;EACpBC,QAAQ;EACRC,YAAY;EACZC,KAAK;EACLC,MAAM;EACNC,gBAAgB;EAChBC;AACF,CAAC,KAAK;EACJ,MAAMC,YAAY,GAAGpB,MAAM,CAAwB,IAAI,CAAC;EACxD,MAAMqB,UAAU,GAAGrB,MAAM,CAAwB,IAAI,CAAC;;EAEtD;EACAF,SAAS,CAAC,MAAM;IACd,IAAIY,iBAAiB,IAAII,QAAQ,EAAE;MACjCQ,MAAM,CAACC,gBAAgB,CAAC,QAAQ,EAAET,QAAQ,CAAC;MAC3CQ,MAAM,CAACC,gBAAgB,CAAC,OAAO,EAAET,QAAQ,CAAC;IAC5C;IACA,OAAO,MAAM;MACX,IAAIJ,iBAAiB,IAAII,QAAQ,EAAE;QACjCQ,MAAM,CAACE,mBAAmB,CAAC,QAAQ,EAAEV,QAAQ,CAAC;QAC9CQ,MAAM,CAACE,mBAAmB,CAAC,OAAO,EAAEV,QAAQ,CAAC;MAC/C;IACF,CAAC;EACH,CAAC,EAAE,CAACJ,iBAAiB,EAAEI,QAAQ,CA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AS,CAAC;;AAEpE;AACA,SAASM,SAAS","ignoreList":[]}
|
|
@@ -1,20 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = void 0;
|
|
8
|
-
var _reactRouter = require("react-router");
|
|
9
|
-
var _GenericLink = _interopRequireDefault(require("./GenericLink"));
|
|
10
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
|
-
const NavLink = props => /*#__PURE__*/(0, _jsxRuntime.jsx)(_GenericLink.default
|
|
1
|
+
import { NavLink as RrNavLink } from 'react-router';
|
|
2
|
+
import GenericLink from "./GenericLink/index.js";
|
|
3
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
4
|
+
const NavLink = props => /*#__PURE__*/_jsx(GenericLink
|
|
12
5
|
// TODO: I guess, we better re-write it to avoid the props spreading,
|
|
13
6
|
// but no need to spend time on it right now.
|
|
14
7
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
15
8
|
, {
|
|
16
9
|
...props,
|
|
17
|
-
routerLinkType:
|
|
10
|
+
routerLinkType: RrNavLink
|
|
18
11
|
});
|
|
19
|
-
|
|
12
|
+
export default NavLink;
|
|
20
13
|
//# sourceMappingURL=NavLink.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NavLink.js","names":["
|
|
1
|
+
{"version":3,"file":"NavLink.js","names":["NavLink","RrNavLink","GenericLink","jsx","_jsx","props","routerLinkType"],"sources":["../../../../src/shared/components/NavLink.tsx"],"sourcesContent":["import { type NavLinkProps, NavLink as RrNavLink } from 'react-router';\n\nimport GenericLink, { type PropsT as GenericLinkPropsT } from './GenericLink';\n\ntype PropsT = Omit<GenericLinkPropsT, 'routerLinkType'> & NavLinkProps;\n\nconst NavLink: React.FunctionComponent<PropsT>\n = (props) => (\n <GenericLink\n // TODO: I guess, we better re-write it to avoid the props spreading,\n // but no need to spend time on it right now.\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...props}\n routerLinkType={RrNavLink}\n />\n );\n\nexport default NavLink;\n"],"mappings":"AAAA,SAA4BA,OAAO,IAAIC,SAAS,QAAQ,cAAc;AAAA,OAE/DC,WAAW;AAA4D,SAAAC,GAAA,IAAAC,IAAA;AAI9E,MAAMJ,OAAwC,GACzCK,KAAK,iBACND,IAAA,CAACF;AACC;AACA;AACA;AAAA;EAAA,GACIG,KAAK;EACTC,cAAc,EAAEL;AAAU,CAC3B,CACF;AAEH,eAAeD,OAAO","ignoreList":[]}
|
|
@@ -1,20 +1,13 @@
|
|
|
1
|
-
|
|
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 _jsxRuntime = require("react/jsx-runtime");
|
|
1
|
+
import themed from '@dr.pogodin/react-themes';
|
|
10
2
|
const baseTheme = {
|
|
11
|
-
"context": "-dr-pogodin-react-
|
|
12
|
-
"ad": "-dr-pogodin-react-
|
|
13
|
-
"hoc": "-dr-pogodin-react-
|
|
14
|
-
"container": "-dr-pogodin-react-
|
|
15
|
-
"mainPanel": "-dr-pogodin-react-
|
|
16
|
-
"sidePanel": "-dr-pogodin-react-
|
|
3
|
+
"context": "-dr-pogodin-react-utils___build-web-shared-components-PageLayout-base-theme___context___zv9tdn",
|
|
4
|
+
"ad": "-dr-pogodin-react-utils___build-web-shared-components-PageLayout-base-theme___ad___yr8hbI",
|
|
5
|
+
"hoc": "-dr-pogodin-react-utils___build-web-shared-components-PageLayout-base-theme___hoc___01Mz0J",
|
|
6
|
+
"container": "-dr-pogodin-react-utils___build-web-shared-components-PageLayout-base-theme___container___blPmpk",
|
|
7
|
+
"mainPanel": "-dr-pogodin-react-utils___build-web-shared-components-PageLayout-base-theme___mainPanel___zPoY0u",
|
|
8
|
+
"sidePanel": "-dr-pogodin-react-utils___build-web-shared-components-PageLayout-base-theme___sidePanel___mRD159"
|
|
17
9
|
};
|
|
10
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
18
11
|
/**
|
|
19
12
|
* Simple and themeable page layout. It keeps the main content centered in
|
|
20
13
|
* a column of limited width, which fills entire viewport on small screens
|
|
@@ -35,18 +28,18 @@ const PageLayout = ({
|
|
|
35
28
|
leftSidePanelContent,
|
|
36
29
|
rightSidePanelContent,
|
|
37
30
|
theme
|
|
38
|
-
}) => /*#__PURE__*/(
|
|
31
|
+
}) => /*#__PURE__*/_jsxs("div", {
|
|
39
32
|
className: theme.container,
|
|
40
|
-
children: [/*#__PURE__*/(
|
|
33
|
+
children: [/*#__PURE__*/_jsx("div", {
|
|
41
34
|
className: [theme.sidePanel, theme.leftSidePanel].join(' '),
|
|
42
35
|
children: leftSidePanelContent
|
|
43
|
-
}), /*#__PURE__*/(
|
|
36
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
44
37
|
className: theme.mainPanel,
|
|
45
38
|
children: children
|
|
46
|
-
}), /*#__PURE__*/(
|
|
39
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
47
40
|
className: [theme.sidePanel, theme.rightSidePanel].join(' '),
|
|
48
41
|
children: rightSidePanelContent
|
|
49
42
|
})]
|
|
50
43
|
});
|
|
51
|
-
|
|
44
|
+
export default /* #__PURE__ */themed(PageLayout, 'PageLayout', baseTheme);
|
|
52
45
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["
|
|
1
|
+
{"version":3,"file":"index.js","names":["themed","baseTheme","jsx","_jsx","jsxs","_jsxs","PageLayout","children","leftSidePanelContent","rightSidePanelContent","theme","className","container","sidePanel","leftSidePanel","join","mainPanel","rightSidePanel"],"sources":["../../../../../src/shared/components/PageLayout/index.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\n\nimport themed, { type Theme } from '@dr.pogodin/react-themes';\n\nimport baseTheme from './base-theme.scss';\n\ntype ThemeKeyT = 'container' | 'leftSidePanel' | 'mainPanel' | 'rightSidePanel'\n | 'sidePanel';\n\ntype PropsT = {\n children?: ReactNode;\n leftSidePanelContent?: ReactNode;\n rightSidePanelContent?: ReactNode;\n theme: Theme<ThemeKeyT>;\n};\n\n/**\n * Simple and themeable page layout. It keeps the main content centered in\n * a column of limited width, which fills entire viewport on small screens\n * (under `$screen-md = 1024px` size). At larger screens the column keeps\n * `$screen-md` size, and it is centered at the page, surrounded by side\n * panels, where additional content can be displayed.\n *\n * **Children:** Component children are rendered as the content of main panel.\n * @param {object} [props] Component properties.\n * @param {Node} [props.leftSidePanelContent] The content for left side panel.\n * @param {Node} [props.rightSidePanelContent] The content for right side panel.\n * @param {PageLayoutTheme} [props.theme] _Ad hoc_ theme.\n * @param {...any} [props....]\n * [Other theming properties](https://www.npmjs.com/package/@dr.pogodin/react-themes#themed-component-properties)\n */\nconst PageLayout: React.FunctionComponent<PropsT> = ({\n children,\n leftSidePanelContent,\n rightSidePanelContent,\n theme,\n}) => (\n <div className={theme.container}>\n <div className={[theme.sidePanel, theme.leftSidePanel].join(' ')}>\n {leftSidePanelContent}\n </div>\n <div className={theme.mainPanel}>\n {children}\n </div>\n <div className={[theme.sidePanel, theme.rightSidePanel].join(' ')}>\n {rightSidePanelContent}\n </div>\n </div>\n);\n\nexport default /* #__PURE__ */ themed(PageLayout, 'PageLayout', baseTheme);\n"],"mappings":"AAEA,OAAOA,MAAM,MAAsB,0BAA0B;AAAA,MAAAC,SAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;AAAA;AAEnB,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAY1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,UAA2C,GAAGA,CAAC;EACnDC,QAAQ;EACRC,oBAAoB;EACpBC,qBAAqB;EACrBC;AACF,CAAC,kBACCL,KAAA;EAAKM,SAAS,EAAED,KAAK,CAACE,SAAU;EAAAL,QAAA,gBAC9BJ,IAAA;IAAKQ,SAAS,EAAE,CAACD,KAAK,CAACG,SAAS,EAAEH,KAAK,CAACI,aAAa,CAAC,CAACC,IAAI,CAAC,GAAG,CAAE;IAAAR,QAAA,EAC9DC;EAAoB,CAClB,CAAC,eACNL,IAAA;IAAKQ,SAAS,EAAED,KAAK,CAACM,SAAU;IAAAT,QAAA,EAC7BA;EAAQ,CACN,CAAC,eACNJ,IAAA;IAAKQ,SAAS,EAAE,CAACD,KAAK,CAACG,SAAS,EAAEH,KAAK,CAACO,cAAc,CAAC,CAACF,IAAI,CAAC,GAAG,CAAE;IAAAR,QAAA,EAC/DE;EAAqB,CACnB,CAAC;AAAA,CACH,CACN;AAED,eAAe,eAAgBT,MAAM,CAACM,UAAU,EAAE,YAAY,EAAEL,SAAS,CAAC","ignoreList":[]}
|
|
@@ -1,24 +1,17 @@
|
|
|
1
|
-
|
|
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 _jsxRuntime = require("react/jsx-runtime");
|
|
1
|
+
import { useEffect, useLayoutEffect, useRef, useState } from 'react';
|
|
2
|
+
import themed from '@dr.pogodin/react-themes';
|
|
11
3
|
const defaultTheme = {
|
|
12
|
-
"context": "-dr-pogodin-react-
|
|
13
|
-
"ad": "-dr-pogodin-react-
|
|
14
|
-
"hoc": "-dr-pogodin-react-
|
|
15
|
-
"container": "-dr-pogodin-react-
|
|
16
|
-
"label": "-dr-pogodin-react-
|
|
17
|
-
"textarea": "-dr-pogodin-react-
|
|
18
|
-
"error": "-dr-pogodin-react-
|
|
19
|
-
"errorMessage": "-dr-pogodin-react-
|
|
20
|
-
"hidden": "-dr-pogodin-react-
|
|
4
|
+
"context": "-dr-pogodin-react-utils___build-web-shared-components-TextArea-style___context___tECG8C",
|
|
5
|
+
"ad": "-dr-pogodin-react-utils___build-web-shared-components-TextArea-style___ad___epeH4O",
|
|
6
|
+
"hoc": "-dr-pogodin-react-utils___build-web-shared-components-TextArea-style___hoc___2kFnSt",
|
|
7
|
+
"container": "-dr-pogodin-react-utils___build-web-shared-components-TextArea-style___container___lV5ZyX",
|
|
8
|
+
"label": "-dr-pogodin-react-utils___build-web-shared-components-TextArea-style___label___7qDPW1",
|
|
9
|
+
"textarea": "-dr-pogodin-react-utils___build-web-shared-components-TextArea-style___textarea___gkaNJJ",
|
|
10
|
+
"error": "-dr-pogodin-react-utils___build-web-shared-components-TextArea-style___error___ObwtG4",
|
|
11
|
+
"errorMessage": "-dr-pogodin-react-utils___build-web-shared-components-TextArea-style___errorMessage___ikIw0x",
|
|
12
|
+
"hidden": "-dr-pogodin-react-utils___build-web-shared-components-TextArea-style___hidden___-UyujK"
|
|
21
13
|
};
|
|
14
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
22
15
|
const TextArea = ({
|
|
23
16
|
disabled,
|
|
24
17
|
error,
|
|
@@ -31,14 +24,14 @@ const TextArea = ({
|
|
|
31
24
|
theme,
|
|
32
25
|
value
|
|
33
26
|
}) => {
|
|
34
|
-
const hiddenAreaRef =
|
|
35
|
-
const [height, setHeight] =
|
|
36
|
-
const textAreaRef =
|
|
37
|
-
const [localValue, setLocalValue] =
|
|
27
|
+
const hiddenAreaRef = useRef(null);
|
|
28
|
+
const [height, setHeight] = useState();
|
|
29
|
+
const textAreaRef = useRef(null);
|
|
30
|
+
const [localValue, setLocalValue] = useState(value ?? '');
|
|
38
31
|
if (value !== undefined && localValue !== value) setLocalValue(value);
|
|
39
32
|
|
|
40
33
|
// This resizes text area's height when its width is changed for any reason.
|
|
41
|
-
|
|
34
|
+
useEffect(() => {
|
|
42
35
|
const el = hiddenAreaRef.current;
|
|
43
36
|
if (!el) return undefined;
|
|
44
37
|
const cb = () => {
|
|
@@ -58,33 +51,35 @@ const TextArea = ({
|
|
|
58
51
|
// useEffect() it becomes visible how the content is modified first,
|
|
59
52
|
// and then input height is incremented, if necessary).
|
|
60
53
|
// See: https://github.com/birdofpreyru/react-utils/issues/313
|
|
61
|
-
|
|
54
|
+
useLayoutEffect(() => {
|
|
62
55
|
const el = hiddenAreaRef.current;
|
|
63
56
|
if (el) setHeight(el.scrollHeight);
|
|
64
57
|
}, [localValue]);
|
|
65
58
|
let containerClassName = theme.container;
|
|
66
59
|
if (error) containerClassName += ` ${theme.error}`;
|
|
67
|
-
return /*#__PURE__*/(
|
|
60
|
+
return /*#__PURE__*/_jsxs("div", {
|
|
68
61
|
className: containerClassName,
|
|
69
62
|
onFocus: () => {
|
|
70
63
|
textAreaRef.current?.focus();
|
|
71
64
|
},
|
|
72
|
-
children: [label === undefined ? null : /*#__PURE__*/(
|
|
65
|
+
children: [label === undefined ? null : /*#__PURE__*/_jsx("div", {
|
|
73
66
|
className: theme.label,
|
|
74
67
|
children: label
|
|
75
|
-
}), /*#__PURE__*/(
|
|
68
|
+
}), /*#__PURE__*/_jsx("textarea", {
|
|
76
69
|
className: `${theme.textarea} ${theme.hidden}`
|
|
77
70
|
|
|
78
71
|
// This text area is hidden underneath the primary one below,
|
|
79
72
|
// and it is used for text measurements, to implement auto-scaling
|
|
80
73
|
// of the primary textarea's height.
|
|
81
74
|
,
|
|
75
|
+
|
|
82
76
|
readOnly: true,
|
|
83
77
|
ref: hiddenAreaRef
|
|
84
78
|
|
|
85
79
|
// The "-1" value of "tabIndex" removes this hidden text area from
|
|
86
80
|
// the tab-focus-chain.
|
|
87
81
|
,
|
|
82
|
+
|
|
88
83
|
tabIndex: -1
|
|
89
84
|
|
|
90
85
|
// NOTE: With empty string value ("") the scrolling height of this text
|
|
@@ -92,8 +87,9 @@ const TextArea = ({
|
|
|
92
87
|
// input height. To avoid it we fallback to whitespace (" ") character
|
|
93
88
|
// here.
|
|
94
89
|
,
|
|
90
|
+
|
|
95
91
|
value: localValue || ' '
|
|
96
|
-
}), /*#__PURE__*/(
|
|
92
|
+
}), /*#__PURE__*/_jsx("textarea", {
|
|
97
93
|
className: theme.textarea,
|
|
98
94
|
"data-testid": process.env.NODE_ENV === 'production' ? undefined : testId,
|
|
99
95
|
disabled: disabled,
|
|
@@ -103,6 +99,7 @@ const TextArea = ({
|
|
|
103
99
|
// manage it internally for the measurement / resizing functionality
|
|
104
100
|
// to work.
|
|
105
101
|
,
|
|
102
|
+
|
|
106
103
|
onChange: value === undefined ? e => {
|
|
107
104
|
setLocalValue(e.target.value);
|
|
108
105
|
} : onChange,
|
|
@@ -113,11 +110,11 @@ const TextArea = ({
|
|
|
113
110
|
height
|
|
114
111
|
},
|
|
115
112
|
value: localValue
|
|
116
|
-
}), error && error !== true ? /*#__PURE__*/(
|
|
113
|
+
}), error && error !== true ? /*#__PURE__*/_jsx("div", {
|
|
117
114
|
className: theme.errorMessage,
|
|
118
115
|
children: error
|
|
119
116
|
}) : null]
|
|
120
117
|
});
|
|
121
118
|
};
|
|
122
|
-
|
|
119
|
+
export default /* #__PURE__ */themed(TextArea, 'TextArea', defaultTheme);
|
|
123
120
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["
|
|
1
|
+
{"version":3,"file":"index.js","names":["useEffect","useLayoutEffect","useRef","useState","themed","defaultTheme","jsx","_jsx","jsxs","_jsxs","TextArea","disabled","error","label","onBlur","onChange","onKeyDown","placeholder","testId","theme","value","hiddenAreaRef","height","setHeight","textAreaRef","localValue","setLocalValue","undefined","el","current","cb","scrollHeight","observer","ResizeObserver","observe","disconnect","containerClassName","container","className","onFocus","focus","children","textarea","hidden","readOnly","ref","tabIndex","process","env","NODE_ENV","e","target","style","errorMessage"],"sources":["../../../../../src/shared/components/TextArea/index.tsx"],"sourcesContent":["import {\n type ChangeEventHandler,\n type FocusEventHandler,\n type FunctionComponent,\n type KeyboardEventHandler,\n type ReactNode,\n useEffect,\n useLayoutEffect,\n useRef,\n useState,\n} from 'react';\n\nimport themed, { type Theme } from '@dr.pogodin/react-themes';\n\nimport defaultTheme from './style.scss';\n\ntype ThemeKeyT = 'container' | 'error' | 'errorMessage' | 'hidden' | 'label'\n | 'textarea';\n\ntype Props = {\n disabled?: boolean;\n error?: ReactNode;\n label?: string;\n onBlur?: FocusEventHandler<HTMLTextAreaElement>;\n onChange?: ChangeEventHandler<HTMLTextAreaElement>;\n onKeyDown?: KeyboardEventHandler<HTMLTextAreaElement>;\n placeholder?: string;\n testId?: string;\n theme: Theme<ThemeKeyT>;\n value?: string;\n};\n\nconst TextArea: FunctionComponent<Props> = ({\n disabled,\n error,\n label,\n onBlur,\n onChange,\n onKeyDown,\n placeholder,\n testId,\n theme,\n value,\n}) => {\n const hiddenAreaRef = useRef<HTMLTextAreaElement>(null);\n const [height, setHeight] = useState<number | undefined>();\n\n const textAreaRef = useRef<HTMLTextAreaElement>(null);\n\n const [localValue, setLocalValue] = useState(value ?? '');\n if (value !== undefined && localValue !== value) setLocalValue(value);\n\n // This resizes text area's height when its width is changed for any reason.\n useEffect(() => {\n const el = hiddenAreaRef.current;\n if (!el) return undefined;\n\n const cb = () => {\n setHeight(el.scrollHeight);\n };\n const observer = new ResizeObserver(cb);\n observer.observe(el);\n\n return () => {\n observer.disconnect();\n };\n }, []);\n\n // Resizes the text area when its content is modified.\n //\n // NOTE: useLayoutEffect() instead of useEffect() makes difference here,\n // as it helps to avoid visible \"content/height\" jumps (i.e. with just\n // useEffect() it becomes visible how the content is modified first,\n // and then input height is incremented, if necessary).\n // See: https://github.com/birdofpreyru/react-utils/issues/313\n useLayoutEffect(() => {\n const el = hiddenAreaRef.current;\n if (el) setHeight(el.scrollHeight);\n }, [localValue]);\n\n let containerClassName = theme.container;\n if (error) containerClassName += ` ${theme.error}`;\n\n return (\n <div\n className={containerClassName}\n onFocus={() => {\n textAreaRef.current?.focus();\n }}\n >\n {label === undefined ? null : <div className={theme.label}>{label}</div>}\n <textarea\n className={`${theme.textarea} ${theme.hidden}`}\n\n // This text area is hidden underneath the primary one below,\n // and it is used for text measurements, to implement auto-scaling\n // of the primary textarea's height.\n readOnly\n ref={hiddenAreaRef}\n\n // The \"-1\" value of \"tabIndex\" removes this hidden text area from\n // the tab-focus-chain.\n tabIndex={-1}\n\n // NOTE: With empty string value (\"\") the scrolling height of this text\n // area is zero, thus collapsing <TextArea> height below the single line\n // input height. To avoid it we fallback to whitespace (\" \") character\n // here.\n value={localValue || ' '}\n />\n <textarea\n className={theme.textarea}\n data-testid={process.env.NODE_ENV === 'production' ? undefined : testId}\n disabled={disabled}\n onBlur={onBlur}\n\n // When value is \"undefined\" the text area is not-managed, and we should\n // manage it internally for the measurement / resizing functionality\n // to work.\n onChange={\n value === undefined\n ? (e) => {\n setLocalValue(e.target.value);\n } : onChange\n }\n onKeyDown={onKeyDown}\n placeholder={placeholder}\n ref={textAreaRef}\n style={{ height }}\n value={localValue}\n />\n {error && error !== true\n ? <div className={theme.errorMessage}>{error}</div>\n : null}\n </div>\n );\n};\n\nexport default /* #__PURE__ */ themed(TextArea, 'TextArea', defaultTheme);\n"],"mappings":"AAAA,SAMEA,SAAS,EACTC,eAAe,EACfC,MAAM,EACNC,QAAQ,QACH,OAAO;AAEd,OAAOC,MAAM,MAAsB,0BAA0B;AAAA,MAAAC,YAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;AAAA;AAErB,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAkBxC,MAAMC,QAAkC,GAAGA,CAAC;EAC1CC,QAAQ;EACRC,KAAK;EACLC,KAAK;EACLC,MAAM;EACNC,QAAQ;EACRC,SAAS;EACTC,WAAW;EACXC,MA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YAAY,CAAC","ignoreList":[]}
|
|
@@ -1,20 +1,13 @@
|
|
|
1
|
-
|
|
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 _jsxRuntime = require("react/jsx-runtime");
|
|
1
|
+
import themed from '@dr.pogodin/react-themes';
|
|
10
2
|
const defaultTheme = {
|
|
11
|
-
"context": "-dr-pogodin-react-
|
|
12
|
-
"ad": "-dr-pogodin-react-
|
|
13
|
-
"hoc": "-dr-pogodin-react-
|
|
14
|
-
"bouncing": "-dr-pogodin-react-
|
|
15
|
-
"container": "-dr-pogodin-react-
|
|
16
|
-
"circle": "-dr-pogodin-react-
|
|
3
|
+
"context": "-dr-pogodin-react-utils___build-web-shared-components-Throbber-theme___context___eVCJf-",
|
|
4
|
+
"ad": "-dr-pogodin-react-utils___build-web-shared-components-Throbber-theme___ad___CU2B6H",
|
|
5
|
+
"hoc": "-dr-pogodin-react-utils___build-web-shared-components-Throbber-theme___hoc___1V5iVx",
|
|
6
|
+
"bouncing": "-dr-pogodin-react-utils___build-web-shared-components-Throbber-theme___bouncing___h6ZYmQ",
|
|
7
|
+
"container": "-dr-pogodin-react-utils___build-web-shared-components-Throbber-theme___container___VDVI-X",
|
|
8
|
+
"circle": "-dr-pogodin-react-utils___build-web-shared-components-Throbber-theme___circle___Y2rzbL"
|
|
17
9
|
};
|
|
10
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
18
11
|
/**
|
|
19
12
|
* Throbber is an "action in progress" indicator, which renders
|
|
20
13
|
* three bouncing circles as a simple pending activity indicator,
|
|
@@ -26,15 +19,15 @@ const defaultTheme = {
|
|
|
26
19
|
*/
|
|
27
20
|
const Throbber = ({
|
|
28
21
|
theme
|
|
29
|
-
}) => /*#__PURE__*/(
|
|
22
|
+
}) => /*#__PURE__*/_jsxs("span", {
|
|
30
23
|
className: theme.container,
|
|
31
|
-
children: [/*#__PURE__*/(
|
|
24
|
+
children: [/*#__PURE__*/_jsx("span", {
|
|
32
25
|
className: theme.circle
|
|
33
|
-
}), /*#__PURE__*/(
|
|
26
|
+
}), /*#__PURE__*/_jsx("span", {
|
|
34
27
|
className: theme.circle
|
|
35
|
-
}), /*#__PURE__*/(
|
|
28
|
+
}), /*#__PURE__*/_jsx("span", {
|
|
36
29
|
className: theme.circle
|
|
37
30
|
})]
|
|
38
31
|
});
|
|
39
|
-
|
|
32
|
+
export default /* #__PURE__ */themed(Throbber, 'Throbber', defaultTheme);
|
|
40
33
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["
|
|
1
|
+
{"version":3,"file":"index.js","names":["themed","defaultTheme","jsx","_jsx","jsxs","_jsxs","Throbber","theme","className","container","children","circle"],"sources":["../../../../../src/shared/components/Throbber/index.tsx"],"sourcesContent":["import themed, { type Theme } from '@dr.pogodin/react-themes';\n\nimport defaultTheme from './theme.scss';\n\ntype ThemeKeyT = 'bouncing' | 'circle' | 'container';\n\ntype PropsT = {\n theme: Theme<ThemeKeyT>;\n};\n\n/**\n * Throbber is an \"action in progress\" indicator, which renders\n * three bouncing circles as a simple pending activity indicator,\n * and can be further themed to a certain degree.\n * @param {object} [props] Component properties.\n * @param {ThrobberTheme} [props.theme] _Ad hoc_ theme.\n * @param {...any} [props....]\n * [Other theming properties](https://www.npmjs.com/package/@dr.pogodin/react-themes#themed-component-properties)\n */\nconst Throbber: React.FunctionComponent<PropsT> = ({ theme }) => (\n <span className={theme.container}>\n <span className={theme.circle} />\n <span className={theme.circle} />\n <span className={theme.circle} />\n </span>\n);\n\nexport default /* #__PURE__ */ themed(Throbber, 'Throbber', defaultTheme);\n"],"mappings":"AAAA,OAAOA,MAAM,MAAsB,0BAA0B;AAAA,MAAAC,YAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;AAAA;AAErB,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAQxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,QAAyC,GAAGA,CAAC;EAAEC;AAAM,CAAC,kBAC1DF,KAAA;EAAMG,SAAS,EAAED,KAAK,CAACE,SAAU;EAAAC,QAAA,gBAC/BP,IAAA;IAAMK,SAAS,EAAED,KAAK,CAACI;EAAO,CAAE,CAAC,eACjCR,IAAA;IAAMK,SAAS,EAAED,KAAK,CAACI;EAAO,CAAE,CAAC,eACjCR,IAAA;IAAMK,SAAS,EAAED,KAAK,CAACI;EAAO,CAAE,CAAC;AAAA,CAC7B,CACP;AAED,eAAe,eAAgBX,MAAM,CAACM,QAAQ,EAAE,UAAU,EAAEL,YAAY,CAAC","ignoreList":[]}
|
|
@@ -1,22 +1,17 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = exports.PLACEMENTS = void 0;
|
|
7
|
-
var _react = require("react");
|
|
8
|
-
var _reactDom = require("react-dom");
|
|
9
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
10
1
|
/**
|
|
11
2
|
* The actual tooltip component. It is rendered outside the regular document
|
|
12
3
|
* hierarchy, and with sub-components managed without React to achieve the best
|
|
13
4
|
* performance during animation.
|
|
14
5
|
*/
|
|
6
|
+
|
|
7
|
+
import { useImperativeHandle, useRef } from 'react';
|
|
8
|
+
import { createPortal } from 'react-dom';
|
|
9
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
15
10
|
/**
|
|
16
11
|
* Valid placements of the rendered tooltip. They will be overriden when
|
|
17
12
|
* necessary to fit the tooltip within the viewport.
|
|
18
13
|
*/
|
|
19
|
-
let PLACEMENTS =
|
|
14
|
+
export let PLACEMENTS = /*#__PURE__*/function (PLACEMENTS) {
|
|
20
15
|
PLACEMENTS["ABOVE_CURSOR"] = "ABOVE_CURSOR";
|
|
21
16
|
PLACEMENTS["ABOVE_ELEMENT"] = "ABOVE_ELEMENT";
|
|
22
17
|
PLACEMENTS["BELOW_CURSOR"] = "BELOW_CURSOR";
|
|
@@ -198,9 +193,9 @@ const Tooltip = ({
|
|
|
198
193
|
// Thus, when we create the <Tooltip> we have to record its target positioning
|
|
199
194
|
// details, and then apply them when it is created.
|
|
200
195
|
|
|
201
|
-
const arrowRef =
|
|
202
|
-
const containerRef =
|
|
203
|
-
const contentRef =
|
|
196
|
+
const arrowRef = useRef(null);
|
|
197
|
+
const containerRef = useRef(null);
|
|
198
|
+
const contentRef = useRef(null);
|
|
204
199
|
const pointTo = (pageX, pageY, placement, element) => {
|
|
205
200
|
if (!arrowRef.current || !containerRef.current || !contentRef.current) {
|
|
206
201
|
throw Error('Internal error');
|
|
@@ -211,21 +206,21 @@ const Tooltip = ({
|
|
|
211
206
|
content: contentRef.current
|
|
212
207
|
});
|
|
213
208
|
};
|
|
214
|
-
|
|
209
|
+
useImperativeHandle(ref, () => ({
|
|
215
210
|
pointTo
|
|
216
211
|
}));
|
|
217
|
-
return /*#__PURE__*/
|
|
212
|
+
return /*#__PURE__*/createPortal(/*#__PURE__*/_jsxs("div", {
|
|
218
213
|
className: theme.container,
|
|
219
214
|
ref: containerRef,
|
|
220
|
-
children: [/*#__PURE__*/(
|
|
215
|
+
children: [/*#__PURE__*/_jsx("div", {
|
|
221
216
|
className: theme.arrow,
|
|
222
217
|
ref: arrowRef
|
|
223
|
-
}), /*#__PURE__*/(
|
|
218
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
224
219
|
className: theme.content,
|
|
225
220
|
ref: contentRef,
|
|
226
221
|
children: children
|
|
227
222
|
})]
|
|
228
223
|
}), document.body);
|
|
229
224
|
};
|
|
230
|
-
|
|
225
|
+
export default Tooltip;
|
|
231
226
|
//# sourceMappingURL=Tooltip.js.map
|