@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,86 +1,83 @@
1
- import { jsxs as c, jsx as e, Fragment as B } from "react/jsx-runtime";
2
- import { useRef as R, useState as U } from "react";
1
+ import t from "prop-types";
2
+ import e, { useRef as I, useState as B } from "react";
3
3
  import g from "../helpers/classnames.js";
4
- import { Button as w } from "./Buttons/Button.js";
4
+ import { Button as T } from "./Buttons/Button.js";
5
5
  import { SubmitButton as u } from "./Buttons/SubmitButton.js";
6
- import { Logo as x } from "./Logo.js";
7
- import { ImageIcon as G } from "../icons/src/ImageIcon.js";
8
- import { TrashIcon as K } from "../icons/src/TrashIcon.js";
9
- const H = ({
10
- src: a,
11
- size: s = "large",
12
- isLoading: l = !1,
13
- maxSize: o = 5,
14
- hasDelete: d = !0,
15
- requirements: t = null,
16
- caption: r = null,
17
- csvAcceptFormats: y = "image/png,image/jpeg",
18
- onChange: N,
19
- onDelete: v,
20
- onError: C,
21
- ...b
6
+ import { Logo as h } from "./Logo.js";
7
+ import { ImageIcon as U } from "../icons/src/ImageIcon.js";
8
+ import { TrashIcon as w } from "../icons/src/TrashIcon.js";
9
+ const D = ({
10
+ src: o,
11
+ size: c = "large",
12
+ isLoading: n = !1,
13
+ maxSize: r = 5,
14
+ hasDelete: s = !0,
15
+ requirements: l = null,
16
+ caption: a = null,
17
+ csvAcceptFormats: E = "image/png,image/jpeg,image/webp",
18
+ onChange: y,
19
+ onDelete: b,
20
+ onError: x,
21
+ ...N
22
22
  }) => {
23
- const h = R(null), [m, k] = U(0), p = () => {
24
- var n;
25
- (n = h.current) == null || n.click();
26
- }, I = (n) => {
27
- const [i] = n.target.files ?? [];
28
- if (i) {
29
- if (o && 1048576 * o < i.size) {
30
- C(`Image size shouldn't exceed ${o}MB`);
31
- return;
32
- }
33
- N(i);
23
+ const i = I(), [m, v] = B(0), d = () => {
24
+ i.current.click();
25
+ }, C = (P) => {
26
+ const [f] = P.target.files;
27
+ if (r && 1048576 * r < f.size) {
28
+ x(`Image size shouldn't exceed ${r}MB`);
29
+ return;
34
30
  }
35
- }, P = () => {
36
- k(m + 1), v();
37
- }, j = typeof t == "string" ? (t == null ? void 0 : t.trim().length) > 0 : !!t, f = r ? r.trim().length > 0 : !1;
38
- return /* @__PURE__ */ c("div", { className: g("flex items-center rounded bg-gray-lighter p-4", d ? "space-x-2" : "space-x-3"), children: [
39
- /* @__PURE__ */ e("div", { children: a ? /* @__PURE__ */ e(x, { src: a, size: s }) : /* @__PURE__ */ e(
40
- "div",
41
- {
42
- className: g(
43
- x.sizes[s],
44
- "flex items-center justify-center rounded border border-gray-light"
45
- ),
46
- children: /* @__PURE__ */ e(G, { size: "large", className: "text-gray" })
47
- }
48
- ) }),
49
- /* @__PURE__ */ c("div", { className: "flex flex-col space-y-2", children: [
50
- /* @__PURE__ */ e("div", { className: "space-x-2", children: d ? /* @__PURE__ */ c(B, { children: [
51
- /* @__PURE__ */ e(
52
- w,
53
- {
54
- variant: "outline",
55
- color: "secondary",
56
- icon: /* @__PURE__ */ e(K, {}),
57
- disabled: l,
58
- onClick: P,
59
- children: "Delete"
60
- }
61
- ),
62
- /* @__PURE__ */ e(u, { disabled: l, isLoading: l, onClick: p, children: f ? r.trim() : "Upload New Photo" })
63
- ] }) : /* @__PURE__ */ e(u, { disabled: l, isLoading: l, onClick: p, children: f ? r.trim() : a ? "Replace Photo" : "Upload New Photo" }) }),
64
- /* @__PURE__ */ e(
65
- "input",
66
- {
67
- ref: h,
68
- className: "hidden",
69
- type: "file",
70
- multiple: !1,
71
- accept: y,
72
- onChange: I,
73
- ...b
74
- },
75
- m
76
- ),
77
- /* @__PURE__ */ e("div", { className: "text-xs text-gray-darker", children: j ? t : /* @__PURE__ */ c("div", { children: [
78
- "Check that the image is in PNG or JPG format",
79
- o ? ` and does not exceed ${o}MB` : ""
80
- ] }) })
81
- ] })
82
- ] });
31
+ y(f);
32
+ }, k = () => {
33
+ v(m + 1), b();
34
+ }, R = typeof l == "string" ? (l == null ? void 0 : l.trim().length) > 0 : !!l, p = a ? a.trim().length > 0 : !1;
35
+ return /* @__PURE__ */ e.createElement("div", { className: g("flex items-center rounded bg-gray-lighter p-4", s ? "space-x-2" : "space-x-3") }, /* @__PURE__ */ e.createElement("div", null, o ? /* @__PURE__ */ e.createElement(h, { src: o, size: c }) : /* @__PURE__ */ e.createElement(
36
+ "div",
37
+ {
38
+ className: g(
39
+ h.sizes[c],
40
+ "flex items-center justify-center rounded border border-gray-light"
41
+ )
42
+ },
43
+ /* @__PURE__ */ e.createElement(U, { size: "large", className: "text-gray" })
44
+ )), /* @__PURE__ */ e.createElement("div", { className: "flex flex-col space-y-2" }, /* @__PURE__ */ e.createElement("div", { className: "space-x-2" }, s ? /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement(
45
+ T,
46
+ {
47
+ variant: "outline",
48
+ color: "secondary",
49
+ icon: /* @__PURE__ */ e.createElement(w, null),
50
+ disabled: n,
51
+ onClick: k
52
+ },
53
+ "Delete"
54
+ ), /* @__PURE__ */ e.createElement(u, { disabled: n, isLoading: n, onClick: d }, p ? a.trim() : "Upload New Photo")) : /* @__PURE__ */ e.createElement(u, { disabled: n, isLoading: n, onClick: d }, p ? a.trim() : o ? "Replace Photo" : "Upload New Photo")), /* @__PURE__ */ e.createElement(
55
+ "input",
56
+ {
57
+ key: m,
58
+ ref: i,
59
+ className: "hidden",
60
+ type: "file",
61
+ multiple: !1,
62
+ accept: E,
63
+ onChange: C,
64
+ ...N
65
+ }
66
+ ), /* @__PURE__ */ e.createElement("div", { className: "text-xs text-gray-darker" }, R ? l : /* @__PURE__ */ e.createElement("div", null, "Check that the image is in PNG, JPG or WebP format", r ? ` and does not exceed ${r}MB` : ""))));
67
+ };
68
+ D.propTypes = {
69
+ src: t.string,
70
+ size: t.oneOf(["small", "medium", "large"]),
71
+ isLoading: t.bool,
72
+ maxSize: t.number,
73
+ hasDelete: t.bool,
74
+ caption: t.string,
75
+ requirements: t.oneOfType([t.node, t.string]),
76
+ csvAcceptFormats: t.string,
77
+ onChange: t.func.isRequired,
78
+ onDelete: t.func.isRequired,
79
+ onError: t.func.isRequired
83
80
  };
84
81
  export {
85
- H as ImageUpload
82
+ D as ImageUpload
86
83
  };
@@ -1,28 +1,33 @@
1
- import { jsx as i } from "react/jsx-runtime";
2
- import { isOSX as t } from "../helpers/browser.js";
1
+ import o from "prop-types";
2
+ import s from "react";
3
3
  import c from "../helpers/classnames.js";
4
- const l = {
5
- cmd: t ? "⌘" : "ctrl",
6
- option: t ? "⌥" : "win",
7
- ctrl: "ctrl",
8
- up: "↑",
9
- down: "↓"
10
- }, y = ({ char: e, className: n, ...o }) => {
11
- const r = l[e] ?? e;
12
- return /* @__PURE__ */ i(
4
+ import { isOSX as t } from "../helpers/browser.js";
5
+ const p = ({ char: e, className: n, ...i }) => {
6
+ const r = m[e] ?? e;
7
+ return /* @__PURE__ */ s.createElement(
13
8
  "div",
14
9
  {
15
10
  className: c(
16
11
  "ui-key",
17
- "no-translate inline-flex h-5 items-center justify-center rounded bg-gray-lighter px-2 py-1 text-xs font-semibold text-gray",
12
+ "no-translate inline-flex h-5 items-center justify-center rounded bg-gray-lighter py-1 px-2 text-xs font-semibold text-gray",
18
13
  r.length === 1 && "w-5",
19
14
  n
20
15
  ),
21
- ...o,
22
- children: r
23
- }
16
+ ...i
17
+ },
18
+ r
24
19
  );
20
+ }, m = {
21
+ cmd: t ? "⌘" : "ctrl",
22
+ option: t ? "⌥" : "win",
23
+ ctrl: "ctrl",
24
+ up: "↑",
25
+ down: "↓"
26
+ };
27
+ p.propTypes = {
28
+ char: o.string.isRequired,
29
+ className: o.string
25
30
  };
26
31
  export {
27
- y as Key
32
+ p as Key
28
33
  };
@@ -1,10 +1,17 @@
1
- import { jsx as n } from "react/jsx-runtime";
2
- import r from "../helpers/classnames.js";
3
- const o = {
1
+ import e from "prop-types";
2
+ import t from "react";
3
+ import c from "../helpers/classnames.js";
4
+ const r = {
4
5
  small: "w-10 h-10",
5
6
  medium: "w-16 h-16",
6
7
  large: "w-20 h-20"
7
- }, t = ({ size: e = "small", className: s, ...m }) => /* @__PURE__ */ n("img", { className: r("ui-logo", s, "inline-block rounded object-cover", o[e]), ...m }), l = Object.assign(t, { sizes: o });
8
+ }, s = ({ className: o, size: i = "small", ...m }) => /* @__PURE__ */ t.createElement("img", { className: c("ui-logo", o, "inline-block rounded object-cover", r[i]), ...m });
9
+ s.sizes = r;
10
+ s.propTypes = {
11
+ className: e.string,
12
+ src: e.string.isRequired,
13
+ size: e.string
14
+ };
8
15
  export {
9
- l as Logo
16
+ s as Logo
10
17
  };
@@ -1,8 +1,8 @@
1
- import { jsx as t, jsxs as c } from "react/jsx-runtime";
2
- import { Transition as s, Dialog as d } from "@headlessui/react";
3
- import { Fragment as m } from "react";
4
- import o from "../helpers/classnames.js";
5
- import { CloseIcon as v } from "../icons/src/CloseIcon.js";
1
+ import { Transition as c, Dialog as p } from "@headlessui/react";
2
+ import o from "prop-types";
3
+ import e, { Fragment as d } from "react";
4
+ import a from "../helpers/classnames.js";
5
+ import { CloseIcon as x } from "../icons/src/CloseIcon.js";
6
6
  const y = {
7
7
  small: "max-w-100",
8
8
  // 400px
@@ -12,13 +12,13 @@ const y = {
12
12
  // 600px
13
13
  huge: "max-w-200"
14
14
  // 800px
15
- }, x = {
15
+ }, f = {
16
16
  center: "inline-block",
17
17
  topLeft: "absolute m-4 top-0 left-0",
18
18
  topRight: "absolute m-4 top-0 right-0",
19
19
  bottomLeft: "absolute m-4 bottom-0 left-0",
20
20
  bottomRight: "absolute m-4 bottom-0 right-0"
21
- }, r = {
21
+ }, l = {
22
22
  center: {
23
23
  enterFrom: "translate-y-4 sm:translate-y-0 sm:scale-95",
24
24
  enterTo: "translate-y-0 sm:scale-100",
@@ -49,78 +49,93 @@ const y = {
49
49
  leaveFrom: "scale-100 origin-bottom-right",
50
50
  leaveTo: "scale-0 origin-bottom-right"
51
51
  }
52
- }, g = ({
53
- size: a = "medium",
54
- position: e = "center",
55
- isOpen: l = !1,
56
- shouldCloseOnOutsideClick: i = !1,
57
- children: b,
58
- className: f,
59
- onClose: n
60
- }) => /* @__PURE__ */ t(s, { appear: !0, show: l, as: m, children: /* @__PURE__ */ t(d, { as: "div", className: "ui-modal fixed inset-0 z-30 overflow-y-auto", onClose: () => {
61
- i && n();
62
- }, children: /* @__PURE__ */ c("div", { className: "min-h-screen px-4 text-center", children: [
63
- /* @__PURE__ */ t(
64
- s.Child,
52
+ }, i = ({
53
+ size: r = "medium",
54
+ position: t = "center",
55
+ isOpen: n = !1,
56
+ shouldCloseOnOutsideClick: s = !1,
57
+ onClose: m,
58
+ children: h,
59
+ className: v
60
+ }) => {
61
+ const T = () => {
62
+ s && m();
63
+ };
64
+ return /* @__PURE__ */ e.createElement(c, { appear: !0, show: n, as: d }, /* @__PURE__ */ e.createElement(p, { as: "div", className: "ui-modal fixed inset-0 z-30 overflow-y-auto", onClose: T }, /* @__PURE__ */ e.createElement("div", { className: "min-h-screen px-4 text-center" }, /* @__PURE__ */ e.createElement(
65
+ c.Child,
65
66
  {
66
- as: m,
67
+ as: d,
67
68
  enter: "ease-out duration-300",
68
69
  enterFrom: "opacity-0",
69
70
  enterTo: "opacity-100",
70
71
  leave: "ease-in duration-200",
71
72
  leaveFrom: "opacity-100",
72
- leaveTo: "opacity-0",
73
- children: /* @__PURE__ */ t(d.Overlay, { className: "ui-modal-overlay fixed inset-0 bg-black bg-opacity-80 transition-opacity" })
74
- }
75
- ),
76
- e === "center" && /* @__PURE__ */ t("span", { className: "inline-block h-screen align-middle", "aria-hidden": "true", children: "​" }),
77
- /* @__PURE__ */ t(
78
- s.Child,
73
+ leaveTo: "opacity-0"
74
+ },
75
+ /* @__PURE__ */ e.createElement(p.Overlay, { className: "ui-modal-overlay fixed inset-0 bg-black bg-opacity-80 transition-opacity" })
76
+ ), t === "center" && /* @__PURE__ */ e.createElement("span", { className: "inline-block h-screen align-middle", "aria-hidden": "true" }, "​"), /* @__PURE__ */ e.createElement(
77
+ c.Child,
79
78
  {
80
- as: m,
81
- enter: o("ease-out duration-300"),
82
- enterFrom: o("opacity-0", r[e].enterFrom),
83
- enterTo: o("opacity-100", r[e].enterTo),
84
- leave: o("ease-in duration-300"),
85
- leaveFrom: o("opacity-100", r[e].leaveFrom),
86
- leaveTo: o("opacity-0", r[e].leaveTo),
87
- children: /* @__PURE__ */ c(
88
- "div",
79
+ as: d,
80
+ enter: a("ease-out duration-300"),
81
+ enterFrom: a("opacity-0", l[t].enterFrom),
82
+ enterTo: a("opacity-100", l[t].enterTo),
83
+ leave: a("ease-in duration-300"),
84
+ leaveFrom: a("opacity-100", l[t].leaveFrom),
85
+ leaveTo: a("opacity-0", l[t].leaveTo)
86
+ },
87
+ /* @__PURE__ */ e.createElement(
88
+ "div",
89
+ {
90
+ className: a(
91
+ v,
92
+ y[r],
93
+ f[t],
94
+ "w-full transform overflow-hidden rounded-lg bg-white p-10 text-left align-middle shadow-xl transition-all"
95
+ )
96
+ },
97
+ m ? /* @__PURE__ */ e.createElement(
98
+ "button",
89
99
  {
90
- className: o(
91
- f,
92
- y[a],
93
- x[e],
94
- "w-full transform overflow-hidden rounded-lg bg-white p-10 text-left align-middle shadow-xl transition-all"
95
- ),
96
- children: [
97
- n ? /* @__PURE__ */ t(
98
- "button",
99
- {
100
- type: "button",
101
- className: "absolute right-0 top-0 m-4 hidden p-2 text-black hover:text-gray-darker sm:block",
102
- onClick: () => n(),
103
- children: /* @__PURE__ */ t(v, {})
104
- }
105
- ) : null,
106
- b
107
- ]
108
- }
109
- )
110
- }
111
- )
112
- ] }) }) }), h = ({ description: a, children: e, className: l, ...i }) => /* @__PURE__ */ c(d.Title, { as: "div", className: o(l, "ui-modal-header text-center"), ...i, children: [
113
- /* @__PURE__ */ t("h3", { className: "text-2xl font-semibold leading-6 text-black", children: e }),
114
- a ? /* @__PURE__ */ t("p", { className: "mt-2 text-base font-normal leading-normal text-gray-darker", children: a }) : null
115
- ] });
116
- h.displayName = "Modal.Header";
117
- const p = ({ className: a, ...e }) => /* @__PURE__ */ t("div", { className: o(a, "ui-modal-body mt-10"), ...e });
118
- p.displayName = "Modal.Body";
119
- const u = ({ className: a, ...e }) => /* @__PURE__ */ t("div", { className: o(a, "ui-modal-footer mt-10 space-x-4 text-right"), ...e });
120
- u.displayName = "Modal.Footer";
121
- g.Header = h;
122
- g.Body = p;
123
- g.Footer = u;
100
+ type: "button",
101
+ className: "absolute right-0 top-0 m-4 hidden p-2 text-black hover:text-gray-darker sm:block",
102
+ onClick: () => m()
103
+ },
104
+ /* @__PURE__ */ e.createElement(x, null)
105
+ ) : null,
106
+ h
107
+ )
108
+ ))));
109
+ };
110
+ i.propTypes = {
111
+ size: o.oneOf(Object.keys(y)),
112
+ position: o.oneOf(Object.keys(f)),
113
+ isOpen: o.bool.isRequired,
114
+ shouldCloseOnOutsideClick: o.bool,
115
+ onClose: o.func.isRequired,
116
+ children: o.node.isRequired,
117
+ className: o.string
118
+ };
119
+ const g = ({ children: r, description: t, className: n, ...s }) => /* @__PURE__ */ e.createElement(p.Title, { as: "div", className: a(n, "ui-modal-header text-center"), ...s }, /* @__PURE__ */ e.createElement("h3", { className: "text-2xl font-semibold leading-6 text-black" }, r), t ? /* @__PURE__ */ e.createElement("p", { className: "mt-2 text-base font-normal leading-normal text-gray-darker" }, t) : null);
120
+ g.propTypes = {
121
+ children: o.node.isRequired,
122
+ description: o.string,
123
+ className: o.string
124
+ };
125
+ g.displayName = "Modal.Header";
126
+ i.Header = g;
127
+ const u = ({ className: r, ...t }) => /* @__PURE__ */ e.createElement("div", { className: a(r, "ui-modal-body mt-10"), ...t });
128
+ u.propTypes = {
129
+ className: o.string
130
+ };
131
+ u.displayName = "Modal.Body";
132
+ i.Body = u;
133
+ const b = ({ className: r, ...t }) => /* @__PURE__ */ e.createElement("div", { className: a(r, "ui-modal-footer mt-10 space-x-4 text-right"), ...t });
134
+ b.propTypes = {
135
+ className: o.string
136
+ };
137
+ b.displayName = "Modal.Footer";
138
+ i.Footer = b;
124
139
  export {
125
- g as Modal
140
+ i as Modal
126
141
  };
@@ -1,44 +1,53 @@
1
- import { jsx as m } from "react/jsx-runtime";
2
- import d from "@tippyjs/react";
3
- import { Children as y, forwardRef as g, useState as C } from "react";
4
- import u from "../../helpers/classnames.js";
1
+ import c from "@tippyjs/react";
2
+ import t from "prop-types";
3
+ import r, { Children as C, useState as T } from "react";
5
4
  import { followCursor as v } from "tippy.js";
6
- import "tippy.js/dist/border.css";
7
- import "tippy.js/dist/tippy.css";
8
- import { getChildrenByType as T } from "../../helpers/children.js";
5
+ /* empty css */
6
+ /* empty css */
7
+ import { getChildrenByType as N } from "../../helpers/children.js";
8
+ import d from "../../helpers/classnames.js";
9
9
  import h from "./Popover.module.css.js";
10
- import x from "./PopoverScroll.module.css.js";
11
- const z = ({ isLazy: t = !0, skidding: o = 0, distance: r = 10, children: n, className: s, ...e }) => {
12
- const p = T(n, l), a = y.toArray(n).filter((i) => i.type !== l);
13
- return /* @__PURE__ */ m(
14
- t ? f : d,
10
+ import z from "./PopoverScroll.module.css.js";
11
+ const m = ({ isLazy: e = !0, skidding: o = 0, distance: i = 10, className: s, children: p, ...n }) => {
12
+ const a = N(p, m.Content), y = C.toArray(p).filter((g) => g.type !== m.Content), f = e ? u : c;
13
+ return /* @__PURE__ */ r.createElement(
14
+ f,
15
15
  {
16
16
  interactive: !0,
17
17
  zIndex: 50,
18
- content: p,
19
- className: u("ui-popover", x, h.main, "!rounded-lg !border-gray-light shadow-xl", s),
18
+ content: a,
19
+ className: d("ui-popover", z, h.main, "!rounded-lg !border-gray-light shadow-xl", s),
20
20
  plugins: [v],
21
- offset: [o ?? 0, r ?? 10],
22
- ...e,
23
- children: /* @__PURE__ */ m("span", { children: a })
24
- }
21
+ offset: [o ?? 0, i ?? 10],
22
+ ...n
23
+ },
24
+ /* @__PURE__ */ r.createElement("span", null, y)
25
25
  );
26
- }, l = ({ children: t, className: o }) => /* @__PURE__ */ m("div", { className: u("ui-popover-content", o), children: t });
26
+ };
27
+ m.propTypes = {
28
+ isLazy: t.bool,
29
+ className: t.string,
30
+ skidding: t.number,
31
+ distance: t.number,
32
+ children: t.node.isRequired
33
+ };
34
+ const l = ({ className: e, children: o }) => /* @__PURE__ */ r.createElement("div", { className: d("ui-popover-content", e) }, o);
27
35
  l.displayName = "Popover.Content";
28
- z.Content = l;
29
- const f = g((t, o) => {
30
- const [r, n] = C(!1), s = {
36
+ l.propTypes = {
37
+ className: t.string,
38
+ children: t.node.isRequired
39
+ };
40
+ m.Content = l;
41
+ const u = r.forwardRef((e, o) => {
42
+ const [i, s] = T(!1), p = {
31
43
  fn: () => ({
32
- onMount: () => n(!0),
33
- onHidden: () => n(!1)
44
+ onMount: () => s(!0),
45
+ onHidden: () => s(!1)
34
46
  })
35
- }, e = { ...t };
36
- return e.plugins = [s, ...t.plugins ?? []], t.render ? e.render = (p, a, c) => {
37
- var i;
38
- return r ? (i = t.render) == null ? void 0 : i.call(t, p, a, c) : "";
39
- } : e.content = r ? t.content : "", /* @__PURE__ */ m(d, { ...e, ref: o });
47
+ }, n = { ...e };
48
+ return n.plugins = [p, ...e.plugins || []], e.render ? n.render = (...a) => i ? e.render(...a) : "" : n.content = i ? e.content : "", /* @__PURE__ */ r.createElement(c, { ...n, ref: o });
40
49
  });
41
- f.displayName = "LazyTippy";
50
+ u.displayName = "LazyTippy";
42
51
  export {
43
- z as Popover
52
+ m as Popover
44
53
  };
@@ -1,50 +1,57 @@
1
- import { jsx as d } from "react/jsx-runtime";
2
- import v, { Children as h } from "react";
3
- import g from "../../helpers/classnames.js";
4
- import { Popover as u } from "./Popover.js";
5
- import f from "./PopoverScroll.module.css.js";
6
- const y = ({ placement: l = "bottom", children: i, className: s, ...o }) => {
7
- const e = h.toArray(i), r = e.filter((t) => t.type !== n), m = e.length - r.length, c = e.map((t, a) => t.type === n ? v.cloneElement(t, { position: a, total: m }) : null), p = /* @__PURE__ */ d(
8
- u.Content,
1
+ import e from "prop-types";
2
+ import l, { Children as f } from "react";
3
+ import u from "../../helpers/classnames.js";
4
+ import { Popover as y } from "./Popover.js";
5
+ import h from "./PopoverScroll.module.css.js";
6
+ const s = ({ placement: o = "bottom", className: m, children: p, ...n }) => {
7
+ const r = f.toArray(p), i = r.filter((t) => t.type !== s.Item), c = r.length - i.length, a = r.map((t, g) => t.type === s.Item ? l.cloneElement(t, { position: g, total: c }) : null), d = /* @__PURE__ */ l.createElement(
8
+ y.Content,
9
9
  {
10
- className: g(f, "ui-popover-list-content divide-y divide-solid divide-gray-lighter p-0 "),
11
- children: c
12
- }
10
+ className: u(h, "ui-popover-list-content divide-y divide-solid divide-gray-lighter p-0 ")
11
+ },
12
+ a
13
13
  );
14
- return /* @__PURE__ */ d(u, { content: p, placement: l, className: g("ui-popover-list", "w-40", s), ...o, children: r });
15
- }, n = ({
16
- name: l,
17
- isActive: i = !1,
18
- id: s = null,
19
- position: o,
20
- total: e,
21
- children: r,
22
- className: m,
23
- onClickItem: c,
24
- ...p
25
- }) => {
26
- const t = (a) => c(a, l, s);
27
- return /* @__PURE__ */ d(
14
+ return /* @__PURE__ */ l.createElement(y, { content: d, placement: o, className: u("ui-popover-list", "w-40", m), ...n }, i);
15
+ };
16
+ s.propTypes = {
17
+ placement: e.string,
18
+ className: e.string,
19
+ children: e.node.isRequired
20
+ };
21
+ const v = ({ name: o, isActive: m = !1, id: p = null, position: n, total: r, children: i, className: c, onClickItem: a, ...d }) => {
22
+ const t = (g) => a(g, o, p);
23
+ return /* @__PURE__ */ l.createElement(
28
24
  "div",
29
25
  {
30
- className: g(
26
+ name: o,
27
+ className: u(
31
28
  "ui-popover-list-item",
32
29
  "flex cursor-pointer space-x-2.5 p-4 align-text-top font-semibold leading-4 tracking-tightest hover:bg-gray-lighter",
33
- i ? "bg-gray-lighter" : null,
34
- o === 1 ? "rounded-t-lg" : null,
30
+ m ? "bg-gray-lighter" : null,
31
+ n === 1 ? "rounded-t-lg" : null,
35
32
  // Round the top left & right corners if it's the first one
36
- o === e ? "rounded-b-lg" : null,
33
+ n === r ? "rounded-b-lg" : null,
37
34
  // Round bottom left & right if it's the last one
38
- m
35
+ c
39
36
  ),
40
37
  onClick: t,
41
- ...p,
42
- children: r
43
- }
38
+ ...d
39
+ },
40
+ i
44
41
  );
45
42
  };
46
- n.displayName = "PopoverList.Item";
47
- y.Item = n;
43
+ v.displayName = "PopoverList.Item";
44
+ v.propTypes = {
45
+ position: e.number,
46
+ total: e.number,
47
+ name: e.string.isRequired,
48
+ isActive: e.bool,
49
+ id: e.string,
50
+ children: e.node.isRequired,
51
+ className: e.string,
52
+ onClickItem: e.func.isRequired
53
+ };
54
+ s.Item = v;
48
55
  export {
49
- y as PopoverList
56
+ s as PopoverList
50
57
  };
@@ -1,17 +1,16 @@
1
- import { jsx as u } from "react/jsx-runtime";
2
- import { createContext as s, useRef as i, useCallback as c, useMemo as l } from "react";
1
+ import u, { useRef as c, useCallback as l, useMemo as s, createContext as i } from "react";
3
2
  let p = 1;
4
- const m = s({
3
+ const w = i({
5
4
  generateId: () => (console.warn(
6
5
  "Please wrap your app with `<Provider />` component from `@xola/ui-kit`. Otherwise your app will not work with SSR frameworks."
7
6
  ), p++),
8
7
  localize: !0,
9
8
  locale: "en_US"
10
- }), f = ({ children: n, localize: e = !0, locale: r = "en_US" }) => {
11
- const t = i(1), o = c(() => t.current++, [t]), a = l(() => ({ generateId: o, localize: e, locale: r }), [o, e, r]);
12
- return /* @__PURE__ */ u(m.Provider, { value: a, children: n });
9
+ }), m = ({ children: n, localize: e = !0, locale: r = "en_US" }) => {
10
+ const t = c(1), o = l(() => t.current++, [t]), a = s(() => ({ generateId: o, localize: e, locale: r }), [o, e, r]);
11
+ return /* @__PURE__ */ u.createElement(w.Provider, { value: a }, n);
13
12
  };
14
13
  export {
15
- m as Context,
16
- f as Provider
14
+ w as Context,
15
+ m as Provider
17
16
  };