@transferwise/components 46.36.1 → 46.37.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 (104) hide show
  1. package/build/index.js +10 -31
  2. package/build/index.js.map +1 -1
  3. package/build/index.mjs +10 -31
  4. package/build/index.mjs.map +1 -1
  5. package/build/types/accordion/AccordionItem/AccordionItem.d.ts.map +1 -1
  6. package/build/types/actionOption/ActionOption.d.ts +5 -5
  7. package/build/types/actionOption/ActionOption.d.ts.map +1 -1
  8. package/build/types/alert/Alert.d.ts +1 -1
  9. package/build/types/alert/Alert.d.ts.map +1 -1
  10. package/build/types/body/Body.d.ts +1 -1
  11. package/build/types/body/Body.d.ts.map +1 -1
  12. package/build/types/chips/Chip.d.ts +2 -2
  13. package/build/types/chips/Chip.d.ts.map +1 -1
  14. package/build/types/chips/Chips.d.ts +2 -2
  15. package/build/types/chips/Chips.d.ts.map +1 -1
  16. package/build/types/common/bottomSheet/BottomSheet.d.ts +2 -2
  17. package/build/types/common/bottomSheet/BottomSheet.d.ts.map +1 -1
  18. package/build/types/common/closeButton/CloseButton.d.ts +1 -1
  19. package/build/types/common/closeButton/CloseButton.d.ts.map +1 -1
  20. package/build/types/common/flowHeader/FlowHeader.d.ts +1 -1
  21. package/build/types/common/flowHeader/FlowHeader.d.ts.map +1 -1
  22. package/build/types/common/hooks/useResizeObserver.d.ts +1 -1
  23. package/build/types/common/hooks/useResizeObserver.d.ts.map +1 -1
  24. package/build/types/common/panel/Panel.d.ts +3 -3
  25. package/build/types/common/panel/Panel.d.ts.map +1 -1
  26. package/build/types/common/polymorphicWithOverrides/PolymorphicWithOverrides.d.ts +1 -1
  27. package/build/types/common/polymorphicWithOverrides/PolymorphicWithOverrides.d.ts.map +1 -1
  28. package/build/types/common/responsivePanel/ResponsivePanel.d.ts +1 -1
  29. package/build/types/dimmer/Dimmer.d.ts +3 -3
  30. package/build/types/dimmer/Dimmer.d.ts.map +1 -1
  31. package/build/types/emphasis/Emphasis.d.ts +2 -2
  32. package/build/types/emphasis/Emphasis.d.ts.map +1 -1
  33. package/build/types/inputs/Input.d.ts +1 -1
  34. package/build/types/inputs/Input.d.ts.map +1 -1
  35. package/build/types/inputs/SearchInput.d.ts +1 -1
  36. package/build/types/inputs/SearchInput.d.ts.map +1 -1
  37. package/build/types/inputs/TextArea.d.ts +1 -1
  38. package/build/types/inputs/TextArea.d.ts.map +1 -1
  39. package/build/types/inputs/_BottomSheet.d.ts +1 -1
  40. package/build/types/inputs/_BottomSheet.d.ts.map +1 -1
  41. package/build/types/inputs/_ButtonInput.d.ts +1 -1
  42. package/build/types/inputs/_ButtonInput.d.ts.map +1 -1
  43. package/build/types/progress/Progress.d.ts +2 -2
  44. package/build/types/progress/Progress.d.ts.map +1 -1
  45. package/build/types/progressBar/ProgressBar.d.ts +2 -2
  46. package/build/types/progressBar/ProgressBar.d.ts.map +1 -1
  47. package/build/types/promoCard/PromoCard.d.ts +1 -1
  48. package/build/types/promoCard/PromoCard.d.ts.map +1 -1
  49. package/build/types/provider/direction/DirectionProvider.d.ts +2 -2
  50. package/build/types/provider/direction/DirectionProvider.d.ts.map +1 -1
  51. package/build/types/provider/language/LanguageProvider.d.ts +2 -2
  52. package/build/types/provider/language/LanguageProvider.d.ts.map +1 -1
  53. package/build/types/select/option/Option.d.ts +2 -1
  54. package/build/types/select/option/Option.d.ts.map +1 -1
  55. package/build/types/slidingPanel/SlidingPanel.d.ts +1 -1
  56. package/build/types/slidingPanel/SlidingPanel.d.ts.map +1 -1
  57. package/build/types/switchOption/SwitchOption.d.ts +4 -4
  58. package/build/types/switchOption/SwitchOption.d.ts.map +1 -1
  59. package/build/types/tabs/Tabs.d.ts +1 -1
  60. package/build/types/tabs/Tabs.d.ts.map +1 -1
  61. package/build/types/tooltip/Tooltip.d.ts.map +1 -1
  62. package/build/types/uploadInput/UploadInput.d.ts +2 -2
  63. package/build/types/uploadInput/UploadInput.d.ts.map +1 -1
  64. package/build/types/uploadInput/uploadItem/UploadItem.d.ts.map +1 -1
  65. package/build/types/withDisplayFormat/WithDisplayFormat.d.ts +4 -4
  66. package/build/types/withDisplayFormat/WithDisplayFormat.d.ts.map +1 -1
  67. package/package.json +3 -3
  68. package/src/accordion/AccordionItem/AccordionItem.tsx +5 -2
  69. package/src/actionOption/ActionOption.tsx +4 -5
  70. package/src/alert/Alert.tsx +1 -1
  71. package/src/body/Body.tsx +4 -3
  72. package/src/chips/Chip.tsx +5 -6
  73. package/src/chips/Chips.tsx +1 -2
  74. package/src/common/bottomSheet/BottomSheet.tsx +2 -9
  75. package/src/common/closeButton/CloseButton.tsx +1 -1
  76. package/src/common/flowHeader/FlowHeader.tsx +1 -1
  77. package/src/common/hooks/useResizeObserver.ts +1 -1
  78. package/src/common/panel/Panel.spec.tsx +1 -1
  79. package/src/common/panel/Panel.tsx +7 -7
  80. package/src/common/polymorphicWithOverrides/PolymorphicWithOverrides.tsx +1 -1
  81. package/src/dimmer/Dimmer.tsx +2 -10
  82. package/src/emphasis/Emphasis.tsx +1 -3
  83. package/src/inputs/Input.tsx +1 -1
  84. package/src/inputs/SearchInput.tsx +1 -1
  85. package/src/inputs/SelectInput.tsx +4 -4
  86. package/src/inputs/TextArea.tsx +1 -1
  87. package/src/inputs/_BottomSheet.tsx +1 -1
  88. package/src/inputs/_ButtonInput.tsx +1 -1
  89. package/src/progress/Progress.tsx +3 -15
  90. package/src/progressBar/ProgressBar.tsx +1 -2
  91. package/src/promoCard/PromoCard.tsx +2 -2
  92. package/src/promoCard/PromoCardContext.spec.tsx +1 -1
  93. package/src/provider/direction/DirectionProvider.tsx +2 -5
  94. package/src/provider/language/LanguageProvider.tsx +2 -2
  95. package/src/segmentedControl/SegmentedControl.tsx +2 -2
  96. package/src/select/option/Option.tsx +6 -18
  97. package/src/slidingPanel/SlidingPanel.tsx +1 -1
  98. package/src/ssr.spec.js +6 -0
  99. package/src/switchOption/SwitchOption.tsx +5 -7
  100. package/src/tabs/Tabs.js +3 -3
  101. package/src/tooltip/Tooltip.tsx +2 -1
  102. package/src/uploadInput/UploadInput.tsx +2 -2
  103. package/src/uploadInput/uploadItem/UploadItem.tsx +3 -4
  104. package/src/withDisplayFormat/WithDisplayFormat.tsx +3 -3
@@ -1 +1 @@
1
- {"version":3,"file":"UploadItem.d.ts","sourceRoot":"","sources":["../../../../src/uploadInput/uploadItem/UploadItem.tsx"],"names":[],"mappings":";AAUA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAKxC,MAAM,MAAM,eAAe,GAAG,GAAG,CAAC,mBAAmB,GAAG;IACtD,IAAI,EAAE,YAAY,CAAC;IACnB;;OAEG;IACH,gBAAgB,EAAE,OAAO,CAAC;IAC1B,SAAS,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,MAAM,IAAI,CAAC;IAErB;;;;;OAKG;IACH,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,YAAY,KAAK,IAAI,CAAC;CAC3C,CAAC;AAEF,oBAAY,QAAQ;IAClB,UAAU,eAAe;IACzB,SAAS,cAAc;CACxB;AAED,QAAA,MAAM,UAAU,iEAMb,eAAe,gCAmHjB,CAAC;AAEF,eAAe,UAAU,CAAC"}
1
+ {"version":3,"file":"UploadItem.d.ts","sourceRoot":"","sources":["../../../../src/uploadInput/uploadItem/UploadItem.tsx"],"names":[],"mappings":";AASA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAKxC,MAAM,MAAM,eAAe,GAAG,GAAG,CAAC,mBAAmB,GAAG;IACtD,IAAI,EAAE,YAAY,CAAC;IACnB;;OAEG;IACH,gBAAgB,EAAE,OAAO,CAAC;IAC1B,SAAS,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,MAAM,IAAI,CAAC;IAErB;;;;;OAKG;IACH,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,YAAY,KAAK,IAAI,CAAC;CAC3C,CAAC;AAEF,oBAAY,QAAQ;IAClB,UAAU,eAAe;IACzB,SAAS,cAAc;CACxB;AAED,QAAA,MAAM,UAAU,iEAMb,eAAe,gCAmHjB,CAAC;AAEF,eAAe,UAAU,CAAC"}
@@ -1,4 +1,4 @@
1
- import { Component } from 'react';
1
+ import * as React from 'react';
2
2
  import { HistoryNavigator } from '../common';
3
3
  import { InputProps } from '../inputs/Input';
4
4
  import { TextAreaProps } from '../inputs/TextArea';
@@ -27,9 +27,9 @@ export interface WithDisplayFormatProps<T extends TextElementProps = TextElement
27
27
  onChange?: (value: string) => void;
28
28
  onBlur?: (value: string) => void;
29
29
  onFocus?: (value: string) => void;
30
- render: (renderProps: T) => JSX.Element;
30
+ render: (renderProps: T) => React.JSX.Element;
31
31
  }
32
- declare class WithDisplayFormat<T extends TextElementProps> extends Component<WithDisplayFormatProps<T>, WithDisplayFormatState> {
32
+ declare class WithDisplayFormat<T extends TextElementProps> extends React.Component<WithDisplayFormatProps<T>, WithDisplayFormatState> {
33
33
  props: WithDisplayFormatProps<T> & Required<Pick<WithDisplayFormatProps<T>, keyof typeof WithDisplayFormat.defaultProps>>;
34
34
  static defaultProps: {
35
35
  autoComplete: string;
@@ -56,7 +56,7 @@ declare class WithDisplayFormat<T extends TextElementProps> extends Component<Wi
56
56
  handleOnFocus: React.FocusEventHandler<HTMLTextElement>;
57
57
  handleDelete: (unformattedValue: string, action: EventType) => string;
58
58
  handleCursorPositioning: (action: string) => void;
59
- render(): JSX.Element;
59
+ render(): React.JSX.Element;
60
60
  }
61
61
  export default WithDisplayFormat;
62
62
  //# sourceMappingURL=WithDisplayFormat.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"WithDisplayFormat.d.ts","sourceRoot":"","sources":["../../../src/withDisplayFormat/WithDisplayFormat.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAS7C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,aA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;IAEF,YAAY,qBAAsB,MAAM,UAAU,SAAS,YAuBzD;IAEF,uBAAuB,WAAY,MAAM,UAiBvC;IAEF,MAAM;CAqCP;AAED,eAAe,iBAAiB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@transferwise/components",
3
- "version": "46.36.1",
3
+ "version": "46.37.0",
4
4
  "description": "Neptune React components",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -94,9 +94,9 @@
94
94
  "react-intl": "^6.6.6",
95
95
  "rollup": "^4.17.2",
96
96
  "storybook": "^7.6.19",
97
- "@transferwise/neptune-css": "14.10.0",
97
+ "@transferwise/less-config": "3.1.0",
98
98
  "@wise/components-theming": "1.3.0",
99
- "@transferwise/less-config": "3.1.0"
99
+ "@transferwise/neptune-css": "14.10.0"
100
100
  },
101
101
  "peerDependencies": {
102
102
  "@transferwise/icons": "^3.7.0",
@@ -1,5 +1,6 @@
1
+ import { IdIconProps } from '@transferwise/icons';
1
2
  import classNames from 'classnames';
2
- import { cloneElement, FC, useId, ReactNode } from 'react';
3
+ import { FC, ReactNode, cloneElement, useId } from 'react';
3
4
 
4
5
  import Body from '../../body';
5
6
  import Chevron from '../../chevron';
@@ -73,7 +74,9 @@ const AccordionItem: FC<AccordionItemProps> = ({
73
74
  icon,
74
75
  theme = 'light',
75
76
  }) => {
76
- const iconElement = icon ? cloneElement(icon as React.ReactElement, { size: 24 }) : null;
77
+ const iconElement = icon
78
+ ? cloneElement(icon as React.ReactElement<IdIconProps>, { size: 24 })
79
+ : null;
77
80
  const fallbackId = useId();
78
81
  const accordionId = id ?? fallbackId;
79
82
 
@@ -1,5 +1,4 @@
1
1
  import classNames from 'classnames';
2
- import { ReactChild } from 'react';
3
2
 
4
3
  import ActionButton from '../actionButton';
5
4
  import { CommonProps, Priority, PriorityPrimary, PrioritySecondary } from '../common';
@@ -7,13 +6,13 @@ import Option from '../common/Option';
7
6
 
8
7
  export type ActionOptionProps = {
9
8
  complex?: boolean;
10
- content?: ReactChild;
9
+ content?: React.ReactNode;
11
10
  disabled?: boolean;
12
- media?: ReactChild;
11
+ media?: React.ReactNode;
13
12
  showMediaAtAllSizes?: boolean;
14
13
  onClick: () => void;
15
- title: ReactChild;
16
- action: ReactChild;
14
+ title: React.ReactNode;
15
+ action: React.ReactNode;
17
16
  priority?: PriorityPrimary | PrioritySecondary;
18
17
  showMediaCircle?: boolean;
19
18
  isContainerAligned?: boolean;
@@ -42,7 +42,7 @@ export interface AlertProps {
42
42
  action?: AlertAction;
43
43
  className?: string;
44
44
  /** An optional icon. If not provided, we will default the icon to something appropriate for the type */
45
- icon?: React.ReactElement;
45
+ icon?: React.ReactNode;
46
46
  /** Title for the alert component */
47
47
  title?: string;
48
48
  /** The main body of the alert. Accepts plain text and bold words specified with **double stars */
package/src/body/Body.tsx CHANGED
@@ -26,9 +26,10 @@ type Props = HTMLAttributes<HTMLSpanElement | HTMLParagraphElement> & {
26
26
  const Body = forwardRef(function Body(
27
27
  { as: Element = 'div', type = DEFAULT_TYPE, className, ...props }: Props,
28
28
  reference: React.ForwardedRef<
29
- {
30
- [key in typeof Element]: React.ElementRef<key>;
31
- }[typeof Element]
29
+ | {
30
+ [key in typeof Element]: React.ElementRef<key>;
31
+ }[typeof Element]
32
+ | null
32
33
  >,
33
34
  ) {
34
35
  const isTypeSupported = bodyTypes.has(type);
@@ -1,10 +1,9 @@
1
1
  import { useTheme } from '@wise/components-theming';
2
2
  import classNames from 'classnames';
3
- import { ReactElement, useEffect, useRef } from 'react';
3
+ import { useEffect, useRef } from 'react';
4
4
 
5
5
  import Body from '../body/Body';
6
- import { AriaLabelProperty, CommonProps } from '../common';
7
- import { Typography } from '../common';
6
+ import { AriaLabelProperty, CommonProps, Typography } from '../common';
8
7
  import { CloseButton } from '../common/closeButton/CloseButton';
9
8
 
10
9
  export type ChipValue = string | number;
@@ -32,7 +31,7 @@ const Chip = ({
32
31
  'aria-checked': ariaChecked,
33
32
  role,
34
33
  closeButton,
35
- }: Props): ReactElement => {
34
+ }: Props) => {
36
35
  const isActionable = onClick || onKeyPress;
37
36
  const defaultRole = isActionable ? 'button' : undefined;
38
37
  const tabIndex = isActionable ? 0 : -1;
@@ -40,7 +39,7 @@ const Chip = ({
40
39
  const { isModern } = useTheme();
41
40
 
42
41
  const closeButtonReference = useRef<HTMLButtonElement>(null);
43
- const previousCloseButtonShown = useRef<boolean>();
42
+ const previousCloseButtonShown = useRef<boolean | undefined>(undefined);
44
43
  useEffect(() => {
45
44
  if (closeButtonReference.current != null && previousCloseButtonShown.current === false) {
46
45
  closeButtonReference.current?.focus();
@@ -78,7 +77,7 @@ const Chip = ({
78
77
  <CloseButton
79
78
  ref={closeButtonReference}
80
79
  className={isModern ? `btn-unstyled` : `btn-unstyled m-l-1`}
81
- aria-label={closeButton && closeButton['aria-label']}
80
+ aria-label={closeButton?.['aria-label']}
82
81
  size="sm"
83
82
  filled={isModern}
84
83
  onClick={onRemove}
@@ -1,5 +1,4 @@
1
1
  import classNames from 'classnames';
2
- import { ReactElement } from 'react';
3
2
  import { useIntl } from 'react-intl';
4
3
 
5
4
  import { CommonProps, AriaLabelProperty } from '../common';
@@ -39,7 +38,7 @@ const Chips = ({
39
38
  'aria-label': ariaLabel,
40
39
  className,
41
40
  multiple,
42
- }: ChipsProps): ReactElement => {
41
+ }: ChipsProps) => {
43
42
  const intl = useIntl();
44
43
 
45
44
  const isSelected = (value: ChipValue) =>
@@ -1,12 +1,5 @@
1
1
  import classNames from 'classnames';
2
- import {
3
- useRef,
4
- useState,
5
- ReactElement,
6
- PropsWithChildren,
7
- CSSProperties,
8
- SyntheticEvent,
9
- } from 'react';
2
+ import { useRef, useState, PropsWithChildren, CSSProperties, SyntheticEvent } from 'react';
10
3
 
11
4
  import Dimmer from '../../dimmer';
12
5
  import Drawer from '../../drawer';
@@ -38,7 +31,7 @@ export type BottomSheetProps = PropsWithChildren<
38
31
  * Neptune Web: https://transferwise.github.io/neptune-web/components/overlays/BottomSheet
39
32
  *
40
33
  */
41
- const BottomSheet = (props: BottomSheetProps): ReactElement => {
34
+ const BottomSheet = (props: BottomSheetProps) => {
42
35
  const bottomSheetReference = useRef<HTMLDivElement>(null);
43
36
  const topBarReference = useRef<HTMLDivElement>(null);
44
37
  const contentReference = useRef<HTMLDivElement>(null);
@@ -27,7 +27,7 @@ export const CloseButton = forwardRef(function CloseButton(
27
27
  isDisabled,
28
28
  testId,
29
29
  }: CloseButtonProps,
30
- reference: React.ForwardedRef<HTMLButtonElement>,
30
+ reference: React.ForwardedRef<HTMLButtonElement | null>,
31
31
  ) {
32
32
  const intl = useIntl();
33
33
  ariaLabel ??= intl.formatMessage(messages.ariaLabel);
@@ -20,7 +20,7 @@ const FlowHeader = React.forwardRef(
20
20
  leftContent,
21
21
  rightContent,
22
22
  }: FlowHeaderProps,
23
- reference: React.ForwardedRef<HTMLDivElement>,
23
+ reference: React.ForwardedRef<HTMLDivElement | null>,
24
24
  ) => {
25
25
  const isVertical = layout === Layout.VERTICAL;
26
26
 
@@ -3,7 +3,7 @@ import { useEffect } from 'react';
3
3
  import { useEffectEvent } from './useEffectEvent';
4
4
 
5
5
  export function useResizeObserver(
6
- ref: React.RefObject<Element>,
6
+ ref: React.MutableRefObject<Element | null>,
7
7
  callback: (entry: ResizeObserverEntry) => void,
8
8
  ) {
9
9
  const handleCallback = useEffectEvent(callback);
@@ -6,7 +6,7 @@ import { render } from '../../test-utils';
6
6
  import Panel from './Panel';
7
7
  import type { PanelProps } from './Panel';
8
8
 
9
- const mockAnchorRef: React.RefObject<HTMLAnchorElement> = {
9
+ const mockAnchorRef: React.MutableRefObject<HTMLAnchorElement | null> = {
10
10
  current: document.createElement('a'),
11
11
  };
12
12
 
@@ -1,13 +1,13 @@
1
1
  import classnames from 'classnames';
2
2
  import {
3
- useState,
4
- forwardRef,
5
- useEffect,
3
+ CSSProperties,
4
+ HTMLAttributes,
5
+ MutableRefObject,
6
6
  PropsWithChildren,
7
- RefObject,
8
7
  SyntheticEvent,
9
- HTMLAttributes,
10
- CSSProperties,
8
+ forwardRef,
9
+ useEffect,
10
+ useState,
11
11
  } from 'react';
12
12
  import { usePopper } from 'react-popper';
13
13
 
@@ -33,7 +33,7 @@ export type PanelProps = PropsWithChildren<{
33
33
  open?: boolean;
34
34
  onClose?: (event: Event | SyntheticEvent) => void;
35
35
  position?: PositionBottom | PositionLeft | PositionRight | PositionTop;
36
- anchorRef: RefObject<Element>;
36
+ anchorRef: MutableRefObject<Element | null>;
37
37
  anchorWidth?: boolean;
38
38
  }> &
39
39
  HTMLAttributes<HTMLDivElement>;
@@ -13,7 +13,7 @@ export interface PolymorphicWithOverridesProps {
13
13
  */
14
14
  export const PolymorphicWithOverrides = forwardRef(function PolymorphicWithOverrides(
15
15
  { __overrides: { as: Element, ...restOverrides }, ...restProps }: PolymorphicWithOverridesProps,
16
- ref: React.ForwardedRef<Element>,
16
+ ref: React.ForwardedRef<Element | null>,
17
17
  ) {
18
18
  return <Element ref={ref} {...restProps} {...restOverrides} />;
19
19
  });
@@ -1,14 +1,6 @@
1
1
  import { ThemeProvider, useTheme } from '@wise/components-theming';
2
2
  import classNames from 'classnames';
3
- import {
4
- MouseEvent,
5
- ReactElement,
6
- ReactNode,
7
- useCallback,
8
- useEffect,
9
- useRef,
10
- useState,
11
- } from 'react';
3
+ import { MouseEvent, ReactNode, useCallback, useEffect, useRef, useState } from 'react';
12
4
  import { CSSTransition } from 'react-transition-group';
13
5
 
14
6
  import {
@@ -203,7 +195,7 @@ export const DimmerContentWrapper = ({
203
195
  children,
204
196
  scrollBody,
205
197
  }: {
206
- children: ReactElement;
198
+ children: React.ReactElement;
207
199
  scrollBody: boolean;
208
200
  }) => {
209
201
  useEffect(() => {
@@ -1,5 +1,3 @@
1
- import { ReactElement } from 'react';
2
-
3
1
  import EmphasisHtmlTransformer from './EmphasisHtmlTransformer';
4
2
 
5
3
  const SUPPORTED_TAGS = ['important', 'positive', 'negative', 'warning'];
@@ -9,7 +7,7 @@ export type EmphasisProps = {
9
7
  text?: string;
10
8
  };
11
9
 
12
- const Emphasis = ({ text = undefined }: EmphasisProps): ReactElement | null => {
10
+ const Emphasis = ({ text = undefined }: EmphasisProps) => {
13
11
  if (!text) {
14
12
  return null;
15
13
  }
@@ -19,7 +19,7 @@ export interface InputProps
19
19
 
20
20
  export const Input = forwardRef(function Input(
21
21
  { size = 'auto', shape = 'rectangle', className, ...restProps }: InputProps,
22
- reference: React.ForwardedRef<HTMLInputElement>,
22
+ reference: React.ForwardedRef<HTMLInputElement | null>,
23
23
  ) {
24
24
  const inputAttributes = useInputAttributes();
25
25
  const inputPaddings = useInputPaddings();
@@ -19,7 +19,7 @@ export interface SearchInputProps
19
19
 
20
20
  export const SearchInput = forwardRef(function SearchInput(
21
21
  { shape = 'pill', size = Size.MEDIUM, disabled, className, ...restProps }: SearchInputProps,
22
- ref: React.ForwardedRef<HTMLInputElement>,
22
+ ref: React.ForwardedRef<HTMLInputElement | null>,
23
23
  ) {
24
24
  return (
25
25
  <InputGroup
@@ -48,7 +48,7 @@ function inferSearchableStrings(value: unknown) {
48
48
  }
49
49
 
50
50
  const SelectInputTriggerButtonPropsContext = createContext<{
51
- ref?: React.ForwardedRef<HTMLButtonElement>;
51
+ ref?: React.ForwardedRef<HTMLButtonElement | null>;
52
52
  id?: string;
53
53
  onClick?: (event: React.MouseEvent) => void;
54
54
  onKeyDown?: (event: React.KeyboardEvent) => void;
@@ -437,7 +437,7 @@ const SelectInputOptionsContainer = forwardRef(function SelectInputOptionsContai
437
437
  onKeyDown,
438
438
  ...restProps
439
439
  }: SelectInputOptionsContainerProps,
440
- ref: React.ForwardedRef<HTMLDivElement>,
440
+ ref: React.ForwardedRef<HTMLDivElement | null>,
441
441
  ) {
442
442
  const handleAriaActiveDescendantChange = useEffectEvent(onAriaActiveDescendantChange);
443
443
  useEffect(() => {
@@ -476,8 +476,8 @@ interface SelectInputOptionsProps<T = string>
476
476
  SelectInputProps<T>,
477
477
  'items' | 'renderValue' | 'renderFooter' | 'filterable' | 'filterPlaceholder'
478
478
  > {
479
- searchInputRef: React.RefObject<HTMLInputElement>;
480
- listboxRef: React.RefObject<HTMLDivElement>;
479
+ searchInputRef: React.MutableRefObject<HTMLInputElement | null>;
480
+ listboxRef: React.MutableRefObject<HTMLDivElement | null>;
481
481
  filterQuery: string;
482
482
  onFilterChange: (query: string) => void;
483
483
  }
@@ -15,7 +15,7 @@ export interface TextAreaProps
15
15
 
16
16
  export const TextArea = forwardRef(function TextArea(
17
17
  { className, ...restProps }: TextAreaProps,
18
- reference: React.ForwardedRef<HTMLTextAreaElement>,
18
+ reference: React.ForwardedRef<HTMLTextAreaElement | null>,
19
19
  ) {
20
20
  const inputAttributes = useInputAttributes();
21
21
 
@@ -25,7 +25,7 @@ export interface BottomSheetProps {
25
25
  };
26
26
  }) => React.ReactNode;
27
27
  title?: string;
28
- initialFocusRef?: React.RefObject<HTMLElement>;
28
+ initialFocusRef?: React.MutableRefObject<HTMLElement | null>;
29
29
  padding?: 'none' | 'md';
30
30
  children?: React.ReactNode;
31
31
  onClose?: () => void;
@@ -10,7 +10,7 @@ export interface ButtonInputProps extends React.ComponentPropsWithRef<'button'>
10
10
 
11
11
  export const ButtonInput = forwardRef(function ButtonInput(
12
12
  { size = 'md', className, style, ...restProps }: ButtonInputProps,
13
- ref: React.ForwardedRef<HTMLButtonElement>,
13
+ ref: React.ForwardedRef<HTMLButtonElement | null>,
14
14
  ) {
15
15
  const inputPaddings = useInputPaddings();
16
16
 
@@ -1,5 +1,4 @@
1
1
  import classnames from 'classnames';
2
- import { ReactElement, useEffect, useState } from 'react';
3
2
 
4
3
  export type ProgressProps = {
5
4
  className?: string;
@@ -7,21 +6,10 @@ export type ProgressProps = {
7
6
  progress: { value: number; max: number };
8
7
  };
9
8
 
10
- const Progress = ({ className, id, progress }: ProgressProps): ReactElement | null => {
11
- const [value, setValue] = useState(0);
12
-
13
- useEffect(() => {
14
- setValue(progress.value);
15
- });
16
-
9
+ const Progress = ({ className, id, progress }: ProgressProps) => {
17
10
  return (
18
- <progress
19
- id={id}
20
- className={classnames('np-progress d-block', className)}
21
- {...progress}
22
- value={value}
23
- >
24
- {value}%
11
+ <progress id={id} className={classnames('np-progress d-block', className)} {...progress}>
12
+ {Math.floor((progress.value / progress.max) * 100)}%
25
13
  </progress>
26
14
  );
27
15
  };
@@ -1,6 +1,5 @@
1
1
  import { useTheme } from '@wise/components-theming';
2
2
  import classNames from 'classnames';
3
- import { ReactElement } from 'react';
4
3
 
5
4
  import Body from '../body';
6
5
  import { Typography } from '../common';
@@ -23,7 +22,7 @@ const ProgressBar = ({
23
22
  title,
24
23
  progress,
25
24
  textEnd,
26
- }: ProgressBarProps): ReactElement | null => {
25
+ }: ProgressBarProps) => {
27
26
  const { isModern } = useTheme();
28
27
  return (
29
28
  <div className={classNames('np-progress-bar', className)}>
@@ -154,7 +154,7 @@ export type PromoCardProps = PromoCardLinkProps | PromoCardCheckedProps;
154
154
 
155
155
  export type PolymorphicPromoCard = (
156
156
  props: PromoCardLinkProps | PromoCardCheckedProps,
157
- ) => JSX.Element;
157
+ ) => React.JSX.Element;
158
158
 
159
159
  /**
160
160
  * PromoCard component.
@@ -185,7 +185,7 @@ export type PolymorphicPromoCard = (
185
185
  * @param {string} title - Title text of the PromoCard.
186
186
  * @param {('checkbox'|'radio')} type - Type of the PromoCard (checkbox, radio).
187
187
  * @param {string} value - Value for checkboxes and radios.
188
- * @returns {JSX.Element} The rendered PromoCard component.
188
+ * @returns {React.JSX.Element} The rendered PromoCard component.
189
189
  * @example
190
190
  * <PromoCard
191
191
  * title="Example PromoCard"
@@ -4,7 +4,7 @@ import React from 'react';
4
4
  import { PromoCardContext, usePromoCardContext } from './PromoCardContext';
5
5
 
6
6
  // A simple component that consumes the context
7
- const TestComponent: React.FC = () => {
7
+ const TestComponent: React.FC<Record<string, never>> = () => {
8
8
  const context = usePromoCardContext();
9
9
 
10
10
  return (
@@ -1,4 +1,4 @@
1
- import { createContext, ReactElement, PropsWithChildren } from 'react';
1
+ import { createContext, PropsWithChildren } from 'react';
2
2
 
3
3
  import { LayoutDirection, Direction } from '../../common/direction';
4
4
 
@@ -6,9 +6,6 @@ export const DirectionContext = createContext<LayoutDirection>(Direction.LTR);
6
6
 
7
7
  export type DirectionProviderProps = PropsWithChildren<{ direction: LayoutDirection }>;
8
8
 
9
- export const DirectionProvider = ({
10
- direction,
11
- children,
12
- }: DirectionProviderProps): ReactElement => {
9
+ export const DirectionProvider = ({ direction, children }: DirectionProviderProps) => {
13
10
  return <DirectionContext.Provider value={direction}>{children}</DirectionContext.Provider>;
14
11
  };
@@ -1,4 +1,4 @@
1
- import { createContext, ReactElement, PropsWithChildren } from 'react';
1
+ import { createContext, PropsWithChildren } from 'react';
2
2
 
3
3
  import { DEFAULT_LOCALE } from '../../common/locale';
4
4
 
@@ -6,6 +6,6 @@ export const LanguageContext = createContext<string>(DEFAULT_LOCALE);
6
6
 
7
7
  export type LanguageProviderProps = PropsWithChildren<{ locale: string }>;
8
8
 
9
- export const LanguageProvider = ({ locale, children }: LanguageProviderProps): ReactElement => {
9
+ export const LanguageProvider = ({ locale, children }: LanguageProviderProps) => {
10
10
  return <LanguageContext.Provider value={locale}>{children}</LanguageContext.Provider>;
11
11
  };
@@ -104,7 +104,7 @@ const SegmentedControl = ({
104
104
  };
105
105
  return mode === 'input' ? (
106
106
  <label
107
- ref={segment.ref as React.RefObject<HTMLLabelElement>}
107
+ ref={segment.ref as React.MutableRefObject<HTMLLabelElement | null>}
108
108
  key={segment.id}
109
109
  htmlFor={segment.id}
110
110
  className={classNames('segmented-control__segment', {
@@ -132,7 +132,7 @@ const SegmentedControl = ({
132
132
  </label>
133
133
  ) : (
134
134
  <button
135
- ref={segment.ref as React.RefObject<HTMLButtonElement>}
135
+ ref={segment.ref as React.MutableRefObject<HTMLButtonElement | null>}
136
136
  key={segment.id}
137
137
  type="button"
138
138
  role="tab"
@@ -1,5 +1,6 @@
1
+ import { IdIconProps } from '@transferwise/icons';
1
2
  import { Flag } from '@wise/art';
2
- import { useTheme } from '@wise/components-theming';
3
+ import classNames from 'classnames';
3
4
  import { cloneElement, ReactElement, ReactNode } from 'react';
4
5
 
5
6
  import Body from '../../body';
@@ -12,6 +13,7 @@ export type Props<T> = {
12
13
  note?: ReactNode;
13
14
  secondary?: ReactNode;
14
15
  icon?: ReactNode;
16
+ /** @deprecated */
15
17
  classNames?: Record<string, string>;
16
18
  selected?: boolean;
17
19
  };
@@ -22,13 +24,10 @@ function Option<T>({
22
24
  note = '',
23
25
  secondary = '',
24
26
  icon,
25
- classNames = {},
26
27
  selected = false,
27
28
  }: Props<T>) {
28
- const { isModern } = useTheme();
29
-
30
29
  const iconElement = icon
31
- ? cloneElement(icon as ReactElement, {
30
+ ? cloneElement(icon as ReactElement<IdIconProps>, {
32
31
  size: 24,
33
32
  className: 'tw-icon',
34
33
  })
@@ -38,26 +37,15 @@ function Option<T>({
38
37
  <Body as="span" type={Typography.BODY_LARGE} className={selected ? 'text-ellipsis' : undefined}>
39
38
  {label}
40
39
  {note && (
41
- <Body as="span" className={isModern ? 'm-l-1' : 'm-l-1 body-2'}>
40
+ <Body as="span" className="m-l-1">
42
41
  {note}
43
42
  </Body>
44
43
  )}
45
44
  </Body>
46
45
  );
47
46
 
48
- const secondaryElementClassNames = (): string | undefined => {
49
- let classes: string | undefined = undefined;
50
- if (selected) {
51
- classes = 'text-ellipsis';
52
- }
53
- if (isModern) {
54
- return classes;
55
- }
56
- return `${classes ? classes + ' ' : ''}body-2`;
57
- };
58
-
59
47
  const secondaryElement = secondary && (
60
- <Body className={secondaryElementClassNames()}>{secondary}</Body>
48
+ <Body className={classNames(selected && 'text-ellipsis')}>{secondary}</Body>
61
49
  );
62
50
 
63
51
  return iconElement ? (
@@ -25,7 +25,7 @@ const SlidingPanel = forwardRef(
25
25
  children,
26
26
  ...rest
27
27
  }: Omit<SlidingPanelProps, 'ref'>,
28
- reference: React.ForwardedRef<HTMLDivElement>,
28
+ reference: React.ForwardedRef<HTMLDivElement | null>,
29
29
  ) => {
30
30
  const localReference = useRef<HTMLDivElement>(null as never);
31
31
  useImperativeHandle(reference, () => localReference.current, []);
package/src/ssr.spec.js CHANGED
@@ -194,6 +194,12 @@ describe('Server side rendering', () => {
194
194
  Popover: {
195
195
  children: <div />,
196
196
  },
197
+ Progress: {
198
+ progress: { value: 50, max: 100 },
199
+ },
200
+ ProgressBar: {
201
+ progress: { value: 50, max: 100 },
202
+ },
197
203
  Field: {
198
204
  model: 'a model',
199
205
  type: 'text',