@team-monolith/cds 1.102.2 → 1.102.3
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.
|
@@ -220,11 +220,15 @@ export const Button = React.forwardRef(function Button(props, ref) {
|
|
|
220
220
|
gap: 8px;
|
|
221
221
|
|
|
222
222
|
border: none;
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
223
|
+
|
|
224
|
+
${disabled || loading
|
|
225
|
+
? css `
|
|
226
|
+
cursor: default;
|
|
227
|
+
pointer-events: none;
|
|
228
|
+
`
|
|
229
|
+
: css `
|
|
230
|
+
cursor: pointer;
|
|
231
|
+
`}
|
|
228
232
|
|
|
229
233
|
font-family: ${theme.fontFamily.ui};
|
|
230
234
|
text-decoration: none;
|
|
@@ -15,79 +15,85 @@ import { css, useTheme } from "@emotion/react";
|
|
|
15
15
|
import React from "react";
|
|
16
16
|
import { HOVER } from "../utils/hover";
|
|
17
17
|
import { Spinner } from "./Spinner";
|
|
18
|
-
const COLOR_TO_BUTTON_STYLE = (theme, color) => ({
|
|
19
|
-
danger:
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
18
|
+
const COLOR_TO_BUTTON_STYLE = (theme, color, disabled) => ({
|
|
19
|
+
danger: disabled
|
|
20
|
+
? css `
|
|
21
|
+
background: ${theme.color.background.dangerDisabled};
|
|
22
|
+
color: ${theme.color.foreground.neutralAltDisabled};
|
|
23
|
+
`
|
|
24
|
+
: css `
|
|
25
|
+
background: ${theme.color.background.danger};
|
|
26
|
+
color: ${theme.color.foreground.neutralAlt};
|
|
27
|
+
${HOVER(css `
|
|
28
|
+
background: ${theme.color.background.dangerActive};
|
|
29
|
+
color: ${theme.color.foreground.neutralAltActive};
|
|
30
|
+
`)}
|
|
31
|
+
`,
|
|
32
|
+
grey: disabled
|
|
33
|
+
? css `
|
|
34
|
+
background: ${theme.color.background.neutralAltDisabled};
|
|
35
|
+
color: ${theme.color.foreground.neutralBaseDisabled};
|
|
36
|
+
`
|
|
37
|
+
: css `
|
|
38
|
+
background: ${theme.color.background.neutralAlt};
|
|
39
|
+
color: ${theme.color.foreground.neutralBase};
|
|
40
|
+
${HOVER(css `
|
|
41
|
+
background: ${theme.color.background.neutralAltActive};
|
|
42
|
+
color: ${theme.color.foreground.neutralBaseActive};
|
|
43
|
+
`)}
|
|
44
|
+
`,
|
|
45
|
+
primary: disabled
|
|
46
|
+
? css `
|
|
47
|
+
background: ${theme.color.background.primaryDisabled};
|
|
48
|
+
color: ${theme.color.foreground.neutralAltDisabled};
|
|
49
|
+
`
|
|
50
|
+
: css `
|
|
51
|
+
background: ${theme.color.background.primary};
|
|
52
|
+
color: ${theme.color.foreground.neutralAlt};
|
|
53
|
+
${HOVER(css `
|
|
54
|
+
background: ${theme.color.background.primaryActive};
|
|
55
|
+
color: ${theme.color.foreground.neutralAltActive};
|
|
56
|
+
`)}
|
|
57
|
+
`,
|
|
58
|
+
icon: disabled
|
|
59
|
+
? css `
|
|
60
|
+
background: none;
|
|
61
|
+
color: ${theme.color.foreground.neutralBaseDisabled};
|
|
62
|
+
`
|
|
63
|
+
: css `
|
|
64
|
+
background: none;
|
|
65
|
+
color: ${theme.color.foreground.neutralBase};
|
|
66
|
+
${HOVER(css `
|
|
67
|
+
background: ${theme.color.blanket.neutralLight};
|
|
68
|
+
color: ${theme.color.foreground.neutralBaseActive};
|
|
69
|
+
`)}
|
|
70
|
+
`,
|
|
71
|
+
black: disabled
|
|
72
|
+
? css `
|
|
73
|
+
background: ${theme.color.background.inverseDisabled};
|
|
74
|
+
color: ${theme.color.foreground.neutralAltDisabled};
|
|
75
|
+
`
|
|
76
|
+
: css `
|
|
77
|
+
background: ${theme.color.background.inverse};
|
|
78
|
+
color: ${theme.color.foreground.neutralAlt};
|
|
79
|
+
${HOVER(css `
|
|
80
|
+
background: ${theme.color.background.inverseActive};
|
|
81
|
+
color: ${theme.color.foreground.neutralAltActive};
|
|
82
|
+
`)}
|
|
83
|
+
`,
|
|
84
|
+
white: disabled
|
|
85
|
+
? css `
|
|
86
|
+
background: ${theme.color.background.neutralAltDisabled};
|
|
87
|
+
color: ${theme.color.foreground.neutralBaseDisabled};
|
|
88
|
+
`
|
|
89
|
+
: css `
|
|
90
|
+
background: ${theme.color.background.neutralBase};
|
|
91
|
+
color: ${theme.color.foreground.neutralBase};
|
|
92
|
+
${HOVER(css `
|
|
93
|
+
background: ${theme.color.background.neutralAltActive};
|
|
94
|
+
color: ${theme.color.foreground.neutralBaseActive};
|
|
95
|
+
`)}
|
|
96
|
+
`,
|
|
91
97
|
})[color];
|
|
92
98
|
const SIZE_TO_BUTTON_STYLE = {
|
|
93
99
|
large: css `
|
|
@@ -144,13 +150,17 @@ export const SquareButton = React.forwardRef(function SquareButton(props, ref) {
|
|
|
144
150
|
return (_jsx(Component, Object.assign({ type: Component === "button" || Component === "input" ? "button" : undefined }, other, { ref: ref, className: className, css: [
|
|
145
151
|
css `
|
|
146
152
|
border: none;
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
153
|
+
|
|
154
|
+
${disabled || loading
|
|
155
|
+
? css `
|
|
156
|
+
cursor: default;
|
|
157
|
+
pointer-events: none;
|
|
158
|
+
`
|
|
159
|
+
: css `
|
|
160
|
+
cursor: pointer;
|
|
161
|
+
`}
|
|
152
162
|
`,
|
|
153
|
-
COLOR_TO_BUTTON_STYLE(theme, color),
|
|
163
|
+
COLOR_TO_BUTTON_STYLE(theme, color, Boolean(disabled || loading)),
|
|
154
164
|
SIZE_TO_BUTTON_STYLE[size],
|
|
155
165
|
], disabled: disabled || loading, onClick: onClick }, { children: loading ? _jsx(Spinner, {}) : icon })));
|
|
156
166
|
});
|