@dr.pogodin/react-utils 1.44.7 → 1.44.9

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.
@@ -1,8 +1,9 @@
1
- import { type ChangeEventHandler, type FocusEventHandler, type KeyboardEventHandler } from 'react';
1
+ import { type ChangeEventHandler, type FocusEventHandler, type KeyboardEventHandler, type ReactNode } from 'react';
2
2
  import { type Theme } from '@dr.pogodin/react-themes';
3
- type ThemeKeyT = 'container' | 'hidden' | 'label' | 'textarea';
3
+ type ThemeKeyT = 'container' | 'error' | 'errorMessage' | 'hidden' | 'label' | 'textarea';
4
4
  type Props = {
5
5
  disabled?: boolean;
6
+ error?: ReactNode;
6
7
  label?: string;
7
8
  onBlur?: FocusEventHandler<HTMLTextAreaElement>;
8
9
  onChange?: ChangeEventHandler<HTMLTextAreaElement>;
@@ -1,6 +1,8 @@
1
1
  export declare const ad: string;
2
2
  export declare const container: string;
3
3
  export declare const context: string;
4
+ export declare const error: string;
5
+ export declare const errorMessage: string;
4
6
  export declare const hidden: string;
5
7
  export declare const hoc: string;
6
8
  export declare const label: string;
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.44.7",
2
+ "version": "1.44.9",
3
3
  "bin": {
4
4
  "react-utils-build": "bin/build.js",
5
5
  "react-utils-setup": "bin/setup.js"
@@ -16,8 +16,8 @@
16
16
  "@dr.pogodin/react-helmet": "^3.0.4",
17
17
  "@dr.pogodin/react-themes": "^1.9.2",
18
18
  "@jest/environment": "^30.1.2",
19
- "axios": "^1.11.0",
20
- "commander": "^14.0.0",
19
+ "axios": "^1.12.2",
20
+ "commander": "^14.0.1",
21
21
  "compression": "^1.8.1",
22
22
  "config": "^4.1.1",
23
23
  "cookie": "^1.0.2",
@@ -34,7 +34,7 @@
34
34
  "raf": "^3.4.1",
35
35
  "react": "^19.1.1",
36
36
  "react-dom": "^19.1.1",
37
- "react-router": "^7.8.2",
37
+ "react-router": "^7.9.1",
38
38
  "request-ip": "^3.3.0",
39
39
  "rimraf": "^6.0.0",
40
40
  "serialize-javascript": "^6.0.2",
@@ -55,7 +55,7 @@
55
55
  "@babel/register": "^7.28.3",
56
56
  "@dr.pogodin/babel-plugin-transform-assets": "^1.2.5",
57
57
  "@dr.pogodin/babel-preset-svgr": "^1.9.2",
58
- "@dr.pogodin/eslint-configs": "^0.0.11",
58
+ "@dr.pogodin/eslint-configs": "^0.0.12",
59
59
  "@pmmmwh/react-refresh-webpack-plugin": "^0.6.1",
60
60
  "@standard-schema/spec": "^1.0.0",
61
61
  "@testing-library/dom": "^10.4.1",
@@ -72,7 +72,7 @@
72
72
  "@types/morgan": "^1.9.10",
73
73
  "@types/node-forge": "^1.3.14",
74
74
  "@types/pretty": "^2.0.3",
75
- "@types/react": "^19.1.12",
75
+ "@types/react": "^19.1.13",
76
76
  "@types/react-dom": "^19.1.9",
77
77
  "@types/request-ip": "^0.0.41",
78
78
  "@types/serialize-javascript": "^5.0.4",
@@ -90,7 +90,7 @@
90
90
  "identity-obj-proxy": "^3.0.0",
91
91
  "jest": "^30.1.3",
92
92
  "jest-environment-jsdom": "^30.1.2",
93
- "memfs": "^4.38.2",
93
+ "memfs": "^4.46.0",
94
94
  "mini-css-extract-plugin": "^2.9.4",
95
95
  "mockdate": "^3.0.5",
96
96
  "nodelist-foreach-polyfill": "^1.2.0",
@@ -101,19 +101,19 @@
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.92.1",
104
+ "sass": "^1.93.2",
105
105
  "sass-loader": "^16.0.5",
106
106
  "sitemap": "^8.0.0",
107
107
  "source-map-loader": "^5.0.0",
108
108
  "stylelint": "^16.24.0",
109
- "stylelint-config-standard-scss": "^15.0.1",
109
+ "stylelint-config-standard-scss": "^16.0.0",
110
110
  "supertest": "^7.1.4",
111
111
  "tsc-alias": "1.8.16",
112
112
  "tstyche": "^4.3.0",
113
113
  "typed-scss-modules": "^8.1.1",
114
114
  "typescript": "^5.9.2",
115
115
  "webpack": "^5.101.3",
116
- "webpack-dev-middleware": "^7.4.3",
116
+ "webpack-dev-middleware": "^7.4.4",
117
117
  "webpack-hot-middleware": "^2.26.1",
118
118
  "webpack-merge": "^6.0.1",
119
119
  "workbox-core": "^7.3.0",
@@ -401,6 +401,8 @@ export default function factory(
401
401
  }
402
402
  }
403
403
 
404
+ const brr = ops.beforeRender!(req, sanitizedConfig as unknown as ConfigT);
405
+
404
406
  const [{
405
407
  configToInject,
406
408
  extraScripts,
@@ -409,7 +411,10 @@ export default function factory(
409
411
  cipher,
410
412
  iv,
411
413
  }] = await Promise.all([
412
- ops.beforeRender!(req, sanitizedConfig as unknown as ConfigT),
414
+ // NOTE: Written this way to avoid triggering the "await-thenable"
415
+ // ESLint rule.
416
+ brr instanceof Promise ? brr : Promise.resolve(brr),
417
+
413
418
  prepareCipher(buildInfo.key),
414
419
  ]);
415
420
 
@@ -3,6 +3,7 @@ import {
3
3
  type FocusEventHandler,
4
4
  type FunctionComponent,
5
5
  type KeyboardEventHandler,
6
+ type ReactNode,
6
7
  useEffect,
7
8
  useLayoutEffect,
8
9
  useRef,
@@ -13,10 +14,12 @@ import themed, { type Theme } from '@dr.pogodin/react-themes';
13
14
 
14
15
  import defaultTheme from './style.scss';
15
16
 
16
- type ThemeKeyT = 'container' | 'hidden' | 'label' | 'textarea';
17
+ type ThemeKeyT = 'container' | 'error' | 'errorMessage' | 'hidden' | 'label'
18
+ | 'textarea';
17
19
 
18
20
  type Props = {
19
21
  disabled?: boolean;
22
+ error?: ReactNode;
20
23
  label?: string;
21
24
  onBlur?: FocusEventHandler<HTMLTextAreaElement>;
22
25
  onChange?: ChangeEventHandler<HTMLTextAreaElement>;
@@ -29,6 +32,7 @@ type Props = {
29
32
 
30
33
  const TextArea: FunctionComponent<Props> = ({
31
34
  disabled,
35
+ error,
32
36
  label,
33
37
  onBlur,
34
38
  onChange,
@@ -74,9 +78,12 @@ const TextArea: FunctionComponent<Props> = ({
74
78
  if (el) setHeight(el.scrollHeight);
75
79
  }, [localValue]);
76
80
 
81
+ let containerClassName = theme.container;
82
+ if (error) containerClassName += ` ${theme.error}`;
83
+
77
84
  return (
78
85
  <div
79
- className={theme.container}
86
+ className={containerClassName}
80
87
  onFocus={() => {
81
88
  textAreaRef.current?.focus();
82
89
  }}
@@ -122,6 +129,9 @@ const TextArea: FunctionComponent<Props> = ({
122
129
  style={{ height }}
123
130
  value={localValue}
124
131
  />
132
+ {error && error !== true
133
+ ? <div className={theme.errorMessage}>{error}</div>
134
+ : null}
125
135
  </div>
126
136
  );
127
137
  };
@@ -4,6 +4,8 @@
4
4
  .context,
5
5
  .ad.hoc {
6
6
  &.container {
7
+ display: inline-flex;
8
+ flex-wrap: wrap;
7
9
  margin: 0.1em;
8
10
  position: relative;
9
11
  }
@@ -42,6 +44,21 @@
42
44
  }
43
45
  }
44
46
 
47
+ &.error &.textarea {
48
+ border-color: red;
49
+
50
+ &:focus { box-shadow: 0 0 3px 1px orangered }
51
+ }
52
+
53
+ &.errorMessage {
54
+ color: red;
55
+ font-size: 0.8em;
56
+ font-style: italic;
57
+ padding-right: 0.6em;
58
+ text-align: right;
59
+ width: 100%;
60
+ }
61
+
45
62
  &.hidden {
46
63
  // NOTE: We hide it this way, as setting "display: none" will interfere
47
64
  // with measurements, making the hidden input height zero.