@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.
package/dist/index.mjs CHANGED
@@ -21930,6 +21930,7 @@ function NavigationLayout({
21930
21930
  defaultMode = "headbar",
21931
21931
  defaultSidebarCollapsed = false,
21932
21932
  expandedSidebarWidth = NAVIGATION_LAYOUT_SIDEBAR_EXPANDED_WIDTH,
21933
+ expandSidebarLabel = "Expand sidebar",
21933
21934
  flush = false,
21934
21935
  headbarActions,
21935
21936
  headbarLayout,
@@ -21940,6 +21941,8 @@ function NavigationLayout({
21940
21941
  onNavigate,
21941
21942
  onSidebarCollapsedChange,
21942
21943
  renderHeadbarExtra,
21944
+ collapseSidebarLabel = "Collapse sidebar",
21945
+ sidebarCollapsed: controlledSidebarCollapsed,
21943
21946
  sidebarAccountMenu,
21944
21947
  sidebarFooter,
21945
21948
  sidebarHeader,
@@ -21947,10 +21950,12 @@ function NavigationLayout({
21947
21950
  switchToSidebarLabel = "Switch to sidebar"
21948
21951
  }) {
21949
21952
  const [uncontrolledMode, setUncontrolledMode] = useState(defaultMode);
21950
- const [sidebarCollapsed, setSidebarCollapsed] = useState(defaultSidebarCollapsed);
21953
+ const [uncontrolledSidebarCollapsed, setUncontrolledSidebarCollapsed] = useState(defaultSidebarCollapsed);
21951
21954
  const [revealRequest, setRevealRequest] = useState(null);
21952
21955
  const isModeControlled = mode !== void 0;
21956
+ const isSidebarCollapsedControlled = controlledSidebarCollapsed !== void 0;
21953
21957
  const navigationMode = isModeControlled ? mode : uncontrolledMode;
21958
+ const sidebarCollapsed = isSidebarCollapsedControlled ? controlledSidebarCollapsed : uncontrolledSidebarCollapsed;
21954
21959
  const isHeadbarMode = navigationMode === "headbar";
21955
21960
  const sidebarWidth = sidebarCollapsed ? collapsedSidebarWidth : expandedSidebarWidth;
21956
21961
  useEffect(() => {
@@ -21958,6 +21963,11 @@ function NavigationLayout({
21958
21963
  setUncontrolledMode(defaultMode);
21959
21964
  }
21960
21965
  }, [defaultMode, isModeControlled]);
21966
+ useEffect(() => {
21967
+ if (!isSidebarCollapsedControlled) {
21968
+ setUncontrolledSidebarCollapsed(defaultSidebarCollapsed);
21969
+ }
21970
+ }, [defaultSidebarCollapsed, isSidebarCollapsedControlled]);
21961
21971
  const setNavigationMode = (nextMode) => {
21962
21972
  if (!isModeControlled) {
21963
21973
  setUncontrolledMode(nextMode);
@@ -21965,7 +21975,9 @@ function NavigationLayout({
21965
21975
  onModeChange?.(nextMode);
21966
21976
  };
21967
21977
  const setCollapsed = (collapsed) => {
21968
- setSidebarCollapsed(collapsed);
21978
+ if (!isSidebarCollapsedControlled) {
21979
+ setUncontrolledSidebarCollapsed(collapsed);
21980
+ }
21969
21981
  onSidebarCollapsedChange?.(collapsed);
21970
21982
  };
21971
21983
  const navigationActions = [];
@@ -21982,7 +21994,7 @@ function NavigationLayout({
21982
21994
  }
21983
21995
  navigationActions.push({
21984
21996
  id: "toggle-sidebar",
21985
- label: sidebarCollapsed ? "Expand sidebar" : "Collapse sidebar",
21997
+ label: sidebarCollapsed ? expandSidebarLabel : collapseSidebarLabel,
21986
21998
  onClick: () => setCollapsed(!sidebarCollapsed),
21987
21999
  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: [
21988
22000
  /* @__PURE__ */ jsx("rect", { width: "18", height: "18", x: "3", y: "3", rx: "2" }),
@@ -21993,7 +22005,10 @@ function NavigationLayout({
21993
22005
  const sidebar = isHeadbarMode ? null : /* @__PURE__ */ jsx(
21994
22006
  "div",
21995
22007
  {
21996
- className: "relative h-full min-h-0 shrink-0 overflow-hidden transition-[width] duration-260",
22008
+ className: cn3(
22009
+ "relative h-full min-h-0 shrink-0 transition-[width] duration-260",
22010
+ sidebarCollapsed ? "z-20 overflow-visible" : "z-10 overflow-hidden"
22011
+ ),
21997
22012
  style: { width: sidebarWidth, transitionTimingFunction: NAVIGATION_LAYOUT_TRANSITION_TIMING },
21998
22013
  children: /* @__PURE__ */ jsx(
21999
22014
  Sidebar,