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