@grucloud/bau-ui 0.41.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/animate/animate.js +47 -33
- package/animate/index.d.ts +2 -3
- package/badge/index.d.ts +0 -4
- package/button/button.js +9 -0
- package/chip/chip.js +3 -3
- package/context.js +5 -1
- package/drillDownMenu/drillDownMenu.js +72 -91
- package/fileInput/fileInput.js +5 -1
- package/form/form.js +31 -0
- package/form/index.d.ts +10 -0
- package/form/index.js +1 -0
- package/globalStyle/globalStyle.js +34 -12
- package/globalStyle/index.d.ts +14 -0
- package/package.json +4 -4
- package/pages/login/index.d.ts +3 -6
- package/pages/login/login.js +1 -1
- package/tooltip/tooltip.js +1 -1
package/README.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# BauUI
|
|
2
2
|
|
|
3
|
-
A component library for built with Bau
|
|
3
|
+
A component library for built with Bau,
|
|
4
4
|
|
|
5
|
-
The library provides
|
|
5
|
+
The library provides 25+ components such as button, input, tabs, tree etc ...
|
|
6
|
+
|
|
7
|
+
Visit the [bau-ui website](https://grucloud.github.io/bau/bau-ui/) to see the component gallery.
|
package/animate/animate.js
CHANGED
|
@@ -1,43 +1,57 @@
|
|
|
1
|
+
import classNames from "@grucloud/bau-css/classNames.js";
|
|
2
|
+
|
|
1
3
|
export default function (context, options = {}) {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const animationEndHandler = () => {
|
|
6
|
-
node.removeEventListener("animationend", animationEndHandler);
|
|
7
|
-
node.style.animation = "";
|
|
8
|
-
};
|
|
9
|
-
node.addEventListener("animationend", animationEndHandler);
|
|
4
|
+
const { bau } = context;
|
|
5
|
+
const { div } = bau.tags;
|
|
6
|
+
const noop = () => undefined;
|
|
10
7
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
8
|
+
return function Animate(
|
|
9
|
+
{ animationHide = noop, animationShow = noop, ...props },
|
|
10
|
+
child
|
|
11
|
+
) {
|
|
12
|
+
return div(
|
|
13
|
+
{
|
|
14
|
+
class: classNames("animate", options?.class, props.class),
|
|
15
|
+
bauChildMutated: ({ record, element }) => {
|
|
16
|
+
// Removed Nodes
|
|
17
|
+
[...record.removedNodes].forEach((childNode) => {
|
|
18
|
+
if (!animationHide() || childNode.getAttribute("cloned")) return;
|
|
19
|
+
const nodeCloned = childNode.cloneNode(true);
|
|
20
|
+
nodeCloned.setAttribute("cloned", true);
|
|
19
21
|
nodeCloned.style.top = 0;
|
|
20
22
|
nodeCloned.style.left = 0;
|
|
23
|
+
nodeCloned.style.width = childNode.getAttribute("width");
|
|
24
|
+
nodeCloned.style.height = childNode.getAttribute("height");
|
|
21
25
|
nodeCloned.style.position = "absolute";
|
|
22
|
-
nodeCloned.style.animation = animationHide;
|
|
23
|
-
|
|
24
|
-
record.previousSibling.after(nodeCloned);
|
|
25
|
-
} else if (record.nextSibling) {
|
|
26
|
-
record.nextSibling.before(nodeCloned);
|
|
27
|
-
} else if (record.target) {
|
|
28
|
-
record.target.appendChild(nodeCloned);
|
|
29
|
-
} else {
|
|
30
|
-
}
|
|
31
|
-
|
|
26
|
+
nodeCloned.style.animation = animationHide();
|
|
27
|
+
record.target.appendChild(nodeCloned);
|
|
32
28
|
nodeCloned.addEventListener("animationend", () =>
|
|
33
29
|
nodeCloned.parentNode.removeChild(nodeCloned)
|
|
34
30
|
);
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
31
|
+
});
|
|
32
|
+
// Added Nodes
|
|
33
|
+
[...record.addedNodes].forEach((childNode) => {
|
|
34
|
+
if (childNode.getAttribute("cloned")) return;
|
|
35
|
+
element.style.position = "relative";
|
|
36
|
+
const rect = childNode.getBoundingClientRect();
|
|
37
|
+
childNode.setAttribute("width", rect.width + "px");
|
|
38
|
+
childNode.setAttribute("height", rect.height + "px");
|
|
39
|
+
if (animationShow()) {
|
|
40
|
+
childNode.style.animation = animationShow();
|
|
41
|
+
const animationEndHandler = () => {
|
|
42
|
+
childNode.removeEventListener(
|
|
43
|
+
"animationend",
|
|
44
|
+
animationEndHandler
|
|
45
|
+
);
|
|
46
|
+
childNode.style.animation = "";
|
|
47
|
+
};
|
|
48
|
+
childNode.addEventListener("animationend", animationEndHandler);
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
},
|
|
52
|
+
...props,
|
|
53
|
+
},
|
|
54
|
+
child
|
|
55
|
+
);
|
|
42
56
|
};
|
|
43
57
|
}
|
package/animate/index.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
declare module "@grucloud/bau-ui/animate" {
|
|
2
2
|
export type AnimateProps = {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
animationShow: string;
|
|
3
|
+
animationHide?: () => string;
|
|
4
|
+
animationShow?: () => string;
|
|
6
5
|
};
|
|
7
6
|
|
|
8
7
|
type Component = import("../bau-ui").ComponentOneChild<AnimateProps>;
|
package/badge/index.d.ts
CHANGED
|
@@ -4,10 +4,6 @@ declare module "@grucloud/bau-ui/badge" {
|
|
|
4
4
|
|
|
5
5
|
export type BadgeProps = {
|
|
6
6
|
content: string;
|
|
7
|
-
primary?: boolean;
|
|
8
|
-
secondary?: boolean;
|
|
9
|
-
success?: boolean;
|
|
10
|
-
danger?: boolean;
|
|
11
7
|
} & DefaultDesignProps;
|
|
12
8
|
|
|
13
9
|
type Component = import("../bau-ui").Component<BadgeProps>;
|
package/button/button.js
CHANGED
|
@@ -21,6 +21,15 @@ export default function (context, options) {
|
|
|
21
21
|
box-sizing: border-box;
|
|
22
22
|
user-select: none;
|
|
23
23
|
transition: all var(--transition-slow);
|
|
24
|
+
|
|
25
|
+
&.outline,
|
|
26
|
+
&.solid {
|
|
27
|
+
box-shadow: var(--shadow-m);
|
|
28
|
+
}
|
|
29
|
+
&.outline:hover,
|
|
30
|
+
&.solid:hover {
|
|
31
|
+
box-shadow: var(--shadow-lg);
|
|
32
|
+
}
|
|
24
33
|
&:hover {
|
|
25
34
|
filter: brightness(var(--brightness-hover));
|
|
26
35
|
}
|
package/chip/chip.js
CHANGED
|
@@ -7,12 +7,12 @@ export default function (context, options) {
|
|
|
7
7
|
|
|
8
8
|
const className = css`
|
|
9
9
|
display: inline-block;
|
|
10
|
+
box-sizing: border-box;
|
|
10
11
|
border-radius: var(--global-radius);
|
|
11
12
|
padding: 0.2rem 0.5rem;
|
|
12
13
|
overflow: hidden;
|
|
13
14
|
text-overflow: ellipsis;
|
|
14
15
|
white-space: nowrap;
|
|
15
|
-
font-size: smaller;
|
|
16
16
|
&.clickable {
|
|
17
17
|
cursor: pointer;
|
|
18
18
|
}
|
|
@@ -20,10 +20,10 @@ export default function (context, options) {
|
|
|
20
20
|
padding: 0.2rem;
|
|
21
21
|
}
|
|
22
22
|
&.md {
|
|
23
|
-
padding: 0.5rem;
|
|
23
|
+
padding: 0.2rem 0.5rem;
|
|
24
24
|
}
|
|
25
25
|
&.lg {
|
|
26
|
-
padding: 0.
|
|
26
|
+
padding: 0.3rem 1rem;
|
|
27
27
|
}
|
|
28
28
|
`;
|
|
29
29
|
|
package/context.js
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import Bau from "@grucloud/bau";
|
|
2
2
|
import BauCss from "@grucloud/bau-css";
|
|
3
3
|
|
|
4
|
+
import globalStyle from "./globalStyle";
|
|
5
|
+
|
|
4
6
|
export function createContext(extra) {
|
|
5
7
|
const bau = Bau();
|
|
8
|
+
const bauCss = BauCss();
|
|
9
|
+
globalStyle(bauCss);
|
|
6
10
|
return {
|
|
7
11
|
bau,
|
|
8
|
-
...
|
|
12
|
+
...bauCss,
|
|
9
13
|
tr: (text) => text,
|
|
10
14
|
window,
|
|
11
15
|
...extra,
|
|
@@ -39,7 +39,7 @@ const findSubTree = (initialPathname) => (tree) => {
|
|
|
39
39
|
}
|
|
40
40
|
};
|
|
41
41
|
|
|
42
|
-
const createStyles = ({
|
|
42
|
+
const createStyles = ({ keyframes }) => {
|
|
43
43
|
return {
|
|
44
44
|
hideToLeft: keyframes`
|
|
45
45
|
from {
|
|
@@ -50,16 +50,6 @@ const createStyles = ({ createGlobalStyles, keyframes }) => {
|
|
|
50
50
|
transform: translateX(-100%);
|
|
51
51
|
opacity: 0;
|
|
52
52
|
}
|
|
53
|
-
`,
|
|
54
|
-
showFromLeft: keyframes`
|
|
55
|
-
from {
|
|
56
|
-
transform: translateX(-100%);
|
|
57
|
-
opacity: 0;
|
|
58
|
-
}
|
|
59
|
-
to {
|
|
60
|
-
transform: translateX(0%);
|
|
61
|
-
opacity: 1;
|
|
62
|
-
}
|
|
63
53
|
`,
|
|
64
54
|
hideToRight: keyframes`
|
|
65
55
|
from {
|
|
@@ -71,29 +61,19 @@ const createStyles = ({ createGlobalStyles, keyframes }) => {
|
|
|
71
61
|
opacity: 0;
|
|
72
62
|
}
|
|
73
63
|
`,
|
|
74
|
-
showFromRight: keyframes`
|
|
75
|
-
from {
|
|
76
|
-
transform: translateX(100%);
|
|
77
|
-
opacity: 0;
|
|
78
|
-
}
|
|
79
|
-
to {
|
|
80
|
-
transform: translateX(0%);
|
|
81
|
-
opacity: 1;
|
|
82
|
-
}
|
|
83
|
-
`,
|
|
84
64
|
};
|
|
85
65
|
};
|
|
86
66
|
|
|
87
67
|
export default function (context, options) {
|
|
88
68
|
const { bau, css, window } = context;
|
|
89
69
|
const { base = "" } = options;
|
|
90
|
-
|
|
70
|
+
|
|
71
|
+
const renderHeaderDefault = ({ currentTree, data }) =>
|
|
91
72
|
header(
|
|
92
73
|
Button(
|
|
93
74
|
{
|
|
94
75
|
variant: "plain",
|
|
95
76
|
href: `${base}${currentTree.parentTree.children[0].data.href}`,
|
|
96
|
-
onclick: onclickBack({ currentTree }),
|
|
97
77
|
class: css`
|
|
98
78
|
flex-grow: 0;
|
|
99
79
|
`,
|
|
@@ -105,6 +85,10 @@ export default function (context, options) {
|
|
|
105
85
|
{
|
|
106
86
|
variant: "plain",
|
|
107
87
|
href: `${base}${data.href}`,
|
|
88
|
+
class: css`
|
|
89
|
+
flex-grow: 1;
|
|
90
|
+
`,
|
|
91
|
+
"data-ischild": true,
|
|
108
92
|
},
|
|
109
93
|
data.name
|
|
110
94
|
)
|
|
@@ -114,7 +98,7 @@ export default function (context, options) {
|
|
|
114
98
|
Button(
|
|
115
99
|
{
|
|
116
100
|
href: `${base}${href}`,
|
|
117
|
-
"data-ischild": children.length
|
|
101
|
+
"data-ischild": !children.length,
|
|
118
102
|
},
|
|
119
103
|
name
|
|
120
104
|
);
|
|
@@ -128,30 +112,29 @@ export default function (context, options) {
|
|
|
128
112
|
isActive = isActiveDefault,
|
|
129
113
|
} = options;
|
|
130
114
|
|
|
131
|
-
const {
|
|
115
|
+
const { li, nav, div, header, a } = bau.tags;
|
|
132
116
|
const Animate = animate(context);
|
|
133
117
|
const List = list(context);
|
|
134
118
|
|
|
135
119
|
const Button = button(context, {
|
|
136
120
|
class: css`
|
|
137
121
|
&.button {
|
|
138
|
-
flex-grow: 1;
|
|
139
122
|
justify-content: flex-start;
|
|
140
123
|
}
|
|
141
124
|
`,
|
|
142
125
|
});
|
|
143
|
-
const { hideToLeft, hideToRight
|
|
144
|
-
createStyles(context);
|
|
126
|
+
const { hideToLeft, hideToRight } = createStyles(context);
|
|
145
127
|
|
|
146
128
|
const className = css`
|
|
147
129
|
font-weight: var(--font-weight-semibold);
|
|
148
130
|
overflow: hidden;
|
|
149
131
|
position: relative;
|
|
132
|
+
|
|
150
133
|
& header {
|
|
151
134
|
display: flex;
|
|
152
135
|
align-items: center;
|
|
153
136
|
font-weight: var(--font-weight-bold);
|
|
154
|
-
border-bottom: 1px solid var(--color-emphasis-
|
|
137
|
+
border-bottom: 1px solid var(--color-emphasis-200);
|
|
155
138
|
& a {
|
|
156
139
|
padding: 0.6rem;
|
|
157
140
|
border-radius: 0;
|
|
@@ -167,24 +150,19 @@ export default function (context, options) {
|
|
|
167
150
|
}
|
|
168
151
|
& li {
|
|
169
152
|
padding: 0;
|
|
153
|
+
& a {
|
|
154
|
+
width: 100%;
|
|
155
|
+
}
|
|
170
156
|
}
|
|
171
157
|
}
|
|
172
158
|
`;
|
|
173
159
|
|
|
174
|
-
const Menu = ({
|
|
175
|
-
variant,
|
|
176
|
-
color,
|
|
177
|
-
size,
|
|
178
|
-
onclickItem,
|
|
179
|
-
onclickBack,
|
|
180
|
-
currentTree,
|
|
181
|
-
pathnameState,
|
|
182
|
-
}) => {
|
|
160
|
+
const Menu = ({ variant, color, size, currentTree, pathnameState }) => {
|
|
183
161
|
const { children, parentTree, data } = currentTree;
|
|
184
162
|
//console.log("Menu", currentTree, pathnameState.val);
|
|
185
163
|
return div(
|
|
186
164
|
{ class: cn("drillDownMenu", variant, color, size) },
|
|
187
|
-
parentTree && renderHeader({ data, currentTree
|
|
165
|
+
parentTree && renderHeader({ data, currentTree }),
|
|
188
166
|
children &&
|
|
189
167
|
List(
|
|
190
168
|
{ class: cn(variant, color, size) },
|
|
@@ -197,8 +175,6 @@ export default function (context, options) {
|
|
|
197
175
|
isActive({ pathname: pathnameState.val, subTree }) &&
|
|
198
176
|
"active"
|
|
199
177
|
),
|
|
200
|
-
onclick:
|
|
201
|
-
subTree.children && onclickItem({ currentTree: subTree }),
|
|
202
178
|
},
|
|
203
179
|
renderMenuItem(subTree)
|
|
204
180
|
)
|
|
@@ -208,7 +184,7 @@ export default function (context, options) {
|
|
|
208
184
|
};
|
|
209
185
|
|
|
210
186
|
const findInitialTree = ({ tree, pathname }) => {
|
|
211
|
-
let currentTree = treeAddParent({})(tree);
|
|
187
|
+
let currentTree = treeAddParent({})(structuredClone(tree));
|
|
212
188
|
let subTree = findSubTree(pathname)(currentTree);
|
|
213
189
|
if (!subTree) {
|
|
214
190
|
console.log("drilldown no sub tree", pathname);
|
|
@@ -226,63 +202,68 @@ export default function (context, options) {
|
|
|
226
202
|
pathnameState = bau.state(window.location.pathname),
|
|
227
203
|
...otherProps
|
|
228
204
|
} = props;
|
|
229
|
-
//console.log("DrillDownMenu");
|
|
230
|
-
const onclickItem =
|
|
231
|
-
({ currentTree }) =>
|
|
232
|
-
(event) =>
|
|
233
|
-
replaceChildren(event, navEl, currentTree, true);
|
|
234
205
|
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
206
|
+
let direction = 1;
|
|
207
|
+
|
|
208
|
+
const onclick = (event) => {
|
|
209
|
+
const { dataset } = event.target;
|
|
210
|
+
if (dataset.buttonback == "true") {
|
|
211
|
+
direction = -1;
|
|
212
|
+
} else if (dataset.ischild == "false") {
|
|
213
|
+
direction = 1;
|
|
214
|
+
} else if (dataset.ischild == "true") {
|
|
215
|
+
direction = 0;
|
|
216
|
+
}
|
|
217
|
+
};
|
|
239
218
|
|
|
240
|
-
const
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
}
|
|
219
|
+
const treeState = bau.derive(() =>
|
|
220
|
+
findInitialTree({
|
|
221
|
+
tree,
|
|
222
|
+
pathname: pathnameState.val,
|
|
223
|
+
})
|
|
224
|
+
);
|
|
225
|
+
|
|
226
|
+
const animationHide = (direction) => {
|
|
227
|
+
switch (direction) {
|
|
228
|
+
case 1:
|
|
229
|
+
return `${hideToLeft} ${animationDuration}`;
|
|
230
|
+
case -1:
|
|
231
|
+
return `${hideToRight} ${animationDuration}`;
|
|
232
|
+
default:
|
|
233
|
+
return "";
|
|
234
|
+
}
|
|
235
|
+
};
|
|
236
|
+
|
|
237
|
+
const animationShow = (direction) => {
|
|
238
|
+
switch (direction) {
|
|
239
|
+
case 1:
|
|
240
|
+
return `${hideToRight} ${animationDuration} reverse`;
|
|
241
|
+
case -1:
|
|
242
|
+
return `${hideToLeft} ${animationDuration} reverse`;
|
|
243
|
+
default:
|
|
244
|
+
return "";
|
|
245
|
+
}
|
|
246
|
+
};
|
|
247
|
+
|
|
248
|
+
return nav(
|
|
249
|
+
{
|
|
250
|
+
class: cn(className, options?.class, otherProps.class),
|
|
251
|
+
onclick,
|
|
252
|
+
},
|
|
253
|
+
Animate(
|
|
254
|
+
{
|
|
255
|
+
animationHide: () => animationHide(direction),
|
|
256
|
+
animationShow: () => animationShow(direction),
|
|
257
|
+
},
|
|
258
|
+
() =>
|
|
253
259
|
Menu({
|
|
254
260
|
variant,
|
|
255
261
|
color,
|
|
256
262
|
size,
|
|
257
|
-
currentTree,
|
|
258
|
-
onclickItem,
|
|
259
|
-
onclickBack,
|
|
263
|
+
currentTree: treeState.val,
|
|
260
264
|
pathnameState,
|
|
261
265
|
})
|
|
262
|
-
|
|
263
|
-
);
|
|
264
|
-
};
|
|
265
|
-
|
|
266
|
-
const navEl = nav(
|
|
267
|
-
{
|
|
268
|
-
class: cn(className, options?.class, otherProps.class),
|
|
269
|
-
},
|
|
270
|
-
() => {
|
|
271
|
-
return Menu({
|
|
272
|
-
variant,
|
|
273
|
-
color,
|
|
274
|
-
size,
|
|
275
|
-
currentTree: findInitialTree({
|
|
276
|
-
tree,
|
|
277
|
-
pathname: pathnameState.val,
|
|
278
|
-
}),
|
|
279
|
-
onclickItem,
|
|
280
|
-
onclickBack,
|
|
281
|
-
pathnameState,
|
|
282
|
-
});
|
|
283
|
-
}
|
|
266
|
+
)
|
|
284
267
|
);
|
|
285
|
-
|
|
286
|
-
return navEl;
|
|
287
268
|
};
|
|
288
269
|
}
|
package/fileInput/fileInput.js
CHANGED
|
@@ -31,8 +31,12 @@ export default function (context, options) {
|
|
|
31
31
|
justify-content: center;
|
|
32
32
|
align-items: center;
|
|
33
33
|
cursor: pointer;
|
|
34
|
+
transition: all var(--transition-slow) ease-out;
|
|
35
|
+
&:hover.solid {
|
|
36
|
+
filter: brightness(var(--brightness-hover-always)) !important;
|
|
37
|
+
}
|
|
34
38
|
&:hover {
|
|
35
|
-
|
|
39
|
+
filter: brightness(var(--brightness-hover));
|
|
36
40
|
}
|
|
37
41
|
}
|
|
38
42
|
`,
|
package/form/form.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
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 { form } = bau.tags;
|
|
7
|
+
|
|
8
|
+
const className = css``;
|
|
9
|
+
|
|
10
|
+
return function Form(...args) {
|
|
11
|
+
let [
|
|
12
|
+
{ color, variant = "outline", size = "md", content, ...props },
|
|
13
|
+
...children
|
|
14
|
+
] = toPropsAndChildren(args);
|
|
15
|
+
return form(
|
|
16
|
+
{
|
|
17
|
+
...props,
|
|
18
|
+
class: classNames(
|
|
19
|
+
"form",
|
|
20
|
+
color,
|
|
21
|
+
variant,
|
|
22
|
+
size,
|
|
23
|
+
className,
|
|
24
|
+
options?.class,
|
|
25
|
+
props?.class
|
|
26
|
+
),
|
|
27
|
+
},
|
|
28
|
+
...children
|
|
29
|
+
);
|
|
30
|
+
};
|
|
31
|
+
}
|
package/form/index.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
declare module "@grucloud/bau-ui/form" {
|
|
2
|
+
type DefaultDesignProps = import("../constants").DefaultDesignProps;
|
|
3
|
+
type ComponentOption = import("../bau-ui").ComponentOption;
|
|
4
|
+
|
|
5
|
+
export type FormProps = {} & DefaultDesignProps;
|
|
6
|
+
|
|
7
|
+
type Component = import("../bau-ui").Component<FormProps>;
|
|
8
|
+
|
|
9
|
+
export default function (context: any, option?: ComponentOption): Component;
|
|
10
|
+
}
|
package/form/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./form";
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
const ColorPaletteDefault = [
|
|
2
|
-
["neutral", { h: "0", s: "0%", l: "
|
|
3
|
-
["primary", { h: "230", s: "
|
|
4
|
-
["secondary", { h: "338", s: "
|
|
5
|
-
["success", { h: "120", s: "
|
|
6
|
-
["info", { h: "194", s: "
|
|
7
|
-
["warning", { h: "43", s: "
|
|
8
|
-
["danger", { h: "358", s: "
|
|
2
|
+
["neutral", { h: "0", s: "0%", l: "50%" }],
|
|
3
|
+
["primary", { h: "230", s: "70%", l: "30%" }],
|
|
4
|
+
["secondary", { h: "338", s: "70%", l: "50%" }],
|
|
5
|
+
["success", { h: "120", s: "70%", l: "25%" }],
|
|
6
|
+
["info", { h: "194", s: "70%", l: "30%" }],
|
|
7
|
+
["warning", { h: "43", s: "70%", l: "25%" }],
|
|
8
|
+
["danger", { h: "358", s: "70%", l: "30%" }],
|
|
9
9
|
];
|
|
10
10
|
|
|
11
11
|
const SHADES_LIGHT = [
|
|
@@ -39,6 +39,11 @@ const variantToCss = () =>
|
|
|
39
39
|
`
|
|
40
40
|
).join("\n");
|
|
41
41
|
|
|
42
|
+
const darkColors = () =>
|
|
43
|
+
ColorPaletteDefault.map(([color]) => [
|
|
44
|
+
`--color-${color}-s: var(--color-${color}-dark-s);`,
|
|
45
|
+
]).join("\n");
|
|
46
|
+
|
|
42
47
|
const indexToColor = (index) => {
|
|
43
48
|
return 100 - index * 10;
|
|
44
49
|
};
|
|
@@ -66,8 +71,10 @@ export const buildEmphasis = ({ dark }) =>
|
|
|
66
71
|
const buildColor = ([color, { h, s, l }]) =>
|
|
67
72
|
[
|
|
68
73
|
`--color-${color}-h: ${h};`,
|
|
69
|
-
`--color-${color}-s: ${s};`,
|
|
70
74
|
`--color-${color}-l: ${l};`,
|
|
75
|
+
`--color-${color}-base-s: ${s};`,
|
|
76
|
+
`--color-${color}-s: var(--color-${color}-base-s);`,
|
|
77
|
+
`--color-${color}-dark-s: calc(${s} - 25%);`,
|
|
71
78
|
`--color-${color}-hsl: var(--color-${color}-h), var(--color-${color}-s), var(--color-${color}-l);`,
|
|
72
79
|
`--color-${color}: hsl(var(--color-${color}-hsl));`,
|
|
73
80
|
...SHADES_LIGHT.map(
|
|
@@ -99,7 +106,6 @@ export default function globalStyle(
|
|
|
99
106
|
${buildGrays()}
|
|
100
107
|
${buildEmphasis({})}
|
|
101
108
|
${variantToCss()}
|
|
102
|
-
|
|
103
109
|
--color-content: hsl(0, 0%, 10%);
|
|
104
110
|
--color-content-inverse: hsl(0, 0%, 95%);
|
|
105
111
|
--color-content-secondary: hsl(0, 0%, 30%);
|
|
@@ -122,12 +128,15 @@ export default function globalStyle(
|
|
|
122
128
|
--transition-fast: 200ms;
|
|
123
129
|
--transition-slow: 400ms;
|
|
124
130
|
--shadow-s: 0 1px 2px 0 rgba(0, 0, 0, 0.4);
|
|
125
|
-
--shadow-m: 0
|
|
131
|
+
--shadow-m: 0 3px 1px -2px rgba(0, 0, 0, 0.2),
|
|
132
|
+
0 2px 2px 0 rgba(0, 0, 0, 0.14), 0 1px 5px 0 rgba(0, 0, 0, 0.12);
|
|
133
|
+
--shadow-lg: 0 2px 4px -1px rgba(0, 0, 0, 0.2),
|
|
134
|
+
0 4px 5px 0 rgba(0, 0, 0, 0.14), 0 1px 10px 0 rgba(0, 0, 0, 0.12);
|
|
126
135
|
--font-size-base: 100%;
|
|
127
136
|
--line-height-base: 1.65;
|
|
128
137
|
--link-color: var(--color-primary);
|
|
129
|
-
--brightness-hover-always:
|
|
130
|
-
--brightness-active-always:
|
|
138
|
+
--brightness-hover-always: 120%;
|
|
139
|
+
--brightness-active-always: 130%;
|
|
131
140
|
--brightness-hover: 80%;
|
|
132
141
|
--brightness-hover-reverse: 140%;
|
|
133
142
|
--brightness-active: 90%;
|
|
@@ -157,6 +166,19 @@ export default function globalStyle(
|
|
|
157
166
|
font: var(--font-size-base) / var(--line-height-base) var(--font-family);
|
|
158
167
|
background-color: var(--background-color);
|
|
159
168
|
}
|
|
169
|
+
html[data-theme="dark"] {
|
|
170
|
+
${darkColors()}
|
|
171
|
+
--color-scheme: dark;
|
|
172
|
+
--background-color: #121212;
|
|
173
|
+
--hover-overlay: rgba(255, 255, 255, 0.05);
|
|
174
|
+
--color-content: #e3e3e3;
|
|
175
|
+
--color-content-secondary: rgba(255, 255, 255, 0.7);
|
|
176
|
+
--brightness-hover-always: 130%;
|
|
177
|
+
--brightness-active-always: 120%;
|
|
178
|
+
--brightness-active: 180%;
|
|
179
|
+
--brightness-hover: 150%;
|
|
180
|
+
--brightness-hover-reverse: 70% ${buildEmphasis({ dark: true })};
|
|
181
|
+
}
|
|
160
182
|
body {
|
|
161
183
|
margin: 0;
|
|
162
184
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
declare module "@grucloud/bau-ui/globalStyle" {
|
|
2
|
+
type HSL = {
|
|
3
|
+
h: string;
|
|
4
|
+
s: string;
|
|
5
|
+
l: string;
|
|
6
|
+
};
|
|
7
|
+
export type ColorDefs = [name: any, hsl: HSL];
|
|
8
|
+
|
|
9
|
+
type StyleOption = {
|
|
10
|
+
colorPalette: ColorDefs[];
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export default function (context: any, option?: StyleOption): void;
|
|
14
|
+
}
|
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.42.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "BSD",
|
|
7
7
|
"keywords": [
|
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
"directory": "bau-ui"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@grucloud/bau": "^0.
|
|
22
|
-
"@grucloud/bau-css": "^0.
|
|
21
|
+
"@grucloud/bau": "^0.42.0",
|
|
22
|
+
"@grucloud/bau-css": "^0.42.0"
|
|
23
23
|
},
|
|
24
|
-
"gitHead": "
|
|
24
|
+
"gitHead": "35376e3c8ba424c0adceca4b3928dbf9e7931676"
|
|
25
25
|
}
|
package/pages/login/index.d.ts
CHANGED
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
declare module "@grucloud/bau-ui/pages/login" {
|
|
2
|
-
type ComponentOption = import("
|
|
2
|
+
type ComponentOption = import("../../bau-ui").ComponentOption;
|
|
3
3
|
|
|
4
|
-
export type LoginProps = {
|
|
5
|
-
// severity: string;
|
|
6
|
-
// onRemove?: Function;
|
|
7
|
-
};
|
|
4
|
+
export type LoginProps = {};
|
|
8
5
|
|
|
9
|
-
type Component = import("
|
|
6
|
+
type Component = import("../../bau-ui").Component<LoginProps>;
|
|
10
7
|
|
|
11
8
|
export default function (context: any): Component;
|
|
12
9
|
}
|
package/pages/login/login.js
CHANGED