@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.
- package/README.md +136 -87
- package/build/components/Alert.js +18 -13
- package/build/components/Animation/FadeIn.js +36 -25
- package/build/components/Animation/SlideDown.js +14 -9
- package/build/components/Avatar.js +17 -10
- package/build/components/Badge.js +33 -24
- package/build/components/BottomSheet.js +114 -0
- package/build/components/Breadcrumb.js +27 -21
- package/build/components/Breakdown.js +66 -74
- package/build/components/Buttons/Button.js +53 -47
- package/build/components/Buttons/ButtonGroup.js +42 -39
- package/build/components/Buttons/SecondaryButton.js +31 -0
- package/build/components/Buttons/SubmitButton.js +72 -66
- package/build/components/Buttons/ToggleButton.js +15 -16
- package/build/components/Counter.js +10 -6
- package/build/components/DatePicker/DatePicker.helpers.js +24 -13
- package/build/components/DatePicker/DatePicker.js +196 -223
- package/build/components/DatePicker/DatePickerPopover.js +75 -66
- package/build/components/DatePicker/Day.js +35 -32
- package/build/components/DatePicker/LocalizedDayPicker.js +15 -18
- package/build/components/DatePicker/MonthGrid.js +35 -48
- package/build/components/DatePicker/MonthPicker.js +25 -20
- package/build/components/DatePicker/MonthSelector.js +39 -40
- package/build/components/DatePicker/MonthYearSelector.js +18 -39
- package/build/components/DatePicker/NavbarElement.js +26 -35
- package/build/components/DatePicker/RangeDatePicker.js +104 -123
- package/build/components/DatePicker/RelativeDateRange.js +153 -143
- package/build/components/DatePicker/UpcomingDatePicker.js +29 -25
- package/build/components/Dot/Dot.js +13 -8
- package/build/components/Dot/DotProgress.js +12 -7
- package/build/components/Drawer.js +109 -101
- package/build/components/Forms/BaseInput.js +50 -34
- package/build/components/Forms/Checkbox.js +33 -30
- package/build/components/Forms/ComboBox.js +35 -35
- package/build/components/Forms/FormGroup.js +7 -3
- package/build/components/Forms/InlineValuePopover.js +33 -39
- package/build/components/Forms/Input.js +15 -7
- package/build/components/Forms/Label.js +14 -8
- package/build/components/Forms/RangeSlider.js +41 -22
- package/build/components/Forms/Select.js +5 -6
- package/build/components/Forms/Switch.js +46 -38
- package/build/components/Forms/Textarea.js +37 -30
- package/build/components/Forms/ValuePopoverText.js +5 -8
- package/build/components/GooglePlacesAutocomplete.js +112 -0
- package/build/components/HeaderToolbar.js +30 -22
- package/build/components/ImageUpload.js +76 -79
- package/build/components/Key.js +21 -16
- package/build/components/Logo.js +12 -5
- package/build/components/Modal.js +87 -72
- package/build/components/Popover/Popover.js +40 -31
- package/build/components/Popover/PopoverList.js +43 -36
- package/build/components/Provider.js +7 -8
- package/build/components/Screens/Login.js +97 -126
- package/build/components/Search.js +114 -144
- package/build/components/Sidebar/Sidebar.Account.js +39 -46
- package/build/components/Sidebar/Sidebar.Button.js +45 -19
- package/build/components/Sidebar/Sidebar.Footer.js +8 -7
- package/build/components/Sidebar/Sidebar.Heading.js +11 -8
- package/build/components/Sidebar/Sidebar.Link.js +79 -44
- package/build/components/Sidebar/Sidebar.Menu.js +52 -28
- package/build/components/Sidebar/Sidebar.Notifications.js +107 -0
- package/build/components/Sidebar/Sidebar.js +207 -214
- package/build/components/Sidebar/SidebarContext.js +15 -0
- package/build/components/Sidebar/sidebarWidth.js +41 -0
- package/build/components/Sidebar/useSidebarWidthState.js +115 -0
- package/build/components/Skeleton.js +19 -20
- package/build/components/Spinner.js +18 -10
- package/build/components/Table.js +86 -50
- package/build/components/Tabs/Tabs.Panel.js +9 -5
- package/build/components/Tabs/Tabs.Tab.js +28 -23
- package/build/components/Tabs/Tabs.js +23 -23
- package/build/components/Tag.js +28 -23
- package/build/components/Tooltip.js +19 -5
- package/build/components/Utilities/Currency.js +49 -42
- package/build/components/Utilities/Number.js +14 -12
- package/build/components/Utilities/Phone.js +18 -12
- package/build/helpers/environment.js +10 -0
- package/build/helpers/flash.js +45 -46
- package/build/hooks/useIsMobile.js +8 -0
- package/build/hooks/useViewportHeight.js +6 -12
- package/build/icons/src/AnnounceIcon.js +3 -4
- package/build/icons/src/BellIcon.js +0 -1
- package/build/icons/src/CalendarIcon.js +0 -1
- package/build/icons/src/CheckIcon.js +0 -1
- package/build/icons/src/ChevronDownIcon.js +4 -5
- package/build/icons/src/ChevronLeftIcon.js +0 -1
- package/build/icons/src/ChevronRightIcon.js +0 -1
- package/build/icons/src/CircleNotch.js +0 -1
- package/build/icons/src/CloseIcon.js +11 -9
- package/build/icons/src/DownArrowIcon.js +0 -1
- package/build/icons/src/ImageIcon.js +0 -1
- package/build/icons/src/SearchIcon.js +4 -5
- package/build/icons/src/TrashIcon.js +0 -1
- package/build/icons/src/WarningDiamondIcon.js +0 -1
- package/build/icons/src/helpers/icon.js +5 -9
- package/build/icons/src/images/XolaLogoSimple.js +2 -3
- package/build/index.js +143 -130
- package/build/style.css +1 -0
- package/build/theme.css +76 -0
- package/build/theme.js +2 -0
- package/build/utils/currency.js +5 -5
- package/build/{helpers → utils}/date.js +17 -20
- package/build/utils/numbers.js +12 -12
- package/build/utils/phone.js +12 -14
- package/build/utils/userLocale.js +6 -0
- package/index.css +96 -4
- package/index.d.ts +204 -0
- package/package.json +87 -77
- package/skills/README.md +27 -0
- package/skills/migrate-2.6-to-3.7/SKILL.md +110 -0
- package/tailwind.config.js +5 -2
- package/build/base.css +0 -2
- package/build/components/Alert.d.ts +0 -18
- package/build/components/Animation/FadeIn.d.ts +0 -13
- package/build/components/Animation/SlideDown.d.ts +0 -6
- package/build/components/Avatar.d.ts +0 -16
- package/build/components/Badge.d.ts +0 -28
- package/build/components/Breadcrumb.d.ts +0 -21
- package/build/components/Breakdown.d.ts +0 -63
- package/build/components/Buttons/Button.d.ts +0 -53
- package/build/components/Buttons/ButtonGroup.d.ts +0 -35
- package/build/components/Buttons/SubmitButton.d.ts +0 -11
- package/build/components/Buttons/ToggleButton.d.ts +0 -21
- package/build/components/Charts/BaseChartOptions.d.ts +0 -136
- package/build/components/Charts/HistogramOptions.d.ts +0 -192
- package/build/components/Charts/PieOptions.d.ts +0 -177
- package/build/components/Counter.d.ts +0 -5
- package/build/components/DatePicker/DatePicker.d.ts +0 -41
- package/build/components/DatePicker/DatePicker.helpers.d.ts +0 -17
- package/build/components/DatePicker/DatePickerPopover.d.ts +0 -29
- package/build/components/DatePicker/Day.d.ts +0 -13
- package/build/components/DatePicker/LocalizedDayPicker.d.ts +0 -6
- package/build/components/DatePicker/MonthGrid.d.ts +0 -11
- package/build/components/DatePicker/MonthPicker.d.ts +0 -7
- package/build/components/DatePicker/MonthSelector.d.ts +0 -8
- package/build/components/DatePicker/MonthYearSelector.d.ts +0 -8
- package/build/components/DatePicker/NavbarElement.d.ts +0 -15
- package/build/components/DatePicker/RangeDatePicker.d.ts +0 -25
- package/build/components/DatePicker/RelativeDateRange.d.ts +0 -51
- package/build/components/DatePicker/UpcomingDatePicker.d.ts +0 -11
- package/build/components/Dot/Dot.d.ts +0 -24
- package/build/components/Dot/DotProgress.d.ts +0 -6
- package/build/components/Drawer.d.ts +0 -28
- package/build/components/Forms/BaseInput.d.ts +0 -20
- package/build/components/Forms/Checkbox.d.ts +0 -10
- package/build/components/Forms/ComboBox.d.ts +0 -8
- package/build/components/Forms/FormGroup.d.ts +0 -5
- package/build/components/Forms/InlineValuePopover.d.ts +0 -17
- package/build/components/Forms/Input.d.ts +0 -6
- package/build/components/Forms/Label.d.ts +0 -7
- package/build/components/Forms/RangeSlider.d.ts +0 -33
- package/build/components/Forms/Select.d.ts +0 -5
- package/build/components/Forms/Switch.d.ts +0 -46
- package/build/components/Forms/Textarea.d.ts +0 -6
- package/build/components/Forms/ValuePopoverText.d.ts +0 -6
- package/build/components/GooglePlacesAutocomplete.d.ts +0 -14
- package/build/components/HeaderToolbar.d.ts +0 -21
- package/build/components/ImageUpload.d.ts +0 -17
- package/build/components/Key.d.ts +0 -6
- package/build/components/Logo.d.ts +0 -19
- package/build/components/Modal.d.ts +0 -52
- package/build/components/Popover/Popover.d.ts +0 -20
- package/build/components/Popover/PopoverList.d.ts +0 -25
- package/build/components/Provider.d.ts +0 -18
- package/build/components/Screens/Login.d.ts +0 -25
- package/build/components/Search.d.ts +0 -16
- package/build/components/Sidebar/Sidebar.Account.d.ts +0 -13
- package/build/components/Sidebar/Sidebar.Button.d.ts +0 -10
- package/build/components/Sidebar/Sidebar.Footer.d.ts +0 -8
- package/build/components/Sidebar/Sidebar.Heading.d.ts +0 -10
- package/build/components/Sidebar/Sidebar.Link.d.ts +0 -24
- package/build/components/Sidebar/Sidebar.Menu.d.ts +0 -13
- package/build/components/Sidebar/Sidebar.d.ts +0 -58
- package/build/components/Sidebar/index.d.ts +0 -8
- package/build/components/Skeleton.d.ts +0 -13
- package/build/components/Spinner.d.ts +0 -26
- package/build/components/Table.d.ts +0 -59
- package/build/components/Tabs/Tabs.Panel.d.ts +0 -9
- package/build/components/Tabs/Tabs.Tab.d.ts +0 -19
- package/build/components/Tabs/Tabs.d.ts +0 -27
- package/build/components/Tabs/index.d.ts +0 -4
- package/build/components/Tag.d.ts +0 -25
- package/build/components/Tooltip.d.ts +0 -8
- package/build/components/Utilities/Currency.d.ts +0 -32
- package/build/components/Utilities/Number.d.ts +0 -8
- package/build/components/Utilities/Phone.d.ts +0 -8
- package/build/full.css +0 -2
- package/build/helpers/avatar.d.ts +0 -1
- package/build/helpers/avatar.js +0 -8
- package/build/helpers/browser.d.ts +0 -2
- package/build/helpers/children.d.ts +0 -3
- package/build/helpers/classnames.d.ts +0 -5
- package/build/helpers/currency.d.ts +0 -2
- package/build/helpers/currency.js +0 -11
- package/build/helpers/date.d.ts +0 -12
- package/build/helpers/flash.d.ts +0 -21
- package/build/helpers/numbers.d.ts +0 -4
- package/build/helpers/numbers.js +0 -23
- package/build/helpers/phone.d.ts +0 -11
- package/build/helpers/phone.js +0 -25
- package/build/hooks/useId.d.ts +0 -1
- package/build/hooks/useId.js +0 -9
- package/build/hooks/useIsClient.d.ts +0 -1
- package/build/hooks/useViewportHeight.d.ts +0 -1
- package/build/icons/src/helpers/classnames.js +0 -8
- package/build/index.d.ts +0 -66
- package/build/theme.d.ts +0 -413
- package/build/types/index.d.ts +0 -22
- package/build/types/migration.d.ts +0 -2
- package/build/ui-kit.css +0 -1
- package/build/utils/avatar.d.ts +0 -1
- package/build/utils/currency.d.ts +0 -2
- package/build/utils/index.d.ts +0 -4
- package/build/utils/numbers.d.ts +0 -4
- package/build/utils/phone.d.ts +0 -2
|
@@ -1,21 +1,47 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
)
|
|
18
|
-
|
|
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
|
-
|
|
46
|
+
s as SidebarButton
|
|
21
47
|
};
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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
|
-
|
|
9
|
+
r as SidebarFooter
|
|
9
10
|
};
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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
|
-
|
|
12
|
+
r as SidebarHeading
|
|
10
13
|
};
|
|
@@ -1,57 +1,92 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import t from "prop-types";
|
|
2
|
+
import r from "react";
|
|
3
3
|
import n from "../../helpers/classnames.js";
|
|
4
|
-
import { Dot as
|
|
5
|
-
import {
|
|
6
|
-
import { ChevronRightIcon as
|
|
7
|
-
const
|
|
8
|
-
isActive:
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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
|
-
|
|
14
|
-
|
|
13
|
+
isSubMenuItem: f,
|
|
14
|
+
align: y,
|
|
15
|
+
classNames: e,
|
|
16
|
+
className: m,
|
|
17
|
+
...b
|
|
15
18
|
}) => {
|
|
16
|
-
const
|
|
17
|
-
return
|
|
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
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
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
|
-
...
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
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
|
-
|
|
52
|
-
|
|
53
|
-
|
|
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
|
-
|
|
56
|
-
|
|
90
|
+
l as SidebarLink,
|
|
91
|
+
u as SidebarSeparator
|
|
57
92
|
};
|
|
@@ -1,30 +1,54 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
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
|
-
|
|
29
|
-
|
|
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
|
+
};
|