@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,130 +1,111 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
isDateRangeStyle:
|
|
16
|
-
shouldShowYearPicker:
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
1
|
+
import { isFunction as H, isArray as J } from "lodash-es";
|
|
2
|
+
import r from "prop-types";
|
|
3
|
+
import c from "react";
|
|
4
|
+
import F from "../../helpers/classnames.js";
|
|
5
|
+
import { now as a } from "../../utils/date.js";
|
|
6
|
+
import { Tooltip as K } from "../Tooltip.js";
|
|
7
|
+
import { Day as N } from "./Day.js";
|
|
8
|
+
import { LocalizedDayPicker as O } from "./LocalizedDayPicker.js";
|
|
9
|
+
import { MonthYearSelector as Q } from "./MonthYearSelector.js";
|
|
10
|
+
import { NavbarElement as R } from "./NavbarElement.js";
|
|
11
|
+
const U = ({
|
|
12
|
+
getTooltip: i,
|
|
13
|
+
value: t,
|
|
14
|
+
getDayContent: d,
|
|
15
|
+
isDateRangeStyle: b,
|
|
16
|
+
shouldShowYearPicker: j,
|
|
17
|
+
startMonth: D,
|
|
18
|
+
disabledDays: f,
|
|
19
|
+
endMonth: y,
|
|
20
|
+
modifiers: p,
|
|
21
|
+
selectedDays: m,
|
|
22
|
+
handleDayClick: h,
|
|
23
|
+
handleStartMonthChange: l,
|
|
24
|
+
handleEndMonthChange: S,
|
|
25
|
+
handleTodayClick: C,
|
|
26
|
+
locale: W,
|
|
27
|
+
timezoneName: s,
|
|
27
28
|
...k
|
|
28
29
|
}) => {
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
37
|
-
) : void 0, _ = C(c, x), S = C(m, w), D = (t) => Q(u) ? u(t) : U(u) ? u.some((e) => d(e, i).isSame(t, "day")) : !1, E = (t) => D(t), N = (t) => {
|
|
38
|
-
const e = d(t, i).isBefore(o == null ? void 0 : o.from, "day");
|
|
39
|
-
return D(t) || e && !l;
|
|
40
|
-
}, B = (t, e, r) => {
|
|
41
|
-
const s = g == null ? void 0 : g(t), J = e(t), L = /* @__PURE__ */ n(
|
|
42
|
-
W,
|
|
43
|
-
{
|
|
44
|
-
disabled: J,
|
|
45
|
-
selectedDate: o,
|
|
46
|
-
date: t,
|
|
47
|
-
getContent: Y,
|
|
48
|
-
currentMonth: r
|
|
49
|
-
}
|
|
50
|
-
);
|
|
51
|
-
return s ? /* @__PURE__ */ n(V, { placement: "top", content: s, children: L }) : L;
|
|
52
|
-
}, G = (t) => B(t, E, c), H = (t) => B(t, N, m), P = {
|
|
53
|
-
months: "flex flex-col relative",
|
|
54
|
-
month_caption: "relative flex h-8 mb-4 pl-4",
|
|
55
|
-
caption_label: "text-lg font-semibold",
|
|
56
|
-
nav: "h-8 right-4 absolute items-center",
|
|
57
|
-
weekdays: "flex flex-row",
|
|
58
|
-
weekday: "w-full m-0 p-0 text-base font-semibold text-black",
|
|
59
|
-
month: "w-full min-w-[400px]",
|
|
60
|
-
month_grid: "w-full mt-4",
|
|
61
|
-
week: "mt-0.5 flex w-full justify-between",
|
|
62
|
-
day: "w-[calc(100%/7)] mr-0.5 rounded",
|
|
63
|
-
day_button: "h-12 w-full cursor-pointer rounded bg-transparent hover:border hover:border-blue hover:bg-blue-lighter hover:text-black disabled:cursor-not-allowed disabled:text-gray-light disabled:hover:border-none disabled:hover:bg-transparent",
|
|
64
|
-
selected: a(
|
|
65
|
-
f ? "[&>button]:bg-transparent [&>button]:text-black [&>button:hover]:bg-blue-lighter [&>button:hover]:text-black" : "[&>button]:border [&>button]:border-blue [&>button]:bg-blue [&>button]:text-white [&>button:hover]:border-blue-darker [&>button:hover]:bg-blue-darker"
|
|
66
|
-
),
|
|
67
|
-
today: "[&>button]:border [&>button]:border-gray-light",
|
|
68
|
-
outside: "opacity-0",
|
|
69
|
-
disabled: "text-gray-light cursor-not-allowed [&>button]:cursor-not-allowed",
|
|
70
|
-
hidden: "invisible"
|
|
71
|
-
}, j = {
|
|
72
|
-
start: a(
|
|
73
|
-
f && !l ? "rounded-none [background:linear-gradient(90deg,#ffffff_40%,#d1e1ff_25%)] [&>button]:!bg-blue [&>button]:!text-white [&>button]:rounded-full" : "[&>button]:!bg-blue [&>button]:!text-white",
|
|
74
|
-
l ? "[&>button]:outline [&>button]:outline-offset-1 [&>button]:outline-blue-lighter" : null
|
|
75
|
-
),
|
|
76
|
-
end: a(
|
|
77
|
-
f && !l ? "rounded-none [background:linear-gradient(90deg,#d1e1ff_40%,#ffffff_25%)] [&>button]:!bg-blue [&>button]:!text-white [&>button]:rounded-full" : "[&>button]:!bg-blue [&>button]:!text-white",
|
|
78
|
-
l ? "[&>button]:outline [&>button]:outline-offset-1 [&>button]:outline-blue-lighter" : null
|
|
79
|
-
),
|
|
80
|
-
selected: f ? "rounded-none bg-blue-lighter text-black" : "",
|
|
81
|
-
waitlist: "[&>button]:relative [&>button]:after:content-[''] [&>button]:after:absolute [&>button]:after:bottom-1 [&>button]:after:left-1/2 [&>button]:after:-translate-x-1/2 [&>button]:after:h-2 [&>button]:after:w-2 [&>button]:after:rounded-full [&>button]:after:bg-yellow"
|
|
82
|
-
};
|
|
83
|
-
return /* @__PURE__ */ K("div", { className: "flex gap-4", children: [
|
|
84
|
-
/* @__PURE__ */ n(
|
|
85
|
-
F,
|
|
86
|
-
{
|
|
87
|
-
className: a("pt-6 tracking-tightest max-w-[400px] rounded-lg ring-0 focus:outline-none focus:ring-0"),
|
|
88
|
-
mode: "single",
|
|
89
|
-
selected: b == null ? void 0 : b.from,
|
|
90
|
-
month: c,
|
|
91
|
-
modifiers: { ...h, start: o == null ? void 0 : o.from },
|
|
92
|
-
disabled: E,
|
|
93
|
-
onSelect: (t, e, r, s) => p(t, r, s, !0),
|
|
94
|
-
onMonthChange: x,
|
|
95
|
-
classNames: P,
|
|
96
|
-
modifiersClassNames: j,
|
|
97
|
-
components: {
|
|
98
|
-
..._ ? { CaptionLabel: _ } : {},
|
|
99
|
-
DayButton: ({ day: t, ...e }) => /* @__PURE__ */ n("button", { ...e, children: G(t.date) }),
|
|
100
|
-
Nav: (t) => /* @__PURE__ */ n(A, { ...t, onTodayClick: (e) => q(/* @__PURE__ */ new Date(), {}, e) })
|
|
101
|
-
},
|
|
102
|
-
...k
|
|
103
|
-
}
|
|
104
|
-
),
|
|
105
|
-
/* @__PURE__ */ n(
|
|
106
|
-
F,
|
|
30
|
+
const g = a(t == null ? void 0 : t.from, s).isSame(a(t == null ? void 0 : t.to, s), "month"), A = a(t == null ? void 0 : t.from, s).isSame(a(t == null ? void 0 : t.to, s), "day"), x = (n, o) => j && n ? ({ date: e }) => /* @__PURE__ */ c.createElement(Q, { date: e, currentMonth: n, locale: W, onChange: o }) : void 0, I = x(D, l), L = x(y, S), w = (n) => H(f) ? f(n) : J(f) ? f.some((o) => a(o, s).isSame(n, "day")) : !1, B = (n) => w(n), P = (n) => {
|
|
31
|
+
const o = a(n, s).isBefore(t == null ? void 0 : t.from, "day");
|
|
32
|
+
return w(n) || o && !A;
|
|
33
|
+
}, u = (n, o, e) => {
|
|
34
|
+
const E = i == null ? void 0 : i(n), Y = o(n), q = E ? K : c.Fragment, G = E ? { placement: "top", content: E } : {};
|
|
35
|
+
return /* @__PURE__ */ c.createElement(q, { ...G }, /* @__PURE__ */ c.createElement(
|
|
36
|
+
N,
|
|
107
37
|
{
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
disabled: N,
|
|
114
|
-
onSelect: (t, e, r, s) => p(t, r, s, !1),
|
|
115
|
-
onMonthChange: w,
|
|
116
|
-
classNames: P,
|
|
117
|
-
modifiersClassNames: j,
|
|
118
|
-
components: {
|
|
119
|
-
...S ? { CaptionLabel: S } : {},
|
|
120
|
-
DayButton: ({ day: t, ...e }) => /* @__PURE__ */ n("button", { ...e, children: H(t.date) }),
|
|
121
|
-
Nav: (t) => /* @__PURE__ */ n(A, { ...t })
|
|
122
|
-
},
|
|
123
|
-
...k
|
|
38
|
+
disabled: Y,
|
|
39
|
+
selectedDate: t,
|
|
40
|
+
date: n,
|
|
41
|
+
getContent: d,
|
|
42
|
+
currentMonth: e
|
|
124
43
|
}
|
|
125
|
-
)
|
|
126
|
-
|
|
44
|
+
));
|
|
45
|
+
}, M = (n) => u(n, B, D), T = (n) => u(n, P, y);
|
|
46
|
+
return /* @__PURE__ */ c.createElement("div", { className: "flex gap-4" }, /* @__PURE__ */ c.createElement(
|
|
47
|
+
O,
|
|
48
|
+
{
|
|
49
|
+
className: F(
|
|
50
|
+
"ui-date-picker max-w-[400px] rounded-lg pt-3",
|
|
51
|
+
b ? "date-range-picker" : null,
|
|
52
|
+
d ? "has-custom-content" : null,
|
|
53
|
+
p.waitlist ? "has-custom-content" : null
|
|
54
|
+
),
|
|
55
|
+
month: D,
|
|
56
|
+
modifiers: { ...p, start: t == null ? void 0 : t.from },
|
|
57
|
+
disabledDays: B,
|
|
58
|
+
navbarElement: R,
|
|
59
|
+
captionElement: I,
|
|
60
|
+
selectedDays: [m == null ? void 0 : m.from, m],
|
|
61
|
+
renderDay: M,
|
|
62
|
+
getTooltip: i,
|
|
63
|
+
onDayClick: (n, o, e) => h(n, o, e, !0),
|
|
64
|
+
onMonthChange: l,
|
|
65
|
+
onTodayButtonClick: C,
|
|
66
|
+
...k
|
|
67
|
+
}
|
|
68
|
+
), /* @__PURE__ */ c.createElement(
|
|
69
|
+
O,
|
|
70
|
+
{
|
|
71
|
+
className: F(
|
|
72
|
+
"ui-date-picker max-w-[400px] rounded-lg pt-3",
|
|
73
|
+
b ? "date-range-picker" : null,
|
|
74
|
+
d ? "has-custom-content" : null,
|
|
75
|
+
p.waitlist ? "has-custom-content" : null
|
|
76
|
+
),
|
|
77
|
+
month: y,
|
|
78
|
+
modifiers: g ? {} : { ...p, end: t == null ? void 0 : t.to },
|
|
79
|
+
disabledDays: P,
|
|
80
|
+
navbarElement: R,
|
|
81
|
+
captionElement: L,
|
|
82
|
+
selectedDays: g ? [] : m,
|
|
83
|
+
renderDay: T,
|
|
84
|
+
getTooltip: i,
|
|
85
|
+
onDayClick: (n, o, e) => h(n, o, e, !1),
|
|
86
|
+
onMonthChange: S,
|
|
87
|
+
onTodayButtonClick: C,
|
|
88
|
+
...k
|
|
89
|
+
}
|
|
90
|
+
));
|
|
91
|
+
};
|
|
92
|
+
U.propTypes = {
|
|
93
|
+
getTooltip: r.func,
|
|
94
|
+
value: r.object,
|
|
95
|
+
getDayContent: r.func,
|
|
96
|
+
isDisabled: r.func,
|
|
97
|
+
isDateRangeStyle: r.bool,
|
|
98
|
+
startMonth: r.instanceOf(Date),
|
|
99
|
+
endMonth: r.instanceOf(Date),
|
|
100
|
+
modifiers: r.object,
|
|
101
|
+
disabledStartDays: r.func,
|
|
102
|
+
disabledEndDays: r.func,
|
|
103
|
+
handleDayClick: r.func,
|
|
104
|
+
handleStartMonthChange: r.func,
|
|
105
|
+
handleEndMonthChange: r.func,
|
|
106
|
+
handleTodayClick: r.func,
|
|
107
|
+
timezoneName: r.string
|
|
127
108
|
};
|
|
128
109
|
export {
|
|
129
|
-
|
|
110
|
+
U as default
|
|
130
111
|
};
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
1
|
+
import E from "prop-types";
|
|
2
|
+
import T from "react";
|
|
3
|
+
import { Button as O } from "../Buttons/Button.js";
|
|
4
|
+
import { Select as I } from "../Forms/Select.js";
|
|
5
|
+
import { now as l, toDate as t } from "../../utils/date.js";
|
|
6
|
+
const e = {
|
|
6
7
|
// Day
|
|
7
8
|
YESTERDAY: "P1D,yesterday",
|
|
8
9
|
TODAY: "P1D,today",
|
|
@@ -31,250 +32,259 @@ const a = {
|
|
|
31
32
|
THIS_YEAR: "P1Y,first day of this year",
|
|
32
33
|
NEXT_YEAR: "P1Y,next year",
|
|
33
34
|
LEADING_YEAR: "P1Y,+1 year"
|
|
34
|
-
},
|
|
35
|
+
}, n = {
|
|
35
36
|
// Day
|
|
36
|
-
[
|
|
37
|
-
[
|
|
38
|
-
[
|
|
37
|
+
[e.YESTERDAY]: "Yesterday",
|
|
38
|
+
[e.TODAY]: "Today",
|
|
39
|
+
[e.NEXT_DAY]: "Next Day",
|
|
39
40
|
// Week
|
|
40
|
-
[
|
|
41
|
-
[
|
|
42
|
-
[
|
|
43
|
-
[
|
|
44
|
-
[
|
|
41
|
+
[e.LAST_WEEK]: "Last Week",
|
|
42
|
+
[e.TRAILING_WEEK]: "Trailing Week",
|
|
43
|
+
[e.THIS_WEEK]: "This Week",
|
|
44
|
+
[e.NEXT_WEEK]: "Next Week",
|
|
45
|
+
[e.LEADING_WEEK]: "Leading Week",
|
|
45
46
|
// Month
|
|
46
|
-
[
|
|
47
|
-
[
|
|
48
|
-
[
|
|
49
|
-
[
|
|
50
|
-
[
|
|
47
|
+
[e.LAST_MONTH]: "Last Month",
|
|
48
|
+
[e.TRAILING_MONTH]: "Trailing Month",
|
|
49
|
+
[e.THIS_MONTH]: "This Month",
|
|
50
|
+
[e.NEXT_MONTH]: "Next Month",
|
|
51
|
+
[e.LEADING_MONTH]: "Leading Month",
|
|
51
52
|
// Quarter
|
|
52
|
-
[
|
|
53
|
-
[
|
|
54
|
-
[
|
|
55
|
-
[
|
|
56
|
-
[
|
|
53
|
+
[e.LAST_QUARTER]: "Last Quarter",
|
|
54
|
+
[e.TRAILING_QUARTER]: "Trailing Quarter",
|
|
55
|
+
[e.THIS_QUARTER]: "This Quarter",
|
|
56
|
+
[e.NEXT_QUARTER]: "Next Quarter",
|
|
57
|
+
[e.LEADING_QUARTER]: "Leading Quarter",
|
|
57
58
|
// Year
|
|
58
|
-
[
|
|
59
|
-
[
|
|
60
|
-
[
|
|
61
|
-
[
|
|
62
|
-
[
|
|
63
|
-
},
|
|
59
|
+
[e.LAST_YEAR]: "Last Year",
|
|
60
|
+
[e.TRAILING_YEAR]: "Trailing Year",
|
|
61
|
+
[e.THIS_YEAR]: "This Year",
|
|
62
|
+
[e.NEXT_YEAR]: "Next Year",
|
|
63
|
+
[e.LEADING_YEAR]: "Leading Year"
|
|
64
|
+
}, y = {
|
|
64
65
|
day: {
|
|
65
66
|
label: "Day",
|
|
66
67
|
rangeOptions: [
|
|
67
|
-
{ value:
|
|
68
|
-
{ value:
|
|
69
|
-
{ value:
|
|
68
|
+
{ value: e.YESTERDAY, label: n[e.YESTERDAY] },
|
|
69
|
+
{ value: e.TODAY, label: n[e.TODAY] },
|
|
70
|
+
{ value: e.NEXT_DAY, label: n[e.NEXT_DAY] }
|
|
70
71
|
]
|
|
71
72
|
},
|
|
72
73
|
week: {
|
|
73
74
|
label: "Week",
|
|
74
75
|
rangeOptions: [
|
|
75
|
-
{ value:
|
|
76
|
-
{ value:
|
|
77
|
-
{ value:
|
|
78
|
-
{ value:
|
|
79
|
-
{ value:
|
|
76
|
+
{ value: e.LAST_WEEK, label: n[e.LAST_WEEK] },
|
|
77
|
+
{ value: e.TRAILING_WEEK, label: n[e.TRAILING_WEEK] },
|
|
78
|
+
{ value: e.THIS_WEEK, label: n[e.THIS_WEEK] },
|
|
79
|
+
{ value: e.NEXT_WEEK, label: n[e.NEXT_WEEK] },
|
|
80
|
+
{ value: e.LEADING_WEEK, label: n[e.LEADING_WEEK] }
|
|
80
81
|
]
|
|
81
82
|
},
|
|
82
83
|
month: {
|
|
83
84
|
label: "Month",
|
|
84
85
|
rangeOptions: [
|
|
85
|
-
{ value:
|
|
86
|
-
{ value:
|
|
87
|
-
{ value:
|
|
88
|
-
{ value:
|
|
89
|
-
{ value:
|
|
86
|
+
{ value: e.LAST_MONTH, label: n[e.LAST_MONTH] },
|
|
87
|
+
{ value: e.TRAILING_MONTH, label: n[e.TRAILING_MONTH] },
|
|
88
|
+
{ value: e.THIS_MONTH, label: n[e.THIS_MONTH] },
|
|
89
|
+
{ value: e.NEXT_MONTH, label: n[e.NEXT_MONTH] },
|
|
90
|
+
{ value: e.LEADING_MONTH, label: n[e.LEADING_MONTH] }
|
|
90
91
|
]
|
|
91
92
|
},
|
|
92
93
|
quarter: {
|
|
93
94
|
label: "Quarter",
|
|
94
95
|
rangeOptions: [
|
|
95
|
-
{ value:
|
|
96
|
-
{ value:
|
|
97
|
-
{ value:
|
|
98
|
-
{ value:
|
|
99
|
-
{ value:
|
|
96
|
+
{ value: e.LAST_QUARTER, label: n[e.LAST_QUARTER] },
|
|
97
|
+
{ value: e.TRAILING_QUARTER, label: n[e.TRAILING_QUARTER] },
|
|
98
|
+
{ value: e.THIS_QUARTER, label: n[e.THIS_QUARTER] },
|
|
99
|
+
{ value: e.NEXT_QUARTER, label: n[e.NEXT_QUARTER] },
|
|
100
|
+
{ value: e.LEADING_QUARTER, label: n[e.LEADING_QUARTER] }
|
|
100
101
|
]
|
|
101
102
|
},
|
|
102
103
|
year: {
|
|
103
104
|
label: "Year",
|
|
104
105
|
rangeOptions: [
|
|
105
|
-
{ value:
|
|
106
|
-
{ value:
|
|
107
|
-
{ value:
|
|
108
|
-
{ value:
|
|
109
|
-
{ value:
|
|
106
|
+
{ value: e.LAST_YEAR, label: n[e.LAST_YEAR] },
|
|
107
|
+
{ value: e.TRAILING_YEAR, label: n[e.TRAILING_YEAR] },
|
|
108
|
+
{ value: e.THIS_YEAR, label: n[e.THIS_YEAR] },
|
|
109
|
+
{ value: e.NEXT_YEAR, label: n[e.NEXT_YEAR] },
|
|
110
|
+
{ value: e.LEADING_YEAR, label: n[e.LEADING_YEAR] }
|
|
110
111
|
]
|
|
111
112
|
}
|
|
112
|
-
},
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
]),
|
|
123
|
-
[
|
|
124
|
-
const r =
|
|
113
|
+
}, L = (a, r, A) => r ? a : a.filter((f) => !A.has(f.value)), m = /* @__PURE__ */ new Set([
|
|
114
|
+
e.NEXT_DAY,
|
|
115
|
+
e.NEXT_WEEK,
|
|
116
|
+
e.NEXT_MONTH,
|
|
117
|
+
e.NEXT_QUARTER,
|
|
118
|
+
e.NEXT_YEAR,
|
|
119
|
+
e.LEADING_WEEK,
|
|
120
|
+
e.LEADING_MONTH,
|
|
121
|
+
e.LEADING_QUARTER,
|
|
122
|
+
e.LEADING_YEAR
|
|
123
|
+
]), Y = {
|
|
124
|
+
[e.YESTERDAY]: (a) => {
|
|
125
|
+
const r = l(null, a).subtract(1, "day");
|
|
125
126
|
return {
|
|
126
127
|
from: t(r.startOf("day")),
|
|
127
128
|
to: t(r.endOf("day"), !1)
|
|
128
129
|
};
|
|
129
130
|
},
|
|
130
|
-
[
|
|
131
|
-
from: t(
|
|
132
|
-
to: t(
|
|
131
|
+
[e.TODAY]: (a) => ({
|
|
132
|
+
from: t(l(null, a).startOf("day")),
|
|
133
|
+
to: t(l(null, a).endOf("day"), !1)
|
|
133
134
|
}),
|
|
134
|
-
[
|
|
135
|
-
const r =
|
|
135
|
+
[e.NEXT_DAY]: (a) => {
|
|
136
|
+
const r = l(null, a).add(1, "day");
|
|
136
137
|
return {
|
|
137
138
|
from: t(r.startOf("day")),
|
|
138
139
|
to: t(r.endOf("day"), !1)
|
|
139
140
|
};
|
|
140
141
|
},
|
|
141
|
-
[
|
|
142
|
-
const r =
|
|
142
|
+
[e.LAST_WEEK]: (a) => {
|
|
143
|
+
const r = l(null, a).subtract(7, "day");
|
|
143
144
|
return {
|
|
144
145
|
from: t(r.startOf("week")),
|
|
145
146
|
to: t(r.endOf("week"), !1)
|
|
146
147
|
};
|
|
147
148
|
},
|
|
148
|
-
[
|
|
149
|
-
from: t(
|
|
150
|
-
to: t(
|
|
149
|
+
[e.TRAILING_WEEK]: (a) => ({
|
|
150
|
+
from: t(l(null, a).subtract(7, "day").startOf("day")),
|
|
151
|
+
to: t(l(null, a).subtract(1, "day").endOf("day"), !1)
|
|
151
152
|
}),
|
|
152
|
-
[
|
|
153
|
-
from: t(
|
|
154
|
-
to: t(
|
|
153
|
+
[e.THIS_WEEK]: (a) => ({
|
|
154
|
+
from: t(l(null, a).startOf("week")),
|
|
155
|
+
to: t(l(null, a).endOf("week"), !1)
|
|
155
156
|
}),
|
|
156
|
-
[
|
|
157
|
-
const r =
|
|
157
|
+
[e.NEXT_WEEK]: (a) => {
|
|
158
|
+
const r = l(null, a).add(1, "week");
|
|
158
159
|
return {
|
|
159
160
|
from: t(r.startOf("week")),
|
|
160
161
|
to: t(r.endOf("week"), !1)
|
|
161
162
|
};
|
|
162
163
|
},
|
|
163
|
-
[
|
|
164
|
-
const r =
|
|
164
|
+
[e.LEADING_WEEK]: (a) => {
|
|
165
|
+
const r = l(null, a);
|
|
165
166
|
return {
|
|
166
167
|
from: t(r.startOf("day")),
|
|
167
168
|
to: t(r.add(1, "week").subtract(1, "day").endOf("day"), !1)
|
|
168
169
|
};
|
|
169
170
|
},
|
|
170
|
-
[
|
|
171
|
-
const r =
|
|
171
|
+
[e.LAST_MONTH]: (a) => {
|
|
172
|
+
const r = l(null, a).subtract(1, "month");
|
|
172
173
|
return {
|
|
173
174
|
from: t(r.startOf("month")),
|
|
174
175
|
to: t(r.endOf("month"), !1)
|
|
175
176
|
};
|
|
176
177
|
},
|
|
177
|
-
[
|
|
178
|
-
from: t(
|
|
179
|
-
to: t(
|
|
178
|
+
[e.TRAILING_MONTH]: (a) => ({
|
|
179
|
+
from: t(l(null, a).subtract(1, "month").startOf("day")),
|
|
180
|
+
to: t(l(null, a).subtract(1, "day").endOf("day"), !1)
|
|
180
181
|
}),
|
|
181
|
-
[
|
|
182
|
-
from: t(
|
|
183
|
-
to: t(
|
|
182
|
+
[e.THIS_MONTH]: (a) => ({
|
|
183
|
+
from: t(l(null, a).startOf("month")),
|
|
184
|
+
to: t(l(null, a).endOf("month"), !1)
|
|
184
185
|
}),
|
|
185
|
-
[
|
|
186
|
-
const r =
|
|
186
|
+
[e.NEXT_MONTH]: (a) => {
|
|
187
|
+
const r = l(null, a).add(1, "month");
|
|
187
188
|
return {
|
|
188
189
|
from: t(r.startOf("month")),
|
|
189
190
|
to: t(r.endOf("month"), !1)
|
|
190
191
|
};
|
|
191
192
|
},
|
|
192
|
-
[
|
|
193
|
-
const r =
|
|
193
|
+
[e.LEADING_MONTH]: (a) => {
|
|
194
|
+
const r = l(null, a);
|
|
194
195
|
return {
|
|
195
196
|
from: t(r.startOf("day")),
|
|
196
197
|
to: t(r.add(1, "month").subtract(1, "day").endOf("day"), !1)
|
|
197
198
|
};
|
|
198
199
|
},
|
|
199
|
-
[
|
|
200
|
-
from: t(
|
|
201
|
-
to: t(
|
|
200
|
+
[e.LAST_QUARTER]: (a) => ({
|
|
201
|
+
from: t(l(null, a).startOf("quarter").subtract(3, "month").startOf("month")),
|
|
202
|
+
to: t(l(null, a).endOf("quarter").subtract(3, "month").endOf("month"), !1)
|
|
202
203
|
}),
|
|
203
|
-
[
|
|
204
|
-
from: t(
|
|
205
|
-
to: t(
|
|
204
|
+
[e.TRAILING_QUARTER]: (a) => ({
|
|
205
|
+
from: t(l(null, a).subtract(3, "month").startOf("day")),
|
|
206
|
+
to: t(l(null, a).subtract(1, "day").endOf("day"), !1)
|
|
206
207
|
}),
|
|
207
|
-
[
|
|
208
|
-
from: t(
|
|
209
|
-
to: t(
|
|
208
|
+
[e.THIS_QUARTER]: (a) => ({
|
|
209
|
+
from: t(l(null, a).startOf("Q")),
|
|
210
|
+
to: t(l(null, a).endOf("Q"), !1)
|
|
210
211
|
}),
|
|
211
|
-
[
|
|
212
|
-
const r =
|
|
212
|
+
[e.NEXT_QUARTER]: (a) => {
|
|
213
|
+
const r = l(null, a).add(1, "quarter");
|
|
213
214
|
return {
|
|
214
215
|
from: t(r.startOf("quarter")),
|
|
215
216
|
to: t(r.endOf("quarter"), !1)
|
|
216
217
|
};
|
|
217
218
|
},
|
|
218
|
-
[
|
|
219
|
-
const r =
|
|
219
|
+
[e.LEADING_QUARTER]: (a) => {
|
|
220
|
+
const r = l(null, a);
|
|
220
221
|
return {
|
|
221
222
|
from: t(r.startOf("day")),
|
|
222
223
|
to: t(r.add(3, "month").subtract(1, "day").endOf("day"), !1)
|
|
224
|
+
// Сегодня + 3 месяца
|
|
223
225
|
};
|
|
224
226
|
},
|
|
225
|
-
[
|
|
226
|
-
const r =
|
|
227
|
+
[e.LAST_YEAR]: (a) => {
|
|
228
|
+
const r = l(null, a).subtract(1, "year");
|
|
227
229
|
return {
|
|
228
230
|
from: t(r.startOf("year")),
|
|
229
231
|
to: t(r.endOf("year"), !1)
|
|
230
232
|
};
|
|
231
233
|
},
|
|
232
|
-
[
|
|
233
|
-
from: t(
|
|
234
|
-
to: t(
|
|
234
|
+
[e.TRAILING_YEAR]: (a) => ({
|
|
235
|
+
from: t(l(null, a).subtract(1, "year").startOf("day")),
|
|
236
|
+
to: t(l(null, a).subtract(1, "day").endOf("day"), !1)
|
|
235
237
|
}),
|
|
236
|
-
[
|
|
237
|
-
from: t(
|
|
238
|
-
to: t(
|
|
238
|
+
[e.THIS_YEAR]: (a) => ({
|
|
239
|
+
from: t(l(null, a).startOf("year")),
|
|
240
|
+
to: t(l(null, a).endOf("year"), !1)
|
|
239
241
|
}),
|
|
240
|
-
[
|
|
241
|
-
const r =
|
|
242
|
+
[e.NEXT_YEAR]: (a) => {
|
|
243
|
+
const r = l(null, a).add(1, "year");
|
|
242
244
|
return {
|
|
243
245
|
from: t(r.startOf("year")),
|
|
244
246
|
to: t(r.endOf("year"), !1)
|
|
245
247
|
};
|
|
246
248
|
},
|
|
247
|
-
[
|
|
248
|
-
const r =
|
|
249
|
+
[e.LEADING_YEAR]: (a) => {
|
|
250
|
+
const r = l(null, a);
|
|
249
251
|
return {
|
|
250
252
|
from: t(r.startOf("day")),
|
|
251
253
|
to: t(r.add(1, "year").subtract(1, "day").endOf("day"), !1)
|
|
254
|
+
// Сегодня + 1 год
|
|
252
255
|
};
|
|
253
256
|
}
|
|
254
|
-
},
|
|
255
|
-
ranges:
|
|
257
|
+
}, c = ({
|
|
258
|
+
ranges: a = ["day", "week", "month", "quarter", "year"],
|
|
256
259
|
value: r,
|
|
257
|
-
|
|
258
|
-
|
|
260
|
+
// TODO: Prop name (showApply) doesn't match rule (^(is|has|should)[A-Z]([A-Za-z0-9]?)+)
|
|
261
|
+
showApply: A = !0,
|
|
262
|
+
onChange: f,
|
|
263
|
+
onSubmit: R,
|
|
259
264
|
timezoneName: _,
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
}) =>
|
|
263
|
-
|
|
264
|
-
const
|
|
265
|
-
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
265
|
+
isFutureDatesAllowed: N = !1
|
|
266
|
+
// This prop used to be able to select Future Dates in RelativeDateRange,
|
|
267
|
+
}) => {
|
|
268
|
+
const d = (u) => {
|
|
269
|
+
const s = u.target.value, o = Y[s](_);
|
|
270
|
+
f(s, o);
|
|
271
|
+
};
|
|
272
|
+
return /* @__PURE__ */ T.createElement("div", { className: "flex space-x-2" }, /* @__PURE__ */ T.createElement(I, { size: "medium", value: r, className: "pr-8 leading-5", onChange: d }, /* @__PURE__ */ T.createElement("option", { value: "" }, "Relative Date Range"), a.map((u) => {
|
|
273
|
+
const s = y[u];
|
|
274
|
+
return /* @__PURE__ */ T.createElement("optgroup", { key: u, label: s.label }, L(s.rangeOptions, N, m).map((o) => /* @__PURE__ */ T.createElement("option", { key: o.value, value: o.value }, o.label)));
|
|
275
|
+
})), A && /* @__PURE__ */ T.createElement(O, { onClick: R }, "Apply"));
|
|
276
|
+
};
|
|
277
|
+
c.propTypes = {
|
|
278
|
+
ranges: E.arrayOf(E.oneOf(["day", "week", "month", "quarter", "year"])),
|
|
279
|
+
onChange: E.func.isRequired,
|
|
280
|
+
onSubmit: E.func.isRequired,
|
|
281
|
+
showApply: E.bool,
|
|
282
|
+
value: E.string,
|
|
283
|
+
timezoneName: E.string,
|
|
284
|
+
isFutureDatesAllowed: E.bool
|
|
285
|
+
};
|
|
275
286
|
export {
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
a as rangeOptions
|
|
287
|
+
c as RelativeDateRange,
|
|
288
|
+
n as rangeLabels,
|
|
289
|
+
e as rangeOptions
|
|
280
290
|
};
|