@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,40 +1,43 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
if (i && c)
|
|
15
|
-
return s ? /* @__PURE__ */ t("div", { className: "flex animate-pulse items-center justify-center", children: /* @__PURE__ */ t(l, { className: "ui-day-content pointer-events-none !cursor-not-allowed", color: "secondary" }) }) : /* @__PURE__ */ t(y, { selectedDate: e, date: n, getContent: i });
|
|
16
|
-
if (s)
|
|
17
|
-
return /* @__PURE__ */ t("div", { className: "flex animate-pulse items-center justify-center", children: /* @__PURE__ */ t(l, { className: "pointer-events-none !cursor-not-allowed", color: "secondary", size: "xlarge" }) });
|
|
18
|
-
const u = e && e instanceof Date && o(e).isSame(n, "day");
|
|
19
|
-
return /* @__PURE__ */ t(
|
|
1
|
+
import i from "dayjs";
|
|
2
|
+
import n from "prop-types";
|
|
3
|
+
import e from "react";
|
|
4
|
+
import u from "../../helpers/classnames.js";
|
|
5
|
+
import { Dot as m } from "../Dot/Dot.js";
|
|
6
|
+
const d = ({ selectedDate: a, date: t, getContent: r, currentMonth: o, isLoading: c = !1, disabled: s = !1 }) => {
|
|
7
|
+
const l = i(o).isSame(t, "month");
|
|
8
|
+
if (r && l)
|
|
9
|
+
return c ? /* @__PURE__ */ e.createElement("div", { className: "flex animate-pulse items-center justify-center" }, /* @__PURE__ */ e.createElement(m, { className: "ui-day-content pointer-events-none !cursor-not-allowed", color: "secondary" })) : /* @__PURE__ */ e.createElement(f, { selectedDate: a, date: t, getContent: r });
|
|
10
|
+
if (c)
|
|
11
|
+
return /* @__PURE__ */ e.createElement("div", { className: "flex animate-pulse items-center justify-center" }, /* @__PURE__ */ e.createElement(m, { className: "pointer-events-none !cursor-not-allowed", color: "secondary", size: "xlarge" }));
|
|
12
|
+
const y = a && i(a).isSame(t, "day");
|
|
13
|
+
return /* @__PURE__ */ e.createElement(
|
|
20
14
|
"div",
|
|
21
15
|
{
|
|
22
|
-
className:
|
|
16
|
+
className: u(
|
|
23
17
|
"ui-date-picker-day",
|
|
24
18
|
"flex items-center justify-center",
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
)
|
|
28
|
-
|
|
29
|
-
|
|
19
|
+
y && l && !s ? "selected text-white" : null,
|
|
20
|
+
l ? "date" : null
|
|
21
|
+
)
|
|
22
|
+
},
|
|
23
|
+
t.getDate()
|
|
30
24
|
);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
25
|
+
};
|
|
26
|
+
d.propTypes = {
|
|
27
|
+
selectedDate: n.objectOf(Date),
|
|
28
|
+
date: n.objectOf(Date),
|
|
29
|
+
getContent: n.func,
|
|
30
|
+
currentMonth: n.objectOf(Date)
|
|
31
|
+
};
|
|
32
|
+
const f = ({ selectedDate: a, date: t, getContent: r }) => {
|
|
33
|
+
const o = t.getDate(), c = r(o, t), s = a && i(a).isSame(t, "day");
|
|
34
|
+
return /* @__PURE__ */ e.createElement("div", { className: "ui-day-content align-center flex flex-col justify-center" }, /* @__PURE__ */ e.createElement("div", { className: u("ui-day-content-value", { "selected text-white": s }) }, o), c ? /* @__PURE__ */ e.createElement("div", { className: "ui-day-content-custom mt-1" }, c) : null);
|
|
35
|
+
};
|
|
36
|
+
f.propTypes = {
|
|
37
|
+
selectedDate: n.objectOf(Date),
|
|
38
|
+
date: n.objectOf(Date),
|
|
39
|
+
getContent: n.func.isRequired
|
|
37
40
|
};
|
|
38
41
|
export {
|
|
39
|
-
|
|
42
|
+
d as Day
|
|
40
43
|
};
|
|
@@ -1,20 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}, [o]), /* @__PURE__ */ m(p, { className: u(a), ...c, ...i });
|
|
16
|
-
};
|
|
17
|
-
C.displayName = "LocalizedDayPicker";
|
|
1
|
+
import n, { forwardRef as s, useContext as m, useState as f, useEffect as l } from "react";
|
|
2
|
+
import p from "react-day-picker";
|
|
3
|
+
import { kebabCase as u } from "lodash-es";
|
|
4
|
+
import P from "../../helpers/classnames.js";
|
|
5
|
+
import { Context as z } from "../Provider.js";
|
|
6
|
+
import { getLocalizationProps as C } from "./DatePicker.helpers.js";
|
|
7
|
+
const w = s(function({ className: r, ...a }, c) {
|
|
8
|
+
const { locale: o } = m(z), [i, t] = f({});
|
|
9
|
+
return l(() => {
|
|
10
|
+
t({});
|
|
11
|
+
const e = u(o).toLowerCase();
|
|
12
|
+
!e || e === "en" || e === "en-us" || C(o).then(t);
|
|
13
|
+
}, [o]), /* @__PURE__ */ n.createElement(p, { ref: c, className: P(r), ...i, ...a });
|
|
14
|
+
});
|
|
18
15
|
export {
|
|
19
|
-
|
|
16
|
+
w as LocalizedDayPicker
|
|
20
17
|
};
|
|
@@ -1,52 +1,39 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import { Context as
|
|
6
|
-
import { Button as
|
|
7
|
-
import { ChevronButton as
|
|
8
|
-
import { ChevronLeftIcon as
|
|
9
|
-
import { ChevronRightIcon as
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
handleClear: d,
|
|
17
|
-
handleToday: h
|
|
18
|
-
}) => {
|
|
19
|
-
const { locale: p } = x(C), f = [...Array.from({ length: 12 }).keys()].map(
|
|
20
|
-
(e) => v.locale(m ?? p).month(e).format("MMM")
|
|
21
|
-
), b = (e) => {
|
|
22
|
-
const o = new Date(r, e);
|
|
23
|
-
a(o);
|
|
1
|
+
import e, { useContext as h } from "react";
|
|
2
|
+
import g from "dayjs";
|
|
3
|
+
import r from "prop-types";
|
|
4
|
+
import y from "clsx";
|
|
5
|
+
import { Context as E } from "../Provider.js";
|
|
6
|
+
import { Button as c } from "../Buttons/Button.js";
|
|
7
|
+
import { ChevronButton as m } from "./NavbarElement.js";
|
|
8
|
+
import { ChevronLeftIcon as x } from "../../icons/src/ChevronLeftIcon.js";
|
|
9
|
+
import { ChevronRightIcon as C } from "../../icons/src/ChevronRightIcon.js";
|
|
10
|
+
const k = g(), v = ({ year: n, value: l, onChange: s, handleYearChange: a, locale: i, handleClear: p, handleToday: d }) => {
|
|
11
|
+
const { locale: f } = h(E), u = [...Array.from({ length: 12 }).keys()].map(
|
|
12
|
+
(t) => k.locale(i ?? f).month(t).format("MMM")
|
|
13
|
+
), b = (t) => {
|
|
14
|
+
const o = new Date(n, t);
|
|
15
|
+
s(o);
|
|
24
16
|
};
|
|
25
|
-
return /* @__PURE__ */
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
/* @__PURE__ */ l("div", { className: "mt-2 flex justify-between border-t border-gray-lighter pt-2", children: [
|
|
45
|
-
/* @__PURE__ */ t(i, { size: "small", color: "secondary", variant: "outline", onClick: d, children: "Clear" }),
|
|
46
|
-
/* @__PURE__ */ t(i, { size: "small", color: "secondary", variant: "outline", onClick: h, children: "Today" })
|
|
47
|
-
] })
|
|
48
|
-
] });
|
|
17
|
+
return /* @__PURE__ */ e.createElement("span", { className: "min-w-72" }, /* @__PURE__ */ e.createElement("div", { className: "mb-4 flex items-center justify-between" }, /* @__PURE__ */ e.createElement(m, { onClick: () => a(-1) }, /* @__PURE__ */ e.createElement(x, null)), /* @__PURE__ */ e.createElement("span", { className: "text-lg font-bold" }, n), /* @__PURE__ */ e.createElement(m, { onClick: () => a(1) }, /* @__PURE__ */ e.createElement(C, null))), /* @__PURE__ */ e.createElement("div", { className: "grid grid-cols-4 gap-2" }, u.map((t, o) => /* @__PURE__ */ e.createElement(
|
|
18
|
+
"button",
|
|
19
|
+
{
|
|
20
|
+
key: t,
|
|
21
|
+
type: "button",
|
|
22
|
+
className: y(
|
|
23
|
+
l && l.getMonth() === o && l.getFullYear() === n ? "bg-blue-dark text-white" : "text-black",
|
|
24
|
+
"rounded-md p-4 text-center hover:bg-blue-dark hover:text-white"
|
|
25
|
+
),
|
|
26
|
+
onClick: () => b(o)
|
|
27
|
+
},
|
|
28
|
+
t
|
|
29
|
+
))), /* @__PURE__ */ e.createElement("div", { className: "mt-2 flex justify-between border-t border-gray-lighter pt-2" }, /* @__PURE__ */ e.createElement(c, { size: "small", color: "secondary", variant: "outline", onClick: p }, "Clear"), /* @__PURE__ */ e.createElement(c, { size: "small", color: "secondary", variant: "outline", onClick: d }, "Today")));
|
|
30
|
+
};
|
|
31
|
+
v.propTypes = {
|
|
32
|
+
year: r.number.isRequired,
|
|
33
|
+
value: r.objectOf(Date),
|
|
34
|
+
onChange: r.func.isRequired,
|
|
35
|
+
locale: r.string
|
|
49
36
|
};
|
|
50
37
|
export {
|
|
51
|
-
|
|
38
|
+
v as MonthGrid
|
|
52
39
|
};
|
|
@@ -1,28 +1,33 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import { MonthGrid as
|
|
4
|
-
const
|
|
5
|
-
const [a, n] =
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import c, { useState as p } from "react";
|
|
2
|
+
import o from "prop-types";
|
|
3
|
+
import { MonthGrid as d } from "./MonthGrid.js";
|
|
4
|
+
const h = ({ value: t, onChange: r, locale: s }) => {
|
|
5
|
+
const [a, n] = p(new Date(t).getFullYear()), l = (e) => {
|
|
6
|
+
n(a + e);
|
|
7
|
+
}, m = () => {
|
|
8
|
+
const e = /* @__PURE__ */ new Date();
|
|
9
|
+
n(e.getFullYear()), r(e);
|
|
10
|
+
}, i = () => {
|
|
11
|
+
r(t);
|
|
12
|
+
};
|
|
13
|
+
return /* @__PURE__ */ c.createElement("div", { className: "ui-month-picker min-w-72 max-w-xs rounded-lg bg-white" }, /* @__PURE__ */ c.createElement(
|
|
14
|
+
d,
|
|
8
15
|
{
|
|
9
16
|
year: a,
|
|
10
17
|
value: t,
|
|
11
|
-
locale:
|
|
12
|
-
handleClear:
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
handleToday: () => {
|
|
16
|
-
const e = /* @__PURE__ */ new Date();
|
|
17
|
-
n(e.getFullYear()), r(e);
|
|
18
|
-
},
|
|
19
|
-
handleYearChange: (e) => {
|
|
20
|
-
n(a + e);
|
|
21
|
-
},
|
|
18
|
+
locale: s,
|
|
19
|
+
handleClear: i,
|
|
20
|
+
handleToday: m,
|
|
21
|
+
handleYearChange: l,
|
|
22
22
|
onChange: r
|
|
23
23
|
}
|
|
24
|
-
)
|
|
24
|
+
));
|
|
25
|
+
};
|
|
26
|
+
h.propTypes = {
|
|
27
|
+
value: o.objectOf(Date),
|
|
28
|
+
onChange: o.func,
|
|
29
|
+
locale: o.string
|
|
25
30
|
};
|
|
26
31
|
export {
|
|
27
|
-
|
|
32
|
+
h as MonthPicker
|
|
28
33
|
};
|
|
@@ -1,47 +1,46 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import { Popover as
|
|
5
|
-
import { MonthGrid as
|
|
1
|
+
import c from "prop-types";
|
|
2
|
+
import e, { useState as m } from "react";
|
|
3
|
+
import C from "dayjs";
|
|
4
|
+
import { Popover as p } from "../Popover/Popover.js";
|
|
5
|
+
import { MonthGrid as E } from "./MonthGrid.js";
|
|
6
6
|
import { ChevronDownIcon as g } from "../../icons/src/ChevronDownIcon.js";
|
|
7
|
-
const
|
|
8
|
-
const [
|
|
9
|
-
t(!
|
|
7
|
+
const M = ({ date: a, locale: o, onChange: s, currentMonth: f }) => {
|
|
8
|
+
const [r, t] = m(!1), [l, d] = m(new Date(f).getFullYear()), u = () => {
|
|
9
|
+
t(!r);
|
|
10
|
+
}, h = (n) => {
|
|
11
|
+
s(n), t(!1);
|
|
10
12
|
}, b = (n) => {
|
|
11
|
-
|
|
12
|
-
},
|
|
13
|
-
h(a + n);
|
|
14
|
-
}, r = () => {
|
|
13
|
+
d(l + n);
|
|
14
|
+
}, i = () => {
|
|
15
15
|
t(!1);
|
|
16
|
-
},
|
|
17
|
-
|
|
16
|
+
}, y = () => {
|
|
17
|
+
s(/* @__PURE__ */ new Date()), t(!1);
|
|
18
18
|
};
|
|
19
|
-
return /* @__PURE__ */ e("span", { className: "DayPicker-Caption",
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
] }) }) });
|
|
19
|
+
return /* @__PURE__ */ e.createElement("span", { className: "DayPicker-Caption" }, /* @__PURE__ */ e.createElement("span", { className: "inline-block" }, /* @__PURE__ */ e.createElement(p, { visible: r, distance: 5, skidding: 60, placement: "bottom", onClickOutside: i }, /* @__PURE__ */ e.createElement(
|
|
20
|
+
"div",
|
|
21
|
+
{
|
|
22
|
+
className: "mt-2 min-w-40 cursor-pointer items-center justify-between text-left font-bold",
|
|
23
|
+
onClick: u
|
|
24
|
+
},
|
|
25
|
+
/* @__PURE__ */ e.createElement("span", { className: "pr-1 text-lg" }, C(a).locale(o).format("MMMM YYYY")),
|
|
26
|
+
/* @__PURE__ */ e.createElement(g, null)
|
|
27
|
+
), /* @__PURE__ */ e.createElement(p.Content, { className: "p-2" }, /* @__PURE__ */ e.createElement(
|
|
28
|
+
E,
|
|
29
|
+
{
|
|
30
|
+
year: l,
|
|
31
|
+
value: a,
|
|
32
|
+
locale: o,
|
|
33
|
+
handleClear: i,
|
|
34
|
+
handleToday: y,
|
|
35
|
+
handleYearChange: b,
|
|
36
|
+
onChange: h
|
|
37
|
+
}
|
|
38
|
+
)))));
|
|
39
|
+
};
|
|
40
|
+
M.propTypes = {
|
|
41
|
+
date: c.objectOf(Date).isRequired,
|
|
42
|
+
onChange: c.func.isRequired
|
|
44
43
|
};
|
|
45
44
|
export {
|
|
46
|
-
|
|
45
|
+
M as MonthSelector
|
|
47
46
|
};
|
|
@@ -1,44 +1,23 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import { Select as
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
(e) =>
|
|
8
|
-
),
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const r = Number(e.target.value), Y = o.current ? Number(o.current.value) : n.getFullYear();
|
|
12
|
-
c(new Date(Y, r - f));
|
|
1
|
+
import f from "dayjs";
|
|
2
|
+
import s from "prop-types";
|
|
3
|
+
import t from "react";
|
|
4
|
+
import { Select as c } from "../Forms/Select.js";
|
|
5
|
+
const r = f(), M = (a, n) => 12 * (a.getFullYear() - n.getFullYear()) + (a.getMonth() - n.getMonth()), Y = ({ date: a, locale: n, onChange: l, currentMonth: m }) => {
|
|
6
|
+
const p = [...Array.from({ length: 12 }).keys()].map((e) => r.locale(n).month(e).format("MMM")), h = [...Array.from({ length: r.year() - 2012 + 5 + 1 }).keys()].map(
|
|
7
|
+
(e) => r.locale(n).year(2012 + e).format("YYYY")
|
|
8
|
+
), i = M(a, m), g = (e) => {
|
|
9
|
+
const { year: o, month: u } = e.target.form;
|
|
10
|
+
l(new Date(o.value, Number(u.value) - i));
|
|
13
11
|
}, y = (e) => {
|
|
14
|
-
const
|
|
15
|
-
|
|
12
|
+
const { year: o } = e.target.form;
|
|
13
|
+
l(new Date(o.value, m.getMonth()));
|
|
16
14
|
};
|
|
17
|
-
return /* @__PURE__ */
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
name: "month",
|
|
23
|
-
value: n.getMonth(),
|
|
24
|
-
className: "month-selector",
|
|
25
|
-
onChange: p,
|
|
26
|
-
children: i.map((e, r) => /* @__PURE__ */ a("option", { value: r, children: e }, e))
|
|
27
|
-
}
|
|
28
|
-
) }),
|
|
29
|
-
/* @__PURE__ */ a("span", { className: "inline-block", children: /* @__PURE__ */ a(
|
|
30
|
-
h,
|
|
31
|
-
{
|
|
32
|
-
ref: o,
|
|
33
|
-
name: "year",
|
|
34
|
-
value: n.getFullYear(),
|
|
35
|
-
className: "year-selector",
|
|
36
|
-
onChange: y,
|
|
37
|
-
children: g.map((e) => /* @__PURE__ */ a("option", { value: e, children: e }, e))
|
|
38
|
-
}
|
|
39
|
-
) })
|
|
40
|
-
] });
|
|
15
|
+
return /* @__PURE__ */ t.createElement("form", { className: "DayPicker-Caption space-x-2" }, /* @__PURE__ */ t.createElement("span", { className: "inline-block" }, /* @__PURE__ */ t.createElement(c, { name: "month", value: a.getMonth(), className: "month-selector", onChange: g }, p.map((e, o) => /* @__PURE__ */ t.createElement("option", { key: e, value: o }, e)))), /* @__PURE__ */ t.createElement("span", { className: "inline-block" }, /* @__PURE__ */ t.createElement(c, { name: "year", value: a.getFullYear(), className: "year-selector", onChange: y }, h.map((e) => /* @__PURE__ */ t.createElement("option", { key: e, value: e }, e)))));
|
|
16
|
+
};
|
|
17
|
+
Y.propTypes = {
|
|
18
|
+
date: s.objectOf(Date).isRequired,
|
|
19
|
+
onChange: s.func.isRequired
|
|
41
20
|
};
|
|
42
21
|
export {
|
|
43
|
-
|
|
22
|
+
Y as MonthYearSelector
|
|
44
23
|
};
|
|
@@ -1,43 +1,34 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
"button",
|
|
16
|
-
{
|
|
17
|
-
type: "button",
|
|
18
|
-
className: "h-8 px-3 py-1.5 text-sm rounded border border-solid border-gray bg-white font-semibold tracking-tightest text-black hover:border-blue hover:bg-blue-lighter",
|
|
19
|
-
onClick: t,
|
|
20
|
-
children: "Today"
|
|
21
|
-
}
|
|
22
|
-
),
|
|
23
|
-
/* @__PURE__ */ s("span", { className: "flex space-x-2", children: [
|
|
24
|
-
/* @__PURE__ */ r(c, { isVisible: !h, onClick: d, children: /* @__PURE__ */ r(p, {}) }),
|
|
25
|
-
/* @__PURE__ */ r(c, { isVisible: !b, onClick: u, children: /* @__PURE__ */ r(f, {}) })
|
|
26
|
-
] })
|
|
27
|
-
] });
|
|
28
|
-
}, c = ({ isVisible: i = !0, children: t, onClick: e }) => /* @__PURE__ */ r(
|
|
1
|
+
import e from "prop-types";
|
|
2
|
+
import t from "react";
|
|
3
|
+
import l from "../../helpers/classnames.js";
|
|
4
|
+
import { ChevronLeftIcon as m } from "../../icons/src/ChevronLeftIcon.js";
|
|
5
|
+
import { ChevronRightIcon as a } from "../../icons/src/ChevronRightIcon.js";
|
|
6
|
+
const u = ({ onPreviousClick: o, onNextClick: n, className: r, showNextButton: c, showPreviousButton: s }) => /* @__PURE__ */ t.createElement("div", { className: l("absolute right-1 top-1.5 z-50", r) }, /* @__PURE__ */ t.createElement(i, { isVisible: s, onClick: o }, /* @__PURE__ */ t.createElement(m, null)), /* @__PURE__ */ t.createElement(i, { isVisible: c, onClick: n }, /* @__PURE__ */ t.createElement(a, null)));
|
|
7
|
+
u.propTypes = {
|
|
8
|
+
onPreviousClick: e.func,
|
|
9
|
+
onNextClick: e.func,
|
|
10
|
+
className: e.string,
|
|
11
|
+
showNextButton: e.bool,
|
|
12
|
+
showPreviousButton: e.bool
|
|
13
|
+
};
|
|
14
|
+
const i = ({ isVisible: o = !0, onClick: n, children: r }) => /* @__PURE__ */ t.createElement(
|
|
29
15
|
"button",
|
|
30
16
|
{
|
|
31
17
|
type: "button",
|
|
32
|
-
className:
|
|
33
|
-
|
|
18
|
+
className: l(
|
|
19
|
+
o ? "inline-block" : "invisible",
|
|
34
20
|
"inline-flex h-7 w-7 items-center justify-center rounded-full border border-transparent leading-none text-black hover:border-black"
|
|
35
21
|
),
|
|
36
|
-
onClick: () =>
|
|
37
|
-
|
|
38
|
-
|
|
22
|
+
onClick: () => n()
|
|
23
|
+
},
|
|
24
|
+
r
|
|
39
25
|
);
|
|
26
|
+
i.propTypes = {
|
|
27
|
+
isVisible: e.bool,
|
|
28
|
+
onClick: e.func.isRequired,
|
|
29
|
+
children: e.element.isRequired
|
|
30
|
+
};
|
|
40
31
|
export {
|
|
41
|
-
|
|
42
|
-
|
|
32
|
+
i as ChevronButton,
|
|
33
|
+
u as NavbarElement
|
|
43
34
|
};
|