@grucloud/bau-ui 0.68.0 → 0.69.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/checkbox/checkbox.js +6 -1
- package/collapsible/collapsible.js +2 -3
- package/collapsible/index.d.ts +1 -1
- package/form/form.js +4 -1
- package/package.json +4 -4
- package/treeView/index.d.ts +1 -0
- package/treeView/treeView.js +28 -13
package/checkbox/checkbox.js
CHANGED
|
@@ -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: "
|
|
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
|
-
|
|
72
|
+
expanded = false,
|
|
73
73
|
...props
|
|
74
74
|
},
|
|
75
75
|
] = toPropsAndChildren(args);
|
|
76
76
|
|
|
77
|
-
const closeState = bau.state(
|
|
78
|
-
|
|
77
|
+
const closeState = bau.state(!expanded);
|
|
79
78
|
return div(
|
|
80
79
|
{
|
|
81
80
|
...props,
|
package/collapsible/index.d.ts
CHANGED
|
@@ -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
|
-
&
|
|
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;
|
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.
|
|
4
|
+
"version": "0.69.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.
|
|
24
|
-
"@grucloud/bau-css": "^0.
|
|
23
|
+
"@grucloud/bau": "^0.69.0",
|
|
24
|
+
"@grucloud/bau-css": "^0.69.0"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"typedoc": "0.24.8"
|
|
28
28
|
},
|
|
29
|
-
"gitHead": "
|
|
29
|
+
"gitHead": "6751716130fa828805362f979f6a28692fd7837f"
|
|
30
30
|
}
|
package/treeView/index.d.ts
CHANGED
package/treeView/treeView.js
CHANGED
|
@@ -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:
|
|
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
|
|
110
|
+
renderMenuItem({ item, parent, depth })
|
|
97
111
|
);
|
|
98
112
|
|
|
99
113
|
const Content = () =>
|
|
@@ -101,11 +115,11 @@ 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
121
|
Collapsible({
|
|
108
|
-
|
|
122
|
+
expanded,
|
|
109
123
|
Header,
|
|
110
124
|
Content: children && depth < maxDepth && Content,
|
|
111
125
|
})
|
|
@@ -131,8 +145,9 @@ export default function (context, options = {}) {
|
|
|
131
145
|
otherProps.class
|
|
132
146
|
),
|
|
133
147
|
},
|
|
134
|
-
|
|
135
|
-
|
|
148
|
+
ul(
|
|
149
|
+
Tree({ maxDepth, color, variant, size })(treeAddParent({})({ ...tree }))
|
|
150
|
+
)
|
|
136
151
|
);
|
|
137
152
|
};
|
|
138
153
|
}
|