elbe-ui 0.4.27 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/bit/_bit_provider.d.ts +1 -1
- package/dist/bit/_bit_provider.js +11 -6
- package/dist/bit/_bit_utils.d.ts +5 -1
- package/dist/bit/bit.d.ts +2 -2
- package/dist/bit/bit.js +2 -2
- package/dist/elbe.css +97 -61
- package/dist/elbe.css.map +1 -1
- package/dist/index.d.ts +1529 -1527
- package/dist/index.js +3 -2
- package/dist/ui/components/badge.d.ts +7 -7
- package/dist/ui/components/badge.js +3 -3
- package/dist/ui/components/banner.d.ts +2 -2
- package/dist/ui/components/banner.js +8 -8
- package/dist/ui/components/base/box.d.ts +4140 -2520
- package/dist/ui/components/base/box.js +4 -4
- package/dist/ui/components/base/card.d.ts +1 -1
- package/dist/ui/components/base/card.js +1 -1
- package/dist/ui/components/base/padded.d.ts +4 -4
- package/dist/ui/components/base/padded.js +2 -2
- package/dist/ui/components/button/button.d.ts +10 -9
- package/dist/ui/components/button/button.js +15 -13
- package/dist/ui/components/button/choose_button.d.ts +2 -2
- package/dist/ui/components/button/choose_button.js +5 -4
- package/dist/ui/components/button/icon_button.d.ts +9 -8
- package/dist/ui/components/button/icon_button.js +16 -4
- package/dist/ui/components/button/toggle_button.d.ts +2 -2
- package/dist/ui/components/button/toggle_button.js +8 -4
- package/dist/ui/components/dev/todo.d.ts +4 -4
- package/dist/ui/components/dev/todo.js +2 -2
- package/dist/ui/components/dialog.d.ts +4 -3
- package/dist/ui/components/dialog.js +21 -4
- package/dist/ui/components/error_view.d.ts +2 -2
- package/dist/ui/components/error_view.js +12 -8
- package/dist/ui/components/footer.d.ts +3 -3
- package/dist/ui/components/footer.js +3 -3
- package/dist/ui/components/input/checkbox.d.ts +1 -1
- package/dist/ui/components/input/checkbox.js +5 -5
- package/dist/ui/components/input/range.d.ts +1 -1
- package/dist/ui/components/input/range.js +1 -1
- package/dist/ui/components/input/select.d.ts +1 -1
- package/dist/ui/components/input/select.js +2 -2
- package/dist/ui/components/input/switch.d.ts +1 -1
- package/dist/ui/components/input/switch.js +1 -1
- package/dist/ui/components/input/text/input_field.d.ts +9 -9
- package/dist/ui/components/input/text/input_field.js +7 -7
- package/dist/ui/components/input/text/multi_line.d.ts +1 -1
- package/dist/ui/components/input/text/multi_line.js +3 -3
- package/dist/ui/components/input/text/single_line.d.ts +1 -1
- package/dist/ui/components/input/text/single_line.js +4 -4
- package/dist/ui/components/layout/alignment.d.ts +3 -2
- package/dist/ui/components/layout/alignment.js +2 -2
- package/dist/ui/components/layout/app_base.d.ts +1 -1
- package/dist/ui/components/layout/app_base.js +33 -9
- package/dist/ui/components/layout/ctx_app_base.d.ts +8 -3
- package/dist/ui/components/layout/ctx_app_base.js +1 -2
- package/dist/ui/components/layout/flex.d.ts +3 -3
- package/dist/ui/components/layout/flex.js +5 -5
- package/dist/ui/components/layout/header.d.ts +5 -8
- package/dist/ui/components/layout/header.js +11 -13
- package/dist/ui/components/layout/menu.d.ts +1 -1
- package/dist/ui/components/layout/menu.js +6 -6
- package/dist/ui/components/layout/page.d.ts +3 -1
- package/dist/ui/components/layout/page.js +3 -1
- package/dist/ui/components/layout/scroll.d.ts +4 -4
- package/dist/ui/components/layout/scroll.js +3 -3
- package/dist/ui/components/layout/spaced.d.ts +1 -1
- package/dist/ui/components/layout/spaced.js +1 -1
- package/dist/ui/components/layout/toolbar.d.ts +2 -2
- package/dist/ui/components/layout/toolbar.js +4 -6
- package/dist/ui/components/link.d.ts +1 -1
- package/dist/ui/components/link.js +2 -2
- package/dist/ui/components/progress_bar.d.ts +1 -1
- package/dist/ui/components/progress_bar.js +1 -1
- package/dist/ui/components/routing/route.d.ts +8 -8
- package/dist/ui/components/routing/route.js +4 -4
- package/dist/ui/components/spinner.d.ts +4 -4
- package/dist/ui/components/spinner.js +33 -33
- package/dist/ui/components/text.d.ts +15 -15
- package/dist/ui/components/text.js +6 -6
- package/dist/ui/theme/colors.js +0 -1
- package/dist/ui/theme/theme.d.ts +1 -1
- package/dist/ui/theme/theme.js +3 -3
- package/dist/ui/theme/theme_context.d.ts +2 -2
- package/dist/ui/theme/theme_context.js +1 -2
- package/dist/ui/util/ctx_toolbar.d.ts +1 -2
- package/dist/ui/util/ctx_toolbar.js +2 -2
- package/dist/ui/util/error_view.d.ts +1 -1
- package/dist/ui/util/error_view.js +8 -2
- package/dist/ui/util/l10n/_l10n_util.d.ts +1 -1
- package/dist/ui/util/l10n/_l10n_util.js +1 -1
- package/dist/ui/util/l10n/l10n.d.ts +1 -1
- package/dist/ui/util/l10n/l10n.js +2 -2
- package/dist/ui/util/types.d.ts +3 -2
- package/dist/ui/util/util.js +1 -2
- package/package.json +6 -8
|
@@ -9,18 +9,18 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
9
9
|
}
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
|
-
import { Component,
|
|
12
|
+
import { Component, createElement } from "react";
|
|
13
13
|
export function applyProps(typeLabel, p, classes, style) {
|
|
14
|
-
var _a, _b, _c
|
|
14
|
+
var _a, _b, _c;
|
|
15
15
|
if (Array.isArray(classes)) {
|
|
16
16
|
classes = classes.filter((c) => c).join(" ");
|
|
17
17
|
}
|
|
18
|
-
return Object.assign(Object.assign({ id: p.id,
|
|
18
|
+
return Object.assign(Object.assign({ id: p.id, className: `${classes || ""} ${p.className || ""}`, style: Object.assign(Object.assign(Object.assign({}, (style !== null && style !== void 0 ? style : {})), ((_a = p.style) !== null && _a !== void 0 ? _a : {})), (p.flex ? { flex: p.flex === true ? 1 : p.flex } : {})) }, (p.tooltip ? { ["data-tooltip"]: p.tooltip } : {})), { ["aria-label"]: (_b = p.ariaLabel) !== null && _b !== void 0 ? _b : undefined, ["data-type"]: (_c = p.typeLabel) !== null && _c !== void 0 ? _c : (!!typeLabel ? `elbe_${typeLabel}` : undefined) });
|
|
19
19
|
}
|
|
20
20
|
export class Box extends Component {
|
|
21
21
|
render() {
|
|
22
22
|
const _a = this.props, { scheme, mode, padding, margin, children } = _a, elbe = __rest(_a, ["scheme", "mode", "padding", "margin", "children"]);
|
|
23
|
-
return
|
|
23
|
+
return createElement("div", applyProps("box", elbe, [scheme, mode], Object.assign({ padding: `${padding}rem`, margin: `${margin}rem` }, elbe.style)), children);
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
Box.primary = (p) => new Box(Object.assign(Object.assign({}, p), { scheme: "primary" })).render();
|
|
@@ -16,4 +16,4 @@ export declare function Card({ mode, scheme, kind, manner, padding, margin, onTa
|
|
|
16
16
|
disabled?: boolean;
|
|
17
17
|
overflow?: "hidden" | "scroll" | "auto";
|
|
18
18
|
children?: ElbeChildren;
|
|
19
|
-
} & ElbeProps): import("
|
|
19
|
+
} & ElbeProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -9,7 +9,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
9
9
|
}
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
|
-
import { jsx as _jsx } from "
|
|
12
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
13
|
import { applyProps, } from "../../..";
|
|
14
14
|
export const elevatedShadow = "0 0 15px rgba(0,0,0,.2)";
|
|
15
15
|
export function Card(_a) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from "
|
|
1
|
+
import React from "react";
|
|
2
2
|
import { ElbeProps } from "./box";
|
|
3
3
|
export type PaddedProps = ElbeProps & {
|
|
4
4
|
children: any;
|
|
@@ -17,10 +17,10 @@ export declare class Padded extends React.Component<PaddedProps & {
|
|
|
17
17
|
});
|
|
18
18
|
static all: ({ amount, ...p }: PaddedProps & {
|
|
19
19
|
amount: number;
|
|
20
|
-
}) =>
|
|
20
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
21
21
|
static symmetric: ({ vertical, horizontal, ...p }: PaddedProps & {
|
|
22
22
|
vertical: number;
|
|
23
23
|
horizontal: number;
|
|
24
|
-
}) =>
|
|
25
|
-
render():
|
|
24
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
25
|
+
render(): import("react/jsx-runtime").JSX.Element;
|
|
26
26
|
}
|
|
@@ -9,8 +9,8 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
9
9
|
}
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
|
-
import { jsx as _jsx } from "
|
|
13
|
-
import React from "
|
|
12
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
import React from "react";
|
|
14
14
|
import { applyProps } from "./box";
|
|
15
15
|
export class Padded extends React.Component {
|
|
16
16
|
constructor(props) {
|
|
@@ -1,23 +1,24 @@
|
|
|
1
|
-
import { Component } from "
|
|
1
|
+
import React, { Component } from "react";
|
|
2
2
|
import type { ElbeColorKinds, ElbeColorManners } from "../../theme/colors";
|
|
3
|
+
import { ElbeChildren } from "../../util/types";
|
|
3
4
|
import { ActionElbeProps } from "../base/box";
|
|
4
|
-
import type
|
|
5
|
+
import { type IconChild } from "./icon_button";
|
|
5
6
|
export type ButtonProps = ActionElbeProps & {
|
|
6
7
|
kind?: ElbeColorKinds;
|
|
7
8
|
transparent?: boolean;
|
|
8
9
|
contentAlign?: "start" | "center" | "end";
|
|
9
|
-
onTap?: (e:
|
|
10
|
+
onTap?: (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
|
|
10
11
|
} & {
|
|
11
12
|
icon?: IconChild;
|
|
12
13
|
label?: string;
|
|
13
|
-
children?:
|
|
14
|
+
children?: ElbeChildren;
|
|
14
15
|
};
|
|
15
16
|
export declare class Button extends Component<ButtonProps & {
|
|
16
17
|
manner: ElbeColorManners;
|
|
17
18
|
}> {
|
|
18
|
-
static major: (p: ButtonProps) => import("
|
|
19
|
-
static minor: (p: ButtonProps) => import("
|
|
20
|
-
static flat: (p: ButtonProps) => import("
|
|
21
|
-
static plain: (p: ButtonProps) => import("
|
|
22
|
-
render(): import("
|
|
19
|
+
static major: (p: ButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
static minor: (p: ButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
static flat: (p: ButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
static plain: (p: ButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
23
|
+
render(): import("react/jsx-runtime").JSX.Element;
|
|
23
24
|
}
|
|
@@ -9,23 +9,23 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
9
9
|
}
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
|
-
import { jsx as _jsx, jsxs as _jsxs } from "
|
|
13
|
-
import { Component } from "
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import { Component } from "react";
|
|
14
14
|
import { useToolbar } from "../../util/ctx_toolbar";
|
|
15
|
-
import { _ElbeErr } from "../../util/error_view";
|
|
16
15
|
import { applyProps } from "../base/box";
|
|
16
|
+
import { Icon } from "./icon_button";
|
|
17
17
|
export class Button extends Component {
|
|
18
18
|
render() {
|
|
19
|
-
return
|
|
19
|
+
return _jsx(_Btn, Object.assign({}, this.props, { manner: this.props.manner }));
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
|
-
Button.major = (p) =>
|
|
23
|
-
Button.minor = (p) =>
|
|
24
|
-
Button.flat = (p) =>
|
|
25
|
-
Button.plain = (p) =>
|
|
26
|
-
function
|
|
22
|
+
Button.major = (p) => _jsx(_Btn, Object.assign({}, p, { manner: "major" }));
|
|
23
|
+
Button.minor = (p) => _jsx(_Btn, Object.assign({}, p, { manner: "minor" }));
|
|
24
|
+
Button.flat = (p) => _jsx(_Btn, Object.assign({}, p, { manner: "flat" }));
|
|
25
|
+
Button.plain = (p) => _jsx(_Btn, Object.assign({}, p, { manner: "plain" }));
|
|
26
|
+
function _Btn(_a) {
|
|
27
27
|
var _b;
|
|
28
|
-
var { kind, onTap, icon, label, children, contentAlign } = _a, elbe = __rest(_a, ["kind", "onTap", "icon", "label", "children", "contentAlign"]);
|
|
28
|
+
var { manner, kind, onTap, icon, label, children, contentAlign } = _a, elbe = __rest(_a, ["manner", "kind", "onTap", "icon", "label", "children", "contentAlign"]);
|
|
29
29
|
const toolbarCtx = useToolbar();
|
|
30
30
|
return label || icon || children ? (_jsxs("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 }), [
|
|
31
31
|
"row",
|
|
@@ -36,10 +36,12 @@ function _btn(_a, manner) {
|
|
|
36
36
|
], {
|
|
37
37
|
overflow: "hidden",
|
|
38
38
|
justifyContent: contentAlign !== null && contentAlign !== void 0 ? contentAlign : ((toolbarCtx === null || toolbarCtx === void 0 ? void 0 : toolbarCtx.isInOverflow) ? "start" : "center"),
|
|
39
|
-
backgroundColor: elbe.transparent ? "transparent" :
|
|
40
|
-
}), { title: (_b = elbe.ariaLabel) !== null && _b !== void 0 ? _b : label, disabled: !onTap, onClick: (e) => onTap && onTap(e), children: [
|
|
39
|
+
backgroundColor: elbe.transparent ? "transparent" : undefined,
|
|
40
|
+
}), { title: (_b = elbe.ariaLabel) !== null && _b !== void 0 ? _b : label, disabled: !onTap, onClick: (e) => onTap && onTap(e), children: [_jsx(Icon, { icon: icon }), !(toolbarCtx === null || toolbarCtx === void 0 ? void 0 : toolbarCtx.isInToolbar) && label && (_jsx("div", { style: {
|
|
41
41
|
whiteSpace: "nowrap",
|
|
42
42
|
overflow: "hidden",
|
|
43
43
|
textOverflow: "ellipsis",
|
|
44
|
-
}, children: label })), children] }))) : (
|
|
44
|
+
}, children: label })), children] }))) : (_jsx("div", {})
|
|
45
|
+
//_ElbeErr("Button requires either an icon and or a label, or a child")
|
|
46
|
+
);
|
|
45
47
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ElbeColorKinds } from "../../theme/colors";
|
|
2
|
-
import type
|
|
2
|
+
import { type IconChild } from "./icon_button";
|
|
3
3
|
export interface ChooseItem<T> {
|
|
4
4
|
value: T;
|
|
5
5
|
label?: string;
|
|
@@ -12,4 +12,4 @@ export declare function ChooseButton<T>({ items, value, onChange, kind, column,
|
|
|
12
12
|
onChange?: (v: T) => void;
|
|
13
13
|
kind?: ElbeColorKinds;
|
|
14
14
|
column?: boolean;
|
|
15
|
-
}): import("
|
|
15
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { CheckIcon } from "lucide-react";
|
|
3
3
|
import { Card } from "../base/card";
|
|
4
4
|
import { Spaced } from "../layout/spaced";
|
|
5
5
|
import { Button } from "./button";
|
|
6
|
+
import { Icon } from "./icon_button";
|
|
6
7
|
export function ChooseButton({ items, value, onChange, kind, column = false, }) {
|
|
7
|
-
return (_jsx(Card, { kind: "accent", manner: "major", padding: 0, overflow: "hidden", role: "radiogroup", disabled: !onChange,
|
|
8
|
+
return (_jsx(Card, { kind: "accent", manner: "major", padding: 0, overflow: "hidden", role: "radiogroup", disabled: !onChange, className: `${column ? "column" : "row"} gap-none`, children: items.map((e, i) => {
|
|
8
9
|
var _a, _b;
|
|
9
|
-
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)),
|
|
10
|
-
(e.value === value ? _jsx(CheckIcon, {}) : _jsx(Spaced, { amount: 1.5 }))] }));
|
|
10
|
+
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)), className: `sharp ${column ? "main-between gap-double" : ""}`, children: [_jsxs("div", { className: "row gap-half", children: [_jsx(Icon, { icon: Icon }), e.label && _jsx("span", { children: e.label })] }), column &&
|
|
11
|
+
(e.value === value ? _jsx(CheckIcon, {}) : _jsx(Spaced, { amount: 1.5 }))] }, i));
|
|
11
12
|
}) }));
|
|
12
13
|
}
|
|
@@ -1,21 +1,22 @@
|
|
|
1
|
-
import { Component } from "
|
|
1
|
+
import React, { Component } from "react";
|
|
2
2
|
import { ActionElbeProps, ElbeProps, type ElbeChild, type ElbeColorKinds, type ElbeColorManners } from "../../..";
|
|
3
3
|
export type IconChild = ElbeChild | ((_: any) => ElbeChild);
|
|
4
4
|
export type IconButtonProps = {
|
|
5
5
|
icon?: IconChild;
|
|
6
6
|
kind?: ElbeColorKinds;
|
|
7
7
|
transparent?: boolean;
|
|
8
|
-
onTap?: (e:
|
|
8
|
+
onTap?: (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
|
|
9
9
|
} & ActionElbeProps;
|
|
10
10
|
export declare class IconButton extends Component<IconButtonProps & {
|
|
11
11
|
manner?: ElbeColorManners;
|
|
12
12
|
}> {
|
|
13
|
-
static major: (p: IconButtonProps) => import("
|
|
14
|
-
static minor: (p: IconButtonProps) => import("
|
|
15
|
-
static flat: (p: IconButtonProps) => import("
|
|
16
|
-
static plain: (p: IconButtonProps) => import("
|
|
17
|
-
render(): import("
|
|
13
|
+
static major: (p: IconButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
static minor: (p: IconButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
static flat: (p: IconButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
static plain: (p: IconButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
render(): import("react/jsx-runtime").JSX.Element;
|
|
18
18
|
}
|
|
19
19
|
export declare function Icon(p: {
|
|
20
20
|
icon: IconChild;
|
|
21
|
-
} & ElbeProps): import("
|
|
21
|
+
} & ElbeProps): import("react/jsx-runtime").JSX.Element | null;
|
|
22
|
+
export declare function _renderIcon(icon: IconChild | undefined): string | number | bigint | boolean | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | import("react/jsx-runtime").JSX.Element | null | undefined;
|
|
@@ -9,8 +9,8 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
9
9
|
}
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
|
-
import { jsx as _jsx } from "
|
|
13
|
-
import { Component } from "
|
|
12
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
import React, { Component } from "react";
|
|
14
14
|
import { applyProps, } from "../../..";
|
|
15
15
|
export class IconButton extends Component {
|
|
16
16
|
render() {
|
|
@@ -33,7 +33,7 @@ function _btn(_a, manner) {
|
|
|
33
33
|
manner,
|
|
34
34
|
!onTap && "disabled",
|
|
35
35
|
], {
|
|
36
|
-
backgroundColor: elbe.transparent ? "transparent" :
|
|
36
|
+
backgroundColor: elbe.transparent ? "transparent" : undefined,
|
|
37
37
|
border: "none",
|
|
38
38
|
borderRadius: "3rem",
|
|
39
39
|
height: "3rem",
|
|
@@ -47,5 +47,17 @@ export function Icon(p) {
|
|
|
47
47
|
display: "flex",
|
|
48
48
|
alignItems: "center",
|
|
49
49
|
justifyContent: "center",
|
|
50
|
-
}), { children:
|
|
50
|
+
}), { children: _renderIcon(p.icon) })));
|
|
51
|
+
}
|
|
52
|
+
export function _renderIcon(icon) {
|
|
53
|
+
if (!icon)
|
|
54
|
+
return null;
|
|
55
|
+
if (typeof icon === "function")
|
|
56
|
+
return icon({});
|
|
57
|
+
// check if it's a valid React element
|
|
58
|
+
if (React.isValidElement(icon))
|
|
59
|
+
return icon;
|
|
60
|
+
// return it as a component
|
|
61
|
+
const Icon = icon;
|
|
62
|
+
return _jsx(Icon, {});
|
|
51
63
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { ElbeColorKinds } from "../../theme/colors";
|
|
2
2
|
import { ActionElbeProps } from "../base/box";
|
|
3
|
-
import type
|
|
3
|
+
import { type IconChild } from "./icon_button";
|
|
4
4
|
export declare function ToggleButton({ value, onChange, label, icon, kind, ...elbe }: {
|
|
5
5
|
value: boolean;
|
|
6
6
|
onChange?: (v: boolean) => void;
|
|
7
7
|
kind?: ElbeColorKinds;
|
|
8
8
|
label: string;
|
|
9
9
|
icon?: IconChild;
|
|
10
|
-
} & ActionElbeProps): import("
|
|
10
|
+
} & ActionElbeProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -9,18 +9,22 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
9
9
|
}
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
|
-
import { jsx as _jsx, jsxs as _jsxs } from "
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
13
|
import { CheckIcon } from "lucide-react";
|
|
14
14
|
import { useThemeConfig } from "../../theme/theme_context";
|
|
15
15
|
import { applyProps } from "../base/box";
|
|
16
16
|
import { Padded } from "../base/padded";
|
|
17
17
|
import { Spaced } from "../layout/spaced";
|
|
18
18
|
import { Button } from "./button";
|
|
19
|
+
import { Icon } from "./icon_button";
|
|
19
20
|
export function ToggleButton(_a) {
|
|
21
|
+
var _b;
|
|
20
22
|
var { value, onChange, label, icon, kind } = _a, elbe = __rest(_a, ["value", "onChange", "label", "icon", "kind"]);
|
|
21
23
|
const tConfig = useThemeConfig();
|
|
22
|
-
return (_jsxs(Button, Object.assign({ manner: value ? "major" : "flat", kind: kind, onTap: onChange && (() => onChange(!value)) }, applyProps("toggle_button", elbe, "main-between"), { children: [_jsxs("div", {
|
|
23
|
-
transition: tConfig.reducedMotion
|
|
24
|
+
return (_jsxs(Button, Object.assign({ manner: value ? "major" : "flat", kind: kind, onTap: onChange && (() => onChange(!value)), ariaLabel: (_b = elbe.ariaLabel) !== null && _b !== void 0 ? _b : label }, applyProps("toggle_button", elbe, "main-between"), { children: [_jsxs("div", { className: "row gap-none", children: [_jsx(Icon, { icon: icon }), icon && _jsx(Spaced, { width: 0.5 }), label && _jsx("span", { children: label })] }), _jsx("div", { style: {
|
|
25
|
+
transition: tConfig.reducedMotion
|
|
26
|
+
? undefined
|
|
27
|
+
: "width 0.2s ease-in-out",
|
|
24
28
|
width: value ? "2.5rem" : "0rem",
|
|
25
|
-
}, children: value && (_jsx(Padded, {
|
|
29
|
+
}, children: value && (_jsx(Padded, { className: "centered", left: 1, children: _jsx(CheckIcon, {}) })) })] })));
|
|
26
30
|
}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { ElbeProps } from "../base/box";
|
|
2
2
|
export declare namespace ToDo {
|
|
3
|
-
function Overlay({}: {}): import("
|
|
3
|
+
function Overlay({}: {}): import("react/jsx-runtime").JSX.Element | null;
|
|
4
4
|
function Inline({ msg, ...elbe }: {
|
|
5
5
|
msg: string;
|
|
6
6
|
width?: number;
|
|
7
7
|
height?: number;
|
|
8
|
-
} & ElbeProps): import("
|
|
8
|
+
} & ElbeProps): import("react/jsx-runtime").JSX.Element;
|
|
9
9
|
function Block({ msg, width, height, ...elbe }: {
|
|
10
10
|
msg: string;
|
|
11
11
|
width?: number;
|
|
12
12
|
height?: number;
|
|
13
|
-
} & ElbeProps): import("
|
|
13
|
+
} & ElbeProps): import("react/jsx-runtime").JSX.Element;
|
|
14
14
|
function Placeholder({ width, height, ...elbe }: {
|
|
15
15
|
width?: number;
|
|
16
16
|
height?: number;
|
|
17
|
-
} & ElbeProps): import("
|
|
17
|
+
} & ElbeProps): import("react/jsx-runtime").JSX.Element;
|
|
18
18
|
}
|
|
@@ -9,9 +9,9 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
9
9
|
}
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
|
-
import { jsx as _jsx, jsxs as _jsxs } from "
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
13
|
import { XIcon } from "lucide-react";
|
|
14
|
-
import { useEffect, useState } from "
|
|
14
|
+
import { useEffect, useState } from "react";
|
|
15
15
|
import { applyProps } from "../base/box";
|
|
16
16
|
const _toDoStyle = {
|
|
17
17
|
padding: ".3rem .5rem",
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { ElbeChildren } from "../util/types";
|
|
2
|
-
export declare function ElbeDialog({ title, open, onClose, children, _style, }: {
|
|
3
|
-
_style?:
|
|
2
|
+
export declare function ElbeDialog({ title, open, onClose, children, _style, barrierDismissible, }: {
|
|
3
|
+
_style?: React.CSSProperties;
|
|
4
4
|
title: string;
|
|
5
5
|
open: boolean;
|
|
6
6
|
onClose: () => void;
|
|
7
7
|
children: ElbeChildren;
|
|
8
|
-
|
|
8
|
+
barrierDismissible?: boolean;
|
|
9
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,11 +1,28 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { X } from "lucide-react";
|
|
3
|
+
import { useEffect } from "react";
|
|
3
4
|
import { IconButton } from "./button/icon_button";
|
|
4
5
|
import { Spaced } from "./layout/spaced";
|
|
5
|
-
export function ElbeDialog({ title, open, onClose, children, _style, }) {
|
|
6
|
-
|
|
6
|
+
export function ElbeDialog({ title, open, onClose, children, _style, barrierDismissible, }) {
|
|
7
|
+
useEffect(() => {
|
|
8
|
+
if (open) {
|
|
9
|
+
document.body.style.overflow = "hidden";
|
|
10
|
+
}
|
|
11
|
+
else {
|
|
12
|
+
document.body.style.overflow = "";
|
|
13
|
+
}
|
|
14
|
+
return () => {
|
|
15
|
+
document.body.style.overflow = "";
|
|
16
|
+
};
|
|
17
|
+
}, [open]);
|
|
18
|
+
return (_jsx("dialog", { onClick: (e) => {
|
|
19
|
+
e.stopPropagation();
|
|
20
|
+
e.preventDefault();
|
|
21
|
+
if (barrierDismissible)
|
|
22
|
+
onClose();
|
|
23
|
+
}, open: open, style: Object.assign({ textAlign: "start" }, (_style !== null && _style !== void 0 ? _style : {})), children: _jsxs("div", { className: "elbe_dialog_base primary card plain-opaque padding-none", style: { maxWidth: "40rem", minWidth: "10rem" }, children: [_jsxs("div", { className: "row cross-center padded main-between", children: [_jsx("div", { className: "body-l b", children: title }), _jsx(IconButton.plain, { ariaLabel: "Close", icon: X, onTap: (e) => {
|
|
7
24
|
e.stopPropagation();
|
|
8
25
|
e.preventDefault();
|
|
9
26
|
onClose();
|
|
10
|
-
} })] }), _jsx(Spaced, { amount: 0.5 }), _jsx("div", {
|
|
27
|
+
} })] }), _jsx(Spaced, { amount: 0.5 }), _jsx("div", { className: "padded", style: { maxHeight: "80vh", overflow: "auto" }, children: children })] }) }));
|
|
11
28
|
}
|
|
@@ -3,7 +3,7 @@ export declare function ErrorView({ error, retry, debug, }: {
|
|
|
3
3
|
error: any;
|
|
4
4
|
retry?: () => any;
|
|
5
5
|
debug?: boolean;
|
|
6
|
-
}): import("
|
|
6
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
7
7
|
export declare function PrettyErrorView({ error, retry, labels, }: {
|
|
8
8
|
error: ElbeError;
|
|
9
9
|
retry?: () => any;
|
|
@@ -12,4 +12,4 @@ export declare function PrettyErrorView({ error, retry, labels, }: {
|
|
|
12
12
|
home?: L10nInlinePlain;
|
|
13
13
|
details: L10nInlinePlain;
|
|
14
14
|
};
|
|
15
|
-
}): import("
|
|
15
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,12 +1,16 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "
|
|
2
|
-
import { useSignal } from "@preact/signals";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
2
|
import { icons } from "lucide-react";
|
|
4
|
-
import {
|
|
5
|
-
import { ElbeDialog, Icon, Icons, toElbeError, } from "../..";
|
|
3
|
+
import { useState } from "react";
|
|
4
|
+
import { ElbeDialog, Icon, Icons, toElbeError, Wouter, } from "../..";
|
|
6
5
|
import { _maybeL10n } from "../util/l10n/_l10n_util";
|
|
7
6
|
export function ErrorView({ error, retry, debug, }) {
|
|
7
|
+
var _a;
|
|
8
|
+
const l10n = _maybeL10n();
|
|
8
9
|
const apiError = toElbeError(error);
|
|
9
|
-
|
|
10
|
+
const fallback = typeof apiError.message === "string"
|
|
11
|
+
? apiError.message
|
|
12
|
+
: "An error occurred";
|
|
13
|
+
return !debug ? (_jsx(PrettyErrorView, { error: apiError, retry: retry })) : (_jsxs("div", { className: "column padded card inverse cross-stretch", 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) })] }));
|
|
10
14
|
}
|
|
11
15
|
export function PrettyErrorView({ error, retry, labels = {
|
|
12
16
|
retry: {
|
|
@@ -36,7 +40,7 @@ export function PrettyErrorView({ error, retry, labels = {
|
|
|
36
40
|
}, }) {
|
|
37
41
|
var _a, _b, _c, _d, _e, _f;
|
|
38
42
|
const l10n = _maybeL10n();
|
|
39
|
-
const
|
|
40
|
-
const [loc, navigate] = useLocation();
|
|
41
|
-
return (_jsxs("div", {
|
|
43
|
+
const [open, setOpen] = useState(false);
|
|
44
|
+
const [loc, navigate] = Wouter.useLocation();
|
|
45
|
+
return (_jsxs("div", { className: "column padded cross-center", style: { margin: "1rem 0" }, 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(ElbeDialog, { 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) }) })] }));
|
|
42
46
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from "
|
|
1
|
+
import React from "react";
|
|
2
2
|
import { IconChild } from "../..";
|
|
3
3
|
export type FooterLink = {
|
|
4
4
|
label: string;
|
|
@@ -12,8 +12,8 @@ export declare function Footer({ left, right, copyright, version, legal, marginT
|
|
|
12
12
|
version?: string;
|
|
13
13
|
legal?: FooterLink;
|
|
14
14
|
marginTop?: number;
|
|
15
|
-
}):
|
|
15
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
16
16
|
export declare function _WrittenIn({ city, href, }: {
|
|
17
17
|
city?: string;
|
|
18
18
|
href?: string;
|
|
19
|
-
}):
|
|
19
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { HeartIcon } from "lucide-react";
|
|
3
3
|
import { Card, Column, FlexSpace, Link, Row, useLayoutMode, } from "../..";
|
|
4
4
|
export function Footer({ left, right, copyright, version, legal, marginTop, }) {
|
|
@@ -7,10 +7,10 @@ export function Footer({ left, right, copyright, version, legal, marginTop, }) {
|
|
|
7
7
|
borderLeft: "none",
|
|
8
8
|
borderRight: "none",
|
|
9
9
|
borderBottom: "none",
|
|
10
|
-
borderTopLeftRadius: layoutMode.isWide ? "var(--g-radius)" :
|
|
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: 0.5, 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) => item.label ? _jsx(_Link, Object.assign({}, item)) : item) })), right && (_jsx(Column, { gap: 0.5, flex: 1, cross: "end", children: right.map((item) => item.label ? _jsx(_Link, Object.assign({}, item)) : item) }))] })), (left || right) && (copyright || version || legal) && (_jsx("hr", { style: { opacity: 0.7 } })), (copyright || version || legal) && (_jsxs(Row, { children: [copyright &&
|
|
13
|
+
}, children: _jsxs(Column, { gap: 0.5, 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", { style: { opacity: 0.7 } })), (copyright || version || legal) && (_jsxs(Row, { children: [copyright &&
|
|
14
14
|
(typeof copyright === "string" ? _jsx("b", { children: copyright }) : copyright), version && _jsx(_Version, { version: version }), _jsx(FlexSpace, {}), legal && _jsx(_Link, Object.assign({}, legal))] }))] }) }));
|
|
15
15
|
}
|
|
16
16
|
function _Version({ version }) {
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { BooleanInputProps } from "../../..";
|
|
2
2
|
import { ActionElbeProps } from "../base/box";
|
|
3
|
-
export declare function Checkbox(p: BooleanInputProps & ActionElbeProps): import("
|
|
3
|
+
export declare function Checkbox(p: BooleanInputProps & ActionElbeProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { _InputSpacer, useThemeConfig } from "../../..";
|
|
3
3
|
import { applyProps } from "../base/box";
|
|
4
4
|
export function Checkbox(p) {
|
|
5
5
|
const tConfig = useThemeConfig();
|
|
6
|
-
return _InputSpacer(p, _jsxs("div", {
|
|
6
|
+
return _InputSpacer(p, _jsxs("div", { className: `row ${p.onChange ? "" : "disabled"}`, style: {
|
|
7
7
|
gap: ".75rem",
|
|
8
8
|
filter: p.onChange ? "" : "grayscale(1)",
|
|
9
9
|
opacity: p.onChange ? "" : "0.5",
|
|
10
10
|
}, children: [_jsx("input", Object.assign({ type: "checkbox" }, applyProps("checkbox", Object.assign({ role: "checkbox" }, p), p.value ? ["accent major"] : "accent minor", {
|
|
11
|
-
background: p.value ?
|
|
12
|
-
transition: tConfig.reducedMotion ? "none" :
|
|
13
|
-
}), { disabled: !p.onChange, checked: p.value, onClick: (e) => e.stopPropagation(), onChange: (e) => { var _a; return (_a = p.onChange) === null || _a === void 0 ? void 0 : _a.call(p, e.currentTarget.checked); } })), p.label && _jsx("div", { style:
|
|
11
|
+
background: p.value ? undefined : "transparent",
|
|
12
|
+
transition: tConfig.reducedMotion ? "none" : undefined,
|
|
13
|
+
}), { disabled: !p.onChange, checked: p.value, onClick: (e) => e.stopPropagation(), onChange: (e) => { var _a; return (_a = p.onChange) === null || _a === void 0 ? void 0 : _a.call(p, e.currentTarget.checked); } })), p.label && _jsx("div", { style: { marginTop: "-.25rem" }, children: p.label })] }));
|
|
14
14
|
}
|
|
@@ -5,4 +5,4 @@ export declare function Range({ value, onChange, min, max, step, ...elbe }: {
|
|
|
5
5
|
step?: number;
|
|
6
6
|
max?: number;
|
|
7
7
|
onChange?: ((value: number) => void) | null;
|
|
8
|
-
} & ActionElbeProps): import("
|
|
8
|
+
} & ActionElbeProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -9,7 +9,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
9
9
|
}
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
|
-
import { jsx as _jsx } from "
|
|
12
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
13
|
import { useTheme } from "../../theme/theme_context";
|
|
14
14
|
import { _ElbeErr } from "../../util/error_view";
|
|
15
15
|
import { applyProps } from "../base/box";
|
|
@@ -9,9 +9,9 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
9
9
|
}
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
|
-
import { jsx as _jsx } from "
|
|
12
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
13
|
import { applyProps } from "../base/box";
|
|
14
14
|
export function Select(_a) {
|
|
15
15
|
var { options, value, label, onChange } = _a, elbe = __rest(_a, ["options", "value", "label", "onChange"]);
|
|
16
|
-
return (_jsx("select", Object.assign({}, applyProps("select", elbe), { value: value,
|
|
16
|
+
return (_jsx("select", Object.assign({}, applyProps("select", elbe), { value: value, role: "combobox", onChange: (e) => onChange(e.currentTarget.value), children: options.map(({ key, label }) => (_jsx("option", { value: key, children: label }, key))) })));
|
|
17
17
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from "
|
|
1
|
+
import React from "react";
|
|
2
2
|
import { ElbeProps } from "../../base/box";
|
|
3
3
|
import { SLInputFieldProps } from "./single_line";
|
|
4
4
|
export type InputFieldProps = {
|
|
@@ -17,12 +17,12 @@ export type InputFieldProps = {
|
|
|
17
17
|
export declare class Field<T extends InputFieldProps> extends React.Component<T & {
|
|
18
18
|
type: "text" | "number" | "password" | "date" | "time" | "email" | "area";
|
|
19
19
|
}> {
|
|
20
|
-
static text: (p: SLInputFieldProps) =>
|
|
21
|
-
static number: (p: SLInputFieldProps) =>
|
|
22
|
-
static password: (p: SLInputFieldProps) =>
|
|
23
|
-
static date: (p: SLInputFieldProps) =>
|
|
24
|
-
static time: (p: SLInputFieldProps) =>
|
|
25
|
-
static email: (p: SLInputFieldProps) =>
|
|
26
|
-
static multiLine: (p: InputFieldProps) =>
|
|
27
|
-
render():
|
|
20
|
+
static text: (p: SLInputFieldProps) => import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
static number: (p: SLInputFieldProps) => import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
static password: (p: SLInputFieldProps) => import("react/jsx-runtime").JSX.Element;
|
|
23
|
+
static date: (p: SLInputFieldProps) => import("react/jsx-runtime").JSX.Element;
|
|
24
|
+
static time: (p: SLInputFieldProps) => import("react/jsx-runtime").JSX.Element;
|
|
25
|
+
static email: (p: SLInputFieldProps) => import("react/jsx-runtime").JSX.Element;
|
|
26
|
+
static multiLine: (p: InputFieldProps) => import("react/jsx-runtime").JSX.Element;
|
|
27
|
+
render(): import("react/jsx-runtime").JSX.Element;
|
|
28
28
|
}
|