@dr.pogodin/react-utils 1.33.3 → 1.34.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 (102) hide show
  1. package/build/development/shared/components/Button/index.js +0 -38
  2. package/build/development/shared/components/Button/index.js.map +1 -1
  3. package/build/development/shared/components/Checkbox/index.js +0 -5
  4. package/build/development/shared/components/Checkbox/index.js.map +1 -1
  5. package/build/development/shared/components/GenericLink/index.js +0 -12
  6. package/build/development/shared/components/GenericLink/index.js.map +1 -1
  7. package/build/development/shared/components/Input/index.js +0 -3
  8. package/build/development/shared/components/Input/index.js.map +1 -1
  9. package/build/development/shared/components/MetaTags.js +0 -8
  10. package/build/development/shared/components/MetaTags.js.map +1 -1
  11. package/build/development/shared/components/Modal/index.js +0 -8
  12. package/build/development/shared/components/Modal/index.js.map +1 -1
  13. package/build/development/shared/components/PageLayout/index.js +0 -5
  14. package/build/development/shared/components/PageLayout/index.js.map +1 -1
  15. package/build/development/shared/components/TextArea/index.js +0 -7
  16. package/build/development/shared/components/TextArea/index.js.map +1 -1
  17. package/build/development/shared/components/WithTooltip/Tooltip.js +0 -3
  18. package/build/development/shared/components/WithTooltip/Tooltip.js.map +1 -1
  19. package/build/development/shared/components/WithTooltip/index.js +1 -6
  20. package/build/development/shared/components/WithTooltip/index.js.map +1 -1
  21. package/build/development/shared/components/YouTubeVideo/index.js +0 -4
  22. package/build/development/shared/components/YouTubeVideo/index.js.map +1 -1
  23. package/build/development/shared/components/selectors/CustomDropdown/Options/index.js +0 -4
  24. package/build/development/shared/components/selectors/CustomDropdown/Options/index.js.map +1 -1
  25. package/build/development/shared/components/selectors/CustomDropdown/index.js +1 -8
  26. package/build/development/shared/components/selectors/CustomDropdown/index.js.map +1 -1
  27. package/build/development/shared/components/selectors/NativeDropdown/index.js +1 -8
  28. package/build/development/shared/components/selectors/NativeDropdown/index.js.map +1 -1
  29. package/build/development/shared/components/selectors/Switch/index.js +1 -7
  30. package/build/development/shared/components/selectors/Switch/index.js.map +1 -1
  31. package/build/development/shared/components/selectors/common.js +11 -6
  32. package/build/development/shared/components/selectors/common.js.map +1 -1
  33. package/build/development/shared/utils/jest/index.js +16 -75
  34. package/build/development/shared/utils/jest/index.js.map +1 -1
  35. package/build/development/shared/utils/splitComponent.js +0 -3
  36. package/build/development/shared/utils/splitComponent.js.map +1 -1
  37. package/build/development/web.bundle.js +23 -33
  38. package/build/production/shared/components/Button/index.js +1 -26
  39. package/build/production/shared/components/Button/index.js.map +1 -1
  40. package/build/production/shared/components/Checkbox/index.js +1 -1
  41. package/build/production/shared/components/Checkbox/index.js.map +1 -1
  42. package/build/production/shared/components/GenericLink/index.js +1 -1
  43. package/build/production/shared/components/GenericLink/index.js.map +1 -1
  44. package/build/production/shared/components/Input/index.js +1 -1
  45. package/build/production/shared/components/Input/index.js.map +1 -1
  46. package/build/production/shared/components/MetaTags.js +1 -1
  47. package/build/production/shared/components/MetaTags.js.map +1 -1
  48. package/build/production/shared/components/Modal/index.js +2 -2
  49. package/build/production/shared/components/Modal/index.js.map +1 -1
  50. package/build/production/shared/components/PageLayout/index.js +1 -1
  51. package/build/production/shared/components/PageLayout/index.js.map +1 -1
  52. package/build/production/shared/components/TextArea/index.js +1 -1
  53. package/build/production/shared/components/TextArea/index.js.map +1 -1
  54. package/build/production/shared/components/WithTooltip/Tooltip.js +1 -1
  55. package/build/production/shared/components/WithTooltip/Tooltip.js.map +1 -1
  56. package/build/production/shared/components/WithTooltip/index.js +2 -2
  57. package/build/production/shared/components/WithTooltip/index.js.map +1 -1
  58. package/build/production/shared/components/YouTubeVideo/index.js +1 -1
  59. package/build/production/shared/components/YouTubeVideo/index.js.map +1 -1
  60. package/build/production/shared/components/selectors/CustomDropdown/Options/index.js +1 -1
  61. package/build/production/shared/components/selectors/CustomDropdown/Options/index.js.map +1 -1
  62. package/build/production/shared/components/selectors/CustomDropdown/index.js +1 -1
  63. package/build/production/shared/components/selectors/CustomDropdown/index.js.map +1 -1
  64. package/build/production/shared/components/selectors/NativeDropdown/index.js +1 -1
  65. package/build/production/shared/components/selectors/NativeDropdown/index.js.map +1 -1
  66. package/build/production/shared/components/selectors/Switch/index.js +1 -1
  67. package/build/production/shared/components/selectors/Switch/index.js.map +1 -1
  68. package/build/production/shared/components/selectors/common.js +2 -2
  69. package/build/production/shared/components/selectors/common.js.map +1 -1
  70. package/build/production/shared/utils/jest/index.js +7 -33
  71. package/build/production/shared/utils/jest/index.js.map +1 -1
  72. package/build/production/shared/utils/splitComponent.js +1 -1
  73. package/build/production/shared/utils/splitComponent.js.map +1 -1
  74. package/build/production/web.bundle.js +1 -1
  75. package/build/production/web.bundle.js.map +1 -1
  76. package/build/types-code/shared/components/selectors/CustomDropdown/Options/index.d.ts +3 -3
  77. package/build/types-code/shared/components/selectors/CustomDropdown/index.d.ts +2 -2
  78. package/build/types-code/shared/components/selectors/Switch/index.d.ts +3 -3
  79. package/build/types-code/shared/components/selectors/common.d.ts +11 -9
  80. package/build/types-code/shared/utils/jest/index.d.ts +3 -43
  81. package/config/eslint/default.json +2 -1
  82. package/config/eslint/jest.json +2 -1
  83. package/config/eslint/typescript.js +5 -0
  84. package/package.json +40 -39
  85. package/src/shared/components/Button/index.tsx +0 -38
  86. package/src/shared/components/Checkbox/index.tsx +0 -6
  87. package/src/shared/components/GenericLink/index.tsx +0 -13
  88. package/src/shared/components/Input/index.tsx +0 -4
  89. package/src/shared/components/MetaTags.tsx +0 -9
  90. package/src/shared/components/Modal/index.tsx +0 -10
  91. package/src/shared/components/PageLayout/index.tsx +0 -6
  92. package/src/shared/components/TextArea/index.tsx +0 -8
  93. package/src/shared/components/WithTooltip/Tooltip.tsx +0 -4
  94. package/src/shared/components/WithTooltip/index.tsx +1 -7
  95. package/src/shared/components/YouTubeVideo/index.tsx +0 -5
  96. package/src/shared/components/selectors/CustomDropdown/Options/index.tsx +3 -7
  97. package/src/shared/components/selectors/CustomDropdown/index.tsx +4 -10
  98. package/src/shared/components/selectors/NativeDropdown/index.tsx +2 -9
  99. package/src/shared/components/selectors/Switch/index.tsx +10 -11
  100. package/src/shared/components/selectors/common.ts +25 -11
  101. package/src/shared/utils/jest/index.tsx +14 -64
  102. package/src/shared/utils/splitComponent.tsx +1 -5
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- import { type OptionT, type OptionsT } from '../../common';
2
+ import { type OptionT, type OptionsT, type ValueT } from '../../common';
3
3
  export type ContainerPosT = {
4
4
  left: number;
5
5
  top: number;
@@ -12,11 +12,11 @@ export type RefT = {
12
12
  type PropsT = {
13
13
  containerClass: string;
14
14
  containerStyle?: ContainerPosT;
15
- filter?: (item: OptionT<React.ReactNode> | string) => boolean;
15
+ filter?: (item: OptionT<React.ReactNode> | ValueT) => boolean;
16
16
  optionClass: string;
17
17
  options: OptionsT<React.ReactNode>;
18
18
  onCancel: () => void;
19
- onChange: (value: string) => void;
19
+ onChange: (value: ValueT) => void;
20
20
  };
21
21
  declare const Options: React.ForwardRefExoticComponent<PropsT & React.RefAttributes<RefT>>;
22
22
  export default Options;
@@ -1,4 +1,4 @@
1
1
  /// <reference types="react" />
2
- import { type PropsT } from '../common';
3
- declare const ThemedCustomDropdown: import("@dr.pogodin/react-themes").ThemedComponent<PropsT<React.ReactNode, (value: string) => void>>;
2
+ import { type PropsT, type ValueT } from '../common';
3
+ declare const ThemedCustomDropdown: import("@dr.pogodin/react-themes").ThemedComponent<PropsT<React.ReactNode, (value: ValueT) => void>>;
4
4
  export default ThemedCustomDropdown;
@@ -1,13 +1,13 @@
1
1
  /// <reference types="react" />
2
2
  import { type Theme } from '@dr.pogodin/react-themes';
3
- import { type OptionsT } from '../common';
3
+ import { type OptionsT, type ValueT } from '../common';
4
4
  declare const validThemeKeys: readonly ["container", "label", "option", "options", "selected"];
5
5
  type PropsT = {
6
6
  label?: React.ReactNode;
7
- onChange?: (value: string) => void;
7
+ onChange?: (value: ValueT) => void;
8
8
  options?: Readonly<OptionsT<React.ReactNode>>;
9
9
  theme: Theme<typeof validThemeKeys>;
10
- value?: string;
10
+ value?: ValueT;
11
11
  };
12
12
  declare const ThemedSwitch: import("@dr.pogodin/react-themes").ThemedComponent<PropsT>;
13
13
  export default ThemedSwitch;
@@ -2,22 +2,24 @@
2
2
  import PT from 'prop-types';
3
3
  import type { Theme } from '@dr.pogodin/react-themes';
4
4
  export declare const validThemeKeys: readonly ["active", "arrow", "container", "dropdown", "hiddenOption", "label", "option", "select", "upward"];
5
+ export type ValueT = number | string;
6
+ export declare const valueValidator: PT.Requireable<ValueT>;
5
7
  export type OptionT<NameT> = {
6
8
  name?: NameT | null;
7
- value: string;
9
+ value: ValueT;
8
10
  };
9
- export type OptionsT<NameT> = Array<OptionT<NameT> | string>;
11
+ export type OptionsT<NameT> = Array<OptionT<NameT> | ValueT>;
10
12
  export type PropsT<NameT, OnChangeT = React.ChangeEventHandler<HTMLSelectElement>> = {
11
- filter?: (item: OptionT<NameT> | string) => boolean;
13
+ filter?: (item: OptionT<NameT> | ValueT) => boolean;
12
14
  label?: React.ReactNode;
13
15
  onChange?: OnChangeT;
14
16
  options?: OptionsT<NameT>;
15
17
  theme: Theme<typeof validThemeKeys>;
16
- value?: string;
18
+ value?: ValueT;
17
19
  };
18
- export declare const optionValidator: PT.Requireable<OptionT<React.ReactNode> | string>;
19
- export declare const optionsValidator: PT.Requireable<NonNullable<string | OptionT<React.ReactNode>>[]>;
20
- export declare const stringOptionValidator: PT.Requireable<OptionT<string> | string>;
21
- export declare const stringOptionsValidator: PT.Requireable<NonNullable<string | OptionT<string>>[]>;
20
+ export declare const optionValidator: PT.Requireable<OptionT<React.ReactNode> | ValueT>;
21
+ export declare const optionsValidator: PT.Requireable<NonNullable<ValueT | OptionT<React.ReactNode>>[]>;
22
+ export declare const stringOptionValidator: PT.Requireable<OptionT<string> | ValueT>;
23
+ export declare const stringOptionsValidator: PT.Requireable<NonNullable<ValueT | OptionT<string>>[]>;
22
24
  /** Returns option value and name as a tuple. */
23
- export declare function optionValueName<NameT>(option: OptionT<NameT> | string): [string, NameT | string];
25
+ export declare function optionValueName<NameT>(option: OptionT<NameT> | ValueT): [ValueT, NameT | ValueT];
@@ -1,11 +1,8 @@
1
1
  /// <reference types="trusted-types" />
2
- import { type ReactElement, type ReactNode } from 'react';
3
- import TU, { act } from 'react-dom/test-utils';
4
- import Renderer from 'react-test-renderer';
2
+ import { type ReactNode, act } from 'react';
5
3
  /**
6
4
  * An alias for [act(..)](https://reactjs.org/docs/test-utils.html#act)
7
- * from `react-dom/test-utils`.
8
- * @param {function} action
5
+ * from `react`.
9
6
  */
10
7
  export { act };
11
8
  export { default as getGlobal } from './global';
@@ -45,41 +42,4 @@ export type MountedSceneT = HTMLElement & {
45
42
  * attached.
46
43
  */
47
44
  export declare function mount(scene: ReactNode): MountedSceneT;
48
- /**
49
- * Renders provided ReactJS component into JSON representation of the component
50
- * tree, using [`react-test-renderer`](https://www.npmjs.com/package/react-test-renderer).
51
- * @param {object} component ReactJS component to render.
52
- * @return {object} JSON representation of the rendered tree.
53
- * @example
54
- * import { JU } from '@dr.pogodin/react-utils';
55
- * console.log(JU.render(<div>Example</div>));
56
- */
57
- export declare function render(component: ReactElement): Renderer.ReactTestRendererJSON | Renderer.ReactTestRendererJSON[] | null;
58
- /**
59
- * Generates a shallow render of given ReactJS component, using
60
- * [react-test-renderer/shallow](https://reactjs.org/docs/shallow-renderer.html)
61
- * and returns the result.
62
- * @param {object} component ReactJS component to render.
63
- * @return {object} JSON representation of the shallow component's render tree.
64
- */
65
- export declare function shallowRender(component: ReactElement): ReactElement<any, string | React.JSXElementConstructor<any>>;
66
- /**
67
- * Makes a shallow snapshot test of the given ReactJS component, and also
68
- * returns JSON representation of the rendered component tree. Under the hood
69
- * it uses {@link module:JU.shallowRender shallowRender(..)} to generate
70
- * the render, then executes `expect(RENDER_RESULT).toMatchSnapshot()`,
71
- * and finally returns the `RENDER_RESULT` to the caller.
72
- * @param {object} component ReactJS component to render.
73
- * @return {object} JSON representation of shallow render.
74
- */
75
- export declare function shallowSnapshot(component: ReactElement): ReactElement<any, string | React.JSXElementConstructor<any>>;
76
- /**
77
- * Makes snapshot test of the given ReactJS component, and also returns JSON
78
- * representation of the rendered component tree. Under the hood, it uses
79
- * {@link module:JU.render render(..)} to render it, then executes
80
- * `expect(RENDER_RESULT).toMatchSnapshot()`, and then returns `RENDER_RESULT`.
81
- * @param {object} component ReactJS component to render.
82
- * @return {object} JSON render of the component.
83
- */
84
- export declare function snapshot(component: ReactElement): Renderer.ReactTestRendererJSON | Renderer.ReactTestRendererJSON[] | null;
85
- export declare const simulate: typeof TU.Simulate;
45
+ export declare function snapshot(element: React.ReactElement): ChildNode | null;
@@ -18,7 +18,8 @@
18
18
  "react/no-unknown-property": ["error", {
19
19
  "ignore": ["styleName"]
20
20
  }],
21
- "react/react-in-jsx-scope": 0
21
+ "react/react-in-jsx-scope": 0,
22
+ "react/require-default-props": 0
22
23
  },
23
24
  "settings": {
24
25
  "import/resolver": {
@@ -12,6 +12,7 @@
12
12
  "import/no-dynamic-require": 0,
13
13
  "import/no-extraneous-dependencies": 0,
14
14
  "no-console": 0,
15
- "no-new-func": 0
15
+ "no-new-func": 0,
16
+ "react/require-default-props": 0
16
17
  }
17
18
  }
@@ -25,6 +25,11 @@ module.exports = {
25
25
  ignore: ['styleName'],
26
26
  }],
27
27
  'react/react-in-jsx-scope': 0,
28
+
29
+ // TODO: .defaultProps will be deprecated in React@19.
30
+ // Remove this rule override once AirBnB ESLint config is updated.
31
+ // (also remove it from sibling .json configs)
32
+ 'react/require-default-props': 0,
28
33
  },
29
34
  settings: {
30
35
  'import/resolver': {
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.33.3",
2
+ "version": "1.34.0",
3
3
  "bin": {
4
4
  "react-utils-build": "bin/build.js",
5
5
  "react-utils-setup": "bin/setup.js"
@@ -8,12 +8,12 @@
8
8
  "url": "https://github.com/birdofpreyru/react-utils/issues"
9
9
  },
10
10
  "dependencies": {
11
- "@babel/runtime": "^7.24.4",
11
+ "@babel/runtime": "^7.24.5",
12
12
  "@dr.pogodin/babel-plugin-react-css-modules": "^6.13.1",
13
13
  "@dr.pogodin/csurf": "^1.13.0",
14
14
  "@dr.pogodin/js-utils": "^0.0.9",
15
- "@dr.pogodin/react-global-state": "^0.14.0",
16
- "@dr.pogodin/react-themes": "^1.6.0",
15
+ "@dr.pogodin/react-global-state": "^0.14.1",
16
+ "@dr.pogodin/react-themes": "^1.6.1",
17
17
  "@jest/environment": "^29.7.0",
18
18
  "axios": "^1.6.8",
19
19
  "commander": "^12.0.0",
@@ -22,21 +22,21 @@
22
22
  "cookie": "^0.6.0",
23
23
  "cookie-parser": "^1.4.6",
24
24
  "cross-env": "^7.0.3",
25
- "dayjs": "^1.11.10",
25
+ "dayjs": "^1.11.11",
26
26
  "express": "^4.19.2",
27
27
  "helmet": "^7.1.0",
28
28
  "http-status-codes": "^2.3.0",
29
- "joi": "^17.12.3",
29
+ "joi": "^17.13.1",
30
30
  "lodash": "^4.17.21",
31
31
  "morgan": "^1.10.0",
32
32
  "node-forge": "^1.3.1",
33
33
  "prop-types": "^15.8.1",
34
- "qs": "^6.12.0",
34
+ "qs": "^6.12.1",
35
35
  "raf": "^3.4.1",
36
- "react": "^18.2.0",
37
- "react-dom": "^18.2.0",
36
+ "react": "^18.3.1",
37
+ "react-dom": "^18.3.1",
38
38
  "react-helmet": "^6.1.0",
39
- "react-router-dom": "^6.22.3",
39
+ "react-router-dom": "^6.23.0",
40
40
  "request-ip": "^3.3.0",
41
41
  "rimraf": "^5.0.5",
42
42
  "serialize-javascript": "^6.0.2",
@@ -47,21 +47,24 @@
47
47
  },
48
48
  "description": "Collection of generic ReactJS components and utils",
49
49
  "devDependencies": {
50
- "@babel/cli": "^7.24.1",
51
- "@babel/core": "^7.24.4",
52
- "@babel/eslint-parser": "^7.24.1",
53
- "@babel/eslint-plugin": "^7.23.5",
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
54
  "@babel/node": "^7.23.9",
55
55
  "@babel/plugin-transform-runtime": "^7.24.3",
56
- "@babel/preset-env": "^7.24.4",
56
+ "@babel/preset-env": "^7.24.5",
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
- "@pmmmwh/react-refresh-webpack-plugin": "^0.5.11",
62
+ "@pmmmwh/react-refresh-webpack-plugin": "^0.5.13",
63
+ "@testing-library/dom": "^10.1.0",
64
+ "@testing-library/react": "^15.0.6",
65
+ "@testing-library/user-event": "^14.5.2",
63
66
  "@tsconfig/recommended": "^1.0.6",
64
- "@tsd/typescript": "^5.4.4",
67
+ "@tsd/typescript": "^5.4.5",
65
68
  "@types/compression": "^1.7.5",
66
69
  "@types/config": "^3.3.4",
67
70
  "@types/cookie": "^0.6.0",
@@ -69,14 +72,13 @@
69
72
  "@types/csurf": "^1.11.5",
70
73
  "@types/express": "^4.17.21",
71
74
  "@types/jest": "^29.5.12",
72
- "@types/lodash": "^4.17.0",
75
+ "@types/lodash": "^4.17.1",
73
76
  "@types/morgan": "^1.9.9",
74
77
  "@types/node-forge": "^1.3.11",
75
78
  "@types/pretty": "^2.0.3",
76
- "@types/react": "^18.2.74",
77
- "@types/react-dom": "^18.2.24",
79
+ "@types/react": "^18.3.1",
80
+ "@types/react-dom": "^18.3.0",
78
81
  "@types/react-helmet": "^6.1.11",
79
- "@types/react-test-renderer": "^18.0.7",
80
82
  "@types/request-ip": "^0.0.41",
81
83
  "@types/serialize-javascript": "^5.0.4",
82
84
  "@types/serve-favicon": "^2.5.7",
@@ -86,51 +88,50 @@
86
88
  "autoprefixer": "^10.4.19",
87
89
  "babel-jest": "^29.7.0",
88
90
  "babel-loader": "^9.1.3",
89
- "babel-plugin-module-resolver": "^5.0.0",
90
- "core-js": "^3.36.1",
91
- "css-loader": "^7.0.0",
91
+ "babel-plugin-module-resolver": "^5.0.2",
92
+ "core-js": "^3.37.0",
93
+ "css-loader": "^7.1.1",
92
94
  "css-minimizer-webpack-plugin": "^6.0.0",
93
95
  "eslint": "^8.57.0",
94
96
  "eslint-config-airbnb": "^19.0.4",
95
97
  "eslint-config-airbnb-typescript": "^18.0.0",
96
98
  "eslint-import-resolver-babel-module": "^5.3.2",
97
99
  "eslint-plugin-import": "^2.29.1",
98
- "eslint-plugin-jest": "^28.2.0",
100
+ "eslint-plugin-jest": "^28.5.0",
99
101
  "eslint-plugin-jsx-a11y": "^6.8.0",
100
102
  "eslint-plugin-react": "^7.34.1",
101
- "eslint-plugin-react-hooks": "^4.6.0",
103
+ "eslint-plugin-react-hooks": "^4.6.2",
102
104
  "identity-obj-proxy": "^3.0.0",
103
105
  "jest": "^29.7.0",
104
106
  "jest-environment-jsdom": "^29.7.0",
105
- "memfs": "^4.8.1",
106
- "mini-css-extract-plugin": "^2.8.1",
107
+ "memfs": "^4.9.2",
108
+ "mini-css-extract-plugin": "^2.9.0",
107
109
  "mockdate": "^3.0.5",
108
110
  "nodelist-foreach-polyfill": "^1.2.0",
109
111
  "postcss": "^8.4.38",
110
112
  "postcss-loader": "^8.1.1",
111
113
  "postcss-scss": "^4.0.9",
112
114
  "pretty": "^2.0.0",
113
- "react-refresh": "^0.14.0",
114
- "react-test-renderer": "^18.2.0",
115
+ "react-refresh": "^0.14.2",
115
116
  "regenerator-runtime": "^0.14.1",
116
117
  "resolve-url-loader": "^5.0.0",
117
- "sass": "^1.74.1",
118
- "sass-loader": "^14.1.1",
118
+ "sass": "^1.76.0",
119
+ "sass-loader": "^14.2.1",
119
120
  "sitemap": "^7.1.1",
120
- "stylelint": "^16.3.1",
121
+ "stylelint": "^16.5.0",
121
122
  "stylelint-config-standard-scss": "^13.1.0",
122
- "supertest": "^6.3.4",
123
+ "supertest": "^7.0.0",
123
124
  "tsc-alias": "^1.8.8",
124
125
  "typed-scss-modules": "^8.0.1",
125
- "typescript": "^5.4.4",
126
- "typescript-eslint": "^7.5.0",
126
+ "typescript": "^5.4.5",
127
+ "typescript-eslint": "^7.8.0",
127
128
  "webpack": "^5.91.0",
128
129
  "webpack-dev-middleware": "^7.2.1",
129
130
  "webpack-hot-middleware": "^2.26.1",
130
131
  "webpack-merge": "^5.10.0",
131
- "workbox-core": "^7.0.0",
132
- "workbox-precaching": "^7.0.0",
133
- "workbox-webpack-plugin": "^7.0.0"
132
+ "workbox-core": "^7.1.0",
133
+ "workbox-precaching": "^7.1.0",
134
+ "workbox-webpack-plugin": "^7.1.0"
134
135
  },
135
136
  "engines": {
136
137
  "node": ">=18",
@@ -89,44 +89,6 @@ const BaseButton: React.FunctionComponent<PropsT> = ({
89
89
  */
90
90
  const ThemedButton = themed(BaseButton, 'Button', validThemeKeys, defaultTheme);
91
91
 
92
- /**
93
- * Implements themeable buttons, and button-line links (elements which look
94
- * like buttons, but behave as links) in the same uniform manner.
95
- * @param {object} [props] Component props.
96
- * @param {boolean} [props.active] Set `true` to render the button as
97
- * active, even if it is not active otherwise.
98
- * @param {boolean} [props.disabled] Set `true` to disable the button.
99
- * @param {boolean} [props.enforceA] When the button is rendered as `<Link>`
100
- * component, this prop enforces it to be rendered as a simple `<a>` element
101
- * (external link), rather than the React router's internal link.
102
- * See `<Link>` documentation to learn when links are rendered as `<a>`
103
- * by default.
104
- * @param {function} [props.onClick] Click event handler.
105
- * @param {function} [props.onMouseDown] Mouse down event handler.
106
- * @param {boolean} [props.openNewTab] Set `true` to open link in the new tab.
107
- * @param {boolean} [props.replace] When the button is rendered as
108
- * `<Link>`, and the target URL is internal, this property tells that
109
- * the new route should replace the last record in the browser's history,
110
- * rather than to be pushed as a new entry into the history stack.
111
- * @param {ButtonTheme} [props.theme] _Ad hoc_ button theme.
112
- * @param {object|string} [props.to] If specified, the button will be rendered
113
- * as `<Link>` (if not disabled), and it will point to the specified location
114
- * or URL.
115
- * @param {...any} [props....]
116
- * [Other properties of themeable components](https://www.npmjs.com/package/@dr.pogodin/react-themes#themed-component-properties)
117
- */
118
- BaseButton.defaultProps = {
119
- active: false,
120
- children: undefined,
121
- disabled: false,
122
- enforceA: false,
123
- onClick: undefined,
124
- onMouseDown: undefined,
125
- openNewTab: false,
126
- replace: false,
127
- to: undefined,
128
- };
129
-
130
92
  BaseButton.propTypes = {
131
93
  active: PT.bool,
132
94
  children: PT.node,
@@ -62,10 +62,4 @@ Checkbox.propTypes = {
62
62
  theme: ThemedCheckbox.themeType.isRequired,
63
63
  };
64
64
 
65
- Checkbox.defaultProps = {
66
- checked: undefined,
67
- label: undefined,
68
- onChange: undefined,
69
- };
70
-
71
65
  export default ThemedCheckbox;
@@ -127,19 +127,6 @@ const GenericLink: React.FunctionComponent<PropsT> = ({
127
127
  );
128
128
  };
129
129
 
130
- GenericLink.defaultProps = {
131
- children: null,
132
- className: '',
133
- disabled: false,
134
- enforceA: false,
135
- keepScrollPosition: false,
136
- onClick: undefined,
137
- onMouseDown: undefined,
138
- openNewTab: false,
139
- replace: false,
140
- to: '',
141
- };
142
-
143
130
  GenericLink.propTypes = {
144
131
  children: PT.node,
145
132
  className: PT.string,
@@ -50,8 +50,4 @@ Input.propTypes = {
50
50
  theme: ThemedInput.themeType.isRequired,
51
51
  };
52
52
 
53
- Input.defaultProps = {
54
- label: undefined,
55
- };
56
-
57
53
  export default ThemedInput;
@@ -147,15 +147,6 @@ const MetaTags: React.FunctionComponent<PropsT> & {
147
147
 
148
148
  MetaTags.Context = Context;
149
149
 
150
- MetaTags.defaultProps = {
151
- children: null,
152
- image: '',
153
- siteName: '',
154
- socialDescription: '',
155
- socialTitle: '',
156
- url: '',
157
- };
158
-
159
150
  MetaTags.propTypes = {
160
151
  children: PT.node,
161
152
  description: PT.string.isRequired,
@@ -1,7 +1,5 @@
1
1
  /* global document */
2
2
 
3
- import { noop } from 'lodash';
4
-
5
3
  import {
6
4
  type ReactNode,
7
5
  useEffect,
@@ -187,14 +185,6 @@ BaseModal.propTypes = {
187
185
  theme: ThemedModal.themeType.isRequired,
188
186
  };
189
187
 
190
- BaseModal.defaultProps = {
191
- cancelOnScrolling: false,
192
- children: null,
193
- containerStyle: undefined,
194
- dontDisableScrolling: false,
195
- onCancel: noop,
196
- };
197
-
198
188
  export default ThemedModal;
199
189
 
200
190
  /* Non-themed version of the Modal. */
@@ -68,10 +68,4 @@ PageLayout.propTypes = {
68
68
  theme: ThemedPageLayout.themeType.isRequired,
69
69
  };
70
70
 
71
- PageLayout.defaultProps = {
72
- children: null,
73
- leftSidePanelContent: null,
74
- rightSidePanelContent: null,
75
- };
76
-
77
71
  export default ThemedPageLayout;
@@ -101,12 +101,4 @@ TextArea.propTypes = {
101
101
  value: PT.string,
102
102
  };
103
103
 
104
- TextArea.defaultProps = {
105
- disabled: false,
106
- onChange: undefined,
107
- onKeyDown: undefined,
108
- placeholder: '',
109
- value: undefined,
110
- };
111
-
112
104
  export default ThemedTextArea;
@@ -350,8 +350,4 @@ Tooltip.propTypes = {
350
350
  theme: PT.shape({}).isRequired,
351
351
  };
352
352
 
353
- Tooltip.defaultProps = {
354
- children: null,
355
- };
356
-
357
353
  export default Tooltip;
@@ -59,7 +59,7 @@ type HeapT = {
59
59
  */
60
60
  const Wrapper: React.FunctionComponent<PropsT> = ({
61
61
  children,
62
- placement,
62
+ placement = PLACEMENTS.ABOVE_CURSOR,
63
63
  tip,
64
64
  theme,
65
65
  }) => {
@@ -198,10 +198,4 @@ Wrapper.propTypes = {
198
198
  tip: PT.node,
199
199
  };
200
200
 
201
- Wrapper.defaultProps = {
202
- children: null,
203
- placement: PLACEMENTS.ABOVE_CURSOR,
204
- tip: null,
205
- };
206
-
207
201
  export default e;
@@ -83,9 +83,4 @@ YouTubeVideo.propTypes = {
83
83
  title: PT.string,
84
84
  };
85
85
 
86
- YouTubeVideo.defaultProps = {
87
- autoplay: false,
88
- title: '',
89
- };
90
-
91
86
  export default ThemedYouTubeVideo;
@@ -8,6 +8,7 @@ import S from './style.scss';
8
8
  import {
9
9
  type OptionT,
10
10
  type OptionsT,
11
+ type ValueT,
11
12
  optionsValidator,
12
13
  optionValueName,
13
14
  } from '../../common';
@@ -29,11 +30,11 @@ export type RefT = {
29
30
  type PropsT = {
30
31
  containerClass: string;
31
32
  containerStyle?: ContainerPosT;
32
- filter?: (item: OptionT<React.ReactNode> | string) => boolean;
33
+ filter?: (item: OptionT<React.ReactNode> | ValueT) => boolean;
33
34
  optionClass: string;
34
35
  options: OptionsT<React.ReactNode>;
35
36
  onCancel: () => void;
36
- onChange: (value: string) => void;
37
+ onChange: (value: ValueT) => void;
37
38
  };
38
39
 
39
40
  const Options = forwardRef<RefT, PropsT>(({
@@ -131,9 +132,4 @@ Options.propTypes = {
131
132
  options: optionsValidator.isRequired,
132
133
  };
133
134
 
134
- Options.defaultProps = {
135
- containerStyle: undefined,
136
- filter: undefined,
137
- };
138
-
139
135
  export default Options;
@@ -9,13 +9,15 @@ import defaultTheme from './theme.scss';
9
9
 
10
10
  import {
11
11
  type PropsT,
12
+ type ValueT,
12
13
  optionValidator,
13
14
  optionValueName,
14
15
  validThemeKeys,
16
+ valueValidator,
15
17
  } from '../common';
16
18
 
17
19
  const BaseCustomDropdown: React.FunctionComponent<
18
- PropsT<React.ReactNode, (value: string) => void>
20
+ PropsT<React.ReactNode, (value: ValueT) => void>
19
21
  > = ({
20
22
  filter,
21
23
  label,
@@ -166,15 +168,7 @@ BaseCustomDropdown.propTypes = {
166
168
  onChange: PT.func,
167
169
  options: PT.arrayOf(optionValidator.isRequired),
168
170
  theme: ThemedCustomDropdown.themeType.isRequired,
169
- value: PT.string,
170
- };
171
-
172
- BaseCustomDropdown.defaultProps = {
173
- filter: undefined,
174
- label: undefined,
175
- onChange: undefined,
176
- options: [],
177
- value: undefined,
171
+ value: valueValidator,
178
172
  };
179
173
 
180
174
  export default ThemedCustomDropdown;
@@ -11,6 +11,7 @@ import {
11
11
  optionValueName,
12
12
  stringOptionsValidator,
13
13
  validThemeKeys,
14
+ valueValidator,
14
15
  } from '../common';
15
16
 
16
17
  /**
@@ -104,15 +105,7 @@ Dropdown.propTypes = {
104
105
  onChange: PT.func,
105
106
  options: stringOptionsValidator,
106
107
  theme: ThemedDropdown.themeType.isRequired,
107
- value: PT.string,
108
- };
109
-
110
- Dropdown.defaultProps = {
111
- filter: undefined,
112
- label: undefined,
113
- onChange: undefined,
114
- options: [],
115
- value: '',
108
+ value: valueValidator,
116
109
  };
117
110
 
118
111
  export default ThemedDropdown;