@reportportal/ui-kit 0.0.1-alpha.170 → 0.0.1-alpha.172
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/dist/bulkPanel.js +52 -51
- package/dist/common/hooks/index.d.ts +1 -0
- package/dist/common/hooks/useEllipsisTitle.d.ts +6 -0
- package/dist/common/hooks.js +28 -26
- package/dist/components/filtersButton/filtersButton.d.ts +5 -0
- package/dist/components/index.d.ts +1 -1
- package/dist/components/sidePanel/sidePanel.d.ts +5 -1
- package/dist/datePicker-cde99de3.js +222 -0
- package/dist/datePicker.js +2 -2
- package/dist/filterItem.js +56 -63
- package/dist/filtersButton.js +71 -19
- package/dist/index.js +93 -91
- package/dist/sidePanel.js +99 -56
- package/dist/style.css +2 -2
- package/dist/useEllipsisTitle-462fa254.js +22 -0
- package/package.json +1 -1
- package/dist/datePicker-412fb8e8.js +0 -213
package/dist/bulkPanel.js
CHANGED
|
@@ -10,8 +10,8 @@ import { K as Z } from "./keyCodes-f63c0e11.js";
|
|
|
10
10
|
import { S as ee } from "./selection-9124d029.js";
|
|
11
11
|
import { Chip as ne } from "./chip.js";
|
|
12
12
|
import { B } from "./button-97d9e587.js";
|
|
13
|
-
import { Tooltip as
|
|
14
|
-
import { S as
|
|
13
|
+
import { Tooltip as le } from "./tooltip.js";
|
|
14
|
+
import { S as te } from "./chevronDownDropdown-0260bb66.js";
|
|
15
15
|
import { S as ie } from "./warning-537ead32.js";
|
|
16
16
|
import "./close-4d480ef7.js";
|
|
17
17
|
import "@floating-ui/react";
|
|
@@ -37,41 +37,42 @@ const ae = "_expanded_ue1t9_6", se = "_header_ue1t9_32", oe = "_tabs_ue1t9_119",
|
|
|
37
37
|
"items-list": "_items-list_ue1t9_167",
|
|
38
38
|
item: de,
|
|
39
39
|
"tooltip-wrapper": "_tooltip-wrapper_ue1t9_179"
|
|
40
|
-
},
|
|
40
|
+
}, l = J.bind(me), pe = {
|
|
41
41
|
selected: "selected",
|
|
42
42
|
clearSelection: "Clear selection",
|
|
43
43
|
selectedItems: "Selected items",
|
|
44
44
|
eligibleTab: "Eligible Items",
|
|
45
45
|
ineligibleTab: "Ineligible Items",
|
|
46
|
-
ineligibleInfoMessage: (
|
|
46
|
+
ineligibleInfoMessage: (t) => /* @__PURE__ */ s(y, { children: [
|
|
47
47
|
"You have ",
|
|
48
|
-
/* @__PURE__ */ n("b", { children:
|
|
49
|
-
" ineligible
|
|
48
|
+
/* @__PURE__ */ n("b", { children: t }),
|
|
49
|
+
" ineligible item",
|
|
50
|
+
t === 1 ? "" : "s"
|
|
50
51
|
] }),
|
|
51
|
-
cancelButton: (
|
|
52
|
-
proceedButton: (
|
|
52
|
+
cancelButton: (t) => `Cancel "${t}"`,
|
|
53
|
+
proceedButton: (t) => `Proceed with ${t} Eligible Item${t === 1 ? "" : "s"}`
|
|
53
54
|
}, u = {
|
|
54
55
|
ELIGIBLE: "eligible",
|
|
55
56
|
INELIGIBLE: "ineligible"
|
|
56
57
|
}, Ge = ({
|
|
57
|
-
items:
|
|
58
|
-
actions:
|
|
59
|
-
captions:
|
|
58
|
+
items: t,
|
|
59
|
+
actions: $ = [],
|
|
60
|
+
captions: D,
|
|
60
61
|
infoMessage: x,
|
|
61
|
-
className:
|
|
62
|
+
className: K,
|
|
62
63
|
portalRoot: f,
|
|
63
64
|
onRemoveItem: w,
|
|
64
|
-
onClearSelection:
|
|
65
|
+
onClearSelection: M
|
|
65
66
|
}) => {
|
|
66
|
-
const r = { ...pe, ...
|
|
67
|
+
const r = { ...pe, ...D }, [o, v] = k(!1), [I, C] = k(u.INELIGIBLE), [i, E] = k(null), S = U(null), d = i !== null, { eligibleItems: b, ineligibleItems: h } = P(() => {
|
|
67
68
|
var g;
|
|
68
|
-
if (!
|
|
69
|
+
if (!i)
|
|
69
70
|
return { eligibleItems: [], ineligibleItems: [] };
|
|
70
|
-
const e = ((g =
|
|
71
|
-
return { eligibleItems:
|
|
72
|
-
}, [
|
|
71
|
+
const e = ((g = i.onValidate) == null ? void 0 : g.call(i, t)) ?? [], a = new Set(e.map((L) => L.id));
|
|
72
|
+
return { eligibleItems: t.filter((L) => !a.has(L.id)), ineligibleItems: e };
|
|
73
|
+
}, [t, i]), m = b.length, p = h.length, O = d && m > 0, T = d && p > 0 ? r.ineligibleInfoMessage(p) : null, F = P(() => d ? p === 0 ? b : m === 0 ? h : I === u.ELIGIBLE ? b : h : t, [
|
|
73
74
|
d,
|
|
74
|
-
|
|
75
|
+
t,
|
|
75
76
|
b,
|
|
76
77
|
h,
|
|
77
78
|
I,
|
|
@@ -84,15 +85,15 @@ const ae = "_expanded_ue1t9_6", se = "_header_ue1t9_32", oe = "_tabs_ue1t9_119",
|
|
|
84
85
|
}, []), V = _(
|
|
85
86
|
(e) => {
|
|
86
87
|
var N, g;
|
|
87
|
-
(N = e.onClick) == null || N.call(e), (((g = e.onValidate) == null ? void 0 : g.call(e,
|
|
88
|
+
(N = e.onClick) == null || N.call(e), (((g = e.onValidate) == null ? void 0 : g.call(e, t)) ?? []).length === 0 ? (e.onProceed(t, !0), c()) : (E(e), C(u.INELIGIBLE), v(!0));
|
|
88
89
|
},
|
|
89
|
-
[
|
|
90
|
+
[t, c]
|
|
90
91
|
), j = _(() => {
|
|
91
|
-
const e =
|
|
92
|
+
const e = i == null ? void 0 : i.onCancel;
|
|
92
93
|
E(null), c(), e == null || e();
|
|
93
|
-
}, [
|
|
94
|
-
|
|
95
|
-
}, [
|
|
94
|
+
}, [i, c]), W = _(() => {
|
|
95
|
+
i == null || i.onProceed(b), E(null), c();
|
|
96
|
+
}, [i, b, c]), Y = _(() => {
|
|
96
97
|
v((e) => !e);
|
|
97
98
|
}, []), q = _(
|
|
98
99
|
(e) => {
|
|
@@ -107,7 +108,7 @@ const ae = "_expanded_ue1t9_6", se = "_header_ue1t9_32", oe = "_tabs_ue1t9_119",
|
|
|
107
108
|
a.keyCode === Z.ESCAPE_KEY_CODE && c();
|
|
108
109
|
};
|
|
109
110
|
return document.addEventListener("keydown", e, !1), () => document.removeEventListener("keydown", e, !1);
|
|
110
|
-
}, [o, c]), X(S, o ? c : void 0),
|
|
111
|
+
}, [o, c]), X(S, o ? c : void 0), t.length === 0)
|
|
111
112
|
return null;
|
|
112
113
|
const A = (e) => h.some((a) => a.id === e.id), R = (e) => {
|
|
113
114
|
const a = /* @__PURE__ */ n(
|
|
@@ -119,10 +120,10 @@ const ae = "_expanded_ue1t9_6", se = "_header_ue1t9_32", oe = "_tabs_ue1t9_119",
|
|
|
119
120
|
},
|
|
120
121
|
e.id
|
|
121
122
|
);
|
|
122
|
-
return /* @__PURE__ */ n("div", { className:
|
|
123
|
-
|
|
123
|
+
return /* @__PURE__ */ n("div", { className: l("item"), children: e.tooltipContent ? /* @__PURE__ */ n(
|
|
124
|
+
le,
|
|
124
125
|
{
|
|
125
|
-
wrapperClassName:
|
|
126
|
+
wrapperClassName: l("tooltip-wrapper"),
|
|
126
127
|
content: e.tooltipContent,
|
|
127
128
|
placement: "top",
|
|
128
129
|
width: 270,
|
|
@@ -134,26 +135,26 @@ const ae = "_expanded_ue1t9_6", se = "_header_ue1t9_32", oe = "_tabs_ue1t9_119",
|
|
|
134
135
|
}, G = /* @__PURE__ */ n(
|
|
135
136
|
"div",
|
|
136
137
|
{
|
|
137
|
-
className:
|
|
138
|
+
className: l("bulk-panel", { expanded: o }, K),
|
|
138
139
|
role: "region",
|
|
139
140
|
"aria-label": "Bulk actions panel",
|
|
140
|
-
children: /* @__PURE__ */ s("div", { className:
|
|
141
|
-
/* @__PURE__ */ s("div", { className:
|
|
142
|
-
/* @__PURE__ */ s("div", { className:
|
|
141
|
+
children: /* @__PURE__ */ s("div", { className: l("panel-content", { expanded: o }), ref: S, children: [
|
|
142
|
+
/* @__PURE__ */ s("div", { className: l("header"), children: [
|
|
143
|
+
/* @__PURE__ */ s("div", { className: l("selection-info"), children: [
|
|
143
144
|
/* @__PURE__ */ n(
|
|
144
145
|
"button",
|
|
145
146
|
{
|
|
146
147
|
onClick: Y,
|
|
147
148
|
"aria-label": o ? "Collapse panel" : "Expand panel",
|
|
148
149
|
"aria-expanded": o,
|
|
149
|
-
children: /* @__PURE__ */ n("span", { className:
|
|
150
|
+
children: /* @__PURE__ */ n("span", { className: l("expand-icon", { expanded: o }), children: /* @__PURE__ */ n(te, {}) })
|
|
150
151
|
}
|
|
151
152
|
),
|
|
152
153
|
/* @__PURE__ */ n(
|
|
153
154
|
ee,
|
|
154
155
|
{
|
|
155
|
-
selectedCount:
|
|
156
|
-
onClearSelection:
|
|
156
|
+
selectedCount: t.length,
|
|
157
|
+
onClearSelection: M,
|
|
157
158
|
captions: {
|
|
158
159
|
selected: r.selected,
|
|
159
160
|
buttonCaption: r.clearSelection
|
|
@@ -161,15 +162,15 @@ const ae = "_expanded_ue1t9_6", se = "_header_ue1t9_32", oe = "_tabs_ue1t9_119",
|
|
|
161
162
|
}
|
|
162
163
|
)
|
|
163
164
|
] }),
|
|
164
|
-
/* @__PURE__ */ s("div", { className:
|
|
165
|
-
(T || x) && /* @__PURE__ */ s("div", { className:
|
|
166
|
-
/* @__PURE__ */ n("i", { className:
|
|
167
|
-
/* @__PURE__ */ n("div", { className:
|
|
165
|
+
/* @__PURE__ */ s("div", { className: l("header-actions"), children: [
|
|
166
|
+
(T || x) && /* @__PURE__ */ s("div", { className: l("info-message-container"), children: [
|
|
167
|
+
/* @__PURE__ */ n("i", { className: l("warning-icon"), children: /* @__PURE__ */ n(ie, {}) }),
|
|
168
|
+
/* @__PURE__ */ n("div", { className: l("info-message"), children: T || x })
|
|
168
169
|
] }),
|
|
169
|
-
/* @__PURE__ */ n("div", { className:
|
|
170
|
-
/* @__PURE__ */ n(B, { variant: "ghost", onClick: j, children: r.cancelButton((
|
|
171
|
-
|
|
172
|
-
] }) :
|
|
170
|
+
/* @__PURE__ */ n("div", { className: l("buttons-container"), children: d ? /* @__PURE__ */ s(y, { children: [
|
|
171
|
+
/* @__PURE__ */ n(B, { variant: "ghost", onClick: j, children: r.cancelButton((i == null ? void 0 : i.label) ?? "") }),
|
|
172
|
+
O && /* @__PURE__ */ n(B, { variant: "primary", onClick: W, children: r.proceedButton(m) })
|
|
173
|
+
] }) : $.map((e, a) => /* @__PURE__ */ n(
|
|
173
174
|
B,
|
|
174
175
|
{
|
|
175
176
|
variant: e.variant,
|
|
@@ -181,36 +182,36 @@ const ae = "_expanded_ue1t9_6", se = "_header_ue1t9_32", oe = "_tabs_ue1t9_119",
|
|
|
181
182
|
)) })
|
|
182
183
|
] })
|
|
183
184
|
] }),
|
|
184
|
-
/* @__PURE__ */ s("div", { className:
|
|
185
|
-
/* @__PURE__ */ n("div", { className:
|
|
185
|
+
/* @__PURE__ */ s("div", { className: l("items-section"), children: [
|
|
186
|
+
/* @__PURE__ */ n("div", { className: l("items-header"), children: d ? /* @__PURE__ */ s("div", { className: l("tabs"), children: [
|
|
186
187
|
p > 0 && /* @__PURE__ */ s(
|
|
187
188
|
"button",
|
|
188
189
|
{
|
|
189
|
-
className:
|
|
190
|
+
className: l("tab", {
|
|
190
191
|
active: I === u.INELIGIBLE || m === 0
|
|
191
192
|
}),
|
|
192
193
|
onClick: () => C(u.INELIGIBLE),
|
|
193
194
|
children: [
|
|
194
195
|
r.ineligibleTab,
|
|
195
|
-
/* @__PURE__ */ n("span", { className:
|
|
196
|
+
/* @__PURE__ */ n("span", { className: l("tab-count"), children: p })
|
|
196
197
|
]
|
|
197
198
|
}
|
|
198
199
|
),
|
|
199
200
|
m > 0 && /* @__PURE__ */ s(
|
|
200
201
|
"button",
|
|
201
202
|
{
|
|
202
|
-
className:
|
|
203
|
+
className: l("tab", {
|
|
203
204
|
active: I === u.ELIGIBLE || p === 0
|
|
204
205
|
}),
|
|
205
206
|
onClick: () => C(u.ELIGIBLE),
|
|
206
207
|
children: [
|
|
207
208
|
r.eligibleTab,
|
|
208
|
-
/* @__PURE__ */ n("span", { className:
|
|
209
|
+
/* @__PURE__ */ n("span", { className: l("tab-count"), children: m })
|
|
209
210
|
]
|
|
210
211
|
}
|
|
211
212
|
)
|
|
212
213
|
] }) : r.selectedItems }),
|
|
213
|
-
/* @__PURE__ */ n("div", { className:
|
|
214
|
+
/* @__PURE__ */ n("div", { className: l("items-scroll"), children: /* @__PURE__ */ n(Q, { hideTracksWhenNotNeeded: !0, children: /* @__PURE__ */ n("div", { className: l("items-list"), children: F.map((e) => R(e)) }) }) })
|
|
214
215
|
] })
|
|
215
216
|
] })
|
|
216
217
|
}
|
|
@@ -3,3 +3,4 @@ export { useSortable } from './useSortable';
|
|
|
3
3
|
export { useTreeSortable } from './useTreeSortable';
|
|
4
4
|
export { useTreeDropValidation } from './useTreeDropValidation';
|
|
5
5
|
export { useWindowResize } from './useWindowResize';
|
|
6
|
+
export { useEllipsisTitle } from './useEllipsisTitle';
|
package/dist/common/hooks.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { u as
|
|
2
|
-
import { u as
|
|
3
|
-
import { useCallback as
|
|
4
|
-
import { i as
|
|
1
|
+
import { u as E } from "../useOnClickOutside-8f7d68a1.js";
|
|
2
|
+
import { u as A, a as R } from "../useTreeSortable-70a9c8f5.js";
|
|
3
|
+
import { useCallback as D } from "react";
|
|
4
|
+
import { i as x } from "../isEmpty-ccacb5ff.js";
|
|
5
5
|
import { u as W } from "../useWindowResize-a7e1ac92.js";
|
|
6
|
+
import { u as q } from "../useEllipsisTitle-462fa254.js";
|
|
6
7
|
import "react-dnd";
|
|
7
8
|
import "react-dnd-html5-backend";
|
|
8
9
|
import "../common.js";
|
|
@@ -21,46 +22,47 @@ import "../common.js";
|
|
|
21
22
|
* See the License for the specific language governing permissions and
|
|
22
23
|
* limitations under the License.
|
|
23
24
|
*/
|
|
24
|
-
const o = (r) => String(r),
|
|
25
|
-
const s = o(r),
|
|
26
|
-
for (const
|
|
27
|
-
if (o(
|
|
28
|
-
return
|
|
29
|
-
const m = t
|
|
30
|
-
if (!
|
|
25
|
+
const o = (r) => String(r), T = (r, e, f, t = "children") => {
|
|
26
|
+
const s = o(r), a = o(e), i = (c, u) => {
|
|
27
|
+
for (const n of u) {
|
|
28
|
+
if (o(n.id) === c)
|
|
29
|
+
return n;
|
|
30
|
+
const m = n[t] || [];
|
|
31
|
+
if (!x(m)) {
|
|
31
32
|
const p = i(c, m);
|
|
32
33
|
if (p)
|
|
33
34
|
return p;
|
|
34
35
|
}
|
|
35
36
|
}
|
|
36
37
|
return null;
|
|
37
|
-
},
|
|
38
|
-
if (!
|
|
38
|
+
}, l = i(s, f);
|
|
39
|
+
if (!l)
|
|
39
40
|
return !1;
|
|
40
|
-
const
|
|
41
|
-
for (const
|
|
42
|
-
if (o(
|
|
41
|
+
const d = (c) => {
|
|
42
|
+
for (const u of c) {
|
|
43
|
+
if (o(u.id) === a)
|
|
43
44
|
return !0;
|
|
44
|
-
const
|
|
45
|
-
if (!
|
|
45
|
+
const n = u[t] || [];
|
|
46
|
+
if (!x(n) && d(n))
|
|
46
47
|
return !0;
|
|
47
48
|
}
|
|
48
49
|
return !1;
|
|
49
|
-
},
|
|
50
|
-
return
|
|
50
|
+
}, z = l[t] || [];
|
|
51
|
+
return d(z);
|
|
51
52
|
}, S = ({
|
|
52
53
|
items: r,
|
|
53
54
|
childrenKey: e = "children"
|
|
54
|
-
}) => ({ canDropOn:
|
|
55
|
-
(
|
|
56
|
-
const
|
|
57
|
-
return
|
|
55
|
+
}) => ({ canDropOn: D(
|
|
56
|
+
(t, s) => {
|
|
57
|
+
const a = o(t.id), i = o(s);
|
|
58
|
+
return a === i ? !1 : !T(t.id, s, r, e);
|
|
58
59
|
},
|
|
59
60
|
[r, e]
|
|
60
61
|
) });
|
|
61
62
|
export {
|
|
62
|
-
|
|
63
|
-
E as
|
|
63
|
+
q as useEllipsisTitle,
|
|
64
|
+
E as useOnClickOutside,
|
|
65
|
+
A as useSortable,
|
|
64
66
|
S as useTreeDropValidation,
|
|
65
67
|
R as useTreeSortable,
|
|
66
68
|
W as useWindowResize
|
|
@@ -4,6 +4,11 @@ export interface FiltersButtonProps extends Omit<ComponentPropsWithRef<'button'>
|
|
|
4
4
|
appliedFiltersCount?: number;
|
|
5
5
|
isOpen?: boolean;
|
|
6
6
|
type?: 'button' | 'submit';
|
|
7
|
+
text?: string;
|
|
8
|
+
filtersLabelClassName?: string;
|
|
9
|
+
clearable?: boolean;
|
|
10
|
+
onClear?: () => void;
|
|
11
|
+
clearButtonAriaLabel?: string;
|
|
7
12
|
}
|
|
8
13
|
export declare const FiltersButton: (props: FiltersButtonProps & import('react').RefAttributes<HTMLButtonElement>) => import('react').ReactElement<any, string | import('react').JSXElementConstructor<any>> | null;
|
|
9
14
|
export default FiltersButton;
|
|
@@ -36,5 +36,5 @@ export { ThemeProvider } from './themeProvider';
|
|
|
36
36
|
export { Toggle } from './toggle';
|
|
37
37
|
export { Tooltip } from './tooltip';
|
|
38
38
|
export { SidePanel } from './sidePanel';
|
|
39
|
-
export { useTreeDropValidation } from '../common/hooks';
|
|
39
|
+
export { useTreeDropValidation, useEllipsisTitle } from '../common/hooks';
|
|
40
40
|
export * from './icons';
|
|
@@ -12,6 +12,10 @@ export interface SidePanelProps {
|
|
|
12
12
|
isOpen?: boolean;
|
|
13
13
|
onClose?: () => void;
|
|
14
14
|
closeButtonAriaLabel?: string;
|
|
15
|
+
showOverlay?: boolean;
|
|
16
|
+
overlay?: 'default' | 'light-cyan';
|
|
17
|
+
allowCloseOutside?: boolean;
|
|
18
|
+
overlayClassName?: string;
|
|
15
19
|
}
|
|
16
|
-
export declare const SidePanel: ({ className, title, descriptionComponent, headerComponent, contentComponent, footerComponent, top, side, isOpen, onClose, closeButtonAriaLabel, }: SidePanelProps) => import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
export declare const SidePanel: ({ className, title, descriptionComponent, headerComponent, contentComponent, footerComponent, top, side, isOpen, onClose, closeButtonAriaLabel, showOverlay, overlay, allowCloseOutside, overlayClassName, }: SidePanelProps) => import("react/jsx-runtime").JSX.Element;
|
|
17
21
|
export default SidePanel;
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
import { jsxs as R, Fragment as j, jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo as E, forwardRef as G, useRef as V } from "react";
|
|
3
|
+
import v from "react-datepicker/dist/es/index.js";
|
|
4
|
+
import { c as L } from "./bind-06a7ff84.js";
|
|
5
|
+
import { F as W } 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 q } from "react-datepicker";
|
|
9
|
+
const De = (t, n) => {
|
|
10
|
+
q(t, n);
|
|
11
|
+
}, z = (t, n, d = 20) => {
|
|
12
|
+
const c = new Array(d).fill(void 0).map((h, u) => t - u), _ = t - d + 1;
|
|
13
|
+
return n > t ? [n, ...c] : n < _ ? [...c, n] : c;
|
|
14
|
+
}, J = "_header_1s3dn_1", K = "_disabled_1s3dn_25", Q = "_dropdown_1s3dn_8", X = {
|
|
15
|
+
header: J,
|
|
16
|
+
"dropdowns-wrapper": "_dropdowns-wrapper_1s3dn_8",
|
|
17
|
+
"button-prev": "_button-prev_1s3dn_13",
|
|
18
|
+
"button-next": "_button-next_1s3dn_14",
|
|
19
|
+
disabled: K,
|
|
20
|
+
dropdown: Q,
|
|
21
|
+
"month-dropdown": "_month-dropdown_1s3dn_44",
|
|
22
|
+
"toggle-button": "_toggle-button_1s3dn_47"
|
|
23
|
+
}, l = L.bind(X), Z = ({
|
|
24
|
+
date: t = /* @__PURE__ */ new Date(),
|
|
25
|
+
changeYear: n = () => {
|
|
26
|
+
},
|
|
27
|
+
changeMonth: d = () => {
|
|
28
|
+
},
|
|
29
|
+
decreaseMonth: c = () => {
|
|
30
|
+
},
|
|
31
|
+
increaseMonth: _ = () => {
|
|
32
|
+
},
|
|
33
|
+
prevMonthButtonDisabled: h = !1,
|
|
34
|
+
nextMonthButtonDisabled: u = !1,
|
|
35
|
+
headerNodes: b = null,
|
|
36
|
+
customClassName: y = "",
|
|
37
|
+
yearsOptions: f = [],
|
|
38
|
+
locale: D
|
|
39
|
+
}) => {
|
|
40
|
+
const i = t.getFullYear(), S = t.getMonth(), N = E(() => {
|
|
41
|
+
const e = Array(12).keys(), p = new Intl.DateTimeFormat(D, {
|
|
42
|
+
month: "long"
|
|
43
|
+
}), s = (w) => p.format(new Date(i, w));
|
|
44
|
+
return Array.from(e, s).reduce((w, P, C) => w.concat({
|
|
45
|
+
value: C,
|
|
46
|
+
label: P
|
|
47
|
+
}), []);
|
|
48
|
+
}, [D, i]), A = E(() => {
|
|
49
|
+
const e = (/* @__PURE__ */ new Date()).getFullYear();
|
|
50
|
+
return (f.length > 0 ? f : z(e, i)).reduce(
|
|
51
|
+
(s, r) => s.concat({ value: r, label: `${r}` }),
|
|
52
|
+
[]
|
|
53
|
+
);
|
|
54
|
+
}, [f, i]), F = (e) => {
|
|
55
|
+
d(e);
|
|
56
|
+
}, o = (e) => {
|
|
57
|
+
n(e);
|
|
58
|
+
};
|
|
59
|
+
return /* @__PURE__ */ R(j, { children: [
|
|
60
|
+
b && /* @__PURE__ */ a("div", { className: l(y), children: b }),
|
|
61
|
+
/* @__PURE__ */ R("div", { className: l("header"), children: [
|
|
62
|
+
/* @__PURE__ */ a(
|
|
63
|
+
"button",
|
|
64
|
+
{
|
|
65
|
+
type: "button",
|
|
66
|
+
"aria-label": "Previous Months",
|
|
67
|
+
disabled: h,
|
|
68
|
+
onClick: (e) => {
|
|
69
|
+
e.stopPropagation(), c();
|
|
70
|
+
},
|
|
71
|
+
className: l("button-prev", { disabled: h }),
|
|
72
|
+
children: /* @__PURE__ */ a(I, {})
|
|
73
|
+
}
|
|
74
|
+
),
|
|
75
|
+
/* @__PURE__ */ R("div", { className: l("dropdowns-wrapper"), children: [
|
|
76
|
+
/* @__PURE__ */ a(
|
|
77
|
+
x,
|
|
78
|
+
{
|
|
79
|
+
options: N,
|
|
80
|
+
value: S,
|
|
81
|
+
onChange: F,
|
|
82
|
+
transparentBackground: !0,
|
|
83
|
+
className: l("dropdown", "month-dropdown"),
|
|
84
|
+
toggleButtonClassName: l("toggle-button")
|
|
85
|
+
}
|
|
86
|
+
),
|
|
87
|
+
/* @__PURE__ */ a(
|
|
88
|
+
x,
|
|
89
|
+
{
|
|
90
|
+
options: A,
|
|
91
|
+
value: i,
|
|
92
|
+
onChange: o,
|
|
93
|
+
transparentBackground: !0,
|
|
94
|
+
className: l("dropdown"),
|
|
95
|
+
toggleButtonClassName: l("toggle-button")
|
|
96
|
+
}
|
|
97
|
+
)
|
|
98
|
+
] }),
|
|
99
|
+
/* @__PURE__ */ a(
|
|
100
|
+
"button",
|
|
101
|
+
{
|
|
102
|
+
type: "button",
|
|
103
|
+
"aria-label": "Next Months",
|
|
104
|
+
disabled: u,
|
|
105
|
+
onClick: (e) => {
|
|
106
|
+
e.stopPropagation(), _();
|
|
107
|
+
},
|
|
108
|
+
className: l("button-next", { disabled: u }),
|
|
109
|
+
children: /* @__PURE__ */ a(I, {})
|
|
110
|
+
}
|
|
111
|
+
)
|
|
112
|
+
] })
|
|
113
|
+
] });
|
|
114
|
+
}, ee = "_calendar_1si6u_5", te = "_date_1si6u_103", ne = "_disabled_1si6u_149", oe = "_popper_1si6u_157", se = "_input_1si6u_161", re = {
|
|
115
|
+
calendar: ee,
|
|
116
|
+
"current-date": "_current-date_1si6u_102",
|
|
117
|
+
date: te,
|
|
118
|
+
"end-date": "_end-date_1si6u_120",
|
|
119
|
+
"selected-range": "_selected-range_1si6u_130",
|
|
120
|
+
disabled: ne,
|
|
121
|
+
popper: oe,
|
|
122
|
+
input: se,
|
|
123
|
+
"input-range": "_input-range_1si6u_172"
|
|
124
|
+
}, g = L.bind(re), ae = "en", de = "MM-dd-yyyy", ce = " to ", le = G(
|
|
125
|
+
({ selectsRange: t, value: n, ...d }, c) => /* @__PURE__ */ a(
|
|
126
|
+
W,
|
|
127
|
+
{
|
|
128
|
+
...d,
|
|
129
|
+
className: g("input", t ? "input-range" : ""),
|
|
130
|
+
defaultWidth: !1,
|
|
131
|
+
value: t ? (n == null ? void 0 : n.replace(" - ", ce)) ?? "" : n,
|
|
132
|
+
ref: c,
|
|
133
|
+
readOnly: !0
|
|
134
|
+
}
|
|
135
|
+
)
|
|
136
|
+
), Ne = (t) => {
|
|
137
|
+
const {
|
|
138
|
+
onChange: n = () => {
|
|
139
|
+
},
|
|
140
|
+
disabled: d = !1,
|
|
141
|
+
onBlur: c = () => {
|
|
142
|
+
},
|
|
143
|
+
onFocus: _ = () => {
|
|
144
|
+
},
|
|
145
|
+
headerNodes: h = null,
|
|
146
|
+
customClassName: u = "",
|
|
147
|
+
customTimeInput: b = void 0,
|
|
148
|
+
shouldCloseOnSelect: y = !0,
|
|
149
|
+
popperClassName: f = "",
|
|
150
|
+
calendarClassName: D = "",
|
|
151
|
+
popperPlacement: i = "bottom-start",
|
|
152
|
+
fixedHeight: S = !0,
|
|
153
|
+
language: N = ae,
|
|
154
|
+
yearsOptions: A = [],
|
|
155
|
+
dateFormat: F = de,
|
|
156
|
+
value: o = null
|
|
157
|
+
} = t, e = "selectsRange" in t && t.selectsRange === !0, p = V(null), s = e ? (o == null ? void 0 : o[0]) ?? void 0 : void 0, r = e ? (o == null ? void 0 : o[1]) ?? void 0 : void 0, w = s == null ? void 0 : s.toDateString(), P = r == null ? void 0 : r.toDateString(), C = r && s && r > s, O = e ? "Select date range" : "Select date", B = t.placeholder ?? O, k = {
|
|
158
|
+
customInput: /* @__PURE__ */ a(le, { ref: p, selectsRange: e }),
|
|
159
|
+
placeholderText: B,
|
|
160
|
+
disabled: d,
|
|
161
|
+
shouldCloseOnSelect: y,
|
|
162
|
+
fixedHeight: S,
|
|
163
|
+
locale: N,
|
|
164
|
+
showPopperArrow: !1,
|
|
165
|
+
dayClassName: (m) => {
|
|
166
|
+
if (!e) {
|
|
167
|
+
const H = o == null ? void 0 : o.toDateString(), U = m.toDateString();
|
|
168
|
+
return g("date", {
|
|
169
|
+
"current-date": U === H,
|
|
170
|
+
disabled: d
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
const M = m.toDateString(), Y = M === w, T = C && M === P, $ = s && r && m > s && m < r;
|
|
174
|
+
return g("date", {
|
|
175
|
+
"current-date": Y,
|
|
176
|
+
"selected-range": $ && !T,
|
|
177
|
+
"end-date": T && C,
|
|
178
|
+
disabled: d
|
|
179
|
+
});
|
|
180
|
+
},
|
|
181
|
+
calendarClassName: g(D, "calendar"),
|
|
182
|
+
renderCustomHeader: (m) => /* @__PURE__ */ a(
|
|
183
|
+
Z,
|
|
184
|
+
{
|
|
185
|
+
...m,
|
|
186
|
+
headerNodes: h,
|
|
187
|
+
customClassName: u,
|
|
188
|
+
yearsOptions: A,
|
|
189
|
+
locale: N
|
|
190
|
+
}
|
|
191
|
+
),
|
|
192
|
+
onBlur: c,
|
|
193
|
+
onFocus: _,
|
|
194
|
+
customTimeInput: b,
|
|
195
|
+
showTimeInput: !!b,
|
|
196
|
+
popperClassName: g(f, "popper"),
|
|
197
|
+
dateFormat: F,
|
|
198
|
+
className: g("datepicker"),
|
|
199
|
+
popperPlacement: i
|
|
200
|
+
};
|
|
201
|
+
return e ? /* @__PURE__ */ a(
|
|
202
|
+
v,
|
|
203
|
+
{
|
|
204
|
+
...k,
|
|
205
|
+
selectsRange: !0,
|
|
206
|
+
startDate: s,
|
|
207
|
+
endDate: r,
|
|
208
|
+
onChange: n
|
|
209
|
+
}
|
|
210
|
+
) : /* @__PURE__ */ a(
|
|
211
|
+
v,
|
|
212
|
+
{
|
|
213
|
+
...k,
|
|
214
|
+
selected: o,
|
|
215
|
+
onChange: n
|
|
216
|
+
}
|
|
217
|
+
);
|
|
218
|
+
};
|
|
219
|
+
export {
|
|
220
|
+
Ne as D,
|
|
221
|
+
De as r
|
|
222
|
+
};
|
package/dist/datePicker.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { D as t } from "./datePicker-
|
|
2
|
-
import { r as A } from "./datePicker-
|
|
1
|
+
import { D as t } from "./datePicker-cde99de3.js";
|
|
2
|
+
import { r as A } from "./datePicker-cde99de3.js";
|
|
3
3
|
import "react/jsx-runtime";
|
|
4
4
|
import "react";
|
|
5
5
|
import "react-datepicker/dist/es/index.js";
|