@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
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# BauUI
|
|
2
2
|
|
|
3
|
-
A component library
|
|
3
|
+
A component library built with Bau.
|
|
4
4
|
|
|
5
|
-
The library provides
|
|
5
|
+
The library provides 40+ components such as button, input, tabs, tree etc ...
|
|
6
6
|
|
|
7
7
|
Visit the [bau-ui website](https://grucloud.github.io/bau/bau-ui/) to see the component gallery.
|
package/accordion/accordion.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { toPropsAndChildren } from "@grucloud/bau/bau.js";
|
|
2
2
|
import classNames from "@grucloud/bau-css/classNames.js";
|
|
3
|
+
import collapsible from "../collapsible";
|
|
3
4
|
import { Colors } from "../constants.js";
|
|
4
5
|
|
|
5
6
|
const colorsToCss = () =>
|
|
@@ -20,37 +21,7 @@ const colorsToCss = () =>
|
|
|
20
21
|
|
|
21
22
|
export default function (context, options) {
|
|
22
23
|
const { bau, css } = context;
|
|
23
|
-
const {
|
|
24
|
-
const { div, ul, li, header, h3, button } = bau.tags;
|
|
25
|
-
const itemNameState = bau.state("");
|
|
26
|
-
|
|
27
|
-
const onclick = (name) => (event) => {
|
|
28
|
-
if (itemNameState.val == name) {
|
|
29
|
-
itemNameState.val = "";
|
|
30
|
-
} else {
|
|
31
|
-
itemNameState.val = name;
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
|
-
const collapseOrExpandSection = ({ element, open }) => {
|
|
35
|
-
const animationEndHandler = () => {
|
|
36
|
-
element.removeEventListener("transitionend", animationEndHandler);
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
function collapseSection(element) {
|
|
40
|
-
element.addEventListener("transitionend", animationEndHandler);
|
|
41
|
-
window.requestAnimationFrame(() => {
|
|
42
|
-
element.style.height = "0px";
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
function expandSection(element) {
|
|
47
|
-
element.addEventListener("transitionend", animationEndHandler);
|
|
48
|
-
element.style.height = element.scrollHeight + "px";
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
if (element.scrollHeight == 0) return;
|
|
52
|
-
open ? expandSection(element) : collapseSection(element);
|
|
53
|
-
};
|
|
24
|
+
const { div, ul, li, h3, button } = bau.tags;
|
|
54
25
|
|
|
55
26
|
const className = css`
|
|
56
27
|
& ul {
|
|
@@ -59,11 +30,10 @@ export default function (context, options) {
|
|
|
59
30
|
justify-content: flex-start;
|
|
60
31
|
padding: 0;
|
|
61
32
|
list-style: none;
|
|
62
|
-
|
|
63
33
|
& li {
|
|
64
34
|
display: flex;
|
|
65
35
|
flex-direction: column;
|
|
66
|
-
padding: 0.5rem;
|
|
36
|
+
padding: 0 0.5rem;
|
|
67
37
|
margin: 0.2rem;
|
|
68
38
|
overflow: hidden;
|
|
69
39
|
border-radius: var(--global-radius);
|
|
@@ -77,14 +47,9 @@ export default function (context, options) {
|
|
|
77
47
|
}
|
|
78
48
|
& h3 {
|
|
79
49
|
display: flex;
|
|
80
|
-
cursor: pointer;
|
|
81
50
|
align-items: center;
|
|
82
51
|
justify-content: space-between;
|
|
83
52
|
margin: 0;
|
|
84
|
-
&::after {
|
|
85
|
-
content: "\u203A";
|
|
86
|
-
transition: all var(--transition-slow) ease-out;
|
|
87
|
-
}
|
|
88
53
|
& button {
|
|
89
54
|
width: 100%;
|
|
90
55
|
border: none;
|
|
@@ -97,15 +62,6 @@ export default function (context, options) {
|
|
|
97
62
|
}
|
|
98
63
|
& h3.active {
|
|
99
64
|
font-weight: var(--font-weight-semibold);
|
|
100
|
-
&::after {
|
|
101
|
-
content: "\u203A";
|
|
102
|
-
transform: rotate(90deg);
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
& .content {
|
|
106
|
-
height: 0px;
|
|
107
|
-
will-change: height;
|
|
108
|
-
transition: height var(--transition-fast) ease-out;
|
|
109
65
|
}
|
|
110
66
|
}
|
|
111
67
|
}
|
|
@@ -113,17 +69,25 @@ export default function (context, options) {
|
|
|
113
69
|
`;
|
|
114
70
|
|
|
115
71
|
return function Accordion(...args) {
|
|
116
|
-
let [
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
72
|
+
let [{ color, variant = "outline", size = "md", data = [], ...props }] =
|
|
73
|
+
toPropsAndChildren(args);
|
|
74
|
+
|
|
75
|
+
const itemNameState = bau.state("");
|
|
76
|
+
|
|
77
|
+
const Collapsible = collapsible(context);
|
|
78
|
+
|
|
79
|
+
const onclick = (name) => (event) => {
|
|
80
|
+
if (itemNameState.val == name) {
|
|
81
|
+
itemNameState.val = "";
|
|
82
|
+
} else {
|
|
83
|
+
itemNameState.val = name;
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
|
|
120
87
|
const AccordionItem = (item) => {
|
|
121
88
|
const { Header, Content, name } = item;
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
class: classNames(color, variant, size),
|
|
125
|
-
onclick: onclick(name),
|
|
126
|
-
},
|
|
89
|
+
|
|
90
|
+
const AccordionHeader = () =>
|
|
127
91
|
h3(
|
|
128
92
|
{
|
|
129
93
|
class: () => classNames(itemNameState.val == name && "active"),
|
|
@@ -136,27 +100,33 @@ export default function (context, options) {
|
|
|
136
100
|
},
|
|
137
101
|
Header(item)
|
|
138
102
|
)
|
|
139
|
-
)
|
|
103
|
+
);
|
|
104
|
+
|
|
105
|
+
const AccordionContent = () =>
|
|
140
106
|
div(
|
|
141
107
|
{
|
|
142
|
-
class: "content",
|
|
143
|
-
role: "region",
|
|
144
108
|
id: `bau-${name}`,
|
|
145
109
|
"data-state": ({ element }) => {
|
|
146
110
|
const open = itemNameState.val == name;
|
|
147
|
-
collapseOrExpandSection({ element, open });
|
|
148
111
|
return open;
|
|
149
112
|
},
|
|
150
113
|
},
|
|
151
114
|
Content(item)
|
|
152
|
-
)
|
|
115
|
+
);
|
|
116
|
+
|
|
117
|
+
return li(
|
|
118
|
+
{
|
|
119
|
+
class: classNames(color, variant, size),
|
|
120
|
+
onclick: onclick(name),
|
|
121
|
+
},
|
|
122
|
+
Collapsible({ Header: AccordionHeader, Content: AccordionContent })
|
|
153
123
|
);
|
|
154
124
|
};
|
|
155
125
|
return div(
|
|
156
126
|
{
|
|
157
127
|
class: classNames("accordion", className, options?.class, props.class),
|
|
158
128
|
},
|
|
159
|
-
ul(
|
|
129
|
+
ul(data.map(AccordionItem))
|
|
160
130
|
);
|
|
161
131
|
};
|
|
162
132
|
}
|
package/accordion/index.d.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
declare module "@grucloud/bau-ui/accordion" {
|
|
2
2
|
type DefaultDesignProps = import("../constants").DefaultDesignProps;
|
|
3
|
+
type ComponentOption = import("../bau-ui").ComponentOption;
|
|
3
4
|
|
|
4
|
-
export type AccordionProps = {
|
|
5
|
+
export type AccordionProps = {
|
|
6
|
+
data: Accordion[];
|
|
7
|
+
} & DefaultDesignProps;
|
|
5
8
|
|
|
6
9
|
type Component = import("../bau-ui").Component<AccordionProps>;
|
|
7
10
|
|
|
@@ -17,10 +20,5 @@ declare module "@grucloud/bau-ui/accordion" {
|
|
|
17
20
|
Content: AccordionItem;
|
|
18
21
|
} & AccordionItemPropBase;
|
|
19
22
|
|
|
20
|
-
|
|
21
|
-
class?: string;
|
|
22
|
-
accordionDefs: Accordion[];
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
export default function (context: any, option: Option): Component;
|
|
23
|
+
export default function (context: any, option?: ComponentOption): Component;
|
|
26
24
|
}
|
package/alert/alert.js
CHANGED
|
@@ -12,43 +12,39 @@ const severityMap = {
|
|
|
12
12
|
neutral: "\u2139",
|
|
13
13
|
};
|
|
14
14
|
|
|
15
|
-
const createStyles = ({ css, createGlobalStyles }) => {
|
|
16
|
-
createGlobalStyles`
|
|
17
|
-
:root {
|
|
18
|
-
--alert-border-left-width: 8px;
|
|
19
|
-
}
|
|
20
|
-
`;
|
|
21
|
-
};
|
|
22
|
-
|
|
23
15
|
const colorsToCss = () =>
|
|
24
16
|
Colors.map(
|
|
25
17
|
(color) =>
|
|
26
18
|
`
|
|
27
|
-
&.alert
|
|
28
|
-
|
|
29
|
-
|
|
19
|
+
&.alert {
|
|
20
|
+
&.plain.${color} {
|
|
21
|
+
& .icon {
|
|
22
|
+
color: var(--color-${color})
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
&.outline.${color} {
|
|
26
|
+
& .icon {
|
|
27
|
+
color: var(--color-${color})
|
|
28
|
+
}
|
|
30
29
|
}
|
|
31
30
|
}
|
|
32
|
-
`
|
|
31
|
+
`
|
|
33
32
|
).join("\n");
|
|
34
33
|
|
|
35
|
-
export default function (context, options) {
|
|
36
|
-
const { bau, css
|
|
34
|
+
export default function (context, options = {}) {
|
|
35
|
+
const { bau, css } = context;
|
|
37
36
|
const { div, i } = bau.tags;
|
|
38
37
|
|
|
39
|
-
createStyles({ css, createGlobalStyles });
|
|
40
|
-
|
|
41
38
|
const className = css`
|
|
42
39
|
display: flex;
|
|
43
40
|
max-width: 600px;
|
|
44
41
|
justify-content: flex-start;
|
|
45
42
|
align-items: center;
|
|
46
|
-
margin: 0.5rem;
|
|
47
43
|
font-weight: var(--font-weight-semibold);
|
|
48
44
|
box-shadow: var(--shadow-m);
|
|
49
45
|
border-radius: var(--global-radius);
|
|
50
46
|
& .icon {
|
|
51
|
-
padding: 0
|
|
47
|
+
padding: 0 0.5rem;
|
|
52
48
|
font-size: 2.5rem;
|
|
53
49
|
}
|
|
54
50
|
& .content {
|
|
@@ -76,26 +72,33 @@ export default function (context, options) {
|
|
|
76
72
|
"\u2716"
|
|
77
73
|
);
|
|
78
74
|
|
|
79
|
-
return function Alert(
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
75
|
+
return function Alert(...args) {
|
|
76
|
+
let [
|
|
77
|
+
{
|
|
78
|
+
color = options.color ?? "neutral",
|
|
79
|
+
variant = options.variant ?? "outline",
|
|
80
|
+
size = "md",
|
|
81
|
+
onRemove,
|
|
82
|
+
...props
|
|
83
|
+
},
|
|
84
|
+
...children
|
|
85
|
+
] = toPropsAndChildren(args);
|
|
86
|
+
|
|
87
87
|
return div(
|
|
88
88
|
{
|
|
89
|
-
...
|
|
89
|
+
...props,
|
|
90
90
|
class: classNames(
|
|
91
|
+
"alert",
|
|
91
92
|
`alert-${variant}`,
|
|
93
|
+
options.class,
|
|
94
|
+
options.variant,
|
|
95
|
+
options.size,
|
|
96
|
+
options.color,
|
|
92
97
|
variant,
|
|
93
98
|
color,
|
|
94
99
|
size,
|
|
95
100
|
className,
|
|
96
|
-
|
|
97
|
-
props.class,
|
|
98
|
-
"alert"
|
|
101
|
+
props.class
|
|
99
102
|
),
|
|
100
103
|
role: "alert",
|
|
101
104
|
},
|
package/animate/animate.js
CHANGED
|
@@ -26,7 +26,7 @@ export default function (context, options = {}) {
|
|
|
26
26
|
nodeCloned.style.animation = animationHide();
|
|
27
27
|
record.target.appendChild(nodeCloned);
|
|
28
28
|
nodeCloned.addEventListener("animationend", () =>
|
|
29
|
-
nodeCloned.parentNode
|
|
29
|
+
nodeCloned.parentNode?.removeChild(nodeCloned)
|
|
30
30
|
);
|
|
31
31
|
});
|
|
32
32
|
// Added Nodes
|
|
@@ -22,7 +22,7 @@ const colorsToCss = () =>
|
|
|
22
22
|
|
|
23
23
|
export default function (context, componentOptions) {
|
|
24
24
|
const { bau, css } = context;
|
|
25
|
-
const { div, li
|
|
25
|
+
const { div, li } = bau.tags;
|
|
26
26
|
|
|
27
27
|
const Popover = popover(context);
|
|
28
28
|
const Button = button(context);
|
|
@@ -38,6 +38,9 @@ export default function (context, componentOptions) {
|
|
|
38
38
|
}
|
|
39
39
|
& .content {
|
|
40
40
|
height: fit-content;
|
|
41
|
+
& ul {
|
|
42
|
+
border-width: 0px !important;
|
|
43
|
+
}
|
|
41
44
|
& input {
|
|
42
45
|
padding: 0.8rem;
|
|
43
46
|
margin: 0.3rem;
|
|
@@ -47,15 +50,6 @@ export default function (context, componentOptions) {
|
|
|
47
50
|
${colorsToCss()}
|
|
48
51
|
`;
|
|
49
52
|
|
|
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
53
|
return function AutoComplete(...args) {
|
|
60
54
|
let [
|
|
61
55
|
{
|
|
@@ -73,6 +67,15 @@ export default function (context, componentOptions) {
|
|
|
73
67
|
...children
|
|
74
68
|
] = toPropsAndChildren(args);
|
|
75
69
|
|
|
70
|
+
const selectedState = bau.state("");
|
|
71
|
+
const inputState = bau.state("");
|
|
72
|
+
const openState = bau.state(false);
|
|
73
|
+
const itemIndexActive = bau.state(0);
|
|
74
|
+
|
|
75
|
+
const onClose = () => {
|
|
76
|
+
openState.val = false;
|
|
77
|
+
};
|
|
78
|
+
|
|
76
79
|
const optionsFilteredState = bau.state(options);
|
|
77
80
|
|
|
78
81
|
const dialogOpen = () => {
|
|
@@ -168,7 +171,7 @@ export default function (context, componentOptions) {
|
|
|
168
171
|
placeholder,
|
|
169
172
|
autofocus: true,
|
|
170
173
|
type: "search",
|
|
171
|
-
autocomplete: "
|
|
174
|
+
autocomplete: "off",
|
|
172
175
|
autocapitalize: "none",
|
|
173
176
|
spellcheck: false,
|
|
174
177
|
role: "combobox",
|
package/avatar/avatar.js
CHANGED
|
@@ -16,6 +16,9 @@ export default function (context, options) {
|
|
|
16
16
|
};
|
|
17
17
|
|
|
18
18
|
const className = css`
|
|
19
|
+
display: flex;
|
|
20
|
+
justify-content: center;
|
|
21
|
+
align-items: center;
|
|
19
22
|
&.sm {
|
|
20
23
|
width: 20px;
|
|
21
24
|
height: 20px;
|
|
@@ -35,8 +38,8 @@ export default function (context, options) {
|
|
|
35
38
|
color,
|
|
36
39
|
variant = "outline",
|
|
37
40
|
size = "md",
|
|
38
|
-
width =
|
|
39
|
-
height =
|
|
41
|
+
width = 40,
|
|
42
|
+
height = 40,
|
|
40
43
|
...props
|
|
41
44
|
},
|
|
42
45
|
...children
|
package/bau-ui.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
type DefaultDesignProps = import("./constants").DefaultDesignProps;
|
|
2
|
+
|
|
1
3
|
type ChildDom = import("@grucloud/bau").ChildDom;
|
|
2
4
|
|
|
3
5
|
export type Component<
|
|
@@ -26,4 +28,4 @@ export type ComponentGeneric = (
|
|
|
26
28
|
|
|
27
29
|
export type ComponentOption = {
|
|
28
30
|
class?: string;
|
|
29
|
-
};
|
|
31
|
+
} & DefaultDesignProps;
|
|
@@ -4,7 +4,7 @@ import button from "../button/button.js";
|
|
|
4
4
|
|
|
5
5
|
export default function (context, options) {
|
|
6
6
|
const { bau, css } = context;
|
|
7
|
-
const { ul, li,
|
|
7
|
+
const { ul, li, span } = bau.tags;
|
|
8
8
|
|
|
9
9
|
const Button = button(context);
|
|
10
10
|
|
|
@@ -42,15 +42,12 @@ export default function (context, options) {
|
|
|
42
42
|
|
|
43
43
|
return function Breadcrumbs(...args) {
|
|
44
44
|
let [
|
|
45
|
-
{ color, variant = "
|
|
45
|
+
{ color = "neutral", variant = "plain", size = "md", items, ...props },
|
|
46
46
|
...children
|
|
47
47
|
] = toPropsAndChildren(args);
|
|
48
48
|
return ul(
|
|
49
49
|
{
|
|
50
50
|
...props,
|
|
51
|
-
// color,
|
|
52
|
-
// variant,
|
|
53
|
-
// size,
|
|
54
51
|
class: classNames(className, options?.class, props?.class),
|
|
55
52
|
},
|
|
56
53
|
items.map(({ href, name }) =>
|
package/button/button.js
CHANGED
|
@@ -1,85 +1,83 @@
|
|
|
1
1
|
import { toPropsAndChildren } from "@grucloud/bau/bau.js";
|
|
2
2
|
import classNames from "@grucloud/bau-css/classNames.js";
|
|
3
3
|
|
|
4
|
-
export default function (context, options) {
|
|
4
|
+
export default function (context, options = {}) {
|
|
5
5
|
const { bau, css } = context;
|
|
6
6
|
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}
|
|
42
|
-
&.md {
|
|
43
|
-
padding: 0.5rem;
|
|
44
|
-
}
|
|
45
|
-
&.lg {
|
|
46
|
-
padding: 0.7rem 2rem;
|
|
47
|
-
}
|
|
48
|
-
`,
|
|
49
|
-
button: css`
|
|
50
|
-
cursor: pointer;
|
|
51
|
-
`,
|
|
52
|
-
a: css``,
|
|
53
|
-
disabled: css`
|
|
54
|
-
color: rgba(0, 0, 0, 0.26);
|
|
7
|
+
const className = css`
|
|
8
|
+
color: inherit;
|
|
9
|
+
display: inline-flex;
|
|
10
|
+
align-items: center;
|
|
11
|
+
justify-content: center;
|
|
12
|
+
gap: 0.5rem;
|
|
13
|
+
min-width: 2rem;
|
|
14
|
+
min-height: 2rem;
|
|
15
|
+
border: none;
|
|
16
|
+
border-radius: var(--global-radius);
|
|
17
|
+
font-weight: var(--font-weight-semibold);
|
|
18
|
+
text-align: center;
|
|
19
|
+
text-decoration: none;
|
|
20
|
+
overflow: hidden;
|
|
21
|
+
box-sizing: border-box;
|
|
22
|
+
user-select: none;
|
|
23
|
+
transition: all var(--transition-slow);
|
|
24
|
+
cursor: pointer;
|
|
25
|
+
&.outline,
|
|
26
|
+
&.solid {
|
|
27
|
+
box-shadow: var(--shadow-m);
|
|
28
|
+
}
|
|
29
|
+
&.outline:hover,
|
|
30
|
+
&.solid:hover {
|
|
31
|
+
box-shadow: var(--shadow-lg);
|
|
32
|
+
}
|
|
33
|
+
&:hover {
|
|
34
|
+
filter: brightness(var(--brightness-hover));
|
|
35
|
+
}
|
|
36
|
+
&:hover.solid {
|
|
37
|
+
filter: brightness(var(--brightness-hover-always));
|
|
38
|
+
}
|
|
39
|
+
&.button:disabled {
|
|
40
|
+
filter: grayscale(1) brightness(var(--brightness-hover));
|
|
55
41
|
cursor: not-allowed;
|
|
56
42
|
pointer-events: none;
|
|
57
|
-
|
|
58
|
-
|
|
43
|
+
}
|
|
44
|
+
&.sm {
|
|
45
|
+
padding: 0.3rem;
|
|
46
|
+
}
|
|
47
|
+
&.md {
|
|
48
|
+
padding: 0.2rem 0.8rem;
|
|
49
|
+
}
|
|
50
|
+
&.lg {
|
|
51
|
+
padding: 0.2rem 2rem;
|
|
52
|
+
}
|
|
53
|
+
& i {
|
|
54
|
+
font-style: normal;
|
|
55
|
+
}
|
|
56
|
+
`;
|
|
59
57
|
|
|
60
58
|
return function Button(...args) {
|
|
61
|
-
let [
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
] = toPropsAndChildren(args);
|
|
59
|
+
let [{ color, variant, size = "md", href, ...props }, ...children] =
|
|
60
|
+
toPropsAndChildren(args);
|
|
61
|
+
|
|
65
62
|
const tagButton = href ? bau.tags.a : bau.tags.button;
|
|
63
|
+
|
|
66
64
|
return tagButton(
|
|
67
65
|
{
|
|
66
|
+
...(!href && { type: "button" }),
|
|
68
67
|
...props,
|
|
69
68
|
class: classNames(
|
|
70
69
|
"button",
|
|
71
|
-
|
|
70
|
+
options.class,
|
|
71
|
+
options.variant,
|
|
72
|
+
options.size,
|
|
73
|
+
options.color,
|
|
72
74
|
variant,
|
|
73
75
|
size,
|
|
74
76
|
color,
|
|
75
|
-
|
|
76
|
-
disabled && styles.disabled,
|
|
77
|
-
options?.class,
|
|
77
|
+
className,
|
|
78
78
|
props.class
|
|
79
79
|
),
|
|
80
|
-
disabled,
|
|
81
80
|
href,
|
|
82
|
-
...(!href && { type: "button" }),
|
|
83
81
|
},
|
|
84
82
|
children
|
|
85
83
|
);
|
|
@@ -8,10 +8,10 @@ const colorsToCss = () =>
|
|
|
8
8
|
`
|
|
9
9
|
&.button-group.${color} {
|
|
10
10
|
& button:not(:last-child) {
|
|
11
|
-
border-right:
|
|
11
|
+
border-right: 1px solid var(--color-${color}) !important;
|
|
12
12
|
}
|
|
13
13
|
& button:not(:first-child) {
|
|
14
|
-
border-left:
|
|
14
|
+
border-left: 1px solid var(--color-${color}) !important;
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
17
|
|
|
@@ -21,7 +21,7 @@ const colorsToCss = () =>
|
|
|
21
21
|
|
|
22
22
|
&.button-group.solid.${color} {
|
|
23
23
|
& button:not(:last-child) {
|
|
24
|
-
border-right:
|
|
24
|
+
border-right: 1px solid var(--color-${color}-lightest) !important;
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
`
|
|
@@ -33,6 +33,7 @@ export default function (context, options) {
|
|
|
33
33
|
|
|
34
34
|
const className = css`
|
|
35
35
|
display: inline-flex;
|
|
36
|
+
box-sizing: border-box;
|
|
36
37
|
border-radius: var(--global-radius);
|
|
37
38
|
& button:not(:last-child) {
|
|
38
39
|
border-top-right-radius: 0;
|