elbe-ui 1.0.7 → 2.0.0
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/elbe.css +150 -562
- package/dist/elbe.css.map +1 -1
- package/dist/index.d.ts +188 -46
- package/dist/index.js +8 -6
- package/dist/ui/app/app.d.ts +12 -0
- package/dist/ui/{components/layout/app_base.js → app/app.js} +24 -31
- package/dist/ui/app/app_ctxt.d.ts +35 -0
- package/dist/ui/app/app_ctxt.js +10 -0
- package/dist/ui/components/badge.d.ts +3 -3
- package/dist/ui/components/badge.js +16 -5
- package/dist/ui/components/banner.d.ts +3 -3
- package/dist/ui/components/banner.js +1 -1
- package/dist/ui/components/base/box.d.ts +82 -35
- package/dist/ui/components/base/box.js +56 -8
- package/dist/ui/components/base/card.d.ts +11 -12
- package/dist/ui/components/base/card.js +36 -19
- package/dist/ui/components/base/padded.d.ts +2 -4
- package/dist/ui/components/base/state_builder.d.ts +9 -0
- package/dist/ui/components/base/state_builder.js +33 -0
- package/dist/ui/components/button/button.d.ts +8 -6
- package/dist/ui/components/button/button.js +27 -16
- package/dist/ui/components/button/choose_button.d.ts +5 -3
- package/dist/ui/components/button/choose_button.js +9 -6
- package/dist/ui/components/button/icon_button.d.ts +6 -5
- package/dist/ui/components/button/icon_button.js +33 -23
- package/dist/ui/components/button/toggle_button.d.ts +5 -5
- package/dist/ui/components/button/toggle_button.js +13 -7
- package/dist/ui/components/dialog/dialog.d.ts +13 -0
- package/dist/ui/components/dialog/dialog.js +69 -0
- package/dist/ui/components/dialog/dialog_ctx.d.ts +34 -0
- package/dist/ui/components/dialog/dialog_ctx.js +44 -0
- package/dist/ui/components/dialog/dialogs/_alert.d.ts +7 -0
- package/dist/ui/components/dialog/dialogs/_alert.js +9 -0
- package/dist/ui/components/dialog/dialogs/_confirm.d.ts +9 -0
- package/dist/ui/components/dialog/dialogs/_confirm.js +21 -0
- package/dist/ui/components/error_view.js +3 -3
- package/dist/ui/components/footer.js +7 -7
- package/dist/ui/components/input/_labeled_input.d.ts +21 -0
- package/dist/ui/components/input/_labeled_input.js +21 -0
- package/dist/ui/components/input/checkbox.d.ts +4 -2
- package/dist/ui/components/input/checkbox.js +16 -8
- package/dist/ui/components/input/range.d.ts +5 -3
- package/dist/ui/components/input/range.js +20 -13
- package/dist/ui/components/input/select.d.ts +4 -3
- package/dist/ui/components/input/select.js +13 -40
- package/dist/ui/components/input/switch.d.ts +4 -2
- package/dist/ui/components/input/switch.js +30 -40
- package/dist/ui/components/input/text/input_field.d.ts +14 -19
- package/dist/ui/components/input/text/input_field.js +63 -61
- package/dist/ui/components/input/text/single_line.d.ts +11 -9
- package/dist/ui/components/input/text/single_line.js +15 -21
- package/dist/ui/components/layout/flex.d.ts +7 -3
- package/dist/ui/components/layout/flex.js +15 -12
- package/dist/ui/components/layout/header.d.ts +2 -2
- package/dist/ui/components/layout/header.js +25 -18
- package/dist/ui/components/layout/menu.js +74 -49
- package/dist/ui/components/layout/scroll.d.ts +1 -0
- package/dist/ui/components/layout/scroll.js +3 -1
- package/dist/ui/components/layout/toolbar.js +9 -6
- package/dist/ui/components/link.d.ts +4 -2
- package/dist/ui/components/link.js +24 -11
- package/dist/ui/components/progress_bar.d.ts +2 -2
- package/dist/ui/components/progress_bar.js +12 -9
- package/dist/ui/components/spinner.d.ts +2 -7
- package/dist/ui/components/spinner.js +15 -16
- package/dist/ui/components/text.d.ts +5 -6
- package/dist/ui/components/text.js +34 -21
- package/dist/ui/components/tooltip.d.ts +5 -0
- package/dist/ui/components/tooltip.js +48 -0
- package/dist/ui/theme/subthemes/_theme_geometry.d.ts +9 -0
- package/dist/ui/theme/subthemes/_theme_geometry.js +22 -0
- package/dist/ui/theme/subthemes/_theme_menu.d.ts +9 -0
- package/dist/ui/theme/subthemes/_theme_menu.js +12 -0
- package/dist/ui/theme/subthemes/_theme_motion.d.ts +9 -0
- package/dist/ui/theme/subthemes/_theme_motion.js +13 -0
- package/dist/ui/theme/subthemes/_theme_toast.d.ts +8 -0
- package/dist/ui/theme/subthemes/_theme_toast.js +11 -0
- package/dist/ui/theme/subthemes/_theme_type.d.ts +49 -0
- package/dist/ui/theme/subthemes/_theme_type.js +73 -0
- package/dist/ui/theme/subthemes/color/_seed.d.ts +2 -0
- package/dist/ui/theme/subthemes/color/_seed.js +105 -0
- package/dist/ui/theme/subthemes/color/_theme_color.d.ts +865 -0
- package/dist/ui/theme/subthemes/color/_theme_color.js +83 -0
- package/dist/ui/theme/subthemes/color/colors/_color_contrast.d.ts +284 -0
- package/dist/ui/theme/subthemes/color/colors/_color_contrast.js +17 -0
- package/dist/ui/theme/subthemes/color/colors/_color_kind.d.ts +242 -0
- package/dist/ui/theme/subthemes/color/colors/_color_kind.js +45 -0
- package/dist/ui/theme/subthemes/color/colors/_color_layer.d.ts +226 -0
- package/dist/ui/theme/subthemes/color/colors/_color_layer.js +95 -0
- package/dist/ui/theme/subthemes/color/colors/_color_manner.d.ts +280 -0
- package/dist/ui/theme/subthemes/color/colors/_color_manner.js +17 -0
- package/dist/ui/theme/subthemes/color/colors/_color_mode.d.ts +269 -0
- package/dist/ui/theme/subthemes/color/colors/_color_mode.js +16 -0
- package/dist/ui/theme/subthemes/color/colors/_color_rgba.d.ts +166 -0
- package/dist/ui/theme/subthemes/color/colors/_color_rgba.js +86 -0
- package/dist/ui/theme/subthemes/color/colors/_color_scheme.d.ts +256 -0
- package/dist/ui/theme/subthemes/color/colors/_color_scheme.js +17 -0
- package/dist/ui/theme/subthemes/color/colors/_color_state.d.ts +252 -0
- package/dist/ui/theme/subthemes/color/colors/_color_state.js +49 -0
- package/dist/ui/theme/subthemes/color/colors/_colordef.d.ts +22 -0
- package/dist/ui/theme/subthemes/color/colors/_colordef.js +34 -0
- package/dist/ui/theme/subthemes/color/colors/colors.d.ts +511 -0
- package/dist/ui/theme/subthemes/color/colors/colors.js +24 -0
- package/dist/ui/theme/theme.d.ts +984 -30
- package/dist/ui/theme/theme.js +14 -82
- package/dist/ui/theme/theme_context.d.ts +15 -17
- package/dist/ui/theme/theme_context.js +79 -18
- package/dist/ui/util/_util.d.ts +1 -0
- package/dist/ui/util/_util.js +3 -0
- package/dist/ui/util/error_view.js +3 -3
- package/dist/ui/util/merge_deep.d.ts +1 -0
- package/dist/ui/util/merge_deep.js +18 -0
- package/dist/ui/util/root.d.ts +17 -0
- package/dist/ui/util/root.js +23 -0
- package/dist/ui/util/toast/_toast.d.ts +5 -0
- package/dist/ui/util/toast/_toast.js +7 -0
- package/dist/ui/util/toast/toast_ctx.d.ts +28 -0
- package/dist/ui/util/toast/toast_ctx.js +62 -0
- package/dist/ui/util/toast/toast_legacy.d.ts +5 -0
- package/dist/ui/util/{toast.js → toast/toast_legacy.js} +4 -4
- package/dist/ui/util/util.d.ts +8 -0
- package/dist/ui/util/util.js +54 -1
- package/package.json +10 -8
- package/dist/ui/components/dialog.d.ts +0 -9
- package/dist/ui/components/dialog.js +0 -32
- package/dist/ui/components/layout/app_base.d.ts +0 -15
- package/dist/ui/components/layout/ctx_app_base.d.ts +0 -19
- package/dist/ui/components/layout/ctx_app_base.js +0 -12
- package/dist/ui/theme/color_theme.d.ts +0 -2
- package/dist/ui/theme/color_theme.js +0 -92
- package/dist/ui/theme/colors.d.ts +0 -133
- package/dist/ui/theme/colors.js +0 -309
- package/dist/ui/theme/geometry_theme.d.ts +0 -16
- package/dist/ui/theme/geometry_theme.js +0 -28
- package/dist/ui/theme/seed.d.ts +0 -53
- package/dist/ui/theme/seed.js +0 -4
- package/dist/ui/theme/type_theme.d.ts +0 -38
- package/dist/ui/theme/type_theme.js +0 -73
- package/dist/ui/util/confirm_dialog.d.ts +0 -10
- package/dist/ui/util/confirm_dialog.js +0 -46
- package/dist/ui/util/toast.d.ts +0 -5
|
@@ -16,24 +16,27 @@ export function FlexSpace({}) {
|
|
|
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"]);
|
|
19
|
-
return
|
|
19
|
+
return _FlexLayout(false, { gap, main, cross, scroll, noScrollbar, children }, p, false);
|
|
20
20
|
}
|
|
21
21
|
export function Row(_a) {
|
|
22
22
|
var { gap = 1, main = "start", cross, wrap = false, children, noScrollbar = false, scroll = false } = _a, p = __rest(_a, ["gap", "main", "cross", "wrap", "children", "noScrollbar", "scroll"]);
|
|
23
|
-
return
|
|
23
|
+
return _FlexLayout(true, { gap, main, cross, scroll, noScrollbar, children }, p, wrap);
|
|
24
24
|
}
|
|
25
|
-
function
|
|
26
|
-
var _a;
|
|
27
|
-
return (
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
], {
|
|
25
|
+
export function FlexLayout(_a) {
|
|
26
|
+
var { gap = 1, main = "start", cross = "stretch", direction, children, noScrollbar = false, scroll = false, wrap = false } = _a, p = __rest(_a, ["gap", "main", "cross", "direction", "children", "noScrollbar", "scroll", "wrap"]);
|
|
27
|
+
return _FlexLayout(direction !== "column", { gap, main, cross, scroll, noScrollbar, children }, p, wrap);
|
|
28
|
+
}
|
|
29
|
+
function _FlexLayout(row, p, elbe, wraps) {
|
|
30
|
+
var _a, _b, _c;
|
|
31
|
+
return (_jsx("div", Object.assign({}, applyProps("flex", elbe, [p.noScrollbar && "elbe_no-scrollbar"], {
|
|
32
|
+
display: "flex",
|
|
33
|
+
flexDirection: row ? "row" : "column",
|
|
34
|
+
flexWrap: wraps ? "wrap" : "nowrap",
|
|
32
35
|
justifyContent: p.main,
|
|
33
|
-
alignItems: p.cross,
|
|
34
|
-
gap: `${p.gap}rem`,
|
|
36
|
+
alignItems: (_a = p.cross) !== null && _a !== void 0 ? _a : (row ? "center" : "stretch"),
|
|
37
|
+
gap: `${(_b = p.gap) !== null && _b !== void 0 ? _b : 1}rem`,
|
|
35
38
|
overflowX: !row ? undefined : p.scroll ? "auto" : undefined,
|
|
36
39
|
overflowY: row ? undefined : p.scroll ? "auto" : undefined,
|
|
37
|
-
flex: ((
|
|
40
|
+
flex: ((_c = elbe.flex) !== null && _c !== void 0 ? _c : p.scroll) ? 1 : undefined,
|
|
38
41
|
}), { children: p.children })));
|
|
39
42
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ColorSelection, ElbeChild } from "../../..";
|
|
2
2
|
export type HeaderLogos = {
|
|
3
3
|
logo?: string | ElbeChild;
|
|
4
4
|
logoDark?: string | ElbeChild;
|
|
@@ -10,7 +10,7 @@ export type HeaderProps = HeaderLogos & {
|
|
|
10
10
|
title: string | ElbeChild;
|
|
11
11
|
centerTitle?: boolean;
|
|
12
12
|
actions?: ElbeChild[];
|
|
13
|
-
scheme?:
|
|
13
|
+
scheme?: ColorSelection.Schemes;
|
|
14
14
|
};
|
|
15
15
|
export declare function Header(p: HeaderProps): import("react/jsx-runtime").JSX.Element;
|
|
16
16
|
export declare function _Logo(p: {
|
|
@@ -1,17 +1,21 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { ChevronLeft, MenuIcon, XIcon } from "lucide-react";
|
|
3
3
|
import { useMemo, useState } from "react";
|
|
4
|
-
import { Card, IconButton, Text, useLayoutMode, useSiteScroll,
|
|
5
|
-
import {
|
|
4
|
+
import { Card, IconButton, Text, useLayoutMode, useSiteScroll, } from "../../..";
|
|
5
|
+
import { useApp } from "../../app/app_ctxt";
|
|
6
6
|
import { _Toolbar } from "./toolbar";
|
|
7
7
|
export function Header(p) {
|
|
8
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
9
|
-
const
|
|
8
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
9
|
+
const { _appThemeContext, appConfig, menu } = useApp();
|
|
10
|
+
const { theme, useWith } = _appThemeContext.useTheme();
|
|
10
11
|
const layoutMode = useLayoutMode();
|
|
11
12
|
const scroll = useSiteScroll();
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
const secTheme = useWith((t) => ({
|
|
14
|
+
color: Object.assign(Object.assign({}, t.color), { selection: Object.assign(Object.assign({}, t.color.selection), { scheme: "secondary", manner: "plain" }) }),
|
|
15
|
+
}), [theme]);
|
|
16
|
+
return (_jsxs(Card, { padding: 0, scheme: (_a = p.scheme) !== null && _a !== void 0 ? _a : "primary", manner: "plain", frosted: !theme.color.isContrast,
|
|
17
|
+
//elevated={!!scroll}
|
|
18
|
+
bordered: true, sharp: true, style: {
|
|
15
19
|
position: "sticky",
|
|
16
20
|
top: 0,
|
|
17
21
|
left: 0,
|
|
@@ -20,22 +24,25 @@ export function Header(p) {
|
|
|
20
24
|
padding: ".5rem",
|
|
21
25
|
display: "flex",
|
|
22
26
|
alignItems: "center",
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
borderColor:
|
|
27
|
+
borderTopStyle: "none",
|
|
28
|
+
borderLeftStyle: "none",
|
|
29
|
+
borderRightStyle: "none",
|
|
30
|
+
borderColor: theme.color.isContrast || scroll
|
|
31
|
+
? theme.color.currentColor.border.withAlpha(0.25).asCss()
|
|
32
|
+
: "transparent",
|
|
33
|
+
borderWidth: theme.geometry.borderWidth + "rem",
|
|
27
34
|
gap: "1rem",
|
|
28
35
|
zIndex: 80,
|
|
29
36
|
}, children: [p.leading && p.leading !== "back" && p.leading !== "close"
|
|
30
37
|
? p.leading
|
|
31
|
-
:
|
|
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 }))] }));
|
|
38
|
+
: !layoutMode.isWide && (_jsx(IconButton.plain, { ariaLabel: "open/close menu", onTap: () => menu.setOpen(!menu.isOpen), 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 : (_c = appConfig === null || appConfig === void 0 ? void 0 : appConfig.icons) === null || _c === void 0 ? void 0 : _c.logo, logoDark: (_d = p.logoDark) !== null && _d !== void 0 ? _d : (_e = appConfig === null || appConfig === void 0 ? void 0 : appConfig.icons) === null || _e === void 0 ? void 0 : _e.logoDark, lMargin: 0.5 })), (!appConfig || layoutMode.isWide) && (_jsx("div", { style: { margin: "-1rem", width: "1.5rem" } })), _jsx(_HeaderTitle, { title: p.title, center: (_f = p.centerTitle) !== null && _f !== void 0 ? _f : false }), _jsx(_Toolbar, { actions: [...((_g = p.actions) !== null && _g !== void 0 ? _g : []), ...((_h = appConfig === null || appConfig === void 0 ? void 0 : appConfig.globalActions) !== null && _h !== void 0 ? _h : [])] }), layoutMode.isWide && (_jsx(_Logo, { logo: (_j = p.endLogo) !== null && _j !== void 0 ? _j : (_k = appConfig === null || appConfig === void 0 ? void 0 : appConfig.icons) === null || _k === void 0 ? void 0 : _k.endLogo, logoDark: (_l = p.endLogoDark) !== null && _l !== void 0 ? _l : (_m = appConfig === null || appConfig === void 0 ? void 0 : appConfig.icons) === null || _m === void 0 ? void 0 : _m.endLogoDark, rMargin: 0.5 }))] }));
|
|
33
39
|
}
|
|
34
40
|
export function _Logo(p) {
|
|
35
41
|
var _a, _b;
|
|
36
|
-
const
|
|
42
|
+
const { _appThemeContext } = useApp();
|
|
43
|
+
const { theme } = _appThemeContext.useTheme();
|
|
37
44
|
const [logo, setLogo] = useState(p.logo);
|
|
38
|
-
useMemo(() => { var _a; return setLogo(
|
|
45
|
+
useMemo(() => { var _a; return setLogo(theme.color.isDark ? (_a = p.logoDark) !== null && _a !== void 0 ? _a : p.logo : p.logo); }, [theme]);
|
|
39
46
|
return !logo ? null : (_jsx("div", { style: {
|
|
40
47
|
flex: p.flex ? 1 : undefined,
|
|
41
48
|
display: "flex",
|
|
@@ -49,9 +56,9 @@ export function _Logo(p) {
|
|
|
49
56
|
}
|
|
50
57
|
export function BackButton(p) {
|
|
51
58
|
var _a, _b;
|
|
52
|
-
const
|
|
53
|
-
const hidden = ((_b = (_a =
|
|
54
|
-
return hidden ? null : (_jsx(IconButton.plain, { ariaLabel: p.close ? "close" : "go back", onTap: () =>
|
|
59
|
+
const { router } = useApp();
|
|
60
|
+
const hidden = ((_b = (_a = router.history) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0) < 2;
|
|
61
|
+
return hidden ? null : (_jsx(IconButton.plain, { ariaLabel: p.close ? "close" : "go back", onTap: () => router.goBack(), icon: p.close ? XIcon : ChevronLeft }, "hello-back"));
|
|
55
62
|
}
|
|
56
63
|
export function _HeaderTitle(p) {
|
|
57
64
|
const layoutMode = useLayoutMode();
|
|
@@ -1,62 +1,87 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { MenuIcon } from "lucide-react";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { useMemo } from "react";
|
|
4
|
+
import { _Logo, elevatedBackdropStyle, useLayoutMode, } from "../../..";
|
|
5
|
+
import { useApp } from "../../app/app_ctxt";
|
|
6
|
+
import { Card } from "../base/card";
|
|
5
7
|
import { Button } from "../button/button";
|
|
6
|
-
import { useAppBase } from "./ctx_app_base";
|
|
7
8
|
import { Column } from "./flex";
|
|
8
9
|
export function Menu(p) {
|
|
10
|
+
const { _appThemeContext, menu } = useApp();
|
|
11
|
+
const { theme } = _appThemeContext.useTheme();
|
|
9
12
|
const layoutMode = useLayoutMode();
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
const
|
|
14
|
-
for (let i of p.items) {
|
|
15
|
-
if (i.bottom)
|
|
16
|
-
topBot.bottom.push(i);
|
|
17
|
-
else
|
|
18
|
-
topBot.top.push(i);
|
|
19
|
-
}
|
|
20
|
-
const wideOrOpen = () => appBase.menuOpen || layoutMode.isWide;
|
|
21
|
-
const menuWidth = () => appBase.menuOpen
|
|
13
|
+
const isWideOrOpen = useMemo(() => {
|
|
14
|
+
return (menu === null || menu === void 0 ? void 0 : menu.isOpen) || layoutMode.isWide;
|
|
15
|
+
}, [menu === null || menu === void 0 ? void 0 : menu.isOpen, layoutMode.isWide]);
|
|
16
|
+
const menuWidth = useMemo(() => (menu === null || menu === void 0 ? void 0 : menu.isOpen)
|
|
22
17
|
? layoutMode.isMobile
|
|
23
|
-
? "
|
|
24
|
-
:
|
|
18
|
+
? "100%"
|
|
19
|
+
: `17rem`
|
|
25
20
|
: layoutMode.isWide
|
|
26
|
-
? `${
|
|
27
|
-
: "0";
|
|
21
|
+
? `${3 + theme.geometry.borderWidth * 2}rem`
|
|
22
|
+
: "0", [menu === null || menu === void 0 ? void 0 : menu.isOpen, layoutMode.mode, theme.geometry.borderWidth]);
|
|
23
|
+
const topBot = useMemo(() => {
|
|
24
|
+
let topBot = { top: [], bottom: [] };
|
|
25
|
+
for (let i of p.items) {
|
|
26
|
+
if (i.bottom)
|
|
27
|
+
topBot.bottom.push(i);
|
|
28
|
+
else
|
|
29
|
+
topBot.top.push(i);
|
|
30
|
+
}
|
|
31
|
+
return topBot;
|
|
32
|
+
}, [p.items]);
|
|
28
33
|
return (_jsxs(_Fragment, { children: [layoutMode.isWide && (_jsx("div", { style: {
|
|
29
|
-
width: menuWidth
|
|
30
|
-
minWidth: menuWidth
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
34
|
+
width: menuWidth,
|
|
35
|
+
minWidth: menuWidth,
|
|
36
|
+
marginRight: ".5rem",
|
|
37
|
+
} }, "menu_wide_spaceholder")), _jsx("div", { onClick: () => menu.setOpen(false), style: Object.assign({ zIndex: 100, position: "fixed", left: 0, top: 0, width: 0, height: 0 }, elevatedBackdropStyle(layoutMode.isNarrow && (menu === null || menu === void 0 ? void 0 : menu.isOpen), theme, {
|
|
38
|
+
width: "100%",
|
|
39
|
+
height: "100%",
|
|
40
|
+
})) }), _jsx(_Menu, { topBot: topBot, wideOrOpen: isWideOrOpen, menuWidth: menuWidth })] }));
|
|
41
|
+
}
|
|
42
|
+
function _Menu(p) {
|
|
43
|
+
var _a, _b;
|
|
44
|
+
const { _appThemeContext, menu, appConfig } = useApp();
|
|
45
|
+
const { theme } = _appThemeContext.useTheme();
|
|
46
|
+
const layoutMode = useLayoutMode();
|
|
47
|
+
return (_jsx(Card, { onTap: () => {
|
|
48
|
+
if (layoutMode.isWide)
|
|
49
|
+
return;
|
|
50
|
+
menu.setOpen(false);
|
|
51
|
+
}, sharp: theme.menu.sharp || !layoutMode.isWide, bordered: true, scheme: theme.menu.scheme, padding: 0, elevated: theme.menu.elevated || (layoutMode.isNarrow && (menu === null || menu === void 0 ? void 0 : menu.isOpen)), overflow: "hidden", style: {
|
|
52
|
+
zIndex: 101,
|
|
53
|
+
position: "fixed",
|
|
54
|
+
left: 0,
|
|
55
|
+
top: 0,
|
|
56
|
+
height: layoutMode.isWide ? "calc(100vh - 1rem)" : "100vh",
|
|
57
|
+
margin: layoutMode.isWide ? ".5rem" : 0,
|
|
58
|
+
padding: layoutMode.isWide || !menu.isOpen ? 0 : ".5rem",
|
|
59
|
+
borderWidth: !layoutMode.isWide && !menu.isOpen
|
|
60
|
+
? 0
|
|
61
|
+
: theme.geometry.borderWidth + "rem",
|
|
62
|
+
borderColor: theme.color.isContrast ? undefined : "transparent",
|
|
63
|
+
width: p.menuWidth,
|
|
64
|
+
display: "flex",
|
|
65
|
+
flexDirection: "column",
|
|
66
|
+
justifyContent: "start",
|
|
67
|
+
alignItems: "stretch",
|
|
68
|
+
gap: "1rem",
|
|
69
|
+
transition: theme.motion.reduced ? "none" : "width 200ms ease-in-out",
|
|
70
|
+
}, children: p.wideOrOpen && (_jsxs(_Fragment, { children: [_jsx(Button.plain, { sharp: layoutMode.isWide, contentAlign: "start", ariaLabel: "open/close menu", onTap: () => menu.setOpen(!menu.isOpen), icon: MenuIcon, style: {
|
|
71
|
+
marginBottom: ".5rem",
|
|
72
|
+
}, children: !layoutMode.isWide && (_jsx(_Logo, { logo: (_a = appConfig.icons) === null || _a === void 0 ? void 0 : _a.logo, logoDark: (_b = appConfig.icons) === null || _b === void 0 ? void 0 : _b.logoDark, lMargin: 0.5 })) }), _jsx(Column, { flex: 1, scroll: true, noScrollbar: true, children: p.topBot.top.map((i, index) => (_jsx(_MenuItemView, { item: i }, index))) }), p.topBot.bottom.map((i, index) => (_jsx(_MenuItemView, { item: i }, index)))] })) }));
|
|
54
73
|
}
|
|
55
74
|
function _MenuItemView({ item }) {
|
|
56
|
-
const
|
|
57
|
-
return (_jsx(Button
|
|
58
|
-
|
|
59
|
-
|
|
75
|
+
const { menu, router } = useApp();
|
|
76
|
+
return (_jsx(Button
|
|
77
|
+
//sharp
|
|
78
|
+
, {
|
|
79
|
+
//sharp
|
|
80
|
+
ariaLabel: item.label, contentAlign: "start", manner: (item.path === "/"
|
|
81
|
+
? router.location === "/"
|
|
82
|
+
: router.location.startsWith(item.path))
|
|
60
83
|
? "major"
|
|
61
|
-
: "plain",
|
|
84
|
+
: "plain", style: {
|
|
85
|
+
transition: "background-color 200ms ease-in-out",
|
|
86
|
+
}, label: menu.isOpen ? item.label : undefined, icon: item.icon, onTap: item.disabled ? undefined : () => router.go(item.path, "all") }));
|
|
62
87
|
}
|
|
@@ -6,7 +6,9 @@ export class Scroll extends Component {
|
|
|
6
6
|
super(props);
|
|
7
7
|
}
|
|
8
8
|
render() {
|
|
9
|
-
return (_jsx("div", Object.assign({}, applyProps("scroll", this.props,
|
|
9
|
+
return (_jsx("div", Object.assign({}, applyProps("scroll", this.props, [this.props.noScrollbars ? "elbe_scrollbars-hidden" : undefined], {
|
|
10
|
+
height: this.props.height ? this.props.height + "rem" : undefined,
|
|
11
|
+
width: this.props.width ? this.props.width + "rem" : undefined,
|
|
10
12
|
overflowY: this.props.axis === "vertical" ? "scroll" : "hidden",
|
|
11
13
|
overflowX: this.props.axis === "horizontal" ? "scroll" : "hidden",
|
|
12
14
|
}), { children: _jsx("div", { className: this.props.innerClass, style: this.props.axis === "horizontal" ? { minWidth: "min-content" } : {}, children: this.props.children }) })));
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { MoreVertical } from "lucide-react";
|
|
3
3
|
import { useMemo, useState } from "react";
|
|
4
|
-
import { Card,
|
|
4
|
+
import { Card, IconButton, ToolbarContext, useLayoutMode, } from "../../..";
|
|
5
|
+
import { useApp } from "../../app/app_ctxt";
|
|
6
|
+
import { elevatedShadow } from "../../util/_util";
|
|
5
7
|
export function _Toolbar(p) {
|
|
6
8
|
const [sections, setSections] = useState([
|
|
7
9
|
[],
|
|
@@ -30,8 +32,9 @@ export function _Toolbar(p) {
|
|
|
30
32
|
}
|
|
31
33
|
export function OverflowMenu(p) {
|
|
32
34
|
var _a;
|
|
35
|
+
const { _appThemeContext } = useApp();
|
|
36
|
+
const { theme } = _appThemeContext.useTheme();
|
|
33
37
|
const [open, setOpen] = useState(false);
|
|
34
|
-
const tConfig = useThemeConfig();
|
|
35
38
|
return !((_a = p.items) === null || _a === void 0 ? void 0 : _a.length) ? null : (_jsxs("div", { style: {
|
|
36
39
|
position: "relative",
|
|
37
40
|
zIndex: 21,
|
|
@@ -39,10 +42,10 @@ export function OverflowMenu(p) {
|
|
|
39
42
|
position: "fixed",
|
|
40
43
|
top: 0,
|
|
41
44
|
right: 0,
|
|
42
|
-
width: "
|
|
43
|
-
height: "
|
|
45
|
+
width: "100%",
|
|
46
|
+
height: "100%",
|
|
44
47
|
backgroundColor: "transparent",
|
|
45
|
-
boxShadow: elevatedShadow,
|
|
48
|
+
boxShadow: elevatedShadow(theme.color.isDark),
|
|
46
49
|
zIndex: 20,
|
|
47
50
|
} })), _jsx(IconButton.plain, { ariaLabel: "open/close menu", icon: MoreVertical, onTap: () => setOpen(!open) }), _jsx("div", { style: {
|
|
48
51
|
zIndex: 21,
|
|
@@ -51,7 +54,7 @@ export function OverflowMenu(p) {
|
|
|
51
54
|
right: 0,
|
|
52
55
|
transform: open ? "scale(1)" : "scale(.6)",
|
|
53
56
|
opacity: open ? 1 : 0,
|
|
54
|
-
transition:
|
|
57
|
+
transition: theme.motion.reduced
|
|
55
58
|
? undefined
|
|
56
59
|
: "transform 200ms ease-in-out, opacity 200ms ease-in-out",
|
|
57
60
|
}, children: open && (_jsx(ToolbarContext.Provider, { value: "overflow", children: _jsx(Card, { onTap: () => setOpen(false), scheme: "primary", elevated: true, style: {
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
+
import { ColorSelection } from "../theme/subthemes/color/colors/colors";
|
|
1
2
|
export declare function Link(p: {
|
|
2
3
|
label: string;
|
|
3
|
-
href
|
|
4
|
+
href?: string;
|
|
4
5
|
external?: boolean;
|
|
5
|
-
|
|
6
|
+
manner?: ColorSelection.Manners;
|
|
6
7
|
bold?: boolean;
|
|
7
8
|
noIcon?: boolean;
|
|
8
9
|
underline?: boolean;
|
|
9
10
|
color?: string;
|
|
11
|
+
tooltip?: string;
|
|
10
12
|
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,15 +1,28 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { ExternalLinkIcon } from "lucide-react";
|
|
3
|
+
import { useApp } from "../app/app_ctxt";
|
|
4
|
+
import { WithStateTheme } from "./base/state_builder";
|
|
5
|
+
import { WithTooltip } from "./tooltip";
|
|
3
6
|
export function Link(p) {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
7
|
+
var _a;
|
|
8
|
+
const { _appThemeContext } = useApp();
|
|
9
|
+
const baseTheme = _appThemeContext.useTheme().useWith(({ color }) => {
|
|
10
|
+
var _a;
|
|
11
|
+
return ({
|
|
12
|
+
color: Object.assign(Object.assign({}, color), { selection: Object.assign(Object.assign({}, color.selection), { manner: (_a = p.manner) !== null && _a !== void 0 ? _a : "flat" }) }),
|
|
13
|
+
});
|
|
14
|
+
}, [p.manner]);
|
|
15
|
+
return (_jsx(WithStateTheme, { theme: baseTheme, disabled: p.href === undefined, children: _jsx(WithTooltip, { tooltip: p.tooltip, children: _jsxs("a", { href: p.href, target: p.external ? "_blank" : undefined, rel: p.external ? "noopener noreferrer" : undefined, className: "elbe_colored", style: {
|
|
16
|
+
display: "inline-flex",
|
|
17
|
+
textDecoration: p.underline ? "underline" : "none",
|
|
18
|
+
alignItems: "center",
|
|
19
|
+
fontWeight: p.bold ? "bold" : "normal",
|
|
20
|
+
padding: ".125rem .3rem",
|
|
21
|
+
borderRadius: ".5rem",
|
|
22
|
+
cursor: "inherit",
|
|
23
|
+
margin: ["major", "minor"].includes((_a = p.manner) !== null && _a !== void 0 ? _a : "flat")
|
|
24
|
+
? "-.125rem 0rem"
|
|
25
|
+
: "-.125rem -.3rem",
|
|
26
|
+
transition: "background .2s",
|
|
27
|
+
}, children: [p.label, p.external && !p.noIcon && (_jsx(ExternalLinkIcon, { size: 15, style: { marginLeft: ".25rem", marginBottom: ".05rem" } }))] }) }) }));
|
|
15
28
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ElbeProps } from "../..";
|
|
2
|
-
export declare function ProgressBar({ value, max,
|
|
2
|
+
export declare function ProgressBar({ value, max, manner, ...elbe }: {
|
|
3
3
|
value: number;
|
|
4
4
|
max?: number;
|
|
5
|
-
plain
|
|
5
|
+
manner: "flat" | "plain";
|
|
6
6
|
} & ElbeProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -10,21 +10,24 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
-
import { applyProps, clamp
|
|
13
|
+
import { applyProps, clamp } from "../..";
|
|
14
|
+
import { useApp } from "../app/app_ctxt";
|
|
14
15
|
export function ProgressBar(_a) {
|
|
15
|
-
var { value, max = 100,
|
|
16
|
-
const
|
|
17
|
-
const theme = useTheme()
|
|
18
|
-
|
|
16
|
+
var { value, max = 100, manner = "flat" } = _a, elbe = __rest(_a, ["value", "max", "manner"]);
|
|
17
|
+
const { _appThemeContext } = useApp();
|
|
18
|
+
const theme = _appThemeContext.useTheme().useWith(({ color }) => ({
|
|
19
|
+
color: Object.assign(Object.assign({}, color), { selection: Object.assign(Object.assign({}, color.selection), { manner: manner }) }),
|
|
20
|
+
}), [manner]);
|
|
21
|
+
return (_jsx("div", Object.assign({}, applyProps("progress_bar", Object.assign({ role: "progressbar" }, elbe), [], {
|
|
19
22
|
width: "100%",
|
|
20
23
|
height: "0.5rem",
|
|
21
|
-
borderRadius: theme.geometry.radius + "rem",
|
|
24
|
+
borderRadius: theme.theme.geometry.radius + "rem",
|
|
22
25
|
border: "none",
|
|
23
26
|
}), { children: _jsx("div", { style: {
|
|
24
27
|
width: `${clamp((value / max) * 100, 0, 100)}%`,
|
|
25
28
|
height: "100%",
|
|
26
|
-
backgroundColor:
|
|
27
|
-
transition:
|
|
28
|
-
borderRadius: theme.geometry.radius + "rem",
|
|
29
|
+
backgroundColor: theme.theme.color.currentColor.front.asCss(),
|
|
30
|
+
transition: theme.theme.motion.reduced ? "none" : "width 0.25s",
|
|
31
|
+
borderRadius: theme.theme.geometry.radius + "rem",
|
|
29
32
|
} }) })));
|
|
30
33
|
}
|
|
@@ -1,11 +1,6 @@
|
|
|
1
|
-
import { Component } from "react";
|
|
2
1
|
export type SpinnerProps = {
|
|
3
2
|
padding?: number;
|
|
4
3
|
};
|
|
5
|
-
export declare
|
|
4
|
+
export declare function Spinner(p: {
|
|
6
5
|
manner?: "flat" | "plain";
|
|
7
|
-
} & SpinnerProps
|
|
8
|
-
static flat: (p: SpinnerProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
-
static plain: (p: SpinnerProps) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
-
render(): import("react/jsx-runtime").JSX.Element;
|
|
11
|
-
}
|
|
6
|
+
} & SpinnerProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { useEffect, useMemo, useState } from "react";
|
|
3
|
+
import { useApp } from "../app/app_ctxt";
|
|
4
4
|
function _toPath(c, yFac, yOffset = 0, clamp = [0, 1], xFac = 1) {
|
|
5
5
|
return c
|
|
6
6
|
.filter((p) => p[0] >= clamp[0] && p[0] <= clamp[1])
|
|
@@ -10,20 +10,18 @@ function _toPath(c, yFac, yOffset = 0, clamp = [0, 1], xFac = 1) {
|
|
|
10
10
|
(p[1] * yFac + yOffset).toFixed(2))
|
|
11
11
|
.join(" ");
|
|
12
12
|
}
|
|
13
|
-
export
|
|
14
|
-
|
|
15
|
-
return _jsx(_Spinner, Object.assign({ manner: this.props.manner }, this.props));
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
Spinner.flat = (p) => new Spinner(Object.assign({ manner: "flat" }, p)).render();
|
|
19
|
-
Spinner.plain = (p) => new Spinner(Object.assign({ manner: "plain" }, p)).render();
|
|
20
|
-
function _Spinner(p) {
|
|
21
|
-
var _a, _b;
|
|
22
|
-
const tConfig = useThemeConfig();
|
|
23
|
-
const flat = ((_a = p.manner) !== null && _a !== void 0 ? _a : "flat") === "flat";
|
|
13
|
+
export function Spinner(p) {
|
|
14
|
+
var _a;
|
|
24
15
|
const [x, setX] = useState(0);
|
|
16
|
+
const { _appThemeContext } = useApp();
|
|
17
|
+
const theme = _appThemeContext.useTheme().useWith(({ color }) => {
|
|
18
|
+
var _a;
|
|
19
|
+
return ({
|
|
20
|
+
color: Object.assign(Object.assign({}, color), { selection: Object.assign(Object.assign({}, color.selection), { manner: (_a = p.manner) !== null && _a !== void 0 ? _a : "plain" }) }),
|
|
21
|
+
});
|
|
22
|
+
}, [p.manner]);
|
|
25
23
|
useEffect(() => {
|
|
26
|
-
if (
|
|
24
|
+
if (theme.theme.motion.reduced)
|
|
27
25
|
return () => { };
|
|
28
26
|
const interval = setInterval(() => {
|
|
29
27
|
setX((prev) => (prev + 2) % 100);
|
|
@@ -39,8 +37,9 @@ function _Spinner(p) {
|
|
|
39
37
|
}
|
|
40
38
|
return path;
|
|
41
39
|
}, [x]);
|
|
42
|
-
return (_jsx("div", {
|
|
43
|
-
padding: `${(
|
|
40
|
+
return (_jsx("div", { style: {
|
|
41
|
+
padding: `${(_a = p.padding) !== null && _a !== void 0 ? _a : 1}rem`,
|
|
42
|
+
color: theme.theme.color.currentColor.front.asCss(),
|
|
44
43
|
}, children: _jsx("svg", { style: { width: "40px", height: "40px" }, viewBox: `-10 -10 120 120`, children: [
|
|
45
44
|
_toPath(path, 13, 20, [0.4, 0.8], 1),
|
|
46
45
|
_toPath(path, 10, 50),
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import
|
|
3
|
-
import type
|
|
4
|
-
|
|
5
|
-
export type TextProps = {
|
|
2
|
+
import { ElbeTypeVariants } from "../theme/subthemes/_theme_type";
|
|
3
|
+
import { ElbeChildrenProps, type ElbeProps } from "./base/box";
|
|
4
|
+
export declare const elbeThemeVariants: ElbeTypeVariants[];
|
|
5
|
+
export type TextProps = ElbeProps & ElbeChildrenProps & {
|
|
6
6
|
align?: "start" | "center" | "end";
|
|
7
7
|
bold?: boolean;
|
|
8
8
|
italic?: boolean;
|
|
@@ -10,9 +10,8 @@ export type TextProps = {
|
|
|
10
10
|
striked?: boolean;
|
|
11
11
|
color?: string;
|
|
12
12
|
size?: number;
|
|
13
|
-
children?: ElbeChildren;
|
|
14
13
|
v?: string;
|
|
15
|
-
}
|
|
14
|
+
};
|
|
16
15
|
export declare class Text extends React.Component<TextProps & {
|
|
17
16
|
variant?: ElbeTypeVariants;
|
|
18
17
|
}> {
|
|
@@ -10,26 +10,24 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
-
import React from "react";
|
|
13
|
+
import React, { useMemo } from "react";
|
|
14
|
+
import { useApp } from "../app/app_ctxt";
|
|
14
15
|
import { applyProps } from "./base/box";
|
|
16
|
+
export const elbeThemeVariants = [
|
|
17
|
+
"h1",
|
|
18
|
+
"h2",
|
|
19
|
+
"h3",
|
|
20
|
+
"h4",
|
|
21
|
+
"h5",
|
|
22
|
+
"h6",
|
|
23
|
+
"bodyL",
|
|
24
|
+
"bodyM",
|
|
25
|
+
"bodyS",
|
|
26
|
+
"code",
|
|
27
|
+
];
|
|
15
28
|
export class Text extends React.Component {
|
|
16
29
|
render() {
|
|
17
|
-
|
|
18
|
-
return (_jsxs("span", Object.assign({}, applyProps("text", elbe, [
|
|
19
|
-
"text",
|
|
20
|
-
//align,
|
|
21
|
-
color,
|
|
22
|
-
variant,
|
|
23
|
-
], {
|
|
24
|
-
fontSize: size ? `${size}rem` : "",
|
|
25
|
-
color: color || "",
|
|
26
|
-
scrollMarginTop: "2rem",
|
|
27
|
-
textAlign: align,
|
|
28
|
-
fontWeight: bold ? "bold" : "",
|
|
29
|
-
fontStyle: italic ? "italic" : "",
|
|
30
|
-
textDecoration: underline ? "underline" : "",
|
|
31
|
-
textDecorationLine: striked ? "line-through" : "",
|
|
32
|
-
}), { children: [v, children] })));
|
|
30
|
+
return _jsx(_Text, Object.assign({}, this.props));
|
|
33
31
|
}
|
|
34
32
|
}
|
|
35
33
|
Text.h1 = (p) => _jsx(Text, Object.assign({}, p, { variant: "h1" }));
|
|
@@ -38,11 +36,26 @@ Text.h3 = (p) => _jsx(Text, Object.assign({}, p, { variant: "h3" }));
|
|
|
38
36
|
Text.h4 = (p) => _jsx(Text, Object.assign({}, p, { variant: "h4" }));
|
|
39
37
|
Text.h5 = (p) => _jsx(Text, Object.assign({}, p, { variant: "h5" }));
|
|
40
38
|
Text.h6 = (p) => _jsx(Text, Object.assign({}, p, { variant: "h6" }));
|
|
41
|
-
Text.s = (p) => _jsx(Text, Object.assign({}, p, { variant: "
|
|
42
|
-
Text.m = (p) => _jsx(Text, Object.assign({}, p, { variant: "
|
|
43
|
-
Text.l = (p) => _jsx(Text, Object.assign({}, p, { variant: "
|
|
39
|
+
Text.s = (p) => _jsx(Text, Object.assign({}, p, { variant: "bodyS" }));
|
|
40
|
+
Text.m = (p) => _jsx(Text, Object.assign({}, p, { variant: "bodyM" }));
|
|
41
|
+
Text.l = (p) => _jsx(Text, Object.assign({}, p, { variant: "bodyL" }));
|
|
44
42
|
Text.code = (p) => _jsx(Text, Object.assign({}, p, { variant: "code" }));
|
|
45
43
|
// replace the constructor with defaultProps so React receives the same props object
|
|
46
44
|
Text.defaultProps = {
|
|
47
|
-
variant: "
|
|
45
|
+
variant: "bodyM",
|
|
48
46
|
};
|
|
47
|
+
function _Text(p) {
|
|
48
|
+
const { _appThemeContext } = useApp();
|
|
49
|
+
const usedTheme = _appThemeContext.useTheme();
|
|
50
|
+
const tVariant = useMemo(() => {
|
|
51
|
+
var _a;
|
|
52
|
+
const v = usedTheme.theme.type[(_a = p.variant) !== null && _a !== void 0 ? _a : "bodyM"];
|
|
53
|
+
if (!v)
|
|
54
|
+
throw new Error(`Unknown text variant: ${p.variant}`);
|
|
55
|
+
return v;
|
|
56
|
+
}, [usedTheme, p.variant]);
|
|
57
|
+
const { align, bold, italic, underline, striked, color, size, children, variant, v } = p, elbe = __rest(p, ["align", "bold", "italic", "underline", "striked", "color", "size", "children", "variant", "v"]);
|
|
58
|
+
return (_jsxs("span", Object.assign({}, applyProps("text", elbe, [], Object.assign({ color: color !== null && color !== void 0 ? color : "", scrollMarginTop: "2rem", textAlign: align, textDecorationLine: striked ? "line-through" : "",
|
|
59
|
+
// disable auto wrap for code blocks
|
|
60
|
+
whiteSpace: "pre-wrap", fontSize: size ? size + "rem" : undefined }, tVariant.asCss({ bold, italic, underline, size }))), { children: [v, children] })));
|
|
61
|
+
}
|