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.
Files changed (96) hide show
  1. package/README.md +1 -1
  2. package/dist/bit/_bit_provider.d.ts +1 -1
  3. package/dist/bit/_bit_provider.js +11 -6
  4. package/dist/bit/_bit_utils.d.ts +5 -1
  5. package/dist/bit/bit.d.ts +2 -2
  6. package/dist/bit/bit.js +2 -2
  7. package/dist/elbe.css +97 -61
  8. package/dist/elbe.css.map +1 -1
  9. package/dist/index.d.ts +1529 -1527
  10. package/dist/index.js +3 -2
  11. package/dist/ui/components/badge.d.ts +7 -7
  12. package/dist/ui/components/badge.js +3 -3
  13. package/dist/ui/components/banner.d.ts +2 -2
  14. package/dist/ui/components/banner.js +8 -8
  15. package/dist/ui/components/base/box.d.ts +4140 -2520
  16. package/dist/ui/components/base/box.js +4 -4
  17. package/dist/ui/components/base/card.d.ts +1 -1
  18. package/dist/ui/components/base/card.js +1 -1
  19. package/dist/ui/components/base/padded.d.ts +4 -4
  20. package/dist/ui/components/base/padded.js +2 -2
  21. package/dist/ui/components/button/button.d.ts +10 -9
  22. package/dist/ui/components/button/button.js +15 -13
  23. package/dist/ui/components/button/choose_button.d.ts +2 -2
  24. package/dist/ui/components/button/choose_button.js +5 -4
  25. package/dist/ui/components/button/icon_button.d.ts +9 -8
  26. package/dist/ui/components/button/icon_button.js +16 -4
  27. package/dist/ui/components/button/toggle_button.d.ts +2 -2
  28. package/dist/ui/components/button/toggle_button.js +8 -4
  29. package/dist/ui/components/dev/todo.d.ts +4 -4
  30. package/dist/ui/components/dev/todo.js +2 -2
  31. package/dist/ui/components/dialog.d.ts +4 -3
  32. package/dist/ui/components/dialog.js +21 -4
  33. package/dist/ui/components/error_view.d.ts +2 -2
  34. package/dist/ui/components/error_view.js +12 -8
  35. package/dist/ui/components/footer.d.ts +3 -3
  36. package/dist/ui/components/footer.js +3 -3
  37. package/dist/ui/components/input/checkbox.d.ts +1 -1
  38. package/dist/ui/components/input/checkbox.js +5 -5
  39. package/dist/ui/components/input/range.d.ts +1 -1
  40. package/dist/ui/components/input/range.js +1 -1
  41. package/dist/ui/components/input/select.d.ts +1 -1
  42. package/dist/ui/components/input/select.js +2 -2
  43. package/dist/ui/components/input/switch.d.ts +1 -1
  44. package/dist/ui/components/input/switch.js +1 -1
  45. package/dist/ui/components/input/text/input_field.d.ts +9 -9
  46. package/dist/ui/components/input/text/input_field.js +7 -7
  47. package/dist/ui/components/input/text/multi_line.d.ts +1 -1
  48. package/dist/ui/components/input/text/multi_line.js +3 -3
  49. package/dist/ui/components/input/text/single_line.d.ts +1 -1
  50. package/dist/ui/components/input/text/single_line.js +4 -4
  51. package/dist/ui/components/layout/alignment.d.ts +3 -2
  52. package/dist/ui/components/layout/alignment.js +2 -2
  53. package/dist/ui/components/layout/app_base.d.ts +1 -1
  54. package/dist/ui/components/layout/app_base.js +33 -9
  55. package/dist/ui/components/layout/ctx_app_base.d.ts +8 -3
  56. package/dist/ui/components/layout/ctx_app_base.js +1 -2
  57. package/dist/ui/components/layout/flex.d.ts +3 -3
  58. package/dist/ui/components/layout/flex.js +5 -5
  59. package/dist/ui/components/layout/header.d.ts +5 -8
  60. package/dist/ui/components/layout/header.js +11 -13
  61. package/dist/ui/components/layout/menu.d.ts +1 -1
  62. package/dist/ui/components/layout/menu.js +6 -6
  63. package/dist/ui/components/layout/page.d.ts +3 -1
  64. package/dist/ui/components/layout/page.js +3 -1
  65. package/dist/ui/components/layout/scroll.d.ts +4 -4
  66. package/dist/ui/components/layout/scroll.js +3 -3
  67. package/dist/ui/components/layout/spaced.d.ts +1 -1
  68. package/dist/ui/components/layout/spaced.js +1 -1
  69. package/dist/ui/components/layout/toolbar.d.ts +2 -2
  70. package/dist/ui/components/layout/toolbar.js +4 -6
  71. package/dist/ui/components/link.d.ts +1 -1
  72. package/dist/ui/components/link.js +2 -2
  73. package/dist/ui/components/progress_bar.d.ts +1 -1
  74. package/dist/ui/components/progress_bar.js +1 -1
  75. package/dist/ui/components/routing/route.d.ts +8 -8
  76. package/dist/ui/components/routing/route.js +4 -4
  77. package/dist/ui/components/spinner.d.ts +4 -4
  78. package/dist/ui/components/spinner.js +33 -33
  79. package/dist/ui/components/text.d.ts +15 -15
  80. package/dist/ui/components/text.js +6 -6
  81. package/dist/ui/theme/colors.js +0 -1
  82. package/dist/ui/theme/theme.d.ts +1 -1
  83. package/dist/ui/theme/theme.js +3 -3
  84. package/dist/ui/theme/theme_context.d.ts +2 -2
  85. package/dist/ui/theme/theme_context.js +1 -2
  86. package/dist/ui/util/ctx_toolbar.d.ts +1 -2
  87. package/dist/ui/util/ctx_toolbar.js +2 -2
  88. package/dist/ui/util/error_view.d.ts +1 -1
  89. package/dist/ui/util/error_view.js +8 -2
  90. package/dist/ui/util/l10n/_l10n_util.d.ts +1 -1
  91. package/dist/ui/util/l10n/_l10n_util.js +1 -1
  92. package/dist/ui/util/l10n/l10n.d.ts +1 -1
  93. package/dist/ui/util/l10n/l10n.js +2 -2
  94. package/dist/ui/util/types.d.ts +3 -2
  95. package/dist/ui/util/util.js +1 -2
  96. 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, h } from "preact";
12
+ import { Component, createElement } from "react";
13
13
  export function applyProps(typeLabel, p, classes, style) {
14
- var _a, _b, _c, _d;
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, class: `${classes || ""} ${p.class || ""}`, 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, ariaLabel: (_c = p.ariaLabel) !== null && _c !== void 0 ? _c : null, ["data-type"]: (_d = p.typeLabel) !== null && _d !== void 0 ? _d : (!!typeLabel ? `elbe_${typeLabel}` : undefined) });
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 h("div", applyProps("box", elbe, [scheme, mode], Object.assign({ padding: `${padding}rem`, margin: `${margin}rem` }, elbe.style)), children);
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("preact").JSX.Element;
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 "preact/jsx-runtime";
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 "preact/compat";
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
- }) => React.JSX.Element;
20
+ }) => import("react/jsx-runtime").JSX.Element;
21
21
  static symmetric: ({ vertical, horizontal, ...p }: PaddedProps & {
22
22
  vertical: number;
23
23
  horizontal: number;
24
- }) => React.JSX.Element;
25
- render(): React.JSX.Element;
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 "preact/jsx-runtime";
13
- import React from "preact/compat";
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 "preact";
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 { IconChild } from "./icon_button";
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: Event) => void;
10
+ onTap?: (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
10
11
  } & {
11
12
  icon?: IconChild;
12
13
  label?: string;
13
- children?: any;
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("preact").JSX.Element;
19
- static minor: (p: ButtonProps) => import("preact").JSX.Element;
20
- static flat: (p: ButtonProps) => import("preact").JSX.Element;
21
- static plain: (p: ButtonProps) => import("preact").JSX.Element;
22
- render(): import("preact").JSX.Element;
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 "preact/jsx-runtime";
13
- import { Component } from "preact";
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 _btn(this.props, this.props.manner);
19
+ return _jsx(_Btn, Object.assign({}, this.props, { manner: this.props.manner }));
20
20
  }
21
21
  }
22
- Button.major = (p) => _btn(p, "major");
23
- Button.minor = (p) => _btn(p, "minor");
24
- Button.flat = (p) => _btn(p, "flat");
25
- Button.plain = (p) => _btn(p, "plain");
26
- function _btn(_a, manner) {
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" : null,
40
- }), { title: (_b = elbe.ariaLabel) !== null && _b !== void 0 ? _b : label, disabled: !onTap, onClick: (e) => onTap && onTap(e), children: [typeof icon === "function" ? icon({}) : icon, !(toolbarCtx === null || toolbarCtx === void 0 ? void 0 : toolbarCtx.isInToolbar) && label && (_jsx("div", { style: {
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] }))) : (_ElbeErr("Button requires either an icon and or a label, or a child"));
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 { IconChild } from "./icon_button";
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("preact").JSX.Element;
15
+ }): import("react/jsx-runtime").JSX.Element;
@@ -1,12 +1,13 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "preact/jsx-runtime";
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, class: `${column ? "column" : "row"} gap-none`, children: items.map((e) => {
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)), class: `sharp ${column ? "main-between gap-double" : ""}`, children: [_jsxs("div", { class: "row gap-half", children: [typeof e.icon === "function" ? e.icon({}) : e.icon, e.label && _jsx("span", { children: e.label })] }), column &&
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 "preact";
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: Event) => void;
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("preact").JSX.Element;
14
- static minor: (p: IconButtonProps) => import("preact").JSX.Element;
15
- static flat: (p: IconButtonProps) => import("preact").JSX.Element;
16
- static plain: (p: IconButtonProps) => import("preact").JSX.Element;
17
- render(): import("preact").JSX.Element;
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("preact").JSX.Element | null;
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 "preact/jsx-runtime";
13
- import { Component } from "preact";
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" : null,
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: typeof p.icon === "function" ? p.icon({}) : p.icon })));
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 { IconChild } from "./icon_button";
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("preact").JSX.Element;
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 "preact/jsx-runtime";
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", { class: "row gap-none", children: [typeof icon === "function" ? icon({}) : icon, icon && _jsx(Spaced, { width: 0.5 }), label && _jsx("span", { children: label })] }), _jsx("div", { style: {
23
- transition: tConfig.reducedMotion ? null : "width 0.2s ease-in-out",
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, { class: "centered", left: 1, children: _jsx(CheckIcon, {}) })) })] })));
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("preact").JSX.Element | null;
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("preact").JSX.Element;
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("preact").JSX.Element;
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("preact").JSX.Element;
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 "preact/jsx-runtime";
12
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
13
  import { XIcon } from "lucide-react";
14
- import { useEffect, useState } from "preact/hooks";
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?: string;
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
- }): import("preact").JSX.Element;
8
+ barrierDismissible?: boolean;
9
+ }): import("react/jsx-runtime").JSX.Element;
@@ -1,11 +1,28 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "preact/jsx-runtime";
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
- 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, { ariaLabel: "Close", icon: X, onTap: (e) => {
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", { class: "padded", style: "max-height: 80vh; overflow: auto", children: children })] }) }));
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("preact").JSX.Element;
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("preact").JSX.Element;
15
+ }): import("react/jsx-runtime").JSX.Element;
@@ -1,12 +1,16 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "preact/jsx-runtime";
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 { useLocation } from "wouter";
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
- return !debug ? (_jsx(PrettyErrorView, { error: 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, null, 2) })] }));
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 openSig = useSignal(false);
40
- const [loc, navigate] = useLocation();
41
- return (_jsxs("div", { class: "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", { class: "pointer", onClick: () => (openSig.value = true), children: (_c = l10n === null || l10n === void 0 ? void 0 : l10n.inline(error.description)) !== null && _c !== void 0 ? _c : "" }), retry && (_jsxs("button", { class: "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", { class: "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: openSig.value, onClose: () => (openSig.value = false), children: _jsx("pre", { class: "card inverse", children: `code: ${error.code}\n\n` + JSON.stringify(error.details, null, 2) }) })] }));
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 "preact/compat";
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
- }): React.JSX.Element;
15
+ }): import("react/jsx-runtime").JSX.Element;
16
16
  export declare function _WrittenIn({ city, href, }: {
17
17
  city?: string;
18
18
  href?: string;
19
- }): React.JSX.Element;
19
+ }): import("react/jsx-runtime").JSX.Element;
@@ -1,4 +1,4 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "preact/jsx-runtime";
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)" : null,
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("preact").JSX.Element;
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 "preact/jsx-runtime";
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", { class: `row ${p.onChange ? "" : "disabled"}`, style: {
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 ? null : "transparent",
12
- transition: tConfig.reducedMotion ? "none" : null,
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: "margin-top: -.25rem", children: p.label })] }));
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("preact").JSX.Element;
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 "preact/jsx-runtime";
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";
@@ -7,4 +7,4 @@ export declare function Select({ options, value, label, onChange, ...elbe }: {
7
7
  value?: string;
8
8
  label?: string;
9
9
  onChange: (value: string) => any;
10
- } & ActionElbeProps): import("preact").JSX.Element;
10
+ } & ActionElbeProps): import("react/jsx-runtime").JSX.Element;
@@ -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 "preact/jsx-runtime";
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, label: label, role: "combobox", onChange: (e) => onChange(e.currentTarget.value), children: options.map(({ key, label }) => (_jsx("option", { value: key, children: label }, key))) })));
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 { JSX } from "preact/jsx-runtime";
1
+ import { JSX } from "react/jsx-runtime";
2
2
  import { ActionElbeProps } from "../../..";
3
3
  export type BooleanInputProps = {
4
4
  value: boolean;
@@ -1,4 +1,4 @@
1
- import { jsx as _jsx } from "preact/jsx-runtime";
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { CheckIcon, XIcon } from "lucide-react";
3
3
  import { applyProps } from "../../..";
4
4
  import { useThemeConfig } from "../../theme/theme_context";
@@ -1,4 +1,4 @@
1
- import React from "preact/compat";
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) => React.JSX.Element;
21
- static number: (p: SLInputFieldProps) => React.JSX.Element;
22
- static password: (p: SLInputFieldProps) => React.JSX.Element;
23
- static date: (p: SLInputFieldProps) => React.JSX.Element;
24
- static time: (p: SLInputFieldProps) => React.JSX.Element;
25
- static email: (p: SLInputFieldProps) => React.JSX.Element;
26
- static multiLine: (p: InputFieldProps) => React.JSX.Element;
27
- render(): React.JSX.Element;
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
  }