@inf-monkeys-tech/monkeys-design 0.4.47 → 0.4.49

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.
@@ -4078,6 +4078,7 @@ function NavigationLayout({
4078
4078
  defaultMode = "headbar",
4079
4079
  defaultSidebarCollapsed = false,
4080
4080
  expandedSidebarWidth = NAVIGATION_LAYOUT_SIDEBAR_EXPANDED_WIDTH,
4081
+ expandSidebarLabel = "Expand sidebar",
4081
4082
  flush = false,
4082
4083
  headbarActions,
4083
4084
  headbarLayout,
@@ -4088,6 +4089,8 @@ function NavigationLayout({
4088
4089
  onNavigate,
4089
4090
  onSidebarCollapsedChange,
4090
4091
  renderHeadbarExtra,
4092
+ collapseSidebarLabel = "Collapse sidebar",
4093
+ sidebarCollapsed: controlledSidebarCollapsed,
4091
4094
  sidebarAccountMenu,
4092
4095
  sidebarFooter,
4093
4096
  sidebarHeader,
@@ -4095,10 +4098,12 @@ function NavigationLayout({
4095
4098
  switchToSidebarLabel = "Switch to sidebar"
4096
4099
  }) {
4097
4100
  const [uncontrolledMode, setUncontrolledMode] = useState(defaultMode);
4098
- const [sidebarCollapsed, setSidebarCollapsed] = useState(defaultSidebarCollapsed);
4101
+ const [uncontrolledSidebarCollapsed, setUncontrolledSidebarCollapsed] = useState(defaultSidebarCollapsed);
4099
4102
  const [revealRequest, setRevealRequest] = useState(null);
4100
4103
  const isModeControlled = mode !== void 0;
4104
+ const isSidebarCollapsedControlled = controlledSidebarCollapsed !== void 0;
4101
4105
  const navigationMode = isModeControlled ? mode : uncontrolledMode;
4106
+ const sidebarCollapsed = isSidebarCollapsedControlled ? controlledSidebarCollapsed : uncontrolledSidebarCollapsed;
4102
4107
  const isHeadbarMode = navigationMode === "headbar";
4103
4108
  const sidebarWidth = sidebarCollapsed ? collapsedSidebarWidth : expandedSidebarWidth;
4104
4109
  useEffect(() => {
@@ -4106,6 +4111,11 @@ function NavigationLayout({
4106
4111
  setUncontrolledMode(defaultMode);
4107
4112
  }
4108
4113
  }, [defaultMode, isModeControlled]);
4114
+ useEffect(() => {
4115
+ if (!isSidebarCollapsedControlled) {
4116
+ setUncontrolledSidebarCollapsed(defaultSidebarCollapsed);
4117
+ }
4118
+ }, [defaultSidebarCollapsed, isSidebarCollapsedControlled]);
4109
4119
  const setNavigationMode = (nextMode) => {
4110
4120
  if (!isModeControlled) {
4111
4121
  setUncontrolledMode(nextMode);
@@ -4113,7 +4123,9 @@ function NavigationLayout({
4113
4123
  onModeChange?.(nextMode);
4114
4124
  };
4115
4125
  const setCollapsed = (collapsed) => {
4116
- setSidebarCollapsed(collapsed);
4126
+ if (!isSidebarCollapsedControlled) {
4127
+ setUncontrolledSidebarCollapsed(collapsed);
4128
+ }
4117
4129
  onSidebarCollapsedChange?.(collapsed);
4118
4130
  };
4119
4131
  const navigationActions = [];
@@ -4130,7 +4142,7 @@ function NavigationLayout({
4130
4142
  }
4131
4143
  navigationActions.push({
4132
4144
  id: "toggle-sidebar",
4133
- label: sidebarCollapsed ? "Expand sidebar" : "Collapse sidebar",
4145
+ label: sidebarCollapsed ? expandSidebarLabel : collapseSidebarLabel,
4134
4146
  onClick: () => setCollapsed(!sidebarCollapsed),
4135
4147
  icon: /* @__PURE__ */ jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", className: "h-[18px] w-[18px]", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.8", strokeLinecap: "round", strokeLinejoin: "round", children: [
4136
4148
  /* @__PURE__ */ jsx("rect", { width: "18", height: "18", x: "3", y: "3", rx: "2" }),
@@ -4141,7 +4153,10 @@ function NavigationLayout({
4141
4153
  const sidebar = isHeadbarMode ? null : /* @__PURE__ */ jsx(
4142
4154
  "div",
4143
4155
  {
4144
- className: "relative h-full min-h-0 shrink-0 overflow-hidden transition-[width] duration-260",
4156
+ className: cn2(
4157
+ "relative h-full min-h-0 shrink-0 transition-[width] duration-260",
4158
+ sidebarCollapsed ? "z-20 overflow-visible" : "z-10 overflow-hidden"
4159
+ ),
4145
4160
  style: { width: sidebarWidth, transitionTimingFunction: NAVIGATION_LAYOUT_TRANSITION_TIMING },
4146
4161
  children: /* @__PURE__ */ jsx(
4147
4162
  Sidebar,