elbe-ui 0.4.26 → 1.0.2
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/README.md +1 -1
- package/dist/bit/_bit_provider.d.ts +1 -1
- package/dist/bit/_bit_provider.js +11 -6
- package/dist/bit/_bit_utils.d.ts +5 -1
- package/dist/bit/bit.d.ts +2 -2
- package/dist/bit/bit.js +2 -2
- package/dist/elbe.css +97 -61
- package/dist/elbe.css.map +1 -1
- package/dist/index.d.ts +1529 -1527
- package/dist/index.js +3 -2
- package/dist/ui/components/badge.d.ts +7 -7
- package/dist/ui/components/badge.js +3 -3
- package/dist/ui/components/banner.d.ts +2 -2
- package/dist/ui/components/banner.js +8 -8
- package/dist/ui/components/base/box.d.ts +4140 -2520
- package/dist/ui/components/base/box.js +4 -4
- package/dist/ui/components/base/card.d.ts +1 -1
- package/dist/ui/components/base/card.js +1 -1
- package/dist/ui/components/base/padded.d.ts +4 -4
- package/dist/ui/components/base/padded.js +2 -2
- package/dist/ui/components/button/button.d.ts +10 -9
- package/dist/ui/components/button/button.js +15 -13
- package/dist/ui/components/button/choose_button.d.ts +2 -2
- package/dist/ui/components/button/choose_button.js +5 -4
- package/dist/ui/components/button/icon_button.d.ts +9 -8
- package/dist/ui/components/button/icon_button.js +16 -4
- package/dist/ui/components/button/toggle_button.d.ts +2 -2
- package/dist/ui/components/button/toggle_button.js +8 -4
- package/dist/ui/components/dev/todo.d.ts +4 -4
- package/dist/ui/components/dev/todo.js +2 -2
- package/dist/ui/components/dialog.d.ts +4 -3
- package/dist/ui/components/dialog.js +21 -4
- package/dist/ui/components/error_view.d.ts +2 -2
- package/dist/ui/components/error_view.js +12 -8
- package/dist/ui/components/footer.d.ts +3 -3
- package/dist/ui/components/footer.js +3 -3
- package/dist/ui/components/input/checkbox.d.ts +1 -1
- package/dist/ui/components/input/checkbox.js +5 -5
- package/dist/ui/components/input/range.d.ts +1 -1
- package/dist/ui/components/input/range.js +1 -1
- package/dist/ui/components/input/select.d.ts +1 -1
- package/dist/ui/components/input/select.js +2 -2
- package/dist/ui/components/input/switch.d.ts +1 -1
- package/dist/ui/components/input/switch.js +1 -1
- package/dist/ui/components/input/text/input_field.d.ts +9 -9
- package/dist/ui/components/input/text/input_field.js +7 -7
- package/dist/ui/components/input/text/multi_line.d.ts +1 -1
- package/dist/ui/components/input/text/multi_line.js +3 -3
- package/dist/ui/components/input/text/single_line.d.ts +1 -1
- package/dist/ui/components/input/text/single_line.js +4 -4
- package/dist/ui/components/layout/alignment.d.ts +3 -2
- package/dist/ui/components/layout/alignment.js +2 -2
- package/dist/ui/components/layout/app_base.d.ts +1 -1
- package/dist/ui/components/layout/app_base.js +33 -9
- package/dist/ui/components/layout/ctx_app_base.d.ts +8 -3
- package/dist/ui/components/layout/ctx_app_base.js +1 -2
- package/dist/ui/components/layout/flex.d.ts +3 -3
- package/dist/ui/components/layout/flex.js +5 -5
- package/dist/ui/components/layout/header.d.ts +5 -8
- package/dist/ui/components/layout/header.js +11 -13
- package/dist/ui/components/layout/menu.d.ts +1 -1
- package/dist/ui/components/layout/menu.js +6 -6
- package/dist/ui/components/layout/page.d.ts +3 -1
- package/dist/ui/components/layout/page.js +14 -12
- package/dist/ui/components/layout/scroll.d.ts +4 -4
- package/dist/ui/components/layout/scroll.js +3 -3
- package/dist/ui/components/layout/spaced.d.ts +1 -1
- package/dist/ui/components/layout/spaced.js +1 -1
- package/dist/ui/components/layout/toolbar.d.ts +2 -2
- package/dist/ui/components/layout/toolbar.js +4 -6
- package/dist/ui/components/link.d.ts +1 -1
- package/dist/ui/components/link.js +2 -2
- package/dist/ui/components/progress_bar.d.ts +1 -1
- package/dist/ui/components/progress_bar.js +1 -1
- package/dist/ui/components/routing/route.d.ts +8 -8
- package/dist/ui/components/routing/route.js +4 -4
- package/dist/ui/components/spinner.d.ts +4 -4
- package/dist/ui/components/spinner.js +33 -33
- package/dist/ui/components/text.d.ts +15 -15
- package/dist/ui/components/text.js +6 -6
- package/dist/ui/theme/colors.js +0 -1
- package/dist/ui/theme/theme.d.ts +1 -1
- package/dist/ui/theme/theme.js +3 -3
- package/dist/ui/theme/theme_context.d.ts +2 -2
- package/dist/ui/theme/theme_context.js +1 -2
- package/dist/ui/util/ctx_toolbar.d.ts +1 -2
- package/dist/ui/util/ctx_toolbar.js +2 -2
- package/dist/ui/util/error_view.d.ts +1 -1
- package/dist/ui/util/error_view.js +8 -2
- package/dist/ui/util/l10n/_l10n_util.d.ts +1 -1
- package/dist/ui/util/l10n/_l10n_util.js +1 -1
- package/dist/ui/util/l10n/l10n.d.ts +1 -1
- package/dist/ui/util/l10n/l10n.js +2 -2
- package/dist/ui/util/types.d.ts +3 -2
- package/dist/ui/util/util.js +1 -2
- package/package.json +6 -8
|
@@ -9,8 +9,8 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
9
9
|
}
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
|
-
import { jsx as _jsx, jsxs as _jsxs } from "
|
|
13
|
-
import React from "
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import React from "react";
|
|
14
14
|
import { KindAlertIcon, Text } from "../../../..";
|
|
15
15
|
import { randomAlphaNum } from "../../../util/util";
|
|
16
16
|
import { applyProps } from "../../base/box";
|
|
@@ -38,14 +38,14 @@ export class Field extends React.Component {
|
|
|
38
38
|
? this.props.flex === true
|
|
39
39
|
? 1
|
|
40
40
|
: this.props.flex
|
|
41
|
-
:
|
|
42
|
-
width: this.props.flex ?
|
|
41
|
+
: undefined,
|
|
42
|
+
width: this.props.flex ? undefined : ((_b = this.props.width) !== null && _b !== void 0 ? _b : 12) + "rem",
|
|
43
43
|
display: "flex",
|
|
44
44
|
flexDirection: "column",
|
|
45
45
|
alignItems: "stretch",
|
|
46
|
-
filter: this.props.onInput ?
|
|
47
|
-
pointerEvents: this.props.onInput ?
|
|
48
|
-
cursor: this.props.onInput ?
|
|
46
|
+
filter: this.props.onInput ? undefined : "grayscale(1) opacity(0.5)",
|
|
47
|
+
pointerEvents: this.props.onInput ? undefined : "none",
|
|
48
|
+
cursor: this.props.onInput ? undefined : "not-allowed",
|
|
49
49
|
}, "data-tooltip": (_c = this.props) === null || _c === void 0 ? void 0 : _c.tooltip, children: [_jsx("label", { htmlFor: id, style: {
|
|
50
50
|
display: this.props.hideLabel ? "none" : "block",
|
|
51
51
|
fontSize: "0.8rem",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx as _jsx } from "
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { applyProps } from "../../base/box";
|
|
3
3
|
export function _MultiLineField(p) {
|
|
4
4
|
var _a, _b;
|
|
@@ -10,10 +10,10 @@ export function _MultiLineField(p) {
|
|
|
10
10
|
padding: "1rem",
|
|
11
11
|
margin: "0 0",
|
|
12
12
|
resize: p.props.notResizable ? "none" : "vertical",
|
|
13
|
-
}), {
|
|
13
|
+
}), { cols: 5, placeholder: p.props.hint, rows: (_b = p.props.rows) !== null && _b !== void 0 ? _b : 5, maxLength: p.props.maxLength, value: p.props.value, onInput: (e) => {
|
|
14
14
|
var _a, _b;
|
|
15
15
|
e.stopPropagation();
|
|
16
16
|
e.preventDefault();
|
|
17
17
|
(_b = (_a = p.props).onInput) === null || _b === void 0 ? void 0 : _b.call(_a, e.currentTarget.value);
|
|
18
|
-
},
|
|
18
|
+
}, readOnly: p.props.onInput ? false : true })));
|
|
19
19
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { applyProps, Card, IconButton, Row, Spaced, } from "../../../..";
|
|
3
3
|
export function _SingleLineField(p) {
|
|
4
4
|
var _a, _b, _c;
|
|
@@ -9,17 +9,17 @@ export function _SingleLineField(p) {
|
|
|
9
9
|
border: "none",
|
|
10
10
|
outline: "none",
|
|
11
11
|
background: "none",
|
|
12
|
-
}), { size: 5,
|
|
12
|
+
}), { size: 5, placeholder: p.props.hint, value: p.props.value, onInput: (e) => p.props.onInput && p.props.onInput(e.currentTarget.value), readOnly: p.props.onInput ? false : true })), _jsx(_Supplement, { kind: (_c = p.msg) === null || _c === void 0 ? void 0 : _c.kind, trailing: true, icon: p.props.trailing, onTap: p.props.onTrailingTap })] }));
|
|
13
13
|
}
|
|
14
14
|
function _Supplement(p) {
|
|
15
15
|
if (!p.icon)
|
|
16
16
|
return _jsx(Spaced, { width: 0.75 });
|
|
17
17
|
return (_jsx(Card, { sharp: true, padding: 0, style: {
|
|
18
18
|
border: "none",
|
|
19
|
-
background: p.onTap ?
|
|
19
|
+
background: p.onTap ? undefined : "transparent",
|
|
20
20
|
}, children: _jsx(IconButton, { kind: p.kind, manner: p.kind ? "minor" : "plain", ariaLabel: p.trailing ? "trailing icon" : "leading icon", icon: p.icon, style: {
|
|
21
21
|
borderRadius: 0,
|
|
22
|
-
background: p.onTap ?
|
|
22
|
+
background: p.onTap ? undefined : "transparent",
|
|
23
23
|
}, onTap: (e) => {
|
|
24
24
|
var _a;
|
|
25
25
|
e.stopPropagation();
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ElbeChildren } from "../../util/types";
|
|
1
2
|
export type Alignment = "start_start" | "start_center" | "start_end" | "center_start" | "center" | "center_end" | "end_start" | "end_center" | "end_end";
|
|
2
3
|
export declare function Align({ alignment, height, width, size, class: className, children, }: {
|
|
3
4
|
alignment?: Alignment;
|
|
@@ -5,5 +6,5 @@ export declare function Align({ alignment, height, width, size, class: className
|
|
|
5
6
|
width?: string | number;
|
|
6
7
|
size?: string | number;
|
|
7
8
|
class?: string;
|
|
8
|
-
children:
|
|
9
|
-
}): import("
|
|
9
|
+
children: ElbeChildren;
|
|
10
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx as _jsx } from "
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Column } from "./flex";
|
|
3
3
|
export function Align({ alignment = "center", height, width, size, class: className, children, }) {
|
|
4
4
|
var _a, _b;
|
|
@@ -9,5 +9,5 @@ export function Align({ alignment = "center", height, width, size, class: classN
|
|
|
9
9
|
width = `${width}rem`;
|
|
10
10
|
if (typeof size === "number")
|
|
11
11
|
size = `${size}rem`;
|
|
12
|
-
return (_jsx(Column, {
|
|
12
|
+
return (_jsx(Column, { className: className, cross: (_a = cross) !== null && _a !== void 0 ? _a : "center", style: { height: height !== null && height !== void 0 ? height : size, width: width !== null && width !== void 0 ? width : size }, main: (_b = main) !== null && _b !== void 0 ? _b : "center", children: children }));
|
|
13
13
|
}
|
|
@@ -12,4 +12,4 @@ export type AppBaseProps = HeaderLogos & {
|
|
|
12
12
|
*
|
|
13
13
|
* Provide `wouter.Route` or `MenuRoute` components as children to define the routes and menu items.
|
|
14
14
|
*/
|
|
15
|
-
export declare function AppBase(p: AppBaseProps): import("
|
|
15
|
+
export declare function AppBase(p: AppBaseProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "
|
|
2
|
-
import { useMemo, useState } from "
|
|
3
|
-
import {
|
|
4
|
-
import { useHashLocation } from "wouter/use-hash-location";
|
|
5
|
-
import { Box, isMenuRoute, wouter, } from "../../..";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo, useState } from "react";
|
|
3
|
+
import { Box, isMenuRoute, Wouter, } from "../../..";
|
|
6
4
|
import { AppBaseContext } from "./ctx_app_base";
|
|
7
5
|
import { Menu } from "./menu";
|
|
8
6
|
/**
|
|
@@ -14,7 +12,10 @@ import { Menu } from "./menu";
|
|
|
14
12
|
* Provide `wouter.Route` or `MenuRoute` components as children to define the routes and menu items.
|
|
15
13
|
*/
|
|
16
14
|
export function AppBase(p) {
|
|
17
|
-
return
|
|
15
|
+
return _jsx(Wouter.Router, { children: _jsx(_AppBase, Object.assign({}, p)) });
|
|
16
|
+
}
|
|
17
|
+
function _initialLocation() {
|
|
18
|
+
return (window.location.pathname + window.location.search + window.location.hash);
|
|
18
19
|
}
|
|
19
20
|
function _AppBase(p) {
|
|
20
21
|
var _a;
|
|
@@ -22,7 +23,8 @@ function _AppBase(p) {
|
|
|
22
23
|
const menuItems = useMemo(() => {
|
|
23
24
|
return _extractMenuItems(p.children);
|
|
24
25
|
}, [p.children]);
|
|
25
|
-
const [location, navigate] =
|
|
26
|
+
const [location, navigate] = Wouter.useLocation();
|
|
27
|
+
const [history, setHistory] = useState([_initialLocation()]);
|
|
26
28
|
return (_jsx(AppBaseContext.Provider, { value: {
|
|
27
29
|
menuOpen: menuOpen,
|
|
28
30
|
icons: {
|
|
@@ -33,12 +35,34 @@ function _AppBase(p) {
|
|
|
33
35
|
},
|
|
34
36
|
globalActions: (_a = p.globalActions) !== null && _a !== void 0 ? _a : [],
|
|
35
37
|
setMenuOpen: (b) => setMenuOpen(b),
|
|
36
|
-
|
|
38
|
+
router: {
|
|
39
|
+
goBack: (steps = 1) => {
|
|
40
|
+
if (history.length === 0)
|
|
41
|
+
return;
|
|
42
|
+
const targetIndex = Math.max(0, history.length - 1 - steps);
|
|
43
|
+
const target = history[targetIndex];
|
|
44
|
+
setHistory((h) => h.slice(0, targetIndex + 1));
|
|
45
|
+
navigate(target, { replace: true });
|
|
46
|
+
},
|
|
47
|
+
go: (p, replace) => {
|
|
48
|
+
setHistory((h) => {
|
|
49
|
+
if (replace === "all")
|
|
50
|
+
return [p];
|
|
51
|
+
const repl = Math.max(0, replace !== null && replace !== void 0 ? replace : 0);
|
|
52
|
+
if (repl === 0)
|
|
53
|
+
return [...h, p];
|
|
54
|
+
return [...h.slice(0, -repl), p];
|
|
55
|
+
});
|
|
56
|
+
navigate(p, { replace: (replace !== null && replace !== void 0 ? replace : 0) !== 0 });
|
|
57
|
+
},
|
|
58
|
+
history: history,
|
|
59
|
+
location: location,
|
|
60
|
+
},
|
|
37
61
|
}, children: _jsxs(Box, { typeLabel: "app_base", scheme: "primary", style: {
|
|
38
62
|
display: "flex",
|
|
39
63
|
width: "100%",
|
|
40
64
|
minHeight: "100vh",
|
|
41
|
-
}, children: [menuItems.length > 0 && _jsx(Menu, { items: menuItems }), _jsx("div", { style: { flex: 1, width: "0px" }, children: _jsx(
|
|
65
|
+
}, children: [menuItems.length > 0 && _jsx(Menu, { items: menuItems }), _jsx("div", { style: { flex: 1, width: "0px" }, children: _jsx(Wouter.Switch, { children: p.children }) })] }) }));
|
|
42
66
|
}
|
|
43
67
|
function _extractMenuItems(children) {
|
|
44
68
|
const childs = Array.isArray(children) ? children : [children];
|
|
@@ -1,14 +1,19 @@
|
|
|
1
|
-
import { ElbeChild } from "../../util/types";
|
|
1
|
+
import { ElbeChild, int } from "../../util/types";
|
|
2
2
|
import { HeaderLogos } from "./header";
|
|
3
3
|
export interface _AppBaseState {
|
|
4
4
|
menuOpen: boolean;
|
|
5
5
|
icons: HeaderLogos;
|
|
6
6
|
globalActions: ElbeChild[];
|
|
7
|
-
|
|
7
|
+
router: {
|
|
8
|
+
go: (path: string, replace?: int | "all") => void;
|
|
9
|
+
goBack: (steps?: number) => void;
|
|
10
|
+
history: string[];
|
|
11
|
+
location: string;
|
|
12
|
+
};
|
|
8
13
|
}
|
|
9
14
|
export interface _AppBaseControl extends _AppBaseState {
|
|
10
15
|
setMenuOpen: (open: boolean) => void;
|
|
11
16
|
}
|
|
12
|
-
export declare const AppBaseContext: import("
|
|
17
|
+
export declare const AppBaseContext: import("react").Context<_AppBaseControl | null>;
|
|
13
18
|
export declare function useAppBase(): _AppBaseControl;
|
|
14
19
|
export declare function maybeAppBase(): _AppBaseControl | null;
|
|
@@ -7,8 +7,8 @@ export type FlexProps = {
|
|
|
7
7
|
main?: "start" | "center" | "end" | "stretch" | "space-between" | "space-around" | "space-evenly";
|
|
8
8
|
cross?: "start" | "center" | "end" | "stretch" | "space-between" | "space-around" | "space-evenly";
|
|
9
9
|
} & ElbeProps;
|
|
10
|
-
export declare function FlexSpace({}: {}): import("
|
|
11
|
-
export declare function Column({ gap, main, cross, children, noScrollbar, scroll, ...p }: FlexProps): import("
|
|
10
|
+
export declare function FlexSpace({}: {}): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export declare function Column({ gap, main, cross, children, noScrollbar, scroll, ...p }: FlexProps): import("react/jsx-runtime").JSX.Element;
|
|
12
12
|
export declare function Row({ gap, main, cross, wrap, children, noScrollbar, scroll, ...p }: FlexProps & {
|
|
13
13
|
wrap?: boolean;
|
|
14
|
-
}): import("
|
|
14
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -9,10 +9,10 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
9
9
|
}
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
|
-
import { jsx as _jsx } from "
|
|
12
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
13
|
import { applyProps } from "../base/box";
|
|
14
14
|
export function FlexSpace({}) {
|
|
15
|
-
return _jsx("div", { style:
|
|
15
|
+
return _jsx("div", { style: { flex: 1 } });
|
|
16
16
|
}
|
|
17
17
|
export function Column(_a) {
|
|
18
18
|
var { gap = 1, main = "start", cross = "stretch", children, noScrollbar = false, scroll = false } = _a, p = __rest(_a, ["gap", "main", "cross", "children", "noScrollbar", "scroll"]);
|
|
@@ -32,8 +32,8 @@ function _Flex(row, p, elbe, wraps) {
|
|
|
32
32
|
justifyContent: p.main,
|
|
33
33
|
alignItems: p.cross,
|
|
34
34
|
gap: `${p.gap}rem`,
|
|
35
|
-
overflowX: !row ?
|
|
36
|
-
overflowY: row ?
|
|
37
|
-
flex: ((_a = p.flex) !== null && _a !== void 0 ? _a : p.scroll) ? 1 :
|
|
35
|
+
overflowX: !row ? undefined : p.scroll ? "auto" : undefined,
|
|
36
|
+
overflowY: row ? undefined : p.scroll ? "auto" : undefined,
|
|
37
|
+
flex: ((_a = p.flex) !== null && _a !== void 0 ? _a : p.scroll) ? 1 : undefined,
|
|
38
38
|
}), { children: p.children })));
|
|
39
39
|
}
|
|
@@ -12,21 +12,18 @@ export type HeaderProps = HeaderLogos & {
|
|
|
12
12
|
actions?: ElbeChild[];
|
|
13
13
|
scheme?: ElbeColorSchemes;
|
|
14
14
|
};
|
|
15
|
-
export declare function Header(p: HeaderProps): import("
|
|
15
|
+
export declare function Header(p: HeaderProps): import("react/jsx-runtime").JSX.Element;
|
|
16
16
|
export declare function _Logo(p: {
|
|
17
17
|
flex?: boolean;
|
|
18
18
|
logo: string | ElbeChild;
|
|
19
19
|
logoDark?: string | ElbeChild | null;
|
|
20
20
|
lMargin?: number;
|
|
21
21
|
rMargin?: number;
|
|
22
|
-
}): import("
|
|
22
|
+
}): import("react/jsx-runtime").JSX.Element | null;
|
|
23
23
|
export declare function BackButton(p: {
|
|
24
|
-
|
|
25
|
-
}): import("
|
|
26
|
-
export declare function CloseButton(p: {
|
|
27
|
-
onTap: () => void;
|
|
28
|
-
}): import("preact").JSX.Element;
|
|
24
|
+
close?: boolean;
|
|
25
|
+
}): import("react/jsx-runtime").JSX.Element | null;
|
|
29
26
|
export declare function _HeaderTitle(p: {
|
|
30
27
|
title: string | ElbeChild;
|
|
31
28
|
center: boolean;
|
|
32
|
-
}): import("
|
|
29
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { ChevronLeft, MenuIcon, XIcon } from "lucide-react";
|
|
3
|
-
import {
|
|
3
|
+
import { useMemo, useState } from "react";
|
|
4
4
|
import { Card, IconButton, Text, useLayoutMode, useSiteScroll, useTheme, useThemeConfig, } from "../../..";
|
|
5
5
|
import { maybeAppBase } from "./ctx_app_base";
|
|
6
6
|
import { _Toolbar } from "./toolbar";
|
|
7
|
-
const _backBtn = _jsx(BackButton, { onTap: () => history.go(-1) });
|
|
8
|
-
const _closeBtn = _jsx(CloseButton, { onTap: () => history.go(-1) });
|
|
9
7
|
export function Header(p) {
|
|
10
8
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
11
9
|
const appBase = maybeAppBase();
|
|
@@ -25,21 +23,21 @@ export function Header(p) {
|
|
|
25
23
|
borderTop: "none",
|
|
26
24
|
borderLeft: "none",
|
|
27
25
|
borderRight: "none",
|
|
28
|
-
borderColor: tConfig.highVis || scroll ?
|
|
26
|
+
borderColor: tConfig.highVis || scroll ? undefined : "transparent",
|
|
29
27
|
gap: "1rem",
|
|
30
28
|
zIndex: 80,
|
|
31
29
|
}, children: [p.leading && p.leading !== "back" && p.leading !== "close"
|
|
32
30
|
? p.leading
|
|
33
31
|
: appBase &&
|
|
34
|
-
!layoutMode.isWide && (_jsx(IconButton.plain, { ariaLabel: "open/close menu", onTap: () => appBase.setMenuOpen(!appBase.menuOpen), icon: MenuIcon })), p.leading === "back" &&
|
|
32
|
+
!layoutMode.isWide && (_jsx(IconButton.plain, { ariaLabel: "open/close menu", onTap: () => appBase.setMenuOpen(!appBase.menuOpen), icon: MenuIcon })), p.leading === "back" && _jsx(BackButton, {}), p.leading === "close" && _jsx(BackButton, { close: true }), !layoutMode.isMobile && (_jsx(_Logo, { logo: (_b = p.logo) !== null && _b !== void 0 ? _b : appBase === null || appBase === void 0 ? void 0 : appBase.icons.logo, logoDark: (_c = p.logoDark) !== null && _c !== void 0 ? _c : appBase === null || appBase === void 0 ? void 0 : appBase.icons.logoDark, lMargin: 0.5 })), (!appBase || layoutMode.isWide) && (_jsx("div", { style: { margin: "-1rem", width: "1.5rem" } })), _jsx(_HeaderTitle, { title: p.title, center: (_d = p.centerTitle) !== null && _d !== void 0 ? _d : false }), _jsx(_Toolbar, { actions: [...((_e = p.actions) !== null && _e !== void 0 ? _e : []), ...((_f = appBase === null || appBase === void 0 ? void 0 : appBase.globalActions) !== null && _f !== void 0 ? _f : [])] }), layoutMode.isWide && (_jsx(_Logo, { logo: (_g = p.endLogo) !== null && _g !== void 0 ? _g : appBase === null || appBase === void 0 ? void 0 : appBase.icons.endLogo, logoDark: (_h = p.endLogoDark) !== null && _h !== void 0 ? _h : appBase === null || appBase === void 0 ? void 0 : appBase.icons.endLogoDark, rMargin: 0.5 }))] }));
|
|
35
33
|
}
|
|
36
34
|
export function _Logo(p) {
|
|
37
35
|
var _a, _b;
|
|
38
36
|
const tConfig = useThemeConfig();
|
|
39
37
|
const [logo, setLogo] = useState(p.logo);
|
|
40
|
-
|
|
38
|
+
useMemo(() => { var _a; return setLogo(tConfig.dark ? (_a = p.logoDark) !== null && _a !== void 0 ? _a : p.logo : p.logo); }, [tConfig]);
|
|
41
39
|
return !logo ? null : (_jsx("div", { style: {
|
|
42
|
-
flex: p.flex ? 1 :
|
|
40
|
+
flex: p.flex ? 1 : undefined,
|
|
43
41
|
display: "flex",
|
|
44
42
|
alignItems: "center",
|
|
45
43
|
justifyContent: "center",
|
|
@@ -47,13 +45,13 @@ export function _Logo(p) {
|
|
|
47
45
|
marginRight: `${(_b = p.rMargin) !== null && _b !== void 0 ? _b : 0}rem`,
|
|
48
46
|
}, children: typeof logo === "string" ? (_jsx("img", { src: logo, style: {
|
|
49
47
|
height: "1.25rem",
|
|
50
|
-
} })) : (
|
|
48
|
+
} })) : (logo) }));
|
|
51
49
|
}
|
|
52
50
|
export function BackButton(p) {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
return _jsx(IconButton.plain, { ariaLabel: "close", onTap:
|
|
51
|
+
var _a, _b;
|
|
52
|
+
const appBase = maybeAppBase();
|
|
53
|
+
const hidden = ((_b = (_a = appBase === null || appBase === void 0 ? void 0 : appBase.router.history) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0) < 2;
|
|
54
|
+
return hidden ? null : (_jsx(IconButton.plain, { ariaLabel: p.close ? "close" : "go back", onTap: () => appBase === null || appBase === void 0 ? void 0 : appBase.router.goBack(), icon: p.close ? XIcon : ChevronLeft }, "hello-back"));
|
|
57
55
|
}
|
|
58
56
|
export function _HeaderTitle(p) {
|
|
59
57
|
const layoutMode = useLayoutMode();
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { MenuIcon } from "lucide-react";
|
|
3
|
-
import { useLocation } from "wouter";
|
|
4
3
|
import { _Logo, useLayoutMode, useTheme, useThemeConfig, } from "../../..";
|
|
5
4
|
import { Card, elevatedShadow } from "../base/card";
|
|
6
5
|
import { Button } from "../button/button";
|
|
@@ -42,7 +41,7 @@ export function Menu(p) {
|
|
|
42
41
|
appBase.setMenuOpen(false);
|
|
43
42
|
}, sharp: layoutMode.isMobile, bordered: true, scheme: "primary", padding: wideOrOpen() ? 0.5 : 0, style: Object.assign({ zIndex: 101, position: "fixed", left: 0, top: 0, height: "100vh", overflow: "hidden", width: menuWidth(), display: "flex",
|
|
44
43
|
//display: appBase.menuOpen || layoutMode == "wide" ? "flex" : "none",
|
|
45
|
-
flexDirection: "column", justifyContent: "start", alignItems: "stretch", borderTopLeftRadius: 0, borderBottomLeftRadius: 0, borderLeft: "none", borderTop: "none", borderBottom: "none", borderColor: tConfig.highVis ?
|
|
44
|
+
flexDirection: "column", justifyContent: "start", alignItems: "stretch", borderTopLeftRadius: 0, borderBottomLeftRadius: 0, borderLeft: "none", borderTop: "none", borderBottom: "none", borderColor: tConfig.highVis ? undefined : "transparent", gap: "1rem", transition: tConfig.reducedMotion
|
|
46
45
|
? "none"
|
|
47
46
|
: "width 200ms ease-in-out" }, (layoutMode.isNarrow && appBase.menuOpen
|
|
48
47
|
? {
|
|
@@ -54,9 +53,10 @@ export function Menu(p) {
|
|
|
54
53
|
}, children: !layoutMode.isWide && (_jsx(_Logo, { logo: appBase === null || appBase === void 0 ? void 0 : appBase.icons.logo, logoDark: appBase === null || appBase === void 0 ? void 0 : appBase.icons.logoDark, lMargin: 0.5 })) }), _jsx(Column, { flex: 1, scroll: true, noScrollbar: true, children: topBot.top.map((i) => (_jsx(_MenuItemView, { item: i }))) }), topBot.bottom.map((i) => (_jsx(_MenuItemView, { item: i })))] })) })] }));
|
|
55
54
|
}
|
|
56
55
|
function _MenuItemView({ item }) {
|
|
57
|
-
const [location, navigate] = useLocation();
|
|
58
56
|
const appBase = useAppBase();
|
|
59
|
-
return (_jsx(Button, { ariaLabel: item.label, contentAlign: "start", manner: (item.path === "/"
|
|
57
|
+
return (_jsx(Button, { ariaLabel: item.label, contentAlign: "start", manner: (item.path === "/"
|
|
58
|
+
? appBase.router.location === "/"
|
|
59
|
+
: appBase.router.location.startsWith(item.path))
|
|
60
60
|
? "major"
|
|
61
|
-
: "plain", label: appBase.menuOpen ? item.label : undefined, icon: item.icon, onTap: item.disabled ? undefined : () =>
|
|
61
|
+
: "plain", label: appBase.menuOpen ? item.label : undefined, icon: item.icon, onTap: item.disabled ? undefined : () => appBase.router.go(item.path, "all") }));
|
|
62
62
|
}
|
|
@@ -14,9 +14,11 @@ type ContentBaseProps = {
|
|
|
14
14
|
* ### Properties:
|
|
15
15
|
* - `narrow` will limit the width of the content to `900px`, and center it.
|
|
16
16
|
* - `padding` will add padding around the content, defaulting to `1rem`.
|
|
17
|
+
* - `leading` can be used to add a back or close button to the header. Setting it
|
|
18
|
+
* "back" or "close" will automatically show the button if there is history to go back to.
|
|
17
19
|
*/
|
|
18
20
|
export declare function Page(p: HeaderProps & ContentBaseProps & {
|
|
19
21
|
children?: ElbeChildren;
|
|
20
22
|
footer?: ElbeChild;
|
|
21
|
-
}): import("
|
|
23
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
22
24
|
export {};
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "
|
|
2
|
-
import { useEffect, useState } from "preact/hooks";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
2
|
import { Column } from "../../..";
|
|
4
3
|
import { Box } from "../base/box";
|
|
5
4
|
import { Header } from "./header";
|
|
5
|
+
function _hasMoreThan(p, expected) {
|
|
6
|
+
return Object.keys(p).findIndex((k) => !expected.includes(k)) !== -1;
|
|
7
|
+
}
|
|
6
8
|
/**
|
|
7
9
|
* A component that represents a full page layout with a header and footer.
|
|
8
10
|
* It accepts header properties, content, and a footer element. All of these
|
|
@@ -11,19 +13,19 @@ import { Header } from "./header";
|
|
|
11
13
|
* ### Properties:
|
|
12
14
|
* - `narrow` will limit the width of the content to `900px`, and center it.
|
|
13
15
|
* - `padding` will add padding around the content, defaulting to `1rem`.
|
|
16
|
+
* - `leading` can be used to add a back or close button to the header. Setting it
|
|
17
|
+
* "back" or "close" will automatically show the button if there is history to go back to.
|
|
14
18
|
*/
|
|
15
19
|
export function Page(p) {
|
|
16
20
|
var _a;
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
setHasHeader(Object.keys(headerProps).length > 0);
|
|
26
|
-
});
|
|
21
|
+
const hasHeader = _hasMoreThan(p, [
|
|
22
|
+
"children",
|
|
23
|
+
"footer",
|
|
24
|
+
"padding",
|
|
25
|
+
"narrow",
|
|
26
|
+
"noScroll",
|
|
27
|
+
"scheme",
|
|
28
|
+
]);
|
|
27
29
|
return (_jsxs(Box, { scheme: (_a = p.scheme) !== null && _a !== void 0 ? _a : "primary", typeLabel: "page", style: {
|
|
28
30
|
display: "flex",
|
|
29
31
|
flexDirection: "column",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Component } from "
|
|
1
|
+
import { Component } from "react";
|
|
2
2
|
import { type ElbeProps } from "../base/box";
|
|
3
3
|
export type ScrollProps = ElbeProps & {
|
|
4
4
|
innerClass?: string;
|
|
@@ -11,8 +11,8 @@ type _ScrollProps = ScrollProps & {
|
|
|
11
11
|
};
|
|
12
12
|
export declare class Scroll extends Component<_ScrollProps> {
|
|
13
13
|
constructor(props: _ScrollProps);
|
|
14
|
-
static vertical: (p: ScrollProps) => import("
|
|
15
|
-
static horizontal: (p: ScrollProps) => import("
|
|
16
|
-
render(): import("
|
|
14
|
+
static vertical: (p: ScrollProps) => import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
static horizontal: (p: ScrollProps) => import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
render(): import("react/jsx-runtime").JSX.Element;
|
|
17
17
|
}
|
|
18
18
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { jsx as _jsx } from "
|
|
2
|
-
import { Component } from "
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Component } from "react";
|
|
3
3
|
import { applyProps } from "../base/box";
|
|
4
4
|
export class Scroll extends Component {
|
|
5
5
|
constructor(props) {
|
|
@@ -9,7 +9,7 @@ export class Scroll extends Component {
|
|
|
9
9
|
return (_jsx("div", Object.assign({}, applyProps("scroll", this.props, null, {
|
|
10
10
|
overflowY: this.props.axis === "vertical" ? "scroll" : "hidden",
|
|
11
11
|
overflowX: this.props.axis === "horizontal" ? "scroll" : "hidden",
|
|
12
|
-
}), { children: _jsx("div", {
|
|
12
|
+
}), { children: _jsx("div", { className: this.props.innerClass, style: this.props.axis === "horizontal" ? { minWidth: "min-content" } : {}, children: this.props.children }) })));
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
15
|
Scroll.vertical = (p) => new Scroll(Object.assign(Object.assign({}, p), { axis: "vertical" })).render();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ElbeChild } from "../../..";
|
|
2
2
|
export declare function _Toolbar(p: {
|
|
3
3
|
actions: ElbeChild[];
|
|
4
|
-
}): import("
|
|
4
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
5
5
|
export declare function OverflowMenu(p: {
|
|
6
6
|
items: ElbeChild[];
|
|
7
|
-
}): import("
|
|
7
|
+
}): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -1,16 +1,14 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { MoreVertical } from "lucide-react";
|
|
3
|
-
import {
|
|
3
|
+
import { useMemo, useState } from "react";
|
|
4
4
|
import { Card, elevatedShadow, IconButton, ToolbarContext, useLayoutMode, useThemeConfig, } from "../../..";
|
|
5
|
-
import { maybeAppBase } from "./ctx_app_base";
|
|
6
5
|
export function _Toolbar(p) {
|
|
7
6
|
const [sections, setSections] = useState([
|
|
8
7
|
[],
|
|
9
8
|
[],
|
|
10
9
|
]);
|
|
11
|
-
const appBase = maybeAppBase();
|
|
12
10
|
const layoutMode = useLayoutMode();
|
|
13
|
-
|
|
11
|
+
useMemo(() => {
|
|
14
12
|
const cutoff = layoutMode.isWide ? 5 : layoutMode.screenWidth < 400 ? 1 : 2;
|
|
15
13
|
const bar = [];
|
|
16
14
|
const overflow = [];
|
|
@@ -54,7 +52,7 @@ export function OverflowMenu(p) {
|
|
|
54
52
|
transform: open ? "scale(1)" : "scale(.6)",
|
|
55
53
|
opacity: open ? 1 : 0,
|
|
56
54
|
transition: tConfig.reducedMotion
|
|
57
|
-
?
|
|
55
|
+
? undefined
|
|
58
56
|
: "transform 200ms ease-in-out, opacity 200ms ease-in-out",
|
|
59
57
|
}, children: open && (_jsx(ToolbarContext.Provider, { value: "overflow", children: _jsx(Card, { onTap: () => setOpen(false), scheme: "primary", elevated: true, style: {
|
|
60
58
|
display: "flex",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { ExternalLinkIcon } from "lucide-react";
|
|
3
3
|
export function Link(p) {
|
|
4
|
-
return (_jsxs("a", {
|
|
4
|
+
return (_jsxs("a", { className: p.plain ? "plain" : "accent action", href: p.href, target: p.external ? "_blank" : undefined, rel: p.external ? "noopener noreferrer" : undefined, style: {
|
|
5
5
|
color: p.color,
|
|
6
6
|
display: "inline-flex",
|
|
7
7
|
textDecoration: p.underline ? "underline" : "none",
|
|
@@ -9,7 +9,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
9
9
|
}
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
|
-
import { jsx as _jsx } from "
|
|
12
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
13
|
import { applyProps, clamp, useTheme, useThemeConfig } from "../..";
|
|
14
14
|
export function ProgressBar(_a) {
|
|
15
15
|
var { value, max = 100, plain } = _a, elbe = __rest(_a, ["value", "max", "plain"]);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { ElbeChildren, IconChild,
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { ElbeChildren, IconChild, Wouter } from "../../..";
|
|
3
3
|
export type MenuItem = {
|
|
4
4
|
path: string;
|
|
5
5
|
label: string;
|
|
@@ -10,9 +10,9 @@ export type MenuItem = {
|
|
|
10
10
|
type _MenuRouteProps = MenuItem & {
|
|
11
11
|
children?: ElbeChildren;
|
|
12
12
|
};
|
|
13
|
-
export type ElbeRoute =
|
|
13
|
+
export type ElbeRoute = React.ReactElement<{
|
|
14
14
|
path: string;
|
|
15
|
-
}> |
|
|
15
|
+
}> | React.ReactElement<_MenuRouteProps>;
|
|
16
16
|
/**
|
|
17
17
|
* a route that also renders a menu item in the <AppBase> component.
|
|
18
18
|
* place it as a child of <AppBase> to have it rendered in the menu.
|
|
@@ -21,10 +21,10 @@ export type ElbeRoute = VNode<{
|
|
|
21
21
|
*
|
|
22
22
|
* ⚠️ a route with path "/" can't be used for nesting
|
|
23
23
|
*/
|
|
24
|
-
export declare function MenuRoute(p: _MenuRouteProps): import("
|
|
24
|
+
export declare function MenuRoute(p: _MenuRouteProps): import("react/jsx-runtime").JSX.Element;
|
|
25
25
|
/**
|
|
26
|
-
* a helper function to create a <
|
|
26
|
+
* a helper function to create a <Wouter.Route> with a path.
|
|
27
27
|
*/
|
|
28
|
-
export declare const Route: typeof
|
|
29
|
-
export declare function isMenuRoute(r: ElbeRoute): r is
|
|
28
|
+
export declare const Route: typeof Wouter.Route;
|
|
29
|
+
export declare function isMenuRoute(r: ElbeRoute): r is React.ReactElement<_MenuRouteProps>;
|
|
30
30
|
export {};
|