@grucloud/bau-ui 0.67.1 → 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/bau-ui.d.ts +11 -8
- package/checkbox/checkbox.js +6 -1
- package/collapsible/collapsible.js +2 -4
- package/collapsible/index.d.ts +1 -1
- package/drillDownMenu/drillDownMenu.js +8 -12
- package/form/form.js +4 -1
- package/globalStyle/globalStyle.js +2 -2
- package/keyValueList/keyValueList.js +3 -0
- package/package.json +4 -4
- package/popover/popover.js +1 -9
- package/radioButton/radioButton.js +1 -1
- package/radioButtonGroup/index.d.ts +21 -0
- package/radioButtonGroup/index.js +1 -0
- package/radioButtonGroup/radioButtonGroup.js +83 -0
- package/spinner/spinner.js +3 -4
- package/switch/switch.js +1 -0
- package/treeView/index.d.ts +1 -0
- package/treeView/treeView.js +28 -13
package/bau-ui.d.ts
CHANGED
|
@@ -11,12 +11,8 @@ export type Component<
|
|
|
11
11
|
...rest: readonly ChildDom[]
|
|
12
12
|
) => TElement & TAction;
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
props: TProps & import("@grucloud/bau").PropsAll<TElement>,
|
|
16
|
-
...rest: readonly ChildDom[]
|
|
17
|
-
) =>
|
|
14
|
+
type ComponentReturnedSimple =
|
|
18
15
|
| TElement
|
|
19
|
-
| TElement[]
|
|
20
16
|
| string
|
|
21
17
|
| number
|
|
22
18
|
| boolean
|
|
@@ -24,15 +20,22 @@ export type ComponentWithProp<TProps, TElement = HTMLElement> = (
|
|
|
24
20
|
| null
|
|
25
21
|
| undefined;
|
|
26
22
|
|
|
23
|
+
type ComponentReturned = ComponentReturnedSimple | ComponentReturnedSimple[];
|
|
24
|
+
|
|
25
|
+
export type ComponentWithProp<TProps, TElement = HTMLElement> = (
|
|
26
|
+
props: TProps & import("@grucloud/bau").PropsAll<TElement>,
|
|
27
|
+
...rest: readonly ChildDom[]
|
|
28
|
+
) => ComponentReturned;
|
|
29
|
+
|
|
27
30
|
export type ComponentOneChild<TProps, TElement = HTMLElement> = (
|
|
28
31
|
props: TProps & import("@grucloud/bau").PropsAll<TElement>,
|
|
29
32
|
child: ChildDom
|
|
30
|
-
) =>
|
|
33
|
+
) => ComponentReturned;
|
|
31
34
|
|
|
32
35
|
export type ComponentGeneric = (
|
|
33
|
-
props?: import("@grucloud/bau").Props<
|
|
36
|
+
props?: import("@grucloud/bau").Props<HTMLElement>,
|
|
34
37
|
...rest: readonly ChildDom[]
|
|
35
|
-
) =>
|
|
38
|
+
) => ComponentReturned;
|
|
36
39
|
|
|
37
40
|
export type ComponentOption = {
|
|
38
41
|
class?: string;
|
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%;
|
|
@@ -12,7 +12,6 @@ export default function (context, options = {}) {
|
|
|
12
12
|
& .header {
|
|
13
13
|
display: flex;
|
|
14
14
|
align-items: center;
|
|
15
|
-
justify-content: space-between;
|
|
16
15
|
background-color: inherit;
|
|
17
16
|
&::before {
|
|
18
17
|
padding: 0.5rem;
|
|
@@ -70,13 +69,12 @@ export default function (context, options = {}) {
|
|
|
70
69
|
color = options.color ?? "neutral",
|
|
71
70
|
Header,
|
|
72
71
|
Content,
|
|
73
|
-
|
|
72
|
+
expanded = false,
|
|
74
73
|
...props
|
|
75
74
|
},
|
|
76
75
|
] = toPropsAndChildren(args);
|
|
77
76
|
|
|
78
|
-
const closeState = bau.state(
|
|
79
|
-
|
|
77
|
+
const closeState = bau.state(!expanded);
|
|
80
78
|
return div(
|
|
81
79
|
{
|
|
82
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
|
|
|
@@ -225,10 +225,6 @@ export default function (context, options = {}) {
|
|
|
225
225
|
return subTree;
|
|
226
226
|
};
|
|
227
227
|
|
|
228
|
-
const pathnameState = bau.state(
|
|
229
|
-
window.location.pathname.replace(baseUrl, "")
|
|
230
|
-
);
|
|
231
|
-
|
|
232
228
|
const pathFromHref = ({ target }) => {
|
|
233
229
|
const href = target.closest("a").getAttribute("href");
|
|
234
230
|
let path = href.replace(baseUrl, "");
|
|
@@ -247,10 +243,15 @@ export default function (context, options = {}) {
|
|
|
247
243
|
...otherProps
|
|
248
244
|
} = props;
|
|
249
245
|
|
|
246
|
+
const pathnameState = bau.state(
|
|
247
|
+
window.location.pathname.replace(baseUrl, "")
|
|
248
|
+
);
|
|
249
|
+
|
|
250
250
|
let _currentTree = findInitialTree({
|
|
251
251
|
tree,
|
|
252
252
|
pathname: pathnameState.val,
|
|
253
253
|
});
|
|
254
|
+
const nodeNameState = bau.state(JSON.stringify(_currentTree.data));
|
|
254
255
|
|
|
255
256
|
let _direction;
|
|
256
257
|
window.document.addEventListener("click", (event) => {
|
|
@@ -269,13 +270,8 @@ export default function (context, options = {}) {
|
|
|
269
270
|
tree,
|
|
270
271
|
pathname: pathFromHref(event),
|
|
271
272
|
});
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
const { ischild } = event.target.dataset;
|
|
275
|
-
|
|
276
|
-
if (ischild !== "true") {
|
|
277
|
-
pathnameState.val = pathFromHref({ target });
|
|
278
|
-
}
|
|
273
|
+
nodeNameState.val = JSON.stringify(_currentTree.data);
|
|
274
|
+
pathnameState.val = pathFromHref({ target });
|
|
279
275
|
}
|
|
280
276
|
});
|
|
281
277
|
|
|
@@ -330,7 +326,7 @@ export default function (context, options = {}) {
|
|
|
330
326
|
animationShow: () => animationShow(_direction),
|
|
331
327
|
},
|
|
332
328
|
bau.bind({
|
|
333
|
-
deps: [
|
|
329
|
+
deps: [nodeNameState],
|
|
334
330
|
render: () => () =>
|
|
335
331
|
Menu({
|
|
336
332
|
variant,
|
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/popover/popover.js
CHANGED
|
@@ -1,17 +1,9 @@
|
|
|
1
|
-
import paper from "../paper";
|
|
2
1
|
import classNames from "@grucloud/bau-css/classNames.js";
|
|
3
2
|
import { toPropsAndChildren } from "@grucloud/bau/bau.js";
|
|
4
3
|
|
|
5
4
|
export default function (context, options) {
|
|
6
5
|
const { bau, css, window } = context;
|
|
7
6
|
const { dialog } = bau.tags;
|
|
8
|
-
const Paper = paper(context, {
|
|
9
|
-
class: css`
|
|
10
|
-
&.paper {
|
|
11
|
-
padding: 0;
|
|
12
|
-
}
|
|
13
|
-
`,
|
|
14
|
-
});
|
|
15
7
|
|
|
16
8
|
const className = css`
|
|
17
9
|
width: fit-content;
|
|
@@ -72,7 +64,7 @@ export default function (context, options) {
|
|
|
72
64
|
event.target === dialogEl && (closeDialog(), onClose?.call());
|
|
73
65
|
},
|
|
74
66
|
},
|
|
75
|
-
|
|
67
|
+
contentEl
|
|
76
68
|
);
|
|
77
69
|
|
|
78
70
|
dialogEl.closeDialog = closeDialog;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
declare module "@grucloud/bau-ui/radioButtonGroup" {
|
|
2
|
+
type DefaultDesignProps = import("../constants").DefaultDesignProps;
|
|
3
|
+
type ComponentOption = import("../bau-ui").ComponentOption;
|
|
4
|
+
|
|
5
|
+
type RadioComponent = import("../bau-ui").ComponentGeneric;
|
|
6
|
+
|
|
7
|
+
type RadioItem = {
|
|
8
|
+
id: string;
|
|
9
|
+
Label: RadioComponent | RadioComponent[];
|
|
10
|
+
};
|
|
11
|
+
export type RadioButtonGroupProps = {
|
|
12
|
+
name: string;
|
|
13
|
+
value?: any;
|
|
14
|
+
oninput?: (event) => any;
|
|
15
|
+
radios: RadioItem[];
|
|
16
|
+
} & DefaultDesignProps;
|
|
17
|
+
|
|
18
|
+
type Component = import("../bau-ui").Component<RadioButtonGroupProps>;
|
|
19
|
+
|
|
20
|
+
export default function (context: any, option?: ComponentOption): Component;
|
|
21
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./radioButtonGroup";
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import classNames from "@grucloud/bau-css/classNames.js";
|
|
2
|
+
import { toPropsAndChildren } from "@grucloud/bau/bau.js";
|
|
3
|
+
import { Colors } from "../constants.js";
|
|
4
|
+
import radioButton from "../radioButton";
|
|
5
|
+
|
|
6
|
+
export default function (context, options = {}) {
|
|
7
|
+
const { bau, css } = context;
|
|
8
|
+
const { div, label } = bau.tags;
|
|
9
|
+
const RadioButton = radioButton(context);
|
|
10
|
+
|
|
11
|
+
const colorsToCss = () =>
|
|
12
|
+
Colors.map(
|
|
13
|
+
(color) =>
|
|
14
|
+
`
|
|
15
|
+
`
|
|
16
|
+
).join("\n");
|
|
17
|
+
|
|
18
|
+
const className = css`
|
|
19
|
+
display: flex;
|
|
20
|
+
flex-direction: row;
|
|
21
|
+
gap: 0.5rem;
|
|
22
|
+
& label {
|
|
23
|
+
display: flex;
|
|
24
|
+
flex-direction: row;
|
|
25
|
+
align-items: center;
|
|
26
|
+
border: 1px dotted var(--color-emphasis-500);
|
|
27
|
+
border-radius: var(--global-radius);
|
|
28
|
+
gap: 0.5rem;
|
|
29
|
+
padding: 0.5rem;
|
|
30
|
+
cursor: pointer;
|
|
31
|
+
> div {
|
|
32
|
+
display: flex;
|
|
33
|
+
flex-direction: column;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
${colorsToCss()};
|
|
37
|
+
`;
|
|
38
|
+
|
|
39
|
+
return function RadioButtonGroup(...args) {
|
|
40
|
+
let [
|
|
41
|
+
{
|
|
42
|
+
size = options.size ?? "md",
|
|
43
|
+
variant = options.variant ?? "none",
|
|
44
|
+
color = options.color ?? "neutral",
|
|
45
|
+
name,
|
|
46
|
+
oninput,
|
|
47
|
+
value,
|
|
48
|
+
radios = [],
|
|
49
|
+
...props
|
|
50
|
+
},
|
|
51
|
+
] = toPropsAndChildren(args);
|
|
52
|
+
|
|
53
|
+
return div(
|
|
54
|
+
{
|
|
55
|
+
...props,
|
|
56
|
+
class: classNames(
|
|
57
|
+
"radioButtonGroup",
|
|
58
|
+
size,
|
|
59
|
+
color,
|
|
60
|
+
variant,
|
|
61
|
+
className,
|
|
62
|
+
options?.class,
|
|
63
|
+
props?.class
|
|
64
|
+
),
|
|
65
|
+
},
|
|
66
|
+
radios.map(({ id, Label }) =>
|
|
67
|
+
label(
|
|
68
|
+
RadioButton({
|
|
69
|
+
size,
|
|
70
|
+
variant,
|
|
71
|
+
color,
|
|
72
|
+
id,
|
|
73
|
+
name,
|
|
74
|
+
checked: value == id,
|
|
75
|
+
value: id,
|
|
76
|
+
oninput,
|
|
77
|
+
}),
|
|
78
|
+
Label()
|
|
79
|
+
)
|
|
80
|
+
)
|
|
81
|
+
);
|
|
82
|
+
};
|
|
83
|
+
}
|
package/spinner/spinner.js
CHANGED
|
@@ -28,8 +28,7 @@ const colorsToCss = () =>
|
|
|
28
28
|
&.solid.${color} {
|
|
29
29
|
background-color:transparent;
|
|
30
30
|
& .path {
|
|
31
|
-
stroke: var(--
|
|
32
|
-
;
|
|
31
|
+
stroke: var(--color-${color});
|
|
33
32
|
}
|
|
34
33
|
}
|
|
35
34
|
`
|
|
@@ -40,9 +39,9 @@ export default function (context, options = {}) {
|
|
|
40
39
|
const { svg, circle } = bau.tagsNS("http://www.w3.org/2000/svg");
|
|
41
40
|
|
|
42
41
|
const rotate = keyframes`
|
|
43
|
-
100% {
|
|
42
|
+
100% {
|
|
44
43
|
transform: rotate(360deg);
|
|
45
|
-
}
|
|
44
|
+
}
|
|
46
45
|
`;
|
|
47
46
|
const dash = keyframes`
|
|
48
47
|
0% {
|
package/switch/switch.js
CHANGED
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
|
}
|