@dr.pogodin/react-utils 1.39.0 → 1.39.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/build/development/shared/components/Button/index.js +3 -3
  2. package/build/development/shared/components/Button/index.js.map +1 -1
  3. package/build/development/shared/components/Input/index.js +1 -1
  4. package/build/development/shared/components/Input/index.js.map +1 -1
  5. package/build/development/shared/components/Modal/index.js +1 -1
  6. package/build/development/shared/components/Modal/index.js.map +1 -1
  7. package/build/development/shared/components/selectors/NativeDropdown/index.js +1 -1
  8. package/build/development/shared/components/selectors/NativeDropdown/index.js.map +1 -1
  9. package/build/development/shared/components/selectors/common.js.map +1 -1
  10. package/build/development/shared/utils/jest/index.js +11 -5
  11. package/build/development/shared/utils/jest/index.js.map +1 -1
  12. package/build/development/style.css +17 -17
  13. package/build/development/web.bundle.js +14 -14
  14. package/build/production/shared/components/Button/index.js +1 -1
  15. package/build/production/shared/components/Button/index.js.map +1 -1
  16. package/build/production/shared/components/Input/index.js +1 -1
  17. package/build/production/shared/components/Input/index.js.map +1 -1
  18. package/build/production/shared/components/Modal/index.js +1 -1
  19. package/build/production/shared/components/Modal/index.js.map +1 -1
  20. package/build/production/shared/components/selectors/NativeDropdown/index.js +1 -1
  21. package/build/production/shared/components/selectors/NativeDropdown/index.js.map +1 -1
  22. package/build/production/shared/components/selectors/common.js.map +1 -1
  23. package/build/production/shared/utils/jest/index.js +1 -1
  24. package/build/production/shared/utils/jest/index.js.map +1 -1
  25. package/build/production/style.css.map +1 -1
  26. package/build/production/web.bundle.js +1 -1
  27. package/build/production/web.bundle.js.map +1 -1
  28. package/build/types-code/shared/components/selectors/common.d.ts +1 -1
  29. package/config/webpack/app-base.js +5 -0
  30. package/config/webpack/lib-base.js +5 -0
  31. package/package.json +20 -19
  32. package/src/shared/components/Button/index.tsx +6 -3
  33. package/src/shared/components/Input/index.tsx +1 -1
  34. package/src/shared/components/Modal/base-theme.scss +2 -2
  35. package/src/shared/components/Modal/index.tsx +1 -1
  36. package/src/shared/components/selectors/NativeDropdown/index.tsx +1 -1
  37. package/src/shared/components/selectors/common.ts +1 -1
  38. package/src/shared/utils/jest/index.tsx +18 -8
  39. package/src/styles/mixins.scss +3 -1
@@ -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?: Readonly<OptionsT<NameT>>;
13
+ options: Readonly<OptionsT<NameT>>;
14
14
  testId?: string;
15
15
  theme: Theme<ThemeKeyT>;
16
16
  value?: ValueT;
@@ -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.0",
2
+ "version": "1.39.1",
3
3
  "bin": {
4
4
  "react-utils-build": "bin/build.js",
5
5
  "react-utils-setup": "bin/setup.js"
@@ -8,7 +8,7 @@
8
8
  "url": "https://github.com/birdofpreyru/react-utils/issues"
9
9
  },
10
10
  "dependencies": {
11
- "@babel/runtime": "^7.24.7",
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",
@@ -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.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.24.1",
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.0"
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.7",
50
- "@babel/core": "^7.24.7",
51
- "@babel/eslint-parser": "^7.24.7",
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.7",
53
+ "@babel/node": "^7.24.8",
54
54
  "@babel/plugin-transform-runtime": "^7.24.7",
55
- "@babel/preset-env": "^7.24.7",
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.1",
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.6",
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.34.3",
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.7",
116
+ "sass": "^1.77.8",
117
117
  "sass-loader": "^14.2.1",
118
118
  "sitemap": "^8.0.0",
119
- "stylelint": "^16.6.1",
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.0.0",
124
+ "tstyche": "^2.1.0",
124
125
  "typed-scss-modules": "^8.0.1",
125
126
  "typescript": "^5.5.3",
126
- "typescript-eslint": "^7.16.0",
127
- "webpack": "^5.92.1",
128
- "webpack-dev-middleware": "^7.2.1",
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 className={className} data-testid={testId}>
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: 998;
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: 999;
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?: Readonly<OptionsT<NameT>>;
40
+ options: Readonly<OptionsT<NameT>>;
41
41
  testId?: string;
42
42
  theme: Theme<ThemeKeyT>;
43
43
  value?: ValueT;
@@ -81,14 +81,24 @@ export function mockAxios(handlers: AxiosRequestHandlerT[]) {
81
81
  }
82
82
 
83
83
  // Fallback to the regular network request.
84
- const res = await axios({ ...config, adapter: ['xhr', 'http', 'fetch'] });
85
-
86
- console.warn(
87
- 'Network request has not been mocked for a test.\n\nConfig:\n',
88
- config,
89
- '\n\nResult:\n',
90
- JSON.stringify(res, null, 2),
91
- );
84
+ let res: AxiosResponse;
85
+ try {
86
+ res = await axios({ ...config, adapter: ['xhr', 'http', 'fetch'] });
87
+ console.warn(
88
+ 'Network request has not been mocked for a test.\n\nConfig:\n',
89
+ config,
90
+ '\n\nResult:\n',
91
+ JSON.stringify(res, null, 2),
92
+ );
93
+ } catch (e) {
94
+ console.warn(
95
+ 'Network request has not been mocked for a test, and failed.\n\nConfig:\n',
96
+ config,
97
+ '\n\nError\n',
98
+ JSON.stringify(e, null, 2),
99
+ );
100
+ throw e;
101
+ }
92
102
 
93
103
  return res;
94
104
  };
@@ -1,4 +1,6 @@
1
1
  /* Collection of standard mixins, being used all around. */
2
2
  @import "_mixins/fonts";
3
3
  @import "_mixins/media";
4
- @import "_mixins/typography"
4
+ @import "_mixins/typography";
5
+
6
+ $zIndexOfDefaultModalOverlay: 998;