@toteat-eng/ds-react 2026.7.10-1 → 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.
- package/dist/components/SidebarNavSection/SidebarNavSection.d.ts +19 -3
- package/dist/components/SidebarNavSection/__stories__/SidebarNavSection.stories.d.ts +1 -0
- package/dist/index.es.js +13 -11
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,12 +1,28 @@
|
|
|
1
1
|
import type { ReactNode } from "react";
|
|
2
|
-
|
|
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
|
-
|
|
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 {};
|
package/dist/index.es.js
CHANGED
|
@@ -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,
|
|
2922
|
-
let [
|
|
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,
|
|
2925
|
-
"data-testid":
|
|
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":
|
|
2930
|
-
"data-active":
|
|
2931
|
-
onClick:
|
|
2932
|
-
|
|
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":
|
|
2956
|
-
inert: !
|
|
2957
|
+
"data-open": h || void 0,
|
|
2958
|
+
inert: !h || void 0,
|
|
2957
2959
|
children: /* @__PURE__ */ d("div", {
|
|
2958
2960
|
className: Z.inner,
|
|
2959
|
-
children:
|
|
2961
|
+
children: c
|
|
2960
2962
|
})
|
|
2961
2963
|
})]
|
|
2962
2964
|
});
|