@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
|
@@ -0,0 +1,105 @@
|
|
|
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 { div } = bau.tags;
|
|
7
|
+
const className = css`
|
|
8
|
+
display: inline-block;
|
|
9
|
+
position: relative;
|
|
10
|
+
overflow: hidden;
|
|
11
|
+
& img {
|
|
12
|
+
object-fit: contain;
|
|
13
|
+
}
|
|
14
|
+
& .control {
|
|
15
|
+
z-index: 1;
|
|
16
|
+
position: absolute;
|
|
17
|
+
padding: 0.5rem;
|
|
18
|
+
cursor: pointer;
|
|
19
|
+
}
|
|
20
|
+
& .control-previous {
|
|
21
|
+
top: 50%;
|
|
22
|
+
transform: translateY(-50%);
|
|
23
|
+
}
|
|
24
|
+
& .control-next {
|
|
25
|
+
top: 50%;
|
|
26
|
+
transform: translateY(-50%);
|
|
27
|
+
right: 0;
|
|
28
|
+
}
|
|
29
|
+
& .track {
|
|
30
|
+
display: flex;
|
|
31
|
+
flex-direction: row;
|
|
32
|
+
transition: all var(--transition-slow);
|
|
33
|
+
}
|
|
34
|
+
`;
|
|
35
|
+
|
|
36
|
+
const slideIndex = bau.state(0);
|
|
37
|
+
|
|
38
|
+
return function Carousel(...args) {
|
|
39
|
+
let [
|
|
40
|
+
{
|
|
41
|
+
color,
|
|
42
|
+
variant = "plain",
|
|
43
|
+
size = "md",
|
|
44
|
+
slides,
|
|
45
|
+
Slide,
|
|
46
|
+
Previous,
|
|
47
|
+
Next,
|
|
48
|
+
...props
|
|
49
|
+
},
|
|
50
|
+
] = toPropsAndChildren(args);
|
|
51
|
+
|
|
52
|
+
const onclickPrevious = () => {
|
|
53
|
+
if (slideIndex.val <= 0) {
|
|
54
|
+
slideIndex.val = slides.length - 1;
|
|
55
|
+
} else {
|
|
56
|
+
slideIndex.val--;
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
const onclickNext = () => {
|
|
61
|
+
if (slideIndex.val >= slides.length - 1) {
|
|
62
|
+
slideIndex.val = 0;
|
|
63
|
+
} else {
|
|
64
|
+
slideIndex.val++;
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
const trackEl = div(
|
|
69
|
+
{
|
|
70
|
+
class: "track",
|
|
71
|
+
style: () => `transform: translateX(${-100 * slideIndex.val}%);`,
|
|
72
|
+
},
|
|
73
|
+
slides.map(Slide)
|
|
74
|
+
);
|
|
75
|
+
|
|
76
|
+
return div(
|
|
77
|
+
{
|
|
78
|
+
...props,
|
|
79
|
+
class: classNames(
|
|
80
|
+
"carousel",
|
|
81
|
+
size,
|
|
82
|
+
className,
|
|
83
|
+
options?.class,
|
|
84
|
+
props?.class
|
|
85
|
+
),
|
|
86
|
+
},
|
|
87
|
+
|
|
88
|
+
div(
|
|
89
|
+
{
|
|
90
|
+
class: classNames("control", "control-previous"),
|
|
91
|
+
onclick: onclickPrevious,
|
|
92
|
+
},
|
|
93
|
+
Previous()
|
|
94
|
+
),
|
|
95
|
+
div(
|
|
96
|
+
{
|
|
97
|
+
class: classNames("control", "control-next"),
|
|
98
|
+
onclick: onclickNext,
|
|
99
|
+
},
|
|
100
|
+
Next()
|
|
101
|
+
),
|
|
102
|
+
trackEl
|
|
103
|
+
);
|
|
104
|
+
};
|
|
105
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
declare module "@grucloud/bau-ui/carousel" {
|
|
2
|
+
type DefaultDesignProps = import("../constants").DefaultDesignProps;
|
|
3
|
+
type ComponentOption = import("../bau-ui").ComponentOption;
|
|
4
|
+
|
|
5
|
+
type Slide = {
|
|
6
|
+
src: string;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
type CommandProp = {};
|
|
10
|
+
type ComponentGeneric = import("../bau-ui").ComponentWithProp<CommandProp>;
|
|
11
|
+
|
|
12
|
+
export type CarouselProps = {
|
|
13
|
+
slides: object[];
|
|
14
|
+
Slide: ComponentGeneric;
|
|
15
|
+
Previous: ComponentGeneric;
|
|
16
|
+
Next: ComponentGeneric;
|
|
17
|
+
} & DefaultDesignProps;
|
|
18
|
+
|
|
19
|
+
type Component = import("../bau-ui").Component<CarouselProps>;
|
|
20
|
+
|
|
21
|
+
export default function (context: any, option?: ComponentOption): Component;
|
|
22
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./carousel";
|
package/chip/chip.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import classNames from "@grucloud/bau-css/classNames.js";
|
|
2
2
|
import { toPropsAndChildren } from "@grucloud/bau/bau.js";
|
|
3
3
|
|
|
4
|
-
export default function (context, options) {
|
|
4
|
+
export default function (context, options = {}) {
|
|
5
5
|
const { bau, css } = context;
|
|
6
6
|
const { span } = bau.tags;
|
|
7
7
|
|
|
@@ -9,10 +9,10 @@ export default function (context, options) {
|
|
|
9
9
|
display: inline-block;
|
|
10
10
|
box-sizing: border-box;
|
|
11
11
|
border-radius: var(--global-radius);
|
|
12
|
-
padding: 0.2rem 0.5rem;
|
|
13
12
|
overflow: hidden;
|
|
14
13
|
text-overflow: ellipsis;
|
|
15
14
|
white-space: nowrap;
|
|
15
|
+
vertical-align: middle;
|
|
16
16
|
&.clickable {
|
|
17
17
|
cursor: pointer;
|
|
18
18
|
}
|
|
@@ -30,9 +30,9 @@ export default function (context, options) {
|
|
|
30
30
|
return function Chip(...args) {
|
|
31
31
|
let [
|
|
32
32
|
{
|
|
33
|
-
size = "md",
|
|
34
|
-
variant = "outline",
|
|
35
|
-
color = "neutral",
|
|
33
|
+
size = options.size ?? "md",
|
|
34
|
+
variant = options.variant ?? "outline",
|
|
35
|
+
color = options.color ?? "neutral",
|
|
36
36
|
onclick,
|
|
37
37
|
...props
|
|
38
38
|
},
|
|
@@ -45,13 +45,13 @@ export default function (context, options) {
|
|
|
45
45
|
onclick,
|
|
46
46
|
class: classNames(
|
|
47
47
|
"chip",
|
|
48
|
-
|
|
48
|
+
options.class,
|
|
49
49
|
size,
|
|
50
50
|
variant,
|
|
51
51
|
color,
|
|
52
52
|
onclick && "clickable",
|
|
53
|
-
|
|
54
|
-
props
|
|
53
|
+
className,
|
|
54
|
+
props.class
|
|
55
55
|
),
|
|
56
56
|
},
|
|
57
57
|
...children
|
|
@@ -0,0 +1,121 @@
|
|
|
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 { div } = bau.tags;
|
|
7
|
+
const className = css`
|
|
8
|
+
overflow: hidden;
|
|
9
|
+
background-color: inherit;
|
|
10
|
+
display: flex;
|
|
11
|
+
flex-direction: column;
|
|
12
|
+
& .header {
|
|
13
|
+
display: flex;
|
|
14
|
+
align-items: center;
|
|
15
|
+
justify-content: space-between;
|
|
16
|
+
background-color: inherit;
|
|
17
|
+
&::after {
|
|
18
|
+
padding: 0.5rem;
|
|
19
|
+
transition: transform var(--transition-fast) linear;
|
|
20
|
+
line-height: 1rem;
|
|
21
|
+
}
|
|
22
|
+
&.close::after {
|
|
23
|
+
content: "\u203A";
|
|
24
|
+
padding: 0.5rem;
|
|
25
|
+
}
|
|
26
|
+
&.open::after {
|
|
27
|
+
content: "\u203A";
|
|
28
|
+
padding: 0.5rem;
|
|
29
|
+
transform: rotate(90deg);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
& .content {
|
|
33
|
+
background-color: inherit;
|
|
34
|
+
will-change: height;
|
|
35
|
+
transition: height var(--transition-fast) ease-out;
|
|
36
|
+
overflow-y: scroll;
|
|
37
|
+
}
|
|
38
|
+
`;
|
|
39
|
+
|
|
40
|
+
const collapseOrExpandSection = ({ element, closeState }) => {
|
|
41
|
+
if (element.scrollHeight == 0) return;
|
|
42
|
+
closeState.val ? collapseSection(element) : expandSection(element);
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
function collapseSection(element) {
|
|
46
|
+
element.style.height = element.scrollHeight + "px";
|
|
47
|
+
const animationEndHandler = () => {
|
|
48
|
+
element.removeEventListener("transitionend", animationEndHandler);
|
|
49
|
+
};
|
|
50
|
+
element.addEventListener("transitionend", animationEndHandler);
|
|
51
|
+
window.requestAnimationFrame(() => {
|
|
52
|
+
element.style.height = "0px";
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function expandSection(element) {
|
|
57
|
+
const animationEndHandler = () => {
|
|
58
|
+
element.removeEventListener("transitionend", animationEndHandler);
|
|
59
|
+
element.style.height = null;
|
|
60
|
+
};
|
|
61
|
+
element.addEventListener("transitionend", animationEndHandler);
|
|
62
|
+
element.style.height = element.scrollHeight + "px";
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
return function Collapsible(...args) {
|
|
66
|
+
let [
|
|
67
|
+
{
|
|
68
|
+
color,
|
|
69
|
+
variant = "plain",
|
|
70
|
+
size = "md",
|
|
71
|
+
Header,
|
|
72
|
+
Content,
|
|
73
|
+
close = true,
|
|
74
|
+
...props
|
|
75
|
+
},
|
|
76
|
+
] = toPropsAndChildren(args);
|
|
77
|
+
|
|
78
|
+
const closeState = bau.state(close);
|
|
79
|
+
|
|
80
|
+
return div(
|
|
81
|
+
{
|
|
82
|
+
...props,
|
|
83
|
+
class: classNames(
|
|
84
|
+
"collapsible",
|
|
85
|
+
size,
|
|
86
|
+
className,
|
|
87
|
+
options?.class,
|
|
88
|
+
props?.class
|
|
89
|
+
),
|
|
90
|
+
},
|
|
91
|
+
div(
|
|
92
|
+
{
|
|
93
|
+
class: () =>
|
|
94
|
+
classNames(
|
|
95
|
+
"header",
|
|
96
|
+
Content ? (closeState.val ? "close" : "open") : ""
|
|
97
|
+
),
|
|
98
|
+
onclick: (event) => {
|
|
99
|
+
closeState.val = !closeState.val;
|
|
100
|
+
event.stopPropagation();
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
Header()
|
|
104
|
+
),
|
|
105
|
+
div(
|
|
106
|
+
{
|
|
107
|
+
class: "content",
|
|
108
|
+
role: "region",
|
|
109
|
+
bauMounted: ({ element }) => {
|
|
110
|
+
closeState.val && (element.style.height = "0px");
|
|
111
|
+
},
|
|
112
|
+
"aria-expanded": ({ element }) => {
|
|
113
|
+
collapseOrExpandSection({ element, closeState });
|
|
114
|
+
return !closeState.val;
|
|
115
|
+
},
|
|
116
|
+
},
|
|
117
|
+
Content && Content()
|
|
118
|
+
)
|
|
119
|
+
);
|
|
120
|
+
};
|
|
121
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
declare module "@grucloud/bau-ui/collapsible" {
|
|
2
|
+
type DefaultDesignProps = import("../constants").DefaultDesignProps;
|
|
3
|
+
type ComponentOption = import("../bau-ui").ComponentOption;
|
|
4
|
+
|
|
5
|
+
export type CollapsibleProps = {} & DefaultDesignProps;
|
|
6
|
+
|
|
7
|
+
type Component = import("../bau-ui").Component<CollapsibleProps>;
|
|
8
|
+
|
|
9
|
+
export default function (context: any, option?: ComponentOption): Component;
|
|
10
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./collapsible";
|
package/constants.d.ts
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
|
-
export type Variant = "plain" | "outline" | "soft" | "solid";
|
|
1
|
+
export type Variant = "plain" | "outline" | "soft" | "solid" | "none";
|
|
2
2
|
export type Size = "sm" | "md" | "lg";
|
|
3
|
-
export type Color =
|
|
3
|
+
export type Color =
|
|
4
|
+
| "primary"
|
|
5
|
+
| "neutral"
|
|
6
|
+
| "success"
|
|
7
|
+
| "danger"
|
|
8
|
+
| "warning"
|
|
9
|
+
| "none";
|
|
4
10
|
|
|
5
11
|
export const Variants: Variant[];
|
|
6
12
|
export const Colors: Color[];
|
package/constants.js
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
-
export const Colors = [
|
|
1
|
+
export const Colors = [
|
|
2
|
+
"neutral",
|
|
3
|
+
"primary",
|
|
4
|
+
"success",
|
|
5
|
+
"danger",
|
|
6
|
+
"warning",
|
|
7
|
+
//"none",
|
|
8
|
+
];
|
|
2
9
|
export const Variants = ["plain", "outline", "solid"];
|
|
3
10
|
export const Sizes = ["sm", "md", "lg"];
|
package/context.d.ts
CHANGED
|
@@ -64,16 +64,22 @@ const createStyles = ({ keyframes }) => {
|
|
|
64
64
|
};
|
|
65
65
|
};
|
|
66
66
|
|
|
67
|
-
export default function (context, options) {
|
|
68
|
-
const { bau, css, window } = context;
|
|
69
|
-
const { base = "" } = options;
|
|
67
|
+
export default function (context, options = {}) {
|
|
68
|
+
const { bau, css, window, config } = context;
|
|
69
|
+
const { base = "", hashBased = false } = options;
|
|
70
|
+
const baseUrl = `${config.base}${base}`;
|
|
71
|
+
const backHref = (currentTree) =>
|
|
72
|
+
currentTree.parentTree.data?.href ??
|
|
73
|
+
currentTree.parentTree.children[0].data.href;
|
|
70
74
|
|
|
71
|
-
const renderHeaderDefault = ({ currentTree, data }) =>
|
|
75
|
+
const renderHeaderDefault = ({ variant, color, size, currentTree, data }) =>
|
|
72
76
|
header(
|
|
73
77
|
Button(
|
|
74
78
|
{
|
|
75
|
-
variant
|
|
76
|
-
|
|
79
|
+
variant,
|
|
80
|
+
color,
|
|
81
|
+
size,
|
|
82
|
+
href: `${baseUrl}${backHref(currentTree)}`,
|
|
77
83
|
class: css`
|
|
78
84
|
flex-grow: 0;
|
|
79
85
|
`,
|
|
@@ -83,8 +89,10 @@ export default function (context, options) {
|
|
|
83
89
|
),
|
|
84
90
|
Button(
|
|
85
91
|
{
|
|
86
|
-
variant
|
|
87
|
-
|
|
92
|
+
variant,
|
|
93
|
+
color,
|
|
94
|
+
size,
|
|
95
|
+
href: `${baseUrl}${data.href}`,
|
|
88
96
|
class: css`
|
|
89
97
|
flex-grow: 1;
|
|
90
98
|
`,
|
|
@@ -94,17 +102,24 @@ export default function (context, options) {
|
|
|
94
102
|
)
|
|
95
103
|
);
|
|
96
104
|
|
|
97
|
-
const renderMenuItemDefault = ({
|
|
105
|
+
const renderMenuItemDefault = ({
|
|
106
|
+
size,
|
|
107
|
+
subTree: {
|
|
108
|
+
data: { name, href },
|
|
109
|
+
children = [],
|
|
110
|
+
},
|
|
111
|
+
}) =>
|
|
98
112
|
Button(
|
|
99
113
|
{
|
|
100
|
-
|
|
114
|
+
size,
|
|
115
|
+
href: `${baseUrl}${href}`,
|
|
101
116
|
"data-ischild": !children.length,
|
|
102
117
|
},
|
|
103
118
|
name
|
|
104
119
|
);
|
|
105
120
|
|
|
106
|
-
const isActiveDefault = ({ subTree }) =>
|
|
107
|
-
|
|
121
|
+
const isActiveDefault = ({ pathname, subTree }) =>
|
|
122
|
+
pathname === subTree?.data?.href;
|
|
108
123
|
|
|
109
124
|
const {
|
|
110
125
|
renderHeader = renderHeaderDefault,
|
|
@@ -129,17 +144,21 @@ export default function (context, options) {
|
|
|
129
144
|
font-weight: var(--font-weight-semibold);
|
|
130
145
|
overflow: hidden;
|
|
131
146
|
position: relative;
|
|
132
|
-
|
|
133
147
|
& header {
|
|
134
148
|
display: flex;
|
|
135
149
|
align-items: center;
|
|
136
150
|
font-weight: var(--font-weight-bold);
|
|
137
|
-
border-bottom: 1px solid var(--color-emphasis-200);
|
|
138
151
|
& a {
|
|
139
152
|
padding: 0.6rem;
|
|
140
153
|
border-radius: 0;
|
|
154
|
+
font-weight: 600;
|
|
141
155
|
}
|
|
142
156
|
}
|
|
157
|
+
& a,
|
|
158
|
+
& ul {
|
|
159
|
+
border-width: 0 !important;
|
|
160
|
+
box-shadow: none !important;
|
|
161
|
+
}
|
|
143
162
|
& ul {
|
|
144
163
|
overflow: hidden;
|
|
145
164
|
& .has-children {
|
|
@@ -159,10 +178,9 @@ export default function (context, options) {
|
|
|
159
178
|
|
|
160
179
|
const Menu = ({ variant, color, size, currentTree, pathnameState }) => {
|
|
161
180
|
const { children, parentTree, data } = currentTree;
|
|
162
|
-
//console.log("Menu", currentTree, pathnameState.val);
|
|
163
181
|
return div(
|
|
164
182
|
{ class: cn("drillDownMenu", variant, color, size) },
|
|
165
|
-
parentTree && renderHeader({ data, currentTree }),
|
|
183
|
+
parentTree && renderHeader({ variant, color, size, data, currentTree }),
|
|
166
184
|
children &&
|
|
167
185
|
List(
|
|
168
186
|
{ class: cn(variant, color, size) },
|
|
@@ -176,7 +194,7 @@ export default function (context, options) {
|
|
|
176
194
|
"active"
|
|
177
195
|
),
|
|
178
196
|
},
|
|
179
|
-
renderMenuItem(subTree)
|
|
197
|
+
renderMenuItem({ variant, color, size, subTree })
|
|
180
198
|
)
|
|
181
199
|
)
|
|
182
200
|
)
|
|
@@ -187,7 +205,7 @@ export default function (context, options) {
|
|
|
187
205
|
let currentTree = treeAddParent({})(structuredClone(tree));
|
|
188
206
|
let subTree = findSubTree(pathname)(currentTree);
|
|
189
207
|
if (!subTree) {
|
|
190
|
-
console.
|
|
208
|
+
console.error("drilldown no sub tree", pathname);
|
|
191
209
|
subTree = currentTree;
|
|
192
210
|
}
|
|
193
211
|
return subTree;
|
|
@@ -199,10 +217,32 @@ export default function (context, options) {
|
|
|
199
217
|
color = "neutral",
|
|
200
218
|
size = "md",
|
|
201
219
|
tree,
|
|
202
|
-
pathnameState = bau.state(window.location.pathname),
|
|
203
220
|
...otherProps
|
|
204
221
|
} = props;
|
|
205
222
|
|
|
223
|
+
const pathnameState = bau.state(
|
|
224
|
+
window.location.pathname.replace(baseUrl, "")
|
|
225
|
+
);
|
|
226
|
+
|
|
227
|
+
const treeState = bau.derive(() =>
|
|
228
|
+
findInitialTree({
|
|
229
|
+
tree,
|
|
230
|
+
pathname: pathnameState.val,
|
|
231
|
+
})
|
|
232
|
+
);
|
|
233
|
+
|
|
234
|
+
window.document.addEventListener("click", (event) => {
|
|
235
|
+
const { target } = event;
|
|
236
|
+
const href = target.getAttribute("href");
|
|
237
|
+
if (target.tagName === "A" && href && !href.startsWith("http")) {
|
|
238
|
+
let path = href.replace(baseUrl, "");
|
|
239
|
+
if (!hashBased) {
|
|
240
|
+
path = path.replace(target.hash, "");
|
|
241
|
+
}
|
|
242
|
+
pathnameState.val = path;
|
|
243
|
+
}
|
|
244
|
+
});
|
|
245
|
+
|
|
206
246
|
let direction = 1;
|
|
207
247
|
|
|
208
248
|
const onclick = (event) => {
|
|
@@ -216,13 +256,6 @@ export default function (context, options) {
|
|
|
216
256
|
}
|
|
217
257
|
};
|
|
218
258
|
|
|
219
|
-
const treeState = bau.derive(() =>
|
|
220
|
-
findInitialTree({
|
|
221
|
-
tree,
|
|
222
|
-
pathname: pathnameState.val,
|
|
223
|
-
})
|
|
224
|
-
);
|
|
225
|
-
|
|
226
259
|
const animationHide = (direction) => {
|
|
227
260
|
switch (direction) {
|
|
228
261
|
case 1:
|
package/drillDownMenu/index.d.ts
CHANGED
|
@@ -20,6 +20,7 @@ declare module "@grucloud/bau-ui/drillDownMenu" {
|
|
|
20
20
|
renderMenuItem?: ComponentGeneric;
|
|
21
21
|
isActive?: (input: { subTree: object }) => boolean;
|
|
22
22
|
base?: string;
|
|
23
|
+
hashBased?: boolean;
|
|
23
24
|
} & ComponentOption;
|
|
24
25
|
|
|
25
26
|
export default function (context: Object, option: Option): Component;
|
package/fileInput/fileInput.js
CHANGED
|
@@ -7,10 +7,7 @@ export default function (context, options) {
|
|
|
7
7
|
|
|
8
8
|
const style = {
|
|
9
9
|
base: css`
|
|
10
|
-
display: inline-
|
|
11
|
-
> * {
|
|
12
|
-
margin: 1rem 0;
|
|
13
|
-
}
|
|
10
|
+
display: inline-flex;
|
|
14
11
|
& input {
|
|
15
12
|
width: 0.1px;
|
|
16
13
|
height: 0.1px;
|
|
@@ -26,8 +23,9 @@ export default function (context, options) {
|
|
|
26
23
|
text-overflow: ellipsis;
|
|
27
24
|
}
|
|
28
25
|
& label {
|
|
26
|
+
padding: 1rem;
|
|
29
27
|
border-radius: var(--global-radius);
|
|
30
|
-
display: flex;
|
|
28
|
+
display: inline-flex;
|
|
31
29
|
justify-content: center;
|
|
32
30
|
align-items: center;
|
|
33
31
|
cursor: pointer;
|
package/form/form.js
CHANGED
|
@@ -5,7 +5,38 @@ export default function (context, options) {
|
|
|
5
5
|
const { bau, css } = context;
|
|
6
6
|
const { form } = bau.tags;
|
|
7
7
|
|
|
8
|
-
const className = css
|
|
8
|
+
const className = css`
|
|
9
|
+
display: flex;
|
|
10
|
+
flex-direction: column;
|
|
11
|
+
align-items: stretch;
|
|
12
|
+
gap: 1rem;
|
|
13
|
+
padding: 1rem;
|
|
14
|
+
min-width: 350px;
|
|
15
|
+
& > header {
|
|
16
|
+
text-align: center;
|
|
17
|
+
& h1 {
|
|
18
|
+
line-height: 0;
|
|
19
|
+
font-size: 1.3rem;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
& section {
|
|
23
|
+
display: flex;
|
|
24
|
+
flex-direction: column;
|
|
25
|
+
gap: 1rem;
|
|
26
|
+
}
|
|
27
|
+
& label {
|
|
28
|
+
display: inline-flex;
|
|
29
|
+
flex-direction: column;
|
|
30
|
+
gap: 0.3rem;
|
|
31
|
+
font-weight: 500;
|
|
32
|
+
font-size: smaller;
|
|
33
|
+
color: var(--color-content-secondary);
|
|
34
|
+
}
|
|
35
|
+
& > footer {
|
|
36
|
+
display: flex;
|
|
37
|
+
gap: 1rem;
|
|
38
|
+
}
|
|
39
|
+
`;
|
|
9
40
|
|
|
10
41
|
return function Form(...args) {
|
|
11
42
|
let [
|
package/input/input.js
CHANGED
|
@@ -16,14 +16,9 @@ const colorsToCss = () =>
|
|
|
16
16
|
&.input.outline.${color} {
|
|
17
17
|
border: 1px solid var(--color-${color});
|
|
18
18
|
&:focus {
|
|
19
|
-
|
|
19
|
+
outline: 4px auto var(--color-${color});
|
|
20
20
|
};
|
|
21
21
|
}
|
|
22
|
-
&.input.soft.${color} {
|
|
23
|
-
&:focus {
|
|
24
|
-
border-color: var(--color-${color});
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
22
|
&.input.solid.${color} {
|
|
28
23
|
&:focus {
|
|
29
24
|
border-color: var(--color-${color});
|
|
@@ -39,7 +34,7 @@ const colorsToCss = () =>
|
|
|
39
34
|
`
|
|
40
35
|
).join("\n");
|
|
41
36
|
|
|
42
|
-
export default function (context, options) {
|
|
37
|
+
export default function (context, options = {}) {
|
|
43
38
|
const { bau, css } = context;
|
|
44
39
|
const { input } = bau.tags;
|
|
45
40
|
|
|
@@ -54,6 +49,10 @@ export default function (context, options) {
|
|
|
54
49
|
&.input:hover {
|
|
55
50
|
background-color: var(--color-emphasis-100);
|
|
56
51
|
}
|
|
52
|
+
&.input:disabled {
|
|
53
|
+
filter: grayscale(100%);
|
|
54
|
+
background-color: var(--color-emphasis-100);
|
|
55
|
+
}
|
|
57
56
|
&.sm {
|
|
58
57
|
padding: 0.4rem;
|
|
59
58
|
}
|
|
@@ -68,24 +67,25 @@ export default function (context, options) {
|
|
|
68
67
|
|
|
69
68
|
return function Input(props) {
|
|
70
69
|
const {
|
|
71
|
-
size = "md",
|
|
72
|
-
variant = "outline",
|
|
73
|
-
color = "neutral",
|
|
74
|
-
name,
|
|
75
|
-
id,
|
|
70
|
+
size = options.size ?? "md",
|
|
71
|
+
variant = options.variant ?? "outline",
|
|
72
|
+
color = options.color ?? "neutral",
|
|
76
73
|
disabled,
|
|
77
74
|
...otherProps
|
|
78
75
|
} = props;
|
|
79
76
|
|
|
80
77
|
return input({
|
|
78
|
+
type: "text",
|
|
81
79
|
...otherProps,
|
|
80
|
+
disabled,
|
|
82
81
|
class: classNames(
|
|
83
82
|
"input",
|
|
83
|
+
options.class,
|
|
84
84
|
size,
|
|
85
85
|
color,
|
|
86
86
|
variant,
|
|
87
87
|
className,
|
|
88
|
-
|
|
88
|
+
disabled && "disabled",
|
|
89
89
|
otherProps.class
|
|
90
90
|
),
|
|
91
91
|
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
declare module "@grucloud/bau-ui/linearProgress" {
|
|
2
|
+
type DefaultDesignProps = import("../constants").DefaultDesignProps;
|
|
3
|
+
type ComponentOption = import("../bau-ui").ComponentOption;
|
|
4
|
+
|
|
5
|
+
export type LinearProgressProps = {
|
|
6
|
+
running: boolean | import("@grucloud/bau").State<boolean>;
|
|
7
|
+
} & DefaultDesignProps;
|
|
8
|
+
|
|
9
|
+
type Component = import("../bau-ui").Component<LinearProgressProps>;
|
|
10
|
+
|
|
11
|
+
export default function (context: any, option?: ComponentOption): Component;
|
|
12
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./linearProgress";
|