@transferwise/components 46.29.0 → 46.29.1
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/i18n/hu.json +1 -1
- package/build/index.js +11 -56
- package/build/index.js.map +1 -1
- package/build/index.mjs +12 -56
- package/build/index.mjs.map +1 -1
- package/build/types/common/hooks/index.d.ts +0 -1
- package/build/types/flowNavigation/FlowNavigation.d.ts +3 -3
- package/build/types/flowNavigation/FlowNavigation.d.ts.map +1 -1
- package/package.json +8 -6
- package/src/common/hooks/index.js +0 -1
- package/src/decision/Decision.spec.js +0 -1
- package/src/flowNavigation/FlowNavigation.spec.js +7 -22
- package/src/flowNavigation/FlowNavigation.tsx +20 -33
- package/src/flowNavigation/__snapshots__/FlowNavigation.spec.js.snap +2 -2
- package/src/i18n/hu.json +1 -1
- package/src/provider/theme/ThemeProvider.story.tsx +21 -0
- package/build/types/common/hooks/useClientWidth/useClientWidth.d.ts +0 -11
- package/build/types/common/hooks/useClientWidth/useClientWidth.d.ts.map +0 -1
- package/src/common/hooks/useClientWidth/useClientWidth.spec.js +0 -77
- package/src/common/hooks/useClientWidth/useClientWidth.tsx +0 -47
package/build/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import classNames from 'classnames';
|
|
2
2
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
3
3
|
import * as React from 'react';
|
|
4
|
-
import React__default, { forwardRef, cloneElement, useState, useEffect, useRef, useMemo, useCallback,
|
|
4
|
+
import React__default, { forwardRef, cloneElement, useState, useEffect, useRef, useMemo, useCallback, createContext, useContext, useImperativeHandle, createElement, Component, PureComponent, createRef, isValidElement, Children, Fragment as Fragment$1 } from 'react';
|
|
5
5
|
import { useId } from '@radix-ui/react-id';
|
|
6
6
|
import { ChevronUp, CrossCircleFill, Cross, NavigateAway, Check, Info as Info$1, Alert as Alert$1, ClockBorderless, Briefcase, Person, ArrowLeft, QuestionMarkCircle, AlertCircle, Search, CrossCircle, ChevronDown, CheckCircleFill, ArrowRight, Download, ClockFill, Upload as Upload$2, Document, Plus, PlusCircle, AlertCircleFill } from '@transferwise/icons';
|
|
7
7
|
import { defineMessages, useIntl, injectIntl, IntlProvider } from 'react-intl';
|
|
@@ -19,7 +19,6 @@ import { CSSTransition } from 'react-transition-group';
|
|
|
19
19
|
import { isUndefined, isNumber, isEmpty, isNull } from '@transferwise/neptune-validation';
|
|
20
20
|
import { createPortal } from 'react-dom';
|
|
21
21
|
import { usePopper } from 'react-popper';
|
|
22
|
-
import throttle from 'lodash.throttle';
|
|
23
22
|
import { Flag, Illustration } from '@wise/art';
|
|
24
23
|
import clamp$2 from 'lodash.clamp';
|
|
25
24
|
import debounce from 'lodash.debounce';
|
|
@@ -1459,41 +1458,6 @@ const DimmerContentWrapper = ({
|
|
|
1459
1458
|
};
|
|
1460
1459
|
var Dimmer$1 = withNextPortalWrapper(Dimmer);
|
|
1461
1460
|
|
|
1462
|
-
const THROTTLE_MS = 100;
|
|
1463
|
-
const useIsomorphicLayoutEffect = typeof window !== 'undefined' ? useLayoutEffect : useEffect;
|
|
1464
|
-
const useClientWidth = ({
|
|
1465
|
-
ref,
|
|
1466
|
-
throttleMs = THROTTLE_MS
|
|
1467
|
-
}) => {
|
|
1468
|
-
const [clientWidth, setClientWidth] = useState(null);
|
|
1469
|
-
useIsomorphicLayoutEffect(() => {
|
|
1470
|
-
// eslint-disable-next-line unicorn/consistent-function-scoping
|
|
1471
|
-
const updateClientWidth = () => {
|
|
1472
|
-
if (ref) {
|
|
1473
|
-
// when `ref` is a window
|
|
1474
|
-
if ('innerWidth' in ref) {
|
|
1475
|
-
setClientWidth(ref.innerWidth);
|
|
1476
|
-
}
|
|
1477
|
-
// when `ref` is an element
|
|
1478
|
-
else if (ref.current) {
|
|
1479
|
-
setClientWidth(ref.current.clientWidth);
|
|
1480
|
-
}
|
|
1481
|
-
}
|
|
1482
|
-
};
|
|
1483
|
-
// This assignment saves a reference to the function so it will be the same passed to both addEventListener removeEventListener.
|
|
1484
|
-
// If throttle gets passed directly to both add and removeEventListenet the results will be that the event
|
|
1485
|
-
// won't get removed even if the component is unmounted.
|
|
1486
|
-
const attachedFunction = throttle(updateClientWidth, throttleMs);
|
|
1487
|
-
window.addEventListener('resize', attachedFunction, true);
|
|
1488
|
-
// using requestAnimationFrame to perform the calculation before the next repaint
|
|
1489
|
-
// getting width earlier causes issues in animations when used with react-transition-group
|
|
1490
|
-
window.requestAnimationFrame(updateClientWidth);
|
|
1491
|
-
return () => window.removeEventListener('resize', attachedFunction, true);
|
|
1492
|
-
}, []);
|
|
1493
|
-
return [clientWidth];
|
|
1494
|
-
};
|
|
1495
|
-
useClientWidth.THROTTLE_MS = THROTTLE_MS;
|
|
1496
|
-
|
|
1497
1461
|
const useConditionalListener = ({
|
|
1498
1462
|
attachListener,
|
|
1499
1463
|
callback,
|
|
@@ -4814,49 +4778,41 @@ const FlowNavigation = ({
|
|
|
4814
4778
|
onGoBack,
|
|
4815
4779
|
steps
|
|
4816
4780
|
}) => {
|
|
4817
|
-
const reference = useRef(null);
|
|
4818
4781
|
const intl = useIntl();
|
|
4819
|
-
const [clientWidth] = useClientWidth({
|
|
4820
|
-
ref: reference
|
|
4821
|
-
});
|
|
4822
4782
|
const closeButton = onClose != null && /*#__PURE__*/jsx(CloseButton, {
|
|
4823
4783
|
size: "lg",
|
|
4824
4784
|
onClick: onClose
|
|
4825
4785
|
});
|
|
4826
|
-
const
|
|
4827
|
-
const
|
|
4786
|
+
const screenSm = useScreenSize(Breakpoint.SMALL);
|
|
4787
|
+
const screenLg = useScreenSize(Breakpoint.LARGE);
|
|
4828
4788
|
const newAvatar = done ? null : avatar;
|
|
4829
4789
|
const displayGoBack = onGoBack != null && activeStep > 0;
|
|
4830
4790
|
return /*#__PURE__*/jsx("div", {
|
|
4831
|
-
ref: reference,
|
|
4832
4791
|
className: classNames('np-flow-navigation d-flex align-items-center justify-content-center p-y-3', {
|
|
4833
4792
|
'np-flow-navigation--border-bottom': !done
|
|
4834
4793
|
}),
|
|
4835
4794
|
children: /*#__PURE__*/jsx(FlowHeader, {
|
|
4836
|
-
className: classNames('np-flow-navigation__content p-x-3', {
|
|
4837
|
-
'np-flow-navigation--
|
|
4838
|
-
'np-flow-navigation--xs-max': isSmall,
|
|
4795
|
+
className: classNames('np-flow-navigation__content p-x-3', screenSm == null ? 'np-flow-navigation--hidden' : {
|
|
4796
|
+
'np-flow-navigation--xs-max': !screenSm,
|
|
4839
4797
|
// Size switches on parent container which may or may not have the same size as the window.
|
|
4840
|
-
'np-flow-navigation--sm':
|
|
4841
|
-
'np-flow-navigation--lg':
|
|
4798
|
+
'np-flow-navigation--sm': screenSm,
|
|
4799
|
+
'np-flow-navigation--lg': screenLg
|
|
4842
4800
|
}),
|
|
4843
4801
|
leftContent: /*#__PURE__*/jsxs(Fragment, {
|
|
4844
|
-
children: [
|
|
4802
|
+
children: [!screenSm && displayGoBack ? /*#__PURE__*/jsx(BackButton$1, {
|
|
4845
4803
|
"aria-label": intl.formatMessage(messages$7.back),
|
|
4846
4804
|
onClick: onGoBack
|
|
4847
4805
|
}) : /*#__PURE__*/jsx("div", {
|
|
4848
4806
|
className: "np-flow-header__left",
|
|
4849
4807
|
children: logo
|
|
4850
|
-
}),
|
|
4808
|
+
}), !screenSm && /*#__PURE__*/jsx(AnimatedLabel, {
|
|
4851
4809
|
className: "m-x-1",
|
|
4852
4810
|
labels: steps.map(step => step.label),
|
|
4853
4811
|
activeLabel: activeStep
|
|
4854
4812
|
})]
|
|
4855
4813
|
}),
|
|
4856
4814
|
rightContent: /*#__PURE__*/jsxs("div", {
|
|
4857
|
-
className:
|
|
4858
|
-
'order-2': isLarge
|
|
4859
|
-
}),
|
|
4815
|
+
className: "np-flow-header__right d-flex align-items-center justify-content-end order-2--lg",
|
|
4860
4816
|
children: [newAvatar, newAvatar && closeButton && /*#__PURE__*/jsx("span", {
|
|
4861
4817
|
className: "m-x-1"
|
|
4862
4818
|
}), closeButton]
|
|
@@ -4866,7 +4822,7 @@ const FlowNavigation = ({
|
|
|
4866
4822
|
steps: steps,
|
|
4867
4823
|
className: classNames('np-flow-navigation__stepper')
|
|
4868
4824
|
}),
|
|
4869
|
-
layout:
|
|
4825
|
+
layout: !screenLg ? Layout.VERTICAL : Layout.HORIZONTAL
|
|
4870
4826
|
})
|
|
4871
4827
|
});
|
|
4872
4828
|
};
|
|
@@ -13600,7 +13556,7 @@ var hu = {
|
|
|
13600
13556
|
"neptune.Upload.psProcessingText": "Feltöltés...",
|
|
13601
13557
|
"neptune.Upload.usButtonText": "Vagy válaszd ki a fájlt",
|
|
13602
13558
|
"neptune.Upload.usDropMessage": "Húzd ide a fájlokat a feltöltéshez",
|
|
13603
|
-
"neptune.Upload.usPlaceholder": "Húzz ide egy legfeljebb {maxSize}
|
|
13559
|
+
"neptune.Upload.usPlaceholder": "Húzz ide egy legfeljebb {maxSize}MB méretű fájlt",
|
|
13604
13560
|
"neptune.UploadButton.allFileTypes": "Összes fájltípus",
|
|
13605
13561
|
"neptune.UploadButton.dropFiles": "Húzd a fájlokat ide a feltöltéshez",
|
|
13606
13562
|
"neptune.UploadButton.instructions": "{fileTypes}, legfeljebb {size}MB",
|