@pibit.ai/cure-design-system 0.6.18 → 0.6.20

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.
@@ -0,0 +1,16 @@
1
+ import { FC, ReactNode } from 'react';
2
+ import { BreadcrumbProps as AriaBreadcrumbProps } from 'react-aria-components';
3
+ import { BreadcrumbType } from './context';
4
+ export interface BreadcrumbItemProps extends AriaBreadcrumbProps {
5
+ href?: string;
6
+ divider?: "chevron" | "slash";
7
+ type?: BreadcrumbType;
8
+ isEllipsis?: boolean;
9
+ children?: ReactNode;
10
+ icon?: FC<{
11
+ className?: string;
12
+ }> | ReactNode;
13
+ onClick?: () => void;
14
+ }
15
+ export declare const BreadcrumbItem: ({ href, icon, divider, type, isEllipsis, children, onClick, ...otherProps }: BreadcrumbItemProps) => import("react/jsx-runtime").JSX.Element;
16
+ //# sourceMappingURL=breadcrumb-item.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"breadcrumb-item.d.ts","sourceRoot":"","sources":["../../../src/patterns/breadcrumbs/breadcrumb-item.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,EAAE,KAAK,SAAS,EAA8B,MAAM,OAAO,CAAC;AAE5E,OAAO,EAEL,KAAK,eAAe,IAAI,mBAAmB,EAE5C,MAAM,uBAAuB,CAAC;AAG/B,OAAO,EAAE,KAAK,cAAc,EAAsB,MAAM,WAAW,CAAC;AAkFpE,MAAM,WAAW,mBAAoB,SAAQ,mBAAmB;IAC9D,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,SAAS,GAAG,OAAO,CAAC;IAC9B,IAAI,CAAC,EAAE,cAAc,CAAC;IACtB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,IAAI,CAAC,EAAE,EAAE,CAAC;QAAE,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,GAAG,SAAS,CAAC;IAC9C,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,eAAO,MAAM,cAAc,GAAI,6EAS5B,mBAAmB,4CAqDrB,CAAC"}
@@ -0,0 +1,120 @@
1
+ import { jsx as e, jsxs as p, Fragment as f } from "react/jsx-runtime";
2
+ import { useContext as g, isValidElement as v } from "react";
3
+ import { SlashDivider as d, ChevronRight as b } from "@untitledui/icons";
4
+ import { Breadcrumb as y, Link as _ } from "react-aria-components";
5
+ import { cx as l } from "../../utils/cn.js";
6
+ import { isReactComponent as q } from "../../utils/is-react-component.js";
7
+ import { BreadcrumbsContext as N } from "./context.js";
8
+ const o = {
9
+ text: {
10
+ root: "",
11
+ icon: "text-fg-quaternary group-hover:text-fg-quaternary_hover",
12
+ label: "text-quaternary group-hover:text-tertiary_hover max-w-40",
13
+ current: {
14
+ root: "",
15
+ icon: "text-primary group-hover:text-primary_hover",
16
+ label: "text-primary group-hover:text-primary_hover"
17
+ }
18
+ },
19
+ button: {
20
+ root: "p-1 hover:bg-primary_hover",
21
+ icon: "text-fg-quaternary group-hover:text-fg-quaternary_hover",
22
+ label: "px-1 text-quaternary group-hover:text-tertiary_hover",
23
+ current: {
24
+ root: "bg-primary_hover",
25
+ icon: "text-fg-quaternary_hover",
26
+ label: "text-fg-tertiary_hover"
27
+ }
28
+ }
29
+ }, h = ({
30
+ href: a,
31
+ children: s,
32
+ icon: t,
33
+ type: r = "text",
34
+ current: i,
35
+ className: m,
36
+ ...n
37
+ }) => /* @__PURE__ */ p(
38
+ a ? _ : "button",
39
+ {
40
+ ...n,
41
+ href: a,
42
+ className: l(
43
+ "group inline-flex cursor-pointer items-center justify-center gap-1 rounded-md outline-focus-ring transition duration-100 ease-linear focus-visible:outline-2 focus-visible:outline-offset-2 in-current:max-w-full",
44
+ o[r].root,
45
+ i && o[r].current.root,
46
+ !a && !n.onClick && "cursor-default",
47
+ m
48
+ ),
49
+ children: [
50
+ q(t) && /* @__PURE__ */ e(
51
+ t,
52
+ {
53
+ className: l(
54
+ "size-5 transition-inherit-all",
55
+ o[r].icon,
56
+ i && o[r].current.icon
57
+ )
58
+ }
59
+ ),
60
+ v(t) && t,
61
+ s && /* @__PURE__ */ e(
62
+ "span",
63
+ {
64
+ className: l(
65
+ "text-sm font-medium whitespace-nowrap transition-inherit-all in-current:truncate",
66
+ o[r].label,
67
+ i && o[r].current.label
68
+ ),
69
+ children: s
70
+ }
71
+ )
72
+ ]
73
+ }
74
+ ), R = ({
75
+ href: a,
76
+ icon: s,
77
+ divider: t,
78
+ type: r,
79
+ isEllipsis: i,
80
+ children: m,
81
+ onClick: n,
82
+ ...c
83
+ }) => {
84
+ const u = g(N);
85
+ return r = u.type || "text", t = u.divider || "chevron", /* @__PURE__ */ e(
86
+ y,
87
+ {
88
+ ...c,
89
+ className: l(
90
+ "flex items-center current:overflow-hidden",
91
+ "gap-0.5 md:gap-0.5"
92
+ ),
93
+ children: ({ isCurrent: x }) => /* @__PURE__ */ p(f, { children: [
94
+ i ? /* @__PURE__ */ e(
95
+ h,
96
+ {
97
+ "aria-label": "See all breadcrumb items",
98
+ type: r === "text-line" ? "text" : r,
99
+ onClick: n,
100
+ children: "..."
101
+ }
102
+ ) : /* @__PURE__ */ e(
103
+ h,
104
+ {
105
+ href: a,
106
+ icon: s,
107
+ current: x,
108
+ type: r === "text-line" ? "text" : r,
109
+ onClick: n,
110
+ children: m
111
+ }
112
+ ),
113
+ !x && /* @__PURE__ */ e("div", { className: "shrink-0 text-fg-quaternary", children: t === "slash" ? /* @__PURE__ */ e(d, { className: "size-2.5 stroke-3" }) : /* @__PURE__ */ e(b, { className: "size-4" }) })
114
+ ] })
115
+ }
116
+ );
117
+ };
118
+ export {
119
+ R as BreadcrumbItem
120
+ };
@@ -0,0 +1,20 @@
1
+ import { ReactNode } from 'react';
2
+ import { BreadcrumbType } from './context';
3
+ export interface BreadcrumbsProps {
4
+ divider?: "chevron" | "slash";
5
+ children: ReactNode;
6
+ type?: BreadcrumbType;
7
+ className?: string;
8
+ /**
9
+ * The maximum number of visible items. If the number of items
10
+ * exceeds this value, the breadcrumbs will collapse into a single
11
+ * item with an ellipsis that can be expanded.
12
+ */
13
+ maxVisibleItems?: number;
14
+ }
15
+ declare const Breadcrumbs: {
16
+ ({ children, divider, type, className, maxVisibleItems, }: BreadcrumbsProps): import("react/jsx-runtime").JSX.Element;
17
+ Item: ({ href, icon, divider, type, isEllipsis, children, onClick, ...otherProps }: import('./breadcrumb-item').BreadcrumbItemProps) => import("react/jsx-runtime").JSX.Element;
18
+ };
19
+ export { Breadcrumbs };
20
+ //# sourceMappingURL=breadcrumbs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"breadcrumbs.d.ts","sourceRoot":"","sources":["../../../src/patterns/breadcrumbs/breadcrumbs.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,KAAK,SAAS,EAAY,MAAM,OAAO,CAAC;AAIxD,OAAO,EAAE,KAAK,cAAc,EAAsB,MAAM,WAAW,CAAC;AAQpE,MAAM,WAAW,gBAAgB;IAC/B,OAAO,CAAC,EAAE,SAAS,GAAG,OAAO,CAAC;IAC9B,QAAQ,EAAE,SAAS,CAAC;IACpB,IAAI,CAAC,EAAE,cAAc,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;OAIG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AASD,QAAA,MAAM,WAAW;+DAMd,gBAAgB;;CAwClB,CAAC;AAIF,OAAO,EAAE,WAAW,EAAE,CAAC"}
@@ -0,0 +1,39 @@
1
+ import { jsx as t } from "react/jsx-runtime";
2
+ import h, { useState as g } from "react";
3
+ import { Breadcrumbs as x } from "react-aria-components";
4
+ import { cx as n } from "../../utils/cn.js";
5
+ import { BreadcrumbItem as l } from "./breadcrumb-item.js";
6
+ import { BreadcrumbsContext as B } from "./context.js";
7
+ const v = {
8
+ text: "gap-0.5 md:gap-0.5",
9
+ "text-line": "pl-2 gap-1.25 md:gap-1.25 py-2 after:pointer-events-none after:absolute after:inset-0 after:border-b after:border-t after:border-secondary",
10
+ button: "gap-0.5 md:gap-0.5"
11
+ }, C = ({
12
+ children: c,
13
+ divider: a = "slash",
14
+ type: s = "text",
15
+ className: i,
16
+ maxVisibleItems: r = 4
17
+ }) => {
18
+ const [m, d] = g(!1), p = (() => {
19
+ const e = h.Children.toArray(c);
20
+ if (!r || e.length <= r || m)
21
+ return e;
22
+ const f = e.slice(0, Math.ceil(r / 2)), o = Math.floor((r - 1) / 2), u = o > 0 ? e.slice(-o) : [], b = /* @__PURE__ */ t(
23
+ l,
24
+ {
25
+ isEllipsis: !0,
26
+ divider: a,
27
+ type: s,
28
+ onClick: () => d(!0)
29
+ },
30
+ "ellipsis"
31
+ );
32
+ return [...f, b, ...u];
33
+ })();
34
+ return /* @__PURE__ */ t("nav", { "aria-label": "Breadcrumbs", className: n("min-w-0", i), children: /* @__PURE__ */ t(B.Provider, { value: { divider: a, type: s }, children: /* @__PURE__ */ t(x, { className: n("relative flex", v[s]), children: p }) }) });
35
+ };
36
+ C.Item = l;
37
+ export {
38
+ C as Breadcrumbs
39
+ };
@@ -0,0 +1,6 @@
1
+ export type BreadcrumbType = "text" | "text-line" | "button";
2
+ export declare const BreadcrumbsContext: import('react').Context<{
3
+ divider: "chevron" | "slash";
4
+ type: BreadcrumbType;
5
+ }>;
6
+ //# sourceMappingURL=context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../src/patterns/breadcrumbs/context.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,WAAW,GAAG,QAAQ,CAAC;AAE7D,eAAO,MAAM,kBAAkB;aACpB,SAAS,GAAG,OAAO;UACtB,cAAc;EAIpB,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { createContext as t } from "react";
2
+ const r = t({
3
+ divider: "slash",
4
+ type: "text"
5
+ });
6
+ export {
7
+ r as BreadcrumbsContext
8
+ };
@@ -0,0 +1,4 @@
1
+ export { Breadcrumbs, type BreadcrumbsProps } from './breadcrumbs';
2
+ export type { BreadcrumbItemProps } from './breadcrumb-item';
3
+ export type { BreadcrumbType } from './context';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/patterns/breadcrumbs/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,KAAK,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACnE,YAAY,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAC7D,YAAY,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { PageHeader, type PageHeaderProps, type PageHeaderBreadcrumb, } from './page-header';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/patterns/page-header/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,KAAK,eAAe,EACpB,KAAK,oBAAoB,GAC1B,MAAM,eAAe,CAAC"}
@@ -0,0 +1,18 @@
1
+ import { ReactNode } from 'react';
2
+ export interface PageHeaderBreadcrumb {
3
+ label: ReactNode;
4
+ href?: string;
5
+ onClick?: () => void;
6
+ }
7
+ export interface PageHeaderProps {
8
+ /** The trail, root first. One crumb renders as the page title, in a taller header. */
9
+ breadcrumbs?: PageHeaderBreadcrumb[];
10
+ /** Shows a two-segment shimmer in place of the crumbs. */
11
+ breadcrumbsLoading?: boolean;
12
+ /** Right-hand side, e.g. a notifications button and the account menu. */
13
+ actions?: ReactNode;
14
+ className?: string;
15
+ children?: ReactNode;
16
+ }
17
+ export declare function PageHeader({ breadcrumbs, breadcrumbsLoading, actions, className, children, }: PageHeaderProps): import("react/jsx-runtime").JSX.Element;
18
+ //# sourceMappingURL=page-header.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"page-header.d.ts","sourceRoot":"","sources":["../../../src/patterns/page-header/page-header.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAYvC,MAAM,WAAW,oBAAoB;IACnC,KAAK,EAAE,SAAS,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,MAAM,WAAW,eAAe;IAC9B,sFAAsF;IACtF,WAAW,CAAC,EAAE,oBAAoB,EAAE,CAAC;IACrC,0DAA0D;IAC1D,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,yEAAyE;IACzE,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED,wBAAgB,UAAU,CAAC,EACzB,WAAgB,EAChB,kBAAkB,EAClB,OAAO,EACP,SAAS,EACT,QAAQ,GACT,EAAE,eAAe,2CAmDjB"}
@@ -0,0 +1,52 @@
1
+ import { jsxs as a, jsx as e } from "react/jsx-runtime";
2
+ import { cx as s } from "../../utils/cn.js";
3
+ import { ShimmerLine as n } from "../../primitives/shimmer/shimmer.js";
4
+ import { Breadcrumbs as m } from "../breadcrumbs/breadcrumbs.js";
5
+ function w({
6
+ breadcrumbs: t = [],
7
+ breadcrumbsLoading: c,
8
+ actions: h,
9
+ className: x,
10
+ children: d
11
+ }) {
12
+ const i = t.length === 1;
13
+ return /* @__PURE__ */ a(
14
+ "header",
15
+ {
16
+ className: s(
17
+ "flex items-center justify-between mx-6 relative z-50",
18
+ i ? "mt-6 py-2" : "py-1.5",
19
+ x
20
+ ),
21
+ children: [
22
+ /* @__PURE__ */ e("div", { className: "flex-1 min-w-0", children: c ? /* @__PURE__ */ a("div", { className: "flex items-center gap-1.5", "aria-hidden": !0, children: [
23
+ /* @__PURE__ */ e(n, { width: "56px", height: "14px", className: "rounded" }),
24
+ /* @__PURE__ */ e("span", { className: "text-tertiary text-xs", children: "/" }),
25
+ /* @__PURE__ */ e(n, { width: "120px", height: "14px", className: "rounded" })
26
+ ] }) : t.length > 0 ? /* @__PURE__ */ e(m, { children: t.map((l, r) => /* @__PURE__ */ e(
27
+ m.Item,
28
+ {
29
+ href: l.href,
30
+ onClick: l.onClick,
31
+ children: /* @__PURE__ */ e(
32
+ "span",
33
+ {
34
+ className: s(
35
+ "whitespace-nowrap overflow-hidden text-ellipsis w-full block",
36
+ r === t.length - 1 ? i ? "text-lg font-semibold text-primary" : "text-xs" : "text-tertiary text-xs"
37
+ ),
38
+ children: l.label
39
+ }
40
+ )
41
+ },
42
+ r
43
+ )) }) : null }),
44
+ /* @__PURE__ */ e("div", { className: "flex items-center gap-3.5 ml-4", children: h }),
45
+ d
46
+ ]
47
+ }
48
+ );
49
+ }
50
+ export {
51
+ w as PageHeader
52
+ };
@@ -0,0 +1,3 @@
1
+ export { SubSidebar, type SubSidebarProps } from './sub-sidebar';
2
+ export type { SubSidebarConfig, SubSidebarSection, SubSidebarItem, SubSidebarChildItem, SubSidebarLinkProps, SubSidebarGuard, } from './types';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/patterns/sub-sidebar/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,KAAK,eAAe,EAAE,MAAM,eAAe,CAAC;AACjE,YAAY,EACV,gBAAgB,EAChB,iBAAiB,EACjB,cAAc,EACd,mBAAmB,EACnB,mBAAmB,EACnB,eAAe,GAChB,MAAM,SAAS,CAAC"}
@@ -0,0 +1,20 @@
1
+ import { ReactNode } from 'react';
2
+ import { SubSidebarConfig, SubSidebarGuard, SubSidebarLinkProps } from './types';
3
+ export interface SubSidebarProps {
4
+ /**
5
+ * Keep it stable (memoize it): a group holding the active link re-opens whenever `config.sections` changes
6
+ * identity, so an inline config re-opens it on every parent render.
7
+ */
8
+ config: SubSidebarConfig;
9
+ /** The current location's path, e.g. `useLocation().pathname`. */
10
+ currentPath: string;
11
+ isCollapsed: boolean;
12
+ onCollapsedChange: (collapsed: boolean) => void;
13
+ /** Renders each link. Default: a plain `<a href>`. */
14
+ renderLink?: (props: SubSidebarLinkProps) => ReactNode;
15
+ /** Permission check for sections, items and child links. Default: everything renders. */
16
+ guard?: SubSidebarGuard;
17
+ className?: string;
18
+ }
19
+ export declare const SubSidebar: ({ config, currentPath, isCollapsed, onCollapsedChange, renderLink, guard, className, }: SubSidebarProps) => import("react/jsx-runtime").JSX.Element;
20
+ //# sourceMappingURL=sub-sidebar.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sub-sidebar.d.ts","sourceRoot":"","sources":["../../../src/patterns/sub-sidebar/sub-sidebar.tsx"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAQf,OAAO,KAAK,EACV,gBAAgB,EAChB,eAAe,EAEf,mBAAmB,EACpB,MAAM,SAAS,CAAC;AAajB,MAAM,WAAW,eAAe;IAC9B;;;OAGG;IACH,MAAM,EAAE,gBAAgB,CAAC;IACzB,kEAAkE;IAClE,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,OAAO,CAAC;IACrB,iBAAiB,EAAE,CAAC,SAAS,EAAE,OAAO,KAAK,IAAI,CAAC;IAChD,sDAAsD;IACtD,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,mBAAmB,KAAK,SAAS,CAAC;IACvD,yFAAyF;IACzF,KAAK,CAAC,EAAE,eAAe,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAcD,eAAO,MAAM,UAAU,GAAI,wFAQxB,eAAe,4CAmZjB,CAAC"}
@@ -0,0 +1,285 @@
1
+ import { jsxs as o, jsx as r, Fragment as S } from "react/jsx-runtime";
2
+ import { useState as A, useEffect as z, Fragment as u } from "react";
3
+ import { Minus as F, Plus as I } from "@untitledui/icons";
4
+ import { CollapseLeft as D } from "../../primitives/custom-icon/icons/collapse-left.js";
5
+ import { CollapseRight as H } from "../../primitives/custom-icon/icons/collapse-right.js";
6
+ import { cx as n } from "../../utils/cn.js";
7
+ import { ButtonUtility as K } from "../../primitives/button/button-utility.js";
8
+ const T = ({
9
+ href: i,
10
+ className: c,
11
+ children: d
12
+ }) => /* @__PURE__ */ r("a", { href: i, className: c, children: d }), $ = (i, c) => c, U = ({
13
+ config: i,
14
+ currentPath: c,
15
+ isCollapsed: d,
16
+ onCollapsedChange: k,
17
+ renderLink: x = T,
18
+ guard: h = $,
19
+ className: C
20
+ }) => {
21
+ const [E, b] = A(/* @__PURE__ */ new Set()), y = (a) => c === a || c.startsWith(a + "/"), m = (a) => a.map((t) => t.href).filter((t) => !!t).filter(y).sort((t, l) => l.length - t.length)[0] ?? null, w = () => {
22
+ var e;
23
+ const a = !d;
24
+ k(a), (e = i.onToggleCollapse) == null || e.call(i, a);
25
+ };
26
+ z(() => {
27
+ const a = /* @__PURE__ */ new Set();
28
+ i.sections.forEach((e) => {
29
+ e.items.forEach((t) => {
30
+ var l;
31
+ if ((l = t.items) != null && l.length && m(t.items) !== null) {
32
+ const p = t.href || t.label;
33
+ a.add(p);
34
+ }
35
+ });
36
+ }), b((e) => {
37
+ const t = new Set(e);
38
+ return a.forEach((l) => t.add(l)), t;
39
+ });
40
+ }, [c, i.sections]);
41
+ const f = (a) => {
42
+ const e = a.href || a.label;
43
+ b((t) => {
44
+ const l = new Set(t);
45
+ return l.has(e) ? l.delete(e) : l.add(e), l;
46
+ });
47
+ }, v = (a) => {
48
+ var e;
49
+ return (e = a.items) != null && e.length && m(a.items) !== null ? !0 : a.href ? y(a.href) : !1;
50
+ }, j = (a, e) => m(e) === a;
51
+ return /* @__PURE__ */ o(
52
+ "div",
53
+ {
54
+ className: n(
55
+ "h-full flex-shrink-0 bg-white border-r border-[#EDEFF4] relative transition-all duration-300 ease-in-out",
56
+ d ? "w-0 border-r-0" : i.width || "w-[296px]",
57
+ C
58
+ ),
59
+ children: [
60
+ i.collapsible !== !1 && d && /* @__PURE__ */ r(
61
+ "button",
62
+ {
63
+ onClick: w,
64
+ className: "absolute -right-5 top-5 z-20 flex h-6 w-6 items-center justify-center transition-all duration-300 cursor-pointer",
65
+ "aria-label": "Expand sidebar",
66
+ children: /* @__PURE__ */ r(
67
+ H,
68
+ {
69
+ color: "var(--color-fg-quaternary)",
70
+ className: "h-4 w-4 text-gray-400 hover:text-gray-600"
71
+ }
72
+ )
73
+ }
74
+ ),
75
+ /* @__PURE__ */ o(
76
+ "div",
77
+ {
78
+ className: n(
79
+ "pl-4 h-full flex flex-col overflow-hidden transition-opacity duration-300",
80
+ d ? "opacity-0 pointer-events-none" : "opacity-100"
81
+ ),
82
+ inert: d,
83
+ children: [
84
+ i.title && /* @__PURE__ */ o("div", { className: "pt-6 pb-4 relative flex-shrink-0 flex items-center justify-between", children: [
85
+ /* @__PURE__ */ r("h2", { className: "pl-1.5 text-primary font-semibold text-md leading-7 whitespace-nowrap", children: i.title }),
86
+ i.collapsible !== !1 && /* @__PURE__ */ r(
87
+ "button",
88
+ {
89
+ onClick: w,
90
+ className: "flex h-5 w-5 items-center justify-center transition-all duration-300 hover:scale-110 cursor-pointer",
91
+ "aria-label": "Collapse sidebar",
92
+ children: /* @__PURE__ */ r(
93
+ D,
94
+ {
95
+ color: "var(--color-fg-quaternary)",
96
+ className: "h-4 w-4 text-gray-400 hover:text-gray-600"
97
+ }
98
+ )
99
+ }
100
+ )
101
+ ] }),
102
+ /* @__PURE__ */ r("nav", { className: "flex-1 pb-4 pr-2 overflow-y-auto overflow-x-hidden", children: i.sections.map((a) => /* @__PURE__ */ r(u, { children: h(
103
+ (a == null ? void 0 : a.permissions) || [],
104
+ /* @__PURE__ */ o("div", { className: n("mb-6"), children: [
105
+ /* @__PURE__ */ r("div", { className: "py-0.5 px-2", children: /* @__PURE__ */ r("p", { className: "font-medium text-[10px] text-[var(--color-text-tertiary)] uppercase tracking-[1.3px] whitespace-nowrap", children: a.label }) }),
106
+ /* @__PURE__ */ r("ul", { className: "space-y-1", children: a.items.map((e) => {
107
+ const t = e.href || e.label, l = E.has(t), N = e.items && e.items.length > 0, p = v(e);
108
+ return N ? /* @__PURE__ */ r(u, { children: h(
109
+ e.permissions || [],
110
+ /* @__PURE__ */ o(
111
+ "li",
112
+ {
113
+ className: n(
114
+ e.disabled && "opacity-30 cursor-not-allowed",
115
+ "text-xs"
116
+ ),
117
+ children: [
118
+ /* @__PURE__ */ o(
119
+ "div",
120
+ {
121
+ className: n(
122
+ "flex items-center justify-between px-1 py-2 rounded-md transition-colors cursor-pointer",
123
+ p ? "bg-active text-primary font-medium" : "text-primary hover:bg-active",
124
+ e.disabled ? "cursor-not-allowed" : ""
125
+ ),
126
+ role: "button",
127
+ tabIndex: e.disabled ? -1 : 0,
128
+ "aria-expanded": l,
129
+ "aria-disabled": e.disabled || void 0,
130
+ onClick: (s) => {
131
+ s.stopPropagation(), !e.disabled && f(e);
132
+ },
133
+ onKeyDown: (s) => {
134
+ if (s.target === s.currentTarget && (s.key === "Enter" || s.key === " ")) {
135
+ if (s.stopPropagation(), e.disabled) return;
136
+ f(e);
137
+ }
138
+ },
139
+ children: [
140
+ /* @__PURE__ */ r("span", { className: "whitespace-nowrap text-primary font-medium", children: e.label }),
141
+ /* @__PURE__ */ r(
142
+ K,
143
+ {
144
+ onClick: (s) => {
145
+ s.stopPropagation(), !e.disabled && f(e);
146
+ },
147
+ className: n(
148
+ "rounded-md bg-secondary",
149
+ e.disabled ? "cursor-not-allowed" : ""
150
+ ),
151
+ size: "xs",
152
+ "aria-label": `${l ? "Collapse" : "Expand"} ${e.label}`,
153
+ icon: l ? /* @__PURE__ */ r(F, { size: 12 }) : /* @__PURE__ */ r(I, { size: 12 })
154
+ }
155
+ )
156
+ ]
157
+ }
158
+ ),
159
+ l && h(
160
+ e.permissions || [],
161
+ /* @__PURE__ */ o("ul", { className: "mt-0.5 ml-4 space-y-0.5 relative", children: [
162
+ /* @__PURE__ */ r("div", { className: "absolute left-2 top-[15px] bottom-[15px] w-px bg-[var(--color-utility-gray-200)]" }),
163
+ e.items.map((s) => {
164
+ const g = j(
165
+ s.href,
166
+ e.items
167
+ );
168
+ return /* @__PURE__ */ r(u, { children: h(
169
+ s.permissions || [],
170
+ /* @__PURE__ */ r("li", { className: "relative", children: x({
171
+ href: s.href,
172
+ className: n(
173
+ "flex items-center pl-6 pr-2 py-2 rounded-md transition-colors relative",
174
+ g ? "text-primary font-medium" : "text-primary hover:bg-active"
175
+ ),
176
+ children: /* @__PURE__ */ o(S, { children: [
177
+ /* @__PURE__ */ r(
178
+ "div",
179
+ {
180
+ className: n(
181
+ "absolute left-1.5 top-1/2 -translate-y-1/2 w-1.5 h-1.5 rounded-full z-10",
182
+ g ? "bg-[var(--color-fg-primary)]" : "bg-[var(--color-utility-gray-200)]"
183
+ )
184
+ }
185
+ ),
186
+ /* @__PURE__ */ r("span", { className: "whitespace-nowrap", children: s.label })
187
+ ] })
188
+ }) }),
189
+ null
190
+ ) }, s.href);
191
+ })
192
+ ] }),
193
+ null
194
+ )
195
+ ]
196
+ }
197
+ ),
198
+ null
199
+ ) }, t) : /* @__PURE__ */ r(u, { children: h(
200
+ e.permissions || [],
201
+ /* @__PURE__ */ r(
202
+ "li",
203
+ {
204
+ className: n(
205
+ e.disabled && "opacity-30 cursor-not-allowed",
206
+ "text-xs"
207
+ ),
208
+ children: e.href ? e.disabled ? /* @__PURE__ */ r(
209
+ "span",
210
+ {
211
+ className: n(
212
+ "flex items-center justify-between px-2 py-2 rounded-md transition-colors cursor-not-allowed",
213
+ p ? "bg-active text-primary" : "text-primary"
214
+ ),
215
+ "aria-disabled": "true",
216
+ children: /* @__PURE__ */ r("span", { className: "whitespace-nowrap font-medium", children: e.label })
217
+ }
218
+ ) : x({
219
+ href: e.href,
220
+ className: n(
221
+ "flex items-center justify-between px-2 py-2 rounded-md transition-colors",
222
+ p ? "bg-active text-primary" : "text-primary hover:bg-active",
223
+ e.disabled ? "opacity-30 cursor-not-allowed" : ""
224
+ ),
225
+ children: /* @__PURE__ */ r("span", { className: "whitespace-nowrap font-medium", children: e.label })
226
+ }) : /* @__PURE__ */ r(
227
+ "div",
228
+ {
229
+ onClick: () => {
230
+ var s;
231
+ return !e.disabled && ((s = e.onClick) == null ? void 0 : s.call(e));
232
+ },
233
+ className: n(
234
+ "w-full flex items-center justify-between px-2 py-2 rounded-md text-sm transition-colors cursor-pointer",
235
+ p ? "bg-active text-primary font-medium" : "text-primary hover:bg-active",
236
+ e.disabled ? "opacity-30 cursor-not-allowed" : ""
237
+ ),
238
+ children: /* @__PURE__ */ r("span", { className: "whitespace-nowrap", children: e.label })
239
+ }
240
+ )
241
+ }
242
+ ),
243
+ e.showDisabled ? /* @__PURE__ */ r(
244
+ "span",
245
+ {
246
+ className: n(
247
+ "flex items-center justify-between opacity-30 px-2 py-2 rounded-md transition-colors cursor-not-allowed text-xs whitespace-nowrap font-medium",
248
+ p ? "bg-active text-primary" : "text-primary"
249
+ ),
250
+ "aria-disabled": "true",
251
+ children: e.label
252
+ }
253
+ ) : null
254
+ ) }, t);
255
+ }) })
256
+ ] }),
257
+ a.showDisabled ? /* @__PURE__ */ o("div", { className: n("mb-6"), children: [
258
+ /* @__PURE__ */ r("div", { className: "py-0.5 px-2", children: /* @__PURE__ */ r("p", { className: "font-medium text-[10px] text-[var(--color-text-tertiary)] uppercase tracking-[1.3px] whitespace-nowrap", children: a.label }) }),
259
+ /* @__PURE__ */ r("ul", { className: "", children: a.items.map((e) => {
260
+ const t = e.href || e.label, l = v(e);
261
+ return /* @__PURE__ */ r(
262
+ "span",
263
+ {
264
+ className: n(
265
+ "flex items-center justify-between opacity-30 px-2 py-2 rounded-md transition-colors cursor-not-allowed text-xs whitespace-nowrap font-medium",
266
+ l ? "bg-active text-primary" : "text-primary"
267
+ ),
268
+ "aria-disabled": "true",
269
+ children: e.label
270
+ },
271
+ t
272
+ );
273
+ }) })
274
+ ] }) : null
275
+ ) }, a.id)) })
276
+ ]
277
+ }
278
+ )
279
+ ]
280
+ }
281
+ );
282
+ };
283
+ export {
284
+ U as SubSidebar
285
+ };