@xola/ui-kit 3.0.8 → 3.4.1

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 (217) hide show
  1. package/README.md +61 -12
  2. package/build/components/Alert.d.ts +18 -0
  3. package/build/components/Alert.js +28 -0
  4. package/build/components/Animation/FadeIn.d.ts +13 -0
  5. package/build/components/Animation/FadeIn.js +29 -0
  6. package/build/components/Animation/SlideDown.d.ts +6 -0
  7. package/build/components/Animation/SlideDown.js +20 -0
  8. package/build/components/Avatar.d.ts +16 -0
  9. package/build/components/Avatar.js +21 -0
  10. package/build/components/Badge.d.ts +27 -0
  11. package/build/components/Badge.js +40 -0
  12. package/build/components/Breadcrumb.d.ts +21 -0
  13. package/build/components/Breadcrumb.js +27 -0
  14. package/build/components/Breakdown.d.ts +63 -0
  15. package/build/components/Breakdown.js +89 -0
  16. package/build/components/Buttons/Button.d.ts +53 -0
  17. package/build/components/Buttons/Button.js +83 -0
  18. package/build/components/Buttons/ButtonGroup.d.ts +35 -0
  19. package/build/components/Buttons/ButtonGroup.js +55 -0
  20. package/build/components/Buttons/SubmitButton.d.ts +11 -0
  21. package/build/components/Buttons/SubmitButton.js +83 -0
  22. package/build/components/Buttons/ToggleButton.d.ts +21 -0
  23. package/build/components/Buttons/ToggleButton.js +34 -0
  24. package/build/components/Charts/BaseChartOptions.d.ts +136 -0
  25. package/build/components/Charts/BaseChartOptions.js +95 -0
  26. package/build/components/Charts/HistogramOptions.d.ts +192 -0
  27. package/build/components/Charts/HistogramOptions.js +69 -0
  28. package/build/components/Charts/PieOptions.d.ts +177 -0
  29. package/build/components/Charts/PieOptions.js +55 -0
  30. package/build/components/Counter.d.ts +5 -0
  31. package/build/components/Counter.js +16 -0
  32. package/build/components/DatePicker/DatePicker.d.ts +41 -0
  33. package/build/components/DatePicker/DatePicker.helpers.d.ts +17 -0
  34. package/build/components/DatePicker/DatePicker.helpers.js +22 -0
  35. package/build/components/DatePicker/DatePicker.js +241 -0
  36. package/build/components/DatePicker/DatePickerPopover.d.ts +29 -0
  37. package/build/components/DatePicker/DatePickerPopover.js +81 -0
  38. package/build/components/DatePicker/Day.d.ts +13 -0
  39. package/build/components/DatePicker/Day.js +40 -0
  40. package/build/components/DatePicker/LocalizedDayPicker.d.ts +6 -0
  41. package/build/components/DatePicker/LocalizedDayPicker.js +20 -0
  42. package/build/components/DatePicker/MonthGrid.d.ts +11 -0
  43. package/build/components/DatePicker/MonthGrid.js +52 -0
  44. package/build/components/DatePicker/MonthPicker.d.ts +7 -0
  45. package/build/components/DatePicker/MonthPicker.js +28 -0
  46. package/build/components/DatePicker/MonthSelector.d.ts +8 -0
  47. package/build/components/DatePicker/MonthSelector.js +47 -0
  48. package/build/components/DatePicker/MonthYearSelector.d.ts +8 -0
  49. package/build/components/DatePicker/MonthYearSelector.js +44 -0
  50. package/build/components/DatePicker/NavbarElement.d.ts +15 -0
  51. package/build/components/DatePicker/NavbarElement.js +43 -0
  52. package/build/components/DatePicker/RangeDatePicker.d.ts +25 -0
  53. package/build/components/DatePicker/RangeDatePicker.js +134 -0
  54. package/build/components/DatePicker/RelativeDateRange.d.ts +51 -0
  55. package/build/components/DatePicker/RelativeDateRange.js +280 -0
  56. package/build/components/DatePicker/UpcomingDatePicker.d.ts +11 -0
  57. package/build/components/DatePicker/UpcomingDatePicker.js +27 -0
  58. package/build/components/Dot/Dot.d.ts +24 -0
  59. package/build/components/Dot/Dot.js +24 -0
  60. package/build/components/Dot/DotProgress.d.ts +6 -0
  61. package/build/components/Dot/DotProgress.js +10 -0
  62. package/build/components/Drawer.d.ts +28 -0
  63. package/build/components/Drawer.js +126 -0
  64. package/build/components/Forms/BaseInput.d.ts +20 -0
  65. package/build/components/Forms/BaseInput.js +41 -0
  66. package/build/components/Forms/Checkbox.d.ts +10 -0
  67. package/build/components/Forms/Checkbox.js +34 -0
  68. package/build/components/Forms/Checkbox.module.css.js +7 -0
  69. package/build/components/Forms/ComboBox.d.ts +8 -0
  70. package/build/components/Forms/ComboBox.js +41 -0
  71. package/build/components/Forms/FormGroup.d.ts +5 -0
  72. package/build/components/Forms/FormGroup.js +6 -0
  73. package/build/components/Forms/InlineValuePopover.d.ts +17 -0
  74. package/build/components/Forms/InlineValuePopover.js +47 -0
  75. package/build/components/Forms/Input.d.ts +6 -0
  76. package/build/components/Forms/Input.js +9 -0
  77. package/build/components/Forms/Label.d.ts +7 -0
  78. package/build/components/Forms/Label.js +17 -0
  79. package/build/components/Forms/RangeSlider.d.ts +33 -0
  80. package/build/components/Forms/RangeSlider.js +39 -0
  81. package/build/components/Forms/Select.d.ts +5 -0
  82. package/build/components/Forms/Select.js +8 -0
  83. package/build/components/Forms/Switch.d.ts +46 -0
  84. package/build/components/Forms/Switch.js +62 -0
  85. package/build/components/Forms/Textarea.d.ts +6 -0
  86. package/build/components/Forms/Textarea.js +35 -0
  87. package/build/components/Forms/ValuePopoverText.d.ts +6 -0
  88. package/build/components/Forms/ValuePopoverText.js +10 -0
  89. package/build/components/GooglePlacesAutocomplete.d.ts +14 -0
  90. package/build/components/HeaderToolbar.d.ts +21 -0
  91. package/build/components/HeaderToolbar.js +33 -0
  92. package/build/components/ImageUpload.d.ts +17 -0
  93. package/build/components/ImageUpload.js +86 -0
  94. package/build/components/Key.d.ts +6 -0
  95. package/build/components/Key.js +28 -0
  96. package/build/components/Logo.d.ts +19 -0
  97. package/build/components/Logo.js +10 -0
  98. package/build/components/Modal.d.ts +52 -0
  99. package/build/components/Modal.js +126 -0
  100. package/build/components/Popover/Popover.d.ts +20 -0
  101. package/build/components/Popover/Popover.js +50 -0
  102. package/build/components/Popover/Popover.module.css.js +7 -0
  103. package/build/components/Popover/PopoverList.d.ts +25 -0
  104. package/build/components/Popover/PopoverList.js +59 -0
  105. package/build/components/Popover/PopoverScroll.module.css.js +4 -0
  106. package/build/components/Provider.d.ts +18 -0
  107. package/build/components/Provider.js +17 -0
  108. package/build/components/Screens/Login.d.ts +25 -0
  109. package/build/components/Screens/Login.js +144 -0
  110. package/build/components/Search.d.ts +16 -0
  111. package/build/components/Search.js +174 -0
  112. package/build/components/Sidebar/Sidebar.Account.d.ts +13 -0
  113. package/build/components/Sidebar/Sidebar.Account.js +56 -0
  114. package/build/components/Sidebar/Sidebar.Button.d.ts +10 -0
  115. package/build/components/Sidebar/Sidebar.Button.js +21 -0
  116. package/build/components/Sidebar/Sidebar.Footer.d.ts +8 -0
  117. package/build/components/Sidebar/Sidebar.Footer.js +9 -0
  118. package/build/components/Sidebar/Sidebar.Heading.d.ts +10 -0
  119. package/build/components/Sidebar/Sidebar.Heading.js +10 -0
  120. package/build/components/Sidebar/Sidebar.Link.d.ts +24 -0
  121. package/build/components/Sidebar/Sidebar.Link.js +56 -0
  122. package/build/components/Sidebar/Sidebar.Menu.d.ts +10 -0
  123. package/build/components/Sidebar/Sidebar.Menu.js +28 -0
  124. package/build/components/Sidebar/Sidebar.Menu.module.css.js +7 -0
  125. package/build/components/Sidebar/Sidebar.d.ts +58 -0
  126. package/build/components/Sidebar/Sidebar.js +218 -0
  127. package/build/components/Sidebar/SidebarScroll.module.css.js +4 -0
  128. package/build/components/Sidebar/index.d.ts +8 -0
  129. package/build/components/Skeleton.d.ts +13 -0
  130. package/build/components/Skeleton.js +29 -0
  131. package/build/components/Skeleton.module.css.js +7 -0
  132. package/build/components/Spinner.d.ts +26 -0
  133. package/build/components/Spinner.js +27 -0
  134. package/build/components/Table.d.ts +59 -0
  135. package/build/components/Table.js +71 -0
  136. package/build/components/Tabs/Tabs.Panel.d.ts +9 -0
  137. package/build/components/Tabs/Tabs.Panel.js +7 -0
  138. package/build/components/Tabs/Tabs.Tab.d.ts +19 -0
  139. package/build/components/Tabs/Tabs.Tab.js +37 -0
  140. package/build/components/Tabs/Tabs.d.ts +27 -0
  141. package/build/components/Tabs/Tabs.js +28 -0
  142. package/build/components/Tabs/index.d.ts +4 -0
  143. package/build/components/Tag.d.ts +25 -0
  144. package/build/components/Tag.js +36 -0
  145. package/build/components/Tooltip.d.ts +8 -0
  146. package/build/components/Tooltip.js +8 -0
  147. package/build/components/Utilities/Currency.d.ts +32 -0
  148. package/build/components/Utilities/Currency.js +49 -0
  149. package/build/components/Utilities/Number.d.ts +8 -0
  150. package/build/components/Utilities/Number.js +15 -0
  151. package/build/components/Utilities/Phone.d.ts +8 -0
  152. package/build/components/Utilities/Phone.js +19 -0
  153. package/build/helpers/avatar.d.ts +1 -0
  154. package/build/helpers/avatar.js +8 -0
  155. package/build/helpers/browser.d.ts +2 -0
  156. package/build/helpers/browser.js +9 -0
  157. package/build/helpers/children.d.ts +3 -0
  158. package/build/helpers/children.js +6 -0
  159. package/build/helpers/classnames.d.ts +5 -0
  160. package/build/helpers/currency.d.ts +2 -0
  161. package/build/helpers/currency.js +11 -0
  162. package/build/helpers/date.d.ts +12 -0
  163. package/build/helpers/date.js +44 -0
  164. package/build/helpers/flash.d.ts +21 -0
  165. package/build/helpers/flash.js +87 -0
  166. package/build/helpers/numbers.d.ts +4 -0
  167. package/build/helpers/numbers.js +23 -0
  168. package/build/helpers/phone.d.ts +11 -0
  169. package/build/helpers/phone.js +25 -0
  170. package/build/hooks/useId.d.ts +1 -0
  171. package/build/hooks/useId.js +9 -0
  172. package/build/hooks/useIsClient.d.ts +1 -0
  173. package/build/hooks/useIsClient.js +10 -0
  174. package/build/hooks/useViewportHeight.d.ts +1 -0
  175. package/build/hooks/useViewportHeight.js +15 -0
  176. package/build/icons/build/AnnounceIcon.js +6 -0
  177. package/build/icons/build/BellIcon.js +23 -0
  178. package/build/icons/build/CalendarIcon.js +15 -0
  179. package/build/icons/build/CheckIcon.js +7 -0
  180. package/build/icons/build/ChevronDownIcon.js +7 -0
  181. package/build/icons/build/ChevronLeftIcon.js +7 -0
  182. package/build/icons/build/ChevronRightIcon.js +7 -0
  183. package/build/icons/build/CircleNotch.js +5 -0
  184. package/build/icons/build/CloseIcon.js +7 -0
  185. package/build/icons/build/DownArrowIcon.js +15 -0
  186. package/build/icons/build/ImageIcon.js +23 -0
  187. package/build/icons/build/SearchIcon.js +15 -0
  188. package/build/icons/build/TrashIcon.js +16 -0
  189. package/build/icons/build/WarningDiamondIcon.js +23 -0
  190. package/build/icons/build/helpers/classnames.js +8 -0
  191. package/build/icons/build/helpers/icon.js +10 -0
  192. package/build/icons/build/helpers/iconSizes.js +13 -0
  193. package/build/icons/build/images/XolaLogoSimple.js +13 -0
  194. package/build/index.d.ts +66 -0
  195. package/build/index.js +142 -0
  196. package/build/theme.d.ts +413 -0
  197. package/build/theme.js +372 -0
  198. package/build/types/index.d.ts +22 -0
  199. package/build/types/migration.d.ts +2 -0
  200. package/build/ui-kit.css +1 -0
  201. package/build/utils/avatar.d.ts +1 -0
  202. package/build/utils/avatar.js +8 -0
  203. package/build/utils/currency.d.ts +2 -0
  204. package/build/utils/currency.js +11 -0
  205. package/build/utils/date.d.ts +12 -0
  206. package/build/utils/date.js +23 -0
  207. package/build/utils/index.d.ts +5 -0
  208. package/build/utils/numbers.d.ts +4 -0
  209. package/build/utils/numbers.js +19 -0
  210. package/build/utils/phone.d.ts +2 -0
  211. package/build/utils/phone.js +17 -0
  212. package/package.json +76 -49
  213. package/postcss.config.js +1 -1
  214. package/tailwind.config.js +28 -8
  215. package/build/style.css +0 -1
  216. package/build/ui-kit.es.js +0 -12173
  217. package/index.d.ts +0 -72
@@ -0,0 +1,241 @@
1
+ import { jsx as s, jsxs as X, Fragment as kt } from "react/jsx-runtime";
2
+ import Dt from "clsx";
3
+ import Y from "dayjs";
4
+ import { isArray as h, isFunction as M } from "lodash-es";
5
+ import { useContext as yt, useState as N, useEffect as jt, useCallback as V, useMemo as Rt } from "react";
6
+ import { isBefore as C, startOfDay as b, endOfDay as v, isAfter as tt, isSameDay as Nt } from "date-fns";
7
+ import { Tooltip as Vt } from "../Tooltip.js";
8
+ import { RelativeDateRange as Lt } from "./RelativeDateRange.js";
9
+ import { MonthSelector as Ot } from "./MonthSelector.js";
10
+ import { UpcomingDatePicker as St } from "./UpcomingDatePicker.js";
11
+ import { Context as Et } from "../Provider.js";
12
+ import { now as f, isSame as L, isValidTimeZoneName as Ft, toDate as l } from "../../helpers/date.js";
13
+ import { Day as rt } from "./Day.js";
14
+ import { LocalizedDayPicker as _t } from "./LocalizedDayPicker.js";
15
+ import { MonthYearSelector as Tt } from "./MonthYearSelector.js";
16
+ import { NavbarElement as At } from "./NavbarElement.js";
17
+ import Bt from "./RangeDatePicker.js";
18
+ const P = {
19
+ single: "single",
20
+ range: "range"
21
+ }, Ct = ({
22
+ variant: U = P.single,
23
+ value: r,
24
+ selectedDays: c,
25
+ upcomingDates: W,
26
+ disabledDays: x = [],
27
+ loadingDays: k = [],
28
+ shouldShowYearPicker: O = !1,
29
+ shouldShowMonthSelector: S = !1,
30
+ shouldShowRelativeRanges: et = !1,
31
+ isFutureDatesAllowed: ot = !1,
32
+ modifiers: E = {},
33
+ ranges: nt,
34
+ components: z = {},
35
+ locale: D,
36
+ timezoneName: u,
37
+ getDayContent: F,
38
+ getTooltip: y,
39
+ onChange: a,
40
+ onMonthChange: i,
41
+ onSubmitDateRange: ft,
42
+ month: it,
43
+ // Deprecated v7 props are spread into rest and ignored
44
+ ...H
45
+ }) => {
46
+ var K, Q;
47
+ const { locale: j } = yt(Et), o = u ?? void 0, st = r ? U === P.single ? r : r.from : null, [d, _] = N(it ?? st ?? f(void 0, o).toDate()), [mt, Z] = N(() => !r || typeof r != "object" || !("from" in r) || !r.from ? /* @__PURE__ */ new Date() : r.from), [lt, $] = N(() => !r || typeof r != "object" || !("from" in r) || !("to" in r) || !r.to || !r.from ? f(void 0, o).add(1, "month").toDate() : L(f(r.to, o), f(r.from, o), "month") ? f(r.from, o).add(1, "month").toDate() : r.to), [ct, at] = N(""), p = U === P.range, R = r && typeof r == "object" && "from" in r && "to" in r && r.from && r.to, dt = c && typeof c == "object" && "from" in c && "to" in c && c.from && c.to;
48
+ jt(() => {
49
+ u && !Ft(u) && (console.log(`${u} is not a valid timezone. Using default timezone now`), Y.tz.setDefault());
50
+ }, [u]);
51
+ const q = (t, e, m) => {
52
+ if (p)
53
+ return;
54
+ const n = u ? l(f(t, u)) : /* @__PURE__ */ new Date();
55
+ e.disabled || T(n) ? (_(n), i == null || i(n)) : a(n, e, m);
56
+ }, T = (t) => h(x) ? x.some((e) => {
57
+ if (e.daysOfWeek)
58
+ return e.daysOfWeek.includes(t.getDay());
59
+ if (e.after || e.before) {
60
+ const m = e.after ? tt(b(t), b(e.after)) : !0, n = e.before ? C(b(t), b(e.before)) : !0;
61
+ return m && n;
62
+ }
63
+ return e instanceof Date ? L(f(e, o), t, "day") : !1;
64
+ }) : M(x) ? x(t) : !1, bt = (t) => h(k) ? k.some((e) => L(f(e, o), t, "day")) : M(k) ? k(t) : !1, ut = (t, e) => {
65
+ _(e.from), Z(e.from), $(e.to), a({ ...e, rangeName: t }, E, null);
66
+ }, g = V(
67
+ (t) => {
68
+ _(t), i == null || i(t);
69
+ },
70
+ [i]
71
+ ), G = V(
72
+ (t) => {
73
+ Z(t), i == null || i(t);
74
+ },
75
+ [i]
76
+ ), pt = V(
77
+ (t) => {
78
+ $(t), i == null || i(t);
79
+ },
80
+ [i]
81
+ ), A = V(
82
+ (t, e, m) => {
83
+ if (!(!t || e.disabled))
84
+ if (r && typeof r == "object" && "from" in r && r.from && L(f(r.from, o), f(t, o), "month") && G(t), at(""), p) {
85
+ const n = r;
86
+ if (R)
87
+ a({ from: l(f(t, o)), to: null }, e, m);
88
+ else if (n && (n.from || n.to) && (n.from || n.to).getTime() === t.getTime()) {
89
+ const w = l(f(t, o)), B = l(f(t, o).endOf("day"), !1);
90
+ a({ from: w, to: B }, e, m);
91
+ } else if (n.from && C(b(n.from), b(l(f(t, o))))) {
92
+ const w = n.from, B = v(l(f(t, o), !1));
93
+ a({ from: w, to: B }, e, m);
94
+ } else if (n.from && (tt(b(n.from), b(l(f(t, o)))) || Nt(n.from, l(f(t, o)))))
95
+ a(
96
+ {
97
+ from: l(f(t, o)),
98
+ to: l(f(n.from).endOf("day"), !1)
99
+ },
100
+ e,
101
+ m
102
+ );
103
+ else {
104
+ const w = v(l(f(t, o), !1));
105
+ a({ from: n.from, to: w }, e, m);
106
+ }
107
+ } else
108
+ a(l(f(t, o)), e, m);
109
+ },
110
+ // eslint-disable-next-line react-hooks/exhaustive-deps
111
+ [p, R, a, o, r]
112
+ ), I = Rt(() => (O || S) && d ? (t) => S ? /* @__PURE__ */ s(
113
+ Ot,
114
+ {
115
+ date: t.date || d,
116
+ currentMonth: d,
117
+ locale: D ?? j,
118
+ onChange: g
119
+ }
120
+ ) : /* @__PURE__ */ s(
121
+ Tt,
122
+ {
123
+ date: t.date || d,
124
+ currentMonth: d,
125
+ locale: D ?? j,
126
+ onChange: g
127
+ }
128
+ ) : void 0, [O, S, d, g, D, j]), xt = (t) => {
129
+ const e = y == null ? void 0 : y(t), m = T(t), n = bt(t);
130
+ return e ? /* @__PURE__ */ s(Vt, { placement: "top", content: e, children: /* @__PURE__ */ s(
131
+ rt,
132
+ {
133
+ disabled: m,
134
+ isLoading: n,
135
+ selectedDate: r,
136
+ date: t,
137
+ getContent: F,
138
+ currentMonth: d
139
+ }
140
+ ) }) : /* @__PURE__ */ s(
141
+ rt,
142
+ {
143
+ disabled: m,
144
+ isLoading: n,
145
+ selectedDate: r,
146
+ date: t,
147
+ getContent: F,
148
+ currentMonth: d
149
+ }
150
+ );
151
+ }, J = p && R ? { start: r.from, end: r.to } : dt ? { start: c.from, end: c.to } : null, gt = p && R && ((K = r.from) == null ? void 0 : K.getTime()) !== ((Q = r.to) == null ? void 0 : Q.getTime()), wt = c ?? (r && (Y.isDayjs(r) || p ? r : f(r, o).toDate()));
152
+ return /* @__PURE__ */ X(kt, { children: [
153
+ /* @__PURE__ */ X("div", { className: "flex", children: [
154
+ W ? /* @__PURE__ */ s(
155
+ St,
156
+ {
157
+ upcomingDates: W,
158
+ value: r,
159
+ onChange: A,
160
+ onMonthChange: g
161
+ }
162
+ ) : null,
163
+ p ? /* @__PURE__ */ s(
164
+ Bt,
165
+ {
166
+ isDateRangeStyle: gt,
167
+ shouldShowYearPicker: O,
168
+ startMonth: mt,
169
+ endMonth: lt,
170
+ modifiers: { ...E, ...J },
171
+ getTooltip: y,
172
+ disabledDays: x,
173
+ getDayContent: F,
174
+ value: r,
175
+ handleDayClick: A,
176
+ handleStartMonthChange: G,
177
+ handleEndMonthChange: pt,
178
+ handleTodayClick: q,
179
+ selectedDays: wt,
180
+ locale: D ?? j,
181
+ timezoneName: o,
182
+ ...H
183
+ }
184
+ ) : /* @__PURE__ */ s(
185
+ _t,
186
+ {
187
+ className: Dt("pt-6 tracking-tightest rounded-lg ring-0 focus:outline-none focus:ring-0"),
188
+ mode: "single",
189
+ selected: r,
190
+ month: d,
191
+ modifiers: { ...E, ...J },
192
+ disabled: T,
193
+ onSelect: A,
194
+ onMonthChange: g,
195
+ classNames: {
196
+ months: "flex flex-col relative",
197
+ month_caption: "relative flex h-8 mb-4 pl-4",
198
+ caption_label: "text-lg font-semibold",
199
+ nav: "h-8 right-4 absolute items-center",
200
+ weekdays: "flex flex-row",
201
+ weekday: "w-full m-0 p-0 text-base font-semibold text-black",
202
+ month: "w-full min-w-[400px]",
203
+ month_grid: "w-full mt-4",
204
+ week: "mt-0.5 flex w-full justify-between",
205
+ day: "w-[calc(100%/7)] mr-0.5 rounded",
206
+ 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",
207
+ selected: "[&>button]:border [&>button]:border-blue [&>button]:bg-blue [&>button]:text-white [&>button:hover]:border-blue-darker [&>button:hover]:bg-blue-darker",
208
+ today: "[&>button]:border [&>button]:border-gray-light",
209
+ outside: "opacity-0",
210
+ disabled: "text-gray-light cursor-not-allowed [&>button]:cursor-not-allowed",
211
+ hidden: "invisible"
212
+ },
213
+ modifiersClassNames: {
214
+ 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"
215
+ },
216
+ components: {
217
+ ...I ? { CaptionLabel: I } : {},
218
+ DayButton: ({ day: t, ...e }) => /* @__PURE__ */ s("button", { ...e, children: xt(t.date) }),
219
+ Nav: (t) => /* @__PURE__ */ s(At, { ...t, onTodayClick: (e) => q(/* @__PURE__ */ new Date(), {}, e) })
220
+ },
221
+ ...H
222
+ }
223
+ )
224
+ ] }),
225
+ z.Footer ? /* @__PURE__ */ s(z.Footer, {}) : null,
226
+ et && /* @__PURE__ */ s("div", { className: "max-w-200 ", children: /* @__PURE__ */ s("div", { className: "ml-auto w-5/12", children: /* @__PURE__ */ s(
227
+ Lt,
228
+ {
229
+ value: ct,
230
+ ranges: nt,
231
+ timezoneName: o,
232
+ isFutureDatesAllowed: ot,
233
+ onChange: ut,
234
+ onSubmit: ft
235
+ }
236
+ ) }) })
237
+ ] });
238
+ };
239
+ export {
240
+ Ct as DatePicker
241
+ };
@@ -0,0 +1,29 @@
1
+ import { default as React } from 'react';
2
+ import { PopoverProps } from '../Popover/Popover';
3
+ type DateValue = Date | {
4
+ from?: Date;
5
+ to?: Date;
6
+ };
7
+ type PickerType = "day" | "month";
8
+ type PickerVariant = "single" | "range";
9
+ export interface DatePickerPopoverProps {
10
+ [key: string]: any;
11
+ value?: DateValue;
12
+ variant?: PickerVariant;
13
+ dateFormat?: string;
14
+ placeholder?: string;
15
+ pickerType?: PickerType;
16
+ classNames?: {
17
+ popover?: string;
18
+ input?: string;
19
+ };
20
+ components?: {
21
+ Footer?: React.ComponentType;
22
+ };
23
+ popoverProps?: Partial<PopoverProps>;
24
+ children?: React.ReactElement;
25
+ getDayContent?: (day: number, date: Date) => React.ReactNode;
26
+ onChange?: (...arguments_: any[]) => void;
27
+ }
28
+ export declare const DatePickerPopover: ({ value, variant, dateFormat, placeholder, pickerType, classNames, components, popoverProps, children, getDayContent, onChange, ...rest }: DatePickerPopoverProps) => React.JSX.Element;
29
+ export {};
@@ -0,0 +1,81 @@
1
+ import { jsxs as D, jsx as e } from "react/jsx-runtime";
2
+ import y from "clsx";
3
+ import { useState as m, useEffect as E, cloneElement as L, forwardRef as A } from "react";
4
+ import { CalendarIcon as M } from "../../icons/build/CalendarIcon.js";
5
+ import { DownArrowIcon as W } from "../../icons/build/DownArrowIcon.js";
6
+ import { formatDate as q } from "../../helpers/date.js";
7
+ import { Input as B } from "../Forms/Input.js";
8
+ import { Popover as x } from "../Popover/Popover.js";
9
+ import { DatePicker as F } from "./DatePicker.js";
10
+ import { MonthPicker as G } from "./MonthPicker.js";
11
+ const $ = ({
12
+ value: t,
13
+ variant: r = "single",
14
+ dateFormat: l = "ddd, LL",
15
+ placeholder: V = "Select Date",
16
+ pickerType: N = "day",
17
+ classNames: o = {},
18
+ components: P = {},
19
+ popoverProps: O,
20
+ children: n,
21
+ getDayContent: S,
22
+ onChange: i,
23
+ ...p
24
+ }) => {
25
+ const [j] = m(t), [w, f] = m(t), [c, d] = m(!1), s = () => {
26
+ d(!c);
27
+ }, a = (b, u, k) => {
28
+ r === "single" ? (i == null || i(b, u, k), s()) : i == null || i(b, w, u, k);
29
+ }, R = () => {
30
+ f(t), i == null || i(t), d(!1);
31
+ }, z = () => {
32
+ r === "range" && t && typeof t == "object" && "to" in t && !t.to && (i == null || i(j)), s();
33
+ };
34
+ return E(() => {
35
+ f(t);
36
+ }, [t]), /* @__PURE__ */ D(
37
+ x,
38
+ {
39
+ visible: c,
40
+ maxWidth: 900,
41
+ distance: 18,
42
+ placement: "bottom",
43
+ className: y("ui-date-picker-input", o.popover),
44
+ onClickOutside: z,
45
+ ...O,
46
+ children: [
47
+ n ? L(n, { onClick: s }) : /* @__PURE__ */ e(
48
+ I,
49
+ {
50
+ readOnly: !0,
51
+ size: "medium",
52
+ value: t ? q(t, l) : "",
53
+ placeholder: V,
54
+ className: o == null ? void 0 : o.input,
55
+ onClick: s
56
+ }
57
+ ),
58
+ /* @__PURE__ */ e(x.Content, { className: "pr-1", children: c && (N === "month" ? /* @__PURE__ */ e(G, { value: t, onChange: a, ...p }) : /* @__PURE__ */ e(
59
+ F,
60
+ {
61
+ variant: r,
62
+ getDayContent: S,
63
+ value: t,
64
+ components: P,
65
+ onChange: a,
66
+ onSubmitDateRange: R,
67
+ ...p
68
+ }
69
+ )) })
70
+ ]
71
+ }
72
+ );
73
+ }, I = A(({ className: t, ...r }, l) => /* @__PURE__ */ D("div", { ref: l, className: "relative flex bg-gray-lighter", children: [
74
+ /* @__PURE__ */ e("div", { className: "pointer-events-none absolute inset-0 flex items-center pl-3", children: /* @__PURE__ */ e(M, { className: "z-10 inline-block" }) }),
75
+ /* @__PURE__ */ e(B, { className: y("no-translate cursor-pointer px-8", t), ...r }),
76
+ /* @__PURE__ */ e("div", { className: "pointer-events-none absolute inset-y-0 right-0 flex items-center pr-3", children: /* @__PURE__ */ e(W, { className: "inline-block" }) })
77
+ ] }));
78
+ I.displayName = "DefaultInput";
79
+ export {
80
+ $ as DatePickerPopover
81
+ };
@@ -0,0 +1,13 @@
1
+ import { default as React } from 'react';
2
+ export interface DayProps {
3
+ selectedDate?: Date | {
4
+ from?: Date;
5
+ to?: Date;
6
+ } | null;
7
+ date: Date;
8
+ currentMonth: Date;
9
+ isLoading?: boolean;
10
+ disabled?: boolean;
11
+ getContent?: (day: number, date: Date) => React.ReactNode;
12
+ }
13
+ export declare const Day: ({ selectedDate, date, currentMonth, isLoading, disabled, getContent, }: DayProps) => React.JSX.Element;
@@ -0,0 +1,40 @@
1
+ import { jsx as t, jsxs as f } from "react/jsx-runtime";
2
+ import m from "clsx";
3
+ import o from "dayjs";
4
+ import { Dot as l } from "../Dot/Dot.js";
5
+ const v = ({
6
+ selectedDate: e,
7
+ date: n,
8
+ currentMonth: r,
9
+ isLoading: s = !1,
10
+ disabled: a = !1,
11
+ getContent: i
12
+ }) => {
13
+ const c = o(r).isSame(n, "month");
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(
20
+ "div",
21
+ {
22
+ className: m(
23
+ "ui-date-picker-day",
24
+ "flex items-center justify-center",
25
+ u && c && !a ? "selected text-white" : null,
26
+ c ? "date" : null
27
+ ),
28
+ children: n.getDate()
29
+ }
30
+ );
31
+ }, y = ({ selectedDate: e, date: n, getContent: r }) => {
32
+ const s = n.getDate(), a = r(s, n), i = e && e instanceof Date && o(e).isSame(n, "day");
33
+ return /* @__PURE__ */ f("div", { className: "ui-day-content align-center flex flex-col justify-center", children: [
34
+ /* @__PURE__ */ t("div", { className: m("ui-day-content-value", { "selected text-white": i }), children: s }),
35
+ a ? /* @__PURE__ */ t("div", { className: "ui-day-content-custom mt-1", children: a }) : null
36
+ ] });
37
+ };
38
+ export {
39
+ v as Day
40
+ };
@@ -0,0 +1,6 @@
1
+ import { default as React } from 'react';
2
+ import { DayPickerProps } from 'react-day-picker';
3
+ export declare const LocalizedDayPicker: {
4
+ ({ className, ...rest }: DayPickerProps): React.JSX.Element;
5
+ displayName: string;
6
+ };
@@ -0,0 +1,20 @@
1
+ import { jsx as s } from "react/jsx-runtime";
2
+ import m from "clsx";
3
+ import { useContext as l, useState as n, useEffect as p } from "react";
4
+ import { DayPicker as f } from "react-day-picker";
5
+ import { kebabCase as u } from "lodash-es";
6
+ import { enUS as r } from "date-fns/locale";
7
+ import { Context as P } from "../Provider.js";
8
+ import { getLocalizationProps as x } from "./DatePicker.helpers.js";
9
+ const z = ({ className: a, ...i }) => {
10
+ const { locale: o } = l(P), [c, t] = n({ locale: r });
11
+ return p(() => {
12
+ t({ locale: r });
13
+ const e = u(o).toLowerCase();
14
+ !e || e === "en" || e === "en-us" || x(o).then(t);
15
+ }, [o]), /* @__PURE__ */ s(f, { className: m(a), ...c, ...i });
16
+ };
17
+ z.displayName = "LocalizedDayPicker";
18
+ export {
19
+ z as LocalizedDayPicker
20
+ };
@@ -0,0 +1,11 @@
1
+ import { default as React } from 'react';
2
+ export interface MonthGridProps {
3
+ year: number;
4
+ value?: Date;
5
+ locale?: string;
6
+ onChange: (newDate: Date) => void;
7
+ handleYearChange: (offset: number) => void;
8
+ handleClear: () => void;
9
+ handleToday: () => void;
10
+ }
11
+ export declare const MonthGrid: ({ year, value, locale, onChange, handleYearChange, handleClear, handleToday, }: MonthGridProps) => React.JSX.Element;
@@ -0,0 +1,52 @@
1
+ import { jsxs as l, jsx as t } from "react/jsx-runtime";
2
+ import x from "clsx";
3
+ import u from "dayjs";
4
+ import { useContext as g } from "react";
5
+ import { ChevronLeftIcon as C } from "../../icons/build/ChevronLeftIcon.js";
6
+ import { ChevronRightIcon as k } from "../../icons/build/ChevronRightIcon.js";
7
+ import { Context as y } from "../Provider.js";
8
+ import { Button as i } from "../Buttons/Button.js";
9
+ import { ChevronButton as s } from "./NavbarElement.js";
10
+ const v = u(), A = ({
11
+ year: r,
12
+ value: n,
13
+ locale: a,
14
+ onChange: m,
15
+ handleYearChange: c,
16
+ handleClear: d,
17
+ handleToday: h
18
+ }) => {
19
+ const { locale: p } = g(y), f = [...Array.from({ length: 12 }).keys()].map(
20
+ (o) => v.locale(a ?? p).month(o).format("MMM")
21
+ ), b = (o) => {
22
+ const e = new Date(r, o);
23
+ m(e);
24
+ };
25
+ return /* @__PURE__ */ l("span", { className: "min-w-72", children: [
26
+ /* @__PURE__ */ l("div", { className: "mb-4 flex items-center justify-between", children: [
27
+ /* @__PURE__ */ t(s, { onClick: () => c(-1), children: /* @__PURE__ */ t(C, {}) }),
28
+ /* @__PURE__ */ t("span", { className: "text-lg font-bold", children: r }),
29
+ /* @__PURE__ */ t(s, { onClick: () => c(1), children: /* @__PURE__ */ t(k, {}) })
30
+ ] }),
31
+ /* @__PURE__ */ t("div", { className: "grid grid-cols-4 gap-2", children: f.map((o, e) => /* @__PURE__ */ t(
32
+ "button",
33
+ {
34
+ type: "button",
35
+ className: x(
36
+ n && n.getMonth() === e && n.getFullYear() === r ? "bg-blue-dark text-white" : "text-black",
37
+ "rounded-md p-4 text-center hover:bg-blue-dark hover:text-white"
38
+ ),
39
+ onClick: () => b(e),
40
+ children: o
41
+ },
42
+ o
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
+ ] });
49
+ };
50
+ export {
51
+ A as MonthGrid
52
+ };
@@ -0,0 +1,7 @@
1
+ import { default as React } from 'react';
2
+ export interface MonthPickerProps {
3
+ value: Date;
4
+ locale?: string;
5
+ onChange: (date: Date) => void;
6
+ }
7
+ export declare const MonthPicker: ({ value, locale, onChange }: MonthPickerProps) => React.JSX.Element;
@@ -0,0 +1,28 @@
1
+ import { jsx as o } from "react/jsx-runtime";
2
+ import { useState as l } from "react";
3
+ import { MonthGrid as s } from "./MonthGrid.js";
4
+ const Y = ({ value: t, locale: d, onChange: r }) => {
5
+ const [a, n] = l(new Date(t).getFullYear());
6
+ return /* @__PURE__ */ o("div", { className: "ui-month-picker min-w-72 max-w-xs rounded-lg bg-white", children: /* @__PURE__ */ o(
7
+ s,
8
+ {
9
+ year: a,
10
+ value: t,
11
+ locale: d,
12
+ handleClear: () => {
13
+ r(t);
14
+ },
15
+ handleToday: () => {
16
+ const e = /* @__PURE__ */ new Date();
17
+ n(e.getFullYear()), r(e);
18
+ },
19
+ handleYearChange: (e) => {
20
+ n(a + e);
21
+ },
22
+ onChange: r
23
+ }
24
+ ) });
25
+ };
26
+ export {
27
+ Y as MonthPicker
28
+ };
@@ -0,0 +1,8 @@
1
+ import { default as React } from 'react';
2
+ export interface MonthSelectorProps {
3
+ date: Date;
4
+ currentMonth: Date;
5
+ locale?: string;
6
+ onChange: (newDate: Date) => void;
7
+ }
8
+ export declare const MonthSelector: ({ date, currentMonth, locale, onChange }: MonthSelectorProps) => React.JSX.Element;
@@ -0,0 +1,47 @@
1
+ import { jsx as e, jsxs as c } from "react/jsx-runtime";
2
+ import M from "dayjs";
3
+ import { useState as m } from "react";
4
+ import { ChevronDownIcon as Y } from "../../icons/build/ChevronDownIcon.js";
5
+ import { Popover as d } from "../Popover/Popover.js";
6
+ import { MonthGrid as g } from "./MonthGrid.js";
7
+ const j = ({ date: s, currentMonth: p, locale: o, onChange: i }) => {
8
+ const [a, t] = m(!1), [l, h] = m(new Date(p).getFullYear()), f = () => {
9
+ t(!a);
10
+ }, b = (n) => {
11
+ i(n), t(!1);
12
+ }, u = (n) => {
13
+ h(l + n);
14
+ }, r = () => {
15
+ t(!1);
16
+ }, C = () => {
17
+ i(/* @__PURE__ */ new Date()), t(!1);
18
+ };
19
+ return /* @__PURE__ */ e("span", { className: "DayPicker-Caption", children: /* @__PURE__ */ e("span", { className: "inline-block", children: /* @__PURE__ */ c(d, { visible: a, distance: 5, skidding: 60, placement: "bottom", onClickOutside: r, children: [
20
+ /* @__PURE__ */ c(
21
+ "div",
22
+ {
23
+ className: "mt-2 min-w-40 cursor-pointer items-center justify-between text-left font-bold",
24
+ onClick: f,
25
+ children: [
26
+ /* @__PURE__ */ e("span", { className: "pr-1 text-lg", children: M(s).locale(o ?? "en").format("MMMM YYYY") }),
27
+ /* @__PURE__ */ e(Y, {})
28
+ ]
29
+ }
30
+ ),
31
+ /* @__PURE__ */ e(d.Content, { className: "p-2", children: /* @__PURE__ */ e(
32
+ g,
33
+ {
34
+ year: l,
35
+ value: s,
36
+ locale: o,
37
+ handleClear: r,
38
+ handleToday: C,
39
+ handleYearChange: u,
40
+ onChange: b
41
+ }
42
+ ) })
43
+ ] }) }) });
44
+ };
45
+ export {
46
+ j as MonthSelector
47
+ };
@@ -0,0 +1,8 @@
1
+ import { default as React } from 'react';
2
+ export interface MonthYearSelectorProps {
3
+ date: Date;
4
+ currentMonth: Date;
5
+ locale?: string;
6
+ onChange: (newDate: Date) => void;
7
+ }
8
+ export declare const MonthYearSelector: ({ date, currentMonth, locale, onChange }: MonthYearSelectorProps) => React.JSX.Element;
@@ -0,0 +1,44 @@
1
+ import { jsxs as d, jsx as a } from "react/jsx-runtime";
2
+ import M from "dayjs";
3
+ import { useRef as m } from "react";
4
+ import { Select as h } from "../Forms/Select.js";
5
+ const l = M(), N = (n, t) => 12 * (n.getFullYear() - t.getFullYear()) + (n.getMonth() - t.getMonth()), C = ({ date: n, currentMonth: t, locale: s, onChange: c }) => {
6
+ const u = m(null), o = m(null), i = [...Array.from({ length: 12 }).keys()].map(
7
+ (e) => l.locale(s ?? "en").month(e).format("MMM")
8
+ ), g = [...Array.from({ length: l.year() - 2012 + 5 + 1 }).keys()].map(
9
+ (e) => l.locale(s ?? "en").year(2012 + e).format("YYYY")
10
+ ), f = N(n, t), p = (e) => {
11
+ const r = Number(e.target.value), Y = o.current ? Number(o.current.value) : n.getFullYear();
12
+ c(new Date(Y, r - f));
13
+ }, y = (e) => {
14
+ const r = Number(e.target.value);
15
+ c(new Date(r, t.getMonth()));
16
+ };
17
+ return /* @__PURE__ */ d("form", { className: "DayPicker-Caption space-x-2", children: [
18
+ /* @__PURE__ */ a("span", { className: "inline-block", children: /* @__PURE__ */ a(
19
+ h,
20
+ {
21
+ ref: u,
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
+ ] });
41
+ };
42
+ export {
43
+ C as MonthYearSelector
44
+ };
@@ -0,0 +1,15 @@
1
+ import { default as React } from 'react';
2
+ import { NavProps } from 'react-day-picker';
3
+ export interface NavbarElementProps extends NavProps {
4
+ onTodayClick?: (e: React.MouseEvent<HTMLButtonElement>) => void;
5
+ }
6
+ /**
7
+ * Render the custom left & right arrows to change the current month.
8
+ */
9
+ export declare const NavbarElement: ({ className, onTodayClick }: NavbarElementProps) => React.JSX.Element;
10
+ export interface ChevronButtonProps {
11
+ isVisible?: boolean;
12
+ children: React.ReactElement;
13
+ onClick?: () => void;
14
+ }
15
+ export declare const ChevronButton: ({ isVisible, children, onClick }: ChevronButtonProps) => React.JSX.Element;