@ck-ui/component-library 1.0.17 → 2.0.0
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/CalendarGrid-xx9nYA1_.js +237 -0
- package/dist/{DropdownFooter-DL--mVls.js → DropdownFooter-DIxlKK1Y.js} +1 -1
- package/dist/ScrollDropdown-tf6ex2lE.js +80 -0
- package/dist/assets/DateRangePicker-DNHTCnqT.css +1 -0
- package/dist/assets/ScrollDropdown-CQTxVikn.css +1 -0
- package/dist/assets/index-C4-S_v9y.css +1 -0
- package/dist/assets/index-Dpv0OAoW.css +1 -0
- package/dist/assets/theme-CDdq9khQ.css +1 -0
- package/dist/components/DateRangePicker/Calendar/CalendarGrid.d.ts.map +1 -1
- package/dist/components/DateRangePicker/Calendar/CalendarGrid.js +2 -2
- package/dist/components/DateRangePicker/Calendar/ScrollDropdown.js +1 -1
- package/dist/components/DateRangePicker/DateRangePicker.d.ts.map +1 -1
- package/dist/components/DateRangePicker/DateRangePicker.js +229 -190
- package/dist/components/DateRangePicker/_utils/util.js +2 -2
- package/dist/components/MAVDropdown/index.d.ts +1 -1
- package/dist/components/MAVDropdown/index.d.ts.map +1 -1
- package/dist/components/MAVDropdown/index.js +70 -73
- package/dist/components/Popover/index.d.ts.map +1 -1
- package/dist/components/Popover/index.js +48 -44
- package/dist/components/ProfileDropdown/index.d.ts.map +1 -1
- package/dist/components/ProfileDropdown/index.js +70 -83
- package/dist/components/SingleSelectDropdown/_helpers/DropdownFooter.js +2 -2
- package/dist/components/SingleSelectDropdown/index.js +2 -2
- package/dist/theme/Theme.js +1 -1
- package/dist/theme/theme.css +1 -1
- package/dist/utils/array.d.ts +8 -0
- package/dist/utils/array.d.ts.map +1 -0
- package/dist/utils/array.js +9 -0
- package/dist/utils/color.d.ts +10 -0
- package/dist/utils/color.d.ts.map +1 -0
- package/dist/utils/color.js +22 -0
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +6 -2
- package/package.json +19 -1
- package/dist/CalendarGrid-CsD34cNQ.js +0 -232
- package/dist/ScrollDropdown-SqirjC7s.js +0 -81
- package/dist/assets/DateRangePicker-DLr3_fJA.css +0 -1
- package/dist/assets/ScrollDropdown-BAUrkqoH.css +0 -1
- package/dist/assets/index-Cdmws__2.css +0 -1
- package/dist/assets/index-PKpDB4Cl.css +0 -1
- package/dist/assets/theme-gJHYUL9y.css +0 -1
|
@@ -1,249 +1,286 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import * as
|
|
3
|
-
import { useState as
|
|
4
|
-
import { CKButton as
|
|
5
|
-
import { CKTag as
|
|
6
|
-
import { Tooltip as
|
|
7
|
-
import { S as
|
|
8
|
-
import { normalizeDefinedRanges as
|
|
9
|
-
import { useDropdownDirection as
|
|
10
|
-
import '../../assets/DateRangePicker-
|
|
11
|
-
"ckds-date-range-picker": "_ckds-date-range-
|
|
12
|
-
"ckds-date-range-picker--open": "_ckds-date-range-picker--
|
|
13
|
-
"ckds-date-range-picker__body": "_ckds-date-range-
|
|
14
|
-
"ckds-date-range-picker__sidebar": "_ckds-date-range-
|
|
15
|
-
"ckds-date-range-picker__sidebar-item": "_ckds-date-range-picker__sidebar-
|
|
16
|
-
"ckds-date-range-picker__sidebar-item--active": "_ckds-date-range-picker__sidebar-item--
|
|
17
|
-
"ckds-date-range-picker__calendar": "_ckds-date-range-
|
|
18
|
-
"ckds-date-range-picker__calendar--align-left": "_ckds-date-range-picker__calendar--align-
|
|
19
|
-
"ckds-date-range-picker__calendar--align-right": "_ckds-date-range-picker__calendar--align-
|
|
20
|
-
"ckds-date-range-picker__calendar--enter": "_ckds-date-range-picker__calendar--
|
|
21
|
-
"ckds-date-range-picker__main": "_ckds-date-range-
|
|
22
|
-
"ckds-date-range-picker__footer": "_ckds-date-range-
|
|
23
|
-
"ckds-date-range-picker__date-inputs": "_ckds-date-range-picker__date-
|
|
24
|
-
"ckds-date-range-picker__date-field": "_ckds-date-range-picker__date-
|
|
25
|
-
"ckds-date-range-picker__date-label": "_ckds-date-range-picker__date-
|
|
26
|
-
"ckds-date-range-picker__required-asterisk": "_ckds-date-range-picker__required-
|
|
27
|
-
"ckds-date-range-picker__date-tag": "_ckds-date-range-picker__date-
|
|
28
|
-
"ckds-date-range-picker__date-arrow": "_ckds-date-range-picker__date-
|
|
29
|
-
"ckds-date-range-picker__reset-btn": "_ckds-date-range-picker__reset-
|
|
30
|
-
"ckds-date-range-picker__actions": "_ckds-date-range-
|
|
1
|
+
import { jsxs as D, jsx as d } from "react/jsx-runtime";
|
|
2
|
+
import * as o from "react";
|
|
3
|
+
import { useState as b, useRef as se, useMemo as M, useEffect as F, useCallback as O, useLayoutEffect as be } from "react";
|
|
4
|
+
import { CKButton as B } from "../CKButton/index.js";
|
|
5
|
+
import { CKTag as ie } from "../CKTag/index.js";
|
|
6
|
+
import { Tooltip as Me } from "../Tooltip/index.js";
|
|
7
|
+
import { S as ye, C as ve } from "../../CalendarGrid-xx9nYA1_.js";
|
|
8
|
+
import { getPresetStartDate as C, isSameDay as Z, normalizeDefinedRanges as ce, getDefaultDefinedRanges as Te, normalizeDateForMUI as j, detectMatchingDefinedRange as Ce, detectMatchingPreset as Ee, clampDefinedRange as Le, getEffectiveEnd as Re, formatWithPattern as Se, formatToMonthDayYear as Ne } from "./_utils/util.js";
|
|
9
|
+
import { useDropdownDirection as Be } from "../MultiSelect/_utils/useDropdownDirection.js";
|
|
10
|
+
import '../../assets/DateRangePicker-DNHTCnqT.css';const Pe = (_) => /* @__PURE__ */ o.createElement("svg", { width: 16, height: 16, viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", ..._ }, /* @__PURE__ */ o.createElement("path", { d: "M10.6668 1.3335V4.00016M5.3335 1.3335V4.00016", stroke: "white", strokeLinecap: "round", strokeLinejoin: "round" }), /* @__PURE__ */ o.createElement("path", { d: "M8.66667 2.6665H7.33333C4.81917 2.6665 3.5621 2.6665 2.78105 3.44755C2 4.2286 2 5.48568 2 7.99984V9.33317C2 11.8473 2 13.1044 2.78105 13.8854C3.5621 14.6665 4.81917 14.6665 7.33333 14.6665H8.66667C11.1808 14.6665 12.4379 14.6665 13.2189 13.8854C14 13.1044 14 11.8473 14 9.33317V7.99984C14 5.48568 14 4.2286 13.2189 3.44755C12.4379 2.6665 11.1808 2.6665 8.66667 2.6665Z", stroke: "#2B2B2B", strokeLinecap: "round", strokeLinejoin: "round" }), /* @__PURE__ */ o.createElement("path", { d: "M2 6.6665H14", stroke: "#2B2B2B", strokeLinecap: "round", strokeLinejoin: "round" }), /* @__PURE__ */ o.createElement("path", { d: "M7.99716 9.3335H8.00316M7.99716 12.0002H8.00316M10.6608 9.3335H10.6668M5.3335 9.3335H5.33948M5.3335 12.0002H5.33948", stroke: "#2B2B2B", strokeWidth: 0.666667, strokeLinecap: "round", strokeLinejoin: "round" })), xe = (_) => /* @__PURE__ */ o.createElement("svg", { width: 12, height: 12, viewBox: "0 0 12 12", fill: "none", xmlns: "http://www.w3.org/2000/svg", ..._ }, /* @__PURE__ */ o.createElement("g", { clipPath: "url(#clip0_7800_479)" }, /* @__PURE__ */ o.createElement("path", { d: "M11 6C11 8.76 8.76 11 6 11C3.24 11 1.555 8.22 1.555 8.22M1.555 10.72V8.22H3.815M1 6C1 3.24 3.22 1 6 1C9.335 1 11 3.78 11 3.78M8.78 3.78H11V1.28", stroke: "#737373", strokeWidth: 0.57, strokeLinecap: "round", strokeLinejoin: "round" })), /* @__PURE__ */ o.createElement("defs", null, /* @__PURE__ */ o.createElement("clipPath", { id: "clip0_7800_479" }, /* @__PURE__ */ o.createElement("rect", { width: 12, height: 12, fill: "white" })))), Ae = (_) => /* @__PURE__ */ o.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: 16, height: 16, viewBox: "0 0 16 16", fill: "none", ..._ }, /* @__PURE__ */ o.createElement("path", { d: "M9.61984 3.95312L13.6665 7.9998L9.61984 12.0465", stroke: "#2B2B2B", strokeMiterlimit: 10, strokeLinecap: "round", strokeLinejoin: "round" }), /* @__PURE__ */ o.createElement("path", { d: "M2.33324 8H13.5532", stroke: "#2B2B2B", strokeMiterlimit: 10, strokeLinecap: "round", strokeLinejoin: "round" })), i = {
|
|
11
|
+
"ckds-date-range-picker": "_ckds-date-range-picker_7m6sy_2",
|
|
12
|
+
"ckds-date-range-picker--open": "_ckds-date-range-picker--open_7m6sy_26",
|
|
13
|
+
"ckds-date-range-picker__body": "_ckds-date-range-picker__body_7m6sy_39",
|
|
14
|
+
"ckds-date-range-picker__sidebar": "_ckds-date-range-picker__sidebar_7m6sy_47",
|
|
15
|
+
"ckds-date-range-picker__sidebar-item": "_ckds-date-range-picker__sidebar-item_7m6sy_58",
|
|
16
|
+
"ckds-date-range-picker__sidebar-item--active": "_ckds-date-range-picker__sidebar-item--active_7m6sy_99",
|
|
17
|
+
"ckds-date-range-picker__calendar": "_ckds-date-range-picker__calendar_7m6sy_113",
|
|
18
|
+
"ckds-date-range-picker__calendar--align-left": "_ckds-date-range-picker__calendar--align-left_7m6sy_127",
|
|
19
|
+
"ckds-date-range-picker__calendar--align-right": "_ckds-date-range-picker__calendar--align-right_7m6sy_130",
|
|
20
|
+
"ckds-date-range-picker__calendar--enter": "_ckds-date-range-picker__calendar--enter_7m6sy_133",
|
|
21
|
+
"ckds-date-range-picker__main": "_ckds-date-range-picker__main_7m6sy_138",
|
|
22
|
+
"ckds-date-range-picker__footer": "_ckds-date-range-picker__footer_7m6sy_146",
|
|
23
|
+
"ckds-date-range-picker__date-inputs": "_ckds-date-range-picker__date-inputs_7m6sy_155",
|
|
24
|
+
"ckds-date-range-picker__date-field": "_ckds-date-range-picker__date-field_7m6sy_161",
|
|
25
|
+
"ckds-date-range-picker__date-label": "_ckds-date-range-picker__date-label_7m6sy_167",
|
|
26
|
+
"ckds-date-range-picker__required-asterisk": "_ckds-date-range-picker__required-asterisk_7m6sy_175",
|
|
27
|
+
"ckds-date-range-picker__date-tag": "_ckds-date-range-picker__date-tag_7m6sy_186",
|
|
28
|
+
"ckds-date-range-picker__date-arrow": "_ckds-date-range-picker__date-arrow_7m6sy_199",
|
|
29
|
+
"ckds-date-range-picker__reset-btn": "_ckds-date-range-picker__reset-btn_7m6sy_206",
|
|
30
|
+
"ckds-date-range-picker__actions": "_ckds-date-range-picker__actions_7m6sy_217"
|
|
31
31
|
};
|
|
32
|
-
function
|
|
33
|
-
return
|
|
32
|
+
function ze(_) {
|
|
33
|
+
return Ne(_);
|
|
34
34
|
}
|
|
35
|
-
const
|
|
36
|
-
|
|
35
|
+
const Ye = ({ ranges: _, activeLabel: U, onSelect: c }) => /* @__PURE__ */ d("div", { className: i["ckds-date-range-picker__sidebar"], children: _.map((f) => /* @__PURE__ */ d(
|
|
36
|
+
B,
|
|
37
37
|
{
|
|
38
38
|
type: "button",
|
|
39
|
-
className: `${
|
|
40
|
-
onClick: () =>
|
|
41
|
-
label:
|
|
39
|
+
className: `${i["ckds-date-range-picker__sidebar-item"]} ${U === f.label ? i["ckds-date-range-picker__sidebar-item--active"] : ""}`,
|
|
40
|
+
onClick: () => c(f),
|
|
41
|
+
label: f.label,
|
|
42
|
+
"aria-label": f.label
|
|
42
43
|
},
|
|
43
|
-
|
|
44
|
-
)) }),
|
|
45
|
-
onChange:
|
|
46
|
-
onClear:
|
|
47
|
-
value:
|
|
48
|
-
label:
|
|
49
|
-
minDate:
|
|
50
|
-
maxDate:
|
|
51
|
-
startDate:
|
|
52
|
-
endDate:
|
|
53
|
-
className:
|
|
54
|
-
disabled:
|
|
55
|
-
error:
|
|
56
|
-
definedRanges:
|
|
57
|
-
size:
|
|
58
|
-
dateFormat:
|
|
59
|
-
resetDisabled:
|
|
60
|
-
defaultRange:
|
|
44
|
+
f.label
|
|
45
|
+
)) }), qe = ({
|
|
46
|
+
onChange: _,
|
|
47
|
+
onClear: U,
|
|
48
|
+
value: c,
|
|
49
|
+
label: f = "Select date range",
|
|
50
|
+
minDate: E,
|
|
51
|
+
maxDate: y,
|
|
52
|
+
startDate: V,
|
|
53
|
+
endDate: I,
|
|
54
|
+
className: de = "",
|
|
55
|
+
disabled: J = !1,
|
|
56
|
+
error: oe = !1,
|
|
57
|
+
definedRanges: P,
|
|
58
|
+
size: le = "medium",
|
|
59
|
+
dateFormat: K,
|
|
60
|
+
resetDisabled: Q,
|
|
61
|
+
defaultRange: X
|
|
61
62
|
}) => {
|
|
62
|
-
const
|
|
63
|
+
const g = X ? {
|
|
63
64
|
"7d": "7 Days",
|
|
64
65
|
"3m": "3 Months",
|
|
65
66
|
"6m": "6 Months",
|
|
66
67
|
"1y": "1 Year",
|
|
67
68
|
mtd: "Month to Date",
|
|
68
69
|
ytd: "Year to Date"
|
|
69
|
-
}[
|
|
70
|
+
}[X.toLowerCase()] ?? null : null, L = (() => {
|
|
71
|
+
if (g) return g;
|
|
72
|
+
if (!c?.startDate && !c?.endDate && !V && !I && (E || y)) {
|
|
73
|
+
const e = y ? new Date(y).getTime() < Date.now() ? new Date(y) : /* @__PURE__ */ new Date() : /* @__PURE__ */ new Date(), t = E ? new Date(E) : void 0, s = C("6 Months", e) ?? new Date(e.getFullYear(), e.getMonth() - 6, e.getDate()), r = t && s.getTime() < t.getTime() ? t : s, w = ["6 Months", "3 Months", "Month to Date", "7 Days"];
|
|
74
|
+
for (const re of w) {
|
|
75
|
+
const ne = C(re, e);
|
|
76
|
+
if (ne && Z(ne, r)) return re;
|
|
77
|
+
}
|
|
78
|
+
return "Custom";
|
|
79
|
+
}
|
|
80
|
+
return "Custom";
|
|
81
|
+
})(), [u, R] = b(!1), [ee, S] = b(L), [_e, N] = b(0), [ge, x] = b(c), [ke, v] = b(!1), [A, te] = b(L), z = se(null), W = se(null), { horizontal: pe } = Be(z, u, 400, 820), T = M(
|
|
70
82
|
() => {
|
|
71
|
-
const e =
|
|
83
|
+
const e = ce(P);
|
|
72
84
|
if (e && e.length > 0) {
|
|
73
|
-
if (e.some((
|
|
85
|
+
if (e.some((s) => s.label === "Custom")) return e;
|
|
74
86
|
const t = /* @__PURE__ */ new Date();
|
|
75
87
|
return [
|
|
76
88
|
{ label: "Custom", startDate: t, endDate: t },
|
|
77
89
|
...e
|
|
78
90
|
];
|
|
79
91
|
}
|
|
80
|
-
return
|
|
92
|
+
return Te();
|
|
81
93
|
},
|
|
82
|
-
[
|
|
83
|
-
),
|
|
84
|
-
const e =
|
|
94
|
+
[P]
|
|
95
|
+
), Y = M(() => {
|
|
96
|
+
const e = ce(P);
|
|
85
97
|
return !!(e && e.length > 0);
|
|
86
|
-
}, [
|
|
87
|
-
if (
|
|
88
|
-
let e =
|
|
89
|
-
return
|
|
98
|
+
}, [P]), a = M(() => j(E), [E]), n = M(() => j(y), [y]), p = M(() => j(V), [V]), m = M(() => j(I), [I]), k = M(() => {
|
|
99
|
+
if (p && m) {
|
|
100
|
+
let e = p.getTime() <= m.getTime() ? new Date(p) : new Date(m), t = p.getTime() <= m.getTime() ? new Date(m) : new Date(p);
|
|
101
|
+
return a && e.getTime() < a.getTime() && (e = new Date(a)), n && t.getTime() > n.getTime() && (t = new Date(n)), { startDate: e, endDate: t };
|
|
102
|
+
}
|
|
103
|
+
if (c?.startDate || c?.endDate) return c;
|
|
104
|
+
if (a || n) {
|
|
105
|
+
const e = n && n.getTime() < Date.now() ? new Date(n) : /* @__PURE__ */ new Date();
|
|
106
|
+
let r = C(g ?? "6 Months", e) ?? new Date(e.getFullYear(), e.getMonth() - 6, e.getDate());
|
|
107
|
+
return a && r.getTime() < a.getTime() && (r = new Date(a)), { startDate: r, endDate: e };
|
|
90
108
|
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
const e = v.find((t) => t.label === i);
|
|
109
|
+
}, [c, p, m, a, n, g]), [l, h] = b(k), ae = k ? `${k.startDate?.getTime()}_${k.endDate?.getTime()}` : "";
|
|
110
|
+
F(() => {
|
|
111
|
+
k?.startDate && k?.endDate && (h({
|
|
112
|
+
startDate: new Date(k.startDate),
|
|
113
|
+
endDate: new Date(k.endDate)
|
|
114
|
+
}), N((e) => e + 1));
|
|
115
|
+
}, [ae]), F(() => {
|
|
116
|
+
if (!g || k?.startDate) return;
|
|
117
|
+
const e = T.find((t) => t.label === g);
|
|
101
118
|
if (e && e.label !== "Custom") {
|
|
102
|
-
const t =
|
|
103
|
-
|
|
119
|
+
const t = $(e);
|
|
120
|
+
h(t), x(t), N((s) => s + 1);
|
|
104
121
|
}
|
|
105
|
-
}, []),
|
|
106
|
-
if (!
|
|
107
|
-
const e =
|
|
108
|
-
|
|
109
|
-
const
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
}, [
|
|
114
|
-
|
|
115
|
-
}, [s]), P(() => {
|
|
116
|
-
if (!f) return;
|
|
122
|
+
}, []), be(() => {
|
|
123
|
+
if (!u) return;
|
|
124
|
+
const e = g ? T.find((r) => r.label === g) : void 0, t = k ?? (e ? $(e) : void 0);
|
|
125
|
+
h(t);
|
|
126
|
+
const s = A !== "Custom" ? A : t?.startDate ? q(t) ?? L : L;
|
|
127
|
+
S(s), N((r) => r + 1);
|
|
128
|
+
}, [u, ae]), F(() => {
|
|
129
|
+
c?.startDate && c?.endDate && x(c);
|
|
130
|
+
}, [c]), F(() => {
|
|
131
|
+
if (!u) return;
|
|
117
132
|
const e = (t) => {
|
|
118
|
-
|
|
133
|
+
W.current && !W.current.contains(t.target) && z.current && !z.current.contains(t.target) && R(!1);
|
|
119
134
|
};
|
|
120
135
|
return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
|
|
121
|
-
}, [
|
|
122
|
-
const
|
|
123
|
-
|
|
124
|
-
},
|
|
125
|
-
|
|
126
|
-
},
|
|
127
|
-
|
|
128
|
-
},
|
|
129
|
-
(e) =>
|
|
136
|
+
}, [u]);
|
|
137
|
+
const me = () => {
|
|
138
|
+
J || (u || v(!1), R((e) => !e));
|
|
139
|
+
}, De = () => {
|
|
140
|
+
l && (x(l), te(ee), _(l)), R(!1);
|
|
141
|
+
}, fe = () => {
|
|
142
|
+
h(ge ?? c), R(!1);
|
|
143
|
+
}, q = O(
|
|
144
|
+
(e) => Y ? Ce(
|
|
130
145
|
e,
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
) :
|
|
135
|
-
[
|
|
136
|
-
),
|
|
137
|
-
let t,
|
|
138
|
-
if (
|
|
139
|
-
({ startDate: t, endDate:
|
|
146
|
+
T,
|
|
147
|
+
a,
|
|
148
|
+
n
|
|
149
|
+
) : Ee(e, a, n),
|
|
150
|
+
[Y, T, n, a]
|
|
151
|
+
), $ = O((e) => {
|
|
152
|
+
let t, s;
|
|
153
|
+
if (Y)
|
|
154
|
+
({ startDate: t, endDate: s } = Le(e, a, n));
|
|
140
155
|
else {
|
|
141
|
-
const
|
|
142
|
-
|
|
156
|
+
const r = Re(n);
|
|
157
|
+
s = r, t = C(e.label, r) ?? new Date(e.startDate), a && t.getTime() < a.getTime() && (t = new Date(a));
|
|
143
158
|
}
|
|
144
|
-
return { startDate: t, endDate:
|
|
145
|
-
}, [
|
|
146
|
-
if (
|
|
147
|
-
const t =
|
|
148
|
-
|
|
149
|
-
},
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
159
|
+
return { startDate: t, endDate: s };
|
|
160
|
+
}, [Y, a, n]), he = (e) => {
|
|
161
|
+
if (S(e.label), e.label === "Custom") return;
|
|
162
|
+
const t = $(e);
|
|
163
|
+
h(t), v(e.label !== A), N((s) => s + 1);
|
|
164
|
+
}, ue = () => {
|
|
165
|
+
const e = n && n.getTime() < Date.now() ? new Date(n) : /* @__PURE__ */ new Date();
|
|
166
|
+
let t;
|
|
167
|
+
if (g) {
|
|
168
|
+
const r = T.find((w) => w.label === g);
|
|
169
|
+
t = r ? $(r) : { startDate: e, endDate: e };
|
|
170
|
+
} else if (p && m)
|
|
171
|
+
t = k ?? { startDate: new Date(p), endDate: new Date(m) };
|
|
172
|
+
else {
|
|
173
|
+
const r = C("6 Months", e) ?? new Date(e.getFullYear(), e.getMonth() - 6, e.getDate());
|
|
174
|
+
t = { startDate: a && r.getTime() < a.getTime() ? new Date(a) : r, endDate: e };
|
|
175
|
+
}
|
|
176
|
+
h(t), x(t);
|
|
177
|
+
const s = q(t) ?? L;
|
|
178
|
+
S(s), te(s), v(!1), N((r) => r + 1), _(t), U?.(), R(!1);
|
|
179
|
+
}, we = (() => {
|
|
180
|
+
if (Q !== void 0) return Q;
|
|
181
|
+
if (g) return A === g;
|
|
182
|
+
const e = n && n.getTime() < Date.now() ? new Date(n) : /* @__PURE__ */ new Date();
|
|
183
|
+
let t, s = e;
|
|
184
|
+
if (p && m)
|
|
185
|
+
t = a && p.getTime() < a.getTime() ? new Date(a) : new Date(p), s = n && m.getTime() > n.getTime() ? new Date(n) : new Date(m);
|
|
186
|
+
else {
|
|
187
|
+
if (!a && !n)
|
|
188
|
+
return !1;
|
|
189
|
+
{
|
|
190
|
+
const w = C("6 Months", e) ?? new Date(e.getFullYear(), e.getMonth() - 6, e.getDate());
|
|
191
|
+
t = a && w.getTime() < a.getTime() ? new Date(a) : w;
|
|
156
192
|
}
|
|
157
193
|
}
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
194
|
+
const r = c?.startDate && c?.endDate ? c : k;
|
|
195
|
+
return !r?.startDate || !r?.endDate ? !0 : Z(r.startDate, t) && Z(r.endDate, s);
|
|
196
|
+
})(), H = O(
|
|
197
|
+
(e) => e ? K ? Se(e, K) : ze(e) : "",
|
|
198
|
+
[K]
|
|
199
|
+
), G = c?.startDate && c?.endDate ? `${H(c.startDate)} – ${H(c.endDate)}` : f;
|
|
200
|
+
return /* @__PURE__ */ D(
|
|
164
201
|
"div",
|
|
165
202
|
{
|
|
166
203
|
"data-testid": "date-range-picker",
|
|
167
|
-
className: `${
|
|
168
|
-
ref:
|
|
204
|
+
className: `${i["ckds-date-range-picker"]} ${u ? i["ckds-date-range-picker--open"] : ""} ${de}`,
|
|
205
|
+
ref: z,
|
|
169
206
|
children: [
|
|
170
|
-
/* @__PURE__ */
|
|
171
|
-
|
|
207
|
+
/* @__PURE__ */ d(
|
|
208
|
+
B,
|
|
172
209
|
{
|
|
173
210
|
variant: "secondary",
|
|
174
|
-
error:
|
|
175
|
-
disabled:
|
|
176
|
-
onClick:
|
|
177
|
-
"aria-label":
|
|
178
|
-
size:
|
|
179
|
-
label:
|
|
211
|
+
error: oe,
|
|
212
|
+
disabled: J,
|
|
213
|
+
onClick: me,
|
|
214
|
+
"aria-label": G === f ? f : `Date range: ${G}`,
|
|
215
|
+
size: le,
|
|
216
|
+
label: G,
|
|
180
217
|
icons: {
|
|
181
|
-
left: /* @__PURE__ */
|
|
182
|
-
right: /* @__PURE__ */
|
|
218
|
+
left: /* @__PURE__ */ d(Pe, { width: 16, height: 16 }),
|
|
219
|
+
right: /* @__PURE__ */ d(ye, { width: 16, height: 16 })
|
|
183
220
|
},
|
|
184
221
|
style: { background: "white" }
|
|
185
222
|
}
|
|
186
223
|
),
|
|
187
|
-
|
|
224
|
+
u && /* @__PURE__ */ D(
|
|
188
225
|
"div",
|
|
189
226
|
{
|
|
190
|
-
ref:
|
|
191
|
-
className: `${
|
|
227
|
+
ref: W,
|
|
228
|
+
className: `${i["ckds-date-range-picker__calendar"]} ${i["ckds-date-range-picker__calendar--enter"]} ${pe === "right" ? i["ckds-date-range-picker__calendar--align-right"] : i["ckds-date-range-picker__calendar--align-left"]}`,
|
|
192
229
|
children: [
|
|
193
|
-
/* @__PURE__ */
|
|
194
|
-
/* @__PURE__ */
|
|
195
|
-
|
|
230
|
+
/* @__PURE__ */ D("div", { className: i["ckds-date-range-picker__body"], children: [
|
|
231
|
+
/* @__PURE__ */ d(
|
|
232
|
+
Ye,
|
|
196
233
|
{
|
|
197
|
-
ranges:
|
|
198
|
-
activeLabel:
|
|
199
|
-
onSelect:
|
|
234
|
+
ranges: T,
|
|
235
|
+
activeLabel: ee,
|
|
236
|
+
onSelect: he
|
|
200
237
|
}
|
|
201
238
|
),
|
|
202
|
-
/* @__PURE__ */
|
|
203
|
-
|
|
239
|
+
/* @__PURE__ */ d("div", { className: i["ckds-date-range-picker__main"], children: /* @__PURE__ */ d(
|
|
240
|
+
ve,
|
|
204
241
|
{
|
|
205
|
-
startDate:
|
|
206
|
-
endDate:
|
|
242
|
+
startDate: l?.startDate,
|
|
243
|
+
endDate: l?.endDate,
|
|
207
244
|
onDateClick: (e) => {
|
|
208
|
-
if (!
|
|
209
|
-
|
|
245
|
+
if (!l?.startDate || l.startDate && l.endDate)
|
|
246
|
+
h({ startDate: e, endDate: void 0 }), S("Custom"), v(!1);
|
|
210
247
|
else {
|
|
211
|
-
const t =
|
|
248
|
+
const t = l.startDate;
|
|
212
249
|
if (e.getTime() < t.getTime())
|
|
213
|
-
|
|
250
|
+
h({ startDate: e, endDate: void 0 }), v(!1);
|
|
214
251
|
else {
|
|
215
|
-
const
|
|
216
|
-
|
|
217
|
-
const
|
|
218
|
-
|
|
252
|
+
const s = { startDate: t, endDate: e };
|
|
253
|
+
h(s);
|
|
254
|
+
const r = q(s);
|
|
255
|
+
S(r ?? "Custom"), v(!0);
|
|
219
256
|
}
|
|
220
257
|
}
|
|
221
258
|
},
|
|
222
|
-
minDate:
|
|
223
|
-
maxDate:
|
|
259
|
+
minDate: a,
|
|
260
|
+
maxDate: n
|
|
224
261
|
},
|
|
225
|
-
|
|
262
|
+
_e
|
|
226
263
|
) })
|
|
227
264
|
] }),
|
|
228
|
-
/* @__PURE__ */
|
|
229
|
-
/* @__PURE__ */
|
|
230
|
-
/* @__PURE__ */
|
|
231
|
-
/* @__PURE__ */
|
|
265
|
+
/* @__PURE__ */ D("div", { className: i["ckds-date-range-picker__footer"], children: [
|
|
266
|
+
/* @__PURE__ */ D("div", { className: i["ckds-date-range-picker__date-inputs"], children: [
|
|
267
|
+
/* @__PURE__ */ D("div", { className: i["ckds-date-range-picker__date-field"], children: [
|
|
268
|
+
/* @__PURE__ */ D("span", { className: i["ckds-date-range-picker__date-label"], children: [
|
|
232
269
|
"Start Date",
|
|
233
|
-
/* @__PURE__ */
|
|
270
|
+
/* @__PURE__ */ d("span", { className: i["ckds-date-range-picker__required-asterisk"], children: "*" })
|
|
234
271
|
] }),
|
|
235
|
-
/* @__PURE__ */
|
|
272
|
+
/* @__PURE__ */ d(ie, { size: "small", variation: "NEUTRAL", shape: "pill", fill: "outline", className: i["ckds-date-range-picker__date-tag"], children: H(l?.startDate) || "MM-DD-YYYY" })
|
|
236
273
|
] }),
|
|
237
|
-
/* @__PURE__ */
|
|
238
|
-
/* @__PURE__ */
|
|
239
|
-
/* @__PURE__ */
|
|
274
|
+
/* @__PURE__ */ d("span", { className: i["ckds-date-range-picker__date-arrow"], children: /* @__PURE__ */ d(Ae, {}) }),
|
|
275
|
+
/* @__PURE__ */ D("div", { className: i["ckds-date-range-picker__date-field"], children: [
|
|
276
|
+
/* @__PURE__ */ D("span", { className: i["ckds-date-range-picker__date-label"], children: [
|
|
240
277
|
"End Date",
|
|
241
|
-
/* @__PURE__ */
|
|
278
|
+
/* @__PURE__ */ d("span", { className: i["ckds-date-range-picker__required-asterisk"], children: "*" })
|
|
242
279
|
] }),
|
|
243
|
-
/* @__PURE__ */
|
|
280
|
+
/* @__PURE__ */ d(ie, { size: "small", variation: "NEUTRAL", shape: "pill", fill: "outline", className: i["ckds-date-range-picker__date-tag"], children: H(l?.endDate) || "MM-DD-YYYY" })
|
|
244
281
|
] }),
|
|
245
|
-
/* @__PURE__ */
|
|
246
|
-
|
|
282
|
+
/* @__PURE__ */ d(
|
|
283
|
+
Me,
|
|
247
284
|
{
|
|
248
285
|
title: "Reset selection and navigation to default",
|
|
249
286
|
placement: "top",
|
|
@@ -263,28 +300,30 @@ const Ae = ({ ranges: o, activeLabel: N, onSelect: s }) => /* @__PURE__ */ n("di
|
|
|
263
300
|
padding: "var(--ckcl-spacing-sm, 8px) var(--ckcl-spacing-ms, 12px)",
|
|
264
301
|
borderRadius: "8px",
|
|
265
302
|
lineHeight: "var(--ckcl-leading-sm, 16px)",
|
|
266
|
-
borderColor: "var(--ckcl-black-350, #676666)"
|
|
303
|
+
borderColor: "var(--ckcl-black-350, #676666)",
|
|
304
|
+
fontFamily: "Inter",
|
|
305
|
+
fontWeight: "400"
|
|
267
306
|
}
|
|
268
307
|
}
|
|
269
308
|
},
|
|
270
|
-
children: /* @__PURE__ */
|
|
271
|
-
|
|
309
|
+
children: /* @__PURE__ */ d(
|
|
310
|
+
B,
|
|
272
311
|
{
|
|
273
312
|
variant: "secondary",
|
|
274
313
|
size: "medium",
|
|
275
|
-
onClick:
|
|
276
|
-
disabled:
|
|
314
|
+
onClick: ue,
|
|
315
|
+
disabled: we,
|
|
277
316
|
"aria-label": "Reset selection and navigation to default",
|
|
278
|
-
className:
|
|
279
|
-
icons: { left: /* @__PURE__ */
|
|
317
|
+
className: i["ckds-date-range-picker__reset-btn"],
|
|
318
|
+
icons: { left: /* @__PURE__ */ d(xe, {}) }
|
|
280
319
|
}
|
|
281
320
|
)
|
|
282
321
|
}
|
|
283
322
|
)
|
|
284
323
|
] }),
|
|
285
|
-
/* @__PURE__ */
|
|
286
|
-
/* @__PURE__ */
|
|
287
|
-
/* @__PURE__ */
|
|
324
|
+
/* @__PURE__ */ D("div", { className: i["ckds-date-range-picker__actions"], children: [
|
|
325
|
+
/* @__PURE__ */ d(B, { variant: "secondary", label: "Cancel", size: "medium", onClick: fe }),
|
|
326
|
+
/* @__PURE__ */ d(B, { variant: "primary", label: "Apply", size: "medium", onClick: De, disabled: !ke || !l?.startDate || !l?.endDate })
|
|
288
327
|
] })
|
|
289
328
|
] })
|
|
290
329
|
]
|
|
@@ -295,5 +334,5 @@ const Ae = ({ ranges: o, activeLabel: N, onSelect: s }) => /* @__PURE__ */ n("di
|
|
|
295
334
|
);
|
|
296
335
|
};
|
|
297
336
|
export {
|
|
298
|
-
|
|
337
|
+
qe as DateRangePicker
|
|
299
338
|
};
|
|
@@ -132,8 +132,8 @@ const B = (t) => new Date(t.getFullYear(), t.getMonth(), 1), F = (t) => new Date
|
|
|
132
132
|
"Year to Date"
|
|
133
133
|
];
|
|
134
134
|
for (const i of r) {
|
|
135
|
-
|
|
136
|
-
if (a && (e && a.getTime() < e.getTime() &&
|
|
135
|
+
const a = _(i, n);
|
|
136
|
+
if (a && !(e && a.getTime() < e.getTime()) && m(t.startDate, a) && m(t.endDate, n))
|
|
137
137
|
return i;
|
|
138
138
|
}
|
|
139
139
|
return null;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { MAVDropdownProps } from './_types/mavDropdown.types';
|
|
2
|
-
export declare function MAVDropdown({ triggerLabel, selectedItem, items, onSelect,
|
|
2
|
+
export declare function MAVDropdown({ triggerLabel, selectedItem, items, onSelect, className, }: MAVDropdownProps): import("react/jsx-runtime").JSX.Element;
|
|
3
3
|
export declare namespace MAVDropdown {
|
|
4
4
|
var displayName: string;
|
|
5
5
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/components/MAVDropdown/index.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,gBAAgB,EAAW,MAAM,4BAA4B,CAAC;AA4B5E,wBAAgB,WAAW,CAAC,EAC1B,YAAoB,EACpB,YAAY,EACZ,KAAK,EACL,QAAQ,EACR,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/components/MAVDropdown/index.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,gBAAgB,EAAW,MAAM,4BAA4B,CAAC;AA4B5E,wBAAgB,WAAW,CAAC,EAC1B,YAAoB,EACpB,YAAY,EACZ,KAAK,EACL,QAAQ,EACR,SAAS,GACV,EAAE,gBAAgB,2CAoIlB;yBA1Ie,WAAW"}
|