@reportportal/ui-kit 0.0.1-alpha.170 → 0.0.1-alpha.171

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reportportal/ui-kit",
3
- "version": "0.0.1-alpha.170",
3
+ "version": "0.0.1-alpha.171",
4
4
  "description": "The UI-kit library for ReportPortal Design System.",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -1,213 +0,0 @@
1
- import { jsxs as F, Fragment as G, jsx as o } from "react/jsx-runtime";
2
- import { useMemo as T, forwardRef as W, useRef as q } from "react";
3
- import E from "react-datepicker/dist/es/index.js";
4
- import { c as L } from "./bind-06a7ff84.js";
5
- import { F as B } from "./fieldText-1749da7a.js";
6
- import { D as x } from "./dropdown-7d024c49.js";
7
- import { S as I } from "./calendarArrow-44c7e60e.js";
8
- import { registerLocale as z } from "react-datepicker";
9
- const De = (t, n) => {
10
- z(t, n);
11
- }, J = (t, n, d = 20) => {
12
- const c = new Array(d).fill(void 0).map((f, m) => t - m), _ = t - d + 1;
13
- return n > t ? [n, ...c] : n < _ ? [...c, n] : c;
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
- }, l = L.bind(Z), ee = ({
24
- date: t = /* @__PURE__ */ new Date(),
25
- changeYear: n = () => {
26
- },
27
- changeMonth: d = () => {
28
- },
29
- decreaseMonth: c = () => {
30
- },
31
- increaseMonth: _ = () => {
32
- },
33
- prevMonthButtonDisabled: f = !1,
34
- nextMonthButtonDisabled: m = !1,
35
- headerNodes: h = null,
36
- customClassName: v = "",
37
- yearsOptions: b = [],
38
- locale: D
39
- }) => {
40
- const i = t.getFullYear(), S = t.getMonth(), N = T(() => {
41
- const e = Array(12).keys(), p = new Intl.DateTimeFormat(D, {
42
- month: "long"
43
- }), a = (w) => p.format(new Date(i, w));
44
- return Array.from(e, a).reduce((w, R, C) => w.concat({
45
- value: C,
46
- label: R
47
- }), []);
48
- }, [D, i]), y = T(() => {
49
- const e = (/* @__PURE__ */ new Date()).getFullYear();
50
- return (b.length > 0 ? b : J(e, i)).reduce(
51
- (a, s) => a.concat({ value: s, label: `${s}` }),
52
- []
53
- );
54
- }, [b, i]), A = (e) => {
55
- d(e);
56
- }, r = (e) => {
57
- n(e);
58
- };
59
- return /* @__PURE__ */ F(G, { children: [
60
- h && /* @__PURE__ */ o("div", { className: l(v), children: h }),
61
- /* @__PURE__ */ F("div", { className: l("header"), children: [
62
- /* @__PURE__ */ o(
63
- "button",
64
- {
65
- type: "button",
66
- "aria-label": "Previous Months",
67
- disabled: f,
68
- onClick: (e) => {
69
- e.stopPropagation(), c();
70
- },
71
- className: l("button-prev", { disabled: f }),
72
- children: /* @__PURE__ */ o(I, {})
73
- }
74
- ),
75
- /* @__PURE__ */ F("div", { className: l("dropdowns-wrapper"), children: [
76
- /* @__PURE__ */ o(
77
- x,
78
- {
79
- options: N,
80
- value: S,
81
- onChange: A,
82
- transparentBackground: !0,
83
- className: l("dropdown", "month-dropdown"),
84
- toggleButtonClassName: l("toggle-button")
85
- }
86
- ),
87
- /* @__PURE__ */ o(
88
- x,
89
- {
90
- options: y,
91
- value: i,
92
- onChange: r,
93
- transparentBackground: !0,
94
- className: l("dropdown"),
95
- toggleButtonClassName: l("toggle-button")
96
- }
97
- )
98
- ] }),
99
- /* @__PURE__ */ o(
100
- "button",
101
- {
102
- type: "button",
103
- "aria-label": "Next Months",
104
- disabled: m,
105
- onClick: (e) => {
106
- e.stopPropagation(), _();
107
- },
108
- className: l("button-next", { disabled: m }),
109
- children: /* @__PURE__ */ o(I, {})
110
- }
111
- )
112
- ] })
113
- ] });
114
- }, te = "_calendar_evrpf_5", ne = "_date_evrpf_103", oe = "_disabled_evrpf_149", re = "_popper_evrpf_157", ae = "_input_evrpf_161", se = {
115
- calendar: te,
116
- "current-date": "_current-date_evrpf_102",
117
- date: ne,
118
- "end-date": "_end-date_evrpf_120",
119
- "selected-range": "_selected-range_evrpf_130",
120
- disabled: oe,
121
- popper: re,
122
- input: ae,
123
- "input-range": "_input-range_evrpf_168"
124
- }, u = L.bind(se), de = "en", ce = "MM-dd-yyyy", le = " to ", ie = W(({ value: t, ...n }, d) => {
125
- const c = (t == null ? void 0 : t.replace(" - ", le)) ?? "";
126
- return /* @__PURE__ */ o(B, { ...n, value: c, ref: d });
127
- }), Ne = (t) => {
128
- const {
129
- onChange: n = () => {
130
- },
131
- disabled: d = !1,
132
- onBlur: c = () => {
133
- },
134
- onFocus: _ = () => {
135
- },
136
- headerNodes: f = null,
137
- customClassName: m = "",
138
- customTimeInput: h = void 0,
139
- shouldCloseOnSelect: v = !0,
140
- popperClassName: b = "",
141
- calendarClassName: D = "",
142
- popperPlacement: i = "bottom-start",
143
- fixedHeight: S = !0,
144
- language: N = de,
145
- yearsOptions: y = [],
146
- dateFormat: A = ce,
147
- value: r = null
148
- } = t, e = "selectsRange" in t && t.selectsRange === !0, p = q(null), a = e ? (r == null ? void 0 : r[0]) ?? void 0 : void 0, s = e ? (r == null ? void 0 : r[1]) ?? void 0 : void 0, w = a == null ? void 0 : a.toDateString(), R = s == null ? void 0 : s.toDateString(), C = s && a && s > a, O = e ? "Select date range" : "Select date", Y = t.placeholder ?? O, $ = (g) => {
149
- if (!e) {
150
- const V = r == null ? void 0 : r.toDateString(), j = g.toDateString();
151
- return u("date", {
152
- "current-date": j === V,
153
- disabled: d
154
- });
155
- }
156
- const k = g.toDateString(), H = k === w, M = C && k === R, U = a && s && g > a && g < s;
157
- return u("date", {
158
- "current-date": H,
159
- "selected-range": U && !M,
160
- "end-date": M && C,
161
- disabled: d
162
- });
163
- }, P = {
164
- customInput: e ? /* @__PURE__ */ o(ie, { className: u("input", "input-range"), defaultWidth: !1, ref: p }) : /* @__PURE__ */ o(B, { className: u("input"), defaultWidth: !1, ref: p }),
165
- placeholderText: Y,
166
- disabled: d,
167
- shouldCloseOnSelect: v,
168
- fixedHeight: S,
169
- locale: N,
170
- showPopperArrow: !1,
171
- dayClassName: $,
172
- calendarClassName: u(D, "calendar"),
173
- renderCustomHeader: (g) => /* @__PURE__ */ o(
174
- ee,
175
- {
176
- ...g,
177
- headerNodes: f,
178
- customClassName: m,
179
- yearsOptions: y,
180
- locale: N
181
- }
182
- ),
183
- onBlur: c,
184
- onFocus: _,
185
- customTimeInput: h,
186
- showTimeInput: !!h,
187
- popperClassName: u(b, "popper"),
188
- dateFormat: A,
189
- className: u("datepicker"),
190
- popperPlacement: i
191
- };
192
- return e ? /* @__PURE__ */ o(
193
- E,
194
- {
195
- ...P,
196
- selectsRange: !0,
197
- startDate: a,
198
- endDate: s,
199
- onChange: n
200
- }
201
- ) : /* @__PURE__ */ o(
202
- E,
203
- {
204
- ...P,
205
- selected: r,
206
- onChange: n
207
- }
208
- );
209
- };
210
- export {
211
- Ne as D,
212
- De as r
213
- };