@dr.pogodin/react-utils 1.43.30 → 1.43.32
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/server/renderer.js +1 -1
- package/build/development/server/renderer.js.map +1 -1
- package/build/development/shared/components/Button/index.js +20 -4
- package/build/development/shared/components/Button/index.js.map +1 -1
- package/build/development/shared/utils/jest/E2eSsrEnv.js +1 -0
- package/build/development/shared/utils/jest/E2eSsrEnv.js.map +1 -1
- package/build/development/web.bundle.js +16 -16
- package/build/production/server/renderer.js +1 -1
- package/build/production/server/renderer.js.map +1 -1
- package/build/production/shared/components/Button/index.js +6 -1
- package/build/production/shared/components/Button/index.js.map +1 -1
- package/build/production/shared/utils/jest/E2eSsrEnv.js +1 -1
- package/build/production/shared/utils/jest/E2eSsrEnv.js.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/Button/index.d.ts +2 -0
- package/config/babel/webpack.js +1 -2
- package/package.json +15 -15
- package/src/server/renderer.tsx +2 -2
- package/src/shared/components/Button/index.tsx +22 -3
- package/src/shared/utils/jest/E2eSsrEnv.ts +1 -0
|
@@ -6,6 +6,8 @@ type PropsT = {
|
|
|
6
6
|
disabled?: boolean;
|
|
7
7
|
enforceA?: boolean;
|
|
8
8
|
onClick?: MouseEventHandler & KeyboardEventHandler;
|
|
9
|
+
onKeyDown?: KeyboardEventHandler;
|
|
10
|
+
onKeyUp?: KeyboardEventHandler;
|
|
9
11
|
onMouseDown?: MouseEventHandler;
|
|
10
12
|
onMouseUp?: MouseEventHandler;
|
|
11
13
|
onPointerDown?: PointerEventHandler;
|
package/config/babel/webpack.js
CHANGED
|
@@ -36,8 +36,7 @@ function newBaseConfig(options) {
|
|
|
36
36
|
['@babel/env', {
|
|
37
37
|
// Leaves it to the Webpack to deal with modules.
|
|
38
38
|
modules: (_a = options.modules) !== null && _a !== void 0 ? _a : false,
|
|
39
|
-
|
|
40
|
-
targets: (_b = options.targets) !== null && _b !== void 0 ? _b : 'defaults or chrome >= 69',
|
|
39
|
+
targets: (_b = options.targets) !== null && _b !== void 0 ? _b : 'defaults',
|
|
41
40
|
}],
|
|
42
41
|
// TODO: Starting from Babel 8, "automatic" will be the default runtime,
|
|
43
42
|
// thus once upgraded to Babel 8, runtime should be removed from
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.43.
|
|
2
|
+
"version": "1.43.32",
|
|
3
3
|
"bin": {
|
|
4
4
|
"react-utils-build": "bin/build.js",
|
|
5
5
|
"react-utils-setup": "bin/setup.js"
|
|
@@ -27,14 +27,14 @@
|
|
|
27
27
|
"express": "^5.1.0",
|
|
28
28
|
"helmet": "^8.1.0",
|
|
29
29
|
"http-status-codes": "^2.3.0",
|
|
30
|
-
"joi": "^
|
|
30
|
+
"joi": "^18.0.0",
|
|
31
31
|
"lodash": "^4.17.21",
|
|
32
32
|
"morgan": "^1.10.1",
|
|
33
33
|
"node-forge": "^1.3.1",
|
|
34
34
|
"qs": "^6.14.0",
|
|
35
35
|
"raf": "^3.4.1",
|
|
36
|
-
"react": "^19.1.
|
|
37
|
-
"react-dom": "^19.1.
|
|
36
|
+
"react": "^19.1.1",
|
|
37
|
+
"react-dom": "^19.1.1",
|
|
38
38
|
"react-router": "^7.7.1",
|
|
39
39
|
"request-ip": "^3.3.0",
|
|
40
40
|
"rimraf": "^6.0.0",
|
|
@@ -56,9 +56,9 @@
|
|
|
56
56
|
"@babel/register": "^7.27.1",
|
|
57
57
|
"@dr.pogodin/babel-plugin-transform-assets": "^1.2.5",
|
|
58
58
|
"@dr.pogodin/babel-preset-svgr": "^1.9.2",
|
|
59
|
-
"@dr.pogodin/eslint-configs": "^0.0.
|
|
59
|
+
"@dr.pogodin/eslint-configs": "^0.0.11",
|
|
60
60
|
"@pmmmwh/react-refresh-webpack-plugin": "^0.6.1",
|
|
61
|
-
"@testing-library/dom": "^10.4.
|
|
61
|
+
"@testing-library/dom": "^10.4.1",
|
|
62
62
|
"@testing-library/react": "^16.3.0",
|
|
63
63
|
"@testing-library/user-event": "^14.6.1",
|
|
64
64
|
"@tsconfig/recommended": "^1.0.10",
|
|
@@ -72,8 +72,8 @@
|
|
|
72
72
|
"@types/morgan": "^1.9.10",
|
|
73
73
|
"@types/node-forge": "^1.3.13",
|
|
74
74
|
"@types/pretty": "^2.0.3",
|
|
75
|
-
"@types/react": "^19.1.
|
|
76
|
-
"@types/react-dom": "^19.1.
|
|
75
|
+
"@types/react": "^19.1.9",
|
|
76
|
+
"@types/react-dom": "^19.1.7",
|
|
77
77
|
"@types/request-ip": "^0.0.41",
|
|
78
78
|
"@types/serialize-javascript": "^5.0.4",
|
|
79
79
|
"@types/serve-favicon": "^2.5.7",
|
|
@@ -84,14 +84,14 @@
|
|
|
84
84
|
"babel-jest": "^30.0.5",
|
|
85
85
|
"babel-loader": "^10.0.0",
|
|
86
86
|
"babel-plugin-module-resolver": "^5.0.2",
|
|
87
|
-
"core-js": "^3.
|
|
87
|
+
"core-js": "^3.45.0",
|
|
88
88
|
"css-loader": "^7.1.2",
|
|
89
89
|
"css-minimizer-webpack-plugin": "^7.0.2",
|
|
90
90
|
"identity-obj-proxy": "^3.0.0",
|
|
91
91
|
"jest": "^30.0.5",
|
|
92
92
|
"jest-environment-jsdom": "^30.0.5",
|
|
93
|
-
"memfs": "^4.
|
|
94
|
-
"mini-css-extract-plugin": "^2.9.
|
|
93
|
+
"memfs": "^4.36.0",
|
|
94
|
+
"mini-css-extract-plugin": "^2.9.3",
|
|
95
95
|
"mockdate": "^3.0.5",
|
|
96
96
|
"nodelist-foreach-polyfill": "^1.2.0",
|
|
97
97
|
"postcss": "^8.5.6",
|
|
@@ -101,18 +101,18 @@
|
|
|
101
101
|
"react-refresh": "^0.17.0",
|
|
102
102
|
"regenerator-runtime": "^0.14.1",
|
|
103
103
|
"resolve-url-loader": "^5.0.0",
|
|
104
|
-
"sass": "^1.
|
|
104
|
+
"sass": "^1.90.0",
|
|
105
105
|
"sass-loader": "^16.0.5",
|
|
106
106
|
"sitemap": "^8.0.0",
|
|
107
107
|
"source-map-loader": "^5.0.0",
|
|
108
|
-
"stylelint": "^16.
|
|
108
|
+
"stylelint": "^16.23.0",
|
|
109
109
|
"stylelint-config-standard-scss": "^15.0.1",
|
|
110
110
|
"supertest": "^7.1.4",
|
|
111
111
|
"tsc-alias": "1.8.16",
|
|
112
112
|
"tstyche": "^4.3.0",
|
|
113
113
|
"typed-scss-modules": "^8.1.1",
|
|
114
|
-
"typescript": "^5.
|
|
115
|
-
"webpack": "^5.
|
|
114
|
+
"typescript": "^5.9.2",
|
|
115
|
+
"webpack": "^5.101.0",
|
|
116
116
|
"webpack-dev-middleware": "^7.4.2",
|
|
117
117
|
"webpack-hot-middleware": "^2.26.1",
|
|
118
118
|
"webpack-merge": "^6.0.1",
|
package/src/server/renderer.tsx
CHANGED
|
@@ -338,7 +338,7 @@ export default function factory(
|
|
|
338
338
|
? `<link rel="manifest" href="${publicPath as string}manifest.json">` : '';
|
|
339
339
|
|
|
340
340
|
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions
|
|
341
|
-
interface BufferWithNonce extends
|
|
341
|
+
interface BufferWithNonce extends ArrayBuffer {
|
|
342
342
|
nonce: string;
|
|
343
343
|
}
|
|
344
344
|
|
|
@@ -626,9 +626,9 @@ export default function factory(
|
|
|
626
626
|
// but it greately simplifies testing, and error reporting.
|
|
627
627
|
await new Promise<void>((done, failed) => {
|
|
628
628
|
brotliCompress(html, (error, buffer) => {
|
|
629
|
-
const b = buffer as BufferWithNonce;
|
|
630
629
|
if (error) failed(error);
|
|
631
630
|
else {
|
|
631
|
+
const b = buffer as unknown as BufferWithNonce;
|
|
632
632
|
b.nonce = (req as unknown as {
|
|
633
633
|
nonce: string;
|
|
634
634
|
}).nonce;
|
|
@@ -20,6 +20,8 @@ type PropsT = {
|
|
|
20
20
|
disabled?: boolean;
|
|
21
21
|
enforceA?: boolean;
|
|
22
22
|
onClick?: MouseEventHandler & KeyboardEventHandler;
|
|
23
|
+
onKeyDown?: KeyboardEventHandler;
|
|
24
|
+
onKeyUp?: KeyboardEventHandler;
|
|
23
25
|
onMouseDown?: MouseEventHandler;
|
|
24
26
|
onMouseUp?: MouseEventHandler;
|
|
25
27
|
onPointerDown?: PointerEventHandler;
|
|
@@ -38,6 +40,8 @@ export const BaseButton: FunctionComponent<PropsT> = ({
|
|
|
38
40
|
disabled,
|
|
39
41
|
enforceA,
|
|
40
42
|
onClick,
|
|
43
|
+
onKeyDown: onKeyDownProp,
|
|
44
|
+
onKeyUp,
|
|
41
45
|
onMouseDown,
|
|
42
46
|
onMouseUp,
|
|
43
47
|
onPointerDown,
|
|
@@ -61,6 +65,14 @@ export const BaseButton: FunctionComponent<PropsT> = ({
|
|
|
61
65
|
</div>
|
|
62
66
|
);
|
|
63
67
|
}
|
|
68
|
+
|
|
69
|
+
let onKeyDown = onKeyDownProp;
|
|
70
|
+
if (!onKeyDown && onClick) {
|
|
71
|
+
onKeyDown = (e) => {
|
|
72
|
+
if (e.key === 'Enter') onClick(e);
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
|
|
64
76
|
if (to) {
|
|
65
77
|
return (
|
|
66
78
|
<Link
|
|
@@ -68,6 +80,14 @@ export const BaseButton: FunctionComponent<PropsT> = ({
|
|
|
68
80
|
data-testid={process.env.NODE_ENV === 'production' ? undefined : testId}
|
|
69
81
|
enforceA={enforceA}
|
|
70
82
|
onClick={onClick}
|
|
83
|
+
|
|
84
|
+
// TODO: For now, the `onKeyDown` handler is not passed to the <Link>,
|
|
85
|
+
// as <Link> component does not call it anyway, presumably due to
|
|
86
|
+
// the inner implementation details. We should look into supporting it:
|
|
87
|
+
// https://github.com/birdofpreyru/react-utils/issues/444
|
|
88
|
+
// onKeyDown={onKeyDown}
|
|
89
|
+
|
|
90
|
+
onKeyUp={onKeyUp}
|
|
71
91
|
onMouseDown={onMouseDown}
|
|
72
92
|
onMouseUp={onMouseUp}
|
|
73
93
|
onPointerDown={onPointerDown}
|
|
@@ -86,9 +106,8 @@ export const BaseButton: FunctionComponent<PropsT> = ({
|
|
|
86
106
|
className={className}
|
|
87
107
|
data-testid={process.env.NODE_ENV === 'production' ? undefined : testId}
|
|
88
108
|
onClick={onClick}
|
|
89
|
-
onKeyDown={
|
|
90
|
-
|
|
91
|
-
} : undefined}
|
|
109
|
+
onKeyDown={onKeyDown}
|
|
110
|
+
onKeyUp={onKeyUp}
|
|
92
111
|
onMouseDown={onMouseDown}
|
|
93
112
|
onMouseUp={onMouseUp}
|
|
94
113
|
onPointerDown={onPointerDown}
|
|
@@ -96,6 +96,7 @@ export default class E2eSsrEnv extends JsdomEnv {
|
|
|
96
96
|
|
|
97
97
|
if (!this.global.webpackConfig) throw Error('Failed to load Webpack config');
|
|
98
98
|
const compiler = webpack(this.global.webpackConfig);
|
|
99
|
+
if (!compiler) throw Error('Failed to construct Webpack compiler');
|
|
99
100
|
|
|
100
101
|
// TODO: The "as typeof compiler.outputFileSystem" piece below is
|
|
101
102
|
// a workaround for the Webpack regression:
|