@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.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)
@@ -4886,6 +4885,20 @@ function InlineAlert({
4886
4885
  });
4887
4886
  }
4888
4887
 
4888
+ const Label = ({
4889
+ id,
4890
+ htmlFor,
4891
+ className,
4892
+ children
4893
+ }) => {
4894
+ return /*#__PURE__*/jsxRuntime.jsx("label", {
4895
+ id: id,
4896
+ htmlFor: htmlFor,
4897
+ className: classNames__default.default('control-label d-flex flex-column gap-y-1 m-b-0', className),
4898
+ children: children
4899
+ });
4900
+ };
4901
+
4889
4902
  const Field = ({
4890
4903
  id,
4891
4904
  label,
@@ -4917,12 +4930,11 @@ const Field = ({
4917
4930
  'has-error': hasError,
4918
4931
  'has-info': sentiment === exports.Sentiment.NEUTRAL
4919
4932
  }, className),
4920
- children: [label ? /*#__PURE__*/jsxRuntime.jsx("label", {
4933
+ children: [label != null ? /*#__PURE__*/jsxRuntime.jsxs(Label, {
4921
4934
  id: labelId,
4922
4935
  htmlFor: inputId,
4923
- className: "control-label",
4924
- children: label
4925
- }) : null, children, message && /*#__PURE__*/jsxRuntime.jsx(InlineAlert, {
4936
+ children: [label, children]
4937
+ }) : children, message && /*#__PURE__*/jsxRuntime.jsx(InlineAlert, {
4926
4938
  type: sentiment,
4927
4939
  id: descriptionId,
4928
4940
  children: message
@@ -7146,20 +7158,6 @@ function Instruction({
7146
7158
  });
7147
7159
  }
7148
7160
 
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
7161
  const ListItem = ({
7164
7162
  media,
7165
7163
  action,
@@ -9717,9 +9715,6 @@ const SegmentedControl = ({
9717
9715
  segments,
9718
9716
  onChange
9719
9717
  }) => {
9720
- const inputAttributes = useInputAttributes({
9721
- nonLabelable: true
9722
- });
9723
9718
  const [animate, setAnimate] = React.useState(false);
9724
9719
  const segmentsRef = React.useRef(null);
9725
9720
  if (segments.length > 3) {
@@ -9765,8 +9760,7 @@ const SegmentedControl = ({
9765
9760
  className: classNames__default.default('segmented-control__segments', {
9766
9761
  'segmented-control__segments--no-animate': !animate
9767
9762
  }),
9768
- role: mode !== 'input' ? 'tablist' : 'group',
9769
- ...inputAttributes,
9763
+ role: mode !== 'input' ? 'tablist' : undefined,
9770
9764
  children: segmentsWithRefs.map(segment => {
9771
9765
  const onSelect = () => {
9772
9766
  setAnimate(true);
@@ -10921,19 +10915,18 @@ Tab.propTypes = {
10921
10915
  focusTab: PropTypes__default.default.func
10922
10916
  };
10923
10917
 
10924
- function TabList({
10918
+ const TabList = ({
10925
10919
  children
10926
- }) {
10927
- const inputAttributes = useInputAttributes({
10928
- nonLabelable: true
10929
- });
10920
+ }) => {
10930
10921
  return /*#__PURE__*/jsxRuntime.jsx("ul", {
10931
10922
  className: "tabs__tab-list",
10932
10923
  role: "tablist",
10933
- ...inputAttributes,
10934
10924
  children: children
10935
10925
  });
10936
- }
10926
+ };
10927
+ TabList.propTypes = {
10928
+ children: PropTypes__default.default.oneOfType([PropTypes__default.default.object, PropTypes__default.default.array]).isRequired
10929
+ };
10937
10930
 
10938
10931
  const TabPanel = ({
10939
10932
  children,