elbe-ui 0.2.41 → 0.2.46
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/bit/bit.js +22 -25
- package/dist/bit/ctrl_bit.js +47 -28
- package/dist/elbe.css +58 -18
- package/dist/elbe.css.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +34 -62
- package/dist/service/s_api.js +62 -49
- package/dist/ui/components/badge.js +13 -34
- package/dist/ui/components/base/box.d.ts +37 -40
- package/dist/ui/components/base/box.js +21 -23
- package/dist/ui/components/base/card.js +19 -10
- package/dist/ui/components/base/padded.d.ts +10 -9
- package/dist/ui/components/base/padded.js +31 -21
- package/dist/ui/components/button/button.js +30 -22
- package/dist/ui/components/button/choose_button.js +7 -10
- package/dist/ui/components/button/icon_button.js +36 -26
- package/dist/ui/components/button/toggle_button.js +19 -10
- package/dist/ui/components/dev/todo.d.ts +18 -0
- package/dist/ui/components/dev/todo.js +69 -0
- package/dist/ui/components/dialog.js +7 -10
- package/dist/ui/components/error_view.js +14 -16
- package/dist/ui/components/input/checkbox.js +17 -8
- package/dist/ui/components/input/input_field.js +28 -23
- package/dist/ui/components/input/range.js +26 -9
- package/dist/ui/components/input/select.js +16 -7
- package/dist/ui/components/input/text_area.js +17 -8
- package/dist/ui/components/layout/flex.d.ts +4 -3
- package/dist/ui/components/layout/flex.js +27 -19
- package/dist/ui/components/layout/scaffold.d.ts +9 -6
- package/dist/ui/components/layout/scaffold.js +40 -22
- package/dist/ui/components/layout/scroll.js +10 -14
- package/dist/ui/components/layout/spaced.js +3 -6
- package/dist/ui/components/spinner.js +16 -19
- package/dist/ui/components/text.js +42 -37
- package/dist/ui/theme/color_theme.js +36 -42
- package/dist/ui/theme/colors.js +40 -77
- package/dist/ui/theme/geometry_theme.js +8 -16
- package/dist/ui/theme/theme.d.ts +1 -0
- package/dist/ui/theme/theme.js +13 -34
- package/dist/ui/theme/type_theme.js +11 -39
- package/dist/ui/util/confirm_dialog.js +1 -4
- package/dist/ui/util/error_view.js +4 -7
- package/dist/ui/util/toast.js +8 -5
- package/dist/ui/util/util.d.ts +1 -0
- package/dist/ui/util/util.js +12 -13
- package/package.json +4 -2
|
@@ -1,31 +1,41 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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 } from "preact/jsx-runtime";
|
|
13
|
+
import { Component } from "preact";
|
|
14
|
+
import { applyProps, } from "../../..";
|
|
15
|
+
export class IconButton extends Component {
|
|
12
16
|
render() {
|
|
13
17
|
return _btn(this.props, this.props.manner);
|
|
14
18
|
}
|
|
15
19
|
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
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, manner) {
|
|
25
|
+
var _b;
|
|
26
|
+
var { icon, onTap } = _a, elbe = __rest(_a, ["icon", "onTap"]);
|
|
27
|
+
if (manner === void 0) { manner = "major"; }
|
|
28
|
+
return (_jsx("button", Object.assign({}, applyProps(elbe, [
|
|
29
|
+
"row",
|
|
30
|
+
"main-center",
|
|
31
|
+
"gap-half",
|
|
32
|
+
(_b = elbe.kind) !== null && _b !== void 0 ? _b : (manner != "plain" && "accent"),
|
|
33
|
+
manner,
|
|
34
|
+
!onTap && "disabled",
|
|
35
|
+
], {
|
|
36
|
+
border: "none",
|
|
37
|
+
borderRadius: "3rem",
|
|
38
|
+
height: "3rem",
|
|
39
|
+
width: "3rem",
|
|
40
|
+
}), { onClick: (e) => onTap && onTap(e), children: typeof icon === "function" ? icon({}) : icon })));
|
|
31
41
|
}
|
|
@@ -1,11 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
return
|
|
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 "preact/jsx-runtime";
|
|
13
|
+
import { CheckIcon } from "lucide-react";
|
|
14
|
+
import { applyProps } from "../base/box";
|
|
15
|
+
import { Spaced } from "../layout/spaced";
|
|
16
|
+
import { Button } from "./button";
|
|
17
|
+
export function ToggleButton(_a) {
|
|
18
|
+
var { value, onChange, label, icon, kind } = _a, elbe = __rest(_a, ["value", "onChange", "label", "icon", "kind"]);
|
|
19
|
+
return (_jsxs(Button, Object.assign({ manner: value ? "minor" : "flat", kind: kind, onTap: onChange && (() => onChange(!value)) }, applyProps(elbe, "main-between", { gap: "1.5rem" }), { children: [_jsxs("div", { class: "row gap-half", children: [typeof icon === "function" ? icon({}) : icon, label && _jsx("span", { children: label })] }), value ? _jsx(CheckIcon, {}) : _jsx(Spaced, { amount: 1.5 })] })));
|
|
11
20
|
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ElbeProps } from "../base/box";
|
|
2
|
+
export declare namespace ToDo {
|
|
3
|
+
function Overlay({}: {}): import("preact").JSX.Element | null;
|
|
4
|
+
function Inline({ msg, ...elbe }: {
|
|
5
|
+
msg: string;
|
|
6
|
+
width?: number;
|
|
7
|
+
height?: number;
|
|
8
|
+
} & ElbeProps): import("preact").JSX.Element;
|
|
9
|
+
function Block({ msg, width, height, ...elbe }: {
|
|
10
|
+
msg: string;
|
|
11
|
+
width?: number;
|
|
12
|
+
height?: number;
|
|
13
|
+
} & ElbeProps): import("preact").JSX.Element;
|
|
14
|
+
function Placeholder({ width, height, ...elbe }: {
|
|
15
|
+
width?: number;
|
|
16
|
+
height?: number;
|
|
17
|
+
} & ElbeProps): import("preact").JSX.Element;
|
|
18
|
+
}
|
|
@@ -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 "preact/jsx-runtime";
|
|
13
|
+
import { XIcon } from "lucide-react";
|
|
14
|
+
import { useEffect, useState } from "preact/hooks";
|
|
15
|
+
import { applyProps } from "../base/box";
|
|
16
|
+
const _toDoStyle = {
|
|
17
|
+
padding: ".3rem .5rem",
|
|
18
|
+
borderRadius: ".3rem",
|
|
19
|
+
background: "#880070",
|
|
20
|
+
color: "white",
|
|
21
|
+
fontSize: ".8rem",
|
|
22
|
+
};
|
|
23
|
+
export var ToDo;
|
|
24
|
+
(function (ToDo) {
|
|
25
|
+
function Overlay({}) {
|
|
26
|
+
const [todos, setTodos] = useState(0);
|
|
27
|
+
useEffect(() => {
|
|
28
|
+
const e = document.querySelectorAll('[data-type="todo"], [data-type="placeholder"]');
|
|
29
|
+
setTodos(e.length);
|
|
30
|
+
}, []);
|
|
31
|
+
return todos == 0 ? null : (_jsxs("div", { ["data-type"]: "todo-overlay", style: {
|
|
32
|
+
position: "fixed",
|
|
33
|
+
bottom: "0",
|
|
34
|
+
right: "0",
|
|
35
|
+
padding: ".6rem",
|
|
36
|
+
margin: ".5rem",
|
|
37
|
+
marginRight: 0,
|
|
38
|
+
background: _toDoStyle.background,
|
|
39
|
+
color: _toDoStyle.color,
|
|
40
|
+
boxShadow: "0 .125rem 1rem rgba(0,0,0,.6)",
|
|
41
|
+
fontSize: ".8rem",
|
|
42
|
+
borderRadius: ".5rem 0 0 .5rem",
|
|
43
|
+
display: "flex",
|
|
44
|
+
alignItems: "center",
|
|
45
|
+
gap: ".4rem",
|
|
46
|
+
}, children: [_jsx(XIcon, { height: "1.2rem", onClick: () => setTodos(0) }), _jsxs("span", { children: [_jsxs("b", { children: [todos, " ToDos"] }), " on this page"] })] }));
|
|
47
|
+
}
|
|
48
|
+
ToDo.Overlay = Overlay;
|
|
49
|
+
function Inline(_a) {
|
|
50
|
+
var { msg } = _a, elbe = __rest(_a, ["msg"]);
|
|
51
|
+
return (_jsxs("div", Object.assign({}, applyProps(Object.assign(Object.assign({}, elbe), { typeLabel: "todo" }), [], Object.assign(Object.assign({}, _toDoStyle), { display: "inline" })), { children: [_jsx("b", { children: "ToDo: " }), _jsx("span", { style: { fontWeight: "normal" }, children: msg })] })));
|
|
52
|
+
}
|
|
53
|
+
ToDo.Inline = Inline;
|
|
54
|
+
function Block(_a) {
|
|
55
|
+
var { msg, width, height } = _a, elbe = __rest(_a, ["msg", "width", "height"]);
|
|
56
|
+
return (_jsx("div", Object.assign({}, applyProps(Object.assign(Object.assign({}, elbe), { typeLabel: "todo" }), [], Object.assign(Object.assign({}, _toDoStyle), { display: "flex", flexDirection: "column", alignItems: "center", justifyContent: "center", width: width ? width + "rem" : "auto", height: height ? height + "rem" : "auto", overflow: "hidden" })), { children: _jsxs("span", { children: [_jsx("b", { children: "ToDo: " }), _jsx("span", { style: { fontWeight: "normal" }, children: msg })] }) })));
|
|
57
|
+
}
|
|
58
|
+
ToDo.Block = Block;
|
|
59
|
+
function Placeholder(_a) {
|
|
60
|
+
var { width, height } = _a, elbe = __rest(_a, ["width", "height"]);
|
|
61
|
+
return (_jsx("div", Object.assign({}, applyProps(Object.assign(Object.assign({}, elbe), { typeLabel: "placeholder" }), [], {
|
|
62
|
+
padding: "0",
|
|
63
|
+
width: width ? width + "rem" : "auto",
|
|
64
|
+
height: height ? height + "rem" : "auto",
|
|
65
|
+
overflow: "hidden",
|
|
66
|
+
}), { children: _jsxs("svg", { width: width ? width + "rem" : "100%", height: height ? height + "rem" : "100%", preserveAspectRatio: "none", children: [_jsx("rect", { x: "0", y: "0", width: "100%", height: "100%", fill: "transparent", stroke: _toDoStyle.background, strokeWidth: ".25rem" }), _jsx("line", { x1: "0", y1: "0", x2: "100%", y2: "100%", stroke: _toDoStyle.background, strokeWidth: ".125rem" }), _jsx("line", { x1: "100%", y1: "0", x2: "0", y2: "100%", stroke: _toDoStyle.background, strokeWidth: ".125rem" })] }) })));
|
|
67
|
+
}
|
|
68
|
+
ToDo.Placeholder = Placeholder;
|
|
69
|
+
})(ToDo || (ToDo = {}));
|
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const spaced_1 = require("./layout/spaced");
|
|
8
|
-
function ElbeDialog({ title, open, onClose, children, _style, }) {
|
|
9
|
-
return ((0, jsx_runtime_1.jsx)("dialog", { onClick: (e) => e.stopPropagation(), open: open, style: "text-align: start" + (_style ?? ""), children: (0, jsx_runtime_1.jsxs)("div", { class: "primary card plain-opaque padding-none", style: "max-width: 40rem; min-width: 10rem", children: [(0, jsx_runtime_1.jsxs)("div", { class: "row cross-center padded main-between", children: [(0, jsx_runtime_1.jsx)("div", { class: "body-l b", children: title }), (0, jsx_runtime_1.jsx)(icon_button_1.IconButton.plain, { icon: lucide_react_1.X, onTap: (e) => {
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "preact/jsx-runtime";
|
|
2
|
+
import { X } from "lucide-react";
|
|
3
|
+
import { IconButton } from "./button/icon_button";
|
|
4
|
+
import { Spaced } from "./layout/spaced";
|
|
5
|
+
export function ElbeDialog({ title, open, onClose, children, _style, }) {
|
|
6
|
+
return (_jsx("dialog", { onClick: (e) => e.stopPropagation(), open: open, style: "text-align: start" + (_style !== null && _style !== void 0 ? _style : ""), children: _jsxs("div", { class: "primary card plain-opaque padding-none", style: "max-width: 40rem; min-width: 10rem", children: [_jsxs("div", { class: "row cross-center padded main-between", children: [_jsx("div", { class: "body-l b", children: title }), _jsx(IconButton.plain, { icon: X, onTap: (e) => {
|
|
10
7
|
e.stopPropagation();
|
|
11
8
|
e.preventDefault();
|
|
12
9
|
onClose();
|
|
13
|
-
} })] }), (
|
|
10
|
+
} })] }), _jsx(Spaced, { amount: 0.5 }), _jsx("div", { class: "padded", style: "max-height: 80vh; overflow: auto", children: children })] }) }));
|
|
14
11
|
}
|
|
@@ -1,26 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const
|
|
10
|
-
const dialog_1 = require("./dialog");
|
|
11
|
-
function ErrorView({ error, retry, debug, }) {
|
|
12
|
-
const apiError = (0, s_api_1.ifApiError)(error) ?? {
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "preact/jsx-runtime";
|
|
2
|
+
import { useSignal } from "@preact/signals";
|
|
3
|
+
import { route } from "preact-router";
|
|
4
|
+
import { Icons } from "../..";
|
|
5
|
+
import { ifApiError } from "../../service/s_api";
|
|
6
|
+
import { ElbeDialog } from "./dialog";
|
|
7
|
+
export function ErrorView({ error, retry, debug, }) {
|
|
8
|
+
var _a;
|
|
9
|
+
const apiError = (_a = ifApiError(error)) !== null && _a !== void 0 ? _a : {
|
|
13
10
|
code: 0,
|
|
14
11
|
message: "unknown error",
|
|
15
12
|
data: error,
|
|
16
13
|
};
|
|
17
|
-
return !debug ? ((
|
|
14
|
+
return !debug ? (_jsx(PrettyErrorView, { apiError: apiError, retry: retry })) : (_jsxs("div", { class: "column padded card inverse cross-stretch", children: [_jsxs("h3", { style: "margin: 0", children: ["ERROR: ", apiError.code] }), _jsx("p", { children: apiError.message }), _jsx("pre", { children: JSON.stringify(apiError.data, null, 2) })] }));
|
|
18
15
|
}
|
|
19
|
-
function PrettyErrorView({ apiError, retry, labels = {
|
|
16
|
+
export function PrettyErrorView({ apiError, retry, labels = {
|
|
20
17
|
retry: "retry",
|
|
21
18
|
home: "go home",
|
|
22
19
|
details: "error details",
|
|
23
20
|
}, }) {
|
|
24
|
-
|
|
25
|
-
|
|
21
|
+
var _a, _b, _c;
|
|
22
|
+
const openSig = useSignal(false);
|
|
23
|
+
return (_jsxs("div", { class: "column padded cross-center", style: "margin: 1rem 0", children: [_jsx(Icons.OctagonAlert, {}), _jsx("h3", { style: "margin: 0", children: apiError.code }), _jsx("span", { class: "pointer", onClick: () => (openSig.value = true), children: apiError.message }), retry && (_jsxs("button", { class: "action", onClick: () => retry(), children: [_jsx(Icons.RotateCcw, {}), " ", (_a = labels.retry) !== null && _a !== void 0 ? _a : "retry"] })), apiError.code === 404 && (_jsxs("button", { class: "action", onClick: () => route("/"), children: [_jsx(Icons.House, {}), (_b = labels.home) !== null && _b !== void 0 ? _b : "go home"] })), _jsx(ElbeDialog, { title: (_c = labels.details) !== null && _c !== void 0 ? _c : "error details", open: openSig.value, onClose: () => (openSig.value = false), children: _jsx("pre", { class: "card inverse", children: JSON.stringify(apiError.data, null, 2) }) })] }));
|
|
26
24
|
}
|
|
@@ -1,12 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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 "preact/jsx-runtime";
|
|
13
|
+
import { applyProps } from "../base/box";
|
|
14
|
+
export function Checkbox(_a) {
|
|
15
|
+
var { value, label, onChange } = _a, elbe = __rest(_a, ["value", "label", "onChange"]);
|
|
16
|
+
return (_jsxs("div", { class: `row ${onChange ? "" : "disabled"}`, style: {
|
|
8
17
|
gap: ".75rem",
|
|
9
18
|
filter: onChange ? "" : "grayscale(1)",
|
|
10
19
|
opacity: onChange ? "" : "0.5",
|
|
11
|
-
}, children: [(
|
|
20
|
+
}, children: [_jsx("input", Object.assign({ type: "checkbox" }, applyProps(elbe), { disabled: !onChange, checked: value, onChange: (e) => onChange === null || onChange === void 0 ? void 0 : onChange(e.currentTarget.checked) })), label && _jsx("div", { style: "margin-top: -.25rem", children: label })] }));
|
|
12
21
|
}
|
|
@@ -1,31 +1,36 @@
|
|
|
1
|
-
|
|
2
|
-
var
|
|
3
|
-
|
|
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;
|
|
4
11
|
};
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const text_area_1 = require("./text_area");
|
|
11
|
-
class Field extends compat_1.default.Component {
|
|
12
|
-
static text = (p) => (0, jsx_runtime_1.jsx)(Field, { ...p, type: "text" });
|
|
13
|
-
static number = (p) => (0, jsx_runtime_1.jsx)(Field, { ...p, type: "number" });
|
|
14
|
-
static password = (p) => (0, jsx_runtime_1.jsx)(Field, { ...p, type: "password" });
|
|
15
|
-
static date = (p) => (0, jsx_runtime_1.jsx)(Field, { ...p, type: "date" });
|
|
16
|
-
static time = (p) => (0, jsx_runtime_1.jsx)(Field, { ...p, type: "time" });
|
|
17
|
-
static email = (p) => (0, jsx_runtime_1.jsx)(Field, { ...p, type: "email" });
|
|
18
|
-
static multiLine = text_area_1._TextArea;
|
|
12
|
+
import { jsx as _jsx } from "preact/jsx-runtime";
|
|
13
|
+
import React from "preact/compat";
|
|
14
|
+
import { applyProps } from "../base/box";
|
|
15
|
+
import { _TextArea } from "./text_area";
|
|
16
|
+
export class Field extends React.Component {
|
|
19
17
|
render() {
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
var _a;
|
|
19
|
+
const _b = this.props, { label, hint, readonly, type, value, onInput } = _b, elbe = __rest(_b, ["label", "hint", "readonly", "type", "value", "onInput"]);
|
|
20
|
+
return (_jsx("div", { style: {
|
|
22
21
|
width: "12rem !important",
|
|
23
22
|
display: "flex",
|
|
24
23
|
flexDirection: "column",
|
|
25
24
|
alignItems: "stretch",
|
|
26
|
-
}, "data-tooltip": this.props
|
|
27
|
-
|
|
28
|
-
|
|
25
|
+
}, "data-tooltip": (_a = this.props) === null || _a === void 0 ? void 0 : _a.tooltip, children: _jsx("input", Object.assign({ type: this.props.type }, applyProps(this.props, null, {
|
|
26
|
+
width: "100%",
|
|
27
|
+
}), { size: 5, label: this.props.label, placeholder: this.props.hint, value: this.props.value, onInput: (e) => this.props.onInput && this.props.onInput(e.currentTarget.value), readonly: this.props.readonly })) }));
|
|
29
28
|
}
|
|
30
29
|
}
|
|
31
|
-
|
|
30
|
+
Field.text = (p) => _jsx(Field, Object.assign({}, p, { type: "text" }));
|
|
31
|
+
Field.number = (p) => _jsx(Field, Object.assign({}, p, { type: "number" }));
|
|
32
|
+
Field.password = (p) => _jsx(Field, Object.assign({}, p, { type: "password" }));
|
|
33
|
+
Field.date = (p) => _jsx(Field, Object.assign({}, p, { type: "date" }));
|
|
34
|
+
Field.time = (p) => _jsx(Field, Object.assign({}, p, { type: "time" }));
|
|
35
|
+
Field.email = (p) => _jsx(Field, Object.assign({}, p, { type: "email" }));
|
|
36
|
+
Field.multiLine = _TextArea;
|
|
@@ -1,14 +1,31 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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 } from "preact/jsx-runtime";
|
|
13
|
+
import { _ElbeErr } from "../../util/error_view";
|
|
14
|
+
import { applyProps } from "../base/box";
|
|
15
|
+
import { Card } from "../base/card";
|
|
16
|
+
export function Range(_a) {
|
|
17
|
+
var { value, onChange, min = 0, max = 100, step = 1 } = _a, elbe = __rest(_a, ["value", "onChange", "min", "max", "step"]);
|
|
18
|
+
return min > max ? (_ElbeErr("Range: max is smaller than min")) : (_jsx(Card, { scheme: "secondary", kind: "accent", manner: "minor", style: {
|
|
19
|
+
overflow: "unset",
|
|
20
|
+
backgroundColor: "transparent",
|
|
21
|
+
padding: "0",
|
|
22
|
+
margin: "0",
|
|
23
|
+
border: "none",
|
|
24
|
+
width: "100%",
|
|
25
|
+
}, children: _jsx("input", Object.assign({ type: "range" }, applyProps(elbe, null, {
|
|
9
26
|
filter: onChange ? "" : "grayscale(1)",
|
|
10
27
|
opacity: onChange ? "" : "0.5",
|
|
11
28
|
cursor: onChange ? "pointer" : "not-allowed",
|
|
12
29
|
width: "100%",
|
|
13
|
-
}), min: min, max: max, step: step, disabled: !onChange, value: value, onInput: (e) => onChange
|
|
30
|
+
}), { min: min, max: max, step: step, disabled: !onChange, value: value, onInput: (e) => onChange === null || onChange === void 0 ? void 0 : onChange(Number(e.currentTarget.value)) })) }));
|
|
14
31
|
}
|
|
@@ -1,8 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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 } from "preact/jsx-runtime";
|
|
13
|
+
import { applyProps } from "../base/box";
|
|
14
|
+
export function Select(_a) {
|
|
15
|
+
var { options, value, label, onChange } = _a, elbe = __rest(_a, ["options", "value", "label", "onChange"]);
|
|
16
|
+
return (_jsx("select", Object.assign({}, applyProps(elbe), { value: value, label: label, onChange: (e) => onChange(e.currentTarget.value), children: options.map(({ key, label }) => (_jsx("option", { value: key, children: label }, key))) })));
|
|
8
17
|
}
|
|
@@ -1,13 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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 } from "preact/jsx-runtime";
|
|
13
|
+
import { applyProps } from "../base/box";
|
|
14
|
+
export function _TextArea(_a) {
|
|
15
|
+
var { label, hint, readonly, rows = 4, maxLength, value, onInput } = _a, elbe = __rest(_a, ["label", "hint", "readonly", "rows", "maxLength", "value", "onInput"]);
|
|
16
|
+
return (_jsx("div", { style: {
|
|
8
17
|
width: "12rem !important",
|
|
9
18
|
display: "flex",
|
|
10
19
|
flexDirection: "column",
|
|
11
20
|
alignItems: "stretch",
|
|
12
|
-
}, "data-tooltip": elbe.tooltip, children: (
|
|
21
|
+
}, "data-tooltip": elbe.tooltip, children: _jsx("textarea", Object.assign({}, applyProps(elbe, null, { width: "100%" }), { label: label, size: 5, cols: 5, placeholder: hint, rows: rows, maxLength: maxLength, value: value, onInput: (e) => onInput && onInput(e.currentTarget.value), readonly: readonly })) }));
|
|
13
22
|
}
|
|
@@ -2,10 +2,11 @@ import { type ElbeProps } from "../base/box";
|
|
|
2
2
|
export type FlexProps = {
|
|
3
3
|
children: any;
|
|
4
4
|
gap?: number;
|
|
5
|
-
stretch?: boolean;
|
|
6
5
|
main?: "start" | "center" | "end" | "stretch" | "space-between" | "space-around" | "space-evenly";
|
|
7
6
|
cross?: "start" | "center" | "end" | "stretch" | "space-between" | "space-around" | "space-evenly";
|
|
8
7
|
} & ElbeProps;
|
|
9
8
|
export declare function FlexSpace({}: {}): import("preact").JSX.Element;
|
|
10
|
-
export declare function Column({ gap, main, cross,
|
|
11
|
-
export declare function Row({ gap, main, cross,
|
|
9
|
+
export declare function Column({ gap, main, cross, children, ...p }: FlexProps): import("preact").JSX.Element;
|
|
10
|
+
export declare function Row({ gap, main, cross, wrap, children, ...p }: FlexProps & {
|
|
11
|
+
wrap?: boolean;
|
|
12
|
+
}): import("preact").JSX.Element;
|
|
@@ -1,23 +1,31 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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 } from "preact/jsx-runtime";
|
|
13
|
+
import { applyProps } from "../base/box";
|
|
14
|
+
export function FlexSpace({}) {
|
|
15
|
+
return _jsx("div", { style: "flex:1" });
|
|
10
16
|
}
|
|
11
|
-
function Column(
|
|
12
|
-
|
|
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);
|
|
13
20
|
}
|
|
14
|
-
function Row(
|
|
15
|
-
|
|
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);
|
|
16
24
|
}
|
|
17
|
-
function _Flex(row, p, elbe) {
|
|
18
|
-
return ((
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
25
|
+
function _Flex(row, p, elbe, wraps) {
|
|
26
|
+
return (_jsx("div", Object.assign({}, applyProps(elbe, [row ? "row" : "column", wraps && "wrap"], {
|
|
27
|
+
justifyContent: p.main,
|
|
28
|
+
alignItems: p.cross,
|
|
29
|
+
gap: `${p.gap}rem`,
|
|
30
|
+
}), { children: p.children })));
|
|
23
31
|
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import { JSX } from "preact/jsx-runtime";
|
|
1
2
|
import { type ElbeColorSchemes } from "../../..";
|
|
2
3
|
type HeaderParams = {
|
|
3
4
|
title?: string;
|
|
4
|
-
back
|
|
5
|
+
back?: null | "close" | "back" | JSX.Element;
|
|
5
6
|
actions?: any;
|
|
6
|
-
|
|
7
|
+
_absolute?: boolean;
|
|
7
8
|
};
|
|
8
9
|
/**
|
|
9
10
|
* Header is a layout component that provides a header for a page.
|
|
@@ -12,16 +13,18 @@ type HeaderParams = {
|
|
|
12
13
|
* @param title - The title of the page.
|
|
13
14
|
* @param actions - The actions to show on the right side of the header.
|
|
14
15
|
*/
|
|
15
|
-
export declare function Header({ back, title, actions,
|
|
16
|
+
export declare function Header({ back, title, actions, _absolute }: HeaderParams): JSX.Element;
|
|
16
17
|
/**
|
|
17
18
|
* Scaffold is a layout component that provides a header and a content area.
|
|
18
19
|
* It is used to create a consistent layout for pages.
|
|
19
20
|
*/
|
|
20
|
-
export declare function Scaffold({ children,
|
|
21
|
-
|
|
21
|
+
export declare function Scaffold({ children, baseLimited, gap, padded, scheme, scroll, height, ...header }: {
|
|
22
|
+
baseLimited?: boolean;
|
|
22
23
|
children: any;
|
|
23
24
|
gap?: number;
|
|
24
25
|
padded?: boolean;
|
|
25
26
|
scheme?: ElbeColorSchemes;
|
|
26
|
-
|
|
27
|
+
scroll?: boolean;
|
|
28
|
+
height?: number;
|
|
29
|
+
} & HeaderParams): JSX.Element;
|
|
27
30
|
export {};
|