@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
|
@@ -0,0 +1,222 @@
|
|
|
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 input from "../input/input.js";
|
|
6
|
+
import list from "../list/list.js";
|
|
7
|
+
|
|
8
|
+
import { Colors } from "../constants.js";
|
|
9
|
+
|
|
10
|
+
const colorsToCss = () =>
|
|
11
|
+
Colors.map(
|
|
12
|
+
(color) =>
|
|
13
|
+
`
|
|
14
|
+
& button.plain.${color}::after {
|
|
15
|
+
color: var(--color-${color});
|
|
16
|
+
}
|
|
17
|
+
& button.outline.${color}::after {
|
|
18
|
+
color: var(--color-${color});
|
|
19
|
+
}
|
|
20
|
+
`
|
|
21
|
+
).join("\n");
|
|
22
|
+
|
|
23
|
+
export default function (context, componentOptions) {
|
|
24
|
+
const { bau, css } = context;
|
|
25
|
+
const { div, li, ul } = bau.tags;
|
|
26
|
+
|
|
27
|
+
const Popover = popover(context);
|
|
28
|
+
const Button = button(context);
|
|
29
|
+
const Input = input(context);
|
|
30
|
+
const List = list(context);
|
|
31
|
+
|
|
32
|
+
const className = css`
|
|
33
|
+
& button {
|
|
34
|
+
&::after {
|
|
35
|
+
content: "\u25BC";
|
|
36
|
+
padding: 0 0.3rem;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
& .content {
|
|
40
|
+
height: fit-content;
|
|
41
|
+
& input {
|
|
42
|
+
padding: 0.8rem;
|
|
43
|
+
margin: 0.3rem;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
${colorsToCss()}
|
|
48
|
+
`;
|
|
49
|
+
|
|
50
|
+
const selectedState = bau.state("");
|
|
51
|
+
const inputState = bau.state("");
|
|
52
|
+
const openState = bau.state(false);
|
|
53
|
+
const itemIndexActive = bau.state(0);
|
|
54
|
+
|
|
55
|
+
const onClose = () => {
|
|
56
|
+
openState.val = false;
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
return function AutoComplete(...args) {
|
|
60
|
+
let [
|
|
61
|
+
{
|
|
62
|
+
variant = "outline",
|
|
63
|
+
color,
|
|
64
|
+
size = "md",
|
|
65
|
+
id,
|
|
66
|
+
label,
|
|
67
|
+
placeholder,
|
|
68
|
+
Option,
|
|
69
|
+
options,
|
|
70
|
+
getOptionLabel = ({ label }) => label,
|
|
71
|
+
...props
|
|
72
|
+
},
|
|
73
|
+
...children
|
|
74
|
+
] = toPropsAndChildren(args);
|
|
75
|
+
|
|
76
|
+
const optionsFilteredState = bau.state(options);
|
|
77
|
+
|
|
78
|
+
const dialogOpen = () => {
|
|
79
|
+
popoverEl.openDialog();
|
|
80
|
+
openState.val = true;
|
|
81
|
+
inputState.val = "";
|
|
82
|
+
optionsFilteredState.val = options;
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
const dialogClose = () => {
|
|
86
|
+
popoverEl.closeDialog();
|
|
87
|
+
openState.val = false;
|
|
88
|
+
inputState.val = "";
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
const oninput = (event) => {
|
|
92
|
+
const { value } = event.target;
|
|
93
|
+
inputState.val = value;
|
|
94
|
+
if (value) {
|
|
95
|
+
optionsFilteredState.val = options.filter((option) =>
|
|
96
|
+
getOptionLabel(option).match(new RegExp(`${value}`, "i"))
|
|
97
|
+
);
|
|
98
|
+
} else {
|
|
99
|
+
optionsFilteredState.val = options;
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
const onclickButton = (event) => {
|
|
104
|
+
if (!openState.val) {
|
|
105
|
+
dialogOpen();
|
|
106
|
+
} else {
|
|
107
|
+
dialogClose();
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
const onclickItem =
|
|
112
|
+
({ option, index }) =>
|
|
113
|
+
(event) => {
|
|
114
|
+
selectedState.val = getOptionLabel(option);
|
|
115
|
+
itemIndexActive.val = index;
|
|
116
|
+
dialogClose();
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
const onkeydown = (event) => {
|
|
120
|
+
console.log("onkeydown", event.key, itemIndexActive.val);
|
|
121
|
+
switch (event.key) {
|
|
122
|
+
case "Escape":
|
|
123
|
+
dialogClose();
|
|
124
|
+
break;
|
|
125
|
+
case "ArrowDown":
|
|
126
|
+
if (itemIndexActive.val < optionsFilteredState.val.length - 1) {
|
|
127
|
+
itemIndexActive.val++;
|
|
128
|
+
} else {
|
|
129
|
+
itemIndexActive.val = 0;
|
|
130
|
+
}
|
|
131
|
+
break;
|
|
132
|
+
case "ArrowUp":
|
|
133
|
+
if (itemIndexActive.val <= 0) {
|
|
134
|
+
itemIndexActive.val = optionsFilteredState.val.length - 1;
|
|
135
|
+
} else {
|
|
136
|
+
itemIndexActive.val--;
|
|
137
|
+
}
|
|
138
|
+
break;
|
|
139
|
+
case "Enter":
|
|
140
|
+
selectedState.val = getOptionLabel(
|
|
141
|
+
optionsFilteredState.val[itemIndexActive.val]
|
|
142
|
+
);
|
|
143
|
+
inputState.val = "";
|
|
144
|
+
dialogClose();
|
|
145
|
+
break;
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
const buttonEl = Button(
|
|
150
|
+
{
|
|
151
|
+
type: "button",
|
|
152
|
+
role: "combobox",
|
|
153
|
+
"aria-autocomplete": "list",
|
|
154
|
+
"aria-expanded": openState,
|
|
155
|
+
"aria-label": label,
|
|
156
|
+
onclick: onclickButton,
|
|
157
|
+
variant,
|
|
158
|
+
color,
|
|
159
|
+
size,
|
|
160
|
+
},
|
|
161
|
+
() => !selectedState.val && label,
|
|
162
|
+
selectedState
|
|
163
|
+
);
|
|
164
|
+
|
|
165
|
+
const inputEl = Input({
|
|
166
|
+
id,
|
|
167
|
+
value: inputState,
|
|
168
|
+
placeholder,
|
|
169
|
+
autofocus: true,
|
|
170
|
+
type: "search",
|
|
171
|
+
autocomplete: "new-password",
|
|
172
|
+
autocapitalize: "none",
|
|
173
|
+
spellcheck: false,
|
|
174
|
+
role: "combobox",
|
|
175
|
+
"aria-autocomplete": "list",
|
|
176
|
+
"aria-expanded": openState,
|
|
177
|
+
oninput,
|
|
178
|
+
onkeydown,
|
|
179
|
+
variant,
|
|
180
|
+
color,
|
|
181
|
+
size,
|
|
182
|
+
});
|
|
183
|
+
|
|
184
|
+
const Content = () =>
|
|
185
|
+
div({ class: classNames(variant, color, size, "content") }, inputEl, () =>
|
|
186
|
+
List(
|
|
187
|
+
{ class: classNames(variant, color, size) },
|
|
188
|
+
optionsFilteredState.val.map((option, index) =>
|
|
189
|
+
li(
|
|
190
|
+
{
|
|
191
|
+
class: () =>
|
|
192
|
+
classNames(itemIndexActive.val == index && "active"),
|
|
193
|
+
onclick: onclickItem({ option, index }),
|
|
194
|
+
},
|
|
195
|
+
Option(option)
|
|
196
|
+
)
|
|
197
|
+
)
|
|
198
|
+
)
|
|
199
|
+
);
|
|
200
|
+
|
|
201
|
+
const popoverEl = Popover({
|
|
202
|
+
id,
|
|
203
|
+
triggerEl: buttonEl,
|
|
204
|
+
contentEl: Content(),
|
|
205
|
+
onClose,
|
|
206
|
+
});
|
|
207
|
+
|
|
208
|
+
return div(
|
|
209
|
+
{
|
|
210
|
+
...props,
|
|
211
|
+
class: classNames(
|
|
212
|
+
"autocomplete",
|
|
213
|
+
className,
|
|
214
|
+
componentOptions?.class,
|
|
215
|
+
props?.class
|
|
216
|
+
),
|
|
217
|
+
},
|
|
218
|
+
buttonEl,
|
|
219
|
+
popoverEl
|
|
220
|
+
);
|
|
221
|
+
};
|
|
222
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
declare module "@grucloud/bau-ui/autocomplete" {
|
|
2
|
+
type DefaultDesignProps = import("../constants").DefaultDesignProps;
|
|
3
|
+
type ComponentOption = import("../bau-ui").ComponentOption;
|
|
4
|
+
|
|
5
|
+
export type Autocomplete = {
|
|
6
|
+
options: object[];
|
|
7
|
+
id: string;
|
|
8
|
+
label: string;
|
|
9
|
+
placeholder: string;
|
|
10
|
+
size?: string;
|
|
11
|
+
getOptionLabel?: (item: object | string) => string;
|
|
12
|
+
Option: (props) => HTMLElement;
|
|
13
|
+
} & DefaultDesignProps;
|
|
14
|
+
|
|
15
|
+
type Component = import("../bau-ui").Component<
|
|
16
|
+
Autocomplete,
|
|
17
|
+
HTMLInputElement
|
|
18
|
+
>;
|
|
19
|
+
|
|
20
|
+
export default function (context: any, option?: ComponentOption): Component;
|
|
21
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./autocomplete";
|
package/avatar/avatar.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { toPropsAndChildren } from "@grucloud/bau/bau.js";
|
|
2
|
+
import classNames from "@grucloud/bau-css/classNames.js";
|
|
2
3
|
|
|
3
|
-
export default function (context, options
|
|
4
|
-
const { bau } = context;
|
|
4
|
+
export default function (context, options) {
|
|
5
|
+
const { bau, css } = context;
|
|
5
6
|
const { span, img } = bau.tags;
|
|
6
7
|
|
|
7
8
|
const loadingState = bau.state(true);
|
|
@@ -14,12 +15,51 @@ export default function (context, options = {}) {
|
|
|
14
15
|
errorState.val = true;
|
|
15
16
|
};
|
|
16
17
|
|
|
17
|
-
|
|
18
|
+
const className = css`
|
|
19
|
+
&.sm {
|
|
20
|
+
width: 20px;
|
|
21
|
+
height: 20px;
|
|
22
|
+
}
|
|
23
|
+
&.md {
|
|
24
|
+
width: 40px;
|
|
25
|
+
height: 40px;
|
|
26
|
+
}
|
|
27
|
+
&.lg {
|
|
28
|
+
width: 60px;
|
|
29
|
+
height: 60px;
|
|
30
|
+
}
|
|
31
|
+
`;
|
|
32
|
+
return function Avatar(...args) {
|
|
33
|
+
let [
|
|
34
|
+
{
|
|
35
|
+
color,
|
|
36
|
+
variant = "outline",
|
|
37
|
+
size = "md",
|
|
38
|
+
width = 30,
|
|
39
|
+
height = 30,
|
|
40
|
+
...props
|
|
41
|
+
},
|
|
42
|
+
...children
|
|
43
|
+
] = toPropsAndChildren(args);
|
|
18
44
|
return span(
|
|
19
|
-
{ class: classNames(options
|
|
45
|
+
{ class: classNames(className, options?.class, props.class) },
|
|
20
46
|
() => (loadingState.val ? "Loading..." : ""),
|
|
21
47
|
() => errorState.val && "Error",
|
|
22
|
-
img({
|
|
48
|
+
img({
|
|
49
|
+
width,
|
|
50
|
+
height,
|
|
51
|
+
onload,
|
|
52
|
+
onerror,
|
|
53
|
+
class: classNames(
|
|
54
|
+
color,
|
|
55
|
+
variant,
|
|
56
|
+
size,
|
|
57
|
+
className,
|
|
58
|
+
options?.class,
|
|
59
|
+
props.class
|
|
60
|
+
),
|
|
61
|
+
...props,
|
|
62
|
+
})
|
|
23
63
|
);
|
|
24
64
|
};
|
|
25
65
|
}
|
package/avatar/index.d.ts
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
declare module "@grucloud/bau-ui/avatar" {
|
|
2
|
+
type DefaultDesignProps = import("../constants").DefaultDesignProps;
|
|
3
|
+
type ComponentOption = import("../bau-ui").ComponentOption;
|
|
4
|
+
|
|
2
5
|
export type AvatarProps = {
|
|
3
6
|
class?: string;
|
|
4
7
|
alt: string;
|
|
5
8
|
src: string;
|
|
6
9
|
width?: Number;
|
|
7
10
|
height?: Number;
|
|
8
|
-
};
|
|
11
|
+
} & DefaultDesignProps;
|
|
9
12
|
|
|
10
13
|
type Component = import("../bau-ui").Component<AvatarProps>;
|
|
11
14
|
|
|
12
|
-
export default function (context: any): Component;
|
|
15
|
+
export default function (context: any, option?: ComponentOption): Component;
|
|
13
16
|
}
|
package/badge/badge.js
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
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 { span } = bau.tags;
|
|
7
|
+
|
|
8
|
+
const className = css`
|
|
9
|
+
position: relative;
|
|
10
|
+
& span {
|
|
11
|
+
display: block;
|
|
12
|
+
position: absolute;
|
|
13
|
+
display: flex;
|
|
14
|
+
align-items: center;
|
|
15
|
+
justify-content: center;
|
|
16
|
+
top: 0;
|
|
17
|
+
right: 0;
|
|
18
|
+
font-size: 0.75rem;
|
|
19
|
+
font-weight: 600;
|
|
20
|
+
transform: scale(1) translate(100%, -50%);
|
|
21
|
+
transform-origin: 100% 0%;
|
|
22
|
+
padding: 0.2rem;
|
|
23
|
+
border-radius: 1rem;
|
|
24
|
+
min-width: 1rem;
|
|
25
|
+
height: 1rem;
|
|
26
|
+
}
|
|
27
|
+
`;
|
|
28
|
+
|
|
29
|
+
return function Badge(...args) {
|
|
30
|
+
let [
|
|
31
|
+
{ color, variant = "outline", size = "md", content, ...props },
|
|
32
|
+
...children
|
|
33
|
+
] = toPropsAndChildren(args);
|
|
34
|
+
return span(
|
|
35
|
+
{
|
|
36
|
+
...props,
|
|
37
|
+
class: classNames("badge", className, options?.class, props?.class),
|
|
38
|
+
},
|
|
39
|
+
span({ class: classNames(color, variant, size) }, content),
|
|
40
|
+
...children
|
|
41
|
+
);
|
|
42
|
+
};
|
|
43
|
+
}
|
package/badge/index.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
declare module "@grucloud/bau-ui/badge" {
|
|
2
|
+
type DefaultDesignProps = import("../constants").DefaultDesignProps;
|
|
3
|
+
type ComponentOption = import("../bau-ui").ComponentOption;
|
|
4
|
+
|
|
5
|
+
export type BadgeProps = {
|
|
6
|
+
content: string;
|
|
7
|
+
} & DefaultDesignProps;
|
|
8
|
+
|
|
9
|
+
type Component = import("../bau-ui").Component<BadgeProps>;
|
|
10
|
+
|
|
11
|
+
export default function (context: any, option?: ComponentOption): Component;
|
|
12
|
+
}
|
package/badge/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./badge";
|
package/bau-ui.d.ts
CHANGED
|
@@ -1,22 +1,29 @@
|
|
|
1
|
-
type Props = import("@grucloud/bau").Props;
|
|
2
1
|
type ChildDom = import("@grucloud/bau").ChildDom;
|
|
3
2
|
|
|
4
|
-
export type Component<
|
|
5
|
-
|
|
3
|
+
export type Component<
|
|
4
|
+
TProps extends Object,
|
|
5
|
+
TElement = HTMLElement,
|
|
6
|
+
TAction = {}
|
|
7
|
+
> = (
|
|
8
|
+
props?: TProps & import("@grucloud/bau").PropsAll<TElement>,
|
|
6
9
|
...rest: readonly ChildDom[]
|
|
7
|
-
) => TElement;
|
|
10
|
+
) => TElement & TAction;
|
|
8
11
|
|
|
9
12
|
export type ComponentWithProp<TProps, TElement = HTMLElement> = (
|
|
10
|
-
props:
|
|
13
|
+
props: TProps & import("@grucloud/bau").PropsAll<TElement>,
|
|
11
14
|
...rest: readonly ChildDom[]
|
|
12
15
|
) => TElement | string | number | boolean | bigint | null | undefined;
|
|
13
16
|
|
|
14
17
|
export type ComponentOneChild<TProps, TElement = HTMLElement> = (
|
|
15
|
-
props: TProps &
|
|
18
|
+
props: TProps & import("@grucloud/bau").PropsAll<TElement>,
|
|
16
19
|
child: ChildDom
|
|
17
20
|
) => TElement;
|
|
18
21
|
|
|
19
22
|
export type ComponentGeneric = (
|
|
20
|
-
props?: Props
|
|
23
|
+
props?: import("@grucloud/bau").Props<HTMLElementHTMLElement>,
|
|
21
24
|
...rest: readonly ChildDom[]
|
|
22
25
|
) => HTMLElement | string | number | boolean | bigint | null | undefined;
|
|
26
|
+
|
|
27
|
+
export type ComponentOption = {
|
|
28
|
+
class?: string;
|
|
29
|
+
};
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
+
import { toPropsAndChildren } from "@grucloud/bau/bau.js";
|
|
1
2
|
import classNames from "@grucloud/bau-css/classNames.js";
|
|
3
|
+
import button from "../button/button.js";
|
|
2
4
|
|
|
3
|
-
export default function (context) {
|
|
5
|
+
export default function (context, options) {
|
|
4
6
|
const { bau, css } = context;
|
|
5
7
|
const { ul, li, a, span } = bau.tags;
|
|
6
8
|
|
|
9
|
+
const Button = button(context);
|
|
10
|
+
|
|
7
11
|
const className = css`
|
|
8
12
|
list-style: none;
|
|
9
13
|
display: flex;
|
|
@@ -35,14 +39,34 @@ export default function (context) {
|
|
|
35
39
|
}
|
|
36
40
|
}
|
|
37
41
|
`;
|
|
38
|
-
|
|
42
|
+
|
|
43
|
+
return function Breadcrumbs(...args) {
|
|
44
|
+
let [
|
|
45
|
+
{ color, variant = "outline", size = "md", items, ...props },
|
|
46
|
+
...children
|
|
47
|
+
] = toPropsAndChildren(args);
|
|
39
48
|
return ul(
|
|
40
49
|
{
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
50
|
+
...props,
|
|
51
|
+
// color,
|
|
52
|
+
// variant,
|
|
53
|
+
// size,
|
|
54
|
+
class: classNames(className, options?.class, props?.class),
|
|
44
55
|
},
|
|
45
|
-
items.map(({ href, name }) =>
|
|
56
|
+
items.map(({ href, name }) =>
|
|
57
|
+
li(
|
|
58
|
+
(href ? Button : span)(
|
|
59
|
+
{
|
|
60
|
+
href,
|
|
61
|
+
color,
|
|
62
|
+
variant,
|
|
63
|
+
size,
|
|
64
|
+
class: classNames(color, variant, size),
|
|
65
|
+
},
|
|
66
|
+
name
|
|
67
|
+
)
|
|
68
|
+
)
|
|
69
|
+
)
|
|
46
70
|
);
|
|
47
71
|
};
|
|
48
72
|
}
|
package/breadcrumbs/index.d.ts
CHANGED
|
@@ -1,13 +1,19 @@
|
|
|
1
1
|
declare module "@grucloud/bau-ui/breadcrumbs" {
|
|
2
|
+
type DefaultDesignProps = import("../constants").DefaultDesignProps;
|
|
3
|
+
type ComponentOption = import("../bau-ui").ComponentOption;
|
|
4
|
+
|
|
2
5
|
export type BreadcrumbsProps = {
|
|
3
6
|
separator?: string;
|
|
4
7
|
//TODO
|
|
5
8
|
items: any[];
|
|
6
|
-
};
|
|
9
|
+
} & DefaultDesignProps;
|
|
7
10
|
|
|
8
11
|
type Component = import("../bau-ui").Component<BreadcrumbsProps>;
|
|
9
12
|
|
|
10
13
|
type ComponentGeneric = import("../bau-ui").ComponentGeneric;
|
|
11
14
|
|
|
12
|
-
export default function (
|
|
15
|
+
export default function (
|
|
16
|
+
context: Object,
|
|
17
|
+
options?: ComponentOption
|
|
18
|
+
): Component;
|
|
13
19
|
}
|
package/button/button.js
CHANGED
|
@@ -1,150 +1,83 @@
|
|
|
1
|
+
import { toPropsAndChildren } from "@grucloud/bau/bau.js";
|
|
1
2
|
import classNames from "@grucloud/bau-css/classNames.js";
|
|
2
3
|
|
|
3
|
-
export default function (context) {
|
|
4
|
+
export default function (context, options) {
|
|
4
5
|
const { bau, css } = context;
|
|
5
6
|
|
|
6
7
|
const styles = {
|
|
7
8
|
root: css`
|
|
8
|
-
color:
|
|
9
|
+
color: inherit;
|
|
9
10
|
display: inline-flex;
|
|
10
11
|
align-items: center;
|
|
11
12
|
justify-content: center;
|
|
12
|
-
position: relative;
|
|
13
|
-
padding: 0 0.5rem;
|
|
14
13
|
min-width: 2rem;
|
|
15
14
|
min-height: 2rem;
|
|
16
|
-
outline: none;
|
|
17
15
|
border: none;
|
|
18
16
|
border-radius: var(--global-radius);
|
|
19
|
-
background: transparent;
|
|
20
|
-
font-size: 1rem;
|
|
21
17
|
font-weight: var(--font-weight-semibold);
|
|
22
18
|
text-align: center;
|
|
23
19
|
text-decoration: none;
|
|
24
|
-
text-transform: uppercase;
|
|
25
20
|
overflow: hidden;
|
|
26
21
|
box-sizing: border-box;
|
|
27
22
|
user-select: none;
|
|
28
|
-
transition:
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
left: calc(50% - 100%);
|
|
34
|
-
width: 200%;
|
|
35
|
-
height: 200%;
|
|
36
|
-
transition: opacity var(--transition-fast) linear;
|
|
37
|
-
border-radius: 50%;
|
|
38
|
-
opacity: 0;
|
|
39
|
-
pointer-events: none;
|
|
40
|
-
content: "";
|
|
23
|
+
transition: all var(--transition-slow);
|
|
24
|
+
|
|
25
|
+
&.outline,
|
|
26
|
+
&.solid {
|
|
27
|
+
box-shadow: var(--shadow-m);
|
|
41
28
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}
|
|
29
|
+
&.outline:hover,
|
|
30
|
+
&.solid:hover {
|
|
31
|
+
box-shadow: var(--shadow-lg);
|
|
46
32
|
}
|
|
47
33
|
&:hover {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
34
|
+
filter: brightness(var(--brightness-hover));
|
|
35
|
+
}
|
|
36
|
+
&:hover.solid {
|
|
37
|
+
filter: brightness(var(--brightness-hover-always));
|
|
38
|
+
}
|
|
39
|
+
&.sm {
|
|
40
|
+
padding: 0.3rem;
|
|
41
|
+
}
|
|
42
|
+
&.md {
|
|
43
|
+
padding: 0.5rem;
|
|
44
|
+
}
|
|
45
|
+
&.lg {
|
|
46
|
+
padding: 0.7rem 2rem;
|
|
51
47
|
}
|
|
52
48
|
`,
|
|
53
49
|
button: css`
|
|
54
50
|
cursor: pointer;
|
|
55
51
|
`,
|
|
56
52
|
a: css``,
|
|
57
|
-
flat: css`
|
|
58
|
-
border-width: 0;
|
|
59
|
-
`,
|
|
60
|
-
flatPrimary: css`
|
|
61
|
-
color: var(--color-primary);
|
|
62
|
-
`,
|
|
63
|
-
flatAccent: css`
|
|
64
|
-
color: var(--color-secondary-darkest);
|
|
65
|
-
`,
|
|
66
|
-
raised: css`
|
|
67
|
-
box-shadow: var(--shadow-s);
|
|
68
|
-
&:active {
|
|
69
|
-
box-shadow: var(--shadow-m);
|
|
70
|
-
}
|
|
71
|
-
`,
|
|
72
|
-
raisedPrimary: css`
|
|
73
|
-
background-color: var(--color-primary-darkest);
|
|
74
|
-
color: var(--color-content-inverse);
|
|
75
|
-
`,
|
|
76
|
-
raisedAccent: css`
|
|
77
|
-
background-color: var(--color-secondary-darkest);
|
|
78
|
-
color: var(--color-content-inverse);
|
|
79
|
-
`,
|
|
80
53
|
disabled: css`
|
|
81
54
|
color: rgba(0, 0, 0, 0.26);
|
|
82
|
-
cursor:
|
|
55
|
+
cursor: not-allowed;
|
|
83
56
|
pointer-events: none;
|
|
84
|
-
box-shadow: none;
|
|
85
|
-
`,
|
|
86
|
-
raisedDisabled: css`
|
|
87
|
-
background-color: rgba(0, 0, 0, 0.12);
|
|
88
|
-
`,
|
|
89
|
-
fullWidth: css`
|
|
90
|
-
text-align: center;
|
|
91
|
-
width: 100%;
|
|
92
|
-
`,
|
|
93
|
-
ripple: css`
|
|
94
|
-
position: relative;
|
|
95
|
-
overflow: hidden;
|
|
96
|
-
transform: translate3d(0, 0, 0);
|
|
97
|
-
&::after {
|
|
98
|
-
content: "";
|
|
99
|
-
display: block;
|
|
100
|
-
position: absolute;
|
|
101
|
-
width: 100%;
|
|
102
|
-
height: 100%;
|
|
103
|
-
top: 0;
|
|
104
|
-
left: 0;
|
|
105
|
-
pointer-events: none;
|
|
106
|
-
background-image: radial-gradient(circle, #000 10%, transparent 10%);
|
|
107
|
-
background-repeat: no-repeat;
|
|
108
|
-
background-position: 50%;
|
|
109
|
-
transform: scale(10, 10);
|
|
110
|
-
opacity: 0;
|
|
111
|
-
transition: transform var(--transition-slow), opacity 1s;
|
|
112
|
-
}
|
|
113
|
-
&:active::after {
|
|
114
|
-
transform: scale(0, 0);
|
|
115
|
-
opacity: 0.2;
|
|
116
|
-
transition: 0s;
|
|
117
|
-
}
|
|
118
57
|
`,
|
|
119
58
|
};
|
|
120
59
|
|
|
121
|
-
return function Button(
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
disabled,
|
|
127
|
-
ripple,
|
|
128
|
-
href,
|
|
129
|
-
icon,
|
|
130
|
-
...otherProps
|
|
131
|
-
} = props;
|
|
60
|
+
return function Button(...args) {
|
|
61
|
+
let [
|
|
62
|
+
{ color, variant, size = "md", disabled, href, ...props },
|
|
63
|
+
...children
|
|
64
|
+
] = toPropsAndChildren(args);
|
|
132
65
|
const tagButton = href ? bau.tags.a : bau.tags.button;
|
|
133
66
|
return tagButton(
|
|
134
67
|
{
|
|
135
|
-
...
|
|
68
|
+
...props,
|
|
136
69
|
class: classNames(
|
|
70
|
+
"button",
|
|
137
71
|
styles.root,
|
|
72
|
+
variant,
|
|
73
|
+
size,
|
|
74
|
+
color,
|
|
138
75
|
href ? styles.a : styles.button,
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
!raised && accent && styles.flatAccent,
|
|
142
|
-
raised && primary && styles.raisedPrimary,
|
|
143
|
-
raised && accent && styles.raisedAccent,
|
|
144
|
-
ripple && styles.rippledisabled && styles.disabled,
|
|
145
|
-
disabled && raised && styles.raisedDisabled,
|
|
76
|
+
disabled && styles.disabled,
|
|
77
|
+
options?.class,
|
|
146
78
|
props.class
|
|
147
79
|
),
|
|
80
|
+
disabled,
|
|
148
81
|
href,
|
|
149
82
|
...(!href && { type: "button" }),
|
|
150
83
|
},
|