@transferwise/components 0.0.0-experimental-d391f4a → 0.0.0-experimental-dbf97a7

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.
Files changed (35) hide show
  1. package/build/index.js +25 -32
  2. package/build/index.js.map +1 -1
  3. package/build/index.mjs +25 -32
  4. package/build/index.mjs.map +1 -1
  5. package/build/main.css +2 -4
  6. package/build/styles/main.css +2 -4
  7. package/build/styles/segmentedControl/SegmentedControl.css +2 -4
  8. package/build/types/definitionList/DefinitionList.d.ts +2 -2
  9. package/build/types/definitionList/DefinitionList.d.ts.map +1 -1
  10. package/build/types/definitionList/index.d.ts +1 -1
  11. package/build/types/definitionList/index.d.ts.map +1 -1
  12. package/build/types/field/Field.d.ts.map +1 -1
  13. package/build/types/index.d.ts +1 -1
  14. package/build/types/index.d.ts.map +1 -1
  15. package/build/types/inputs/contexts.d.ts.map +1 -1
  16. package/build/types/segmentedControl/SegmentedControl.d.ts.map +1 -1
  17. package/build/types/tabs/TabList.d.ts +8 -3
  18. package/build/types/tabs/TabList.d.ts.map +1 -1
  19. package/package.json +1 -1
  20. package/src/definitionList/DefinitionList.tsx +6 -3
  21. package/src/definitionList/index.ts +1 -1
  22. package/src/field/Field.tsx +7 -5
  23. package/src/index.ts +1 -1
  24. package/src/inputs/contexts.tsx +1 -2
  25. package/src/main.css +2 -4
  26. package/src/segmentedControl/SegmentedControl.css +2 -4
  27. package/src/segmentedControl/SegmentedControl.less +1 -4
  28. package/src/segmentedControl/SegmentedControl.spec.tsx +0 -10
  29. package/src/segmentedControl/SegmentedControl.story.tsx +4 -42
  30. package/src/segmentedControl/SegmentedControl.tsx +1 -5
  31. package/src/tabs/TabList.js +15 -0
  32. package/src/tabs/Tabs.story.js +135 -0
  33. package/src/tabs/TabList.tsx +0 -15
  34. package/src/tabs/Tabs.rtl.spec.tsx +0 -40
  35. 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: !nonLabelable ? id : undefined,
2244
+ id: useContext(InputIdContext),
2246
2245
  'aria-labelledby': nonLabelable ? labelId : undefined,
2247
2246
  'aria-describedby': useContext(InputDescribedByContext),
2248
2247
  'aria-invalid': useContext(InputInvalidContext)
@@ -4857,6 +4856,20 @@ function InlineAlert({
4857
4856
  });
4858
4857
  }
4859
4858
 
4859
+ const Label = ({
4860
+ id,
4861
+ htmlFor,
4862
+ className,
4863
+ children
4864
+ }) => {
4865
+ return /*#__PURE__*/jsx("label", {
4866
+ id: id,
4867
+ htmlFor: htmlFor,
4868
+ className: classNames('control-label d-flex flex-column gap-y-1 m-b-0', className),
4869
+ children: children
4870
+ });
4871
+ };
4872
+
4860
4873
  const Field = ({
4861
4874
  id,
4862
4875
  label,
@@ -4888,12 +4901,11 @@ const Field = ({
4888
4901
  'has-error': hasError,
4889
4902
  'has-info': sentiment === Sentiment.NEUTRAL
4890
4903
  }, className),
4891
- children: [label ? /*#__PURE__*/jsx("label", {
4904
+ children: [label != null ? /*#__PURE__*/jsxs(Label, {
4892
4905
  id: labelId,
4893
4906
  htmlFor: inputId,
4894
- className: "control-label",
4895
- children: label
4896
- }) : null, children, message && /*#__PURE__*/jsx(InlineAlert, {
4907
+ children: [label, children]
4908
+ }) : children, message && /*#__PURE__*/jsx(InlineAlert, {
4897
4909
  type: sentiment,
4898
4910
  id: descriptionId,
4899
4911
  children: message
@@ -7117,20 +7129,6 @@ function Instruction({
7117
7129
  });
7118
7130
  }
7119
7131
 
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
7132
  const ListItem = ({
7135
7133
  media,
7136
7134
  action,
@@ -9688,9 +9686,6 @@ const SegmentedControl = ({
9688
9686
  segments,
9689
9687
  onChange
9690
9688
  }) => {
9691
- const inputAttributes = useInputAttributes({
9692
- nonLabelable: true
9693
- });
9694
9689
  const [animate, setAnimate] = useState(false);
9695
9690
  const segmentsRef = useRef(null);
9696
9691
  if (segments.length > 3) {
@@ -9736,8 +9731,7 @@ const SegmentedControl = ({
9736
9731
  className: classNames('segmented-control__segments', {
9737
9732
  'segmented-control__segments--no-animate': !animate
9738
9733
  }),
9739
- role: mode !== 'input' ? 'tablist' : 'group',
9740
- ...inputAttributes,
9734
+ role: mode !== 'input' ? 'tablist' : undefined,
9741
9735
  children: segmentsWithRefs.map(segment => {
9742
9736
  const onSelect = () => {
9743
9737
  setAnimate(true);
@@ -10892,19 +10886,18 @@ Tab.propTypes = {
10892
10886
  focusTab: PropTypes.func
10893
10887
  };
10894
10888
 
10895
- function TabList({
10889
+ const TabList = ({
10896
10890
  children
10897
- }) {
10898
- const inputAttributes = useInputAttributes({
10899
- nonLabelable: true
10900
- });
10891
+ }) => {
10901
10892
  return /*#__PURE__*/jsx("ul", {
10902
10893
  className: "tabs__tab-list",
10903
10894
  role: "tablist",
10904
- ...inputAttributes,
10905
10895
  children: children
10906
10896
  });
10907
- }
10897
+ };
10898
+ TabList.propTypes = {
10899
+ children: PropTypes.oneOfType([PropTypes.object, PropTypes.array]).isRequired
10900
+ };
10908
10901
 
10909
10902
  const TabPanel = ({
10910
10903
  children,