@stack-spot/portal-layout 0.0.2 → 0.0.4
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/Layout.d.ts +19 -5
- package/dist/Layout.d.ts.map +1 -1
- package/dist/Layout.js +13 -3
- package/dist/Layout.js.map +1 -1
- package/dist/LayoutOverlayManager.d.ts +22 -7
- package/dist/LayoutOverlayManager.d.ts.map +1 -1
- package/dist/LayoutOverlayManager.js +36 -26
- package/dist/LayoutOverlayManager.js.map +1 -1
- package/dist/components/Dialog.d.ts +9 -1
- package/dist/components/Dialog.d.ts.map +1 -1
- package/dist/components/Dialog.js +12 -4
- package/dist/components/Dialog.js.map +1 -1
- package/dist/components/Header.d.ts +2 -1
- package/dist/components/Header.d.ts.map +1 -1
- package/dist/components/Header.js +1 -1
- package/dist/components/Header.js.map +1 -1
- package/dist/components/Menu/MenuContent.d.ts +1 -1
- package/dist/components/Menu/MenuContent.d.ts.map +1 -1
- package/dist/components/Menu/MenuContent.js +46 -12
- package/dist/components/Menu/MenuContent.js.map +1 -1
- package/dist/components/Menu/MenuSections.d.ts +2 -1
- package/dist/components/Menu/MenuSections.d.ts.map +1 -1
- package/dist/components/Menu/MenuSections.js +39 -9
- package/dist/components/Menu/MenuSections.js.map +1 -1
- package/dist/components/Menu/PageSelector.d.ts +1 -1
- package/dist/components/Menu/PageSelector.d.ts.map +1 -1
- package/dist/components/Menu/PageSelector.js +9 -3
- package/dist/components/Menu/PageSelector.js.map +1 -1
- package/dist/components/Menu/types.d.ts +47 -7
- package/dist/components/Menu/types.d.ts.map +1 -1
- package/dist/components/OverlayContent.d.ts.map +1 -1
- package/dist/components/OverlayContent.js +8 -2
- package/dist/components/OverlayContent.js.map +1 -1
- package/dist/components/SelectionList.d.ts +2 -1
- package/dist/components/SelectionList.d.ts.map +1 -1
- package/dist/components/SelectionList.js +7 -3
- package/dist/components/SelectionList.js.map +1 -1
- package/dist/components/Toaster.d.ts.map +1 -1
- package/dist/components/Toaster.js +5 -1
- package/dist/components/Toaster.js.map +1 -1
- package/dist/dictionary.d.ts +15 -0
- package/dist/dictionary.d.ts.map +1 -0
- package/dist/dictionary.js +23 -0
- package/dist/dictionary.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/layout.css +38 -10
- package/package.json +4 -3
- package/src/Layout.tsx +46 -16
- package/src/LayoutOverlayManager.tsx +57 -29
- package/src/components/Dialog.tsx +38 -7
- package/src/components/Header.tsx +3 -2
- package/src/components/Menu/MenuContent.tsx +60 -16
- package/src/components/Menu/MenuSections.tsx +58 -14
- package/src/components/Menu/PageSelector.tsx +25 -12
- package/src/components/Menu/types.ts +50 -7
- package/src/components/OverlayContent.tsx +19 -13
- package/src/components/SelectionList.tsx +9 -3
- package/src/components/Toaster.tsx +9 -5
- package/src/dictionary.ts +25 -0
- package/src/index.ts +2 -0
- package/src/layout.css +38 -10
- package/src/citric.fix.d.ts +0 -7
package/dist/Layout.d.ts
CHANGED
|
@@ -1,22 +1,36 @@
|
|
|
1
1
|
import { WithStyle } from '@stack-spot/portal-theme';
|
|
2
2
|
import '@stack-spot/portal-theme/dist/theme.css';
|
|
3
|
-
import { ReactElement } from 'react';
|
|
3
|
+
import { ComponentClass, ReactElement, ReactNode } from 'react';
|
|
4
4
|
import { HeaderProps } from './components/Header';
|
|
5
5
|
import { MenuProps } from './components/Menu/types';
|
|
6
6
|
import './layout.css';
|
|
7
|
+
type ErrorBoundaryComponent = ComponentClass<{
|
|
8
|
+
children: ReactNode;
|
|
9
|
+
}>;
|
|
10
|
+
interface ErrorBoundaries {
|
|
11
|
+
page?: ErrorBoundaryComponent;
|
|
12
|
+
menuSections?: ErrorBoundaryComponent;
|
|
13
|
+
menuContent?: ErrorBoundaryComponent;
|
|
14
|
+
modal?: ErrorBoundaryComponent;
|
|
15
|
+
rightPanel?: ErrorBoundaryComponent;
|
|
16
|
+
header?: ErrorBoundaryComponent;
|
|
17
|
+
bottomDialog?: ErrorBoundaryComponent;
|
|
18
|
+
}
|
|
7
19
|
interface Props extends WithStyle {
|
|
8
20
|
menu: MenuProps;
|
|
9
21
|
header: HeaderProps;
|
|
10
|
-
children:
|
|
22
|
+
children: ReactNode;
|
|
23
|
+
errorBoundaries?: ErrorBoundaries;
|
|
11
24
|
}
|
|
12
25
|
interface RawProps extends WithStyle {
|
|
13
26
|
menuSections: ReactElement;
|
|
14
27
|
menuContent?: ReactElement;
|
|
15
28
|
header: ReactElement;
|
|
16
|
-
children:
|
|
29
|
+
children: ReactNode;
|
|
17
30
|
compactMenu?: boolean;
|
|
31
|
+
errorBoundaries?: ErrorBoundaries;
|
|
18
32
|
}
|
|
19
|
-
export declare const RawLayout: ({ menuSections, menuContent, header, compactMenu, children, className, style }: RawProps) => import("react/jsx-runtime").JSX.Element;
|
|
20
|
-
export declare const Layout: ({ menu, header, children, className, style }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
33
|
+
export declare const RawLayout: ({ menuSections, menuContent, header, compactMenu, children, errorBoundaries, className, style }: RawProps) => import("react/jsx-runtime").JSX.Element;
|
|
34
|
+
export declare const Layout: ({ menu, header, children, errorBoundaries, className, style }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
21
35
|
export {};
|
|
22
36
|
//# sourceMappingURL=Layout.d.ts.map
|
package/dist/Layout.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Layout.d.ts","sourceRoot":"","sources":["../src/Layout.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAmC,SAAS,EAAE,MAAM,0BAA0B,CAAA;AACrF,OAAO,yCAAyC,CAAA;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"Layout.d.ts","sourceRoot":"","sources":["../src/Layout.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAmC,SAAS,EAAE,MAAM,0BAA0B,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aster';
|
|
8
8
|
import './layout.css';
|
|
9
9
|
import { overlay } from './LayoutOverlayManager';
|
|
10
|
-
export const RawLayout = ({ menuSections, menuContent, header, compactMenu = true, children, className, style }) => {
|
|
10
|
+
export const RawLayout = ({ menuSections, menuContent, header, compactMenu = true, children, errorBoundaries = {}, className, style }) => {
|
|
11
11
|
// @ts-ignore
|
|
12
12
|
const { bottomDialog, modal, rightPanel } = overlay.useOverlays();
|
|
13
13
|
const classes = [
|
|
@@ -15,7 +15,17 @@ export const RawLayout = ({ menuSections, menuContent, header, compactMenu = tru
|
|
|
15
15
|
compactMenu ? 'menu-compact' : undefined,
|
|
16
16
|
className,
|
|
17
17
|
];
|
|
18
|
-
|
|
18
|
+
function includeErrorBoundary(content, section) {
|
|
19
|
+
const ErrorBoundary = errorBoundaries[section];
|
|
20
|
+
return ErrorBoundary ? _jsx(ErrorBoundary, { children: content }) : content;
|
|
21
|
+
}
|
|
22
|
+
return (_jsx(CSSToCitricAdapter, { children: _jsxs("div", { id: "layout", className: listToClass(classes), style: style, children: [_jsx("div", { id: "page", children: _jsx("article", { id: "content", children: includeErrorBoundary(children, 'page') }) }), _jsx("header", { id: "header", children: includeErrorBoundary(header, 'header') }), _jsxs("aside", { id: "menu", children: [_jsx("nav", { id: "menuContent", children: includeErrorBoundary(menuContent, 'menuContent') }), _jsx("nav", { id: "menuSections", children: includeErrorBoundary(menuSections, 'menuSections') })] }), _jsx("div", { id: "rightPanel", children: includeErrorBoundary(rightPanel, 'rightPanel') }), _jsx("div", { id: "bottomDialog", children: includeErrorBoundary(bottomDialog, 'bottomDialog') }), _jsx("div", { id: "backdrop", children: _jsx("div", { id: "modal", children: includeErrorBoundary(modal, 'modal') }) }), _jsx(Toaster, {})] }) }));
|
|
19
23
|
};
|
|
20
|
-
|
|
24
|
+
const MenuContentRenderer = ({ content }) => {
|
|
25
|
+
const menuContent = typeof content === 'function' ? content() : content;
|
|
26
|
+
return _jsx(MenuContent, { ...menuContent });
|
|
27
|
+
};
|
|
28
|
+
export const Layout = ({ menu, header, children, errorBoundaries, className, style }) => (_jsx(RawLayout, { header: _jsx(Header, { ...header }), menuSections: _jsx(MenuSections, { ...menu }), menuContent: menu.content
|
|
29
|
+
? _jsx(MenuContentRenderer, { content: menu.content }, 'contentKey' in menu ? menu.contentKey : undefined)
|
|
30
|
+
: undefined, compactMenu: menu.compact, errorBoundaries: errorBoundaries, className: className, style: style, children: children }));
|
|
21
31
|
//# sourceMappingURL=Layout.js.map
|
package/dist/Layout.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Layout.js","sourceRoot":"","sources":["../src/Layout.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAa,MAAM,0BAA0B,CAAA;AACrF,OAAO,yCAAyC,CAAA;AAEhD,OAAO,EAAE,MAAM,EAAe,MAAM,qBAAqB,CAAA;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAA;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAA;AAE7D,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAA;AAC9C,OAAO,cAAc,CAAA;AACrB,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAA;
|
|
1
|
+
{"version":3,"file":"Layout.js","sourceRoot":"","sources":["../src/Layout.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAa,MAAM,0BAA0B,CAAA;AACrF,OAAO,yCAAyC,CAAA;AAEhD,OAAO,EAAE,MAAM,EAAe,MAAM,qBAAqB,CAAA;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAA;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAA;AAE7D,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAA;AAC9C,OAAO,cAAc,CAAA;AACrB,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB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6
6
|
showButton?: boolean;
|
|
7
7
|
}
|
|
8
8
|
type BottomDialogOptions = Omit<DialogOptions, 'title'>;
|
|
9
|
-
type
|
|
9
|
+
type OverlaySize = 'small' | 'medium' | 'large';
|
|
10
|
+
type ModalSize = 'fit-content' | OverlaySize;
|
|
11
|
+
interface CustomModalOptions {
|
|
12
|
+
size?: ModalSize;
|
|
13
|
+
onClose?: () => void;
|
|
14
|
+
}
|
|
15
|
+
interface CustomRightPanelOptions {
|
|
16
|
+
size?: OverlaySize;
|
|
17
|
+
onClose?: () => void;
|
|
18
|
+
}
|
|
10
19
|
declare class LayoutOverlayManager {
|
|
11
20
|
static readonly instance?: LayoutOverlayManager;
|
|
12
21
|
private setContent;
|
|
@@ -14,17 +23,23 @@ declare class LayoutOverlayManager {
|
|
|
14
23
|
private onModalClose?;
|
|
15
24
|
private setupElements;
|
|
16
25
|
private useOverlays;
|
|
17
|
-
showCustomModal(content: ReactElement, size?:
|
|
18
|
-
showModal(props: OverlayContentProps
|
|
26
|
+
showCustomModal(content: React.ReactElement, { size, onClose }?: CustomModalOptions): void;
|
|
27
|
+
showModal({ size, ...props }: OverlayContentProps & {
|
|
28
|
+
size?: ModalSize;
|
|
29
|
+
}): void;
|
|
19
30
|
private showDialog;
|
|
20
31
|
confirm({ confirm, cancel, ...options }: DialogOptions): Promise<boolean>;
|
|
21
32
|
alert({ confirm, showButton, ...options }: AlertOptions): Promise<void>;
|
|
22
33
|
showBottomDialog({ message, cancel, confirm }: BottomDialogOptions): Promise<boolean>;
|
|
23
|
-
showCustomRightPanel(content: ReactElement): void;
|
|
24
|
-
showRightPanel(props: OverlayContentProps
|
|
25
|
-
|
|
26
|
-
|
|
34
|
+
showCustomRightPanel(content: ReactElement, { size, onClose }?: CustomRightPanelOptions): void;
|
|
35
|
+
showRightPanel({ size, ...props }: OverlayContentProps & {
|
|
36
|
+
size?: OverlaySize;
|
|
37
|
+
}): void;
|
|
38
|
+
closeModal(runCloseListener?: boolean): void;
|
|
39
|
+
closeRightPanel(runCloseListener?: boolean): void;
|
|
27
40
|
closeBottomDialog(): void;
|
|
41
|
+
isInsideModal(element: HTMLElement): boolean;
|
|
42
|
+
isInsideRightPanel(element: HTMLElement): boolean;
|
|
28
43
|
showToaster: typeof showReactToaster;
|
|
29
44
|
}
|
|
30
45
|
export declare const overlay: LayoutOverlayManager;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LayoutOverlayManager.d.ts","sourceRoot":"","sources":["../src/LayoutOverlayManager.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAA6B,MAAM,OAAO,CAAA;AAC/D,OAAO,EAAU,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAC3D,OAAO,EAAkB,mBAAmB,EAAE,MAAM,6BAA6B,CAAA;
|
|
1
|
+
{"version":3,"file":"LayoutOverlayManager.d.ts","sourceRoot":"","sources":["../src/LayoutOverlayManager.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAA6B,MAAM,OAAO,CAAA;AAC/D,OAAO,EAAU,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAC3D,OAAO,EAAkB,mBAAmB,EAAE,MAAM,6BAA6B,CAAA;AAGjF,OAAO,EAAE,WAAW,IAAI,gBAAgB,EAAE,MAAM,WAAW,CAAA;AAG3D,UAAU,YAAa,SAAQ,IAAI,CAAC,aAAa,EAAE,QAAQ,CAAC;IAC1D,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,KAAK,mBAAmB,GAAG,IAAI,CAAC,aAAa,EAAE,OAAO,CAAC,CAAA;AACvD,KAAK,WAAW,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAA;AAC/C,KAAK,SAAS,GAAG,aAAa,GAAG,WAAW,CAAA;AAiB5C,UAAU,kBAAkB;IAC1B,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,UAAU,uBAAuB;IAC/B,IAA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B,CAAC,OAAO,EAAE,WAAW;IAIvC,WAAW,0BAAmB;CAC/B;AAED,eAAO,MAAM,OAAO,sBAA6B,CAAA"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
/* eslint-disable react-hooks/rules-of-hooks */
|
|
3
|
-
import { Button
|
|
3
|
+
import { Button } from '@citric/core';
|
|
4
4
|
import { useLayoutEffect, useState } from 'react';
|
|
5
5
|
import { Dialog } from './components/Dialog';
|
|
6
6
|
import { OverlayContent } from './components/OverlayContent';
|
|
7
|
+
import { getDictionary } from './dictionary';
|
|
7
8
|
import { ElementNotFound, LayoutError } from './errors';
|
|
8
9
|
import { showToaster as showReactToaster } from './toaster';
|
|
9
10
|
import { valueOfLayoutVar } from './utils';
|
|
@@ -66,39 +67,40 @@ class LayoutOverlayManager {
|
|
|
66
67
|
this.setContent.bottomDialog = setBottomDialog;
|
|
67
68
|
return { modal, rightPanel, bottomDialog };
|
|
68
69
|
}
|
|
69
|
-
showCustomModal(content, size = 'medium') {
|
|
70
|
+
showCustomModal(content, { size = 'medium', onClose } = {}) {
|
|
70
71
|
if (!this.elements?.modal)
|
|
71
72
|
throw new ElementNotFound('modal', MODAL_ID);
|
|
72
73
|
if (!this.setContent.modal)
|
|
73
74
|
throw new LayoutError('unable to show modal, because it has not been setup yet.');
|
|
75
|
+
this.onModalClose = onClose;
|
|
74
76
|
this.setContent.modal(content);
|
|
75
77
|
this.elements.backdrop?.setAttribute('class', 'visible');
|
|
76
78
|
this.elements.modal.setAttribute('class', `visible ${size}`);
|
|
77
79
|
}
|
|
78
|
-
showModal(props) {
|
|
79
|
-
this.
|
|
80
|
-
this.showCustomModal(_jsx(OverlayContent, { ...props, onClose: () => this.closeModal(), type: "modal" }));
|
|
80
|
+
showModal({ size, ...props }) {
|
|
81
|
+
this.showCustomModal(_jsx(OverlayContent, { ...props, onClose: () => this.closeModal(), type: "modal" }), { size, onClose: props.onClose });
|
|
81
82
|
}
|
|
82
83
|
showDialog(options) {
|
|
83
84
|
let dialogResult = false;
|
|
84
85
|
return new Promise((resolve, reject) => {
|
|
85
|
-
this.onModalClose = () => resolve(dialogResult);
|
|
86
86
|
try {
|
|
87
87
|
this.showCustomModal(_jsx(Dialog, { ...options, onCancel: () => this.closeModal(), onConfirm: () => {
|
|
88
88
|
dialogResult = true;
|
|
89
89
|
this.closeModal();
|
|
90
|
-
} }), 'small');
|
|
90
|
+
} }), { size: 'small', onClose: () => resolve(dialogResult) });
|
|
91
91
|
}
|
|
92
92
|
catch (error) {
|
|
93
93
|
reject(error);
|
|
94
94
|
}
|
|
95
95
|
});
|
|
96
96
|
}
|
|
97
|
-
confirm({ confirm
|
|
98
|
-
|
|
97
|
+
confirm({ confirm, cancel, ...options }) {
|
|
98
|
+
const t = getDictionary();
|
|
99
|
+
return this.showDialog({ ...options, confirm: confirm || t.confirm, cancel: cancel || t.cancel });
|
|
99
100
|
}
|
|
100
|
-
async alert({ confirm
|
|
101
|
-
|
|
101
|
+
async alert({ confirm, showButton = true, ...options }) {
|
|
102
|
+
const t = getDictionary();
|
|
103
|
+
await this.showDialog({ ...options, confirm: showButton ? (confirm || t.confirm) : undefined });
|
|
102
104
|
}
|
|
103
105
|
showBottomDialog({ message, cancel, confirm }) {
|
|
104
106
|
if (!this.elements?.bottomDialog)
|
|
@@ -106,30 +108,27 @@ class LayoutOverlayManager {
|
|
|
106
108
|
if (!this.setContent.bottomDialog)
|
|
107
109
|
throw new LayoutError('unable to show bottom dialog, because it has not been setup yet.');
|
|
108
110
|
return new Promise((resolve) => {
|
|
109
|
-
this.setContent.bottomDialog(_jsxs(
|
|
111
|
+
this.setContent.bottomDialog?.(_jsxs(_Fragment, { children: [message, _jsxs("div", { className: "btn-group", children: [cancel && _jsx(Button, { onClick: () => resolve(false), colorScheme: "light", appearance: "outlined", children: cancel }), confirm && _jsx(Button, { onClick: () => resolve(true), colorScheme: "light", children: confirm })] })] }));
|
|
110
112
|
this.elements?.bottomDialog?.setAttribute('class', 'visible');
|
|
111
113
|
});
|
|
112
114
|
}
|
|
113
|
-
showCustomRightPanel(content) {
|
|
115
|
+
showCustomRightPanel(content, { size = 'medium', onClose } = {}) {
|
|
114
116
|
if (!this.elements?.rightPanel)
|
|
115
117
|
throw new ElementNotFound('right panel overlay', RIGHT_PANEL_ID);
|
|
116
118
|
if (!this.setContent.rightPanel)
|
|
117
119
|
throw new LayoutError('unable to show right panel overlay, because it has not been setup yet.');
|
|
120
|
+
this.onModalClose = onClose;
|
|
118
121
|
this.setContent.rightPanel(content);
|
|
119
|
-
this.elements?.rightPanel.
|
|
122
|
+
this.elements?.rightPanel.classList.add(size);
|
|
123
|
+
setTimeout(() => this.elements?.rightPanel?.classList?.add('visible'));
|
|
120
124
|
}
|
|
121
|
-
showRightPanel(props) {
|
|
122
|
-
|
|
123
|
-
this.closeRightPanel();
|
|
124
|
-
if (props.onClose)
|
|
125
|
-
props.onClose();
|
|
126
|
-
};
|
|
127
|
-
this.showCustomRightPanel(_jsx(OverlayContent, { ...props, onClose: onClose, type: "panel" }));
|
|
125
|
+
showRightPanel({ size, ...props }) {
|
|
126
|
+
this.showCustomRightPanel(_jsx(OverlayContent, { ...props, onClose: () => this.closeRightPanel(), type: "panel" }), { size, onClose: props.onClose });
|
|
128
127
|
}
|
|
129
|
-
closeModal() {
|
|
128
|
+
closeModal(runCloseListener = true) {
|
|
130
129
|
this.elements?.modal?.classList.remove('visible');
|
|
131
130
|
this.elements?.backdrop?.setAttribute('class', '');
|
|
132
|
-
if (this.onModalClose) {
|
|
131
|
+
if (runCloseListener && this.onModalClose) {
|
|
133
132
|
this.onModalClose();
|
|
134
133
|
this.onModalClose = undefined;
|
|
135
134
|
}
|
|
@@ -139,16 +138,27 @@ class LayoutOverlayManager {
|
|
|
139
138
|
this.elements?.modal?.setAttribute('class', '');
|
|
140
139
|
}, parseFloat(valueOfLayoutVar('--modal-animation-duration')) * 1000);
|
|
141
140
|
}
|
|
142
|
-
closeRightPanel() {
|
|
143
|
-
this.elements?.rightPanel?.
|
|
141
|
+
closeRightPanel(runCloseListener = true) {
|
|
142
|
+
this.elements?.rightPanel?.classList.remove('visible');
|
|
143
|
+
if (runCloseListener && this.onModalClose) {
|
|
144
|
+
this.onModalClose();
|
|
145
|
+
this.onModalClose = undefined;
|
|
146
|
+
}
|
|
144
147
|
setTimeout(() => {
|
|
145
148
|
if (this.setContent.rightPanel)
|
|
146
149
|
this.setContent.rightPanel(undefined);
|
|
150
|
+
this.elements?.rightPanel?.removeAttribute('class');
|
|
147
151
|
}, parseFloat(valueOfLayoutVar('--right-panel-animation-duration')) * 1000);
|
|
148
152
|
}
|
|
149
153
|
closeBottomDialog() {
|
|
150
154
|
this.elements?.bottomDialog?.setAttribute('class', '');
|
|
151
155
|
}
|
|
156
|
+
isInsideModal(element) {
|
|
157
|
+
return !!this.elements?.modal?.contains(element);
|
|
158
|
+
}
|
|
159
|
+
isInsideRightPanel(element) {
|
|
160
|
+
return !!this.elements?.rightPanel?.contains(element);
|
|
161
|
+
}
|
|
152
162
|
}
|
|
153
163
|
export const overlay = new LayoutOverlayManager();
|
|
154
164
|
//# sourceMappingURL=LayoutOverlayManager.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LayoutOverlayManager.js","sourceRoot":"","sources":["../src/LayoutOverlayManager.tsx"],"names":[],"mappings":";AAAA,+CAA+C;AAE/C,OAAO,EAAE,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"LayoutOverlayManager.js","sourceRoot":"","sources":["../src/LayoutOverlayManager.tsx"],"names":[],"mappings":";AAAA,+CAA+C;AAE/C,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AACrC,OAAO,EAAgB,eAAe,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAC/D,OAAO,EAAE,MAAM,EAAiB,M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?: false | string | Validation;
|
|
14
|
+
/**
|
|
15
|
+
* @default modal
|
|
16
|
+
*/
|
|
17
|
+
type?: 'modal' | 'panel';
|
|
18
|
+
/**
|
|
19
|
+
* @default right if type is "panel", "right" otherwise.
|
|
20
|
+
*/
|
|
21
|
+
buttonPlacement?: 'left' | 'center' | 'right';
|
|
14
22
|
}
|
|
15
23
|
interface Props extends DialogOptions {
|
|
16
24
|
onConfirm: () => void;
|
|
17
25
|
onCancel: () => void;
|
|
18
26
|
}
|
|
19
|
-
export declare const Dialog: ({ message, title, subtitle, cancel, confirm, validation, onConfirm, onCancel }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
27
|
+
export declare const Dialog: ({ message, title, subtitle, cancel, confirm, validation, onConfirm, onCancel, type, buttonPlacement, }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
20
28
|
export {};
|
|
21
29
|
//# sourceMappingURL=Dialog.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dialog.d.ts","sourceRoot":"","sources":["../../src/components/Dialog.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Dialog.d.ts","sourceRoot":"","sources":["../../src/components/Dialog.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAY,MAAM,OAAO,CAAA;AAI3C,UAAU,UAAU;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,SAAS,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,KAAK,GAAG,MAAM,GAAG,UAAU,CAAC;IACzC;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC;IACzB;;OAEG;IACH,eAAe,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAC;CAC/C;AAED,UAAU,KAAM,SAAQ,aAAa;IACnC,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,QAAQ,EAAE,MAAM,IAAI,CAAC;CACtB;AAQD,eAAO,MAAM,MAAM,2GAWhB,KAAK,4CAkCP,CAAA"}
|
|
@@ -1,19 +1,27 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Button, Flex, Input, Text } from '@citric/core';
|
|
3
|
+
import { interpolate } from '@stack-spot/portal-translate';
|
|
3
4
|
import { useState } from 'react';
|
|
5
|
+
import { useDictionary } from '../dictionary';
|
|
4
6
|
import { OverlayContent } from './OverlayContent';
|
|
5
|
-
|
|
7
|
+
const justifyButtons = {
|
|
8
|
+
center: 'center',
|
|
9
|
+
left: 'start',
|
|
10
|
+
right: 'end',
|
|
11
|
+
};
|
|
12
|
+
export const Dialog = ({ message, title, subtitle, cancel, confirm, validation, onConfirm, onCancel, type = 'modal', buttonPlacement = type === 'panel' ? 'left' : 'right', }) => {
|
|
13
|
+
const t = useDictionary();
|
|
6
14
|
const [enabled, setEnabled] = useState(!validation);
|
|
7
15
|
function renderValidation() {
|
|
8
16
|
if (!validation)
|
|
9
17
|
return null;
|
|
10
|
-
const value = typeof validation === 'string' ? validation : validation.
|
|
18
|
+
const value = typeof validation === 'string' ? validation : validation.value;
|
|
11
19
|
const label = typeof validation === 'object' && validation.label
|
|
12
20
|
? validation.label
|
|
13
|
-
:
|
|
21
|
+
: interpolate(t.validationLabel, value);
|
|
14
22
|
const placeholder = typeof validation === 'object' ? validation.placeholder : undefined;
|
|
15
23
|
return (_jsxs("div", { style: { margin: '16px 0' }, children: [_jsx(Text, { children: label }), _jsx(Input, { placeholder: placeholder, onChange: e => setEnabled(e.target.value === value), style: { marginTop: '10px' } })] }));
|
|
16
24
|
}
|
|
17
|
-
return (_jsxs(OverlayContent, { title: title, subtitle: subtitle, onClose: onCancel, type: "
|
|
25
|
+
return (_jsxs(OverlayContent, { title: title, subtitle: subtitle, onClose: onCancel, type: type, children: [_jsxs(Flex, { flexDirection: "column", flex: 1, children: [message, renderValidation()] }), (cancel || confirm) && _jsxs(Flex, { gap: true, justifyContent: justifyButtons[buttonPlacement], alignItems: "center", sx: { mt: 6 }, children: [cancel && _jsx(Button, { appearance: "outlined", colorScheme: "inverse", onClick: onCancel, children: cancel }), confirm && _jsx(Button, { colorScheme: "primary", onClick: onConfirm, disabled: !enabled, children: confirm })] })] }));
|
|
18
26
|
};
|
|
19
27
|
//# sourceMappingURL=Dialog.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dialog.js","sourceRoot":"","sources":["../../src/components/Dialog.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AACxD,OAAO,EAAa,QAAQ,EAAE,MAAM,OAAO,CAAA;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;
|
|
1
|
+
{"version":3,"file":"Dialog.js","sourceRoot":"","sources":["../../src/components/Dialog.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAA;AAC1D,OAAO,EAAa,QAAQ,EAAE,MAAM,OAAO,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AA8BjD,MAAM,cAAc,GAA8F;IAChH,MAAM,EAAE,QAAQ;IAChB,IAAI,EAAE,OAAO;IACb,KAAK,EAAE,KAAK;CACb,CAAA;AAED,MAAM,CAAC,MAAM,MAAM,GAA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EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,aAC7E,MAAC,IAAI,IAAC,aAAa,EAAC,QAAQ,EAAC,IAAI,EAAE,CAAC,aACjC,OAAO,EACP,gBAAgB,EAAE,IACd,EACN,CAAC,MAAM,IAAI,OAAO,CAAC,IAAI,MAAC,IAAI,IAAC,GAAG,QAAC,cAAc,EAAE,cAAc,CAAC,eAAe,CAAC,EAAE,UAAU,EAAC,QAAQ,EAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,aACjH,MAAM,IAAI,KAAC,MAAM,IAAC,UAAU,EAAC,UAAU,EAAC,WAAW,EAAC,SAAS,EAAC,OAAO,EAAE,QAAQ,YAAG,MAAM,GAAU,EAClG,OAAO,IAAI,KAAC,MAAM,IAAC,WAAW,EAAC,SAAS,EAAC,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC,OAAO,YAC7E,OAAO,GACD,IACJ,IACQ,CAClB,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -2,11 +2,12 @@ import { ReactNode } from 'react';
|
|
|
2
2
|
import { SelectionListProps } from './SelectionList';
|
|
3
3
|
export interface HeaderProps {
|
|
4
4
|
logo?: ReactNode;
|
|
5
|
+
logoHref?: string;
|
|
5
6
|
userName?: string;
|
|
6
7
|
email?: string;
|
|
7
8
|
options?: SelectionListProps['items'];
|
|
8
9
|
center?: ReactNode;
|
|
9
10
|
right?: ReactNode;
|
|
10
11
|
}
|
|
11
|
-
export declare const Header: ({ logo, center, right, userName, email, options }: HeaderProps) => import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export declare const Header: ({ logo, logoHref, center, right, userName, email, options }: HeaderProps) => import("react/jsx-runtime").JSX.Element;
|
|
12
13
|
//# sourceMappingURL=Header.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Header.d.ts","sourceRoot":"","sources":["../../src/components/Header.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEjC,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAA;AAGpD,MAAM,WAAW,WAAW;IAC1B,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,kBAAkB,CAAC,OAAO,CAAC,CAAC;IACtC,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,KAAK,CAAC,EAAE,SAAS,CAAC;CACnB;AAED,eAAO,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"Header.d.ts","sourceRoot":"","sources":["../../src/components/Header.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEjC,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAA;AAGpD,MAAM,WAAW,WAAW;IAC1B,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,kBAAkB,CAAC,OAAO,CAAC,CAAC;IACtC,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,KAAK,CAAC,EAAE,SAAS,CAAC;CACnB;AAED,eAAO,MAAM,MAAM,gEAAiE,WAAW,4CAO9F,CAAA"}
|
|
@@ -2,5 +2,5 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
|
|
|
2
2
|
import { Flex } from '@citric/core';
|
|
3
3
|
import { StackspotLogo } from './Logo';
|
|
4
4
|
import { UserMenu } from './UserMenu';
|
|
5
|
-
export const Header = ({ logo, center, right, userName, email, options }) => (_jsxs(_Fragment, { children: [
|
|
5
|
+
export const Header = ({ logo, logoHref, center, right, userName, email, options }) => (_jsxs(_Fragment, { children: [_jsx("a", { href: logoHref, title: "Home", children: logo ?? _jsx(StackspotLogo, { style: { width: 130 } }) }), _jsx(Flex, { flex: 1, children: center }), right, userName && _jsx(UserMenu, { userName: userName, email: email, options: options })] }));
|
|
6
6
|
//# sourceMappingURL=Header.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Header.js","sourceRoot":"","sources":["../../src/components/Header.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAEnC,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAA;AAEtC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"Header.js","sourceRoot":"","sources":["../../src/components/Header.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAEnC,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAA;AAEtC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAYrC,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAe,EAAE,EAAE,CAAC,CAClG,8BACE,YAAG,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAC,MAAM,YAAE,IAAI,IAAI,KAAC,aAAa,IAAC,KAAK,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,GAAI,GAAK,EACtF,KAAC,IAAI,IAAC,IAAI,EAAE,CAAC,YAAG,MAAM,GAAQ,EAC7B,KAAK,EACL,QAAQ,IAAI,KAAC,QAAQ,IAAC,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,GAAI,IAC5E,CACJ,CAAA"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { MenuSectionContent } from './types';
|
|
2
|
-
export declare const MenuContent: ({ pageSelector, goBack, title, subtitle, options }: MenuSectionContent) => import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare const MenuContent: ({ pageSelector, goBack, title, subtitle, options, loading, error }: MenuSectionContent) => import("react/jsx-runtime").JSX.Element;
|
|
3
3
|
//# sourceMappingURL=MenuContent.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MenuContent.d.ts","sourceRoot":"","sources":["../../../src/components/Menu/MenuContent.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"MenuContent.d.ts","sourceRoot":"","sources":["../../../src/components/Menu/MenuContent.tsx"],"names":[],"mappings":"AAUA,OAAO,EAAmC,kBAAkB,EAAE,MAAM,SAAS,CAAA;AAiL7E,eAAO,MAAM,WAAW,uEAA6E,kBAAkB,4CAmCtH,CAAA"}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
3
|
-
import { IconBox, Text } from '@citric/core';
|
|
3
|
+
import { Flex, IconBox, Text } from '@citric/core';
|
|
4
4
|
import { ArrowLeft, ChevronDown } from '@citric/icons';
|
|
5
|
+
import { LoadingCircular } from '@citric/ui';
|
|
5
6
|
import { listToClass, theme } from '@stack-spot/portal-theme';
|
|
6
7
|
import { useMemo, useState } from 'react';
|
|
7
8
|
import { styled } from 'styled-components';
|
|
9
|
+
import { hideOverlayImmediately } from './MenuSections';
|
|
8
10
|
import { PageSelector } from './PageSelector';
|
|
9
11
|
import { MENU_CONTENT_ITEM_PADDING as ITEM_PADDING, MENU_CONTENT_PADDING as PADDING } from './constants';
|
|
10
12
|
const BackLink = styled.a `
|
|
@@ -24,16 +26,34 @@ const MenuGroup = styled.ul `
|
|
|
24
26
|
padding: 0;
|
|
25
27
|
}
|
|
26
28
|
|
|
29
|
+
.item-row {
|
|
30
|
+
display: flex;
|
|
31
|
+
flex-direction: row;
|
|
32
|
+
gap: 8px;
|
|
33
|
+
align-items: center;
|
|
34
|
+
|
|
35
|
+
.label {
|
|
36
|
+
flex: 1;
|
|
37
|
+
&.hidden, &.ellipsis {
|
|
38
|
+
white-space: nowrap;
|
|
39
|
+
overflow: hidden;
|
|
40
|
+
}
|
|
41
|
+
&.ellipsis {
|
|
42
|
+
text-overflow: ellipsis;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
27
47
|
li a {
|
|
28
48
|
position: relative;
|
|
29
49
|
height: 0;
|
|
30
50
|
overflow: hidden;
|
|
31
|
-
display: flex;
|
|
32
|
-
align-items: center;
|
|
51
|
+
/* display: flex; */
|
|
52
|
+
/* align-items: center; */
|
|
33
53
|
transition: height 0.3s, background-color 0.2s;
|
|
34
54
|
margin: 0 ${PADDING - ITEM_PADDING}px;
|
|
35
55
|
border-radius: 4px;
|
|
36
|
-
justify-content: space-between;
|
|
56
|
+
/* justify-content: space-between; */
|
|
37
57
|
padding: 0 ${ITEM_PADDING}px;
|
|
38
58
|
|
|
39
59
|
&:hover {
|
|
@@ -105,22 +125,36 @@ const Title = styled.header `
|
|
|
105
125
|
flex-direction: column;
|
|
106
126
|
margin: ${PADDING}px 0 24px ${PADDING}px;
|
|
107
127
|
`;
|
|
108
|
-
const ActionItem = ({ label, onClick, href, active }) => (
|
|
109
|
-
|
|
128
|
+
const ActionItem = ({ label, onClick, href, active, icon, badge, overflow = 'wrap' }) => (_jsxs("a", { href: active ? undefined : href, onClick: () => {
|
|
129
|
+
if (active)
|
|
130
|
+
return;
|
|
131
|
+
if (onClick)
|
|
132
|
+
onClick();
|
|
133
|
+
hideOverlayImmediately();
|
|
134
|
+
}, className: listToClass(['action', 'item-row', active ? 'active' : undefined]), children: [icon, _jsx(Text, { appearance: "body2", className: `label ${overflow}`, children: label }), badge] }));
|
|
135
|
+
const CollapsibleGroupItem = ({ label, open: initiallyOpened, children, icon, badge, overflow = 'wrap' }) => {
|
|
110
136
|
const [open, setOpen] = useState(initiallyOpened ?? children?.some(c => 'active' in c && c.active) ?? false);
|
|
111
137
|
const items = useMemo(() => children?.map(renderOption), [children]);
|
|
112
|
-
return (_jsxs(_Fragment, { children: [_jsxs("a", { onClick: () => setOpen(!open), children: [_jsx(Text, { appearance: "body2", children: label }), _jsx(IconBox, { children: _jsx(ChevronDown, { className: listToClass(['chevron', open ? 'open' : '']) }) })] }), _jsx(MenuGroup, { className: open ? 'open' : undefined, children: items })] }));
|
|
138
|
+
return (_jsxs(_Fragment, { children: [_jsxs("a", { onClick: () => setOpen(!open), className: "item-row", children: [icon, _jsx(Text, { appearance: "body2", className: `label ${overflow}`, children: label }), badge, _jsx(IconBox, { children: _jsx(ChevronDown, { className: listToClass(['chevron', open ? 'open' : '']) }) })] }), _jsx(MenuGroup, { className: open ? 'open' : undefined, children: items })] }));
|
|
113
139
|
};
|
|
114
|
-
const RootGroupItem = ({ label, children }) => {
|
|
115
|
-
const items = useMemo(() => children?.map(renderOption), [children]);
|
|
116
|
-
return (_jsxs(_Fragment, { children: [_jsx(Text, { appearance: "overheader2", colorScheme: "light.700", className:
|
|
140
|
+
const RootGroupItem = ({ label, children, icon, badge, overflow = 'wrap' }) => {
|
|
141
|
+
const items = useMemo(() => children?.filter(i => !i.hidden).map(renderOption), [children]);
|
|
142
|
+
return (_jsxs(_Fragment, { children: [_jsxs("div", { className: "item-row", children: [icon, _jsx(Text, { appearance: "overheader2", colorScheme: "light.700", className: `group-title label ${overflow}`, children: label }), badge] }), _jsx(MenuGroup, { className: "open no-indentation", children: items })] }));
|
|
117
143
|
};
|
|
118
144
|
const GroupItem = ({ root, ...item }) => (root ? _jsx(RootGroupItem, { ...item }) : _jsx(CollapsibleGroupItem, { ...item }));
|
|
119
145
|
function renderOption({ root, ...option }) {
|
|
120
146
|
return _jsx("li", { children: 'children' in option ? _jsx(GroupItem, { root: root, ...option }) : _jsx(ActionItem, { ...option }) }, option.label);
|
|
121
147
|
}
|
|
122
|
-
export const MenuContent = ({ pageSelector, goBack, title, subtitle, options = [] }) => {
|
|
148
|
+
export const MenuContent = ({ pageSelector, goBack, title, subtitle, options = [], loading, error }) => {
|
|
123
149
|
const items = useMemo(() => options.filter(o => !o.hidden).map(o => renderOption({ ...o, root: true })), [options]);
|
|
124
|
-
|
|
150
|
+
function renderContent() {
|
|
151
|
+
if (loading) {
|
|
152
|
+
return (_jsx(Flex, { justifyContent: "center", alignItems: "center", flex: 1, sx: { padding: '40px' }, children: _jsx(LoadingCircular, {}) }));
|
|
153
|
+
}
|
|
154
|
+
if (error)
|
|
155
|
+
return _jsx(Text, { colorScheme: "danger", children: error });
|
|
156
|
+
return _jsx(MenuGroup, { className: "open root no-indentation", children: items });
|
|
157
|
+
}
|
|
158
|
+
return (_jsxs(_Fragment, { children: [goBack && (_jsxs(BackLink, { href: goBack.href, onClick: goBack.onClick, children: [_jsx(IconBox, { colorScheme: "inverse", size: "sm", children: _jsx(ArrowLeft, {}) }), _jsx(Text, { appearance: "body2", nowrapEllipsis: true, children: goBack.label })] })), title && (_jsxs(Title, { children: [_jsx(Text, { appearance: "overheader1", colorScheme: "primary", sx: { fontSize: '0.75rem', mt: 2, mb: 2 }, children: title }), subtitle && _jsx(Text, { appearance: "h5", children: subtitle })] })), pageSelector && _jsx(PageSelector, { ...pageSelector }), renderContent()] }));
|
|
125
159
|
};
|
|
126
160
|
//# sourceMappingURL=MenuContent.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MenuContent.js","sourceRoot":"","sources":["../../../src/components/Menu/MenuContent.tsx"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"MenuContent.js","sourceRoot":"","sources":["../../../src/components/Menu/MenuContent.tsx"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,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AAK,GAAQ,IACpD,CACZ,EACA,KAAK,IAAI,CACR,MAAC,KAAK,eACJ,KAAC,IAAI,IAAC,UAAU,EAAC,aAAa,EAAC,WAAW,EAAC,SAAS,EAAC,EAAE,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,YAAG,KAAK,GAAQ,EAC7G,QAAQ,IAAI,KAAC,IAAI,IAAC,UAAU,EAAC,IAAI,YAAE,QAAQ,GAAQ,IAC9C,CACT,EACA,YAAY,IAAI,KAAC,YAAY,OAAK,YAAY,GAAI,EAClD,aAAa,EAAE,IACf,CACJ,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import { MenuProps } from './types';
|
|
2
|
-
export declare
|
|
2
|
+
export declare function hideOverlayImmediately(): void;
|
|
3
|
+
export declare const MenuSections: ({ sections, ...props }: MenuProps) => import("react/jsx-runtime").JSX.Element;
|
|
3
4
|
//# sourceMappingURL=MenuSections.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MenuSections.d.ts","sourceRoot":"","sources":["../../../src/components/Menu/MenuSections.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,SAAS,
|
|
1
|
+
{"version":3,"file":"MenuSections.d.ts","sourceRoot":"","sources":["../../../src/components/Menu/MenuSections.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,SAAS,EAAe,MAAM,SAAS,CAAA;AAchD,wBAAgB,sBAAsB,SAErC;AA8ED,eAAO,MAAM,YAAY,2BAA4B,SAAS,4CAiD7D,CAAA"}
|