@transferwise/components 0.0.0-experimental-9b30760 → 0.0.0-experimental-683a8ba
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.esm.js +110 -114
- package/build/index.esm.js.map +1 -1
- package/build/index.js +110 -114
- package/build/index.js.map +1 -1
- package/build/types/circularButton/CircularButton.d.ts +2 -2
- package/build/types/circularButton/CircularButton.d.ts.map +1 -1
- package/build/types/common/bottomSheet/BottomSheet.d.ts.map +1 -1
- package/build/types/common/textFormat/formatWithPattern/index.d.ts +1 -1
- package/build/types/common/textFormat/formatWithPattern/index.d.ts.map +1 -1
- package/build/types/common/textFormat/getCountOfSymbolsInSelection/getCountOfSymbolsInSelection.d.ts +1 -1
- package/build/types/common/textFormat/getCountOfSymbolsInSelection/getCountOfSymbolsInSelection.d.ts.map +1 -1
- package/build/types/common/textFormat/getCountOfSymbolsInSelection/index.d.ts +1 -1
- package/build/types/common/textFormat/getCountOfSymbolsInSelection/index.d.ts.map +1 -1
- package/build/types/common/textFormat/getCursorPositionAfterKeystroke/index.d.ts +1 -1
- package/build/types/common/textFormat/getCursorPositionAfterKeystroke/index.d.ts.map +1 -1
- package/build/types/common/textFormat/getDistanceToSymbol/getDistanceToSymbol.d.ts +2 -2
- package/build/types/common/textFormat/getDistanceToSymbol/getDistanceToSymbol.d.ts.map +1 -1
- package/build/types/common/textFormat/getDistanceToSymbol/index.d.ts +1 -1
- package/build/types/common/textFormat/getDistanceToSymbol/index.d.ts.map +1 -1
- package/build/types/common/textFormat/getSymbolsInPatternWithPosition/index.d.ts +1 -1
- package/build/types/common/textFormat/getSymbolsInPatternWithPosition/index.d.ts.map +1 -1
- package/build/types/common/textFormat/index.d.ts +7 -6
- package/build/types/common/textFormat/index.d.ts.map +1 -1
- package/build/types/common/textFormat/unformatWithPattern/index.d.ts +1 -1
- package/build/types/common/textFormat/unformatWithPattern/index.d.ts.map +1 -1
- package/build/types/index.d.ts +1 -1
- package/build/types/index.d.ts.map +1 -1
- package/build/types/info/Info.d.ts +2 -3
- package/build/types/info/Info.d.ts.map +1 -1
- package/build/types/logo/Logo.d.ts.map +1 -1
- package/build/types/popover/Popover.d.ts +21 -16
- package/build/types/popover/Popover.d.ts.map +1 -1
- package/build/types/popover/index.d.ts +1 -2
- package/build/types/popover/index.d.ts.map +1 -1
- package/build/types/slidingPanel/SlidingPanel.d.ts +12 -17
- package/build/types/slidingPanel/SlidingPanel.d.ts.map +1 -1
- package/build/types/slidingPanel/index.d.ts +2 -1
- package/build/types/slidingPanel/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/circularButton/CircularButton.tsx +2 -2
- package/src/common/bottomSheet/BottomSheet.tsx +47 -41
- package/src/common/bottomSheet/__snapshots__/BottomSheet.spec.tsx.snap +37 -33
- package/src/common/textFormat/getCountOfSymbolsInSelection/{getCountOfSymbolsInSelection.js → getCountOfSymbolsInSelection.ts} +5 -1
- package/src/common/textFormat/getCursorPositionAfterKeystroke/{getCursorPositionAfterKeystroke.spec.js → getCursorPositionAfterKeystroke.spec.ts} +15 -18
- package/src/common/textFormat/getDistanceToSymbol/{getDistanceToSymbol.spec.js → getDistanceToSymbol.spec.ts} +3 -3
- package/src/common/textFormat/getDistanceToSymbol/{getDistanceToSymbol.js → getDistanceToSymbol.ts} +8 -3
- package/src/index.ts +1 -1
- package/src/info/Info.tsx +2 -2
- package/src/logo/Logo.js +1 -0
- package/src/logo/__snapshots__/Logo.spec.js.snap +6 -0
- package/src/popover/Popover.js +101 -0
- package/src/popover/{Popover.spec.tsx → Popover.spec.js} +2 -5
- package/src/popover/index.js +1 -0
- package/src/select/Select.spec.js +1 -1
- package/src/slidingPanel/SlidingPanel.spec.js +9 -19
- package/src/slidingPanel/SlidingPanel.tsx +62 -0
- package/src/slidingPanel/index.ts +2 -0
- package/src/sticky/Sticky.spec.js +0 -1
- package/src/popover/Popover.tsx +0 -106
- package/src/popover/index.ts +0 -2
- package/src/slidingPanel/SlidingPanel.js +0 -73
- package/src/slidingPanel/index.js +0 -1
- /package/src/common/textFormat/formatWithPattern/{formatWithPattern.spec.js → formatWithPattern.spec.ts} +0 -0
- /package/src/common/textFormat/formatWithPattern/{index.js → index.ts} +0 -0
- /package/src/common/textFormat/getCountOfSymbolsInSelection/{getCountOfSymbolsInSelection.spec.js → getCountOfSymbolsInSelection.spec.ts} +0 -0
- /package/src/common/textFormat/getCountOfSymbolsInSelection/{index.js → index.ts} +0 -0
- /package/src/common/textFormat/getCursorPositionAfterKeystroke/{index.js → index.ts} +0 -0
- /package/src/common/textFormat/getDistanceToSymbol/{index.js → index.ts} +0 -0
- /package/src/common/textFormat/getSymbolsInPatternWithPosition/{getSymbolsInPatternWithPosition.spec.js → getSymbolsInPatternWithPosition.spec.ts} +0 -0
- /package/src/common/textFormat/getSymbolsInPatternWithPosition/{index.js → index.ts} +0 -0
- /package/src/common/textFormat/{index.js → index.ts} +0 -0
- /package/src/common/textFormat/unformatWithPattern/{index.js → index.ts} +0 -0
- /package/src/common/textFormat/unformatWithPattern/{unformatWithPattern.spec.js → unformatWithPattern.spec.ts} +0 -0
- /package/src/popover/{Popover.story.tsx → Popover.story.js} +0 -0
- /package/src/popover/__snapshots__/{Popover.spec.tsx.snap → Popover.spec.js.snap} +0 -0
- /package/src/slidingPanel/{SlidingPanel.story.js → SlidingPanel.story.tsx} +0 -0
package/build/index.esm.js
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, useRef, useMemo, useEffect, useCallback, useLayoutEffect, createContext, useContext, createElement, Component, PureComponent, createRef,
|
|
4
|
+
import React__default, { forwardRef, cloneElement, useState, useRef, useMemo, useEffect, useCallback, useLayoutEffect, createContext, useContext, createElement, Component, PureComponent, createRef, 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$2, ClockBorderless, CheckCircle, InfoCircle, Warning, CrossCircle, Clock, Briefcase, Person, ArrowLeft, QuestionMarkCircle, AlertCircle, Search, 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';
|
|
@@ -816,7 +816,7 @@ const StatusIcon = ({
|
|
|
816
816
|
});
|
|
817
817
|
};
|
|
818
818
|
|
|
819
|
-
function logActionRequired$
|
|
819
|
+
function logActionRequired$2(message) {
|
|
820
820
|
if (['development', 'test'].includes(process?.env?.NODE_ENV)) {
|
|
821
821
|
// eslint-disable-next-line no-console
|
|
822
822
|
console.warn(message);
|
|
@@ -824,7 +824,7 @@ function logActionRequired$1(message) {
|
|
|
824
824
|
}
|
|
825
825
|
function logActionRequiredIf(message, conditional) {
|
|
826
826
|
if (conditional) {
|
|
827
|
-
logActionRequired$
|
|
827
|
+
logActionRequired$2(message);
|
|
828
828
|
}
|
|
829
829
|
}
|
|
830
830
|
|
|
@@ -855,7 +855,7 @@ const deprecated = (validator, {
|
|
|
855
855
|
}) => (props, propertyName, ...rest) => {
|
|
856
856
|
const newPropertyMessage = newProperty ? `Please use ${newProperty} instead.` : message;
|
|
857
857
|
if (props[propertyName] != null && typeof props[propertyName] !== 'undefined') {
|
|
858
|
-
logActionRequired$
|
|
858
|
+
logActionRequired$2(deprecatedMessage({
|
|
859
859
|
component,
|
|
860
860
|
propName: propertyName,
|
|
861
861
|
message: newPropertyMessage,
|
|
@@ -884,7 +884,7 @@ function Markdown({
|
|
|
884
884
|
}
|
|
885
885
|
const linkTarget = config?.link?.target ?? '_self';
|
|
886
886
|
if (allowList != null && blockList != null) {
|
|
887
|
-
logActionRequired$
|
|
887
|
+
logActionRequired$2('Markdown supports only one of `allowList` or `blockList` to be used at a time. `blockList` will be ignored.');
|
|
888
888
|
}
|
|
889
889
|
const parser = nodes => {
|
|
890
890
|
const parsed = reader.parse(nodes);
|
|
@@ -1036,7 +1036,7 @@ const Alert = props => {
|
|
|
1036
1036
|
...props
|
|
1037
1037
|
});
|
|
1038
1038
|
}
|
|
1039
|
-
logActionRequired(props);
|
|
1039
|
+
logActionRequired$1(props);
|
|
1040
1040
|
const mappedType = deprecatedTypeMap$1[type] || type;
|
|
1041
1041
|
const Icon = iconTypeMap[mappedType];
|
|
1042
1042
|
function generateIcon() {
|
|
@@ -1119,7 +1119,7 @@ const deprecatedTypeMapMessage$1 = {
|
|
|
1119
1119
|
[Sentiment.ERROR]: 'Sentiment.NEGATIVE'
|
|
1120
1120
|
};
|
|
1121
1121
|
const deprecatedTypes$1 = Object.keys(deprecatedTypeMap$1);
|
|
1122
|
-
function logActionRequired({
|
|
1122
|
+
function logActionRequired$1({
|
|
1123
1123
|
size,
|
|
1124
1124
|
type
|
|
1125
1125
|
}) {
|
|
@@ -1768,15 +1768,14 @@ const useLayout = () => {
|
|
|
1768
1768
|
|
|
1769
1769
|
const EXIT_ANIMATION = 350;
|
|
1770
1770
|
const SlidingPanel = /*#__PURE__*/forwardRef(({
|
|
1771
|
-
|
|
1772
|
-
className,
|
|
1771
|
+
position = 'left',
|
|
1773
1772
|
open,
|
|
1774
|
-
position,
|
|
1775
1773
|
showSlidingPanelBorder,
|
|
1776
1774
|
slidingPanelPositionFixed,
|
|
1775
|
+
className,
|
|
1776
|
+
children,
|
|
1777
1777
|
...rest
|
|
1778
1778
|
}, reference) => {
|
|
1779
|
-
/** @type {RefObject<HTMLDivElement>} */
|
|
1780
1779
|
const localReference = useRef(null);
|
|
1781
1780
|
return /*#__PURE__*/createElement(CSSTransition, {
|
|
1782
1781
|
...rest,
|
|
@@ -1789,34 +1788,15 @@ const SlidingPanel = /*#__PURE__*/forwardRef(({
|
|
|
1789
1788
|
enter: 0,
|
|
1790
1789
|
exit: EXIT_ANIMATION
|
|
1791
1790
|
},
|
|
1792
|
-
classNames:
|
|
1793
|
-
'sliding-panel--fixed': slidingPanelPositionFixed
|
|
1794
|
-
}, 'sliding-panel'),
|
|
1791
|
+
classNames: "sliding-panel",
|
|
1795
1792
|
appear: true,
|
|
1796
1793
|
unmountOnExit: true
|
|
1797
1794
|
}, /*#__PURE__*/jsx("div", {
|
|
1798
1795
|
ref: mergeRefs([reference, localReference]),
|
|
1799
|
-
className: classNames('sliding-panel', `sliding-panel--open-${position}`, className),
|
|
1796
|
+
className: classNames('sliding-panel', `sliding-panel--open-${position}`, showSlidingPanelBorder && `sliding-panel--border-${position}`, slidingPanelPositionFixed && 'sliding-panel--fixed', className),
|
|
1800
1797
|
children: children
|
|
1801
1798
|
}));
|
|
1802
1799
|
});
|
|
1803
|
-
SlidingPanel.propTypes = {
|
|
1804
|
-
children: PropTypes.node,
|
|
1805
|
-
className: PropTypes.string,
|
|
1806
|
-
open: PropTypes.bool,
|
|
1807
|
-
position: PropTypes.oneOf(['top', 'bottom', 'left', 'right']),
|
|
1808
|
-
showSlidingPanelBorder: PropTypes.bool,
|
|
1809
|
-
slidingPanelPositionFixed: PropTypes.bool
|
|
1810
|
-
};
|
|
1811
|
-
SlidingPanel.defaultProps = {
|
|
1812
|
-
children: null,
|
|
1813
|
-
className: undefined,
|
|
1814
|
-
open: false,
|
|
1815
|
-
position: 'left',
|
|
1816
|
-
showSlidingPanelBorder: false,
|
|
1817
|
-
slidingPanelPositionFixed: false
|
|
1818
|
-
};
|
|
1819
|
-
var SlidingPanel$1 = SlidingPanel;
|
|
1820
1800
|
|
|
1821
1801
|
const Drawer = ({
|
|
1822
1802
|
children,
|
|
@@ -1835,7 +1815,7 @@ const Drawer = ({
|
|
|
1835
1815
|
return /*#__PURE__*/jsx(Dimmer$1, {
|
|
1836
1816
|
open: open,
|
|
1837
1817
|
onClose: onClose,
|
|
1838
|
-
children: /*#__PURE__*/jsx(SlidingPanel
|
|
1818
|
+
children: /*#__PURE__*/jsx(SlidingPanel, {
|
|
1839
1819
|
open: open,
|
|
1840
1820
|
position: isMobile ? Position.BOTTOM : position,
|
|
1841
1821
|
children: /*#__PURE__*/jsxs("div", {
|
|
@@ -1952,15 +1932,15 @@ const BottomSheet$1 = props => {
|
|
|
1952
1932
|
props.onClose(event);
|
|
1953
1933
|
}
|
|
1954
1934
|
}
|
|
1955
|
-
const onSwipeStart =
|
|
1956
|
-
initialYCoordinate.current = (
|
|
1935
|
+
const onSwipeStart = event => {
|
|
1936
|
+
initialYCoordinate.current = ('touches' in event ? event.touches[0] : event).clientY;
|
|
1957
1937
|
setPressed(true);
|
|
1958
1938
|
};
|
|
1959
|
-
const onSwipeMove =
|
|
1939
|
+
const onSwipeMove = event => {
|
|
1960
1940
|
if (pressed) {
|
|
1961
1941
|
const {
|
|
1962
1942
|
clientY
|
|
1963
|
-
} =
|
|
1943
|
+
} = 'touches' in event ? event.touches[0] : event;
|
|
1964
1944
|
const offset = calculateOffsetAfterMove(clientY);
|
|
1965
1945
|
// check whether move is to the bottom only and content scroll position is at the top
|
|
1966
1946
|
if (offset > INITIAL_Y_POSITION && isContentScrollPositionAtTop()) {
|
|
@@ -2029,34 +2009,37 @@ const BottomSheet$1 = props => {
|
|
|
2029
2009
|
fadeContentOnEnter: true,
|
|
2030
2010
|
fadeContentOnExit: true,
|
|
2031
2011
|
onClose: close,
|
|
2032
|
-
children: /*#__PURE__*/
|
|
2012
|
+
children: /*#__PURE__*/jsx(SlidingPanel, {
|
|
2033
2013
|
ref: bottomSheetReference,
|
|
2034
2014
|
open: props.open,
|
|
2035
2015
|
position: Position.BOTTOM,
|
|
2036
2016
|
className: classNames('np-bottom-sheet', props.className),
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
className: "np-bottom-sheet--
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2017
|
+
children: /*#__PURE__*/jsxs("div", {
|
|
2018
|
+
role: "dialog",
|
|
2019
|
+
"aria-modal": true,
|
|
2020
|
+
onTouchStart: onSwipeStart,
|
|
2021
|
+
onTouchMove: onSwipeMove,
|
|
2022
|
+
onTouchEnd: onSwipeEnd,
|
|
2023
|
+
onMouseDown: onSwipeStart,
|
|
2024
|
+
onMouseMove: onSwipeMove,
|
|
2025
|
+
onMouseUp: onSwipeEnd,
|
|
2026
|
+
children: [/*#__PURE__*/jsxs("div", {
|
|
2027
|
+
ref: topBarReference,
|
|
2028
|
+
className: "np-bottom-sheet--top-bar",
|
|
2029
|
+
children: [/*#__PURE__*/jsx("div", {
|
|
2030
|
+
className: "np-bottom-sheet--handler"
|
|
2031
|
+
}), /*#__PURE__*/jsx(CloseButton, {
|
|
2032
|
+
size: "sm",
|
|
2033
|
+
className: "sr-only np-bottom-sheet--close-btn",
|
|
2034
|
+
onClick: close
|
|
2035
|
+
})]
|
|
2036
|
+
}), /*#__PURE__*/jsx("div", {
|
|
2037
|
+
ref: contentReference,
|
|
2038
|
+
style: setContentMaxHeight(),
|
|
2039
|
+
className: "np-bottom-sheet--content",
|
|
2040
|
+
children: props.children
|
|
2053
2041
|
})]
|
|
2054
|
-
})
|
|
2055
|
-
ref: contentReference,
|
|
2056
|
-
style: setContentMaxHeight(),
|
|
2057
|
-
className: "np-bottom-sheet--content",
|
|
2058
|
-
children: props.children
|
|
2059
|
-
})]
|
|
2042
|
+
})
|
|
2060
2043
|
})
|
|
2061
2044
|
});
|
|
2062
2045
|
};
|
|
@@ -5252,6 +5235,7 @@ const Logo = ({
|
|
|
5252
5235
|
const LogoMd = svgPaths[`${type}${inverse ? '_INVERSE' : ''}`];
|
|
5253
5236
|
return /*#__PURE__*/jsxs("span", {
|
|
5254
5237
|
"aria-label": type === LogoType.WISE ? 'Wise' : 'Wise business',
|
|
5238
|
+
role: "img",
|
|
5255
5239
|
className: classNames(className, 'np-logo'),
|
|
5256
5240
|
children: [/*#__PURE__*/jsx(LogoSm, {
|
|
5257
5241
|
className: "np-logo-svg np-logo-svg--size-sm"
|
|
@@ -5775,31 +5759,17 @@ const Modal = ({
|
|
|
5775
5759
|
});
|
|
5776
5760
|
};
|
|
5777
5761
|
|
|
5778
|
-
|
|
5779
|
-
switch (preferredPlacement) {
|
|
5780
|
-
case 'left-top':
|
|
5781
|
-
case 'right-top':
|
|
5782
|
-
return 'top';
|
|
5783
|
-
case 'bottom-left':
|
|
5784
|
-
case 'bottom-right':
|
|
5785
|
-
return 'bottom';
|
|
5786
|
-
}
|
|
5787
|
-
return preferredPlacement;
|
|
5788
|
-
}
|
|
5789
|
-
function Popover$1({
|
|
5762
|
+
const Popover$1 = ({
|
|
5790
5763
|
children,
|
|
5791
5764
|
className,
|
|
5792
5765
|
content,
|
|
5793
|
-
preferredPlacement
|
|
5766
|
+
preferredPlacement,
|
|
5794
5767
|
title,
|
|
5795
5768
|
onClose
|
|
5796
|
-
}) {
|
|
5797
|
-
|
|
5798
|
-
|
|
5799
|
-
|
|
5800
|
-
logActionRequired$1(`Popover has deprecated ${preferredPlacement} value for the 'preferredPlacement' prop. Please use ${resolvedPlacement} instead.`);
|
|
5801
|
-
}
|
|
5802
|
-
}, [preferredPlacement, resolvedPlacement]);
|
|
5769
|
+
}) => {
|
|
5770
|
+
logActionRequired({
|
|
5771
|
+
preferredPlacement
|
|
5772
|
+
});
|
|
5803
5773
|
const anchorReference = useRef(null);
|
|
5804
5774
|
const [open, setOpen] = useState(false);
|
|
5805
5775
|
const {
|
|
@@ -5814,16 +5784,18 @@ function Popover$1({
|
|
|
5814
5784
|
children: [/*#__PURE__*/jsx("span", {
|
|
5815
5785
|
ref: anchorReference,
|
|
5816
5786
|
className: "d-inline-block",
|
|
5817
|
-
children: /*#__PURE__*/
|
|
5787
|
+
children: /*#__PURE__*/cloneElement(children, {
|
|
5818
5788
|
onClick: () => {
|
|
5819
|
-
children
|
|
5820
|
-
|
|
5789
|
+
if (children?.props?.onClick) {
|
|
5790
|
+
children.props.onClick();
|
|
5791
|
+
}
|
|
5792
|
+
setOpen(!open);
|
|
5821
5793
|
}
|
|
5822
|
-
})
|
|
5794
|
+
})
|
|
5823
5795
|
}), /*#__PURE__*/jsx(ResponsivePanel$1, {
|
|
5824
5796
|
open: open,
|
|
5825
5797
|
anchorRef: anchorReference,
|
|
5826
|
-
position:
|
|
5798
|
+
position: deprecatedPlacements[preferredPlacement] || preferredPlacement,
|
|
5827
5799
|
arrow: true,
|
|
5828
5800
|
className: "np-popover__container",
|
|
5829
5801
|
onClose: handleOnClose,
|
|
@@ -5839,7 +5811,36 @@ function Popover$1({
|
|
|
5839
5811
|
})
|
|
5840
5812
|
})]
|
|
5841
5813
|
});
|
|
5842
|
-
}
|
|
5814
|
+
};
|
|
5815
|
+
const logActionRequired = ({
|
|
5816
|
+
preferredPlacement
|
|
5817
|
+
}) => {
|
|
5818
|
+
logActionRequiredIf(`Popover has deprecated ${preferredPlacement} value for the 'preferredPlacement' prop. Please use ${deprecatedPlacements[preferredPlacement]} instead.`, deprecatedPlacements[preferredPlacement]);
|
|
5819
|
+
};
|
|
5820
|
+
Popover$1.defaultProps = {
|
|
5821
|
+
className: undefined,
|
|
5822
|
+
preferredPlacement: Position.RIGHT,
|
|
5823
|
+
title: undefined
|
|
5824
|
+
};
|
|
5825
|
+
Popover$1.propTypes = {
|
|
5826
|
+
children: PropTypes.node.isRequired,
|
|
5827
|
+
className: PropTypes.string,
|
|
5828
|
+
content: PropTypes.node.isRequired,
|
|
5829
|
+
/**
|
|
5830
|
+
* `'left-top'` / `'right-top'` are deprecated use `Position.TOP` / `'top'` instead,
|
|
5831
|
+
* `'bottom-right'` / `'bottom-left'` are deprecated use `Position.BOTTOM` / `'bottom'` instead
|
|
5832
|
+
*/
|
|
5833
|
+
preferredPlacement: PropTypes.oneOf(['top', 'right', 'bottom', 'left', 'left-top', 'right-top', 'bottom-right', 'bottom-left']),
|
|
5834
|
+
onClose: PropTypes.func,
|
|
5835
|
+
title: PropTypes.node
|
|
5836
|
+
};
|
|
5837
|
+
const deprecatedPlacements = {
|
|
5838
|
+
[Position.BOTTOM_LEFT]: Position.BOTTOM,
|
|
5839
|
+
[Position.BOTTOM_RIGHT]: Position.BOTTOM,
|
|
5840
|
+
[Position.LEFT_TOP]: Position.TOP,
|
|
5841
|
+
[Position.RIGHT_TOP]: Position.TOP
|
|
5842
|
+
};
|
|
5843
|
+
var Popover$2 = Popover$1;
|
|
5843
5844
|
|
|
5844
5845
|
var messages$6 = defineMessages({
|
|
5845
5846
|
ariaLabel: {
|
|
@@ -5890,7 +5891,7 @@ const Info = ({
|
|
|
5890
5891
|
title: title,
|
|
5891
5892
|
onClose: () => setOpen(false)
|
|
5892
5893
|
})]
|
|
5893
|
-
}) : /*#__PURE__*/jsx(Popover$
|
|
5894
|
+
}) : /*#__PURE__*/jsx(Popover$2, {
|
|
5894
5895
|
content: content,
|
|
5895
5896
|
preferredPlacement: preferredPlacement,
|
|
5896
5897
|
title: title,
|
|
@@ -6946,14 +6947,13 @@ const getSymbolsInPatternWithPosition = pattern => {
|
|
|
6946
6947
|
});
|
|
6947
6948
|
return patternWithSymbolsPosition;
|
|
6948
6949
|
};
|
|
6949
|
-
var getSymbolsInPatternWithPosition$1 = getSymbolsInPatternWithPosition;
|
|
6950
6950
|
|
|
6951
6951
|
const formatWithPattern = (value, pattern) => {
|
|
6952
6952
|
if (!value || value === '') {
|
|
6953
6953
|
return '';
|
|
6954
6954
|
}
|
|
6955
6955
|
const valueArray = value.toString().split('');
|
|
6956
|
-
const patternWithSymbolsPosition = getSymbolsInPatternWithPosition
|
|
6956
|
+
const patternWithSymbolsPosition = getSymbolsInPatternWithPosition(pattern);
|
|
6957
6957
|
let patternSymbol = [];
|
|
6958
6958
|
// valueArray.length increments during the cycle cause we are adding new elements.
|
|
6959
6959
|
for (let index = 0; index < valueArray.length; index += 1) {
|
|
@@ -6968,7 +6968,6 @@ const formatWithPattern = (value, pattern) => {
|
|
|
6968
6968
|
}
|
|
6969
6969
|
return valueArray.join('');
|
|
6970
6970
|
};
|
|
6971
|
-
var formatWithPattern$1 = formatWithPattern;
|
|
6972
6971
|
|
|
6973
6972
|
const unformatWithPattern = (value, pattern) => {
|
|
6974
6973
|
let valueArray = [''];
|
|
@@ -6979,18 +6978,16 @@ const unformatWithPattern = (value, pattern) => {
|
|
|
6979
6978
|
return valueArray.join('');
|
|
6980
6979
|
};
|
|
6981
6980
|
const getSymbolsInPattern = pattern => pattern.split('').filter(symbol => symbol !== '*');
|
|
6982
|
-
var unformatWithPattern$1 = unformatWithPattern;
|
|
6983
6981
|
|
|
6984
|
-
const getCountOfSymbolsInSelection = (selectionStart, selectionEnd, pattern) => getSymbolsInPatternWithPosition
|
|
6985
|
-
var getCountOfSymbolsInSelection$1 = getCountOfSymbolsInSelection;
|
|
6982
|
+
const getCountOfSymbolsInSelection = (selectionStart, selectionEnd, pattern) => getSymbolsInPatternWithPosition(pattern).filter(symbol => symbol.index >= selectionStart && symbol.index < selectionEnd).length;
|
|
6986
6983
|
|
|
6987
6984
|
const getDistanceToNextSymbol = (selectionStart, pattern) => {
|
|
6988
|
-
const patternArray = getSymbolsInPatternWithPosition
|
|
6985
|
+
const patternArray = getSymbolsInPatternWithPosition(pattern);
|
|
6989
6986
|
const applicablePattern = patternArray.filter(symbol => symbol.index >= selectionStart);
|
|
6990
6987
|
return countConsecutiveSymbols(selectionStart, applicablePattern, 'left');
|
|
6991
6988
|
};
|
|
6992
6989
|
const getDistanceToPreviousSymbol = (selectionStart, pattern) => {
|
|
6993
|
-
const patternArray = getSymbolsInPatternWithPosition
|
|
6990
|
+
const patternArray = getSymbolsInPatternWithPosition(pattern);
|
|
6994
6991
|
const applicablePattern = patternArray.filter(symbol => symbol.index < selectionStart).reverse();
|
|
6995
6992
|
return countConsecutiveSymbols(selectionStart, applicablePattern, 'right');
|
|
6996
6993
|
};
|
|
@@ -7020,7 +7017,7 @@ const getCursorPositionAfterActionStroke = (action, selectionStart, selectionEnd
|
|
|
7020
7017
|
}
|
|
7021
7018
|
break;
|
|
7022
7019
|
case 'Paste':
|
|
7023
|
-
cursorPosition += pastedLength + getCountOfSymbolsInSelection
|
|
7020
|
+
cursorPosition += pastedLength + getCountOfSymbolsInSelection(selectionStart, selectionStart + pastedLength, pattern) + getDistanceToNextSymbol(selectionStart + pastedLength, pattern);
|
|
7024
7021
|
break;
|
|
7025
7022
|
case 'Cut':
|
|
7026
7023
|
case 'Delete':
|
|
@@ -7031,7 +7028,6 @@ const getCursorPositionAfterActionStroke = (action, selectionStart, selectionEnd
|
|
|
7031
7028
|
}
|
|
7032
7029
|
return cursorPosition;
|
|
7033
7030
|
};
|
|
7034
|
-
var getCursorPositionAfterKeystroke = getCursorPositionAfterActionStroke;
|
|
7035
7031
|
|
|
7036
7032
|
class WithDisplayFormat extends Component {
|
|
7037
7033
|
static defaultProps = {
|
|
@@ -7041,9 +7037,9 @@ class WithDisplayFormat extends Component {
|
|
|
7041
7037
|
};
|
|
7042
7038
|
constructor(props) {
|
|
7043
7039
|
super(props);
|
|
7044
|
-
const unformattedValue = unformatWithPattern
|
|
7040
|
+
const unformattedValue = unformatWithPattern(props.value ?? '', props.displayPattern);
|
|
7045
7041
|
this.state = {
|
|
7046
|
-
value: formatWithPattern
|
|
7042
|
+
value: formatWithPattern(unformattedValue, props.displayPattern),
|
|
7047
7043
|
historyNavigator: new HistoryNavigator$1(),
|
|
7048
7044
|
prevDisplayPattern: props.displayPattern,
|
|
7049
7045
|
triggerType: 'Initial',
|
|
@@ -7061,11 +7057,11 @@ class WithDisplayFormat extends Component {
|
|
|
7061
7057
|
historyNavigator
|
|
7062
7058
|
}) {
|
|
7063
7059
|
if (prevDisplayPattern !== displayPattern) {
|
|
7064
|
-
const unFormattedValue = unformatWithPattern
|
|
7060
|
+
const unFormattedValue = unformatWithPattern(value, prevDisplayPattern);
|
|
7065
7061
|
historyNavigator.reset();
|
|
7066
7062
|
return {
|
|
7067
7063
|
prevDisplayPattern: displayPattern,
|
|
7068
|
-
value: formatWithPattern
|
|
7064
|
+
value: formatWithPattern(unFormattedValue, displayPattern),
|
|
7069
7065
|
triggerType: null,
|
|
7070
7066
|
triggerEvent: null,
|
|
7071
7067
|
pastedLength: 0
|
|
@@ -7095,7 +7091,7 @@ class WithDisplayFormat extends Component {
|
|
|
7095
7091
|
return 'Delete';
|
|
7096
7092
|
}
|
|
7097
7093
|
// Android Fix.
|
|
7098
|
-
if (typeof triggerEvent.key === 'undefined' && unformattedValue.length <= unformatWithPattern
|
|
7094
|
+
if (typeof triggerEvent.key === 'undefined' && unformattedValue.length <= unformatWithPattern(value, displayPattern).length) {
|
|
7099
7095
|
return 'Backspace';
|
|
7100
7096
|
}
|
|
7101
7097
|
return triggerEvent.key;
|
|
@@ -7133,13 +7129,13 @@ class WithDisplayFormat extends Component {
|
|
|
7133
7129
|
// Unfortunately Undo and Redo don't trigger OnChange event so we need to handle some value logic here.
|
|
7134
7130
|
let newFormattedValue = '';
|
|
7135
7131
|
if (this.detectUndoRedo(event) === 'Undo') {
|
|
7136
|
-
newFormattedValue = formatWithPattern
|
|
7132
|
+
newFormattedValue = formatWithPattern(historyNavigator.undo(), displayPattern);
|
|
7137
7133
|
this.setState({
|
|
7138
7134
|
value: newFormattedValue,
|
|
7139
7135
|
triggerType: 'Undo'
|
|
7140
7136
|
});
|
|
7141
7137
|
} else if (this.detectUndoRedo(event) === 'Redo') {
|
|
7142
|
-
newFormattedValue = formatWithPattern
|
|
7138
|
+
newFormattedValue = formatWithPattern(historyNavigator.redo(), displayPattern);
|
|
7143
7139
|
this.setState({
|
|
7144
7140
|
value: newFormattedValue,
|
|
7145
7141
|
triggerType: 'Redo'
|
|
@@ -7157,7 +7153,7 @@ class WithDisplayFormat extends Component {
|
|
|
7157
7153
|
const {
|
|
7158
7154
|
displayPattern
|
|
7159
7155
|
} = this.props;
|
|
7160
|
-
const pastedLength = unformatWithPattern
|
|
7156
|
+
const pastedLength = unformatWithPattern(event.clipboardData.getData('Text'), displayPattern).length;
|
|
7161
7157
|
this.setState({
|
|
7162
7158
|
triggerType: 'Paste',
|
|
7163
7159
|
pastedLength
|
|
@@ -7187,7 +7183,7 @@ class WithDisplayFormat extends Component {
|
|
|
7187
7183
|
const {
|
|
7188
7184
|
value
|
|
7189
7185
|
} = event.target;
|
|
7190
|
-
let unformattedValue = unformatWithPattern
|
|
7186
|
+
let unformattedValue = unformatWithPattern(value, displayPattern);
|
|
7191
7187
|
const action = this.getUserAction(unformattedValue);
|
|
7192
7188
|
if (!this.isKeyAllowed(action) || triggerType === 'Undo' || triggerType === 'Redo') {
|
|
7193
7189
|
return;
|
|
@@ -7195,7 +7191,7 @@ class WithDisplayFormat extends Component {
|
|
|
7195
7191
|
if (action === 'Backspace' || action === 'Delete') {
|
|
7196
7192
|
unformattedValue = this.handleDelete(unformattedValue, action);
|
|
7197
7193
|
}
|
|
7198
|
-
const newFormattedValue = formatWithPattern
|
|
7194
|
+
const newFormattedValue = formatWithPattern(unformattedValue, displayPattern);
|
|
7199
7195
|
historyNavigator.add(unformattedValue);
|
|
7200
7196
|
this.handleCursorPositioning(action);
|
|
7201
7197
|
this.setState({
|
|
@@ -7203,13 +7199,13 @@ class WithDisplayFormat extends Component {
|
|
|
7203
7199
|
}, () => {
|
|
7204
7200
|
this.resetEvent();
|
|
7205
7201
|
if (onChange) {
|
|
7206
|
-
const broadcastValue = unformatWithPattern
|
|
7202
|
+
const broadcastValue = unformatWithPattern(newFormattedValue, displayPattern);
|
|
7207
7203
|
onChange(broadcastValue);
|
|
7208
7204
|
}
|
|
7209
7205
|
});
|
|
7210
7206
|
};
|
|
7211
7207
|
handleOnBlur = event => {
|
|
7212
|
-
this.props.onBlur?.(unformatWithPattern
|
|
7208
|
+
this.props.onBlur?.(unformatWithPattern(event.target.value, this.props.displayPattern));
|
|
7213
7209
|
};
|
|
7214
7210
|
handleOnFocus = event => {
|
|
7215
7211
|
const {
|
|
@@ -7218,7 +7214,7 @@ class WithDisplayFormat extends Component {
|
|
|
7218
7214
|
} = this.props;
|
|
7219
7215
|
if (onFocus) {
|
|
7220
7216
|
this.handleOnChange(event);
|
|
7221
|
-
onFocus(unformatWithPattern
|
|
7217
|
+
onFocus(unformatWithPattern(event.target.value, displayPattern));
|
|
7222
7218
|
}
|
|
7223
7219
|
};
|
|
7224
7220
|
handleDelete = (unformattedValue, action) => {
|
|
@@ -7231,7 +7227,7 @@ class WithDisplayFormat extends Component {
|
|
|
7231
7227
|
} = this.state;
|
|
7232
7228
|
const newStack = [...unformattedValue];
|
|
7233
7229
|
if (selectionStart === selectionEnd) {
|
|
7234
|
-
let startPosition = selectionStart - getCountOfSymbolsInSelection
|
|
7230
|
+
let startPosition = selectionStart - getCountOfSymbolsInSelection(0, selectionStart, displayPattern);
|
|
7235
7231
|
let toDelete = 0;
|
|
7236
7232
|
let count = getDistanceToNextSymbol(selectionStart, displayPattern);
|
|
7237
7233
|
if (action === 'Backspace') {
|
|
@@ -7255,7 +7251,7 @@ class WithDisplayFormat extends Component {
|
|
|
7255
7251
|
selectionEnd,
|
|
7256
7252
|
pastedLength
|
|
7257
7253
|
} = this.state;
|
|
7258
|
-
const cursorPosition =
|
|
7254
|
+
const cursorPosition = getCursorPositionAfterActionStroke(action, selectionStart, selectionEnd, displayPattern, pastedLength);
|
|
7259
7255
|
setTimeout(() => {
|
|
7260
7256
|
if (triggerEvent) {
|
|
7261
7257
|
triggerEvent.target.setSelectionRange(cursorPosition, cursorPosition);
|
|
@@ -10968,7 +10964,7 @@ const Sticky = ({
|
|
|
10968
10964
|
open,
|
|
10969
10965
|
position,
|
|
10970
10966
|
children
|
|
10971
|
-
}) => /*#__PURE__*/jsx(SlidingPanel
|
|
10967
|
+
}) => /*#__PURE__*/jsx(SlidingPanel, {
|
|
10972
10968
|
open: open,
|
|
10973
10969
|
position: position,
|
|
10974
10970
|
slidingPanelPositionFixed: true,
|
|
@@ -15100,5 +15096,5 @@ const translations = {
|
|
|
15100
15096
|
'zh-HK': zhHK
|
|
15101
15097
|
};
|
|
15102
15098
|
|
|
15103
|
-
export { Accordion, ActionButton, ActionOption, Alert$1 as Alert, ArrowPosition as AlertArrowPosition, Avatar, AvatarType, AvatarWrapper, Badge, Card as BaseCard, Body, BottomSheet$2 as BottomSheet, Breakpoint, Button, Card$2 as Card, Checkbox$1 as Checkbox, CheckboxButton$1 as CheckboxButton, CheckboxOption, Chevron, Chip, Chips, CircularButton, ControlType, CriticalCommsBanner, DEFAULT_LANG, DEFAULT_LOCALE, DateInput, DateLookup$1 as DateLookup, DateMode, Decision, DecisionPresentation, DecisionType, DefinitionList$1 as DefinitionList, Dimmer$1 as Dimmer, Direction, DirectionProvider, Display, Drawer$1 as Drawer, DropFade, DynamicFieldDefinitionList$1 as DynamicFieldDefinitionList, Emphasis, FileType, FlowNavigation, Header, Image, Info, InfoPresentation, InlineAlert, Input, InputGroup, InputWithDisplayFormat, InstructionsList, LanguageProvider, Layout, Link, ListItem$1 as ListItem, Loader$1 as Loader, Logo$1 as Logo, LogoType, Markdown, MarkdownNodeType, Modal, Money$1 as Money, MoneyInput$1 as MoneyInput, MonthFormat, NavigationOption, NavigationOptionList$1 as NavigationOptionsList, Nudge, Option$2 as Option, OverlayHeader$1 as OverlayHeader, PhoneNumberInput, Popover$
|
|
15099
|
+
export { Accordion, ActionButton, ActionOption, Alert$1 as Alert, ArrowPosition as AlertArrowPosition, Avatar, AvatarType, AvatarWrapper, Badge, Card as BaseCard, Body, BottomSheet$2 as BottomSheet, Breakpoint, Button, Card$2 as Card, Checkbox$1 as Checkbox, CheckboxButton$1 as CheckboxButton, CheckboxOption, Chevron, Chip, Chips, CircularButton, ControlType, CriticalCommsBanner, DEFAULT_LANG, DEFAULT_LOCALE, DateInput, DateLookup$1 as DateLookup, DateMode, Decision, DecisionPresentation, DecisionType, DefinitionList$1 as DefinitionList, Dimmer$1 as Dimmer, Direction, DirectionProvider, Display, Drawer$1 as Drawer, DropFade, DynamicFieldDefinitionList$1 as DynamicFieldDefinitionList, Emphasis, FileType, FlowNavigation, Header, Image, Info, InfoPresentation, InlineAlert, Input, InputGroup, InputWithDisplayFormat, InstructionsList, LanguageProvider, Layout, Link, ListItem$1 as ListItem, Loader$1 as Loader, Logo$1 as Logo, LogoType, Markdown, MarkdownNodeType, Modal, Money$1 as Money, MoneyInput$1 as MoneyInput, MonthFormat, NavigationOption, NavigationOptionList$1 as NavigationOptionsList, Nudge, Option$2 as Option, OverlayHeader$1 as OverlayHeader, PhoneNumberInput, Popover$2 as Popover, Position, Priority, ProcessIndicator$1 as ProcessIndicator, ProfileType, Progress, ProgressBar, PromoCard$1 as PromoCard, PromoCard$1 as PromoCardGroup, Provider$1 as Provider, RTL_LANGUAGES, Radio, RadioGroup, RadioOption, SUPPORTED_LANGUAGES, Scroll, SearchInput, Section, SegmentedControl, Select, SelectInput, SelectInputOptionContent, SelectInputTriggerButton, Sentiment, Size, SlidingPanel, SnackbarConsumer, SnackbarContext, SnackbarPortal, SnackbarProvider, Status, StatusIcon, Stepper, Sticky$1 as Sticky, Summary, Switch, SwitchOption, Tabs$1 as Tabs, TextArea, TextareaWithDisplayFormat, Theme, Title, Tooltip$1 as Tooltip, Type, Typeahead, Typography, Upload$1 as Upload, UploadInput, UploadStep, Variant, Width, adjustLocale, getCountryFromLocale, getDirectionFromLocale, getLangFromLocale, isBrowser, isServerSide, translations, useDirection, useLayout, useScreenSize, useSnackbar };
|
|
15104
15100
|
//# sourceMappingURL=index.esm.js.map
|