@reportportal/ui-kit 0.0.1-alpha.136 → 0.0.1-alpha.138

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.
@@ -0,0 +1,189 @@
1
+ import { jsx as l, jsxs as g, Fragment as M } from "react/jsx-runtime";
2
+ import { useRef as Z, useState as v, useCallback as m, useMemo as h, useEffect as S } from "react";
3
+ import { c as A } from "./bind-06a7ff84.js";
4
+ import { B as P } from "./button-97d9e587.js";
5
+ import { S as V } from "./close-4d480ef7.js";
6
+ import { i as tt } from "./isEmpty-ccacb5ff.js";
7
+ const et = 3, st = 22, nt = 8, it = 0, at = 100, ot = 20, lt = {
8
+ "tag-list-wrapper": "_tag-list-wrapper_1yg21_16",
9
+ "tag-list-wrapper--show-all-view": "_tag-list-wrapper--show-all-view_1yg21_19",
10
+ "tag-list": "_tag-list_1yg21_16",
11
+ "tag-list--full-width": "_tag-list--full-width_1yg21_31",
12
+ "tag-list--show-all-view": "_tag-list--show-all-view_1yg21_34",
13
+ "tag-list--expanded": "_tag-list--expanded_1yg21_40",
14
+ "tag-list--no-tags": "_tag-list--no-tags_1yg21_45",
15
+ "tag-list__item": "_tag-list__item_1yg21_49",
16
+ "tag-list__item-title": "_tag-list__item-title_1yg21_78",
17
+ "tag-list__item--is-editable": "_tag-list__item--is-editable_1yg21_93",
18
+ "tag-list__item-remove": "_tag-list__item-remove_1yg21_99",
19
+ "tag-list__item--count": "_tag-list__item--count_1yg21_123",
20
+ "tag-list__item--button-show-all-view": "_tag-list__item--button-show-all-view_1yg21_137",
21
+ "tag-list__item--button-wrapper": "_tag-list__item--button-wrapper_1yg21_141",
22
+ "no-tags-message": "_no-tags-message_1yg21_158"
23
+ }, a = A.bind(lt), pt = ({
24
+ tags: C,
25
+ isShowAllView: e = !1,
26
+ defaultVisibleLines: s = et,
27
+ onRemoveTag: c,
28
+ noTagsMessage: R = "No tags added",
29
+ showAllText: I = "Show all",
30
+ hideAllText: H = "Hide all",
31
+ showLessText: O = "Show less"
32
+ }) => {
33
+ const d = Z(null), [E, b] = v(0), [o, $] = v(!1), [j, w] = v(/* @__PURE__ */ new Set()), [B, Y] = v(!1), U = m(
34
+ (t, n) => {
35
+ t.stopPropagation(), c == null || c(n);
36
+ },
37
+ [c]
38
+ ), k = m(() => {
39
+ const t = d.current, n = /* @__PURE__ */ new Set();
40
+ if (!t)
41
+ return;
42
+ const i = [...t.children].filter(
43
+ (r) => !r.classList.contains("tag-list__item--button")
44
+ );
45
+ if (i.length === 0)
46
+ return;
47
+ const p = i[0].offsetTop, x = t.getBoundingClientRect().right;
48
+ let u = 0;
49
+ i.forEach((r, f) => {
50
+ const T = r.getBoundingClientRect(), Q = r.offsetTop !== p, X = T.right > x;
51
+ (Q || X) && (n.add(f), u += 1);
52
+ }), w(n), b(u);
53
+ }, []), D = m(() => {
54
+ const t = d.current, n = /* @__PURE__ */ new Set();
55
+ if (!t || !s)
56
+ return;
57
+ const i = [...t.children].filter(
58
+ (f) => !f.classList.contains("tag-list__item--button")
59
+ );
60
+ if (i.length === 0)
61
+ return;
62
+ const p = i[0].offsetTop, _ = i[0].offsetHeight, x = p + _ * (s - 1);
63
+ let u = 0, r = !1;
64
+ i.forEach((f, T) => {
65
+ f.offsetTop > x + ot && (n.add(T), u += 1, r = !0);
66
+ }), w(n), b(u), Y(r);
67
+ }, [s]), q = h(() => e && s && !o ? {
68
+ maxHeight: `${st * s + nt * (s - 1)}px`,
69
+ overflow: "hidden"
70
+ } : {}, [e, s, o]);
71
+ S(() => {
72
+ if (!d.current)
73
+ return;
74
+ const i = setTimeout(() => {
75
+ e && s ? D() : k();
76
+ }, e && s ? it : at);
77
+ return () => clearTimeout(i);
78
+ }, [
79
+ d,
80
+ e,
81
+ s,
82
+ k,
83
+ D,
84
+ E
85
+ ]);
86
+ const N = m(() => {
87
+ $((t) => !t);
88
+ }, []), z = (t) => {
89
+ t.stopPropagation(), N();
90
+ }, y = m(
91
+ (t) => {
92
+ t.stopPropagation(), N();
93
+ },
94
+ [N]
95
+ ), J = h(() => E > 0 && !o, [E, o]), F = h(
96
+ () => e && s && B && !o,
97
+ [e, s, B, o]
98
+ ), G = h(() => /* @__PURE__ */ l("div", { className: a("tag-list__item--button-wrapper"), children: /* @__PURE__ */ l(
99
+ P,
100
+ {
101
+ className: a("tag-list__item--button", "tag-list__item--button-show-all-view"),
102
+ onClick: y,
103
+ variant: "text",
104
+ children: I
105
+ }
106
+ ) }), [y, I]), W = h(() => /* @__PURE__ */ l("div", { className: a({ "tag-list__item--button-wrapper": e }), children: /* @__PURE__ */ l(
107
+ P,
108
+ {
109
+ className: a("tag-list__item--button", {
110
+ "tag-list__item--button-show-all-view": e && s
111
+ }),
112
+ onClick: y,
113
+ variant: "text",
114
+ children: e && s ? H : O
115
+ }
116
+ ) }), [y, e, s, H, O]), K = m((t, n) => {
117
+ t && (t.scrollWidth > t.clientWidth ? t.setAttribute("title", n) : t.removeAttribute("title"));
118
+ }, []);
119
+ return tt(C) ? /* @__PURE__ */ l("div", { className: a("tag-list-wrapper"), children: /* @__PURE__ */ l("div", { className: a("tag-list", "tag-list--no-tags", "tag-list--full-width"), children: /* @__PURE__ */ l("div", { className: a("no-tags-message"), children: R }) }) }) : /* @__PURE__ */ g("div", { className: a("tag-list-wrapper", { "tag-list-wrapper--show-all-view": e }), children: [
120
+ /* @__PURE__ */ g(
121
+ "div",
122
+ {
123
+ className: a("tag-list", "tag-list--full-width", {
124
+ "tag-list--expanded": o,
125
+ "tag-list--show-all-view": e && !o
126
+ }),
127
+ style: q,
128
+ ref: d,
129
+ children: [
130
+ C.map((t, n) => {
131
+ const i = !o && j.has(n), p = !e && i;
132
+ return /* @__PURE__ */ g(
133
+ "div",
134
+ {
135
+ className: a("tag-list__item", { "tag-list__item--is-editable": !!c }),
136
+ style: {
137
+ display: p ? "none" : "flex"
138
+ },
139
+ children: [
140
+ /* @__PURE__ */ l(
141
+ "div",
142
+ {
143
+ className: a("tag-list__item-title"),
144
+ ref: (_) => K(_, t),
145
+ children: t
146
+ }
147
+ ),
148
+ c && /* @__PURE__ */ l(
149
+ "button",
150
+ {
151
+ type: "button",
152
+ className: a("tag-list__item-remove"),
153
+ onClick: (_) => U(_, t),
154
+ children: /* @__PURE__ */ l(V, {})
155
+ }
156
+ )
157
+ ]
158
+ },
159
+ `${n}-${t}`
160
+ );
161
+ }),
162
+ !e && /* @__PURE__ */ g(M, { children: [
163
+ o && W,
164
+ F && G
165
+ ] })
166
+ ]
167
+ }
168
+ ),
169
+ e && /* @__PURE__ */ g(M, { children: [
170
+ o && W,
171
+ F && G
172
+ ] }),
173
+ J && !e ? /* @__PURE__ */ g(
174
+ "button",
175
+ {
176
+ type: "button",
177
+ className: a("tag-list__item", "tag-list__item--count"),
178
+ onClick: z,
179
+ children: [
180
+ "+",
181
+ E
182
+ ]
183
+ }
184
+ ) : null
185
+ ] });
186
+ };
187
+ export {
188
+ pt as AdaptiveTagList
189
+ };
@@ -0,0 +1,11 @@
1
+ export interface AdaptiveTagListProps {
2
+ tags: string[];
3
+ isShowAllView?: boolean;
4
+ defaultVisibleLines?: number;
5
+ onRemoveTag?: (tag: string) => void;
6
+ noTagsMessage?: string;
7
+ showAllText?: string;
8
+ hideAllText?: string;
9
+ showLessText?: string;
10
+ }
11
+ export declare const AdaptiveTagList: ({ tags, isShowAllView, defaultVisibleLines, onRemoveTag, noTagsMessage, showAllText, hideAllText, showLessText, }: AdaptiveTagListProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,6 @@
1
+ export declare const DEFAULT_VISIBLE_LINES = 3;
2
+ export declare const TAG_LINE_HEIGHT = 22;
3
+ export declare const TAG_GAP_HEIGHT = 8;
4
+ export declare const IMMEDIATE_DELAY = 0;
5
+ export declare const FONT_LOADING_DELAY = 100;
6
+ export declare const OFFSET_TOLERANCE = 20;
@@ -0,0 +1,2 @@
1
+ export { AdaptiveTagList } from './adaptiveTagList';
2
+ export type { AdaptiveTagListProps } from './adaptiveTagList';
@@ -8,3 +8,4 @@ export declare enum EventName {
8
8
  }
9
9
  export declare const SCROLLBARS_AUTO_HEIGHT_MAX = 216;
10
10
  export declare const DROPDOWN_PORTAL_MENU_ATTR = "data-dropdown-portal-menu";
11
+ export declare const DEFAULT_VISIBLE_TAG_LINES = 10;
@@ -51,5 +51,7 @@ export interface DropdownProps {
51
51
  * @example menuPortalRoot={document.body}
52
52
  */
53
53
  menuPortalRoot?: Element;
54
+ /** Whether to render selected values as tags using AdaptiveTagList (only for multiSelect mode) */
55
+ isMultiSelectWithTags?: boolean;
54
56
  }
55
57
  export declare const Dropdown: FC<DropdownProps>;
@@ -1,3 +1,4 @@
1
+ export { AdaptiveTagList } from './adaptiveTagList';
1
2
  export { AttachedFile } from './attachedFile';
2
3
  export { BaseIconButton } from './baseIconButton';
3
4
  export { Breadcrumbs } from './breadcrumbs';
@@ -3,7 +3,7 @@ import B from "react-datepicker/dist/es/index.js";
3
3
  import { c as R } from "./bind-06a7ff84.js";
4
4
  import { useMemo as P, useRef as D } from "react";
5
5
  import { F as I } from "./fieldText-1749da7a.js";
6
- import { D as E } from "./dropdown-360803d5.js";
6
+ import { D as E } from "./dropdown-f33fa0ce.js";
7
7
  import { S as T } from "./calendarArrow-44c7e60e.js";
8
8
  import { registerLocale as j } from "react-datepicker";
9
9
  const ie = (n, s) => {
@@ -1,5 +1,5 @@
1
- import { D as t } from "./datePicker-926c9cae.js";
2
- import { r as z } from "./datePicker-926c9cae.js";
1
+ import { D as t } from "./datePicker-c2925cdd.js";
2
+ import { r as E } from "./datePicker-c2925cdd.js";
3
3
  import "react/jsx-runtime";
4
4
  import "react-datepicker/dist/es/index.js";
5
5
  import "./bind-06a7ff84.js";
@@ -11,7 +11,7 @@ import "./baseIconButton-251479f7.js";
11
11
  import "./spinLoader-c4a53718.js";
12
12
  import "./maxValueDisplay-9be01a75.js";
13
13
  import "./fieldLabel.js";
14
- import "./dropdown-360803d5.js";
14
+ import "./dropdown-f33fa0ce.js";
15
15
  import "react-dom";
16
16
  import "@floating-ui/react-dom";
17
17
  import "downshift";
@@ -21,11 +21,15 @@ import "./dropdown-0260bb66.js";
21
21
  import "./tooltip.js";
22
22
  import "@floating-ui/react";
23
23
  import "./floatingUi-41f8c7b5.js";
24
+ import "./adaptiveTagList.js";
25
+ import "./button-97d9e587.js";
26
+ import "./close-4d480ef7.js";
27
+ import "./isEmpty-ccacb5ff.js";
24
28
  import "./checkbox-ed6cc375.js";
25
29
  import "./calendarArrow-44c7e60e.js";
26
30
  import "react-datepicker";
27
31
  export {
28
32
  t as DatePicker,
29
33
  t as default,
30
- z as registerDatePickerLocale
34
+ E as registerDatePickerLocale
31
35
  };