@reportportal/ui-kit 0.0.1-alpha.237 → 0.0.1-alpha.239

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,370 @@
1
+ import { jsxs as d, jsx as t } from "react/jsx-runtime";
2
+ import { c as _ } from "./bind-06a7ff84.js";
3
+ import { Tooltip as j } from "./tooltip.js";
4
+ import { useState as y } from "react";
5
+ import { Popover as A } from "./popover.js";
6
+ import { B as C } from "./button-7ab874f3.js";
7
+ import { F as B } from "./fieldText-4a8e5496.js";
8
+ import { B as N } from "./baseIconButton-251479f7.js";
9
+ import { S as z, a as S } from "./prevPage-87faf576.js";
10
+ const W = {
11
+ "item-counter": "_item-counter_3hukk_1",
12
+ "accent-total": "_accent-total_3hukk_12",
13
+ "accent-total-tooltip-wrapper": "_accent-total-tooltip-wrapper_3hukk_17"
14
+ }, f = _.bind(W), P = ({
15
+ activePage: s,
16
+ pageSize: n,
17
+ totalItems: o,
18
+ ofText: a,
19
+ itemsText: l,
20
+ limitExceeded: i = !1,
21
+ warningContent: c = null,
22
+ accentTotalTooltip: e
23
+ }) => {
24
+ const p = s * n, r = p - n;
25
+ return /* @__PURE__ */ d("div", { className: f("item-counter"), children: [
26
+ `${r + 1} - ${p < o ? p : o}`,
27
+ ` ${a} `,
28
+ e ? typeof window < "u" ? /* @__PURE__ */ t(
29
+ j,
30
+ {
31
+ content: e,
32
+ placement: "top",
33
+ wrapperClassName: f("accent-total-tooltip-wrapper"),
34
+ children: /* @__PURE__ */ t("span", { className: f("accent-total"), children: o })
35
+ }
36
+ ) : /* @__PURE__ */ t("span", { className: f("accent-total"), children: o }) : `${o}${i ? "+" : ""}`,
37
+ ` ${l}`,
38
+ !e && c
39
+ ] });
40
+ }, E = "_selected_cjnvy_23", M = {
41
+ "size-selector": "_size-selector_cjnvy_1",
42
+ "size-option": "_size-option_cjnvy_6",
43
+ selected: E
44
+ }, k = _.bind(M), V = ({
45
+ currentSize: s,
46
+ options: n,
47
+ onClickOption: o
48
+ }) => /* @__PURE__ */ t("div", { className: k("size-selector"), children: n.map((a) => /* @__PURE__ */ t(
49
+ "button",
50
+ {
51
+ className: k("size-option", { selected: a === s }),
52
+ onClick: () => {
53
+ o(a);
54
+ },
55
+ children: a
56
+ },
57
+ a
58
+ )) }), D = {
59
+ "page-size-control": "_page-size-control_8rb7p_1",
60
+ "page-size-options": "_page-size-options_8rb7p_8",
61
+ "size-selector-button": "_size-selector-button_8rb7p_12"
62
+ }, v = _.bind(D), F = ({
63
+ size: s,
64
+ sizeOptions: n,
65
+ perPageText: o,
66
+ changeSize: a
67
+ }) => {
68
+ const [l, i] = y(!1), c = (e) => {
69
+ a(e), i(!1);
70
+ };
71
+ return /* @__PURE__ */ d("div", { className: v("page-size-control"), children: [
72
+ /* @__PURE__ */ t(
73
+ A,
74
+ {
75
+ content: /* @__PURE__ */ t(V, { options: n, onClickOption: c, currentSize: s }),
76
+ placement: "top",
77
+ isOpened: l,
78
+ setIsOpened: i,
79
+ className: v("page-size-options"),
80
+ children: /* @__PURE__ */ t(C, { className: v("size-selector-button"), variant: "text", adjustWidthOn: "content", children: s })
81
+ }
82
+ ),
83
+ ` ${o}`
84
+ ] });
85
+ }, G = {
86
+ "page-selector": "_page-selector_rtho4_1",
87
+ "field-wrapper": "_field-wrapper_rtho4_6",
88
+ "apply-button": "_apply-button_rtho4_10"
89
+ }, $ = _.bind(G), H = ({
90
+ totalPages: s,
91
+ pageText: n,
92
+ goActionText: o,
93
+ selectPage: a
94
+ }) => {
95
+ const [l, i] = y(""), [c, e] = y(!0), p = (g) => {
96
+ const b = g.target.value.replace(/\D/g, ""), u = Number(b), x = u > 0 && u <= s;
97
+ e(x), i(b);
98
+ }, r = () => {
99
+ a(Number(l));
100
+ };
101
+ return /* @__PURE__ */ d("div", { className: $("page-selector"), children: [
102
+ /* @__PURE__ */ t("div", { className: $("field-wrapper"), children: /* @__PURE__ */ t(
103
+ B,
104
+ {
105
+ onChange: p,
106
+ value: l,
107
+ placeholder: n,
108
+ error: c ? "" : "Error",
109
+ touched: !0,
110
+ defaultWidth: !1,
111
+ displayError: !1
112
+ }
113
+ ) }),
114
+ /* @__PURE__ */ t(C, { onClick: r, disabled: !l || !c, className: $("apply-button"), children: o })
115
+ ] });
116
+ }, L = {
117
+ "active-page": "_active-page_1gl9o_1",
118
+ "page-selector": "_page-selector_1gl9o_10",
119
+ "page-selector-button": "_page-selector-button_1gl9o_14"
120
+ }, w = _.bind(L), R = ({
121
+ activePage: s,
122
+ totalPages: n,
123
+ pageText: o,
124
+ goToText: a,
125
+ goActionText: l,
126
+ changePage: i
127
+ }) => {
128
+ const [c, e] = y(!1), p = (r) => {
129
+ i(r), e(!1);
130
+ };
131
+ return /* @__PURE__ */ d("div", { className: w("active-page"), children: [
132
+ `${o} `,
133
+ /* @__PURE__ */ t(
134
+ A,
135
+ {
136
+ content: /* @__PURE__ */ t(
137
+ H,
138
+ {
139
+ pageText: o,
140
+ goActionText: l,
141
+ selectPage: p,
142
+ totalPages: n
143
+ }
144
+ ),
145
+ title: a,
146
+ placement: "top",
147
+ isOpened: c,
148
+ setIsOpened: e,
149
+ className: w("page-selector"),
150
+ children: /* @__PURE__ */ t(C, { className: w("page-selector-button"), variant: "text", adjustWidthOn: "content", children: s })
151
+ }
152
+ )
153
+ ] });
154
+ }, q = "_bar_y74hy_1", J = "_section_y74hy_9", K = "_selected_y74hy_33", Q = "_tooltip_y74hy_37", U = {
155
+ bar: q,
156
+ "section-with-tooltip": "_section-with-tooltip_y74hy_9",
157
+ section: J,
158
+ selected: K,
159
+ "tooltip-wrapper": "_tooltip-wrapper_y74hy_37",
160
+ tooltip: Q,
161
+ "tooltip-text": "_tooltip-text_y74hy_48",
162
+ "page-number": "_page-number_y74hy_52"
163
+ }, m = _.bind(U), T = 13, O = 260, X = ({
164
+ totalPages: s,
165
+ activePage: n,
166
+ changePage: o,
167
+ captions: a
168
+ }) => {
169
+ const l = O / s, i = Math.min(Math.ceil(O / T), s), c = Math.max(T, l), e = [];
170
+ for (let r = 1; r <= s; r++)
171
+ e.push({
172
+ end: r * l,
173
+ pageNumber: r
174
+ });
175
+ const p = Array.from({ length: i }, () => ({ pages: { from: void 0, to: void 0 } }));
176
+ return p.forEach((r, g) => {
177
+ for (r.pages.from = e[0].pageNumber; c * (g + 1) > e[0].end; )
178
+ e.shift();
179
+ r.pages.to = e[0].pageNumber, e.shift();
180
+ }), /* @__PURE__ */ t("div", { className: m("bar"), children: p.map((r, g) => /* @__PURE__ */ t(
181
+ "div",
182
+ {
183
+ className: m("section-with-tooltip"),
184
+ style: { width: c },
185
+ onClick: () => r.pages.from && o(r.pages.from),
186
+ children: /* @__PURE__ */ t(
187
+ j,
188
+ {
189
+ content: /* @__PURE__ */ d("div", { className: m("tooltip"), children: [
190
+ /* @__PURE__ */ t("div", { className: m("tooltip-text"), children: a.goTo }),
191
+ /* @__PURE__ */ t("div", { className: m("page-number"), children: r.pages.from })
192
+ ] }),
193
+ wrapperClassName: m("tooltip-wrapper"),
194
+ placement: "top",
195
+ children: /* @__PURE__ */ t(
196
+ "div",
197
+ {
198
+ className: m("section", {
199
+ selected: r.pages.from && r.pages.to && r.pages.from <= n && n <= r.pages.to
200
+ })
201
+ }
202
+ )
203
+ }
204
+ )
205
+ },
206
+ g
207
+ )) });
208
+ }, Y = "_next_pyt8p_21", Z = {
209
+ "page-navigator": "_page-navigator_pyt8p_1",
210
+ "page-buttons": "_page-buttons_pyt8p_7",
211
+ "page-button": "_page-button_pyt8p_7",
212
+ next: Y
213
+ }, h = _.bind(Z), ee = ({
214
+ activePage: s,
215
+ changePage: n,
216
+ totalPages: o,
217
+ captions: a
218
+ }) => {
219
+ const l = () => {
220
+ n(1);
221
+ }, i = () => {
222
+ n(s - 1);
223
+ }, c = () => {
224
+ n(s + 1);
225
+ }, e = () => {
226
+ n(o);
227
+ };
228
+ return /* @__PURE__ */ d("div", { className: h("page-navigator"), children: [
229
+ /* @__PURE__ */ d("div", { className: h("page-buttons"), children: [
230
+ /* @__PURE__ */ t(
231
+ N,
232
+ {
233
+ className: h("page-button"),
234
+ onClick: l,
235
+ disabled: s === 1,
236
+ children: /* @__PURE__ */ t(z, {})
237
+ }
238
+ ),
239
+ /* @__PURE__ */ t(
240
+ N,
241
+ {
242
+ className: h("page-button"),
243
+ onClick: i,
244
+ disabled: s === 1,
245
+ children: /* @__PURE__ */ t(S, {})
246
+ }
247
+ )
248
+ ] }),
249
+ /* @__PURE__ */ t(
250
+ X,
251
+ {
252
+ totalPages: o,
253
+ activePage: s,
254
+ changePage: n,
255
+ captions: a
256
+ }
257
+ ),
258
+ /* @__PURE__ */ d("div", { className: h("page-buttons"), children: [
259
+ /* @__PURE__ */ t(
260
+ N,
261
+ {
262
+ className: h("page-button", "next"),
263
+ onClick: c,
264
+ disabled: s === o,
265
+ children: /* @__PURE__ */ t(S, {})
266
+ }
267
+ ),
268
+ /* @__PURE__ */ t(
269
+ N,
270
+ {
271
+ className: h("page-button", "next"),
272
+ onClick: e,
273
+ disabled: s === o,
274
+ children: /* @__PURE__ */ t(z, {})
275
+ }
276
+ )
277
+ ] })
278
+ ] });
279
+ }, te = {
280
+ "page-controls": "_page-controls_thyf8_1",
281
+ "total-pages": "_total-pages_thyf8_8"
282
+ }, I = _.bind(te), oe = ({
283
+ activePage: s,
284
+ changePage: n,
285
+ captions: o,
286
+ totalPages: a
287
+ }) => /* @__PURE__ */ d("div", { className: I("page-controls"), children: [
288
+ /* @__PURE__ */ t(
289
+ R,
290
+ {
291
+ activePage: s,
292
+ totalPages: a,
293
+ changePage: n,
294
+ pageText: o.page,
295
+ goToText: o.goTo,
296
+ goActionText: o.goAction
297
+ }
298
+ ),
299
+ /* @__PURE__ */ t(
300
+ ee,
301
+ {
302
+ changePage: n,
303
+ activePage: s,
304
+ totalPages: a,
305
+ captions: { goTo: o.goTo }
306
+ }
307
+ ),
308
+ /* @__PURE__ */ d("span", { className: I("total-pages"), children: [
309
+ `${o.of} `,
310
+ a
311
+ ] })
312
+ ] }), se = "_pagination_ax9ed_1", ne = {
313
+ pagination: se
314
+ }, re = _.bind(ne), he = ({
315
+ activePage: s,
316
+ totalPages: n,
317
+ pageSize: o,
318
+ totalItems: a,
319
+ pageSizeOptions: l,
320
+ changePage: i,
321
+ changePageSize: c,
322
+ captions: e,
323
+ className: p,
324
+ warningContent: r,
325
+ limitExceeded: g = !1,
326
+ accentTotalTooltip: b
327
+ }) => {
328
+ const u = (e == null ? void 0 : e.of) || "of", x = (e == null ? void 0 : e.page) || "Page";
329
+ return /* @__PURE__ */ d("div", { className: re("pagination", p), children: [
330
+ /* @__PURE__ */ t(
331
+ P,
332
+ {
333
+ activePage: s,
334
+ pageSize: o,
335
+ totalItems: a,
336
+ ofText: u,
337
+ itemsText: (e == null ? void 0 : e.items) || "items",
338
+ limitExceeded: g,
339
+ warningContent: r,
340
+ accentTotalTooltip: b
341
+ }
342
+ ),
343
+ n > 1 && /* @__PURE__ */ t(
344
+ oe,
345
+ {
346
+ activePage: s,
347
+ totalPages: n,
348
+ changePage: i,
349
+ captions: {
350
+ page: x,
351
+ of: u,
352
+ goTo: (e == null ? void 0 : e.goTo) || "Go to page",
353
+ goAction: (e == null ? void 0 : e.goAction) || "Go"
354
+ }
355
+ }
356
+ ),
357
+ /* @__PURE__ */ t(
358
+ F,
359
+ {
360
+ size: o,
361
+ sizeOptions: l,
362
+ changeSize: c,
363
+ perPageText: (e == null ? void 0 : e.perPage) || "per page"
364
+ }
365
+ )
366
+ ] });
367
+ };
368
+ export {
369
+ he as P
370
+ };
@@ -1,21 +1,21 @@
1
- import { P as t } from "./pagination-53c8a559.js";
1
+ import { P as t } from "./pagination-535d600a.js";
2
2
  import "react/jsx-runtime";
3
3
  import "./bind-06a7ff84.js";
4
+ import "./tooltip.js";
4
5
  import "react";
5
- import "./popover.js";
6
+ import "react-dom";
6
7
  import "@floating-ui/react";
7
8
  import "./floatingUi-46f5b896.js";
9
+ import "./popover.js";
8
10
  import "./button-7ab874f3.js";
9
- import "./fieldText-1749da7a.js";
11
+ import "./fieldText-4a8e5496.js";
10
12
  import "./clear-53660571.js";
11
- import "./openEye-950159cb.js";
13
+ import "./openedEye-8fa4c67d.js";
12
14
  import "./baseIconButton-251479f7.js";
13
15
  import "./spinLoader-c4a53718.js";
14
16
  import "./maxValueDisplay-9be01a75.js";
15
17
  import "./fieldLabel.js";
16
18
  import "./prevPage-87faf576.js";
17
- import "./tooltip.js";
18
- import "react-dom";
19
19
  export {
20
20
  t as Pagination,
21
21
  t as default