@xola/ui-kit 3.5.0 → 3.7.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/README.md +136 -87
- package/build/components/Alert.js +18 -13
- package/build/components/Animation/FadeIn.js +36 -25
- package/build/components/Animation/SlideDown.js +14 -9
- package/build/components/Avatar.js +17 -10
- package/build/components/Badge.js +33 -24
- package/build/components/BottomSheet.js +114 -0
- package/build/components/Breadcrumb.js +27 -21
- package/build/components/Breakdown.js +66 -74
- package/build/components/Buttons/Button.js +53 -47
- package/build/components/Buttons/ButtonGroup.js +42 -39
- package/build/components/Buttons/SecondaryButton.js +31 -0
- package/build/components/Buttons/SubmitButton.js +72 -66
- package/build/components/Buttons/ToggleButton.js +15 -16
- package/build/components/Counter.js +10 -6
- package/build/components/DatePicker/DatePicker.helpers.js +24 -13
- package/build/components/DatePicker/DatePicker.js +196 -223
- package/build/components/DatePicker/DatePickerPopover.js +75 -66
- package/build/components/DatePicker/Day.js +35 -32
- package/build/components/DatePicker/LocalizedDayPicker.js +15 -18
- package/build/components/DatePicker/MonthGrid.js +35 -48
- package/build/components/DatePicker/MonthPicker.js +25 -20
- package/build/components/DatePicker/MonthSelector.js +39 -40
- package/build/components/DatePicker/MonthYearSelector.js +18 -39
- package/build/components/DatePicker/NavbarElement.js +26 -35
- package/build/components/DatePicker/RangeDatePicker.js +104 -123
- package/build/components/DatePicker/RelativeDateRange.js +153 -143
- package/build/components/DatePicker/UpcomingDatePicker.js +29 -25
- package/build/components/Dot/Dot.js +13 -8
- package/build/components/Dot/DotProgress.js +12 -7
- package/build/components/Drawer.js +109 -101
- package/build/components/Forms/BaseInput.js +50 -34
- package/build/components/Forms/Checkbox.js +33 -30
- package/build/components/Forms/ComboBox.js +35 -35
- package/build/components/Forms/FormGroup.js +7 -3
- package/build/components/Forms/InlineValuePopover.js +33 -39
- package/build/components/Forms/Input.js +15 -7
- package/build/components/Forms/Label.js +14 -8
- package/build/components/Forms/RangeSlider.js +41 -22
- package/build/components/Forms/Select.js +5 -6
- package/build/components/Forms/Switch.js +46 -38
- package/build/components/Forms/Textarea.js +37 -30
- package/build/components/Forms/ValuePopoverText.js +5 -8
- package/build/components/GooglePlacesAutocomplete.js +112 -0
- package/build/components/HeaderToolbar.js +30 -22
- package/build/components/ImageUpload.js +76 -79
- package/build/components/Key.js +21 -16
- package/build/components/Logo.js +12 -5
- package/build/components/Modal.js +87 -72
- package/build/components/Popover/Popover.js +40 -31
- package/build/components/Popover/PopoverList.js +43 -36
- package/build/components/Provider.js +7 -8
- package/build/components/Screens/Login.js +97 -126
- package/build/components/Search.js +114 -144
- package/build/components/Sidebar/Sidebar.Account.js +39 -46
- package/build/components/Sidebar/Sidebar.Button.js +45 -19
- package/build/components/Sidebar/Sidebar.Footer.js +8 -7
- package/build/components/Sidebar/Sidebar.Heading.js +11 -8
- package/build/components/Sidebar/Sidebar.Link.js +79 -44
- package/build/components/Sidebar/Sidebar.Menu.js +52 -28
- package/build/components/Sidebar/Sidebar.Notifications.js +107 -0
- package/build/components/Sidebar/Sidebar.js +207 -214
- package/build/components/Sidebar/SidebarContext.js +15 -0
- package/build/components/Sidebar/sidebarWidth.js +41 -0
- package/build/components/Sidebar/useSidebarWidthState.js +115 -0
- package/build/components/Skeleton.js +19 -20
- package/build/components/Spinner.js +18 -10
- package/build/components/Table.js +86 -50
- package/build/components/Tabs/Tabs.Panel.js +9 -5
- package/build/components/Tabs/Tabs.Tab.js +28 -23
- package/build/components/Tabs/Tabs.js +23 -23
- package/build/components/Tag.js +28 -23
- package/build/components/Tooltip.js +19 -5
- package/build/components/Utilities/Currency.js +49 -42
- package/build/components/Utilities/Number.js +14 -12
- package/build/components/Utilities/Phone.js +18 -12
- package/build/helpers/environment.js +10 -0
- package/build/helpers/flash.js +45 -46
- package/build/hooks/useIsMobile.js +8 -0
- package/build/hooks/useViewportHeight.js +6 -12
- package/build/icons/src/AnnounceIcon.js +3 -4
- package/build/icons/src/BellIcon.js +0 -1
- package/build/icons/src/CalendarIcon.js +0 -1
- package/build/icons/src/CheckIcon.js +0 -1
- package/build/icons/src/ChevronDownIcon.js +4 -5
- package/build/icons/src/ChevronLeftIcon.js +0 -1
- package/build/icons/src/ChevronRightIcon.js +0 -1
- package/build/icons/src/CircleNotch.js +0 -1
- package/build/icons/src/CloseIcon.js +11 -9
- package/build/icons/src/DownArrowIcon.js +0 -1
- package/build/icons/src/ImageIcon.js +0 -1
- package/build/icons/src/SearchIcon.js +4 -5
- package/build/icons/src/TrashIcon.js +0 -1
- package/build/icons/src/WarningDiamondIcon.js +0 -1
- package/build/icons/src/helpers/icon.js +5 -9
- package/build/icons/src/images/XolaLogoSimple.js +2 -3
- package/build/index.js +143 -130
- package/build/style.css +1 -0
- package/build/theme.css +76 -0
- package/build/theme.js +2 -0
- package/build/utils/currency.js +5 -5
- package/build/{helpers → utils}/date.js +17 -20
- package/build/utils/numbers.js +12 -12
- package/build/utils/phone.js +12 -14
- package/build/utils/userLocale.js +6 -0
- package/index.css +96 -4
- package/index.d.ts +204 -0
- package/package.json +87 -77
- package/skills/README.md +27 -0
- package/skills/migrate-2.6-to-3.7/SKILL.md +110 -0
- package/tailwind.config.js +5 -2
- package/build/base.css +0 -2
- package/build/components/Alert.d.ts +0 -18
- package/build/components/Animation/FadeIn.d.ts +0 -13
- package/build/components/Animation/SlideDown.d.ts +0 -6
- package/build/components/Avatar.d.ts +0 -16
- package/build/components/Badge.d.ts +0 -28
- package/build/components/Breadcrumb.d.ts +0 -21
- package/build/components/Breakdown.d.ts +0 -63
- package/build/components/Buttons/Button.d.ts +0 -53
- package/build/components/Buttons/ButtonGroup.d.ts +0 -35
- package/build/components/Buttons/SubmitButton.d.ts +0 -11
- package/build/components/Buttons/ToggleButton.d.ts +0 -21
- package/build/components/Charts/BaseChartOptions.d.ts +0 -136
- package/build/components/Charts/HistogramOptions.d.ts +0 -192
- package/build/components/Charts/PieOptions.d.ts +0 -177
- package/build/components/Counter.d.ts +0 -5
- package/build/components/DatePicker/DatePicker.d.ts +0 -41
- package/build/components/DatePicker/DatePicker.helpers.d.ts +0 -17
- package/build/components/DatePicker/DatePickerPopover.d.ts +0 -29
- package/build/components/DatePicker/Day.d.ts +0 -13
- package/build/components/DatePicker/LocalizedDayPicker.d.ts +0 -6
- package/build/components/DatePicker/MonthGrid.d.ts +0 -11
- package/build/components/DatePicker/MonthPicker.d.ts +0 -7
- package/build/components/DatePicker/MonthSelector.d.ts +0 -8
- package/build/components/DatePicker/MonthYearSelector.d.ts +0 -8
- package/build/components/DatePicker/NavbarElement.d.ts +0 -15
- package/build/components/DatePicker/RangeDatePicker.d.ts +0 -25
- package/build/components/DatePicker/RelativeDateRange.d.ts +0 -51
- package/build/components/DatePicker/UpcomingDatePicker.d.ts +0 -11
- package/build/components/Dot/Dot.d.ts +0 -24
- package/build/components/Dot/DotProgress.d.ts +0 -6
- package/build/components/Drawer.d.ts +0 -28
- package/build/components/Forms/BaseInput.d.ts +0 -20
- package/build/components/Forms/Checkbox.d.ts +0 -10
- package/build/components/Forms/ComboBox.d.ts +0 -8
- package/build/components/Forms/FormGroup.d.ts +0 -5
- package/build/components/Forms/InlineValuePopover.d.ts +0 -17
- package/build/components/Forms/Input.d.ts +0 -6
- package/build/components/Forms/Label.d.ts +0 -7
- package/build/components/Forms/RangeSlider.d.ts +0 -33
- package/build/components/Forms/Select.d.ts +0 -5
- package/build/components/Forms/Switch.d.ts +0 -46
- package/build/components/Forms/Textarea.d.ts +0 -6
- package/build/components/Forms/ValuePopoverText.d.ts +0 -6
- package/build/components/GooglePlacesAutocomplete.d.ts +0 -14
- package/build/components/HeaderToolbar.d.ts +0 -21
- package/build/components/ImageUpload.d.ts +0 -17
- package/build/components/Key.d.ts +0 -6
- package/build/components/Logo.d.ts +0 -19
- package/build/components/Modal.d.ts +0 -52
- package/build/components/Popover/Popover.d.ts +0 -20
- package/build/components/Popover/PopoverList.d.ts +0 -25
- package/build/components/Provider.d.ts +0 -18
- package/build/components/Screens/Login.d.ts +0 -25
- package/build/components/Search.d.ts +0 -16
- package/build/components/Sidebar/Sidebar.Account.d.ts +0 -13
- package/build/components/Sidebar/Sidebar.Button.d.ts +0 -10
- package/build/components/Sidebar/Sidebar.Footer.d.ts +0 -8
- package/build/components/Sidebar/Sidebar.Heading.d.ts +0 -10
- package/build/components/Sidebar/Sidebar.Link.d.ts +0 -24
- package/build/components/Sidebar/Sidebar.Menu.d.ts +0 -13
- package/build/components/Sidebar/Sidebar.d.ts +0 -58
- package/build/components/Sidebar/index.d.ts +0 -8
- package/build/components/Skeleton.d.ts +0 -13
- package/build/components/Spinner.d.ts +0 -26
- package/build/components/Table.d.ts +0 -59
- package/build/components/Tabs/Tabs.Panel.d.ts +0 -9
- package/build/components/Tabs/Tabs.Tab.d.ts +0 -19
- package/build/components/Tabs/Tabs.d.ts +0 -27
- package/build/components/Tabs/index.d.ts +0 -4
- package/build/components/Tag.d.ts +0 -25
- package/build/components/Tooltip.d.ts +0 -8
- package/build/components/Utilities/Currency.d.ts +0 -32
- package/build/components/Utilities/Number.d.ts +0 -8
- package/build/components/Utilities/Phone.d.ts +0 -8
- package/build/full.css +0 -2
- package/build/helpers/avatar.d.ts +0 -1
- package/build/helpers/avatar.js +0 -8
- package/build/helpers/browser.d.ts +0 -2
- package/build/helpers/children.d.ts +0 -3
- package/build/helpers/classnames.d.ts +0 -5
- package/build/helpers/currency.d.ts +0 -2
- package/build/helpers/currency.js +0 -11
- package/build/helpers/date.d.ts +0 -12
- package/build/helpers/flash.d.ts +0 -21
- package/build/helpers/numbers.d.ts +0 -4
- package/build/helpers/numbers.js +0 -23
- package/build/helpers/phone.d.ts +0 -11
- package/build/helpers/phone.js +0 -25
- package/build/hooks/useId.d.ts +0 -1
- package/build/hooks/useId.js +0 -9
- package/build/hooks/useIsClient.d.ts +0 -1
- package/build/hooks/useViewportHeight.d.ts +0 -1
- package/build/icons/src/helpers/classnames.js +0 -8
- package/build/index.d.ts +0 -66
- package/build/theme.d.ts +0 -413
- package/build/types/index.d.ts +0 -22
- package/build/types/migration.d.ts +0 -2
- package/build/ui-kit.css +0 -1
- package/build/utils/avatar.d.ts +0 -1
- package/build/utils/currency.d.ts +0 -2
- package/build/utils/index.d.ts +0 -4
- package/build/utils/numbers.d.ts +0 -4
- package/build/utils/phone.d.ts +0 -2
|
@@ -1,241 +1,214 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import { useContext as
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import
|
|
12
|
-
|
|
13
|
-
import { Day as
|
|
14
|
-
import { LocalizedDayPicker as
|
|
15
|
-
import { MonthYearSelector as
|
|
16
|
-
import {
|
|
17
|
-
import
|
|
18
|
-
|
|
1
|
+
import C from "dayjs";
|
|
2
|
+
import { isArray as h, isFunction as N } from "lodash-es";
|
|
3
|
+
import e from "prop-types";
|
|
4
|
+
import s, { useContext as Et, useState as b, useEffect as gt, useMemo as Rt } from "react";
|
|
5
|
+
import ut from "react-day-picker";
|
|
6
|
+
/* empty css */
|
|
7
|
+
import { Tooltip as kt } from "../Tooltip.js";
|
|
8
|
+
import { RelativeDateRange as yt } from "./RelativeDateRange.js";
|
|
9
|
+
import { now as c, isSame as O, isValidTimeZoneName as Tt, toDate as i } from "../../utils/date.js";
|
|
10
|
+
import { Context as bt } from "../Provider.js";
|
|
11
|
+
import Ot from "../../helpers/classnames.js";
|
|
12
|
+
/* empty css */
|
|
13
|
+
import { Day as z } from "./Day.js";
|
|
14
|
+
import { LocalizedDayPicker as St } from "./LocalizedDayPicker.js";
|
|
15
|
+
import { MonthYearSelector as wt } from "./MonthYearSelector.js";
|
|
16
|
+
import { MonthSelector as xt } from "./MonthSelector.js";
|
|
17
|
+
import { NavbarElement as Vt } from "./NavbarElement.js";
|
|
18
|
+
import jt from "./RangeDatePicker.js";
|
|
19
|
+
import { UpcomingDatePicker as Ft } from "./UpcomingDatePicker.js";
|
|
20
|
+
const { DateUtils: R } = ut, S = {
|
|
19
21
|
single: "single",
|
|
20
22
|
range: "range"
|
|
21
|
-
},
|
|
22
|
-
variant:
|
|
23
|
-
value:
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
loadingDays:
|
|
28
|
-
shouldShowYearPicker:
|
|
29
|
-
shouldShowMonthSelector:
|
|
30
|
-
|
|
23
|
+
}, Lt = ({
|
|
24
|
+
variant: B = S.single,
|
|
25
|
+
value: t,
|
|
26
|
+
getDayContent: u,
|
|
27
|
+
disabledDays: p = [],
|
|
28
|
+
selectedDays: a,
|
|
29
|
+
loadingDays: g = [],
|
|
30
|
+
shouldShowYearPicker: w = !1,
|
|
31
|
+
shouldShowMonthSelector: x = !1,
|
|
32
|
+
onChange: d,
|
|
33
|
+
onMonthChange: f,
|
|
34
|
+
onSubmitDateRange: v,
|
|
35
|
+
modifiers: k = {},
|
|
36
|
+
ranges: tt,
|
|
37
|
+
shouldShowRelativeRanges: rt = !1,
|
|
31
38
|
isFutureDatesAllowed: ot = !1,
|
|
32
|
-
|
|
33
|
-
ranges: nt,
|
|
34
|
-
components: z = {},
|
|
35
|
-
locale: D,
|
|
36
|
-
timezoneName: u,
|
|
37
|
-
getDayContent: F,
|
|
39
|
+
components: U = {},
|
|
38
40
|
getTooltip: y,
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
...H
|
|
41
|
+
upcomingDates: q,
|
|
42
|
+
locale: V,
|
|
43
|
+
timezoneName: o = null,
|
|
44
|
+
// seller timezone (e.g. "America/Los_Angeles") to return correct today date
|
|
45
|
+
...A
|
|
45
46
|
}) => {
|
|
46
|
-
var
|
|
47
|
-
const { locale: j } =
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}, [
|
|
51
|
-
const
|
|
52
|
-
if (
|
|
47
|
+
var X, Y, _, M;
|
|
48
|
+
const { locale: j } = Et(bt), et = t ? B === S.single ? t : t.from : null, [D, F] = b(et ?? c(null, o).toDate()), [nt, H] = b(() => !t || !t.from ? /* @__PURE__ */ new Date() : t.from), [ct, Z] = b(() => !t || !t.to || !t.from ? c(null, o).add(1, "month").toDate() : O(c(t.to, o), c(t.from, o), "month") ? c(t.from, o).add(1, "month").toDate() : t.to), [st, ft] = b(""), E = B === S.range, L = t && t.from && t.to, $ = a && a.from && a.to;
|
|
49
|
+
gt(() => {
|
|
50
|
+
o && !Tt(o) && (console.log(`${o} is not a valid timezone. Using default timezone now`), C.tz.setDefault());
|
|
51
|
+
}, [o]);
|
|
52
|
+
const G = (r, n, l) => {
|
|
53
|
+
if (E)
|
|
53
54
|
return;
|
|
54
|
-
const
|
|
55
|
-
|
|
56
|
-
},
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
else if (n && (n.from || n.to) && (n.from || n.to).getTime() === t.getTime()) {
|
|
89
|
-
const w = l(f(t, o)), B = l(f(t, o).endOf("day"), !1);
|
|
90
|
-
a({ from: w, to: B }, e, m);
|
|
91
|
-
} else if (n.from && C(b(n.from), b(l(f(t, o))))) {
|
|
92
|
-
const w = n.from, B = v(l(f(t, o), !1));
|
|
93
|
-
a({ from: w, to: B }, e, m);
|
|
94
|
-
} else if (n.from && (tt(b(n.from), b(l(f(t, o)))) || Rt(n.from, l(f(t, o)))))
|
|
95
|
-
a(
|
|
96
|
-
{
|
|
97
|
-
from: l(f(t, o)),
|
|
98
|
-
to: l(f(n.from).endOf("day"), !1)
|
|
99
|
-
},
|
|
100
|
-
e,
|
|
101
|
-
m
|
|
102
|
-
);
|
|
103
|
-
else {
|
|
104
|
-
const w = v(l(f(t, o), !1));
|
|
105
|
-
a({ from: n.from, to: w }, e, m);
|
|
106
|
-
}
|
|
107
|
-
} else
|
|
108
|
-
a(l(f(t, o)), e, m);
|
|
109
|
-
},
|
|
110
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
111
|
-
[p, R, a, o, r]
|
|
112
|
-
), I = jt(() => (O || S) && d ? (t) => S ? /* @__PURE__ */ s(
|
|
113
|
-
Lt,
|
|
55
|
+
const m = o ? i(c(r, o)) : /* @__PURE__ */ new Date();
|
|
56
|
+
n.disabled || I(m) ? (F(m), f == null || f(m)) : d(m, n, l);
|
|
57
|
+
}, I = (r) => h(p) ? p.some((n) => O(c(n, o), r, "day")) : (N(p), p(r)), it = (r) => h(g) ? g.some((n) => O(c(n, o), r, "day")) : (N(g), g(r)), lt = (r, n) => {
|
|
58
|
+
F(n.from), H(n.from), Z(n.to), d({ ...n, rangeName: r }, k, null);
|
|
59
|
+
}, T = (r) => {
|
|
60
|
+
F(r), f == null || f(r);
|
|
61
|
+
}, J = (r) => {
|
|
62
|
+
H(r), f == null || f(r);
|
|
63
|
+
}, mt = (r) => {
|
|
64
|
+
Z(r), f == null || f(r);
|
|
65
|
+
}, P = (r, n, l) => {
|
|
66
|
+
if (!n.disabled)
|
|
67
|
+
if (O(c(t == null ? void 0 : t.from, o), c(r, o), "month") && J(r), ft(""), E)
|
|
68
|
+
if (L)
|
|
69
|
+
d({ from: i(c(r, o)), to: null }, n, l);
|
|
70
|
+
else if (t && (t.from || t.to) && (t.from || t.to).getTime() === r.getTime()) {
|
|
71
|
+
const m = i(c(r, o)), Dt = i(c(r, o).endOf("day"), !1);
|
|
72
|
+
d({ from: m, to: Dt }, n, l);
|
|
73
|
+
} else t.from && R.isDayBefore(t.from, i(c(r, o))) ? d(R.addDayToRange(i(c(r, o), !1), t), n, l) : t.from && (R.isDayAfter(t.from, i(c(r, o))) || R.isSameDay(t.from, i(c(r, o)))) ? d(
|
|
74
|
+
{
|
|
75
|
+
from: i(c(r, o)),
|
|
76
|
+
to: i(c(t.from).endOf("day"), !1)
|
|
77
|
+
},
|
|
78
|
+
n,
|
|
79
|
+
l
|
|
80
|
+
) : d(
|
|
81
|
+
R.addDayToRange(i(c(r, o).endOf("day"), !1), t),
|
|
82
|
+
n,
|
|
83
|
+
l
|
|
84
|
+
);
|
|
85
|
+
else
|
|
86
|
+
d(i(c(r, o)), n, l);
|
|
87
|
+
}, at = Rt(() => (w || x) && D ? ({ date: r }) => x ? /* @__PURE__ */ s.createElement(
|
|
88
|
+
xt,
|
|
114
89
|
{
|
|
115
|
-
date:
|
|
116
|
-
currentMonth:
|
|
117
|
-
locale:
|
|
118
|
-
onChange:
|
|
90
|
+
date: r,
|
|
91
|
+
currentMonth: D,
|
|
92
|
+
locale: V ?? j,
|
|
93
|
+
onChange: T
|
|
119
94
|
}
|
|
120
|
-
) : /* @__PURE__ */ s(
|
|
121
|
-
|
|
95
|
+
) : /* @__PURE__ */ s.createElement(
|
|
96
|
+
wt,
|
|
122
97
|
{
|
|
123
|
-
date:
|
|
124
|
-
currentMonth:
|
|
125
|
-
locale:
|
|
126
|
-
onChange:
|
|
98
|
+
date: r,
|
|
99
|
+
currentMonth: D,
|
|
100
|
+
locale: V ?? j,
|
|
101
|
+
onChange: T
|
|
127
102
|
}
|
|
128
|
-
) : void 0, [
|
|
129
|
-
const
|
|
130
|
-
return
|
|
131
|
-
|
|
103
|
+
) : void 0, [w, x, D]), dt = (r) => {
|
|
104
|
+
const n = y == null ? void 0 : y(r), l = I(r), m = it(r);
|
|
105
|
+
return n ? /* @__PURE__ */ s.createElement(kt, { placement: "top", content: n }, /* @__PURE__ */ s.createElement(
|
|
106
|
+
z,
|
|
132
107
|
{
|
|
133
|
-
disabled:
|
|
134
|
-
isLoading:
|
|
135
|
-
selectedDate:
|
|
136
|
-
date:
|
|
137
|
-
getContent:
|
|
138
|
-
currentMonth:
|
|
108
|
+
disabled: l,
|
|
109
|
+
isLoading: m,
|
|
110
|
+
selectedDate: t,
|
|
111
|
+
date: r,
|
|
112
|
+
getContent: u,
|
|
113
|
+
currentMonth: D
|
|
139
114
|
}
|
|
140
|
-
)
|
|
141
|
-
|
|
115
|
+
)) : /* @__PURE__ */ s.createElement(
|
|
116
|
+
z,
|
|
142
117
|
{
|
|
143
|
-
disabled:
|
|
144
|
-
isLoading:
|
|
145
|
-
selectedDate:
|
|
146
|
-
date:
|
|
147
|
-
getContent:
|
|
148
|
-
currentMonth:
|
|
118
|
+
disabled: l,
|
|
119
|
+
isLoading: m,
|
|
120
|
+
selectedDate: t,
|
|
121
|
+
date: r,
|
|
122
|
+
getContent: u,
|
|
123
|
+
currentMonth: D
|
|
149
124
|
}
|
|
150
125
|
);
|
|
151
|
-
},
|
|
152
|
-
return /* @__PURE__ */
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
) }) })
|
|
237
|
-
] });
|
|
126
|
+
}, K = E && L ? { start: t.from, end: t.to } : $ ? { start: a.from, end: a.to } : null, Q = E && L && ((X = t.from) == null ? void 0 : X.getTime()) !== ((Y = t.to) == null ? void 0 : Y.getTime()), pt = $ && ((_ = a.from) == null ? void 0 : _.getTime()) !== ((M = a.to) == null ? void 0 : M.getTime()), W = a ?? (t && (C.isDayjs(t) || E ? t : c(t, o).toDate()));
|
|
127
|
+
return /* @__PURE__ */ s.createElement(s.Fragment, null, /* @__PURE__ */ s.createElement("div", { className: "flex" }, q ? /* @__PURE__ */ s.createElement(
|
|
128
|
+
Ft,
|
|
129
|
+
{
|
|
130
|
+
upcomingDates: q,
|
|
131
|
+
value: t,
|
|
132
|
+
onChange: P,
|
|
133
|
+
onMonthChange: T
|
|
134
|
+
}
|
|
135
|
+
) : null, E ? /* @__PURE__ */ s.createElement(
|
|
136
|
+
jt,
|
|
137
|
+
{
|
|
138
|
+
isDateRangeStyle: Q,
|
|
139
|
+
shouldShowYearPicker: w,
|
|
140
|
+
startMonth: nt,
|
|
141
|
+
endMonth: ct,
|
|
142
|
+
modifiers: { ...k, ...K },
|
|
143
|
+
getTooltip: y,
|
|
144
|
+
disabledDays: p,
|
|
145
|
+
getDayContent: u,
|
|
146
|
+
value: t,
|
|
147
|
+
handleDayClick: P,
|
|
148
|
+
handleStartMonthChange: J,
|
|
149
|
+
handleEndMonthChange: mt,
|
|
150
|
+
handleTodayClick: G,
|
|
151
|
+
selectedDays: W,
|
|
152
|
+
locale: V ?? j,
|
|
153
|
+
timezoneName: o,
|
|
154
|
+
...A
|
|
155
|
+
}
|
|
156
|
+
) : /* @__PURE__ */ s.createElement(
|
|
157
|
+
St,
|
|
158
|
+
{
|
|
159
|
+
className: Ot(
|
|
160
|
+
"ui-date-picker rounded-lg pt-3",
|
|
161
|
+
Q ? "date-range-picker" : null,
|
|
162
|
+
pt ? "date-range-picker max-w-[400px]" : null,
|
|
163
|
+
u ? "has-custom-content" : null,
|
|
164
|
+
k.waitlist ? "has-custom-content" : null
|
|
165
|
+
),
|
|
166
|
+
todayButton: "Today",
|
|
167
|
+
selectedDays: W,
|
|
168
|
+
month: D,
|
|
169
|
+
modifiers: { ...k, ...K },
|
|
170
|
+
disabledDays: p,
|
|
171
|
+
captionElement: at,
|
|
172
|
+
renderDay: dt,
|
|
173
|
+
navbarElement: Vt,
|
|
174
|
+
onDayClick: P,
|
|
175
|
+
onMonthChange: T,
|
|
176
|
+
onTodayButtonClick: G,
|
|
177
|
+
...A
|
|
178
|
+
}
|
|
179
|
+
)), U.Footer ? /* @__PURE__ */ s.createElement(U.Footer, null) : null, rt && /* @__PURE__ */ s.createElement("div", { className: "max-w-200 " }, /* @__PURE__ */ s.createElement("div", { className: "ml-auto w-5/12" }, /* @__PURE__ */ s.createElement(
|
|
180
|
+
yt,
|
|
181
|
+
{
|
|
182
|
+
value: st,
|
|
183
|
+
ranges: tt,
|
|
184
|
+
timezoneName: o,
|
|
185
|
+
isFutureDatesAllowed: ot,
|
|
186
|
+
onChange: lt,
|
|
187
|
+
onSubmit: v
|
|
188
|
+
}
|
|
189
|
+
))));
|
|
190
|
+
};
|
|
191
|
+
Lt.propTypes = {
|
|
192
|
+
variant: e.oneOf(Object.keys(S)),
|
|
193
|
+
value: e.objectOf(Date),
|
|
194
|
+
selectedDays: e.objectOf(Date),
|
|
195
|
+
upcomingDates: e.arrayOf(Date),
|
|
196
|
+
onChange: e.func.isRequired,
|
|
197
|
+
onMonthChange: e.func,
|
|
198
|
+
disabledDays: e.oneOfType([e.object, e.array, e.func]),
|
|
199
|
+
shouldShowYearPicker: e.bool,
|
|
200
|
+
shouldShowMonthSelector: e.bool,
|
|
201
|
+
isDateRangeStyle: e.bool,
|
|
202
|
+
isRangeVariant: e.bool,
|
|
203
|
+
getDayContent: e.func,
|
|
204
|
+
modifiers: e.object,
|
|
205
|
+
ranges: e.arrayOf(e.oneOf(["day", "week", "month", "quarter", "year"])),
|
|
206
|
+
shouldShowRelativeRanges: e.bool,
|
|
207
|
+
components: e.shape({ Footer: e.oneOfType([e.node, e.func]) }),
|
|
208
|
+
getTooltip: e.func,
|
|
209
|
+
locale: e.string,
|
|
210
|
+
timezoneName: e.string
|
|
238
211
|
};
|
|
239
212
|
export {
|
|
240
|
-
|
|
213
|
+
Lt as DatePicker
|
|
241
214
|
};
|
|
@@ -1,81 +1,90 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { useState as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
1
|
+
import o from "prop-types";
|
|
2
|
+
import t, { useState as n, useEffect as j, cloneElement as z, forwardRef as L } from "react";
|
|
3
|
+
import I from "../../helpers/classnames.js";
|
|
4
|
+
import { formatDate as A } from "../../utils/date.js";
|
|
5
|
+
import { useIsMobile as F } from "../../hooks/useIsMobile.js";
|
|
5
6
|
import { Input as W } from "../Forms/Input.js";
|
|
6
7
|
import { Popover as D } from "../Popover/Popover.js";
|
|
7
|
-
import { DatePicker as
|
|
8
|
-
import { MonthPicker as
|
|
9
|
-
import { CalendarIcon as
|
|
8
|
+
import { DatePicker as N } from "./DatePicker.js";
|
|
9
|
+
import { MonthPicker as q } from "./MonthPicker.js";
|
|
10
|
+
import { CalendarIcon as B } from "../../icons/src/CalendarIcon.js";
|
|
10
11
|
import { DownArrowIcon as G } from "../../icons/src/DownArrowIcon.js";
|
|
11
|
-
const
|
|
12
|
-
value:
|
|
13
|
-
variant:
|
|
14
|
-
dateFormat:
|
|
15
|
-
placeholder:
|
|
16
|
-
pickerType:
|
|
17
|
-
|
|
18
|
-
|
|
12
|
+
const H = ({
|
|
13
|
+
value: e,
|
|
14
|
+
variant: i = "single",
|
|
15
|
+
dateFormat: c = "ddd, LL",
|
|
16
|
+
placeholder: P = "Select Date",
|
|
17
|
+
pickerType: x = "day",
|
|
18
|
+
onChange: r,
|
|
19
|
+
children: a,
|
|
20
|
+
classNames: s = {},
|
|
21
|
+
components: V = {},
|
|
19
22
|
popoverProps: O,
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
onChange: i,
|
|
23
|
-
...p
|
|
23
|
+
getDayContent: R,
|
|
24
|
+
...f
|
|
24
25
|
}) => {
|
|
25
|
-
const [
|
|
26
|
-
|
|
27
|
-
},
|
|
28
|
-
|
|
29
|
-
},
|
|
30
|
-
|
|
31
|
-
},
|
|
32
|
-
|
|
26
|
+
const [S] = n(e), [T, d] = n(e), [l, b] = n(!1), m = () => {
|
|
27
|
+
b(!l);
|
|
28
|
+
}, E = (u, k, y) => {
|
|
29
|
+
i === "single" ? (r == null || r(u, k, y), m()) : r == null || r(u, T, k, y);
|
|
30
|
+
}, g = () => {
|
|
31
|
+
d(e), r == null || r(e), b(!1);
|
|
32
|
+
}, w = () => {
|
|
33
|
+
!(e != null && e.to) && i === "range" && r(S), m();
|
|
33
34
|
};
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}, [
|
|
35
|
+
j(() => {
|
|
36
|
+
d(e);
|
|
37
|
+
}, [e]);
|
|
38
|
+
const M = F();
|
|
39
|
+
return /* @__PURE__ */ t.createElement(
|
|
37
40
|
D,
|
|
38
41
|
{
|
|
39
|
-
visible:
|
|
42
|
+
visible: l,
|
|
40
43
|
maxWidth: 900,
|
|
41
44
|
distance: 18,
|
|
42
45
|
placement: "bottom",
|
|
43
|
-
className:
|
|
44
|
-
onClickOutside:
|
|
46
|
+
className: I("ui-date-picker-input", s.popover),
|
|
47
|
+
onClickOutside: w,
|
|
45
48
|
...O,
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
}
|
|
49
|
+
...M ? { placement: "top", distance: 4 } : {}
|
|
50
|
+
},
|
|
51
|
+
a ? z(a, { onClick: m }) : /* @__PURE__ */ t.createElement(
|
|
52
|
+
p,
|
|
53
|
+
{
|
|
54
|
+
readOnly: !0,
|
|
55
|
+
size: "medium",
|
|
56
|
+
value: e ? A(e, c) : "",
|
|
57
|
+
placeholder: P,
|
|
58
|
+
className: s == null ? void 0 : s.input,
|
|
59
|
+
onClick: m
|
|
60
|
+
}
|
|
61
|
+
),
|
|
62
|
+
/* @__PURE__ */ t.createElement(D.Content, { className: "pr-1" }, l && (x === "month" ? /* @__PURE__ */ t.createElement(q, { value: e, onChange: E, ...f }) : /* @__PURE__ */ t.createElement(
|
|
63
|
+
N,
|
|
64
|
+
{
|
|
65
|
+
variant: i,
|
|
66
|
+
getDayContent: R,
|
|
67
|
+
value: e,
|
|
68
|
+
components: V,
|
|
69
|
+
onChange: E,
|
|
70
|
+
onSubmitDateRange: g,
|
|
71
|
+
...f
|
|
72
|
+
}
|
|
73
|
+
)))
|
|
72
74
|
);
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
75
|
+
};
|
|
76
|
+
H.propTypes = {
|
|
77
|
+
...N.propTypes,
|
|
78
|
+
dateFormat: o.string,
|
|
79
|
+
classNames: o.object,
|
|
80
|
+
popoverProps: o.object,
|
|
81
|
+
children: o.node
|
|
82
|
+
};
|
|
83
|
+
const p = L(({ className: e, ...i }, c) => /* @__PURE__ */ t.createElement("div", { ref: c, className: "relative flex bg-gray-lighter" }, /* @__PURE__ */ t.createElement("div", { className: "pointer-events-none absolute inset-0 flex items-center pl-3" }, /* @__PURE__ */ t.createElement(B, { className: "z-10 inline-block" })), /* @__PURE__ */ t.createElement(W, { className: I("no-translate cursor-pointer px-8", e), ...i }), /* @__PURE__ */ t.createElement("div", { className: "pointer-events-none absolute inset-y-0 right-0 flex items-center pr-3" }, /* @__PURE__ */ t.createElement(G, { className: "inline-block" }))));
|
|
84
|
+
p.displayName = "DefaultInput";
|
|
85
|
+
p.propTypes = {
|
|
86
|
+
className: o.string
|
|
87
|
+
};
|
|
79
88
|
export {
|
|
80
|
-
|
|
89
|
+
H as DatePickerPopover
|
|
81
90
|
};
|