@reportportal/ui-kit 0.0.1-alpha.65 → 0.0.1-alpha.67

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,2 @@
1
+ export declare const ASC = "asc";
2
+ export declare const DESC = "desc";
@@ -1,4 +1,5 @@
1
1
  import { ReactNode } from 'react';
2
+ import { ASC, DESC } from './constants';
2
3
 
3
4
  export interface Column {
4
5
  key: string;
@@ -27,13 +28,10 @@ export interface RowData {
27
28
  rowConfigs?: RowConfigs;
28
29
  metaData?: MetaData;
29
30
  }
30
- export declare enum SortDirection {
31
- ASC = "asc",
32
- DESC = "desc"
33
- }
31
+ export type SortingDirection = typeof ASC | typeof DESC | Uppercase<typeof ASC | typeof DESC>;
34
32
  export interface SortConfig {
35
33
  key: string;
36
- direction: SortDirection;
34
+ direction: SortingDirection;
37
35
  }
38
36
  export interface TableComponentProps {
39
37
  data: RowData[];
@@ -45,7 +43,7 @@ export interface TableComponentProps {
45
43
  headerClassName?: string;
46
44
  rowClassName?: string;
47
45
  selectedRowIds?: (string | number)[];
48
- sortingDirection?: SortDirection;
46
+ sortingDirection?: SortingDirection;
49
47
  sortingColumn?: Column;
50
48
  sortableColumns?: string[];
51
49
  onChangeSorting?: (sortConfig?: SortConfig) => void;
@@ -1,4 +1,6 @@
1
- import { Column, RowData, SortConfig } from './types';
1
+ import { Column, RowData, SortConfig, SortingDirection } from './types';
2
2
 
3
+ export declare const isAsc: (direction: SortingDirection) => boolean;
3
4
  export declare const sortTableData: (tableData: RowData[], sortConfig?: SortConfig) => RowData[];
4
5
  export declare const getColumnsKeys: (columns: Column[]) => string[];
6
+ export declare const toggleDirection: (direction: SortingDirection) => "desc" | "asc";
package/dist/index.js CHANGED
@@ -15,7 +15,7 @@ import { R as q } from "./radio-bccc84f2.js";
15
15
  import { Tooltip as K } from "./tooltip.js";
16
16
  import { Popover as V } from "./popover.js";
17
17
  import { P as X } from "./pagination-91729c7d.js";
18
- import { T as Z } from "./table-32fc8c70.js";
18
+ import { T as Z } from "./table-02e40724.js";
19
19
  import { D as $ } from "./datePicker-06e90999.js";
20
20
  import "react-datepicker";
21
21
  import { SystemAlert as ro } from "./systemAlert.js";
package/dist/modal.js CHANGED
@@ -41,12 +41,12 @@ const Q = () => {
41
41
  N,
42
42
  {
43
43
  variant: "ghost",
44
- adjustWidthOn: s === "small" ? "parent" : "content",
44
+ adjustWidthOn: s === "small" ? "parent" : "min-width",
45
45
  onClick: n,
46
46
  ...r
47
47
  }
48
48
  ) }),
49
- l && /* @__PURE__ */ e("div", { className: m("button-container"), children: /* @__PURE__ */ e(N, { adjustWidthOn: s === "small" ? "parent" : "content", ...l }) })
49
+ l && /* @__PURE__ */ e("div", { className: m("button-container"), children: /* @__PURE__ */ e(N, { adjustWidthOn: s === "small" ? "parent" : "min-width", ...l }) })
50
50
  ] })
51
51
  ] }), ne = {
52
52
  "modal-header": "_modal-header_68lru_1",
@@ -1,5 +1,5 @@
1
1
  import { jsxs as n, jsx as l } from "react/jsx-runtime";
2
- import { useState as S, useMemo as G } from "react";
2
+ import { useState as g, useMemo as G } from "react";
3
3
  import { c as J } from "./bind-06a7ff84.js";
4
4
  import { a as f, S as K } from "./arrowUp-4a5caee7.js";
5
5
  import { C as x } from "./checkbox-9a6c7ce1.js";
@@ -20,82 +20,80 @@ const O = "_table_kha9s_1", P = "_label_kha9s_87", Q = {
20
20
  "sortable-cell": "_sortable-cell_kha9s_91",
21
21
  "align-right": "_align-right_kha9s_94",
22
22
  "align-center": "_align-center_kha9s_100"
23
- };
24
- var k = /* @__PURE__ */ ((c) => (c.ASC = "asc", c.DESC = "desc", c))(k || {});
25
- const V = (c) => c.map((t) => t.key), a = J.bind(Q), ee = ({
23
+ }, z = "asc", V = (c) => c.toLowerCase() === z, W = (c) => c.map((t) => t.key), a = J.bind(Q), ae = ({
26
24
  data: c,
27
25
  primaryColumn: t,
28
26
  fixedColumns: h,
29
27
  renderRowActions: i,
30
- className: z = "",
31
- rowClassName: M = "",
28
+ className: M = "",
29
+ rowClassName: S = "",
32
30
  headerClassName: m = "",
33
- selectable: y = !1,
31
+ selectable: k = !1,
34
32
  selectedRowIds: d = [],
35
- sortingDirection: v = k.ASC,
33
+ sortingDirection: y = z,
36
34
  sortingColumn: r = t,
37
- sortableColumns: _ = V([t, ...h]),
35
+ sortableColumns: o = W([t, ...h]),
38
36
  onChangeSorting: u = () => {
39
37
  },
40
38
  onToggleRowSelection: A = () => {
41
39
  },
42
- onToggleAllRowsSelection: E = () => {
40
+ onToggleAllRowsSelection: L = () => {
43
41
  }
44
42
  }) => {
45
- const [C, p] = S(null), [L, N] = S(null), w = G(() => [{ ...t, primary: !0 }, ...h], [t, h]), j = (e) => {
46
- _.includes(e) && u({ key: e, direction: v });
47
- }, g = (e) => ({
43
+ const [E, v] = g(null), [j, p] = g(null), N = G(() => [{ ...t, primary: !0 }, ...h], [t, h]), C = (e) => {
44
+ o.includes(e) && u({ key: e, direction: y });
45
+ }, w = (e) => ({
48
46
  width: e.width,
49
47
  textAlign: e.align
50
48
  }), H = (e) => {
51
- p(e);
49
+ v(e);
52
50
  }, T = () => {
53
- p(null);
51
+ v(null);
54
52
  }, $ = (e) => {
55
- N(e);
53
+ p(e);
56
54
  }, D = () => {
57
- N(null);
55
+ p(null);
58
56
  }, R = (e) => {
59
57
  A(e);
60
58
  }, U = () => {
61
- E();
62
- }, q = c.every((e) => d.includes(e.id)), o = c.some((e) => d.includes(e.id)), B = (e) => {
59
+ L();
60
+ }, q = c.every((e) => d.includes(e.id)), _ = c.some((e) => d.includes(e.id)), B = (e) => {
63
61
  var s;
64
62
  return `size-${((s = e.rowConfigs) == null ? void 0 : s.size) ?? "default"}`;
65
63
  }, F = (e) => {
66
- if (_.includes(e))
67
- return (r == null ? void 0 : r.key) === e ? v === k.ASC ? /* @__PURE__ */ l(f, {}) : /* @__PURE__ */ l(K, {}) : /* @__PURE__ */ l(f, {});
64
+ if (o.includes(e))
65
+ return (r == null ? void 0 : r.key) === e ? V(y) ? /* @__PURE__ */ l(f, {}) : /* @__PURE__ */ l(K, {}) : /* @__PURE__ */ l(f, {});
68
66
  };
69
- return /* @__PURE__ */ n("div", { className: a("table", z), children: [
67
+ return /* @__PURE__ */ n("div", { className: a("table", M), children: [
70
68
  /* @__PURE__ */ n("div", { className: a("table-header", m), children: [
71
- y && /* @__PURE__ */ l("div", { className: a("table-header-cell", "checkbox-cell"), children: o && /* @__PURE__ */ l(
69
+ k && /* @__PURE__ */ l("div", { className: a("table-header-cell", "checkbox-cell"), children: _ && /* @__PURE__ */ l(
72
70
  x,
73
71
  {
74
72
  value: q,
75
- partiallyChecked: o,
73
+ partiallyChecked: _,
76
74
  onChange: U,
77
75
  className: a("checkbox-cell")
78
76
  }
79
77
  ) }),
80
- w.map((e) => /* @__PURE__ */ l(
78
+ N.map((e) => /* @__PURE__ */ l(
81
79
  "button",
82
80
  {
83
81
  className: a("table-header-cell", {
84
82
  [`align-${e.align}`]: "align" in e,
85
83
  "primary-cell": "primary" in e && e.primary,
86
- "sortable-cell": _.includes(e.key)
84
+ "sortable-cell": o.includes(e.key)
87
85
  }),
88
- style: g(e),
86
+ style: w(e),
89
87
  children: /* @__PURE__ */ n(
90
88
  "div",
91
89
  {
92
90
  className: a("label"),
93
- onClick: () => j(e.key),
91
+ onClick: () => C(e.key),
94
92
  onMouseEnter: () => H(e.key),
95
93
  onMouseLeave: T,
96
94
  children: [
97
95
  /* @__PURE__ */ l("span", { children: e.header }),
98
- (C === e.key || (r == null ? void 0 : r.key) === e.key) && F(e.key)
96
+ (E === e.key || (r == null ? void 0 : r.key) === e.key) && F(e.key)
99
97
  ]
100
98
  }
101
99
  )
@@ -107,11 +105,11 @@ const V = (c) => c.map((t) => t.key), a = J.bind(Q), ee = ({
107
105
  /* @__PURE__ */ l("div", { className: a("table-body"), children: c.map((e, b) => /* @__PURE__ */ n(
108
106
  "div",
109
107
  {
110
- className: a("table-row", B(e), M),
108
+ className: a("table-row", B(e), S),
111
109
  onMouseEnter: () => $(b),
112
110
  onMouseLeave: D,
113
111
  children: [
114
- y && /* @__PURE__ */ l("div", { className: a("table-cell", "checkbox-cell"), children: (o || L === b) && /* @__PURE__ */ l(
112
+ k && /* @__PURE__ */ l("div", { className: a("table-cell", "checkbox-cell"), children: (_ || j === b) && /* @__PURE__ */ l(
115
113
  x,
116
114
  {
117
115
  value: d.includes(e.id),
@@ -120,13 +118,13 @@ const V = (c) => c.map((t) => t.key), a = J.bind(Q), ee = ({
120
118
  }
121
119
  ) }),
122
120
  /* @__PURE__ */ n("div", { className: a("table-row-content"), children: [
123
- w.map((s) => /* @__PURE__ */ l(
121
+ N.map((s) => /* @__PURE__ */ l(
124
122
  "div",
125
123
  {
126
124
  className: a("table-cell", {
127
125
  "primary-cell": "primary" in s && s.primary
128
126
  }),
129
- style: g(s),
127
+ style: w(s),
130
128
  children: e[s.key].component || e[s.key].content || e[s.key]
131
129
  },
132
130
  s.key
@@ -140,5 +138,5 @@ const V = (c) => c.map((t) => t.key), a = J.bind(Q), ee = ({
140
138
  ] });
141
139
  };
142
140
  export {
143
- ee as T
141
+ ae as T
144
142
  };
package/dist/table.js CHANGED
@@ -1,4 +1,4 @@
1
- import { T as r } from "./table-32fc8c70.js";
1
+ import { T as r } from "./table-02e40724.js";
2
2
  import "react/jsx-runtime";
3
3
  import "react";
4
4
  import "./bind-06a7ff84.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reportportal/ui-kit",
3
- "version": "0.0.1-alpha.65",
3
+ "version": "0.0.1-alpha.67",
4
4
  "description": "The UI-kit library for ReportPortal Design System.",
5
5
  "type": "module",
6
6
  "scripts": {