@transferwise/components 46.19.0 → 46.20.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.esm.js +59 -84
- package/build/index.esm.js.map +1 -1
- package/build/index.js +58 -83
- package/build/index.js.map +1 -1
- package/build/types/common/panel/Panel.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 -0
- package/build/types/index.d.ts.map +1 -1
- package/build/types/info/Info.d.ts +3 -2
- 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 +16 -21
- package/build/types/popover/Popover.d.ts.map +1 -1
- package/build/types/popover/index.d.ts +2 -1
- package/build/types/popover/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/common/panel/Panel.tsx +1 -0
- 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 -0
- 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.spec.js → Popover.spec.tsx} +5 -2
- package/src/popover/Popover.tsx +101 -0
- package/src/popover/__snapshots__/{Popover.spec.js.snap → Popover.spec.tsx.snap} +2 -3
- package/src/popover/index.ts +2 -0
- package/src/popover/Popover.js +0 -101
- package/src/popover/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.js → Popover.story.tsx} +0 -0
package/build/index.js
CHANGED
|
@@ -849,7 +849,7 @@ const StatusIcon = ({
|
|
|
849
849
|
});
|
|
850
850
|
};
|
|
851
851
|
|
|
852
|
-
function logActionRequired$
|
|
852
|
+
function logActionRequired$1(message) {
|
|
853
853
|
if (['development', 'test'].includes(process?.env?.NODE_ENV)) {
|
|
854
854
|
// eslint-disable-next-line no-console
|
|
855
855
|
console.warn(message);
|
|
@@ -857,7 +857,7 @@ function logActionRequired$2(message) {
|
|
|
857
857
|
}
|
|
858
858
|
function logActionRequiredIf(message, conditional) {
|
|
859
859
|
if (conditional) {
|
|
860
|
-
logActionRequired$
|
|
860
|
+
logActionRequired$1(message);
|
|
861
861
|
}
|
|
862
862
|
}
|
|
863
863
|
|
|
@@ -888,7 +888,7 @@ const deprecated = (validator, {
|
|
|
888
888
|
}) => (props, propertyName, ...rest) => {
|
|
889
889
|
const newPropertyMessage = newProperty ? `Please use ${newProperty} instead.` : message;
|
|
890
890
|
if (props[propertyName] != null && typeof props[propertyName] !== 'undefined') {
|
|
891
|
-
logActionRequired$
|
|
891
|
+
logActionRequired$1(deprecatedMessage({
|
|
892
892
|
component,
|
|
893
893
|
propName: propertyName,
|
|
894
894
|
message: newPropertyMessage,
|
|
@@ -917,7 +917,7 @@ function Markdown({
|
|
|
917
917
|
}
|
|
918
918
|
const linkTarget = config?.link?.target ?? '_self';
|
|
919
919
|
if (allowList != null && blockList != null) {
|
|
920
|
-
logActionRequired$
|
|
920
|
+
logActionRequired$1('Markdown supports only one of `allowList` or `blockList` to be used at a time. `blockList` will be ignored.');
|
|
921
921
|
}
|
|
922
922
|
const parser = nodes => {
|
|
923
923
|
const parsed = reader.parse(nodes);
|
|
@@ -1069,7 +1069,7 @@ const Alert = props => {
|
|
|
1069
1069
|
...props
|
|
1070
1070
|
});
|
|
1071
1071
|
}
|
|
1072
|
-
logActionRequired
|
|
1072
|
+
logActionRequired(props);
|
|
1073
1073
|
const mappedType = deprecatedTypeMap$1[type] || type;
|
|
1074
1074
|
const Icon = iconTypeMap[mappedType];
|
|
1075
1075
|
function generateIcon() {
|
|
@@ -1152,7 +1152,7 @@ const deprecatedTypeMapMessage$1 = {
|
|
|
1152
1152
|
[exports.Sentiment.ERROR]: 'Sentiment.NEGATIVE'
|
|
1153
1153
|
};
|
|
1154
1154
|
const deprecatedTypes$1 = Object.keys(deprecatedTypeMap$1);
|
|
1155
|
-
function logActionRequired
|
|
1155
|
+
function logActionRequired({
|
|
1156
1156
|
size,
|
|
1157
1157
|
type
|
|
1158
1158
|
}) {
|
|
@@ -3152,7 +3152,8 @@ const Panel = /*#__PURE__*/React.forwardRef(({
|
|
|
3152
3152
|
onClose: onClose,
|
|
3153
3153
|
children: /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
3154
3154
|
...rest,
|
|
3155
|
-
ref: setPopperElement
|
|
3155
|
+
ref: setPopperElement,
|
|
3156
|
+
role: "dialog"
|
|
3156
3157
|
// eslint-disable-next-line react/forbid-dom-props
|
|
3157
3158
|
,
|
|
3158
3159
|
style: {
|
|
@@ -5285,6 +5286,7 @@ const Logo = ({
|
|
|
5285
5286
|
const LogoMd = svgPaths[`${type}${inverse ? '_INVERSE' : ''}`];
|
|
5286
5287
|
return /*#__PURE__*/jsxRuntime.jsxs("span", {
|
|
5287
5288
|
"aria-label": type === exports.LogoType.WISE ? 'Wise' : 'Wise business',
|
|
5289
|
+
role: "img",
|
|
5288
5290
|
className: classNames__default.default(className, 'np-logo'),
|
|
5289
5291
|
children: [/*#__PURE__*/jsxRuntime.jsx(LogoSm, {
|
|
5290
5292
|
className: "np-logo-svg np-logo-svg--size-sm"
|
|
@@ -5808,22 +5810,33 @@ const Modal = ({
|
|
|
5808
5810
|
});
|
|
5809
5811
|
};
|
|
5810
5812
|
|
|
5811
|
-
|
|
5813
|
+
function resolvePlacement(preferredPlacement) {
|
|
5814
|
+
switch (preferredPlacement) {
|
|
5815
|
+
case 'left-top':
|
|
5816
|
+
case 'right-top':
|
|
5817
|
+
return 'top';
|
|
5818
|
+
case 'bottom-left':
|
|
5819
|
+
case 'bottom-right':
|
|
5820
|
+
return 'bottom';
|
|
5821
|
+
}
|
|
5822
|
+
return preferredPlacement;
|
|
5823
|
+
}
|
|
5824
|
+
function Popover$1({
|
|
5812
5825
|
children,
|
|
5813
5826
|
className,
|
|
5814
5827
|
content,
|
|
5815
|
-
preferredPlacement,
|
|
5828
|
+
preferredPlacement = exports.Position.RIGHT,
|
|
5816
5829
|
title,
|
|
5817
5830
|
onClose
|
|
5818
|
-
})
|
|
5819
|
-
|
|
5820
|
-
|
|
5821
|
-
|
|
5831
|
+
}) {
|
|
5832
|
+
const resolvedPlacement = resolvePlacement(preferredPlacement);
|
|
5833
|
+
React.useEffect(() => {
|
|
5834
|
+
if (resolvedPlacement !== preferredPlacement) {
|
|
5835
|
+
logActionRequired$1(`Popover has deprecated ${preferredPlacement} value for the 'preferredPlacement' prop. Please use ${resolvedPlacement} instead.`);
|
|
5836
|
+
}
|
|
5837
|
+
}, [preferredPlacement, resolvedPlacement]);
|
|
5822
5838
|
const anchorReference = React.useRef(null);
|
|
5823
5839
|
const [open, setOpen] = React.useState(false);
|
|
5824
|
-
const {
|
|
5825
|
-
isModern
|
|
5826
|
-
} = componentsTheming.useTheme();
|
|
5827
5840
|
const handleOnClose = () => {
|
|
5828
5841
|
setOpen(false);
|
|
5829
5842
|
onClose?.();
|
|
@@ -5833,25 +5846,21 @@ const Popover$1 = ({
|
|
|
5833
5846
|
children: [/*#__PURE__*/jsxRuntime.jsx("span", {
|
|
5834
5847
|
ref: anchorReference,
|
|
5835
5848
|
className: "d-inline-block",
|
|
5836
|
-
children: /*#__PURE__*/React.cloneElement(children, {
|
|
5849
|
+
children: /*#__PURE__*/React.isValidElement(children) ? /*#__PURE__*/React.cloneElement(children, {
|
|
5837
5850
|
onClick: () => {
|
|
5838
|
-
|
|
5839
|
-
|
|
5840
|
-
}
|
|
5841
|
-
setOpen(!open);
|
|
5851
|
+
children.props.onClick?.();
|
|
5852
|
+
setOpen(prevOpen => !prevOpen);
|
|
5842
5853
|
}
|
|
5843
|
-
})
|
|
5854
|
+
}) : children
|
|
5844
5855
|
}), /*#__PURE__*/jsxRuntime.jsx(ResponsivePanel$1, {
|
|
5845
5856
|
open: open,
|
|
5846
5857
|
anchorRef: anchorReference,
|
|
5847
|
-
position:
|
|
5858
|
+
position: resolvedPlacement,
|
|
5848
5859
|
arrow: true,
|
|
5849
5860
|
className: "np-popover__container",
|
|
5850
5861
|
onClose: handleOnClose,
|
|
5851
5862
|
children: /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
5852
|
-
className:
|
|
5853
|
-
"aria-hidden": !open,
|
|
5854
|
-
role: "dialog",
|
|
5863
|
+
className: "np-popover__content np-text-default-body",
|
|
5855
5864
|
children: [title && /*#__PURE__*/jsxRuntime.jsx(Title, {
|
|
5856
5865
|
type: exports.Typography.TITLE_BODY,
|
|
5857
5866
|
className: "m-b-1",
|
|
@@ -5860,36 +5869,7 @@ const Popover$1 = ({
|
|
|
5860
5869
|
})
|
|
5861
5870
|
})]
|
|
5862
5871
|
});
|
|
5863
|
-
}
|
|
5864
|
-
const logActionRequired = ({
|
|
5865
|
-
preferredPlacement
|
|
5866
|
-
}) => {
|
|
5867
|
-
logActionRequiredIf(`Popover has deprecated ${preferredPlacement} value for the 'preferredPlacement' prop. Please use ${deprecatedPlacements[preferredPlacement]} instead.`, deprecatedPlacements[preferredPlacement]);
|
|
5868
|
-
};
|
|
5869
|
-
Popover$1.defaultProps = {
|
|
5870
|
-
className: undefined,
|
|
5871
|
-
preferredPlacement: exports.Position.RIGHT,
|
|
5872
|
-
title: undefined
|
|
5873
|
-
};
|
|
5874
|
-
Popover$1.propTypes = {
|
|
5875
|
-
children: PropTypes__default.default.node.isRequired,
|
|
5876
|
-
className: PropTypes__default.default.string,
|
|
5877
|
-
content: PropTypes__default.default.node.isRequired,
|
|
5878
|
-
/**
|
|
5879
|
-
* `'left-top'` / `'right-top'` are deprecated use `Position.TOP` / `'top'` instead,
|
|
5880
|
-
* `'bottom-right'` / `'bottom-left'` are deprecated use `Position.BOTTOM` / `'bottom'` instead
|
|
5881
|
-
*/
|
|
5882
|
-
preferredPlacement: PropTypes__default.default.oneOf(['top', 'right', 'bottom', 'left', 'left-top', 'right-top', 'bottom-right', 'bottom-left']),
|
|
5883
|
-
onClose: PropTypes__default.default.func,
|
|
5884
|
-
title: PropTypes__default.default.node
|
|
5885
|
-
};
|
|
5886
|
-
const deprecatedPlacements = {
|
|
5887
|
-
[exports.Position.BOTTOM_LEFT]: exports.Position.BOTTOM,
|
|
5888
|
-
[exports.Position.BOTTOM_RIGHT]: exports.Position.BOTTOM,
|
|
5889
|
-
[exports.Position.LEFT_TOP]: exports.Position.TOP,
|
|
5890
|
-
[exports.Position.RIGHT_TOP]: exports.Position.TOP
|
|
5891
|
-
};
|
|
5892
|
-
var Popover$2 = Popover$1;
|
|
5872
|
+
}
|
|
5893
5873
|
|
|
5894
5874
|
var messages$6 = reactIntl.defineMessages({
|
|
5895
5875
|
ariaLabel: {
|
|
@@ -5940,7 +5920,7 @@ const Info = ({
|
|
|
5940
5920
|
title: title,
|
|
5941
5921
|
onClose: () => setOpen(false)
|
|
5942
5922
|
})]
|
|
5943
|
-
}) : /*#__PURE__*/jsxRuntime.jsx(Popover$
|
|
5923
|
+
}) : /*#__PURE__*/jsxRuntime.jsx(Popover$1, {
|
|
5944
5924
|
content: content,
|
|
5945
5925
|
preferredPlacement: preferredPlacement,
|
|
5946
5926
|
title: title,
|
|
@@ -6996,14 +6976,13 @@ const getSymbolsInPatternWithPosition = pattern => {
|
|
|
6996
6976
|
});
|
|
6997
6977
|
return patternWithSymbolsPosition;
|
|
6998
6978
|
};
|
|
6999
|
-
var getSymbolsInPatternWithPosition$1 = getSymbolsInPatternWithPosition;
|
|
7000
6979
|
|
|
7001
6980
|
const formatWithPattern = (value, pattern) => {
|
|
7002
6981
|
if (!value || value === '') {
|
|
7003
6982
|
return '';
|
|
7004
6983
|
}
|
|
7005
6984
|
const valueArray = value.toString().split('');
|
|
7006
|
-
const patternWithSymbolsPosition = getSymbolsInPatternWithPosition
|
|
6985
|
+
const patternWithSymbolsPosition = getSymbolsInPatternWithPosition(pattern);
|
|
7007
6986
|
let patternSymbol = [];
|
|
7008
6987
|
// valueArray.length increments during the cycle cause we are adding new elements.
|
|
7009
6988
|
for (let index = 0; index < valueArray.length; index += 1) {
|
|
@@ -7018,7 +6997,6 @@ const formatWithPattern = (value, pattern) => {
|
|
|
7018
6997
|
}
|
|
7019
6998
|
return valueArray.join('');
|
|
7020
6999
|
};
|
|
7021
|
-
var formatWithPattern$1 = formatWithPattern;
|
|
7022
7000
|
|
|
7023
7001
|
const unformatWithPattern = (value, pattern) => {
|
|
7024
7002
|
let valueArray = [''];
|
|
@@ -7029,18 +7007,16 @@ const unformatWithPattern = (value, pattern) => {
|
|
|
7029
7007
|
return valueArray.join('');
|
|
7030
7008
|
};
|
|
7031
7009
|
const getSymbolsInPattern = pattern => pattern.split('').filter(symbol => symbol !== '*');
|
|
7032
|
-
var unformatWithPattern$1 = unformatWithPattern;
|
|
7033
7010
|
|
|
7034
|
-
const getCountOfSymbolsInSelection = (selectionStart, selectionEnd, pattern) => getSymbolsInPatternWithPosition
|
|
7035
|
-
var getCountOfSymbolsInSelection$1 = getCountOfSymbolsInSelection;
|
|
7011
|
+
const getCountOfSymbolsInSelection = (selectionStart, selectionEnd, pattern) => getSymbolsInPatternWithPosition(pattern).filter(symbol => symbol.index >= selectionStart && symbol.index < selectionEnd).length;
|
|
7036
7012
|
|
|
7037
7013
|
const getDistanceToNextSymbol = (selectionStart, pattern) => {
|
|
7038
|
-
const patternArray = getSymbolsInPatternWithPosition
|
|
7014
|
+
const patternArray = getSymbolsInPatternWithPosition(pattern);
|
|
7039
7015
|
const applicablePattern = patternArray.filter(symbol => symbol.index >= selectionStart);
|
|
7040
7016
|
return countConsecutiveSymbols(selectionStart, applicablePattern, 'left');
|
|
7041
7017
|
};
|
|
7042
7018
|
const getDistanceToPreviousSymbol = (selectionStart, pattern) => {
|
|
7043
|
-
const patternArray = getSymbolsInPatternWithPosition
|
|
7019
|
+
const patternArray = getSymbolsInPatternWithPosition(pattern);
|
|
7044
7020
|
const applicablePattern = patternArray.filter(symbol => symbol.index < selectionStart).reverse();
|
|
7045
7021
|
return countConsecutiveSymbols(selectionStart, applicablePattern, 'right');
|
|
7046
7022
|
};
|
|
@@ -7070,7 +7046,7 @@ const getCursorPositionAfterActionStroke = (action, selectionStart, selectionEnd
|
|
|
7070
7046
|
}
|
|
7071
7047
|
break;
|
|
7072
7048
|
case 'Paste':
|
|
7073
|
-
cursorPosition += pastedLength + getCountOfSymbolsInSelection
|
|
7049
|
+
cursorPosition += pastedLength + getCountOfSymbolsInSelection(selectionStart, selectionStart + pastedLength, pattern) + getDistanceToNextSymbol(selectionStart + pastedLength, pattern);
|
|
7074
7050
|
break;
|
|
7075
7051
|
case 'Cut':
|
|
7076
7052
|
case 'Delete':
|
|
@@ -7081,7 +7057,6 @@ const getCursorPositionAfterActionStroke = (action, selectionStart, selectionEnd
|
|
|
7081
7057
|
}
|
|
7082
7058
|
return cursorPosition;
|
|
7083
7059
|
};
|
|
7084
|
-
var getCursorPositionAfterKeystroke = getCursorPositionAfterActionStroke;
|
|
7085
7060
|
|
|
7086
7061
|
class WithDisplayFormat extends React.Component {
|
|
7087
7062
|
static defaultProps = {
|
|
@@ -7091,9 +7066,9 @@ class WithDisplayFormat extends React.Component {
|
|
|
7091
7066
|
};
|
|
7092
7067
|
constructor(props) {
|
|
7093
7068
|
super(props);
|
|
7094
|
-
const unformattedValue = unformatWithPattern
|
|
7069
|
+
const unformattedValue = unformatWithPattern(props.value ?? '', props.displayPattern);
|
|
7095
7070
|
this.state = {
|
|
7096
|
-
value: formatWithPattern
|
|
7071
|
+
value: formatWithPattern(unformattedValue, props.displayPattern),
|
|
7097
7072
|
historyNavigator: new HistoryNavigator$1(),
|
|
7098
7073
|
prevDisplayPattern: props.displayPattern,
|
|
7099
7074
|
triggerType: 'Initial',
|
|
@@ -7111,11 +7086,11 @@ class WithDisplayFormat extends React.Component {
|
|
|
7111
7086
|
historyNavigator
|
|
7112
7087
|
}) {
|
|
7113
7088
|
if (prevDisplayPattern !== displayPattern) {
|
|
7114
|
-
const unFormattedValue = unformatWithPattern
|
|
7089
|
+
const unFormattedValue = unformatWithPattern(value, prevDisplayPattern);
|
|
7115
7090
|
historyNavigator.reset();
|
|
7116
7091
|
return {
|
|
7117
7092
|
prevDisplayPattern: displayPattern,
|
|
7118
|
-
value: formatWithPattern
|
|
7093
|
+
value: formatWithPattern(unFormattedValue, displayPattern),
|
|
7119
7094
|
triggerType: null,
|
|
7120
7095
|
triggerEvent: null,
|
|
7121
7096
|
pastedLength: 0
|
|
@@ -7145,7 +7120,7 @@ class WithDisplayFormat extends React.Component {
|
|
|
7145
7120
|
return 'Delete';
|
|
7146
7121
|
}
|
|
7147
7122
|
// Android Fix.
|
|
7148
|
-
if (typeof triggerEvent.key === 'undefined' && unformattedValue.length <= unformatWithPattern
|
|
7123
|
+
if (typeof triggerEvent.key === 'undefined' && unformattedValue.length <= unformatWithPattern(value, displayPattern).length) {
|
|
7149
7124
|
return 'Backspace';
|
|
7150
7125
|
}
|
|
7151
7126
|
return triggerEvent.key;
|
|
@@ -7183,13 +7158,13 @@ class WithDisplayFormat extends React.Component {
|
|
|
7183
7158
|
// Unfortunately Undo and Redo don't trigger OnChange event so we need to handle some value logic here.
|
|
7184
7159
|
let newFormattedValue = '';
|
|
7185
7160
|
if (this.detectUndoRedo(event) === 'Undo') {
|
|
7186
|
-
newFormattedValue = formatWithPattern
|
|
7161
|
+
newFormattedValue = formatWithPattern(historyNavigator.undo(), displayPattern);
|
|
7187
7162
|
this.setState({
|
|
7188
7163
|
value: newFormattedValue,
|
|
7189
7164
|
triggerType: 'Undo'
|
|
7190
7165
|
});
|
|
7191
7166
|
} else if (this.detectUndoRedo(event) === 'Redo') {
|
|
7192
|
-
newFormattedValue = formatWithPattern
|
|
7167
|
+
newFormattedValue = formatWithPattern(historyNavigator.redo(), displayPattern);
|
|
7193
7168
|
this.setState({
|
|
7194
7169
|
value: newFormattedValue,
|
|
7195
7170
|
triggerType: 'Redo'
|
|
@@ -7207,7 +7182,7 @@ class WithDisplayFormat extends React.Component {
|
|
|
7207
7182
|
const {
|
|
7208
7183
|
displayPattern
|
|
7209
7184
|
} = this.props;
|
|
7210
|
-
const pastedLength = unformatWithPattern
|
|
7185
|
+
const pastedLength = unformatWithPattern(event.clipboardData.getData('Text'), displayPattern).length;
|
|
7211
7186
|
this.setState({
|
|
7212
7187
|
triggerType: 'Paste',
|
|
7213
7188
|
pastedLength
|
|
@@ -7237,7 +7212,7 @@ class WithDisplayFormat extends React.Component {
|
|
|
7237
7212
|
const {
|
|
7238
7213
|
value
|
|
7239
7214
|
} = event.target;
|
|
7240
|
-
let unformattedValue = unformatWithPattern
|
|
7215
|
+
let unformattedValue = unformatWithPattern(value, displayPattern);
|
|
7241
7216
|
const action = this.getUserAction(unformattedValue);
|
|
7242
7217
|
if (!this.isKeyAllowed(action) || triggerType === 'Undo' || triggerType === 'Redo') {
|
|
7243
7218
|
return;
|
|
@@ -7245,7 +7220,7 @@ class WithDisplayFormat extends React.Component {
|
|
|
7245
7220
|
if (action === 'Backspace' || action === 'Delete') {
|
|
7246
7221
|
unformattedValue = this.handleDelete(unformattedValue, action);
|
|
7247
7222
|
}
|
|
7248
|
-
const newFormattedValue = formatWithPattern
|
|
7223
|
+
const newFormattedValue = formatWithPattern(unformattedValue, displayPattern);
|
|
7249
7224
|
historyNavigator.add(unformattedValue);
|
|
7250
7225
|
this.handleCursorPositioning(action);
|
|
7251
7226
|
this.setState({
|
|
@@ -7253,13 +7228,13 @@ class WithDisplayFormat extends React.Component {
|
|
|
7253
7228
|
}, () => {
|
|
7254
7229
|
this.resetEvent();
|
|
7255
7230
|
if (onChange) {
|
|
7256
|
-
const broadcastValue = unformatWithPattern
|
|
7231
|
+
const broadcastValue = unformatWithPattern(newFormattedValue, displayPattern);
|
|
7257
7232
|
onChange(broadcastValue);
|
|
7258
7233
|
}
|
|
7259
7234
|
});
|
|
7260
7235
|
};
|
|
7261
7236
|
handleOnBlur = event => {
|
|
7262
|
-
this.props.onBlur?.(unformatWithPattern
|
|
7237
|
+
this.props.onBlur?.(unformatWithPattern(event.target.value, this.props.displayPattern));
|
|
7263
7238
|
};
|
|
7264
7239
|
handleOnFocus = event => {
|
|
7265
7240
|
const {
|
|
@@ -7268,7 +7243,7 @@ class WithDisplayFormat extends React.Component {
|
|
|
7268
7243
|
} = this.props;
|
|
7269
7244
|
if (onFocus) {
|
|
7270
7245
|
this.handleOnChange(event);
|
|
7271
|
-
onFocus(unformatWithPattern
|
|
7246
|
+
onFocus(unformatWithPattern(event.target.value, displayPattern));
|
|
7272
7247
|
}
|
|
7273
7248
|
};
|
|
7274
7249
|
handleDelete = (unformattedValue, action) => {
|
|
@@ -7281,7 +7256,7 @@ class WithDisplayFormat extends React.Component {
|
|
|
7281
7256
|
} = this.state;
|
|
7282
7257
|
const newStack = [...unformattedValue];
|
|
7283
7258
|
if (selectionStart === selectionEnd) {
|
|
7284
|
-
let startPosition = selectionStart - getCountOfSymbolsInSelection
|
|
7259
|
+
let startPosition = selectionStart - getCountOfSymbolsInSelection(0, selectionStart, displayPattern);
|
|
7285
7260
|
let toDelete = 0;
|
|
7286
7261
|
let count = getDistanceToNextSymbol(selectionStart, displayPattern);
|
|
7287
7262
|
if (action === 'Backspace') {
|
|
@@ -7305,7 +7280,7 @@ class WithDisplayFormat extends React.Component {
|
|
|
7305
7280
|
selectionEnd,
|
|
7306
7281
|
pastedLength
|
|
7307
7282
|
} = this.state;
|
|
7308
|
-
const cursorPosition =
|
|
7283
|
+
const cursorPosition = getCursorPositionAfterActionStroke(action, selectionStart, selectionEnd, displayPattern, pastedLength);
|
|
7309
7284
|
setTimeout(() => {
|
|
7310
7285
|
if (triggerEvent) {
|
|
7311
7286
|
triggerEvent.target.setSelectionRange(cursorPosition, cursorPosition);
|
|
@@ -15207,7 +15182,7 @@ exports.Nudge = Nudge;
|
|
|
15207
15182
|
exports.Option = Option$2;
|
|
15208
15183
|
exports.OverlayHeader = OverlayHeader$1;
|
|
15209
15184
|
exports.PhoneNumberInput = PhoneNumberInput;
|
|
15210
|
-
exports.Popover = Popover$
|
|
15185
|
+
exports.Popover = Popover$1;
|
|
15211
15186
|
exports.ProcessIndicator = ProcessIndicator$1;
|
|
15212
15187
|
exports.Progress = Progress;
|
|
15213
15188
|
exports.ProgressBar = ProgressBar;
|