@dr.pogodin/react-utils 1.39.0 → 1.39.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/development/shared/components/Button/index.js +3 -3
- package/build/development/shared/components/Button/index.js.map +1 -1
- package/build/development/shared/components/Input/index.js +1 -1
- package/build/development/shared/components/Input/index.js.map +1 -1
- package/build/development/shared/components/Modal/index.js +1 -1
- package/build/development/shared/components/Modal/index.js.map +1 -1
- package/build/development/shared/components/selectors/NativeDropdown/index.js +1 -1
- package/build/development/shared/components/selectors/NativeDropdown/index.js.map +1 -1
- package/build/development/shared/components/selectors/common.js.map +1 -1
- package/build/development/shared/utils/isomorphy/buildInfo.js +0 -2
- package/build/development/shared/utils/isomorphy/buildInfo.js.map +1 -1
- package/build/development/shared/utils/isomorphy/environment-check.js.map +1 -1
- package/build/development/shared/utils/jest/index.js +11 -5
- package/build/development/shared/utils/jest/index.js.map +1 -1
- package/build/development/style.css +17 -18
- package/build/development/web.bundle.js +15 -15
- package/build/production/shared/components/Button/index.js +1 -1
- package/build/production/shared/components/Button/index.js.map +1 -1
- package/build/production/shared/components/Input/index.js +1 -1
- package/build/production/shared/components/Input/index.js.map +1 -1
- package/build/production/shared/components/Modal/index.js +1 -1
- package/build/production/shared/components/Modal/index.js.map +1 -1
- package/build/production/shared/components/selectors/NativeDropdown/index.js +1 -1
- package/build/production/shared/components/selectors/NativeDropdown/index.js.map +1 -1
- package/build/production/shared/components/selectors/common.js.map +1 -1
- package/build/production/shared/utils/isomorphy/buildInfo.js +1 -1
- package/build/production/shared/utils/isomorphy/buildInfo.js.map +1 -1
- package/build/production/shared/utils/isomorphy/environment-check.js.map +1 -1
- package/build/production/shared/utils/jest/index.js +1 -1
- package/build/production/shared/utils/jest/index.js.map +1 -1
- package/build/production/style.css +1 -1
- package/build/production/style.css.map +1 -1
- package/build/production/web.bundle.js +1 -1
- package/build/production/web.bundle.js.map +1 -1
- package/build/types-code/shared/components/selectors/common.d.ts +1 -1
- package/build/types-code/shared/utils/isomorphy/environment-check.d.ts +0 -3
- package/build/types-code/shared/utils/jest/index.d.ts +0 -3
- package/config/webpack/app-base.js +5 -0
- package/config/webpack/lib-base.js +5 -0
- package/package.json +21 -20
- package/src/shared/components/Button/index.tsx +6 -3
- package/src/shared/components/Input/index.tsx +1 -1
- package/src/shared/components/Modal/base-theme.scss +2 -2
- package/src/shared/components/Modal/index.tsx +1 -1
- package/src/shared/components/selectors/NativeDropdown/index.tsx +1 -1
- package/src/shared/components/selectors/NativeDropdown/theme.scss +0 -1
- package/src/shared/components/selectors/common.ts +1 -1
- package/src/shared/utils/isomorphy/buildInfo.ts +0 -2
- package/src/shared/utils/isomorphy/environment-check.ts +0 -5
- package/src/shared/utils/jest/index.tsx +18 -13
- package/src/styles/mixins.scss +3 -1
- package/types.d.ts +5 -0
|
@@ -10,7 +10,7 @@ export type PropsT<NameT, OnChangeT = React.ChangeEventHandler<HTMLSelectElement
|
|
|
10
10
|
filter?: (item: OptionT<NameT> | ValueT) => boolean;
|
|
11
11
|
label?: React.ReactNode;
|
|
12
12
|
onChange?: OnChangeT;
|
|
13
|
-
options
|
|
13
|
+
options: Readonly<OptionsT<NameT>>;
|
|
14
14
|
testId?: string;
|
|
15
15
|
theme: Theme<ThemeKeyT>;
|
|
16
16
|
value?: ValueT;
|
|
@@ -7,9 +7,6 @@ import { type RenderResult } from '@testing-library/react';
|
|
|
7
7
|
*/
|
|
8
8
|
export { act };
|
|
9
9
|
export { default as getGlobal } from './global';
|
|
10
|
-
declare global {
|
|
11
|
-
var IS_REACT_ACT_ENVIRONMENT: boolean | undefined;
|
|
12
|
-
}
|
|
13
10
|
/**
|
|
14
11
|
* Tricks **react-utils** into thinking the test is running within client-side
|
|
15
12
|
* (browser) environment.
|
|
@@ -258,6 +258,11 @@ function configFactory(ops) {
|
|
|
258
258
|
generator: {
|
|
259
259
|
filename: 'fonts/[contenthash][ext][query]',
|
|
260
260
|
},
|
|
261
|
+
}, {
|
|
262
|
+
// Aggregates source maps from dependencies.
|
|
263
|
+
test: /\.js$/,
|
|
264
|
+
enforce: 'pre',
|
|
265
|
+
use: ['source-map-loader'],
|
|
261
266
|
}, {
|
|
262
267
|
/* Loads JS and JSX moudles, and inlines SVG assets. */
|
|
263
268
|
test: ops.typescript ? /\.((j|t)sx?|svg)$/ : /\.(jsx?|svg)$/,
|
|
@@ -74,6 +74,11 @@ function configFactory(ops) {
|
|
|
74
74
|
filename: '../shared/[path][name][ext]',
|
|
75
75
|
publicPath: `${ops.library}/build/shared`,
|
|
76
76
|
},
|
|
77
|
+
}, {
|
|
78
|
+
// Aggregates source maps from dependencies.
|
|
79
|
+
test: /\.js$/,
|
|
80
|
+
enforce: 'pre',
|
|
81
|
+
use: ['source-map-loader'],
|
|
77
82
|
}, {
|
|
78
83
|
/* Loads JS and JSX moudles, and inlines SVG assets. */
|
|
79
84
|
test: ops.typescript ? /\.((j|t)sx?|svg)$/ : /\.(jsx?|svg)$/,
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.39.
|
|
2
|
+
"version": "1.39.2",
|
|
3
3
|
"bin": {
|
|
4
4
|
"react-utils-build": "bin/build.js",
|
|
5
5
|
"react-utils-setup": "bin/setup.js"
|
|
@@ -8,11 +8,11 @@
|
|
|
8
8
|
"url": "https://github.com/birdofpreyru/react-utils/issues"
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@babel/runtime": "^7.24.
|
|
11
|
+
"@babel/runtime": "^7.24.8",
|
|
12
12
|
"@dr.pogodin/babel-plugin-react-css-modules": "^6.13.2",
|
|
13
13
|
"@dr.pogodin/csurf": "^1.13.0",
|
|
14
14
|
"@dr.pogodin/js-utils": "^0.0.12",
|
|
15
|
-
"@dr.pogodin/react-global-state": "^0.15.
|
|
15
|
+
"@dr.pogodin/react-global-state": "^0.15.1",
|
|
16
16
|
"@dr.pogodin/react-themes": "^1.7.0",
|
|
17
17
|
"@jest/environment": "^29.7.0",
|
|
18
18
|
"axios": "^1.7.2",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"cookie": "^0.6.0",
|
|
23
23
|
"cookie-parser": "^1.4.6",
|
|
24
24
|
"cross-env": "^7.0.3",
|
|
25
|
-
"dayjs": "^1.11.
|
|
25
|
+
"dayjs": "^1.11.12",
|
|
26
26
|
"express": "^4.19.2",
|
|
27
27
|
"helmet": "^7.1.0",
|
|
28
28
|
"http-status-codes": "^2.3.0",
|
|
@@ -35,31 +35,31 @@
|
|
|
35
35
|
"react": "^18.3.1",
|
|
36
36
|
"react-dom": "^18.3.1",
|
|
37
37
|
"react-helmet": "^6.1.0",
|
|
38
|
-
"react-router-dom": "^6.
|
|
38
|
+
"react-router-dom": "^6.25.1",
|
|
39
39
|
"request-ip": "^3.3.0",
|
|
40
40
|
"rimraf": "^6.0.0",
|
|
41
41
|
"serialize-javascript": "^6.0.2",
|
|
42
42
|
"serve-favicon": "^2.5.0",
|
|
43
43
|
"source-map-support": "^0.5.21",
|
|
44
44
|
"uuid": "^10.0.0",
|
|
45
|
-
"winston": "^3.13.
|
|
45
|
+
"winston": "^3.13.1"
|
|
46
46
|
},
|
|
47
47
|
"description": "Collection of generic ReactJS components and utils",
|
|
48
48
|
"devDependencies": {
|
|
49
|
-
"@babel/cli": "^7.24.
|
|
50
|
-
"@babel/core": "^7.24.
|
|
51
|
-
"@babel/eslint-parser": "^7.24.
|
|
49
|
+
"@babel/cli": "^7.24.8",
|
|
50
|
+
"@babel/core": "^7.24.9",
|
|
51
|
+
"@babel/eslint-parser": "^7.24.8",
|
|
52
52
|
"@babel/eslint-plugin": "^7.24.7",
|
|
53
|
-
"@babel/node": "^7.24.
|
|
53
|
+
"@babel/node": "^7.24.8",
|
|
54
54
|
"@babel/plugin-transform-runtime": "^7.24.7",
|
|
55
|
-
"@babel/preset-env": "^7.24.
|
|
55
|
+
"@babel/preset-env": "^7.24.8",
|
|
56
56
|
"@babel/preset-react": "^7.24.7",
|
|
57
57
|
"@babel/preset-typescript": "^7.24.7",
|
|
58
58
|
"@babel/register": "^7.24.6",
|
|
59
59
|
"@dr.pogodin/babel-plugin-transform-assets": "^1.2.2",
|
|
60
60
|
"@dr.pogodin/babel-preset-svgr": "^1.8.0",
|
|
61
61
|
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.15",
|
|
62
|
-
"@testing-library/dom": "^10.3.
|
|
62
|
+
"@testing-library/dom": "^10.3.2",
|
|
63
63
|
"@testing-library/react": "^16.0.0",
|
|
64
64
|
"@testing-library/user-event": "^14.5.2",
|
|
65
65
|
"@tsconfig/recommended": "^1.0.7",
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
"@types/csurf": "^1.11.5",
|
|
71
71
|
"@types/express": "^4.17.21",
|
|
72
72
|
"@types/jest": "^29.5.12",
|
|
73
|
-
"@types/lodash": "^4.17.
|
|
73
|
+
"@types/lodash": "^4.17.7",
|
|
74
74
|
"@types/morgan": "^1.9.9",
|
|
75
75
|
"@types/node-forge": "^1.3.11",
|
|
76
76
|
"@types/pretty": "^2.0.3",
|
|
@@ -97,7 +97,7 @@
|
|
|
97
97
|
"eslint-plugin-import": "^2.29.1",
|
|
98
98
|
"eslint-plugin-jest": "^28.6.0",
|
|
99
99
|
"eslint-plugin-jsx-a11y": "^6.9.0",
|
|
100
|
-
"eslint-plugin-react": "^7.
|
|
100
|
+
"eslint-plugin-react": "^7.35.0",
|
|
101
101
|
"eslint-plugin-react-hooks": "^4.6.2",
|
|
102
102
|
"identity-obj-proxy": "^3.0.0",
|
|
103
103
|
"jest": "^29.7.0",
|
|
@@ -113,19 +113,20 @@
|
|
|
113
113
|
"react-refresh": "^0.14.2",
|
|
114
114
|
"regenerator-runtime": "^0.14.1",
|
|
115
115
|
"resolve-url-loader": "^5.0.0",
|
|
116
|
-
"sass": "^1.77.
|
|
116
|
+
"sass": "^1.77.8",
|
|
117
117
|
"sass-loader": "^14.2.1",
|
|
118
118
|
"sitemap": "^8.0.0",
|
|
119
|
-
"
|
|
119
|
+
"source-map-loader": "^5.0.0",
|
|
120
|
+
"stylelint": "^16.7.0",
|
|
120
121
|
"stylelint-config-standard-scss": "^13.1.0",
|
|
121
122
|
"supertest": "^7.0.0",
|
|
122
123
|
"tsc-alias": "^1.8.10",
|
|
123
|
-
"tstyche": "^2.
|
|
124
|
+
"tstyche": "^2.1.0",
|
|
124
125
|
"typed-scss-modules": "^8.0.1",
|
|
125
126
|
"typescript": "^5.5.3",
|
|
126
|
-
"typescript-eslint": "^7.16.
|
|
127
|
-
"webpack": "^5.
|
|
128
|
-
"webpack-dev-middleware": "^7.
|
|
127
|
+
"typescript-eslint": "^7.16.1",
|
|
128
|
+
"webpack": "^5.93.0",
|
|
129
|
+
"webpack-dev-middleware": "^7.3.0",
|
|
129
130
|
"webpack-hot-middleware": "^2.26.1",
|
|
130
131
|
"webpack-merge": "^6.0.1",
|
|
131
132
|
"workbox-core": "^7.1.0",
|
|
@@ -42,7 +42,10 @@ export const BaseButton: React.FunctionComponent<PropsT> = ({
|
|
|
42
42
|
if (disabled) {
|
|
43
43
|
if (theme.disabled) className += ` ${theme.disabled}`;
|
|
44
44
|
return (
|
|
45
|
-
<div
|
|
45
|
+
<div
|
|
46
|
+
className={className}
|
|
47
|
+
data-testid={process.env.NODE_ENV === 'production' ? undefined : testId}
|
|
48
|
+
>
|
|
46
49
|
{children}
|
|
47
50
|
</div>
|
|
48
51
|
);
|
|
@@ -51,7 +54,7 @@ export const BaseButton: React.FunctionComponent<PropsT> = ({
|
|
|
51
54
|
return (
|
|
52
55
|
<Link
|
|
53
56
|
className={className}
|
|
54
|
-
data-testid={testId}
|
|
57
|
+
data-testid={process.env.NODE_ENV === 'production' ? undefined : testId}
|
|
55
58
|
enforceA={enforceA}
|
|
56
59
|
onClick={onClick}
|
|
57
60
|
onMouseDown={onMouseDown}
|
|
@@ -67,7 +70,7 @@ export const BaseButton: React.FunctionComponent<PropsT> = ({
|
|
|
67
70
|
return (
|
|
68
71
|
<div
|
|
69
72
|
className={className}
|
|
70
|
-
data-testid={testId}
|
|
73
|
+
data-testid={process.env.NODE_ENV === 'production' ? undefined : testId}
|
|
71
74
|
onClick={onClick}
|
|
72
75
|
onKeyDown={onClick && ((e) => {
|
|
73
76
|
if (e.key === 'Enter') onClick(e);
|
|
@@ -37,7 +37,7 @@ const Input = forwardRef<HTMLInputElement, PropsT>((
|
|
|
37
37
|
{ label === undefined ? null : <div className={theme.label}>{label}</div> }
|
|
38
38
|
<input
|
|
39
39
|
className={theme.input}
|
|
40
|
-
data-testid={testId}
|
|
40
|
+
data-testid={process.env.NODE_ENV === 'production' ? undefined : testId}
|
|
41
41
|
ref={ref}
|
|
42
42
|
{...rest} // eslint-disable-line react/jsx-props-no-spreading
|
|
43
43
|
/>
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
position: fixed;
|
|
12
12
|
top: 0;
|
|
13
13
|
width: 100%;
|
|
14
|
-
z-index:
|
|
14
|
+
z-index: $zIndexOfDefaultModalOverlay;
|
|
15
15
|
|
|
16
16
|
&:focus { outline: none; }
|
|
17
17
|
}
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
top: 50%;
|
|
30
30
|
left: 50%;
|
|
31
31
|
transform: translate(-50%, -50%);
|
|
32
|
-
z-index:
|
|
32
|
+
z-index: $zIndexOfDefaultModalOverlay + 1;
|
|
33
33
|
|
|
34
34
|
@include xs-to-lg {
|
|
35
35
|
max-width: 95vw;
|
|
@@ -147,7 +147,7 @@ const BaseModal: React.FunctionComponent<PropsT> = ({
|
|
|
147
147
|
<div
|
|
148
148
|
aria-modal="true"
|
|
149
149
|
className={theme.container}
|
|
150
|
-
data-testid={testId}
|
|
150
|
+
data-testid={process.env.NODE_ENV === 'production' ? undefined : testId}
|
|
151
151
|
onClick={(e) => e.stopPropagation()}
|
|
152
152
|
onWheel={(event) => event.stopPropagation()}
|
|
153
153
|
ref={containerRef}
|
|
@@ -76,7 +76,7 @@ const Dropdown: React.FunctionComponent<PropsT<string>> = ({
|
|
|
76
76
|
<div className={theme.dropdown}>
|
|
77
77
|
<select
|
|
78
78
|
className={selectClassName}
|
|
79
|
-
data-testid={testId}
|
|
79
|
+
data-testid={process.env.NODE_ENV === 'production' ? undefined : testId}
|
|
80
80
|
onChange={onChange}
|
|
81
81
|
value={value}
|
|
82
82
|
>
|
|
@@ -37,7 +37,7 @@ export type PropsT<
|
|
|
37
37
|
filter?: (item: OptionT<NameT> | ValueT) => boolean;
|
|
38
38
|
label?: React.ReactNode;
|
|
39
39
|
onChange?: OnChangeT;
|
|
40
|
-
options
|
|
40
|
+
options: Readonly<OptionsT<NameT>>;
|
|
41
41
|
testId?: string;
|
|
42
42
|
theme: Theme<ThemeKeyT>;
|
|
43
43
|
value?: ValueT;
|
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
// Checks for client- vs. server-side environment detection.
|
|
2
2
|
|
|
3
|
-
declare global {
|
|
4
|
-
// eslint-disable-next-line no-var, vars-on-top
|
|
5
|
-
var REACT_UTILS_FORCE_CLIENT_SIDE: boolean | undefined;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
3
|
/**
|
|
9
4
|
* `true` within client-side environment (browser), `false` at server-side.
|
|
10
5
|
*/
|
|
@@ -21,11 +21,6 @@ export { act };
|
|
|
21
21
|
|
|
22
22
|
export { default as getGlobal } from './global';
|
|
23
23
|
|
|
24
|
-
declare global {
|
|
25
|
-
// eslint-disable-next-line no-var, vars-on-top
|
|
26
|
-
var IS_REACT_ACT_ENVIRONMENT: boolean | undefined;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
24
|
global.IS_REACT_ACT_ENVIRONMENT = true;
|
|
30
25
|
|
|
31
26
|
const originalProcessVersions = process.versions;
|
|
@@ -81,14 +76,24 @@ export function mockAxios(handlers: AxiosRequestHandlerT[]) {
|
|
|
81
76
|
}
|
|
82
77
|
|
|
83
78
|
// Fallback to the regular network request.
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
79
|
+
let res: AxiosResponse;
|
|
80
|
+
try {
|
|
81
|
+
res = await axios({ ...config, adapter: ['xhr', 'http', 'fetch'] });
|
|
82
|
+
console.warn(
|
|
83
|
+
'Network request has not been mocked for a test.\n\nConfig:\n',
|
|
84
|
+
config,
|
|
85
|
+
'\n\nResult:\n',
|
|
86
|
+
JSON.stringify(res, null, 2),
|
|
87
|
+
);
|
|
88
|
+
} catch (e) {
|
|
89
|
+
console.warn(
|
|
90
|
+
'Network request has not been mocked for a test, and failed.\n\nConfig:\n',
|
|
91
|
+
config,
|
|
92
|
+
'\n\nError\n',
|
|
93
|
+
JSON.stringify(e, null, 2),
|
|
94
|
+
);
|
|
95
|
+
throw e;
|
|
96
|
+
}
|
|
92
97
|
|
|
93
98
|
return res;
|
|
94
99
|
};
|
package/src/styles/mixins.scss
CHANGED
package/types.d.ts
CHANGED