@reportportal/ui-kit 0.0.1-alpha.10 → 0.0.1-alpha.11

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/README.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  This library is designed to reflect [ReportPortal Design System](https://www.figma.com/file/gjYQPbeyf4YsH3wZiVKoaj/RP-DS-6) components as React components.
4
4
 
5
+ **alpha versions available**
6
+
5
7
  ## Installation
6
8
 
7
9
  Install the package into your project using your favourite package manager:
@@ -112,7 +114,7 @@ To see a published showcase of the latest components released with its API and u
112
114
 
113
115
  ### Icons
114
116
 
115
- The library provides a set of SVG icons and the `BaseIconButton` component to apply basic styles for hover, disabled and others to them.
117
+ The library provides a set of SVG icons and the `BaseIconButton` component to apply basic styles for hover, disabled and other states to them.
116
118
 
117
119
  The list of available icons can be found in the [icons](./src/components/icons/svg) folder.
118
120
 
@@ -150,14 +152,7 @@ const MyComponent = () => {
150
152
 
151
153
  `BaseIconButton` supports all the props of the `button` HTML element.
152
154
 
153
- ## Build process
154
-
155
- We use [vite](https://vitejs.dev/) as a build tool.
156
-
157
- To build the library run
158
- ```console
159
- npm run build
160
- ```
155
+ **Note:** To support styling via `BaseIconButton`, it is recommended to use *path-based*, *single-color* SVG icons.
161
156
 
162
157
  ## Development
163
158
 
@@ -170,11 +165,48 @@ To run it locally use
170
165
  npm run start
171
166
  ```
172
167
 
173
- To create a ready-to-deploy version of the Storybook run
168
+ To create a ready-to-deploy version of the Storybook, run
174
169
  ```console
175
170
  npm run build:storybook
176
171
  ```
177
172
 
173
+ ### Build process
174
+
175
+ We use [vite](https://vitejs.dev/) as a build tool.
176
+
177
+ To build the library run
178
+ ```console
179
+ npm run build
180
+ ```
181
+
182
+ ### Storybook showcase deploy
183
+
184
+ While the library is in alpha, the showcase hosted on [GitHub Pages](https://reportportal.io/ui-kit/) should be updated based on changes from the `develop` branch.
185
+
186
+ #### Deployment steps
187
+
188
+ 1. Navigate to the "Actions" page within the [repository](https://github.com/reportportal/ui-kit/actions).
189
+ 2. Choose the "Deploy dev storybook showcase" action from list of available workflows.
190
+ 3. Click "Run workflow" button on the right and select the `develop` branch.
191
+ 4. Wait for the deployment process to complete. The progress can be tracked on the "Actions" page.
192
+ 5. Once the deployment is finished, verify that the changes have been deployed correctly, visiting [GitHub Pages](https://reportportal.io/ui-kit/).
193
+
194
+ That's it! If you encounter any issues during the deployment process, please consult the documentation or reach out to the project maintainers for assistance.
195
+
196
+ ### Release
197
+
198
+ While the library is in alpha, the [NPM package](https://www.npmjs.com/package/@reportportal/ui-kit) should be built and published from the `develop` branch with `alpha` tag.
199
+
200
+ #### Release steps
201
+
202
+ 1. Navigate to the "Actions" page within the [repository](https://github.com/reportportal/ui-kit/actions).
203
+ 2. Choose the "Publish dev package version" action from list of available workflows.
204
+ 3. Click "Run workflow" button on the right and select the `develop` branch.
205
+ 4. Wait for the publishing process to complete. The progress can be tracked on the "Actions" page.
206
+ 5. Once the publishing is finished, verify that the changes have been published correctly, visiting [NPM registry](https://www.npmjs.com/package/@reportportal/ui-kit?activeTab=versions).
207
+
208
+ That's it! If you encounter any issues during the release process, please consult the documentation or reach out to the project maintainers for assistance.
209
+
178
210
  ### Code style
179
211
 
180
212
  We follow the [Airbnb JavaScript Style Guide](https://github.com/airbnb/javascript) and use [ESLint](https://eslint.org/) to enforce it.
@@ -0,0 +1,73 @@
1
+ import { jsxs as x, jsx as t } from "react/jsx-runtime";
2
+ import { c as m } from "./bind-06a7ff84.js";
3
+ import { useRef as f } from "react";
4
+ import { K as _ } from "./keyCodes-f63c0e11.js";
5
+ const y = "_checkbox_189ko_1", C = "_disabled_189ko_11", E = "_input_189ko_16", D = "_control_189ko_23", K = "_children_189ko_149", N = {
6
+ checkbox: y,
7
+ disabled: C,
8
+ input: E,
9
+ control: D,
10
+ "partially-checked": "_partially-checked_189ko_76",
11
+ children: K
12
+ }, e = m.bind(N), Y = ({
13
+ children: l,
14
+ disabled: c = !1,
15
+ onChange: p,
16
+ className: h,
17
+ value: r,
18
+ partiallyChecked: b,
19
+ title: s,
20
+ ...d
21
+ }) => {
22
+ const o = f(null), u = (n) => {
23
+ var i, k;
24
+ const { keyCode: a } = n;
25
+ if (a === _.SPACE_KEY_CODE) {
26
+ n.preventDefault(), (i = o.current) == null || i.click();
27
+ return;
28
+ }
29
+ a === _.ENTER_KEY_CODE && (n.preventDefault(), (k = o.current) == null || k.click());
30
+ };
31
+ return /* @__PURE__ */ x(
32
+ "label",
33
+ {
34
+ id: "rp-ui-kit-checkbox-label",
35
+ className: e("checkbox", h, {
36
+ disabled: c
37
+ }),
38
+ title: s,
39
+ children: [
40
+ /* @__PURE__ */ t(
41
+ "input",
42
+ {
43
+ ref: o,
44
+ tabIndex: 0,
45
+ type: "checkbox",
46
+ onKeyDown: u,
47
+ className: e("input", { "partially-checked": b }),
48
+ disabled: c,
49
+ onChange: p,
50
+ checked: r,
51
+ title: s,
52
+ ...d
53
+ }
54
+ ),
55
+ /* @__PURE__ */ t(
56
+ "span",
57
+ {
58
+ "aria-labelledby": "rp-ui-kit-checkbox-label",
59
+ role: "checkbox",
60
+ "aria-checked": r,
61
+ className: e("control", {
62
+ disabled: c
63
+ })
64
+ }
65
+ ),
66
+ l && /* @__PURE__ */ t("span", { className: e("children", { disabled: c }), children: l })
67
+ ]
68
+ }
69
+ );
70
+ };
71
+ export {
72
+ Y as C
73
+ };
package/dist/checkbox.js CHANGED
@@ -1,4 +1,4 @@
1
- import { C as r } from "./checkbox-4143390f.js";
1
+ import { C as r } from "./checkbox-6777be17.js";
2
2
  import "react/jsx-runtime";
3
3
  import "./bind-06a7ff84.js";
4
4
  import "react";
@@ -6,6 +6,7 @@ interface CheckboxProps extends HTMLAttributes<HTMLInputElement> {
6
6
  className?: string;
7
7
  onChange?: ChangeEventHandler<HTMLInputElement>;
8
8
  partiallyChecked?: boolean;
9
+ title?: string;
9
10
  }
10
11
  export declare const Checkbox: FC<CheckboxProps>;
11
12
  export {};
@@ -0,0 +1,11 @@
1
+ import { FC } from 'react';
2
+ import { ChangePage } from '../../../types';
3
+ export interface BarProps {
4
+ totalPages: number;
5
+ activePage: number;
6
+ changePage: ChangePage;
7
+ captions: {
8
+ goTo: string;
9
+ };
10
+ }
11
+ export declare const Bar: FC<BarProps>;
@@ -0,0 +1 @@
1
+ export { Bar } from './bar';
@@ -4,5 +4,8 @@ export interface PageNavigatorProps {
4
4
  activePage: number;
5
5
  totalPages: number;
6
6
  changePage: ChangePage;
7
+ captions: {
8
+ goTo: string;
9
+ };
7
10
  }
8
11
  export declare const PageNavigator: FC<PageNavigatorProps>;
@@ -37,9 +37,12 @@ export interface TableComponentProps {
37
37
  rowActionMenu?: ReactNode;
38
38
  selectable?: boolean;
39
39
  className?: string;
40
+ headerClassName?: string;
41
+ rowClassName?: string;
40
42
  selectedRowIds?: (string | number)[];
41
43
  sortingDirection?: SortDirection;
42
44
  sortingColumn?: Column;
45
+ sortableColumns?: string[];
43
46
  onChangeSorting?: (sortConfig?: SortConfig) => void;
44
47
  onToggleRowSelection?: (id: string | number) => void;
45
48
  onToggleAllRowsSelection?: () => void;
@@ -1,2 +1,3 @@
1
- import { RowData, SortConfig } from './types';
1
+ import { Column, RowData, SortConfig } from './types';
2
2
  export declare const sortTableData: (tableData: RowData[], sortConfig?: SortConfig) => RowData[];
3
+ export declare const getColumnsKeys: (columns: Column[]) => string[];
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { B as d } from "./button-7fb84fde.js";
2
- import { C as L } from "./checkbox-4143390f.js";
2
+ import { C as L } from "./checkbox-6777be17.js";
3
3
  import { S as g } from "./systemMessage-1ced6079.js";
4
4
  import { S as h, F as u } from "./fieldText-d80b29ba.js";
5
5
  import { T as I } from "./themeProvider-46c2be7b.js";
@@ -12,8 +12,8 @@ import { F as U } from "./fieldTextFlex-5bddf46a.js";
12
12
  import { R as q } from "./radio-fd49a09c.js";
13
13
  import { Tooltip as G } from "./tooltip.js";
14
14
  import { Popover as K } from "./popover.js";
15
- import { P as Q, a as W, S as X } from "./pagination-a36bc786.js";
16
- import { S as _, a as $, T as e1 } from "./table-d949a4ae.js";
15
+ import { P as Q, a as W, S as X } from "./pagination-5449cd03.js";
16
+ import { S as _, a as $, T as e1 } from "./table-231fd19c.js";
17
17
  import { B as r1 } from "./baseIconButton-7bc53dec.js";
18
18
  import * as e from "react";
19
19
  import "react/jsx-runtime";
@@ -0,0 +1,346 @@
1
+ import { jsxs as d, jsx as t } from "react/jsx-runtime";
2
+ import { c as m } from "./bind-06a7ff84.js";
3
+ import * as b from "react";
4
+ import { useState as x } from "react";
5
+ import { Popover as B } from "./popover.js";
6
+ import { B as $ } from "./button-7fb84fde.js";
7
+ import { F as I } from "./fieldText-d80b29ba.js";
8
+ import { B as f } from "./baseIconButton-7bc53dec.js";
9
+ import { Tooltip as k } from "./tooltip.js";
10
+ const w = (e) => /* @__PURE__ */ b.createElement("svg", { width: 16, height: 16, viewBox: "0 0 16 16", fill: "#A2AAB5", xmlns: "http://www.w3.org/2000/svg", ...e }, /* @__PURE__ */ b.createElement("path", { d: "M12 13L4 8L12 3L12 13Z" })), T = (e) => /* @__PURE__ */ b.createElement("svg", { width: 13, height: 12, viewBox: "0 0 13 12", fill: "#A2AAB5", xmlns: "http://www.w3.org/2000/svg", ...e }, /* @__PURE__ */ b.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M0 12L2 12L2 2.38498e-08L1.90798e-07 0L0 12ZM13 1L5 6L13 11L13 1Z" })), E = {
11
+ "item-counter": "_item-counter_4g6do_1"
12
+ }, M = m.bind(E), P = ({
13
+ activePage: e,
14
+ pageSize: n,
15
+ totalItems: s,
16
+ ofText: r,
17
+ itemsText: c
18
+ }) => {
19
+ const a = e * n, i = a - n;
20
+ return /* @__PURE__ */ d("div", { className: M("item-counter"), children: [
21
+ `${i + 1} - ${a < s ? a : s}`,
22
+ ` ${r} ${s} ${c}`
23
+ ] });
24
+ }, j = "_selected_183l8_32", R = {
25
+ "size-selector": "_size-selector_183l8_1",
26
+ "size-option": "_size-option_183l8_6",
27
+ selected: j
28
+ }, C = m.bind(R), V = ({
29
+ currentSize: e,
30
+ options: n,
31
+ onClickOption: s
32
+ }) => /* @__PURE__ */ t("div", { className: C("size-selector"), children: n.map((r) => /* @__PURE__ */ t(
33
+ "button",
34
+ {
35
+ className: C("size-option", { selected: r === e }),
36
+ onClick: () => {
37
+ s(r);
38
+ },
39
+ children: r
40
+ },
41
+ r
42
+ )) }), W = {
43
+ "page-size-control": "_page-size-control_gnurh_1",
44
+ "size-selector-button": "_size-selector-button_gnurh_10"
45
+ }, S = m.bind(W), D = ({
46
+ size: e,
47
+ sizeOptions: n,
48
+ perPageText: s,
49
+ changeSize: r
50
+ }) => {
51
+ const [c, a] = x(!1), i = (o) => {
52
+ r(o), a(!1);
53
+ };
54
+ return /* @__PURE__ */ d("div", { className: S("page-size-control"), children: [
55
+ /* @__PURE__ */ t(
56
+ B,
57
+ {
58
+ content: /* @__PURE__ */ t(V, { options: n, onClickOption: i, currentSize: e }),
59
+ placement: "top",
60
+ isOpened: c,
61
+ setIsOpened: a,
62
+ children: /* @__PURE__ */ t($, { className: S("size-selector-button"), variant: "text", children: e })
63
+ }
64
+ ),
65
+ ` ${s}`
66
+ ] });
67
+ }, F = {
68
+ "page-selector": "_page-selector_rtho4_1",
69
+ "field-wrapper": "_field-wrapper_rtho4_6",
70
+ "apply-button": "_apply-button_rtho4_10"
71
+ }, N = m.bind(F), Z = ({
72
+ totalPages: e,
73
+ pageText: n,
74
+ goActionText: s,
75
+ selectPage: r
76
+ }) => {
77
+ const [c, a] = x(""), [i, o] = x(!0), p = (h) => {
78
+ const u = h.target.value.replace(/\D/g, ""), y = Number(u), O = y > 0 && y <= e;
79
+ o(O), a(u);
80
+ }, l = () => {
81
+ r(Number(c));
82
+ };
83
+ return /* @__PURE__ */ d("div", { className: N("page-selector"), children: [
84
+ /* @__PURE__ */ t("div", { className: N("field-wrapper"), children: /* @__PURE__ */ t(
85
+ I,
86
+ {
87
+ onChange: p,
88
+ value: c,
89
+ placeholder: n,
90
+ error: i ? "" : "Error",
91
+ touched: !0,
92
+ defaultWidth: !1,
93
+ displayError: !1
94
+ }
95
+ ) }),
96
+ /* @__PURE__ */ t($, { onClick: l, disabled: !c || !i, className: N("apply-button"), children: s })
97
+ ] });
98
+ }, G = {
99
+ "active-page": "_active-page_14j0y_1",
100
+ "page-selector": "_page-selector_14j0y_10",
101
+ "page-selector-button": "_page-selector-button_14j0y_14"
102
+ }, v = m.bind(G), H = ({
103
+ activePage: e,
104
+ totalPages: n,
105
+ pageText: s,
106
+ goToText: r,
107
+ goActionText: c,
108
+ changePage: a
109
+ }) => {
110
+ const [i, o] = x(!1), p = (l) => {
111
+ a(l), o(!1);
112
+ };
113
+ return /* @__PURE__ */ d("div", { className: v("active-page"), children: [
114
+ `${s} `,
115
+ /* @__PURE__ */ t(
116
+ B,
117
+ {
118
+ content: /* @__PURE__ */ t(
119
+ Z,
120
+ {
121
+ pageText: s,
122
+ goActionText: c,
123
+ selectPage: p,
124
+ totalPages: n
125
+ }
126
+ ),
127
+ title: r,
128
+ placement: "top",
129
+ isOpened: i,
130
+ setIsOpened: o,
131
+ className: v("page-selector"),
132
+ children: /* @__PURE__ */ t($, { className: v("page-selector-button"), variant: "text", children: e })
133
+ }
134
+ )
135
+ ] });
136
+ }, q = "_bar_dfnmf_1", J = "_section_dfnmf_9", K = "_selected_dfnmf_33", Q = "_tooltip_dfnmf_37", U = {
137
+ bar: q,
138
+ "section-with-tooltip": "_section-with-tooltip_dfnmf_9",
139
+ section: J,
140
+ selected: K,
141
+ "tooltip-wrapper": "_tooltip-wrapper_dfnmf_37",
142
+ tooltip: Q,
143
+ "tooltip-text": "_tooltip-text_dfnmf_48",
144
+ "page-number": "_page-number_dfnmf_52"
145
+ }, g = m.bind(U), z = 13, A = 260, X = ({
146
+ totalPages: e,
147
+ activePage: n,
148
+ changePage: s,
149
+ captions: r
150
+ }) => {
151
+ const c = A / e, a = Math.min(Math.ceil(A / z), e), i = Math.max(z, c), o = [];
152
+ for (let l = 1; l <= e; l++)
153
+ o.push({
154
+ end: l * c,
155
+ pageNumber: l
156
+ });
157
+ const p = Array.from({ length: a }, () => ({ pages: { from: void 0, to: void 0 } }));
158
+ return o.forEach((l) => {
159
+ const h = Math.ceil(l.end / i) - 1, u = p[h].pages;
160
+ u.from || (u.from = l.pageNumber), u.to = l.pageNumber;
161
+ }), /* @__PURE__ */ t("div", { className: g("bar"), children: p.map((l, h) => /* @__PURE__ */ t(
162
+ "div",
163
+ {
164
+ className: g("section-with-tooltip"),
165
+ style: { width: i },
166
+ onClick: () => l.pages.from && s(l.pages.from),
167
+ children: /* @__PURE__ */ t(
168
+ k,
169
+ {
170
+ content: /* @__PURE__ */ d("div", { className: g("tooltip"), children: [
171
+ /* @__PURE__ */ t("div", { className: g("tooltip-text"), children: r.goTo }),
172
+ /* @__PURE__ */ t("div", { className: g("page-number"), children: l.pages.from })
173
+ ] }),
174
+ className: g("tooltip-wrapper"),
175
+ placement: "top",
176
+ children: /* @__PURE__ */ t(
177
+ "div",
178
+ {
179
+ className: g("section", {
180
+ selected: l.pages.from && l.pages.to && l.pages.from <= n && n <= l.pages.to
181
+ })
182
+ }
183
+ )
184
+ }
185
+ )
186
+ },
187
+ h
188
+ )) });
189
+ }, Y = "_next_1p2t5_18", ee = {
190
+ "page-navigator": "_page-navigator_1p2t5_1",
191
+ "page-buttons": "_page-buttons_1p2t5_6",
192
+ "page-button": "_page-button_1p2t5_6",
193
+ next: Y
194
+ }, _ = m.bind(ee), te = ({
195
+ activePage: e,
196
+ changePage: n,
197
+ totalPages: s,
198
+ captions: r
199
+ }) => {
200
+ const c = () => {
201
+ n(1);
202
+ }, a = () => {
203
+ n(e - 1);
204
+ }, i = () => {
205
+ n(e + 1);
206
+ }, o = () => {
207
+ n(s);
208
+ };
209
+ return /* @__PURE__ */ d("div", { className: _("page-navigator"), children: [
210
+ /* @__PURE__ */ d("div", { className: _("page-buttons"), children: [
211
+ /* @__PURE__ */ t(
212
+ f,
213
+ {
214
+ className: _("page-button"),
215
+ onClick: c,
216
+ disabled: e === 1,
217
+ children: /* @__PURE__ */ t(T, {})
218
+ }
219
+ ),
220
+ /* @__PURE__ */ t(
221
+ f,
222
+ {
223
+ className: _("page-button"),
224
+ onClick: a,
225
+ disabled: e === 1,
226
+ children: /* @__PURE__ */ t(w, {})
227
+ }
228
+ )
229
+ ] }),
230
+ /* @__PURE__ */ t(
231
+ X,
232
+ {
233
+ totalPages: s,
234
+ activePage: e,
235
+ changePage: n,
236
+ captions: r
237
+ }
238
+ ),
239
+ /* @__PURE__ */ d("div", { className: _("page-buttons"), children: [
240
+ /* @__PURE__ */ t(
241
+ f,
242
+ {
243
+ className: _("page-button", "next"),
244
+ onClick: i,
245
+ disabled: e === s,
246
+ children: /* @__PURE__ */ t(w, {})
247
+ }
248
+ ),
249
+ /* @__PURE__ */ t(
250
+ f,
251
+ {
252
+ className: _("page-button", "next"),
253
+ onClick: o,
254
+ disabled: e === s,
255
+ children: /* @__PURE__ */ t(T, {})
256
+ }
257
+ )
258
+ ] })
259
+ ] });
260
+ }, oe = {
261
+ "page-controls": "_page-controls_thyf8_1",
262
+ "total-pages": "_total-pages_thyf8_8"
263
+ }, L = m.bind(oe), se = ({
264
+ activePage: e,
265
+ changePage: n,
266
+ captions: s,
267
+ totalPages: r
268
+ }) => /* @__PURE__ */ d("div", { className: L("page-controls"), children: [
269
+ /* @__PURE__ */ t(
270
+ H,
271
+ {
272
+ activePage: e,
273
+ totalPages: r,
274
+ changePage: n,
275
+ pageText: s.page,
276
+ goToText: s.goTo,
277
+ goActionText: s.goAction
278
+ }
279
+ ),
280
+ /* @__PURE__ */ t(
281
+ te,
282
+ {
283
+ changePage: n,
284
+ activePage: e,
285
+ totalPages: r,
286
+ captions: { goTo: s.goTo }
287
+ }
288
+ ),
289
+ /* @__PURE__ */ d("span", { className: L("total-pages"), children: [
290
+ `${s.of} `,
291
+ r
292
+ ] })
293
+ ] }), ne = "_pagination_uykxy_1", re = {
294
+ pagination: ne
295
+ }, le = m.bind(re), ue = ({
296
+ activePage: e,
297
+ totalPages: n,
298
+ pageSize: s,
299
+ totalItems: r,
300
+ pageSizeOptions: c,
301
+ changePage: a,
302
+ changePageSize: i,
303
+ captions: o
304
+ }) => {
305
+ const p = (o == null ? void 0 : o.of) || "of", l = (o == null ? void 0 : o.page) || "Page";
306
+ return /* @__PURE__ */ d("div", { className: le("pagination"), children: [
307
+ /* @__PURE__ */ t(
308
+ P,
309
+ {
310
+ activePage: e,
311
+ pageSize: s,
312
+ totalItems: r,
313
+ ofText: p,
314
+ itemsText: (o == null ? void 0 : o.items) || "items"
315
+ }
316
+ ),
317
+ n > 1 && /* @__PURE__ */ t(
318
+ se,
319
+ {
320
+ activePage: e,
321
+ totalPages: n,
322
+ changePage: a,
323
+ captions: {
324
+ page: l,
325
+ of: p,
326
+ goTo: (o == null ? void 0 : o.goTo) || "Go to page",
327
+ goAction: (o == null ? void 0 : o.goAction) || "Go"
328
+ }
329
+ }
330
+ ),
331
+ /* @__PURE__ */ t(
332
+ D,
333
+ {
334
+ size: s,
335
+ sizeOptions: c,
336
+ changeSize: i,
337
+ perPageText: (o == null ? void 0 : o.perPage) || "per page"
338
+ }
339
+ )
340
+ ] });
341
+ };
342
+ export {
343
+ ue as P,
344
+ w as S,
345
+ T as a
346
+ };
@@ -1,4 +1,4 @@
1
- import { P as t } from "./pagination-a36bc786.js";
1
+ import { P as t } from "./pagination-5449cd03.js";
2
2
  import "react/jsx-runtime";
3
3
  import "./bind-06a7ff84.js";
4
4
  import "react";
@@ -7,6 +7,8 @@ import "@floating-ui/react";
7
7
  import "./button-7fb84fde.js";
8
8
  import "./fieldText-d80b29ba.js";
9
9
  import "./baseIconButton-7bc53dec.js";
10
+ import "./tooltip.js";
11
+ import "@floating-ui/react-dom";
10
12
  export {
11
13
  t as Pagination,
12
14
  t as default