@kopexa/sidebar 17.2.0 → 17.2.1

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/dist/index.js CHANGED
@@ -531,12 +531,12 @@ var Sidebar = Object.assign(SidebarRoot, {
531
531
  });
532
532
 
533
533
  // src/v2/app-shell.tsx
534
- var import_shared_utils = require("@kopexa/shared-utils");
535
534
  var import_react3 = require("react");
536
535
  var import_react_dom = require("react-dom");
537
536
 
538
537
  // src/v2/context.tsx
539
538
  var import_react_utils2 = require("@kopexa/react-utils");
539
+ var import_theme2 = require("@kopexa/theme");
540
540
  var import_tooltip2 = require("@kopexa/tooltip");
541
541
  var import_use_is_mobile2 = require("@kopexa/use-is-mobile");
542
542
  var import_react2 = require("react");
@@ -576,6 +576,7 @@ function SidebarV2Provider({
576
576
  }, []);
577
577
  const panelOverrideActive = overrideCount > 0;
578
578
  const navPreviewActive = pinned ? selectedRail !== null : flyoutValue !== null;
579
+ const styles = (0, import_react2.useMemo)(() => (0, import_theme2.sidebarV2)({ tone }), [tone]);
579
580
  const setPinned = (0, import_react2.useCallback)(
580
581
  (value2) => {
581
582
  onPinnedChange == null ? void 0 : onPinnedChange(value2);
@@ -611,6 +612,7 @@ function SidebarV2Provider({
611
612
  const value = (0, import_react2.useMemo)(
612
613
  () => ({
613
614
  tone,
615
+ styles,
614
616
  pinned,
615
617
  togglePin,
616
618
  setPinned,
@@ -639,6 +641,7 @@ function SidebarV2Provider({
639
641
  }),
640
642
  [
641
643
  tone,
644
+ styles,
642
645
  pinned,
643
646
  togglePin,
644
647
  setPinned,
@@ -681,17 +684,13 @@ function AppShellRoot({
681
684
  children,
682
685
  ...props
683
686
  }) {
684
- const { tone } = useSidebarV2();
687
+ const { tone, styles } = useSidebarV2();
685
688
  return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
686
689
  "div",
687
690
  {
688
691
  "data-slot": "app-shell",
689
692
  "data-tone": tone,
690
- className: (0, import_shared_utils.cn)(
691
- "relative isolate grid h-svh w-full overflow-hidden antialiased",
692
- tone === "light" ? "bg-muted text-foreground" : "bg-sidebar text-sidebar-foreground",
693
- className
694
- ),
693
+ className: styles.shell({ className }),
695
694
  style: {
696
695
  "--kpx-rail-width": RAIL_WIDTH,
697
696
  "--kpx-panel-width": PANEL_WIDTH,
@@ -710,26 +709,24 @@ function AppShellHeader({
710
709
  style,
711
710
  ...props
712
711
  }) {
712
+ const { styles } = useSidebarV2();
713
713
  return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
714
714
  "header",
715
715
  {
716
716
  "data-slot": "app-shell-header",
717
- className: (0, import_shared_utils.cn)("z-20 flex h-14 items-center gap-3 px-2", className),
717
+ className: styles.header({ className }),
718
718
  style: { gridArea: "header", ...style },
719
719
  ...props
720
720
  }
721
721
  );
722
722
  }
723
723
  function AppShellMain({ className, style, ...props }) {
724
+ const { styles } = useSidebarV2();
724
725
  return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
725
726
  "main",
726
727
  {
727
728
  "data-slot": "app-shell-main",
728
- className: (0, import_shared_utils.cn)(
729
- "relative flex min-h-0 min-w-0 flex-col overflow-hidden bg-background",
730
- "m-2 rounded-xl shadow-sm",
731
- className
732
- ),
729
+ className: styles.main({ className }),
733
730
  style: { gridArea: "main", ...style },
734
731
  ...props
735
732
  }
@@ -740,11 +737,12 @@ function AppShellAside({
740
737
  style,
741
738
  ...props
742
739
  }) {
740
+ const { styles } = useSidebarV2();
743
741
  return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
744
742
  "aside",
745
743
  {
746
744
  "data-slot": "app-shell-aside",
747
- className: (0, import_shared_utils.cn)("min-h-0 min-w-0 overflow-hidden", className),
745
+ className: styles.aside({ className }),
748
746
  style: { gridArea: "aside", ...style },
749
747
  ...props
750
748
  }
@@ -765,8 +763,8 @@ AppShell.PanelContent = AppShellPanelContent;
765
763
  // src/v2/components.tsx
766
764
  var import_button2 = require("@kopexa/button");
767
765
  var import_icons2 = require("@kopexa/icons");
768
- var import_shared_utils2 = require("@kopexa/shared-utils");
769
- var import_theme2 = require("@kopexa/theme");
766
+ var import_shared_utils = require("@kopexa/shared-utils");
767
+ var import_theme3 = require("@kopexa/theme");
770
768
  var import_tooltip3 = require("@kopexa/tooltip");
771
769
  var import_react4 = require("react");
772
770
 
@@ -784,37 +782,23 @@ function SidebarV2Inset({
784
782
  className,
785
783
  ...props
786
784
  }) {
787
- const { tone } = useSidebarV2();
785
+ const { styles } = useSidebarV2();
788
786
  return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
789
787
  "main",
790
788
  {
791
789
  "data-slot": "sidebar-v2-inset",
792
- className: (0, import_shared_utils2.cn)(
793
- "relative flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden bg-background",
794
- "md:m-2 md:rounded-xl md:shadow-sm",
795
- // On a light surround the white card needs a hairline to define its
796
- // edge; on the dark surround a border would read as a seam.
797
- tone === "light" && "md:border md:border-border/70",
798
- className
799
- ),
790
+ className: styles.inset({ className }),
800
791
  ...props
801
792
  }
802
793
  );
803
794
  }
804
795
  function SidebarV2Rail({ className, ...props }) {
805
- const { tone } = useSidebarV2();
806
- const light = tone === "light";
796
+ const { styles } = useSidebarV2();
807
797
  return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
808
798
  "nav",
809
799
  {
810
800
  "data-slot": "sidebar-v2-rail",
811
- className: (0, import_shared_utils2.cn)(
812
- "flex w-(--kpx-rail-width) shrink-0 flex-col overflow-hidden bg-sidebar py-2 text-sidebar-foreground",
813
- // Light tone: the dark rail floats as a rounded card on the light
814
- // surround. Dark tone: full-height, flush to the edge.
815
- light ? "m-2 rounded-2xl shadow-sm" : "h-full",
816
- className
817
- ),
801
+ className: styles.rail({ className }),
818
802
  ...props
819
803
  }
820
804
  );
@@ -823,6 +807,7 @@ function SidebarV2RailSpacer() {
823
807
  return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { "aria-hidden": true, className: "flex-1" });
824
808
  }
825
809
  var SidebarV2Workspace = (0, import_react4.forwardRef)(({ name, role, logo, className, appearance = "rail", ...props }, ref) => {
810
+ const { styles } = useSidebarV2();
826
811
  if (appearance === "bar") {
827
812
  return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
828
813
  "button",
@@ -831,19 +816,15 @@ var SidebarV2Workspace = (0, import_react4.forwardRef)(({ name, role, logo, clas
831
816
  type: "button",
832
817
  "data-slot": "sidebar-v2-workspace",
833
818
  "aria-label": role ? `${name} \u2013 ${role}` : name,
834
- className: (0, import_shared_utils2.cn)(
835
- "group/ws flex cursor-pointer items-center gap-2 rounded-lg py-1 pr-2 pl-1",
836
- "outline-hidden ring-ring transition-colors hover:bg-foreground/5 focus-visible:ring-2",
837
- className
838
- ),
819
+ className: styles.workspaceBar({ className }),
839
820
  ...props,
840
821
  children: [
841
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "flex size-7 shrink-0 items-center justify-center rounded-md bg-primary text-xs font-semibold text-primary-foreground", children: logo != null ? logo : name.charAt(0).toUpperCase() }),
842
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { className: "flex min-w-0 flex-col text-left leading-tight", children: [
843
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "truncate text-sm font-semibold text-foreground", children: name }),
844
- role && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "truncate text-xs text-muted-foreground", children: role })
822
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: styles.workspaceBarLogo(), children: logo != null ? logo : name.charAt(0).toUpperCase() }),
823
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { className: styles.workspaceBarText(), children: [
824
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: styles.workspaceBarName(), children: name }),
825
+ role && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: styles.workspaceBarRole(), children: role })
845
826
  ] }),
846
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_icons2.ChevronDownIcon, { className: "size-4 shrink-0 text-muted-foreground" })
827
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_icons2.ChevronDownIcon, { className: styles.workspaceBarChevron() })
847
828
  ]
848
829
  }
849
830
  );
@@ -855,48 +836,25 @@ var SidebarV2Workspace = (0, import_react4.forwardRef)(({ name, role, logo, clas
855
836
  type: "button",
856
837
  "data-slot": "sidebar-v2-workspace",
857
838
  "aria-label": role ? `${name} \u2013 ${role}` : name,
858
- className: (0, import_shared_utils2.cn)(
859
- "group/ws relative mx-auto mt-1 flex cursor-pointer items-center justify-center rounded-lg p-1",
860
- "outline-hidden ring-sidebar-ring transition-colors",
861
- "hover:bg-sidebar-accent focus-visible:ring-2",
862
- className
863
- ),
839
+ className: styles.workspaceRail({ className }),
864
840
  ...props,
865
- children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { className: "relative flex size-9 shrink-0 items-center justify-center rounded-lg bg-primary text-sm font-semibold text-primary-foreground", children: [
841
+ children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { className: styles.workspaceRailLogo(), children: [
866
842
  logo != null ? logo : name.charAt(0).toUpperCase(),
867
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_icons2.ChevronDownIcon, { className: "absolute -right-1 -bottom-1 size-3.5 rounded-full bg-sidebar p-px text-sidebar-foreground/60" })
843
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_icons2.ChevronDownIcon, { className: styles.workspaceRailChevron() })
868
844
  ] })
869
845
  }
870
846
  );
871
847
  });
872
848
  SidebarV2Workspace.displayName = "SidebarV2Workspace";
873
- function railButtonClasses(active) {
874
- return (0, import_shared_utils2.cn)(
875
- "group/rail relative mx-auto flex size-11 shrink-0 cursor-pointer items-center justify-center rounded-xl",
876
- "outline-hidden ring-sidebar-ring transition-colors",
877
- "text-sidebar-foreground/85 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",
878
- "focus-visible:ring-2",
879
- active && "bg-sidebar-accent text-sidebar-accent-foreground"
880
- );
881
- }
882
849
  function RailInner({
883
850
  icon: Icon,
884
- active,
885
851
  badge
886
852
  }) {
853
+ const { styles } = useSidebarV2();
887
854
  return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
888
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
889
- "span",
890
- {
891
- "aria-hidden": true,
892
- className: (0, import_shared_utils2.cn)(
893
- "absolute top-1/2 left-0 h-5 w-0.5 -translate-x-[0.6rem] -translate-y-1/2 rounded-r bg-primary transition-opacity",
894
- active ? "opacity-100" : "opacity-0"
895
- )
896
- }
897
- ),
898
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Icon, { className: "size-5 shrink-0" }),
899
- badge != null && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "absolute -top-0.5 -right-0.5 flex h-4 min-w-4 items-center justify-center rounded-full bg-primary px-1 text-[0.5625rem] font-semibold text-primary-foreground", children: badge })
855
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { "aria-hidden": true, className: styles.railIndicator() }),
856
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Icon, { className: styles.railIcon() }),
857
+ badge != null && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: styles.railBadge(), children: badge })
900
858
  ] });
901
859
  }
902
860
  function SidebarV2RailLink({
@@ -905,18 +863,18 @@ function SidebarV2RailLink({
905
863
  href,
906
864
  badge
907
865
  }) {
908
- const { renderLink, isActive, resetPanelSelection } = useSidebarV2();
866
+ const { renderLink, isActive, resetPanelSelection, styles } = useSidebarV2();
909
867
  const active = isActive(href);
910
868
  return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_tooltip3.Tooltip, { content: label, side: "right", children: renderLink({
911
869
  href,
912
- className: railButtonClasses(active),
870
+ className: styles.railButton(),
913
871
  "data-active": active,
914
872
  "aria-current": active ? "page" : void 0,
915
873
  "aria-label": label,
916
874
  // Navigating to a destination link clears any open panel preview,
917
875
  // even when the route doesn't change (e.g. already on it).
918
876
  onClick: resetPanelSelection,
919
- children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(RailInner, { icon, label, active, badge })
877
+ children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(RailInner, { icon, badge })
920
878
  }) });
921
879
  }
922
880
  function SidebarV2RailItem({
@@ -929,6 +887,7 @@ function SidebarV2RailItem({
929
887
  onMouseLeave,
930
888
  badge
931
889
  }) {
890
+ const { styles } = useSidebarV2();
932
891
  return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_tooltip3.Tooltip, { content: label, side: "right", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
933
892
  "button",
934
893
  {
@@ -939,8 +898,8 @@ function SidebarV2RailItem({
939
898
  onClick,
940
899
  onMouseEnter,
941
900
  onMouseLeave,
942
- className: railButtonClasses(active),
943
- children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(RailInner, { icon, label, active, badge })
901
+ className: styles.railButton(),
902
+ children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(RailInner, { icon, badge })
944
903
  }
945
904
  ) });
946
905
  }
@@ -953,54 +912,18 @@ function SidebarV2Panel({
953
912
  children,
954
913
  className
955
914
  }) {
956
- const { togglePin, pinned, tone } = useSidebarV2();
957
- const light = tone === "light";
915
+ const { togglePin, pinned, styles } = useSidebarV2();
958
916
  return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
959
917
  "div",
960
918
  {
961
919
  "data-slot": "sidebar-v2-panel",
962
- "data-floating": floating,
963
- className: (0, import_shared_utils2.cn)(
964
- "flex h-full w-(--kpx-panel-width) shrink-0 flex-col",
965
- // Surface. The flyout is a distinct floating card (white on light),
966
- // so it reads as an overlay rather than a flat full-height slab.
967
- floating ? light ? "bg-background text-foreground" : "bg-sidebar text-sidebar-foreground" : light ? "bg-muted text-foreground" : "bg-sidebar text-sidebar-foreground",
968
- floating ? (
969
- // Floating card: rounded, soft layered shadow, hairline ring.
970
- (0, import_shared_utils2.cn)(
971
- "overflow-hidden rounded-2xl shadow-2xl shadow-black/20 ring-1",
972
- light ? "ring-black/5" : "ring-white/10"
973
- )
974
- ) : (
975
- // Pinned: light blends into the surround (no border); dark keeps a
976
- // hairline against the rail.
977
- light ? "" : "border-l border-sidebar-border/40"
978
- ),
979
- className
980
- ),
920
+ "data-floating": floating ? "true" : "false",
921
+ className: styles.panel({ className }),
981
922
  children: [
982
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "flex items-start gap-2 px-3 pt-3 pb-1.5", children: [
923
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: styles.panelHeader(), children: [
983
924
  /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "min-w-0 flex-1", children: [
984
- title && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
985
- "div",
986
- {
987
- className: (0, import_shared_utils2.cn)(
988
- "truncate text-sm font-semibold",
989
- light ? "text-foreground" : "text-sidebar-foreground"
990
- ),
991
- children: title
992
- }
993
- ),
994
- subtitle && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
995
- "div",
996
- {
997
- className: (0, import_shared_utils2.cn)(
998
- "truncate text-xs",
999
- light ? "text-muted-foreground" : "text-sidebar-foreground/70"
1000
- ),
1001
- children: subtitle
1002
- }
1003
- )
925
+ title && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: styles.panelTitle(), children: title }),
926
+ subtitle && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: styles.panelSubtitle(), children: subtitle })
1004
927
  ] }),
1005
928
  action != null ? action : !hidePin && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1006
929
  import_tooltip3.Tooltip,
@@ -1014,41 +937,28 @@ function SidebarV2Panel({
1014
937
  size: "sm",
1015
938
  "aria-label": pinned ? "Panel l\xF6sen" : "Panel anheften",
1016
939
  onClick: togglePin,
1017
- className: (0, import_shared_utils2.cn)(
1018
- "-mr-1 shrink-0",
1019
- light ? "text-muted-foreground hover:bg-foreground/5 hover:text-foreground" : "text-sidebar-foreground/60 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground"
1020
- ),
940
+ className: styles.panelPin(),
1021
941
  children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_icons2.PanelLeftIcon, { className: "size-4" })
1022
942
  }
1023
943
  )
1024
944
  }
1025
945
  )
1026
946
  ] }),
1027
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "flex min-h-0 flex-1 flex-col gap-0.5 overflow-auto p-2", children })
947
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: styles.panelBody(), children })
1028
948
  ]
1029
949
  }
1030
950
  );
1031
951
  }
1032
- function panelRowLight(active) {
1033
- return (0, import_shared_utils2.cn)(
1034
- "flex h-8 w-full items-center gap-2.5 rounded-md px-2 text-sm outline-hidden ring-ring transition-colors focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0",
1035
- active ? "bg-primary/10 font-medium text-primary" : "text-foreground/80 hover:bg-foreground/5"
1036
- );
1037
- }
1038
952
  function SidebarV2PanelLabel({
1039
953
  className,
1040
954
  ...props
1041
955
  }) {
1042
- const { tone } = useSidebarV2();
956
+ const { styles } = useSidebarV2();
1043
957
  return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1044
958
  "div",
1045
959
  {
1046
960
  "data-slot": "sidebar-v2-panel-label",
1047
- className: (0, import_shared_utils2.cn)(
1048
- "px-2 pt-3 pb-1 text-[0.6875rem] font-medium uppercase tracking-wide",
1049
- tone === "light" ? "text-muted-foreground" : "text-sidebar-foreground/50",
1050
- className
1051
- ),
961
+ className: styles.panelLabel({ className }),
1052
962
  ...props
1053
963
  }
1054
964
  );
@@ -1057,7 +967,7 @@ function SidebarV2PanelLeaf({
1057
967
  item,
1058
968
  active: activeProp
1059
969
  }) {
1060
- const { renderLink, isActive, tone } = useSidebarV2();
970
+ const { renderLink, isActive, tone, styles } = useSidebarV2();
1061
971
  const light = tone === "light";
1062
972
  const Icon = item.icon;
1063
973
  const active = activeProp != null ? activeProp : isActive(item.href);
@@ -1065,27 +975,13 @@ function SidebarV2PanelLeaf({
1065
975
  href: item.href,
1066
976
  "data-active": active,
1067
977
  "aria-current": active ? "page" : void 0,
1068
- className: light ? panelRowLight(active) : (0, import_theme2.sidebarMenuButton)({ size: "md" }),
978
+ // Light tone uses the recipe's leaf slot (group/leaf + data-active);
979
+ // dark tone reuses the existing sidebarMenuButton recipe.
980
+ className: light ? styles.panelLeaf() : (0, import_theme3.sidebarMenuButton)({ size: "md" }),
1069
981
  children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
1070
- Icon && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1071
- Icon,
1072
- {
1073
- className: (0, import_shared_utils2.cn)(
1074
- light ? active ? void 0 : "text-muted-foreground" : "text-sidebar-foreground/75"
1075
- )
1076
- }
1077
- ),
1078
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "min-w-0 flex-1 truncate", children: item.label }),
1079
- item.badge != null && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1080
- "span",
1081
- {
1082
- className: (0, import_shared_utils2.cn)(
1083
- "ml-auto rounded-full px-1.5 text-[0.625rem] font-medium",
1084
- light ? "bg-foreground/10 text-foreground/70" : "bg-sidebar-accent text-sidebar-accent-foreground"
1085
- ),
1086
- children: item.badge
1087
- }
1088
- )
982
+ Icon && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Icon, { className: styles.panelLeafIcon() }),
983
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: styles.panelLeafLabel(), children: item.label }),
984
+ item.badge != null && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: styles.panelLeafBadge(), children: item.badge })
1089
985
  ] })
1090
986
  }) });
1091
987
  }
@@ -1093,7 +989,7 @@ function SidebarV2PanelGroup({
1093
989
  item
1094
990
  }) {
1095
991
  var _a;
1096
- const { openGroup, toggleGroup, activeHref, renderLink, tone } = useSidebarV2();
992
+ const { openGroup, toggleGroup, activeHref, renderLink, tone, styles } = useSidebarV2();
1097
993
  const light = tone === "light";
1098
994
  const Icon = item.icon;
1099
995
  const key = (_a = item.value) != null ? _a : item.label;
@@ -1117,57 +1013,30 @@ function SidebarV2PanelGroup({
1117
1013
  {
1118
1014
  type: "button",
1119
1015
  "data-state": open ? "open" : "closed",
1016
+ "data-contains-active": containsActive,
1120
1017
  "aria-expanded": open,
1121
1018
  onClick: () => toggleGroup(key),
1122
- className: (0, import_shared_utils2.cn)(
1123
- light ? panelRowLight(false) : (0, import_theme2.sidebarMenuButton)({ size: "md" }),
1124
- "cursor-pointer",
1125
- containsActive && (light ? "font-medium text-foreground" : "font-medium")
1019
+ className: (0, import_shared_utils.cn)(
1020
+ light ? styles.panelLeaf() : (0, import_theme3.sidebarMenuButton)({ size: "md" }),
1021
+ styles.panelGroupButton()
1126
1022
  ),
1127
1023
  children: [
1128
- Icon && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1129
- Icon,
1130
- {
1131
- className: light ? "text-muted-foreground" : "text-sidebar-foreground/75"
1132
- }
1133
- ),
1134
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "min-w-0 flex-1 truncate text-left", children: item.label }),
1135
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1136
- import_icons2.ChevronRightIcon,
1137
- {
1138
- className: (0, import_shared_utils2.cn)(
1139
- "size-3.5! shrink-0 transition-transform",
1140
- light ? "text-muted-foreground" : "text-sidebar-foreground/60",
1141
- open && "rotate-90"
1142
- )
1143
- }
1144
- )
1024
+ Icon && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Icon, { className: styles.panelGroupIcon() }),
1025
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: styles.panelGroupLabel(), children: item.label }),
1026
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_icons2.ChevronRightIcon, { className: styles.panelGroupChevron() })
1145
1027
  ]
1146
1028
  }
1147
1029
  ),
1148
- open && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1149
- "div",
1150
- {
1151
- className: (0, import_shared_utils2.cn)(
1152
- "my-0.5 ml-[1.05rem] flex flex-col border-l pl-3",
1153
- light ? "border-border" : "border-sidebar-border"
1154
- ),
1155
- children: item.children.map((child) => {
1156
- const active = child.href === bestChildHref;
1157
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: renderLink({
1158
- href: child.href,
1159
- "data-active": active,
1160
- "aria-current": active ? "page" : void 0,
1161
- className: (0, import_shared_utils2.cn)(
1162
- "relative block rounded-md px-2 py-1.5 text-[0.8125rem] outline-hidden transition-colors focus-visible:ring-2",
1163
- "before:absolute before:top-1/2 before:-left-3 before:h-px before:w-2.5",
1164
- light ? active ? "bg-primary/10 font-medium text-primary ring-ring before:bg-primary" : "text-muted-foreground ring-ring hover:bg-foreground/5 hover:text-foreground before:bg-border" : active ? "bg-sidebar-accent font-medium text-sidebar-accent-foreground ring-sidebar-ring before:bg-primary" : "text-sidebar-foreground/80 ring-sidebar-ring hover:bg-sidebar-accent/60 hover:text-sidebar-accent-foreground before:bg-sidebar-foreground/30"
1165
- ),
1166
- children: child.label
1167
- }) }, child.href);
1168
- })
1169
- }
1170
- )
1030
+ open && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: styles.panelTree(), children: item.children.map((child) => {
1031
+ const active = child.href === bestChildHref;
1032
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: renderLink({
1033
+ href: child.href,
1034
+ "data-active": active,
1035
+ "aria-current": active ? "page" : void 0,
1036
+ className: styles.subItem(),
1037
+ children: child.label
1038
+ }) }, child.href);
1039
+ }) })
1171
1040
  ] });
1172
1041
  }
1173
1042
  function SidebarV2PanelItems({
@@ -1205,7 +1074,7 @@ function SidebarV2Trigger({
1205
1074
 
1206
1075
  // src/v2/from-config.tsx
1207
1076
  var import_drawer2 = require("@kopexa/drawer");
1208
- var import_shared_utils3 = require("@kopexa/shared-utils");
1077
+ var import_shared_utils2 = require("@kopexa/shared-utils");
1209
1078
  var import_react5 = require("motion/react");
1210
1079
  var import_react6 = require("react");
1211
1080
  var import_jsx_runtime5 = require("react/jsx-runtime");
@@ -1240,7 +1109,8 @@ function SidebarV2FromConfig({
1240
1109
  setDrawerOpen,
1241
1110
  setPanelHost,
1242
1111
  panelOverrideActive,
1243
- navPreviewActive
1112
+ navPreviewActive,
1113
+ styles
1244
1114
  } = useSidebarV2();
1245
1115
  const hoverMode = flyoutTrigger === "hover" && !pinned && !isMobile;
1246
1116
  const closeTimer = (0, import_react6.useRef)(null);
@@ -1297,7 +1167,7 @@ function SidebarV2FromConfig({
1297
1167
  "div",
1298
1168
  {
1299
1169
  "aria-hidden": true,
1300
- className: "mx-3 my-1.5 h-px shrink-0 bg-sidebar-border/70"
1170
+ className: styles.railDivider()
1301
1171
  },
1302
1172
  `rail-divider-${index}`
1303
1173
  );
@@ -1349,14 +1219,14 @@ function SidebarV2FromConfig({
1349
1219
  );
1350
1220
  }
1351
1221
  const railContent = /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
1352
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "flex min-h-0 flex-1 flex-col gap-1 overflow-y-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden", children: [
1222
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: styles.railScroll(), children: [
1353
1223
  header && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
1354
1224
  header,
1355
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "mx-3 my-1 h-px shrink-0 bg-sidebar-border/60" })
1225
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: styles.railHeaderDivider() })
1356
1226
  ] }),
1357
1227
  topEntries.map(renderRailEntry)
1358
1228
  ] }),
1359
- bottomEntries.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "flex shrink-0 flex-col gap-1 pt-1", children: bottomEntries.map(renderRailEntry) })
1229
+ bottomEntries.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: styles.railBottom(), children: bottomEntries.map(renderRailEntry) })
1360
1230
  ] });
1361
1231
  const navData = pinned && shownPanel && (navPreviewActive || !panelOverrideActive) ? shownPanel : null;
1362
1232
  const [bufferedPanel, setBufferedPanel] = (0, import_react6.useState)(navData);
@@ -1388,7 +1258,7 @@ function SidebarV2FromConfig({
1388
1258
  open: drawerOpen,
1389
1259
  onOpenChange: setDrawerOpen,
1390
1260
  placement: "left",
1391
- children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_drawer2.Drawer.Content, { className: "w-auto max-w-[85vw] border-0 bg-sidebar p-0 [&>button]:hidden", children: [
1261
+ children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_drawer2.Drawer.Content, { className: styles.mobileDrawer(), children: [
1392
1262
  /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_drawer2.Drawer.Header, { className: "sr-only", children: [
1393
1263
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_drawer2.Drawer.Title, { children: "Navigation" }),
1394
1264
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_drawer2.Drawer.Description, { children: "Hauptnavigation" })
@@ -1416,10 +1286,7 @@ function SidebarV2FromConfig({
1416
1286
  {
1417
1287
  ref: setPanelHost,
1418
1288
  "data-slot": "sidebar-v2-panel-zone",
1419
- className: (0, import_shared_utils3.cn)(
1420
- "relative shrink-0 transition-[width] duration-200 ease-out motion-reduce:transition-none",
1421
- pinned && "overflow-hidden"
1422
- ),
1289
+ className: (0, import_shared_utils2.cn)(styles.panelZone(), pinned && "overflow-hidden"),
1423
1290
  style: { gridArea: "panel", width: docked ? PANEL_WIDTH2 : "0px" },
1424
1291
  children: [
1425
1292
  panelContent,
@@ -1427,7 +1294,7 @@ function SidebarV2FromConfig({
1427
1294
  import_react5.motion.div,
1428
1295
  {
1429
1296
  "data-floating": "true",
1430
- className: "absolute inset-y-2 left-1 z-30",
1297
+ className: styles.flyout(),
1431
1298
  initial: { x: -14, opacity: 0 },
1432
1299
  animate: { x: 0, opacity: 1 },
1433
1300
  exit: { x: -14, opacity: 0 },
package/dist/index.mjs CHANGED
@@ -23,7 +23,7 @@ import {
23
23
  } from "./chunk-FPVGSRAX.mjs";
24
24
  import {
25
25
  SidebarV2
26
- } from "./chunk-WA2NSEYE.mjs";
26
+ } from "./chunk-LCCZNS2E.mjs";
27
27
  import {
28
28
  AppShell,
29
29
  AppShellAside,
@@ -31,10 +31,10 @@ import {
31
31
  AppShellMain,
32
32
  AppShellPanelContent,
33
33
  AppShellRoot
34
- } from "./chunk-PZFEB2PM.mjs";
34
+ } from "./chunk-YVQVW5EP.mjs";
35
35
  import {
36
36
  SidebarV2FromConfig
37
- } from "./chunk-CMYTESJM.mjs";
37
+ } from "./chunk-KLYPP6QE.mjs";
38
38
  import {
39
39
  SidebarV2Inset,
40
40
  SidebarV2Panel,
@@ -48,12 +48,12 @@ import {
48
48
  SidebarV2RailSpacer,
49
49
  SidebarV2Trigger,
50
50
  SidebarV2Workspace
51
- } from "./chunk-EIXUCY5M.mjs";
51
+ } from "./chunk-YW3JMPRU.mjs";
52
52
  import "./chunk-SDMGFB6V.mjs";
53
53
  import {
54
54
  SidebarV2Provider,
55
55
  useSidebarV2
56
- } from "./chunk-3L2F566G.mjs";
56
+ } from "./chunk-AIRHHM7Z.mjs";
57
57
  export {
58
58
  AppShell,
59
59
  AppShellAside,