@reportportal/ui-kit 0.0.1-alpha.168 → 0.0.1-alpha.169

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,208 @@
1
+ import { jsxs as F, Fragment as j, jsx as r } from "react/jsx-runtime";
2
+ import M from "react-datepicker/dist/es/index.js";
3
+ import { c as U } from "./bind-06a7ff84.js";
4
+ import { useMemo as E, forwardRef as W, useRef as q } from "react";
5
+ import { F as $ } from "./fieldText-1749da7a.js";
6
+ import { D as I } from "./dropdown-7d024c49.js";
7
+ import { S as L } from "./calendarArrow-44c7e60e.js";
8
+ import { registerLocale as z } from "react-datepicker";
9
+ const we = (e, s) => {
10
+ z(e, s);
11
+ }, J = (e, s = 20) => {
12
+ const d = e + s;
13
+ return new Array(d - e).fill(void 0).map((u, _) => e - _);
14
+ }, K = "_header_1s3dn_1", Q = "_disabled_1s3dn_25", X = "_dropdown_1s3dn_8", Z = {
15
+ header: K,
16
+ "dropdowns-wrapper": "_dropdowns-wrapper_1s3dn_8",
17
+ "button-prev": "_button-prev_1s3dn_13",
18
+ "button-next": "_button-next_1s3dn_14",
19
+ disabled: Q,
20
+ dropdown: X,
21
+ "month-dropdown": "_month-dropdown_1s3dn_44",
22
+ "toggle-button": "_toggle-button_1s3dn_47"
23
+ }, c = U.bind(Z), ee = ({
24
+ date: e = /* @__PURE__ */ new Date(),
25
+ changeYear: s = () => {
26
+ },
27
+ changeMonth: d = () => {
28
+ },
29
+ decreaseMonth: u = () => {
30
+ },
31
+ increaseMonth: _ = () => {
32
+ },
33
+ prevMonthButtonDisabled: b = !1,
34
+ nextMonthButtonDisabled: w = !1,
35
+ headerNodes: g = null,
36
+ customClassName: y = "",
37
+ yearsOptions: f = [],
38
+ locale: C
39
+ }) => {
40
+ const p = e.getFullYear(), N = e.getMonth(), A = E(() => {
41
+ const n = Array(12).keys(), t = new Intl.DateTimeFormat(C, {
42
+ month: "long"
43
+ }), o = (h) => t.format(new Date(p, h));
44
+ return Array.from(n, o).reduce((h, D, S) => h.concat({
45
+ value: S,
46
+ label: D
47
+ }), []);
48
+ }, [C, p]), R = E(() => (f.length > 0 ? f : J(p)).reduce(
49
+ (t, o) => t.concat({ value: o, label: `${o}` }),
50
+ []
51
+ ), [f, p]), a = (n) => {
52
+ d(n);
53
+ }, l = (n) => {
54
+ s(n);
55
+ };
56
+ return /* @__PURE__ */ F(j, { children: [
57
+ g && /* @__PURE__ */ r("div", { className: c(y), children: g }),
58
+ /* @__PURE__ */ F("div", { className: c("header"), children: [
59
+ /* @__PURE__ */ r(
60
+ "button",
61
+ {
62
+ type: "button",
63
+ "aria-label": "Previous Months",
64
+ disabled: b,
65
+ onClick: (n) => {
66
+ n.stopPropagation(), u();
67
+ },
68
+ className: c("button-prev", { disabled: b }),
69
+ children: /* @__PURE__ */ r(L, {})
70
+ }
71
+ ),
72
+ /* @__PURE__ */ F("div", { className: c("dropdowns-wrapper"), children: [
73
+ /* @__PURE__ */ r(
74
+ I,
75
+ {
76
+ options: A,
77
+ value: N,
78
+ onChange: a,
79
+ transparentBackground: !0,
80
+ className: c("dropdown", "month-dropdown"),
81
+ toggleButtonClassName: c("toggle-button")
82
+ }
83
+ ),
84
+ /* @__PURE__ */ r(
85
+ I,
86
+ {
87
+ options: R,
88
+ value: p,
89
+ onChange: l,
90
+ transparentBackground: !0,
91
+ className: c("dropdown"),
92
+ toggleButtonClassName: c("toggle-button")
93
+ }
94
+ )
95
+ ] }),
96
+ /* @__PURE__ */ r(
97
+ "button",
98
+ {
99
+ type: "button",
100
+ "aria-label": "Next Months",
101
+ disabled: w,
102
+ onClick: (n) => {
103
+ n.stopPropagation(), _();
104
+ },
105
+ className: c("button-next", { disabled: w }),
106
+ children: /* @__PURE__ */ r(L, {})
107
+ }
108
+ )
109
+ ] })
110
+ ] });
111
+ }, te = "_calendar_evrpf_5", ne = "_date_evrpf_103", oe = "_disabled_evrpf_149", re = "_popper_evrpf_157", ae = "_input_evrpf_161", se = {
112
+ calendar: te,
113
+ "current-date": "_current-date_evrpf_102",
114
+ date: ne,
115
+ "end-date": "_end-date_evrpf_120",
116
+ "selected-range": "_selected-range_evrpf_130",
117
+ disabled: oe,
118
+ popper: re,
119
+ input: ae,
120
+ "input-range": "_input-range_evrpf_168"
121
+ }, i = U.bind(se), de = "en", v = "MM-dd-yyyy", ce = " to ", le = W(({ value: e, ...s }, d) => {
122
+ const u = (e == null ? void 0 : e.replace(" - ", ce)) ?? "";
123
+ return /* @__PURE__ */ r($, { ...s, value: u, ref: d });
124
+ }), Ce = (e) => {
125
+ const {
126
+ onChange: s = () => {
127
+ },
128
+ disabled: d = !1,
129
+ onBlur: u = () => {
130
+ },
131
+ onFocus: _ = () => {
132
+ },
133
+ headerNodes: b = null,
134
+ customClassName: w = "",
135
+ customTimeInput: g = void 0,
136
+ shouldCloseOnSelect: y = !0,
137
+ popperClassName: f = "",
138
+ calendarClassName: C = "",
139
+ fixedHeight: p = !1,
140
+ language: N = de,
141
+ yearsOptions: A = [],
142
+ dateFormat: R = v,
143
+ value: a = null
144
+ } = e, l = "selectsRange" in e && e.selectsRange === !0, n = q(null), t = l ? (a == null ? void 0 : a[0]) ?? void 0 : void 0, o = l ? (a == null ? void 0 : a[1]) ?? void 0 : void 0, x = t == null ? void 0 : t.toDateString(), h = o == null ? void 0 : o.toDateString(), D = o && t && o > t, S = l ? `${v.toUpperCase()} to ${v.toUpperCase()}` : v.toUpperCase(), Y = e.placeholder ?? S, B = (m) => {
145
+ if (!l) {
146
+ const H = a == null ? void 0 : a.toDateString(), V = m.toDateString();
147
+ return i("date", {
148
+ "current-date": V === H,
149
+ disabled: d
150
+ });
151
+ }
152
+ const T = m.toDateString(), O = T === x, k = D && T === h, G = t && o && m > t && m < o;
153
+ return i("date", {
154
+ "current-date": O,
155
+ "selected-range": G && !k,
156
+ "end-date": k && D,
157
+ disabled: d
158
+ });
159
+ }, P = {
160
+ customInput: l ? /* @__PURE__ */ r(le, { className: i("input", "input-range"), defaultWidth: !1, ref: n }) : /* @__PURE__ */ r($, { className: i("input"), defaultWidth: !1, ref: n }),
161
+ placeholderText: Y,
162
+ disabled: d,
163
+ shouldCloseOnSelect: y,
164
+ fixedHeight: p,
165
+ locale: N,
166
+ showPopperArrow: !1,
167
+ dayClassName: B,
168
+ calendarClassName: i(C, "calendar"),
169
+ renderCustomHeader: (m) => /* @__PURE__ */ r(
170
+ ee,
171
+ {
172
+ ...m,
173
+ headerNodes: b,
174
+ customClassName: w,
175
+ yearsOptions: A,
176
+ locale: N
177
+ }
178
+ ),
179
+ onBlur: u,
180
+ onFocus: _,
181
+ customTimeInput: g,
182
+ showTimeInput: !!g,
183
+ popperClassName: i(f, "popper"),
184
+ dateFormat: R,
185
+ className: i("datepicker")
186
+ };
187
+ return l ? /* @__PURE__ */ r(
188
+ M,
189
+ {
190
+ ...P,
191
+ selectsRange: !0,
192
+ startDate: t,
193
+ endDate: o,
194
+ onChange: s
195
+ }
196
+ ) : /* @__PURE__ */ r(
197
+ M,
198
+ {
199
+ ...P,
200
+ selected: a,
201
+ onChange: s
202
+ }
203
+ );
204
+ };
205
+ export {
206
+ Ce as D,
207
+ we as r
208
+ };
@@ -1,5 +1,5 @@
1
- import { D as t } from "./datePicker-9d52ba44.js";
2
- import { r as A } from "./datePicker-9d52ba44.js";
1
+ import { D as t } from "./datePicker-ad4a758c.js";
2
+ import { r as A } from "./datePicker-ad4a758c.js";
3
3
  import "react/jsx-runtime";
4
4
  import "react-datepicker/dist/es/index.js";
5
5
  import "./bind-06a7ff84.js";
@@ -0,0 +1,96 @@
1
+ import { jsxs as O, jsx as l } from "react/jsx-runtime";
2
+ import { useRef as _, useEffect as T, useCallback as o } from "react";
3
+ import { c as W } from "./bind-06a7ff84.js";
4
+ import { A as j } from "./actionMenu-77a63b96.js";
5
+ import "./meatballMenu-535635a9.js";
6
+ import "./baseIconButton-251479f7.js";
7
+ import "./popover.js";
8
+ import "@floating-ui/react";
9
+ import "./floatingUi-41f8c7b5.js";
10
+ const D = "_disabled_1of31_29", I = "_selected_1of31_32", K = {
11
+ "filter-item": "_filter-item_1of31_16",
12
+ disabled: D,
13
+ selected: I,
14
+ "actions-button": "_actions-button_1of31_37",
15
+ "caption-wrapper": "_caption-wrapper_1of31_58"
16
+ }, p = W.bind(K), S = ({
17
+ id: e,
18
+ caption: f,
19
+ actions: h,
20
+ onClick: r,
21
+ onHover: s,
22
+ className: b,
23
+ captionClassName: w,
24
+ popoverClassName: N,
25
+ disabled: t = !1,
26
+ selected: x = !1,
27
+ editMode: u = !1
28
+ }) => {
29
+ const n = _(null), m = _(null);
30
+ T(() => {
31
+ const a = () => {
32
+ n.current && (n.current.scrollWidth > n.current.clientWidth ? n.current.setAttribute("title", f) : n.current.removeAttribute("title"));
33
+ };
34
+ if (a(), typeof ResizeObserver < "u" && n.current) {
35
+ const c = new ResizeObserver(a);
36
+ return c.observe(n.current), () => c.disconnect();
37
+ }
38
+ }, [f]);
39
+ const y = o(
40
+ (a) => {
41
+ var i;
42
+ if (t || u)
43
+ return;
44
+ const c = a.target;
45
+ (i = m.current) != null && i.contains(c) || r == null || r(e);
46
+ },
47
+ [e, r, t, u]
48
+ ), R = o(
49
+ (a) => {
50
+ var c;
51
+ if (a.key === "Enter" && !t && !u) {
52
+ const i = a.target;
53
+ if ((c = m.current) != null && c.contains(i))
54
+ return;
55
+ r == null || r(e);
56
+ }
57
+ },
58
+ [e, r, t, u]
59
+ ), g = o(() => {
60
+ t || s == null || s(e, !0);
61
+ }, [e, s, t]), A = o(() => {
62
+ t || s == null || s(e, !1);
63
+ }, [e, s, t]), E = p("filter-item", b, {
64
+ selected: x,
65
+ disabled: t
66
+ }), z = p("caption-wrapper", w);
67
+ return /* @__PURE__ */ O(
68
+ "div",
69
+ {
70
+ className: E,
71
+ "data-filter-item-container": !0,
72
+ onClick: y,
73
+ onKeyDown: R,
74
+ onMouseEnter: g,
75
+ onMouseLeave: A,
76
+ role: "button",
77
+ tabIndex: t ? -1 : 0,
78
+ children: [
79
+ /* @__PURE__ */ l("div", { className: z, ref: n, children: f }),
80
+ /* @__PURE__ */ l("div", { ref: m, children: /* @__PURE__ */ l(
81
+ j,
82
+ {
83
+ items: h,
84
+ disabled: t || u,
85
+ buttonClassName: p("actions-button"),
86
+ popoverClassName: N,
87
+ placement: "bottom-start"
88
+ }
89
+ ) })
90
+ ]
91
+ }
92
+ );
93
+ };
94
+ export {
95
+ S as FilterItem
96
+ };