@tap-payments/os-micro-frontend-shared 0.0.31-dev-shared-migration-v1 → 0.0.33
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,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { ExpandableSideBarProps } from './type';
|
|
3
|
-
declare function ExpandableSideBar({ sections, isMaximized, onClick, activeSection }: ExpandableSideBarProps): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
declare function ExpandableSideBar({ sections, isMaximized, onClick, activeSection, activeSubSection }: ExpandableSideBarProps): import("react/jsx-runtime").JSX.Element;
|
|
4
4
|
declare const _default: import("react").MemoExoticComponent<typeof ExpandableSideBar>;
|
|
5
5
|
export default _default;
|
|
@@ -2,9 +2,10 @@ import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
|
2
2
|
import { memo } from 'react';
|
|
3
3
|
import { SideBar, Content, SubMenuLink, MenuHeader } from './style';
|
|
4
4
|
import AccordionAdapter from '../AccordionAdapter';
|
|
5
|
-
function ExpandableSideBar({ sections, isMaximized, onClick, activeSection }) {
|
|
6
|
-
var _a;
|
|
5
|
+
function ExpandableSideBar({ sections, isMaximized, onClick, activeSection, activeSubSection }) {
|
|
6
|
+
var _a, _b, _c, _d;
|
|
7
7
|
const currentActiveSection = activeSection || ((_a = sections === null || sections === void 0 ? void 0 : sections[0]) === null || _a === void 0 ? void 0 : _a.id);
|
|
8
|
+
const currentActiveSubSection = activeSubSection || ((_d = (_c = (_b = sections === null || sections === void 0 ? void 0 : sections[0]) === null || _b === void 0 ? void 0 : _b.subSections) === null || _c === void 0 ? void 0 : _c[0]) === null || _d === void 0 ? void 0 : _d.id);
|
|
8
9
|
return (_jsx(SideBar, Object.assign({ isMaximized: isMaximized }, { children: _jsx(Content, { children: sections === null || sections === void 0 ? void 0 : sections.map((s) => {
|
|
9
10
|
var _a;
|
|
10
11
|
return (_jsx(AccordionAdapter, Object.assign({ defaultExpanded: currentActiveSection === s.id, summarySx: {
|
|
@@ -22,12 +23,13 @@ function ExpandableSideBar({ sections, isMaximized, onClick, activeSection }) {
|
|
|
22
23
|
borderRadius: '4px !important',
|
|
23
24
|
},
|
|
24
25
|
}, Header: _jsx(MenuHeader, Object.assign({ onClick: () => {
|
|
25
|
-
|
|
26
|
+
var _a, _b;
|
|
27
|
+
onClick === null || onClick === void 0 ? void 0 : onClick(s.id, (_b = (_a = s.subSections) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.id);
|
|
26
28
|
}, isActive: currentActiveSection === s.id }, { children: s.title }), s.id) }, { children: _jsx(_Fragment, { children: (_a = s.subSections) === null || _a === void 0 ? void 0 : _a.map((ss) => {
|
|
27
29
|
return (_jsx(SubMenuLink, Object.assign({ onClick: () => {
|
|
28
|
-
onClick === null || onClick === void 0 ? void 0 : onClick(s);
|
|
29
|
-
}, isActive:
|
|
30
|
-
}) }) })));
|
|
30
|
+
onClick === null || onClick === void 0 ? void 0 : onClick(s.id, ss.id);
|
|
31
|
+
}, isActive: currentActiveSubSection === ss.id }, { children: ss.title }), `${s.id}-${ss.id}`));
|
|
32
|
+
}) }) }), `${s.id}`));
|
|
31
33
|
}) }) })));
|
|
32
34
|
}
|
|
33
35
|
export default memo(ExpandableSideBar);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import Box from '@mui/material/Box';
|
|
2
2
|
import { alpha, styled } from '@mui/material/styles';
|
|
3
|
+
import { LEFT_SIDEBAR } from '../AppWindowWrapper';
|
|
3
4
|
import { TITLE_BAR_HEIGHT } from './constant';
|
|
4
|
-
import { LEFT_SIDEBAR } from '../index.js';
|
|
5
5
|
export const SideBar = styled(Box, {
|
|
6
6
|
shouldForwardProp: (props) => props !== 'isMaximized',
|
|
7
7
|
})(({ theme, isMaximized }) => ({
|
|
@@ -11,6 +11,7 @@ export interface Section {
|
|
|
11
11
|
export interface ExpandableSideBarProps {
|
|
12
12
|
sections: Section[];
|
|
13
13
|
isMaximized?: boolean;
|
|
14
|
-
onClick
|
|
14
|
+
onClick: (sectionId: string, subSectionId?: string) => void;
|
|
15
15
|
activeSection?: string;
|
|
16
|
+
activeSubSection?: string;
|
|
16
17
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tap-payments/os-micro-frontend-shared",
|
|
3
3
|
"description": "Shared components and utilities for Tap Payments micro frontends",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.33",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "build/index.js",
|
|
7
7
|
"module": "build/index.js",
|