@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,21 +1,47 @@
1
- import { jsxs as n, jsx as e } from "react/jsx-runtime";
2
- import o from "../../helpers/classnames.js";
3
- const i = ({ icon: r, label: t, className: s, ...a }) => /* @__PURE__ */ n(
4
- "button",
5
- {
6
- type: "button",
7
- className: o(
8
- "ui-sidebar-button flex w-full cursor-pointer items-center rounded px-4 py-2 hover:bg-gray-darker",
9
- s
10
- ),
11
- ...a,
12
- children: [
13
- /* @__PURE__ */ e("div", { className: "p-1.5", children: /* @__PURE__ */ e(r, { className: "h-4 w-4" }) }),
14
- /* @__PURE__ */ e("span", { className: "ml-2", children: t })
15
- ]
16
- }
17
- );
18
- i.displayName = "Sidebar.Button";
1
+ import r from "prop-types";
2
+ import i from "react";
3
+ import a from "../../helpers/classnames.js";
4
+ import { useSidebar as d } from "./SidebarContext.js";
5
+ const s = ({ icon: p, label: n, appearance: m = "plain", className: l, ...c }) => {
6
+ const { showIcons: o, showText: t } = d(), e = m === "solid";
7
+ return /* @__PURE__ */ i.createElement(
8
+ "button",
9
+ {
10
+ type: "button",
11
+ className: a(
12
+ "ui-sidebar-button flex min-w-0 cursor-pointer items-center rounded",
13
+ e ? "mx-2 mb-4 bg-white py-1.5 text-base font-semibold text-gray-darker hover:bg-gray-lighter" : "w-full py-2 hover:bg-gray-darker",
14
+ t && (e ? "px-3" : "px-4"),
15
+ !t && "justify-center px-2",
16
+ l
17
+ ),
18
+ "aria-label": t ? void 0 : n,
19
+ ...c
20
+ },
21
+ /* @__PURE__ */ i.createElement("div", { className: a("shrink-0", e ? "p-0.5" : "p-1.5", !o && "hidden") }, /* @__PURE__ */ i.createElement(p, { className: a("shrink-0", e ? "h-5 w-5" : "h-4 w-4") })),
22
+ /* @__PURE__ */ i.createElement(
23
+ "span",
24
+ {
25
+ className: a(
26
+ "min-w-0 truncate",
27
+ !t && "hidden",
28
+ o && (e ? "ml-3" : "ml-2"),
29
+ e && "whitespace-nowrap"
30
+ )
31
+ },
32
+ n
33
+ )
34
+ );
35
+ };
36
+ s.displayName = "Sidebar.Button";
37
+ s.propTypes = {
38
+ icon: r.elementType.isRequired,
39
+ label: r.string.isRequired,
40
+ // "solid" is the filled, card-like treatment that lifts one action out of the list. It
41
+ // carries a larger icon to match.
42
+ appearance: r.oneOf(["plain", "solid"]),
43
+ className: r.string
44
+ };
19
45
  export {
20
- i as SidebarButton
46
+ s as SidebarButton
21
47
  };
@@ -1,9 +1,10 @@
1
- import { jsxs as o, jsx as a } from "react/jsx-runtime";
2
- const d = ({ children: r, ...e }) => /* @__PURE__ */ o("div", { className: "ui-sidebar-footer py-3", ...e, children: [
3
- /* @__PURE__ */ a("div", { className: "mx-4 border-t border-secondary-darker pb-2" }),
4
- r
5
- ] });
6
- d.displayName = "Sidebar.Footer";
1
+ import t from "prop-types";
2
+ import e from "react";
3
+ const r = ({ children: o, ...a }) => /* @__PURE__ */ e.createElement("div", { className: "ui-sidebar-footer py-3", ...a }, /* @__PURE__ */ e.createElement("div", { className: "mx-4 border-t border-secondary-darker pb-2" }), o);
4
+ r.displayName = "Sidebar.Footer";
5
+ r.propTypes = {
6
+ children: t.node.isRequired
7
+ };
7
8
  export {
8
- d as SidebarFooter
9
+ r as SidebarFooter
9
10
  };
@@ -1,10 +1,13 @@
1
- import { jsxs as t, jsx as e } from "react/jsx-runtime";
2
- import i from "../../helpers/classnames.js";
3
- const m = ({ icon: a, label: r, className: s }) => /* @__PURE__ */ t("p", { className: i("ml-4 flex items-center text-white", s), children: [
4
- /* @__PURE__ */ e(a, { className: "mr-3 h-5 w-5" }),
5
- /* @__PURE__ */ e("span", { className: "text-md font-bold", children: r })
6
- ] });
7
- m.displayName = "Sidebar.Heading";
1
+ import e from "prop-types";
2
+ import t from "react";
3
+ import s from "../../helpers/classnames.js";
4
+ const r = ({ icon: a, label: i, className: m }) => /* @__PURE__ */ t.createElement("p", { className: s("ml-4 flex items-center text-white", m) }, /* @__PURE__ */ t.createElement(a, { className: "mr-3 h-5 w-5" }), /* @__PURE__ */ t.createElement("span", { className: "text-md font-bold" }, i));
5
+ r.displayName = "Sidebar.Heading";
6
+ r.propTypes = {
7
+ icon: e.func.isRequired,
8
+ label: e.string.isRequired,
9
+ className: e.string
10
+ };
8
11
  export {
9
- m as SidebarHeading
12
+ r as SidebarHeading
10
13
  };
@@ -1,57 +1,92 @@
1
- import { jsxs as b, jsx as o } from "react/jsx-runtime";
2
- import { useRef as g, useState as h, useEffect as w } from "react";
1
+ import t from "prop-types";
2
+ import r from "react";
3
3
  import n from "../../helpers/classnames.js";
4
- import { Dot as k } from "../Dot/Dot.js";
5
- import { useSidebarMenu as j } from "./Sidebar.Menu.js";
6
- import { ChevronRightIcon as N } from "../../icons/src/ChevronRightIcon.js";
7
- const S = ({
8
- isActive: t = !1,
9
- icon: i,
10
- isSubMenuItem: r,
11
- align: l,
4
+ import { Dot as x } from "../Dot/Dot.js";
5
+ import { useSidebar as c } from "./SidebarContext.js";
6
+ import { ChevronRightIcon as k } from "../../icons/src/ChevronRightIcon.js";
7
+ const l = ({
8
+ isActive: i = !1,
9
+ hasSubmenu: h = !1,
10
+ icon: p,
11
+ info: g,
12
12
  children: d,
13
- classNames: s,
14
- ...m
13
+ isSubMenuItem: f,
14
+ align: y,
15
+ classNames: e,
16
+ className: m,
17
+ ...b
15
18
  }) => {
16
- const e = g(null), [a, p] = h(!0), [u, x] = h(!0), { hasSubmenu: y } = j();
17
- return w(() => {
18
- const c = () => {
19
- e.current && (p(e.current.offsetWidth >= 140), x(e.current.offsetWidth >= 140 || e.current.offsetWidth < 100));
20
- };
21
- c();
22
- const f = new ResizeObserver(c);
23
- return e.current && f.observe(e.current), () => {
24
- f.disconnect();
25
- };
26
- }, []), /* @__PURE__ */ b(
19
+ const { showIcons: a, showText: o } = c();
20
+ return f ? /* @__PURE__ */ r.createElement(
27
21
  "button",
28
22
  {
29
- ref: e,
30
23
  type: "button",
31
24
  className: n(
32
25
  "ui-sidebar-link",
33
- "flex w-full items-center rounded leading-none transition-colors xl:justify-start",
34
- !r && "h-11",
35
- {
36
- "bg-primary text-white hover:bg-primary-dark": t,
37
- "text-gray hover:bg-gray-darker": !t,
38
- "justify-start px-6 py-2": r,
39
- "justify-center px-6 py-3": !r
40
- }
26
+ "flex w-full items-center justify-start rounded px-6 py-2 leading-none transition-colors",
27
+ i ? "bg-primary text-white hover:bg-primary-dark" : "text-gray hover:bg-gray-darker",
28
+ e == null ? void 0 : e.button,
29
+ m
41
30
  ),
42
- ...m,
43
- children: [
44
- r ? /* @__PURE__ */ o(k, { className: n("mr-3 shrink-0", { "bg-white": t, "bg-gray": !t }) }) : u && i && /* @__PURE__ */ o("div", { className: n(!a && "flex w-full justify-center"), children: /* @__PURE__ */ o(i, { className: n("h-5 w-5 shrink-0", a && "mr-3") }) }),
45
- (a || r) && /* @__PURE__ */ o("span", { className: n("px-1", { "text-left": r ?? l === "left" }, s == null ? void 0 : s.text), children: d }),
46
- !r && a && y && /* @__PURE__ */ o(N, { className: "ml-auto h-3 w-3" })
47
- ]
48
- }
31
+ ...b
32
+ },
33
+ /* @__PURE__ */ r.createElement(x, { className: n("mr-3 shrink-0", i ? "bg-white" : "bg-gray") }),
34
+ /* @__PURE__ */ r.createElement("span", { className: n("px-1 text-left", e == null ? void 0 : e.text) }, d)
35
+ ) : /* @__PURE__ */ r.createElement(
36
+ "button",
37
+ {
38
+ type: "button",
39
+ className: n(
40
+ "ui-sidebar-link",
41
+ "flex h-10 w-full items-center rounded leading-none transition-colors",
42
+ "py-3",
43
+ o ? "justify-start" : "justify-center px-2",
44
+ // No icon: the label sits nearer the edge instead of holding open the icon's gutter.
45
+ o && (a ? "px-6" : "px-3"),
46
+ i ? "bg-primary text-white hover:bg-primary-dark" : "text-gray hover:bg-gray-darker",
47
+ e == null ? void 0 : e.button,
48
+ m
49
+ ),
50
+ ...b
51
+ },
52
+ /* @__PURE__ */ r.createElement("div", { className: n("shrink-0", !a && "hidden") }, p && /* @__PURE__ */ r.createElement(p, { className: n("h-5 w-5 shrink-0", a && o && "mr-3") })),
53
+ /* @__PURE__ */ r.createElement(
54
+ "span",
55
+ {
56
+ className: n(
57
+ // leading-5 overrides the button's leading-none: `truncate` hides overflow, so a
58
+ // line box only as tall as the cap height clips the descenders off g, y, p.
59
+ "min-w-0 truncate px-1 leading-5",
60
+ !o && "hidden",
61
+ y === "left" && "text-left",
62
+ e == null ? void 0 : e.text
63
+ )
64
+ },
65
+ d
66
+ ),
67
+ g ?? (h && /* @__PURE__ */ r.createElement(k, { className: n("ml-auto h-3 w-3 shrink-0", !o && "hidden") }))
49
68
  );
50
69
  };
51
- S.displayName = "Sidebar.Link";
52
- const v = ({ className: t }) => /* @__PURE__ */ o("hr", { className: n("mx-3 my-4 border-gray-lighter/20", t) });
53
- v.displayName = "Sidebar.Separator";
70
+ l.displayName = "Sidebar.Link";
71
+ l.propTypes = {
72
+ align: t.oneOf(["center", "left", "right"]),
73
+ isActive: t.bool,
74
+ hasSubmenu: t.bool,
75
+ icon: t.func,
76
+ // A consumer-supplied trailing node. Rendered in every variant, unlike the default chevron:
77
+ // it carries opt-in content such as a badge or a portal target that must survive the rail.
78
+ info: t.node,
79
+ children: t.node.isRequired,
80
+ isSubMenuItem: t.bool,
81
+ className: t.string,
82
+ classNames: t.shape({ button: t.string, text: t.string })
83
+ };
84
+ const u = ({ className: i }) => /* @__PURE__ */ r.createElement("hr", { className: n("mx-3 my-4 border-gray-lighter/20", i) });
85
+ u.displayName = "Sidebar.Separator";
86
+ u.propTypes = {
87
+ className: t.string
88
+ };
54
89
  export {
55
- S as SidebarLink,
56
- v as SidebarSeparator
90
+ l as SidebarLink,
91
+ u as SidebarSeparator
57
92
  };
@@ -1,30 +1,54 @@
1
- import { jsx as e } from "react/jsx-runtime";
2
- import i from "@tippyjs/react";
3
- import { useContext as a, createContext as s } from "react";
4
- import d from "../../helpers/classnames.js";
5
- import m from "./Sidebar.Menu.module.css.js";
6
- const u = typeof window > "u" ? void 0 : window.document.body, r = s({ hasSubmenu: !1 }), h = () => a(r), c = ({ content: o, children: n, ...t }) => /* @__PURE__ */ e(r.Provider, { value: { hasSubmenu: !0 }, children: /* @__PURE__ */ e(
7
- i,
8
- {
9
- interactive: !0,
10
- trigger: "mouseenter",
11
- hideOnClick: "toggle",
12
- appendTo: u,
13
- placement: "right",
14
- offset: [0, 4],
15
- arrow: !1,
16
- className: d(
17
- "ui-sidebar-menu",
18
- m.main,
19
- "!rounded-none bg-black bg-opacity-90 p-2 backdrop-blur-sm backdrop-filter"
20
- ),
21
- content: o,
22
- ...t,
23
- children: /* @__PURE__ */ e("span", { className: "block", children: n })
24
- }
25
- ) });
26
- c.displayName = "Sidebar.Menu";
1
+ import b from "@tippyjs/react";
2
+ import t from "prop-types";
3
+ import s from "react";
4
+ import E from "../../helpers/classnames.js";
5
+ import T from "./Sidebar.Menu.module.css.js";
6
+ const h = typeof window > "u" ? void 0 : window.document.body, y = 24, R = 75, g = [150, 100], I = [200, 0], r = /* @__PURE__ */ new Set(), a = (o) => {
7
+ for (const n of r)
8
+ n !== o && n.hide();
9
+ }, C = () => a(null), l = ({ children: o, content: n, onShow: i, onHidden: c, onDestroy: d, ...p }) => {
10
+ const m = (e) => (a(e), r.add(e), i == null ? void 0 : i(e)), u = (e) => {
11
+ r.delete(e), c == null || c(e);
12
+ }, f = (e) => {
13
+ r.delete(e), d == null || d(e);
14
+ };
15
+ return /* @__PURE__ */ s.createElement(
16
+ b,
17
+ {
18
+ interactive: !0,
19
+ arrow: !1,
20
+ trigger: "mouseenter",
21
+ hideOnClick: "toggle",
22
+ appendTo: h,
23
+ placement: "right",
24
+ offset: [0, 4],
25
+ interactiveBorder: y,
26
+ interactiveDebounce: R,
27
+ delay: g,
28
+ duration: I,
29
+ content: n,
30
+ className: E(
31
+ "ui-sidebar-menu",
32
+ T.main,
33
+ "!rounded-none bg-black bg-opacity-90 p-2 backdrop-blur-sm backdrop-filter"
34
+ ),
35
+ onShow: m,
36
+ onHidden: u,
37
+ onDestroy: f,
38
+ ...p
39
+ },
40
+ /* @__PURE__ */ s.createElement("span", { className: "block" }, o)
41
+ );
42
+ };
43
+ l.displayName = "Sidebar.Menu";
44
+ l.propTypes = {
45
+ children: t.node.isRequired,
46
+ content: t.node.isRequired,
47
+ onShow: t.func,
48
+ onHidden: t.func,
49
+ onDestroy: t.func
50
+ };
27
51
  export {
28
- c as SidebarMenu,
29
- h as useSidebarMenu
52
+ l as SidebarMenu,
53
+ C as hideAllSidebarMenus
30
54
  };
@@ -0,0 +1,107 @@
1
+ import e from "prop-types";
2
+ import i from "react";
3
+ import s from "../../helpers/classnames.js";
4
+ import { Counter as r } from "../Counter.js";
5
+ import { Drawer as u } from "../Drawer.js";
6
+ import { AnnounceIcon as k } from "../../icons/src/AnnounceIcon.js";
7
+ import { BellIcon as F } from "../../icons/src/BellIcon.js";
8
+ const z = {
9
+ // From Figma
10
+ background: "linear-gradient(138.65deg, #583DFF 19.59%, #F849C7 62.96%, #FFC03D 97.07%)"
11
+ }, f = (l) => {
12
+ const c = l ? "30px" : "48px";
13
+ return {
14
+ minWidth: c,
15
+ width: c,
16
+ minHeight: "20px",
17
+ height: "20px",
18
+ display: "inline-flex",
19
+ justifyContent: "center",
20
+ alignItems: "center"
21
+ };
22
+ }, d = ({
23
+ notifications: l,
24
+ isCollapsed: c,
25
+ isSticky: x = !0,
26
+ width: p,
27
+ isLeftDrawerOpen: y,
28
+ isRightDrawerOpen: E,
29
+ onDrawerStateChange: t
30
+ }) => {
31
+ const { announcements: o, notices: n } = l ?? {};
32
+ if (!o && !n)
33
+ return null;
34
+ const N = (n == null ? void 0 : n.count) > 0;
35
+ return /* @__PURE__ */ i.createElement(i.Fragment, null, /* @__PURE__ */ i.createElement(
36
+ "div",
37
+ {
38
+ className: s(
39
+ "flex w-full gap-2 bg-black p-2",
40
+ x && "sticky top-0 z-50",
41
+ c ? "flex-col justify-center" : "justify-between"
42
+ )
43
+ },
44
+ o && /* @__PURE__ */ i.createElement("div", { className: s("cursor-pointer text-center", o.hide && "hidden") }, /* @__PURE__ */ i.createElement(
45
+ r,
46
+ {
47
+ style: { ...z, ...f(c) },
48
+ onClick: () => t == null ? void 0 : t("left")
49
+ },
50
+ /* @__PURE__ */ i.createElement(k, { className: s(c && "hidden") }),
51
+ o.count
52
+ )),
53
+ n && /* @__PURE__ */ i.createElement("div", { className: s("cursor-pointer text-center", !N && "hidden") }, /* @__PURE__ */ i.createElement(
54
+ r,
55
+ {
56
+ className: "text-sm",
57
+ style: f(c),
58
+ onClick: () => t == null ? void 0 : t("right")
59
+ },
60
+ /* @__PURE__ */ i.createElement(F, { className: s(c && "hidden") }),
61
+ n.count
62
+ ))
63
+ ), o && /* @__PURE__ */ i.createElement(
64
+ u,
65
+ {
66
+ isOpen: y,
67
+ sideIndent: p,
68
+ position: "left",
69
+ size: "xl",
70
+ title: o.title,
71
+ content: o.content,
72
+ onClose: (m) => !!m && (t == null ? void 0 : t("left"))
73
+ }
74
+ ), n && /* @__PURE__ */ i.createElement(
75
+ u,
76
+ {
77
+ isOpen: E,
78
+ sideIndent: p,
79
+ position: "left",
80
+ size: "xl",
81
+ title: n.title,
82
+ content: n.content,
83
+ onClose: (m) => !!m && (t == null ? void 0 : t("right"))
84
+ }
85
+ ));
86
+ };
87
+ d.displayName = "Sidebar.Notifications";
88
+ const b = {
89
+ count: e.number,
90
+ content: e.node,
91
+ title: e.string,
92
+ onClose: e.func
93
+ }, I = e.shape(b), O = e.shape({ ...b, hide: e.bool });
94
+ d.propTypes = {
95
+ notifications: e.shape({ announcements: O, notices: I }),
96
+ isCollapsed: e.bool,
97
+ isSticky: e.bool,
98
+ width: e.number.isRequired,
99
+ isLeftDrawerOpen: e.bool,
100
+ isRightDrawerOpen: e.bool,
101
+ // Optional: Sidebar forwards its own optional `handleDrawerStateChange` prop here, so a
102
+ // consumer can render notification badges without wiring up drawer toggling.
103
+ onDrawerStateChange: e.func
104
+ };
105
+ export {
106
+ d as SidebarNotifications
107
+ };