@grucloud/bau-ui 0.105.0 → 0.201.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/animate/animate.js +3 -0
- package/lazy/lazy.js +8 -11
- package/list/list.js +1 -1
- package/package.json +5 -5
- package/popover/popover.js +14 -8
- package/select/select.js +3 -2
package/animate/animate.js
CHANGED
|
@@ -13,6 +13,8 @@ export default function (context, options = {}) {
|
|
|
13
13
|
bauChildMutated: ({ record, element }) => {
|
|
14
14
|
// Removed Nodes
|
|
15
15
|
[...record.removedNodes].forEach((childNode) => {
|
|
16
|
+
// Only elements can be animated, skip text and comment nodes
|
|
17
|
+
if (childNode.nodeType !== 1) return;
|
|
16
18
|
if (!animationHide() || childNode.getAttribute("cloned")) return;
|
|
17
19
|
const nodeCloned = childNode.cloneNode(true);
|
|
18
20
|
window.requestAnimationFrame(() => {
|
|
@@ -31,6 +33,7 @@ export default function (context, options = {}) {
|
|
|
31
33
|
});
|
|
32
34
|
// Added Nodes
|
|
33
35
|
[...record.addedNodes].forEach((childNode) => {
|
|
36
|
+
if (childNode.nodeType !== 1) return;
|
|
34
37
|
if (childNode.getAttribute("cloned")) return;
|
|
35
38
|
window.requestAnimationFrame(() => {
|
|
36
39
|
element.style.position = "relative";
|
package/lazy/lazy.js
CHANGED
|
@@ -25,18 +25,20 @@ export default function (context, options = {}) {
|
|
|
25
25
|
|
|
26
26
|
return function Lazy({
|
|
27
27
|
getModule,
|
|
28
|
-
loading = loadingDefault,
|
|
29
|
-
error = errorDefault,
|
|
28
|
+
loading = options.loading ?? loadingDefault,
|
|
29
|
+
error = options.error ?? errorDefault,
|
|
30
30
|
props = {},
|
|
31
31
|
}) {
|
|
32
|
+
// The element of the component, created once its module is loaded
|
|
32
33
|
const componentState = bau.state(undefined);
|
|
33
|
-
const loadingState = bau.state(true);
|
|
34
34
|
const errorState = bau.state(false);
|
|
35
35
|
|
|
36
|
+
// The component is created here, not while the div renders: the states
|
|
37
|
+
// it reads while it is created, like a query run by a page, would
|
|
38
|
+
// re-render the div and create the component again.
|
|
36
39
|
getModule()
|
|
37
40
|
.then((module) => {
|
|
38
|
-
componentState.val = module.default(context);
|
|
39
|
-
loadingState.val = false;
|
|
41
|
+
componentState.val = module.default(context)(props);
|
|
40
42
|
})
|
|
41
43
|
.catch((error) => {
|
|
42
44
|
errorState.val = error.message;
|
|
@@ -46,12 +48,7 @@ export default function (context, options = {}) {
|
|
|
46
48
|
if (errorState.val) {
|
|
47
49
|
return error({ message: errorState.val });
|
|
48
50
|
}
|
|
49
|
-
|
|
50
|
-
return loading();
|
|
51
|
-
}
|
|
52
|
-
if (componentState.val) {
|
|
53
|
-
return componentState.val(props);
|
|
54
|
-
}
|
|
51
|
+
return componentState.val ?? loading();
|
|
55
52
|
});
|
|
56
53
|
};
|
|
57
54
|
}
|
package/list/list.js
CHANGED
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.201.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "BSD",
|
|
7
7
|
"keywords": [
|
|
@@ -16,15 +16,15 @@
|
|
|
16
16
|
},
|
|
17
17
|
"repository": {
|
|
18
18
|
"type": "git",
|
|
19
|
-
"url": "git
|
|
19
|
+
"url": "git+https://github.com/grucloud/bau.git",
|
|
20
20
|
"directory": "bau-ui"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@grucloud/bau": "^0.
|
|
24
|
-
"@grucloud/bau-css": "^0.
|
|
23
|
+
"@grucloud/bau": "^0.201.0",
|
|
24
|
+
"@grucloud/bau-css": "^0.201.0"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"typedoc": "0.24.8"
|
|
28
28
|
},
|
|
29
|
-
"gitHead": "
|
|
29
|
+
"gitHead": "cfc6c52e67c919fe349efbd4bc7667f45c49f0e9"
|
|
30
30
|
}
|
package/popover/popover.js
CHANGED
|
@@ -12,8 +12,17 @@ export default function (context, options) {
|
|
|
12
12
|
box-shadow: var(--shadow-m);
|
|
13
13
|
padding: 0rem;
|
|
14
14
|
margin: 0rem;
|
|
15
|
-
|
|
15
|
+
/* Fade in and out. "overlay" and "display" keep the dialog on screen
|
|
16
|
+
while it fades out, after close() has already made the page usable */
|
|
17
|
+
transition: opacity 0.3s ease-in-out, overlay 0.3s allow-discrete,
|
|
18
|
+
display 0.3s allow-discrete;
|
|
16
19
|
opacity: 0;
|
|
20
|
+
&[open] {
|
|
21
|
+
opacity: 1;
|
|
22
|
+
@starting-style {
|
|
23
|
+
opacity: 0;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
17
26
|
`;
|
|
18
27
|
|
|
19
28
|
return function Popover(...args) {
|
|
@@ -21,7 +30,6 @@ export default function (context, options) {
|
|
|
21
30
|
toPropsAndChildren(args);
|
|
22
31
|
|
|
23
32
|
const openDialog = (event) => {
|
|
24
|
-
dialogEl.style.opacity = 1;
|
|
25
33
|
dialogEl.showModal();
|
|
26
34
|
const rectAnchor = triggerEl.getBoundingClientRect();
|
|
27
35
|
const rectDialog = dialogEl.getBoundingClientRect();
|
|
@@ -46,13 +54,11 @@ export default function (context, options) {
|
|
|
46
54
|
}
|
|
47
55
|
};
|
|
48
56
|
|
|
57
|
+
// Close at once: a modal dialog makes the rest of the page inert, waiting
|
|
58
|
+
// for the end of the fade out left the page unusable meanwhile (and for
|
|
59
|
+
// ever if the transition did not run). The CSS above does the fade out.
|
|
49
60
|
const closeDialog = (event) => {
|
|
50
|
-
|
|
51
|
-
dialogEl.close();
|
|
52
|
-
dialogEl.removeEventListener("transitionend", listener);
|
|
53
|
-
};
|
|
54
|
-
dialogEl.addEventListener("transitionend", listener);
|
|
55
|
-
dialogEl.style.opacity = 0;
|
|
61
|
+
dialogEl.close();
|
|
56
62
|
};
|
|
57
63
|
|
|
58
64
|
const dialogEl = dialog(
|
package/select/select.js
CHANGED
|
@@ -140,7 +140,7 @@ export default function (context, componentOptions = {}) {
|
|
|
140
140
|
case "Enter":
|
|
141
141
|
if (popoverEl.open) {
|
|
142
142
|
inputState.val = getOptionLabel(options[itemIndexActive.val]);
|
|
143
|
-
selectEl.value = getOptionValue(
|
|
143
|
+
selectEl.value = getOptionValue(options[itemIndexActive.val]);
|
|
144
144
|
onSelect(options[itemIndexActive.val]);
|
|
145
145
|
dialogClose();
|
|
146
146
|
} else {
|
|
@@ -191,7 +191,8 @@ export default function (context, componentOptions = {}) {
|
|
|
191
191
|
});
|
|
192
192
|
// Hidden select, required to save the value.
|
|
193
193
|
const selectEl = select(
|
|
194
|
-
|
|
194
|
+
// Hidden from assistive technologies too: the button is the combobox
|
|
195
|
+
{ ...props, "aria-label": label, tabindex: "-1", "aria-hidden": "true" },
|
|
195
196
|
option({ value: "" }, "--Select Category--"),
|
|
196
197
|
options.map((opt) =>
|
|
197
198
|
option({ value: getOptionValue(opt) }, getOptionLabel(opt))
|