@pushwoosh/dumb-components 2.9.1 → 2.9.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.
Files changed (83) hide show
  1. package/Calendar/CalendarMonthSlider/CalendarMonthSlider.js +1 -1
  2. package/Calendar/CalendarMonthSlider/styles.d.ts +1 -1
  3. package/Calendar/CalendarMonthSlider/styles.js +2 -2
  4. package/CardMetric/CardCollapse.js +2 -2
  5. package/CardMetric/CardMetric.js +4 -4
  6. package/CardMetric/__tests__/CardMetric.test.d.ts +1 -0
  7. package/CardMetric/__tests__/CardMetric.test.js +31 -0
  8. package/CardMetric/styles.d.ts +8 -4
  9. package/CardMetric/styles.js +23 -23
  10. package/CardMetric/types.d.ts +3 -3
  11. package/DateTimePicker/__tests__/YearView.test.d.ts +1 -0
  12. package/DateTimePicker/__tests__/YearView.test.js +15 -0
  13. package/DateTimePicker/components/DecadeView/DecadeView.js +1 -1
  14. package/DateTimePicker/components/YearView/YearView.js +1 -1
  15. package/DateTimePicker/styles.d.ts +1 -1
  16. package/DateTimePicker/styles.js +2 -2
  17. package/EditableField/EditableField.js +1 -1
  18. package/EditableField/__tests__/EditableField.test.d.ts +1 -0
  19. package/EditableField/__tests__/EditableField.test.js +19 -0
  20. package/EditableField/styles.d.ts +1 -1
  21. package/EditableField/styles.js +8 -8
  22. package/ExternalImagePreview/ExternalImagePreview.js +9 -9
  23. package/ExternalImagePreview/__tests__/ExternalImagePreview.test.d.ts +1 -0
  24. package/ExternalImagePreview/__tests__/ExternalImagePreview.test.js +18 -0
  25. package/ExternalImagePreview/styles.d.ts +7 -7
  26. package/ExternalImagePreview/styles.js +14 -14
  27. package/NativeRichMediaPreview/NativeRichMediaPreview.js +2 -2
  28. package/NativeRichMediaPreview/styles.d.ts +2 -2
  29. package/NativeRichMediaPreview/styles.js +4 -4
  30. package/PageHeader/__tests__/PageHeader.test.d.ts +1 -0
  31. package/PageHeader/__tests__/PageHeader.test.js +37 -0
  32. package/PageHeader/components/AutosizeInput/AutosizeInput.js +1 -1
  33. package/PageHeader/components/AutosizeInput/styles.js +2 -2
  34. package/PageHeader/components/AutosizeInput/types.d.ts +1 -1
  35. package/PageHeader/components/PageHeader/PageHeader.js +1 -1
  36. package/PageHeader/components/PageHeader/styles.d.ts +1 -1
  37. package/PageHeader/components/PageHeader/styles.js +2 -2
  38. package/PageHeader/components/PageHeaderEditable/PageHeaderEditable.js +1 -1
  39. package/PageHeader/components/PageHeaderEditable/styles.d.ts +1 -1
  40. package/PageHeader/components/PageHeaderEditable/styles.js +2 -2
  41. package/PageHeader/components/PageHeaderSkeleton/PageHeaderSkeleton.js +6 -6
  42. package/PageHeader/components/PageHeaderSkeleton/styles.d.ts +2 -2
  43. package/PageHeader/components/PageHeaderSkeleton/styles.js +4 -4
  44. package/PushPreview/PushPreview.js +4 -4
  45. package/PushPreview/__tests__/PushPreview.test.d.ts +1 -0
  46. package/PushPreview/__tests__/PushPreview.test.js +26 -0
  47. package/PushPreview/components/MissedContentPreview/MissedContentPreview.js +3 -3
  48. package/PushPreview/components/SilentPushPreview/SilentPushPreview.js +3 -3
  49. package/PushPreview/styles.d.ts +4 -4
  50. package/PushPreview/styles.js +8 -8
  51. package/RadioCard/RadioCard.js +2 -2
  52. package/RadioCard/__tests__/RadioCard.test.d.ts +1 -0
  53. package/RadioCard/__tests__/RadioCard.test.js +23 -0
  54. package/RadioCard/styles.d.ts +2 -2
  55. package/RadioCard/styles.js +10 -10
  56. package/RichmediaPreview/RichmediaPreview.js +2 -2
  57. package/RichmediaPreview/__tests__/RichmediaPreview.test.d.ts +1 -0
  58. package/RichmediaPreview/__tests__/RichmediaPreview.test.js +21 -0
  59. package/RichmediaPreview/styles.d.ts +2 -2
  60. package/RichmediaPreview/styles.js +4 -4
  61. package/Spinner/Spinner.js +1 -1
  62. package/Spinner/__tests__/Spinner.test.d.ts +1 -0
  63. package/Spinner/__tests__/Spinner.test.js +15 -0
  64. package/Spinner/styles.d.ts +1 -1
  65. package/Spinner/styles.js +4 -4
  66. package/Switch/Switch.js +7 -7
  67. package/Switch/styles.js +18 -18
  68. package/Switch/types.d.ts +4 -4
  69. package/Tabs/__tests__/TabBar.test.d.ts +1 -0
  70. package/Tabs/__tests__/TabBar.test.js +36 -0
  71. package/Tabs/components/TabBar/TabBar.js +1 -1
  72. package/Tabs/components/TabBar/styles.d.ts +1 -1
  73. package/Tabs/components/TabBar/styles.js +2 -2
  74. package/Tabs/components/TabBarScrollableFrame/TabBarScrollableFrame.js +1 -1
  75. package/Tabs/components/TabBarScrollableFrame/styles.d.ts +1 -1
  76. package/Tabs/components/TabBarScrollableFrame/styles.js +2 -2
  77. package/Toast/Toast.js +2 -2
  78. package/Toast/__tests__/Toast.test.d.ts +1 -0
  79. package/Toast/__tests__/Toast.test.js +20 -0
  80. package/Toast/styles.d.ts +2 -2
  81. package/Toast/styles.js +4 -4
  82. package/hooks/useOnClickOutside.d.ts +1 -1
  83. package/package.json +2 -2
@@ -24,8 +24,8 @@ export const MoreActionsBox = styled.div.withConfig({
24
24
  displayName: "MoreActionsBox",
25
25
  componentId: "sc-19rm2yr-5"
26
26
  })(["display:flex;margin-right:", ";"], ({
27
- hasActions
28
- }) => hasActions ? '16px' : '0');
27
+ $hasActions
28
+ }) => $hasActions ? '16px' : '0');
29
29
  export const DescriptionBox = styled(Paragraph).withConfig({
30
30
  displayName: "DescriptionBox",
31
31
  componentId: "sc-19rm2yr-6"
@@ -6,18 +6,18 @@ export function PageHeaderSkeleton() {
6
6
  children: [_jsxs(Horizontal, {
7
7
  "$gap": 16,
8
8
  children: [_jsx(SkeletonStyled, {}), _jsx(SkeletonStyled, {
9
- width: 60
9
+ "$width": 60
10
10
  }), _jsx(SkeletonStyled, {
11
- width: 60
11
+ "$width": 60
12
12
  })]
13
13
  }), _jsxs(Horizontal, {
14
14
  "$gap": 16,
15
15
  children: [_jsx(SkeletonStyled, {
16
- width: 68,
17
- height: 36
16
+ "$width": 68,
17
+ "$height": 36
18
18
  }), _jsx(SkeletonStyled, {
19
- width: 68,
20
- height: 36
19
+ "$width": 68,
20
+ "$height": 36
21
21
  })]
22
22
  })]
23
23
  });
@@ -1,5 +1,5 @@
1
1
  export declare const RootBox: import("styled-components").StyledComponent<"div", any, {}, never>;
2
2
  export declare const SkeletonStyled: import("styled-components").StyledComponent<"div", any, {
3
- width?: number;
4
- height?: number;
3
+ $width?: number;
4
+ $height?: number;
5
5
  }, never>;
@@ -9,7 +9,7 @@ export const SkeletonStyled = styled.div.withConfig({
9
9
  displayName: "SkeletonStyled",
10
10
  componentId: "sc-1idyyj7-1"
11
11
  })(["width:", ";height:", ";padding:4px 0;background:", ";border-radius:", ";animation:", " 1s ease-in-out infinite;opacity:0.1;"], ({
12
- width
13
- }) => width ? `${width}px` : '24px', ({
14
- height
15
- }) => height ? `${height}px` : '24px', Color.SOFT, ShapeRadius.CONTROL, animation);
12
+ $width
13
+ }) => $width ? `${$width}px` : '24px', ({
14
+ $height
15
+ }) => $height ? `${$height}px` : '24px', Color.SOFT, ShapeRadius.CONTROL, animation);
@@ -29,7 +29,7 @@ export function PushPreview({
29
29
  const icon = pushPreset?.icon || appIcon || PREVIEW_ICON_URL;
30
30
  if (isLoading) {
31
31
  return _jsx(PushBox, {
32
- view: view,
32
+ "$view": view,
33
33
  "$loading": true
34
34
  });
35
35
  }
@@ -41,7 +41,7 @@ export function PushPreview({
41
41
  }
42
42
  return _jsxs(PushBox, {
43
43
  ...LIGHT_ISLAND_PROPS,
44
- view: view,
44
+ "$view": view,
45
45
  "$width": width,
46
46
  "$loading": isLoading,
47
47
  children: [_jsx(PushIcon, {
@@ -59,8 +59,8 @@ export function PushPreview({
59
59
  flat: true
60
60
  })
61
61
  }), _jsxs(PushDescription, {
62
- view: view,
63
- locked: !pushPreset || !content,
62
+ "$view": view,
63
+ "$locked": !pushPreset || !content,
64
64
  children: [content && _jsx(RichMessageViewer, {
65
65
  flat: view === 'compact',
66
66
  value: content
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,26 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { render, screen } from '@testing-library/react';
3
+ import { Color } from '@pushwoosh/kit-constants';
4
+ import { PushPreview } from '../PushPreview';
5
+ describe('PushPreview', () => {
6
+ it('wraps the extended description and keeps view off the DOM', () => {
7
+ const {
8
+ container
9
+ } = render(_jsx(PushPreview, {
10
+ view: "extended",
11
+ pushPreset: null
12
+ }));
13
+ const description = screen.getByText('Message is empty…');
14
+ expect(container.querySelector('[view]')).toBeNull();
15
+ expect(getComputedStyle(description).whiteSpace).toBe('normal');
16
+ });
17
+ it('greys out the silent-push texts without a `locked` attribute', () => {
18
+ const {
19
+ container
20
+ } = render(_jsx(PushPreview, {
21
+ view: "silent"
22
+ }));
23
+ expect(container.querySelector('[locked]')).toBeNull();
24
+ expect(getComputedStyle(screen.getByText('Silent push notification')).color.replace(/\s/g, '')).toBe(Color.LOCKED.replace(/\s/g, ''));
25
+ });
26
+ });
@@ -6,7 +6,7 @@ import { Lang } from '../../polyglot';
6
6
  import { PushBox, IconContainer, PushTitle, PushDescription } from '../../styles';
7
7
  export function MissedContentPreview() {
8
8
  return _jsxs(PushBox, {
9
- view: "compact",
9
+ "$view": "compact",
10
10
  children: [_jsx(IconContainer, {
11
11
  children: _jsx(CloseIcon, {
12
12
  size: "small",
@@ -14,12 +14,12 @@ export function MissedContentPreview() {
14
14
  })
15
15
  }), _jsxs(Vertical, {
16
16
  children: [_jsx(PushTitle, {
17
- locked: true,
17
+ "$locked": true,
18
18
  children: _jsx(Lang, {
19
19
  message: "DUMB.PUSH_PREVIEW.CONTENT_MISSED"
20
20
  })
21
21
  }), _jsx(PushDescription, {
22
- locked: true,
22
+ "$locked": true,
23
23
  children: _jsx(Lang, {
24
24
  message: "DUMB.PUSH_PREVIEW.HINT"
25
25
  })
@@ -5,7 +5,7 @@ import { NotificationIcon } from '@pushwoosh/kit-icons';
5
5
  import { PushBox, IconContainer, PushTitle, PushDescription } from '../../styles';
6
6
  export function SilentPushPreview() {
7
7
  return _jsxs(PushBox, {
8
- view: "silent",
8
+ "$view": "silent",
9
9
  children: [_jsx(IconContainer, {
10
10
  children: _jsx(NotificationIcon, {
11
11
  size: "small",
@@ -15,10 +15,10 @@ export function SilentPushPreview() {
15
15
  })
16
16
  }), _jsxs(Vertical, {
17
17
  children: [_jsx(PushTitle, {
18
- locked: true,
18
+ "$locked": true,
19
19
  children: "Silent push notification"
20
20
  }), _jsx(PushDescription, {
21
- locked: true,
21
+ "$locked": true,
22
22
  children: "There is no content to preview"
23
23
  })]
24
24
  })]
@@ -16,16 +16,16 @@ export declare const PushBox: import("styled-components").StyledComponent<"div",
16
16
  $padding: number;
17
17
  $gap: number;
18
18
  } & {
19
- view: PushPreviewView;
19
+ $view: PushPreviewView;
20
20
  $width?: string | number;
21
21
  $loading?: boolean;
22
22
  }, "$gridAutoFlow" | "$padding" | "$alignItems" | "$gap" | "$justifyContent">;
23
23
  export declare const IconContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
24
24
  export declare const PushIcon: import("styled-components").StyledComponent<"img", any, {}, never>;
25
25
  export declare const PushTitle: import("styled-components").StyledComponent<"div", any, {
26
- locked?: boolean;
26
+ $locked?: boolean;
27
27
  }, never>;
28
28
  export declare const PushDescription: import("styled-components").StyledComponent<"div", any, {
29
- view?: PushPreviewView;
30
- locked?: boolean;
29
+ $view?: PushPreviewView;
30
+ $locked?: boolean;
31
31
  }, never>;
@@ -14,8 +14,8 @@ export const PushBox = styled(Horizontal).attrs({
14
14
  }) => $width ? toCssValue($width) : '100%', ShapeRadius.SECTION, ({
15
15
  $loading
16
16
  }) => $loading ? 'none' : `1px solid ${Color.DIVIDER}`, ({
17
- view
18
- }) => view === 'extended' ? Shadow.LARGE : 'none', ({
17
+ $view
18
+ }) => $view === 'extended' ? Shadow.LARGE : 'none', ({
19
19
  $loading
20
20
  }) => $loading ? Color.SOFT_LIGHT : Color.CLEAR);
21
21
  export const IconContainer = styled.div.withConfig({
@@ -30,13 +30,13 @@ export const PushTitle = styled.div.withConfig({
30
30
  displayName: "PushTitle",
31
31
  componentId: "sc-185rvhg-3"
32
32
  })(["color:", ";font-size:", ";font-weight:", ";line-height:", ";white-space:nowrap;text-overflow:ellipsis;overflow:hidden;"], ({
33
- locked
34
- }) => locked ? Color.LOCKED : Color.MAIN, FontSize.SMALL, FontWeight.MEDIUM, LineHeight.SMALL);
33
+ $locked
34
+ }) => $locked ? Color.LOCKED : Color.MAIN, FontSize.SMALL, FontWeight.MEDIUM, LineHeight.SMALL);
35
35
  export const PushDescription = styled.div.withConfig({
36
36
  displayName: "PushDescription",
37
37
  componentId: "sc-185rvhg-4"
38
38
  })(["color:", ";font-size:", ";font-weight:", ";line-height:", ";white-space:", ";text-overflow:ellipsis;overflow:hidden;"], ({
39
- locked
40
- }) => locked ? Color.LOCKED : Color.MAIN, FontSize.SMALL, FontWeight.REGULAR, LineHeight.SMALL, ({
41
- view
42
- }) => view === 'extended' ? 'normal' : 'nowrap');
39
+ $locked
40
+ }) => $locked ? Color.LOCKED : Color.MAIN, FontSize.SMALL, FontWeight.REGULAR, LineHeight.SMALL, ({
41
+ $view
42
+ }) => $view === 'extended' ? 'normal' : 'nowrap');
@@ -24,8 +24,8 @@ export function RadioCard(props) {
24
24
  } = props;
25
25
  return _jsxs(RootBox, {
26
26
  "$width": width,
27
- isActive: isActive,
28
- isDisabled: isDisabled,
27
+ "$isActive": isActive,
28
+ "$isDisabled": isDisabled,
29
29
  onClick: isDisabled ? undefined : onClick,
30
30
  children: [_jsxs(Vertical, {
31
31
  "$gap": 0,
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,23 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { render } from '@testing-library/react';
3
+ import { RadioCard } from '../RadioCard';
4
+ describe('RadioCard', () => {
5
+ it('outlines the active card and dims the disabled one', () => {
6
+ const {
7
+ container,
8
+ rerender
9
+ } = render(_jsx(RadioCard, {
10
+ title: "Pro",
11
+ isActive: true,
12
+ onClick: jest.fn()
13
+ }));
14
+ const card = () => container.firstElementChild;
15
+ expect(getComputedStyle(card()).outline).toMatch(/^2px solid/);
16
+ rerender(_jsx(RadioCard, {
17
+ title: "Pro",
18
+ isDisabled: true,
19
+ onClick: jest.fn()
20
+ }));
21
+ expect(getComputedStyle(card()).opacity).toBe('0.5');
22
+ });
23
+ });
@@ -17,7 +17,7 @@ export declare const RootBox: import("styled-components").StyledComponent<"div",
17
17
  $borderRadius: ShapeRadius;
18
18
  $gap: number;
19
19
  } & {
20
- isActive?: boolean;
21
- isDisabled?: boolean;
20
+ $isActive?: boolean;
21
+ $isDisabled?: boolean;
22
22
  $width: string | number;
23
23
  }, "$gridAutoFlow" | "$bgColor" | "$borderRadius" | "$padding" | "$alignItems" | "$gap">;
@@ -13,13 +13,13 @@ export const RootBox = styled(Vertical).attrs({
13
13
  })(["width:", ";height:100%;box-sizing:border-box;outline:", ";cursor:", ";opacity:", ";pointer-events:", ";&:hover{background:", ";}"], ({
14
14
  $width
15
15
  }) => toCssValue($width), ({
16
- isActive
17
- }) => isActive ? `2px solid ${Color.PRIMARY}` : `1px solid ${Color.DIVIDER}`, ({
18
- isDisabled
19
- }) => isDisabled ? 'default' : 'pointer', ({
20
- isDisabled
21
- }) => isDisabled ? 0.5 : 1, ({
22
- isDisabled
23
- }) => isDisabled ? 'none' : 'auto', ({
24
- isDisabled
25
- }) => isDisabled ? Color.CLEAR : Color.ROW_HOVER);
16
+ $isActive
17
+ }) => $isActive ? `2px solid ${Color.PRIMARY}` : `1px solid ${Color.DIVIDER}`, ({
18
+ $isDisabled
19
+ }) => $isDisabled ? 'default' : 'pointer', ({
20
+ $isDisabled
21
+ }) => $isDisabled ? 0.5 : 1, ({
22
+ $isDisabled
23
+ }) => $isDisabled ? 'none' : 'auto', ({
24
+ $isDisabled
25
+ }) => $isDisabled ? Color.CLEAR : Color.ROW_HOVER);
@@ -34,8 +34,8 @@ export function RichmediaPreview(props) {
34
34
  });
35
35
  return _jsx(RichMediaPreviewContainer, {
36
36
  ...LIGHT_ISLAND_PROPS,
37
- width: width,
38
- height: height,
37
+ "$width": width,
38
+ "$height": height,
39
39
  "$isLoading": isLoading,
40
40
  "$placeItems": "center",
41
41
  children: isLoading ? _jsx(Spinner, {
@@ -0,0 +1,21 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { render } from '@testing-library/react';
3
+ import { RichmediaPreview } from '../RichmediaPreview';
4
+ describe('RichmediaPreview', () => {
5
+ it('sizes the container without width/height attributes', () => {
6
+ const {
7
+ container
8
+ } = render(_jsx(RichmediaPreview, {
9
+ name: "rm",
10
+ params: {},
11
+ content: "",
12
+ width: 300,
13
+ height: 500
14
+ }));
15
+ const box = container.firstElementChild;
16
+ expect(box).not.toHaveAttribute('width');
17
+ expect(box).not.toHaveAttribute('height');
18
+ expect(getComputedStyle(box).width).toBe('300px');
19
+ expect(getComputedStyle(box).height).toBe('500px');
20
+ });
21
+ });
@@ -11,8 +11,8 @@ export declare const RichMediaPreviewContainer: import("styled-components").Styl
11
11
  } & {
12
12
  $gridAutoFlow: string;
13
13
  } & {
14
- width: string | number;
15
- height: string | number;
14
+ $width: string | number;
15
+ $height: string | number;
16
16
  $isLoading?: boolean;
17
17
  }, "$gridAutoFlow">;
18
18
  export declare const RichMediaPreviewIframe: import("styled-components").StyledComponent<typeof SandboxedHtmlFrame, any, {}, never>;
@@ -6,10 +6,10 @@ export const RichMediaPreviewContainer = styled(Vertical).withConfig({
6
6
  displayName: "RichMediaPreviewContainer",
7
7
  componentId: "sc-1ci6l2b-0"
8
8
  })(["position:relative;border:1px solid #ddd;width:", ";height:", ";border-radius:", ";background-color:", ";margin:0 auto;overflow:hidden;"], ({
9
- width
10
- }) => toCssValue(width), ({
11
- height
12
- }) => toCssValue(height), ShapeRadius.SECTION, ({
9
+ $width
10
+ }) => toCssValue($width), ({
11
+ $height
12
+ }) => toCssValue($height), ShapeRadius.SECTION, ({
13
13
  $isLoading
14
14
  }) => $isLoading ? Color.FROZEN : Color.CLEAR);
15
15
  export const RichMediaPreviewIframe = styled(SandboxedHtmlFrame).withConfig({
@@ -20,7 +20,7 @@ export function Spinner(props) {
20
20
  }
21
21
  return _jsx(SpinnerBox, {
22
22
  ...rest,
23
- size: size,
23
+ "$size": size,
24
24
  ref: boxRef,
25
25
  children: _jsx(SpinnerAnimate, {
26
26
  children: _jsx(Icon, {})
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,15 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { render } from '@testing-library/react';
3
+ import { Spinner } from '../Spinner';
4
+ describe('Spinner', () => {
5
+ it('sizes the box from `size` without leaking it to the DOM', () => {
6
+ const {
7
+ container
8
+ } = render(_jsx(Spinner, {
9
+ size: "medium"
10
+ }));
11
+ const box = container.firstElementChild;
12
+ expect(box).not.toHaveAttribute('size');
13
+ expect(getComputedStyle(box).width).toBe('24px');
14
+ });
15
+ });
@@ -1,5 +1,5 @@
1
1
  import type { SpinnerProps } from './types';
2
2
  export declare const SpinnerBox: import("styled-components").StyledComponent<"div", any, {
3
- size: SpinnerProps["size"];
3
+ $size: SpinnerProps["size"];
4
4
  }, never>;
5
5
  export declare const SpinnerAnimate: import("styled-components").StyledComponent<"div", any, {}, never>;
package/Spinner/styles.js CHANGED
@@ -9,10 +9,10 @@ export const SpinnerBox = styled.div.withConfig({
9
9
  displayName: "SpinnerBox",
10
10
  componentId: "sc-y39y31-0"
11
11
  })(["width:", ";height:", ";color:", ";line-height:0;user-select:none;", ""], ({
12
- size
13
- }) => SizeInPxBySpinnerSizeMap[size], ({
14
- size
15
- }) => SizeInPxBySpinnerSizeMap[size], ({
12
+ $size
13
+ }) => SizeInPxBySpinnerSizeMap[$size], ({
14
+ $size
15
+ }) => SizeInPxBySpinnerSizeMap[$size], ({
16
16
  color
17
17
  }) => color || Color.CURRENT, ({
18
18
  color
package/Switch/Switch.js CHANGED
@@ -20,18 +20,18 @@ export function Switch({
20
20
  }
21
21
  }, [isDisabled, onChange]);
22
22
  return _jsxs(Container, {
23
- labelPosition: labelPosition,
24
- isDisabled: isDisabled,
23
+ "$labelPosition": labelPosition,
24
+ "$isDisabled": isDisabled,
25
25
  onClick: handleClick,
26
26
  children: [_jsx(Box, {
27
- enabled: enabled,
28
- isDisabled: isDisabled,
27
+ "$enabled": enabled,
28
+ "$isDisabled": isDisabled,
29
29
  children: _jsx(Circle, {
30
- enabled: enabled,
31
- isDisabled: isDisabled
30
+ "$enabled": enabled,
31
+ "$isDisabled": isDisabled
32
32
  })
33
33
  }), children && _jsx(Label, {
34
- labelPosition: labelPosition,
34
+ "$labelPosition": labelPosition,
35
35
  children: children
36
36
  })]
37
37
  });
package/Switch/styles.js CHANGED
@@ -1,34 +1,34 @@
1
1
  import styled, { css } from 'styled-components';
2
2
  import { Color, FontSize, FontWeight } from '@pushwoosh/kit-constants';
3
3
  const defineColorBackgroundBox = css(["", ""], props => {
4
- if (props.isDisabled && !props.enabled) {
4
+ if (props.$isDisabled && !props.$enabled) {
5
5
  return Color.CLEAR;
6
6
  }
7
- if (props.isDisabled && props.enabled) {
7
+ if (props.$isDisabled && props.$enabled) {
8
8
  return Color.LOCKED;
9
9
  }
10
- if (props.enabled) {
10
+ if (props.$enabled) {
11
11
  return Color.PRIMARY_HOVER;
12
12
  }
13
13
  return Color.CLEAR;
14
14
  });
15
15
  const defineColorBorderBox = css(["", ""], props => {
16
- if (props.isDisabled) {
16
+ if (props.$isDisabled) {
17
17
  return Color.LOCKED;
18
18
  }
19
- if (props.enabled) {
19
+ if (props.$enabled) {
20
20
  return Color.PRIMARY_HOVER;
21
21
  }
22
22
  return Color.PHANTOM;
23
23
  });
24
24
  const defineColorCircle = css(["", ""], props => {
25
- if (props.isDisabled && props.enabled) {
25
+ if (props.$isDisabled && props.$enabled) {
26
26
  return Color.CLEAR;
27
27
  }
28
- if (props.isDisabled && !props.enabled) {
28
+ if (props.$isDisabled && !props.$enabled) {
29
29
  return Color.LOCKED;
30
30
  }
31
- if (!props.isDisabled && props.enabled) {
31
+ if (!props.$isDisabled && props.$enabled) {
32
32
  return Color.CLEAR;
33
33
  }
34
34
  return Color.MAIN;
@@ -38,20 +38,20 @@ export const Container = styled.div.withConfig({
38
38
  displayName: "Container",
39
39
  componentId: "sc-csdrg2-0"
40
40
  })(["display:flex;align-items:center;flex-direction:", ";cursor:", ";"], ({
41
- labelPosition
42
- }) => labelPosition === 'left' ? 'row-reverse' : 'row', ({
43
- isDisabled
44
- }) => isDisabled ? 'not-allowed' : 'pointer');
41
+ $labelPosition
42
+ }) => $labelPosition === 'left' ? 'row-reverse' : 'row', ({
43
+ $isDisabled
44
+ }) => $isDisabled ? 'not-allowed' : 'pointer');
45
45
  export const Box = styled.div.attrs({
46
46
  tabIndex: '0'
47
47
  }).withConfig({
48
48
  displayName: "Box",
49
49
  componentId: "sc-csdrg2-1"
50
50
  })(["display:flex;align-items:center;justify-content:", ";width:36px;height:20px;border:2px solid ", ";border-radius:10px;background-color:", ";outline:none;cursor:pointer;", ""], ({
51
- enabled
52
- }) => enabled ? 'flex-end' : 'flex-start', defineColorBorderBox, defineColorBackgroundBox, ({
53
- isDisabled
54
- }) => isDisabled ? '' : cssActive);
51
+ $enabled
52
+ }) => $enabled ? 'flex-end' : 'flex-start', defineColorBorderBox, defineColorBackgroundBox, ({
53
+ $isDisabled
54
+ }) => $isDisabled ? '' : cssActive);
55
55
  export const Circle = styled.div.withConfig({
56
56
  displayName: "Circle",
57
57
  componentId: "sc-csdrg2-2"
@@ -60,5 +60,5 @@ export const Label = styled.div.withConfig({
60
60
  displayName: "Label",
61
61
  componentId: "sc-csdrg2-3"
62
62
  })(["display:flex;align-items:center;color:", ";font-size:", ";font-weight:", ";margin:", ";"], Color.MAIN, FontSize.REGULAR, FontWeight.MEDIUM, ({
63
- labelPosition
64
- }) => labelPosition === 'left' ? '0 8px 0' : '0 0 0 8px');
63
+ $labelPosition
64
+ }) => $labelPosition === 'left' ? '0 8px 0' : '0 0 0 8px');
package/Switch/types.d.ts CHANGED
@@ -14,11 +14,11 @@ export interface SwitchProps {
14
14
  }
15
15
  /** Internal style props carrying the label side and the disabled state. */
16
16
  export interface AlignProps {
17
- labelPosition?: string;
18
- isDisabled?: boolean;
17
+ $labelPosition?: string;
18
+ $isDisabled?: boolean;
19
19
  }
20
20
  /** Internal style prop carrying the toggle state. */
21
21
  export interface ComponentProps {
22
- enabled: boolean;
23
- isDisabled?: boolean;
22
+ $enabled: boolean;
23
+ $isDisabled?: boolean;
24
24
  }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,36 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { render, screen } from '@testing-library/react';
3
+ import { Tab, TabBar, Tabs } from '..';
4
+ describe('TabBar', () => {
5
+ it('adds a title column only when a title is given, without a hasTitle attribute', () => {
6
+ render(_jsx(Tabs, {
7
+ activeCode: "a",
8
+ onChange: jest.fn(),
9
+ children: _jsx(TabBar, {
10
+ title: "Title",
11
+ "data-testid": "bar",
12
+ children: _jsx(Tab, {
13
+ code: "a",
14
+ children: "A"
15
+ })
16
+ })
17
+ }));
18
+ const bar = screen.getByTestId('bar');
19
+ expect(bar).not.toHaveAttribute('hastitle');
20
+ expect(getComputedStyle(bar).gridTemplateColumns).toBe('max-content 1fr');
21
+ });
22
+ it('uses a single column without a title', () => {
23
+ render(_jsx(Tabs, {
24
+ activeCode: "a",
25
+ onChange: jest.fn(),
26
+ children: _jsx(TabBar, {
27
+ "data-testid": "bar",
28
+ children: _jsx(Tab, {
29
+ code: "a",
30
+ children: "A"
31
+ })
32
+ })
33
+ }));
34
+ expect(getComputedStyle(screen.getByTestId('bar')).gridTemplateColumns).toBe('1fr');
35
+ });
36
+ });
@@ -15,7 +15,7 @@ export const TabBar = forwardRef((props, ref) => {
15
15
  ...rest
16
16
  } = props;
17
17
  return _jsxs(TabBarContainer, {
18
- hasTitle: !!title,
18
+ "$hasTitle": !!title,
19
19
  ref: ref,
20
20
  ...rest,
21
21
  children: [title && _jsx(TabBarTitleBox, {
@@ -1,5 +1,5 @@
1
1
  export declare const TabBarContainer: import("styled-components").StyledComponent<"div", any, {
2
- hasTitle: boolean;
2
+ $hasTitle: boolean;
3
3
  }, never>;
4
4
  export declare const TabBarTitleBox: import("styled-components").StyledComponent<"div", any, {}, never>;
5
5
  export declare const TabBarStretchedContent: import("styled-components").StyledComponent<"div", any, {}, never>;
@@ -4,8 +4,8 @@ export const TabBarContainer = styled.div.withConfig({
4
4
  displayName: "TabBarContainer",
5
5
  componentId: "sc-pu8yhh-0"
6
6
  })(["position:relative;display:grid;grid-template-columns:", ";width:100%;height:40px;background:", ";border-radius:8px;padding:4px;overflow:hidden;"], ({
7
- hasTitle
8
- }) => hasTitle ? 'max-content 1fr' : '1fr', Color.SOFT_LIGHT);
7
+ $hasTitle
8
+ }) => $hasTitle ? 'max-content 1fr' : '1fr', Color.SOFT_LIGHT);
9
9
  export const TabBarTitleBox = styled.div.withConfig({
10
10
  displayName: "TabBarTitleBox",
11
11
  componentId: "sc-pu8yhh-1"
@@ -55,7 +55,7 @@ export const TabBarScrollableFrame = forwardRef(({
55
55
  "$clipRight": canScrollRight,
56
56
  ref: windowRef,
57
57
  children: _jsx(TabBarContent, {
58
- left: scrollLeft,
58
+ "$left": scrollLeft,
59
59
  ref: contentRef,
60
60
  children: children
61
61
  })
@@ -7,6 +7,6 @@ export declare const TabBarWindow: import("styled-components").StyledComponent<"
7
7
  }, never>;
8
8
  export declare const TabsListContentBase: import("styled-components").StyledComponent<"div", any, {}, never>;
9
9
  export declare const TabBarContent: import("styled-components").StyledComponent<"div", any, {
10
- left: number;
10
+ $left: number;
11
11
  }, never>;
12
12
  export declare const TabBarFrame: import("styled-components").StyledComponent<"div", any, {}, never>;
@@ -23,8 +23,8 @@ export const TabBarContent = styled(TabsListContentBase).withConfig({
23
23
  displayName: "TabBarContent",
24
24
  componentId: "sc-1sonok9-3"
25
25
  })(["left:", "px;gap:4px;"], ({
26
- left
27
- }) => left);
26
+ $left
27
+ }) => $left);
28
28
  export const TabBarFrame = styled.div.withConfig({
29
29
  displayName: "TabBarFrame",
30
30
  componentId: "sc-1sonok9-4"