elbe-ui 0.2.5 → 0.2.14

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 (50) hide show
  1. package/dist/index.js +17 -2
  2. package/dist/ui/color_theme.d.ts +5 -0
  3. package/dist/ui/components/badge.d.ts +25 -0
  4. package/dist/ui/components/box.d.ts +1027 -0
  5. package/dist/ui/components/button.d.ts +23 -0
  6. package/dist/ui/components/card.d.ts +14 -0
  7. package/dist/ui/components/dialog.d.ts +8 -0
  8. package/dist/ui/components/flex.d.ts +11 -0
  9. package/dist/ui/components/icon_button.d.ts +19 -0
  10. package/dist/ui/components/input/checkbox.d.ts +6 -0
  11. package/dist/ui/components/input/input_field.d.ts +22 -0
  12. package/dist/ui/components/input/range.d.ts +8 -0
  13. package/dist/ui/components/input/select.d.ts +10 -0
  14. package/dist/ui/components/input/text_area.d.ts +10 -0
  15. package/dist/ui/components/padded.d.ts +25 -0
  16. package/dist/ui/components/text.d.ts +33 -0
  17. package/dist/ui/components/toggle_button.d.ts +12 -0
  18. package/dist/ui/components/util.d.ts +3 -0
  19. package/dist/ui/util/confirm_dialog.d.ts +10 -0
  20. package/dist/ui/util/error_view.d.ts +1 -0
  21. package/dist/ui/util/toast.d.ts +5 -0
  22. package/dist/ui/util/util.d.ts +19 -0
  23. package/elbe.scss +2 -2
  24. package/package.json +5 -2
  25. package/src/index.tsx +24 -0
  26. package/src/ui/color_theme.ts +24 -0
  27. package/src/ui/components/badge.tsx +78 -0
  28. package/src/ui/components/box.tsx +49 -0
  29. package/src/ui/components/button.tsx +61 -0
  30. package/src/ui/components/card.tsx +45 -0
  31. package/src/ui/components/dialog.tsx +51 -0
  32. package/src/ui/components/flex.tsx +64 -0
  33. package/src/ui/components/icon_button.tsx +56 -0
  34. package/src/ui/components/input/checkbox.tsx +32 -0
  35. package/src/ui/components/input/input_field.tsx +57 -0
  36. package/src/ui/components/input/range.tsx +37 -0
  37. package/src/ui/components/input/select.tsx +29 -0
  38. package/src/ui/components/input/text_area.tsx +45 -0
  39. package/src/ui/components/padded.tsx +62 -0
  40. package/src/ui/components/text.tsx +78 -0
  41. package/src/ui/components/toggle_button.tsx +52 -0
  42. package/src/ui/components/util.tsx +3 -0
  43. package/src/ui/util/confirm_dialog.ts +53 -0
  44. package/src/ui/util/error_view.tsx +16 -0
  45. package/src/ui/util/toast.ts +14 -0
  46. package/src/ui/util/util.ts +36 -0
  47. package/style/color_style.scss +148 -0
  48. package/style/components.scss +450 -0
  49. package/style/root.scss +50 -0
  50. package/style/type_style.scss +22 -0
package/dist/index.js CHANGED
@@ -15900,7 +15900,6 @@ var index = Object.freeze({
15900
15900
  ZoomIn,
15901
15901
  ZoomOut
15902
15902
  });
15903
- var $CircleXIcon = CircleX;
15904
15903
  var $X = X;
15905
15904
  var $icons = index;
15906
15905
  // node_modules/preact/dist/preact.mjs
@@ -16873,7 +16872,7 @@ function _ElbeErr(msg) {
16873
16872
  class: "row text-s gap-half",
16874
16873
  style: "background: #ee0044; color: white; border-radius: 4px; text-align: left; padding: .5rem",
16875
16874
  children: [
16876
- u3($CircleXIcon, {}, undefined, false, undefined, this),
16875
+ u3(Icons.CircleX, {}, undefined, false, undefined, this),
16877
16876
  u3("div", {
16878
16877
  class: "column gap-none cross-stretch",
16879
16878
  children: [
@@ -17429,12 +17428,28 @@ function showToast(message) {
17429
17428
  toast.remove();
17430
17429
  }, 3000);
17431
17430
  }
17431
+ // src/ui/util/util.ts
17432
+ function share(data, toastMsg = "copied to clipboard. Share it with others.") {
17433
+ const msg = `${data.title}\n${data.text ?? ""}\n\n${data.url}`;
17434
+ if (navigator.share) {
17435
+ navigator.share(data).catch(() => copyToClipboard(msg, toastMsg));
17436
+ } else {
17437
+ copyToClipboard(msg, toastMsg);
17438
+ }
17439
+ }
17440
+ function copyToClipboard(text, toastMsg = "copied to clipboard") {
17441
+ navigator.clipboard.writeText(text);
17442
+ if (toastMsg)
17443
+ showToast(toastMsg);
17444
+ }
17432
17445
 
17433
17446
  // src/index.tsx
17434
17447
  var Icons = $icons;
17435
17448
  export {
17436
17449
  showToast,
17437
17450
  showConfirmDialog,
17451
+ share,
17452
+ copyToClipboard,
17438
17453
  applyProps,
17439
17454
  ToggleButton,
17440
17455
  Text2 as Text,
@@ -0,0 +1,5 @@
1
+ export type ElbeColorStyles = "accent" | "error" | "warning" | "success" | "info";
2
+ export type ElbeColorManners = "major" | "minor" | "action" | "integrated";
3
+ export type ElbeColorThemes = "primary" | "secondary" | "inverse";
4
+ export type ElbeColorModes = "light" | "dark";
5
+ export type ElbeTypeStyles = "header-1" | "header-2" | "header-3" | "header-4" | "header-5" | "header-6" | "text-s" | "text-m" | "text-l" | "code";
@@ -0,0 +1,25 @@
1
+ import React from "preact/compat";
2
+ import type { ElbeColorStyles } from "../color_theme";
3
+ import type { ElbeChild, ElbeChildren } from "../util/util";
4
+ import type { ElbeProps } from "./box";
5
+ export type BadgeProps = {
6
+ count?: number;
7
+ message?: string;
8
+ child?: ElbeChild;
9
+ hidden?: boolean;
10
+ children?: ElbeChildren;
11
+ } & ElbeProps;
12
+ export declare function TestBadge(p: BadgeProps): Badge;
13
+ export declare class Badge extends React.Component<BadgeProps & {
14
+ colorStyle: ElbeColorStyles;
15
+ }> {
16
+ constructor(props: BadgeProps & {
17
+ colorStyle: ElbeColorStyles;
18
+ });
19
+ static accent(p: BadgeProps): React.JSX.Element;
20
+ static error(p: BadgeProps): React.JSX.Element;
21
+ static warning(p: BadgeProps): React.JSX.Element;
22
+ static success(p: BadgeProps): React.JSX.Element;
23
+ static info(p: BadgeProps): React.JSX.Element;
24
+ render(): React.JSX.Element;
25
+ }