@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.
@@ -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.color : base.bgColor;
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.color : base.borderColor;
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] ?? {
@@ -28,7 +28,7 @@ export function Drawer({
28
28
  withoutLockScreen = false,
29
29
  closeOnClickOutside = true
30
30
  }) {
31
- const ref = useRef();
31
+ const ref = useRef(undefined);
32
32
  const [element] = useState(createDivElement);
33
33
  const {
34
34
  zIndex: resolvedZIndex
@@ -26,7 +26,7 @@ export function Modal(props) {
26
26
  onClose,
27
27
  children
28
28
  } = props;
29
- const ref = useRef();
29
+ const ref = useRef(undefined);
30
30
  const [element] = useState(createDivElement);
31
31
  const {
32
32
  zIndex: resolvedZIndex
@@ -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 => descriptionRefs.current[notification.id] = element || null,
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,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pushwoosh/dumb-components",
3
- "version": "2.9.5",
3
+ "version": "2.9.7",
4
4
  "description": "React components to build Pushwoosh products",
5
5
  "main": "index.js",
6
6
  "module": "index.js",