@transferwise/components 46.19.0 → 46.20.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/index.esm.js +61 -100
- package/build/index.esm.js.map +1 -1
- package/build/index.js +60 -99
- package/build/index.js.map +1 -1
- package/build/types/common/index.d.ts +0 -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/build/types/promoCard/PromoCard.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/common/index.js +0 -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/promoCard/PromoCard.tsx +5 -3
- package/build/types/common/randomId.d.ts +0 -13
- package/build/types/common/randomId.d.ts.map +0 -1
- package/src/common/randomId.ts +0 -14
- 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
|
@@ -437,21 +437,6 @@ function getDirectionFromLocale(locale) {
|
|
|
437
437
|
return adjustedLocale != null && RTL_LANGUAGES.includes(new Intl.Locale(adjustedLocale).language) ? exports.Direction.RTL : exports.Direction.LTR;
|
|
438
438
|
}
|
|
439
439
|
|
|
440
|
-
/**
|
|
441
|
-
* generateRandomId() function
|
|
442
|
-
*
|
|
443
|
-
* This function generates a random string of characters that can be used as
|
|
444
|
-
* an ID.
|
|
445
|
-
*
|
|
446
|
-
* @returns {string} A random string of characters.
|
|
447
|
-
* @example
|
|
448
|
-
* const id = generateRandomId();
|
|
449
|
-
* // id will be a random string of characters, such as "id-4711".
|
|
450
|
-
*/
|
|
451
|
-
const generateRandomId = () => {
|
|
452
|
-
return `id-${Math.random().toString(36).slice(7)}`;
|
|
453
|
-
};
|
|
454
|
-
|
|
455
440
|
const DEFAULT_TYPE$1 = exports.Typography.TITLE_GROUP;
|
|
456
441
|
const titleTypeMapping = {
|
|
457
442
|
[exports.Typography.TITLE_SCREEN]: 'h1',
|
|
@@ -849,7 +834,7 @@ const StatusIcon = ({
|
|
|
849
834
|
});
|
|
850
835
|
};
|
|
851
836
|
|
|
852
|
-
function logActionRequired$
|
|
837
|
+
function logActionRequired$1(message) {
|
|
853
838
|
if (['development', 'test'].includes(process?.env?.NODE_ENV)) {
|
|
854
839
|
// eslint-disable-next-line no-console
|
|
855
840
|
console.warn(message);
|
|
@@ -857,7 +842,7 @@ function logActionRequired$2(message) {
|
|
|
857
842
|
}
|
|
858
843
|
function logActionRequiredIf(message, conditional) {
|
|
859
844
|
if (conditional) {
|
|
860
|
-
logActionRequired$
|
|
845
|
+
logActionRequired$1(message);
|
|
861
846
|
}
|
|
862
847
|
}
|
|
863
848
|
|
|
@@ -888,7 +873,7 @@ const deprecated = (validator, {
|
|
|
888
873
|
}) => (props, propertyName, ...rest) => {
|
|
889
874
|
const newPropertyMessage = newProperty ? `Please use ${newProperty} instead.` : message;
|
|
890
875
|
if (props[propertyName] != null && typeof props[propertyName] !== 'undefined') {
|
|
891
|
-
logActionRequired$
|
|
876
|
+
logActionRequired$1(deprecatedMessage({
|
|
892
877
|
component,
|
|
893
878
|
propName: propertyName,
|
|
894
879
|
message: newPropertyMessage,
|
|
@@ -917,7 +902,7 @@ function Markdown({
|
|
|
917
902
|
}
|
|
918
903
|
const linkTarget = config?.link?.target ?? '_self';
|
|
919
904
|
if (allowList != null && blockList != null) {
|
|
920
|
-
logActionRequired$
|
|
905
|
+
logActionRequired$1('Markdown supports only one of `allowList` or `blockList` to be used at a time. `blockList` will be ignored.');
|
|
921
906
|
}
|
|
922
907
|
const parser = nodes => {
|
|
923
908
|
const parsed = reader.parse(nodes);
|
|
@@ -1069,7 +1054,7 @@ const Alert = props => {
|
|
|
1069
1054
|
...props
|
|
1070
1055
|
});
|
|
1071
1056
|
}
|
|
1072
|
-
logActionRequired
|
|
1057
|
+
logActionRequired(props);
|
|
1073
1058
|
const mappedType = deprecatedTypeMap$1[type] || type;
|
|
1074
1059
|
const Icon = iconTypeMap[mappedType];
|
|
1075
1060
|
function generateIcon() {
|
|
@@ -1152,7 +1137,7 @@ const deprecatedTypeMapMessage$1 = {
|
|
|
1152
1137
|
[exports.Sentiment.ERROR]: 'Sentiment.NEGATIVE'
|
|
1153
1138
|
};
|
|
1154
1139
|
const deprecatedTypes$1 = Object.keys(deprecatedTypeMap$1);
|
|
1155
|
-
function logActionRequired
|
|
1140
|
+
function logActionRequired({
|
|
1156
1141
|
size,
|
|
1157
1142
|
type
|
|
1158
1143
|
}) {
|
|
@@ -3152,7 +3137,8 @@ const Panel = /*#__PURE__*/React.forwardRef(({
|
|
|
3152
3137
|
onClose: onClose,
|
|
3153
3138
|
children: /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
3154
3139
|
...rest,
|
|
3155
|
-
ref: setPopperElement
|
|
3140
|
+
ref: setPopperElement,
|
|
3141
|
+
role: "dialog"
|
|
3156
3142
|
// eslint-disable-next-line react/forbid-dom-props
|
|
3157
3143
|
,
|
|
3158
3144
|
style: {
|
|
@@ -5285,6 +5271,7 @@ const Logo = ({
|
|
|
5285
5271
|
const LogoMd = svgPaths[`${type}${inverse ? '_INVERSE' : ''}`];
|
|
5286
5272
|
return /*#__PURE__*/jsxRuntime.jsxs("span", {
|
|
5287
5273
|
"aria-label": type === exports.LogoType.WISE ? 'Wise' : 'Wise business',
|
|
5274
|
+
role: "img",
|
|
5288
5275
|
className: classNames__default.default(className, 'np-logo'),
|
|
5289
5276
|
children: [/*#__PURE__*/jsxRuntime.jsx(LogoSm, {
|
|
5290
5277
|
className: "np-logo-svg np-logo-svg--size-sm"
|
|
@@ -5808,22 +5795,33 @@ const Modal = ({
|
|
|
5808
5795
|
});
|
|
5809
5796
|
};
|
|
5810
5797
|
|
|
5811
|
-
|
|
5798
|
+
function resolvePlacement(preferredPlacement) {
|
|
5799
|
+
switch (preferredPlacement) {
|
|
5800
|
+
case 'left-top':
|
|
5801
|
+
case 'right-top':
|
|
5802
|
+
return 'top';
|
|
5803
|
+
case 'bottom-left':
|
|
5804
|
+
case 'bottom-right':
|
|
5805
|
+
return 'bottom';
|
|
5806
|
+
}
|
|
5807
|
+
return preferredPlacement;
|
|
5808
|
+
}
|
|
5809
|
+
function Popover$1({
|
|
5812
5810
|
children,
|
|
5813
5811
|
className,
|
|
5814
5812
|
content,
|
|
5815
|
-
preferredPlacement,
|
|
5813
|
+
preferredPlacement = exports.Position.RIGHT,
|
|
5816
5814
|
title,
|
|
5817
5815
|
onClose
|
|
5818
|
-
})
|
|
5819
|
-
|
|
5820
|
-
|
|
5821
|
-
|
|
5816
|
+
}) {
|
|
5817
|
+
const resolvedPlacement = resolvePlacement(preferredPlacement);
|
|
5818
|
+
React.useEffect(() => {
|
|
5819
|
+
if (resolvedPlacement !== preferredPlacement) {
|
|
5820
|
+
logActionRequired$1(`Popover has deprecated ${preferredPlacement} value for the 'preferredPlacement' prop. Please use ${resolvedPlacement} instead.`);
|
|
5821
|
+
}
|
|
5822
|
+
}, [preferredPlacement, resolvedPlacement]);
|
|
5822
5823
|
const anchorReference = React.useRef(null);
|
|
5823
5824
|
const [open, setOpen] = React.useState(false);
|
|
5824
|
-
const {
|
|
5825
|
-
isModern
|
|
5826
|
-
} = componentsTheming.useTheme();
|
|
5827
5825
|
const handleOnClose = () => {
|
|
5828
5826
|
setOpen(false);
|
|
5829
5827
|
onClose?.();
|
|
@@ -5833,25 +5831,21 @@ const Popover$1 = ({
|
|
|
5833
5831
|
children: [/*#__PURE__*/jsxRuntime.jsx("span", {
|
|
5834
5832
|
ref: anchorReference,
|
|
5835
5833
|
className: "d-inline-block",
|
|
5836
|
-
children: /*#__PURE__*/React.cloneElement(children, {
|
|
5834
|
+
children: /*#__PURE__*/React.isValidElement(children) ? /*#__PURE__*/React.cloneElement(children, {
|
|
5837
5835
|
onClick: () => {
|
|
5838
|
-
|
|
5839
|
-
|
|
5840
|
-
}
|
|
5841
|
-
setOpen(!open);
|
|
5836
|
+
children.props.onClick?.();
|
|
5837
|
+
setOpen(prevOpen => !prevOpen);
|
|
5842
5838
|
}
|
|
5843
|
-
})
|
|
5839
|
+
}) : children
|
|
5844
5840
|
}), /*#__PURE__*/jsxRuntime.jsx(ResponsivePanel$1, {
|
|
5845
5841
|
open: open,
|
|
5846
5842
|
anchorRef: anchorReference,
|
|
5847
|
-
position:
|
|
5843
|
+
position: resolvedPlacement,
|
|
5848
5844
|
arrow: true,
|
|
5849
5845
|
className: "np-popover__container",
|
|
5850
5846
|
onClose: handleOnClose,
|
|
5851
5847
|
children: /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
5852
|
-
className:
|
|
5853
|
-
"aria-hidden": !open,
|
|
5854
|
-
role: "dialog",
|
|
5848
|
+
className: "np-popover__content np-text-default-body",
|
|
5855
5849
|
children: [title && /*#__PURE__*/jsxRuntime.jsx(Title, {
|
|
5856
5850
|
type: exports.Typography.TITLE_BODY,
|
|
5857
5851
|
className: "m-b-1",
|
|
@@ -5860,36 +5854,7 @@ const Popover$1 = ({
|
|
|
5860
5854
|
})
|
|
5861
5855
|
})]
|
|
5862
5856
|
});
|
|
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;
|
|
5857
|
+
}
|
|
5893
5858
|
|
|
5894
5859
|
var messages$6 = reactIntl.defineMessages({
|
|
5895
5860
|
ariaLabel: {
|
|
@@ -5940,7 +5905,7 @@ const Info = ({
|
|
|
5940
5905
|
title: title,
|
|
5941
5906
|
onClose: () => setOpen(false)
|
|
5942
5907
|
})]
|
|
5943
|
-
}) : /*#__PURE__*/jsxRuntime.jsx(Popover$
|
|
5908
|
+
}) : /*#__PURE__*/jsxRuntime.jsx(Popover$1, {
|
|
5944
5909
|
content: content,
|
|
5945
5910
|
preferredPlacement: preferredPlacement,
|
|
5946
5911
|
title: title,
|
|
@@ -6996,14 +6961,13 @@ const getSymbolsInPatternWithPosition = pattern => {
|
|
|
6996
6961
|
});
|
|
6997
6962
|
return patternWithSymbolsPosition;
|
|
6998
6963
|
};
|
|
6999
|
-
var getSymbolsInPatternWithPosition$1 = getSymbolsInPatternWithPosition;
|
|
7000
6964
|
|
|
7001
6965
|
const formatWithPattern = (value, pattern) => {
|
|
7002
6966
|
if (!value || value === '') {
|
|
7003
6967
|
return '';
|
|
7004
6968
|
}
|
|
7005
6969
|
const valueArray = value.toString().split('');
|
|
7006
|
-
const patternWithSymbolsPosition = getSymbolsInPatternWithPosition
|
|
6970
|
+
const patternWithSymbolsPosition = getSymbolsInPatternWithPosition(pattern);
|
|
7007
6971
|
let patternSymbol = [];
|
|
7008
6972
|
// valueArray.length increments during the cycle cause we are adding new elements.
|
|
7009
6973
|
for (let index = 0; index < valueArray.length; index += 1) {
|
|
@@ -7018,7 +6982,6 @@ const formatWithPattern = (value, pattern) => {
|
|
|
7018
6982
|
}
|
|
7019
6983
|
return valueArray.join('');
|
|
7020
6984
|
};
|
|
7021
|
-
var formatWithPattern$1 = formatWithPattern;
|
|
7022
6985
|
|
|
7023
6986
|
const unformatWithPattern = (value, pattern) => {
|
|
7024
6987
|
let valueArray = [''];
|
|
@@ -7029,18 +6992,16 @@ const unformatWithPattern = (value, pattern) => {
|
|
|
7029
6992
|
return valueArray.join('');
|
|
7030
6993
|
};
|
|
7031
6994
|
const getSymbolsInPattern = pattern => pattern.split('').filter(symbol => symbol !== '*');
|
|
7032
|
-
var unformatWithPattern$1 = unformatWithPattern;
|
|
7033
6995
|
|
|
7034
|
-
const getCountOfSymbolsInSelection = (selectionStart, selectionEnd, pattern) => getSymbolsInPatternWithPosition
|
|
7035
|
-
var getCountOfSymbolsInSelection$1 = getCountOfSymbolsInSelection;
|
|
6996
|
+
const getCountOfSymbolsInSelection = (selectionStart, selectionEnd, pattern) => getSymbolsInPatternWithPosition(pattern).filter(symbol => symbol.index >= selectionStart && symbol.index < selectionEnd).length;
|
|
7036
6997
|
|
|
7037
6998
|
const getDistanceToNextSymbol = (selectionStart, pattern) => {
|
|
7038
|
-
const patternArray = getSymbolsInPatternWithPosition
|
|
6999
|
+
const patternArray = getSymbolsInPatternWithPosition(pattern);
|
|
7039
7000
|
const applicablePattern = patternArray.filter(symbol => symbol.index >= selectionStart);
|
|
7040
7001
|
return countConsecutiveSymbols(selectionStart, applicablePattern, 'left');
|
|
7041
7002
|
};
|
|
7042
7003
|
const getDistanceToPreviousSymbol = (selectionStart, pattern) => {
|
|
7043
|
-
const patternArray = getSymbolsInPatternWithPosition
|
|
7004
|
+
const patternArray = getSymbolsInPatternWithPosition(pattern);
|
|
7044
7005
|
const applicablePattern = patternArray.filter(symbol => symbol.index < selectionStart).reverse();
|
|
7045
7006
|
return countConsecutiveSymbols(selectionStart, applicablePattern, 'right');
|
|
7046
7007
|
};
|
|
@@ -7070,7 +7031,7 @@ const getCursorPositionAfterActionStroke = (action, selectionStart, selectionEnd
|
|
|
7070
7031
|
}
|
|
7071
7032
|
break;
|
|
7072
7033
|
case 'Paste':
|
|
7073
|
-
cursorPosition += pastedLength + getCountOfSymbolsInSelection
|
|
7034
|
+
cursorPosition += pastedLength + getCountOfSymbolsInSelection(selectionStart, selectionStart + pastedLength, pattern) + getDistanceToNextSymbol(selectionStart + pastedLength, pattern);
|
|
7074
7035
|
break;
|
|
7075
7036
|
case 'Cut':
|
|
7076
7037
|
case 'Delete':
|
|
@@ -7081,7 +7042,6 @@ const getCursorPositionAfterActionStroke = (action, selectionStart, selectionEnd
|
|
|
7081
7042
|
}
|
|
7082
7043
|
return cursorPosition;
|
|
7083
7044
|
};
|
|
7084
|
-
var getCursorPositionAfterKeystroke = getCursorPositionAfterActionStroke;
|
|
7085
7045
|
|
|
7086
7046
|
class WithDisplayFormat extends React.Component {
|
|
7087
7047
|
static defaultProps = {
|
|
@@ -7091,9 +7051,9 @@ class WithDisplayFormat extends React.Component {
|
|
|
7091
7051
|
};
|
|
7092
7052
|
constructor(props) {
|
|
7093
7053
|
super(props);
|
|
7094
|
-
const unformattedValue = unformatWithPattern
|
|
7054
|
+
const unformattedValue = unformatWithPattern(props.value ?? '', props.displayPattern);
|
|
7095
7055
|
this.state = {
|
|
7096
|
-
value: formatWithPattern
|
|
7056
|
+
value: formatWithPattern(unformattedValue, props.displayPattern),
|
|
7097
7057
|
historyNavigator: new HistoryNavigator$1(),
|
|
7098
7058
|
prevDisplayPattern: props.displayPattern,
|
|
7099
7059
|
triggerType: 'Initial',
|
|
@@ -7111,11 +7071,11 @@ class WithDisplayFormat extends React.Component {
|
|
|
7111
7071
|
historyNavigator
|
|
7112
7072
|
}) {
|
|
7113
7073
|
if (prevDisplayPattern !== displayPattern) {
|
|
7114
|
-
const unFormattedValue = unformatWithPattern
|
|
7074
|
+
const unFormattedValue = unformatWithPattern(value, prevDisplayPattern);
|
|
7115
7075
|
historyNavigator.reset();
|
|
7116
7076
|
return {
|
|
7117
7077
|
prevDisplayPattern: displayPattern,
|
|
7118
|
-
value: formatWithPattern
|
|
7078
|
+
value: formatWithPattern(unFormattedValue, displayPattern),
|
|
7119
7079
|
triggerType: null,
|
|
7120
7080
|
triggerEvent: null,
|
|
7121
7081
|
pastedLength: 0
|
|
@@ -7145,7 +7105,7 @@ class WithDisplayFormat extends React.Component {
|
|
|
7145
7105
|
return 'Delete';
|
|
7146
7106
|
}
|
|
7147
7107
|
// Android Fix.
|
|
7148
|
-
if (typeof triggerEvent.key === 'undefined' && unformattedValue.length <= unformatWithPattern
|
|
7108
|
+
if (typeof triggerEvent.key === 'undefined' && unformattedValue.length <= unformatWithPattern(value, displayPattern).length) {
|
|
7149
7109
|
return 'Backspace';
|
|
7150
7110
|
}
|
|
7151
7111
|
return triggerEvent.key;
|
|
@@ -7183,13 +7143,13 @@ class WithDisplayFormat extends React.Component {
|
|
|
7183
7143
|
// Unfortunately Undo and Redo don't trigger OnChange event so we need to handle some value logic here.
|
|
7184
7144
|
let newFormattedValue = '';
|
|
7185
7145
|
if (this.detectUndoRedo(event) === 'Undo') {
|
|
7186
|
-
newFormattedValue = formatWithPattern
|
|
7146
|
+
newFormattedValue = formatWithPattern(historyNavigator.undo(), displayPattern);
|
|
7187
7147
|
this.setState({
|
|
7188
7148
|
value: newFormattedValue,
|
|
7189
7149
|
triggerType: 'Undo'
|
|
7190
7150
|
});
|
|
7191
7151
|
} else if (this.detectUndoRedo(event) === 'Redo') {
|
|
7192
|
-
newFormattedValue = formatWithPattern
|
|
7152
|
+
newFormattedValue = formatWithPattern(historyNavigator.redo(), displayPattern);
|
|
7193
7153
|
this.setState({
|
|
7194
7154
|
value: newFormattedValue,
|
|
7195
7155
|
triggerType: 'Redo'
|
|
@@ -7207,7 +7167,7 @@ class WithDisplayFormat extends React.Component {
|
|
|
7207
7167
|
const {
|
|
7208
7168
|
displayPattern
|
|
7209
7169
|
} = this.props;
|
|
7210
|
-
const pastedLength = unformatWithPattern
|
|
7170
|
+
const pastedLength = unformatWithPattern(event.clipboardData.getData('Text'), displayPattern).length;
|
|
7211
7171
|
this.setState({
|
|
7212
7172
|
triggerType: 'Paste',
|
|
7213
7173
|
pastedLength
|
|
@@ -7237,7 +7197,7 @@ class WithDisplayFormat extends React.Component {
|
|
|
7237
7197
|
const {
|
|
7238
7198
|
value
|
|
7239
7199
|
} = event.target;
|
|
7240
|
-
let unformattedValue = unformatWithPattern
|
|
7200
|
+
let unformattedValue = unformatWithPattern(value, displayPattern);
|
|
7241
7201
|
const action = this.getUserAction(unformattedValue);
|
|
7242
7202
|
if (!this.isKeyAllowed(action) || triggerType === 'Undo' || triggerType === 'Redo') {
|
|
7243
7203
|
return;
|
|
@@ -7245,7 +7205,7 @@ class WithDisplayFormat extends React.Component {
|
|
|
7245
7205
|
if (action === 'Backspace' || action === 'Delete') {
|
|
7246
7206
|
unformattedValue = this.handleDelete(unformattedValue, action);
|
|
7247
7207
|
}
|
|
7248
|
-
const newFormattedValue = formatWithPattern
|
|
7208
|
+
const newFormattedValue = formatWithPattern(unformattedValue, displayPattern);
|
|
7249
7209
|
historyNavigator.add(unformattedValue);
|
|
7250
7210
|
this.handleCursorPositioning(action);
|
|
7251
7211
|
this.setState({
|
|
@@ -7253,13 +7213,13 @@ class WithDisplayFormat extends React.Component {
|
|
|
7253
7213
|
}, () => {
|
|
7254
7214
|
this.resetEvent();
|
|
7255
7215
|
if (onChange) {
|
|
7256
|
-
const broadcastValue = unformatWithPattern
|
|
7216
|
+
const broadcastValue = unformatWithPattern(newFormattedValue, displayPattern);
|
|
7257
7217
|
onChange(broadcastValue);
|
|
7258
7218
|
}
|
|
7259
7219
|
});
|
|
7260
7220
|
};
|
|
7261
7221
|
handleOnBlur = event => {
|
|
7262
|
-
this.props.onBlur?.(unformatWithPattern
|
|
7222
|
+
this.props.onBlur?.(unformatWithPattern(event.target.value, this.props.displayPattern));
|
|
7263
7223
|
};
|
|
7264
7224
|
handleOnFocus = event => {
|
|
7265
7225
|
const {
|
|
@@ -7268,7 +7228,7 @@ class WithDisplayFormat extends React.Component {
|
|
|
7268
7228
|
} = this.props;
|
|
7269
7229
|
if (onFocus) {
|
|
7270
7230
|
this.handleOnChange(event);
|
|
7271
|
-
onFocus(unformatWithPattern
|
|
7231
|
+
onFocus(unformatWithPattern(event.target.value, displayPattern));
|
|
7272
7232
|
}
|
|
7273
7233
|
};
|
|
7274
7234
|
handleDelete = (unformattedValue, action) => {
|
|
@@ -7281,7 +7241,7 @@ class WithDisplayFormat extends React.Component {
|
|
|
7281
7241
|
} = this.state;
|
|
7282
7242
|
const newStack = [...unformattedValue];
|
|
7283
7243
|
if (selectionStart === selectionEnd) {
|
|
7284
|
-
let startPosition = selectionStart - getCountOfSymbolsInSelection
|
|
7244
|
+
let startPosition = selectionStart - getCountOfSymbolsInSelection(0, selectionStart, displayPattern);
|
|
7285
7245
|
let toDelete = 0;
|
|
7286
7246
|
let count = getDistanceToNextSymbol(selectionStart, displayPattern);
|
|
7287
7247
|
if (action === 'Backspace') {
|
|
@@ -7305,7 +7265,7 @@ class WithDisplayFormat extends React.Component {
|
|
|
7305
7265
|
selectionEnd,
|
|
7306
7266
|
pastedLength
|
|
7307
7267
|
} = this.state;
|
|
7308
|
-
const cursorPosition =
|
|
7268
|
+
const cursorPosition = getCursorPositionAfterActionStroke(action, selectionStart, selectionEnd, displayPattern, pastedLength);
|
|
7309
7269
|
setTimeout(() => {
|
|
7310
7270
|
if (triggerEvent) {
|
|
7311
7271
|
triggerEvent.target.setSelectionRange(cursorPosition, cursorPosition);
|
|
@@ -9693,7 +9653,8 @@ const PromoCard = /*#__PURE__*/React.forwardRef(({
|
|
|
9693
9653
|
setChecked(!checked); // Update local state for checkbox
|
|
9694
9654
|
}
|
|
9695
9655
|
};
|
|
9696
|
-
const
|
|
9656
|
+
const fallbackId = reactId.useId();
|
|
9657
|
+
const componentId = id || fallbackId;
|
|
9697
9658
|
// Set the icon to `'arrow'` if `href` is truthy and `type` is falsy, or
|
|
9698
9659
|
// `'download'` if `download` is truthy. If neither condition is true, set
|
|
9699
9660
|
// `icon` to `undefined`.
|
|
@@ -15207,7 +15168,7 @@ exports.Nudge = Nudge;
|
|
|
15207
15168
|
exports.Option = Option$2;
|
|
15208
15169
|
exports.OverlayHeader = OverlayHeader$1;
|
|
15209
15170
|
exports.PhoneNumberInput = PhoneNumberInput;
|
|
15210
|
-
exports.Popover = Popover$
|
|
15171
|
+
exports.Popover = Popover$1;
|
|
15211
15172
|
exports.ProcessIndicator = ProcessIndicator$1;
|
|
15212
15173
|
exports.Progress = Progress;
|
|
15213
15174
|
exports.ProgressBar = ProgressBar;
|