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
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from "react";
|
|
3
|
+
import { useApp } from "../../app/app_ctxt";
|
|
4
|
+
export function WithStateTheme(p) {
|
|
5
|
+
const { _appThemeContext } = useApp();
|
|
6
|
+
const [elState, setElState] = useState("neutral");
|
|
7
|
+
if (!p.theme) {
|
|
8
|
+
console.error("WithStateTheme: No theme provided");
|
|
9
|
+
}
|
|
10
|
+
const theme = p.theme.useWith(({ color }) => {
|
|
11
|
+
var _a;
|
|
12
|
+
return ({
|
|
13
|
+
color: Object.assign(Object.assign({}, color), { selection: Object.assign(Object.assign({}, color.selection), { manner: (_a = p.manner) !== null && _a !== void 0 ? _a : color.selection.manner, state: p.disabled ? "disabled" : elState }) }),
|
|
14
|
+
});
|
|
15
|
+
}, [p.theme, elState, p.disabled, p.manner]);
|
|
16
|
+
return (_jsx(_appThemeContext.WithTheme, { theme: theme, children: _jsx("div", { onMouseEnter: (e) => {
|
|
17
|
+
e.stopPropagation();
|
|
18
|
+
setElState("hover");
|
|
19
|
+
}, onMouseLeave: (e) => {
|
|
20
|
+
//e.stopPropagation();
|
|
21
|
+
setElState("neutral");
|
|
22
|
+
}, onMouseDown: (e) => {
|
|
23
|
+
e.stopPropagation();
|
|
24
|
+
setElState("active");
|
|
25
|
+
}, onMouseUp: (e) => {
|
|
26
|
+
e.stopPropagation();
|
|
27
|
+
setElState("hover");
|
|
28
|
+
}, style: {
|
|
29
|
+
display: "contents",
|
|
30
|
+
pointerEvents: p.disabled ? "none" : undefined,
|
|
31
|
+
cursor: p.disabled ? "auto" : "pointer",
|
|
32
|
+
}, children: p.children }) }));
|
|
33
|
+
}
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import React, { Component } from "react";
|
|
2
|
-
import
|
|
2
|
+
import { ColorSelection } from "../../..";
|
|
3
3
|
import { ElbeChildren } from "../../util/types";
|
|
4
|
-
import {
|
|
4
|
+
import { ElbeActionProps } from "../base/box";
|
|
5
5
|
import { type IconChild } from "./icon_button";
|
|
6
|
-
export type ButtonProps =
|
|
7
|
-
kind?:
|
|
6
|
+
export type ButtonProps = ElbeActionProps & {
|
|
7
|
+
kind?: ColorSelection.Kinds;
|
|
8
8
|
transparent?: boolean;
|
|
9
|
-
contentAlign?: "start" | "center" | "end";
|
|
9
|
+
contentAlign?: "start" | "center" | "end" | "space-between";
|
|
10
|
+
gap?: number;
|
|
11
|
+
sharp?: boolean;
|
|
10
12
|
onTap?: (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
|
|
11
13
|
} & {
|
|
12
14
|
icon?: IconChild;
|
|
@@ -14,7 +16,7 @@ export type ButtonProps = ActionElbeProps & {
|
|
|
14
16
|
children?: ElbeChildren;
|
|
15
17
|
};
|
|
16
18
|
export declare class Button extends Component<ButtonProps & {
|
|
17
|
-
manner:
|
|
19
|
+
manner: ColorSelection.Manners;
|
|
18
20
|
}> {
|
|
19
21
|
static major: (p: ButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
20
22
|
static minor: (p: ButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -11,8 +11,12 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
13
|
import { Component } from "react";
|
|
14
|
+
import { Row, Text } from "../../..";
|
|
15
|
+
import { useApp } from "../../app/app_ctxt";
|
|
14
16
|
import { useToolbar } from "../../util/ctx_toolbar";
|
|
15
17
|
import { applyProps } from "../base/box";
|
|
18
|
+
import { WithStateTheme } from "../base/state_builder";
|
|
19
|
+
import { WithTooltip } from "../tooltip";
|
|
16
20
|
import { Icon } from "./icon_button";
|
|
17
21
|
export class Button extends Component {
|
|
18
22
|
render() {
|
|
@@ -24,24 +28,31 @@ Button.minor = (p) => _jsx(_Btn, Object.assign({}, p, { manner: "minor" }));
|
|
|
24
28
|
Button.flat = (p) => _jsx(_Btn, Object.assign({}, p, { manner: "flat" }));
|
|
25
29
|
Button.plain = (p) => _jsx(_Btn, Object.assign({}, p, { manner: "plain" }));
|
|
26
30
|
function _Btn(_a) {
|
|
27
|
-
var _b;
|
|
31
|
+
var _b, _c;
|
|
28
32
|
var { manner, kind, onTap, icon, label, children, contentAlign } = _a, elbe = __rest(_a, ["manner", "kind", "onTap", "icon", "label", "children", "contentAlign"]);
|
|
29
33
|
const toolbarCtx = useToolbar();
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
34
|
+
const { _appThemeContext } = useApp();
|
|
35
|
+
const baseTheme = _appThemeContext.useTheme().useWith(({ color }) => ({
|
|
36
|
+
color: Object.assign(Object.assign({}, color), { selection: Object.assign(Object.assign({}, color.selection), { kind: kind !== null && kind !== void 0 ? kind : color.selection.kind, manner: manner }) }),
|
|
37
|
+
}), [kind, manner]);
|
|
38
|
+
return label || icon || children ? (_jsx(WithTooltip, { tooltip: elbe.tooltip, children: _jsx(WithStateTheme, { theme: baseTheme, disabled: !onTap, children: _jsx("button", Object.assign({}, applyProps("button", Object.assign(Object.assign({ role: "button" }, elbe), { flex: (toolbarCtx === null || toolbarCtx === void 0 ? void 0 : toolbarCtx.isInOverflow) ? 1 : elbe.flex }), ["elbe_colored"], {
|
|
39
|
+
/*backgroundColor: elbe.transparent
|
|
40
|
+
? "transparent"
|
|
41
|
+
: usedTheme.theme.color.currentColor.back.asCss(),*/
|
|
42
|
+
cursor: "inherit",
|
|
43
|
+
padding: "0.25rem .75rem",
|
|
44
|
+
minHeight: "3rem",
|
|
45
|
+
minWidth: "3rem",
|
|
46
|
+
border: "none",
|
|
47
|
+
backgroundColor: elbe.transparent ? "transparent" : undefined,
|
|
48
|
+
borderRadius: elbe.sharp
|
|
49
|
+
? 0
|
|
50
|
+
: baseTheme.theme.geometry.radius + "rem",
|
|
51
|
+
}), { title: elbe.tooltip ? undefined : (_b = elbe.ariaLabel) !== null && _b !== void 0 ? _b : label, disabled: !onTap, onClick: (e) => onTap && onTap(e), children: _jsxs(Row, { cross: "center", main: contentAlign !== null && contentAlign !== void 0 ? contentAlign : ((toolbarCtx === null || toolbarCtx === void 0 ? void 0 : toolbarCtx.isInOverflow) ? "start" : "center"), gap: (_c = elbe.gap) !== null && _c !== void 0 ? _c : 0.5, children: [_jsx(Icon, { icon: icon }), !(toolbarCtx === null || toolbarCtx === void 0 ? void 0 : toolbarCtx.isInToolbar) && label && (_jsx(Text, { bold: true, style: {
|
|
52
|
+
whiteSpace: "nowrap",
|
|
53
|
+
overflow: "hidden",
|
|
54
|
+
textOverflow: "ellipsis",
|
|
55
|
+
}, v: label })), children] }) })) }) })) : (_jsx("div", {})
|
|
45
56
|
//_ElbeErr("Button requires either an icon and or a label, or a child")
|
|
46
57
|
);
|
|
47
58
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { ColorSelection } from "../../..";
|
|
2
2
|
import { type IconChild } from "./icon_button";
|
|
3
3
|
export interface ChooseItem<T> {
|
|
4
4
|
value: T;
|
|
@@ -6,10 +6,12 @@ export interface ChooseItem<T> {
|
|
|
6
6
|
icon?: IconChild;
|
|
7
7
|
ariaLabel?: string;
|
|
8
8
|
}
|
|
9
|
-
export declare function ChooseButton<T>({ items, value, onChange, kind, column, }: {
|
|
9
|
+
export declare function ChooseButton<T>({ items, value, onChange, kind, column, tooltip, }: {
|
|
10
10
|
items: ChooseItem<T>[];
|
|
11
11
|
value: T;
|
|
12
12
|
onChange?: (v: T) => void;
|
|
13
|
-
kind?:
|
|
13
|
+
kind?: ColorSelection.Kinds;
|
|
14
14
|
column?: boolean;
|
|
15
|
+
sharp?: boolean;
|
|
16
|
+
tooltip?: string;
|
|
15
17
|
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { CheckIcon } from "lucide-react";
|
|
3
|
+
import { FlexLayout, Row, Text } from "../../..";
|
|
3
4
|
import { Card } from "../base/card";
|
|
4
5
|
import { Spaced } from "../layout/spaced";
|
|
5
6
|
import { Button } from "./button";
|
|
6
7
|
import { Icon } from "./icon_button";
|
|
7
|
-
export function ChooseButton({ items, value, onChange, kind, column = false, }) {
|
|
8
|
-
return (_jsx(Card, { kind: "accent", manner: "major", padding: 0, overflow: "hidden", role: "radiogroup",
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
export function ChooseButton({ items, value, onChange, kind, column = false, tooltip, }) {
|
|
9
|
+
return (_jsx(Card, { kind: "accent", manner: "major", state: onChange ? "neutral" : "disabled", padding: 0, overflow: "hidden", role: "radiogroup", bordered: true, tooltip: tooltip, onTap: onChange ? undefined : null, style: {
|
|
10
|
+
maxWidth: "fit-content",
|
|
11
|
+
}, children: _jsx(FlexLayout, { direction: column ? "column" : "row", cross: "stretch", gap: 0, children: items.map((e, i) => {
|
|
12
|
+
var _a, _b;
|
|
13
|
+
return (_jsxs(Button, { ariaLabel: (_b = (_a = e.ariaLabel) !== null && _a !== void 0 ? _a : e.label) !== null && _b !== void 0 ? _b : null, manner: e.value === value ? "major" : "flat", kind: kind, onTap: onChange && (() => onChange(e.value)), sharp: true, contentAlign: "space-between", gap: column ? 2 : undefined, children: [_jsxs(Row, { gap: 0.5, children: [e.icon && _jsx(Icon, { icon: e.icon }), e.label && _jsx(Text, { bold: true, v: e.label })] }), column &&
|
|
14
|
+
(e.value === value ? _jsx(CheckIcon, {}) : _jsx(Spaced, { amount: 1.5 }))] }, i));
|
|
15
|
+
}) }) }));
|
|
13
16
|
}
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import React, { Component } from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { ColorSelection, ElbeActionProps, ElbeProps, type ElbeChild } from "../../..";
|
|
3
3
|
export type IconChild = ElbeChild | ((_: any) => ElbeChild);
|
|
4
|
-
export type IconButtonProps = {
|
|
4
|
+
export type IconButtonProps = ElbeActionProps & {
|
|
5
5
|
icon?: IconChild;
|
|
6
|
-
kind?:
|
|
6
|
+
kind?: ColorSelection.Kinds;
|
|
7
7
|
transparent?: boolean;
|
|
8
|
+
sharp?: boolean;
|
|
8
9
|
onTap?: (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
|
|
9
|
-
}
|
|
10
|
+
};
|
|
10
11
|
export declare class IconButton extends Component<IconButtonProps & {
|
|
11
|
-
manner?:
|
|
12
|
+
manner?: ColorSelection.Manners;
|
|
12
13
|
}> {
|
|
13
14
|
static major: (p: IconButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
14
15
|
static minor: (p: IconButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -12,33 +12,43 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
12
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
13
|
import React, { Component } from "react";
|
|
14
14
|
import { applyProps, } from "../../..";
|
|
15
|
+
import { useApp } from "../../app/app_ctxt";
|
|
16
|
+
import { WithStateTheme } from "../base/state_builder";
|
|
17
|
+
import { WithTooltip } from "../tooltip";
|
|
15
18
|
export class IconButton extends Component {
|
|
16
19
|
render() {
|
|
17
|
-
|
|
20
|
+
var _a;
|
|
21
|
+
return _jsx(_btn, Object.assign({}, this.props, { manner: (_a = this.props.manner) !== null && _a !== void 0 ? _a : "plain" }));
|
|
18
22
|
}
|
|
19
23
|
}
|
|
20
|
-
IconButton.major = (p) => _btn(p, "major");
|
|
21
|
-
IconButton.minor = (p) => _btn(p, "minor");
|
|
22
|
-
IconButton.flat = (p) => _btn(p, "flat");
|
|
23
|
-
IconButton.plain = (p) => _btn(p, "plain");
|
|
24
|
-
function _btn(_a
|
|
25
|
-
var _b
|
|
26
|
-
var { icon, onTap } = _a, elbe = __rest(_a, ["icon", "onTap"]);
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
24
|
+
IconButton.major = (p) => _jsx(_btn, Object.assign({}, p, { manner: "major" }));
|
|
25
|
+
IconButton.minor = (p) => _jsx(_btn, Object.assign({}, p, { manner: "minor" }));
|
|
26
|
+
IconButton.flat = (p) => _jsx(_btn, Object.assign({}, p, { manner: "flat" }));
|
|
27
|
+
IconButton.plain = (p) => _jsx(_btn, Object.assign({}, p, { manner: "plain" }));
|
|
28
|
+
function _btn(_a) {
|
|
29
|
+
var _b;
|
|
30
|
+
var { icon, onTap, manner } = _a, elbe = __rest(_a, ["icon", "onTap", "manner"]);
|
|
31
|
+
const { _appThemeContext } = useApp();
|
|
32
|
+
const baseTheme = _appThemeContext.useTheme().useWith(({ color }) => {
|
|
33
|
+
var _a, _b;
|
|
34
|
+
return ({
|
|
35
|
+
color: Object.assign(Object.assign({}, color), { selection: Object.assign(Object.assign({}, color.selection), { kind: (_b = (_a = elbe.kind) !== null && _a !== void 0 ? _a : color.selection.kind) !== null && _b !== void 0 ? _b : "accent", manner: manner }) }),
|
|
36
|
+
});
|
|
37
|
+
}, [elbe.kind, manner]);
|
|
38
|
+
return (_jsx(WithTooltip, { tooltip: elbe.tooltip, children: _jsx(WithStateTheme, { theme: baseTheme, disabled: !onTap, children: _jsx("button", Object.assign({}, applyProps("icon_button", elbe, ["elbe_colored"], {
|
|
39
|
+
display: "flex",
|
|
40
|
+
alignItems: "center",
|
|
41
|
+
justifyContent: "center",
|
|
42
|
+
cursor: "inherit",
|
|
43
|
+
backgroundColor: elbe.transparent ? "transparent" : undefined,
|
|
44
|
+
border: "none",
|
|
45
|
+
borderRadius: elbe.sharp ? 0 : "3rem",
|
|
46
|
+
height: "3rem",
|
|
47
|
+
width: "3rem",
|
|
48
|
+
}), { title: elbe.tooltip ? undefined : (_b = elbe.ariaLabel) !== null && _b !== void 0 ? _b : undefined, onClick: (e) => {
|
|
49
|
+
e.stopPropagation();
|
|
50
|
+
onTap && onTap(e);
|
|
51
|
+
}, children: _jsx(Icon, { icon: icon }) })) }) }));
|
|
42
52
|
}
|
|
43
53
|
export function Icon(p) {
|
|
44
54
|
if (!p.icon)
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import { ColorSelection } from "../../..";
|
|
2
|
+
import { ElbeActionProps } from "../base/box";
|
|
3
3
|
import { type IconChild } from "./icon_button";
|
|
4
|
-
export declare function ToggleButton({ value, onChange, label, icon, kind, ...elbe }: {
|
|
4
|
+
export declare function ToggleButton({ value, onChange, label, icon, kind, ...elbe }: ElbeActionProps & {
|
|
5
5
|
value: boolean;
|
|
6
6
|
onChange?: (v: boolean) => void;
|
|
7
|
-
kind?:
|
|
7
|
+
kind?: ColorSelection.Kinds;
|
|
8
8
|
label: string;
|
|
9
9
|
icon?: IconChild;
|
|
10
|
-
}
|
|
10
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -11,20 +11,26 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
13
|
import { CheckIcon } from "lucide-react";
|
|
14
|
-
import {
|
|
14
|
+
import { Row, Text } from "../../..";
|
|
15
|
+
import { useApp } from "../../app/app_ctxt";
|
|
15
16
|
import { applyProps } from "../base/box";
|
|
16
|
-
import { Padded } from "../base/padded";
|
|
17
17
|
import { Spaced } from "../layout/spaced";
|
|
18
18
|
import { Button } from "./button";
|
|
19
19
|
import { Icon } from "./icon_button";
|
|
20
20
|
export function ToggleButton(_a) {
|
|
21
21
|
var _b;
|
|
22
22
|
var { value, onChange, label, icon, kind } = _a, elbe = __rest(_a, ["value", "onChange", "label", "icon", "kind"]);
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
const { _appThemeContext } = useApp();
|
|
24
|
+
const { theme } = _appThemeContext.useTheme();
|
|
25
|
+
return (_jsxs(Button, Object.assign({ manner: value ? "major" : "flat", kind: kind, tooltip: elbe.tooltip, onTap: onChange && (() => onChange(!value)), ariaLabel: (_b = elbe.ariaLabel) !== null && _b !== void 0 ? _b : label, contentAlign: "space-between" }, applyProps("toggle_button", elbe, [], {
|
|
26
|
+
overflow: "hidden",
|
|
27
|
+
}), { children: [_jsxs(Row, { gap: 0, children: [_jsx(Icon, { icon: icon }), icon && _jsx(Spaced, { width: 0.5 }), label && _jsx(Text, { bold: true, v: label })] }), _jsx("div", { style: {
|
|
28
|
+
transition: theme.motion.reduced
|
|
26
29
|
? undefined
|
|
27
30
|
: "width 0.2s ease-in-out",
|
|
28
|
-
width: value ? "
|
|
29
|
-
|
|
31
|
+
width: value ? "2rem" : "0rem",
|
|
32
|
+
display: "flex",
|
|
33
|
+
alignItems: "center",
|
|
34
|
+
overflow: "hidden",
|
|
35
|
+
}, children: value && (_jsx(CheckIcon, { style: { marginLeft: ".5rem", minWidth: ".5rem" } })) })] })));
|
|
30
36
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ColorSelection, ElbeThemeComputed, ElbeThemeData } from "../../..";
|
|
2
|
+
import type { ElbeChildren } from "../../util/types";
|
|
3
|
+
export declare function elevatedBackdropStyle(open: boolean, theme?: ElbeThemeComputed<ElbeThemeData>, openMergeStyle?: React.CSSProperties): React.CSSProperties;
|
|
4
|
+
export type ElbeDialogProps = {
|
|
5
|
+
title: string;
|
|
6
|
+
open: boolean;
|
|
7
|
+
onClose: () => void;
|
|
8
|
+
kind?: ColorSelection.KindsAlert;
|
|
9
|
+
dismissible?: "none" | "button" | "barrier";
|
|
10
|
+
maxWidth?: number;
|
|
11
|
+
children?: ElbeChildren;
|
|
12
|
+
};
|
|
13
|
+
export declare function Dialog({ dismissible, ...p }: ElbeDialogProps): import("react").ReactPortal | null;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import { X } from "lucide-react";
|
|
14
|
+
import { useEffect, useMemo } from "react";
|
|
15
|
+
import ReactDOM from "react-dom";
|
|
16
|
+
import { Card, KindAlertIcon, } from "../../..";
|
|
17
|
+
import { useApp } from "../../app/app_ctxt";
|
|
18
|
+
import { getRootElement } from "../../util/root";
|
|
19
|
+
import { IconButton } from "../button/icon_button";
|
|
20
|
+
import { Column, Row } from "../layout/flex";
|
|
21
|
+
import { Text } from "../text";
|
|
22
|
+
export function elevatedBackdropStyle(open, theme, openMergeStyle) {
|
|
23
|
+
return Object.assign({ transition: (theme === null || theme === void 0 ? void 0 : theme.motion.reduced)
|
|
24
|
+
? undefined
|
|
25
|
+
: "background-color 200ms ease-in-out, backdrop-filter 200ms ease-in-out", backgroundColor: open
|
|
26
|
+
? theme === null || theme === void 0 ? void 0 : theme.color.currentColor.front.withAlpha(0.3).hex()
|
|
27
|
+
: "transparent", backdropFilter: open ? "blur(2px)" : "none" }, ((open && openMergeStyle) || {}));
|
|
28
|
+
}
|
|
29
|
+
export function Dialog(_a) {
|
|
30
|
+
var { dismissible = "button" } = _a, p = __rest(_a, ["dismissible"]);
|
|
31
|
+
const { _appThemeContext } = useApp();
|
|
32
|
+
const theme = _appThemeContext.useTheme().useWith((c) => ({
|
|
33
|
+
color: Object.assign(Object.assign({}, c.color), { selection: Object.assign(Object.assign({}, c.color.selection), { scheme: "primary", kind: "accent", manner: "plain", state: "neutral" }) }),
|
|
34
|
+
}), []);
|
|
35
|
+
const rootDOM = useMemo(() => getRootElement("elbe_dialog"), []);
|
|
36
|
+
useEffect(() => {
|
|
37
|
+
if (p.open) {
|
|
38
|
+
document.body.style.overflow = "hidden";
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
document.body.style.overflow = "";
|
|
42
|
+
}
|
|
43
|
+
return () => {
|
|
44
|
+
document.body.style.overflow = "";
|
|
45
|
+
};
|
|
46
|
+
}, [p.open]);
|
|
47
|
+
if (!p.open)
|
|
48
|
+
return null;
|
|
49
|
+
return ReactDOM.createPortal(_jsx(_appThemeContext.WithTheme, { theme: theme, children: _jsxs("div", { style: Object.assign({ position: "fixed", left: 0, top: 0, width: "100%", height: "100%", display: "flex", alignItems: "center", justifyContent: "center" }, elevatedBackdropStyle(p.open, theme.theme)), className: "elbe_dialog-base", onClick: (e) => {
|
|
50
|
+
e.stopPropagation();
|
|
51
|
+
e.preventDefault();
|
|
52
|
+
if (dismissible === "barrier")
|
|
53
|
+
p.onClose();
|
|
54
|
+
}, children: [_jsx("dialog", { open: p.open, style: {
|
|
55
|
+
position: "static",
|
|
56
|
+
display: "flex",
|
|
57
|
+
border: "none",
|
|
58
|
+
background: "transparent",
|
|
59
|
+
margin: 0,
|
|
60
|
+
padding: 0,
|
|
61
|
+
}, children: _jsxs(Card, { padding: 0.25, bordered: true, elevated: true, kind: p.kind, style: {
|
|
62
|
+
maxWidth: p.maxWidth ? `min(${p.maxWidth}rem, 90vw)` : "90%",
|
|
63
|
+
minWidth: "min(17rem, 90vw)",
|
|
64
|
+
}, children: [_jsxs(Row, { cross: "center", gap: 1, style: { marginLeft: "1rem" }, children: [p.kind && _jsx(KindAlertIcon, { kind: p.kind }), _jsx(Text.h4, { v: p.title, flex: true, style: { marginRight: "1rem" } }), ["button", "barrier"].includes(dismissible) && (_jsx(IconButton.plain, { ariaLabel: "Close", icon: X, onTap: (e) => {
|
|
65
|
+
e.stopPropagation();
|
|
66
|
+
e.preventDefault();
|
|
67
|
+
p.onClose();
|
|
68
|
+
} }))] }), _jsx(Column, { style: { padding: "1rem" }, children: p.children })] }) }), ","] }) }), rootDOM);
|
|
69
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { ColorSelection, ElbeChildren } from "../../..";
|
|
2
|
+
declare const _dialogs: {
|
|
3
|
+
showConfirmDialog: DialogsConfig<{
|
|
4
|
+
message: string;
|
|
5
|
+
labelYes?: string;
|
|
6
|
+
labelNo?: string;
|
|
7
|
+
highlight?: "yes" | "no" | "none";
|
|
8
|
+
}, boolean>;
|
|
9
|
+
showAlertDialog: DialogsConfig<{
|
|
10
|
+
message: string;
|
|
11
|
+
labelOkay?: string;
|
|
12
|
+
}, null>;
|
|
13
|
+
};
|
|
14
|
+
type AllDialogParams = {
|
|
15
|
+
title: string;
|
|
16
|
+
dismissible?: "none" | "button" | "barrier";
|
|
17
|
+
maxWidth?: number;
|
|
18
|
+
kind?: ColorSelection.KindsAlert;
|
|
19
|
+
};
|
|
20
|
+
export type DialogsConfig<I extends Dict<any>, O> = {
|
|
21
|
+
onClose: (value: O | null) => O;
|
|
22
|
+
children: (p: AllDialogParams & I, close: (t: O | null) => void) => ElbeChildren;
|
|
23
|
+
};
|
|
24
|
+
type _DialogsType<T extends DialogsConfig<any, any>> = (p: AllDialogParams & (T extends DialogsConfig<infer I, any> ? I : never)) => Promise<ReturnType<T["onClose"]>>;
|
|
25
|
+
export type DialogsCtrl = {
|
|
26
|
+
[K in keyof typeof _dialogs]: _DialogsType<(typeof _dialogs)[K]>;
|
|
27
|
+
} & {
|
|
28
|
+
showDialog: <I extends AllDialogParams & Dict<any>, O>(config: DialogsConfig<I, O>, params: I) => Promise<O>;
|
|
29
|
+
};
|
|
30
|
+
export declare function useDialogs(): DialogsCtrl;
|
|
31
|
+
export declare function DialogsProvider(p: {
|
|
32
|
+
children: ElbeChildren;
|
|
33
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
34
|
+
export {};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
// ToastContext.js
|
|
3
|
+
import { createContext, useContext, useMemo, useState } from "react";
|
|
4
|
+
import ReactDOM from "react-dom";
|
|
5
|
+
import { Dialog, dictMap, getRootElement, } from "../../..";
|
|
6
|
+
import { showAlertDialog } from "./dialogs/_alert";
|
|
7
|
+
import { showConfirmDialog } from "./dialogs/_confirm";
|
|
8
|
+
const _dialogs = {
|
|
9
|
+
showConfirmDialog,
|
|
10
|
+
showAlertDialog,
|
|
11
|
+
};
|
|
12
|
+
const _DialogsContext = createContext(null);
|
|
13
|
+
export function useDialogs() {
|
|
14
|
+
return useContext(_DialogsContext);
|
|
15
|
+
}
|
|
16
|
+
export function DialogsProvider(p) {
|
|
17
|
+
const rootDOM = useMemo(() => getRootElement("elbe_dialog"), []);
|
|
18
|
+
const [dialogs, setDialogs] = useState([]);
|
|
19
|
+
function showDialog(dialog, params) {
|
|
20
|
+
return new Promise((resolve) => {
|
|
21
|
+
const id = Date.now() + "";
|
|
22
|
+
setDialogs([
|
|
23
|
+
...dialogs,
|
|
24
|
+
{
|
|
25
|
+
id,
|
|
26
|
+
params,
|
|
27
|
+
config: dialog,
|
|
28
|
+
onClose: (p) => resolve(dialog.onClose(p)),
|
|
29
|
+
},
|
|
30
|
+
]);
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
function _closeDialog(id, value) {
|
|
34
|
+
const dialog = dialogs.find((d) => d.id === id);
|
|
35
|
+
setDialogs((d) => d.filter((dialog) => dialog.id !== id));
|
|
36
|
+
if (dialog)
|
|
37
|
+
dialog.onClose(value);
|
|
38
|
+
}
|
|
39
|
+
const provVal = useMemo(() => dictMap(_dialogs, (config) => (p) => showDialog(config, p)), [dialogs]);
|
|
40
|
+
return (_jsxs(_DialogsContext.Provider, { value: Object.assign(Object.assign({}, provVal), { showDialog }), children: [p.children, ReactDOM.createPortal(_jsx("div", { children: dialogs.map((dialog) => {
|
|
41
|
+
var _a, _b;
|
|
42
|
+
return (_jsx(Dialog, { title: dialog.params.title, open: true, dismissible: (_a = dialog.params.dismissible) !== null && _a !== void 0 ? _a : "button", maxWidth: (_b = dialog.params.maxWidth) !== null && _b !== void 0 ? _b : undefined, onClose: () => _closeDialog(dialog.id, null), kind: dialog.params.kind, children: dialog.config.children(dialog.params, (value) => _closeDialog(dialog.id, value)) }, dialog.id));
|
|
43
|
+
}) }), rootDOM)] }));
|
|
44
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Button, Column, Row, Text } from "../../../..";
|
|
3
|
+
export const showAlertDialog = {
|
|
4
|
+
onClose: () => null,
|
|
5
|
+
children: (p, close) => {
|
|
6
|
+
var _a;
|
|
7
|
+
return (_jsxs(Column, { gap: 2, children: [_jsx(Text, { v: p.message }), _jsx(Row, { children: _jsx(Button.major, { flex: true, ariaLabel: "close dialog", label: (_a = p.labelOkay) !== null && _a !== void 0 ? _a : "Yes", onTap: () => close(null) }) })] }));
|
|
8
|
+
},
|
|
9
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import { Button, Column, Row, Text } from "../../../..";
|
|
14
|
+
export const showConfirmDialog = {
|
|
15
|
+
onClose: (value) => value !== null && value !== void 0 ? value : false,
|
|
16
|
+
children: (_a, close) => {
|
|
17
|
+
var _b, _c;
|
|
18
|
+
var { highlight = "no" } = _a, p = __rest(_a, ["highlight"]);
|
|
19
|
+
return (_jsxs(Column, { gap: 2, children: [_jsx(Text, { v: p.message }), _jsxs(Row, { children: [_jsx(Button, { flex: true, ariaLabel: "select no", manner: highlight === "no" ? "major" : "minor", label: (_b = p.labelNo) !== null && _b !== void 0 ? _b : "No", onTap: () => close(false) }), _jsx(Button, { flex: true, ariaLabel: "select yes", manner: highlight === "yes" ? "major" : "minor", label: (_c = p.labelYes) !== null && _c !== void 0 ? _c : "Yes", onTap: () => close(true) })] })] }));
|
|
20
|
+
},
|
|
21
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { icons } from "lucide-react";
|
|
3
3
|
import { useState } from "react";
|
|
4
|
-
import {
|
|
4
|
+
import { Card, Column, Dialog, Icon, Icons, toElbeError, Wouter, } from "../..";
|
|
5
5
|
import { _maybeL10n } from "../util/l10n/_l10n_util";
|
|
6
6
|
export function ErrorView({ error, retry, debug, }) {
|
|
7
7
|
var _a;
|
|
@@ -10,7 +10,7 @@ export function ErrorView({ error, retry, debug, }) {
|
|
|
10
10
|
const fallback = typeof apiError.message === "string"
|
|
11
11
|
? apiError.message
|
|
12
12
|
: "An error occurred";
|
|
13
|
-
return !debug ? (_jsx(PrettyErrorView, { error: apiError, retry: retry })) : (
|
|
13
|
+
return !debug ? (_jsx(PrettyErrorView, { error: apiError, retry: retry })) : (_jsx(Card, { scheme: "inverse", children: _jsxs(Column, { children: [_jsxs("h3", { style: { margin: 0 }, children: ["ERROR: ", apiError.code] }), _jsx("p", { children: (_a = l10n === null || l10n === void 0 ? void 0 : l10n.inline(apiError.message)) !== null && _a !== void 0 ? _a : fallback }), _jsx("pre", { children: JSON.stringify(apiError, null, 2) })] }) }));
|
|
14
14
|
}
|
|
15
15
|
export function PrettyErrorView({ error, retry, labels = {
|
|
16
16
|
retry: {
|
|
@@ -42,5 +42,5 @@ export function PrettyErrorView({ error, retry, labels = {
|
|
|
42
42
|
const l10n = _maybeL10n();
|
|
43
43
|
const [open, setOpen] = useState(false);
|
|
44
44
|
const [loc, navigate] = Wouter.useLocation();
|
|
45
|
-
return (_jsxs(
|
|
45
|
+
return (_jsxs(Column, { cross: "center", style: { margin: "1rem 0", padding: "1rem" }, children: [_jsx(Icon, { icon: (_a = error.icon) !== null && _a !== void 0 ? _a : icons.OctagonAlert }), _jsx("h4", { style: { margin: 0 }, children: (_b = l10n === null || l10n === void 0 ? void 0 : l10n.inline(error.message)) !== null && _b !== void 0 ? _b : "error" }), _jsx("span", { className: "pointer", onClick: () => setOpen(true), children: (_c = l10n === null || l10n === void 0 ? void 0 : l10n.inline(error.description)) !== null && _c !== void 0 ? _c : "" }), retry && (_jsxs("button", { className: "action", onClick: () => retry(), children: [_jsx(Icons.RotateCcw, {}), " ", (_d = l10n === null || l10n === void 0 ? void 0 : l10n.inline(labels.retry)) !== null && _d !== void 0 ? _d : "retry"] })), error.code === 404 && (_jsxs("button", { className: "action", onClick: () => navigate("/", { replace: true }), children: [_jsx(Icons.House, {}), (_e = l10n === null || l10n === void 0 ? void 0 : l10n.inline(labels.home)) !== null && _e !== void 0 ? _e : "go home"] })), _jsx(Dialog, { title: (_f = l10n === null || l10n === void 0 ? void 0 : l10n.inline(labels.details)) !== null && _f !== void 0 ? _f : "error details", open: open, onClose: () => setOpen(false), children: _jsx("pre", { className: "card inverse", children: `code: ${error.code}\n\n` + JSON.stringify(error.details, null, 2) }) })] }));
|
|
46
46
|
}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { HeartIcon } from "lucide-react";
|
|
3
|
-
import { Card, Column, FlexSpace, Link, Row, useLayoutMode, } from "../..";
|
|
3
|
+
import { Card, Column, FlexSpace, Link, Row, Text, useLayoutMode, } from "../..";
|
|
4
4
|
export function Footer({ left, right, copyright, version, legal, marginTop, }) {
|
|
5
5
|
const layoutMode = useLayoutMode();
|
|
6
6
|
return (_jsx(Card, { scheme: "secondary", sharp: true, role: "contentinfo", ariaLabel: "footer", style: {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
borderLeftStyle: "none",
|
|
8
|
+
borderRightStyle: "none",
|
|
9
|
+
borderBottomStyle: "none",
|
|
10
10
|
borderTopLeftRadius: layoutMode.isWide ? "var(--g-radius)" : undefined,
|
|
11
11
|
color: "color-mix(in srgb, var(--c-context-front) 60%, transparent)",
|
|
12
12
|
marginTop: `${marginTop !== null && marginTop !== void 0 ? marginTop : 0}rem`,
|
|
13
|
-
}, children: _jsxs(Column, { gap:
|
|
14
|
-
(typeof copyright === "string" ? _jsx(
|
|
13
|
+
}, children: _jsxs(Column, { gap: 1, children: [(left || right) && (_jsxs(Row, { main: "space-between", cross: "start", children: [left && (_jsx(Column, { gap: 0.5, flex: 1, cross: "start", children: left.map((item, i) => item.label ? _jsx(_Link, Object.assign({}, item), i) : item) })), right && (_jsx(Column, { gap: 0.5, flex: 1, cross: "end", children: right.map((item, i) => item.label ? _jsx(_Link, Object.assign({}, item), i) : item) }))] })), (left || right) && (copyright || version || legal) && _jsx("hr", {}), (copyright || version || legal) && (_jsxs(Row, { children: [copyright &&
|
|
14
|
+
(typeof copyright === "string" ? (_jsx(Text, { bold: true, v: copyright })) : (copyright)), version && _jsx(_Version, { version: version }), _jsx(FlexSpace, {}), legal && _jsx(_Link, Object.assign({}, legal))] }))] }) }));
|
|
15
15
|
}
|
|
16
16
|
function _Version({ version }) {
|
|
17
17
|
return (_jsx("pre", { style: {
|
|
@@ -21,7 +21,7 @@ function _Version({ version }) {
|
|
|
21
21
|
}, children: version }));
|
|
22
22
|
}
|
|
23
23
|
function _Link({ href, label }) {
|
|
24
|
-
return (_jsx(Link, { color: "inherit",
|
|
24
|
+
return (_jsx(Link, { color: "inherit", manner: "plain", noIcon: true, href: href, label: label, external: true }));
|
|
25
25
|
}
|
|
26
26
|
export function _WrittenIn({ city = "Hamburg", href, }) {
|
|
27
27
|
return (_jsxs("a", { href: href, style: {
|