@reportportal/ui-kit 0.0.1-alpha.101 → 0.0.1-alpha.103
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/dist/attachedFile.js +1 -1
- package/dist/components/fileDropArea/attachedFilesList/attachedFilesList.d.ts +1 -0
- package/dist/components/fileDropArea/hooks/useFileProcessing.d.ts +2 -2
- package/dist/components/fileDropArea/types.d.ts +1 -0
- package/dist/components/fileDropArea/utils/getValidationErrorMessage.d.ts +1 -1
- package/dist/fieldNumber-1fa248f5.js +139 -0
- package/dist/fieldNumber.js +1 -1
- package/dist/fileDropArea.js +160 -155
- package/dist/index-803576c3.js +110 -0
- package/dist/index.js +2 -2
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/dist/fieldNumber-4a22c986.js +0 -131
- package/dist/index-e27a72a8.js +0 -99
package/dist/attachedFile.js
CHANGED
|
@@ -5,9 +5,9 @@ interface FileProcessingOptions extends FileValidationOptions {
|
|
|
5
5
|
onFilesAdded: (files: FileWithValidation[]) => void;
|
|
6
6
|
}
|
|
7
7
|
export declare const useFileProcessing: ({ maxFileSize, acceptFileMimeTypes, onFilesAdded, }: FileProcessingOptions) => {
|
|
8
|
-
onDrop: (acceptedFiles: File[]) => void;
|
|
9
|
-
handleFileInputChange: (event: ChangeEvent<HTMLInputElement>) => void;
|
|
10
8
|
error: ValidationError | null;
|
|
9
|
+
handleFileInputChange: (event: ChangeEvent<HTMLInputElement>) => void;
|
|
11
10
|
clearError: () => void;
|
|
11
|
+
onDrop: (acceptedFiles: File[]) => void;
|
|
12
12
|
};
|
|
13
13
|
export {};
|
|
@@ -49,6 +49,7 @@ export interface FileValidationOptions {
|
|
|
49
49
|
export interface FileWithValidation {
|
|
50
50
|
file: File;
|
|
51
51
|
validationErrors: FileValidationError[];
|
|
52
|
+
customErrorMessage?: string;
|
|
52
53
|
}
|
|
53
54
|
export interface FileDropAreaBaseConfig extends FileValidationOptions {
|
|
54
55
|
messages: FileValidationMessages;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { FileValidationError, FileValidationMessages } from '../types';
|
|
2
2
|
|
|
3
|
-
export declare const getValidationErrorMessage: (errors: FileValidationError[], messages: FileValidationMessages) => string | null;
|
|
3
|
+
export declare const getValidationErrorMessage: (errors: FileValidationError[], messages: FileValidationMessages, customErrorMessage?: string) => string | null;
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { jsxs as a, Fragment as y, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as B, useId as F, useMemo as S } from "react";
|
|
3
|
+
import { c as w } from "./bind-06a7ff84.js";
|
|
4
|
+
import { K as _ } from "./keyCodes-f63c0e11.js";
|
|
5
|
+
import { B as p } from "./baseIconButton-251479f7.js";
|
|
6
|
+
import { S as V, a as k } from "./plus-0929dda4.js";
|
|
7
|
+
import { FieldLabel as H } from "./fieldLabel.js";
|
|
8
|
+
const P = 5, N = 16, j = [
|
|
9
|
+
_.TAB_KEY_CODE,
|
|
10
|
+
_.BACKSPACE_KEY_CODE,
|
|
11
|
+
_.ARROW_LEFT_KEY_CODE,
|
|
12
|
+
_.ARROW_UP_KEY_CODE,
|
|
13
|
+
_.ARROW_RIGHT_KEY_CODE,
|
|
14
|
+
_.ARROW_DOWN_KEY_CODE,
|
|
15
|
+
_.DELETE_KEY_CODE,
|
|
16
|
+
_.NUM_LOCK_0_KEY_CODE,
|
|
17
|
+
_.NUM_LOCK_1_KEY_CODE,
|
|
18
|
+
_.NUM_LOCK_2_KEY_CODE,
|
|
19
|
+
_.NUM_LOCK_3_KEY_CODE,
|
|
20
|
+
_.NUM_LOCK_4_KEY_CODE,
|
|
21
|
+
_.NUM_LOCK_5_KEY_CODE,
|
|
22
|
+
_.NUM_LOCK_6_KEY_CODE,
|
|
23
|
+
_.NUM_LOCK_7_KEY_CODE,
|
|
24
|
+
_.NUM_LOCK_8_KEY_CODE,
|
|
25
|
+
_.NUM_LOCK_9_KEY_CODE
|
|
26
|
+
], z = "_sign_3v3h5_7", G = "_error_3v3h5_22", X = "_disabled_3v3h5_27", $ = "_input_3v3h5_12", b = {
|
|
27
|
+
"field-number": "_field-number_3v3h5_1",
|
|
28
|
+
sign: z,
|
|
29
|
+
"input-container": "_input-container_3v3h5_12",
|
|
30
|
+
error: G,
|
|
31
|
+
disabled: X,
|
|
32
|
+
"input-field": "_input-field_3v3h5_38",
|
|
33
|
+
input: $,
|
|
34
|
+
"additional-content": "_additional-content_3v3h5_84",
|
|
35
|
+
"error-text": "_error-text_3v3h5_88"
|
|
36
|
+
}, c = w.bind(b), en = ({
|
|
37
|
+
value: i = "",
|
|
38
|
+
placeholder: Y = "0",
|
|
39
|
+
disabled: t = !1,
|
|
40
|
+
onChange: s,
|
|
41
|
+
onFocus: d,
|
|
42
|
+
onBlur: O,
|
|
43
|
+
label: h,
|
|
44
|
+
postfix: o = "",
|
|
45
|
+
min: l = 0,
|
|
46
|
+
max: E = Number.MAX_SAFE_INTEGER,
|
|
47
|
+
title: L,
|
|
48
|
+
error: C,
|
|
49
|
+
id: D,
|
|
50
|
+
...M
|
|
51
|
+
}) => {
|
|
52
|
+
const u = B(null), f = F(), R = (n) => n < l ? l : n > E ? E : n, U = (n) => {
|
|
53
|
+
let e = n.target.value.replace(/^0(?=\d+|^\d)/g, "");
|
|
54
|
+
if (e === "") {
|
|
55
|
+
s("");
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
e = +e, s(e);
|
|
59
|
+
}, A = (n) => {
|
|
60
|
+
const e = +n.currentTarget.value, m = R(e);
|
|
61
|
+
m !== e && s(m), O && O(n);
|
|
62
|
+
}, g = (n) => {
|
|
63
|
+
const { keyCode: e } = n;
|
|
64
|
+
j.includes(e) || (e < _.NUMBER_START_KEY_CODE || e > _.NUMBER_END_KEY_CODE || n.shiftKey) && n.preventDefault();
|
|
65
|
+
}, T = () => {
|
|
66
|
+
const n = +i - 1;
|
|
67
|
+
n >= l && n <= E && s(n);
|
|
68
|
+
}, v = () => {
|
|
69
|
+
const n = +i + 1;
|
|
70
|
+
n >= l && n <= E && s(n);
|
|
71
|
+
}, K = Y + o, I = S(() => {
|
|
72
|
+
let n = (String(i) || K).length;
|
|
73
|
+
return o && !i && (n += 1), n > N ? `${N}ch` : `${n || P}ch`;
|
|
74
|
+
}, [K, o, i]), W = () => {
|
|
75
|
+
u && u.current && u.current.focus(), d && d();
|
|
76
|
+
};
|
|
77
|
+
return /* @__PURE__ */ a(y, { children: [
|
|
78
|
+
/* @__PURE__ */ a("div", { className: c("field-number", { disabled: t }), children: [
|
|
79
|
+
h && /* @__PURE__ */ r(H, { htmlFor: D ?? f, children: h }),
|
|
80
|
+
/* @__PURE__ */ a(
|
|
81
|
+
"div",
|
|
82
|
+
{
|
|
83
|
+
className: c("input-container", {
|
|
84
|
+
error: C,
|
|
85
|
+
disabled: t
|
|
86
|
+
}),
|
|
87
|
+
title: L,
|
|
88
|
+
children: [
|
|
89
|
+
/* @__PURE__ */ r(
|
|
90
|
+
p,
|
|
91
|
+
{
|
|
92
|
+
className: c("sign", "minus"),
|
|
93
|
+
disabled: t,
|
|
94
|
+
onClick: T,
|
|
95
|
+
children: /* @__PURE__ */ r(V, {})
|
|
96
|
+
}
|
|
97
|
+
),
|
|
98
|
+
/* @__PURE__ */ a("span", { className: c("input-field", { disabled: t }), onClick: W, children: [
|
|
99
|
+
/* @__PURE__ */ r(
|
|
100
|
+
"input",
|
|
101
|
+
{
|
|
102
|
+
id: D ?? f,
|
|
103
|
+
ref: u,
|
|
104
|
+
className: c("input"),
|
|
105
|
+
type: "number",
|
|
106
|
+
value: i,
|
|
107
|
+
placeholder: K,
|
|
108
|
+
disabled: t,
|
|
109
|
+
min: l,
|
|
110
|
+
max: E,
|
|
111
|
+
onKeyDown: t ? void 0 : g,
|
|
112
|
+
onChange: t ? void 0 : U,
|
|
113
|
+
onFocus: t ? void 0 : d,
|
|
114
|
+
onBlur: t ? void 0 : A,
|
|
115
|
+
style: { width: I },
|
|
116
|
+
...M
|
|
117
|
+
}
|
|
118
|
+
),
|
|
119
|
+
!!o && (i === 0 || !!i) && /* @__PURE__ */ r("span", { children: o.slice(0, 1) })
|
|
120
|
+
] }),
|
|
121
|
+
/* @__PURE__ */ r(
|
|
122
|
+
p,
|
|
123
|
+
{
|
|
124
|
+
className: c("sign", "plus"),
|
|
125
|
+
disabled: t,
|
|
126
|
+
onClick: v,
|
|
127
|
+
children: /* @__PURE__ */ r(k, {})
|
|
128
|
+
}
|
|
129
|
+
)
|
|
130
|
+
]
|
|
131
|
+
}
|
|
132
|
+
)
|
|
133
|
+
] }),
|
|
134
|
+
C && /* @__PURE__ */ r("div", { className: c("additional-content"), children: /* @__PURE__ */ r("span", { className: c("error-text"), children: C }) })
|
|
135
|
+
] });
|
|
136
|
+
};
|
|
137
|
+
export {
|
|
138
|
+
en as F
|
|
139
|
+
};
|
package/dist/fieldNumber.js
CHANGED