@grucloud/bau-ui 0.68.0 → 0.70.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.
@@ -22,14 +22,19 @@ export default function (context, options = {}) {
22
22
  &:hover.solid {
23
23
  filter: brightness(var(--brightness-hover-always));
24
24
  }
25
+ &:indeterminate::after {
26
+ content: "\u2796";
27
+ opacity: 1;
28
+ }
25
29
  &:disabled {
26
30
  border: 2px dashed var(--color-gray-500);
27
31
  }
28
32
  &:checked::after {
33
+ content: "\u2716";
29
34
  opacity: 1;
30
35
  }
31
36
  &::after {
32
- content: "\u2716";
37
+ content: "";
33
38
  position: absolute;
34
39
  top: 50%;
35
40
  left: 50%;
@@ -69,13 +69,12 @@ export default function (context, options = {}) {
69
69
  color = options.color ?? "neutral",
70
70
  Header,
71
71
  Content,
72
- close = true,
72
+ expanded = false,
73
73
  ...props
74
74
  },
75
75
  ] = toPropsAndChildren(args);
76
76
 
77
- const closeState = bau.state(close);
78
-
77
+ const closeState = bau.state(!expanded);
79
78
  return div(
80
79
  {
81
80
  ...props,
@@ -2,7 +2,7 @@ declare module "@grucloud/bau-ui/collapsible" {
2
2
  type DefaultDesignProps = import("../constants").DefaultDesignProps;
3
3
  type ComponentOption = import("../bau-ui").ComponentOption;
4
4
 
5
- export type CollapsibleProps = {} & DefaultDesignProps;
5
+ export type CollapsibleProps = { expanded?: boolean } & DefaultDesignProps;
6
6
 
7
7
  type Component = import("../bau-ui").Component<CollapsibleProps>;
8
8
 
package/form/form.js CHANGED
@@ -22,7 +22,10 @@ export default function (context, options = {}) {
22
22
  flex-direction: column;
23
23
  gap: 0.5rem;
24
24
  }
25
- & label,
25
+ &
26
+ label:has(
27
+ :is(input[type="text"], input[type="password"], input[type="email"])
28
+ ),
26
29
  legend {
27
30
  display: inline-flex;
28
31
  flex-direction: column;
@@ -1,5 +1,5 @@
1
1
  const ColorPaletteDefault = [
2
- ["neutral", { h: "0", s: "0%", l: "50%" }],
2
+ ["neutral", { h: "0", s: "0%", l: "10%" }],
3
3
  ["primary", { h: "230", s: "70%", l: "30%" }],
4
4
  ["secondary", { h: "338", s: "70%", l: "50%" }],
5
5
  ["success", { h: "120", s: "70%", l: "25%" }],
@@ -27,7 +27,7 @@ const variantToCss = () =>
27
27
  ([color]) =>
28
28
  `
29
29
  .outline.${color} {
30
- border: 1px solid ${darkVar(color)};
30
+ border: 1px solid var(--color-emphasis-600);
31
31
  color: var(--font-color-base)
32
32
  }
33
33
  .soft.${color} {
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.68.0",
4
+ "version": "0.70.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.68.0",
24
- "@grucloud/bau-css": "^0.68.0"
23
+ "@grucloud/bau": "^0.70.0",
24
+ "@grucloud/bau-css": "^0.70.0"
25
25
  },
26
26
  "devDependencies": {
27
27
  "typedoc": "0.24.8"
28
28
  },
29
- "gitHead": "676336432d3057c0dac8821c9a07de33871b7f46"
29
+ "gitHead": "d6e99e63ba58ed1de134100dd8106fef0eb6d286"
30
30
  }
package/tabs/tabs.js CHANGED
@@ -102,10 +102,12 @@ export default function (context, options = {}) {
102
102
  const search = new URLSearchParams(window.location.search);
103
103
  const tabName = search.get(tabsKey) ?? tabDefs[0].name;
104
104
 
105
- const nextTab = tabByName(tabName);
106
- tabCurrentState.val.exit?.call();
107
- tabCurrentState.val = nextTab;
108
- nextTab?.enter?.call();
105
+ if (tabName != tabCurrentState.val.name) {
106
+ const nextTab = tabByName(tabName);
107
+ tabCurrentState.val.exit?.call();
108
+ tabCurrentState.val = nextTab;
109
+ nextTab?.enter?.call();
110
+ }
109
111
  };
110
112
 
111
113
  hashchange();
@@ -10,6 +10,7 @@ declare module "@grucloud/bau-ui/treeView" {
10
10
 
11
11
  export type TreeViewProps = {
12
12
  tree: Tree;
13
+ maxDepth?: integer;
13
14
  };
14
15
 
15
16
  type Component = import("../bau-ui").Component<TreeViewProps>;
@@ -2,10 +2,25 @@ import { toPropsAndChildren } from "@grucloud/bau/bau.js";
2
2
  import classNames from "@grucloud/bau-css/classNames.js";
3
3
  import collapsible from "../collapsible";
4
4
 
5
+ const treeAddParent =
6
+ ({ parent, grandParent }) =>
7
+ (tree) => {
8
+ const { children = [], ...othersTreeProps } = tree;
9
+ const result = { ...othersTreeProps };
10
+ result.children = children?.map(
11
+ treeAddParent({ parent: tree, grandParent: parent })
12
+ );
13
+ if (parent) {
14
+ parent.parent = grandParent;
15
+ }
16
+ result.parent = parent;
17
+ return result;
18
+ };
19
+
5
20
  const createStyles = ({ css, createGlobalStyles }) => {
6
21
  createGlobalStyles`
7
22
  :root {
8
- --treeview-link-padding-horizontal: 0.75rem;
23
+ --treeview-link-padding-horizontal: 2rem;
9
24
  --treeview-link-padding-vertical: 0.375rem;
10
25
  }
11
26
  `;
@@ -14,11 +29,9 @@ const createStyles = ({ css, createGlobalStyles }) => {
14
29
  font-weight: var(--font-weight-semibold);
15
30
  overflow-x: hidden;
16
31
  display: inline-flex;
17
-
18
32
  &.solid div:hover {
19
33
  filter: brightness(var(--brightness-hover-always));
20
34
  }
21
-
22
35
  & ul {
23
36
  display: block;
24
37
  list-style: none;
@@ -46,9 +59,8 @@ const createStyles = ({ css, createGlobalStyles }) => {
46
59
  display: flex;
47
60
  flex-grow: 1;
48
61
  text-decoration: none;
62
+ text-align: left;
49
63
  color: inherit;
50
- padding: var(--treeview-link-padding-vertical)
51
- var(--treeview-link-padding-horizontal);
52
64
  }
53
65
  }
54
66
  }
@@ -74,7 +86,7 @@ export default function (context, options = {}) {
74
86
  const Collapsible = collapsible(context);
75
87
 
76
88
  const Tree =
77
- ({ depth = 1, maxDepth, color, variant, size }) =>
89
+ ({ depth = 1, maxDepth, parent, color, variant, size }) =>
78
90
  (item) => {
79
91
  const { children, expanded } = item;
80
92
  const closeState = bau.state(!expanded);
@@ -83,8 +95,10 @@ export default function (context, options = {}) {
83
95
  div(
84
96
  {
85
97
  class: css`
86
- cursor: pointer;
87
- display: flex;
98
+ cursor: ${children ? "pointer" : "auto"};
99
+ display: inline-flex;
100
+ justify-content: flex-start;
101
+ align-items: center;
88
102
  width: 100%;
89
103
  `,
90
104
  onclick: (event) => {
@@ -93,7 +107,7 @@ export default function (context, options = {}) {
93
107
  }
94
108
  },
95
109
  },
96
- renderMenuItem(item.data)
110
+ renderMenuItem({ item, parent, depth })
97
111
  );
98
112
 
99
113
  const Content = () =>
@@ -101,14 +115,16 @@ export default function (context, options = {}) {
101
115
  {
102
116
  class: classNames(color, size),
103
117
  },
104
- children.map(Tree({ depth: depth + 1, maxDepth }))
118
+ children.map(Tree({ depth: depth + 1, maxDepth, parent: item }))
105
119
  );
106
120
  return li(
107
- Collapsible({
108
- size,
109
- Header,
110
- Content: children && depth < maxDepth && Content,
111
- })
121
+ children.length
122
+ ? Collapsible({
123
+ expanded,
124
+ Header,
125
+ Content: children && depth < maxDepth && Content,
126
+ })
127
+ : Header()
112
128
  );
113
129
  };
114
130
 
@@ -131,8 +147,9 @@ export default function (context, options = {}) {
131
147
  otherProps.class
132
148
  ),
133
149
  },
134
- tree.children &&
135
- ul(tree.children.map(Tree({ maxDepth, color, variant, size })))
150
+ ul(
151
+ Tree({ maxDepth, color, variant, size })(treeAddParent({})({ ...tree }))
152
+ )
136
153
  );
137
154
  };
138
155
  }