elbe-ui 0.3.1 → 0.4.1
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 +12 -0
- package/dist/elbe.css +57 -56
- package/dist/elbe.css.map +1 -1
- package/dist/index.d.ts +6 -3
- package/dist/index.js +6 -3
- package/dist/ui/components/badge.d.ts +1 -1
- package/dist/ui/components/banner.d.ts +3 -2
- package/dist/ui/components/banner.js +13 -7
- package/dist/ui/components/base/box.d.ts +28 -27
- package/dist/ui/components/base/card.d.ts +6 -4
- package/dist/ui/components/base/card.js +6 -2
- package/dist/ui/components/base/roles.d.ts +1 -0
- package/dist/ui/components/base/roles.js +1 -0
- package/dist/ui/components/button/button.d.ts +1 -0
- package/dist/ui/components/button/button.js +12 -4
- package/dist/ui/components/button/choose_button.js +3 -2
- package/dist/ui/components/button/icon_button.d.ts +3 -0
- package/dist/ui/components/button/icon_button.js +9 -2
- package/dist/ui/components/button/toggle_button.js +7 -1
- package/dist/ui/components/dialog.d.ts +1 -1
- package/dist/ui/components/footer.js +1 -1
- package/dist/ui/components/input/checkbox.d.ts +2 -5
- package/dist/ui/components/input/checkbox.js +10 -19
- package/dist/ui/components/input/range.js +4 -1
- package/dist/ui/components/input/select.js +1 -1
- package/dist/ui/components/input/switch.d.ts +6 -2
- package/dist/ui/components/input/switch.js +25 -22
- package/dist/ui/components/input/text/input_field.d.ts +28 -0
- package/dist/ui/components/input/text/input_field.js +70 -0
- package/dist/ui/components/input/text/multi_line.d.ts +10 -0
- package/dist/ui/components/input/text/multi_line.js +19 -0
- package/dist/ui/components/input/text/single_line.d.ts +18 -0
- package/dist/ui/components/input/text/single_line.js +28 -0
- package/dist/ui/components/layout/app_base.d.ts +14 -0
- package/dist/ui/components/layout/app_base.js +30 -0
- package/dist/ui/components/layout/ctx_app_base.d.ts +16 -0
- package/dist/ui/components/layout/ctx_app_base.js +13 -0
- package/dist/ui/components/layout/flex.d.ts +4 -2
- package/dist/ui/components/layout/flex.js +13 -5
- package/dist/ui/components/layout/header.d.ts +18 -18
- package/dist/ui/components/layout/header.js +54 -48
- package/dist/ui/components/layout/menu.d.ts +12 -0
- package/dist/ui/components/layout/menu.js +59 -0
- package/dist/ui/components/layout/spaced.d.ts +4 -2
- package/dist/ui/components/layout/spaced.js +6 -2
- package/dist/ui/components/layout/toolbar.d.ts +7 -0
- package/dist/ui/components/layout/toolbar.js +71 -0
- package/dist/ui/components/progress_bar.js +7 -5
- package/dist/ui/components/spinner.js +4 -0
- package/dist/ui/components/text.d.ts +1 -1
- package/dist/ui/components/text.js +4 -4
- package/dist/ui/theme/color_theme.d.ts +1 -1
- package/dist/ui/theme/color_theme.js +63 -52
- package/dist/ui/theme/colors.d.ts +33 -13
- package/dist/ui/theme/colors.js +42 -15
- package/dist/ui/theme/geometry_theme.js +2 -4
- package/dist/ui/theme/seed.d.ts +18 -8
- package/dist/ui/theme/seed.js +4 -1
- package/dist/ui/theme/theme.d.ts +3 -5
- package/dist/ui/theme/theme.js +9 -12
- package/dist/ui/theme/theme_context.d.ts +18 -0
- package/dist/ui/theme/theme_context.js +26 -0
- package/dist/ui/theme/type_theme.js +5 -2
- package/dist/ui/util/ctx_toolbar.d.ts +8 -0
- package/dist/ui/util/ctx_toolbar.js +9 -0
- package/dist/ui/util/l10n/l10n.d.ts +35 -0
- package/dist/ui/util/l10n/l10n.js +68 -0
- package/dist/ui/util/single_key.d.ts +11 -0
- package/dist/ui/util/single_key.js +1 -0
- package/dist/ui/util/types.d.ts +9 -0
- package/dist/ui/util/types.js +1 -0
- package/dist/ui/util/util.d.ts +5 -3
- package/dist/ui/util/util.js +36 -1
- package/package.json +1 -1
- package/dist/ui/components/input/input_field.d.ts +0 -22
- package/dist/ui/components/input/input_field.js +0 -36
- package/dist/ui/components/input/text_area.d.ts +0 -10
- package/dist/ui/components/input/text_area.js +0 -22
- package/dist/ui/components/layout/scaffold.d.ts +0 -15
- package/dist/ui/components/layout/scaffold.js +0 -31
|
@@ -15,17 +15,25 @@ export function FlexSpace({}) {
|
|
|
15
15
|
return _jsx("div", { style: "flex:1" });
|
|
16
16
|
}
|
|
17
17
|
export function Column(_a) {
|
|
18
|
-
var { gap = 1, main = "start", cross = "stretch", children } = _a, p = __rest(_a, ["gap", "main", "cross", "children"]);
|
|
19
|
-
return _Flex(false, { gap, main, cross, children }, p, false);
|
|
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 _Flex(false, { gap, main, cross, scroll, noScrollbar, children }, p, false);
|
|
20
20
|
}
|
|
21
21
|
export function Row(_a) {
|
|
22
|
-
var { gap = 1, main = "start", cross, wrap = false, children } = _a, p = __rest(_a, ["gap", "main", "cross", "wrap", "children"]);
|
|
23
|
-
return _Flex(true, { gap, main, cross, children }, p, wrap);
|
|
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 _Flex(true, { gap, main, cross, scroll, noScrollbar, children }, p, wrap);
|
|
24
24
|
}
|
|
25
25
|
function _Flex(row, p, elbe, wraps) {
|
|
26
|
-
|
|
26
|
+
var _a;
|
|
27
|
+
return (_jsx("div", Object.assign({}, applyProps("flex", elbe, [
|
|
28
|
+
row ? "row" : "column",
|
|
29
|
+
wraps && "wrap",
|
|
30
|
+
p.noScrollbar && "no-scrollbar",
|
|
31
|
+
], {
|
|
27
32
|
justifyContent: p.main,
|
|
28
33
|
alignItems: p.cross,
|
|
29
34
|
gap: `${p.gap}rem`,
|
|
35
|
+
overflowX: !row ? null : p.scroll ? "auto" : null,
|
|
36
|
+
overflowY: row ? null : p.scroll ? "auto" : null,
|
|
37
|
+
flex: ((_a = p.flex) !== null && _a !== void 0 ? _a : p.scroll) ? 1 : null,
|
|
30
38
|
}), { children: p.children })));
|
|
31
39
|
}
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export type
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { ElbeChild } from "../../..";
|
|
2
|
+
export type HeaderLogos = {
|
|
3
|
+
logo?: string | ElbeChild;
|
|
4
|
+
logoDark?: string | ElbeChild;
|
|
5
|
+
endLogo?: string | ElbeChild;
|
|
6
|
+
endLogoDark?: string | ElbeChild;
|
|
7
7
|
};
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}): JSX.Element;
|
|
8
|
+
export declare function Header(p: HeaderLogos & {
|
|
9
|
+
leading?: ElbeChild | "back" | "close";
|
|
10
|
+
title: string | ElbeChild;
|
|
11
|
+
centerTitle?: boolean;
|
|
12
|
+
actions?: ElbeChild[];
|
|
13
|
+
}): import("preact").JSX.Element;
|
|
14
|
+
export declare function BackButton(p: {
|
|
15
|
+
onTap: () => void;
|
|
16
|
+
}): import("preact").JSX.Element;
|
|
17
|
+
export declare function CloseButton(p: {
|
|
18
|
+
onTap: () => void;
|
|
19
|
+
}): import("preact").JSX.Element;
|
|
@@ -1,52 +1,58 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "preact/jsx-runtime";
|
|
2
|
+
import { ChevronLeft, MenuIcon, XIcon } from "lucide-react";
|
|
2
3
|
import { useEffect, useState } from "preact/hooks";
|
|
3
|
-
import { IconButton,
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
4
|
+
import { Card, IconButton, Text, useLayoutMode, useSiteScroll, useTheme, useThemeConfig, } from "../../..";
|
|
5
|
+
import { maybeAppBase } from "./ctx_app_base";
|
|
6
|
+
import { _Toolbar } from "./toolbar";
|
|
7
|
+
const _backBtn = _jsx(BackButton, { onTap: () => history.go(-1) });
|
|
8
|
+
const _closeBtn = _jsx(CloseButton, { onTap: () => history.go(-1) });
|
|
9
|
+
export function Header(p) {
|
|
10
|
+
var _a, _b, _c, _d, _e, _f;
|
|
11
|
+
const appBase = maybeAppBase();
|
|
12
|
+
const layoutMode = useLayoutMode();
|
|
13
|
+
const scroll = useSiteScroll();
|
|
14
|
+
const tConfig = useThemeConfig();
|
|
15
|
+
const theme = useTheme();
|
|
16
|
+
return (_jsxs(Card, { padding: 0, scheme: "primary", bordered: true, frosted: !tConfig.highVis, sharp: true, style: {
|
|
17
|
+
position: "sticky",
|
|
18
|
+
top: 0,
|
|
19
|
+
left: 0,
|
|
20
|
+
right: 0,
|
|
21
|
+
height: `${4 + theme.geometry.borderWidth}rem`,
|
|
22
|
+
padding: ".5rem",
|
|
23
|
+
display: "flex",
|
|
24
|
+
alignItems: "center",
|
|
25
|
+
borderTop: "none",
|
|
26
|
+
borderLeft: "none",
|
|
27
|
+
borderRight: "none",
|
|
28
|
+
borderColor: tConfig.highVis || scroll ? null : "transparent",
|
|
29
|
+
gap: "1rem",
|
|
30
|
+
zIndex: 80,
|
|
31
|
+
}, children: [p.leading === "back" && _backBtn, p.leading === "close" && _closeBtn, typeof p.leading === "function"
|
|
32
|
+
? p.leading
|
|
33
|
+
: appBase &&
|
|
34
|
+
layoutMode != "wide" && (_jsx(IconButton.plain, { ariaLabel: "open/close menu", onTap: () => appBase.setMenuOpen(!appBase.menuOpen), icon: MenuIcon })), _jsx(_Logo, { logo: (_a = p.logo) !== null && _a !== void 0 ? _a : appBase === null || appBase === void 0 ? void 0 : appBase.icons.logo, logoDark: (_b = p.logoDark) !== null && _b !== void 0 ? _b : appBase === null || appBase === void 0 ? void 0 : appBase.icons.logoDark, lMargin: 0.5 }), typeof p.title === "string" ? (_jsx(Text.h3, { style: {
|
|
35
|
+
marginLeft: !appBase || layoutMode === "wide" ? ".5rem" : 0,
|
|
36
|
+
}, align: p.centerTitle ? "center" : "start", flex: 1, v: p.title })) : (_jsx("div", { style: { flex: 1 }, children: p.title })), _jsx(_Toolbar, { actions: [...((_c = p.actions) !== null && _c !== void 0 ? _c : []), ...((_d = appBase === null || appBase === void 0 ? void 0 : appBase.globalActions) !== null && _d !== void 0 ? _d : [])] }), layoutMode === "wide" && (_jsx(_Logo, { logo: (_e = p.endLogo) !== null && _e !== void 0 ? _e : appBase === null || appBase === void 0 ? void 0 : appBase.icons.endLogo, logoDark: (_f = p.endLogoDark) !== null && _f !== void 0 ? _f : appBase === null || appBase === void 0 ? void 0 : appBase.icons.endLogoDark, rMargin: 0.5 }))] }));
|
|
35
37
|
}
|
|
36
|
-
function
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
38
|
+
function _Logo(p) {
|
|
39
|
+
var _a, _b;
|
|
40
|
+
const tConfig = useThemeConfig();
|
|
41
|
+
const [logo, setLogo] = useState(p.logo);
|
|
42
|
+
useEffect(() => { var _a; return setLogo(tConfig.dark ? (_a = p.logoDark) !== null && _a !== void 0 ? _a : p.logo : p.logo); }, [tConfig]);
|
|
43
|
+
return !logo ? null : (_jsx("div", { style: {
|
|
44
|
+
display: "flex",
|
|
45
|
+
alignItems: "center",
|
|
46
|
+
justifyContent: "center",
|
|
47
|
+
marginLeft: `${(_a = p.lMargin) !== null && _a !== void 0 ? _a : 0}rem`,
|
|
48
|
+
marginRight: `${(_b = p.rMargin) !== null && _b !== void 0 ? _b : 0}rem`,
|
|
49
|
+
}, children: typeof logo === "string" ? (_jsx("img", { src: logo, style: {
|
|
50
|
+
height: "1.25rem",
|
|
51
|
+
} })) : (p.logo) }));
|
|
52
|
+
}
|
|
53
|
+
export function BackButton(p) {
|
|
54
|
+
return (_jsx(IconButton.plain, { ariaLabel: "go back", onTap: p.onTap, icon: ChevronLeft }));
|
|
55
|
+
}
|
|
56
|
+
export function CloseButton(p) {
|
|
57
|
+
return _jsx(IconButton.plain, { ariaLabel: "close", onTap: p.onTap, icon: XIcon });
|
|
52
58
|
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ElbeChild } from "../../..";
|
|
2
|
+
import { IconChild } from "../button/icon_button";
|
|
3
|
+
export type MenuItem = {
|
|
4
|
+
id: string;
|
|
5
|
+
label: string;
|
|
6
|
+
icon?: IconChild;
|
|
7
|
+
bottom?: boolean;
|
|
8
|
+
component?: ElbeChild;
|
|
9
|
+
};
|
|
10
|
+
export declare function Menu(p: {
|
|
11
|
+
items: MenuItem[];
|
|
12
|
+
}): import("preact").JSX.Element;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "preact/jsx-runtime";
|
|
2
|
+
import { MenuIcon } from "lucide-react";
|
|
3
|
+
import { useLayoutMode, useTheme, useThemeConfig } from "../../..";
|
|
4
|
+
import { Card, elevatedShadow } from "../base/card";
|
|
5
|
+
import { Button } from "../button/button";
|
|
6
|
+
import { useAppBase } from "./ctx_app_base";
|
|
7
|
+
import { Column } from "./flex";
|
|
8
|
+
export function Menu(p) {
|
|
9
|
+
const layoutMode = useLayoutMode();
|
|
10
|
+
const appBase = useAppBase();
|
|
11
|
+
const tConfig = useThemeConfig();
|
|
12
|
+
const theme = useTheme();
|
|
13
|
+
const topBot = { top: [], bottom: [] };
|
|
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 == "wide";
|
|
21
|
+
const menuWidth = () => appBase.menuOpen
|
|
22
|
+
? layoutMode === "mobile"
|
|
23
|
+
? "100vw"
|
|
24
|
+
: `${17 + theme.geometry.borderWidth}rem`
|
|
25
|
+
: layoutMode === "wide"
|
|
26
|
+
? `${4 + theme.geometry.borderWidth}rem`
|
|
27
|
+
: "0";
|
|
28
|
+
return (_jsxs(_Fragment, { children: [layoutMode == "wide" && (_jsx("div", { style: {
|
|
29
|
+
width: menuWidth(),
|
|
30
|
+
} })), _jsx("div", { onClick: () => appBase.setMenuOpen(false), style: Object.assign({ zIndex: 100, position: "fixed", left: 0, top: 0, width: 0, height: 0, backgroundColor: "rgba(0,0,0,0)", transition: "background-color 200ms ease-in-out" }, (layoutMode === "narrow" && appBase.menuOpen
|
|
31
|
+
? {
|
|
32
|
+
backdropFilter: "blur(5px)",
|
|
33
|
+
backgroundColor: "rgba(0,0,0,.2)",
|
|
34
|
+
width: "100vw",
|
|
35
|
+
height: "100vh",
|
|
36
|
+
}
|
|
37
|
+
: {})) }), _jsx(Card, { onTap: () => {
|
|
38
|
+
if (layoutMode == "wide")
|
|
39
|
+
return;
|
|
40
|
+
appBase.setMenuOpen(false);
|
|
41
|
+
}, sharp: layoutMode == "mobile", 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",
|
|
42
|
+
//display: appBase.menuOpen || layoutMode == "wide" ? "flex" : "none",
|
|
43
|
+
flexDirection: "column", justifyContent: "start", alignItems: "stretch", borderTopLeftRadius: 0, borderBottomLeftRadius: 0, borderLeft: "none", borderTop: "none", borderBottom: "none", borderColor: tConfig.highVis ? null : "transparent", gap: "1rem", transition: tConfig.reducedMotion
|
|
44
|
+
? "none"
|
|
45
|
+
: "width 200ms ease-in-out" }, (layoutMode === "narrow" && appBase.menuOpen
|
|
46
|
+
? {
|
|
47
|
+
boxShadow: elevatedShadow,
|
|
48
|
+
}
|
|
49
|
+
: {})), children: wideOrOpen() && (_jsxs(_Fragment, { children: [_jsx(Button.plain, { contentAlign: "start", ariaLabel: "open/close menu", onTap: () => appBase.setMenuOpen(!appBase.menuOpen), icon: MenuIcon, style: {
|
|
50
|
+
marginBottom: ".5rem",
|
|
51
|
+
borderRadius: "3rem",
|
|
52
|
+
} }), _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 })))] })) })] }));
|
|
53
|
+
}
|
|
54
|
+
function _MenuItemView({ item }) {
|
|
55
|
+
const appBase = useAppBase();
|
|
56
|
+
return (_jsx(Button, { ariaLabel: item.label, contentAlign: "start", manner: item.id === appBase.menuSelected ? "major" : "plain", label: appBase.menuOpen ? item.label : undefined, icon: item.icon, onTap: item.component != null
|
|
57
|
+
? () => appBase.setMenuSelected(item.id)
|
|
58
|
+
: undefined }));
|
|
59
|
+
}
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx } from "preact/jsx-runtime";
|
|
2
|
-
export function Spaced({ amount = 1 }) {
|
|
3
|
-
|
|
2
|
+
export function Spaced({ width, height, amount = 1, }) {
|
|
3
|
+
const fromWH = !!(width || height);
|
|
4
|
+
return (_jsx("div", { style: {
|
|
5
|
+
width: (fromWH ? width !== null && width !== void 0 ? width : 0 : amount) + "rem",
|
|
6
|
+
height: (fromWH ? height !== null && height !== void 0 ? height : 0 : amount) + "rem",
|
|
7
|
+
} }));
|
|
4
8
|
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "preact/jsx-runtime";
|
|
2
|
+
import { MoreVertical } from "lucide-react";
|
|
3
|
+
import { useEffect, useState } from "preact/hooks";
|
|
4
|
+
import { Card, elevatedShadow, IconButton, ToolbarContext, useLayoutMode, useThemeConfig, } from "../../..";
|
|
5
|
+
import { maybeAppBase } from "./ctx_app_base";
|
|
6
|
+
export function _Toolbar(p) {
|
|
7
|
+
const [sections, setSections] = useState([
|
|
8
|
+
[],
|
|
9
|
+
[],
|
|
10
|
+
]);
|
|
11
|
+
const appBase = maybeAppBase();
|
|
12
|
+
const layoutMode = useLayoutMode();
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
const cutoff = layoutMode === "wide" ? 5 : 2;
|
|
15
|
+
const bar = [];
|
|
16
|
+
const overflow = [];
|
|
17
|
+
for (let i = 0; i < p.actions.length; i++) {
|
|
18
|
+
const e = p.actions[i];
|
|
19
|
+
if (i < cutoff)
|
|
20
|
+
bar.push(e);
|
|
21
|
+
else
|
|
22
|
+
overflow.push(e);
|
|
23
|
+
}
|
|
24
|
+
setSections([bar, overflow]);
|
|
25
|
+
}, [p.actions, layoutMode]);
|
|
26
|
+
return (_jsx(ToolbarContext.Provider, { value: "toolbar", children: _jsxs("div", { style: {
|
|
27
|
+
display: "flex",
|
|
28
|
+
flexDirection: "row",
|
|
29
|
+
gap: ".5rem",
|
|
30
|
+
alignItems: "center",
|
|
31
|
+
}, children: [sections[0], _jsx(OverflowMenu, { items: sections[1] })] }) }));
|
|
32
|
+
}
|
|
33
|
+
export function OverflowMenu(p) {
|
|
34
|
+
var _a;
|
|
35
|
+
const [open, setOpen] = useState(false);
|
|
36
|
+
const tConfig = useThemeConfig();
|
|
37
|
+
return !((_a = p.items) === null || _a === void 0 ? void 0 : _a.length) ? null : (_jsxs("div", { style: {
|
|
38
|
+
position: "relative",
|
|
39
|
+
zIndex: 21,
|
|
40
|
+
}, children: [open && (_jsx("div", { onClick: () => setOpen(false), style: {
|
|
41
|
+
position: "fixed",
|
|
42
|
+
top: 0,
|
|
43
|
+
right: 0,
|
|
44
|
+
width: "100vw",
|
|
45
|
+
height: "100vh",
|
|
46
|
+
backgroundColor: "transparent",
|
|
47
|
+
boxShadow: elevatedShadow,
|
|
48
|
+
zIndex: 20,
|
|
49
|
+
} })), _jsx(IconButton.plain, { ariaLabel: "open/close menu", icon: MoreVertical, onTap: () => setOpen(!open) }), _jsx("div", { style: {
|
|
50
|
+
zIndex: 21,
|
|
51
|
+
position: "absolute",
|
|
52
|
+
top: 0,
|
|
53
|
+
right: 0,
|
|
54
|
+
transform: open ? "scale(1)" : "scale(.6)",
|
|
55
|
+
opacity: open ? 1 : 0,
|
|
56
|
+
transition: tConfig.reducedMotion
|
|
57
|
+
? null
|
|
58
|
+
: "transform 200ms ease-in-out, opacity 200ms ease-in-out",
|
|
59
|
+
}, children: open && (_jsx(ToolbarContext.Provider, { value: "overflow", children: _jsx(Card, { onTap: () => setOpen(false), scheme: "primary", elevated: true, style: {
|
|
60
|
+
display: "flex",
|
|
61
|
+
flexDirection: "column",
|
|
62
|
+
gap: ".5rem",
|
|
63
|
+
alignItems: "stretch",
|
|
64
|
+
position: "absolute",
|
|
65
|
+
top: "3rem",
|
|
66
|
+
right: 0,
|
|
67
|
+
padding: ".5rem",
|
|
68
|
+
width: "fit-content",
|
|
69
|
+
zIndex: 21,
|
|
70
|
+
}, children: p.items }) })) })] }));
|
|
71
|
+
}
|
|
@@ -10,19 +10,21 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx } from "preact/jsx-runtime";
|
|
13
|
-
import { applyProps, clamp } from "../..";
|
|
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"]);
|
|
16
|
-
|
|
16
|
+
const tConfig = useThemeConfig();
|
|
17
|
+
const theme = useTheme();
|
|
18
|
+
return (_jsx("div", Object.assign({}, applyProps("progress_bar", Object.assign({ role: "progressbar" }, elbe), [plain ? "plain" : "accent minor"], {
|
|
17
19
|
width: "100%",
|
|
18
20
|
height: "0.5rem",
|
|
19
|
-
borderRadius: "
|
|
21
|
+
borderRadius: theme.geometry.radius + "rem",
|
|
20
22
|
border: "none",
|
|
21
23
|
}), { children: _jsx("div", { style: {
|
|
22
24
|
width: `${clamp((value / max) * 100, 0, 100)}%`,
|
|
23
25
|
height: "100%",
|
|
24
26
|
backgroundColor: "var(--c-context-front)",
|
|
25
|
-
transition: "width 0.25s",
|
|
26
|
-
borderRadius: "
|
|
27
|
+
transition: tConfig.reducedMotion ? "none" : "width 0.25s",
|
|
28
|
+
borderRadius: theme.geometry.radius + "rem",
|
|
27
29
|
} }) })));
|
|
28
30
|
}
|
|
@@ -2,6 +2,7 @@ import { jsx as _jsx } from "preact/jsx-runtime";
|
|
|
2
2
|
import { useComputed, useSignal } from "@preact/signals";
|
|
3
3
|
import { Component } from "preact";
|
|
4
4
|
import { useEffect } from "preact/hooks";
|
|
5
|
+
import { useThemeConfig } from "../theme/theme_context";
|
|
5
6
|
function _toPath(c, yFac, yOffset = 0, clamp = [0, 1], xFac = 1) {
|
|
6
7
|
return c
|
|
7
8
|
.filter((p) => p[0] >= clamp[0] && p[0] <= clamp[1])
|
|
@@ -14,9 +15,12 @@ function _toPath(c, yFac, yOffset = 0, clamp = [0, 1], xFac = 1) {
|
|
|
14
15
|
export class Spinner extends Component {
|
|
15
16
|
render() {
|
|
16
17
|
var _a, _b;
|
|
18
|
+
const tConfig = useThemeConfig();
|
|
17
19
|
const flat = ((_a = this.props.manner) !== null && _a !== void 0 ? _a : "flat") === "flat";
|
|
18
20
|
const xSig = useSignal(0);
|
|
19
21
|
useEffect(() => {
|
|
22
|
+
if (tConfig.reducedMotion)
|
|
23
|
+
return;
|
|
20
24
|
const interval = setInterval(() => {
|
|
21
25
|
xSig.value = (xSig.value + 2) % 100;
|
|
22
26
|
}, 16);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from "preact/compat";
|
|
2
2
|
import type { ElbeTypeVariants } from "../theme/type_theme";
|
|
3
|
-
import type { ElbeChildren } from "../util/
|
|
3
|
+
import type { ElbeChildren } from "../util/types";
|
|
4
4
|
import { type ElbeProps } from "./base/box";
|
|
5
5
|
export type TextProps = {
|
|
6
6
|
align?: "start" | "center" | "end";
|
|
@@ -22,10 +22,6 @@ export class Text extends React.Component {
|
|
|
22
22
|
return (_jsxs("span", Object.assign({}, applyProps("text", elbe, [
|
|
23
23
|
"text",
|
|
24
24
|
//align,
|
|
25
|
-
bold && "b",
|
|
26
|
-
italic && "i",
|
|
27
|
-
underline && "underline",
|
|
28
|
-
striked && "striked",
|
|
29
25
|
color,
|
|
30
26
|
variant,
|
|
31
27
|
], {
|
|
@@ -33,6 +29,10 @@ export class Text extends React.Component {
|
|
|
33
29
|
color: color || "",
|
|
34
30
|
scrollMarginTop: "2rem",
|
|
35
31
|
textAlign: align,
|
|
32
|
+
fontWeight: bold ? "bold" : "",
|
|
33
|
+
fontStyle: italic ? "italic" : "",
|
|
34
|
+
textDecoration: underline ? "underline" : "",
|
|
35
|
+
textDecorationLine: striked ? "line-through" : "",
|
|
36
36
|
}), { children: [v, children] })));
|
|
37
37
|
}
|
|
38
38
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { ColorThemeSeed, PartialColorThemeSeed } from "./seed";
|
|
2
|
-
export declare function colorThemePreset(merge?: Partial<PartialColorThemeSeed
|
|
2
|
+
export declare function colorThemePreset(merge?: Partial<PartialColorThemeSeed>): ColorThemeSeed;
|
|
@@ -1,81 +1,92 @@
|
|
|
1
|
-
import { colors, LayerColor } from "./colors";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
return s;
|
|
8
|
-
//if (bL === 0) return s.mirrorBrightness();
|
|
9
|
-
if (s.luminance == 0)
|
|
10
|
-
return s.mirrorBrightness();
|
|
11
|
-
return s.inter(LayerColor.fromBack(bL > 0.5 ? colors.black : colors.white), 0.1);
|
|
12
|
-
};
|
|
1
|
+
import { colors, LayerColor, } from "./colors";
|
|
2
|
+
import { lColor } from "./seed";
|
|
3
|
+
export function colorThemePreset(merge
|
|
4
|
+
//highVis: boolean = false
|
|
5
|
+
) {
|
|
6
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
|
|
13
7
|
const seed = merge !== null && merge !== void 0 ? merge : {};
|
|
14
8
|
return {
|
|
15
9
|
base: (_a = seed.base) !== null && _a !== void 0 ? _a : LayerColor.fromBack(colors.white),
|
|
16
|
-
accent:
|
|
17
|
-
? LayerColor.fromHex("#000000")
|
|
18
|
-
: (_b = seed.accent) !== null && _b !== void 0 ? _b : LayerColor.fromBack(colors.blueAccent),
|
|
10
|
+
accent: (_b = seed.accent) !== null && _b !== void 0 ? _b : LayerColor.fromBack(colors.blueAccent),
|
|
19
11
|
info: (_c = seed.info) !== null && _c !== void 0 ? _c : LayerColor.fromBack(colors.blue),
|
|
20
12
|
success: (_d = seed.success) !== null && _d !== void 0 ? _d : LayerColor.fromBack(colors.green),
|
|
21
13
|
warning: (_e = seed.warning) !== null && _e !== void 0 ? _e : LayerColor.fromBack(colors.yellow),
|
|
22
14
|
error: (_f = seed.error) !== null && _f !== void 0 ? _f : LayerColor.fromBack(colors.red),
|
|
15
|
+
contrast: {
|
|
16
|
+
highvis: (_h = (_g = seed.contrast) === null || _g === void 0 ? void 0 : _g.highvis) !== null && _h !== void 0 ? _h : (({ seed }) => (Object.assign(Object.assign({}, seed), { accent: LayerColor.fromBack(colors.black) }))),
|
|
17
|
+
normal: (_k = (_j = seed.contrast) === null || _j === void 0 ? void 0 : _j.normal) !== null && _k !== void 0 ? _k : (({ seed }) => seed),
|
|
18
|
+
},
|
|
23
19
|
mode: {
|
|
24
|
-
light: (
|
|
25
|
-
dark: (
|
|
20
|
+
light: (_m = (_l = seed.mode) === null || _l === void 0 ? void 0 : _l.light) !== null && _m !== void 0 ? _m : (({ base }) => base),
|
|
21
|
+
dark: (_p = (_o = seed.mode) === null || _o === void 0 ? void 0 : _o.dark) !== null && _p !== void 0 ? _p : (({ base }) => base.mirrorBrightness()),
|
|
26
22
|
},
|
|
27
23
|
scheme: {
|
|
28
|
-
primary: (
|
|
29
|
-
secondary:
|
|
30
|
-
|
|
31
|
-
|
|
24
|
+
primary: (_r = (_q = seed.scheme) === null || _q === void 0 ? void 0 : _q.primary) !== null && _r !== void 0 ? _r : _makePrimary,
|
|
25
|
+
secondary: (p) => {
|
|
26
|
+
var _a, _b, _c, _d;
|
|
27
|
+
const highVis = p.path.includes("highvis");
|
|
28
|
+
return (highVis
|
|
29
|
+
? (_b = (_a = seed.scheme) === null || _a === void 0 ? void 0 : _a.primary) !== null && _b !== void 0 ? _b : _makePrimary
|
|
30
|
+
: (_d = (_c = seed.scheme) === null || _c === void 0 ? void 0 : _c.secondary) !== null && _d !== void 0 ? _d : _makeSecondary)(p);
|
|
31
|
+
},
|
|
32
32
|
inverse: (_t = (_s = seed.scheme) === null || _s === void 0 ? void 0 : _s.inverse) !== null && _t !== void 0 ? _t : _makeInverse,
|
|
33
33
|
},
|
|
34
34
|
style: {
|
|
35
|
-
accent:
|
|
36
|
-
info:
|
|
37
|
-
success:
|
|
38
|
-
warning:
|
|
39
|
-
error:
|
|
35
|
+
accent: _styleSel,
|
|
36
|
+
info: _styleSel,
|
|
37
|
+
success: _styleSel,
|
|
38
|
+
warning: _styleSel,
|
|
39
|
+
error: _styleSel,
|
|
40
40
|
},
|
|
41
41
|
variant: {
|
|
42
42
|
major: (_v = (_u = seed.variant) === null || _u === void 0 ? void 0 : _u.major) !== null && _v !== void 0 ? _v : _makeMajor,
|
|
43
|
-
minor: (
|
|
44
|
-
|
|
43
|
+
minor: (p) => {
|
|
44
|
+
var _a, _b;
|
|
45
|
+
if ((_a = seed.variant) === null || _a === void 0 ? void 0 : _a.minor)
|
|
46
|
+
return (_b = seed.variant) === null || _b === void 0 ? void 0 : _b.minor(p);
|
|
47
|
+
const highVis = p.path.includes("highvis");
|
|
48
|
+
return highVis ? _makeMajor(p) : _makeMinor(p);
|
|
49
|
+
},
|
|
50
|
+
flat: (_x = (_w = seed.variant) === null || _w === void 0 ? void 0 : _w.flat) !== null && _x !== void 0 ? _x : _makeFlat,
|
|
45
51
|
},
|
|
46
52
|
};
|
|
47
53
|
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
54
|
+
const _styleSel = ({ base, style }) => {
|
|
55
|
+
const bL = base.luminance;
|
|
56
|
+
if (bL === 1)
|
|
57
|
+
return style;
|
|
58
|
+
//if (bL === 0) return s.mirrorBrightness();
|
|
59
|
+
if (style.luminance == 0)
|
|
60
|
+
return style.mirrorBrightness();
|
|
61
|
+
return style.inter(LayerColor.fromBack(bL > 0.5 ? colors.black : colors.white), 0.1);
|
|
62
|
+
};
|
|
63
|
+
const _makePrimary = (p) => p.base;
|
|
64
|
+
const _makeSecondary = ({ base, seed }) => new LayerColor(base.back
|
|
65
|
+
.inter(lColor(seed.accent).back, base.back.luminance < 0.3 ? 0.2 : 0.1)
|
|
66
|
+
.desaturated(0.5), base.front, base.border);
|
|
67
|
+
const _makeInverse = ({ base }) => base.mirrorBrightness();
|
|
68
|
+
const _makeMajor = ({ style, path }) => {
|
|
59
69
|
return LayerColor.fromBack(style.back, { border: style.back });
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
const b =
|
|
70
|
+
};
|
|
71
|
+
const _makeMinor = ({ base, style }) => {
|
|
72
|
+
const b = base.back;
|
|
63
73
|
const backIn = b.mirrorBrightness();
|
|
64
74
|
const major = style.back;
|
|
65
75
|
const minor = style.back.inter(b, 0.8);
|
|
66
76
|
const minorFront = minor.hasWCAGContrast(major) ? major : null;
|
|
67
77
|
return new LayerColor(style.back.withAlpha(0.25), minorFront !== null && minorFront !== void 0 ? minorFront : major.inter(backIn, 0.6), minorFront !== null && minorFront !== void 0 ? minorFront : major.inter(backIn, 0.3));
|
|
68
|
-
}
|
|
69
|
-
|
|
78
|
+
};
|
|
79
|
+
const _makeFlat = ({ path, style, base }) => {
|
|
80
|
+
const highVis = path.includes("highvis");
|
|
70
81
|
const front = !style
|
|
71
|
-
?
|
|
72
|
-
:
|
|
82
|
+
? base.front
|
|
83
|
+
: base.back.hasWCAGContrast(style === null || style === void 0 ? void 0 : style.back)
|
|
73
84
|
? style === null || style === void 0 ? void 0 : style.back
|
|
74
|
-
: style === null || style === void 0 ? void 0 : style.back.inter(
|
|
75
|
-
const isDark =
|
|
85
|
+
: style === null || style === void 0 ? void 0 : style.back.inter(base.front, 0.6);
|
|
86
|
+
const isDark = base.back.luminance < 0.3;
|
|
76
87
|
const border = !highVis && !style
|
|
77
|
-
?
|
|
78
|
-
:
|
|
79
|
-
return new LayerColor(
|
|
88
|
+
? base.front.inter(base.back, isDark ? 0.75 : 0.9)
|
|
89
|
+
: base.front;
|
|
90
|
+
return new LayerColor(base.back, //.withAlpha(0),
|
|
80
91
|
front, highVis ? border : null, border);
|
|
81
|
-
}
|
|
92
|
+
};
|