@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 CHANGED
@@ -2268,10 +2268,9 @@ const InputInvalidProvider = InputInvalidContext.Provider;
2268
2268
  function useInputAttributes({
2269
2269
  nonLabelable
2270
2270
  } = {}) {
2271
- const id = React.useContext(InputIdContext);
2272
2271
  const labelId = React.useContext(FieldLabelIdContext);
2273
2272
  return {
2274
- id: !nonLabelable ? id : undefined,
2273
+ id: React.useContext(InputIdContext),
2275
2274
  'aria-labelledby': nonLabelable ? labelId : undefined,
2276
2275
  'aria-describedby': React.useContext(InputDescribedByContext),
2277
2276
  'aria-invalid': React.useContext(InputInvalidContext)
@@ -4866,6 +4865,7 @@ const Emphasis = ({
4866
4865
  }) : null;
4867
4866
  };
4868
4867
 
4868
+ const iconTypes = new Set([exports.Sentiment.NEGATIVE, exports.Sentiment.ERROR, exports.Sentiment.POSITIVE, exports.Sentiment.SUCCESS, exports.Sentiment.WARNING]);
4869
4869
  function InlineAlert({
4870
4870
  id,
4871
4871
  type = 'neutral',
@@ -4876,7 +4876,7 @@ function InlineAlert({
4876
4876
  role: "alert",
4877
4877
  id: id,
4878
4878
  className: classNames__default.default('alert alert-detach', `alert-${type === exports.Sentiment.NEGATIVE || type === exports.Sentiment.ERROR ? 'danger' : type}`, className),
4879
- children: [type !== exports.Sentiment.NEUTRAL && type !== exports.Sentiment.PENDING && /*#__PURE__*/jsxRuntime.jsx(StatusIcon, {
4879
+ children: [iconTypes.has(type) && /*#__PURE__*/jsxRuntime.jsx(StatusIcon, {
4880
4880
  sentiment: type,
4881
4881
  size: exports.Size.SMALL
4882
4882
  }), /*#__PURE__*/jsxRuntime.jsx("div", {
@@ -4886,6 +4886,20 @@ function InlineAlert({
4886
4886
  });
4887
4887
  }
4888
4888
 
4889
+ const Label = ({
4890
+ id,
4891
+ htmlFor,
4892
+ className,
4893
+ children
4894
+ }) => {
4895
+ return /*#__PURE__*/jsxRuntime.jsx("label", {
4896
+ id: id,
4897
+ htmlFor: htmlFor,
4898
+ className: classNames__default.default('control-label d-flex flex-column gap-y-1 m-b-0', className),
4899
+ children: children
4900
+ });
4901
+ };
4902
+
4889
4903
  const Field = ({
4890
4904
  id,
4891
4905
  label,
@@ -4917,12 +4931,11 @@ const Field = ({
4917
4931
  'has-error': hasError,
4918
4932
  'has-info': sentiment === exports.Sentiment.NEUTRAL
4919
4933
  }, className),
4920
- children: [label ? /*#__PURE__*/jsxRuntime.jsx("label", {
4934
+ children: [label != null ? /*#__PURE__*/jsxRuntime.jsxs(Label, {
4921
4935
  id: labelId,
4922
4936
  htmlFor: inputId,
4923
- className: "control-label",
4924
- children: label
4925
- }) : null, children, message && /*#__PURE__*/jsxRuntime.jsx(InlineAlert, {
4937
+ children: [label, children]
4938
+ }) : children, message && /*#__PURE__*/jsxRuntime.jsx(InlineAlert, {
4926
4939
  type: sentiment,
4927
4940
  id: descriptionId,
4928
4941
  children: message
@@ -7146,20 +7159,6 @@ function Instruction({
7146
7159
  });
7147
7160
  }
7148
7161
 
7149
- const Label = ({
7150
- id,
7151
- htmlFor,
7152
- className,
7153
- children
7154
- }) => {
7155
- return /*#__PURE__*/jsxRuntime.jsx("label", {
7156
- id: id,
7157
- htmlFor: htmlFor,
7158
- className: classNames__default.default('control-label d-flex flex-column gap-y-1 m-b-0', className),
7159
- children: children
7160
- });
7161
- };
7162
-
7163
7162
  const ListItem = ({
7164
7163
  media,
7165
7164
  action,
@@ -9717,9 +9716,6 @@ const SegmentedControl = ({
9717
9716
  segments,
9718
9717
  onChange
9719
9718
  }) => {
9720
- const inputAttributes = useInputAttributes({
9721
- nonLabelable: true
9722
- });
9723
9719
  const [animate, setAnimate] = React.useState(false);
9724
9720
  const segmentsRef = React.useRef(null);
9725
9721
  if (segments.length > 3) {
@@ -9765,8 +9761,7 @@ const SegmentedControl = ({
9765
9761
  className: classNames__default.default('segmented-control__segments', {
9766
9762
  'segmented-control__segments--no-animate': !animate
9767
9763
  }),
9768
- role: mode !== 'input' ? 'tablist' : 'group',
9769
- ...inputAttributes,
9764
+ role: mode !== 'input' ? 'tablist' : undefined,
9770
9765
  children: segmentsWithRefs.map(segment => {
9771
9766
  const onSelect = () => {
9772
9767
  setAnimate(true);
@@ -10921,19 +10916,18 @@ Tab.propTypes = {
10921
10916
  focusTab: PropTypes__default.default.func
10922
10917
  };
10923
10918
 
10924
- function TabList({
10919
+ const TabList = ({
10925
10920
  children
10926
- }) {
10927
- const inputAttributes = useInputAttributes({
10928
- nonLabelable: true
10929
- });
10921
+ }) => {
10930
10922
  return /*#__PURE__*/jsxRuntime.jsx("ul", {
10931
10923
  className: "tabs__tab-list",
10932
10924
  role: "tablist",
10933
- ...inputAttributes,
10934
10925
  children: children
10935
10926
  });
10936
- }
10927
+ };
10928
+ TabList.propTypes = {
10929
+ children: PropTypes__default.default.oneOfType([PropTypes__default.default.object, PropTypes__default.default.array]).isRequired
10930
+ };
10937
10931
 
10938
10932
  const TabPanel = ({
10939
10933
  children,