@dr.pogodin/react-utils 1.43.31 → 1.43.33
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/shared/components/Button/index.js +20 -4
- package/build/development/shared/components/Button/index.js.map +1 -1
- package/build/development/shared/components/Input/index.js +3 -1
- package/build/development/shared/components/Input/index.js.map +1 -1
- package/build/development/web.bundle.js +2 -2
- 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/components/Input/index.js +1 -1
- package/build/production/shared/components/Input/index.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/build/types-code/shared/components/Input/index.d.ts +1 -1
- package/package.json +10 -10
- package/src/shared/components/Button/index.tsx +22 -3
- package/src/shared/components/Input/index.tsx +6 -2
|
@@ -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;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type Ref } from 'react';
|
|
2
2
|
import { type Theme } from '@dr.pogodin/react-themes';
|
|
3
|
-
type ThemeKeyT = 'container' | 'input' | 'label';
|
|
3
|
+
type ThemeKeyT = 'container' | 'empty' | 'input' | 'label';
|
|
4
4
|
type PropsT = React.InputHTMLAttributes<HTMLInputElement> & {
|
|
5
5
|
label?: React.ReactNode;
|
|
6
6
|
ref?: Ref<HTMLInputElement>;
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.43.
|
|
2
|
+
"version": "1.43.33",
|
|
3
3
|
"bin": {
|
|
4
4
|
"react-utils-build": "bin/build.js",
|
|
5
5
|
"react-utils-setup": "bin/setup.js"
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"@babel/runtime": "^7.28.2",
|
|
12
|
-
"@dr.pogodin/babel-plugin-react-css-modules": "^6.13.
|
|
12
|
+
"@dr.pogodin/babel-plugin-react-css-modules": "^6.13.7",
|
|
13
13
|
"@dr.pogodin/csurf": "^1.16.5",
|
|
14
14
|
"@dr.pogodin/js-utils": "^0.1.3",
|
|
15
15
|
"@dr.pogodin/react-global-state": "^0.19.3",
|
|
@@ -27,7 +27,7 @@
|
|
|
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",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"raf": "^3.4.1",
|
|
36
36
|
"react": "^19.1.1",
|
|
37
37
|
"react-dom": "^19.1.1",
|
|
38
|
-
"react-router": "^7.
|
|
38
|
+
"react-router": "^7.8.0",
|
|
39
39
|
"request-ip": "^3.3.0",
|
|
40
40
|
"rimraf": "^6.0.0",
|
|
41
41
|
"serialize-javascript": "^6.0.2",
|
|
@@ -56,7 +56,7 @@
|
|
|
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
61
|
"@testing-library/dom": "^10.4.1",
|
|
62
62
|
"@testing-library/react": "^16.3.0",
|
|
@@ -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,11 +101,11 @@
|
|
|
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.23.
|
|
108
|
+
"stylelint": "^16.23.1",
|
|
109
109
|
"stylelint-config-standard-scss": "^15.0.1",
|
|
110
110
|
"supertest": "^7.1.4",
|
|
111
111
|
"tsc-alias": "1.8.16",
|
|
@@ -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}
|
|
@@ -4,7 +4,7 @@ import themed, { type Theme } from '@dr.pogodin/react-themes';
|
|
|
4
4
|
|
|
5
5
|
import defaultTheme from './theme.scss';
|
|
6
6
|
|
|
7
|
-
type ThemeKeyT = 'container' | 'input' | 'label';
|
|
7
|
+
type ThemeKeyT = 'container' | 'empty' | 'input' | 'label';
|
|
8
8
|
|
|
9
9
|
type PropsT = React.InputHTMLAttributes<HTMLInputElement> & {
|
|
10
10
|
label?: React.ReactNode;
|
|
@@ -29,9 +29,13 @@ const Input: FunctionComponent<PropsT> = ({
|
|
|
29
29
|
...rest
|
|
30
30
|
}) => {
|
|
31
31
|
const localRef = useRef<HTMLInputElement>(null);
|
|
32
|
+
|
|
33
|
+
let containerClassName = theme.container;
|
|
34
|
+
if (!rest.value && theme.empty) containerClassName += ` ${theme.empty}`;
|
|
35
|
+
|
|
32
36
|
return (
|
|
33
37
|
<span
|
|
34
|
-
className={
|
|
38
|
+
className={containerClassName}
|
|
35
39
|
onFocus={() => {
|
|
36
40
|
// TODO: It does not really work if a callback-style `ref` is passed in,
|
|
37
41
|
// we need a more complex logic to cover that case, but for now this serves
|