@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.js CHANGED
@@ -21957,6 +21957,7 @@ function NavigationLayout({
21957
21957
  defaultMode = "headbar",
21958
21958
  defaultSidebarCollapsed = false,
21959
21959
  expandedSidebarWidth = NAVIGATION_LAYOUT_SIDEBAR_EXPANDED_WIDTH,
21960
+ expandSidebarLabel = "Expand sidebar",
21960
21961
  flush = false,
21961
21962
  headbarActions,
21962
21963
  headbarLayout,
@@ -21967,6 +21968,8 @@ function NavigationLayout({
21967
21968
  onNavigate,
21968
21969
  onSidebarCollapsedChange,
21969
21970
  renderHeadbarExtra,
21971
+ collapseSidebarLabel = "Collapse sidebar",
21972
+ sidebarCollapsed: controlledSidebarCollapsed,
21970
21973
  sidebarAccountMenu,
21971
21974
  sidebarFooter,
21972
21975
  sidebarHeader,
@@ -21974,10 +21977,12 @@ function NavigationLayout({
21974
21977
  switchToSidebarLabel = "Switch to sidebar"
21975
21978
  }) {
21976
21979
  const [uncontrolledMode, setUncontrolledMode] = React.useState(defaultMode);
21977
- const [sidebarCollapsed, setSidebarCollapsed] = React.useState(defaultSidebarCollapsed);
21980
+ const [uncontrolledSidebarCollapsed, setUncontrolledSidebarCollapsed] = React.useState(defaultSidebarCollapsed);
21978
21981
  const [revealRequest, setRevealRequest] = React.useState(null);
21979
21982
  const isModeControlled = mode !== void 0;
21983
+ const isSidebarCollapsedControlled = controlledSidebarCollapsed !== void 0;
21980
21984
  const navigationMode = isModeControlled ? mode : uncontrolledMode;
21985
+ const sidebarCollapsed = isSidebarCollapsedControlled ? controlledSidebarCollapsed : uncontrolledSidebarCollapsed;
21981
21986
  const isHeadbarMode = navigationMode === "headbar";
21982
21987
  const sidebarWidth = sidebarCollapsed ? collapsedSidebarWidth : expandedSidebarWidth;
21983
21988
  React.useEffect(() => {
@@ -21985,6 +21990,11 @@ function NavigationLayout({
21985
21990
  setUncontrolledMode(defaultMode);
21986
21991
  }
21987
21992
  }, [defaultMode, isModeControlled]);
21993
+ React.useEffect(() => {
21994
+ if (!isSidebarCollapsedControlled) {
21995
+ setUncontrolledSidebarCollapsed(defaultSidebarCollapsed);
21996
+ }
21997
+ }, [defaultSidebarCollapsed, isSidebarCollapsedControlled]);
21988
21998
  const setNavigationMode = (nextMode) => {
21989
21999
  if (!isModeControlled) {
21990
22000
  setUncontrolledMode(nextMode);
@@ -21992,7 +22002,9 @@ function NavigationLayout({
21992
22002
  onModeChange?.(nextMode);
21993
22003
  };
21994
22004
  const setCollapsed = (collapsed) => {
21995
- setSidebarCollapsed(collapsed);
22005
+ if (!isSidebarCollapsedControlled) {
22006
+ setUncontrolledSidebarCollapsed(collapsed);
22007
+ }
21996
22008
  onSidebarCollapsedChange?.(collapsed);
21997
22009
  };
21998
22010
  const navigationActions = [];
@@ -22009,7 +22021,7 @@ function NavigationLayout({
22009
22021
  }
22010
22022
  navigationActions.push({
22011
22023
  id: "toggle-sidebar",
22012
- label: sidebarCollapsed ? "Expand sidebar" : "Collapse sidebar",
22024
+ label: sidebarCollapsed ? expandSidebarLabel : collapseSidebarLabel,
22013
22025
  onClick: () => setCollapsed(!sidebarCollapsed),
22014
22026
  icon: /* @__PURE__ */ jsxRuntime.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: [
22015
22027
  /* @__PURE__ */ jsxRuntime.jsx("rect", { width: "18", height: "18", x: "3", y: "3", rx: "2" }),
@@ -22020,7 +22032,10 @@ function NavigationLayout({
22020
22032
  const sidebar = isHeadbarMode ? null : /* @__PURE__ */ jsxRuntime.jsx(
22021
22033
  "div",
22022
22034
  {
22023
- className: "relative h-full min-h-0 shrink-0 overflow-hidden transition-[width] duration-260",
22035
+ className: cn3(
22036
+ "relative h-full min-h-0 shrink-0 transition-[width] duration-260",
22037
+ sidebarCollapsed ? "z-20 overflow-visible" : "z-10 overflow-hidden"
22038
+ ),
22024
22039
  style: { width: sidebarWidth, transitionTimingFunction: NAVIGATION_LAYOUT_TRANSITION_TIMING },
22025
22040
  children: /* @__PURE__ */ jsxRuntime.jsx(
22026
22041
  Sidebar,