@grucloud/bau-ui 0.42.0 → 0.43.1
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/README.md +2 -2
- package/accordion/accordion.js +32 -62
- package/accordion/index.d.ts +5 -7
- package/alert/alert.js +33 -30
- package/animate/animate.js +1 -1
- package/autocomplete/autocomplete.js +14 -11
- package/avatar/avatar.js +5 -2
- package/bau-ui.d.ts +3 -1
- package/breadcrumbs/breadcrumbs.js +2 -5
- package/button/button.js +59 -61
- package/buttonGroup/buttonGroup.js +4 -3
- package/carousel/carousel.js +105 -0
- package/carousel/index.d.ts +22 -0
- package/carousel/index.js +1 -0
- package/chip/chip.js +8 -8
- package/collapsible/collapsible.js +121 -0
- package/collapsible/index.d.ts +10 -0
- package/collapsible/index.js +1 -0
- package/constants.d.ts +8 -2
- package/constants.js +8 -1
- package/context.d.ts +2 -0
- package/drillDownMenu/drillDownMenu.js +59 -26
- package/drillDownMenu/index.d.ts +1 -0
- package/fileInput/fileInput.js +3 -5
- package/form/form.js +32 -1
- package/globalStyle/globalStyle.js +1 -1
- package/input/input.js +13 -13
- package/linearProgress/index.d.ts +12 -0
- package/linearProgress/index.js +1 -0
- package/linearProgress/linearProgress.js +84 -0
- package/list/list.js +3 -11
- package/loadingButton/index.d.ts +12 -0
- package/loadingButton/index.js +1 -0
- package/loadingButton/loadingButton.js +70 -0
- package/modal/modal.js +25 -27
- package/package.json +10 -5
- package/paginationNavigation/index.d.ts +10 -0
- package/paginationNavigation/index.js +1 -0
- package/paginationNavigation/paginationNavigation.js +78 -0
- package/paper/index.d.ts +10 -0
- package/paper/index.js +1 -0
- package/paper/paper.js +51 -0
- package/popover/popover.js +14 -3
- package/radioButton/index.d.ts +15 -0
- package/radioButton/index.js +1 -0
- package/radioButton/radioButton.js +49 -0
- package/select/select.js +21 -8
- package/spinner/index.d.ts +1 -3
- package/spinner/spinner.js +98 -55
- package/stepper/index.d.ts +28 -0
- package/stepper/index.js +1 -0
- package/stepper/stepper.js +159 -0
- package/tableContainer/tableContainer.js +2 -3
- package/tableOfContent/index.d.ts +10 -0
- package/tableOfContent/index.js +1 -0
- package/tableOfContent/tableOfContent.js +159 -0
- package/tabs/tabs.js +56 -56
- package/toggle/index.d.ts +10 -0
- package/toggle/index.js +1 -0
- package/toggle/toggle.js +106 -0
- package/toggleGroup/index.d.ts +13 -0
- package/toggleGroup/index.js +1 -0
- package/toggleGroup/toggleGroup.js +94 -0
- package/tooltip/tooltip.js +1 -6
- package/treeView/treeView.js +30 -88
- package/tsconfig.json +23 -0
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import classNames from "@grucloud/bau-css/classNames.js";
|
|
2
|
+
import { toPropsAndChildren } from "@grucloud/bau/bau.js";
|
|
3
|
+
import { Colors } from "../constants.js";
|
|
4
|
+
|
|
5
|
+
export default function (context, options) {
|
|
6
|
+
const { bau, css, keyframes } = context;
|
|
7
|
+
const { div } = bau.tags;
|
|
8
|
+
|
|
9
|
+
const colorsToCss = () =>
|
|
10
|
+
Colors.map(
|
|
11
|
+
(color) =>
|
|
12
|
+
`
|
|
13
|
+
&.${color}{
|
|
14
|
+
background-color: var(--color-${color});
|
|
15
|
+
}
|
|
16
|
+
`
|
|
17
|
+
).join("\n");
|
|
18
|
+
|
|
19
|
+
const stripes = keyframes`
|
|
20
|
+
0% {
|
|
21
|
+
background-position: 0rem 0;
|
|
22
|
+
}
|
|
23
|
+
100% {
|
|
24
|
+
background-position: 1rem 0;
|
|
25
|
+
}
|
|
26
|
+
`;
|
|
27
|
+
|
|
28
|
+
const className = css`
|
|
29
|
+
width: 100%;
|
|
30
|
+
height: 5px;
|
|
31
|
+
background-image: linear-gradient(
|
|
32
|
+
45deg,
|
|
33
|
+
rgba(255, 255, 255, 0.15) 25%,
|
|
34
|
+
transparent 25%,
|
|
35
|
+
transparent 50%,
|
|
36
|
+
rgba(255, 255, 255, 0.15) 50%,
|
|
37
|
+
rgba(255, 255, 255, 0.15) 75%,
|
|
38
|
+
transparent 75%,
|
|
39
|
+
transparent
|
|
40
|
+
);
|
|
41
|
+
background-size: 1rem 1rem;
|
|
42
|
+
transition: all 0.3s linear;
|
|
43
|
+
opacity: 0;
|
|
44
|
+
&.running {
|
|
45
|
+
opacity: 1;
|
|
46
|
+
animation: ${stripes} 1s linear infinite;
|
|
47
|
+
}
|
|
48
|
+
&.sm {
|
|
49
|
+
height: 0.2rem;
|
|
50
|
+
}
|
|
51
|
+
&.md {
|
|
52
|
+
height: 0.5rem;
|
|
53
|
+
}
|
|
54
|
+
&.lg {
|
|
55
|
+
height: 1rem;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
${colorsToCss()}
|
|
59
|
+
`;
|
|
60
|
+
|
|
61
|
+
return function LinearProgress(...args) {
|
|
62
|
+
let [
|
|
63
|
+
{ color = "neutral", variant = "plain", size = "md", running, ...props },
|
|
64
|
+
] = toPropsAndChildren(args);
|
|
65
|
+
|
|
66
|
+
return div({
|
|
67
|
+
...props,
|
|
68
|
+
role: "progressbar",
|
|
69
|
+
class: {
|
|
70
|
+
deps: [running],
|
|
71
|
+
renderProp: () => (running) =>
|
|
72
|
+
classNames(
|
|
73
|
+
"linearProgress",
|
|
74
|
+
size,
|
|
75
|
+
color,
|
|
76
|
+
className,
|
|
77
|
+
running && "running",
|
|
78
|
+
options?.class,
|
|
79
|
+
props?.class
|
|
80
|
+
),
|
|
81
|
+
},
|
|
82
|
+
});
|
|
83
|
+
};
|
|
84
|
+
}
|
package/list/list.js
CHANGED
|
@@ -1,19 +1,13 @@
|
|
|
1
1
|
import classNames from "@grucloud/bau-css/classNames.js";
|
|
2
2
|
import { toPropsAndChildren } from "@grucloud/bau/bau.js";
|
|
3
|
-
import { Colors } from "../constants.js";
|
|
4
3
|
|
|
5
4
|
export default function (context, options) {
|
|
6
5
|
const { bau, css } = context;
|
|
7
6
|
const { ul } = bau.tags;
|
|
8
7
|
|
|
9
|
-
const colorsToCss = () =>
|
|
10
|
-
Colors.map(
|
|
11
|
-
(color) =>
|
|
12
|
-
`
|
|
13
|
-
`
|
|
14
|
-
).join("\n");
|
|
15
|
-
|
|
16
8
|
const className = css`
|
|
9
|
+
display: flex;
|
|
10
|
+
flex-direction: column;
|
|
17
11
|
list-style: none;
|
|
18
12
|
padding: 0;
|
|
19
13
|
margin: 0 0;
|
|
@@ -25,13 +19,12 @@ export default function (context, options) {
|
|
|
25
19
|
filter: brightness(var(--brightness-active-always));
|
|
26
20
|
}
|
|
27
21
|
}
|
|
28
|
-
& li {
|
|
22
|
+
& > li {
|
|
29
23
|
padding: 0.4rem;
|
|
30
24
|
cursor: pointer;
|
|
31
25
|
background-color: inherit;
|
|
32
26
|
transition: all var(--transition-slow) ease-out;
|
|
33
27
|
display: flex;
|
|
34
|
-
align-items: center;
|
|
35
28
|
&:hover {
|
|
36
29
|
filter: brightness(var(--brightness-hover));
|
|
37
30
|
}
|
|
@@ -39,7 +32,6 @@ export default function (context, options) {
|
|
|
39
32
|
filter: brightness(var(--brightness-active));
|
|
40
33
|
}
|
|
41
34
|
}
|
|
42
|
-
${colorsToCss()}
|
|
43
35
|
`;
|
|
44
36
|
|
|
45
37
|
return function List(...args) {
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
declare module "@grucloud/bau-ui/loadingButton" {
|
|
2
|
+
type DefaultDesignProps = import("../constants").DefaultDesignProps;
|
|
3
|
+
type ComponentOption = import("../bau-ui").ComponentOption;
|
|
4
|
+
|
|
5
|
+
export type LoadingButtonProps = {
|
|
6
|
+
loading: boolean | import("@grucloud/bau").State<boolean>;
|
|
7
|
+
} & DefaultDesignProps;
|
|
8
|
+
|
|
9
|
+
type Component = import("../bau-ui").Component<LoadingButtonProps>;
|
|
10
|
+
|
|
11
|
+
export default function (context: any, option?: ComponentOption): Component;
|
|
12
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./loadingButton";
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import classNames from "@grucloud/bau-css/classNames.js";
|
|
2
|
+
import { toPropsAndChildren } from "@grucloud/bau/bau.js";
|
|
3
|
+
import button from "../button";
|
|
4
|
+
import spinner from "../spinner";
|
|
5
|
+
|
|
6
|
+
export default function (context, options) {
|
|
7
|
+
const { bau, css, keyframes } = context;
|
|
8
|
+
const { span } = bau.tags;
|
|
9
|
+
|
|
10
|
+
const fadeOut = keyframes`
|
|
11
|
+
0% {
|
|
12
|
+
opacity: 1;
|
|
13
|
+
}
|
|
14
|
+
100% {
|
|
15
|
+
opacity: 0;
|
|
16
|
+
}
|
|
17
|
+
`;
|
|
18
|
+
|
|
19
|
+
const className = css`
|
|
20
|
+
position: relative;
|
|
21
|
+
&:hover.loading {
|
|
22
|
+
cursor: default;
|
|
23
|
+
}
|
|
24
|
+
& .spinner {
|
|
25
|
+
position: absolute;
|
|
26
|
+
}
|
|
27
|
+
& span {
|
|
28
|
+
&.loading {
|
|
29
|
+
animation: ${fadeOut} 0.5s;
|
|
30
|
+
opacity: 0;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
&.md {
|
|
34
|
+
padding-left: 0.5rem;
|
|
35
|
+
padding-right: 0.5rem;
|
|
36
|
+
}
|
|
37
|
+
`;
|
|
38
|
+
|
|
39
|
+
return function LoadingButton(...args) {
|
|
40
|
+
let [
|
|
41
|
+
{ color, variant = "plain", size = "md", loading, ...props },
|
|
42
|
+
...children
|
|
43
|
+
] = toPropsAndChildren(args);
|
|
44
|
+
|
|
45
|
+
const Button = button(context);
|
|
46
|
+
const Spinner = spinner(context);
|
|
47
|
+
|
|
48
|
+
return bau.bind({
|
|
49
|
+
deps: [loading],
|
|
50
|
+
render: () => (loading) =>
|
|
51
|
+
Button(
|
|
52
|
+
{
|
|
53
|
+
...props,
|
|
54
|
+
class: classNames(
|
|
55
|
+
"loadingButton",
|
|
56
|
+
size,
|
|
57
|
+
variant,
|
|
58
|
+
color,
|
|
59
|
+
className,
|
|
60
|
+
loading && "loading",
|
|
61
|
+
options?.class,
|
|
62
|
+
props?.class
|
|
63
|
+
),
|
|
64
|
+
},
|
|
65
|
+
Spinner({ size, variant, color, visibility: loading }),
|
|
66
|
+
span({ class: loading && "loading" }, children)
|
|
67
|
+
),
|
|
68
|
+
});
|
|
69
|
+
};
|
|
70
|
+
}
|
package/modal/modal.js
CHANGED
|
@@ -4,7 +4,7 @@ import { Colors } from "../constants.js";
|
|
|
4
4
|
|
|
5
5
|
export default function (context, options) {
|
|
6
6
|
const { bau, css } = context;
|
|
7
|
-
const { dialog } = bau.tags;
|
|
7
|
+
const { dialog, div } = bau.tags;
|
|
8
8
|
|
|
9
9
|
const colorsToCss = () =>
|
|
10
10
|
Colors.map(
|
|
@@ -20,7 +20,6 @@ export default function (context, options) {
|
|
|
20
20
|
color: inherit;
|
|
21
21
|
}
|
|
22
22
|
&.modal.solid.${color} {
|
|
23
|
-
|
|
24
23
|
}
|
|
25
24
|
`
|
|
26
25
|
).join("\n");
|
|
@@ -28,34 +27,33 @@ export default function (context, options) {
|
|
|
28
27
|
const className = css`
|
|
29
28
|
box-shadow: var(--shadow-s);
|
|
30
29
|
background-color: var(--background-color);
|
|
31
|
-
|
|
32
|
-
left: 0;
|
|
33
|
-
max-height: 90vh;
|
|
34
|
-
max-width: 95vw;
|
|
35
|
-
transition: transform 0.3s ease-out;
|
|
36
|
-
border-radius: 10px;
|
|
30
|
+
border-radius: var(--global-radius);
|
|
37
31
|
min-width: 400px;
|
|
38
|
-
padding:
|
|
32
|
+
padding: 1rem;
|
|
39
33
|
border: 0px;
|
|
40
|
-
|
|
41
|
-
padding: 1rem;
|
|
42
|
-
font-size: 1.8rem;
|
|
43
|
-
font-weight: 800;
|
|
44
|
-
text-align: center;
|
|
45
|
-
}
|
|
46
|
-
& footer {
|
|
34
|
+
> div {
|
|
47
35
|
display: flex;
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
36
|
+
flex-direction: column;
|
|
37
|
+
overflow: hidden;
|
|
38
|
+
max-height: 90vh;
|
|
39
|
+
max-width: 95vw;
|
|
40
|
+
& > header {
|
|
41
|
+
font-size: 1.5rem;
|
|
42
|
+
font-weight: 500;
|
|
43
|
+
}
|
|
44
|
+
& > main,
|
|
45
|
+
> section {
|
|
46
|
+
flex-grow: 1;
|
|
47
|
+
overflow-y: auto;
|
|
48
|
+
}
|
|
49
|
+
& > footer {
|
|
50
|
+
display: flex;
|
|
51
|
+
justify-content: flex-end;
|
|
52
|
+
padding: 1rem;
|
|
53
|
+
gap: 1rem;
|
|
54
|
+
}
|
|
58
55
|
}
|
|
56
|
+
|
|
59
57
|
${colorsToCss()}
|
|
60
58
|
`;
|
|
61
59
|
|
|
@@ -77,7 +75,7 @@ export default function (context, options) {
|
|
|
77
75
|
props?.class
|
|
78
76
|
),
|
|
79
77
|
},
|
|
80
|
-
...children
|
|
78
|
+
div(...children)
|
|
81
79
|
);
|
|
82
80
|
};
|
|
83
81
|
}
|
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.43.1",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "BSD",
|
|
7
7
|
"keywords": [
|
|
@@ -11,15 +11,20 @@
|
|
|
11
11
|
"CSS in JS"
|
|
12
12
|
],
|
|
13
13
|
"author": "Frederic Heem",
|
|
14
|
-
"scripts": {
|
|
14
|
+
"scripts": {
|
|
15
|
+
"typedoc": "typedoc --exclude myComponent/index.d.ts *.d.ts **/*.d.ts "
|
|
16
|
+
},
|
|
15
17
|
"repository": {
|
|
16
18
|
"type": "git",
|
|
17
19
|
"url": "git@github.com:grucloud/bau.git",
|
|
18
20
|
"directory": "bau-ui"
|
|
19
21
|
},
|
|
20
22
|
"dependencies": {
|
|
21
|
-
"@grucloud/bau": "^0.
|
|
22
|
-
"@grucloud/bau-css": "^0.
|
|
23
|
+
"@grucloud/bau": "^0.43.0",
|
|
24
|
+
"@grucloud/bau-css": "^0.43.0"
|
|
25
|
+
},
|
|
26
|
+
"devDependencies": {
|
|
27
|
+
"typedoc": "0.24.8"
|
|
23
28
|
},
|
|
24
|
-
"gitHead": "
|
|
29
|
+
"gitHead": "3950ebd435d5cc3f5b459331d5a56c49760b8357"
|
|
25
30
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
declare module "@grucloud/bau-ui/paginationNavigation" {
|
|
2
|
+
type DefaultDesignProps = import("../constants").DefaultDesignProps;
|
|
3
|
+
type ComponentOption = import("../bau-ui").ComponentOption;
|
|
4
|
+
|
|
5
|
+
export type PaginationNavigationProps = {} & DefaultDesignProps;
|
|
6
|
+
|
|
7
|
+
type Component = import("../bau-ui").Component<PaginationNavigationProps>;
|
|
8
|
+
|
|
9
|
+
export default function (context: any, option?: ComponentOption): Component;
|
|
10
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./paginationNavigation";
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import classNames from "@grucloud/bau-css/classNames.js";
|
|
2
|
+
import { toPropsAndChildren } from "@grucloud/bau/bau.js";
|
|
3
|
+
|
|
4
|
+
export default function (context, options) {
|
|
5
|
+
const { bau, css, config } = context;
|
|
6
|
+
const { div, a, span, nav } = bau.tags;
|
|
7
|
+
|
|
8
|
+
const className = css`
|
|
9
|
+
margin-top: 3rem;
|
|
10
|
+
margin-bottom: 1rem;
|
|
11
|
+
display: grid;
|
|
12
|
+
grid-area: paginationnav;
|
|
13
|
+
gap: var(--spacing-horizontal);
|
|
14
|
+
grid-template-columns: repeat(2, 1fr);
|
|
15
|
+
& > a {
|
|
16
|
+
padding: 0.5rem 1rem;
|
|
17
|
+
text-decoration: none;
|
|
18
|
+
border: 1px solid var(--color-emphasis-300);
|
|
19
|
+
border-radius: var(--global-radius);
|
|
20
|
+
transition: border-color var(--transition-slow);
|
|
21
|
+
&:hover {
|
|
22
|
+
border-color: var(--color-primary);
|
|
23
|
+
}
|
|
24
|
+
.sublabel {
|
|
25
|
+
color: var(--color-content-secondary);
|
|
26
|
+
font-size: 0.8rem;
|
|
27
|
+
font-weight: var(--font-weight-semibold);
|
|
28
|
+
margin-bottom: 0.25rem;
|
|
29
|
+
}
|
|
30
|
+
.label {
|
|
31
|
+
color: var(--link-color);
|
|
32
|
+
font-size: 1rem;
|
|
33
|
+
font-weight: var(--font-weight-bold);
|
|
34
|
+
}
|
|
35
|
+
.Previous {
|
|
36
|
+
&::before {
|
|
37
|
+
content: "« ";
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
.Next {
|
|
41
|
+
&::after {
|
|
42
|
+
content: " »";
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
`;
|
|
47
|
+
|
|
48
|
+
const Link =
|
|
49
|
+
({ text }) =>
|
|
50
|
+
({ name, label, href }) =>
|
|
51
|
+
a(
|
|
52
|
+
{ href: `${config.base}${href}` },
|
|
53
|
+
span({ class: "sublabel" }, text),
|
|
54
|
+
div({ class: `label ${text}` }, label ?? name)
|
|
55
|
+
);
|
|
56
|
+
|
|
57
|
+
return function PaginationNavigation(...args) {
|
|
58
|
+
let [{ color, variant = "plain", size = "md", data = {}, ...props }] =
|
|
59
|
+
toPropsAndChildren(args);
|
|
60
|
+
const { next, previous } = data;
|
|
61
|
+
return nav(
|
|
62
|
+
{
|
|
63
|
+
"data-paginationnav": JSON.stringify(data),
|
|
64
|
+
"aria-label": "pages navigation",
|
|
65
|
+
...props,
|
|
66
|
+
class: classNames(
|
|
67
|
+
"paginationNavigation",
|
|
68
|
+
size,
|
|
69
|
+
className,
|
|
70
|
+
options?.class,
|
|
71
|
+
props?.class
|
|
72
|
+
),
|
|
73
|
+
},
|
|
74
|
+
previous?.href && Link({ text: "Previous" })(previous),
|
|
75
|
+
next?.href && Link({ text: "Next" })(next)
|
|
76
|
+
);
|
|
77
|
+
};
|
|
78
|
+
}
|
package/paper/index.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
declare module "@grucloud/bau-ui/paper" {
|
|
2
|
+
type DefaultDesignProps = import("../constants").DefaultDesignProps;
|
|
3
|
+
type ComponentOption = import("../bau-ui").ComponentOption;
|
|
4
|
+
|
|
5
|
+
export type PaperProps = {} & DefaultDesignProps;
|
|
6
|
+
|
|
7
|
+
type Component = import("../bau-ui").Component<PaperProps>;
|
|
8
|
+
|
|
9
|
+
export default function (context: any, option?: ComponentOption): Component;
|
|
10
|
+
}
|
package/paper/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./paper";
|
package/paper/paper.js
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import classNames from "@grucloud/bau-css/classNames.js";
|
|
2
|
+
import { toPropsAndChildren } from "@grucloud/bau/bau.js";
|
|
3
|
+
|
|
4
|
+
export default function (context, options) {
|
|
5
|
+
const { bau, css } = context;
|
|
6
|
+
const { div } = bau.tags;
|
|
7
|
+
const className = css`
|
|
8
|
+
border: 1px solid transparent;
|
|
9
|
+
height: fit-content;
|
|
10
|
+
border-radius: var(--global-radius);
|
|
11
|
+
&.sm {
|
|
12
|
+
box-shadow: var(--shadow-s);
|
|
13
|
+
background-image: linear-gradient(
|
|
14
|
+
rgba(255, 255, 255, 0.03),
|
|
15
|
+
rgba(255, 255, 255, 0.03)
|
|
16
|
+
);
|
|
17
|
+
}
|
|
18
|
+
&.md {
|
|
19
|
+
box-shadow: var(--shadow-m);
|
|
20
|
+
background-image: linear-gradient(
|
|
21
|
+
rgba(255, 255, 255, 0.05),
|
|
22
|
+
rgba(255, 255, 255, 0.05)
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
&.lg {
|
|
26
|
+
box-shadow: var(--shadow-lg);
|
|
27
|
+
background-image: linear-gradient(
|
|
28
|
+
rgba(255, 255, 255, 0.1),
|
|
29
|
+
rgba(255, 255, 255, 0.1)
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
`;
|
|
33
|
+
|
|
34
|
+
return function Paper(...args) {
|
|
35
|
+
let [{ color, variant = "outline", size = "md", ...props }, ...children] =
|
|
36
|
+
toPropsAndChildren(args);
|
|
37
|
+
return div(
|
|
38
|
+
{
|
|
39
|
+
...props,
|
|
40
|
+
class: classNames(
|
|
41
|
+
"paper",
|
|
42
|
+
size,
|
|
43
|
+
className,
|
|
44
|
+
options?.class,
|
|
45
|
+
props?.class
|
|
46
|
+
),
|
|
47
|
+
},
|
|
48
|
+
...children
|
|
49
|
+
);
|
|
50
|
+
};
|
|
51
|
+
}
|
package/popover/popover.js
CHANGED
|
@@ -1,9 +1,17 @@
|
|
|
1
|
+
import paper from "../paper";
|
|
1
2
|
import classNames from "@grucloud/bau-css/classNames.js";
|
|
2
3
|
import { toPropsAndChildren } from "@grucloud/bau/bau.js";
|
|
3
4
|
|
|
4
5
|
export default function (context, options) {
|
|
5
6
|
const { bau, css, window } = context;
|
|
6
7
|
const { dialog } = bau.tags;
|
|
8
|
+
const Paper = paper(context, {
|
|
9
|
+
class: css`
|
|
10
|
+
&.paper {
|
|
11
|
+
padding: 0;
|
|
12
|
+
}
|
|
13
|
+
`,
|
|
14
|
+
});
|
|
7
15
|
|
|
8
16
|
const className = css`
|
|
9
17
|
width: fit-content;
|
|
@@ -34,11 +42,14 @@ export default function (context, options) {
|
|
|
34
42
|
} else {
|
|
35
43
|
dialogEl.style.left = rectAnchor.right - rectDialog.width + "px";
|
|
36
44
|
}
|
|
37
|
-
|
|
38
45
|
if (rectAnchor.y < window.innerHeight / 2) {
|
|
39
46
|
dialogEl.style.top = rectAnchor.top + rectAnchor.height + "px";
|
|
40
47
|
} else {
|
|
41
|
-
dialogEl.style.top =
|
|
48
|
+
dialogEl.style.top =
|
|
49
|
+
Math.max(0, rectAnchor.top - rectDialog.height) + "px";
|
|
50
|
+
if (rectDialog.height > rectAnchor.top) {
|
|
51
|
+
dialogEl.style.height = rectAnchor.top + "px";
|
|
52
|
+
}
|
|
42
53
|
}
|
|
43
54
|
};
|
|
44
55
|
|
|
@@ -58,7 +69,7 @@ export default function (context, options) {
|
|
|
58
69
|
onclick: (event) =>
|
|
59
70
|
event.target === dialogEl && (closeDialog(), onClose?.call()),
|
|
60
71
|
},
|
|
61
|
-
contentEl
|
|
72
|
+
Paper(contentEl)
|
|
62
73
|
);
|
|
63
74
|
|
|
64
75
|
dialogEl.closeDialog = closeDialog;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
declare module "@grucloud/bau-ui/radioButton" {
|
|
2
|
+
type DefaultDesignProps = import("../constants").DefaultDesignProps;
|
|
3
|
+
type ComponentOption = import("../bau-ui").ComponentOption;
|
|
4
|
+
|
|
5
|
+
export type RadioButtonProps = {
|
|
6
|
+
value: string | import("@grucloud/bau").State<string>;
|
|
7
|
+
} & DefaultDesignProps;
|
|
8
|
+
|
|
9
|
+
type Component = import("../bau-ui").Component<
|
|
10
|
+
RadioButtonProps,
|
|
11
|
+
HTMLInputElement
|
|
12
|
+
>;
|
|
13
|
+
|
|
14
|
+
export default function (context: any, option?: ComponentOption): Component;
|
|
15
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./radioButton";
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import classNames from "@grucloud/bau-css/classNames.js";
|
|
2
|
+
import { toPropsAndChildren } from "@grucloud/bau/bau.js";
|
|
3
|
+
import { Colors } from "../constants.js";
|
|
4
|
+
|
|
5
|
+
export default function (context, options) {
|
|
6
|
+
const { bau, css } = context;
|
|
7
|
+
const { input } = bau.tags;
|
|
8
|
+
|
|
9
|
+
const colorsToCss = () =>
|
|
10
|
+
Colors.map(
|
|
11
|
+
(color) =>
|
|
12
|
+
`
|
|
13
|
+
&.radio-button.${color} {
|
|
14
|
+
accent-color: var(--color-${color});
|
|
15
|
+
}
|
|
16
|
+
`
|
|
17
|
+
).join("\n");
|
|
18
|
+
|
|
19
|
+
const className = css`
|
|
20
|
+
&.sm {
|
|
21
|
+
transform: scale(0.8);
|
|
22
|
+
}
|
|
23
|
+
&.md {
|
|
24
|
+
}
|
|
25
|
+
&.lg {
|
|
26
|
+
transform: scale(1.5);
|
|
27
|
+
}
|
|
28
|
+
${colorsToCss()}
|
|
29
|
+
`;
|
|
30
|
+
|
|
31
|
+
return function RadioButton(...args) {
|
|
32
|
+
let [{ color = "neutral", variant = "plain", size = "md", ...props }] =
|
|
33
|
+
toPropsAndChildren(args);
|
|
34
|
+
|
|
35
|
+
return input({
|
|
36
|
+
...props,
|
|
37
|
+
type: "radio",
|
|
38
|
+
class: classNames(
|
|
39
|
+
"radio-button",
|
|
40
|
+
size,
|
|
41
|
+
color,
|
|
42
|
+
variant,
|
|
43
|
+
className,
|
|
44
|
+
options?.class,
|
|
45
|
+
props?.class
|
|
46
|
+
),
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
}
|
package/select/select.js
CHANGED
|
@@ -21,12 +21,16 @@ const colorsToCss = () =>
|
|
|
21
21
|
|
|
22
22
|
export default function (context, componentOptions) {
|
|
23
23
|
const { bau, css } = context;
|
|
24
|
-
const { div, li } = bau.tags;
|
|
24
|
+
const { div, li, select, option } = bau.tags;
|
|
25
25
|
const Button = button(context);
|
|
26
26
|
const Popover = popover(context);
|
|
27
27
|
const List = list(context);
|
|
28
28
|
|
|
29
29
|
const className = css`
|
|
30
|
+
& select {
|
|
31
|
+
width: 0;
|
|
32
|
+
height: 0;
|
|
33
|
+
}
|
|
30
34
|
& button {
|
|
31
35
|
&::after {
|
|
32
36
|
content: "\u25BC";
|
|
@@ -36,17 +40,12 @@ export default function (context, componentOptions) {
|
|
|
36
40
|
${colorsToCss()}
|
|
37
41
|
`;
|
|
38
42
|
|
|
39
|
-
const inputState = bau.state("");
|
|
40
|
-
const openState = bau.state(false);
|
|
41
|
-
const itemIndexActive = bau.state(0);
|
|
42
|
-
|
|
43
43
|
return function Select(...args) {
|
|
44
44
|
let [
|
|
45
45
|
{
|
|
46
46
|
color = "neutral",
|
|
47
47
|
variant = "outline",
|
|
48
48
|
size = "md",
|
|
49
|
-
id,
|
|
50
49
|
label,
|
|
51
50
|
Option,
|
|
52
51
|
options,
|
|
@@ -56,6 +55,10 @@ export default function (context, componentOptions) {
|
|
|
56
55
|
...children
|
|
57
56
|
] = toPropsAndChildren(args);
|
|
58
57
|
|
|
58
|
+
const inputState = bau.state("");
|
|
59
|
+
const openState = bau.state(false);
|
|
60
|
+
const itemIndexActive = bau.state(0);
|
|
61
|
+
|
|
59
62
|
const dialogOpen = () => {
|
|
60
63
|
popoverEl.openDialog();
|
|
61
64
|
popoverEl.focus();
|
|
@@ -77,15 +80,18 @@ export default function (context, componentOptions) {
|
|
|
77
80
|
} else {
|
|
78
81
|
dialogClose();
|
|
79
82
|
}
|
|
83
|
+
event.preventDefault();
|
|
80
84
|
};
|
|
81
85
|
|
|
82
86
|
const onclickItem =
|
|
83
87
|
({ option, index }) =>
|
|
84
88
|
(event) => {
|
|
85
89
|
inputState.val = getOptionLabel(option);
|
|
90
|
+
selectEl.value = inputState.val;
|
|
91
|
+
selectEl.setCustomValidity("");
|
|
86
92
|
itemIndexActive.val = index;
|
|
87
|
-
|
|
88
93
|
dialogClose();
|
|
94
|
+
event.preventDefault();
|
|
89
95
|
};
|
|
90
96
|
|
|
91
97
|
const onkeydown = (event) => {
|
|
@@ -150,11 +156,17 @@ export default function (context, componentOptions) {
|
|
|
150
156
|
);
|
|
151
157
|
|
|
152
158
|
const popoverEl = Popover({
|
|
153
|
-
id,
|
|
159
|
+
// id,
|
|
154
160
|
triggerEl: buttonEl,
|
|
155
161
|
contentEl: Content(),
|
|
156
162
|
onClose,
|
|
157
163
|
});
|
|
164
|
+
// Hidden select, required to save the value.
|
|
165
|
+
const selectEl = select(
|
|
166
|
+
props,
|
|
167
|
+
option({ value: "" }, "--Select Category--"),
|
|
168
|
+
options.map((opt) => option(getOptionLabel(opt)))
|
|
169
|
+
);
|
|
158
170
|
|
|
159
171
|
return div(
|
|
160
172
|
{
|
|
@@ -169,6 +181,7 @@ export default function (context, componentOptions) {
|
|
|
169
181
|
),
|
|
170
182
|
onkeydown,
|
|
171
183
|
},
|
|
184
|
+
selectEl,
|
|
172
185
|
buttonEl,
|
|
173
186
|
popoverEl
|
|
174
187
|
);
|