@transferwise/components 46.22.1 → 46.24.0

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 (143) hide show
  1. package/build/i18n/es.json +2 -2
  2. package/build/i18n/hu.json +2 -2
  3. package/build/i18n/zh-HK.json +2 -2
  4. package/build/index.esm.js +101 -79
  5. package/build/index.esm.js.map +1 -1
  6. package/build/index.js +103 -82
  7. package/build/index.js.map +1 -1
  8. package/build/types/actionOption/ActionOption.d.ts +3 -3
  9. package/build/types/actionOption/ActionOption.d.ts.map +1 -1
  10. package/build/types/actionOption/index.d.ts +1 -0
  11. package/build/types/actionOption/index.d.ts.map +1 -1
  12. package/build/types/badge/Badge.d.ts +2 -2
  13. package/build/types/badge/Badge.d.ts.map +1 -1
  14. package/build/types/common/dateUtils/getFormatForLocale/getFormatForLocale.d.ts +3 -0
  15. package/build/types/common/dateUtils/getFormatForLocale/getFormatForLocale.d.ts.map +1 -0
  16. package/build/types/common/dateUtils/index.d.ts +7 -6
  17. package/build/types/common/dateUtils/index.d.ts.map +1 -1
  18. package/build/types/dateInput/DateInput.d.ts.map +1 -1
  19. package/build/types/emphasis/Emphasis.d.ts +1 -1
  20. package/build/types/emphasis/Emphasis.d.ts.map +1 -1
  21. package/build/types/emphasis/EmphasisHtmlTransformer.d.ts +1 -1
  22. package/build/types/emphasis/EmphasisHtmlTransformer.d.ts.map +1 -1
  23. package/build/types/emphasis/index.d.ts +1 -0
  24. package/build/types/emphasis/index.d.ts.map +1 -1
  25. package/build/types/i18n/index.d.ts.map +1 -1
  26. package/build/types/index.d.ts +13 -0
  27. package/build/types/index.d.ts.map +1 -1
  28. package/build/types/inputs/SelectInput.d.ts.map +1 -1
  29. package/build/types/loader/Loader.d.ts +3 -3
  30. package/build/types/loader/Loader.d.ts.map +1 -1
  31. package/build/types/loader/index.d.ts +2 -2
  32. package/build/types/loader/index.d.ts.map +1 -1
  33. package/build/types/money/Money.d.ts +8 -11
  34. package/build/types/money/Money.d.ts.map +1 -1
  35. package/build/types/money/index.d.ts +2 -1
  36. package/build/types/money/index.d.ts.map +1 -1
  37. package/build/types/navigationOptionsList/NavigationOptionsList.d.ts +7 -10
  38. package/build/types/navigationOptionsList/NavigationOptionsList.d.ts.map +1 -1
  39. package/build/types/navigationOptionsList/index.d.ts +2 -1
  40. package/build/types/navigationOptionsList/index.d.ts.map +1 -1
  41. package/build/types/progress/Progress.d.ts +1 -1
  42. package/build/types/progress/Progress.d.ts.map +1 -1
  43. package/build/types/progress/index.d.ts +1 -0
  44. package/build/types/progress/index.d.ts.map +1 -1
  45. package/build/types/progressBar/index.d.ts +1 -0
  46. package/build/types/progressBar/index.d.ts.map +1 -1
  47. package/build/types/segmentedControl/SegmentedControl.d.ts.map +1 -1
  48. package/build/types/slidingPanel/SlidingPanel.d.ts.map +1 -1
  49. package/build/types/statusIcon/StatusIcon.d.ts +3 -3
  50. package/build/types/statusIcon/StatusIcon.d.ts.map +1 -1
  51. package/build/types/statusIcon/index.d.ts +2 -1
  52. package/build/types/statusIcon/index.d.ts.map +1 -1
  53. package/build/types/switch/Switch.d.ts +3 -3
  54. package/build/types/switch/Switch.d.ts.map +1 -1
  55. package/build/types/switch/index.d.ts +1 -0
  56. package/build/types/switch/index.d.ts.map +1 -1
  57. package/build/types/switchOption/SwitchOption.d.ts +3 -3
  58. package/build/types/switchOption/SwitchOption.d.ts.map +1 -1
  59. package/build/types/switchOption/index.d.ts +1 -0
  60. package/build/types/switchOption/index.d.ts.map +1 -1
  61. package/build/types/tooltip/Tooltip.d.ts +3 -3
  62. package/build/types/tooltip/Tooltip.d.ts.map +1 -1
  63. package/build/types/tooltip/index.d.ts +2 -2
  64. package/build/types/tooltip/index.d.ts.map +1 -1
  65. package/package.json +3 -4
  66. package/src/actionOption/{ActionOption.spec.js → ActionOption.spec.tsx} +2 -2
  67. package/src/actionOption/ActionOption.tsx +3 -3
  68. package/src/actionOption/index.ts +1 -0
  69. package/src/avatar/{Avatar.spec.js → Avatar.spec.tsx} +6 -13
  70. package/src/badge/{Badge.story.js → Badge.story.tsx} +1 -1
  71. package/src/badge/Badge.tsx +2 -2
  72. package/src/common/dateUtils/getFormatForLocale/getFormatForLocale.ts +2 -0
  73. package/src/common/dateUtils/index.ts +7 -6
  74. package/src/common/dateUtils/isMonthAndYearFormat/isMonthAndYearFormat.ts +1 -1
  75. package/src/dateInput/DateInput.spec.js +29 -9
  76. package/src/dateInput/DateInput.story.tsx +0 -3
  77. package/src/dateInput/DateInput.tsx +90 -48
  78. package/src/emphasis/{Emphasis.spec.js → Emphasis.spec.tsx} +2 -1
  79. package/src/emphasis/Emphasis.tsx +1 -1
  80. package/src/emphasis/{EmphasisHtmlTransformer.spec.js → EmphasisHtmlTransformer.spec.tsx} +0 -12
  81. package/src/emphasis/EmphasisHtmlTransformer.ts +1 -1
  82. package/src/emphasis/index.ts +1 -0
  83. package/src/i18n/es.json +2 -2
  84. package/src/i18n/hu.json +2 -2
  85. package/src/i18n/index.ts +1 -0
  86. package/src/i18n/zh-HK.json +2 -2
  87. package/src/index.ts +13 -0
  88. package/src/inputWithDisplayFormat/InputWithDisplayFormat.story.js +3 -2
  89. package/src/inputs/SelectInput.tsx +5 -3
  90. package/src/loader/Loader.tsx +3 -3
  91. package/src/loader/index.ts +2 -0
  92. package/src/money/{Money.spec.js → Money.spec.tsx} +1 -1
  93. package/src/money/{Money.js → Money.tsx} +6 -7
  94. package/src/money/index.ts +2 -0
  95. package/src/navigationOptionsList/NavigationOptionsList.tsx +20 -0
  96. package/src/navigationOptionsList/index.ts +2 -0
  97. package/src/progress/{Progress.spec.js → Progress.spec.tsx} +4 -3
  98. package/src/progress/Progress.tsx +1 -1
  99. package/src/progress/index.ts +1 -0
  100. package/src/progressBar/index.ts +1 -0
  101. package/src/radio/Radio.story.tsx +3 -4
  102. package/src/segmentedControl/SegmentedControl.tsx +1 -0
  103. package/src/slidingPanel/SlidingPanel.tsx +4 -4
  104. package/src/statusIcon/StatusIcon.spec.tsx +80 -0
  105. package/src/statusIcon/StatusIcon.tsx +3 -4
  106. package/src/statusIcon/index.ts +2 -0
  107. package/src/switch/Switch.story.tsx +4 -1
  108. package/src/switch/Switch.tsx +3 -3
  109. package/src/switch/index.ts +1 -0
  110. package/src/switchOption/{SwitchOption.spec.js → SwitchOption.spec.tsx} +8 -3
  111. package/src/switchOption/SwitchOption.tsx +3 -3
  112. package/src/switchOption/index.ts +1 -0
  113. package/src/tooltip/Tooltip.tsx +2 -2
  114. package/src/tooltip/index.ts +2 -0
  115. package/build/types/common/dateUtils/getDayNames/index.d.ts +0 -2
  116. package/build/types/common/dateUtils/getDayNames/index.d.ts.map +0 -1
  117. package/build/types/common/dateUtils/getMonthNames/index.d.ts +0 -2
  118. package/build/types/common/dateUtils/getMonthNames/index.d.ts.map +0 -1
  119. package/build/types/common/dateUtils/isDateValid/index.d.ts +0 -2
  120. package/build/types/common/dateUtils/isDateValid/index.d.ts.map +0 -1
  121. package/build/types/common/dateUtils/isWithinRange/index.d.ts +0 -2
  122. package/build/types/common/dateUtils/isWithinRange/index.d.ts.map +0 -1
  123. package/build/types/common/dateUtils/moveToWithinRange/index.d.ts +0 -2
  124. package/build/types/common/dateUtils/moveToWithinRange/index.d.ts.map +0 -1
  125. package/src/common/dateUtils/getDayNames/index.ts +0 -1
  126. package/src/common/dateUtils/getMonthNames/index.ts +0 -1
  127. package/src/common/dateUtils/isDateValid/index.ts +0 -1
  128. package/src/common/dateUtils/isWithinRange/index.ts +0 -1
  129. package/src/common/dateUtils/moveToWithinRange/index.ts +0 -1
  130. package/src/loader/index.js +0 -3
  131. package/src/money/index.js +0 -1
  132. package/src/navigationOptionsList/NavigationOptionsList.js +0 -20
  133. package/src/navigationOptionsList/index.js +0 -1
  134. package/src/statusIcon/StatusIcon.spec.js +0 -70
  135. package/src/statusIcon/index.js +0 -1
  136. package/src/tooltip/index.js +0 -3
  137. /package/src/badge/{Badge.spec.js → Badge.spec.tsx} +0 -0
  138. /package/src/loader/{Loader.spec.js → Loader.spec.tsx} +0 -0
  139. /package/src/navigationOptionsList/{NavigationOptionsList.spec.js → NavigationOptionsList.spec.tsx} +0 -0
  140. /package/src/navigationOptionsList/{NavigationOptionsList.story.js → NavigationOptionsList.story.tsx} +0 -0
  141. /package/src/progressBar/{ProgressBar.spec.js → ProgressBar.spec.tsx} +0 -0
  142. /package/src/switch/{Switch.spec.js → Switch.spec.tsx} +0 -0
  143. /package/src/switch/__snapshots__/{Switch.spec.js.snap → Switch.spec.tsx.snap} +0 -0
@@ -0,0 +1,20 @@
1
+ import * as React from 'react';
2
+ import { Children } from 'react';
3
+
4
+ export interface NavigationOptionListProps {
5
+ children: React.ReactNode;
6
+ }
7
+
8
+ const NavigationOptionList = ({ children }: NavigationOptionListProps) => {
9
+ return (
10
+ <ul className="np-navigation-options-list">
11
+ {Children.map(children, (child) => (
12
+ <li key={child?.toString()} className="np-navigation-options-list__item">
13
+ {child}
14
+ </li>
15
+ ))}
16
+ </ul>
17
+ );
18
+ };
19
+
20
+ export default NavigationOptionList;
@@ -0,0 +1,2 @@
1
+ export { default } from './NavigationOptionsList';
2
+ export type { NavigationOptionListProps } from './NavigationOptionsList';
@@ -1,10 +1,11 @@
1
1
  import '@testing-library/jest-dom';
2
- import { render, screen } from '../test-utils';
2
+ import { render } from '../test-utils';
3
3
 
4
- import Progress from './Progress';
4
+ import Progress from '.';
5
5
 
6
6
  describe('Progress', () => {
7
7
  const props = {
8
+ id: 'test-id',
8
9
  progress: { value: 50, max: 100 },
9
10
  };
10
11
  describe('by default', () => {
@@ -15,7 +16,7 @@ describe('Progress', () => {
15
16
  it('renders the progress', () => {
16
17
  const progress = document.querySelector('progress');
17
18
  expect(progress).toBeInTheDocument();
18
- expect(progress).toHaveValue(progress.value);
19
+ expect(progress).toHaveValue(progress?.value);
19
20
  });
20
21
  });
21
22
  });
@@ -1,7 +1,7 @@
1
1
  import classnames from 'classnames';
2
2
  import { ReactElement, useEffect, useState } from 'react';
3
3
 
4
- type ProgressProps = {
4
+ export type ProgressProps = {
5
5
  className?: string;
6
6
  id: string;
7
7
  progress: { value: number; max: number };
@@ -1 +1,2 @@
1
1
  export { default } from './Progress';
2
+ export type { ProgressProps } from './Progress';
@@ -1 +1,2 @@
1
1
  export { default } from './ProgressBar';
2
+ export type { ProgressBarProps } from './ProgressBar';
@@ -44,7 +44,7 @@ export const Basic = () => {
44
44
  <Radio
45
45
  label={label}
46
46
  name="name"
47
- id="id"
47
+ id="id1"
48
48
  checked={checked}
49
49
  disabled={disabled}
50
50
  secondary={secondary}
@@ -61,7 +61,7 @@ export const Basic = () => {
61
61
  <div className={`form-group ${hasError ? 'has-error' : ''}`}>
62
62
  <Checkbox
63
63
  label={label}
64
- id="test"
64
+ id="id2"
65
65
  checked={checked}
66
66
  disabled={disabled}
67
67
  secondary={secondary}
@@ -71,10 +71,9 @@ export const Basic = () => {
71
71
  <div className={`form-group ${hasError ? 'has-error' : ''}`}>
72
72
  <Checkbox
73
73
  label={label}
74
- id="test"
74
+ id="id3"
75
75
  checked={checked}
76
76
  disabled={disabled}
77
- // secondary={secondary}
78
77
  onChange={() => setChecked(!checked)}
79
78
  />
80
79
  </div>
@@ -101,6 +101,7 @@ const SegmentedControl = ({
101
101
  className={classNames('segmented-control__segments', {
102
102
  'segmented-control__segments--no-animate': !animate,
103
103
  })}
104
+ role={mode !== 'input' ? 'tablist' : undefined}
104
105
  >
105
106
  {segmentsWithRefs.map((segment) =>
106
107
  mode === 'input' ? (
@@ -1,6 +1,5 @@
1
1
  import classNames from 'classnames';
2
- import { forwardRef, useRef } from 'react';
3
- import mergeRefs from 'react-merge-refs';
2
+ import { forwardRef, useImperativeHandle, useRef } from 'react';
4
3
  import { CSSTransition } from 'react-transition-group';
5
4
 
6
5
  import { Position } from '../common';
@@ -28,7 +27,8 @@ const SlidingPanel = forwardRef(
28
27
  }: Omit<SlidingPanelProps, 'ref'>,
29
28
  reference: React.ForwardedRef<HTMLDivElement>,
30
29
  ) => {
31
- const localReference = useRef<HTMLDivElement>(null);
30
+ const localReference = useRef<HTMLDivElement>(null as never);
31
+ useImperativeHandle(reference, () => localReference.current, []);
32
32
 
33
33
  return (
34
34
  <CSSTransition
@@ -43,7 +43,7 @@ const SlidingPanel = forwardRef(
43
43
  unmountOnExit
44
44
  >
45
45
  <div
46
- ref={mergeRefs([reference, localReference])}
46
+ ref={localReference}
47
47
  className={classNames(
48
48
  'sliding-panel',
49
49
  `sliding-panel--open-${position}`,
@@ -0,0 +1,80 @@
1
+ import { Sentiment, Size, SizeLarge, SizeMedium, SizeSmall } from '../common';
2
+ import { render, cleanup, screen } from '../test-utils';
3
+
4
+ import StatusIcon from '.';
5
+
6
+ describe('StatusIcon', () => {
7
+ const renderStatusIcon = (props?: {
8
+ sentiment?: Sentiment;
9
+ size?: SizeLarge | SizeMedium | SizeSmall;
10
+ }) => {
11
+ return render(
12
+ <StatusIcon
13
+ sentiment={props?.sentiment || Sentiment.NEUTRAL}
14
+ size={props?.size || Size.MEDIUM}
15
+ />,
16
+ );
17
+ };
18
+
19
+ afterEach(cleanup);
20
+
21
+ it('renders the status icon without any props', () => {
22
+ renderStatusIcon();
23
+
24
+ expect(screen.getByTestId('status-icon')).toHaveClass('neutral');
25
+ expect(screen.getByTestId('status-icon')).toHaveClass('status-circle');
26
+ expect(screen.getByTestId('status-icon')).toHaveClass('status-circle-md');
27
+ });
28
+
29
+ it.each([
30
+ [Size.SMALL as const, 'status-circle-sm'],
31
+ [Size.MEDIUM as const, 'status-circle-md'],
32
+ [Size.LARGE as const, 'status-circle-lg'],
33
+ ])(
34
+ "if prop 'size' equals '%s' is passed, renders the status icon with class '%s'",
35
+ (size, expectedClass) => {
36
+ renderStatusIcon({ size: size });
37
+
38
+ expect(screen.getByTestId('status-icon')).toHaveClass(expectedClass);
39
+ cleanup();
40
+ },
41
+ );
42
+
43
+ it.each([
44
+ [Sentiment.NEGATIVE, Sentiment.NEGATIVE],
45
+ [Sentiment.NEUTRAL, Sentiment.NEUTRAL],
46
+ [Sentiment.PENDING, Sentiment.PENDING],
47
+ [Sentiment.POSITIVE, Sentiment.POSITIVE],
48
+ [Sentiment.WARNING, Sentiment.WARNING],
49
+ ])(
50
+ "if prop 'sentiment' equals '%s' is passed, renders the status icon with class '%s'",
51
+ (sentiment, expectedClass) => {
52
+ renderStatusIcon({ sentiment: sentiment });
53
+
54
+ expect(screen.getByTestId('status-icon')).toHaveClass(expectedClass);
55
+ cleanup();
56
+ },
57
+ );
58
+
59
+ it("'warning' and 'pending' sentiments generate 'dark' colored icons", () => {
60
+ renderStatusIcon({ sentiment: Sentiment.WARNING });
61
+ expect(screen.getByTestId('alert-icon')).toHaveClass('dark');
62
+ cleanup();
63
+
64
+ renderStatusIcon({ sentiment: Sentiment.PENDING });
65
+ expect(screen.getByTestId('clock-borderless-icon')).toHaveClass('dark');
66
+ });
67
+
68
+ it("'positive', 'negative', and 'neutral' sentiments generate 'light' colored icons", () => {
69
+ renderStatusIcon({ sentiment: Sentiment.POSITIVE });
70
+ expect(screen.getByTestId('check-icon')).toHaveClass('light');
71
+ cleanup();
72
+
73
+ renderStatusIcon({ sentiment: Sentiment.NEGATIVE });
74
+ expect(screen.getByTestId('cross-icon')).toHaveClass('light');
75
+ cleanup();
76
+
77
+ renderStatusIcon();
78
+ expect(screen.getByTestId('info-icon')).toHaveClass('light');
79
+ });
80
+ });
@@ -1,15 +1,14 @@
1
1
  import { Info, Alert, Cross, Check, ClockBorderless } from '@transferwise/icons';
2
2
  import classNames from 'classnames';
3
- import { ReactElement } from 'react';
4
3
 
5
- import { SizeSmall, SizeMedium, SizeLarge, Sentiment } from '../common';
4
+ import { SizeSmall, SizeMedium, SizeLarge, Sentiment, Size } from '../common';
6
5
 
7
- type Props = {
6
+ export type StatusIconProps = {
8
7
  sentiment: Sentiment;
9
8
  size: SizeSmall | SizeMedium | SizeLarge;
10
9
  };
11
10
 
12
- const StatusIcon = ({ sentiment = Sentiment.NEUTRAL, size }: Props): ReactElement => {
11
+ const StatusIcon = ({ sentiment = Sentiment.NEUTRAL, size = Size.MEDIUM }: StatusIconProps) => {
13
12
  const iconTypeMap = {
14
13
  [Sentiment.POSITIVE]: Check,
15
14
  [Sentiment.NEUTRAL]: Info,
@@ -0,0 +1,2 @@
1
+ export { default } from './StatusIcon';
2
+ export type { StatusIconProps } from './StatusIcon';
@@ -39,6 +39,9 @@ export const Disabled = () => {
39
39
 
40
40
  return (
41
41
  <div className="d-flex flex-column">
42
+ <label id="labelID" htmlFor="switchId">
43
+ A switch with a label
44
+ </label>
42
45
  <Switch
43
46
  checked={checked}
44
47
  disabled
@@ -53,7 +56,7 @@ export const Disabled = () => {
53
56
  disabled
54
57
  className="a-class-name"
55
58
  aria-labelledby="labelID"
56
- id="switchId"
59
+ id="switchId1"
57
60
  onClick={() => setCheck(!checked)}
58
61
  />
59
62
  </div>
@@ -1,12 +1,12 @@
1
1
  import { CheckCircleFill, CrossCircleFill } from '@transferwise/icons';
2
2
  import { useTheme } from '@wise/components-theming';
3
3
  import classnames from 'classnames';
4
- import { KeyboardEventHandler, MouseEvent, ReactElement } from 'react';
4
+ import { KeyboardEventHandler, MouseEvent } from 'react';
5
5
 
6
6
  import { CommonProps } from '../common';
7
7
  import { logActionRequiredIf } from '../utilities';
8
8
 
9
- type Props = CommonProps & {
9
+ export type SwitchProps = CommonProps & {
10
10
  /** Used to describe the purpose of the switch. To be used if there is no external label (i.e. aria-labelledby is null) */
11
11
  'aria-label'?: string;
12
12
  /** A reference to a label that describes the purpose of the switch. Ignored if aria-label is provided */
@@ -20,7 +20,7 @@ type Props = CommonProps & {
20
20
  onClick: (event?: MouseEvent<HTMLSpanElement>) => void;
21
21
  };
22
22
 
23
- const Switch = (props: Props): ReactElement => {
23
+ const Switch = (props: SwitchProps) => {
24
24
  const { isModern } = useTheme();
25
25
  const { checked, className, id, onClick, disabled } = props;
26
26
 
@@ -1 +1,2 @@
1
1
  export { default } from './Switch';
2
+ export type { SwitchProps } from './Switch';
@@ -5,6 +5,8 @@ import SwitchOption from '.';
5
5
 
6
6
  describe('SwitchOption', () => {
7
7
  it('renders the option with the provided content', () => {
8
+ const mockOnChange = jest.fn();
9
+
8
10
  render(
9
11
  <SwitchOption
10
12
  media={<FastFlag data-testid="fast-flag" />}
@@ -13,7 +15,7 @@ describe('SwitchOption', () => {
13
15
  aria-label="title"
14
16
  content="content"
15
17
  checked={false}
16
- onChange={() => {}}
18
+ onChange={mockOnChange}
17
19
  />,
18
20
  );
19
21
 
@@ -97,11 +99,11 @@ describe('SwitchOption', () => {
97
99
 
98
100
  expect(mockOnChange).toHaveBeenCalledTimes(0);
99
101
 
100
- fireEvent.click(screen.queryByText('title'));
102
+ fireEvent.click(screen.getByText('title'));
101
103
 
102
104
  expect(mockOnChange).toHaveBeenCalledTimes(1);
103
105
 
104
- fireEvent.click(screen.queryByText('content'));
106
+ fireEvent.click(screen.getByText('content'));
105
107
 
106
108
  expect(mockOnChange).toHaveBeenCalledTimes(2);
107
109
 
@@ -111,6 +113,8 @@ describe('SwitchOption', () => {
111
113
  });
112
114
 
113
115
  it('renders aligned with container content', () => {
116
+ const mockOnChange = jest.fn();
117
+
114
118
  render(
115
119
  <SwitchOption
116
120
  id="id"
@@ -118,6 +122,7 @@ describe('SwitchOption', () => {
118
122
  aria-label="title"
119
123
  content="content"
120
124
  isContainerAligned
125
+ onChange={mockOnChange}
121
126
  />,
122
127
  );
123
128
  expect(document.querySelector('.np-option__container-aligned')).toBeInTheDocument();
@@ -1,9 +1,9 @@
1
- import { MouseEvent, ReactChild, ReactElement } from 'react';
1
+ import { MouseEvent, ReactChild } from 'react';
2
2
 
3
3
  import Option from '../common/Option';
4
4
  import Switch from '../switch';
5
5
 
6
- type Props = {
6
+ export type SwitchOptionProps = {
7
7
  checked?: boolean;
8
8
  complex?: boolean;
9
9
  content?: ReactChild;
@@ -41,7 +41,7 @@ const SwitchOption = ({
41
41
  showMediaAtAllSizes,
42
42
  isContainerAligned,
43
43
  'aria-label': ariaLabel,
44
- }: Props): ReactElement => {
44
+ }: SwitchOptionProps) => {
45
45
  const sharedProps = {
46
46
  media,
47
47
  title,
@@ -1 +1,2 @@
1
1
  export { default } from './SwitchOption';
2
+ export type { SwitchOptionProps } from './SwitchOption';
@@ -20,7 +20,7 @@ import {
20
20
  PositionTop,
21
21
  } from '../common/propsValues/position';
22
22
 
23
- type Props = PropsWithChildren<{
23
+ export type TooltipProps = PropsWithChildren<{
24
24
  position?: PositionTop | PositionRight | PositionBottom | PositionLeft;
25
25
  label: ReactNode;
26
26
  id?: string;
@@ -33,7 +33,7 @@ const Tooltip = ({
33
33
  label,
34
34
  id,
35
35
  className,
36
- }: Props): ReactElement => {
36
+ }: TooltipProps) => {
37
37
  const [open, setOpen] = useState(false);
38
38
  const anchorReference = useRef(null);
39
39
  const [arrowElement, setArrowElement] = useState(null);
@@ -0,0 +1,2 @@
1
+ export { default } from './Tooltip';
2
+ export type { TooltipProps } from './Tooltip';
@@ -1,2 +0,0 @@
1
- export { getDayNames } from './getDayNames';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/common/dateUtils/getDayNames/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC"}
@@ -1,2 +0,0 @@
1
- export { getMonthNames } from './getMonthNames';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/common/dateUtils/getMonthNames/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC"}
@@ -1,2 +0,0 @@
1
- export { isDateValid, validDateString } from './isDateValid';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/common/dateUtils/isDateValid/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC"}
@@ -1,2 +0,0 @@
1
- export { isWithinRange } from './isWithinRange';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/common/dateUtils/isWithinRange/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC"}
@@ -1,2 +0,0 @@
1
- export { moveToWithinRange } from './moveToWithinRange';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/common/dateUtils/moveToWithinRange/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC"}
@@ -1 +0,0 @@
1
- export { getDayNames } from './getDayNames';
@@ -1 +0,0 @@
1
- export { getMonthNames } from './getMonthNames';
@@ -1 +0,0 @@
1
- export { isDateValid, validDateString } from './isDateValid';
@@ -1 +0,0 @@
1
- export { isWithinRange } from './isWithinRange';
@@ -1 +0,0 @@
1
- export { moveToWithinRange } from './moveToWithinRange';
@@ -1,3 +0,0 @@
1
- import Loader from './Loader';
2
-
3
- export default Loader;
@@ -1 +0,0 @@
1
- export { default } from './Money';
@@ -1,20 +0,0 @@
1
- import PropTypes from 'prop-types';
2
- import { Children } from 'react';
3
-
4
- const NavigationOptionList = ({ children }) => {
5
- return (
6
- <ul className="np-navigation-options-list">
7
- {Children.map(children, (child) => (
8
- <li key={child.key} className="np-navigation-options-list__item">
9
- {child}
10
- </li>
11
- ))}
12
- </ul>
13
- );
14
- };
15
-
16
- NavigationOptionList.propTypes = {
17
- children: PropTypes.node.isRequired,
18
- };
19
-
20
- export default NavigationOptionList;
@@ -1 +0,0 @@
1
- export { default } from './NavigationOptionsList';
@@ -1,70 +0,0 @@
1
- import { Sentiment } from '../common';
2
- import { render, cleanup, screen } from '../test-utils';
3
-
4
- import StatusIcon from '.';
5
-
6
- describe('StatusIcon', () => {
7
- const renderStatusIcon = (props = {}) => {
8
- return render(<StatusIcon {...props} />);
9
- };
10
-
11
- afterEach(cleanup);
12
-
13
- it('renders the status icon without any props', () => {
14
- renderStatusIcon();
15
-
16
- expect(screen.getByTestId('status-icon')).toHaveClass('neutral');
17
- expect(screen.getByTestId('status-icon')).toHaveClass('status-circle');
18
- });
19
-
20
- it('renders the status icon small if prop is passed in', () => {
21
- renderStatusIcon({ size: 'sm' });
22
-
23
- expect(screen.getByTestId('status-icon')).toHaveClass('status-circle-sm');
24
- });
25
-
26
- it('renders the status icon medium if prop is passed in', () => {
27
- renderStatusIcon({ size: 'md' });
28
-
29
- expect(screen.getByTestId('status-icon')).toHaveClass('status-circle-md');
30
- });
31
-
32
- it('renders the status icon big if prop is passed in', () => {
33
- renderStatusIcon({ size: 'lg' });
34
-
35
- expect(screen.getByTestId('status-icon')).toHaveClass('status-circle-lg');
36
- });
37
-
38
- it('renders the status icon with different icons based on sentiment passed in', () => {
39
- [
40
- Sentiment.NEGATIVE,
41
- Sentiment.NEUTRAL,
42
- Sentiment.PENDING,
43
- Sentiment.POSITIVE,
44
- Sentiment.WARNING,
45
- ].forEach((sentiment) => {
46
- renderStatusIcon({ sentiment: sentiment });
47
- expect(screen.getByTestId('status-icon')).toHaveClass(sentiment.toString());
48
- cleanup();
49
- });
50
- });
51
-
52
- it('warning and pending sentiments get dark colored icons', () => {
53
- renderStatusIcon({ sentiment: Sentiment.WARNING });
54
- expect(screen.getByTestId('alert-icon')).toHaveClass('dark');
55
- cleanup();
56
- renderStatusIcon({ sentiment: Sentiment.PENDING });
57
- expect(screen.getByTestId('clock-borderless-icon')).toHaveClass('dark');
58
- });
59
-
60
- it('positive, negative, and neutral sentiments get light colored icons', () => {
61
- renderStatusIcon({ sentiment: Sentiment.POSITIVE });
62
- expect(screen.getByTestId('check-icon')).toHaveClass('light');
63
- cleanup();
64
- renderStatusIcon({ sentiment: Sentiment.NEGATIVE });
65
- expect(screen.getByTestId('cross-icon')).toHaveClass('light');
66
- cleanup();
67
- renderStatusIcon({ sentiment: Sentiment.NEUTRAL });
68
- expect(screen.getByTestId('info-icon')).toHaveClass('light');
69
- });
70
- });
@@ -1 +0,0 @@
1
- export { default } from './StatusIcon';
@@ -1,3 +0,0 @@
1
- import Tooltip from './Tooltip';
2
-
3
- export default Tooltip;
File without changes
File without changes
File without changes