@transferwise/components 46.104.0 → 46.105.0

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 (82) hide show
  1. package/build/header/Header.js +60 -43
  2. package/build/header/Header.js.map +1 -1
  3. package/build/header/Header.mjs +57 -43
  4. package/build/header/Header.mjs.map +1 -1
  5. package/build/i18n/cs.json +2 -0
  6. package/build/i18n/cs.json.js +2 -0
  7. package/build/i18n/cs.json.js.map +1 -1
  8. package/build/i18n/cs.json.mjs +2 -0
  9. package/build/i18n/cs.json.mjs.map +1 -1
  10. package/build/i18n/es.json +2 -0
  11. package/build/i18n/es.json.js +2 -0
  12. package/build/i18n/es.json.js.map +1 -1
  13. package/build/i18n/es.json.mjs +2 -0
  14. package/build/i18n/es.json.mjs.map +1 -1
  15. package/build/i18n/th.json +2 -0
  16. package/build/i18n/th.json.js +2 -0
  17. package/build/i18n/th.json.js.map +1 -1
  18. package/build/i18n/th.json.mjs +2 -0
  19. package/build/i18n/th.json.mjs.map +1 -1
  20. package/build/index.js +1 -1
  21. package/build/index.mjs +1 -1
  22. package/build/inputs/SelectInput.js +1 -1
  23. package/build/inputs/SelectInput.js.map +1 -1
  24. package/build/inputs/SelectInput.mjs +1 -1
  25. package/build/listItem/ListItem.js +4 -2
  26. package/build/listItem/ListItem.js.map +1 -1
  27. package/build/listItem/ListItem.mjs +4 -2
  28. package/build/listItem/ListItem.mjs.map +1 -1
  29. package/build/main.css +24 -14
  30. package/build/styles/header/Header.css +21 -14
  31. package/build/styles/listItem/ListItem.css +3 -0
  32. package/build/styles/main.css +24 -14
  33. package/build/title/Title.js +10 -4
  34. package/build/title/Title.js.map +1 -1
  35. package/build/title/Title.mjs +6 -4
  36. package/build/title/Title.mjs.map +1 -1
  37. package/build/types/header/Header.d.ts +27 -11
  38. package/build/types/header/Header.d.ts.map +1 -1
  39. package/build/types/header/index.d.ts +1 -0
  40. package/build/types/header/index.d.ts.map +1 -1
  41. package/build/types/index.d.ts +1 -0
  42. package/build/types/index.d.ts.map +1 -1
  43. package/build/types/listItem/ListItem.d.ts.map +1 -1
  44. package/build/types/listItem/_stories/subcomponents.d.ts +1 -1
  45. package/build/types/listItem/_stories/subcomponents.d.ts.map +1 -1
  46. package/build/types/title/Title.d.ts +4 -5
  47. package/build/types/title/Title.d.ts.map +1 -1
  48. package/package.json +1 -1
  49. package/src/actionButton/ActionButton.story.tsx +1 -1
  50. package/src/avatar/Avatar.story.tsx +1 -1
  51. package/src/avatarWrapper/AvatarWrapper.story.tsx +1 -1
  52. package/src/badge/Badge.story.tsx +1 -1
  53. package/src/button/Button.spec.tsx +25 -1
  54. package/src/button/Button.story.tsx +1 -1
  55. package/src/button/LegacyButton.story.tsx +1 -1
  56. package/src/header/Header.accessibility.docs.mdx +85 -0
  57. package/src/header/Header.css +21 -14
  58. package/src/header/Header.less +17 -10
  59. package/src/header/Header.spec.tsx +68 -50
  60. package/src/header/Header.story.tsx +190 -36
  61. package/src/header/Header.tsx +96 -65
  62. package/src/header/index.ts +1 -0
  63. package/src/i18n/cs.json +2 -0
  64. package/src/i18n/es.json +2 -0
  65. package/src/i18n/th.json +2 -0
  66. package/src/iconButton/iconButton.spec.tsx +31 -0
  67. package/src/index.ts +1 -0
  68. package/src/listItem/Button/ListItemButton.spec.tsx +23 -1
  69. package/src/listItem/IconButton/ListItemIconButton.spec.tsx +14 -2
  70. package/src/listItem/ListItem.css +3 -0
  71. package/src/listItem/ListItem.less +4 -0
  72. package/src/listItem/ListItem.tsx +4 -2
  73. package/src/listItem/Navigation/ListItemNavigation.spec.tsx +8 -0
  74. package/src/listItem/Navigation/ListItemNavigation.story.tsx +4 -2
  75. package/src/listItem/_stories/ListItem.layout.test.story.tsx +20 -0
  76. package/src/listItem/_stories/ListItem.story.tsx +1 -1
  77. package/src/listItem/_stories/ListItem.variants.test.story.tsx +3 -0
  78. package/src/listItem/_stories/subcomponents.tsx +2 -0
  79. package/src/main.css +24 -14
  80. package/src/primitives/PrimitiveAnchor/test/PrimitiveAnchor.spec.tsx +15 -4
  81. package/src/select/Select.story.tsx +1 -1
  82. package/src/title/Title.tsx +25 -12
@@ -1,5 +1,5 @@
1
1
  import { clsx } from 'clsx';
2
- import { LabelHTMLAttributes, LiHTMLAttributes, ReactHTML } from 'react';
2
+ import React, { forwardRef, LabelHTMLAttributes, LiHTMLAttributes } from 'react';
3
3
 
4
4
  import { TitleTypes, Typography, Heading } from '../common';
5
5
 
@@ -25,16 +25,29 @@ type Props = LabelHTMLAttributes<HTMLHeadingElement | HTMLSpanElement | HTMLLabe
25
25
  type?: TitleTypes;
26
26
  };
27
27
 
28
- function Title({ as, type = DEFAULT_TYPE, className, ...props }: Props) {
29
- const mapping = titleTypeMapping[type];
30
- const isTypeSupported = mapping !== undefined;
31
-
32
- if (isTypeSupported) {
33
- const HeaderTag = as ?? mapping;
34
- return <HeaderTag {...props} className={clsx(`np-text-${type}`, className)} />;
35
- }
36
- const HeaderTag = as ?? titleTypeMapping[DEFAULT_TYPE];
37
- return <HeaderTag {...props} className={clsx(`np-text-${DEFAULT_TYPE}`, className)} />;
38
- }
28
+ const Title = React.forwardRef<HTMLHeadingElement | HTMLSpanElement | HTMLLabelElement, Props>(
29
+ ({ as, type = DEFAULT_TYPE, className, ...props }, ref) => {
30
+ const mapping = titleTypeMapping[type as keyof typeof titleTypeMapping];
31
+ const isTypeSupported = mapping !== undefined;
32
+ if (isTypeSupported) {
33
+ const HeaderTag = as ?? mapping;
34
+ return (
35
+ <HeaderTag
36
+ ref={ref as React.Ref<any>}
37
+ {...props}
38
+ className={clsx(`np-text-${type}`, className)}
39
+ />
40
+ );
41
+ }
42
+ const HeaderTag = as ?? titleTypeMapping[DEFAULT_TYPE];
43
+ return (
44
+ <HeaderTag
45
+ ref={ref as React.Ref<any>}
46
+ {...props}
47
+ className={clsx(`np-text-${DEFAULT_TYPE}`, className)}
48
+ />
49
+ );
50
+ },
51
+ );
39
52
 
40
53
  export default Title;