@grucloud/bau-ui 0.54.0 → 0.55.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/accordion/accordion.js +1 -1
- package/alert/alert.js +11 -1
- package/autocomplete/autocomplete.js +1 -1
- package/avatar/avatar.js +5 -1
- package/bau-ui.d.ts +9 -1
- package/button/button.js +1 -1
- package/chip/chip.js +4 -1
- package/drillDownMenu/drillDownMenu.js +2 -1
- package/form/form.js +1 -1
- package/package.json +4 -4
- package/skeleton/skeleton.js +2 -2
- package/stepper/index.d.ts +1 -0
- package/stepper/stepper.js +68 -25
package/accordion/accordion.js
CHANGED
package/alert/alert.js
CHANGED
|
@@ -17,6 +17,16 @@ const colorsToCss = () =>
|
|
|
17
17
|
(color) =>
|
|
18
18
|
`
|
|
19
19
|
&.alert {
|
|
20
|
+
&.sm {
|
|
21
|
+
& .icon {
|
|
22
|
+
font-size: 1.3rem;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
&.lg {
|
|
26
|
+
& .icon {
|
|
27
|
+
font-size: 2.5rem;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
20
30
|
&.plain.${color} {
|
|
21
31
|
& .icon {
|
|
22
32
|
color: var(--color-${color})
|
|
@@ -45,7 +55,7 @@ export default function (context, options = {}) {
|
|
|
45
55
|
border-radius: var(--global-radius);
|
|
46
56
|
& .icon {
|
|
47
57
|
padding: 0 0.5rem;
|
|
48
|
-
font-size:
|
|
58
|
+
font-size: 2rem;
|
|
49
59
|
}
|
|
50
60
|
& .content {
|
|
51
61
|
padding: 0 0.5rem;
|
package/avatar/avatar.js
CHANGED
|
@@ -42,6 +42,9 @@ export default function (context, options = {}) {
|
|
|
42
42
|
visibility: visible;
|
|
43
43
|
opacity: 1;
|
|
44
44
|
}
|
|
45
|
+
& .hide {
|
|
46
|
+
display: none;
|
|
47
|
+
}
|
|
45
48
|
`;
|
|
46
49
|
return function Avatar(...args) {
|
|
47
50
|
let [
|
|
@@ -81,7 +84,8 @@ export default function (context, options = {}) {
|
|
|
81
84
|
onerror,
|
|
82
85
|
class: () =>
|
|
83
86
|
classNames(
|
|
84
|
-
!
|
|
87
|
+
!loadingState.val && "visible",
|
|
88
|
+
errorState.val && "hide",
|
|
85
89
|
color,
|
|
86
90
|
variant,
|
|
87
91
|
size,
|
package/bau-ui.d.ts
CHANGED
|
@@ -14,7 +14,15 @@ export type Component<
|
|
|
14
14
|
export type ComponentWithProp<TProps, TElement = HTMLElement> = (
|
|
15
15
|
props: TProps & import("@grucloud/bau").PropsAll<TElement>,
|
|
16
16
|
...rest: readonly ChildDom[]
|
|
17
|
-
) =>
|
|
17
|
+
) =>
|
|
18
|
+
| TElement
|
|
19
|
+
| TElement[]
|
|
20
|
+
| string
|
|
21
|
+
| number
|
|
22
|
+
| boolean
|
|
23
|
+
| bigint
|
|
24
|
+
| null
|
|
25
|
+
| undefined;
|
|
18
26
|
|
|
19
27
|
export type ComponentOneChild<TProps, TElement = HTMLElement> = (
|
|
20
28
|
props: TProps & import("@grucloud/bau").PropsAll<TElement>,
|
package/button/button.js
CHANGED
|
@@ -46,7 +46,6 @@ export default function (context, options = {}) {
|
|
|
46
46
|
box-sizing: border-box;
|
|
47
47
|
user-select: none;
|
|
48
48
|
transition: all var(--transition-slow);
|
|
49
|
-
cursor: pointer;
|
|
50
49
|
&.outline,
|
|
51
50
|
&.solid {
|
|
52
51
|
box-shadow: var(--shadow-m);
|
|
@@ -57,6 +56,7 @@ export default function (context, options = {}) {
|
|
|
57
56
|
}
|
|
58
57
|
&:hover {
|
|
59
58
|
filter: brightness(var(--brightness-hover));
|
|
59
|
+
cursor: pointer;
|
|
60
60
|
}
|
|
61
61
|
&:hover.solid {
|
|
62
62
|
filter: brightness(var(--brightness-hover-always));
|
package/chip/chip.js
CHANGED
|
@@ -6,8 +6,11 @@ export default function (context, options = {}) {
|
|
|
6
6
|
const { span } = bau.tags;
|
|
7
7
|
|
|
8
8
|
const className = css`
|
|
9
|
-
display: inline-
|
|
9
|
+
display: inline-flex;
|
|
10
|
+
align-items: center;
|
|
11
|
+
flex-grow: 0;
|
|
10
12
|
box-sizing: border-box;
|
|
13
|
+
gap: 0.5rem;
|
|
11
14
|
border-radius: var(--global-radius);
|
|
12
15
|
overflow: hidden;
|
|
13
16
|
text-overflow: ellipsis;
|
|
@@ -239,7 +239,8 @@ export default function (context, options = {}) {
|
|
|
239
239
|
target.tagName === "A" &&
|
|
240
240
|
href &&
|
|
241
241
|
!href.startsWith("http") &&
|
|
242
|
-
!href.startsWith("#")
|
|
242
|
+
!href.startsWith("#") &&
|
|
243
|
+
!href.startsWith("?")
|
|
243
244
|
) {
|
|
244
245
|
let path = href.replace(baseUrl, "");
|
|
245
246
|
if (!hashBased) {
|
package/form/form.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.55.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "BSD",
|
|
7
7
|
"keywords": [
|
|
@@ -20,11 +20,11 @@
|
|
|
20
20
|
"directory": "bau-ui"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@grucloud/bau": "^0.
|
|
24
|
-
"@grucloud/bau-css": "^0.
|
|
23
|
+
"@grucloud/bau": "^0.55.0",
|
|
24
|
+
"@grucloud/bau-css": "^0.55.0"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"typedoc": "0.24.8"
|
|
28
28
|
},
|
|
29
|
-
"gitHead": "
|
|
29
|
+
"gitHead": "ee5d05d4fdeaf72e84a473e0549af00b867910c7"
|
|
30
30
|
}
|
package/skeleton/skeleton.js
CHANGED
|
@@ -3,7 +3,7 @@ import { toPropsAndChildren } from "@grucloud/bau/bau.js";
|
|
|
3
3
|
|
|
4
4
|
export default function (context, options = {}) {
|
|
5
5
|
const { bau, css, keyframes } = context;
|
|
6
|
-
const {
|
|
6
|
+
const { div } = bau.tags;
|
|
7
7
|
|
|
8
8
|
const opacityKeyFrame = keyframes`
|
|
9
9
|
0% {
|
|
@@ -46,7 +46,7 @@ export default function (context, options = {}) {
|
|
|
46
46
|
},
|
|
47
47
|
...children
|
|
48
48
|
] = toPropsAndChildren(args);
|
|
49
|
-
return
|
|
49
|
+
return div(
|
|
50
50
|
{
|
|
51
51
|
...props,
|
|
52
52
|
class: classNames(
|
package/stepper/index.d.ts
CHANGED
package/stepper/stepper.js
CHANGED
|
@@ -11,8 +11,8 @@ const colorsToCss = () =>
|
|
|
11
11
|
).join("\n");
|
|
12
12
|
|
|
13
13
|
export default function (context, options = {}) {
|
|
14
|
-
const { bau, css } = context;
|
|
15
|
-
const { div, ul, li, span } = bau.tags;
|
|
14
|
+
const { bau, css, window } = context;
|
|
15
|
+
const { div, ul, li, span, footer } = bau.tags;
|
|
16
16
|
|
|
17
17
|
const className = css`
|
|
18
18
|
display: flex;
|
|
@@ -76,6 +76,19 @@ export default function (context, options = {}) {
|
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
78
|
${colorsToCss()}
|
|
79
|
+
&.stepper > .content {
|
|
80
|
+
visibility: hidden;
|
|
81
|
+
display: none;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
&.stepper > .visible {
|
|
85
|
+
visibility: visible;
|
|
86
|
+
display: block;
|
|
87
|
+
}
|
|
88
|
+
&.stepper footer {
|
|
89
|
+
display: flex;
|
|
90
|
+
gap: 1rem;
|
|
91
|
+
}
|
|
79
92
|
`;
|
|
80
93
|
|
|
81
94
|
return function Stepper(...args) {
|
|
@@ -85,7 +98,7 @@ export default function (context, options = {}) {
|
|
|
85
98
|
variant = "plain",
|
|
86
99
|
size,
|
|
87
100
|
stepperDefs = [],
|
|
88
|
-
activeStepIndex,
|
|
101
|
+
activeStepIndex = bau.state(0),
|
|
89
102
|
...props
|
|
90
103
|
},
|
|
91
104
|
...children
|
|
@@ -95,6 +108,45 @@ export default function (context, options = {}) {
|
|
|
95
108
|
stepperDefs.map((stepper, index) => ({ ...stepper, index }))
|
|
96
109
|
);
|
|
97
110
|
|
|
111
|
+
const hashchange = () => {
|
|
112
|
+
const stepNameInitial = window.location.hash.slice(1).split("?")[0];
|
|
113
|
+
console.log("hashchange", stepNameInitial);
|
|
114
|
+
const initialActiveStep = stepperDefs.findIndex(
|
|
115
|
+
({ name }) => name == stepNameInitial
|
|
116
|
+
);
|
|
117
|
+
|
|
118
|
+
if (initialActiveStep >= 0) {
|
|
119
|
+
activeStepIndex.val = initialActiveStep;
|
|
120
|
+
} else {
|
|
121
|
+
activeStepIndex.val = 0;
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
hashchange();
|
|
126
|
+
|
|
127
|
+
window.history.pushState = new Proxy(window.history.pushState, {
|
|
128
|
+
apply: (target, thisArg, argArray) => {
|
|
129
|
+
target.apply(thisArg, argArray);
|
|
130
|
+
const url = argArray[2] ?? "";
|
|
131
|
+
if (["?", "#"].includes(url[0])) {
|
|
132
|
+
hashchange();
|
|
133
|
+
}
|
|
134
|
+
},
|
|
135
|
+
});
|
|
136
|
+
document.addEventListener("click", (event) => {
|
|
137
|
+
const { target } = event;
|
|
138
|
+
const href = target.getAttribute("href");
|
|
139
|
+
if (target.tagName === "A" && href && ["?", "#"].includes(href[0])) {
|
|
140
|
+
//console.log("a click");
|
|
141
|
+
hashchange();
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
//TODO bauMounted
|
|
145
|
+
window.addEventListener("popstate", (event) => {
|
|
146
|
+
//console.log("popstate");
|
|
147
|
+
hashchange();
|
|
148
|
+
});
|
|
149
|
+
|
|
98
150
|
const stepperCurrentState = bau.derive(
|
|
99
151
|
() => stepperState.val[activeStepIndex.val]
|
|
100
152
|
);
|
|
@@ -131,29 +183,20 @@ export default function (context, options = {}) {
|
|
|
131
183
|
// Header
|
|
132
184
|
bau.loop(stepperState, ul(), StepperHeader),
|
|
133
185
|
// Content
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
186
|
+
stepperDefs.map((stepperDef) =>
|
|
187
|
+
div(
|
|
188
|
+
{
|
|
189
|
+
class: () =>
|
|
190
|
+
classNames(
|
|
191
|
+
"content",
|
|
192
|
+
stepperDef.name == stepperCurrentState.val.name && "visible"
|
|
193
|
+
),
|
|
194
|
+
},
|
|
195
|
+
() => (stepperDef.Content ? stepperDef.Content(props) : ""),
|
|
196
|
+
footer(stepperDef.Footer ? stepperDef.Footer(props) : "")
|
|
197
|
+
)
|
|
198
|
+
)
|
|
140
199
|
);
|
|
141
|
-
|
|
142
|
-
// rootEl.addEventListener(
|
|
143
|
-
// "stepper.select",
|
|
144
|
-
// (event) => {
|
|
145
|
-
// const { stepperName } = event.detail;
|
|
146
|
-
// const nextStepper = stepperByName(stepperName);
|
|
147
|
-
// if (!nextStepper) {
|
|
148
|
-
// return;
|
|
149
|
-
// }
|
|
150
|
-
// stepperCurrentState.val.exit?.call();
|
|
151
|
-
// stepperCurrentState.val = nextStepper;
|
|
152
|
-
// nextStepper.enter?.call();
|
|
153
|
-
// },
|
|
154
|
-
// false
|
|
155
|
-
// );
|
|
156
|
-
|
|
157
200
|
return rootEl;
|
|
158
201
|
};
|
|
159
202
|
}
|