@pushwoosh/dumb-components 2.9.10 → 2.9.12

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.
@@ -1,6 +1,7 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { render, screen } from '@testing-library/react';
3
- import { CircularSkeleton, RectangularSkeleton } from '../styles';
3
+ import { CircularSkeleton, RectangularSkeleton, TextSkeletonTag } from '../styles';
4
+ import { TextSkeleton } from '../TextSkeleton';
4
5
  describe('RectangularSkeleton', () => {
5
6
  it('keeps style props off the DOM and still paints them', () => {
6
7
  render(_jsx(RectangularSkeleton, {
@@ -53,4 +54,48 @@ describe('CircularSkeleton', () => {
53
54
  backgroundColor: 'rgb(255, 0, 0)'
54
55
  });
55
56
  });
57
+ });
58
+ describe('TextSkeleton', () => {
59
+ it('denies borderRadius and color in shouldForwardProp, which SC 6 uses instead of isPropValid', () => {
60
+ const {
61
+ shouldForwardProp
62
+ } = TextSkeletonTag;
63
+ expect(shouldForwardProp?.('borderRadius')).toBe(false);
64
+ expect(shouldForwardProp?.('color')).toBe(false);
65
+ expect(shouldForwardProp?.('title')).toBe(true);
66
+ });
67
+ it('keeps style props off the DOM and still paints them', () => {
68
+ render(_jsx(TextSkeleton, {
69
+ "data-testid": "text",
70
+ width: 160,
71
+ color: "red",
72
+ borderRadius: "8px"
73
+ }));
74
+ const node = screen.getByTestId('text');
75
+ expect(node).not.toHaveAttribute('color');
76
+ expect(node).not.toHaveAttribute('borderradius');
77
+ expect(node).toHaveAttribute('data-testid', 'text');
78
+ expect(getComputedStyle(node)).toMatchObject({
79
+ width: '160px',
80
+ color: 'rgb(255, 0, 0)',
81
+ backgroundColor: 'rgb(255, 0, 0)',
82
+ borderRadius: '8px'
83
+ });
84
+ });
85
+ it('still renders a div with inline width and an inline span without it', () => {
86
+ render(_jsx(TextSkeleton, {
87
+ "data-testid": "block",
88
+ width: 160
89
+ }));
90
+ render(_jsx(TextSkeleton, {
91
+ "data-testid": "inline",
92
+ children: "abc"
93
+ }));
94
+ expect(screen.getByTestId('block').tagName).toBe('DIV');
95
+ expect(screen.getByTestId('block')).toHaveStyle({
96
+ width: '160px'
97
+ });
98
+ expect(screen.getByTestId('inline').tagName).toBe('SPAN');
99
+ expect(screen.getByTestId('inline')).not.toHaveAttribute('style');
100
+ });
56
101
  });
@@ -36,6 +36,8 @@ export const CircularSkeleton = styled.div.withConfig({
36
36
  diameter
37
37
  }) => toCssValue(diameter), skeletonCommonCss);
38
38
  export const TextSkeletonTag = styled.div.withConfig({
39
+ shouldForwardProp: prop => !['borderRadius', 'color'].includes(prop)
40
+ }).withConfig({
39
41
  displayName: "TextSkeletonTag",
40
42
  componentId: "sc-mdyfd6-2"
41
43
  })(["", " color:", ";border-radius:", ";", ""], ({
package/index.d.ts CHANGED
@@ -12,6 +12,7 @@ export { DatePicker, DatePickerField, DateTimePicker, DateTimePickerField, } fro
12
12
  export { DropdownMenu, DropdownMenuButton, DropdownMenuSection, DropdownMenuItem, DropdownMenuSubmenu, } from './DropdownMenu';
13
13
  export { GetStartedPage } from './GetStartedPage';
14
14
  export { EditableField } from './EditableField';
15
+ export { EmojiPicker } from './EmojiPicker';
15
16
  export { InputFile } from './InputFile';
16
17
  export { Modal, ModalTitle, ModalConfirm, ModalConfirmProvider, useModalConfirm, ModalHeader, ModalBodyGroup, ModalBodyItem, ModalBody, ModalFooter, } from './Modal';
17
18
  export { Pagination } from './Pagination';
package/index.js CHANGED
@@ -12,6 +12,7 @@ export { DatePicker, DatePickerField, DateTimePicker, DateTimePickerField } from
12
12
  export { DropdownMenu, DropdownMenuButton, DropdownMenuSection, DropdownMenuItem, DropdownMenuSubmenu } from './DropdownMenu';
13
13
  export { GetStartedPage } from './GetStartedPage';
14
14
  export { EditableField } from './EditableField';
15
+ export { EmojiPicker } from './EmojiPicker';
15
16
  export { InputFile } from './InputFile';
16
17
  export { Modal, ModalTitle, ModalConfirm, ModalConfirmProvider, useModalConfirm, ModalHeader, ModalBodyGroup, ModalBodyItem, ModalBody, ModalFooter } from './Modal';
17
18
  export { Pagination } from './Pagination';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pushwoosh/dumb-components",
3
- "version": "2.9.10",
3
+ "version": "2.9.12",
4
4
  "description": "React components to build Pushwoosh products",
5
5
  "main": "index.js",
6
6
  "module": "index.js",