@grucloud/bau-ui 0.65.0 → 0.67.0

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/avatar/avatar.js CHANGED
@@ -78,6 +78,7 @@ export default function (context, options = {}) {
78
78
  () => loadingState.val && Skeleton(),
79
79
  () => errorState.val && alt,
80
80
  img({
81
+ alt,
81
82
  width,
82
83
  height,
83
84
  onload,
@@ -118,7 +118,7 @@ export default function globalStyle(
118
118
  ${variantToCss()}
119
119
  --color-content: hsl(0, 0%, 10%);
120
120
  --color-content-inverse: hsl(0, 0%, 95%);
121
- --color-content-secondary: hsl(0, 0%, 60%);
121
+ --color-content-secondary: hsl(0, 0%, 40%);
122
122
  --background-color: var(--color-white);
123
123
  --global-border-width: 1px;
124
124
  --global-radius: 0.2rem;
@@ -8,6 +8,7 @@ export default function (context, options = {}) {
8
8
  const className = css`
9
9
  list-style: none;
10
10
  & li {
11
+ margin: 0.5rem 0;
11
12
  display: flex;
12
13
  flex-direction: column;
13
14
  font-size: smaller;
@@ -0,0 +1,22 @@
1
+ declare module "@grucloud/bau-ui/lazy" {
2
+ type DefaultDesignProps = import("../constants").DefaultDesignProps;
3
+ type ComponentOption = import("../bau-ui").ComponentOption;
4
+ type Component = import("../bau-ui").Component<any>;
5
+
6
+ export type LazyOptions = {
7
+ loading?: Component;
8
+ error?: Component;
9
+ };
10
+
11
+ export type LazyProps = {
12
+ getModule: () => any;
13
+ props?: any;
14
+ } & DefaultDesignProps;
15
+
16
+ type LazyComponent = import("../bau-ui").Component<LazyProps>;
17
+
18
+ export default function (
19
+ context: any,
20
+ option?: ComponentOption & LazyOptions
21
+ ): LazyComponent;
22
+ }
package/lazy/index.js ADDED
@@ -0,0 +1 @@
1
+ export { default } from "./lazy";
package/lazy/lazy.js ADDED
@@ -0,0 +1,57 @@
1
+ import spinner from "../spinner";
2
+ import alert from "../alert";
3
+
4
+ export default function (context, options = {}) {
5
+ const { bau, css } = context;
6
+ const { div } = bau.tags;
7
+
8
+ const Spinner = spinner(context, { size: "lg" });
9
+ const Alert = alert(context, { color: "danger" });
10
+
11
+ const loadingDefault = () =>
12
+ div(
13
+ {
14
+ class: css`
15
+ height: 100%;
16
+ display: flex;
17
+ justify-content: center;
18
+ align-items: center;
19
+ `,
20
+ },
21
+ Spinner({ visibility: true })
22
+ );
23
+
24
+ const errorDefault = (error) => Alert(error.message);
25
+
26
+ return function Lazy({
27
+ getModule,
28
+ loading = loadingDefault,
29
+ error = errorDefault,
30
+ props = {},
31
+ }) {
32
+ const componentState = bau.state(undefined);
33
+ const loadingState = bau.state(true);
34
+ const errorState = bau.state(false);
35
+
36
+ getModule()
37
+ .then((module) => {
38
+ componentState.val = module.default(context);
39
+ loadingState.val = false;
40
+ })
41
+ .catch((error) => {
42
+ errorState.val = error.message;
43
+ });
44
+
45
+ return div(() => {
46
+ if (errorState.val) {
47
+ return error({ message: errorState.val });
48
+ }
49
+ if (componentState.val) {
50
+ return componentState.val(props);
51
+ }
52
+ if (loadingState.val) {
53
+ return loading();
54
+ }
55
+ });
56
+ };
57
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@grucloud/bau-ui",
3
3
  "description": "Components library built with Bau",
4
- "version": "0.65.0",
4
+ "version": "0.67.0",
5
5
  "type": "module",
6
6
  "license": "BSD",
7
7
  "keywords": [
@@ -20,11 +20,11 @@
20
20
  "directory": "bau-ui"
21
21
  },
22
22
  "dependencies": {
23
- "@grucloud/bau": "^0.65.0",
24
- "@grucloud/bau-css": "^0.65.0"
23
+ "@grucloud/bau": "^0.67.0",
24
+ "@grucloud/bau-css": "^0.67.0"
25
25
  },
26
26
  "devDependencies": {
27
27
  "typedoc": "0.24.8"
28
28
  },
29
- "gitHead": "e8ab060afb9b3342cbf9edecd4f461d5ab1047b6"
29
+ "gitHead": "211dba67346ad04c11165a85291ec42fd856d0a2"
30
30
  }