@transferwise/components 0.0.0-experimental-d9b4d5e → 0.0.0-experimental-a0d696c
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.js +69 -63
- package/build/index.js.map +1 -1
- package/build/index.mjs +69 -63
- package/build/index.mjs.map +1 -1
- package/build/types/decision/Decision.d.ts +1 -1
- package/build/types/decision/Decision.d.ts.map +1 -1
- package/build/types/definitionList/DefinitionList.d.ts +20 -24
- package/build/types/definitionList/DefinitionList.d.ts.map +1 -1
- package/build/types/definitionList/index.d.ts +2 -1
- package/build/types/definitionList/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/tile/Tile.d.ts +37 -17
- package/build/types/tile/Tile.d.ts.map +1 -1
- package/build/types/tile/index.d.ts +1 -1
- package/build/types/tile/index.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/decision/Decision.tsx +1 -1
- package/src/definitionList/{DefinitionList.story.js → DefinitionList.story.tsx} +22 -2
- package/src/definitionList/DefinitionList.tsx +95 -0
- package/src/definitionList/index.ts +2 -0
- package/src/index.ts +1 -0
- package/src/tile/{Tile.tsx → Tile.js} +35 -24
- package/src/tile/{Tile.spec.tsx → Tile.spec.js} +1 -1
- package/src/definitionList/DefinitionList.js +0 -100
- package/src/definitionList/index.js +0 -1
- /package/src/tile/{Tile.story.tsx → Tile.story.js} +0 -0
- /package/src/tile/__snapshots__/{Tile.spec.tsx.snap → Tile.spec.js.snap} +0 -0
- /package/src/tile/{index.ts → index.js} +0 -0
package/build/index.js
CHANGED
|
@@ -4682,7 +4682,7 @@ const NavigationOption = /*#__PURE__*/React.forwardRef(({
|
|
|
4682
4682
|
});
|
|
4683
4683
|
});
|
|
4684
4684
|
|
|
4685
|
-
|
|
4685
|
+
const Tile = ({
|
|
4686
4686
|
className,
|
|
4687
4687
|
description,
|
|
4688
4688
|
disabled,
|
|
@@ -4690,10 +4690,10 @@ function Tile({
|
|
|
4690
4690
|
target,
|
|
4691
4691
|
media,
|
|
4692
4692
|
onClick,
|
|
4693
|
-
size
|
|
4693
|
+
size,
|
|
4694
4694
|
title
|
|
4695
|
-
}) {
|
|
4696
|
-
const isSmall = size ===
|
|
4695
|
+
}) => {
|
|
4696
|
+
const isSmall = size === exports.Size.SMALL;
|
|
4697
4697
|
const Element = href ? 'a' : 'button';
|
|
4698
4698
|
return /*#__PURE__*/jsxRuntime.jsxs(Element, {
|
|
4699
4699
|
className: classNames__default.default('decision', 'flex-column', 'np-tile', 'text-no-decoration', 'text-xs-center', className, {
|
|
@@ -4702,12 +4702,12 @@ function Tile({
|
|
|
4702
4702
|
}, disabled && 'disabled'),
|
|
4703
4703
|
href: href,
|
|
4704
4704
|
target: target,
|
|
4705
|
-
onClick: disabled ?
|
|
4706
|
-
onKeyDown: disabled ?
|
|
4705
|
+
onClick: disabled ? null : onClick,
|
|
4706
|
+
onKeyDown: disabled ? null : ({
|
|
4707
4707
|
key
|
|
4708
4708
|
}) => {
|
|
4709
4709
|
if (key === 'Enter' || key === ' ') {
|
|
4710
|
-
onClick
|
|
4710
|
+
onClick();
|
|
4711
4711
|
}
|
|
4712
4712
|
},
|
|
4713
4713
|
children: [/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
@@ -4724,7 +4724,29 @@ function Tile({
|
|
|
4724
4724
|
children: description
|
|
4725
4725
|
}) : null]
|
|
4726
4726
|
});
|
|
4727
|
-
}
|
|
4727
|
+
};
|
|
4728
|
+
Tile.propTypes = {
|
|
4729
|
+
/** Classes to apply to the Tile container */
|
|
4730
|
+
className: PropTypes__default.default.string,
|
|
4731
|
+
description: PropTypes__default.default.node,
|
|
4732
|
+
disabled: PropTypes__default.default.bool,
|
|
4733
|
+
href: PropTypes__default.default.string,
|
|
4734
|
+
target: PropTypes__default.default.oneOf(['_self', '_blank', '_parent', '_top']),
|
|
4735
|
+
/** Accepts only Avatar and images */
|
|
4736
|
+
media: PropTypes__default.default.node.isRequired,
|
|
4737
|
+
/** Function called onClick or onKeyDown */
|
|
4738
|
+
onClick: PropTypes__default.default.func,
|
|
4739
|
+
/** The size applied to Tile */
|
|
4740
|
+
size: PropTypes__default.default.oneOf(['sm', 'md']),
|
|
4741
|
+
title: PropTypes__default.default.node.isRequired
|
|
4742
|
+
};
|
|
4743
|
+
Tile.defaultProps = {
|
|
4744
|
+
className: '',
|
|
4745
|
+
description: null,
|
|
4746
|
+
disabled: false,
|
|
4747
|
+
size: exports.Size.MEDIUM,
|
|
4748
|
+
target: undefined
|
|
4749
|
+
};
|
|
4728
4750
|
|
|
4729
4751
|
exports.DecisionPresentation = void 0;
|
|
4730
4752
|
(function (DecisionPresentation) {
|
|
@@ -4816,9 +4838,9 @@ const Decision = ({
|
|
|
4816
4838
|
return null;
|
|
4817
4839
|
};
|
|
4818
4840
|
|
|
4819
|
-
const isLayoutHorizontal = layout =>
|
|
4841
|
+
const isLayoutHorizontal = layout => layout === exports.Layout.HORIZONTAL_LEFT_ALIGNED || layout === exports.Layout.HORIZONTAL_RIGHT_ALIGNED || layout === exports.Layout.HORIZONTAL_JUSTIFIED;
|
|
4820
4842
|
const getAlignmentClasses = (layout, action) => {
|
|
4821
|
-
|
|
4843
|
+
const classes = ['d-flex'];
|
|
4822
4844
|
if (action) {
|
|
4823
4845
|
if (isLayoutHorizontal(layout)) {
|
|
4824
4846
|
classes.push('align-items-center');
|
|
@@ -4836,60 +4858,44 @@ const getAlignmentClasses = (layout, action) => {
|
|
|
4836
4858
|
}
|
|
4837
4859
|
return classes;
|
|
4838
4860
|
};
|
|
4839
|
-
const
|
|
4840
|
-
|
|
4841
|
-
|
|
4861
|
+
const defaultDefinitions = [];
|
|
4862
|
+
function DefinitionList({
|
|
4863
|
+
definitions = defaultDefinitions,
|
|
4864
|
+
layout = 'VERTICAL_TWO_COLUMN',
|
|
4842
4865
|
muted
|
|
4843
|
-
})
|
|
4844
|
-
|
|
4845
|
-
'
|
|
4846
|
-
|
|
4847
|
-
|
|
4848
|
-
|
|
4849
|
-
|
|
4850
|
-
children: definitions.filter(definition => definition).map(({
|
|
4851
|
-
action,
|
|
4852
|
-
title,
|
|
4853
|
-
value,
|
|
4854
|
-
key
|
|
4855
|
-
}) => /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
4856
|
-
className: "tw-definition-list__item",
|
|
4857
|
-
children: [/*#__PURE__*/jsxRuntime.jsx("dt", {
|
|
4858
|
-
children: title
|
|
4859
|
-
}), /*#__PURE__*/jsxRuntime.jsxs("dd", {
|
|
4860
|
-
className: classNames__default.default(...getAlignmentClasses(layout, action)),
|
|
4861
|
-
children: [/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
4862
|
-
children: value
|
|
4863
|
-
}), action ? /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
4864
|
-
className: classNames__default.default(isLayoutHorizontal(layout) ? 'p-l-2' : 'p-x-2', 'tw-definition-list__action'),
|
|
4865
|
-
children: /*#__PURE__*/jsxRuntime.jsx(ActionButton, {
|
|
4866
|
-
className: "tw-definition-list__button",
|
|
4867
|
-
onClick: action.onClick,
|
|
4868
|
-
children: action.label
|
|
4869
|
-
})
|
|
4870
|
-
}) : null]
|
|
4871
|
-
})]
|
|
4872
|
-
}, key))
|
|
4873
|
-
});
|
|
4874
|
-
DefinitionList.propTypes = {
|
|
4875
|
-
definitions: PropTypes__default.default.arrayOf(PropTypes__default.default.shape({
|
|
4876
|
-
action: PropTypes__default.default.shape({
|
|
4877
|
-
label: PropTypes__default.default.string.isRequired,
|
|
4878
|
-
onClick: PropTypes__default.default.func
|
|
4866
|
+
}) {
|
|
4867
|
+
return /*#__PURE__*/jsxRuntime.jsx("dl", {
|
|
4868
|
+
className: classNames__default.default('tw-definition-list d-flex ', {
|
|
4869
|
+
'text-muted': muted,
|
|
4870
|
+
'flex-column': layout === exports.Layout.VERTICAL_ONE_COLUMN,
|
|
4871
|
+
'tw-definition-list--columns flex-column flex-row--sm': layout === exports.Layout.VERTICAL_TWO_COLUMN,
|
|
4872
|
+
'tw-definition-list--horizontal flex-column': isLayoutHorizontal(layout)
|
|
4879
4873
|
}),
|
|
4880
|
-
|
|
4881
|
-
|
|
4882
|
-
|
|
4883
|
-
|
|
4884
|
-
|
|
4885
|
-
|
|
4886
|
-
|
|
4887
|
-
|
|
4888
|
-
|
|
4889
|
-
|
|
4890
|
-
|
|
4891
|
-
|
|
4892
|
-
|
|
4874
|
+
children: definitions.filter(definition => definition).map(({
|
|
4875
|
+
action,
|
|
4876
|
+
title,
|
|
4877
|
+
value,
|
|
4878
|
+
key
|
|
4879
|
+
}) => /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
4880
|
+
className: "tw-definition-list__item",
|
|
4881
|
+
children: [/*#__PURE__*/jsxRuntime.jsx("dt", {
|
|
4882
|
+
children: title
|
|
4883
|
+
}), /*#__PURE__*/jsxRuntime.jsxs("dd", {
|
|
4884
|
+
className: classNames__default.default(...getAlignmentClasses(layout, action)),
|
|
4885
|
+
children: [/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
4886
|
+
children: value
|
|
4887
|
+
}), action ? /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
4888
|
+
className: classNames__default.default(isLayoutHorizontal(layout) ? 'p-l-2' : 'p-x-2', 'tw-definition-list__action'),
|
|
4889
|
+
children: /*#__PURE__*/jsxRuntime.jsx(ActionButton, {
|
|
4890
|
+
className: "tw-definition-list__button",
|
|
4891
|
+
onClick: action.onClick,
|
|
4892
|
+
children: action.label
|
|
4893
|
+
})
|
|
4894
|
+
}) : null]
|
|
4895
|
+
})]
|
|
4896
|
+
}, key))
|
|
4897
|
+
});
|
|
4898
|
+
}
|
|
4893
4899
|
|
|
4894
4900
|
const DropFade = ({
|
|
4895
4901
|
children,
|
|
@@ -14779,7 +14785,7 @@ exports.DEFAULT_LOCALE = DEFAULT_LOCALE;
|
|
|
14779
14785
|
exports.DateInput = DateInput;
|
|
14780
14786
|
exports.DateLookup = DateLookup$1;
|
|
14781
14787
|
exports.Decision = Decision;
|
|
14782
|
-
exports.DefinitionList = DefinitionList
|
|
14788
|
+
exports.DefinitionList = DefinitionList;
|
|
14783
14789
|
exports.Dimmer = Dimmer$1;
|
|
14784
14790
|
exports.DirectionProvider = DirectionProvider;
|
|
14785
14791
|
exports.Display = Display;
|