@pushwoosh/dumb-components 2.9.2 → 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 (82) 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/package.json +2 -2
@@ -92,7 +92,7 @@ export const CalendarMonthSlider = ({
92
92
  },
93
93
  children: [_jsx(Viewport, {
94
94
  children: _jsx(Strip, {
95
- withTransition: inTransition,
95
+ "$withTransition": inTransition,
96
96
  onTransitionEnd: () => {
97
97
  toBaseline(anchor);
98
98
  },
@@ -12,7 +12,7 @@ export declare const Root: import("styled-components").StyledComponent<"div", an
12
12
  }, "$gridAutoFlow">;
13
13
  export declare const Viewport: import("styled-components").StyledComponent<"div", any, {}, never>;
14
14
  export declare const Strip: import("styled-components").StyledComponent<"div", any, {
15
- withTransition: boolean;
15
+ $withTransition: boolean;
16
16
  }, never>;
17
17
  export declare const Panel: import("styled-components").StyledComponent<"div", any, {}, never>;
18
18
  export declare const Arrow: import("styled-components").StyledComponent<import("react").FC<import("@pushwoosh/kit-icons").ArrowIconProps>, any, {
@@ -14,8 +14,8 @@ export const Strip = styled.div.withConfig({
14
14
  displayName: "Strip",
15
15
  componentId: "sc-1qqlxvi-2"
16
16
  })(["display:grid;grid-auto-flow:column;grid-auto-columns:var(--col-width,0px);column-gap:var(--gap,0px);transform:translateX(var(--shift,0px));", ""], ({
17
- withTransition
18
- }) => withTransition && css(["transition:transform var(--duration,150ms) ease-out;"]));
17
+ $withTransition
18
+ }) => $withTransition && css(["transition:transform var(--duration,150ms) ease-out;"]));
19
19
  export const Panel = styled.div.withConfig({
20
20
  displayName: "Panel",
21
21
  componentId: "sc-1qqlxvi-3"
@@ -6,9 +6,9 @@ export function CardCollapse(props) {
6
6
  isCollapsed
7
7
  } = props;
8
8
  return _jsx(CollapseContainer, {
9
- isCollapsed: isCollapsed,
9
+ "$isCollapsed": isCollapsed,
10
10
  children: _jsx(CollapseInner, {
11
- isCollapsed: isCollapsed,
11
+ "$isCollapsed": isCollapsed,
12
12
  children: children
13
13
  })
14
14
  });
@@ -33,8 +33,8 @@ export function CardMetric({
33
33
  const onMouseOver = () => setVisibleInfo(true);
34
34
  const onMouseOut = () => setVisibleInfo(false);
35
35
  return _jsxs(CardContainer, {
36
- view: view,
37
- focus: focus,
36
+ "$view": view,
37
+ "$focus": focus,
38
38
  ...otherProps,
39
39
  children: [(!!title || !!headerExtra) && _jsxs(CardHeader, {
40
40
  children: [_jsxs(CardHeaderLeft, {
@@ -44,12 +44,12 @@ export function CardMetric({
44
44
  setIsCollapsed(prevState => !prevState);
45
45
  }
46
46
  },
47
- collapsable: collapse !== undefined,
47
+ "$collapsable": collapse !== undefined,
48
48
  children: [title, collapse !== undefined && _jsx(ChevronIcon, {
49
49
  direction: isCollapsed ? 'down' : 'up',
50
50
  size: "small"
51
51
  }), _jsx(CardInfo, {
52
- hide: !tooltip,
52
+ "$hide": !tooltip,
53
53
  onMouseOver: onMouseOver,
54
54
  onMouseOut: onMouseOut,
55
55
  children: _jsx(Tooltip, {
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,31 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { render, screen } from '@testing-library/react';
3
+ import { CardMetric } from '../CardMetric';
4
+ describe('CardMetric', () => {
5
+ it('styles a focused stacking card without leaking view/focus to the DOM', () => {
6
+ const {
7
+ container
8
+ } = render(_jsx(CardMetric, {
9
+ view: "stacking",
10
+ focus: true,
11
+ title: "Sent",
12
+ metric: 1
13
+ }));
14
+ const card = container.firstElementChild;
15
+ expect(card).not.toHaveAttribute('view');
16
+ expect(card).not.toHaveAttribute('focus');
17
+ expect(getComputedStyle(card).padding).toBe('24px');
18
+ expect(getComputedStyle(card).outlineWidth).toBe('4px');
19
+ });
20
+ it('collapses the body and marks the title clickable', () => {
21
+ render(_jsx(CardMetric, {
22
+ title: "Sent",
23
+ collapse: {
24
+ isCollapsed: true
25
+ },
26
+ children: "Body"
27
+ }));
28
+ expect(getComputedStyle(screen.getByText('Sent')).cursor).toBe('pointer');
29
+ expect(getComputedStyle(screen.getByText('Body').parentElement).gridTemplateRows).toBe('0fr');
30
+ });
31
+ });
@@ -1,13 +1,17 @@
1
- import type { CardContainerProps, CardTitleProps, CollapseContainerProps } from './types';
1
+ import type { CardContainerProps, CardTitleProps } from './types';
2
2
  export declare const CardContainer: import("styled-components").StyledComponent<"div", any, CardContainerProps, never>;
3
3
  export declare const CardHeader: import("styled-components").StyledComponent<"div", any, {}, never>;
4
4
  export declare const CardHeaderLeft: import("styled-components").StyledComponent<"div", any, {}, never>;
5
5
  export declare const CardTitle: import("styled-components").StyledComponent<"div", any, CardTitleProps, never>;
6
6
  export declare const CardInfo: import("styled-components").StyledComponent<"div", any, {
7
- hide: boolean;
7
+ $hide: boolean;
8
8
  }, never>;
9
9
  export declare const CardMetricValue: import("styled-components").StyledComponent<"div", any, {}, never>;
10
10
  export declare const CardExtraMetric: import("styled-components").StyledComponent<"div", any, {}, never>;
11
11
  export declare const CardDescription: import("styled-components").StyledComponent<"div", any, {}, never>;
12
- export declare const CollapseContainer: import("styled-components").StyledComponent<"div", any, CollapseContainerProps, never>;
13
- export declare const CollapseInner: import("styled-components").StyledComponent<"div", any, CollapseContainerProps, never>;
12
+ export declare const CollapseContainer: import("styled-components").StyledComponent<"div", any, {
13
+ $isCollapsed: boolean;
14
+ }, never>;
15
+ export declare const CollapseInner: import("styled-components").StyledComponent<"div", any, {
16
+ $isCollapsed: boolean;
17
+ }, never>;
@@ -4,22 +4,22 @@ export const CardContainer = styled.div.withConfig({
4
4
  displayName: "CardContainer",
5
5
  componentId: "sc-17snd37-0"
6
6
  })(["display:flex;color:", ";background-color:", ";flex-direction:column;scroll-margin:4px;outline-style:solid;gap:12px;padding:", ";border-radius:", ";border-bottom:", ";outline-color:", ";outline-width:", ";"], Color.MAIN, Color.CLEAR, ({
7
- view
8
- }) => view === 'stacking' ? '24px' : '16px', ({
9
- view
10
- }) => view === 'stacking' ? 0 : '4px', ({
11
- view,
12
- focus
13
- }) => view === 'stacking' && !focus ? `1px solid ${Color.DIVIDER}` : 'none', ({
14
- focus
15
- }) => focus ? Color.BRIGHT : Color.DIVIDER, ({
16
- view,
17
- focus
7
+ $view
8
+ }) => $view === 'stacking' ? '24px' : '16px', ({
9
+ $view
10
+ }) => $view === 'stacking' ? 0 : '4px', ({
11
+ $view,
12
+ $focus
13
+ }) => $view === 'stacking' && !$focus ? `1px solid ${Color.DIVIDER}` : 'none', ({
14
+ $focus
15
+ }) => $focus ? Color.BRIGHT : Color.DIVIDER, ({
16
+ $view,
17
+ $focus
18
18
  }) => {
19
- if (focus) {
19
+ if ($focus) {
20
20
  return '4px';
21
21
  }
22
- if (view === 'stacking') {
22
+ if ($view === 'stacking') {
23
23
  return 0;
24
24
  }
25
25
  return '1px';
@@ -36,16 +36,16 @@ export const CardTitle = styled.div.withConfig({
36
36
  displayName: "CardTitle",
37
37
  componentId: "sc-17snd37-3"
38
38
  })(["display:flex;align-items:center;text-transform:uppercase;font-size:", ";color:", ";cursor:", ";gap:4px;"], FontSize.SMALL, ({
39
- collapsable
40
- }) => collapsable ? Color.SOFT : Color.MAIN, ({
41
- collapsable
42
- }) => collapsable ? 'pointer' : 'auto');
39
+ $collapsable
40
+ }) => $collapsable ? Color.SOFT : Color.MAIN, ({
41
+ $collapsable
42
+ }) => $collapsable ? 'pointer' : 'auto');
43
43
  export const CardInfo = styled.div.withConfig({
44
44
  displayName: "CardInfo",
45
45
  componentId: "sc-17snd37-4"
46
46
  })(["display:", ";cursor:pointer;"], ({
47
- hide
48
- }) => hide ? 'none' : 'block');
47
+ $hide
48
+ }) => $hide ? 'none' : 'block');
49
49
  export const CardMetricValue = styled.div.withConfig({
50
50
  displayName: "CardMetricValue",
51
51
  componentId: "sc-17snd37-5"
@@ -64,11 +64,11 @@ export const CollapseContainer = styled.div.withConfig({
64
64
  displayName: "CollapseContainer",
65
65
  componentId: "sc-17snd37-8"
66
66
  })(["display:grid;grid-template-rows:", ";transition:grid-template-rows 0.5s ease-out;"], ({
67
- isCollapsed
68
- }) => isCollapsed ? '0fr' : '1fr');
67
+ $isCollapsed
68
+ }) => $isCollapsed ? '0fr' : '1fr');
69
69
  export const CollapseInner = styled.div.withConfig({
70
70
  displayName: "CollapseInner",
71
71
  componentId: "sc-17snd37-9"
72
72
  })(["overflow:", ";"], ({
73
- isCollapsed
74
- }) => isCollapsed ? 'hidden' : 'auto');
73
+ $isCollapsed
74
+ }) => $isCollapsed ? 'hidden' : 'auto');
@@ -29,11 +29,11 @@ export type CardMetricProps = {
29
29
  [key: string]: any;
30
30
  };
31
31
  export type CardContainerProps = {
32
- view: 'rounded' | 'stacking';
33
- focus: boolean;
32
+ $view: 'rounded' | 'stacking';
33
+ $focus: boolean;
34
34
  };
35
35
  export type CardTitleProps = {
36
- collapsable: boolean;
36
+ $collapsable: boolean;
37
37
  };
38
38
  export type CollapseContainerProps = {
39
39
  isCollapsed: boolean;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,15 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { render, screen } from '@testing-library/react';
3
+ import { YearView } from '../components/YearView/YearView';
4
+ describe('YearView', () => {
5
+ it('makes month cells 59px tall without a height attribute', () => {
6
+ render(_jsx(YearView, {
7
+ year: "2026",
8
+ onChange: jest.fn(),
9
+ onSelect: jest.fn()
10
+ }));
11
+ const cell = screen.getAllByText(/^[A-Z][a-z]{2}$/)[0].closest('div[class]');
12
+ expect(cell).not.toHaveAttribute('height');
13
+ expect(getComputedStyle(cell).height).toBe('59px');
14
+ });
15
+ });
@@ -24,7 +24,7 @@ export function DecadeView(props) {
24
24
  }).map((_, i) => {
25
25
  const year = firstYear + i;
26
26
  return _jsx(CellBox, {
27
- height: "59px",
27
+ "$height": "59px",
28
28
  "$isActive": year === activeDayYear,
29
29
  onClick: () => onSelect(format(setPeriod(value, 'year', year), 'year')),
30
30
  children: year
@@ -25,7 +25,7 @@ export function YearView(props) {
25
25
  }).map((_, i) => {
26
26
  const month = format(setPeriod(year, 'month', i + 1), 'year-month');
27
27
  return _jsx(CellBox, {
28
- height: "59px",
28
+ "$height": "59px",
29
29
  "$isActive": !!activeDay && isSamePeriod(month, activeDay, 'month'),
30
30
  onClick: () => onSelect(month),
31
31
  children: monthName(i + 1, 'short')
@@ -3,7 +3,7 @@ export declare const CellBox: import("styled-components").StyledComponent<"div",
3
3
  $isDisabled?: boolean;
4
4
  $secondary?: boolean;
5
5
  $secondActive?: boolean;
6
- height?: number | string;
6
+ $height?: number | string;
7
7
  }, never>;
8
8
  export declare const DayHeader: import("styled-components").StyledComponent<"div", any, {}, never>;
9
9
  export declare const DateInfo: import("styled-components").StyledComponent<"div", any, {}, never>;
@@ -10,8 +10,8 @@ export const CellBox = styled(CalendarCellBaseStyled).withConfig({
10
10
  displayName: "CellBox",
11
11
  componentId: "sc-t3ruuk-1"
12
12
  })(["height:", ";color:", ";background-color:", ";border-radius:", ";opacity:", ";outline:", ";cursor:pointer;", " &:hover{background-color:", ";}"], ({
13
- height
14
- }) => height || '32px', ({
13
+ $height
14
+ }) => $height || '32px', ({
15
15
  $isActive
16
16
  }) => $isActive ? Color.CLEAR : Color.MAIN, ({
17
17
  $isActive
@@ -36,7 +36,7 @@ export function EditableField({
36
36
  return _jsxs(PopoverContainer, {
37
37
  ref: rootRef,
38
38
  children: [_jsxs(FieldBox, {
39
- open: open,
39
+ "$open": open,
40
40
  onClick: onToggleOpen,
41
41
  ref: buttonRef,
42
42
  children: [_jsx("span", {
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,19 @@
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 { EditableField } from '../EditableField';
5
+ describe('EditableField', () => {
6
+ it('paints the open field without an `open` attribute on the div', () => {
7
+ render(_jsx(EditableField, {
8
+ value: "Campaign",
9
+ open: true,
10
+ onToggleOpen: jest.fn(),
11
+ onSubmit: jest.fn(),
12
+ onCancel: jest.fn(),
13
+ children: "Editor"
14
+ }));
15
+ const field = screen.getByText('Campaign').closest('div');
16
+ expect(field).not.toHaveAttribute('open');
17
+ expect(getComputedStyle(field).background.replace(/\s/g, '')).toBe(Color.MAIN.replace(/\s/g, ''));
18
+ });
19
+ });
@@ -1,6 +1,6 @@
1
1
  import { H5 } from '@pushwoosh/kit-typography';
2
2
  export declare const FieldBox: import("styled-components").StyledComponent<"div", any, {
3
- open: boolean;
3
+ $open: boolean;
4
4
  }, never>;
5
5
  export declare const TitleBox: import("styled-components").StyledComponent<typeof H5, any, {}, never>;
6
6
  export declare const ButtonsGroup: import("styled-components").StyledComponent<"div", any, {
@@ -5,14 +5,14 @@ export const FieldBox = styled.div.withConfig({
5
5
  displayName: "FieldBox",
6
6
  componentId: "sc-qxboek-0"
7
7
  })(["display:flex;align-items:center;font-size:", ";line-height:", ";padding:2px 6px 2px 8px;border-radius:", ";color:", ";background:", ";box-sizing:border-box;cursor:pointer;gap:6px;svg{opacity:0.2;}&:active{opacity:0.5;}&:hover{color:", ";background:", ";svg{opacity:1;}}"], FontSize.REGULAR, LineHeight.REGULAR, ShapeRadius.CONTROL, ({
8
- open
9
- }) => open ? Color.CLEAR : Color.MAIN, ({
10
- open
11
- }) => open ? Color.MAIN : Color.CLEAR, ({
12
- open
13
- }) => open ? Color.CLEAR : Color.PRIMARY_HOVER, ({
14
- open
15
- }) => open ? Color.MAIN : 'rgba(153, 201, 255, 0.14)');
8
+ $open
9
+ }) => $open ? Color.CLEAR : Color.MAIN, ({
10
+ $open
11
+ }) => $open ? Color.MAIN : Color.CLEAR, ({
12
+ $open
13
+ }) => $open ? Color.CLEAR : Color.PRIMARY_HOVER, ({
14
+ $open
15
+ }) => $open ? Color.MAIN : 'rgba(153, 201, 255, 0.14)');
16
16
  export const TitleBox = styled(H5).withConfig({
17
17
  displayName: "TitleBox",
18
18
  componentId: "sc-qxboek-1"
@@ -35,23 +35,23 @@ export function ExternalImagePreview(props) {
35
35
  }
36
36
  };
37
37
  return _jsxs(RootBox, {
38
- width: width,
39
- height: height,
38
+ "$width": width,
39
+ "$height": height,
40
40
  children: [(!src || isError) && _jsx(PlaceholderWrapper, {
41
- width: width,
42
- height: height,
41
+ "$width": width,
42
+ "$height": height,
43
43
  children: placeholder
44
44
  }), isLoading && _jsx(PlaceholderWrapper, {
45
- width: width,
46
- height: height,
45
+ "$width": width,
46
+ "$height": height,
47
47
  children: _jsx(Spinner, {
48
48
  size: "small",
49
49
  color: Color.CLEAR
50
50
  })
51
51
  }), _jsx(ImgPreview, {
52
- width: width,
53
- height: height,
54
- isHide: !src || isLoading || isError,
52
+ "$width": width,
53
+ "$height": height,
54
+ "$isHide": !src || isLoading || isError,
55
55
  alt: alt,
56
56
  src: src,
57
57
  onError: handleOnError,
@@ -0,0 +1,18 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { render, screen } from '@testing-library/react';
3
+ import { ExternalImagePreview } from '../ExternalImagePreview';
4
+ describe('ExternalImagePreview', () => {
5
+ it('sizes the image by CSS, not by width/height attributes', () => {
6
+ render(_jsx(ExternalImagePreview, {
7
+ src: "https://example.com/a.png",
8
+ width: 120,
9
+ height: 80,
10
+ placeholder: _jsx("i", {})
11
+ }));
12
+ const img = screen.getByRole('img');
13
+ expect(img).not.toHaveAttribute('width');
14
+ expect(img).not.toHaveAttribute('height');
15
+ expect(getComputedStyle(img).width).toBe('120px');
16
+ expect(getComputedStyle(img).height).toBe('80px');
17
+ });
18
+ });
@@ -1,13 +1,13 @@
1
1
  export declare const RootBox: import("styled-components").StyledComponent<"div", any, {
2
- width: string | number;
3
- height: string | number;
2
+ $width: string | number;
3
+ $height: string | number;
4
4
  }, never>;
5
5
  export declare const ImgPreview: import("styled-components").StyledComponent<"img", any, {
6
- width: string | number;
7
- height: string | number;
8
- isHide: boolean;
6
+ $width: string | number;
7
+ $height: string | number;
8
+ $isHide: boolean;
9
9
  }, never>;
10
10
  export declare const PlaceholderWrapper: import("styled-components").StyledComponent<"div", any, {
11
- width: string | number;
12
- height: string | number;
11
+ $width: string | number;
12
+ $height: string | number;
13
13
  }, never>;
@@ -5,25 +5,25 @@ export const RootBox = styled.div.withConfig({
5
5
  displayName: "RootBox",
6
6
  componentId: "sc-irvho3-0"
7
7
  })(["position:relative;width:", ";height:", ";"], ({
8
- width
9
- }) => toCssValue(width), ({
10
- height
11
- }) => toCssValue(height));
8
+ $width
9
+ }) => toCssValue($width), ({
10
+ $height
11
+ }) => toCssValue($height));
12
12
  export const ImgPreview = styled.img.withConfig({
13
13
  displayName: "ImgPreview",
14
14
  componentId: "sc-irvho3-1"
15
15
  })(["width:", ";height:", ";border-radius:", ";opacity:", ";"], ({
16
- width
17
- }) => toCssValue(width), ({
18
- height
19
- }) => toCssValue(height), ShapeRadius.CONTROL, ({
20
- isHide
21
- }) => isHide ? 0 : 1);
16
+ $width
17
+ }) => toCssValue($width), ({
18
+ $height
19
+ }) => toCssValue($height), ShapeRadius.CONTROL, ({
20
+ $isHide
21
+ }) => $isHide ? 0 : 1);
22
22
  export const PlaceholderWrapper = styled.div.withConfig({
23
23
  displayName: "PlaceholderWrapper",
24
24
  componentId: "sc-irvho3-2"
25
25
  })(["width:", ";height:", ";display:flex;align-items:center;justify-content:center;border-radius:", ";position:absolute;top:0;left:0;background:", ";"], ({
26
- width
27
- }) => toCssValue(width), ({
28
- height
29
- }) => toCssValue(height), ShapeRadius.CONTROL, Color.MAIN);
26
+ $width
27
+ }) => toCssValue($width), ({
28
+ $height
29
+ }) => toCssValue($height), ShapeRadius.CONTROL, Color.MAIN);
@@ -240,8 +240,8 @@ export function NativeRichMediaPreview(props) {
240
240
  const shouldDim = !isLoading && dimsScreen(config);
241
241
  return _jsxs(PreviewHost, {
242
242
  ...LIGHT_ISLAND_PROPS,
243
- width: width,
244
- height: height,
243
+ "$width": width,
244
+ "$height": height,
245
245
  "$withBackground": withBackground,
246
246
  children: [_jsxs(ScaleViewport, {
247
247
  "$scale": scale,
@@ -7,8 +7,8 @@ export declare const ButtonRow: import("styled-components").StyledComponent<"div
7
7
  $border?: string;
8
8
  }, never>;
9
9
  export declare const PreviewHost: import("styled-components").StyledComponent<"div", any, {
10
- width: string | number;
11
- height: string | number;
10
+ $width: string | number;
11
+ $height: string | number;
12
12
  $withBackground: boolean;
13
13
  }, never>;
14
14
  export declare const ScaleViewport: import("styled-components").StyledComponent<"div", any, {
@@ -23,10 +23,10 @@ export const PreviewHost = styled.div.withConfig({
23
23
  }) => $withBackground ? `1px solid ${Color.DIVIDER}` : 'none', ShapeRadius.SECTION, ({
24
24
  $withBackground
25
25
  }) => $withBackground ? Color.CLEAR : 'transparent', ({
26
- width
27
- }) => toCssValue(width), ({
28
- height
29
- }) => toCssValue(height), FontFamily.MAIN);
26
+ $width
27
+ }) => toCssValue($width), ({
28
+ $height
29
+ }) => toCssValue($height), FontFamily.MAIN);
30
30
  export const ScaleViewport = styled.div.withConfig({
31
31
  displayName: "ScaleViewport",
32
32
  componentId: "sc-mc9ykd-2"
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,37 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { render, screen } from '@testing-library/react';
3
+ import { PageHeader } from '../components/PageHeader';
4
+ import { PageHeaderSkeleton } from '../components/PageHeaderSkeleton';
5
+ describe('PageHeader', () => {
6
+ it('spaces the more-actions box only when there are actions', () => {
7
+ const {
8
+ rerender
9
+ } = render(_jsx(PageHeader, {
10
+ title: "Page",
11
+ moreActions: _jsx("span", {
12
+ children: "More"
13
+ }),
14
+ onSubmit: jest.fn()
15
+ }));
16
+ expect(getComputedStyle(screen.getByText('More').parentElement).marginRight).toBe('16px');
17
+ rerender(_jsx(PageHeader, {
18
+ title: "Page",
19
+ moreActions: _jsx("span", {
20
+ children: "More"
21
+ })
22
+ }));
23
+ expect(getComputedStyle(screen.getByText('More').parentElement).marginRight).toBe('0px');
24
+ });
25
+ it('sizes the skeleton blocks without width/height attributes', () => {
26
+ const {
27
+ container
28
+ } = render(_jsx(PageHeaderSkeleton, {}));
29
+ const sized = Array.from(container.querySelectorAll('div')).filter(el => getComputedStyle(el).width === '68px');
30
+ expect(sized).toHaveLength(2);
31
+ sized.forEach(el => {
32
+ expect(el).not.toHaveAttribute('width');
33
+ expect(el).not.toHaveAttribute('height');
34
+ expect(getComputedStyle(el).height).toBe('36px');
35
+ });
36
+ });
37
+ });
@@ -68,7 +68,7 @@ export function AutosizeInput(props) {
68
68
  children: [_jsxs(InputBox, {
69
69
  children: [_jsx(InputStyled, {
70
70
  ref: inputRef,
71
- width: width,
71
+ "$width": width,
72
72
  value: value,
73
73
  placeholder: placeholder,
74
74
  onKeyDown: onKeyDown,
@@ -12,8 +12,8 @@ export const InputStyled = styled.input.withConfig({
12
12
  displayName: "InputStyled",
13
13
  componentId: "sc-191i2ot-2"
14
14
  })(["color:", ";width:", "px;max-width:100%;border:0;padding:0;margin:3px 4px 0 0;background:#0000;font-weight:inherit;white-space:nowrap;text-overflow:ellipsis;overflow:hidden;border-bottom:1px dashed ", ";&::placeholder{color:", ";}&:active,&:hover,&:focus{border-bottom:1px dashed ", ";outline-offset:0;outline:0;}&:hover{color:", ";cursor:pointer;}&:active{opacity:0.5;cursor:pointer;}"], Color.PRIMARY, ({
15
- width
16
- }) => width - 10, Color.PHANTOM, Color.PHANTOM, Color.PHANTOM, Color.PRIMARY_HOVER);
15
+ $width
16
+ }) => $width - 10, Color.PHANTOM, Color.PHANTOM, Color.PHANTOM, Color.PRIMARY_HOVER);
17
17
  export const RootBox = styled.div.withConfig({
18
18
  displayName: "RootBox",
19
19
  componentId: "sc-191i2ot-3"
@@ -13,5 +13,5 @@ export interface AutosizeInputProps {
13
13
  }
14
14
  /** Internal style prop carrying the computed input width. */
15
15
  export interface InputStyledProps {
16
- width: number;
16
+ $width: number;
17
17
  }
@@ -50,7 +50,7 @@ export function PageHeader(props) {
50
50
  })]
51
51
  }), hasActionsBox && _jsxs(ActionsBox, {
52
52
  children: [!!moreActions && _jsx(MoreActionsBox, {
53
- hasActions: hasActions,
53
+ "$hasActions": hasActions,
54
54
  children: moreActions
55
55
  }), onCancel && _jsx(Button, {
56
56
  color: "secondary",
@@ -4,6 +4,6 @@ export declare const BackButton: import("styled-components").StyledComponent<"di
4
4
  export declare const TitleBox: import("styled-components").StyledComponent<"div", any, {}, never>;
5
5
  export declare const ActionsBox: import("styled-components").StyledComponent<"div", any, {}, never>;
6
6
  export declare const MoreActionsBox: import("styled-components").StyledComponent<"div", any, {
7
- hasActions: boolean;
7
+ $hasActions: boolean;
8
8
  }, never>;
9
9
  export declare const DescriptionBox: import("styled-components").StyledComponent<typeof Paragraph, any, {}, never>;
@@ -20,8 +20,8 @@ export const MoreActionsBox = styled.div.withConfig({
20
20
  displayName: "MoreActionsBox",
21
21
  componentId: "sc-1qwo99q-4"
22
22
  })(["display:flex;margin-right:", ";"], ({
23
- hasActions
24
- }) => hasActions ? '16px' : '0');
23
+ $hasActions
24
+ }) => $hasActions ? '16px' : '0');
25
25
  export const DescriptionBox = styled(Paragraph).withConfig({
26
26
  displayName: "DescriptionBox",
27
27
  componentId: "sc-1qwo99q-5"
@@ -66,7 +66,7 @@ export function PageHeaderEditable(props) {
66
66
  })]
67
67
  }), hasActionsBox && _jsxs(ActionsBox, {
68
68
  children: [!!moreActions && _jsx(MoreActionsBox, {
69
- hasActions: hasActions,
69
+ "$hasActions": hasActions,
70
70
  children: moreActions
71
71
  }), onCancel && _jsx(Button, {
72
72
  color: "secondary",
@@ -5,6 +5,6 @@ export declare const TitleBox: import("styled-components").StyledComponent<"div"
5
5
  export declare const AutosizeInputBox: import("styled-components").StyledComponent<typeof H2, any, {}, never>;
6
6
  export declare const ActionsBox: import("styled-components").StyledComponent<"div", any, {}, never>;
7
7
  export declare const MoreActionsBox: import("styled-components").StyledComponent<"div", any, {
8
- hasActions: boolean;
8
+ $hasActions: boolean;
9
9
  }, never>;
10
10
  export declare const DescriptionBox: import("styled-components").StyledComponent<typeof Paragraph, any, {}, never>;