@dr.pogodin/react-utils 1.31.2 → 1.33.0

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 (40) hide show
  1. package/build/development/shared/components/selectors/CustomDropdown/Options/index.js +15 -2
  2. package/build/development/shared/components/selectors/CustomDropdown/Options/index.js.map +1 -1
  3. package/build/development/shared/components/selectors/CustomDropdown/index.js +3 -2
  4. package/build/development/shared/components/selectors/CustomDropdown/index.js.map +1 -1
  5. package/build/development/shared/components/selectors/index.js +13 -0
  6. package/build/development/shared/components/selectors/index.js.map +1 -1
  7. package/build/development/web.bundle.js +5 -5
  8. package/build/production/shared/components/selectors/CustomDropdown/Options/index.js +1 -1
  9. package/build/production/shared/components/selectors/CustomDropdown/Options/index.js.map +1 -1
  10. package/build/production/shared/components/selectors/CustomDropdown/index.js +2 -2
  11. package/build/production/shared/components/selectors/CustomDropdown/index.js.map +1 -1
  12. package/build/production/shared/components/selectors/index.js +1 -1
  13. package/build/production/shared/components/selectors/index.js.map +1 -1
  14. package/build/production/web.bundle.js +1 -1
  15. package/build/production/web.bundle.js.map +1 -1
  16. package/build/types-code/shared/components/selectors/index.d.ts +1 -0
  17. package/config/webpack/app-base.js +9 -0
  18. package/config/webpack/lib-base.js +9 -0
  19. package/package.json +19 -19
  20. package/src/shared/components/selectors/CustomDropdown/Options/index.tsx +18 -2
  21. package/src/shared/components/selectors/CustomDropdown/index.tsx +6 -2
  22. package/src/shared/components/selectors/index.ts +7 -0
  23. package/build/types-scss/__tests__/js/config/publicPath support/__assets__/style.scss.d.ts +0 -1
  24. package/build/types-scss/__tests__/js/config/stylename-generation/__assets__/MockPackageA/TestComponent/style.scss.d.ts +0 -1
  25. package/build/types-scss/__tests__/js/config/stylename-generation/__assets__/MockPackageB/TestComponent/style.scss.d.ts +0 -1
  26. package/build/types-scss/__tests__/js/config/stylename-generation/__assets__/style.scss.d.ts +0 -1
  27. package/build/types-scss/__tests__/js/shared/components/NavLink/styles.scss.d.ts +0 -1
  28. package/build/types-scss/__tests__/js/shared/utils/splitComponent/__assets__/SampleScene/ComponentA/style.scss.d.ts +0 -1
  29. package/build/types-scss/__tests__/js/shared/utils/splitComponent/__assets__/SampleScene/ComponentB/style.scss.d.ts +0 -1
  30. package/build/types-scss/__tests__/js/shared/utils/splitComponent/__assets__/SampleScene/ComponentC/style.scss.d.ts +0 -1
  31. package/build/types-scss/__tests__/js/shared/utils/splitComponent/__assets__/SampleScene/style.scss.d.ts +0 -1
  32. package/build/types-scss/__tests__/ts/config/publicPath support/__assets__/style.scss.d.ts +0 -1
  33. package/build/types-scss/__tests__/ts/config/stylename-generation/__assets__/MockPackageA/TestComponent/style.scss.d.ts +0 -1
  34. package/build/types-scss/__tests__/ts/config/stylename-generation/__assets__/MockPackageB/TestComponent/style.scss.d.ts +0 -1
  35. package/build/types-scss/__tests__/ts/config/stylename-generation/__assets__/style.scss.d.ts +0 -1
  36. package/build/types-scss/__tests__/ts/shared/components/NavLink/styles.scss.d.ts +0 -1
  37. package/build/types-scss/__tests__/ts/shared/utils/splitComponent/__assets__/SampleScene/ComponentA/style.scss.d.ts +0 -1
  38. package/build/types-scss/__tests__/ts/shared/utils/splitComponent/__assets__/SampleScene/ComponentB/style.scss.d.ts +0 -1
  39. package/build/types-scss/__tests__/ts/shared/utils/splitComponent/__assets__/SampleScene/ComponentC/style.scss.d.ts +0 -1
  40. package/build/types-scss/__tests__/ts/shared/utils/splitComponent/__assets__/SampleScene/style.scss.d.ts +0 -1
@@ -1,3 +1,4 @@
1
1
  export { default as CustomDropdown } from './CustomDropdown';
2
2
  export { default as Dropdown } from './NativeDropdown';
3
3
  export { default as Switch } from './Switch';
4
+ export { type OptionT, type OptionsT, optionValidator, optionsValidator, } from './common';
@@ -282,6 +282,15 @@ function configFactory(ops) {
282
282
  modules: {
283
283
  getLocalIdent: utils_1.getLocalIdent,
284
284
  localIdentName: o.cssLocalIdent,
285
+ // TODO: This flag defaults `true` for ES module builds since
286
+ // css-loader@7.0.0:
287
+ // https://github.com/webpack-contrib/css-loader/releases/tag/v7.0.0
288
+ // For now we'll keep it `false` to avoid a breaking change for
289
+ // host projects, and also because babel-plugin-react-css-modules
290
+ // we rely upon is pending an upgrade to support named style
291
+ // imports:
292
+ // https://github.com/birdofpreyru/babel-plugin-react-css-modules/issues/44
293
+ namedExport: false,
285
294
  },
286
295
  },
287
296
  }, {
@@ -103,6 +103,15 @@ function configFactory(ops) {
103
103
  modules: {
104
104
  getLocalIdent: utils_1.getLocalIdent,
105
105
  localIdentName: ops.cssLocalIdent,
106
+ // TODO: This flag defaults `true` for ES module builds since
107
+ // css-loader@7.0.0:
108
+ // https://github.com/webpack-contrib/css-loader/releases/tag/v7.0.0
109
+ // For now we'll keep it `false` to avoid a breaking change for
110
+ // host projects, and also because babel-plugin-react-css-modules
111
+ // we rely upon is pending an upgrade to support named style
112
+ // imports:
113
+ // https://github.com/birdofpreyru/babel-plugin-react-css-modules/issues/44
114
+ namedExport: false,
106
115
  },
107
116
  },
108
117
  }, {
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.31.2",
2
+ "version": "1.33.0",
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.1",
12
- "@dr.pogodin/babel-plugin-react-css-modules": "^6.12.0",
11
+ "@babel/runtime": "^7.24.4",
12
+ "@dr.pogodin/babel-plugin-react-css-modules": "^6.13.0",
13
13
  "@dr.pogodin/csurf": "^1.13.0",
14
14
  "@dr.pogodin/js-utils": "^0.0.9",
15
- "@dr.pogodin/react-global-state": "^0.13.0",
15
+ "@dr.pogodin/react-global-state": "^0.14.0",
16
16
  "@dr.pogodin/react-themes": "^1.6.0",
17
17
  "@jest/environment": "^29.7.0",
18
18
  "axios": "^1.6.8",
@@ -26,7 +26,7 @@
26
26
  "express": "^4.19.2",
27
27
  "helmet": "^7.1.0",
28
28
  "http-status-codes": "^2.3.0",
29
- "joi": "^17.12.2",
29
+ "joi": "^17.12.3",
30
30
  "lodash": "^4.17.21",
31
31
  "morgan": "^1.10.0",
32
32
  "node-forge": "^1.3.1",
@@ -48,20 +48,20 @@
48
48
  "description": "Collection of generic ReactJS components and utils",
49
49
  "devDependencies": {
50
50
  "@babel/cli": "^7.24.1",
51
- "@babel/core": "^7.24.3",
51
+ "@babel/core": "^7.24.4",
52
52
  "@babel/eslint-parser": "^7.24.1",
53
53
  "@babel/eslint-plugin": "^7.23.5",
54
54
  "@babel/node": "^7.23.9",
55
55
  "@babel/plugin-transform-runtime": "^7.24.3",
56
- "@babel/preset-env": "^7.24.3",
56
+ "@babel/preset-env": "^7.24.4",
57
57
  "@babel/preset-react": "^7.24.1",
58
58
  "@babel/preset-typescript": "^7.24.1",
59
59
  "@babel/register": "^7.23.7",
60
60
  "@dr.pogodin/babel-plugin-transform-assets": "^1.2.2",
61
61
  "@dr.pogodin/babel-preset-svgr": "^1.8.0",
62
62
  "@pmmmwh/react-refresh-webpack-plugin": "^0.5.11",
63
- "@tsconfig/recommended": "^1.0.4",
64
- "@tsd/typescript": "^5.4.3",
63
+ "@tsconfig/recommended": "^1.0.6",
64
+ "@tsd/typescript": "^5.4.4",
65
65
  "@types/compression": "^1.7.5",
66
66
  "@types/config": "^3.3.4",
67
67
  "@types/cookie": "^0.6.0",
@@ -73,8 +73,8 @@
73
73
  "@types/morgan": "^1.9.9",
74
74
  "@types/node-forge": "^1.3.11",
75
75
  "@types/pretty": "^2.0.3",
76
- "@types/react": "^18.2.72",
77
- "@types/react-dom": "^18.2.22",
76
+ "@types/react": "^18.2.74",
77
+ "@types/react-dom": "^18.2.24",
78
78
  "@types/react-helmet": "^6.1.11",
79
79
  "@types/react-test-renderer": "^18.0.7",
80
80
  "@types/request-ip": "^0.0.41",
@@ -88,21 +88,21 @@
88
88
  "babel-loader": "^9.1.3",
89
89
  "babel-plugin-module-resolver": "^5.0.0",
90
90
  "core-js": "^3.36.1",
91
- "css-loader": "^6.10.0",
91
+ "css-loader": "^7.0.0",
92
92
  "css-minimizer-webpack-plugin": "^6.0.0",
93
93
  "eslint": "^8.57.0",
94
94
  "eslint-config-airbnb": "^19.0.4",
95
95
  "eslint-config-airbnb-typescript": "^18.0.0",
96
96
  "eslint-import-resolver-babel-module": "^5.3.2",
97
97
  "eslint-plugin-import": "^2.29.1",
98
- "eslint-plugin-jest": "^27.9.0",
98
+ "eslint-plugin-jest": "^28.0.0",
99
99
  "eslint-plugin-jsx-a11y": "^6.8.0",
100
100
  "eslint-plugin-react": "^7.34.1",
101
101
  "eslint-plugin-react-hooks": "^4.6.0",
102
102
  "identity-obj-proxy": "^3.0.0",
103
103
  "jest": "^29.7.0",
104
104
  "jest-environment-jsdom": "^29.7.0",
105
- "memfs": "^4.8.0",
105
+ "memfs": "^4.8.1",
106
106
  "mini-css-extract-plugin": "^2.8.1",
107
107
  "mockdate": "^3.0.5",
108
108
  "nodelist-foreach-polyfill": "^1.2.0",
@@ -114,18 +114,18 @@
114
114
  "react-test-renderer": "^18.2.0",
115
115
  "regenerator-runtime": "^0.14.1",
116
116
  "resolve-url-loader": "^5.0.0",
117
- "sass": "^1.72.0",
117
+ "sass": "^1.74.1",
118
118
  "sass-loader": "^14.1.1",
119
119
  "sitemap": "^7.1.1",
120
120
  "stylelint": "^16.3.1",
121
- "stylelint-config-standard-scss": "^13.0.0",
121
+ "stylelint-config-standard-scss": "^13.1.0",
122
122
  "supertest": "^6.3.4",
123
123
  "tsc-alias": "^1.8.8",
124
124
  "typed-scss-modules": "^8.0.1",
125
- "typescript": "^5.4.3",
126
- "typescript-eslint": "^7.4.0",
125
+ "typescript": "^5.4.4",
126
+ "typescript-eslint": "^7.5.0",
127
127
  "webpack": "^5.91.0",
128
- "webpack-dev-middleware": "^7.1.1",
128
+ "webpack-dev-middleware": "^7.2.1",
129
129
  "webpack-hot-middleware": "^2.26.1",
130
130
  "webpack-merge": "^5.10.0",
131
131
  "workbox-core": "^7.0.0",
@@ -48,7 +48,19 @@ const Options = forwardRef<RefT, PropsT>(({
48
48
  const opsRef = useRef<HTMLDivElement>(null);
49
49
 
50
50
  useImperativeHandle(ref, () => ({
51
- measure: () => opsRef.current?.getBoundingClientRect(),
51
+ measure: () => {
52
+ const e = opsRef.current?.parentElement;
53
+ if (!e) return undefined;
54
+
55
+ const rect = opsRef.current?.getBoundingClientRect();
56
+ const style = window.getComputedStyle(e);
57
+ const mBottom = parseFloat(style.marginBottom);
58
+ const mTop = parseFloat(style.marginTop);
59
+
60
+ rect.height += mBottom + mTop;
61
+
62
+ return rect;
63
+ },
52
64
  }), []);
53
65
 
54
66
  const optionNodes: React.ReactNode[] = [];
@@ -59,10 +71,14 @@ const Options = forwardRef<RefT, PropsT>(({
59
71
  optionNodes.push(
60
72
  <div
61
73
  className={optionClass}
62
- onClick={() => onChange(iValue)}
74
+ onClick={(e) => {
75
+ onChange(iValue);
76
+ e.stopPropagation();
77
+ }}
63
78
  onKeyDown={(e) => {
64
79
  if (e.key === 'Enter') {
65
80
  onChange(iValue);
81
+ e.stopPropagation();
66
82
  }
67
83
  }}
68
84
  key={iValue}
@@ -70,7 +70,9 @@ PropsT<React.ReactNode, (value: string) => void>
70
70
  };
71
71
  }, [active]);
72
72
 
73
- const openList = () => {
73
+ const openList = (
74
+ e: React.KeyboardEvent<HTMLDivElement> | React.MouseEvent<HTMLDivElement>,
75
+ ) => {
74
76
  const view = window.visualViewport;
75
77
  const rect = dropdownRef.current!.getBoundingClientRect();
76
78
  setActive(true);
@@ -86,6 +88,8 @@ PropsT<React.ReactNode, (value: string) => void>
86
88
  top: view?.height || 0,
87
89
  width: rect.width,
88
90
  });
91
+
92
+ e.stopPropagation();
89
93
  };
90
94
 
91
95
  let selected: React.ReactNode = <>&zwnj;</>;
@@ -118,7 +122,7 @@ PropsT<React.ReactNode, (value: string) => void>
118
122
  className={theme.dropdown}
119
123
  onClick={openList}
120
124
  onKeyDown={(e) => {
121
- if (e.key === 'Enter') openList();
125
+ if (e.key === 'Enter') openList(e);
122
126
  }}
123
127
  ref={dropdownRef}
124
128
  role="listbox"
@@ -1,3 +1,10 @@
1
1
  export { default as CustomDropdown } from './CustomDropdown';
2
2
  export { default as Dropdown } from './NativeDropdown';
3
3
  export { default as Switch } from './Switch';
4
+
5
+ export {
6
+ type OptionT,
7
+ type OptionsT,
8
+ optionValidator,
9
+ optionsValidator,
10
+ } from './common';
@@ -1 +0,0 @@
1
- export declare const container: string;
@@ -1 +0,0 @@
1
- export declare const sampleClassName: string;
@@ -1 +0,0 @@
1
- export declare const navLink: string;
@@ -1 +0,0 @@
1
- export declare const container: string;
@@ -1 +0,0 @@
1
- export declare const container: string;
@@ -1 +0,0 @@
1
- export declare const sampleClassName: string;
@@ -1 +0,0 @@
1
- export declare const navLink: string;
@@ -1 +0,0 @@
1
- export declare const container: string;