@toteat-eng/ds-react 2026.7.10 → 2026.7.13

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,12 +1,28 @@
1
1
  import type { ReactNode } from "react";
2
- export interface SidebarNavSectionProps {
2
+ interface SidebarNavSectionBaseProps {
3
3
  title: string;
4
4
  icon?: ReactNode;
5
5
  titleSuffix?: ReactNode;
6
- defaultOpen?: boolean;
7
6
  isActive?: boolean;
8
7
  className?: string;
9
8
  children: ReactNode;
10
9
  "data-testid"?: string;
11
10
  }
12
- export declare function SidebarNavSection({ title, icon, titleSuffix, defaultOpen, isActive, className, children, "data-testid": testId, }: SidebarNavSectionProps): import("react/jsx-runtime").JSX.Element;
11
+ interface UncontrolledSidebarNavSectionProps {
12
+ /** Initial open state (uncontrolled — the component owns open/close). */
13
+ defaultOpen?: boolean;
14
+ open?: undefined;
15
+ /** Fired on every trigger click. */
16
+ onToggle?: () => void;
17
+ }
18
+ interface ControlledSidebarNavSectionProps {
19
+ /** Controlled open state. The component renders from this and never mutates
20
+ * internal state — the parent owns open/close (e.g. a single-open accordion). */
21
+ open: boolean;
22
+ /** Required in controlled mode so the parent can react to trigger clicks. */
23
+ onToggle: () => void;
24
+ defaultOpen?: never;
25
+ }
26
+ export type SidebarNavSectionProps = SidebarNavSectionBaseProps & (ControlledSidebarNavSectionProps | UncontrolledSidebarNavSectionProps);
27
+ export declare function SidebarNavSection({ title, icon, titleSuffix, defaultOpen, open, onToggle, isActive, className, children, "data-testid": testId, }: SidebarNavSectionProps): import("react/jsx-runtime").JSX.Element;
28
+ export {};
@@ -8,4 +8,5 @@ export declare const DefaultOpen: Story;
8
8
  export declare const Active: Story;
9
9
  export declare const WithIcon: Story;
10
10
  export declare const WithTitleSuffix: Story;
11
+ export declare const ControlledAccordion: Story;
11
12
  export declare const MultipleSections: Story;
package/dist/index.es.js CHANGED
@@ -2152,8 +2152,8 @@ function si({ options: e, value: t, onChange: n, placeholder: r = "Seleccionar..
2152
2152
  });
2153
2153
  }
2154
2154
  var ci = {
2155
- backdrop: "_backdrop_1j7fj_3",
2156
- sidebar: "_sidebar_1j7fj_16"
2155
+ backdrop: "_backdrop_kq54y_3",
2156
+ sidebar: "_sidebar_kq54y_16"
2157
2157
  }, li = "ds-sidebar-drawer", ui = "a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex=\"-1\"])";
2158
2158
  function di(e) {
2159
2159
  return Array.from(e.querySelectorAll(ui));
@@ -2918,18 +2918,20 @@ var Z = {
2918
2918
  };
2919
2919
  //#endregion
2920
2920
  //#region src/components/SidebarNavSection/SidebarNavSection.tsx
2921
- function qi({ title: e, icon: t, titleSuffix: n, defaultOpen: r = !1, isActive: i = !1, className: a, children: o, "data-testid": s }) {
2922
- let [c, l] = Ki(r);
2921
+ function qi({ title: e, icon: t, titleSuffix: n, defaultOpen: r = !1, open: i, onToggle: a, isActive: o = !1, className: s, children: c, "data-testid": l }) {
2922
+ let [u, p] = Ki(r), m = i !== void 0, h = m ? i : u;
2923
2923
  return /* @__PURE__ */ f("div", {
2924
- className: R(Z.section, a),
2925
- "data-testid": s,
2924
+ className: R(Z.section, s),
2925
+ "data-testid": l,
2926
2926
  children: [/* @__PURE__ */ f("button", {
2927
2927
  type: "button",
2928
2928
  className: Z.trigger,
2929
- "data-open": c || void 0,
2930
- "data-active": i || void 0,
2931
- onClick: l,
2932
- "aria-expanded": c,
2929
+ "data-open": h || void 0,
2930
+ "data-active": o || void 0,
2931
+ onClick: () => {
2932
+ m || p(), a?.();
2933
+ },
2934
+ "aria-expanded": h,
2933
2935
  children: [
2934
2936
  t && /* @__PURE__ */ d("span", {
2935
2937
  className: Z.icon,
@@ -2952,11 +2954,11 @@ function qi({ title: e, icon: t, titleSuffix: n, defaultOpen: r = !1, isActive:
2952
2954
  ]
2953
2955
  }), /* @__PURE__ */ d("div", {
2954
2956
  className: Z.content,
2955
- "data-open": c || void 0,
2956
- inert: !c || void 0,
2957
+ "data-open": h || void 0,
2958
+ inert: !h || void 0,
2957
2959
  children: /* @__PURE__ */ d("div", {
2958
2960
  className: Z.inner,
2959
- children: o
2961
+ children: c
2960
2962
  })
2961
2963
  })]
2962
2964
  });
@@ -3904,30 +3906,30 @@ function Wa({ title: e, actions: t, "data-testid": n }) {
3904
3906
  });
3905
3907
  }
3906
3908
  var Ga = {
3907
- shell: "_shell_1wom3_2",
3908
- body: "_body_1wom3_10",
3909
- sidebarSlot: "_sidebarSlot_1wom3_17",
3910
- contentArea: "_contentArea_1wom3_28",
3911
- main: "_main_1wom3_45",
3912
- tabBarSlot: "_tabBarSlot_1wom3_51"
3909
+ shell: "_shell_h247i_2",
3910
+ body: "_body_h247i_10",
3911
+ sidebarSlot: "_sidebarSlot_h247i_17",
3912
+ contentArea: "_contentArea_h247i_31",
3913
+ main: "_main_h247i_41",
3914
+ tabBarSlot: "_tabBarSlot_h247i_48"
3913
3915
  };
3914
3916
  //#endregion
3915
3917
  //#region src/layouts/AppShell/AppShell.tsx
3916
- function Ka({ restaurantName: e, onMenuToggle: t, onLogoClick: n, onRightToggle: r, sidebar: i, children: a, tabBar: o, headerRight: s, isSidebarOpen: c = !1, sidebarMode: l = "overlay", isPinLocked: u = !1, pinLockContent: p, isLoading: m = !1, "data-testid": h }) {
3917
- return u ? /* @__PURE__ */ d(ji, {
3918
+ function Ka({ restaurantName: e, onMenuToggle: t, onLogoClick: n, onRightToggle: r, sidebar: i, children: a, tabBar: o, headerRight: s, isSidebarOpen: c = !1, sidebarMode: l = "overlay", contentPadding: u, isPinLocked: p = !1, pinLockContent: m, isLoading: h = !1, "data-testid": g }) {
3919
+ return p ? /* @__PURE__ */ d(ji, {
3918
3920
  isLocked: !0,
3919
- children: p
3921
+ children: m
3920
3922
  }) : /* @__PURE__ */ f("div", {
3921
3923
  className: Ga.shell,
3922
3924
  "data-sidebar-mode": l,
3923
- "data-testid": h,
3925
+ "data-testid": g,
3924
3926
  children: [/* @__PURE__ */ d(mi, {
3925
3927
  restaurantName: e,
3926
3928
  onMenuToggle: t,
3927
3929
  onLogoClick: n,
3928
3930
  onRightToggle: r,
3929
3931
  isMenuOpen: c,
3930
- isLoading: m,
3932
+ isLoading: h,
3931
3933
  rightSlot: s
3932
3934
  }), /* @__PURE__ */ f("div", {
3933
3935
  className: Ga.body,
@@ -3938,6 +3940,7 @@ function Ka({ restaurantName: e, onMenuToggle: t, onLogoClick: n, onRightToggle:
3938
3940
  className: Ga.contentArea,
3939
3941
  children: [/* @__PURE__ */ d("main", {
3940
3942
  className: Ga.main,
3943
+ style: u ? { "--ds-appshell-content-padding": u } : void 0,
3941
3944
  children: a
3942
3945
  }), o && /* @__PURE__ */ d("div", {
3943
3946
  className: Ga.tabBarSlot,