@transferwise/components 0.0.0-experimental-a6eccb9 → 0.0.0-experimental-eecc435
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 +73 -60
- package/build/index.esm.js.map +1 -1
- package/build/index.js +72 -59
- package/build/index.js.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 +0 -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/package.json +1 -1
- 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 +0 -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/popover/Popover.tsx +0 -106
- package/src/popover/index.ts +0 -2
- /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/build/index.js
CHANGED
|
@@ -849,7 +849,7 @@ const StatusIcon = ({
|
|
|
849
849
|
});
|
|
850
850
|
};
|
|
851
851
|
|
|
852
|
-
function logActionRequired$
|
|
852
|
+
function logActionRequired$2(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$1(message) {
|
|
|
857
857
|
}
|
|
858
858
|
function logActionRequiredIf(message, conditional) {
|
|
859
859
|
if (conditional) {
|
|
860
|
-
logActionRequired$
|
|
860
|
+
logActionRequired$2(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$2(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$2('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(props);
|
|
1072
|
+
logActionRequired$1(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$1({
|
|
1156
1156
|
size,
|
|
1157
1157
|
type
|
|
1158
1158
|
}) {
|
|
@@ -5285,6 +5285,7 @@ const Logo = ({
|
|
|
5285
5285
|
const LogoMd = svgPaths[`${type}${inverse ? '_INVERSE' : ''}`];
|
|
5286
5286
|
return /*#__PURE__*/jsxRuntime.jsxs("span", {
|
|
5287
5287
|
"aria-label": type === exports.LogoType.WISE ? 'Wise' : 'Wise business',
|
|
5288
|
+
role: "img",
|
|
5288
5289
|
className: classNames__default.default(className, 'np-logo'),
|
|
5289
5290
|
children: [/*#__PURE__*/jsxRuntime.jsx(LogoSm, {
|
|
5290
5291
|
className: "np-logo-svg np-logo-svg--size-sm"
|
|
@@ -5808,31 +5809,17 @@ const Modal = ({
|
|
|
5808
5809
|
});
|
|
5809
5810
|
};
|
|
5810
5811
|
|
|
5811
|
-
|
|
5812
|
-
switch (preferredPlacement) {
|
|
5813
|
-
case 'left-top':
|
|
5814
|
-
case 'right-top':
|
|
5815
|
-
return 'top';
|
|
5816
|
-
case 'bottom-left':
|
|
5817
|
-
case 'bottom-right':
|
|
5818
|
-
return 'bottom';
|
|
5819
|
-
}
|
|
5820
|
-
return preferredPlacement;
|
|
5821
|
-
}
|
|
5822
|
-
function Popover$1({
|
|
5812
|
+
const Popover$1 = ({
|
|
5823
5813
|
children,
|
|
5824
5814
|
className,
|
|
5825
5815
|
content,
|
|
5826
|
-
preferredPlacement
|
|
5816
|
+
preferredPlacement,
|
|
5827
5817
|
title,
|
|
5828
5818
|
onClose
|
|
5829
|
-
}) {
|
|
5830
|
-
|
|
5831
|
-
|
|
5832
|
-
|
|
5833
|
-
logActionRequired$1(`Popover has deprecated ${preferredPlacement} value for the 'preferredPlacement' prop. Please use ${resolvedPlacement} instead.`);
|
|
5834
|
-
}
|
|
5835
|
-
}, [preferredPlacement, resolvedPlacement]);
|
|
5819
|
+
}) => {
|
|
5820
|
+
logActionRequired({
|
|
5821
|
+
preferredPlacement
|
|
5822
|
+
});
|
|
5836
5823
|
const anchorReference = React.useRef(null);
|
|
5837
5824
|
const [open, setOpen] = React.useState(false);
|
|
5838
5825
|
const {
|
|
@@ -5847,16 +5834,18 @@ function Popover$1({
|
|
|
5847
5834
|
children: [/*#__PURE__*/jsxRuntime.jsx("span", {
|
|
5848
5835
|
ref: anchorReference,
|
|
5849
5836
|
className: "d-inline-block",
|
|
5850
|
-
children: /*#__PURE__*/React.
|
|
5837
|
+
children: /*#__PURE__*/React.cloneElement(children, {
|
|
5851
5838
|
onClick: () => {
|
|
5852
|
-
children
|
|
5853
|
-
|
|
5839
|
+
if (children?.props?.onClick) {
|
|
5840
|
+
children.props.onClick();
|
|
5841
|
+
}
|
|
5842
|
+
setOpen(!open);
|
|
5854
5843
|
}
|
|
5855
|
-
})
|
|
5844
|
+
})
|
|
5856
5845
|
}), /*#__PURE__*/jsxRuntime.jsx(ResponsivePanel$1, {
|
|
5857
5846
|
open: open,
|
|
5858
5847
|
anchorRef: anchorReference,
|
|
5859
|
-
position:
|
|
5848
|
+
position: deprecatedPlacements[preferredPlacement] || preferredPlacement,
|
|
5860
5849
|
arrow: true,
|
|
5861
5850
|
className: "np-popover__container",
|
|
5862
5851
|
onClose: handleOnClose,
|
|
@@ -5872,7 +5861,36 @@ function Popover$1({
|
|
|
5872
5861
|
})
|
|
5873
5862
|
})]
|
|
5874
5863
|
});
|
|
5875
|
-
}
|
|
5864
|
+
};
|
|
5865
|
+
const logActionRequired = ({
|
|
5866
|
+
preferredPlacement
|
|
5867
|
+
}) => {
|
|
5868
|
+
logActionRequiredIf(`Popover has deprecated ${preferredPlacement} value for the 'preferredPlacement' prop. Please use ${deprecatedPlacements[preferredPlacement]} instead.`, deprecatedPlacements[preferredPlacement]);
|
|
5869
|
+
};
|
|
5870
|
+
Popover$1.defaultProps = {
|
|
5871
|
+
className: undefined,
|
|
5872
|
+
preferredPlacement: exports.Position.RIGHT,
|
|
5873
|
+
title: undefined
|
|
5874
|
+
};
|
|
5875
|
+
Popover$1.propTypes = {
|
|
5876
|
+
children: PropTypes__default.default.node.isRequired,
|
|
5877
|
+
className: PropTypes__default.default.string,
|
|
5878
|
+
content: PropTypes__default.default.node.isRequired,
|
|
5879
|
+
/**
|
|
5880
|
+
* `'left-top'` / `'right-top'` are deprecated use `Position.TOP` / `'top'` instead,
|
|
5881
|
+
* `'bottom-right'` / `'bottom-left'` are deprecated use `Position.BOTTOM` / `'bottom'` instead
|
|
5882
|
+
*/
|
|
5883
|
+
preferredPlacement: PropTypes__default.default.oneOf(['top', 'right', 'bottom', 'left', 'left-top', 'right-top', 'bottom-right', 'bottom-left']),
|
|
5884
|
+
onClose: PropTypes__default.default.func,
|
|
5885
|
+
title: PropTypes__default.default.node
|
|
5886
|
+
};
|
|
5887
|
+
const deprecatedPlacements = {
|
|
5888
|
+
[exports.Position.BOTTOM_LEFT]: exports.Position.BOTTOM,
|
|
5889
|
+
[exports.Position.BOTTOM_RIGHT]: exports.Position.BOTTOM,
|
|
5890
|
+
[exports.Position.LEFT_TOP]: exports.Position.TOP,
|
|
5891
|
+
[exports.Position.RIGHT_TOP]: exports.Position.TOP
|
|
5892
|
+
};
|
|
5893
|
+
var Popover$2 = Popover$1;
|
|
5876
5894
|
|
|
5877
5895
|
var messages$6 = reactIntl.defineMessages({
|
|
5878
5896
|
ariaLabel: {
|
|
@@ -5923,7 +5941,7 @@ const Info = ({
|
|
|
5923
5941
|
title: title,
|
|
5924
5942
|
onClose: () => setOpen(false)
|
|
5925
5943
|
})]
|
|
5926
|
-
}) : /*#__PURE__*/jsxRuntime.jsx(Popover$
|
|
5944
|
+
}) : /*#__PURE__*/jsxRuntime.jsx(Popover$2, {
|
|
5927
5945
|
content: content,
|
|
5928
5946
|
preferredPlacement: preferredPlacement,
|
|
5929
5947
|
title: title,
|
|
@@ -6979,14 +6997,13 @@ const getSymbolsInPatternWithPosition = pattern => {
|
|
|
6979
6997
|
});
|
|
6980
6998
|
return patternWithSymbolsPosition;
|
|
6981
6999
|
};
|
|
6982
|
-
var getSymbolsInPatternWithPosition$1 = getSymbolsInPatternWithPosition;
|
|
6983
7000
|
|
|
6984
7001
|
const formatWithPattern = (value, pattern) => {
|
|
6985
7002
|
if (!value || value === '') {
|
|
6986
7003
|
return '';
|
|
6987
7004
|
}
|
|
6988
7005
|
const valueArray = value.toString().split('');
|
|
6989
|
-
const patternWithSymbolsPosition = getSymbolsInPatternWithPosition
|
|
7006
|
+
const patternWithSymbolsPosition = getSymbolsInPatternWithPosition(pattern);
|
|
6990
7007
|
let patternSymbol = [];
|
|
6991
7008
|
// valueArray.length increments during the cycle cause we are adding new elements.
|
|
6992
7009
|
for (let index = 0; index < valueArray.length; index += 1) {
|
|
@@ -7001,7 +7018,6 @@ const formatWithPattern = (value, pattern) => {
|
|
|
7001
7018
|
}
|
|
7002
7019
|
return valueArray.join('');
|
|
7003
7020
|
};
|
|
7004
|
-
var formatWithPattern$1 = formatWithPattern;
|
|
7005
7021
|
|
|
7006
7022
|
const unformatWithPattern = (value, pattern) => {
|
|
7007
7023
|
let valueArray = [''];
|
|
@@ -7012,18 +7028,16 @@ const unformatWithPattern = (value, pattern) => {
|
|
|
7012
7028
|
return valueArray.join('');
|
|
7013
7029
|
};
|
|
7014
7030
|
const getSymbolsInPattern = pattern => pattern.split('').filter(symbol => symbol !== '*');
|
|
7015
|
-
var unformatWithPattern$1 = unformatWithPattern;
|
|
7016
7031
|
|
|
7017
|
-
const getCountOfSymbolsInSelection = (selectionStart, selectionEnd, pattern) => getSymbolsInPatternWithPosition
|
|
7018
|
-
var getCountOfSymbolsInSelection$1 = getCountOfSymbolsInSelection;
|
|
7032
|
+
const getCountOfSymbolsInSelection = (selectionStart, selectionEnd, pattern) => getSymbolsInPatternWithPosition(pattern).filter(symbol => symbol.index >= selectionStart && symbol.index < selectionEnd).length;
|
|
7019
7033
|
|
|
7020
7034
|
const getDistanceToNextSymbol = (selectionStart, pattern) => {
|
|
7021
|
-
const patternArray = getSymbolsInPatternWithPosition
|
|
7035
|
+
const patternArray = getSymbolsInPatternWithPosition(pattern);
|
|
7022
7036
|
const applicablePattern = patternArray.filter(symbol => symbol.index >= selectionStart);
|
|
7023
7037
|
return countConsecutiveSymbols(selectionStart, applicablePattern, 'left');
|
|
7024
7038
|
};
|
|
7025
7039
|
const getDistanceToPreviousSymbol = (selectionStart, pattern) => {
|
|
7026
|
-
const patternArray = getSymbolsInPatternWithPosition
|
|
7040
|
+
const patternArray = getSymbolsInPatternWithPosition(pattern);
|
|
7027
7041
|
const applicablePattern = patternArray.filter(symbol => symbol.index < selectionStart).reverse();
|
|
7028
7042
|
return countConsecutiveSymbols(selectionStart, applicablePattern, 'right');
|
|
7029
7043
|
};
|
|
@@ -7053,7 +7067,7 @@ const getCursorPositionAfterActionStroke = (action, selectionStart, selectionEnd
|
|
|
7053
7067
|
}
|
|
7054
7068
|
break;
|
|
7055
7069
|
case 'Paste':
|
|
7056
|
-
cursorPosition += pastedLength + getCountOfSymbolsInSelection
|
|
7070
|
+
cursorPosition += pastedLength + getCountOfSymbolsInSelection(selectionStart, selectionStart + pastedLength, pattern) + getDistanceToNextSymbol(selectionStart + pastedLength, pattern);
|
|
7057
7071
|
break;
|
|
7058
7072
|
case 'Cut':
|
|
7059
7073
|
case 'Delete':
|
|
@@ -7064,7 +7078,6 @@ const getCursorPositionAfterActionStroke = (action, selectionStart, selectionEnd
|
|
|
7064
7078
|
}
|
|
7065
7079
|
return cursorPosition;
|
|
7066
7080
|
};
|
|
7067
|
-
var getCursorPositionAfterKeystroke = getCursorPositionAfterActionStroke;
|
|
7068
7081
|
|
|
7069
7082
|
class WithDisplayFormat extends React.Component {
|
|
7070
7083
|
static defaultProps = {
|
|
@@ -7074,9 +7087,9 @@ class WithDisplayFormat extends React.Component {
|
|
|
7074
7087
|
};
|
|
7075
7088
|
constructor(props) {
|
|
7076
7089
|
super(props);
|
|
7077
|
-
const unformattedValue = unformatWithPattern
|
|
7090
|
+
const unformattedValue = unformatWithPattern(props.value ?? '', props.displayPattern);
|
|
7078
7091
|
this.state = {
|
|
7079
|
-
value: formatWithPattern
|
|
7092
|
+
value: formatWithPattern(unformattedValue, props.displayPattern),
|
|
7080
7093
|
historyNavigator: new HistoryNavigator$1(),
|
|
7081
7094
|
prevDisplayPattern: props.displayPattern,
|
|
7082
7095
|
triggerType: 'Initial',
|
|
@@ -7094,11 +7107,11 @@ class WithDisplayFormat extends React.Component {
|
|
|
7094
7107
|
historyNavigator
|
|
7095
7108
|
}) {
|
|
7096
7109
|
if (prevDisplayPattern !== displayPattern) {
|
|
7097
|
-
const unFormattedValue = unformatWithPattern
|
|
7110
|
+
const unFormattedValue = unformatWithPattern(value, prevDisplayPattern);
|
|
7098
7111
|
historyNavigator.reset();
|
|
7099
7112
|
return {
|
|
7100
7113
|
prevDisplayPattern: displayPattern,
|
|
7101
|
-
value: formatWithPattern
|
|
7114
|
+
value: formatWithPattern(unFormattedValue, displayPattern),
|
|
7102
7115
|
triggerType: null,
|
|
7103
7116
|
triggerEvent: null,
|
|
7104
7117
|
pastedLength: 0
|
|
@@ -7128,7 +7141,7 @@ class WithDisplayFormat extends React.Component {
|
|
|
7128
7141
|
return 'Delete';
|
|
7129
7142
|
}
|
|
7130
7143
|
// Android Fix.
|
|
7131
|
-
if (typeof triggerEvent.key === 'undefined' && unformattedValue.length <= unformatWithPattern
|
|
7144
|
+
if (typeof triggerEvent.key === 'undefined' && unformattedValue.length <= unformatWithPattern(value, displayPattern).length) {
|
|
7132
7145
|
return 'Backspace';
|
|
7133
7146
|
}
|
|
7134
7147
|
return triggerEvent.key;
|
|
@@ -7166,13 +7179,13 @@ class WithDisplayFormat extends React.Component {
|
|
|
7166
7179
|
// Unfortunately Undo and Redo don't trigger OnChange event so we need to handle some value logic here.
|
|
7167
7180
|
let newFormattedValue = '';
|
|
7168
7181
|
if (this.detectUndoRedo(event) === 'Undo') {
|
|
7169
|
-
newFormattedValue = formatWithPattern
|
|
7182
|
+
newFormattedValue = formatWithPattern(historyNavigator.undo(), displayPattern);
|
|
7170
7183
|
this.setState({
|
|
7171
7184
|
value: newFormattedValue,
|
|
7172
7185
|
triggerType: 'Undo'
|
|
7173
7186
|
});
|
|
7174
7187
|
} else if (this.detectUndoRedo(event) === 'Redo') {
|
|
7175
|
-
newFormattedValue = formatWithPattern
|
|
7188
|
+
newFormattedValue = formatWithPattern(historyNavigator.redo(), displayPattern);
|
|
7176
7189
|
this.setState({
|
|
7177
7190
|
value: newFormattedValue,
|
|
7178
7191
|
triggerType: 'Redo'
|
|
@@ -7190,7 +7203,7 @@ class WithDisplayFormat extends React.Component {
|
|
|
7190
7203
|
const {
|
|
7191
7204
|
displayPattern
|
|
7192
7205
|
} = this.props;
|
|
7193
|
-
const pastedLength = unformatWithPattern
|
|
7206
|
+
const pastedLength = unformatWithPattern(event.clipboardData.getData('Text'), displayPattern).length;
|
|
7194
7207
|
this.setState({
|
|
7195
7208
|
triggerType: 'Paste',
|
|
7196
7209
|
pastedLength
|
|
@@ -7220,7 +7233,7 @@ class WithDisplayFormat extends React.Component {
|
|
|
7220
7233
|
const {
|
|
7221
7234
|
value
|
|
7222
7235
|
} = event.target;
|
|
7223
|
-
let unformattedValue = unformatWithPattern
|
|
7236
|
+
let unformattedValue = unformatWithPattern(value, displayPattern);
|
|
7224
7237
|
const action = this.getUserAction(unformattedValue);
|
|
7225
7238
|
if (!this.isKeyAllowed(action) || triggerType === 'Undo' || triggerType === 'Redo') {
|
|
7226
7239
|
return;
|
|
@@ -7228,7 +7241,7 @@ class WithDisplayFormat extends React.Component {
|
|
|
7228
7241
|
if (action === 'Backspace' || action === 'Delete') {
|
|
7229
7242
|
unformattedValue = this.handleDelete(unformattedValue, action);
|
|
7230
7243
|
}
|
|
7231
|
-
const newFormattedValue = formatWithPattern
|
|
7244
|
+
const newFormattedValue = formatWithPattern(unformattedValue, displayPattern);
|
|
7232
7245
|
historyNavigator.add(unformattedValue);
|
|
7233
7246
|
this.handleCursorPositioning(action);
|
|
7234
7247
|
this.setState({
|
|
@@ -7236,13 +7249,13 @@ class WithDisplayFormat extends React.Component {
|
|
|
7236
7249
|
}, () => {
|
|
7237
7250
|
this.resetEvent();
|
|
7238
7251
|
if (onChange) {
|
|
7239
|
-
const broadcastValue = unformatWithPattern
|
|
7252
|
+
const broadcastValue = unformatWithPattern(newFormattedValue, displayPattern);
|
|
7240
7253
|
onChange(broadcastValue);
|
|
7241
7254
|
}
|
|
7242
7255
|
});
|
|
7243
7256
|
};
|
|
7244
7257
|
handleOnBlur = event => {
|
|
7245
|
-
this.props.onBlur?.(unformatWithPattern
|
|
7258
|
+
this.props.onBlur?.(unformatWithPattern(event.target.value, this.props.displayPattern));
|
|
7246
7259
|
};
|
|
7247
7260
|
handleOnFocus = event => {
|
|
7248
7261
|
const {
|
|
@@ -7251,7 +7264,7 @@ class WithDisplayFormat extends React.Component {
|
|
|
7251
7264
|
} = this.props;
|
|
7252
7265
|
if (onFocus) {
|
|
7253
7266
|
this.handleOnChange(event);
|
|
7254
|
-
onFocus(unformatWithPattern
|
|
7267
|
+
onFocus(unformatWithPattern(event.target.value, displayPattern));
|
|
7255
7268
|
}
|
|
7256
7269
|
};
|
|
7257
7270
|
handleDelete = (unformattedValue, action) => {
|
|
@@ -7264,7 +7277,7 @@ class WithDisplayFormat extends React.Component {
|
|
|
7264
7277
|
} = this.state;
|
|
7265
7278
|
const newStack = [...unformattedValue];
|
|
7266
7279
|
if (selectionStart === selectionEnd) {
|
|
7267
|
-
let startPosition = selectionStart - getCountOfSymbolsInSelection
|
|
7280
|
+
let startPosition = selectionStart - getCountOfSymbolsInSelection(0, selectionStart, displayPattern);
|
|
7268
7281
|
let toDelete = 0;
|
|
7269
7282
|
let count = getDistanceToNextSymbol(selectionStart, displayPattern);
|
|
7270
7283
|
if (action === 'Backspace') {
|
|
@@ -7288,7 +7301,7 @@ class WithDisplayFormat extends React.Component {
|
|
|
7288
7301
|
selectionEnd,
|
|
7289
7302
|
pastedLength
|
|
7290
7303
|
} = this.state;
|
|
7291
|
-
const cursorPosition =
|
|
7304
|
+
const cursorPosition = getCursorPositionAfterActionStroke(action, selectionStart, selectionEnd, displayPattern, pastedLength);
|
|
7292
7305
|
setTimeout(() => {
|
|
7293
7306
|
if (triggerEvent) {
|
|
7294
7307
|
triggerEvent.target.setSelectionRange(cursorPosition, cursorPosition);
|
|
@@ -15190,7 +15203,7 @@ exports.Nudge = Nudge;
|
|
|
15190
15203
|
exports.Option = Option$2;
|
|
15191
15204
|
exports.OverlayHeader = OverlayHeader$1;
|
|
15192
15205
|
exports.PhoneNumberInput = PhoneNumberInput;
|
|
15193
|
-
exports.Popover = Popover$
|
|
15206
|
+
exports.Popover = Popover$2;
|
|
15194
15207
|
exports.ProcessIndicator = ProcessIndicator$1;
|
|
15195
15208
|
exports.Progress = Progress;
|
|
15196
15209
|
exports.ProgressBar = ProgressBar;
|