laif-ds 0.1.20 → 0.1.21

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.
@@ -1,3 +1,8 @@
1
1
  "use client";
2
- import { __require as e } from "../node_modules/react-is/index.js";
3
- e();
2
+ import { getDefaultExportFromCjs as r } from "./_commonjsHelpers.js";
3
+ import { __require as e } from "../node_modules/style-to-js/cjs/index.js";
4
+ var t = e();
5
+ const a = /* @__PURE__ */ r(t);
6
+ export {
7
+ a as default
8
+ };
@@ -1,5 +1,8 @@
1
1
  "use client";
2
- var e = { exports: {} };
2
+ import { getDefaultExportFromCjs as e } from "./_commonjsHelpers.js";
3
+ import { __require as r } from "../node_modules/extend/index.js";
4
+ var t = r();
5
+ const x = /* @__PURE__ */ e(t);
3
6
  export {
4
- e as __module
7
+ x as default
5
8
  };
@@ -1,8 +1,3 @@
1
1
  "use client";
2
- import { getDefaultExportFromCjs as r } from "./_commonjsHelpers.js";
3
- import { __require as e } from "../node_modules/style-to-js/cjs/index.js";
4
- var t = e();
5
- const a = /* @__PURE__ */ r(t);
6
- export {
7
- a as default
8
- };
2
+ import { __require as e } from "../node_modules/react-is/index.js";
3
+ e();
@@ -1,8 +1,5 @@
1
1
  "use client";
2
- import { getDefaultExportFromCjs as e } from "./_commonjsHelpers.js";
3
- import { __require as r } from "../node_modules/extend/index.js";
4
- var t = r();
5
- const x = /* @__PURE__ */ e(t);
2
+ var e = { exports: {} };
6
3
  export {
7
- x as default
4
+ e as __module
8
5
  };
@@ -1,8 +1,5 @@
1
1
  "use client";
2
- import { getDefaultExportFromCjs as r } from "./_commonjsHelpers.js";
3
- import { __require as e } from "../node_modules/classnames/index.js";
4
- var s = e();
5
- const o = /* @__PURE__ */ r(s);
2
+ var e = {};
6
3
  export {
7
- o as default
4
+ e as __exports
8
5
  };
@@ -1,5 +1,8 @@
1
1
  "use client";
2
- var e = {};
2
+ import { getDefaultExportFromCjs as r } from "./_commonjsHelpers.js";
3
+ import { __require as e } from "../node_modules/classnames/index.js";
4
+ var s = e();
5
+ const o = /* @__PURE__ */ r(s);
3
6
  export {
4
- e as __exports
7
+ o as default
5
8
  };
@@ -1,70 +1,105 @@
1
1
  "use client";
2
- import { jsxs as r, jsx as e } from "react/jsx-runtime";
3
- import * as f from "react";
4
- import { Sidebar as x, SidebarHeader as v, SidebarContent as N, SidebarGroup as C, SidebarGroupLabel as M, SidebarGroupContent as A, SidebarMenu as I, SidebarMenuItem as g, SidebarMenuButton as w, SidebarMenuSub as j, SidebarMenuSubItem as G, SidebarMenuSubButton as R, SidebarRail as k } from "./sidebar.js";
5
- import { Icon as t } from "./icon.js";
6
- function H({
7
- navigation: o,
8
- versions: z,
2
+ import { jsxs as s, jsx as e } from "react/jsx-runtime";
3
+ import * as N from "react";
4
+ import { Sidebar as x, SidebarHeader as w, SidebarContent as A, SidebarGroup as C, SidebarGroupLabel as g, SidebarGroupContent as I, SidebarMenu as M, SidebarMenuItem as E, SidebarMenuButton as j, SidebarMenuSub as z, SidebarMenuSubItem as R, SidebarMenuSubButton as D, SidebarRail as G } from "./sidebar.js";
5
+ import { Icon as r } from "./icon.js";
6
+ function q({
7
+ navigation: h,
8
+ versions: y,
9
9
  defaultVersion: B,
10
- headerContent: s,
11
- footerContent: h,
12
- showRail: u = !0,
13
- ...m
10
+ headerContent: o,
11
+ footerContent: S,
12
+ showRail: b = !0,
13
+ linkComponent: l,
14
+ linkProps: m = {},
15
+ ...v
14
16
  }) {
15
- const [p, S] = f.useState({});
16
- return /* @__PURE__ */ r(x, { ...m, children: [
17
- s && /* @__PURE__ */ e(v, { children: s }),
18
- /* @__PURE__ */ e(N, { children: o.map((l) => /* @__PURE__ */ r(C, { children: [
19
- /* @__PURE__ */ e(M, { children: l.title }),
20
- /* @__PURE__ */ e(A, { children: /* @__PURE__ */ e(I, { children: l.items.map((i) => {
21
- const a = i.subItems && i.subItems.length > 0, d = p[i.title] || !1, b = (n) => {
22
- a && (n.preventDefault(), S((c) => ({
23
- ...c,
24
- [i.title]: !c[i.title]
17
+ const [u, f] = N.useState({});
18
+ return N.useEffect(() => {
19
+ const c = { ...u };
20
+ h.forEach((i) => {
21
+ i.items.some(
22
+ (t) => t.isActive || t.subItems && t.subItems.some((d) => d.isActive)
23
+ ) && (c[i.title] = !0);
24
+ }), f(c);
25
+ }, [h]), /* @__PURE__ */ s(x, { ...v, children: [
26
+ o && /* @__PURE__ */ e(w, { children: o }),
27
+ /* @__PURE__ */ e(A, { children: h.map((c) => /* @__PURE__ */ s(C, { children: [
28
+ /* @__PURE__ */ e(g, { children: c.title }),
29
+ /* @__PURE__ */ e(I, { children: /* @__PURE__ */ e(M, { children: c.items.map((i) => {
30
+ const n = i.subItems && i.subItems.length > 0, t = u[i.title] || !1, d = (a) => {
31
+ n && (a.preventDefault(), f((p) => ({
32
+ ...p,
33
+ [i.title]: !p[i.title]
25
34
  })));
26
35
  };
27
- return /* @__PURE__ */ r(g, { children: [
36
+ return /* @__PURE__ */ s(E, { children: [
28
37
  /* @__PURE__ */ e(
29
- w,
38
+ j,
30
39
  {
31
40
  asChild: !0,
32
41
  isActive: i.isActive,
33
- children: /* @__PURE__ */ r(
42
+ children: l ? /* @__PURE__ */ s(
43
+ l,
44
+ {
45
+ href: n ? "#" : i.url,
46
+ className: "flex items-center justify-between gap-2",
47
+ onClick: n ? d : void 0,
48
+ ...m,
49
+ children: [
50
+ /* @__PURE__ */ s("div", { className: "flex items-center gap-2", children: [
51
+ i.iconName && /* @__PURE__ */ e(r, { name: i.iconName, size: "sm" }),
52
+ /* @__PURE__ */ e("span", { children: i.title })
53
+ ] }),
54
+ n && /* @__PURE__ */ e("div", { className: "text-muted-foreground", children: t ? /* @__PURE__ */ e(r, { name: "ChevronDown", className: "h-4 w-4" }) : /* @__PURE__ */ e(r, { name: "ChevronRight", className: "h-4 w-4" }) })
55
+ ]
56
+ }
57
+ ) : /* @__PURE__ */ s(
34
58
  "a",
35
59
  {
36
- href: a ? "#" : i.url,
60
+ href: n ? "#" : i.url,
37
61
  className: "flex items-center justify-between gap-2",
38
- onClick: a ? b : void 0,
62
+ onClick: n ? d : void 0,
39
63
  children: [
40
- /* @__PURE__ */ r("div", { className: "flex items-center gap-2", children: [
41
- i.iconName && /* @__PURE__ */ e(t, { name: i.iconName, size: "sm" }),
64
+ /* @__PURE__ */ s("div", { className: "flex items-center gap-2", children: [
65
+ i.iconName && /* @__PURE__ */ e(r, { name: i.iconName, size: "sm" }),
42
66
  /* @__PURE__ */ e("span", { children: i.title })
43
67
  ] }),
44
- a && /* @__PURE__ */ e("div", { className: "text-muted-foreground", children: d ? /* @__PURE__ */ e(t, { name: "ChevronDown", className: "h-4 w-4" }) : /* @__PURE__ */ e(t, { name: "ChevronRight", className: "h-4 w-4" }) })
68
+ n && /* @__PURE__ */ e("div", { className: "text-muted-foreground", children: t ? /* @__PURE__ */ e(r, { name: "ChevronDown", className: "h-4 w-4" }) : /* @__PURE__ */ e(r, { name: "ChevronRight", className: "h-4 w-4" }) })
45
69
  ]
46
70
  }
47
71
  )
48
72
  }
49
73
  ),
50
- a && d && /* @__PURE__ */ e(j, { children: i.subItems.map((n) => /* @__PURE__ */ e(G, { children: /* @__PURE__ */ e(
51
- R,
74
+ n && t && /* @__PURE__ */ e(z, { children: i.subItems.map((a) => /* @__PURE__ */ e(R, { children: /* @__PURE__ */ e(
75
+ D,
52
76
  {
53
77
  asChild: !0,
54
- isActive: n.isActive,
55
- children: /* @__PURE__ */ r("a", { href: n.url, className: "flex items-center gap-2", children: [
56
- n.iconName && /* @__PURE__ */ e(t, { name: n.iconName, size: "xs" }),
57
- /* @__PURE__ */ e("span", { children: n.title })
78
+ isActive: a.isActive,
79
+ children: l ? /* @__PURE__ */ s(
80
+ l,
81
+ {
82
+ href: a.url,
83
+ className: "flex items-center gap-2",
84
+ ...m,
85
+ children: [
86
+ a.iconName && /* @__PURE__ */ e(r, { name: a.iconName, size: "xs" }),
87
+ /* @__PURE__ */ e("span", { children: a.title })
88
+ ]
89
+ }
90
+ ) : /* @__PURE__ */ s("a", { href: a.url, className: "flex items-center gap-2", children: [
91
+ a.iconName && /* @__PURE__ */ e(r, { name: a.iconName, size: "xs" }),
92
+ /* @__PURE__ */ e("span", { children: a.title })
58
93
  ] })
59
94
  }
60
- ) }, n.title)) })
95
+ ) }, a.title)) })
61
96
  ] }, i.title);
62
97
  }) }) })
63
- ] }, l.title)) }),
64
- h,
65
- u && /* @__PURE__ */ e(k, {})
98
+ ] }, c.title)) }),
99
+ S,
100
+ b && /* @__PURE__ */ e(G, {})
66
101
  ] });
67
102
  }
68
103
  export {
69
- H as AppSidebar
104
+ q as AppSidebar
70
105
  };
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import { jsx as o, jsxs as M, Fragment as N } from "react/jsx-runtime";
3
3
  import { useContext as R, useRef as a, useState as s, useCallback as k, useMemo as y, useEffect as u } from "react";
4
- import A from "../../../../../_virtual/index5.js";
4
+ import A from "../../../../../_virtual/index6.js";
5
5
  import B from "../../../../../_virtual/debounce.js";
6
6
  import { GanttContext as F } from "../Gantt/GanttContext.js";
7
7
  import { transformData as O } from "../../utils/transformData.js";
@@ -499,7 +499,7 @@ const ve = d.forwardRef(({ asChild: a = !1, size: e = "md", isActive: t, classNa
499
499
  "data-active": t,
500
500
  className: i(
501
501
  "flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 text-d-sidebar-foreground outline-none ring-d-sidebar-ring hover:bg-d-sidebar-accent hover:text-d-sidebar-accent-foreground focus-visible:ring-2 active:bg-d-sidebar-accent active:text-d-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0 [&>svg]:text-d-sidebar-accent-foreground",
502
- "data-[active=true]:bg-d-sidebar-accent data-[active=true]:text-d-sidebar-accent-foreground",
502
+ "data-[active=true]:bg-d-sidebar-accent data-[active=true]:text-d-sidebar-accent-foreground data-[active=true]:font-bold",
503
503
  e === "sm" && "text-xs",
504
504
  e === "md" && "text-sm",
505
505
  "group-data-[collapsible=icon]:hidden",
package/dist/index.d.ts CHANGED
@@ -123,7 +123,7 @@ declare const alertVariants: (props?: ({
123
123
 
124
124
  declare type Animation_2 = VariantProps<typeof chatBubbleVariants>["animation"];
125
125
 
126
- export declare function AppSidebar({ navigation, versions, defaultVersion, headerContent, footerContent, showRail, ...props }: AppSidebarProps): JSX.Element;
126
+ export declare function AppSidebar({ navigation, versions, defaultVersion, headerContent, footerContent, showRail, linkComponent: LinkComponent, linkProps, ...props }: AppSidebarProps): JSX.Element;
127
127
 
128
128
  declare interface AppSidebarProps extends React_2.ComponentProps<typeof Sidebar> {
129
129
  navigation: NavGroup[];
@@ -132,6 +132,16 @@ declare interface AppSidebarProps extends React_2.ComponentProps<typeof Sidebar>
132
132
  headerContent?: React_2.ReactNode;
133
133
  footerContent?: React_2.ReactNode;
134
134
  showRail?: boolean;
135
+ /**
136
+ * Componente Link personalizzato da utilizzare al posto del tag <a>
137
+ * Può essere il componente Link di Next.js o qualsiasi altro router
138
+ */
139
+ linkComponent?: React_2.ComponentType<any>;
140
+ /**
141
+ * Proprietà aggiuntive da passare al componente Link
142
+ * Ad esempio, per Next.js potrebbe essere { legacyBehavior: true }
143
+ */
144
+ linkProps?: Record<string, any>;
135
145
  }
136
146
 
137
147
  export declare function AspectRatio({ ...props }: AspectRatioProps): JSX.Element;
@@ -3,7 +3,7 @@ import { stringify as w } from "../../comma-separated-tokens/index.js";
3
3
  import { ok as u } from "../../devlop/lib/default.js";
4
4
  import { svg as m, html as C } from "../../property-information/index.js";
5
5
  import { stringify as N } from "../../space-separated-tokens/index.js";
6
- import S from "../../../_virtual/index3.js";
6
+ import S from "../../../_virtual/index.js";
7
7
  import { whitespace as j } from "../../hast-util-whitespace/lib/index.js";
8
8
  import { name as x } from "../../estree-util-is-identifier-name/lib/index.js";
9
9
  import { VFileMessage as h } from "../../vfile-message/lib/index.js";
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import { __module as e } from "../../_virtual/index2.js";
2
+ import { __module as e } from "../../_virtual/index4.js";
3
3
  import { __require as t } from "./cjs/react-is.production.min.js";
4
4
  import { __require as o } from "./cjs/react-is.development.js";
5
5
  var r;
@@ -5,7 +5,7 @@ import "../../../../_virtual/isString.js";
5
5
  import f from "../../../../_virtual/isFunction.js";
6
6
  import s from "../../../../_virtual/isObject.js";
7
7
  import { isValidElement as d } from "react";
8
- import "../../../../_virtual/index.js";
8
+ import "../../../../_virtual/index3.js";
9
9
  import { SVGElementPropKeys as m, EventKeys as p, FilteredElementKeyMap as o } from "./types.js";
10
10
  var h = function(i) {
11
11
  return typeof i == "string" ? i : i ? i.displayName || i.name || "Component" : "";
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import { __exports as r } from "../../../_virtual/index6.js";
2
+ import { __exports as r } from "../../../_virtual/index5.js";
3
3
  import { __require as c } from "../../inline-style-parser/index.js";
4
4
  var f;
5
5
  function j() {
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  import { bail as P } from "../../bail/index.js";
3
- import y from "../../../_virtual/index4.js";
3
+ import y from "../../../_virtual/index2.js";
4
4
  import z from "../../is-plain-obj/index.js";
5
5
  import { CallableInstance as C } from "./callable-instance.js";
6
6
  import { trough as A } from "../../trough/lib/index.js";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "laif-ds",
3
3
  "private": false,
4
- "version": "0.1.20",
4
+ "version": "0.1.21",
5
5
  "type": "module",
6
6
  "main": "dist/index.es.js",
7
7
  "module": "dist/index.es.js",