@transferwise/components 0.0.0-experimental-9b30760 → 0.0.0-experimental-683a8ba
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/index.esm.js +110 -114
- package/build/index.esm.js.map +1 -1
- package/build/index.js +110 -114
- package/build/index.js.map +1 -1
- package/build/types/circularButton/CircularButton.d.ts +2 -2
- package/build/types/circularButton/CircularButton.d.ts.map +1 -1
- package/build/types/common/bottomSheet/BottomSheet.d.ts.map +1 -1
- package/build/types/common/textFormat/formatWithPattern/index.d.ts +1 -1
- package/build/types/common/textFormat/formatWithPattern/index.d.ts.map +1 -1
- package/build/types/common/textFormat/getCountOfSymbolsInSelection/getCountOfSymbolsInSelection.d.ts +1 -1
- package/build/types/common/textFormat/getCountOfSymbolsInSelection/getCountOfSymbolsInSelection.d.ts.map +1 -1
- package/build/types/common/textFormat/getCountOfSymbolsInSelection/index.d.ts +1 -1
- package/build/types/common/textFormat/getCountOfSymbolsInSelection/index.d.ts.map +1 -1
- package/build/types/common/textFormat/getCursorPositionAfterKeystroke/index.d.ts +1 -1
- package/build/types/common/textFormat/getCursorPositionAfterKeystroke/index.d.ts.map +1 -1
- package/build/types/common/textFormat/getDistanceToSymbol/getDistanceToSymbol.d.ts +2 -2
- package/build/types/common/textFormat/getDistanceToSymbol/getDistanceToSymbol.d.ts.map +1 -1
- package/build/types/common/textFormat/getDistanceToSymbol/index.d.ts +1 -1
- package/build/types/common/textFormat/getDistanceToSymbol/index.d.ts.map +1 -1
- package/build/types/common/textFormat/getSymbolsInPatternWithPosition/index.d.ts +1 -1
- package/build/types/common/textFormat/getSymbolsInPatternWithPosition/index.d.ts.map +1 -1
- package/build/types/common/textFormat/index.d.ts +7 -6
- package/build/types/common/textFormat/index.d.ts.map +1 -1
- package/build/types/common/textFormat/unformatWithPattern/index.d.ts +1 -1
- package/build/types/common/textFormat/unformatWithPattern/index.d.ts.map +1 -1
- package/build/types/index.d.ts +1 -1
- package/build/types/index.d.ts.map +1 -1
- package/build/types/info/Info.d.ts +2 -3
- package/build/types/info/Info.d.ts.map +1 -1
- package/build/types/logo/Logo.d.ts.map +1 -1
- package/build/types/popover/Popover.d.ts +21 -16
- package/build/types/popover/Popover.d.ts.map +1 -1
- package/build/types/popover/index.d.ts +1 -2
- package/build/types/popover/index.d.ts.map +1 -1
- package/build/types/slidingPanel/SlidingPanel.d.ts +12 -17
- package/build/types/slidingPanel/SlidingPanel.d.ts.map +1 -1
- package/build/types/slidingPanel/index.d.ts +2 -1
- package/build/types/slidingPanel/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/circularButton/CircularButton.tsx +2 -2
- package/src/common/bottomSheet/BottomSheet.tsx +47 -41
- package/src/common/bottomSheet/__snapshots__/BottomSheet.spec.tsx.snap +37 -33
- package/src/common/textFormat/getCountOfSymbolsInSelection/{getCountOfSymbolsInSelection.js → getCountOfSymbolsInSelection.ts} +5 -1
- package/src/common/textFormat/getCursorPositionAfterKeystroke/{getCursorPositionAfterKeystroke.spec.js → getCursorPositionAfterKeystroke.spec.ts} +15 -18
- package/src/common/textFormat/getDistanceToSymbol/{getDistanceToSymbol.spec.js → getDistanceToSymbol.spec.ts} +3 -3
- package/src/common/textFormat/getDistanceToSymbol/{getDistanceToSymbol.js → getDistanceToSymbol.ts} +8 -3
- package/src/index.ts +1 -1
- package/src/info/Info.tsx +2 -2
- package/src/logo/Logo.js +1 -0
- package/src/logo/__snapshots__/Logo.spec.js.snap +6 -0
- package/src/popover/Popover.js +101 -0
- package/src/popover/{Popover.spec.tsx → Popover.spec.js} +2 -5
- package/src/popover/index.js +1 -0
- package/src/select/Select.spec.js +1 -1
- package/src/slidingPanel/SlidingPanel.spec.js +9 -19
- package/src/slidingPanel/SlidingPanel.tsx +62 -0
- package/src/slidingPanel/index.ts +2 -0
- package/src/sticky/Sticky.spec.js +0 -1
- package/src/popover/Popover.tsx +0 -106
- package/src/popover/index.ts +0 -2
- package/src/slidingPanel/SlidingPanel.js +0 -73
- package/src/slidingPanel/index.js +0 -1
- /package/src/common/textFormat/formatWithPattern/{formatWithPattern.spec.js → formatWithPattern.spec.ts} +0 -0
- /package/src/common/textFormat/formatWithPattern/{index.js → index.ts} +0 -0
- /package/src/common/textFormat/getCountOfSymbolsInSelection/{getCountOfSymbolsInSelection.spec.js → getCountOfSymbolsInSelection.spec.ts} +0 -0
- /package/src/common/textFormat/getCountOfSymbolsInSelection/{index.js → index.ts} +0 -0
- /package/src/common/textFormat/getCursorPositionAfterKeystroke/{index.js → index.ts} +0 -0
- /package/src/common/textFormat/getDistanceToSymbol/{index.js → index.ts} +0 -0
- /package/src/common/textFormat/getSymbolsInPatternWithPosition/{getSymbolsInPatternWithPosition.spec.js → getSymbolsInPatternWithPosition.spec.ts} +0 -0
- /package/src/common/textFormat/getSymbolsInPatternWithPosition/{index.js → index.ts} +0 -0
- /package/src/common/textFormat/{index.js → index.ts} +0 -0
- /package/src/common/textFormat/unformatWithPattern/{index.js → index.ts} +0 -0
- /package/src/common/textFormat/unformatWithPattern/{unformatWithPattern.spec.js → unformatWithPattern.spec.ts} +0 -0
- /package/src/popover/{Popover.story.tsx → Popover.story.js} +0 -0
- /package/src/popover/__snapshots__/{Popover.spec.tsx.snap → Popover.spec.js.snap} +0 -0
- /package/src/slidingPanel/{SlidingPanel.story.js → SlidingPanel.story.tsx} +0 -0
package/build/index.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
|
}) {
|
|
@@ -1801,15 +1801,14 @@ const useLayout = () => {
|
|
|
1801
1801
|
|
|
1802
1802
|
const EXIT_ANIMATION = 350;
|
|
1803
1803
|
const SlidingPanel = /*#__PURE__*/React.forwardRef(({
|
|
1804
|
-
|
|
1805
|
-
className,
|
|
1804
|
+
position = 'left',
|
|
1806
1805
|
open,
|
|
1807
|
-
position,
|
|
1808
1806
|
showSlidingPanelBorder,
|
|
1809
1807
|
slidingPanelPositionFixed,
|
|
1808
|
+
className,
|
|
1809
|
+
children,
|
|
1810
1810
|
...rest
|
|
1811
1811
|
}, reference) => {
|
|
1812
|
-
/** @type {RefObject<HTMLDivElement>} */
|
|
1813
1812
|
const localReference = React.useRef(null);
|
|
1814
1813
|
return /*#__PURE__*/React.createElement(reactTransitionGroup.CSSTransition, {
|
|
1815
1814
|
...rest,
|
|
@@ -1822,34 +1821,15 @@ const SlidingPanel = /*#__PURE__*/React.forwardRef(({
|
|
|
1822
1821
|
enter: 0,
|
|
1823
1822
|
exit: EXIT_ANIMATION
|
|
1824
1823
|
},
|
|
1825
|
-
classNames:
|
|
1826
|
-
'sliding-panel--fixed': slidingPanelPositionFixed
|
|
1827
|
-
}, 'sliding-panel'),
|
|
1824
|
+
classNames: "sliding-panel",
|
|
1828
1825
|
appear: true,
|
|
1829
1826
|
unmountOnExit: true
|
|
1830
1827
|
}, /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
1831
1828
|
ref: mergeRefs__default.default([reference, localReference]),
|
|
1832
|
-
className: classNames__default.default('sliding-panel', `sliding-panel--open-${position}`, className),
|
|
1829
|
+
className: classNames__default.default('sliding-panel', `sliding-panel--open-${position}`, showSlidingPanelBorder && `sliding-panel--border-${position}`, slidingPanelPositionFixed && 'sliding-panel--fixed', className),
|
|
1833
1830
|
children: children
|
|
1834
1831
|
}));
|
|
1835
1832
|
});
|
|
1836
|
-
SlidingPanel.propTypes = {
|
|
1837
|
-
children: PropTypes__default.default.node,
|
|
1838
|
-
className: PropTypes__default.default.string,
|
|
1839
|
-
open: PropTypes__default.default.bool,
|
|
1840
|
-
position: PropTypes__default.default.oneOf(['top', 'bottom', 'left', 'right']),
|
|
1841
|
-
showSlidingPanelBorder: PropTypes__default.default.bool,
|
|
1842
|
-
slidingPanelPositionFixed: PropTypes__default.default.bool
|
|
1843
|
-
};
|
|
1844
|
-
SlidingPanel.defaultProps = {
|
|
1845
|
-
children: null,
|
|
1846
|
-
className: undefined,
|
|
1847
|
-
open: false,
|
|
1848
|
-
position: 'left',
|
|
1849
|
-
showSlidingPanelBorder: false,
|
|
1850
|
-
slidingPanelPositionFixed: false
|
|
1851
|
-
};
|
|
1852
|
-
var SlidingPanel$1 = SlidingPanel;
|
|
1853
1833
|
|
|
1854
1834
|
const Drawer = ({
|
|
1855
1835
|
children,
|
|
@@ -1868,7 +1848,7 @@ const Drawer = ({
|
|
|
1868
1848
|
return /*#__PURE__*/jsxRuntime.jsx(Dimmer$1, {
|
|
1869
1849
|
open: open,
|
|
1870
1850
|
onClose: onClose,
|
|
1871
|
-
children: /*#__PURE__*/jsxRuntime.jsx(SlidingPanel
|
|
1851
|
+
children: /*#__PURE__*/jsxRuntime.jsx(SlidingPanel, {
|
|
1872
1852
|
open: open,
|
|
1873
1853
|
position: isMobile ? exports.Position.BOTTOM : position,
|
|
1874
1854
|
children: /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
@@ -1985,15 +1965,15 @@ const BottomSheet$1 = props => {
|
|
|
1985
1965
|
props.onClose(event);
|
|
1986
1966
|
}
|
|
1987
1967
|
}
|
|
1988
|
-
const onSwipeStart =
|
|
1989
|
-
initialYCoordinate.current = (
|
|
1968
|
+
const onSwipeStart = event => {
|
|
1969
|
+
initialYCoordinate.current = ('touches' in event ? event.touches[0] : event).clientY;
|
|
1990
1970
|
setPressed(true);
|
|
1991
1971
|
};
|
|
1992
|
-
const onSwipeMove =
|
|
1972
|
+
const onSwipeMove = event => {
|
|
1993
1973
|
if (pressed) {
|
|
1994
1974
|
const {
|
|
1995
1975
|
clientY
|
|
1996
|
-
} =
|
|
1976
|
+
} = 'touches' in event ? event.touches[0] : event;
|
|
1997
1977
|
const offset = calculateOffsetAfterMove(clientY);
|
|
1998
1978
|
// check whether move is to the bottom only and content scroll position is at the top
|
|
1999
1979
|
if (offset > INITIAL_Y_POSITION && isContentScrollPositionAtTop()) {
|
|
@@ -2062,34 +2042,37 @@ const BottomSheet$1 = props => {
|
|
|
2062
2042
|
fadeContentOnEnter: true,
|
|
2063
2043
|
fadeContentOnExit: true,
|
|
2064
2044
|
onClose: close,
|
|
2065
|
-
children: /*#__PURE__*/jsxRuntime.
|
|
2045
|
+
children: /*#__PURE__*/jsxRuntime.jsx(SlidingPanel, {
|
|
2066
2046
|
ref: bottomSheetReference,
|
|
2067
2047
|
open: props.open,
|
|
2068
2048
|
position: exports.Position.BOTTOM,
|
|
2069
2049
|
className: classNames__default.default('np-bottom-sheet', props.className),
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
className: "np-bottom-sheet--
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2050
|
+
children: /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
2051
|
+
role: "dialog",
|
|
2052
|
+
"aria-modal": true,
|
|
2053
|
+
onTouchStart: onSwipeStart,
|
|
2054
|
+
onTouchMove: onSwipeMove,
|
|
2055
|
+
onTouchEnd: onSwipeEnd,
|
|
2056
|
+
onMouseDown: onSwipeStart,
|
|
2057
|
+
onMouseMove: onSwipeMove,
|
|
2058
|
+
onMouseUp: onSwipeEnd,
|
|
2059
|
+
children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
2060
|
+
ref: topBarReference,
|
|
2061
|
+
className: "np-bottom-sheet--top-bar",
|
|
2062
|
+
children: [/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
2063
|
+
className: "np-bottom-sheet--handler"
|
|
2064
|
+
}), /*#__PURE__*/jsxRuntime.jsx(CloseButton, {
|
|
2065
|
+
size: "sm",
|
|
2066
|
+
className: "sr-only np-bottom-sheet--close-btn",
|
|
2067
|
+
onClick: close
|
|
2068
|
+
})]
|
|
2069
|
+
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
2070
|
+
ref: contentReference,
|
|
2071
|
+
style: setContentMaxHeight(),
|
|
2072
|
+
className: "np-bottom-sheet--content",
|
|
2073
|
+
children: props.children
|
|
2086
2074
|
})]
|
|
2087
|
-
})
|
|
2088
|
-
ref: contentReference,
|
|
2089
|
-
style: setContentMaxHeight(),
|
|
2090
|
-
className: "np-bottom-sheet--content",
|
|
2091
|
-
children: props.children
|
|
2092
|
-
})]
|
|
2075
|
+
})
|
|
2093
2076
|
})
|
|
2094
2077
|
});
|
|
2095
2078
|
};
|
|
@@ -5285,6 +5268,7 @@ const Logo = ({
|
|
|
5285
5268
|
const LogoMd = svgPaths[`${type}${inverse ? '_INVERSE' : ''}`];
|
|
5286
5269
|
return /*#__PURE__*/jsxRuntime.jsxs("span", {
|
|
5287
5270
|
"aria-label": type === exports.LogoType.WISE ? 'Wise' : 'Wise business',
|
|
5271
|
+
role: "img",
|
|
5288
5272
|
className: classNames__default.default(className, 'np-logo'),
|
|
5289
5273
|
children: [/*#__PURE__*/jsxRuntime.jsx(LogoSm, {
|
|
5290
5274
|
className: "np-logo-svg np-logo-svg--size-sm"
|
|
@@ -5808,31 +5792,17 @@ const Modal = ({
|
|
|
5808
5792
|
});
|
|
5809
5793
|
};
|
|
5810
5794
|
|
|
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({
|
|
5795
|
+
const Popover$1 = ({
|
|
5823
5796
|
children,
|
|
5824
5797
|
className,
|
|
5825
5798
|
content,
|
|
5826
|
-
preferredPlacement
|
|
5799
|
+
preferredPlacement,
|
|
5827
5800
|
title,
|
|
5828
5801
|
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]);
|
|
5802
|
+
}) => {
|
|
5803
|
+
logActionRequired({
|
|
5804
|
+
preferredPlacement
|
|
5805
|
+
});
|
|
5836
5806
|
const anchorReference = React.useRef(null);
|
|
5837
5807
|
const [open, setOpen] = React.useState(false);
|
|
5838
5808
|
const {
|
|
@@ -5847,16 +5817,18 @@ function Popover$1({
|
|
|
5847
5817
|
children: [/*#__PURE__*/jsxRuntime.jsx("span", {
|
|
5848
5818
|
ref: anchorReference,
|
|
5849
5819
|
className: "d-inline-block",
|
|
5850
|
-
children: /*#__PURE__*/React.
|
|
5820
|
+
children: /*#__PURE__*/React.cloneElement(children, {
|
|
5851
5821
|
onClick: () => {
|
|
5852
|
-
children
|
|
5853
|
-
|
|
5822
|
+
if (children?.props?.onClick) {
|
|
5823
|
+
children.props.onClick();
|
|
5824
|
+
}
|
|
5825
|
+
setOpen(!open);
|
|
5854
5826
|
}
|
|
5855
|
-
})
|
|
5827
|
+
})
|
|
5856
5828
|
}), /*#__PURE__*/jsxRuntime.jsx(ResponsivePanel$1, {
|
|
5857
5829
|
open: open,
|
|
5858
5830
|
anchorRef: anchorReference,
|
|
5859
|
-
position:
|
|
5831
|
+
position: deprecatedPlacements[preferredPlacement] || preferredPlacement,
|
|
5860
5832
|
arrow: true,
|
|
5861
5833
|
className: "np-popover__container",
|
|
5862
5834
|
onClose: handleOnClose,
|
|
@@ -5872,7 +5844,36 @@ function Popover$1({
|
|
|
5872
5844
|
})
|
|
5873
5845
|
})]
|
|
5874
5846
|
});
|
|
5875
|
-
}
|
|
5847
|
+
};
|
|
5848
|
+
const logActionRequired = ({
|
|
5849
|
+
preferredPlacement
|
|
5850
|
+
}) => {
|
|
5851
|
+
logActionRequiredIf(`Popover has deprecated ${preferredPlacement} value for the 'preferredPlacement' prop. Please use ${deprecatedPlacements[preferredPlacement]} instead.`, deprecatedPlacements[preferredPlacement]);
|
|
5852
|
+
};
|
|
5853
|
+
Popover$1.defaultProps = {
|
|
5854
|
+
className: undefined,
|
|
5855
|
+
preferredPlacement: exports.Position.RIGHT,
|
|
5856
|
+
title: undefined
|
|
5857
|
+
};
|
|
5858
|
+
Popover$1.propTypes = {
|
|
5859
|
+
children: PropTypes__default.default.node.isRequired,
|
|
5860
|
+
className: PropTypes__default.default.string,
|
|
5861
|
+
content: PropTypes__default.default.node.isRequired,
|
|
5862
|
+
/**
|
|
5863
|
+
* `'left-top'` / `'right-top'` are deprecated use `Position.TOP` / `'top'` instead,
|
|
5864
|
+
* `'bottom-right'` / `'bottom-left'` are deprecated use `Position.BOTTOM` / `'bottom'` instead
|
|
5865
|
+
*/
|
|
5866
|
+
preferredPlacement: PropTypes__default.default.oneOf(['top', 'right', 'bottom', 'left', 'left-top', 'right-top', 'bottom-right', 'bottom-left']),
|
|
5867
|
+
onClose: PropTypes__default.default.func,
|
|
5868
|
+
title: PropTypes__default.default.node
|
|
5869
|
+
};
|
|
5870
|
+
const deprecatedPlacements = {
|
|
5871
|
+
[exports.Position.BOTTOM_LEFT]: exports.Position.BOTTOM,
|
|
5872
|
+
[exports.Position.BOTTOM_RIGHT]: exports.Position.BOTTOM,
|
|
5873
|
+
[exports.Position.LEFT_TOP]: exports.Position.TOP,
|
|
5874
|
+
[exports.Position.RIGHT_TOP]: exports.Position.TOP
|
|
5875
|
+
};
|
|
5876
|
+
var Popover$2 = Popover$1;
|
|
5876
5877
|
|
|
5877
5878
|
var messages$6 = reactIntl.defineMessages({
|
|
5878
5879
|
ariaLabel: {
|
|
@@ -5923,7 +5924,7 @@ const Info = ({
|
|
|
5923
5924
|
title: title,
|
|
5924
5925
|
onClose: () => setOpen(false)
|
|
5925
5926
|
})]
|
|
5926
|
-
}) : /*#__PURE__*/jsxRuntime.jsx(Popover$
|
|
5927
|
+
}) : /*#__PURE__*/jsxRuntime.jsx(Popover$2, {
|
|
5927
5928
|
content: content,
|
|
5928
5929
|
preferredPlacement: preferredPlacement,
|
|
5929
5930
|
title: title,
|
|
@@ -6979,14 +6980,13 @@ const getSymbolsInPatternWithPosition = pattern => {
|
|
|
6979
6980
|
});
|
|
6980
6981
|
return patternWithSymbolsPosition;
|
|
6981
6982
|
};
|
|
6982
|
-
var getSymbolsInPatternWithPosition$1 = getSymbolsInPatternWithPosition;
|
|
6983
6983
|
|
|
6984
6984
|
const formatWithPattern = (value, pattern) => {
|
|
6985
6985
|
if (!value || value === '') {
|
|
6986
6986
|
return '';
|
|
6987
6987
|
}
|
|
6988
6988
|
const valueArray = value.toString().split('');
|
|
6989
|
-
const patternWithSymbolsPosition = getSymbolsInPatternWithPosition
|
|
6989
|
+
const patternWithSymbolsPosition = getSymbolsInPatternWithPosition(pattern);
|
|
6990
6990
|
let patternSymbol = [];
|
|
6991
6991
|
// valueArray.length increments during the cycle cause we are adding new elements.
|
|
6992
6992
|
for (let index = 0; index < valueArray.length; index += 1) {
|
|
@@ -7001,7 +7001,6 @@ const formatWithPattern = (value, pattern) => {
|
|
|
7001
7001
|
}
|
|
7002
7002
|
return valueArray.join('');
|
|
7003
7003
|
};
|
|
7004
|
-
var formatWithPattern$1 = formatWithPattern;
|
|
7005
7004
|
|
|
7006
7005
|
const unformatWithPattern = (value, pattern) => {
|
|
7007
7006
|
let valueArray = [''];
|
|
@@ -7012,18 +7011,16 @@ const unformatWithPattern = (value, pattern) => {
|
|
|
7012
7011
|
return valueArray.join('');
|
|
7013
7012
|
};
|
|
7014
7013
|
const getSymbolsInPattern = pattern => pattern.split('').filter(symbol => symbol !== '*');
|
|
7015
|
-
var unformatWithPattern$1 = unformatWithPattern;
|
|
7016
7014
|
|
|
7017
|
-
const getCountOfSymbolsInSelection = (selectionStart, selectionEnd, pattern) => getSymbolsInPatternWithPosition
|
|
7018
|
-
var getCountOfSymbolsInSelection$1 = getCountOfSymbolsInSelection;
|
|
7015
|
+
const getCountOfSymbolsInSelection = (selectionStart, selectionEnd, pattern) => getSymbolsInPatternWithPosition(pattern).filter(symbol => symbol.index >= selectionStart && symbol.index < selectionEnd).length;
|
|
7019
7016
|
|
|
7020
7017
|
const getDistanceToNextSymbol = (selectionStart, pattern) => {
|
|
7021
|
-
const patternArray = getSymbolsInPatternWithPosition
|
|
7018
|
+
const patternArray = getSymbolsInPatternWithPosition(pattern);
|
|
7022
7019
|
const applicablePattern = patternArray.filter(symbol => symbol.index >= selectionStart);
|
|
7023
7020
|
return countConsecutiveSymbols(selectionStart, applicablePattern, 'left');
|
|
7024
7021
|
};
|
|
7025
7022
|
const getDistanceToPreviousSymbol = (selectionStart, pattern) => {
|
|
7026
|
-
const patternArray = getSymbolsInPatternWithPosition
|
|
7023
|
+
const patternArray = getSymbolsInPatternWithPosition(pattern);
|
|
7027
7024
|
const applicablePattern = patternArray.filter(symbol => symbol.index < selectionStart).reverse();
|
|
7028
7025
|
return countConsecutiveSymbols(selectionStart, applicablePattern, 'right');
|
|
7029
7026
|
};
|
|
@@ -7053,7 +7050,7 @@ const getCursorPositionAfterActionStroke = (action, selectionStart, selectionEnd
|
|
|
7053
7050
|
}
|
|
7054
7051
|
break;
|
|
7055
7052
|
case 'Paste':
|
|
7056
|
-
cursorPosition += pastedLength + getCountOfSymbolsInSelection
|
|
7053
|
+
cursorPosition += pastedLength + getCountOfSymbolsInSelection(selectionStart, selectionStart + pastedLength, pattern) + getDistanceToNextSymbol(selectionStart + pastedLength, pattern);
|
|
7057
7054
|
break;
|
|
7058
7055
|
case 'Cut':
|
|
7059
7056
|
case 'Delete':
|
|
@@ -7064,7 +7061,6 @@ const getCursorPositionAfterActionStroke = (action, selectionStart, selectionEnd
|
|
|
7064
7061
|
}
|
|
7065
7062
|
return cursorPosition;
|
|
7066
7063
|
};
|
|
7067
|
-
var getCursorPositionAfterKeystroke = getCursorPositionAfterActionStroke;
|
|
7068
7064
|
|
|
7069
7065
|
class WithDisplayFormat extends React.Component {
|
|
7070
7066
|
static defaultProps = {
|
|
@@ -7074,9 +7070,9 @@ class WithDisplayFormat extends React.Component {
|
|
|
7074
7070
|
};
|
|
7075
7071
|
constructor(props) {
|
|
7076
7072
|
super(props);
|
|
7077
|
-
const unformattedValue = unformatWithPattern
|
|
7073
|
+
const unformattedValue = unformatWithPattern(props.value ?? '', props.displayPattern);
|
|
7078
7074
|
this.state = {
|
|
7079
|
-
value: formatWithPattern
|
|
7075
|
+
value: formatWithPattern(unformattedValue, props.displayPattern),
|
|
7080
7076
|
historyNavigator: new HistoryNavigator$1(),
|
|
7081
7077
|
prevDisplayPattern: props.displayPattern,
|
|
7082
7078
|
triggerType: 'Initial',
|
|
@@ -7094,11 +7090,11 @@ class WithDisplayFormat extends React.Component {
|
|
|
7094
7090
|
historyNavigator
|
|
7095
7091
|
}) {
|
|
7096
7092
|
if (prevDisplayPattern !== displayPattern) {
|
|
7097
|
-
const unFormattedValue = unformatWithPattern
|
|
7093
|
+
const unFormattedValue = unformatWithPattern(value, prevDisplayPattern);
|
|
7098
7094
|
historyNavigator.reset();
|
|
7099
7095
|
return {
|
|
7100
7096
|
prevDisplayPattern: displayPattern,
|
|
7101
|
-
value: formatWithPattern
|
|
7097
|
+
value: formatWithPattern(unFormattedValue, displayPattern),
|
|
7102
7098
|
triggerType: null,
|
|
7103
7099
|
triggerEvent: null,
|
|
7104
7100
|
pastedLength: 0
|
|
@@ -7128,7 +7124,7 @@ class WithDisplayFormat extends React.Component {
|
|
|
7128
7124
|
return 'Delete';
|
|
7129
7125
|
}
|
|
7130
7126
|
// Android Fix.
|
|
7131
|
-
if (typeof triggerEvent.key === 'undefined' && unformattedValue.length <= unformatWithPattern
|
|
7127
|
+
if (typeof triggerEvent.key === 'undefined' && unformattedValue.length <= unformatWithPattern(value, displayPattern).length) {
|
|
7132
7128
|
return 'Backspace';
|
|
7133
7129
|
}
|
|
7134
7130
|
return triggerEvent.key;
|
|
@@ -7166,13 +7162,13 @@ class WithDisplayFormat extends React.Component {
|
|
|
7166
7162
|
// Unfortunately Undo and Redo don't trigger OnChange event so we need to handle some value logic here.
|
|
7167
7163
|
let newFormattedValue = '';
|
|
7168
7164
|
if (this.detectUndoRedo(event) === 'Undo') {
|
|
7169
|
-
newFormattedValue = formatWithPattern
|
|
7165
|
+
newFormattedValue = formatWithPattern(historyNavigator.undo(), displayPattern);
|
|
7170
7166
|
this.setState({
|
|
7171
7167
|
value: newFormattedValue,
|
|
7172
7168
|
triggerType: 'Undo'
|
|
7173
7169
|
});
|
|
7174
7170
|
} else if (this.detectUndoRedo(event) === 'Redo') {
|
|
7175
|
-
newFormattedValue = formatWithPattern
|
|
7171
|
+
newFormattedValue = formatWithPattern(historyNavigator.redo(), displayPattern);
|
|
7176
7172
|
this.setState({
|
|
7177
7173
|
value: newFormattedValue,
|
|
7178
7174
|
triggerType: 'Redo'
|
|
@@ -7190,7 +7186,7 @@ class WithDisplayFormat extends React.Component {
|
|
|
7190
7186
|
const {
|
|
7191
7187
|
displayPattern
|
|
7192
7188
|
} = this.props;
|
|
7193
|
-
const pastedLength = unformatWithPattern
|
|
7189
|
+
const pastedLength = unformatWithPattern(event.clipboardData.getData('Text'), displayPattern).length;
|
|
7194
7190
|
this.setState({
|
|
7195
7191
|
triggerType: 'Paste',
|
|
7196
7192
|
pastedLength
|
|
@@ -7220,7 +7216,7 @@ class WithDisplayFormat extends React.Component {
|
|
|
7220
7216
|
const {
|
|
7221
7217
|
value
|
|
7222
7218
|
} = event.target;
|
|
7223
|
-
let unformattedValue = unformatWithPattern
|
|
7219
|
+
let unformattedValue = unformatWithPattern(value, displayPattern);
|
|
7224
7220
|
const action = this.getUserAction(unformattedValue);
|
|
7225
7221
|
if (!this.isKeyAllowed(action) || triggerType === 'Undo' || triggerType === 'Redo') {
|
|
7226
7222
|
return;
|
|
@@ -7228,7 +7224,7 @@ class WithDisplayFormat extends React.Component {
|
|
|
7228
7224
|
if (action === 'Backspace' || action === 'Delete') {
|
|
7229
7225
|
unformattedValue = this.handleDelete(unformattedValue, action);
|
|
7230
7226
|
}
|
|
7231
|
-
const newFormattedValue = formatWithPattern
|
|
7227
|
+
const newFormattedValue = formatWithPattern(unformattedValue, displayPattern);
|
|
7232
7228
|
historyNavigator.add(unformattedValue);
|
|
7233
7229
|
this.handleCursorPositioning(action);
|
|
7234
7230
|
this.setState({
|
|
@@ -7236,13 +7232,13 @@ class WithDisplayFormat extends React.Component {
|
|
|
7236
7232
|
}, () => {
|
|
7237
7233
|
this.resetEvent();
|
|
7238
7234
|
if (onChange) {
|
|
7239
|
-
const broadcastValue = unformatWithPattern
|
|
7235
|
+
const broadcastValue = unformatWithPattern(newFormattedValue, displayPattern);
|
|
7240
7236
|
onChange(broadcastValue);
|
|
7241
7237
|
}
|
|
7242
7238
|
});
|
|
7243
7239
|
};
|
|
7244
7240
|
handleOnBlur = event => {
|
|
7245
|
-
this.props.onBlur?.(unformatWithPattern
|
|
7241
|
+
this.props.onBlur?.(unformatWithPattern(event.target.value, this.props.displayPattern));
|
|
7246
7242
|
};
|
|
7247
7243
|
handleOnFocus = event => {
|
|
7248
7244
|
const {
|
|
@@ -7251,7 +7247,7 @@ class WithDisplayFormat extends React.Component {
|
|
|
7251
7247
|
} = this.props;
|
|
7252
7248
|
if (onFocus) {
|
|
7253
7249
|
this.handleOnChange(event);
|
|
7254
|
-
onFocus(unformatWithPattern
|
|
7250
|
+
onFocus(unformatWithPattern(event.target.value, displayPattern));
|
|
7255
7251
|
}
|
|
7256
7252
|
};
|
|
7257
7253
|
handleDelete = (unformattedValue, action) => {
|
|
@@ -7264,7 +7260,7 @@ class WithDisplayFormat extends React.Component {
|
|
|
7264
7260
|
} = this.state;
|
|
7265
7261
|
const newStack = [...unformattedValue];
|
|
7266
7262
|
if (selectionStart === selectionEnd) {
|
|
7267
|
-
let startPosition = selectionStart - getCountOfSymbolsInSelection
|
|
7263
|
+
let startPosition = selectionStart - getCountOfSymbolsInSelection(0, selectionStart, displayPattern);
|
|
7268
7264
|
let toDelete = 0;
|
|
7269
7265
|
let count = getDistanceToNextSymbol(selectionStart, displayPattern);
|
|
7270
7266
|
if (action === 'Backspace') {
|
|
@@ -7288,7 +7284,7 @@ class WithDisplayFormat extends React.Component {
|
|
|
7288
7284
|
selectionEnd,
|
|
7289
7285
|
pastedLength
|
|
7290
7286
|
} = this.state;
|
|
7291
|
-
const cursorPosition =
|
|
7287
|
+
const cursorPosition = getCursorPositionAfterActionStroke(action, selectionStart, selectionEnd, displayPattern, pastedLength);
|
|
7292
7288
|
setTimeout(() => {
|
|
7293
7289
|
if (triggerEvent) {
|
|
7294
7290
|
triggerEvent.target.setSelectionRange(cursorPosition, cursorPosition);
|
|
@@ -11001,7 +10997,7 @@ const Sticky = ({
|
|
|
11001
10997
|
open,
|
|
11002
10998
|
position,
|
|
11003
10999
|
children
|
|
11004
|
-
}) => /*#__PURE__*/jsxRuntime.jsx(SlidingPanel
|
|
11000
|
+
}) => /*#__PURE__*/jsxRuntime.jsx(SlidingPanel, {
|
|
11005
11001
|
open: open,
|
|
11006
11002
|
position: position,
|
|
11007
11003
|
slidingPanelPositionFixed: true,
|
|
@@ -15190,7 +15186,7 @@ exports.Nudge = Nudge;
|
|
|
15190
15186
|
exports.Option = Option$2;
|
|
15191
15187
|
exports.OverlayHeader = OverlayHeader$1;
|
|
15192
15188
|
exports.PhoneNumberInput = PhoneNumberInput;
|
|
15193
|
-
exports.Popover = Popover$
|
|
15189
|
+
exports.Popover = Popover$2;
|
|
15194
15190
|
exports.ProcessIndicator = ProcessIndicator$1;
|
|
15195
15191
|
exports.Progress = Progress;
|
|
15196
15192
|
exports.ProgressBar = ProgressBar;
|
|
@@ -15209,7 +15205,7 @@ exports.Select = Select;
|
|
|
15209
15205
|
exports.SelectInput = SelectInput;
|
|
15210
15206
|
exports.SelectInputOptionContent = SelectInputOptionContent;
|
|
15211
15207
|
exports.SelectInputTriggerButton = SelectInputTriggerButton;
|
|
15212
|
-
exports.SlidingPanel = SlidingPanel
|
|
15208
|
+
exports.SlidingPanel = SlidingPanel;
|
|
15213
15209
|
exports.SnackbarConsumer = SnackbarConsumer;
|
|
15214
15210
|
exports.SnackbarContext = SnackbarContext;
|
|
15215
15211
|
exports.SnackbarPortal = SnackbarPortal;
|