@reportportal/ui-kit 0.0.1-alpha.106 → 0.0.1-alpha.108

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 (45) hide show
  1. package/dist/attachedFile.js +1 -1
  2. package/dist/autocompletes.js +694 -0
  3. package/dist/components/autocompletes/common/autocompleteMenu/autocompleteMenu.d.ts +9 -0
  4. package/dist/components/autocompletes/common/autocompleteMenu/index.d.ts +1 -0
  5. package/dist/components/autocompletes/common/autocompleteOption/autocompleteOption.d.ts +13 -0
  6. package/dist/components/autocompletes/common/autocompleteOption/index.d.ts +1 -0
  7. package/dist/components/autocompletes/common/autocompleteOptions.d.ts +19 -0
  8. package/dist/components/autocompletes/common/autocompletePrompt/autocompletePrompt.d.ts +7 -0
  9. package/dist/components/autocompletes/common/autocompletePrompt/index.d.ts +1 -0
  10. package/dist/components/autocompletes/common/index.d.ts +19 -0
  11. package/dist/components/autocompletes/constants.d.ts +2 -0
  12. package/dist/components/autocompletes/index.d.ts +3 -0
  13. package/dist/components/autocompletes/multipleAutocomplete/index.d.ts +17 -0
  14. package/dist/components/autocompletes/multipleAutocomplete/multipleAutocomplete.d.ts +46 -0
  15. package/dist/components/autocompletes/multipleAutocomplete/multipleDownshift.d.ts +25 -0
  16. package/dist/components/autocompletes/multipleAutocomplete/selectedItems/index.d.ts +1 -0
  17. package/dist/components/autocompletes/multipleAutocomplete/selectedItems/selectedItems.d.ts +35 -0
  18. package/dist/components/autocompletes/singleAutocomplete/index.d.ts +1 -0
  19. package/dist/components/autocompletes/singleAutocomplete/singleAutocomplete.d.ts +40 -0
  20. package/dist/components/autocompletes/types.d.ts +8 -0
  21. package/dist/components/autocompletes/utils.d.ts +5 -0
  22. package/dist/components/button/button.d.ts +1 -1
  23. package/dist/components/fieldText/fieldText.d.ts +2 -2
  24. package/dist/components/fieldTextFlex/fieldTextFlex.d.ts +2 -1
  25. package/dist/components/fileDropArea/index.d.ts +3 -3
  26. package/dist/components/icons/index.d.ts +4 -0
  27. package/dist/components/index.d.ts +4 -1
  28. package/dist/components/sidePanel/index.d.ts +2 -0
  29. package/dist/components/sidePanel/sidePanel.d.ts +17 -0
  30. package/dist/{fieldNumber-1fa248f5.js → fieldNumber-d1b5a7a1.js} +15 -14
  31. package/dist/fieldNumber.js +3 -2
  32. package/dist/fieldTextFlex-2f51c173.js +80 -0
  33. package/dist/fieldTextFlex.js +1 -1
  34. package/dist/fileDropArea.js +135 -168
  35. package/dist/icons.js +65 -60
  36. package/dist/{index-803576c3.js → index-1a874a8b.js} +1 -1
  37. package/dist/index.js +126 -116
  38. package/dist/isEmpty-ccacb5ff.js +38 -0
  39. package/dist/minus-2857540f.js +5 -0
  40. package/dist/plus-199fb2a8.js +5 -0
  41. package/dist/sidePanel.js +74 -0
  42. package/dist/style.css +1 -1
  43. package/package.json +13 -1
  44. package/dist/fieldTextFlex-8afaab31.js +0 -78
  45. package/dist/plus-0929dda4.js +0 -6
@@ -1,47 +1,13 @@
1
- import { jsx as f, jsxs as F } from "react/jsx-runtime";
2
- import { c as E } from "./bind-06a7ff84.js";
3
- import { useState as C, useCallback as d, useRef as A, createContext as L, useMemo as z, useContext as M, useEffect as k } from "react";
4
- import { g as B, A as S } from "./index-803576c3.js";
5
- import { B as P } from "./button-97d9e587.js";
6
- import w from "react-dropzone";
1
+ import { jsx as _, jsxs as F } from "react/jsx-runtime";
2
+ import { c as h } from "./bind-06a7ff84.js";
3
+ import { useState as I, useCallback as d, useRef as A, createContext as L, useMemo as M, useContext as j, useEffect as k } from "react";
4
+ import { g as B, A as P } from "./index-1a874a8b.js";
5
+ import { i as v } from "./isEmpty-ccacb5ff.js";
6
+ import { B as S } from "./button-97d9e587.js";
7
+ import Z from "react-dropzone";
7
8
  import "./close-4d480ef7.js";
8
9
  import "./xls-995781cc.js";
9
- function Z(e) {
10
- return Number.isSafeInteger(e) && e >= 0;
11
- }
12
- function U(e) {
13
- return e != null && typeof e != "function" && Z(e.length);
14
- }
15
- function V(e) {
16
- return e == null ? e === void 0 ? "[object Undefined]" : "[object Null]" : Object.prototype.toString.call(e);
17
- }
18
- function $(e) {
19
- return ArrayBuffer.isView(e) && !(e instanceof DataView);
20
- }
21
- function W(e) {
22
- return e !== null && typeof e == "object" && V(e) === "[object Arguments]";
23
- }
24
- function X(e) {
25
- const r = e == null ? void 0 : e.constructor, t = typeof r == "function" ? r.prototype : Object.prototype;
26
- return e === t;
27
- }
28
- function q(e) {
29
- return $(e);
30
- }
31
- function g(e) {
32
- if (e == null)
33
- return !0;
34
- if (U(e))
35
- return typeof e.splice != "function" && typeof e != "string" && (typeof Buffer > "u" || !Buffer.isBuffer(e)) && !q(e) && !W(e) ? !1 : e.length === 0;
36
- if (typeof e == "object") {
37
- if (e instanceof Map || e instanceof Set)
38
- return e.size === 0;
39
- const r = Object.keys(e);
40
- return X(e) ? r.filter((t) => t !== "constructor").length === 0 : r.length === 0;
41
- }
42
- return !0;
43
- }
44
- const ge = {
10
+ const pe = {
45
11
  png: "image/png",
46
12
  jpeg: "image/jpeg",
47
13
  gif: "image/gif",
@@ -76,38 +42,38 @@ const ge = {
76
42
  gtar: "application/x-gtar",
77
43
  kml: "application/vnd.google-earth.kml+xml"
78
44
  };
79
- var h = /* @__PURE__ */ ((e) => (e.INCORRECT_FILE_SIZE = "INCORRECT_FILE_SIZE", e.INCORRECT_FILE_FORMAT = "INCORRECT_FILE_FORMAT", e))(h || {});
80
- const Y = (e, r) => {
81
- const { maxFileSize: t, acceptFileMimeTypes: o = [] } = r, a = [];
82
- if (t && e.size > t && a.push(h.INCORRECT_FILE_SIZE), !g(o)) {
45
+ var g = /* @__PURE__ */ ((e) => (e.INCORRECT_FILE_SIZE = "INCORRECT_FILE_SIZE", e.INCORRECT_FILE_FORMAT = "INCORRECT_FILE_FORMAT", e))(g || {});
46
+ const w = (e, a) => {
47
+ const { maxFileSize: r, acceptFileMimeTypes: o = [] } = a, n = [];
48
+ if (r && e.size > r && n.push(g.INCORRECT_FILE_SIZE), !v(o)) {
83
49
  const s = B(e.name);
84
50
  o.some(
85
51
  (c) => c.startsWith(".") ? s === c.slice(1) : e.type === c
86
- ) || a.push(h.INCORRECT_FILE_FORMAT);
52
+ ) || n.push(g.INCORRECT_FILE_FORMAT);
87
53
  }
88
- return a;
89
- }, I = (e, r, t) => t || (g(e) ? null : {
90
- [h.INCORRECT_FILE_SIZE]: r.incorrectFileSize,
91
- [h.INCORRECT_FILE_FORMAT]: r.incorrectFileFormat
92
- }[e[0]]), G = 128, b = G * 1024 * 1024, H = ({
93
- maxFileSize: e = b,
94
- acceptFileMimeTypes: r = [],
95
- onFilesAdded: t
54
+ return n;
55
+ }, R = (e, a, r) => r || (v(e) ? null : {
56
+ [g.INCORRECT_FILE_SIZE]: a.incorrectFileSize,
57
+ [g.INCORRECT_FILE_FORMAT]: a.incorrectFileFormat
58
+ }[e[0]]), U = 128, N = U * 1024 * 1024, V = ({
59
+ maxFileSize: e = N,
60
+ acceptFileMimeTypes: a = [],
61
+ onFilesAdded: r
96
62
  }) => {
97
- const [o, a] = C(null), s = d(
63
+ const [o, n] = I(null), s = d(
98
64
  (i) => {
99
- a(null);
100
- const p = i.map((_) => ({
101
- file: _,
102
- validationErrors: Y(_, { maxFileSize: e, acceptFileMimeTypes: r })
65
+ n(null);
66
+ const p = i.map((f) => ({
67
+ file: f,
68
+ validationErrors: w(f, { maxFileSize: e, acceptFileMimeTypes: a })
103
69
  }));
104
- t(p);
70
+ r(p);
105
71
  const m = p.find(
106
- ({ validationErrors: _ }) => !g(_)
72
+ ({ validationErrors: f }) => !v(f)
107
73
  );
108
- m && a(m.validationErrors[0]);
74
+ m && n(m.validationErrors[0]);
109
75
  },
110
- [e, r, t]
76
+ [e, a, r]
111
77
  ), l = d(
112
78
  (i) => {
113
79
  s(i);
@@ -119,24 +85,24 @@ const Y = (e, r) => {
119
85
  p && s([...p]), i.currentTarget.value = "";
120
86
  },
121
87
  [s]
122
- ), n = d(() => {
123
- a(null);
88
+ ), t = d(() => {
89
+ n(null);
124
90
  }, []);
125
91
  return {
126
92
  error: o,
127
93
  handleFileInputChange: c,
128
- clearError: n,
94
+ clearError: t,
129
95
  onDrop: l
130
96
  };
131
- }, J = ({
132
- maxFileSize: e = b,
133
- acceptFileMimeTypes: r = [],
134
- onFilesAdded: t
97
+ }, W = ({
98
+ maxFileSize: e = N,
99
+ acceptFileMimeTypes: a = [],
100
+ onFilesAdded: r
135
101
  }) => {
136
- const { onDrop: o, handleFileInputChange: a, error: s, clearError: l } = H({
102
+ const { onDrop: o, handleFileInputChange: n, error: s, clearError: l } = V({
137
103
  maxFileSize: e,
138
- acceptFileMimeTypes: r,
139
- onFilesAdded: t
104
+ acceptFileMimeTypes: a,
105
+ onFilesAdded: r
140
106
  }), c = d(() => {
141
107
  l();
142
108
  }, [l]);
@@ -144,67 +110,67 @@ const Y = (e, r) => {
144
110
  error: s,
145
111
  onDrop: o,
146
112
  handleDropzoneClick: c,
147
- handleFileInputChange: a,
113
+ handleFileInputChange: n,
148
114
  clearError: l
149
115
  };
150
- }, K = ({ isOverlay: e = !1 }) => {
151
- const [r, t] = C(!1), o = A(null), a = d((i) => {
116
+ }, $ = ({ isOverlay: e = !1 }) => {
117
+ const [a, r] = I(!1), o = A(null), n = d((i) => {
152
118
  var p;
153
- i.preventDefault(), (p = i.dataTransfer) != null && p.types.includes("Files") && t(!0);
119
+ i.preventDefault(), (p = i.dataTransfer) != null && p.types.includes("Files") && r(!0);
154
120
  }, []), s = d((i) => {
155
- i.preventDefault(), o.current && !o.current.contains(i.relatedTarget) && t(!1);
121
+ i.preventDefault(), o.current && !o.current.contains(i.relatedTarget) && r(!1);
156
122
  }, []), l = d((i) => {
157
123
  i.preventDefault();
158
124
  }, []), c = d((i) => {
159
- i.preventDefault(), t(!1);
125
+ i.preventDefault(), r(!1);
160
126
  }, []);
161
127
  return {
162
128
  handlers: e ? {
163
129
  ref: o,
164
- onDragEnter: a,
130
+ onDragEnter: n,
165
131
  onDragLeave: s,
166
132
  onDragOver: l,
167
133
  onDrop: c
168
134
  } : {},
169
- ...e && { isDragActive: r }
135
+ ...e && { isDragActive: a }
170
136
  };
171
- }, y = L(null);
172
- y.displayName = "FileDropAreaContext";
173
- const Q = ({
137
+ }, C = L(null);
138
+ C.displayName = "FileDropAreaContext";
139
+ const X = ({
174
140
  children: e,
175
- ...r
141
+ ...a
176
142
  }) => {
177
- const t = A(null), o = d((l) => {
178
- t.current = l;
179
- }, []), a = d(() => {
180
- r.isDisabled || !t.current || (r.clearError(), t.current());
181
- }, [r]), s = z(
182
- () => ({ ...r, registerOpenFunction: o, openFileDialog: a }),
183
- [r, o, a]
143
+ const r = A(null), o = d((l) => {
144
+ r.current = l;
145
+ }, []), n = d(() => {
146
+ a.isDisabled || !r.current || (a.clearError(), r.current());
147
+ }, [a]), s = M(
148
+ () => ({ ...a, registerOpenFunction: o, openFileDialog: n }),
149
+ [a, o, n]
184
150
  );
185
- return /* @__PURE__ */ f(y.Provider, { value: s, children: e });
186
- }, v = () => {
187
- const e = M(y);
151
+ return /* @__PURE__ */ _(C.Provider, { value: s, children: e });
152
+ }, E = () => {
153
+ const e = j(C);
188
154
  if (!e)
189
155
  throw new Error("useFileDropAreaContext must be used within a FileDropAreaProvider");
190
156
  return e;
191
- }, ee = ({
157
+ }, q = ({
192
158
  children: e,
193
- className: r,
194
- variant: t = "text",
159
+ className: a,
160
+ variant: r = "text",
195
161
  ...o
196
162
  }) => {
197
- const { openFileDialog: a, isDisabled: s } = v();
198
- return /* @__PURE__ */ f(
199
- P,
163
+ const { openFileDialog: n, isDisabled: s } = E();
164
+ return /* @__PURE__ */ _(
165
+ S,
200
166
  {
201
167
  ...o,
202
- variant: t,
168
+ variant: r,
203
169
  adjustWidthOn: "content",
204
170
  disabled: s,
205
- className: r,
171
+ className: a,
206
172
  onClick: (c) => {
207
- c.stopPropagation(), a();
173
+ c.stopPropagation(), n();
208
174
  },
209
175
  children: e
210
176
  }
@@ -224,135 +190,136 @@ const Q = ({
224
190
  "file-drop-area__error-message": "_file-drop-area__error-message_1s34r_83",
225
191
  "file-drop-area--overlay": "_file-drop-area--overlay_1s34r_89",
226
192
  "file-drop-area--overlay-mode": "_file-drop-area--overlay-mode_1s34r_107"
227
- }, re = E.bind(D), te = ({ className: e }) => {
228
- const { error: r, messages: t } = v();
229
- return r ? /* @__PURE__ */ f(
193
+ }, Y = h.bind(D), G = ({ className: e }) => {
194
+ const { error: a, messages: r } = E();
195
+ return a ? /* @__PURE__ */ _(
230
196
  "div",
231
197
  {
232
- className: re("file-drop-area__error-message", e),
198
+ className: Y("file-drop-area__error-message", e),
233
199
  role: "alert",
234
200
  "aria-live": "assertive",
235
201
  "aria-atomic": "true",
236
- children: I([r], t) || r
202
+ children: R([a], r) || a
237
203
  }
238
204
  ) : null;
239
- }, u = E.bind(D), oe = ({ icon: e, description: r, fileSizeMessage: t, className: o }) => {
205
+ }, u = h.bind(D), H = ({ icon: e, description: a, fileSizeMessage: r, className: o }) => {
240
206
  const {
241
- variant: a = "default",
207
+ variant: n = "default",
242
208
  error: s,
243
209
  isDisabled: l,
244
210
  isMultipleFiles: c,
245
- overlayProps: n,
211
+ overlayProps: t,
246
212
  onDrop: i,
247
213
  handleDropzoneClick: p,
248
214
  registerOpenFunction: m
249
- } = v(), _ = a === "overlay";
250
- return /* @__PURE__ */ f(w, { multiple: c, disabled: l, noClick: _, onDrop: i, children: ({ getRootProps: R, getInputProps: T, isDragActive: N, open: O }) => {
251
- m(O);
252
- const j = _ ? !!(n != null && n.isDragActive) : N;
215
+ } = E(), f = n === "overlay";
216
+ return /* @__PURE__ */ _(Z, { multiple: c, disabled: l, noClick: f, onDrop: i, children: ({ getRootProps: T, getInputProps: b, isDragActive: O, open: y }) => {
217
+ m(y);
218
+ const z = f ? !!(t != null && t.isDragActive) : O;
253
219
  return /* @__PURE__ */ F(
254
220
  "div",
255
221
  {
256
- ...R({
222
+ ...T({
257
223
  className: u("file-drop-area", o, {
258
- "file-drop-area--active": j,
224
+ "file-drop-area--active": z,
259
225
  "file-drop-area--disabled": l,
260
226
  "file-drop-area--error": !!s,
261
- "file-drop-area--overlay-mode": _
227
+ "file-drop-area--overlay-mode": f
262
228
  }),
263
- onClick: _ ? void 0 : p
229
+ onClick: f ? void 0 : p
264
230
  }),
265
231
  children: [
266
- /* @__PURE__ */ f("input", { ...T() }),
232
+ /* @__PURE__ */ _("input", { ...b() }),
267
233
  /* @__PURE__ */ F("div", { className: u("file-drop-area__content"), children: [
268
- /* @__PURE__ */ f("div", { className: u("file-drop-area__icon"), children: e }),
234
+ /* @__PURE__ */ _("div", { className: u("file-drop-area__icon"), children: e }),
269
235
  /* @__PURE__ */ F("div", { className: u("file-drop-area__text"), children: [
270
- r && /* @__PURE__ */ f("div", { className: u("file-drop-area__description"), children: r }),
271
- t && /* @__PURE__ */ f("div", { className: u("file-drop-area__file-size-info"), children: t })
236
+ a && /* @__PURE__ */ _("div", { className: u("file-drop-area__description"), children: a }),
237
+ r && /* @__PURE__ */ _("div", { className: u("file-drop-area__file-size-info"), children: r })
272
238
  ] })
273
239
  ] })
274
240
  ]
275
241
  }
276
242
  );
277
243
  } });
278
- }, ie = {
244
+ }, J = {
279
245
  "attached-files-list": "_attached-files-list_14nn3_16"
280
- }, ne = E.bind(ie), ae = ({
246
+ }, K = h.bind(J), Q = ({
281
247
  files: e,
282
- className: r,
283
- onRemoveFile: t,
248
+ className: a,
249
+ onRemoveFile: r,
284
250
  onDownloadFile: o
285
251
  }) => {
286
- const { messages: a, clearError: s } = v();
252
+ const { messages: n, clearError: s } = E();
287
253
  k(() => {
288
- e.some((i) => !g(i.validationErrors)) && s();
254
+ e.some((i) => !v(i.validationErrors)) && s();
289
255
  }, [e, s]);
290
256
  const l = d(
291
- (n) => () => t(n.id),
292
- [t]
257
+ (t) => () => r(t.id),
258
+ [r]
293
259
  ), c = d(
294
- (n) => () => o == null ? void 0 : o(n),
260
+ (t) => () => o == null ? void 0 : o(t),
295
261
  [o]
296
262
  );
297
- return g(e) ? null : /* @__PURE__ */ f("div", { className: ne("attached-files-list", r), children: e.map((n) => {
298
- const i = I(
299
- n.validationErrors ?? [],
300
- a,
301
- n.customErrorMessage
263
+ return v(e) ? null : /* @__PURE__ */ _("div", { className: K("attached-files-list", a), children: e.map((t) => {
264
+ const i = R(
265
+ t.validationErrors ?? [],
266
+ n,
267
+ t.customErrorMessage
302
268
  );
303
- return /* @__PURE__ */ f(
304
- S,
269
+ return /* @__PURE__ */ _(
270
+ P,
305
271
  {
306
- fileName: n.fileName,
307
- size: n.size,
308
- uploadingProgress: n.uploadingProgress,
309
- isUploadFailed: n.isUploadFailed || !!i,
310
- isUploading: n.isUploading,
311
- onRemove: l(n),
272
+ fileName: t.fileName,
273
+ size: t.size,
274
+ uploadingProgress: t.uploadingProgress,
275
+ isUploadFailed: t.isUploadFailed || !!i,
276
+ isUploading: t.isUploading,
277
+ onRemove: l(t),
312
278
  ...i && { uploadFailedMessage: i },
313
- ...o && { onDownload: c(n) }
279
+ ...o && { onDownload: c(t) }
314
280
  },
315
- n.id
281
+ t.id
316
282
  );
317
283
  }) });
318
- }, se = E.bind(D), x = ({
284
+ }, ee = h.bind(D), x = ({
319
285
  maxFileSize: e,
320
- acceptFileMimeTypes: r,
321
- isMultipleFiles: t,
286
+ acceptFileMimeTypes: a,
287
+ isMultipleFiles: r,
322
288
  isDisabled: o,
323
- variant: a = "default",
289
+ variant: n = "default",
324
290
  children: s,
325
291
  messages: l,
326
292
  onFilesAdded: c
327
293
  }) => {
328
- const n = a === "overlay", i = J({
294
+ const t = n === "overlay", i = W({
329
295
  maxFileSize: e,
330
- acceptFileMimeTypes: r,
296
+ acceptFileMimeTypes: a,
331
297
  messages: l,
332
- isMultipleFiles: t,
298
+ isMultipleFiles: r,
333
299
  isDisabled: o,
334
300
  onFilesAdded: c
335
- }), p = K({
336
- isOverlay: n
301
+ }), p = $({
302
+ isOverlay: t
337
303
  });
338
- return /* @__PURE__ */ f(
339
- Q,
304
+ return /* @__PURE__ */ _(
305
+ X,
340
306
  {
341
307
  ...i,
342
- variant: a,
308
+ variant: n,
343
309
  messages: l,
344
310
  overlayProps: p,
345
311
  isDisabled: o,
346
- isMultipleFiles: t,
347
- children: (() => n ? /* @__PURE__ */ f("div", { className: se("file-drop-area--overlay"), ...p.handlers, children: s }) : s)()
312
+ isMultipleFiles: r,
313
+ children: (() => t ? /* @__PURE__ */ _("div", { className: ee("file-drop-area--overlay"), ...p.handlers, children: s }) : s)()
348
314
  }
349
315
  );
350
316
  };
351
- x.DropZone = oe;
352
- x.BrowseButton = ee;
353
- x.Error = te;
354
- x.AttachedFilesList = ae;
317
+ x.DropZone = H;
318
+ x.BrowseButton = q;
319
+ x.Error = G;
320
+ x.AttachedFilesList = Q;
355
321
  export {
356
322
  x as FileDropArea,
357
- ge as MIME_TYPES
323
+ g as FileValidationError,
324
+ pe as MIME_TYPES
358
325
  };