@grucloud/bau-ui 0.40.0 → 0.42.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/README.md +4 -2
- package/accordion/accordion.js +162 -0
- package/accordion/index.d.ts +26 -0
- package/accordion/index.js +1 -0
- package/alert/alert.js +65 -55
- package/alert/index.d.ts +8 -9
- package/alertStack/alertStack.js +5 -3
- package/alertStack/index.d.ts +5 -2
- package/animate/animate.js +47 -33
- package/animate/index.d.ts +2 -3
- package/autocomplete/autocomplete.js +222 -0
- package/autocomplete/index.d.ts +21 -0
- package/autocomplete/index.js +1 -0
- package/avatar/avatar.js +46 -6
- package/avatar/index.d.ts +5 -2
- package/badge/badge.js +43 -0
- package/badge/index.d.ts +12 -0
- package/badge/index.js +1 -0
- package/bau-ui.d.ts +14 -7
- package/breadcrumbs/breadcrumbs.js +30 -6
- package/breadcrumbs/index.d.ts +8 -2
- package/button/button.js +38 -105
- package/button/index.d.ts +4 -7
- package/buttonGroup/buttonGroup.js +68 -0
- package/buttonGroup/index.d.ts +10 -0
- package/buttonGroup/index.js +1 -0
- package/calendar/calendar.js +51 -0
- package/calendar/index.d.ts +13 -0
- package/calendar/index.js +1 -0
- package/checkbox/checkbox.js +66 -39
- package/checkbox/index.d.ts +5 -2
- package/chip/chip.js +60 -0
- package/chip/index.d.ts +10 -0
- package/chip/index.js +1 -0
- package/constants.d.ts +13 -0
- package/constants.js +3 -0
- package/context.d.ts +12 -0
- package/context.js +17 -0
- package/drawer/drawer.js +10 -5
- package/drawer/index.d.ts +5 -2
- package/drillDownMenu/drillDownMenu.js +157 -138
- package/drillDownMenu/index.d.ts +11 -3
- package/fileInput/fileInput.js +25 -11
- package/fileInput/index.d.ts +9 -3
- package/form/form.js +31 -0
- package/form/index.d.ts +10 -0
- package/form/index.js +1 -0
- package/globalStyle/globalStyle.js +133 -61
- package/globalStyle/index.d.ts +14 -0
- package/input/index.d.ts +6 -8
- package/input/input.js +78 -107
- package/list/index.d.ts +10 -0
- package/list/index.js +1 -0
- package/list/list.js +66 -0
- package/modal/index.d.ts +5 -2
- package/modal/modal.js +47 -10
- package/package.json +4 -4
- package/pages/login/index.d.ts +4 -5
- package/pages/login/login.js +1 -1
- package/popover/index.d.ts +18 -0
- package/popover/index.js +1 -0
- package/popover/popover.js +69 -0
- package/select/index.d.ts +16 -0
- package/select/index.js +1 -0
- package/select/select.js +176 -0
- package/slider/index.d.ts +10 -0
- package/slider/index.js +1 -0
- package/slider/slider.js +47 -0
- package/spinner/index.d.ts +7 -4
- package/spinner/spinner.js +13 -5
- package/switch/index.d.ts +5 -2
- package/switch/switch.js +101 -18
- package/tableContainer/index.d.ts +9 -0
- package/tableContainer/index.js +1 -0
- package/tableContainer/tableContainer.js +78 -0
- package/tablePagination/index.d.ts +17 -0
- package/tablePagination/index.js +1 -0
- package/tablePagination/tablePagination.js +131 -0
- package/tabs/index.d.ts +3 -1
- package/tabs/tabs.js +34 -15
- package/themeSwitch/index.d.ts +3 -1
- package/themeSwitch/themeSwitch.js +58 -15
- package/tooltip/index.d.ts +24 -0
- package/tooltip/index.js +1 -0
- package/tooltip/tooltip.js +184 -0
- package/treeView/index.d.ts +7 -2
- package/treeView/treeView.js +37 -9
package/pages/login/login.js
CHANGED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
declare module "@grucloud/bau-ui/popover" {
|
|
2
|
+
type ComponentOption = import("../bau-ui").ComponentOption;
|
|
3
|
+
|
|
4
|
+
export type PopoverProps = {};
|
|
5
|
+
|
|
6
|
+
type Action = {
|
|
7
|
+
openDialog: () => void;
|
|
8
|
+
closeDialog: () => void;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
type Component = import("../bau-ui").Component<
|
|
12
|
+
PopoverProps,
|
|
13
|
+
HTMLDialogElement,
|
|
14
|
+
Action
|
|
15
|
+
>;
|
|
16
|
+
|
|
17
|
+
export default function (context: any, option?: ComponentOption): Component;
|
|
18
|
+
}
|
package/popover/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./popover";
|
|
@@ -0,0 +1,69 @@
|
|
|
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, window } = context;
|
|
6
|
+
const { dialog } = bau.tags;
|
|
7
|
+
|
|
8
|
+
const className = css`
|
|
9
|
+
width: fit-content;
|
|
10
|
+
margin: 0;
|
|
11
|
+
background: var(--background-color);
|
|
12
|
+
border: none;
|
|
13
|
+
box-shadow: var(--shadow-m);
|
|
14
|
+
padding: 0rem;
|
|
15
|
+
margin: 0rem;
|
|
16
|
+
transition: opacity 0.3s ease-in-out;
|
|
17
|
+
&::backdrop {
|
|
18
|
+
background: var(--background-color);
|
|
19
|
+
}
|
|
20
|
+
opacity: 0;
|
|
21
|
+
`;
|
|
22
|
+
|
|
23
|
+
return function Popover(...args) {
|
|
24
|
+
let [{ contentEl, triggerEl, onClose, ...props }, ...children] =
|
|
25
|
+
toPropsAndChildren(args);
|
|
26
|
+
|
|
27
|
+
const openDialog = (event) => {
|
|
28
|
+
dialogEl.style.opacity = 1;
|
|
29
|
+
dialogEl.showModal();
|
|
30
|
+
const rectAnchor = triggerEl.getBoundingClientRect();
|
|
31
|
+
const rectDialog = dialogEl.getBoundingClientRect();
|
|
32
|
+
if (rectAnchor.x < window.innerWidth / 2) {
|
|
33
|
+
dialogEl.style.left = rectAnchor.left + "px";
|
|
34
|
+
} else {
|
|
35
|
+
dialogEl.style.left = rectAnchor.right - rectDialog.width + "px";
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
if (rectAnchor.y < window.innerHeight / 2) {
|
|
39
|
+
dialogEl.style.top = rectAnchor.top + rectAnchor.height + "px";
|
|
40
|
+
} else {
|
|
41
|
+
dialogEl.style.top = rectAnchor.top - rectDialog.height + "px";
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
const closeDialog = (event) => {
|
|
46
|
+
const listener = () => {
|
|
47
|
+
dialogEl.close();
|
|
48
|
+
dialogEl.removeEventListener("transitionend", listener);
|
|
49
|
+
};
|
|
50
|
+
dialogEl.addEventListener("transitionend", listener);
|
|
51
|
+
dialogEl.style.opacity = 0;
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
const dialogEl = dialog(
|
|
55
|
+
{
|
|
56
|
+
role: "presentation",
|
|
57
|
+
class: classNames("popover", className, options?.class, props?.class),
|
|
58
|
+
onclick: (event) =>
|
|
59
|
+
event.target === dialogEl && (closeDialog(), onClose?.call()),
|
|
60
|
+
},
|
|
61
|
+
contentEl
|
|
62
|
+
);
|
|
63
|
+
|
|
64
|
+
dialogEl.closeDialog = closeDialog;
|
|
65
|
+
dialogEl.openDialog = openDialog;
|
|
66
|
+
|
|
67
|
+
return dialogEl;
|
|
68
|
+
};
|
|
69
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
declare module "@grucloud/bau-ui/select" {
|
|
2
|
+
type DefaultDesignProps = import("../constants").DefaultDesignProps;
|
|
3
|
+
type ComponentOption = import("../bau-ui").ComponentOption;
|
|
4
|
+
|
|
5
|
+
export type SelectProps = {
|
|
6
|
+
options: object[];
|
|
7
|
+
id?: string;
|
|
8
|
+
label: string;
|
|
9
|
+
getOptionLabel?: (item: object | string) => string;
|
|
10
|
+
Option: (props) => HTMLElement;
|
|
11
|
+
} & DefaultDesignProps;
|
|
12
|
+
|
|
13
|
+
type Component = import("../bau-ui").Component<SelectProps, HTMLInputElement>;
|
|
14
|
+
|
|
15
|
+
export default function (context: any, option?: ComponentOption): Component;
|
|
16
|
+
}
|
package/select/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./select";
|
package/select/select.js
ADDED
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import classNames from "@grucloud/bau-css/classNames.js";
|
|
2
|
+
import { toPropsAndChildren } from "@grucloud/bau/bau.js";
|
|
3
|
+
import popover from "../popover/popover.js";
|
|
4
|
+
import button from "../button/button.js";
|
|
5
|
+
import list from "../list/list.js";
|
|
6
|
+
|
|
7
|
+
import { Colors } from "../constants.js";
|
|
8
|
+
|
|
9
|
+
const colorsToCss = () =>
|
|
10
|
+
Colors.map(
|
|
11
|
+
(color) =>
|
|
12
|
+
`
|
|
13
|
+
& button.plain.${color}::after {
|
|
14
|
+
color: var(--color-${color});
|
|
15
|
+
}
|
|
16
|
+
& button.outline.${color}::after {
|
|
17
|
+
color: var(--color-${color});
|
|
18
|
+
}
|
|
19
|
+
`
|
|
20
|
+
).join("\n");
|
|
21
|
+
|
|
22
|
+
export default function (context, componentOptions) {
|
|
23
|
+
const { bau, css } = context;
|
|
24
|
+
const { div, li } = bau.tags;
|
|
25
|
+
const Button = button(context);
|
|
26
|
+
const Popover = popover(context);
|
|
27
|
+
const List = list(context);
|
|
28
|
+
|
|
29
|
+
const className = css`
|
|
30
|
+
& button {
|
|
31
|
+
&::after {
|
|
32
|
+
content: "\u25BC";
|
|
33
|
+
padding: 0.3rem;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
${colorsToCss()}
|
|
37
|
+
`;
|
|
38
|
+
|
|
39
|
+
const inputState = bau.state("");
|
|
40
|
+
const openState = bau.state(false);
|
|
41
|
+
const itemIndexActive = bau.state(0);
|
|
42
|
+
|
|
43
|
+
return function Select(...args) {
|
|
44
|
+
let [
|
|
45
|
+
{
|
|
46
|
+
color = "neutral",
|
|
47
|
+
variant = "outline",
|
|
48
|
+
size = "md",
|
|
49
|
+
id,
|
|
50
|
+
label,
|
|
51
|
+
Option,
|
|
52
|
+
options,
|
|
53
|
+
getOptionLabel = ({ label }) => label,
|
|
54
|
+
...props
|
|
55
|
+
},
|
|
56
|
+
...children
|
|
57
|
+
] = toPropsAndChildren(args);
|
|
58
|
+
|
|
59
|
+
const dialogOpen = () => {
|
|
60
|
+
popoverEl.openDialog();
|
|
61
|
+
popoverEl.focus();
|
|
62
|
+
openState.val = true;
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
const dialogClose = () => {
|
|
66
|
+
popoverEl.closeDialog();
|
|
67
|
+
openState.val = false;
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
const onClose = () => {
|
|
71
|
+
openState.val = false;
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
const onclickButton = (event) => {
|
|
75
|
+
if (!openState.val) {
|
|
76
|
+
dialogOpen();
|
|
77
|
+
} else {
|
|
78
|
+
dialogClose();
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
const onclickItem =
|
|
83
|
+
({ option, index }) =>
|
|
84
|
+
(event) => {
|
|
85
|
+
inputState.val = getOptionLabel(option);
|
|
86
|
+
itemIndexActive.val = index;
|
|
87
|
+
|
|
88
|
+
dialogClose();
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
const onkeydown = (event) => {
|
|
92
|
+
event.preventDefault();
|
|
93
|
+
switch (event.key) {
|
|
94
|
+
case "Escape":
|
|
95
|
+
dialogClose();
|
|
96
|
+
break;
|
|
97
|
+
case "ArrowDown":
|
|
98
|
+
if (itemIndexActive.val < options.length - 1) {
|
|
99
|
+
itemIndexActive.val++;
|
|
100
|
+
} else {
|
|
101
|
+
itemIndexActive.val = 0;
|
|
102
|
+
}
|
|
103
|
+
break;
|
|
104
|
+
case "ArrowUp":
|
|
105
|
+
if (itemIndexActive.val <= 0) {
|
|
106
|
+
itemIndexActive.val = options.length - 1;
|
|
107
|
+
} else {
|
|
108
|
+
itemIndexActive.val--;
|
|
109
|
+
}
|
|
110
|
+
break;
|
|
111
|
+
case "Enter":
|
|
112
|
+
if (openState.val) {
|
|
113
|
+
inputState.val = getOptionLabel(options[itemIndexActive.val]);
|
|
114
|
+
dialogClose();
|
|
115
|
+
} else {
|
|
116
|
+
dialogOpen();
|
|
117
|
+
}
|
|
118
|
+
break;
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
const Content = () =>
|
|
123
|
+
List(
|
|
124
|
+
{ tabindex: "0", class: classNames(color, variant) },
|
|
125
|
+
options.map((option, index) =>
|
|
126
|
+
li(
|
|
127
|
+
{
|
|
128
|
+
class: () => classNames(itemIndexActive.val == index && "active"),
|
|
129
|
+
onclick: onclickItem({ option, index }),
|
|
130
|
+
},
|
|
131
|
+
Option(option)
|
|
132
|
+
)
|
|
133
|
+
)
|
|
134
|
+
);
|
|
135
|
+
|
|
136
|
+
const buttonEl = Button(
|
|
137
|
+
{
|
|
138
|
+
type: "button",
|
|
139
|
+
role: "combobox",
|
|
140
|
+
"aria-autocomplete": "list",
|
|
141
|
+
"aria-expanded": openState,
|
|
142
|
+
"aria-label": label,
|
|
143
|
+
onclick: onclickButton,
|
|
144
|
+
color,
|
|
145
|
+
variant,
|
|
146
|
+
size,
|
|
147
|
+
},
|
|
148
|
+
() => !inputState.val && label,
|
|
149
|
+
inputState
|
|
150
|
+
);
|
|
151
|
+
|
|
152
|
+
const popoverEl = Popover({
|
|
153
|
+
id,
|
|
154
|
+
triggerEl: buttonEl,
|
|
155
|
+
contentEl: Content(),
|
|
156
|
+
onClose,
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
return div(
|
|
160
|
+
{
|
|
161
|
+
...props,
|
|
162
|
+
class: classNames(
|
|
163
|
+
"select",
|
|
164
|
+
color,
|
|
165
|
+
size,
|
|
166
|
+
className,
|
|
167
|
+
componentOptions?.class,
|
|
168
|
+
props?.class
|
|
169
|
+
),
|
|
170
|
+
onkeydown,
|
|
171
|
+
},
|
|
172
|
+
buttonEl,
|
|
173
|
+
popoverEl
|
|
174
|
+
);
|
|
175
|
+
};
|
|
176
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
declare module "@grucloud/bau-ui/slider" {
|
|
2
|
+
type DefaultDesignProps = import("../constants").DefaultDesignProps;
|
|
3
|
+
type ComponentOption = import("../bau-ui").ComponentOption;
|
|
4
|
+
|
|
5
|
+
export type SliderProps = {} & DefaultDesignProps;
|
|
6
|
+
|
|
7
|
+
type Component = import("../bau-ui").Component<SliderProps, HTMLInputElement>;
|
|
8
|
+
|
|
9
|
+
export default function (context: any, option?: ComponentOption): Component;
|
|
10
|
+
}
|
package/slider/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./slider";
|
package/slider/slider.js
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { toPropsAndChildren } from "@grucloud/bau/bau.js";
|
|
2
|
+
import classNames from "@grucloud/bau-css/classNames.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
|
+
&.slider.${color} {
|
|
14
|
+
accent-color: var(--color-${color});
|
|
15
|
+
}
|
|
16
|
+
`
|
|
17
|
+
).join("\n");
|
|
18
|
+
|
|
19
|
+
const className = css`
|
|
20
|
+
${colorsToCss()};
|
|
21
|
+
`;
|
|
22
|
+
|
|
23
|
+
return function Slider(...args) {
|
|
24
|
+
let [
|
|
25
|
+
{ color = "neutral", variant = "outline", size, ...props },
|
|
26
|
+
...children
|
|
27
|
+
] = toPropsAndChildren(args);
|
|
28
|
+
|
|
29
|
+
return input(
|
|
30
|
+
{
|
|
31
|
+
...props,
|
|
32
|
+
type: "range",
|
|
33
|
+
class: classNames(
|
|
34
|
+
"slider",
|
|
35
|
+
color,
|
|
36
|
+
variant,
|
|
37
|
+
size,
|
|
38
|
+
className,
|
|
39
|
+
|
|
40
|
+
options?.class,
|
|
41
|
+
props.class
|
|
42
|
+
),
|
|
43
|
+
},
|
|
44
|
+
...children
|
|
45
|
+
);
|
|
46
|
+
};
|
|
47
|
+
}
|
package/spinner/index.d.ts
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
declare module "@grucloud/bau-ui/spinner" {
|
|
2
|
+
type DefaultDesignProps = import("../constants").DefaultDesignProps;
|
|
3
|
+
type ComponentOption = import("../bau-ui").ComponentOption;
|
|
4
|
+
|
|
2
5
|
export type SpinnerProps = {
|
|
3
|
-
size?: Number;
|
|
4
|
-
color?: "primary" | "secondary" | "warning" | "danger" | "info" | "success";
|
|
6
|
+
//size?: Number;
|
|
7
|
+
//color?: "primary" | "secondary" | "warning" | "danger" | "info" | "success";
|
|
5
8
|
visibility?: boolean;
|
|
6
|
-
};
|
|
9
|
+
} & DefaultDesignProps;
|
|
7
10
|
|
|
8
11
|
type Component = import("../bau-ui").Component<SpinnerProps>;
|
|
9
12
|
|
|
10
|
-
export default function (context: any): Component;
|
|
13
|
+
export default function (context: any, option?: ComponentOption): Component;
|
|
11
14
|
}
|
package/spinner/spinner.js
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
import classNames from "@grucloud/bau-css/classNames";
|
|
1
|
+
import classNames from "@grucloud/bau-css/classNames.js";
|
|
2
|
+
|
|
3
|
+
const sizeToPixel = {
|
|
4
|
+
sm: 16,
|
|
5
|
+
md: 32,
|
|
6
|
+
lg: 64,
|
|
7
|
+
};
|
|
2
8
|
|
|
3
9
|
export default function (context, options = {}) {
|
|
4
10
|
const { bau, css } = context;
|
|
@@ -8,8 +14,9 @@ export default function (context, options = {}) {
|
|
|
8
14
|
);
|
|
9
15
|
|
|
10
16
|
return function Spinner({
|
|
11
|
-
size =
|
|
12
|
-
color = "
|
|
17
|
+
size = "md",
|
|
18
|
+
color = "color-base",
|
|
19
|
+
variant = "outline",
|
|
13
20
|
visibility = true,
|
|
14
21
|
...otherProps
|
|
15
22
|
} = {}) {
|
|
@@ -20,14 +27,15 @@ export default function (context, options = {}) {
|
|
|
20
27
|
visibility: ${visibility ? "visible" : "hidden"};
|
|
21
28
|
color: var(--color-${color});
|
|
22
29
|
`,
|
|
30
|
+
options.class,
|
|
23
31
|
otherProps.class
|
|
24
32
|
),
|
|
25
33
|
version: "1.1",
|
|
26
34
|
id: "L6",
|
|
27
35
|
x: "0px",
|
|
28
36
|
y: "0px",
|
|
29
|
-
width: size,
|
|
30
|
-
height: size,
|
|
37
|
+
width: sizeToPixel[size],
|
|
38
|
+
height: sizeToPixel[size],
|
|
31
39
|
viewBox: `0 0 100 100`,
|
|
32
40
|
enableBackground: `new 0 0 100 100`,
|
|
33
41
|
},
|
package/switch/index.d.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
declare module "@grucloud/bau-ui/switch" {
|
|
2
|
-
|
|
2
|
+
type DefaultDesignProps = import("../constants").DefaultDesignProps;
|
|
3
|
+
type ComponentOption = import("../bau-ui").ComponentOption;
|
|
4
|
+
|
|
5
|
+
export type SwitchProps = {} & DefaultDesignProps;
|
|
3
6
|
|
|
4
7
|
type Component = import("../bau-ui").Component<SwitchProps, HTMLInputElement>;
|
|
5
8
|
|
|
6
|
-
export default function (context: any): Component;
|
|
9
|
+
export default function (context: any, option?: ComponentOption): Component;
|
|
7
10
|
}
|
package/switch/switch.js
CHANGED
|
@@ -1,46 +1,129 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { toPropsAndChildren } from "@grucloud/bau/bau.js";
|
|
2
|
+
import classNames from "@grucloud/bau-css/classNames.js";
|
|
3
|
+
import { Colors } from "../constants.js";
|
|
2
4
|
|
|
3
|
-
|
|
5
|
+
const colorsToCss = () =>
|
|
6
|
+
Colors.map(
|
|
7
|
+
(color) =>
|
|
8
|
+
`
|
|
9
|
+
&.switch.plain.${color} {
|
|
10
|
+
&::after {
|
|
11
|
+
background-color: var(--color-emphasis-400);
|
|
12
|
+
}
|
|
13
|
+
&:checked::after {
|
|
14
|
+
background-color: var(--color-${color});
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
&.switch.outline.${color} {
|
|
18
|
+
&::after {
|
|
19
|
+
background-color: var(--color-emphasis-400);
|
|
20
|
+
}
|
|
21
|
+
&:checked::after {
|
|
22
|
+
background-color: var(--color-${color});
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
&.switch.soft.${color} {
|
|
26
|
+
&::after {
|
|
27
|
+
background-color: var(--color-emphasis-400);
|
|
28
|
+
}
|
|
29
|
+
&:checked::after {
|
|
30
|
+
background-color: var(--color-${color});
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
&.switch.solid.${color} {
|
|
34
|
+
background-color: var(--color-emphasis-800);
|
|
35
|
+
&::after {
|
|
36
|
+
background-color: var(--color-emphasis-400);
|
|
37
|
+
}
|
|
38
|
+
&:checked {
|
|
39
|
+
background-color: var(--color-${color}) ;
|
|
40
|
+
}
|
|
41
|
+
&:checked::after {
|
|
42
|
+
background-color: var(--color-emphasis-400);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
`
|
|
46
|
+
).join("\n");
|
|
47
|
+
|
|
48
|
+
export default function (context, options) {
|
|
4
49
|
const { bau, css } = context;
|
|
5
50
|
const { input } = bau.tags;
|
|
6
51
|
|
|
7
52
|
const style = css`
|
|
8
53
|
position: relative;
|
|
9
|
-
|
|
10
|
-
height: 1rem;
|
|
11
|
-
background-color: var(--color-gray-300);
|
|
12
|
-
border-radius: var(--global-radius);
|
|
54
|
+
border-radius: 0.7rem;
|
|
13
55
|
appearance: none;
|
|
14
56
|
outline: none;
|
|
15
57
|
transition: all var(--transition-fast);
|
|
16
58
|
box-shadow: var(--shadow-m);
|
|
17
59
|
&::after {
|
|
18
60
|
content: "";
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
height: 1rem;
|
|
61
|
+
transform: translate(-100%, -50%);
|
|
62
|
+
left: 50%;
|
|
63
|
+
top: 50%;
|
|
23
64
|
border-radius: 50%;
|
|
24
65
|
position: absolute;
|
|
25
66
|
box-shadow: var(--shadow-m);
|
|
26
|
-
background-color: var(--color-gray-700);
|
|
27
67
|
transition: all var(--transition-fast);
|
|
28
|
-
|
|
29
|
-
&:checked {
|
|
30
|
-
background-color: var(--color-primary-lighter);
|
|
68
|
+
background-color: var(--color-emphasis-800);
|
|
31
69
|
}
|
|
32
70
|
&:checked::after {
|
|
33
71
|
content: "";
|
|
34
|
-
transform:
|
|
35
|
-
|
|
72
|
+
transform: translate(0%, -50%);
|
|
73
|
+
}
|
|
74
|
+
&:hover {
|
|
75
|
+
filter: brightness(var(--brightness-hover));
|
|
76
|
+
}
|
|
77
|
+
&:hover.solid {
|
|
78
|
+
filter: brightness(var(--brightness-hover-always));
|
|
36
79
|
}
|
|
80
|
+
&.sm {
|
|
81
|
+
width: 2rem;
|
|
82
|
+
height: 1.2rem;
|
|
83
|
+
border-radius: 0.6rem;
|
|
84
|
+
}
|
|
85
|
+
&.sm::after {
|
|
86
|
+
width: 0.8rem;
|
|
87
|
+
height: 0.8rem;
|
|
88
|
+
}
|
|
89
|
+
&.md {
|
|
90
|
+
width: 2.4rem;
|
|
91
|
+
height: 1.4rem;
|
|
92
|
+
border-radius: 0.7rem;
|
|
93
|
+
}
|
|
94
|
+
&.md::after {
|
|
95
|
+
width: 1rem;
|
|
96
|
+
height: 1rem;
|
|
97
|
+
}
|
|
98
|
+
&.lg {
|
|
99
|
+
width: 3.3rem;
|
|
100
|
+
height: 1.7rem;
|
|
101
|
+
border-radius: 2rem;
|
|
102
|
+
}
|
|
103
|
+
&.lg::after {
|
|
104
|
+
width: 1.5rem;
|
|
105
|
+
height: 1.5rem;
|
|
106
|
+
}
|
|
107
|
+
${colorsToCss()}
|
|
37
108
|
`;
|
|
38
109
|
|
|
39
|
-
return function Switch(
|
|
110
|
+
return function Switch(...args) {
|
|
111
|
+
let [
|
|
112
|
+
{ color = "neutral", variant = "plain", size = "md", ...props },
|
|
113
|
+
...children
|
|
114
|
+
] = toPropsAndChildren(args);
|
|
40
115
|
return input(
|
|
41
116
|
{
|
|
42
117
|
...props,
|
|
43
|
-
class: classNames(
|
|
118
|
+
class: classNames(
|
|
119
|
+
"switch",
|
|
120
|
+
style,
|
|
121
|
+
color,
|
|
122
|
+
variant,
|
|
123
|
+
size,
|
|
124
|
+
options?.class,
|
|
125
|
+
props.class
|
|
126
|
+
),
|
|
44
127
|
type: "checkbox",
|
|
45
128
|
required: "required",
|
|
46
129
|
},
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
declare module "@grucloud/bau-ui/tableContainer" {
|
|
2
|
+
type ComponentOption = import("../bau-ui").ComponentOption;
|
|
3
|
+
|
|
4
|
+
export type TableProps = {};
|
|
5
|
+
|
|
6
|
+
type Component = import("../bau-ui").Component<TableProps>;
|
|
7
|
+
|
|
8
|
+
export default function (context: any, option?: ComponentOption): Component;
|
|
9
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./tableContainer";
|
|
@@ -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, createGlobalStyles } = context;
|
|
6
|
+
const { div } = bau.tags;
|
|
7
|
+
|
|
8
|
+
createGlobalStyles`
|
|
9
|
+
:root {
|
|
10
|
+
--table-cell-padding: 0.75rem;
|
|
11
|
+
--table-background: transparent;
|
|
12
|
+
--table-stripe-background: rgba(0, 0, 0, 0.03);
|
|
13
|
+
--table-border-width: 1px;
|
|
14
|
+
--table-border-color: var(--color-emphasis-300);
|
|
15
|
+
--table-head-background: inherit;
|
|
16
|
+
--table-head-color: inherit;
|
|
17
|
+
--table-cell-color: inherit;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
table {
|
|
21
|
+
border-collapse: collapse;
|
|
22
|
+
display: table;
|
|
23
|
+
|
|
24
|
+
& thead, tr {
|
|
25
|
+
border-bottom: var(--table-border-width) solid var(--table-border-color);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
& tr {
|
|
29
|
+
background-color: var(--table-background);
|
|
30
|
+
}
|
|
31
|
+
& tr:last-child {
|
|
32
|
+
border-bottom: none
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
& td, th {
|
|
36
|
+
padding: var(--table-cell-padding);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
& th {
|
|
40
|
+
background-color: var(--table-head-background);
|
|
41
|
+
color: var(--table-head-color);
|
|
42
|
+
font-weight: var(--font-weight-semibold);
|
|
43
|
+
text-overflow: ellipsis;
|
|
44
|
+
white-space: nowrap;
|
|
45
|
+
overflow: hidden;
|
|
46
|
+
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
& td {
|
|
50
|
+
color: var(--table-cell-color);
|
|
51
|
+
font-size: 0.875rem;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
`;
|
|
55
|
+
|
|
56
|
+
const className = css`
|
|
57
|
+
display: inline-block;
|
|
58
|
+
border: 1px solid var(--color-emphasis-50);
|
|
59
|
+
box-shadow: var(--shadow-s);
|
|
60
|
+
border-radius: var(--global-radius);
|
|
61
|
+
`;
|
|
62
|
+
|
|
63
|
+
return function TableContainer(...args) {
|
|
64
|
+
let [{ ...props }, ...children] = toPropsAndChildren(args);
|
|
65
|
+
return div(
|
|
66
|
+
{
|
|
67
|
+
...props,
|
|
68
|
+
class: classNames(
|
|
69
|
+
"table-container",
|
|
70
|
+
className,
|
|
71
|
+
options?.class,
|
|
72
|
+
props?.class
|
|
73
|
+
),
|
|
74
|
+
},
|
|
75
|
+
...children
|
|
76
|
+
);
|
|
77
|
+
};
|
|
78
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
declare module "@grucloud/bau-ui/tablePagination" {
|
|
2
|
+
type ComponentOption = import("../bau-ui").ComponentOption;
|
|
3
|
+
|
|
4
|
+
export type onPageChange = ({ page: Number }) => (event: Event) => void;
|
|
5
|
+
|
|
6
|
+
export type TablePaginationProps = {
|
|
7
|
+
count: number;
|
|
8
|
+
page: number;
|
|
9
|
+
rowsPerPage: number;
|
|
10
|
+
isLoading?: boolean;
|
|
11
|
+
onPageChange: onPageChange;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
type Component = import("../bau-ui").Component<TablePaginationProps>;
|
|
15
|
+
|
|
16
|
+
export default function (context: any, option?: ComponentOption): Component;
|
|
17
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./tablePagination";
|