elbe-ui 0.2.37 → 0.2.44
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 +6 -0
- package/dist/bit/bit.d.ts +4 -1
- package/dist/bit/bit.js +24 -28
- package/dist/bit/ctrl_bit.js +47 -28
- package/dist/elbe.css +71 -30
- package/dist/elbe.css.map +1 -1
- package/dist/index.js +33 -62
- package/dist/service/s_api.js +62 -49
- package/dist/ui/components/badge.js +13 -34
- package/dist/ui/components/base/box.js +21 -23
- package/dist/ui/components/base/card.js +19 -10
- package/dist/ui/components/base/padded.js +25 -16
- 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/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.js +24 -16
- package/dist/ui/components/layout/scaffold.d.ts +4 -3
- package/dist/ui/components/layout/scaffold.js +28 -18
- 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.d.ts +2 -3
- package/dist/ui/theme/colors.js +42 -78
- package/dist/ui/theme/geometry_theme.js +8 -16
- package/dist/ui/theme/theme.js +12 -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 +1 -4
- package/dist/ui/util/util.js +8 -13
- package/package.json +3 -2
|
@@ -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
|
}
|
|
@@ -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(
|
|
17
|
+
export function Column(_a) {
|
|
18
|
+
var { gap = 1, main = "start", cross = "stretch", stretch = false, children } = _a, p = __rest(_a, ["gap", "main", "cross", "stretch", "children"]);
|
|
12
19
|
return _Flex(false, { gap, main, cross, stretch, children }, p);
|
|
13
20
|
}
|
|
14
|
-
function Row(
|
|
21
|
+
export function Row(_a) {
|
|
22
|
+
var { gap = 1, main = "start", cross, stretch = false, children } = _a, p = __rest(_a, ["gap", "main", "cross", "stretch", "children"]);
|
|
15
23
|
return _Flex(true, { gap, main, cross, stretch, children }, p);
|
|
16
24
|
}
|
|
17
25
|
function _Flex(row, p, elbe) {
|
|
18
|
-
return ((
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
26
|
+
return (_jsx("div", Object.assign({}, applyProps(elbe, row ? "row" : "column", {
|
|
27
|
+
justifyContent: p.main,
|
|
28
|
+
alignItems: p.cross || (p.stretch ? "stretch" : "center"),
|
|
29
|
+
gap: `${p.gap}rem`,
|
|
30
|
+
}), { children: p.children })));
|
|
23
31
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { JSX } from "preact/jsx-runtime";
|
|
1
2
|
import { type ElbeColorSchemes } from "../../..";
|
|
2
3
|
type HeaderParams = {
|
|
3
4
|
title?: string;
|
|
4
|
-
back: null | "close" | "back";
|
|
5
|
+
back: null | "close" | "back" | JSX.Element;
|
|
5
6
|
actions?: any;
|
|
6
7
|
limitedHeight?: number;
|
|
7
8
|
};
|
|
@@ -12,7 +13,7 @@ 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, limitedHeight }: HeaderParams):
|
|
16
|
+
export declare function Header({ back, title, actions, limitedHeight }: 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.
|
|
@@ -23,5 +24,5 @@ export declare function Scaffold({ children, limited, gap, padded, scheme, ...he
|
|
|
23
24
|
gap?: number;
|
|
24
25
|
padded?: boolean;
|
|
25
26
|
scheme?: ElbeColorSchemes;
|
|
26
|
-
} & HeaderParams):
|
|
27
|
+
} & HeaderParams): JSX.Element;
|
|
27
28
|
export {};
|
|
@@ -1,12 +1,19 @@
|
|
|
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, jsxs as _jsxs } from "preact/jsx-runtime";
|
|
13
|
+
import { useEffect, useState } from "preact/hooks";
|
|
14
|
+
import { Icons, Text } from "../../..";
|
|
15
|
+
import { IconButton } from "../button/icon_button";
|
|
16
|
+
import { Column, Row } from "./flex";
|
|
10
17
|
/**
|
|
11
18
|
* Header is a layout component that provides a header for a page.
|
|
12
19
|
* It is used to create a consistent header for pages.
|
|
@@ -14,31 +21,34 @@ const flex_1 = require("./flex");
|
|
|
14
21
|
* @param title - The title of the page.
|
|
15
22
|
* @param actions - The actions to show on the right side of the header.
|
|
16
23
|
*/
|
|
17
|
-
function Header({ back, title, actions, limitedHeight }) {
|
|
24
|
+
export function Header({ back, title, actions, limitedHeight }) {
|
|
18
25
|
if (history.length == 0)
|
|
19
26
|
back = null;
|
|
20
27
|
const goBack = () => history.go(-1);
|
|
21
|
-
const [
|
|
22
|
-
|
|
28
|
+
const [isScrolled, setIsScrolled] = useState(false);
|
|
29
|
+
useEffect(() => {
|
|
23
30
|
const _handle = () => setIsScrolled(window.scrollY > 0);
|
|
24
31
|
window.addEventListener("scroll", _handle);
|
|
25
32
|
return () => {
|
|
26
33
|
window.removeEventListener("scroll", _handle);
|
|
27
34
|
};
|
|
28
35
|
}, []);
|
|
29
|
-
return ((
|
|
30
|
-
borderColor:
|
|
36
|
+
return (_jsxs("div", { children: [_jsx("div", { style: "height: 4.5rem" }), _jsxs("div", { class: "header", style: {
|
|
37
|
+
borderColor: isScrolled
|
|
38
|
+
? "color-mix(in srgb, var(--c-context-border) 40%, transparent)"
|
|
39
|
+
: "transparent",
|
|
31
40
|
position: limitedHeight ? "absolute" : "fixed",
|
|
32
|
-
}, children: [(
|
|
41
|
+
}, children: [_jsx("div", { class: "flex-1", children: back ? (typeof back !== "string" ? (back) : (_jsx(IconButton.plain, { icon: back === "back" ? Icons.ArrowLeft : Icons.X, onTap: goBack }))) : null }), _jsx(Text.h4, { v: title }), _jsx(Row, { class: "flex-1", gap: 0.5, main: "end", children: actions })] })] }));
|
|
33
42
|
}
|
|
34
43
|
/**
|
|
35
44
|
* Scaffold is a layout component that provides a header and a content area.
|
|
36
45
|
* It is used to create a consistent layout for pages.
|
|
37
46
|
*/
|
|
38
|
-
function Scaffold(
|
|
39
|
-
|
|
47
|
+
export function Scaffold(_a) {
|
|
48
|
+
var { children, limited = false, gap = 1, padded = true, scheme } = _a, header = __rest(_a, ["children", "limited", "gap", "padded", "scheme"]);
|
|
49
|
+
return (_jsxs(Column, { cross: "stretch", gap: 0, class: `${scheme !== null && scheme !== void 0 ? scheme : "primary"}`, style: {
|
|
40
50
|
overflowY: header.limitedHeight ? "scroll" : null,
|
|
41
51
|
maxHeight: header.limitedHeight ? `${header.limitedHeight}rem` : null,
|
|
42
52
|
//height: header.limitToParent ? "100px" : null,
|
|
43
|
-
}, children: [(
|
|
53
|
+
}, children: [_jsx(Header, Object.assign({}, header)), _jsx("div", { class: `${padded ? "padded" : ""} ${limited ? "base-limited" : ""}`, children: _jsx(Column, { cross: "stretch", gap: gap !== null && gap !== void 0 ? gap : 1, children: children }) })] }));
|
|
44
54
|
}
|
|
@@ -1,20 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const preact_1 = require("preact");
|
|
6
|
-
const box_1 = require("../base/box");
|
|
7
|
-
class Scroll extends preact_1.Component {
|
|
1
|
+
import { jsx as _jsx } from "preact/jsx-runtime";
|
|
2
|
+
import { Component } from "preact";
|
|
3
|
+
import { applyProps } from "../base/box";
|
|
4
|
+
export class Scroll extends Component {
|
|
8
5
|
constructor(props) {
|
|
9
6
|
super(props);
|
|
10
7
|
}
|
|
11
|
-
static vertical = (p) => new Scroll({ ...p, axis: "vertical" }).render();
|
|
12
|
-
static horizontal = (p) => new Scroll({ ...p, axis: "horizontal" }).render();
|
|
13
8
|
render() {
|
|
14
|
-
return ((
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
9
|
+
return (_jsx("div", Object.assign({}, applyProps(this.props, null, {
|
|
10
|
+
overflowY: this.props.axis === "vertical" ? "scroll" : "hidden",
|
|
11
|
+
overflowX: this.props.axis === "horizontal" ? "scroll" : "hidden",
|
|
12
|
+
}), { children: _jsx("div", { class: this.props.innerClass, style: this.props.axis === "horizontal" ? "min-width: min-content;" : "", children: this.props.children }) })));
|
|
18
13
|
}
|
|
19
14
|
}
|
|
20
|
-
|
|
15
|
+
Scroll.vertical = (p) => new Scroll(Object.assign(Object.assign({}, p), { axis: "vertical" })).render();
|
|
16
|
+
Scroll.horizontal = (p) => new Scroll(Object.assign(Object.assign({}, p), { axis: "horizontal" })).render();
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const jsx_runtime_1 = require("preact/jsx-runtime");
|
|
5
|
-
function Spaced({ amount = 1 }) {
|
|
6
|
-
return (0, jsx_runtime_1.jsx)("div", { style: { width: amount + "rem", height: amount + "rem" } });
|
|
1
|
+
import { jsx as _jsx } from "preact/jsx-runtime";
|
|
2
|
+
export function Spaced({ amount = 1 }) {
|
|
3
|
+
return _jsx("div", { style: { width: amount + "rem", height: amount + "rem" } });
|
|
7
4
|
}
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const signals_1 = require("@preact/signals");
|
|
6
|
-
const preact_1 = require("preact");
|
|
7
|
-
const hooks_1 = require("preact/hooks");
|
|
1
|
+
import { jsx as _jsx } from "preact/jsx-runtime";
|
|
2
|
+
import { useComputed, useSignal } from "@preact/signals";
|
|
3
|
+
import { Component } from "preact";
|
|
4
|
+
import { useEffect } from "preact/hooks";
|
|
8
5
|
function _toPath(c, yFac, yOffset = 0, clamp = [0, 1], xFac = 1) {
|
|
9
6
|
return c
|
|
10
7
|
.filter((p) => p[0] >= clamp[0] && p[0] <= clamp[1])
|
|
@@ -14,19 +11,18 @@ function _toPath(c, yFac, yOffset = 0, clamp = [0, 1], xFac = 1) {
|
|
|
14
11
|
(p[1] * yFac + yOffset).toFixed(2))
|
|
15
12
|
.join(" ");
|
|
16
13
|
}
|
|
17
|
-
class Spinner extends
|
|
18
|
-
static flat = (p) => new Spinner({ manner: "flat", ...p }).render();
|
|
19
|
-
static plain = (p) => new Spinner({ manner: "plain", ...p }).render();
|
|
14
|
+
export class Spinner extends Component {
|
|
20
15
|
render() {
|
|
21
|
-
|
|
22
|
-
const
|
|
23
|
-
(0
|
|
16
|
+
var _a, _b;
|
|
17
|
+
const flat = ((_a = this.props.manner) !== null && _a !== void 0 ? _a : "flat") === "flat";
|
|
18
|
+
const xSig = useSignal(0);
|
|
19
|
+
useEffect(() => {
|
|
24
20
|
const interval = setInterval(() => {
|
|
25
21
|
xSig.value = (xSig.value + 2) % 100;
|
|
26
22
|
}, 16);
|
|
27
23
|
return () => clearInterval(interval);
|
|
28
24
|
});
|
|
29
|
-
const path =
|
|
25
|
+
const path = useComputed(() => {
|
|
30
26
|
const x = xSig.value;
|
|
31
27
|
const path = [];
|
|
32
28
|
for (let i = 0; i <= 1; i += 0.01) {
|
|
@@ -36,13 +32,14 @@ class Spinner extends preact_1.Component {
|
|
|
36
32
|
}
|
|
37
33
|
return path;
|
|
38
34
|
});
|
|
39
|
-
return ((
|
|
40
|
-
padding: `${this.props.padding
|
|
41
|
-
}, children: (
|
|
35
|
+
return (_jsx("div", { class: `${flat ? "accent flat" : "plain"}`, style: {
|
|
36
|
+
padding: `${(_b = this.props.padding) !== null && _b !== void 0 ? _b : 1}rem`,
|
|
37
|
+
}, children: _jsx("svg", { style: "width: 40px; height: 40px", viewBox: `-10 -10 120 120`, children: [
|
|
42
38
|
_toPath(path.value, 13, 20, [0.4, 0.8], 1),
|
|
43
39
|
_toPath(path.value, 10, 50),
|
|
44
40
|
_toPath(path.value, 11, 80, [0.2, 0.6], 1),
|
|
45
|
-
].map((p) => ((
|
|
41
|
+
].map((p) => (_jsx("path", { d: p, fill: "none", stroke: "currentcolor", "stroke-width": "10", "stroke-linecap": "round" }))) }) }));
|
|
46
42
|
}
|
|
47
43
|
}
|
|
48
|
-
|
|
44
|
+
Spinner.flat = (p) => new Spinner(Object.assign({ manner: "flat" }, p)).render();
|
|
45
|
+
Spinner.plain = (p) => new Spinner(Object.assign({ manner: "plain" }, p)).render();
|
|
@@ -1,42 +1,47 @@
|
|
|
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
|
-
|
|
11
|
-
|
|
12
|
-
static h2 = (p) => (0, jsx_runtime_1.jsx)(Text, { ...p, variant: "h2" });
|
|
13
|
-
static h3 = (p) => (0, jsx_runtime_1.jsx)(Text, { ...p, variant: "h3" });
|
|
14
|
-
static h4 = (p) => (0, jsx_runtime_1.jsx)(Text, { ...p, variant: "h4" });
|
|
15
|
-
static h5 = (p) => (0, jsx_runtime_1.jsx)(Text, { ...p, variant: "h5" });
|
|
16
|
-
static h6 = (p) => (0, jsx_runtime_1.jsx)(Text, { ...p, variant: "h6" });
|
|
17
|
-
static s = (p) => (0, jsx_runtime_1.jsx)(Text, { ...p, variant: "body-s" });
|
|
18
|
-
static m = (p) => (0, jsx_runtime_1.jsx)(Text, { ...p, variant: "body-m" });
|
|
19
|
-
static l = (p) => (0, jsx_runtime_1.jsx)(Text, { ...p, variant: "body-l" });
|
|
20
|
-
static code = (p) => (0, jsx_runtime_1.jsx)(Text, { ...p, variant: "code" });
|
|
21
|
-
constructor({ variant = "body-m", ...props }) {
|
|
22
|
-
super({ ...props, variant });
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "preact/jsx-runtime";
|
|
13
|
+
import React from "preact/compat";
|
|
14
|
+
import { applyProps } from "./base/box";
|
|
15
|
+
export class Text extends React.Component {
|
|
16
|
+
constructor(_a) {
|
|
17
|
+
var { variant = "body-m" } = _a, props = __rest(_a, ["variant"]);
|
|
18
|
+
super(Object.assign(Object.assign({}, props), { variant }));
|
|
23
19
|
}
|
|
24
20
|
render() {
|
|
25
|
-
const { align, bold, italic, underline, striked, color, size, children, variant, v,
|
|
26
|
-
return ((
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
21
|
+
const _a = this.props, { align, bold, italic, underline, striked, color, size, children, variant, v } = _a, elbe = __rest(_a, ["align", "bold", "italic", "underline", "striked", "color", "size", "children", "variant", "v"]);
|
|
22
|
+
return (_jsxs("span", Object.assign({}, applyProps(elbe, [
|
|
23
|
+
"text",
|
|
24
|
+
align,
|
|
25
|
+
bold && "b",
|
|
26
|
+
italic && "i",
|
|
27
|
+
underline && "underline",
|
|
28
|
+
striked && "striked",
|
|
29
|
+
color,
|
|
30
|
+
variant,
|
|
31
|
+
], {
|
|
32
|
+
fontSize: size ? `${size}rem` : "",
|
|
33
|
+
color: color || "",
|
|
34
|
+
scrollMarginTop: "2rem",
|
|
35
|
+
}), { children: [v, children] })));
|
|
40
36
|
}
|
|
41
37
|
}
|
|
42
|
-
|
|
38
|
+
Text.h1 = (p) => _jsx(Text, Object.assign({}, p, { variant: "h1" }));
|
|
39
|
+
Text.h2 = (p) => _jsx(Text, Object.assign({}, p, { variant: "h2" }));
|
|
40
|
+
Text.h3 = (p) => _jsx(Text, Object.assign({}, p, { variant: "h3" }));
|
|
41
|
+
Text.h4 = (p) => _jsx(Text, Object.assign({}, p, { variant: "h4" }));
|
|
42
|
+
Text.h5 = (p) => _jsx(Text, Object.assign({}, p, { variant: "h5" }));
|
|
43
|
+
Text.h6 = (p) => _jsx(Text, Object.assign({}, p, { variant: "h6" }));
|
|
44
|
+
Text.s = (p) => _jsx(Text, Object.assign({}, p, { variant: "body-s" }));
|
|
45
|
+
Text.m = (p) => _jsx(Text, Object.assign({}, p, { variant: "body-m" }));
|
|
46
|
+
Text.l = (p) => _jsx(Text, Object.assign({}, p, { variant: "body-l" }));
|
|
47
|
+
Text.code = (p) => _jsx(Text, Object.assign({}, p, { variant: "code" }));
|