@pushwoosh/dumb-components 2.9.5 → 2.9.7
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/Button/__tests__/Button.test.d.ts +1 -0
- package/Button/__tests__/Button.test.js +27 -0
- package/Button/colors.js +3 -5
- package/Calendar/CalendarSuperForm/components/CalendarRangePicker/CalendarRangePicker.js +1 -1
- package/Drawer/components/Drawer/Drawer.js +1 -1
- package/Modal/components/Modal/Modal.js +1 -1
- package/NotificationInbox/NotificationInbox.js +3 -1
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { render, screen } from '@testing-library/react';
|
|
3
|
+
import { Button } from '../Button';
|
|
4
|
+
describe('Button disabled colors', () => {
|
|
5
|
+
it('keeps white text on the red background for a disabled danger button', () => {
|
|
6
|
+
render(_jsx(Button, {
|
|
7
|
+
color: "danger",
|
|
8
|
+
isDisabled: true,
|
|
9
|
+
children: "Delete"
|
|
10
|
+
}));
|
|
11
|
+
const style = getComputedStyle(screen.getByRole('button'));
|
|
12
|
+
expect(style.color).toContain('--danger-shape-base-color');
|
|
13
|
+
expect(style.backgroundColor).toContain('--danger-shape-base-bg-color');
|
|
14
|
+
});
|
|
15
|
+
it('paints background, not text color, behind a disabled link-button', () => {
|
|
16
|
+
render(_jsx(Button, {
|
|
17
|
+
as: "a",
|
|
18
|
+
color: "primary",
|
|
19
|
+
isDisabled: true,
|
|
20
|
+
children: "Open"
|
|
21
|
+
}));
|
|
22
|
+
const style = getComputedStyle(screen.getByText('Open').closest('a'));
|
|
23
|
+
expect(style.color).toContain('--primary-shape-base-color');
|
|
24
|
+
expect(style.backgroundColor).toContain('--primary-shape-disabled-bg-color');
|
|
25
|
+
expect(style.borderColor).toBe('transparent');
|
|
26
|
+
});
|
|
27
|
+
});
|
package/Button/colors.js
CHANGED
|
@@ -64,9 +64,7 @@ export const colors = {
|
|
|
64
64
|
color: `var(--danger-shape-base-color, ${Color.CLEAR})`,
|
|
65
65
|
bgColor: `var(--danger-shape-base-bg-color, ${Color.DANGER})`
|
|
66
66
|
},
|
|
67
|
-
disabled: {
|
|
68
|
-
color: `var(--danger-shape-disabled-color, ${Color.LOCKED})`
|
|
69
|
-
},
|
|
67
|
+
disabled: {},
|
|
70
68
|
hover: {
|
|
71
69
|
bgColor: `var(--danger-shape-hover-bg-color, ${Color.DANGER_HOVER})`
|
|
72
70
|
}
|
|
@@ -115,7 +113,7 @@ export function createColors(buttonColors) {
|
|
|
115
113
|
if ($isOpen) {
|
|
116
114
|
return Color.MAIN;
|
|
117
115
|
}
|
|
118
|
-
return $isDisabled ? disabled.
|
|
116
|
+
return $isDisabled ? disabled.bgColor : base.bgColor;
|
|
119
117
|
}, ({
|
|
120
118
|
$isOpen,
|
|
121
119
|
$isDisabled
|
|
@@ -123,7 +121,7 @@ export function createColors(buttonColors) {
|
|
|
123
121
|
if ($isOpen) {
|
|
124
122
|
return Color.MAIN;
|
|
125
123
|
}
|
|
126
|
-
return $isDisabled ? disabled.
|
|
124
|
+
return $isDisabled ? disabled.borderColor : base.borderColor;
|
|
127
125
|
}, disabled.color, disabled.bgColor, disabled.borderColor, ({
|
|
128
126
|
$isOpen
|
|
129
127
|
}) => $isOpen ? '' : hoverCss /* sc-custom "display: none;" */, hover.color, hover.bgColor, hover.borderColor);
|
|
@@ -18,7 +18,7 @@ export const CalendarRangePicker = ({
|
|
|
18
18
|
firstDayOfWeek,
|
|
19
19
|
initialVisibleMonth
|
|
20
20
|
}) => {
|
|
21
|
-
const startMonthRef = useRef();
|
|
21
|
+
const startMonthRef = useRef(undefined);
|
|
22
22
|
if (!startMonthRef.current) {
|
|
23
23
|
const d = new Date();
|
|
24
24
|
startMonthRef.current = initialVisibleMonth ?? value[0] ?? {
|
|
@@ -155,7 +155,9 @@ export function NotificationInbox({
|
|
|
155
155
|
children: notification.title
|
|
156
156
|
}), notification.description && _jsx(NotificationDescription, {
|
|
157
157
|
as: "div",
|
|
158
|
-
ref: element =>
|
|
158
|
+
ref: element => {
|
|
159
|
+
descriptionRefs.current[notification.id] = element || null;
|
|
160
|
+
},
|
|
159
161
|
"$variant": "standard",
|
|
160
162
|
"$color": Color.MAIN,
|
|
161
163
|
"$visibleLines": VISIBLE_LINES,
|