@dr.pogodin/react-utils 1.35.0 → 1.35.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.
Files changed (55) hide show
  1. package/build/development/client/getInj.js.map +1 -1
  2. package/build/development/index.js.map +1 -1
  3. package/build/development/server/index.js.map +1 -1
  4. package/build/development/server/renderer.js.map +1 -1
  5. package/build/development/server/server.js.map +1 -1
  6. package/build/development/shared/components/Button/index.js +2 -1
  7. package/build/development/shared/components/Button/index.js.map +1 -1
  8. package/build/development/shared/components/MetaTags.js.map +1 -1
  9. package/build/development/shared/components/TextArea/index.js.map +1 -1
  10. package/build/development/shared/components/WithTooltip/Tooltip.js.map +1 -1
  11. package/build/development/shared/components/YouTubeVideo/index.js.map +1 -1
  12. package/build/development/shared/components/index.js +8 -1
  13. package/build/development/shared/components/index.js.map +1 -1
  14. package/build/development/shared/components/selectors/CustomDropdown/index.js.map +1 -1
  15. package/build/development/shared/components/selectors/Switch/index.js.map +1 -1
  16. package/build/development/shared/utils/index.js.map +1 -1
  17. package/build/development/shared/utils/jest/E2eSsrEnv.js.map +1 -1
  18. package/build/development/shared/utils/jest/index.js +7 -2
  19. package/build/development/shared/utils/jest/index.js.map +1 -1
  20. package/build/development/shared/utils/splitComponent.js.map +1 -1
  21. package/build/development/web.bundle.js +3 -3
  22. package/build/production/client/getInj.js.map +1 -1
  23. package/build/production/index.js.map +1 -1
  24. package/build/production/server/index.js.map +1 -1
  25. package/build/production/server/renderer.js.map +1 -1
  26. package/build/production/server/server.js.map +1 -1
  27. package/build/production/shared/components/Button/index.js +2 -2
  28. package/build/production/shared/components/Button/index.js.map +1 -1
  29. package/build/production/shared/components/MetaTags.js.map +1 -1
  30. package/build/production/shared/components/TextArea/index.js.map +1 -1
  31. package/build/production/shared/components/WithTooltip/Tooltip.js.map +1 -1
  32. package/build/production/shared/components/YouTubeVideo/index.js.map +1 -1
  33. package/build/production/shared/components/index.js +1 -1
  34. package/build/production/shared/components/index.js.map +1 -1
  35. package/build/production/shared/components/selectors/CustomDropdown/index.js.map +1 -1
  36. package/build/production/shared/components/selectors/Switch/index.js.map +1 -1
  37. package/build/production/shared/utils/index.js.map +1 -1
  38. package/build/production/shared/utils/jest/E2eSsrEnv.js.map +1 -1
  39. package/build/production/shared/utils/jest/index.js +1 -1
  40. package/build/production/shared/utils/jest/index.js.map +1 -1
  41. package/build/production/shared/utils/splitComponent.js.map +1 -1
  42. package/build/production/web.bundle.js +1 -1
  43. package/build/production/web.bundle.js.map +1 -1
  44. package/build/types-code/index.d.ts +1 -1
  45. package/build/types-code/shared/components/Button/index.d.ts +1 -0
  46. package/build/types-code/shared/components/index.d.ts +1 -1
  47. package/build/types-code/shared/utils/index.d.ts +1 -1
  48. package/build/types-code/shared/utils/jest/index.d.ts +2 -1
  49. package/package.json +32 -33
  50. package/src/index.ts +1 -0
  51. package/src/shared/components/Button/index.tsx +1 -1
  52. package/src/shared/components/index.ts +1 -1
  53. package/src/shared/utils/index.ts +1 -0
  54. package/src/shared/utils/jest/index.tsx +9 -3
  55. package/tsconfig.types.json +1 -3
@@ -6,5 +6,5 @@ export { default as api } from 'axios';
6
6
  export * as PT from 'prop-types';
7
7
  export { type AsyncCollectionLoaderT, type AsyncDataEnvelopeT, type AsyncDataLoaderT, type ForceT, type UseAsyncDataOptionsT, type UseAsyncDataResT, type UseGlobalStateResT, type ValueOrInitializerT, getGlobalState, GlobalStateProvider, newAsyncDataEnvelope, useAsyncCollection, useAsyncData, useGlobalState, withGlobalStateType, } from '@dr.pogodin/react-global-state';
8
8
  export * from './shared/components';
9
- export { type Theme, config, Barrier, Emitter, isomorphy, getSsrContext, Semaphore, splitComponent, themed, ThemeProvider, time, webpack, withRetries, } from './shared/utils';
9
+ export { type Listener, type Theme, config, Barrier, Emitter, isomorphy, getSsrContext, Semaphore, splitComponent, themed, ThemeProvider, time, webpack, withRetries, } from './shared/utils';
10
10
  export { client, server };
@@ -13,6 +13,7 @@ type PropsT = {
13
13
  theme: Theme<typeof validThemeKeys>;
14
14
  to?: object | string;
15
15
  };
16
+ export declare const BaseButton: React.FunctionComponent<PropsT>;
16
17
  /**
17
18
  * Button component theme: a map of CSS
18
19
  * class names to append to button elements:
@@ -2,7 +2,7 @@
2
2
  * Just an aggregation of all exported components into a single module.
3
3
  */
4
4
  export * from './selectors';
5
- export { default as Button } from './Button';
5
+ export { default as Button, BaseButton } from './Button';
6
6
  export { default as Checkbox } from './Checkbox';
7
7
  export { default as Input } from './Input';
8
8
  export { default as Link } from './Link';
@@ -3,7 +3,7 @@ import config from './config';
3
3
  import * as isomorphy from './isomorphy';
4
4
  import time from './time';
5
5
  import * as webpack from './webpack';
6
- export { Barrier, Emitter, Semaphore, withRetries, } from '@dr.pogodin/js-utils';
6
+ export { type Listener, Barrier, Emitter, Semaphore, withRetries, } from '@dr.pogodin/js-utils';
7
7
  export { getSsrContext } from './globalState';
8
8
  export { default as splitComponent } from './splitComponent';
9
9
  type ThemedT = typeof themedImpl & {
@@ -1,4 +1,5 @@
1
1
  import { type ReactNode, act } from 'react';
2
+ import { type RenderResult } from '@testing-library/react';
2
3
  /**
3
4
  * An alias for [act(..)](https://reactjs.org/docs/test-utils.html#act)
4
5
  * from `react`.
@@ -41,4 +42,4 @@ export type MountedSceneT = HTMLElement & {
41
42
  * attached.
42
43
  */
43
44
  export declare function mount(scene: ReactNode): MountedSceneT;
44
- export declare function snapshot(element: React.ReactElement): ChildNode | null;
45
+ export declare function snapshot(element: React.ReactElement): RenderResult;
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.35.0",
2
+ "version": "1.35.2",
3
3
  "bin": {
4
4
  "react-utils-build": "bin/build.js",
5
5
  "react-utils-setup": "bin/setup.js"
@@ -8,15 +8,15 @@
8
8
  "url": "https://github.com/birdofpreyru/react-utils/issues"
9
9
  },
10
10
  "dependencies": {
11
- "@babel/runtime": "^7.24.5",
11
+ "@babel/runtime": "^7.24.6",
12
12
  "@dr.pogodin/babel-plugin-react-css-modules": "^6.13.1",
13
13
  "@dr.pogodin/csurf": "^1.13.0",
14
- "@dr.pogodin/js-utils": "^0.0.9",
15
- "@dr.pogodin/react-global-state": "^0.14.1",
16
- "@dr.pogodin/react-themes": "^1.6.1",
14
+ "@dr.pogodin/js-utils": "^0.0.12",
15
+ "@dr.pogodin/react-global-state": "^0.14.2",
16
+ "@dr.pogodin/react-themes": "^1.6.2",
17
17
  "@jest/environment": "^29.7.0",
18
- "axios": "^1.6.8",
19
- "commander": "^12.0.0",
18
+ "axios": "^1.7.2",
19
+ "commander": "^12.1.0",
20
20
  "compression": "^1.7.4",
21
21
  "config": "^3.3.11",
22
22
  "cookie": "^0.6.0",
@@ -36,9 +36,9 @@
36
36
  "react": "^18.3.1",
37
37
  "react-dom": "^18.3.1",
38
38
  "react-helmet": "^6.1.0",
39
- "react-router-dom": "^6.23.0",
39
+ "react-router-dom": "^6.23.1",
40
40
  "request-ip": "^3.3.0",
41
- "rimraf": "^5.0.5",
41
+ "rimraf": "^5.0.7",
42
42
  "serialize-javascript": "^6.0.2",
43
43
  "serve-favicon": "^2.5.0",
44
44
  "source-map-support": "^0.5.21",
@@ -47,24 +47,23 @@
47
47
  },
48
48
  "description": "Collection of generic ReactJS components and utils",
49
49
  "devDependencies": {
50
- "@babel/cli": "^7.24.5",
51
- "@babel/core": "^7.24.5",
52
- "@babel/eslint-parser": "^7.24.5",
53
- "@babel/eslint-plugin": "^7.24.5",
54
- "@babel/node": "^7.23.9",
55
- "@babel/plugin-transform-runtime": "^7.24.3",
56
- "@babel/preset-env": "^7.24.5",
57
- "@babel/preset-react": "^7.24.1",
58
- "@babel/preset-typescript": "^7.24.1",
59
- "@babel/register": "^7.23.7",
50
+ "@babel/cli": "^7.24.6",
51
+ "@babel/core": "^7.24.6",
52
+ "@babel/eslint-parser": "^7.24.6",
53
+ "@babel/eslint-plugin": "^7.24.6",
54
+ "@babel/node": "^7.24.6",
55
+ "@babel/plugin-transform-runtime": "^7.24.6",
56
+ "@babel/preset-env": "^7.24.6",
57
+ "@babel/preset-react": "^7.24.6",
58
+ "@babel/preset-typescript": "^7.24.6",
59
+ "@babel/register": "^7.24.6",
60
60
  "@dr.pogodin/babel-plugin-transform-assets": "^1.2.2",
61
61
  "@dr.pogodin/babel-preset-svgr": "^1.8.0",
62
- "@pmmmwh/react-refresh-webpack-plugin": "^0.5.13",
62
+ "@pmmmwh/react-refresh-webpack-plugin": "^0.5.15",
63
63
  "@testing-library/dom": "^10.1.0",
64
- "@testing-library/react": "^15.0.6",
64
+ "@testing-library/react": "^16.0.0",
65
65
  "@testing-library/user-event": "^14.5.2",
66
66
  "@tsconfig/recommended": "^1.0.6",
67
- "@tsd/typescript": "^5.4.5",
68
67
  "@types/compression": "^1.7.5",
69
68
  "@types/config": "^3.3.4",
70
69
  "@types/cookie": "^0.6.0",
@@ -72,11 +71,11 @@
72
71
  "@types/csurf": "^1.11.5",
73
72
  "@types/express": "^4.17.21",
74
73
  "@types/jest": "^29.5.12",
75
- "@types/lodash": "^4.17.1",
74
+ "@types/lodash": "^4.17.4",
76
75
  "@types/morgan": "^1.9.9",
77
76
  "@types/node-forge": "^1.3.11",
78
77
  "@types/pretty": "^2.0.3",
79
- "@types/react": "^18.3.1",
78
+ "@types/react": "^18.3.3",
80
79
  "@types/react-dom": "^18.3.0",
81
80
  "@types/react-helmet": "^6.1.11",
82
81
  "@types/request-ip": "^0.0.41",
@@ -89,9 +88,9 @@
89
88
  "babel-jest": "^29.7.0",
90
89
  "babel-loader": "^9.1.3",
91
90
  "babel-plugin-module-resolver": "^5.0.2",
92
- "core-js": "^3.37.0",
93
- "css-loader": "^7.1.1",
94
- "css-minimizer-webpack-plugin": "^6.0.0",
91
+ "core-js": "^3.37.1",
92
+ "css-loader": "^7.1.2",
93
+ "css-minimizer-webpack-plugin": "^7.0.0",
95
94
  "eslint": "^8.57.0",
96
95
  "eslint-config-airbnb": "^19.0.4",
97
96
  "eslint-config-airbnb-typescript": "^18.0.0",
@@ -99,7 +98,7 @@
99
98
  "eslint-plugin-import": "^2.29.1",
100
99
  "eslint-plugin-jest": "^28.5.0",
101
100
  "eslint-plugin-jsx-a11y": "^6.8.0",
102
- "eslint-plugin-react": "^7.34.1",
101
+ "eslint-plugin-react": "^7.34.2",
103
102
  "eslint-plugin-react-hooks": "^4.6.2",
104
103
  "identity-obj-proxy": "^3.0.0",
105
104
  "jest": "^29.7.0",
@@ -115,16 +114,16 @@
115
114
  "react-refresh": "^0.14.2",
116
115
  "regenerator-runtime": "^0.14.1",
117
116
  "resolve-url-loader": "^5.0.0",
118
- "sass": "^1.76.0",
117
+ "sass": "^1.77.4",
119
118
  "sass-loader": "^14.2.1",
120
- "sitemap": "^7.1.1",
121
- "stylelint": "^16.5.0",
119
+ "sitemap": "^8.0.0",
120
+ "stylelint": "^16.6.1",
122
121
  "stylelint-config-standard-scss": "^13.1.0",
123
122
  "supertest": "^7.0.0",
124
- "tsc-alias": "^1.8.8",
123
+ "tsc-alias": "^1.8.10",
125
124
  "typed-scss-modules": "^8.0.1",
126
125
  "typescript": "^5.4.5",
127
- "typescript-eslint": "^7.8.0",
126
+ "typescript-eslint": "^7.12.0",
128
127
  "webpack": "^5.91.0",
129
128
  "webpack-dev-middleware": "^7.2.1",
130
129
  "webpack-hot-middleware": "^2.26.1",
package/src/index.ts CHANGED
@@ -32,6 +32,7 @@ export {
32
32
  export * from 'components';
33
33
 
34
34
  export {
35
+ type Listener,
35
36
  type Theme,
36
37
  config,
37
38
  Barrier,
@@ -26,7 +26,7 @@ type PropsT = {
26
26
  };
27
27
 
28
28
  /* eslint-disable react/function-component-definition */
29
- const BaseButton: React.FunctionComponent<PropsT> = ({
29
+ export const BaseButton: React.FunctionComponent<PropsT> = ({
30
30
  active,
31
31
  children,
32
32
  disabled,
@@ -4,7 +4,7 @@
4
4
 
5
5
  export * from 'components/selectors';
6
6
 
7
- export { default as Button } from 'components/Button';
7
+ export { default as Button, BaseButton } from 'components/Button';
8
8
  export { default as Checkbox } from 'components/Checkbox';
9
9
  export { default as Input } from 'components/Input';
10
10
  export { default as Link } from 'components/Link';
@@ -11,6 +11,7 @@ import time from './time';
11
11
  import * as webpack from './webpack';
12
12
 
13
13
  export {
14
+ type Listener,
14
15
  Barrier,
15
16
  Emitter,
16
17
  Semaphore,
@@ -5,7 +5,7 @@ import mockdate from 'mockdate';
5
5
  import { type ReactNode, act } from 'react';
6
6
  import { type Root, createRoot } from 'react-dom/client';
7
7
 
8
- import { render } from '@testing-library/react';
8
+ import { type RenderResult, render } from '@testing-library/react';
9
9
 
10
10
  /**
11
11
  * An alias for [act(..)](https://reactjs.org/docs/test-utils.html#act)
@@ -101,7 +101,13 @@ export function mount(scene: ReactNode): MountedSceneT {
101
101
  }
102
102
 
103
103
  export function snapshot(element: React.ReactElement) {
104
- const res = render(element).asFragment().firstChild;
105
- expect(res).toMatchSnapshot();
104
+ let res: RenderResult | undefined;
105
+ act(() => {
106
+ res = render(element);
107
+ });
108
+ if (res === undefined) throw Error('Render failed');
109
+
110
+ const nodes = res.asFragment().childNodes;
111
+ expect(nodes.length > 1 ? [...nodes] : nodes[0]).toMatchSnapshot();
106
112
  return res;
107
113
  }
@@ -1,9 +1,7 @@
1
1
  // TS config for ESLint, editor plugins, and other tools that look-up and use
2
2
  // the default tsconfig.json file.
3
3
  {
4
- // Note: Full relative paths, as some tools don't support Node module
5
- // resolution mechanics.
6
- "extends": "./node_modules/@tsconfig/recommended/tsconfig.json",
4
+ "extends": "@tsconfig/recommended",
7
5
 
8
6
  // Keep these in case any mocks / tests are declared within "src" code tree.
9
7
  "exclude": [