@grucloud/bau-ui 0.79.0 → 0.80.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/package.json +4 -4
- package/toggle/index.d.ts +4 -1
- package/toggle/toggle.js +25 -26
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.80.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.80.0",
|
|
24
|
+
"@grucloud/bau-css": "^0.80.0"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"typedoc": "0.24.8"
|
|
28
28
|
},
|
|
29
|
-
"gitHead": "
|
|
29
|
+
"gitHead": "7256586c4f0c23d3c93b39bbf7091a2fbf930d4b"
|
|
30
30
|
}
|
package/toggle/index.d.ts
CHANGED
|
@@ -4,7 +4,10 @@ declare module "@grucloud/bau-ui/toggle" {
|
|
|
4
4
|
|
|
5
5
|
export type ToggleProps = {} & DefaultDesignProps;
|
|
6
6
|
|
|
7
|
-
type Component = import("../bau-ui").Component<
|
|
7
|
+
type Component = import("../bau-ui").Component<
|
|
8
|
+
ToggleProps,
|
|
9
|
+
HTMLButtonElement
|
|
10
|
+
>;
|
|
8
11
|
|
|
9
12
|
export default function (context: any, option?: ComponentOption): Component;
|
|
10
13
|
}
|
package/toggle/toggle.js
CHANGED
|
@@ -32,24 +32,25 @@ export default function (context, options = {}) {
|
|
|
32
32
|
transition: all var(--transition-slow);
|
|
33
33
|
box-sizing: border-box;
|
|
34
34
|
cursor: pointer;
|
|
35
|
-
|
|
35
|
+
&[aria-pressed="true"] {
|
|
36
36
|
background-color: var(--toggle-background-color);
|
|
37
|
+
box-shadow: var(--shadow-lg);
|
|
37
38
|
}
|
|
38
|
-
|
|
39
|
+
&[aria-pressed="true"].solid {
|
|
39
40
|
filter: brightness(80%) !important;
|
|
40
41
|
}
|
|
41
42
|
&.outline,
|
|
42
43
|
&.solid {
|
|
43
|
-
box-shadow: var(--shadow-
|
|
44
|
+
box-shadow: var(--shadow-sm);
|
|
44
45
|
}
|
|
45
46
|
&.outline:hover,
|
|
46
47
|
&.solid:hover {
|
|
47
48
|
box-shadow: var(--shadow-lg);
|
|
48
49
|
}
|
|
49
|
-
&:hover:not(
|
|
50
|
+
&:hover:not([aria-pressed="true"]) {
|
|
50
51
|
filter: brightness(var(--brightness-hover)) !important;
|
|
51
52
|
}
|
|
52
|
-
&:hover.solid:not(
|
|
53
|
+
&:hover.solid:not([aria-pressed="true"]) {
|
|
53
54
|
filter: brightness(var(--brightness-hover-always)) !important;
|
|
54
55
|
}
|
|
55
56
|
&.sm {
|
|
@@ -69,9 +70,7 @@ export default function (context, options = {}) {
|
|
|
69
70
|
size = options.size ?? "md",
|
|
70
71
|
variant = options.variant ?? "outline",
|
|
71
72
|
color = options.color ?? "neutral",
|
|
72
|
-
|
|
73
|
-
disabled,
|
|
74
|
-
onChange,
|
|
73
|
+
onclick,
|
|
75
74
|
...props
|
|
76
75
|
},
|
|
77
76
|
...children
|
|
@@ -81,25 +80,25 @@ export default function (context, options = {}) {
|
|
|
81
80
|
{
|
|
82
81
|
type: "button",
|
|
83
82
|
...props,
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
"toggle",
|
|
93
|
-
size,
|
|
94
|
-
color,
|
|
95
|
-
variant,
|
|
96
|
-
className,
|
|
97
|
-
selected && "selected",
|
|
98
|
-
options?.class,
|
|
99
|
-
props?.class
|
|
100
|
-
),
|
|
83
|
+
onclick: (event) => {
|
|
84
|
+
const { target } = event;
|
|
85
|
+
const pressed = target.getAttribute("aria-pressed");
|
|
86
|
+
target.setAttribute(
|
|
87
|
+
"aria-pressed",
|
|
88
|
+
pressed == "true" ? "false" : "true"
|
|
89
|
+
);
|
|
90
|
+
onclick && onclick(event);
|
|
101
91
|
},
|
|
102
|
-
|
|
92
|
+
|
|
93
|
+
class: classNames(
|
|
94
|
+
"toggle",
|
|
95
|
+
size,
|
|
96
|
+
color,
|
|
97
|
+
variant,
|
|
98
|
+
className,
|
|
99
|
+
options?.class,
|
|
100
|
+
props?.class
|
|
101
|
+
),
|
|
103
102
|
},
|
|
104
103
|
children
|
|
105
104
|
);
|