@transferwise/components 0.0.0-experimental-44efb60 → 0.0.0-experimental-95044f9
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 +27 -33
- package/build/index.js.map +1 -1
- package/build/index.mjs +27 -33
- package/build/index.mjs.map +1 -1
- package/build/main.css +2 -2
- package/build/styles/main.css +2 -2
- package/build/styles/segmentedControl/SegmentedControl.css +2 -2
- package/build/types/field/Field.d.ts.map +1 -1
- package/build/types/inlineAlert/InlineAlert.d.ts.map +1 -1
- package/build/types/inputs/contexts.d.ts.map +1 -1
- package/build/types/segmentedControl/SegmentedControl.d.ts.map +1 -1
- package/build/types/tabs/TabList.d.ts +8 -3
- package/build/types/tabs/TabList.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/field/Field.tsx +7 -5
- package/src/inlineAlert/InlineAlert.spec.tsx +7 -0
- package/src/inlineAlert/InlineAlert.tsx +9 -3
- package/src/inputs/contexts.tsx +1 -2
- package/src/main.css +2 -2
- package/src/segmentedControl/SegmentedControl.css +2 -2
- package/src/segmentedControl/SegmentedControl.less +1 -1
- package/src/segmentedControl/SegmentedControl.spec.tsx +0 -10
- package/src/segmentedControl/SegmentedControl.story.tsx +4 -42
- package/src/segmentedControl/SegmentedControl.tsx +1 -5
- package/src/tabs/TabList.js +15 -0
- package/src/tabs/Tabs.story.js +135 -0
- package/src/tabs/TabList.tsx +0 -15
- package/src/tabs/Tabs.rtl.spec.tsx +0 -40
- package/src/tabs/Tabs.story.tsx +0 -88
package/build/index.mjs
CHANGED
|
@@ -2239,10 +2239,9 @@ const InputInvalidProvider = InputInvalidContext.Provider;
|
|
|
2239
2239
|
function useInputAttributes({
|
|
2240
2240
|
nonLabelable
|
|
2241
2241
|
} = {}) {
|
|
2242
|
-
const id = useContext(InputIdContext);
|
|
2243
2242
|
const labelId = useContext(FieldLabelIdContext);
|
|
2244
2243
|
return {
|
|
2245
|
-
id:
|
|
2244
|
+
id: useContext(InputIdContext),
|
|
2246
2245
|
'aria-labelledby': nonLabelable ? labelId : undefined,
|
|
2247
2246
|
'aria-describedby': useContext(InputDescribedByContext),
|
|
2248
2247
|
'aria-invalid': useContext(InputInvalidContext)
|
|
@@ -4837,6 +4836,7 @@ const Emphasis = ({
|
|
|
4837
4836
|
}) : null;
|
|
4838
4837
|
};
|
|
4839
4838
|
|
|
4839
|
+
const iconTypes = new Set([Sentiment.NEGATIVE, Sentiment.ERROR, Sentiment.POSITIVE, Sentiment.SUCCESS, Sentiment.WARNING]);
|
|
4840
4840
|
function InlineAlert({
|
|
4841
4841
|
id,
|
|
4842
4842
|
type = 'neutral',
|
|
@@ -4847,7 +4847,7 @@ function InlineAlert({
|
|
|
4847
4847
|
role: "alert",
|
|
4848
4848
|
id: id,
|
|
4849
4849
|
className: classNames('alert alert-detach', `alert-${type === Sentiment.NEGATIVE || type === Sentiment.ERROR ? 'danger' : type}`, className),
|
|
4850
|
-
children: [
|
|
4850
|
+
children: [iconTypes.has(type) && /*#__PURE__*/jsx(StatusIcon, {
|
|
4851
4851
|
sentiment: type,
|
|
4852
4852
|
size: Size.SMALL
|
|
4853
4853
|
}), /*#__PURE__*/jsx("div", {
|
|
@@ -4857,6 +4857,20 @@ function InlineAlert({
|
|
|
4857
4857
|
});
|
|
4858
4858
|
}
|
|
4859
4859
|
|
|
4860
|
+
const Label = ({
|
|
4861
|
+
id,
|
|
4862
|
+
htmlFor,
|
|
4863
|
+
className,
|
|
4864
|
+
children
|
|
4865
|
+
}) => {
|
|
4866
|
+
return /*#__PURE__*/jsx("label", {
|
|
4867
|
+
id: id,
|
|
4868
|
+
htmlFor: htmlFor,
|
|
4869
|
+
className: classNames('control-label d-flex flex-column gap-y-1 m-b-0', className),
|
|
4870
|
+
children: children
|
|
4871
|
+
});
|
|
4872
|
+
};
|
|
4873
|
+
|
|
4860
4874
|
const Field = ({
|
|
4861
4875
|
id,
|
|
4862
4876
|
label,
|
|
@@ -4888,12 +4902,11 @@ const Field = ({
|
|
|
4888
4902
|
'has-error': hasError,
|
|
4889
4903
|
'has-info': sentiment === Sentiment.NEUTRAL
|
|
4890
4904
|
}, className),
|
|
4891
|
-
children: [label ? /*#__PURE__*/
|
|
4905
|
+
children: [label != null ? /*#__PURE__*/jsxs(Label, {
|
|
4892
4906
|
id: labelId,
|
|
4893
4907
|
htmlFor: inputId,
|
|
4894
|
-
|
|
4895
|
-
|
|
4896
|
-
}) : null, children, message && /*#__PURE__*/jsx(InlineAlert, {
|
|
4908
|
+
children: [label, children]
|
|
4909
|
+
}) : children, message && /*#__PURE__*/jsx(InlineAlert, {
|
|
4897
4910
|
type: sentiment,
|
|
4898
4911
|
id: descriptionId,
|
|
4899
4912
|
children: message
|
|
@@ -7117,20 +7130,6 @@ function Instruction({
|
|
|
7117
7130
|
});
|
|
7118
7131
|
}
|
|
7119
7132
|
|
|
7120
|
-
const Label = ({
|
|
7121
|
-
id,
|
|
7122
|
-
htmlFor,
|
|
7123
|
-
className,
|
|
7124
|
-
children
|
|
7125
|
-
}) => {
|
|
7126
|
-
return /*#__PURE__*/jsx("label", {
|
|
7127
|
-
id: id,
|
|
7128
|
-
htmlFor: htmlFor,
|
|
7129
|
-
className: classNames('control-label d-flex flex-column gap-y-1 m-b-0', className),
|
|
7130
|
-
children: children
|
|
7131
|
-
});
|
|
7132
|
-
};
|
|
7133
|
-
|
|
7134
7133
|
const ListItem = ({
|
|
7135
7134
|
media,
|
|
7136
7135
|
action,
|
|
@@ -9688,9 +9687,6 @@ const SegmentedControl = ({
|
|
|
9688
9687
|
segments,
|
|
9689
9688
|
onChange
|
|
9690
9689
|
}) => {
|
|
9691
|
-
const inputAttributes = useInputAttributes({
|
|
9692
|
-
nonLabelable: true
|
|
9693
|
-
});
|
|
9694
9690
|
const [animate, setAnimate] = useState(false);
|
|
9695
9691
|
const segmentsRef = useRef(null);
|
|
9696
9692
|
if (segments.length > 3) {
|
|
@@ -9736,8 +9732,7 @@ const SegmentedControl = ({
|
|
|
9736
9732
|
className: classNames('segmented-control__segments', {
|
|
9737
9733
|
'segmented-control__segments--no-animate': !animate
|
|
9738
9734
|
}),
|
|
9739
|
-
role: mode !== 'input' ? 'tablist' :
|
|
9740
|
-
...inputAttributes,
|
|
9735
|
+
role: mode !== 'input' ? 'tablist' : undefined,
|
|
9741
9736
|
children: segmentsWithRefs.map(segment => {
|
|
9742
9737
|
const onSelect = () => {
|
|
9743
9738
|
setAnimate(true);
|
|
@@ -10892,19 +10887,18 @@ Tab.propTypes = {
|
|
|
10892
10887
|
focusTab: PropTypes.func
|
|
10893
10888
|
};
|
|
10894
10889
|
|
|
10895
|
-
|
|
10890
|
+
const TabList = ({
|
|
10896
10891
|
children
|
|
10897
|
-
}) {
|
|
10898
|
-
const inputAttributes = useInputAttributes({
|
|
10899
|
-
nonLabelable: true
|
|
10900
|
-
});
|
|
10892
|
+
}) => {
|
|
10901
10893
|
return /*#__PURE__*/jsx("ul", {
|
|
10902
10894
|
className: "tabs__tab-list",
|
|
10903
10895
|
role: "tablist",
|
|
10904
|
-
...inputAttributes,
|
|
10905
10896
|
children: children
|
|
10906
10897
|
});
|
|
10907
|
-
}
|
|
10898
|
+
};
|
|
10899
|
+
TabList.propTypes = {
|
|
10900
|
+
children: PropTypes.oneOfType([PropTypes.object, PropTypes.array]).isRequired
|
|
10901
|
+
};
|
|
10908
10902
|
|
|
10909
10903
|
const TabPanel = ({
|
|
10910
10904
|
children,
|