@transferwise/components 46.36.0 → 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.
- package/build/index.js +11 -35
- package/build/index.js.map +1 -1
- package/build/index.mjs +11 -35
- package/build/index.mjs.map +1 -1
- package/build/types/accordion/AccordionItem/AccordionItem.d.ts.map +1 -1
- package/build/types/actionOption/ActionOption.d.ts +5 -5
- package/build/types/actionOption/ActionOption.d.ts.map +1 -1
- package/build/types/alert/Alert.d.ts +1 -1
- package/build/types/alert/Alert.d.ts.map +1 -1
- package/build/types/body/Body.d.ts +1 -1
- package/build/types/body/Body.d.ts.map +1 -1
- package/build/types/chips/Chip.d.ts +2 -2
- package/build/types/chips/Chip.d.ts.map +1 -1
- package/build/types/chips/Chips.d.ts +2 -2
- package/build/types/chips/Chips.d.ts.map +1 -1
- package/build/types/common/bottomSheet/BottomSheet.d.ts +2 -2
- package/build/types/common/bottomSheet/BottomSheet.d.ts.map +1 -1
- package/build/types/common/closeButton/CloseButton.d.ts +1 -1
- package/build/types/common/closeButton/CloseButton.d.ts.map +1 -1
- package/build/types/common/flowHeader/FlowHeader.d.ts +1 -1
- package/build/types/common/flowHeader/FlowHeader.d.ts.map +1 -1
- package/build/types/common/hooks/useResizeObserver.d.ts +1 -1
- package/build/types/common/hooks/useResizeObserver.d.ts.map +1 -1
- package/build/types/common/panel/Panel.d.ts +3 -3
- package/build/types/common/panel/Panel.d.ts.map +1 -1
- package/build/types/common/polymorphicWithOverrides/PolymorphicWithOverrides.d.ts +1 -1
- package/build/types/common/polymorphicWithOverrides/PolymorphicWithOverrides.d.ts.map +1 -1
- package/build/types/common/responsivePanel/ResponsivePanel.d.ts +1 -1
- package/build/types/dimmer/Dimmer.d.ts +3 -3
- package/build/types/dimmer/Dimmer.d.ts.map +1 -1
- package/build/types/emphasis/Emphasis.d.ts +2 -2
- package/build/types/emphasis/Emphasis.d.ts.map +1 -1
- package/build/types/inputs/Input.d.ts +1 -1
- package/build/types/inputs/Input.d.ts.map +1 -1
- package/build/types/inputs/SearchInput.d.ts +1 -1
- package/build/types/inputs/SearchInput.d.ts.map +1 -1
- package/build/types/inputs/TextArea.d.ts +1 -1
- package/build/types/inputs/TextArea.d.ts.map +1 -1
- package/build/types/inputs/_BottomSheet.d.ts +1 -1
- package/build/types/inputs/_BottomSheet.d.ts.map +1 -1
- package/build/types/inputs/_ButtonInput.d.ts +1 -1
- package/build/types/inputs/_ButtonInput.d.ts.map +1 -1
- package/build/types/moneyInput/MoneyInput.d.ts.map +1 -1
- package/build/types/progress/Progress.d.ts +2 -2
- package/build/types/progress/Progress.d.ts.map +1 -1
- package/build/types/progressBar/ProgressBar.d.ts +2 -2
- package/build/types/progressBar/ProgressBar.d.ts.map +1 -1
- package/build/types/promoCard/PromoCard.d.ts +1 -1
- package/build/types/promoCard/PromoCard.d.ts.map +1 -1
- package/build/types/provider/direction/DirectionProvider.d.ts +2 -2
- package/build/types/provider/direction/DirectionProvider.d.ts.map +1 -1
- package/build/types/provider/language/LanguageProvider.d.ts +2 -2
- package/build/types/provider/language/LanguageProvider.d.ts.map +1 -1
- package/build/types/select/option/Option.d.ts +2 -1
- package/build/types/select/option/Option.d.ts.map +1 -1
- package/build/types/slidingPanel/SlidingPanel.d.ts +1 -1
- package/build/types/slidingPanel/SlidingPanel.d.ts.map +1 -1
- package/build/types/switchOption/SwitchOption.d.ts +4 -4
- package/build/types/switchOption/SwitchOption.d.ts.map +1 -1
- package/build/types/tabs/Tabs.d.ts +1 -1
- package/build/types/tabs/Tabs.d.ts.map +1 -1
- package/build/types/tooltip/Tooltip.d.ts.map +1 -1
- package/build/types/uploadInput/UploadInput.d.ts +2 -2
- package/build/types/uploadInput/UploadInput.d.ts.map +1 -1
- package/build/types/uploadInput/uploadItem/UploadItem.d.ts.map +1 -1
- package/build/types/withDisplayFormat/WithDisplayFormat.d.ts +4 -4
- package/build/types/withDisplayFormat/WithDisplayFormat.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/accordion/AccordionItem/AccordionItem.tsx +5 -2
- package/src/actionOption/ActionOption.tsx +4 -5
- package/src/alert/Alert.tsx +1 -1
- package/src/body/Body.tsx +4 -3
- package/src/chips/Chip.tsx +5 -6
- package/src/chips/Chips.tsx +1 -2
- package/src/common/bottomSheet/BottomSheet.tsx +2 -9
- package/src/common/closeButton/CloseButton.tsx +1 -1
- package/src/common/flowHeader/FlowHeader.tsx +1 -1
- package/src/common/hooks/useResizeObserver.ts +1 -1
- package/src/common/panel/Panel.spec.tsx +1 -1
- package/src/common/panel/Panel.tsx +7 -7
- package/src/common/polymorphicWithOverrides/PolymorphicWithOverrides.tsx +1 -1
- package/src/dimmer/Dimmer.tsx +2 -10
- package/src/emphasis/Emphasis.tsx +1 -3
- package/src/inputs/Input.tsx +1 -1
- package/src/inputs/SearchInput.tsx +1 -1
- package/src/inputs/SelectInput.tsx +4 -4
- package/src/inputs/TextArea.tsx +1 -1
- package/src/inputs/_BottomSheet.tsx +1 -1
- package/src/inputs/_ButtonInput.tsx +1 -1
- package/src/moneyInput/MoneyInput.story.tsx +40 -2
- package/src/moneyInput/MoneyInput.tsx +1 -4
- package/src/progress/Progress.tsx +3 -15
- package/src/progressBar/ProgressBar.tsx +1 -2
- package/src/promoCard/PromoCard.tsx +2 -2
- package/src/promoCard/PromoCardContext.spec.tsx +1 -1
- package/src/provider/direction/DirectionProvider.tsx +2 -5
- package/src/provider/language/LanguageProvider.tsx +2 -2
- package/src/segmentedControl/SegmentedControl.tsx +2 -2
- package/src/select/option/Option.tsx +6 -18
- package/src/slidingPanel/SlidingPanel.tsx +1 -1
- package/src/ssr.spec.js +6 -0
- package/src/switchOption/SwitchOption.tsx +5 -7
- package/src/tabs/Tabs.js +3 -3
- package/src/tooltip/Tooltip.tsx +2 -1
- package/src/uploadInput/UploadInput.tsx +2 -2
- package/src/uploadInput/uploadItem/UploadItem.tsx +3 -4
- package/src/withDisplayFormat/WithDisplayFormat.tsx +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UploadInput.d.ts","sourceRoot":"","sources":["../../../src/uploadInput/UploadInput.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"UploadInput.d.ts","sourceRoot":"","sources":["../../../src/uploadInput/UploadInput.tsx"],"names":[],"mappings":";AAMA,OAAO,EAAE,WAAW,EAAiC,MAAM,WAAW,CAAC;AAMvE,OAAO,EAAE,YAAY,EAAe,cAAc,EAAE,MAAM,SAAS,CAAC;AACpE,OAAqB,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAE9E,OAAmB,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAEtE,MAAM,MAAM,gBAAgB,GAAG;IAC7B;;OAEG;IACH,KAAK,CAAC,EAAE,SAAS,YAAY,EAAE,CAAC;IAEhC;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB;;;;OAIG;IACH,YAAY,EAAE,CAAC,QAAQ,EAAE,QAAQ,KAAK,OAAO,CAAC,cAAc,CAAC,CAAC;IAE9D;;;;;OAKG;IACH,YAAY,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC;IAErD;;;;OAIG;IACH,iBAAiB,CAAC,EAAE,CAAC,IAAI,EAAE,YAAY,KAAK,IAAI,CAAC;IAEjD;;;;OAIG;IACH,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,YAAY,EAAE,KAAK,IAAI,CAAC;IAEhD;;OAEG;IACH,aAAa,CAAC,EAAE;QACd;;WAEG;QACH,KAAK,CAAC,EAAE,MAAM,CAAC;QAEf;;WAEG;QACH,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;QAEvB;;WAEG;QACH,WAAW,CAAC,EAAE,MAAM,CAAC;QAErB;;WAEG;QACH,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB,CAAC;IAEF;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAE9B;;OAEG;IACH,qBAAqB,CAAC,EAAE,MAAM,CAAC;CAChC,GAAG,IAAI,CACN,iBAAiB,EACjB,UAAU,GAAG,UAAU,GAAG,WAAW,GAAG,WAAW,GAAG,aAAa,GAAG,IAAI,GAAG,mBAAmB,CACjG,GACC,IAAI,CAAC,eAAe,EAAE,YAAY,CAAC,GACnC,WAAW,CAAC;AAQd,QAAA,MAAM,WAAW,uQAoBd,gBAAgB,gCA0PlB,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UploadItem.d.ts","sourceRoot":"","sources":["../../../../src/uploadInput/uploadItem/UploadItem.tsx"],"names":[],"mappings":";
|
|
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
|
|
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,
|
|
1
|
+
{"version":3,"file":"WithDisplayFormat.d.ts","sourceRoot":"","sources":["../../../src/withDisplayFormat/WithDisplayFormat.tsx"],"names":[],"mappings":"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"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@transferwise/components",
|
|
3
|
-
"version": "46.
|
|
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/
|
|
97
|
+
"@transferwise/less-config": "3.1.0",
|
|
98
98
|
"@wise/components-theming": "1.3.0",
|
|
99
|
-
"@transferwise/
|
|
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 {
|
|
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
|
|
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?:
|
|
9
|
+
content?: React.ReactNode;
|
|
11
10
|
disabled?: boolean;
|
|
12
|
-
media?:
|
|
11
|
+
media?: React.ReactNode;
|
|
13
12
|
showMediaAtAllSizes?: boolean;
|
|
14
13
|
onClick: () => void;
|
|
15
|
-
title:
|
|
16
|
-
action:
|
|
14
|
+
title: React.ReactNode;
|
|
15
|
+
action: React.ReactNode;
|
|
17
16
|
priority?: PriorityPrimary | PrioritySecondary;
|
|
18
17
|
showMediaCircle?: boolean;
|
|
19
18
|
isContainerAligned?: boolean;
|
package/src/alert/Alert.tsx
CHANGED
|
@@ -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.
|
|
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
|
-
|
|
31
|
-
|
|
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);
|
package/src/chips/Chip.tsx
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { useTheme } from '@wise/components-theming';
|
|
2
2
|
import classNames from 'classnames';
|
|
3
|
-
import {
|
|
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)
|
|
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
|
|
80
|
+
aria-label={closeButton?.['aria-label']}
|
|
82
81
|
size="sm"
|
|
83
82
|
filled={isModern}
|
|
84
83
|
onClick={onRemove}
|
package/src/chips/Chips.tsx
CHANGED
|
@@ -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)
|
|
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)
|
|
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.
|
|
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.
|
|
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
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
CSSProperties,
|
|
4
|
+
HTMLAttributes,
|
|
5
|
+
MutableRefObject,
|
|
6
6
|
PropsWithChildren,
|
|
7
|
-
RefObject,
|
|
8
7
|
SyntheticEvent,
|
|
9
|
-
|
|
10
|
-
|
|
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:
|
|
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
|
});
|
package/src/dimmer/Dimmer.tsx
CHANGED
|
@@ -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)
|
|
10
|
+
const Emphasis = ({ text = undefined }: EmphasisProps) => {
|
|
13
11
|
if (!text) {
|
|
14
12
|
return null;
|
|
15
13
|
}
|
package/src/inputs/Input.tsx
CHANGED
|
@@ -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.
|
|
480
|
-
listboxRef: React.
|
|
479
|
+
searchInputRef: React.MutableRefObject<HTMLInputElement | null>;
|
|
480
|
+
listboxRef: React.MutableRefObject<HTMLDivElement | null>;
|
|
481
481
|
filterQuery: string;
|
|
482
482
|
onFilterChange: (query: string) => void;
|
|
483
483
|
}
|
package/src/inputs/TextArea.tsx
CHANGED
|
@@ -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.
|
|
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,9 +1,13 @@
|
|
|
1
|
+
import { FORCE_RE_RENDER } from '@storybook/core-events';
|
|
2
|
+
import { addons, useGlobals } from '@storybook/manager-api';
|
|
1
3
|
import { Meta, StoryObj } from '@storybook/react';
|
|
2
|
-
import { within, userEvent } from '@storybook/test';
|
|
4
|
+
import { expect, within, userEvent } from '@storybook/test';
|
|
3
5
|
import { Lock } from '@transferwise/icons';
|
|
4
|
-
import React, { useState } from 'react';
|
|
6
|
+
import React, { useEffect, useState } from 'react';
|
|
5
7
|
|
|
6
8
|
import MoneyInput, { CurrencyOptionItem } from '.';
|
|
9
|
+
import Provider from '../provider/Provider';
|
|
10
|
+
import translations from '../i18n';
|
|
7
11
|
|
|
8
12
|
export default {
|
|
9
13
|
component: MoneyInput,
|
|
@@ -148,6 +152,40 @@ export const BalanceCurrencies: Story = {
|
|
|
148
152
|
},
|
|
149
153
|
};
|
|
150
154
|
|
|
155
|
+
export const MaxLengthOverride: Story = {
|
|
156
|
+
args: {
|
|
157
|
+
...SingleCurrency.args,
|
|
158
|
+
maxLengthOverride: 5,
|
|
159
|
+
},
|
|
160
|
+
play: async ({ canvasElement }) => {
|
|
161
|
+
await userEvent.tab();
|
|
162
|
+
await userEvent.keyboard('12.345');
|
|
163
|
+
|
|
164
|
+
await expect(within(canvasElement).getByRole('textbox')).toHaveValue('12.34');
|
|
165
|
+
},
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
export const MaxLengthOverrideWithCommaDecimalSeparator: Story = {
|
|
169
|
+
...MaxLengthOverride,
|
|
170
|
+
decorators: [
|
|
171
|
+
(Story) => {
|
|
172
|
+
const locale = 'de';
|
|
173
|
+
return (
|
|
174
|
+
<Provider i18n={{ locale, messages: translations[locale] }}>
|
|
175
|
+
<Story />
|
|
176
|
+
</Provider>
|
|
177
|
+
);
|
|
178
|
+
},
|
|
179
|
+
],
|
|
180
|
+
play: async ({ canvasElement }) => {
|
|
181
|
+
await userEvent.tab();
|
|
182
|
+
await userEvent.keyboard('12,345');
|
|
183
|
+
await userEvent.tab();
|
|
184
|
+
|
|
185
|
+
await expect(within(canvasElement).getByRole('textbox')).toHaveValue('12.34');
|
|
186
|
+
},
|
|
187
|
+
};
|
|
188
|
+
|
|
151
189
|
export const OpenedInput: Story = {
|
|
152
190
|
...MultipleCurrencies,
|
|
153
191
|
play: async ({ canvasElement }) => {
|
|
@@ -65,13 +65,10 @@ const parseNumber = ({
|
|
|
65
65
|
locale: string;
|
|
66
66
|
maxLengthOverride?: number;
|
|
67
67
|
}) => {
|
|
68
|
-
if (!maxLengthOverride) {
|
|
69
|
-
return parseAmount(amount, currency, locale);
|
|
70
|
-
}
|
|
71
68
|
if (maxLengthOverride && amount.length > maxLengthOverride) {
|
|
72
69
|
return 0;
|
|
73
70
|
}
|
|
74
|
-
return
|
|
71
|
+
return parseAmount(amount, currency, locale);
|
|
75
72
|
};
|
|
76
73
|
|
|
77
74
|
const allowedInputKeys = new Set([
|
|
@@ -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)
|
|
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
|
-
|
|
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)
|
|
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,
|
|
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,
|
|
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)
|
|
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.
|
|
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.
|
|
135
|
+
ref={segment.ref as React.MutableRefObject<HTMLButtonElement | null>}
|
|
136
136
|
key={segment.id}
|
|
137
137
|
type="button"
|
|
138
138
|
role="tab"
|