@transferwise/components 0.0.0-experimental-eec707b → 0.0.0-experimental-dc27730
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 +29 -90
- package/build/index.esm.js.map +1 -1
- package/build/index.js +32 -93
- package/build/index.js.map +1 -1
- package/build/types/avatarWrapper/AvatarWrapper.d.ts +18 -28
- package/build/types/avatarWrapper/AvatarWrapper.d.ts.map +1 -1
- package/build/types/avatarWrapper/index.d.ts +1 -1
- package/build/types/avatarWrapper/index.d.ts.map +1 -1
- package/build/types/badge/Badge.d.ts +2 -2
- package/build/types/badge/Badge.d.ts.map +1 -1
- package/build/types/badge/index.d.ts +2 -1
- package/build/types/badge/index.d.ts.map +1 -1
- package/build/types/common/index.d.ts +1 -1
- package/build/types/common/propsValues/profileType.d.ts +2 -0
- package/build/types/common/propsValues/profileType.d.ts.map +1 -1
- package/build/types/common/propsValues/sentiment.d.ts +1 -0
- package/build/types/common/propsValues/sentiment.d.ts.map +1 -1
- package/build/types/image/Image.d.ts +17 -21
- package/build/types/image/Image.d.ts.map +1 -1
- package/build/types/image/index.d.ts +1 -1
- package/build/types/image/index.d.ts.map +1 -1
- package/build/types/inlineAlert/InlineAlert.d.ts +12 -15
- package/build/types/inlineAlert/InlineAlert.d.ts.map +1 -1
- package/build/types/inlineAlert/index.d.ts +1 -1
- package/build/types/inlineAlert/index.d.ts.map +1 -1
- package/build/types/promoCard/PromoCard.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/avatarWrapper/AvatarWrapper.spec.tsx +105 -0
- package/src/avatarWrapper/AvatarWrapper.story.tsx +1 -41
- package/src/avatarWrapper/{AvatarWrapper.js → AvatarWrapper.tsx} +25 -56
- package/src/avatarWrapper/__snapshots__/{AvatarWrapper.spec.js.snap → AvatarWrapper.spec.tsx.snap} +76 -76
- package/src/badge/Badge.tsx +2 -2
- package/src/badge/index.ts +2 -0
- package/src/common/index.js +1 -1
- package/src/common/propsValues/profileType.ts +3 -0
- package/src/common/propsValues/sentiment.ts +10 -0
- package/src/image/{Image.spec.js → Image.spec.tsx} +5 -5
- package/src/image/{Image.story.js → Image.story.tsx} +3 -3
- package/src/image/Image.tsx +65 -0
- package/src/inlineAlert/{InlineAlert.story.js → InlineAlert.story.tsx} +3 -2
- package/src/inlineAlert/InlineAlert.tsx +59 -0
- package/src/promoCard/PromoCard.tsx +1 -6
- package/src/promoCard/__snapshots__/PromoCardGroup.spec.tsx.snap +2 -2
- package/src/avatarWrapper/AvatarWrapper.spec.js +0 -81
- package/src/badge/index.js +0 -1
- package/src/image/Image.js +0 -78
- package/src/inlineAlert/InlineAlert.js +0 -62
- /package/src/avatarWrapper/{index.js → index.ts} +0 -0
- /package/src/image/{index.js → index.ts} +0 -0
- /package/src/inlineAlert/{InlineAlert.spec.js → InlineAlert.spec.tsx} +0 -0
- /package/src/inlineAlert/{index.js → index.ts} +0 -0
package/build/index.js
CHANGED
|
@@ -1369,7 +1369,6 @@ const Badge = ({
|
|
|
1369
1369
|
})]
|
|
1370
1370
|
});
|
|
1371
1371
|
};
|
|
1372
|
-
var Badge$1 = Badge;
|
|
1373
1372
|
|
|
1374
1373
|
const OptionalBadge = ({
|
|
1375
1374
|
url,
|
|
@@ -1379,7 +1378,7 @@ const OptionalBadge = ({
|
|
|
1379
1378
|
...rest
|
|
1380
1379
|
}) => {
|
|
1381
1380
|
if (url) {
|
|
1382
|
-
return /*#__PURE__*/jsxRuntime.jsx(Badge
|
|
1381
|
+
return /*#__PURE__*/jsxRuntime.jsx(Badge, {
|
|
1383
1382
|
badge: /*#__PURE__*/jsxRuntime.jsx("img", {
|
|
1384
1383
|
src: url,
|
|
1385
1384
|
alt: altText
|
|
@@ -1389,7 +1388,7 @@ const OptionalBadge = ({
|
|
|
1389
1388
|
});
|
|
1390
1389
|
}
|
|
1391
1390
|
if (statusIcon) {
|
|
1392
|
-
return /*#__PURE__*/jsxRuntime.jsx(Badge
|
|
1391
|
+
return /*#__PURE__*/jsxRuntime.jsx(Badge, {
|
|
1393
1392
|
badge: /*#__PURE__*/jsxRuntime.jsx(StatusIcon, {
|
|
1394
1393
|
sentiment: statusIcon,
|
|
1395
1394
|
size: exports.Size.SMALL
|
|
@@ -1398,18 +1397,9 @@ const OptionalBadge = ({
|
|
|
1398
1397
|
children: children
|
|
1399
1398
|
});
|
|
1400
1399
|
}
|
|
1401
|
-
return
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
url: PropTypes__default.default.string,
|
|
1405
|
-
altText: PropTypes__default.default.string,
|
|
1406
|
-
statusIcon: PropTypes__default.default.oneOf([exports.Sentiment.POSITIVE, exports.Sentiment.NEGATIVE, exports.Sentiment.NEUTRAL, exports.Sentiment.WARNING, exports.Sentiment.PENDING]),
|
|
1407
|
-
children: PropTypes__default.default.node.isRequired
|
|
1408
|
-
};
|
|
1409
|
-
OptionalBadge.defaultProps = {
|
|
1410
|
-
url: undefined,
|
|
1411
|
-
altText: undefined,
|
|
1412
|
-
statusIcon: undefined
|
|
1400
|
+
return /*#__PURE__*/jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
1401
|
+
children: children
|
|
1402
|
+
});
|
|
1413
1403
|
};
|
|
1414
1404
|
const AvatarWrapper = ({
|
|
1415
1405
|
url,
|
|
@@ -1424,7 +1414,6 @@ const AvatarWrapper = ({
|
|
|
1424
1414
|
}) => {
|
|
1425
1415
|
const [hasImageLoadError, setImageLoadError] = React.useState(false);
|
|
1426
1416
|
const isBusinessProfile = profileType === exports.ProfileType.BUSINESS;
|
|
1427
|
-
|
|
1428
1417
|
// Reset the errored state when url changes
|
|
1429
1418
|
React.useEffect(() => setImageLoadError(false), [url]);
|
|
1430
1419
|
const getAvatarProps = () => {
|
|
@@ -1486,29 +1475,6 @@ function getInitials(name) {
|
|
|
1486
1475
|
}
|
|
1487
1476
|
return allInitials[0] + allInitials.slice(-1);
|
|
1488
1477
|
}
|
|
1489
|
-
AvatarWrapper.defaultProps = {
|
|
1490
|
-
url: undefined,
|
|
1491
|
-
profileType: undefined,
|
|
1492
|
-
profileId: undefined,
|
|
1493
|
-
badgeUrl: undefined,
|
|
1494
|
-
badgeAltText: undefined,
|
|
1495
|
-
badgeStatusIcon: undefined,
|
|
1496
|
-
name: undefined,
|
|
1497
|
-
avatarProps: {},
|
|
1498
|
-
badgeProps: {}
|
|
1499
|
-
};
|
|
1500
|
-
AvatarWrapper.propTypes = {
|
|
1501
|
-
url: PropTypes__default.default.string,
|
|
1502
|
-
profileType: PropTypes__default.default.oneOf([exports.ProfileType.PERSONAL, exports.ProfileType.BUSINESS]),
|
|
1503
|
-
profileId: PropTypes__default.default.number,
|
|
1504
|
-
badgeUrl: PropTypes__default.default.string,
|
|
1505
|
-
badgeAltText: PropTypes__default.default.string,
|
|
1506
|
-
badgeStatusIcon: PropTypes__default.default.oneOf([exports.Sentiment.POSITIVE, exports.Sentiment.NEGATIVE, exports.Sentiment.NEUTRAL, exports.Sentiment.WARNING, exports.Sentiment.PENDING]),
|
|
1507
|
-
name: PropTypes__default.default.string,
|
|
1508
|
-
avatarProps: PropTypes__default.default.shape({}),
|
|
1509
|
-
badgeProps: PropTypes__default.default.shape({})
|
|
1510
|
-
};
|
|
1511
|
-
var AvatarWrapper$1 = AvatarWrapper;
|
|
1512
1478
|
|
|
1513
1479
|
const THROTTLE_MS = 100;
|
|
1514
1480
|
const useIsomorphicLayoutEffect = typeof window !== 'undefined' ? React.useLayoutEffect : React.useEffect;
|
|
@@ -5770,11 +5736,11 @@ const Image = ({
|
|
|
5770
5736
|
onError,
|
|
5771
5737
|
className,
|
|
5772
5738
|
loading,
|
|
5773
|
-
stretch,
|
|
5739
|
+
stretch = true,
|
|
5774
5740
|
role,
|
|
5775
|
-
shrink
|
|
5741
|
+
shrink = true
|
|
5776
5742
|
}) => {
|
|
5777
|
-
const elementReference = React.useRef();
|
|
5743
|
+
const elementReference = React.useRef(null);
|
|
5778
5744
|
const [hasIntersected] = useHasIntersected({
|
|
5779
5745
|
elRef: elementReference,
|
|
5780
5746
|
loading
|
|
@@ -5783,7 +5749,7 @@ const Image = ({
|
|
|
5783
5749
|
let imageOnLoad = onLoad;
|
|
5784
5750
|
if (loading === 'lazy' && !hasIntersected) {
|
|
5785
5751
|
imageSource = EmptyTransparentImage;
|
|
5786
|
-
imageOnLoad =
|
|
5752
|
+
imageOnLoad = undefined;
|
|
5787
5753
|
}
|
|
5788
5754
|
return /*#__PURE__*/jsxRuntime.jsx("img", {
|
|
5789
5755
|
ref: elementReference,
|
|
@@ -5799,28 +5765,6 @@ const Image = ({
|
|
|
5799
5765
|
onError: onError
|
|
5800
5766
|
});
|
|
5801
5767
|
};
|
|
5802
|
-
Image.propTypes = {
|
|
5803
|
-
id: PropTypes__default.default.string,
|
|
5804
|
-
src: PropTypes__default.default.string.isRequired,
|
|
5805
|
-
alt: PropTypes__default.default.string.isRequired,
|
|
5806
|
-
onLoad: PropTypes__default.default.func,
|
|
5807
|
-
onError: PropTypes__default.default.func,
|
|
5808
|
-
className: PropTypes__default.default.string,
|
|
5809
|
-
loading: PropTypes__default.default.oneOf(['lazy', 'eager']),
|
|
5810
|
-
stretch: PropTypes__default.default.bool,
|
|
5811
|
-
shrink: PropTypes__default.default.bool,
|
|
5812
|
-
role: PropTypes__default.default.string
|
|
5813
|
-
};
|
|
5814
|
-
Image.defaultProps = {
|
|
5815
|
-
id: null,
|
|
5816
|
-
className: '',
|
|
5817
|
-
onLoad: () => {},
|
|
5818
|
-
onError: () => {},
|
|
5819
|
-
loading: 'eager',
|
|
5820
|
-
stretch: true,
|
|
5821
|
-
shrink: true
|
|
5822
|
-
};
|
|
5823
|
-
var Image$1 = Image;
|
|
5824
5768
|
|
|
5825
5769
|
// TODO: consider to move this enum into component file once we migrate it on TypeScript or replace with some common enum
|
|
5826
5770
|
exports.InfoPresentation = void 0;
|
|
@@ -6056,18 +6000,23 @@ const typeClassMap = {
|
|
|
6056
6000
|
[exports.Sentiment.ERROR]: 'danger',
|
|
6057
6001
|
[exports.Sentiment.NEGATIVE]: 'danger'
|
|
6058
6002
|
};
|
|
6059
|
-
const InlineAlert =
|
|
6003
|
+
const InlineAlert = ({
|
|
6004
|
+
id,
|
|
6005
|
+
type = exports.Sentiment.NEUTRAL,
|
|
6006
|
+
className,
|
|
6007
|
+
children
|
|
6008
|
+
}) => {
|
|
6060
6009
|
const {
|
|
6061
6010
|
isModern
|
|
6062
6011
|
} = componentsTheming.useTheme();
|
|
6063
|
-
const typeClass = `alert-${typeClassMap[
|
|
6012
|
+
const typeClass = `alert-${typeClassMap[type] || type}`;
|
|
6064
6013
|
if (isModern) {
|
|
6065
6014
|
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
6066
6015
|
role: "alert",
|
|
6067
|
-
id:
|
|
6068
|
-
className: classNames__default.default('alert alert-detach', typeClass,
|
|
6069
|
-
children: [(
|
|
6070
|
-
children:
|
|
6016
|
+
id: id,
|
|
6017
|
+
className: classNames__default.default('alert alert-detach', typeClass, className),
|
|
6018
|
+
children: [(type === 'error' || type === 'negative') && /*#__PURE__*/jsxRuntime.jsx(icons.AlertCircle, {}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
6019
|
+
children: children
|
|
6071
6020
|
})]
|
|
6072
6021
|
});
|
|
6073
6022
|
}
|
|
@@ -6077,28 +6026,19 @@ const InlineAlert = props => {
|
|
|
6077
6026
|
}) => {
|
|
6078
6027
|
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
6079
6028
|
role: "alert",
|
|
6080
|
-
id:
|
|
6029
|
+
id: id,
|
|
6081
6030
|
className: classNames__default.default('alert alert-detach p-x-2 p-y-1', typeClass, className),
|
|
6082
6031
|
children: children
|
|
6083
6032
|
});
|
|
6084
6033
|
};
|
|
6085
6034
|
const AlertWithArrow = withArrow(getAlertContents, exports.AlertArrowPosition.TOP_LEFT);
|
|
6086
6035
|
return /*#__PURE__*/jsxRuntime.jsx(AlertWithArrow, {
|
|
6087
|
-
|
|
6036
|
+
id,
|
|
6037
|
+
type,
|
|
6038
|
+
className,
|
|
6039
|
+
children
|
|
6088
6040
|
});
|
|
6089
6041
|
};
|
|
6090
|
-
InlineAlert.propTypes = {
|
|
6091
|
-
children: PropTypes__default.default.node.isRequired,
|
|
6092
|
-
className: PropTypes__default.default.string,
|
|
6093
|
-
id: PropTypes__default.default.string,
|
|
6094
|
-
type: PropTypes__default.default.oneOf(['positive', 'negative', 'warning', 'neutral', 'success', 'info', 'error'])
|
|
6095
|
-
};
|
|
6096
|
-
InlineAlert.defaultProps = {
|
|
6097
|
-
className: undefined,
|
|
6098
|
-
id: undefined,
|
|
6099
|
-
type: exports.Sentiment.NEUTRAL
|
|
6100
|
-
};
|
|
6101
|
-
var InlineAlert$1 = InlineAlert;
|
|
6102
6042
|
|
|
6103
6043
|
/*
|
|
6104
6044
|
* Inspired by:
|
|
@@ -9989,10 +9929,9 @@ const PromoCard = /*#__PURE__*/React.forwardRef(({
|
|
|
9989
9929
|
className: classNames__default.default('np-Card-image', {
|
|
9990
9930
|
imageClass
|
|
9991
9931
|
}),
|
|
9992
|
-
children: /*#__PURE__*/jsxRuntime.jsx(Image
|
|
9932
|
+
children: /*#__PURE__*/jsxRuntime.jsx(Image, {
|
|
9993
9933
|
src: imageSource,
|
|
9994
|
-
alt: imageAlt,
|
|
9995
|
-
role: !imageAlt ? 'presentation' : null,
|
|
9934
|
+
alt: imageAlt || '',
|
|
9996
9935
|
loading: "lazy"
|
|
9997
9936
|
})
|
|
9998
9937
|
}), /*#__PURE__*/jsxRuntime.jsx(PromoCardIndicator, {
|
|
@@ -12097,7 +12036,7 @@ class Typeahead extends React.Component {
|
|
|
12097
12036
|
children: /*#__PURE__*/jsxRuntime.jsx(icons.Cross, {})
|
|
12098
12037
|
})
|
|
12099
12038
|
})]
|
|
12100
|
-
}), displayAlert && /*#__PURE__*/jsxRuntime.jsx(InlineAlert
|
|
12039
|
+
}), displayAlert && /*#__PURE__*/jsxRuntime.jsx(InlineAlert, {
|
|
12101
12040
|
type: alert.type,
|
|
12102
12041
|
children: alert.message
|
|
12103
12042
|
}), menu]
|
|
@@ -14484,8 +14423,8 @@ exports.ActionButton = ActionButton;
|
|
|
14484
14423
|
exports.ActionOption = ActionOption;
|
|
14485
14424
|
exports.Alert = Alert$1;
|
|
14486
14425
|
exports.Avatar = Avatar;
|
|
14487
|
-
exports.AvatarWrapper = AvatarWrapper
|
|
14488
|
-
exports.Badge = Badge
|
|
14426
|
+
exports.AvatarWrapper = AvatarWrapper;
|
|
14427
|
+
exports.Badge = Badge;
|
|
14489
14428
|
exports.BaseCard = Card;
|
|
14490
14429
|
exports.Body = Body;
|
|
14491
14430
|
exports.BottomSheet = BottomSheet$1;
|
|
@@ -14514,9 +14453,9 @@ exports.DynamicFieldDefinitionList = DynamicFieldDefinitionList$1;
|
|
|
14514
14453
|
exports.Emphasis = Emphasis;
|
|
14515
14454
|
exports.FlowNavigation = FlowNavigation;
|
|
14516
14455
|
exports.Header = Header;
|
|
14517
|
-
exports.Image = Image
|
|
14456
|
+
exports.Image = Image;
|
|
14518
14457
|
exports.Info = Info;
|
|
14519
|
-
exports.InlineAlert = InlineAlert
|
|
14458
|
+
exports.InlineAlert = InlineAlert;
|
|
14520
14459
|
exports.Input = Input;
|
|
14521
14460
|
exports.InputGroup = InputGroup;
|
|
14522
14461
|
exports.InputWithDisplayFormat = InputWithDisplayFormat$1;
|