@xola/ui-kit 3.4.6 → 3.5.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/build/components/Alert.js +4 -8
- package/build/components/Avatar.js +4 -4
- package/build/components/Badge.d.ts +2 -2
- package/build/components/Badge.js +19 -19
- package/build/components/Breadcrumb.js +1 -1
- package/build/components/Breakdown.js +20 -20
- package/build/components/Buttons/Button.js +1 -1
- package/build/components/Buttons/ButtonGroup.js +8 -8
- package/build/components/Buttons/SubmitButton.js +13 -13
- package/build/components/Buttons/ToggleButton.js +1 -1
- package/build/components/Counter.js +1 -1
- package/build/components/DatePicker/DatePicker.js +19 -19
- package/build/components/DatePicker/DatePickerPopover.js +7 -7
- package/build/components/DatePicker/Day.js +1 -1
- package/build/components/DatePicker/LocalizedDayPicker.js +14 -14
- package/build/components/DatePicker/MonthGrid.js +4 -4
- package/build/components/DatePicker/NavbarElement.js +3 -3
- package/build/components/DatePicker/RangeDatePicker.js +3 -7
- package/build/components/DatePicker/UpcomingDatePicker.js +14 -14
- package/build/components/Dot/Dot.js +4 -4
- package/build/components/Drawer.js +5 -5
- package/build/components/Forms/BaseInput.js +4 -4
- package/build/components/Forms/Checkbox.js +5 -5
- package/build/components/Forms/ComboBox.js +10 -10
- package/build/components/Forms/FormGroup.js +3 -3
- package/build/components/Forms/InlineValuePopover.js +9 -9
- package/build/components/Forms/Input.js +5 -5
- package/build/components/Forms/Label.js +3 -3
- package/build/components/Forms/RangeSlider.js +14 -14
- package/build/components/Forms/Switch.js +15 -15
- package/build/components/Forms/Textarea.js +4 -4
- package/build/components/HeaderToolbar.js +1 -1
- package/build/components/ImageUpload.js +1 -1
- package/build/components/Key.js +6 -6
- package/build/components/Logo.js +4 -4
- package/build/components/Modal.js +1 -1
- package/build/components/Popover/Popover.js +6 -12
- package/build/components/Popover/PopoverList.js +9 -18
- package/build/components/Search.js +7 -7
- package/build/components/Sidebar/Sidebar.Account.js +5 -5
- package/build/components/Sidebar/Sidebar.Button.js +4 -4
- package/build/components/Sidebar/Sidebar.Heading.js +4 -4
- package/build/components/Sidebar/Sidebar.Link.js +21 -20
- package/build/components/Sidebar/Sidebar.Menu.d.ts +3 -0
- package/build/components/Sidebar/Sidebar.Menu.js +15 -13
- package/build/components/Sidebar/Sidebar.js +1 -1
- package/build/components/Skeleton.js +7 -7
- package/build/components/Spinner.js +1 -1
- package/build/components/Table.js +1 -1
- package/build/components/Tabs/Tabs.Panel.js +5 -5
- package/build/components/Tabs/Tabs.Tab.js +7 -7
- package/build/components/Tabs/Tabs.js +7 -7
- package/build/components/Tag.js +9 -9
- package/build/components/Utilities/Phone.js +3 -3
- package/build/full.css +1 -1
- package/build/helpers/classnames.js +8 -0
- package/build/helpers/flash.js +4 -4
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsxs as i, jsx as t } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
3
|
-
import { CloseIcon as
|
|
2
|
+
import n from "../helpers/classnames.js";
|
|
3
|
+
import { CloseIcon as s } from "../icons/src/CloseIcon.js";
|
|
4
4
|
const o = {
|
|
5
5
|
primary: "bg-primary-lighter text-black",
|
|
6
6
|
secondary: "bg-secondary-lighter text-black",
|
|
@@ -11,15 +11,11 @@ const o = {
|
|
|
11
11
|
}, u = ({ color: r = "primary", children: a, className: l, onClose: e, ...c }) => /* @__PURE__ */ i(
|
|
12
12
|
"div",
|
|
13
13
|
{
|
|
14
|
-
className:
|
|
15
|
-
"ui-alert flex items-start rounded px-3 py-3 text-base leading-4",
|
|
16
|
-
o[r],
|
|
17
|
-
l
|
|
18
|
-
),
|
|
14
|
+
className: n("ui-alert flex items-start rounded px-3 py-3 text-base leading-4", o[r], l),
|
|
19
15
|
...c,
|
|
20
16
|
children: [
|
|
21
17
|
/* @__PURE__ */ t("span", { className: "ui-alert-content w-full leading-p1", children: a }),
|
|
22
|
-
e ? /* @__PURE__ */ t("button", { type: "button", className: "ui-alert-close ml-3 cursor-pointer hover:text-gray-dark", children: /* @__PURE__ */ t(
|
|
18
|
+
e ? /* @__PURE__ */ t("button", { type: "button", className: "ui-alert-close ml-3 cursor-pointer hover:text-gray-dark", children: /* @__PURE__ */ t(s, { onClick: e }) }) : null
|
|
23
19
|
]
|
|
24
20
|
}
|
|
25
21
|
);
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import { jsx as a } from "react/jsx-runtime";
|
|
2
|
-
import n from "
|
|
3
|
-
import
|
|
2
|
+
import { getInitials as n } from "../helpers/avatar.js";
|
|
3
|
+
import m from "../helpers/classnames.js";
|
|
4
4
|
const o = {
|
|
5
5
|
tiny: "h-7 w-7 text-base",
|
|
6
6
|
small: "h-10 w-10 text-base",
|
|
7
7
|
medium: "h-12 w-12 text-md",
|
|
8
8
|
large: "h-15 w-15 text-xl"
|
|
9
9
|
}, f = ({ name: t, color: e = "bg-primary-lighter", size: r = "large", className: i, ...l }) => {
|
|
10
|
-
const s =
|
|
10
|
+
const s = m(
|
|
11
11
|
"ui-avatar",
|
|
12
12
|
"inline-flex items-center justify-center rounded-full text-black leading-none",
|
|
13
13
|
o[r],
|
|
14
14
|
e,
|
|
15
15
|
i
|
|
16
16
|
);
|
|
17
|
-
return /* @__PURE__ */ a("div", { title: t, className: s, ...l, children:
|
|
17
|
+
return /* @__PURE__ */ a("div", { title: t, className: s, ...l, children: n(t) });
|
|
18
18
|
};
|
|
19
19
|
export {
|
|
20
20
|
f as Avatar
|
|
@@ -10,10 +10,10 @@ declare const colors: {
|
|
|
10
10
|
readonly critical: "bg-danger text-white";
|
|
11
11
|
};
|
|
12
12
|
declare const sizes: {
|
|
13
|
-
readonly
|
|
13
|
+
readonly tiny: "px-2 py-0.5 h-4 text-xs";
|
|
14
14
|
readonly small: "px-2 py-0.75 h-5 text-sm leading-sm";
|
|
15
15
|
readonly medium: "px-3 py-1.5 h-7.5 text-base leading-base";
|
|
16
|
-
readonly large: "px-3.5 py-0.75 h-
|
|
16
|
+
readonly large: "px-3.5 py-0.75 h-8 text-md leading-md";
|
|
17
17
|
};
|
|
18
18
|
type BadgeColor = keyof typeof colors;
|
|
19
19
|
type BadgeSize = keyof typeof sizes;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import r from "clsx";
|
|
1
|
+
import { jsxs as l } from "react/jsx-runtime";
|
|
3
2
|
import { cloneElement as g } from "react";
|
|
4
|
-
|
|
3
|
+
import r from "../helpers/classnames.js";
|
|
4
|
+
const m = {
|
|
5
5
|
primary: "bg-primary-lighter text-primary-dark",
|
|
6
6
|
secondary: "bg-secondary-lighter text-black",
|
|
7
7
|
success: "bg-success-lightish text-success-darker",
|
|
@@ -10,33 +10,33 @@ const c = {
|
|
|
10
10
|
danger: "bg-danger-lightish text-danger-dark",
|
|
11
11
|
problem: "bg-warning text-white",
|
|
12
12
|
critical: "bg-danger text-white"
|
|
13
|
-
},
|
|
14
|
-
|
|
13
|
+
}, c = {
|
|
14
|
+
tiny: "px-2 py-0.5 h-4 text-xs",
|
|
15
15
|
small: "px-2 py-0.75 h-5 text-sm leading-sm",
|
|
16
16
|
medium: "px-3 py-1.5 h-7.5 text-base leading-base",
|
|
17
|
-
large: "px-3.5 py-0.75 h-
|
|
18
|
-
},
|
|
19
|
-
|
|
20
|
-
small: "w-3 h-3",
|
|
21
|
-
medium: "w-4 h-4",
|
|
22
|
-
large: "w-5 h-5 mr-1
|
|
23
|
-
},
|
|
17
|
+
large: "px-3.5 py-0.75 h-8 text-md leading-md"
|
|
18
|
+
}, d = {
|
|
19
|
+
tiny: "!w-2.5 !h-2.5",
|
|
20
|
+
small: "!w-3 !h-3",
|
|
21
|
+
medium: "!w-4 !h-4",
|
|
22
|
+
large: "!w-4.5 !h-4.5 mr-1"
|
|
23
|
+
}, x = ({ color: a = "primary", size: e = "small", icon: t, children: i, className: n, ...s }) => /* @__PURE__ */ l(
|
|
24
24
|
"span",
|
|
25
25
|
{
|
|
26
26
|
className: r(
|
|
27
27
|
"ui-badge",
|
|
28
28
|
"inline-flex items-center whitespace-nowrap rounded-full",
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
m[a],
|
|
30
|
+
c[e],
|
|
31
|
+
n
|
|
32
32
|
),
|
|
33
|
-
...
|
|
33
|
+
...s,
|
|
34
34
|
children: [
|
|
35
|
-
t ? g(t, { className: r("mr-1",
|
|
36
|
-
|
|
35
|
+
t ? g(t, { className: r("mr-1", d[e]) }) : null,
|
|
36
|
+
i
|
|
37
37
|
]
|
|
38
38
|
}
|
|
39
39
|
);
|
|
40
40
|
export {
|
|
41
|
-
|
|
41
|
+
x as Badge
|
|
42
42
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as t, jsxs as p, Fragment as b } from "react/jsx-runtime";
|
|
2
|
-
import a from "clsx";
|
|
3
2
|
import { Children as s } from "react";
|
|
3
|
+
import a from "../helpers/classnames.js";
|
|
4
4
|
const x = ({ separator: n = "/", children: r, classNames: e = {}, className: o, ...i }) => {
|
|
5
5
|
const d = s.count(r) - 1;
|
|
6
6
|
return /* @__PURE__ */ t("div", { className: a("ui-breadcrumb", "whitespace-nowrap text-2xl font-semibold", o), ...i, children: s.map(r, (u, l) => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as e, jsxs as m } from "react/jsx-runtime";
|
|
2
|
-
import r from "clsx";
|
|
3
2
|
import { isNumber as f } from "lodash-es";
|
|
4
3
|
import { useMemo as S, createContext as v, useContext as h } from "react";
|
|
4
|
+
import r from "../helpers/classnames.js";
|
|
5
5
|
import { Currency as b } from "./Utilities/Currency.js";
|
|
6
6
|
const w = {
|
|
7
7
|
default: "text-gray-darker",
|
|
@@ -12,22 +12,22 @@ const w = {
|
|
|
12
12
|
success: "text-success",
|
|
13
13
|
danger: "text-danger",
|
|
14
14
|
caution: "text-caution"
|
|
15
|
-
}, u = v(void 0), B = ({ currency: a, locale: t, children: s, className:
|
|
15
|
+
}, u = v(void 0), B = ({ currency: a, locale: t, children: s, className: c, ...l }) => {
|
|
16
16
|
const i = S(() => ({ currency: a, locale: t }), [a, t]);
|
|
17
|
-
return /* @__PURE__ */ e(u.Provider, { value: i, children: /* @__PURE__ */ e("table", { className: r("ui-breakdown", "w-full",
|
|
17
|
+
return /* @__PURE__ */ e(u.Provider, { value: i, children: /* @__PURE__ */ e("table", { className: r("ui-breakdown", "w-full", c), ...l, children: /* @__PURE__ */ e("tbody", { children: s }) }) });
|
|
18
18
|
}, k = ({
|
|
19
19
|
info: a,
|
|
20
20
|
methodIcon: t,
|
|
21
21
|
secondary: s,
|
|
22
|
-
value:
|
|
23
|
-
color:
|
|
22
|
+
value: c,
|
|
23
|
+
color: l = "default",
|
|
24
24
|
children: i,
|
|
25
25
|
classNames: d = {},
|
|
26
26
|
className: o,
|
|
27
27
|
...p
|
|
28
28
|
}) => {
|
|
29
|
-
const n = h(u),
|
|
30
|
-
return /* @__PURE__ */ m("tr", { className: r("ui-breakdown-item", w[
|
|
29
|
+
const n = h(u), g = n == null ? void 0 : n.currency, x = n == null ? void 0 : n.locale;
|
|
30
|
+
return /* @__PURE__ */ m("tr", { className: r("ui-breakdown-item", w[l], o), ...p, children: [
|
|
31
31
|
/* @__PURE__ */ m("td", { colSpan: 2, className: r("break-words text-left leading-none", d.key), children: [
|
|
32
32
|
/* @__PURE__ */ e("span", { className: "mr-0.5", children: t }),
|
|
33
33
|
/* @__PURE__ */ e("span", { className: r("mr-1 break-normal md:break-all", d.children), children: i ?? "" }),
|
|
@@ -36,17 +36,17 @@ const w = {
|
|
|
36
36
|
s && /* @__PURE__ */ e("span", { className: "empty:hidden", children: s })
|
|
37
37
|
] })
|
|
38
38
|
] }),
|
|
39
|
-
/* @__PURE__ */ e("td", { className: r("w-[1%] whitespace-nowrap pl-4 text-right", d.value), children: f(
|
|
39
|
+
/* @__PURE__ */ e("td", { className: r("w-[1%] whitespace-nowrap pl-4 text-right", d.value), children: f(c) ? /* @__PURE__ */ e(
|
|
40
40
|
b,
|
|
41
41
|
{
|
|
42
42
|
shouldRemoveTrailingZeroes: !1,
|
|
43
|
-
currency:
|
|
44
|
-
locale:
|
|
43
|
+
currency: g,
|
|
44
|
+
locale: x,
|
|
45
45
|
compact: void 0,
|
|
46
46
|
isNarrowSymbolForm: void 0,
|
|
47
|
-
children:
|
|
47
|
+
children: c
|
|
48
48
|
}
|
|
49
|
-
) : /* @__PURE__ */ e("span", { children:
|
|
49
|
+
) : /* @__PURE__ */ e("span", { children: c }) })
|
|
50
50
|
] });
|
|
51
51
|
};
|
|
52
52
|
k.displayName = "Breakdown.Item";
|
|
@@ -54,16 +54,16 @@ const y = ({
|
|
|
54
54
|
info: a,
|
|
55
55
|
value: t,
|
|
56
56
|
color: s = "black",
|
|
57
|
-
children:
|
|
58
|
-
classNames:
|
|
57
|
+
children: c,
|
|
58
|
+
classNames: l = {},
|
|
59
59
|
className: i,
|
|
60
60
|
...d
|
|
61
61
|
}) => {
|
|
62
62
|
const o = h(u), p = o == null ? void 0 : o.currency, n = o == null ? void 0 : o.locale;
|
|
63
63
|
return /* @__PURE__ */ m("tr", { className: r("ui-breakdown-subtotal-item", "font-bold", w[s], i), ...d, children: [
|
|
64
|
-
/* @__PURE__ */ e("td", { className: r("pb-4 pt-1 text-left",
|
|
65
|
-
/* @__PURE__ */ e("td", { className: r("whitespace-nowrap pb-4 pt-1 text-right",
|
|
66
|
-
/* @__PURE__ */ e("td", { className: r("w-[1%] whitespace-nowrap pb-4 pl-4 pt-1 text-right",
|
|
64
|
+
/* @__PURE__ */ e("td", { className: r("pb-4 pt-1 text-left", l.children), children: c }),
|
|
65
|
+
/* @__PURE__ */ e("td", { className: r("whitespace-nowrap pb-4 pt-1 text-right", l.info), children: a }),
|
|
66
|
+
/* @__PURE__ */ e("td", { className: r("w-[1%] whitespace-nowrap pb-4 pl-4 pt-1 text-right", l.value), children: /* @__PURE__ */ e(
|
|
67
67
|
b,
|
|
68
68
|
{
|
|
69
69
|
shouldRemoveTrailingZeroes: !1,
|
|
@@ -77,12 +77,12 @@ const y = ({
|
|
|
77
77
|
] });
|
|
78
78
|
};
|
|
79
79
|
y.displayName = "Breakdown.SubtotalItem";
|
|
80
|
-
const
|
|
81
|
-
|
|
80
|
+
const N = ({ className: a, ...t }) => /* @__PURE__ */ e("tr", { className: r("ui-breakdown-separator", a), ...t, children: /* @__PURE__ */ e("td", { colSpan: 3, className: "border-b border-gray-light pb-1" }) });
|
|
81
|
+
N.displayName = "Breakdown.Separator";
|
|
82
82
|
const T = Object.assign(B, {
|
|
83
83
|
Item: k,
|
|
84
84
|
SubtotalItem: y,
|
|
85
|
-
Separator:
|
|
85
|
+
Separator: N
|
|
86
86
|
});
|
|
87
87
|
export {
|
|
88
88
|
T as Breakdown
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as d, jsxs as g } from "react/jsx-runtime";
|
|
2
|
-
import m from "clsx";
|
|
3
2
|
import x, { Children as h, cloneElement as y } from "react";
|
|
3
|
+
import m from "../../helpers/classnames.js";
|
|
4
4
|
const B = {
|
|
5
5
|
small: "px-2 py-1.5 text-sm",
|
|
6
6
|
medium: "py-3 px-2.5 text-base",
|
|
@@ -13,11 +13,11 @@ const B = {
|
|
|
13
13
|
className: u,
|
|
14
14
|
onChange: t,
|
|
15
15
|
...n
|
|
16
|
-
}) => /* @__PURE__ */ d("span", { className: m("ui-button-group", "inline-flex whitespace-nowrap", u), ...n, children: h.map(p, (r,
|
|
16
|
+
}) => /* @__PURE__ */ d("span", { className: m("ui-button-group", "inline-flex whitespace-nowrap", u), ...n, children: h.map(p, (r, s) => {
|
|
17
17
|
if (!x.isValidElement(r) || r.props.isHidden)
|
|
18
18
|
return null;
|
|
19
|
-
const
|
|
20
|
-
return e !== void 0 && (
|
|
19
|
+
const o = { size: i };
|
|
20
|
+
return e !== void 0 && (o.isActive = e === s), a && e >= 0 && e !== s && (o.shouldShowText = !1), t && (o.onClick = () => t(s)), y(r, o);
|
|
21
21
|
}) }), c = ({
|
|
22
22
|
as: i,
|
|
23
23
|
isActive: e,
|
|
@@ -28,17 +28,17 @@ const B = {
|
|
|
28
28
|
icon: t,
|
|
29
29
|
iconPlacement: n = "left",
|
|
30
30
|
children: r,
|
|
31
|
-
className:
|
|
32
|
-
...
|
|
31
|
+
className: s,
|
|
32
|
+
...o
|
|
33
33
|
}) => {
|
|
34
|
-
const f = i ?? "button", l = { ...
|
|
34
|
+
const f = i ?? "button", l = { ...o };
|
|
35
35
|
delete l.isActive, delete l.shouldShowText, delete l.isHidden;
|
|
36
36
|
const b = m(
|
|
37
37
|
"ui-button-group-button",
|
|
38
38
|
"inline-flex border-t border-l border-b last:border-r first:rounded-l-md last:rounded-r-md transition-colors focus:ring disabled:opacity-60 focus:z-10 leading-none",
|
|
39
39
|
B[u],
|
|
40
40
|
e ? "bg-primary border-primary text-white hover:bg-primary-dark" : "border-gray-light hover:bg-gray-lighter text-gray-darker",
|
|
41
|
-
|
|
41
|
+
s
|
|
42
42
|
);
|
|
43
43
|
return /* @__PURE__ */ g(f, { className: b, ...l, children: [
|
|
44
44
|
t && n === "left" ? /* @__PURE__ */ d("span", { className: "mr-2 flex-shrink-0", children: t }) : null,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { jsxs as l, jsx as
|
|
1
|
+
import { jsxs as l, jsx as o } from "react/jsx-runtime";
|
|
2
2
|
import { Transition as g } from "@headlessui/react";
|
|
3
|
-
import o from "clsx";
|
|
4
3
|
import { useState as y, useEffect as b } from "react";
|
|
4
|
+
import s from "../../helpers/classnames.js";
|
|
5
5
|
import { Spinner as d } from "../Spinner.js";
|
|
6
|
-
import { Button as
|
|
7
|
-
import { CheckIcon as
|
|
6
|
+
import { Button as w } from "./Button.js";
|
|
7
|
+
import { CheckIcon as x } from "../../icons/src/CheckIcon.js";
|
|
8
8
|
const N = {
|
|
9
9
|
primary: "!bg-primary-light",
|
|
10
10
|
secondary: "!bg-secondary-light",
|
|
@@ -33,18 +33,18 @@ const N = {
|
|
|
33
33
|
}, [c, e]);
|
|
34
34
|
const t = !!e || r;
|
|
35
35
|
return /* @__PURE__ */ l(
|
|
36
|
-
|
|
36
|
+
w,
|
|
37
37
|
{
|
|
38
38
|
color: i,
|
|
39
39
|
variant: n,
|
|
40
40
|
disabled: t || m,
|
|
41
|
-
className:
|
|
41
|
+
className: s(u, "relative", t && N[i]),
|
|
42
42
|
...f,
|
|
43
43
|
children: [
|
|
44
|
-
/* @__PURE__ */
|
|
44
|
+
/* @__PURE__ */ o(
|
|
45
45
|
"span",
|
|
46
46
|
{
|
|
47
|
-
className:
|
|
47
|
+
className: s(
|
|
48
48
|
"absolute inset-0 flex items-center justify-center",
|
|
49
49
|
t ? "opacity-100" : "opacity-0"
|
|
50
50
|
),
|
|
@@ -58,22 +58,22 @@ const N = {
|
|
|
58
58
|
enterFrom: "opacity-0",
|
|
59
59
|
enterTo: "opacity-100",
|
|
60
60
|
children: [
|
|
61
|
-
r && /* @__PURE__ */
|
|
62
|
-
|
|
61
|
+
r && /* @__PURE__ */ o(
|
|
62
|
+
x,
|
|
63
63
|
{
|
|
64
64
|
size: "medium",
|
|
65
|
-
className:
|
|
65
|
+
className: s("relative -top-0.25 text-white", {
|
|
66
66
|
"text-black": n === "outline"
|
|
67
67
|
})
|
|
68
68
|
}
|
|
69
69
|
),
|
|
70
|
-
e && !r && /* @__PURE__ */
|
|
70
|
+
e && !r && /* @__PURE__ */ o(d, { size: "current", color: "current", className: "relative -top-0.25 text-white" })
|
|
71
71
|
]
|
|
72
72
|
}
|
|
73
73
|
)
|
|
74
74
|
}
|
|
75
75
|
),
|
|
76
|
-
/* @__PURE__ */
|
|
76
|
+
/* @__PURE__ */ o("span", { className: s(t ? "flex-shrink flex-grow opacity-0" : "opacity-100"), children: p })
|
|
77
77
|
]
|
|
78
78
|
}
|
|
79
79
|
);
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { jsx as s, jsxs as X, Fragment as kt } from "react/jsx-runtime";
|
|
2
|
-
import Dt from "clsx";
|
|
3
2
|
import Y from "dayjs";
|
|
4
3
|
import { isArray as h, isFunction as M } from "lodash-es";
|
|
5
|
-
import { useContext as
|
|
6
|
-
import { isBefore as C, startOfDay as b, endOfDay as v, isAfter as tt, isSameDay as
|
|
7
|
-
import { Tooltip as
|
|
8
|
-
import { RelativeDateRange as
|
|
9
|
-
import { MonthSelector as
|
|
10
|
-
import { UpcomingDatePicker as
|
|
11
|
-
import { now as f, isSame as L, isValidTimeZoneName as
|
|
12
|
-
import { Context as
|
|
4
|
+
import { useContext as Dt, useState as N, useEffect as yt, useCallback as V, useMemo as jt } from "react";
|
|
5
|
+
import { isBefore as C, startOfDay as b, endOfDay as v, isAfter as tt, isSameDay as Rt } from "date-fns";
|
|
6
|
+
import { Tooltip as Nt } from "../Tooltip.js";
|
|
7
|
+
import { RelativeDateRange as Vt } from "./RelativeDateRange.js";
|
|
8
|
+
import { MonthSelector as Lt } from "./MonthSelector.js";
|
|
9
|
+
import { UpcomingDatePicker as Ot } from "./UpcomingDatePicker.js";
|
|
10
|
+
import { now as f, isSame as L, isValidTimeZoneName as St, toDate as l } from "../../helpers/date.js";
|
|
11
|
+
import { Context as Et } from "../Provider.js";
|
|
12
|
+
import Ft from "../../helpers/classnames.js";
|
|
13
13
|
import { Day as rt } from "./Day.js";
|
|
14
14
|
import { LocalizedDayPicker as _t } from "./LocalizedDayPicker.js";
|
|
15
15
|
import { MonthYearSelector as Tt } from "./MonthYearSelector.js";
|
|
@@ -44,9 +44,9 @@ const P = {
|
|
|
44
44
|
...H
|
|
45
45
|
}) => {
|
|
46
46
|
var K, Q;
|
|
47
|
-
const { locale: j } =
|
|
48
|
-
|
|
49
|
-
u && !
|
|
47
|
+
const { locale: j } = Dt(Et), o = u ?? void 0, st = r ? U === P.single ? r : r.from : null, [d, _] = N(it ?? st ?? f(void 0, o).toDate()), [mt, Z] = N(() => !r || typeof r != "object" || !("from" in r) || !r.from ? /* @__PURE__ */ new Date() : r.from), [lt, $] = N(() => !r || typeof r != "object" || !("from" in r) || !("to" in r) || !r.to || !r.from ? f(void 0, o).add(1, "month").toDate() : L(f(r.to, o), f(r.from, o), "month") ? f(r.from, o).add(1, "month").toDate() : r.to), [ct, at] = N(""), p = U === P.range, R = r && typeof r == "object" && "from" in r && "to" in r && r.from && r.to, dt = c && typeof c == "object" && "from" in c && "to" in c && c.from && c.to;
|
|
48
|
+
yt(() => {
|
|
49
|
+
u && !St(u) && (console.log(`${u} is not a valid timezone. Using default timezone now`), Y.tz.setDefault());
|
|
50
50
|
}, [u]);
|
|
51
51
|
const q = (t, e, m) => {
|
|
52
52
|
if (p)
|
|
@@ -91,7 +91,7 @@ const P = {
|
|
|
91
91
|
} else if (n.from && C(b(n.from), b(l(f(t, o))))) {
|
|
92
92
|
const w = n.from, B = v(l(f(t, o), !1));
|
|
93
93
|
a({ from: w, to: B }, e, m);
|
|
94
|
-
} else if (n.from && (tt(b(n.from), b(l(f(t, o)))) ||
|
|
94
|
+
} else if (n.from && (tt(b(n.from), b(l(f(t, o)))) || Rt(n.from, l(f(t, o)))))
|
|
95
95
|
a(
|
|
96
96
|
{
|
|
97
97
|
from: l(f(t, o)),
|
|
@@ -109,8 +109,8 @@ const P = {
|
|
|
109
109
|
},
|
|
110
110
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
111
111
|
[p, R, a, o, r]
|
|
112
|
-
), I =
|
|
113
|
-
|
|
112
|
+
), I = jt(() => (O || S) && d ? (t) => S ? /* @__PURE__ */ s(
|
|
113
|
+
Lt,
|
|
114
114
|
{
|
|
115
115
|
date: t.date || d,
|
|
116
116
|
currentMonth: d,
|
|
@@ -127,7 +127,7 @@ const P = {
|
|
|
127
127
|
}
|
|
128
128
|
) : void 0, [O, S, d, g, D, j]), xt = (t) => {
|
|
129
129
|
const e = y == null ? void 0 : y(t), m = T(t), n = bt(t);
|
|
130
|
-
return e ? /* @__PURE__ */ s(
|
|
130
|
+
return e ? /* @__PURE__ */ s(Nt, { placement: "top", content: e, children: /* @__PURE__ */ s(
|
|
131
131
|
rt,
|
|
132
132
|
{
|
|
133
133
|
disabled: m,
|
|
@@ -152,7 +152,7 @@ const P = {
|
|
|
152
152
|
return /* @__PURE__ */ X(kt, { children: [
|
|
153
153
|
/* @__PURE__ */ X("div", { className: "flex", children: [
|
|
154
154
|
W ? /* @__PURE__ */ s(
|
|
155
|
-
|
|
155
|
+
Ot,
|
|
156
156
|
{
|
|
157
157
|
upcomingDates: W,
|
|
158
158
|
value: r,
|
|
@@ -184,7 +184,7 @@ const P = {
|
|
|
184
184
|
) : /* @__PURE__ */ s(
|
|
185
185
|
_t,
|
|
186
186
|
{
|
|
187
|
-
className:
|
|
187
|
+
className: Ft("pt-6 tracking-tightest rounded-lg ring-0 focus:outline-none focus:ring-0"),
|
|
188
188
|
mode: "single",
|
|
189
189
|
selected: r,
|
|
190
190
|
month: d,
|
|
@@ -224,7 +224,7 @@ const P = {
|
|
|
224
224
|
] }),
|
|
225
225
|
z.Footer ? /* @__PURE__ */ s(z.Footer, {}) : null,
|
|
226
226
|
et && /* @__PURE__ */ s("div", { className: "max-w-200 ", children: /* @__PURE__ */ s("div", { className: "ml-auto w-5/12", children: /* @__PURE__ */ s(
|
|
227
|
-
|
|
227
|
+
Vt,
|
|
228
228
|
{
|
|
229
229
|
value: ct,
|
|
230
230
|
ranges: nt,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import y from "clsx";
|
|
1
|
+
import { jsxs as x, jsx as e } from "react/jsx-runtime";
|
|
3
2
|
import { useState as m, useEffect as E, cloneElement as L, forwardRef as A } from "react";
|
|
4
3
|
import { formatDate as M } from "../../helpers/date.js";
|
|
4
|
+
import y from "../../helpers/classnames.js";
|
|
5
5
|
import { Input as W } from "../Forms/Input.js";
|
|
6
|
-
import { Popover as
|
|
6
|
+
import { Popover as D } from "../Popover/Popover.js";
|
|
7
7
|
import { DatePicker as q } from "./DatePicker.js";
|
|
8
8
|
import { MonthPicker as B } from "./MonthPicker.js";
|
|
9
9
|
import { CalendarIcon as F } from "../../icons/src/CalendarIcon.js";
|
|
@@ -33,8 +33,8 @@ const $ = ({
|
|
|
33
33
|
};
|
|
34
34
|
return E(() => {
|
|
35
35
|
f(t);
|
|
36
|
-
}, [t]), /* @__PURE__ */
|
|
37
|
-
|
|
36
|
+
}, [t]), /* @__PURE__ */ x(
|
|
37
|
+
D,
|
|
38
38
|
{
|
|
39
39
|
visible: c,
|
|
40
40
|
maxWidth: 900,
|
|
@@ -55,7 +55,7 @@ const $ = ({
|
|
|
55
55
|
onClick: s
|
|
56
56
|
}
|
|
57
57
|
),
|
|
58
|
-
/* @__PURE__ */ e(
|
|
58
|
+
/* @__PURE__ */ e(D.Content, { className: "pr-1", children: c && (N === "month" ? /* @__PURE__ */ e(B, { value: t, onChange: a, ...p }) : /* @__PURE__ */ e(
|
|
59
59
|
q,
|
|
60
60
|
{
|
|
61
61
|
variant: r,
|
|
@@ -70,7 +70,7 @@ const $ = ({
|
|
|
70
70
|
]
|
|
71
71
|
}
|
|
72
72
|
);
|
|
73
|
-
}, I = A(({ className: t, ...r }, l) => /* @__PURE__ */
|
|
73
|
+
}, I = A(({ className: t, ...r }, l) => /* @__PURE__ */ x("div", { ref: l, className: "relative flex bg-gray-lighter", children: [
|
|
74
74
|
/* @__PURE__ */ e("div", { className: "pointer-events-none absolute inset-0 flex items-center pl-3", children: /* @__PURE__ */ e(F, { className: "z-10 inline-block" }) }),
|
|
75
75
|
/* @__PURE__ */ e(W, { className: y("no-translate cursor-pointer px-8", t), ...r }),
|
|
76
76
|
/* @__PURE__ */ e("div", { className: "pointer-events-none absolute inset-y-0 right-0 flex items-center pr-3", children: /* @__PURE__ */ e(G, { className: "inline-block" }) })
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { kebabCase as u } from "lodash-es";
|
|
1
|
+
import { jsx as m } from "react/jsx-runtime";
|
|
2
|
+
import { useContext as s, useState as l, useEffect as n } from "react";
|
|
3
|
+
import { DayPicker as p } from "react-day-picker";
|
|
4
|
+
import { kebabCase as f } from "lodash-es";
|
|
6
5
|
import { enUS as r } from "date-fns/locale";
|
|
6
|
+
import u from "../../helpers/classnames.js";
|
|
7
7
|
import { Context as P } from "../Provider.js";
|
|
8
|
-
import { getLocalizationProps as
|
|
9
|
-
const
|
|
10
|
-
const { locale: o } =
|
|
11
|
-
return
|
|
8
|
+
import { getLocalizationProps as z } from "./DatePicker.helpers.js";
|
|
9
|
+
const C = ({ className: a, ...i }) => {
|
|
10
|
+
const { locale: o } = s(P), [c, t] = l({ locale: r });
|
|
11
|
+
return n(() => {
|
|
12
12
|
t({ locale: r });
|
|
13
|
-
const e =
|
|
14
|
-
!e || e === "en" || e === "en-us" ||
|
|
15
|
-
}, [o]), /* @__PURE__ */
|
|
13
|
+
const e = f(o).toLowerCase();
|
|
14
|
+
!e || e === "en" || e === "en-us" || z(o).then(t);
|
|
15
|
+
}, [o]), /* @__PURE__ */ m(p, { className: u(a), ...c, ...i });
|
|
16
16
|
};
|
|
17
|
-
|
|
17
|
+
C.displayName = "LocalizedDayPicker";
|
|
18
18
|
export {
|
|
19
|
-
|
|
19
|
+
C as LocalizedDayPicker
|
|
20
20
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsxs as l, jsx as t } from "react/jsx-runtime";
|
|
2
|
-
import x from "clsx";
|
|
3
2
|
import u from "dayjs";
|
|
4
|
-
import { useContext as
|
|
3
|
+
import { useContext as x } from "react";
|
|
4
|
+
import g from "../../helpers/classnames.js";
|
|
5
5
|
import { Context as C } from "../Provider.js";
|
|
6
6
|
import { Button as i } from "../Buttons/Button.js";
|
|
7
7
|
import { ChevronButton as s } from "./NavbarElement.js";
|
|
@@ -16,7 +16,7 @@ const v = u(), A = ({
|
|
|
16
16
|
handleClear: d,
|
|
17
17
|
handleToday: h
|
|
18
18
|
}) => {
|
|
19
|
-
const { locale: p } =
|
|
19
|
+
const { locale: p } = x(C), f = [...Array.from({ length: 12 }).keys()].map(
|
|
20
20
|
(e) => v.locale(m ?? p).month(e).format("MMM")
|
|
21
21
|
), b = (e) => {
|
|
22
22
|
const o = new Date(r, e);
|
|
@@ -32,7 +32,7 @@ const v = u(), A = ({
|
|
|
32
32
|
"button",
|
|
33
33
|
{
|
|
34
34
|
type: "button",
|
|
35
|
-
className:
|
|
35
|
+
className: g(
|
|
36
36
|
n && n.getMonth() === o && n.getFullYear() === r ? "bg-blue-dark text-white" : "text-black",
|
|
37
37
|
"rounded-md p-4 text-center hover:bg-blue-dark hover:text-white"
|
|
38
38
|
),
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsxs as s, jsx as r } from "react/jsx-runtime";
|
|
2
|
-
import a from "clsx";
|
|
3
2
|
import { useCallback as l } from "react";
|
|
4
3
|
import { useDayPicker as m } from "react-day-picker";
|
|
4
|
+
import a from "../../helpers/classnames.js";
|
|
5
5
|
import { ChevronLeftIcon as p } from "../../icons/src/ChevronLeftIcon.js";
|
|
6
|
-
import { ChevronRightIcon as
|
|
6
|
+
import { ChevronRightIcon as f } from "../../icons/src/ChevronRightIcon.js";
|
|
7
7
|
const C = ({ className: i, onTodayClick: t }) => {
|
|
8
8
|
const { nextMonth: e, previousMonth: o, goToMonth: n } = m(), b = !e, h = !o, d = l(() => {
|
|
9
9
|
o && n(o);
|
|
@@ -22,7 +22,7 @@ const C = ({ className: i, onTodayClick: t }) => {
|
|
|
22
22
|
),
|
|
23
23
|
/* @__PURE__ */ s("span", { className: "flex space-x-2", children: [
|
|
24
24
|
/* @__PURE__ */ r(c, { isVisible: !h, onClick: d, children: /* @__PURE__ */ r(p, {}) }),
|
|
25
|
-
/* @__PURE__ */ r(c, { isVisible: !b, onClick: u, children: /* @__PURE__ */ r(
|
|
25
|
+
/* @__PURE__ */ r(c, { isVisible: !b, onClick: u, children: /* @__PURE__ */ r(f, {}) })
|
|
26
26
|
] })
|
|
27
27
|
] });
|
|
28
28
|
}, c = ({ isVisible: i = !0, children: t, onClick: e }) => /* @__PURE__ */ r(
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsxs as K, jsx as n } from "react/jsx-runtime";
|
|
2
|
-
import a from "clsx";
|
|
3
2
|
import { isFunction as Q, isArray as U } from "lodash-es";
|
|
4
3
|
import { now as d } from "../../helpers/date.js";
|
|
4
|
+
import a from "../../helpers/classnames.js";
|
|
5
5
|
import { Tooltip as V } from "../Tooltip.js";
|
|
6
6
|
import { Day as W } from "./Day.js";
|
|
7
7
|
import { LocalizedDayPicker as F } from "./LocalizedDayPicker.js";
|
|
@@ -84,9 +84,7 @@ const et = ({
|
|
|
84
84
|
/* @__PURE__ */ n(
|
|
85
85
|
F,
|
|
86
86
|
{
|
|
87
|
-
className: a(
|
|
88
|
-
"pt-6 tracking-tightest max-w-[400px] rounded-lg ring-0 focus:outline-none focus:ring-0"
|
|
89
|
-
),
|
|
87
|
+
className: a("pt-6 tracking-tightest max-w-[400px] rounded-lg ring-0 focus:outline-none focus:ring-0"),
|
|
90
88
|
mode: "single",
|
|
91
89
|
selected: b == null ? void 0 : b.from,
|
|
92
90
|
month: c,
|
|
@@ -107,9 +105,7 @@ const et = ({
|
|
|
107
105
|
/* @__PURE__ */ n(
|
|
108
106
|
F,
|
|
109
107
|
{
|
|
110
|
-
className: a(
|
|
111
|
-
"pt-6 tracking-tightest max-w-[400px] rounded-lg ring-0 focus:outline-none focus:ring-0"
|
|
112
|
-
),
|
|
108
|
+
className: a("pt-6 tracking-tightest max-w-[400px] rounded-lg ring-0 focus:outline-none focus:ring-0"),
|
|
113
109
|
mode: "single",
|
|
114
110
|
selected: y || b == null ? void 0 : b.to,
|
|
115
111
|
month: m,
|