@reportportal/ui-kit 0.0.1-alpha.166 → 0.0.1-alpha.167

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/bulkPanel.js CHANGED
@@ -1,5 +1,5 @@
1
- import { jsx as n, jsxs as s, Fragment as y } from "react/jsx-runtime";
2
- import { useState as k, useRef as q, useMemo as P, useCallback as b, useEffect as z } from "react";
1
+ import { jsx as n, jsxs as a, Fragment as y } from "react/jsx-runtime";
2
+ import { useState as k, useRef as z, useMemo as P, useCallback as b, useEffect as A } from "react";
3
3
  import { createPortal as H } from "react-dom";
4
4
  import { c as J } from "./bind-06a7ff84.js";
5
5
  import { Scrollbars as Q } from "rc-scrollbars";
@@ -16,11 +16,11 @@ import { S as ie } from "./warning-537ead32.js";
16
16
  import "./close-4d480ef7.js";
17
17
  import "@floating-ui/react";
18
18
  import "./floatingUi-41f8c7b5.js";
19
- const ae = "_expanded_ue1t9_6", se = "_header_ue1t9_32", oe = "_tabs_ue1t9_119", ce = "_tab_ue1t9_119", re = "_active_ue1t9_146", de = "_item_ue1t9_99", me = {
19
+ const se = "_expanded_ue1t9_6", ae = "_header_ue1t9_32", oe = "_tabs_ue1t9_119", ce = "_tab_ue1t9_119", re = "_active_ue1t9_146", de = "_item_ue1t9_99", me = {
20
20
  "bulk-panel": "_bulk-panel_ue1t9_1",
21
- expanded: ae,
21
+ expanded: se,
22
22
  "panel-content": "_panel-content_ue1t9_16",
23
- header: se,
23
+ header: ae,
24
24
  "header-actions": "_header-actions_ue1t9_43",
25
25
  "warning-icon": "_warning-icon_ue1t9_49",
26
26
  "info-message-container": "_info-message-container_ue1t9_58",
@@ -43,18 +43,18 @@ const ae = "_expanded_ue1t9_6", se = "_header_ue1t9_32", oe = "_tabs_ue1t9_119",
43
43
  selectedItems: "Selected items",
44
44
  eligibleTab: "Eligible Items",
45
45
  ineligibleTab: "Ineligible Items",
46
- ineligibleInfoMessage: (t) => /* @__PURE__ */ s(y, { children: [
46
+ ineligibleInfoMessage: (i) => /* @__PURE__ */ a(y, { children: [
47
47
  "You have ",
48
- /* @__PURE__ */ n("b", { children: t }),
48
+ /* @__PURE__ */ n("b", { children: i }),
49
49
  " ineligible items"
50
50
  ] }),
51
- cancelButton: (t) => `Cancel "${t}"`,
52
- proceedButton: (t) => `Proceed with ${t} Eligible Items`
51
+ cancelButton: (i) => `Cancel "${i}"`,
52
+ proceedButton: (i) => `Proceed with ${i} Eligible Items`
53
53
  }, p = {
54
54
  ELIGIBLE: "eligible",
55
55
  INELIGIBLE: "ineligible"
56
56
  }, Ge = ({
57
- items: t,
57
+ items: i,
58
58
  actions: D = [],
59
59
  captions: K,
60
60
  infoMessage: x,
@@ -63,15 +63,15 @@ const ae = "_expanded_ue1t9_6", se = "_header_ue1t9_32", oe = "_tabs_ue1t9_119",
63
63
  onRemoveItem: w,
64
64
  onClearSelection: O
65
65
  }) => {
66
- const c = { ...pe, ...K }, [o, _] = k(!1), [I, v] = k(p.INELIGIBLE), [i, C] = k(null), S = q(null), r = i !== null, { eligibleItems: u, ineligibleItems: h } = P(() => {
66
+ const c = { ...pe, ...K }, [o, _] = k(!1), [I, v] = k(p.INELIGIBLE), [t, C] = k(null), S = z(null), r = t !== null, { eligibleItems: u, ineligibleItems: h } = P(() => {
67
67
  var g;
68
- if (!i)
68
+ if (!t)
69
69
  return { eligibleItems: [], ineligibleItems: [] };
70
- const e = ((g = i.onValidate) == null ? void 0 : g.call(i, t)) ?? [], a = new Set(e.map((L) => L.id));
71
- return { eligibleItems: t.filter((L) => !a.has(L.id)), ineligibleItems: e };
72
- }, [t, i]), d = u.length, m = h.length, $ = r && d > 0, T = r && m > 0 ? c.ineligibleInfoMessage(m) : null, V = P(() => r ? m === 0 ? u : d === 0 ? h : I === p.ELIGIBLE ? u : h : t, [
70
+ const e = ((g = t.onValidate) == null ? void 0 : g.call(t, i)) ?? [], s = new Set(e.map((L) => L.id));
71
+ return { eligibleItems: i.filter((L) => !s.has(L.id)), ineligibleItems: e };
72
+ }, [i, t]), d = u.length, m = h.length, $ = r && d > 0, T = r && m > 0 ? c.ineligibleInfoMessage(m) : null, V = P(() => r ? m === 0 ? u : d === 0 ? h : I === p.ELIGIBLE ? u : h : i, [
73
73
  r,
74
- t,
74
+ i,
75
75
  u,
76
76
  h,
77
77
  I,
@@ -80,38 +80,39 @@ const ae = "_expanded_ue1t9_6", se = "_header_ue1t9_32", oe = "_tabs_ue1t9_119",
80
80
  ]), j = b(
81
81
  (e) => {
82
82
  var N, g;
83
- (N = e.onClick) == null || N.call(e), (((g = e.onValidate) == null ? void 0 : g.call(e, t)) ?? []).length === 0 ? e.onProceed(t, !0) : (C(e), v(p.INELIGIBLE), _(!0));
83
+ (N = e.onClick) == null || N.call(e), (((g = e.onValidate) == null ? void 0 : g.call(e, i)) ?? []).length === 0 ? e.onProceed(i, !0) : (C(e), v(p.INELIGIBLE), _(!0));
84
84
  },
85
- [t]
86
- ), A = b(() => {
87
- C(null), _(!1);
88
- }, []), F = b(() => {
89
- i == null || i.onProceed(u), C(null), _(!1);
90
- }, [i, u]), E = b(() => {
85
+ [i]
86
+ ), F = b(() => {
87
+ const e = t == null ? void 0 : t.onCancel;
88
+ C(null), _(!1), e == null || e();
89
+ }, [t]), W = b(() => {
90
+ t == null || t.onProceed(u), C(null), _(!1);
91
+ }, [t, u]), E = b(() => {
91
92
  _(!1);
92
- }, []), W = b(() => {
93
+ }, []), Y = b(() => {
93
94
  _((e) => !e);
94
- }, []), Y = b(
95
+ }, []), R = b(
95
96
  (e) => {
96
97
  w(e);
97
98
  },
98
99
  [w]
99
100
  );
100
- if (z(() => {
101
+ if (A(() => {
101
102
  if (!o)
102
103
  return;
103
- const e = (a) => {
104
- a.keyCode === Z.ESCAPE_KEY_CODE && E();
104
+ const e = (s) => {
105
+ s.keyCode === Z.ESCAPE_KEY_CODE && E();
105
106
  };
106
107
  return document.addEventListener("keydown", e, !1), () => document.removeEventListener("keydown", e, !1);
107
- }, [o, E]), X(S, o ? E : void 0), t.length === 0)
108
+ }, [o, E]), X(S, o ? E : void 0), i.length === 0)
108
109
  return null;
109
- const R = (e) => h.some((a) => a.id === e.id), U = (e) => {
110
- const a = /* @__PURE__ */ n(
110
+ const U = (e) => h.some((s) => s.id === e.id), q = (e) => {
111
+ const s = /* @__PURE__ */ n(
111
112
  ne,
112
113
  {
113
- onRemove: () => Y(e.id),
114
- variant: R(e) && r ? "error" : "default",
114
+ onRemove: () => R(e.id),
115
+ variant: U(e) && r ? "error" : "default",
115
116
  children: e.label ?? e.name
116
117
  },
117
118
  e.id
@@ -124,23 +125,23 @@ const ae = "_expanded_ue1t9_6", se = "_header_ue1t9_32", oe = "_tabs_ue1t9_119",
124
125
  placement: "top",
125
126
  width: 270,
126
127
  portalRoot: f,
127
- children: a
128
+ children: s
128
129
  },
129
130
  e.id
130
- ) : a }, e.id);
131
+ ) : s }, e.id);
131
132
  }, G = /* @__PURE__ */ n(
132
133
  "div",
133
134
  {
134
135
  className: l("bulk-panel", { expanded: o }, M),
135
136
  role: "region",
136
137
  "aria-label": "Bulk actions panel",
137
- children: /* @__PURE__ */ s("div", { className: l("panel-content", { expanded: o }), ref: S, children: [
138
- /* @__PURE__ */ s("div", { className: l("header"), children: [
139
- /* @__PURE__ */ s("div", { className: l("selection-info"), children: [
138
+ children: /* @__PURE__ */ a("div", { className: l("panel-content", { expanded: o }), ref: S, children: [
139
+ /* @__PURE__ */ a("div", { className: l("header"), children: [
140
+ /* @__PURE__ */ a("div", { className: l("selection-info"), children: [
140
141
  /* @__PURE__ */ n(
141
142
  "button",
142
143
  {
143
- onClick: W,
144
+ onClick: Y,
144
145
  "aria-label": o ? "Collapse panel" : "Expand panel",
145
146
  "aria-expanded": o,
146
147
  children: /* @__PURE__ */ n("span", { className: l("expand-icon", { expanded: o }), children: /* @__PURE__ */ n(te, {}) })
@@ -149,7 +150,7 @@ const ae = "_expanded_ue1t9_6", se = "_header_ue1t9_32", oe = "_tabs_ue1t9_119",
149
150
  /* @__PURE__ */ n(
150
151
  ee,
151
152
  {
152
- selectedCount: t.length,
153
+ selectedCount: i.length,
153
154
  onClearSelection: O,
154
155
  captions: {
155
156
  selected: c.selected,
@@ -158,15 +159,15 @@ const ae = "_expanded_ue1t9_6", se = "_header_ue1t9_32", oe = "_tabs_ue1t9_119",
158
159
  }
159
160
  )
160
161
  ] }),
161
- /* @__PURE__ */ s("div", { className: l("header-actions"), children: [
162
- (T || x) && /* @__PURE__ */ s("div", { className: l("info-message-container"), children: [
162
+ /* @__PURE__ */ a("div", { className: l("header-actions"), children: [
163
+ (T || x) && /* @__PURE__ */ a("div", { className: l("info-message-container"), children: [
163
164
  /* @__PURE__ */ n("i", { className: l("warning-icon"), children: /* @__PURE__ */ n(ie, {}) }),
164
165
  /* @__PURE__ */ n("div", { className: l("info-message"), children: T || x })
165
166
  ] }),
166
- /* @__PURE__ */ n("div", { className: l("buttons-container"), children: r ? /* @__PURE__ */ s(y, { children: [
167
- /* @__PURE__ */ n(B, { variant: "ghost", onClick: A, children: c.cancelButton((i == null ? void 0 : i.label) ?? "") }),
168
- $ && /* @__PURE__ */ n(B, { variant: "primary", onClick: F, children: c.proceedButton(d) })
169
- ] }) : D.map((e, a) => /* @__PURE__ */ n(
167
+ /* @__PURE__ */ n("div", { className: l("buttons-container"), children: r ? /* @__PURE__ */ a(y, { children: [
168
+ /* @__PURE__ */ n(B, { variant: "ghost", onClick: F, children: c.cancelButton((t == null ? void 0 : t.label) ?? "") }),
169
+ $ && /* @__PURE__ */ n(B, { variant: "primary", onClick: W, children: c.proceedButton(d) })
170
+ ] }) : D.map((e, s) => /* @__PURE__ */ n(
170
171
  B,
171
172
  {
172
173
  variant: e.variant,
@@ -174,13 +175,13 @@ const ae = "_expanded_ue1t9_6", se = "_header_ue1t9_32", oe = "_tabs_ue1t9_119",
174
175
  disabled: e.disabled,
175
176
  children: e.label
176
177
  },
177
- `${e.label}-${a}`
178
+ `${e.label}-${s}`
178
179
  )) })
179
180
  ] })
180
181
  ] }),
181
- /* @__PURE__ */ s("div", { className: l("items-section"), children: [
182
- /* @__PURE__ */ n("div", { className: l("items-header"), children: r ? /* @__PURE__ */ s("div", { className: l("tabs"), children: [
183
- m > 0 && /* @__PURE__ */ s(
182
+ /* @__PURE__ */ a("div", { className: l("items-section"), children: [
183
+ /* @__PURE__ */ n("div", { className: l("items-header"), children: r ? /* @__PURE__ */ a("div", { className: l("tabs"), children: [
184
+ m > 0 && /* @__PURE__ */ a(
184
185
  "button",
185
186
  {
186
187
  className: l("tab", {
@@ -193,7 +194,7 @@ const ae = "_expanded_ue1t9_6", se = "_header_ue1t9_32", oe = "_tabs_ue1t9_119",
193
194
  ]
194
195
  }
195
196
  ),
196
- d > 0 && /* @__PURE__ */ s(
197
+ d > 0 && /* @__PURE__ */ a(
197
198
  "button",
198
199
  {
199
200
  className: l("tab", {
@@ -207,7 +208,7 @@ const ae = "_expanded_ue1t9_6", se = "_header_ue1t9_32", oe = "_tabs_ue1t9_119",
207
208
  }
208
209
  )
209
210
  ] }) : c.selectedItems }),
210
- /* @__PURE__ */ n("div", { className: l("items-scroll"), children: /* @__PURE__ */ n(Q, { hideTracksWhenNotNeeded: !0, children: /* @__PURE__ */ n("div", { className: l("items-list"), children: V.map((e) => U(e)) }) }) })
211
+ /* @__PURE__ */ n("div", { className: l("items-scroll"), children: /* @__PURE__ */ n(Q, { hideTracksWhenNotNeeded: !0, children: /* @__PURE__ */ n("div", { className: l("items-list"), children: V.map((e) => q(e)) }) }) })
211
212
  ] })
212
213
  ] })
213
214
  }
@@ -22,6 +22,7 @@ export interface BulkPanelAction {
22
22
  * @param direct - true if all items were eligible and proceed was called directly, false if called via Proceed button
23
23
  */
24
24
  onProceed: (eligibleItems: BulkPanelItem[], direct?: boolean) => void;
25
+ onCancel?: () => void;
25
26
  }
26
27
  export interface BulkPanelCaptions {
27
28
  selected?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reportportal/ui-kit",
3
- "version": "0.0.1-alpha.166",
3
+ "version": "0.0.1-alpha.167",
4
4
  "description": "The UI-kit library for ReportPortal Design System.",
5
5
  "type": "module",
6
6
  "scripts": {