@transferwise/components 46.18.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 +70 -107
- package/build/index.esm.js.map +1 -1
- package/build/index.js +70 -107
- package/build/index.js.map +1 -1
- package/build/types/actionButton/ActionButton.d.ts +1 -1
- package/build/types/circularButton/CircularButton.d.ts +16 -20
- package/build/types/circularButton/CircularButton.d.ts.map +1 -1
- package/build/types/circularButton/index.d.ts +2 -1
- package/build/types/circularButton/index.d.ts.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 +2 -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/phoneNumberInput/PhoneNumberInput.d.ts +2 -1
- package/build/types/phoneNumberInput/PhoneNumberInput.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/summary/Summary.d.ts.map +1 -1
- package/build/types/typeahead/typeaheadInput/TypeaheadInput.d.ts +1 -1
- package/package.json +1 -1
- package/src/circularButton/{CircularButton.story.js → CircularButton.story.tsx} +2 -2
- package/src/circularButton/CircularButton.tsx +51 -0
- package/src/circularButton/index.ts +2 -0
- 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 +2 -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/phoneNumberInput/PhoneNumberInput.rtl.spec.tsx +22 -0
- package/src/phoneNumberInput/PhoneNumberInput.tsx +3 -1
- 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/summary/Summary.tsx +7 -1
- package/src/typeahead/Typeahead.spec.js +9 -0
- package/src/typeahead/Typeahead.tsx +1 -1
- package/src/typeahead/typeaheadInput/TypeaheadInput.tsx +3 -3
- package/src/circularButton/CircularButton.js +0 -57
- package/src/circularButton/index.js +0 -1
- package/src/popover/Popover.js +0 -101
- package/src/popover/index.js +0 -1
- /package/src/circularButton/{CircularButton.spec.js → CircularButton.spec.tsx} +0 -0
- /package/src/circularButton/__snapshots__/{CircularButton.spec.js.snap → CircularButton.spec.tsx.snap} +0 -0
- /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
|
}) {
|
|
@@ -2689,16 +2689,16 @@ const CircularButton = ({
|
|
|
2689
2689
|
children,
|
|
2690
2690
|
disabled,
|
|
2691
2691
|
icon,
|
|
2692
|
-
priority,
|
|
2693
|
-
type,
|
|
2692
|
+
priority = exports.Priority.PRIMARY,
|
|
2693
|
+
type = exports.ControlType.ACCENT,
|
|
2694
2694
|
...rest
|
|
2695
2695
|
}) => {
|
|
2696
2696
|
const classes = classNames__default.default('btn np-btn', typeClassMap$1[type], priorityClassMap[priority]);
|
|
2697
|
-
const iconElement = icon.props.size !== 24 ? /*#__PURE__*/React.cloneElement(icon, {
|
|
2697
|
+
const iconElement = Number(icon.props.size) !== 24 ? /*#__PURE__*/React.cloneElement(icon, {
|
|
2698
2698
|
size: 24
|
|
2699
2699
|
}) : icon;
|
|
2700
2700
|
return /*#__PURE__*/jsxRuntime.jsxs("label", {
|
|
2701
|
-
className: classNames__default.default('np-circular-btn', priority, type, disabled
|
|
2701
|
+
className: classNames__default.default('np-circular-btn', priority, type, disabled && 'disabled', className),
|
|
2702
2702
|
children: [/*#__PURE__*/jsxRuntime.jsx("input", {
|
|
2703
2703
|
type: "button",
|
|
2704
2704
|
"aria-label": children,
|
|
@@ -2713,22 +2713,6 @@ const CircularButton = ({
|
|
|
2713
2713
|
})]
|
|
2714
2714
|
});
|
|
2715
2715
|
};
|
|
2716
|
-
CircularButton.propTypes = {
|
|
2717
|
-
className: PropTypes__default.default.string,
|
|
2718
|
-
children: PropTypes__default.default.string.isRequired,
|
|
2719
|
-
disabled: PropTypes__default.default.bool,
|
|
2720
|
-
icon: PropTypes__default.default.element.isRequired,
|
|
2721
|
-
onClick: PropTypes__default.default.func,
|
|
2722
|
-
priority: PropTypes__default.default.oneOf(['primary', 'secondary']),
|
|
2723
|
-
type: PropTypes__default.default.oneOf(['accent', 'positive', 'negative'])
|
|
2724
|
-
};
|
|
2725
|
-
CircularButton.defaultProps = {
|
|
2726
|
-
className: undefined,
|
|
2727
|
-
disabled: false,
|
|
2728
|
-
priority: exports.Priority.PRIMARY,
|
|
2729
|
-
type: exports.ControlType.ACCENT
|
|
2730
|
-
};
|
|
2731
|
-
var CircularButton$1 = CircularButton;
|
|
2732
2716
|
|
|
2733
2717
|
function getDayNames(locale, format = 'short') {
|
|
2734
2718
|
const days = [];
|
|
@@ -3168,7 +3152,8 @@ const Panel = /*#__PURE__*/React.forwardRef(({
|
|
|
3168
3152
|
onClose: onClose,
|
|
3169
3153
|
children: /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
3170
3154
|
...rest,
|
|
3171
|
-
ref: setPopperElement
|
|
3155
|
+
ref: setPopperElement,
|
|
3156
|
+
role: "dialog"
|
|
3172
3157
|
// eslint-disable-next-line react/forbid-dom-props
|
|
3173
3158
|
,
|
|
3174
3159
|
style: {
|
|
@@ -5301,6 +5286,7 @@ const Logo = ({
|
|
|
5301
5286
|
const LogoMd = svgPaths[`${type}${inverse ? '_INVERSE' : ''}`];
|
|
5302
5287
|
return /*#__PURE__*/jsxRuntime.jsxs("span", {
|
|
5303
5288
|
"aria-label": type === exports.LogoType.WISE ? 'Wise' : 'Wise business',
|
|
5289
|
+
role: "img",
|
|
5304
5290
|
className: classNames__default.default(className, 'np-logo'),
|
|
5305
5291
|
children: [/*#__PURE__*/jsxRuntime.jsx(LogoSm, {
|
|
5306
5292
|
className: "np-logo-svg np-logo-svg--size-sm"
|
|
@@ -5824,22 +5810,33 @@ const Modal = ({
|
|
|
5824
5810
|
});
|
|
5825
5811
|
};
|
|
5826
5812
|
|
|
5827
|
-
|
|
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({
|
|
5828
5825
|
children,
|
|
5829
5826
|
className,
|
|
5830
5827
|
content,
|
|
5831
|
-
preferredPlacement,
|
|
5828
|
+
preferredPlacement = exports.Position.RIGHT,
|
|
5832
5829
|
title,
|
|
5833
5830
|
onClose
|
|
5834
|
-
})
|
|
5835
|
-
|
|
5836
|
-
|
|
5837
|
-
|
|
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]);
|
|
5838
5838
|
const anchorReference = React.useRef(null);
|
|
5839
5839
|
const [open, setOpen] = React.useState(false);
|
|
5840
|
-
const {
|
|
5841
|
-
isModern
|
|
5842
|
-
} = componentsTheming.useTheme();
|
|
5843
5840
|
const handleOnClose = () => {
|
|
5844
5841
|
setOpen(false);
|
|
5845
5842
|
onClose?.();
|
|
@@ -5849,25 +5846,21 @@ const Popover$1 = ({
|
|
|
5849
5846
|
children: [/*#__PURE__*/jsxRuntime.jsx("span", {
|
|
5850
5847
|
ref: anchorReference,
|
|
5851
5848
|
className: "d-inline-block",
|
|
5852
|
-
children: /*#__PURE__*/React.cloneElement(children, {
|
|
5849
|
+
children: /*#__PURE__*/React.isValidElement(children) ? /*#__PURE__*/React.cloneElement(children, {
|
|
5853
5850
|
onClick: () => {
|
|
5854
|
-
|
|
5855
|
-
|
|
5856
|
-
}
|
|
5857
|
-
setOpen(!open);
|
|
5851
|
+
children.props.onClick?.();
|
|
5852
|
+
setOpen(prevOpen => !prevOpen);
|
|
5858
5853
|
}
|
|
5859
|
-
})
|
|
5854
|
+
}) : children
|
|
5860
5855
|
}), /*#__PURE__*/jsxRuntime.jsx(ResponsivePanel$1, {
|
|
5861
5856
|
open: open,
|
|
5862
5857
|
anchorRef: anchorReference,
|
|
5863
|
-
position:
|
|
5858
|
+
position: resolvedPlacement,
|
|
5864
5859
|
arrow: true,
|
|
5865
5860
|
className: "np-popover__container",
|
|
5866
5861
|
onClose: handleOnClose,
|
|
5867
5862
|
children: /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
5868
|
-
className:
|
|
5869
|
-
"aria-hidden": !open,
|
|
5870
|
-
role: "dialog",
|
|
5863
|
+
className: "np-popover__content np-text-default-body",
|
|
5871
5864
|
children: [title && /*#__PURE__*/jsxRuntime.jsx(Title, {
|
|
5872
5865
|
type: exports.Typography.TITLE_BODY,
|
|
5873
5866
|
className: "m-b-1",
|
|
@@ -5876,36 +5869,7 @@ const Popover$1 = ({
|
|
|
5876
5869
|
})
|
|
5877
5870
|
})]
|
|
5878
5871
|
});
|
|
5879
|
-
}
|
|
5880
|
-
const logActionRequired = ({
|
|
5881
|
-
preferredPlacement
|
|
5882
|
-
}) => {
|
|
5883
|
-
logActionRequiredIf(`Popover has deprecated ${preferredPlacement} value for the 'preferredPlacement' prop. Please use ${deprecatedPlacements[preferredPlacement]} instead.`, deprecatedPlacements[preferredPlacement]);
|
|
5884
|
-
};
|
|
5885
|
-
Popover$1.defaultProps = {
|
|
5886
|
-
className: undefined,
|
|
5887
|
-
preferredPlacement: exports.Position.RIGHT,
|
|
5888
|
-
title: undefined
|
|
5889
|
-
};
|
|
5890
|
-
Popover$1.propTypes = {
|
|
5891
|
-
children: PropTypes__default.default.node.isRequired,
|
|
5892
|
-
className: PropTypes__default.default.string,
|
|
5893
|
-
content: PropTypes__default.default.node.isRequired,
|
|
5894
|
-
/**
|
|
5895
|
-
* `'left-top'` / `'right-top'` are deprecated use `Position.TOP` / `'top'` instead,
|
|
5896
|
-
* `'bottom-right'` / `'bottom-left'` are deprecated use `Position.BOTTOM` / `'bottom'` instead
|
|
5897
|
-
*/
|
|
5898
|
-
preferredPlacement: PropTypes__default.default.oneOf(['top', 'right', 'bottom', 'left', 'left-top', 'right-top', 'bottom-right', 'bottom-left']),
|
|
5899
|
-
onClose: PropTypes__default.default.func,
|
|
5900
|
-
title: PropTypes__default.default.node
|
|
5901
|
-
};
|
|
5902
|
-
const deprecatedPlacements = {
|
|
5903
|
-
[exports.Position.BOTTOM_LEFT]: exports.Position.BOTTOM,
|
|
5904
|
-
[exports.Position.BOTTOM_RIGHT]: exports.Position.BOTTOM,
|
|
5905
|
-
[exports.Position.LEFT_TOP]: exports.Position.TOP,
|
|
5906
|
-
[exports.Position.RIGHT_TOP]: exports.Position.TOP
|
|
5907
|
-
};
|
|
5908
|
-
var Popover$2 = Popover$1;
|
|
5872
|
+
}
|
|
5909
5873
|
|
|
5910
5874
|
var messages$6 = reactIntl.defineMessages({
|
|
5911
5875
|
ariaLabel: {
|
|
@@ -5956,7 +5920,7 @@ const Info = ({
|
|
|
5956
5920
|
title: title,
|
|
5957
5921
|
onClose: () => setOpen(false)
|
|
5958
5922
|
})]
|
|
5959
|
-
}) : /*#__PURE__*/jsxRuntime.jsx(Popover$
|
|
5923
|
+
}) : /*#__PURE__*/jsxRuntime.jsx(Popover$1, {
|
|
5960
5924
|
content: content,
|
|
5961
5925
|
preferredPlacement: preferredPlacement,
|
|
5962
5926
|
title: title,
|
|
@@ -7012,14 +6976,13 @@ const getSymbolsInPatternWithPosition = pattern => {
|
|
|
7012
6976
|
});
|
|
7013
6977
|
return patternWithSymbolsPosition;
|
|
7014
6978
|
};
|
|
7015
|
-
var getSymbolsInPatternWithPosition$1 = getSymbolsInPatternWithPosition;
|
|
7016
6979
|
|
|
7017
6980
|
const formatWithPattern = (value, pattern) => {
|
|
7018
6981
|
if (!value || value === '') {
|
|
7019
6982
|
return '';
|
|
7020
6983
|
}
|
|
7021
6984
|
const valueArray = value.toString().split('');
|
|
7022
|
-
const patternWithSymbolsPosition = getSymbolsInPatternWithPosition
|
|
6985
|
+
const patternWithSymbolsPosition = getSymbolsInPatternWithPosition(pattern);
|
|
7023
6986
|
let patternSymbol = [];
|
|
7024
6987
|
// valueArray.length increments during the cycle cause we are adding new elements.
|
|
7025
6988
|
for (let index = 0; index < valueArray.length; index += 1) {
|
|
@@ -7034,7 +6997,6 @@ const formatWithPattern = (value, pattern) => {
|
|
|
7034
6997
|
}
|
|
7035
6998
|
return valueArray.join('');
|
|
7036
6999
|
};
|
|
7037
|
-
var formatWithPattern$1 = formatWithPattern;
|
|
7038
7000
|
|
|
7039
7001
|
const unformatWithPattern = (value, pattern) => {
|
|
7040
7002
|
let valueArray = [''];
|
|
@@ -7045,18 +7007,16 @@ const unformatWithPattern = (value, pattern) => {
|
|
|
7045
7007
|
return valueArray.join('');
|
|
7046
7008
|
};
|
|
7047
7009
|
const getSymbolsInPattern = pattern => pattern.split('').filter(symbol => symbol !== '*');
|
|
7048
|
-
var unformatWithPattern$1 = unformatWithPattern;
|
|
7049
7010
|
|
|
7050
|
-
const getCountOfSymbolsInSelection = (selectionStart, selectionEnd, pattern) => getSymbolsInPatternWithPosition
|
|
7051
|
-
var getCountOfSymbolsInSelection$1 = getCountOfSymbolsInSelection;
|
|
7011
|
+
const getCountOfSymbolsInSelection = (selectionStart, selectionEnd, pattern) => getSymbolsInPatternWithPosition(pattern).filter(symbol => symbol.index >= selectionStart && symbol.index < selectionEnd).length;
|
|
7052
7012
|
|
|
7053
7013
|
const getDistanceToNextSymbol = (selectionStart, pattern) => {
|
|
7054
|
-
const patternArray = getSymbolsInPatternWithPosition
|
|
7014
|
+
const patternArray = getSymbolsInPatternWithPosition(pattern);
|
|
7055
7015
|
const applicablePattern = patternArray.filter(symbol => symbol.index >= selectionStart);
|
|
7056
7016
|
return countConsecutiveSymbols(selectionStart, applicablePattern, 'left');
|
|
7057
7017
|
};
|
|
7058
7018
|
const getDistanceToPreviousSymbol = (selectionStart, pattern) => {
|
|
7059
|
-
const patternArray = getSymbolsInPatternWithPosition
|
|
7019
|
+
const patternArray = getSymbolsInPatternWithPosition(pattern);
|
|
7060
7020
|
const applicablePattern = patternArray.filter(symbol => symbol.index < selectionStart).reverse();
|
|
7061
7021
|
return countConsecutiveSymbols(selectionStart, applicablePattern, 'right');
|
|
7062
7022
|
};
|
|
@@ -7086,7 +7046,7 @@ const getCursorPositionAfterActionStroke = (action, selectionStart, selectionEnd
|
|
|
7086
7046
|
}
|
|
7087
7047
|
break;
|
|
7088
7048
|
case 'Paste':
|
|
7089
|
-
cursorPosition += pastedLength + getCountOfSymbolsInSelection
|
|
7049
|
+
cursorPosition += pastedLength + getCountOfSymbolsInSelection(selectionStart, selectionStart + pastedLength, pattern) + getDistanceToNextSymbol(selectionStart + pastedLength, pattern);
|
|
7090
7050
|
break;
|
|
7091
7051
|
case 'Cut':
|
|
7092
7052
|
case 'Delete':
|
|
@@ -7097,7 +7057,6 @@ const getCursorPositionAfterActionStroke = (action, selectionStart, selectionEnd
|
|
|
7097
7057
|
}
|
|
7098
7058
|
return cursorPosition;
|
|
7099
7059
|
};
|
|
7100
|
-
var getCursorPositionAfterKeystroke = getCursorPositionAfterActionStroke;
|
|
7101
7060
|
|
|
7102
7061
|
class WithDisplayFormat extends React.Component {
|
|
7103
7062
|
static defaultProps = {
|
|
@@ -7107,9 +7066,9 @@ class WithDisplayFormat extends React.Component {
|
|
|
7107
7066
|
};
|
|
7108
7067
|
constructor(props) {
|
|
7109
7068
|
super(props);
|
|
7110
|
-
const unformattedValue = unformatWithPattern
|
|
7069
|
+
const unformattedValue = unformatWithPattern(props.value ?? '', props.displayPattern);
|
|
7111
7070
|
this.state = {
|
|
7112
|
-
value: formatWithPattern
|
|
7071
|
+
value: formatWithPattern(unformattedValue, props.displayPattern),
|
|
7113
7072
|
historyNavigator: new HistoryNavigator$1(),
|
|
7114
7073
|
prevDisplayPattern: props.displayPattern,
|
|
7115
7074
|
triggerType: 'Initial',
|
|
@@ -7127,11 +7086,11 @@ class WithDisplayFormat extends React.Component {
|
|
|
7127
7086
|
historyNavigator
|
|
7128
7087
|
}) {
|
|
7129
7088
|
if (prevDisplayPattern !== displayPattern) {
|
|
7130
|
-
const unFormattedValue = unformatWithPattern
|
|
7089
|
+
const unFormattedValue = unformatWithPattern(value, prevDisplayPattern);
|
|
7131
7090
|
historyNavigator.reset();
|
|
7132
7091
|
return {
|
|
7133
7092
|
prevDisplayPattern: displayPattern,
|
|
7134
|
-
value: formatWithPattern
|
|
7093
|
+
value: formatWithPattern(unFormattedValue, displayPattern),
|
|
7135
7094
|
triggerType: null,
|
|
7136
7095
|
triggerEvent: null,
|
|
7137
7096
|
pastedLength: 0
|
|
@@ -7161,7 +7120,7 @@ class WithDisplayFormat extends React.Component {
|
|
|
7161
7120
|
return 'Delete';
|
|
7162
7121
|
}
|
|
7163
7122
|
// Android Fix.
|
|
7164
|
-
if (typeof triggerEvent.key === 'undefined' && unformattedValue.length <= unformatWithPattern
|
|
7123
|
+
if (typeof triggerEvent.key === 'undefined' && unformattedValue.length <= unformatWithPattern(value, displayPattern).length) {
|
|
7165
7124
|
return 'Backspace';
|
|
7166
7125
|
}
|
|
7167
7126
|
return triggerEvent.key;
|
|
@@ -7199,13 +7158,13 @@ class WithDisplayFormat extends React.Component {
|
|
|
7199
7158
|
// Unfortunately Undo and Redo don't trigger OnChange event so we need to handle some value logic here.
|
|
7200
7159
|
let newFormattedValue = '';
|
|
7201
7160
|
if (this.detectUndoRedo(event) === 'Undo') {
|
|
7202
|
-
newFormattedValue = formatWithPattern
|
|
7161
|
+
newFormattedValue = formatWithPattern(historyNavigator.undo(), displayPattern);
|
|
7203
7162
|
this.setState({
|
|
7204
7163
|
value: newFormattedValue,
|
|
7205
7164
|
triggerType: 'Undo'
|
|
7206
7165
|
});
|
|
7207
7166
|
} else if (this.detectUndoRedo(event) === 'Redo') {
|
|
7208
|
-
newFormattedValue = formatWithPattern
|
|
7167
|
+
newFormattedValue = formatWithPattern(historyNavigator.redo(), displayPattern);
|
|
7209
7168
|
this.setState({
|
|
7210
7169
|
value: newFormattedValue,
|
|
7211
7170
|
triggerType: 'Redo'
|
|
@@ -7223,7 +7182,7 @@ class WithDisplayFormat extends React.Component {
|
|
|
7223
7182
|
const {
|
|
7224
7183
|
displayPattern
|
|
7225
7184
|
} = this.props;
|
|
7226
|
-
const pastedLength = unformatWithPattern
|
|
7185
|
+
const pastedLength = unformatWithPattern(event.clipboardData.getData('Text'), displayPattern).length;
|
|
7227
7186
|
this.setState({
|
|
7228
7187
|
triggerType: 'Paste',
|
|
7229
7188
|
pastedLength
|
|
@@ -7253,7 +7212,7 @@ class WithDisplayFormat extends React.Component {
|
|
|
7253
7212
|
const {
|
|
7254
7213
|
value
|
|
7255
7214
|
} = event.target;
|
|
7256
|
-
let unformattedValue = unformatWithPattern
|
|
7215
|
+
let unformattedValue = unformatWithPattern(value, displayPattern);
|
|
7257
7216
|
const action = this.getUserAction(unformattedValue);
|
|
7258
7217
|
if (!this.isKeyAllowed(action) || triggerType === 'Undo' || triggerType === 'Redo') {
|
|
7259
7218
|
return;
|
|
@@ -7261,7 +7220,7 @@ class WithDisplayFormat extends React.Component {
|
|
|
7261
7220
|
if (action === 'Backspace' || action === 'Delete') {
|
|
7262
7221
|
unformattedValue = this.handleDelete(unformattedValue, action);
|
|
7263
7222
|
}
|
|
7264
|
-
const newFormattedValue = formatWithPattern
|
|
7223
|
+
const newFormattedValue = formatWithPattern(unformattedValue, displayPattern);
|
|
7265
7224
|
historyNavigator.add(unformattedValue);
|
|
7266
7225
|
this.handleCursorPositioning(action);
|
|
7267
7226
|
this.setState({
|
|
@@ -7269,13 +7228,13 @@ class WithDisplayFormat extends React.Component {
|
|
|
7269
7228
|
}, () => {
|
|
7270
7229
|
this.resetEvent();
|
|
7271
7230
|
if (onChange) {
|
|
7272
|
-
const broadcastValue = unformatWithPattern
|
|
7231
|
+
const broadcastValue = unformatWithPattern(newFormattedValue, displayPattern);
|
|
7273
7232
|
onChange(broadcastValue);
|
|
7274
7233
|
}
|
|
7275
7234
|
});
|
|
7276
7235
|
};
|
|
7277
7236
|
handleOnBlur = event => {
|
|
7278
|
-
this.props.onBlur?.(unformatWithPattern
|
|
7237
|
+
this.props.onBlur?.(unformatWithPattern(event.target.value, this.props.displayPattern));
|
|
7279
7238
|
};
|
|
7280
7239
|
handleOnFocus = event => {
|
|
7281
7240
|
const {
|
|
@@ -7284,7 +7243,7 @@ class WithDisplayFormat extends React.Component {
|
|
|
7284
7243
|
} = this.props;
|
|
7285
7244
|
if (onFocus) {
|
|
7286
7245
|
this.handleOnChange(event);
|
|
7287
|
-
onFocus(unformatWithPattern
|
|
7246
|
+
onFocus(unformatWithPattern(event.target.value, displayPattern));
|
|
7288
7247
|
}
|
|
7289
7248
|
};
|
|
7290
7249
|
handleDelete = (unformattedValue, action) => {
|
|
@@ -7297,7 +7256,7 @@ class WithDisplayFormat extends React.Component {
|
|
|
7297
7256
|
} = this.state;
|
|
7298
7257
|
const newStack = [...unformattedValue];
|
|
7299
7258
|
if (selectionStart === selectionEnd) {
|
|
7300
|
-
let startPosition = selectionStart - getCountOfSymbolsInSelection
|
|
7259
|
+
let startPosition = selectionStart - getCountOfSymbolsInSelection(0, selectionStart, displayPattern);
|
|
7301
7260
|
let toDelete = 0;
|
|
7302
7261
|
let count = getDistanceToNextSymbol(selectionStart, displayPattern);
|
|
7303
7262
|
if (action === 'Backspace') {
|
|
@@ -7321,7 +7280,7 @@ class WithDisplayFormat extends React.Component {
|
|
|
7321
7280
|
selectionEnd,
|
|
7322
7281
|
pastedLength
|
|
7323
7282
|
} = this.state;
|
|
7324
|
-
const cursorPosition =
|
|
7283
|
+
const cursorPosition = getCursorPositionAfterActionStroke(action, selectionStart, selectionEnd, displayPattern, pastedLength);
|
|
7325
7284
|
setTimeout(() => {
|
|
7326
7285
|
if (triggerEvent) {
|
|
7327
7286
|
triggerEvent.target.setSelectionRange(cursorPosition, cursorPosition);
|
|
@@ -9435,6 +9394,7 @@ const defaultSelectProps = {};
|
|
|
9435
9394
|
const defaultDisabledCountries = [];
|
|
9436
9395
|
const PhoneNumberInput = ({
|
|
9437
9396
|
id,
|
|
9397
|
+
'aria-labelledby': ariaLabelledBy,
|
|
9438
9398
|
required,
|
|
9439
9399
|
disabled,
|
|
9440
9400
|
initialValue,
|
|
@@ -9497,6 +9457,7 @@ const PhoneNumberInput = ({
|
|
|
9497
9457
|
setBroadcastedValue(internalValue);
|
|
9498
9458
|
}, [onChange, broadcastedValue, internalValue]);
|
|
9499
9459
|
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
9460
|
+
"aria-labelledby": ariaLabelledBy,
|
|
9500
9461
|
className: "tw-telephone",
|
|
9501
9462
|
children: [/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
9502
9463
|
className: "tw-telephone__country-select",
|
|
@@ -11123,6 +11084,8 @@ const Summary = ({
|
|
|
11123
11084
|
className: "np-summary__title d-flex",
|
|
11124
11085
|
children: [/*#__PURE__*/jsxRuntime.jsx(Body, {
|
|
11125
11086
|
as: "span",
|
|
11087
|
+
role: "heading",
|
|
11088
|
+
"aria-level": 4,
|
|
11126
11089
|
type: exports.Typography.BODY_LARGE_BOLD,
|
|
11127
11090
|
className: "text-primary m-b-1",
|
|
11128
11091
|
children: title
|
|
@@ -11986,7 +11949,7 @@ class TypeaheadInput extends React.Component {
|
|
|
11986
11949
|
autoFocus,
|
|
11987
11950
|
multiple,
|
|
11988
11951
|
name,
|
|
11989
|
-
|
|
11952
|
+
dropdownOpen,
|
|
11990
11953
|
placeholder,
|
|
11991
11954
|
selected,
|
|
11992
11955
|
value,
|
|
@@ -12008,7 +11971,7 @@ class TypeaheadInput extends React.Component {
|
|
|
12008
11971
|
autoFocus: autoFocus,
|
|
12009
11972
|
placeholder: hasPlaceholder ? placeholder : '',
|
|
12010
11973
|
"aria-autocomplete": "list",
|
|
12011
|
-
"aria-expanded":
|
|
11974
|
+
"aria-expanded": dropdownOpen,
|
|
12012
11975
|
"aria-haspopup": "listbox",
|
|
12013
11976
|
"aria-controls": `menu-${typeaheadId}`,
|
|
12014
11977
|
autoComplete: autoComplete,
|
|
@@ -12510,7 +12473,7 @@ class Typeahead extends React.Component {
|
|
|
12510
12473
|
}), /*#__PURE__*/jsxRuntime.jsx(TypeaheadInput, {
|
|
12511
12474
|
autoFocus,
|
|
12512
12475
|
multiple,
|
|
12513
|
-
|
|
12476
|
+
dropdownOpen,
|
|
12514
12477
|
placeholder,
|
|
12515
12478
|
selected,
|
|
12516
12479
|
maxHeight,
|
|
@@ -15180,7 +15143,7 @@ exports.CheckboxOption = CheckboxOption;
|
|
|
15180
15143
|
exports.Chevron = Chevron;
|
|
15181
15144
|
exports.Chip = Chip;
|
|
15182
15145
|
exports.Chips = Chips;
|
|
15183
|
-
exports.CircularButton = CircularButton
|
|
15146
|
+
exports.CircularButton = CircularButton;
|
|
15184
15147
|
exports.CriticalCommsBanner = CriticalCommsBanner;
|
|
15185
15148
|
exports.DEFAULT_LANG = DEFAULT_LANG;
|
|
15186
15149
|
exports.DEFAULT_LOCALE = DEFAULT_LOCALE;
|
|
@@ -15219,7 +15182,7 @@ exports.Nudge = Nudge;
|
|
|
15219
15182
|
exports.Option = Option$2;
|
|
15220
15183
|
exports.OverlayHeader = OverlayHeader$1;
|
|
15221
15184
|
exports.PhoneNumberInput = PhoneNumberInput;
|
|
15222
|
-
exports.Popover = Popover$
|
|
15185
|
+
exports.Popover = Popover$1;
|
|
15223
15186
|
exports.ProcessIndicator = ProcessIndicator$1;
|
|
15224
15187
|
exports.Progress = Progress;
|
|
15225
15188
|
exports.ProgressBar = ProgressBar;
|