@xola/ui-kit 3.6.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.
Files changed (126) hide show
  1. package/README.md +98 -19
  2. package/build/components/Alert.js +29 -0
  3. package/build/components/Animation/FadeIn.js +40 -0
  4. package/build/components/Animation/SlideDown.js +25 -0
  5. package/build/components/Avatar.js +28 -0
  6. package/build/components/Badge.js +51 -0
  7. package/build/components/BottomSheet.js +114 -0
  8. package/build/components/Breadcrumb.js +33 -0
  9. package/build/components/Breakdown.js +81 -0
  10. package/build/components/Buttons/Button.js +89 -0
  11. package/build/components/Buttons/ButtonGroup.js +58 -0
  12. package/build/components/Buttons/SecondaryButton.js +31 -0
  13. package/build/components/Buttons/SubmitButton.js +89 -0
  14. package/build/components/Buttons/ToggleButton.js +33 -0
  15. package/build/components/Charts/BaseChartOptions.js +95 -0
  16. package/build/components/Charts/HistogramOptions.js +69 -0
  17. package/build/components/Charts/PieOptions.js +55 -0
  18. package/build/components/Counter.js +20 -0
  19. package/build/components/DatePicker/DatePicker.helpers.js +33 -0
  20. package/build/components/DatePicker/DatePicker.js +214 -0
  21. package/build/components/DatePicker/DatePickerPopover.js +90 -0
  22. package/build/components/DatePicker/Day.js +43 -0
  23. package/build/components/DatePicker/LocalizedDayPicker.js +17 -0
  24. package/build/components/DatePicker/MonthGrid.js +39 -0
  25. package/build/components/DatePicker/MonthPicker.js +33 -0
  26. package/build/components/DatePicker/MonthSelector.js +46 -0
  27. package/build/components/DatePicker/MonthYearSelector.js +23 -0
  28. package/build/components/DatePicker/NavbarElement.js +34 -0
  29. package/build/components/DatePicker/RangeDatePicker.js +111 -0
  30. package/build/components/DatePicker/RelativeDateRange.js +290 -0
  31. package/build/components/DatePicker/UpcomingDatePicker.js +31 -0
  32. package/build/components/Dot/Dot.js +29 -0
  33. package/build/components/Dot/DotProgress.js +15 -0
  34. package/build/components/Drawer.js +134 -0
  35. package/build/components/Forms/BaseInput.js +57 -0
  36. package/build/components/Forms/Checkbox.js +37 -0
  37. package/build/components/Forms/Checkbox.module.css.js +7 -0
  38. package/build/components/Forms/ComboBox.js +41 -0
  39. package/build/components/Forms/FormGroup.js +10 -0
  40. package/build/components/Forms/InlineValuePopover.js +41 -0
  41. package/build/components/Forms/Input.js +17 -0
  42. package/build/components/Forms/Label.js +23 -0
  43. package/build/components/Forms/RangeSlider.js +58 -0
  44. package/build/components/Forms/Select.js +7 -0
  45. package/build/components/Forms/Switch.js +70 -0
  46. package/build/components/Forms/Textarea.js +42 -0
  47. package/build/components/Forms/ValuePopoverText.js +7 -0
  48. package/build/components/GooglePlacesAutocomplete.js +112 -0
  49. package/build/components/HeaderToolbar.js +41 -0
  50. package/build/components/ImageUpload.js +83 -0
  51. package/build/components/Key.js +33 -0
  52. package/build/components/Logo.js +17 -0
  53. package/build/components/Modal.js +141 -0
  54. package/build/components/Popover/Popover.js +53 -0
  55. package/build/components/Popover/Popover.module.css.js +7 -0
  56. package/build/components/Popover/PopoverList.js +57 -0
  57. package/build/components/Popover/PopoverScroll.module.css.js +4 -0
  58. package/build/components/Provider.js +16 -0
  59. package/build/components/Screens/Login.js +115 -0
  60. package/build/components/Search.js +144 -0
  61. package/build/components/Sidebar/Sidebar.Account.js +49 -0
  62. package/build/components/Sidebar/Sidebar.Button.js +47 -0
  63. package/build/components/Sidebar/Sidebar.Footer.js +10 -0
  64. package/build/components/Sidebar/Sidebar.Heading.js +13 -0
  65. package/build/components/Sidebar/Sidebar.Link.js +92 -0
  66. package/build/components/Sidebar/Sidebar.Menu.js +54 -0
  67. package/build/components/Sidebar/Sidebar.Menu.module.css.js +7 -0
  68. package/build/components/Sidebar/Sidebar.Notifications.js +107 -0
  69. package/build/components/Sidebar/Sidebar.js +212 -0
  70. package/build/components/Sidebar/SidebarContext.js +15 -0
  71. package/build/components/Sidebar/SidebarScroll.module.css.js +4 -0
  72. package/build/components/Sidebar/sidebarWidth.js +41 -0
  73. package/build/components/Sidebar/useSidebarWidthState.js +115 -0
  74. package/build/components/Skeleton.js +28 -0
  75. package/build/components/Skeleton.module.css.js +7 -0
  76. package/build/components/Spinner.js +35 -0
  77. package/build/components/Table.js +107 -0
  78. package/build/components/Tabs/Tabs.Panel.js +11 -0
  79. package/build/components/Tabs/Tabs.Tab.js +42 -0
  80. package/build/components/Tabs/Tabs.js +28 -0
  81. package/build/components/Tag.js +41 -0
  82. package/build/components/Tooltip.js +22 -0
  83. package/build/components/Utilities/Currency.js +56 -0
  84. package/build/components/Utilities/Number.js +17 -0
  85. package/build/components/Utilities/Phone.js +25 -0
  86. package/build/helpers/browser.js +9 -0
  87. package/build/helpers/children.js +6 -0
  88. package/build/helpers/classnames.js +8 -0
  89. package/build/helpers/environment.js +10 -0
  90. package/build/helpers/flash.js +86 -0
  91. package/build/hooks/useIsClient.js +10 -0
  92. package/build/hooks/useIsMobile.js +8 -0
  93. package/build/hooks/useViewportHeight.js +9 -0
  94. package/build/icons/src/AnnounceIcon.js +12 -0
  95. package/build/icons/src/BellIcon.js +26 -0
  96. package/build/icons/src/CalendarIcon.js +15 -0
  97. package/build/icons/src/CheckIcon.js +7 -0
  98. package/build/icons/src/ChevronDownIcon.js +7 -0
  99. package/build/icons/src/ChevronLeftIcon.js +7 -0
  100. package/build/icons/src/ChevronRightIcon.js +7 -0
  101. package/build/icons/src/CircleNotch.js +5 -0
  102. package/build/icons/src/CloseIcon.js +13 -0
  103. package/build/icons/src/DownArrowIcon.js +15 -0
  104. package/build/icons/src/ImageIcon.js +26 -0
  105. package/build/icons/src/SearchIcon.js +15 -0
  106. package/build/icons/src/TrashIcon.js +19 -0
  107. package/build/icons/src/WarningDiamondIcon.js +26 -0
  108. package/build/icons/src/helpers/icon.js +7 -0
  109. package/build/icons/src/helpers/iconSizes.js +13 -0
  110. package/build/icons/src/images/XolaLogoSimple.js +13 -0
  111. package/build/index.js +155 -0
  112. package/build/style.css +1 -1
  113. package/build/theme.js +374 -0
  114. package/build/utils/avatar.js +8 -0
  115. package/build/utils/currency.js +11 -0
  116. package/build/utils/date.js +46 -0
  117. package/build/utils/numbers.js +19 -0
  118. package/build/utils/phone.js +15 -0
  119. package/build/utils/userLocale.js +6 -0
  120. package/index.d.ts +132 -79
  121. package/package.json +76 -45
  122. package/postcss.config.js +1 -1
  123. package/skills/README.md +27 -0
  124. package/skills/migrate-2.6-to-3.7/SKILL.md +110 -0
  125. package/tailwind.config.js +9 -5
  126. package/build/ui-kit.es.js +0 -16771
@@ -0,0 +1,214 @@
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 = {
21
+ single: "single",
22
+ range: "range"
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,
38
+ isFutureDatesAllowed: ot = !1,
39
+ components: U = {},
40
+ getTooltip: y,
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
46
+ }) => {
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)
54
+ return;
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,
89
+ {
90
+ date: r,
91
+ currentMonth: D,
92
+ locale: V ?? j,
93
+ onChange: T
94
+ }
95
+ ) : /* @__PURE__ */ s.createElement(
96
+ wt,
97
+ {
98
+ date: r,
99
+ currentMonth: D,
100
+ locale: V ?? j,
101
+ onChange: T
102
+ }
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,
107
+ {
108
+ disabled: l,
109
+ isLoading: m,
110
+ selectedDate: t,
111
+ date: r,
112
+ getContent: u,
113
+ currentMonth: D
114
+ }
115
+ )) : /* @__PURE__ */ s.createElement(
116
+ z,
117
+ {
118
+ disabled: l,
119
+ isLoading: m,
120
+ selectedDate: t,
121
+ date: r,
122
+ getContent: u,
123
+ currentMonth: D
124
+ }
125
+ );
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
211
+ };
212
+ export {
213
+ Lt as DatePicker
214
+ };
@@ -0,0 +1,90 @@
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";
6
+ import { Input as W } from "../Forms/Input.js";
7
+ import { Popover as D } from "../Popover/Popover.js";
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";
11
+ import { DownArrowIcon as G } from "../../icons/src/DownArrowIcon.js";
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 = {},
22
+ popoverProps: O,
23
+ getDayContent: R,
24
+ ...f
25
+ }) => {
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();
34
+ };
35
+ j(() => {
36
+ d(e);
37
+ }, [e]);
38
+ const M = F();
39
+ return /* @__PURE__ */ t.createElement(
40
+ D,
41
+ {
42
+ visible: l,
43
+ maxWidth: 900,
44
+ distance: 18,
45
+ placement: "bottom",
46
+ className: I("ui-date-picker-input", s.popover),
47
+ onClickOutside: w,
48
+ ...O,
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
+ )))
74
+ );
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
+ };
88
+ export {
89
+ H as DatePickerPopover
90
+ };
@@ -0,0 +1,43 @@
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(
14
+ "div",
15
+ {
16
+ className: u(
17
+ "ui-date-picker-day",
18
+ "flex items-center justify-center",
19
+ y && l && !s ? "selected text-white" : null,
20
+ l ? "date" : null
21
+ )
22
+ },
23
+ t.getDate()
24
+ );
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
40
+ };
41
+ export {
42
+ d as Day
43
+ };
@@ -0,0 +1,17 @@
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
+ });
15
+ export {
16
+ w as LocalizedDayPicker
17
+ };
@@ -0,0 +1,39 @@
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);
16
+ };
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
36
+ };
37
+ export {
38
+ v as MonthGrid
39
+ };
@@ -0,0 +1,33 @@
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,
15
+ {
16
+ year: a,
17
+ value: t,
18
+ locale: s,
19
+ handleClear: i,
20
+ handleToday: m,
21
+ handleYearChange: l,
22
+ onChange: r
23
+ }
24
+ ));
25
+ };
26
+ h.propTypes = {
27
+ value: o.objectOf(Date),
28
+ onChange: o.func,
29
+ locale: o.string
30
+ };
31
+ export {
32
+ h as MonthPicker
33
+ };
@@ -0,0 +1,46 @@
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
+ import { ChevronDownIcon as g } from "../../icons/src/ChevronDownIcon.js";
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);
12
+ }, b = (n) => {
13
+ d(l + n);
14
+ }, i = () => {
15
+ t(!1);
16
+ }, y = () => {
17
+ s(/* @__PURE__ */ new Date()), t(!1);
18
+ };
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
43
+ };
44
+ export {
45
+ M as MonthSelector
46
+ };
@@ -0,0 +1,23 @@
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));
11
+ }, y = (e) => {
12
+ const { year: o } = e.target.form;
13
+ l(new Date(o.value, m.getMonth()));
14
+ };
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
20
+ };
21
+ export {
22
+ Y as MonthYearSelector
23
+ };
@@ -0,0 +1,34 @@
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(
15
+ "button",
16
+ {
17
+ type: "button",
18
+ className: l(
19
+ o ? "inline-block" : "invisible",
20
+ "inline-flex h-7 w-7 items-center justify-center rounded-full border border-transparent leading-none text-black hover:border-black"
21
+ ),
22
+ onClick: () => n()
23
+ },
24
+ r
25
+ );
26
+ i.propTypes = {
27
+ isVisible: e.bool,
28
+ onClick: e.func.isRequired,
29
+ children: e.element.isRequired
30
+ };
31
+ export {
32
+ i as ChevronButton,
33
+ u as NavbarElement
34
+ };
@@ -0,0 +1,111 @@
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,
28
+ ...k
29
+ }) => {
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,
37
+ {
38
+ disabled: Y,
39
+ selectedDate: t,
40
+ date: n,
41
+ getContent: d,
42
+ currentMonth: e
43
+ }
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
108
+ };
109
+ export {
110
+ U as default
111
+ };