@grucloud/bau-ui 0.47.3 → 0.49.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.
@@ -7,10 +7,10 @@ const colorsToCss = () =>
7
7
  (color) =>
8
8
  `
9
9
  &.button-group.${color} {
10
- & button:not(:last-child) {
10
+ & .button:not(:last-child) {
11
11
  border-right: 1px solid var(--color-${color}) !important;
12
12
  }
13
- & button:not(:first-child) {
13
+ & .button:not(:first-child) {
14
14
  border-left: 1px solid var(--color-${color}) !important;
15
15
  }
16
16
  }
@@ -20,7 +20,7 @@ const colorsToCss = () =>
20
20
  }
21
21
 
22
22
  &.button-group.solid.${color} {
23
- & button:not(:last-child) {
23
+ & .button:not(:last-child) {
24
24
  border-right: 1px solid var(--color-${color}-lightest) !important;
25
25
  }
26
26
  }
@@ -35,11 +35,11 @@ export default function (context, options = {}) {
35
35
  display: inline-flex;
36
36
  box-sizing: border-box;
37
37
  border-radius: var(--global-radius);
38
- & button:not(:last-child) {
38
+ & .button:not(:last-child) {
39
39
  border-top-right-radius: 0;
40
40
  border-bottom-right-radius: 0;
41
41
  }
42
- & button:not(:first-child) {
42
+ & .button:not(:first-child) {
43
43
  border-top-left-radius: 0;
44
44
  border-bottom-left-radius: 0;
45
45
  }
@@ -14,16 +14,16 @@ export default function (context, options = {}) {
14
14
  align-items: center;
15
15
  justify-content: space-between;
16
16
  background-color: inherit;
17
- &::after {
17
+ &::before {
18
18
  padding: 0.5rem;
19
19
  transition: transform var(--transition-fast) linear;
20
20
  line-height: 1rem;
21
21
  }
22
- &.close::after {
22
+ &.close::before {
23
23
  content: "\u203A";
24
24
  padding: 0.5rem;
25
25
  }
26
- &.open::after {
26
+ &.open::before {
27
27
  content: "\u203A";
28
28
  padding: 0.5rem;
29
29
  transform: rotate(90deg);
@@ -235,7 +235,12 @@ export default function (context, options = {}) {
235
235
  window.document.addEventListener("click", (event) => {
236
236
  const { target } = event;
237
237
  const href = target.getAttribute("href");
238
- if (target.tagName === "A" && href && !href.startsWith("http")) {
238
+ if (
239
+ target.tagName === "A" &&
240
+ href &&
241
+ !href.startsWith("http") &&
242
+ !href.startsWith("#")
243
+ ) {
239
244
  let path = href.replace(baseUrl, "");
240
245
  if (!hashBased) {
241
246
  path = path.replace(target.hash, "");
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.47.3",
4
+ "version": "0.49.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.47.0",
24
- "@grucloud/bau-css": "^0.47.0"
23
+ "@grucloud/bau": "^0.49.0",
24
+ "@grucloud/bau-css": "^0.49.0"
25
25
  },
26
26
  "devDependencies": {
27
27
  "typedoc": "0.24.8"
28
28
  },
29
- "gitHead": "fdf838442743037e6dfd3d367d3797c24825a02c"
29
+ "gitHead": "e2ae7c556efa95e6c178f948d139ec889bc3e413"
30
30
  }
@@ -0,0 +1,10 @@
1
+ declare module "@grucloud/bau-ui/skeleton" {
2
+ type DefaultDesignProps = import("../constants").DefaultDesignProps;
3
+ type ComponentOption = import("../bau-ui").ComponentOption;
4
+
5
+ export type SkeletonProps = {} & DefaultDesignProps;
6
+
7
+ type Component = import("../bau-ui").Component<SkeletonProps>;
8
+
9
+ export default function (context: any, option?: ComponentOption): Component;
10
+ }
@@ -0,0 +1 @@
1
+ export { default } from "./skeleton";
@@ -0,0 +1,63 @@
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, keyframes } = context;
6
+ const { div } = bau.tags;
7
+
8
+ const opacityKeyFrame = keyframes`
9
+ 0% {
10
+ transform: translateX(-100%);
11
+ }
12
+ 50% {
13
+ transform: translateX(100%);
14
+ }
15
+ 100% {
16
+ transform: translateX(100%);
17
+ }
18
+ `;
19
+
20
+ const className = css`
21
+ background-color: var(--color-emphasis-200);
22
+ position: relative;
23
+ overflow: hidden;
24
+ &::after {
25
+ animation: 2s linear 0.5s infinite normal none running ${opacityKeyFrame};
26
+ background: linear-gradient(
27
+ 90deg,
28
+ transparent,
29
+ rgba(255, 255, 255, 0.4),
30
+ transparent
31
+ );
32
+ content: "";
33
+ position: absolute;
34
+ transform: translateX(-100%);
35
+ inset: 0px;
36
+ }
37
+ `;
38
+
39
+ return function Skeleton(...args) {
40
+ let [
41
+ {
42
+ size = options.size ?? "md",
43
+ variant = options.variant ?? "plain",
44
+ color = options.color ?? "neutral",
45
+ ...props
46
+ },
47
+ ...children
48
+ ] = toPropsAndChildren(args);
49
+ return div(
50
+ {
51
+ ...props,
52
+ class: classNames(
53
+ "skeleton",
54
+ size,
55
+ className,
56
+ options?.class,
57
+ props?.class
58
+ ),
59
+ },
60
+ ...children
61
+ );
62
+ };
63
+ }
package/tabs/tabs.js CHANGED
@@ -13,7 +13,7 @@ const colorsToCss = () =>
13
13
  ).join("\n");
14
14
 
15
15
  export default function (context, options = {}) {
16
- const { bau, css } = context;
16
+ const { bau, css, window } = context;
17
17
  const { tabDefs } = options;
18
18
  const { div, ul, li } = bau.tags;
19
19
 
@@ -27,8 +27,11 @@ export default function (context, options = {}) {
27
27
  align-items: flex-start;
28
28
  padding: 0;
29
29
  list-style: none;
30
- border-bottom: 2px solid var(--color-emphasis-200);
31
30
  & li {
31
+ & > a {
32
+ color: inherit;
33
+ text-decoration: none;
34
+ }
32
35
  text-align: center;
33
36
  padding: 0.5rem;
34
37
  padding-bottom: 0rem;
@@ -39,14 +42,15 @@ export default function (context, options = {}) {
39
42
  overflow: hidden;
40
43
  &:hover {
41
44
  color: var(--color-primary-light);
42
- background-color: var(--color-emphasis-300);
45
+ background-color: var(--color-emphasis-200);
43
46
  &::after {
44
47
  transform: translateY(0%);
45
48
  }
46
49
  }
47
50
  &::after {
48
51
  transition: var(--transition-fast) ease-in-out;
49
- transform: translateY(400%);
52
+ transform: translateY(100%);
53
+ background: var(--color-primary-light);
50
54
  opacity: 1;
51
55
  content: "";
52
56
  margin-top: 0.3rem;
@@ -64,6 +68,7 @@ export default function (context, options = {}) {
64
68
  & .disabled {
65
69
  cursor: not-allowed;
66
70
  font-style: italic;
71
+ pointer-events: none;
67
72
  transform: none;
68
73
  &:hover {
69
74
  border: none;
@@ -85,10 +90,10 @@ export default function (context, options = {}) {
85
90
  ] = toPropsAndChildren(args);
86
91
 
87
92
  const tabsState = bau.state(tabDefs);
88
-
89
- const tabCurrentState = bau.state(tabDefs[0]);
93
+ const tabNameInitial = window.location.hash.slice(1);
90
94
 
91
95
  const tabByName = (name) => tabsState.val.find((tab) => tab.name == name);
96
+ const tabCurrentState = bau.state(tabByName(tabNameInitial) ?? tabDefs[0]);
92
97
 
93
98
  const TabHeader = (tab) => {
94
99
  const { Header, disabled, name } = tab;
@@ -126,7 +131,8 @@ export default function (context, options = {}) {
126
131
  // Header
127
132
  bau.loop(tabsState, ul(), TabHeader),
128
133
  // Content
129
- () => (tabCurrentState.val.Content ? tabCurrentState.val.Content({}) : "")
134
+ () =>
135
+ tabCurrentState.val.Content ? tabCurrentState.val.Content(props) : ""
130
136
  );
131
137
 
132
138
  rootEl.addEventListener(