@transferwise/components 0.0.0-experimental-a9e2e05 → 0.0.0-experimental-e92f7ac

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 (153) hide show
  1. package/build/avatarLayout/AvatarLayout.js +2 -9
  2. package/build/avatarLayout/AvatarLayout.js.map +1 -1
  3. package/build/avatarLayout/AvatarLayout.mjs +2 -9
  4. package/build/avatarLayout/AvatarLayout.mjs.map +1 -1
  5. package/build/button/{LegacyButton/Button.js → Button.js} +24 -25
  6. package/build/button/Button.js.map +1 -0
  7. package/build/button/{LegacyButton/Button.mjs → Button.mjs} +24 -25
  8. package/build/button/Button.mjs.map +1 -0
  9. package/build/button/classMap.js +42 -0
  10. package/build/button/classMap.js.map +1 -0
  11. package/build/button/classMap.mjs +39 -0
  12. package/build/button/classMap.mjs.map +1 -0
  13. package/build/button/{LegacyButton/legacyUtils → legacyUtils}/legacyUtils.js +21 -21
  14. package/build/button/legacyUtils/legacyUtils.js.map +1 -0
  15. package/build/button/{LegacyButton/legacyUtils → legacyUtils}/legacyUtils.mjs +21 -21
  16. package/build/button/legacyUtils/legacyUtils.mjs.map +1 -0
  17. package/build/circularButton/CircularButton.js +1 -1
  18. package/build/circularButton/CircularButton.js.map +1 -1
  19. package/build/circularButton/CircularButton.mjs +1 -1
  20. package/build/circularButton/CircularButton.mjs.map +1 -1
  21. package/build/common/action/Action.js +1 -1
  22. package/build/common/action/Action.js.map +1 -1
  23. package/build/common/action/Action.mjs +1 -1
  24. package/build/common/action/Action.mjs.map +1 -1
  25. package/build/criticalBanner/CriticalCommsBanner.js +1 -1
  26. package/build/criticalBanner/CriticalCommsBanner.mjs +1 -1
  27. package/build/header/Header.js +1 -1
  28. package/build/header/Header.mjs +1 -1
  29. package/build/index.js +1 -1
  30. package/build/index.mjs +1 -1
  31. package/build/link/Link.js +3 -8
  32. package/build/link/Link.js.map +1 -1
  33. package/build/link/Link.mjs +3 -8
  34. package/build/link/Link.mjs.map +1 -1
  35. package/build/main.css +29 -288
  36. package/build/nudge/Nudge.js +1 -1
  37. package/build/nudge/Nudge.js.map +1 -1
  38. package/build/nudge/Nudge.mjs +1 -1
  39. package/build/nudge/Nudge.mjs.map +1 -1
  40. package/build/select/Select.js +1 -1
  41. package/build/select/Select.mjs +1 -1
  42. package/build/styles/avatarLayout/AvatarLayout.css +0 -11
  43. package/build/styles/iconButton/IconButton.css +29 -24
  44. package/build/styles/main.css +29 -288
  45. package/build/types/avatarLayout/AvatarLayout.d.ts +2 -1
  46. package/build/types/avatarLayout/AvatarLayout.d.ts.map +1 -1
  47. package/build/types/avatarLayout/index.d.ts +0 -1
  48. package/build/types/avatarLayout/index.d.ts.map +1 -1
  49. package/build/types/button/{LegacyButton/Button.d.ts → Button.d.ts} +5 -8
  50. package/build/types/button/Button.d.ts.map +1 -0
  51. package/build/types/button/classMap.d.ts.map +1 -0
  52. package/build/types/button/index.d.ts +2 -2
  53. package/build/types/button/index.d.ts.map +1 -1
  54. package/build/types/button/legacyUtils/index.d.ts.map +1 -0
  55. package/build/types/button/{LegacyButton/legacyUtils → legacyUtils}/legacyUtils.d.ts +1 -1
  56. package/build/types/button/legacyUtils/legacyUtils.d.ts.map +1 -0
  57. package/build/types/link/Link.d.ts +2 -2
  58. package/build/types/link/Link.d.ts.map +1 -1
  59. package/build/types/test-utils/index.d.ts.map +1 -1
  60. package/build/upload/steps/completeStep/completeStep.js +1 -1
  61. package/build/upload/steps/completeStep/completeStep.mjs +1 -1
  62. package/build/upload/steps/processingStep/processingStep.js +1 -1
  63. package/build/upload/steps/processingStep/processingStep.mjs +1 -1
  64. package/build/uploadInput/UploadInput.js +1 -1
  65. package/build/uploadInput/UploadInput.mjs +1 -1
  66. package/package.json +3 -3
  67. package/src/avatarLayout/AvatarLayout.css +0 -11
  68. package/src/avatarLayout/AvatarLayout.less +1 -18
  69. package/src/avatarLayout/AvatarLayout.tsx +3 -11
  70. package/src/avatarLayout/index.ts +0 -1
  71. package/src/avatarWrapper/AvatarWrapper.story.tsx +0 -2
  72. package/src/button/{LegacyButton/Button.less → Button.less} +1 -1
  73. package/src/button/{LegacyButton/Button.spec.tsx → Button.spec.tsx} +3 -3
  74. package/src/button/Button.story.tsx +163 -0
  75. package/src/button/{LegacyButton/Button.tsx → Button.tsx} +9 -14
  76. package/src/button/{LegacyButton/classMap.ts → classMap.ts} +1 -1
  77. package/src/button/index.ts +3 -2
  78. package/src/button/{LegacyButton/legacyUtils → legacyUtils}/legacyUtils.spec.tsx +2 -2
  79. package/src/button/{LegacyButton/legacyUtils → legacyUtils}/legacyUtils.ts +2 -2
  80. package/src/circularButton/CircularButton.tsx +1 -1
  81. package/src/common/action/Action.tsx +1 -1
  82. package/src/iconButton/IconButton.css +29 -24
  83. package/src/iconButton/IconButton.less +4 -4
  84. package/src/link/Link.tsx +6 -15
  85. package/src/main.css +29 -288
  86. package/src/main.less +1 -2
  87. package/src/nudge/Nudge.tsx +1 -1
  88. package/src/phoneNumberInput/PhoneNumberInput.spec.tsx +283 -0
  89. package/src/primitives/PrimitiveAnchor/stories/PrimitiveAnchor.story.tsx +1 -1
  90. package/src/primitives/PrimitiveAnchor/test/PrimitiveAnchor.spec.tsx +1 -1
  91. package/src/primitives/PrimitiveButton/stories/PrimitiveButton.story.tsx +1 -1
  92. package/src/primitives/PrimitiveButton/test/PrimitiveButton.spec.tsx +3 -2
  93. package/src/test-utils/index.tsx +1 -0
  94. package/build/button/Button/src/Button.js +0 -93
  95. package/build/button/Button/src/Button.js.map +0 -1
  96. package/build/button/Button/src/Button.mjs +0 -91
  97. package/build/button/Button/src/Button.mjs.map +0 -1
  98. package/build/button/LegacyButton/Button.js.map +0 -1
  99. package/build/button/LegacyButton/Button.mjs.map +0 -1
  100. package/build/button/LegacyButton/classMap.js +0 -42
  101. package/build/button/LegacyButton/classMap.js.map +0 -1
  102. package/build/button/LegacyButton/classMap.mjs +0 -39
  103. package/build/button/LegacyButton/classMap.mjs.map +0 -1
  104. package/build/button/LegacyButton/legacyUtils/legacyUtils.js.map +0 -1
  105. package/build/button/LegacyButton/legacyUtils/legacyUtils.mjs.map +0 -1
  106. package/build/button/src/Button.js +0 -66
  107. package/build/button/src/Button.js.map +0 -1
  108. package/build/button/src/Button.mjs +0 -64
  109. package/build/button/src/Button.mjs.map +0 -1
  110. package/build/styles/button/Button/less/Button.css +0 -253
  111. package/build/styles/button/Button/less/Button.vars.css +0 -57
  112. package/build/types/button/Button/index.d.ts +0 -3
  113. package/build/types/button/Button/index.d.ts.map +0 -1
  114. package/build/types/button/Button/src/Button.d.ts +0 -4
  115. package/build/types/button/Button/src/Button.d.ts.map +0 -1
  116. package/build/types/button/Button/src/Button.types.d.ts +0 -50
  117. package/build/types/button/Button/src/Button.types.d.ts.map +0 -1
  118. package/build/types/button/Button/src/index.d.ts +0 -2
  119. package/build/types/button/Button/src/index.d.ts.map +0 -1
  120. package/build/types/button/LegacyButton/Button.d.ts.map +0 -1
  121. package/build/types/button/LegacyButton/classMap.d.ts.map +0 -1
  122. package/build/types/button/LegacyButton/index.d.ts +0 -3
  123. package/build/types/button/LegacyButton/index.d.ts.map +0 -1
  124. package/build/types/button/LegacyButton/legacyUtils/index.d.ts.map +0 -1
  125. package/build/types/button/LegacyButton/legacyUtils/legacyUtils.d.ts.map +0 -1
  126. package/build/types/button/src/Button.d.ts +0 -47
  127. package/build/types/button/src/Button.d.ts.map +0 -1
  128. package/build/types/button/src/index.d.ts +0 -3
  129. package/build/types/button/src/index.d.ts.map +0 -1
  130. package/src/button/Button/index.ts +0 -2
  131. package/src/button/Button/less/Button.css +0 -253
  132. package/src/button/Button/less/Button.less +0 -221
  133. package/src/button/Button/less/Button.vars.css +0 -57
  134. package/src/button/Button/less/Button.vars.less +0 -65
  135. package/src/button/Button/src/Button.tsx +0 -116
  136. package/src/button/Button/src/Button.types.ts +0 -70
  137. package/src/button/Button/src/index.ts +0 -1
  138. package/src/button/Button/stories/Button.story.tsx +0 -314
  139. package/src/button/Button/stories/Button.tests.story.tsx +0 -288
  140. package/src/button/Button/test/Button.spec.tsx +0 -328
  141. package/src/button/LegacyButton/Button.story.tsx +0 -224
  142. package/src/button/LegacyButton/index.ts +0 -3
  143. package/src/button/src/Button.tsx +0 -87
  144. package/src/button/src/index.ts +0 -2
  145. package/src/button/test/Button.spec.tsx +0 -32
  146. package/src/phoneNumberInput/PhoneNumberInput.rtl.spec.tsx +0 -32
  147. package/src/phoneNumberInput/PhoneNumberInput.spec.js +0 -356
  148. /package/build/styles/button/{LegacyButton/Button.css → Button.css} +0 -0
  149. /package/build/types/button/{LegacyButton/classMap.d.ts → classMap.d.ts} +0 -0
  150. /package/build/types/button/{LegacyButton/legacyUtils → legacyUtils}/index.d.ts +0 -0
  151. /package/src/button/{LegacyButton/Button.css → Button.css} +0 -0
  152. /package/src/button/{LegacyButton/__snapshots__ → __snapshots__}/Button.spec.tsx.snap +0 -0
  153. /package/src/button/{LegacyButton/legacyUtils → legacyUtils}/index.ts +0 -0
@@ -2,10 +2,6 @@
2
2
 
3
3
  var clsx = require('clsx');
4
4
  var AvatarView = require('../avatarView/AvatarView.js');
5
- require('@transferwise/neptune-validation');
6
- require('react');
7
- var useDirection = require('../common/hooks/useDirection/useDirection.js');
8
- require('../common/propsValues/breakpoint.js');
9
5
  var jsxRuntime = require('react/jsx-runtime');
10
6
 
11
7
  function AvatarLayout({
@@ -17,9 +13,6 @@ function AvatarLayout({
17
13
  ...restProps
18
14
  }) {
19
15
  const orientation = size === 16 && orientationProp === 'diagonal' ? 'horizontal' : orientationProp;
20
- const {
21
- isRTL
22
- } = useDirection.useDirection();
23
16
  const isDiagonal = orientation === 'diagonal';
24
17
  const avatarSize = isDiagonal ? DIAGONAL_LAYOUT_STYLE_CONFIG[size]?.avatarSize : size;
25
18
  return avatars.length < 1 ? null : avatars.length === 1 ? /*#__PURE__*/jsxRuntime.jsx(AvatarView, {
@@ -40,9 +33,9 @@ function AvatarLayout({
40
33
  ...avatar
41
34
  }, index) => /*#__PURE__*/jsxRuntime.jsx("div", {
42
35
  className: clsx.clsx({
43
- [`np-avatar-layout-${orientation}-child`]: !isDiagonal && isRTL ? index !== avatars.length - 1 : index !== 0
36
+ [`np-avatar-layout-${orientation}-child`]: index !== 0
44
37
  }, {
45
- [`np-avatar-layout-${orientation}-mask`]: !isDiagonal && isRTL ? index !== 0 : index !== avatars.length - 1
38
+ [`np-avatar-layout-${orientation}-mask`]: index !== avatars.length - 1
46
39
  }),
47
40
  children: /*#__PURE__*/jsxRuntime.jsx(AvatarView, {
48
41
  ...avatar,
@@ -1 +1 @@
1
- {"version":3,"file":"AvatarLayout.js","sources":["../../src/avatarLayout/AvatarLayout.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport AvatarView, { AvatarViewProps } from '../avatarView';\nimport { useDirection } from '../common/hooks';\n\nexport type SingleAvatarType = { asset?: AvatarViewProps['children'] } & Omit<\n AvatarViewProps,\n 'notification' | 'selected' | 'size' | 'badge' | 'children' | 'interactive'\n>;\n\nexport type Props = {\n avatars: SingleAvatarType[];\n orientation?: 'horizontal' | 'diagonal';\n} & Pick<\n AvatarViewProps,\n 'size' | 'interactive' | 'className' | 'role' | 'aria-label' | 'aria-labelledby' | 'aria-hidden'\n>;\n\nexport default function AvatarLayout({\n avatars = [],\n orientation: orientationProp = 'horizontal',\n size = 48,\n className,\n interactive,\n ...restProps\n}: Props) {\n const orientation =\n size === 16 && orientationProp === 'diagonal' ? 'horizontal' : orientationProp;\n const { isRTL } = useDirection();\n const isDiagonal = orientation === 'diagonal';\n const avatarSize = isDiagonal ? DIAGONAL_LAYOUT_STYLE_CONFIG[size]?.avatarSize : size;\n return avatars.length < 1 ? null : avatars.length === 1 ? (\n <AvatarView {...avatars[0]}>{avatars[0].asset}</AvatarView>\n ) : (\n <div\n className={clsx('np-avatar-layout', `np-avatar-layout-${orientation}`, className)}\n style={{\n // @ts-expect-error CSS custom props allowed\n '--np-avatar-layout-size': `${size}px`,\n '--np-avatar-size': `${avatarSize}px`,\n '--np-avatar-offset': `${isDiagonal ? DIAGONAL_LAYOUT_STYLE_CONFIG[size].offset : HORIZONTAL_LAYOUT_OFFSET[size]}px`,\n }}\n {...restProps}\n >\n {avatars.map(({ asset, style, ...avatar }, index) => (\n <div\n // eslint-disable-next-line react/no-array-index-key\n key={index}\n className={clsx(\n {\n [`np-avatar-layout-${orientation}-child`]:\n !isDiagonal && isRTL ? index !== avatars.length - 1 : index !== 0,\n },\n {\n [`np-avatar-layout-${orientation}-mask`]:\n !isDiagonal && isRTL ? index !== 0 : index !== avatars.length - 1,\n },\n )}\n >\n <AvatarView\n {...avatar}\n size={avatarSize as Props['size']}\n style={{\n ...(isDiagonal && {\n '--circle-size': `${avatarSize}px`,\n '--circle-icon-size': `${DIAGONAL_LAYOUT_STYLE_CONFIG[size].iconSize}px`,\n '--circle-font-size': `${DIAGONAL_LAYOUT_STYLE_CONFIG[size].fontSize}px`,\n }),\n ...style,\n }}\n interactive={interactive}\n >\n {asset}\n </AvatarView>\n </div>\n ))}\n </div>\n );\n}\n\n/** Diagonal layout have custom sizes for avatar, font and icon */\nconst DIAGONAL_LAYOUT_STYLE_CONFIG = {\n // Diagonal layout doesn't support 16 size\n 16: { avatarSize: undefined, offset: undefined, fontSize: undefined, iconSize: undefined },\n 24: { avatarSize: 15, offset: 2.5, fontSize: 8, iconSize: 11.25 },\n 32: { avatarSize: 20, offset: 2.5, fontSize: 12, iconSize: 15 },\n 40: { avatarSize: 24, offset: 4.5, fontSize: 12, iconSize: 18 },\n 48: { avatarSize: 30, offset: 3.5, fontSize: 14, iconSize: 16.87 },\n 56: { avatarSize: 34, offset: 5, fontSize: 14, iconSize: 19.12 },\n 72: { avatarSize: 44, offset: 6, fontSize: 22, iconSize: 22 },\n};\n\n/** Horizontal layout have custom offset between avatars */\nconst HORIZONTAL_LAYOUT_OFFSET = {\n 16: 2,\n 24: 2,\n 32: 4,\n 40: 4,\n 48: 4,\n 56: 5,\n 72: 5,\n};\n"],"names":["AvatarLayout","avatars","orientation","orientationProp","size","className","interactive","restProps","isRTL","useDirection","isDiagonal","avatarSize","DIAGONAL_LAYOUT_STYLE_CONFIG","length","_jsx","AvatarView","children","asset","clsx","style","offset","HORIZONTAL_LAYOUT_OFFSET","map","avatar","index","iconSize","fontSize","undefined"],"mappings":";;;;;;;;;;AAiBc,SAAUA,YAAYA,CAAC;AACnCC,EAAAA,OAAO,GAAG,EAAE;EACZC,WAAW,EAAEC,eAAe,GAAG,YAAY;AAC3CC,EAAAA,IAAI,GAAG,EAAE;EACTC,SAAS;EACTC,WAAW;EACX,GAAGC,SAAAA;AACG,CAAA,EAAA;AACN,EAAA,MAAML,WAAW,GACfE,IAAI,KAAK,EAAE,IAAID,eAAe,KAAK,UAAU,GAAG,YAAY,GAAGA,eAAe,CAAA;EAChF,MAAM;AAAEK,IAAAA,KAAAA;GAAO,GAAGC,yBAAY,EAAE,CAAA;AAChC,EAAA,MAAMC,UAAU,GAAGR,WAAW,KAAK,UAAU,CAAA;EAC7C,MAAMS,UAAU,GAAGD,UAAU,GAAGE,4BAA4B,CAACR,IAAI,CAAC,EAAEO,UAAU,GAAGP,IAAI,CAAA;AACrF,EAAA,OAAOH,OAAO,CAACY,MAAM,GAAG,CAAC,GAAG,IAAI,GAAGZ,OAAO,CAACY,MAAM,KAAK,CAAC,gBACrDC,cAAA,CAACC,UAAU,EAAA;IAAA,GAAKd,OAAO,CAAC,CAAC,CAAC;AAAAe,IAAAA,QAAA,EAAGf,OAAO,CAAC,CAAC,CAAC,CAACgB,KAAAA;GAAkB,CAAC,gBAE3DH,cAAA,CAAA,KAAA,EAAA;IACET,SAAS,EAAEa,SAAI,CAAC,kBAAkB,EAAE,oBAAoBhB,WAAW,CAAA,CAAE,EAAEG,SAAS,CAAE;AAClFc,IAAAA,KAAK,EAAE;AACL;MACA,yBAAyB,EAAE,CAAGf,EAAAA,IAAI,CAAI,EAAA,CAAA;MACtC,kBAAkB,EAAE,CAAGO,EAAAA,UAAU,CAAI,EAAA,CAAA;AACrC,MAAA,o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I,GAAA;CAC9D,CAAA;AAED;AACA,MAAMJ,wBAAwB,GAAG;AAC/B,EAAA,EAAE,EAAE,CAAC;AACL,EAAA,EAAE,EAAE,CAAC;AACL,EAAA,EAAE,EAAE,CAAC;AACL,EAAA,EAAE,EAAE,CAAC;AACL,EAAA,EAAE,EAAE,CAAC;AACL,EAAA,EAAE,EAAE,CAAC;AACL,EAAA,EAAE,EAAE,CAAA;CACL;;;;"}
1
+ {"version":3,"file":"AvatarLayout.js","sources":["../../src/avatarLayout/AvatarLayout.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport AvatarView, { AvatarViewProps } from '../avatarView';\n\ntype SingleAvatarType = { asset?: AvatarViewProps['children'] } & Omit<\n AvatarViewProps,\n 'notification' | 'selected' | 'size' | 'badge' | 'children' | 'interactive'\n>;\n\nexport type Props = {\n avatars: SingleAvatarType[];\n orientation?: 'horizontal' | 'diagonal';\n} & Pick<\n AvatarViewProps,\n 'size' | 'interactive' | 'className' | 'role' | 'aria-label' | 'aria-labelledby' | 'aria-hidden'\n>;\n\nexport default function AvatarLayout({\n avatars = [],\n orientation: orientationProp = 'horizontal',\n size = 48,\n className,\n interactive,\n ...restProps\n}: Props) {\n const orientation =\n size === 16 && orientationProp === 'diagonal' ? 'horizontal' : orientationProp;\n const isDiagonal = orientation === 'diagonal';\n const avatarSize = isDiagonal ? DIAGONAL_LAYOUT_STYLE_CONFIG[size]?.avatarSize : size;\n return avatars.length < 1 ? null : avatars.length === 1 ? (\n <AvatarView {...avatars[0]}>{avatars[0].asset}</AvatarView>\n ) : (\n <div\n className={clsx('np-avatar-layout', `np-avatar-layout-${orientation}`, className)}\n style={{\n // @ts-expect-error CSS custom props allowed\n '--np-avatar-layout-size': `${size}px`,\n '--np-avatar-size': `${avatarSize}px`,\n '--np-avatar-offset': `${isDiagonal ? DIAGONAL_LAYOUT_STYLE_CONFIG[size].offset : HORIZONTAL_LAYOUT_OFFSET[size]}px`,\n }}\n {...restProps}\n >\n {avatars.map(({ asset, style, ...avatar }, index) => (\n <div\n // eslint-disable-next-line react/no-array-index-key\n key={index}\n className={clsx(\n { [`np-avatar-layout-${orientation}-child`]: index !== 0 },\n { [`np-avatar-layout-${orientation}-mask`]: index !== avatars.length - 1 },\n )}\n >\n <AvatarView\n {...avatar}\n size={avatarSize as Props['size']}\n style={{\n ...(isDiagonal && {\n '--circle-size': `${avatarSize}px`,\n '--circle-icon-size': `${DIAGONAL_LAYOUT_STYLE_CONFIG[size].iconSize}px`,\n '--circle-font-size': `${DIAGONAL_LAYOUT_STYLE_CONFIG[size].fontSize}px`,\n }),\n ...style,\n }}\n interactive={interactive}\n >\n {asset}\n </AvatarView>\n </div>\n ))}\n </div>\n );\n}\n\n/** Diagonal layout have custom sizes for avatar, font and icon */\nconst DIAGONAL_LAYOUT_STYLE_CONFIG = {\n // Diagonal layout doesn't support 16 size\n 16: { avatarSize: undefined, offset: undefined, fontSize: undefined, iconSize: undefined },\n 24: { avatarSize: 15, offset: 2.5, fontSize: 8, iconSize: 11.25 },\n 32: { avatarSize: 20, offset: 2.5, fontSize: 12, iconSize: 15 },\n 40: { avatarSize: 24, offset: 4.5, fontSize: 12, iconSize: 18 },\n 48: { avatarSize: 30, offset: 3.5, fontSize: 14, iconSize: 16.87 },\n 56: { avatarSize: 34, offset: 5, fontSize: 14, iconSize: 19.12 },\n 72: { avatarSize: 44, offset: 6, fontSize: 22, iconSize: 22 },\n};\n\n/** Horizontal layout have custom offset between avatars */\nconst HORIZONTAL_LAYOUT_OFFSET = {\n 16: 2,\n 24: 2,\n 32: 4,\n 40: 4,\n 48: 4,\n 56: 5,\n 72: 5,\n};\n"],"names":["AvatarLayout","avatars","orientation","orientationProp","size","className","interactive","restProps","isDiagonal","avatarSize","DIAGONAL_LAYOUT_STYLE_CONFIG","length","_jsx","AvatarView","children","asset","clsx","style","offset","HORIZONTAL_LAYOUT_OFFSET","map","avatar","index","iconSize","fontSize","undefined"],"mappings":";;;;;;AAgBc,SAAUA,YAAYA,CAAC;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- import { useDirection } from '../common/hooks/useDirection/useDirection.mjs';
6
- import '../common/propsValues/breakpoint.mjs';
7
3
  import { jsx } from 'react/jsx-runtime';
8
4
 
9
5
  function AvatarLayout({
@@ -15,9 +11,6 @@ function AvatarLayout({
15
11
  ...restProps
16
12
  }) {
17
13
  const orientation = size === 16 && orientationProp === 'diagonal' ? 'horizontal' : orientationProp;
18
- const {
19
- isRTL
20
- } = useDirection();
21
14
  const isDiagonal = orientation === 'diagonal';
22
15
  const avatarSize = isDiagonal ? DIAGONAL_LAYOUT_STYLE_CONFIG[size]?.avatarSize : size;
23
16
  return avatars.length < 1 ? null : avatars.length === 1 ? /*#__PURE__*/jsx(AvatarView, {
@@ -38,9 +31,9 @@ function AvatarLayout({
38
31
  ...avatar
39
32
  }, index) => /*#__PURE__*/jsx("div", {
40
33
  className: clsx({
41
- [`np-avatar-layout-${orientation}-child`]: !isDiagonal && isRTL ? index !== avatars.length - 1 : index !== 0
34
+ [`np-avatar-layout-${orientation}-child`]: index !== 0
42
35
  }, {
43
- [`np-avatar-layout-${orientation}-mask`]: !isDiagonal && isRTL ? index !== 0 : index !== avatars.length - 1
36
+ [`np-avatar-layout-${orientation}-mask`]: index !== avatars.length - 1
44
37
  }),
45
38
  children: /*#__PURE__*/jsx(AvatarView, {
46
39
  ...avatar,
@@ -1 +1 @@
1
- {"version":3,"file":"AvatarLayout.mjs","sources":["../../src/avatarLayout/AvatarLayout.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport AvatarView, { AvatarViewProps } from '../avatarView';\nimport { useDirection } from '../common/hooks';\n\nexport type SingleAvatarType = { asset?: AvatarViewProps['children'] } & Omit<\n AvatarViewProps,\n 'notification' | 'selected' | 'size' | 'badge' | 'children' | 'interactive'\n>;\n\nexport type Props = {\n avatars: SingleAvatarType[];\n orientation?: 'horizontal' | 'diagonal';\n} & Pick<\n AvatarViewProps,\n 'size' | 'interactive' | 'className' | 'role' | 'aria-label' | 'aria-labelledby' | 'aria-hidden'\n>;\n\nexport default function AvatarLayout({\n avatars = [],\n orientation: orientationProp = 'horizontal',\n size = 48,\n className,\n interactive,\n ...restProps\n}: Props) {\n const orientation =\n size === 16 && orientationProp === 'diagonal' ? 'horizontal' : orientationProp;\n const { isRTL } = useDirection();\n const isDiagonal = orientation === 'diagonal';\n const avatarSize = isDiagonal ? DIAGONAL_LAYOUT_STYLE_CONFIG[size]?.avatarSize : size;\n return avatars.length < 1 ? null : avatars.length === 1 ? (\n <AvatarView {...avatars[0]}>{avatars[0].asset}</AvatarView>\n ) : (\n <div\n className={clsx('np-avatar-layout', `np-avatar-layout-${orientation}`, className)}\n style={{\n // @ts-expect-error CSS custom props allowed\n '--np-avatar-layout-size': `${size}px`,\n '--np-avatar-size': `${avatarSize}px`,\n '--np-avatar-offset': `${isDiagonal ? DIAGONAL_LAYOUT_STYLE_CONFIG[size].offset : HORIZONTAL_LAYOUT_OFFSET[size]}px`,\n }}\n {...restProps}\n >\n {avatars.map(({ asset, style, ...avatar }, index) => (\n <div\n // eslint-disable-next-line react/no-array-index-key\n key={index}\n className={clsx(\n {\n [`np-avatar-layout-${orientation}-child`]:\n !isDiagonal && isRTL ? index !== avatars.length - 1 : index !== 0,\n },\n {\n [`np-avatar-layout-${orientation}-mask`]:\n !isDiagonal && isRTL ? index !== 0 : index !== avatars.length - 1,\n },\n )}\n >\n <AvatarView\n {...avatar}\n size={avatarSize as Props['size']}\n style={{\n ...(isDiagonal && {\n '--circle-size': `${avatarSize}px`,\n '--circle-icon-size': `${DIAGONAL_LAYOUT_STYLE_CONFIG[size].iconSize}px`,\n '--circle-font-size': `${DIAGONAL_LAYOUT_STYLE_CONFIG[size].fontSize}px`,\n }),\n ...style,\n }}\n interactive={interactive}\n >\n {asset}\n </AvatarView>\n </div>\n ))}\n </div>\n );\n}\n\n/** Diagonal layout have custom sizes for avatar, font and icon */\nconst DIAGONAL_LAYOUT_STYLE_CONFIG = {\n // Diagonal layout doesn't support 16 size\n 16: { avatarSize: undefined, offset: undefined, fontSize: undefined, iconSize: undefined },\n 24: { avatarSize: 15, offset: 2.5, fontSize: 8, iconSize: 11.25 },\n 32: { avatarSize: 20, offset: 2.5, fontSize: 12, iconSize: 15 },\n 40: { avatarSize: 24, offset: 4.5, fontSize: 12, iconSize: 18 },\n 48: { avatarSize: 30, offset: 3.5, fontSize: 14, iconSize: 16.87 },\n 56: { avatarSize: 34, offset: 5, fontSize: 14, iconSize: 19.12 },\n 72: { avatarSize: 44, offset: 6, fontSize: 22, iconSize: 22 },\n};\n\n/** Horizontal layout have custom offset between avatars */\nconst HORIZONTAL_LAYOUT_OFFSET = {\n 16: 2,\n 24: 2,\n 32: 4,\n 40: 4,\n 48: 4,\n 56: 5,\n 72: 5,\n};\n"],"names":["AvatarLayout","avatars","orientation","orientationProp","size","className","interactive","restProps","isRTL","useDirection","isDiagonal","avatarSize","DIAGONAL_LAYOUT_STYLE_CONFIG","length","_jsx","AvatarView","children","asset","clsx","style","offset","HORIZONTAL_LAYOUT_OFFSET","map","avatar","index","iconSize","fontSize","undefined"],"mappings":";;;;;;;;AAiBc,SAAUA,YAAYA,CAAC;AACnCC,EAAAA,OAAO,GAAG,EAAE;EACZC,WAAW,EAAEC,eAAe,GAAG,YAAY;AAC3CC,EAAAA,IAAI,GAAG,EAAE;EACTC,SAAS;EACTC,WAAW;EACX,GAAGC,SAAAA;AACG,CAAA,EAAA;AACN,EAAA,MAAML,WAAW,GACfE,IAAI,KAAK,EAAE,IAAID,eAAe,KAAK,UAAU,GAAG,YAAY,GAAGA,eAAe,CAAA;EAChF,MAAM;AAAEK,IAAAA,KAAAA;GAAO,GAAGC,YAAY,EAAE,CAAA;AAChC,EAAA,MAAMC,UAAU,GAAGR,WAAW,KAAK,UAAU,CAAA;EAC7C,MAAMS,UAAU,GAAGD,UAAU,GAAGE,4BAA4B,CAACR,IAAI,CAAC,EAAEO,UAAU,GAAGP,IAAI,CAAA;AACrF,EAAA,OAAOH,OAAO,CAACY,MAAM,GAAG,CAAC,GAAG,IAAI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C/D,EAAA,EAAE,EAAE;AAAEd,IAAAA,UAAU,EAAE,EAAE;AAAES,IAAAA,MAAM,EAAE,GAAG;AAAEM,IAAAA,QAAQ,EAAE,EAAE;AAAED,IAAAA,QAAQ,EAAE,KAAA;GAAO;AAClE,EAAA,EAAE,EAAE;AAAEd,IAAAA,UAAU,EAAE,EAAE;AAAES,IAAAA,MAAM,EAAE,CAAC;AAAEM,IAAAA,QAAQ,EAAE,EAAE;AAAED,IAAAA,QAAQ,EAAE,KAAA;GAAO;AAChE,EAAA,EAAE,EAAE;AAAEd,IAAAA,UAAU,EAAE,EAAE;AAAES,IAAAA,MAAM,EAAE,CAAC;AAAEM,IAAAA,QAAQ,EAAE,EAAE;AAAED,IAAAA,QAAQ,EAAE,EAAA;AAAI,GAAA;CAC9D,CAAA;AAED;AACA,MAAMJ,wBAAwB,GAAG;AAC/B,EAAA,EAAE,EAAE,CAAC;AACL,EAAA,EAAE,EAAE,CAAC;AACL,EAAA,EAAE,EAAE,CAAC;AACL,EAAA,EAAE,EAAE,CAAC;AACL,EAAA,EAAE,EAAE,CAAC;AACL,EAAA,EAAE,EAAE,CAAC;AACL,EAAA,EAAE,EAAE,CAAA;CACL;;;;"}
1
+ {"version":3,"file":"AvatarLayout.mjs","sources":["../../src/avatarLayout/AvatarLayout.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport AvatarView, { AvatarViewProps } from '../avatarView';\n\ntype SingleAvatarType = { asset?: AvatarViewProps['children'] } & Omit<\n AvatarViewProps,\n 'notification' | 'selected' | 'size' | 'badge' | 'children' | 'interactive'\n>;\n\nexport type Props = {\n avatars: SingleAvatarType[];\n orientation?: 'horizontal' | 'diagonal';\n} & Pick<\n AvatarViewProps,\n 'size' | 'interactive' | 'className' | 'role' | 'aria-label' | 'aria-labelledby' | 'aria-hidden'\n>;\n\nexport default function AvatarLayout({\n avatars = [],\n orientation: orientationProp = 'horizontal',\n size = 48,\n className,\n interactive,\n ...restProps\n}: Props) {\n const orientation =\n size === 16 && orientationProp === 'diagonal' ? 'horizontal' : orientationProp;\n const isDiagonal = orientation === 'diagonal';\n const avatarSize = isDiagonal ? DIAGONAL_LAYOUT_STYLE_CONFIG[size]?.avatarSize : size;\n return avatars.length < 1 ? null : avatars.length === 1 ? (\n <AvatarView {...avatars[0]}>{avatars[0].asset}</AvatarView>\n ) : (\n <div\n className={clsx('np-avatar-layout', `np-avatar-layout-${orientation}`, className)}\n style={{\n // @ts-expect-error CSS custom props allowed\n '--np-avatar-layout-size': `${size}px`,\n '--np-avatar-size': `${avatarSize}px`,\n '--np-avatar-offset': `${isDiagonal ? DIAGONAL_LAYOUT_STYLE_CONFIG[size].offset : HORIZONTAL_LAYOUT_OFFSET[size]}px`,\n }}\n {...restProps}\n >\n {avatars.map(({ asset, style, ...avatar }, index) => (\n <div\n // eslint-disable-next-line react/no-array-index-key\n key={index}\n className={clsx(\n { [`np-avatar-layout-${orientation}-child`]: index !== 0 },\n { [`np-avatar-layout-${orientation}-mask`]: index !== avatars.length - 1 },\n )}\n >\n <AvatarView\n {...avatar}\n size={avatarSize as Props['size']}\n style={{\n ...(isDiagonal && {\n '--circle-size': `${avatarSize}px`,\n '--circle-icon-size': `${DIAGONAL_LAYOUT_STYLE_CONFIG[size].iconSize}px`,\n '--circle-font-size': `${DIAGONAL_LAYOUT_STYLE_CONFIG[size].fontSize}px`,\n }),\n ...style,\n }}\n interactive={interactive}\n >\n {asset}\n </AvatarView>\n </div>\n ))}\n </div>\n );\n}\n\n/** Diagonal layout have custom sizes for avatar, font and icon */\nconst DIAGONAL_LAYOUT_STYLE_CONFIG = {\n // Diagonal layout doesn't support 16 size\n 16: { avatarSize: undefined, offset: undefined, fontSize: undefined, iconSize: undefined },\n 24: { avatarSize: 15, offset: 2.5, fontSize: 8, iconSize: 11.25 },\n 32: { avatarSize: 20, offset: 2.5, fontSize: 12, iconSize: 15 },\n 40: { avatarSize: 24, offset: 4.5, fontSize: 12, iconSize: 18 },\n 48: { avatarSize: 30, offset: 3.5, fontSize: 14, iconSize: 16.87 },\n 56: { avatarSize: 34, offset: 5, fontSize: 14, iconSize: 19.12 },\n 72: { avatarSize: 44, offset: 6, fontSize: 22, iconSize: 22 },\n};\n\n/** Horizontal layout have custom offset between avatars */\nconst HORIZONTAL_LAYOUT_OFFSET = {\n 16: 2,\n 24: 2,\n 32: 4,\n 40: 4,\n 48: 4,\n 56: 5,\n 72: 5,\n};\n"],"names":["AvatarLayout","avatars","orientation","orientationProp","size","className","interactive","restProps","isDiagonal","avatarSize","DIAGONAL_LAYOUT_STYLE_CONFIG","length","_jsx","AvatarView","children","asset","clsx","style","offset","HORIZONTAL_LAYOUT_OFFSET","map","avatar","index","iconSize","fontSize","undefined"],"mappings":";;;;AAgBc,SAAUA,YAAYA,CAAC;AACnCC,EAAAA,OAAO,GAAG,EAAE;EACZC,WAAW,EAAEC,eAAe,GAAG,YAAY;AAC3CC,EAAAA,IAAI,GAAG,EAAE;EACTC,SAAS;EACTC,WAAW;EACX,GAAGC,SAAAA;AACG,CAAA,EAAA;AACN,EAAA,MAAML,WAAW,GACfE,IAAI,KAAK,EAAE,IAAID,eAAe,KAAK,UAAU,GAAG,YAAY,GAAGA,eAAe,CAAA;AAChF,EAAA,MAAMK,UAAU,GAAGN,WAAW,KAAK,UAAU,CAAA;EAC7C,MAAMO,UAAU,GAAGD,UAAU,GAAGE,4BAA4B,CAACN,IAAI,CAAC,EAAEK,UAAU,GAAGL,IAAI,CAAA;AACrF,EAAA,OAAOH,OAAO,CAACU,MAAM,GAAG,CAAC,GAAG,IAAI,GAAGV,OAAO,CAACU,MAAM,KAAK,CAAC,gBACrDC,GAAA,CAACC,UAAU,EAAA;IAAA,GAAKZ,OAAO,CAAC,CAAC,CAAC;AAAAa,IAAAA,QAAA,EAAGb,OAAO,CAAC,CAAC,CAAC,CAACc,KAAAA;GAAkB,CAAC,gBAE3DH,GAAA,CAAA,KAAA,EAAA;IACEP,SAAS,EAAEW,IAAI,CAAC,kBAAkB,EAAE,oBAAo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AA,MAAM,EAAE,CAAC;AAAEM,IAAAA,QAAQ,EAAE,EAAE;AAAED,IAAAA,QAAQ,EAAE,EAAA;AAAI,GAAA;CAC9D,CAAA;AAED;AACA,MAAMJ,wBAAwB,GAAG;AAC/B,EAAA,EAAE,EAAE,CAAC;AACL,EAAA,EAAE,EAAE,CAAC;AACL,EAAA,EAAE,EAAE,CAAC;AACL,EAAA,EAAE,EAAE,CAAC;AACL,EAAA,EAAE,EAAE,CAAC;AACL,EAAA,EAAE,EAAE,CAAC;AACL,EAAA,EAAE,EAAE,CAAA;CACL;;;;"}
@@ -3,30 +3,30 @@
3
3
  var clsx = require('clsx');
4
4
  var React = require('react');
5
5
  var reactIntl = require('react-intl');
6
- require('../../common/theme.js');
7
- require('../../common/direction.js');
8
- var control = require('../../common/propsValues/control.js');
9
- require('../../common/propsValues/breakpoint.js');
10
- var size = require('../../common/propsValues/size.js');
11
- require('../../common/propsValues/typography.js');
12
- require('../../common/propsValues/width.js');
13
- require('../../common/propsValues/type.js');
14
- require('../../common/propsValues/dateMode.js');
15
- require('../../common/propsValues/monthFormat.js');
16
- require('../../common/propsValues/position.js');
17
- require('../../common/propsValues/layouts.js');
18
- require('../../common/propsValues/status.js');
19
- require('../../common/propsValues/sentiment.js');
20
- require('../../common/propsValues/profileType.js');
21
- require('../../common/propsValues/variant.js');
22
- require('../../common/propsValues/scroll.js');
23
- require('../../common/propsValues/markdownNodeType.js');
24
- require('../../common/fileType.js');
6
+ require('../common/theme.js');
7
+ require('../common/direction.js');
8
+ var control = require('../common/propsValues/control.js');
9
+ require('../common/propsValues/breakpoint.js');
10
+ var size = require('../common/propsValues/size.js');
11
+ require('../common/propsValues/typography.js');
12
+ require('../common/propsValues/width.js');
13
+ require('../common/propsValues/type.js');
14
+ require('../common/propsValues/dateMode.js');
15
+ require('../common/propsValues/monthFormat.js');
16
+ require('../common/propsValues/position.js');
17
+ require('../common/propsValues/layouts.js');
18
+ require('../common/propsValues/status.js');
19
+ require('../common/propsValues/sentiment.js');
20
+ require('../common/propsValues/profileType.js');
21
+ require('../common/propsValues/variant.js');
22
+ require('../common/propsValues/scroll.js');
23
+ require('../common/propsValues/markdownNodeType.js');
24
+ require('../common/fileType.js');
25
25
  require('@transferwise/icons');
26
- require('../../common/closeButton/CloseButton.messages.js');
26
+ require('../common/closeButton/CloseButton.messages.js');
27
27
  var jsxRuntime = require('react/jsx-runtime');
28
- var ProcessIndicator = require('../../processIndicator/ProcessIndicator.js');
29
- var Button_messages = require('../../i18n/commonMessages/Button.messages.js');
28
+ var ProcessIndicator = require('../processIndicator/ProcessIndicator.js');
29
+ var Button_messages = require('../i18n/commonMessages/Button.messages.js');
30
30
  var classMap = require('./classMap.js');
31
31
  var legacyUtils = require('./legacyUtils/legacyUtils.js');
32
32
 
@@ -42,7 +42,7 @@ const Button = /*#__PURE__*/React.forwardRef(({
42
42
  type = control.ControlType.ACCENT,
43
43
  onClick,
44
44
  ...rest
45
- }, ref) => {
45
+ }, reference) => {
46
46
  const intl = reactIntl.useIntl();
47
47
  legacyUtils.logDeprecationNotices({
48
48
  size: size$1,
@@ -95,7 +95,7 @@ const Button = /*#__PURE__*/React.forwardRef(({
95
95
  }
96
96
  };
97
97
  return /*#__PURE__*/jsxRuntime.jsxs(Element, {
98
- ref: ref,
98
+ ref: reference,
99
99
  className: classes,
100
100
  onClick: handleClick(onClick),
101
101
  ...props,
@@ -109,7 +109,6 @@ const Button = /*#__PURE__*/React.forwardRef(({
109
109
  })]
110
110
  });
111
111
  });
112
- Button.displayName = 'Button';
113
112
 
114
113
  module.exports = Button;
115
114
  //# sourceMappingURL=Button.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Button.js","sources":["../../src/button/Button.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { ElementType, forwardRef, MouseEvent } from 'react';\nimport { useIntl } from 'react-intl';\n\nimport {\n Size,\n ControlType,\n Priority,\n ControlTypeAccent,\n ControlTypeNegative,\n ControlTypePositive,\n PriorityPrimary,\n PrioritySecondary,\n PriorityTertiary,\n SizeExtraSmall,\n SizeSmall,\n SizeMedium,\n SizeLarge,\n} from '../common';\nimport ProcessIndicator from '../processIndicator';\n\nimport messages from '../i18n/commonMessages/Button.messages';\nimport { typeClassMap, priorityClassMap } from './classMap';\nimport { establishNewPriority, establishNewType, logDeprecationNotices } from './legacyUtils';\n\n/** @deprecated */\ntype DeprecatedTypes = 'primary' | 'pay' | 'secondary' | 'danger' | 'link';\n\n/** @deprecated */\ntype DeprecatedSizes = SizeExtraSmall;\n\ntype CommonProps = {\n block?: boolean;\n disabled?: boolean;\n loading?: boolean;\n type?: ControlTypeAccent | ControlTypeNegative | ControlTypePositive | DeprecatedTypes | null;\n priority?: PriorityPrimary | PrioritySecondary | PriorityTertiary | null;\n size?: SizeSmall | SizeMedium | SizeLarge | DeprecatedSizes;\n};\n\ntype ButtonProps = CommonProps &\n Omit<React.ComponentPropsWithRef<'button'>, 'type'> & {\n as?: 'button';\n htmlType?: 'submit' | 'reset' | 'button';\n };\n\ntype AnchorProps = CommonProps &\n Omit<React.ComponentPropsWithRef<'a'>, 'type'> & {\n as?: 'a';\n };\n\nexport type Props = ButtonProps | AnchorProps;\n\nexport type ButtonReferenceType = HTMLButtonElement | HTMLAnchorElement;\n\nconst Button = forwardRef<ButtonReferenceType, Props>(\n (\n {\n as: component,\n block = false,\n children,\n className,\n disabled,\n loading = false,\n priority = Priority.PRIMARY,\n size = Size.MEDIUM,\n type = ControlType.ACCENT,\n onClick,\n ...rest\n }: Props,\n reference,\n ) => {\n const intl = useIntl();\n\n logDeprecationNotices({ size, type });\n\n const newType = establishNewType(type);\n const newPriority = establishNewPriority(priority, type);\n\n const classes = clsx(\n `btn btn-${size}`,\n `np-btn np-btn-${size}`,\n {\n 'btn-loading': loading,\n 'btn-block np-btn-block': block,\n disabled,\n },\n // @ts-expect-error fix when refactor `typeClassMap` to TypeScript\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n typeClassMap[newType],\n // @ts-expect-error fix when refactor `typeClassMap` to TypeScript\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n priorityClassMap[newPriority],\n className,\n );\n\n function processIndicatorSize() {\n return ['sm', 'xs'].includes(size) ? 'xxs' : 'xs';\n }\n\n const Element = (component as ElementType) ?? 'button';\n let props;\n\n if (Element === 'button') {\n const { htmlType = 'button', ...restProps } = rest as ButtonProps;\n props = {\n ...restProps,\n disabled,\n 'aria-disabled': loading,\n type: htmlType,\n };\n } else {\n props = {\n ...rest,\n 'aria-disabled': loading,\n } as AnchorProps;\n }\n\n /**\n * Ensures that the button cannot be activated in loading or disabled mode,\n * when `aria-disabled` might be used over the `disabled` HTML attribute\n */\n const handleClick =\n (handler: Props['onClick']) =>\n (event: MouseEvent<HTMLButtonElement> & MouseEvent<HTMLAnchorElement>) => {\n if (disabled || loading) {\n event.preventDefault();\n } else if (typeof handler === 'function') {\n handler(event);\n }\n };\n\n return (\n <Element\n ref={reference}\n className={classes}\n onClick={handleClick(onClick)}\n {...props}\n aria-live={loading ? 'polite' : 'off'}\n aria-busy={loading}\n aria-label={loading ? intl.formatMessage(messages.loadingAriaLabel) : rest['aria-label']}\n >\n {children}\n {loading && (\n <ProcessIndicator\n size={processIndicatorSize()}\n className=\"btn-loader\"\n data-testid=\"ButtonProgressIndicator\"\n />\n )}\n </Element>\n );\n },\n);\n\nexport default Button;\n"],"names":["Button","forwardRef","as","component","block","children","className","disabled","loading","priority","Priority","PRIMARY","size","Size","MEDIUM","type","ControlType","ACCENT","onClick","rest","reference","intl","useIntl","logDeprecationNotices","newType","establishNewType","newPriority","establishNewPriority","classes","clsx","typeClassMap","priorityClassMap","processIndicatorSize","includes","Element","props","htmlType","restProps","handleClick","handler","event","preventDefault","_jsxs","ref","formatMessage","messages","loadingAriaLabel","_jsx","ProcessIndicator"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuDA,MAAMA,MAAM,gBAAGC,gBAAU,CACvB,CACE;AACEC,EAAAA,EAAE,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AAEd,CAAC;;;;"}
@@ -1,30 +1,30 @@
1
1
  import { clsx } from 'clsx';
2
2
  import { forwardRef } from 'react';
3
3
  import { useIntl } from 'react-intl';
4
- import '../../common/theme.mjs';
5
- import '../../common/direction.mjs';
6
- import { Priority, ControlType } from '../../common/propsValues/control.mjs';
7
- import '../../common/propsValues/breakpoint.mjs';
8
- import { Size } from '../../common/propsValues/size.mjs';
9
- import '../../common/propsValues/typography.mjs';
10
- import '../../common/propsValues/width.mjs';
11
- import '../../common/propsValues/type.mjs';
12
- import '../../common/propsValues/dateMode.mjs';
13
- import '../../common/propsValues/monthFormat.mjs';
14
- import '../../common/propsValues/position.mjs';
15
- import '../../common/propsValues/layouts.mjs';
16
- import '../../common/propsValues/status.mjs';
17
- import '../../common/propsValues/sentiment.mjs';
18
- import '../../common/propsValues/profileType.mjs';
19
- import '../../common/propsValues/variant.mjs';
20
- import '../../common/propsValues/scroll.mjs';
21
- import '../../common/propsValues/markdownNodeType.mjs';
22
- import '../../common/fileType.mjs';
4
+ import '../common/theme.mjs';
5
+ import '../common/direction.mjs';
6
+ import { Priority, ControlType } from '../common/propsValues/control.mjs';
7
+ import '../common/propsValues/breakpoint.mjs';
8
+ import { Size } from '../common/propsValues/size.mjs';
9
+ import '../common/propsValues/typography.mjs';
10
+ import '../common/propsValues/width.mjs';
11
+ import '../common/propsValues/type.mjs';
12
+ import '../common/propsValues/dateMode.mjs';
13
+ import '../common/propsValues/monthFormat.mjs';
14
+ import '../common/propsValues/position.mjs';
15
+ import '../common/propsValues/layouts.mjs';
16
+ import '../common/propsValues/status.mjs';
17
+ import '../common/propsValues/sentiment.mjs';
18
+ import '../common/propsValues/profileType.mjs';
19
+ import '../common/propsValues/variant.mjs';
20
+ import '../common/propsValues/scroll.mjs';
21
+ import '../common/propsValues/markdownNodeType.mjs';
22
+ import '../common/fileType.mjs';
23
23
  import '@transferwise/icons';
24
- import '../../common/closeButton/CloseButton.messages.mjs';
24
+ import '../common/closeButton/CloseButton.messages.mjs';
25
25
  import { jsxs, jsx } from 'react/jsx-runtime';
26
- import ProcessIndicator from '../../processIndicator/ProcessIndicator.mjs';
27
- import messages from '../../i18n/commonMessages/Button.messages.mjs';
26
+ import ProcessIndicator from '../processIndicator/ProcessIndicator.mjs';
27
+ import messages from '../i18n/commonMessages/Button.messages.mjs';
28
28
  import { typeClassMap, priorityClassMap } from './classMap.mjs';
29
29
  import { logDeprecationNotices, establishNewType, establishNewPriority } from './legacyUtils/legacyUtils.mjs';
30
30
 
@@ -40,7 +40,7 @@ const Button = /*#__PURE__*/forwardRef(({
40
40
  type = ControlType.ACCENT,
41
41
  onClick,
42
42
  ...rest
43
- }, ref) => {
43
+ }, reference) => {
44
44
  const intl = useIntl();
45
45
  logDeprecationNotices({
46
46
  size,
@@ -93,7 +93,7 @@ const Button = /*#__PURE__*/forwardRef(({
93
93
  }
94
94
  };
95
95
  return /*#__PURE__*/jsxs(Element, {
96
- ref: ref,
96
+ ref: reference,
97
97
  className: classes,
98
98
  onClick: handleClick(onClick),
99
99
  ...props,
@@ -107,7 +107,6 @@ const Button = /*#__PURE__*/forwardRef(({
107
107
  })]
108
108
  });
109
109
  });
110
- Button.displayName = 'Button';
111
110
 
112
111
  export { Button as default };
113
112
  //# sourceMappingURL=Button.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Button.mjs","sources":["../../src/button/Button.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { ElementType, forwardRef, MouseEvent } from 'react';\nimport { useIntl } from 'react-intl';\n\nimport {\n Size,\n ControlType,\n Priority,\n ControlTypeAccent,\n ControlTypeNegative,\n ControlTypePositive,\n PriorityPrimary,\n PrioritySecondary,\n PriorityTertiary,\n SizeExtraSmall,\n SizeSmall,\n SizeMedium,\n SizeLarge,\n} from '../common';\nimport ProcessIndicator from '../processIndicator';\n\nimport messages from '../i18n/commonMessages/Button.messages';\nimport { typeClassMap, priorityClassMap } from './classMap';\nimport { establishNewPriority, establishNewType, logDeprecationNotices } from './legacyUtils';\n\n/** @deprecated */\ntype DeprecatedTypes = 'primary' | 'pay' | 'secondary' | 'danger' | 'link';\n\n/** @deprecated */\ntype DeprecatedSizes = SizeExtraSmall;\n\ntype CommonProps = {\n block?: boolean;\n disabled?: boolean;\n loading?: boolean;\n type?: ControlTypeAccent | ControlTypeNegative | ControlTypePositive | DeprecatedTypes | null;\n priority?: PriorityPrimary | PrioritySecondary | PriorityTertiary | null;\n size?: SizeSmall | SizeMedium | SizeLarge | DeprecatedSizes;\n};\n\ntype ButtonProps = CommonProps &\n Omit<React.ComponentPropsWithRef<'button'>, 'type'> & {\n as?: 'button';\n htmlType?: 'submit' | 'reset' | 'button';\n };\n\ntype AnchorProps = CommonProps &\n Omit<React.ComponentPropsWithRef<'a'>, 'type'> & {\n as?: 'a';\n };\n\nexport type Props = ButtonProps | AnchorProps;\n\nexport type ButtonReferenceType = HTMLButtonElement | HTMLAnchorElement;\n\nconst Button = forwardRef<ButtonReferenceType, Props>(\n (\n {\n as: component,\n block = false,\n children,\n className,\n disabled,\n loading = false,\n priority = Priority.PRIMARY,\n size = Size.MEDIUM,\n type = ControlType.ACCENT,\n onClick,\n ...rest\n }: Props,\n reference,\n ) => {\n const intl = useIntl();\n\n logDeprecationNotices({ size, type });\n\n const newType = establishNewType(type);\n const newPriority = establishNewPriority(priority, type);\n\n const classes = clsx(\n `btn btn-${size}`,\n `np-btn np-btn-${size}`,\n {\n 'btn-loading': loading,\n 'btn-block np-btn-block': block,\n disabled,\n },\n // @ts-expect-error fix when refactor `typeClassMap` to TypeScript\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n typeClassMap[newType],\n // @ts-expect-error fix when refactor `typeClassMap` to TypeScript\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n priorityClassMap[newPriority],\n className,\n );\n\n function processIndicatorSize() {\n return ['sm', 'xs'].includes(size) ? 'xxs' : 'xs';\n }\n\n const Element = (component as ElementType) ?? 'button';\n let props;\n\n if (Element === 'button') {\n const { htmlType = 'button', ...restProps } = rest as ButtonProps;\n props = {\n ...restProps,\n disabled,\n 'aria-disabled': loading,\n type: htmlType,\n };\n } else {\n props = {\n ...rest,\n 'aria-disabled': loading,\n } as AnchorProps;\n }\n\n /**\n * Ensures that the button cannot be activated in loading or disabled mode,\n * when `aria-disabled` might be used over the `disabled` HTML attribute\n */\n const handleClick =\n (handler: Props['onClick']) =>\n (event: MouseEvent<HTMLButtonElement> & MouseEvent<HTMLAnchorElement>) => {\n if (disabled || loading) {\n event.preventDefault();\n } else if (typeof handler === 'function') {\n handler(event);\n }\n };\n\n return (\n <Element\n ref={reference}\n className={classes}\n onClick={handleClick(onClick)}\n {...props}\n aria-live={loading ? 'polite' : 'off'}\n aria-busy={loading}\n aria-label={loading ? intl.formatMessage(messages.loadingAriaLabel) : rest['aria-label']}\n >\n {children}\n {loading && (\n <ProcessIndicator\n size={processIndicatorSize()}\n className=\"btn-loader\"\n data-testid=\"ButtonProgressIndicator\"\n />\n )}\n </Element>\n );\n },\n);\n\nexport default Button;\n"],"names":["Button","forwardRef","as","component","block","children","className","disabled","loading","priority","Priority","PRIMARY","size","Size","MEDIUM","type","ControlType","ACCENT","onClick","rest","reference","intl","useIntl","logDeprecationNotices","newType","establishNewType","newPriority","establishNewPriority","classes","clsx","typeClassMap","priorityClassMap","processIndicatorSize","includes","Element","props","htmlType","restProps","handleClick","handler","event","preventDefault","_jsxs","ref","formatMessage","messages","loadingAriaLabel","_jsx","ProcessIndicator"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuDA,MAAMA,MAAM,gBAAGC,UAAU,CACvB,CACE;AACEC,EAAAA,EAAE,EAAEC,SAAS;AACbC,EAAAA,KAAK,GAAG,KAAK;EACbC,QAAQ;EACRC,SAAS;EACTC,QAAQ;AACRC,EAAAA,OAAO,GAAG,KAAK;EACfC,QAAQ,GAAGC,QAAQ,CAACC,OAAO;EAC3BC,IAAI,GAAGC,IAAI,CAACC,MAAM;EAClBC,IAAI,GAAG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AACH,GAAC,MAAM;AACLD,IAAAA,KAAK,GAAG;AACN,MAAA,GAAGhB,IAAI;AACP,MAAA,eAAe,EAAEX,OAAAA;KACH,CAAA;AAClB,GAAA;AAEA;;;AAGG;AACH,EAAA,MAAM8B,WAAW,GACdC,OAAyB,IACzBC,KAAoE,IAAI;IACvE,IAAIjC,QAAQ,IAAIC,OAAO,EAAE;MACvBgC,KAAK,CAACC,cAAc,EAAE,CAAA;AACxB,KAAC,MAAM,IAAI,OAAOF,OAAO,KAAK,UAAU,EAAE;MACxCA,OAAO,CAACC,KAAK,CAAC,CAAA;AAChB,KAAA;GACD,CAAA;EAEH,oBACEE,IAAA,CAACR,OAAO,EAAA;AACNS,IAAAA,GAAG,EAAEvB,SAAU;AACfd,IAAAA,SAAS,EAAEsB,OAAQ;AACnBV,IAAAA,OAAO,EAAEoB,WAAW,CAACpB,OAAO,CAAE;AAAA,IAAA,GAC1BiB,KAAK;AACT,IAAA,WAAA,EAAW3B,OAAO,GAAG,QAAQ,GAAG,KAAM;AACtC,IAAA,WAAA,EAAWA,OAAQ;AACnB,IAAA,YAAA,EAAYA,OAAO,GAAGa,IAAI,CAACuB,aAAa,CAACC,QAAQ,CAACC,gBAAgB,CAAC,GAAG3B,IAAI,CAAC,YAAY,CAAE;AAAAd,IAAAA,QAAA,GAExFA,QAAQ,EACRG,OAAO,iBACNuC,GAAA,CAACC,gBAAgB,EAAA;MACfpC,IAAI,EAAEoB,oBAAoB,EAAG;AAC7B1B,MAAAA,SAAS,EAAC,YAAY;MACtB,aAAY,EAAA,yBAAA;AAAyB,KACrC,CACH,CAAA;AAAA,GACM,CAAC,CAAA;AAEd,CAAC;;;;"}
@@ -0,0 +1,42 @@
1
+ 'use strict';
2
+
3
+ require('../common/theme.js');
4
+ require('../common/direction.js');
5
+ var control = require('../common/propsValues/control.js');
6
+ require('../common/propsValues/breakpoint.js');
7
+ require('../common/propsValues/size.js');
8
+ require('../common/propsValues/typography.js');
9
+ require('../common/propsValues/width.js');
10
+ require('../common/propsValues/type.js');
11
+ require('../common/propsValues/dateMode.js');
12
+ require('../common/propsValues/monthFormat.js');
13
+ require('../common/propsValues/position.js');
14
+ require('../common/propsValues/layouts.js');
15
+ require('../common/propsValues/status.js');
16
+ require('../common/propsValues/sentiment.js');
17
+ require('../common/propsValues/profileType.js');
18
+ require('../common/propsValues/variant.js');
19
+ require('../common/propsValues/scroll.js');
20
+ require('../common/propsValues/markdownNodeType.js');
21
+ require('../common/fileType.js');
22
+ require('@transferwise/icons');
23
+ require('clsx');
24
+ require('react');
25
+ require('react-intl');
26
+ require('../common/closeButton/CloseButton.messages.js');
27
+ require('react/jsx-runtime');
28
+
29
+ const typeClassMap = {
30
+ [control.ControlType.ACCENT]: 'btn-accent',
31
+ [control.ControlType.POSITIVE]: 'btn-positive',
32
+ [control.ControlType.NEGATIVE]: 'btn-negative'
33
+ };
34
+ const priorityClassMap = {
35
+ [control.Priority.PRIMARY]: 'btn-priority-1',
36
+ [control.Priority.SECONDARY]: 'btn-priority-2',
37
+ [control.Priority.TERTIARY]: 'btn-priority-3'
38
+ };
39
+
40
+ exports.priorityClassMap = priorityClassMap;
41
+ exports.typeClassMap = typeClassMap;
42
+ //# sourceMappingURL=classMap.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"classMap.js","sources":["../../src/button/classMap.ts"],"sourcesContent":["import { ControlType, Priority } from '../common';\n\nexport const typeClassMap = {\n [ControlType.ACCENT]: 'btn-accent',\n [ControlType.POSITIVE]: 'btn-positive',\n [ControlType.NEGATIVE]: 'btn-negative',\n};\n\nexport const priorityClassMap = {\n [Priority.PRIMARY]: 'btn-priority-1',\n [Priority.SECONDARY]: 'btn-priority-2',\n [Priority.TERTIARY]: 'btn-priority-3',\n};\n"],"names":["typeClassMap","ControlType","ACCENT","POSITIVE","NEGATIVE","priorityClassMap","Priority","PRIMARY","SECONDARY","TERTIARY"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEO,MAAMA,YAAY,GAAG;AAC1B,EAAA,CAACC,mBAAW,CAACC,MAAM,GAAG,YAAY;AAClC,EAAA,CAACD,mBAAW,CAACE,QAAQ,GAAG,cAAc;EACtC,CAACF,mBAAW,CAACG,QAAQ,GAAG,cAAA;EACzB;AAEM,MAAMC,gBAAgB,GAAG;AAC9B,EAAA,CAACC,gBAAQ,CAACC,OAAO,GAAG,gBAAgB;AACpC,EAAA,CAACD,gBAAQ,CAACE,SAAS,GAAG,gBAAgB;EACtC,CAACF,gBAAQ,CAACG,QAAQ,GAAG,gBAAA;;;;;;"}
@@ -0,0 +1,39 @@
1
+ import '../common/theme.mjs';
2
+ import '../common/direction.mjs';
3
+ import { ControlType, Priority } from '../common/propsValues/control.mjs';
4
+ import '../common/propsValues/breakpoint.mjs';
5
+ import '../common/propsValues/size.mjs';
6
+ import '../common/propsValues/typography.mjs';
7
+ import '../common/propsValues/width.mjs';
8
+ import '../common/propsValues/type.mjs';
9
+ import '../common/propsValues/dateMode.mjs';
10
+ import '../common/propsValues/monthFormat.mjs';
11
+ import '../common/propsValues/position.mjs';
12
+ import '../common/propsValues/layouts.mjs';
13
+ import '../common/propsValues/status.mjs';
14
+ import '../common/propsValues/sentiment.mjs';
15
+ import '../common/propsValues/profileType.mjs';
16
+ import '../common/propsValues/variant.mjs';
17
+ import '../common/propsValues/scroll.mjs';
18
+ import '../common/propsValues/markdownNodeType.mjs';
19
+ import '../common/fileType.mjs';
20
+ import '@transferwise/icons';
21
+ import 'clsx';
22
+ import 'react';
23
+ import 'react-intl';
24
+ import '../common/closeButton/CloseButton.messages.mjs';
25
+ import 'react/jsx-runtime';
26
+
27
+ const typeClassMap = {
28
+ [ControlType.ACCENT]: 'btn-accent',
29
+ [ControlType.POSITIVE]: 'btn-positive',
30
+ [ControlType.NEGATIVE]: 'btn-negative'
31
+ };
32
+ const priorityClassMap = {
33
+ [Priority.PRIMARY]: 'btn-priority-1',
34
+ [Priority.SECONDARY]: 'btn-priority-2',
35
+ [Priority.TERTIARY]: 'btn-priority-3'
36
+ };
37
+
38
+ export { priorityClassMap, typeClassMap };
39
+ //# sourceMappingURL=classMap.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"classMap.mjs","sources":["../../src/button/classMap.ts"],"sourcesContent":["import { ControlType, Priority } from '../common';\n\nexport const typeClassMap = {\n [ControlType.ACCENT]: 'btn-accent',\n [ControlType.POSITIVE]: 'btn-positive',\n [ControlType.NEGATIVE]: 'btn-negative',\n};\n\nexport const priorityClassMap = {\n [Priority.PRIMARY]: 'btn-priority-1',\n [Priority.SECONDARY]: 'btn-priority-2',\n [Priority.TERTIARY]: 'btn-priority-3',\n};\n"],"names":["typeClassMap","ControlType","ACCENT","POSITIVE","NEGATIVE","priorityClassMap","Priority","PRIMARY","SECONDARY","TERTIARY"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAEO,MAAMA,YAAY,GAAG;AAC1B,EAAA,CAACC,WAAW,CAACC,MAAM,GAAG,YAAY;AAClC,EAAA,CAACD,WAAW,CAACE,QAAQ,GAAG,cAAc;EACtC,CAACF,WAAW,CAACG,QAAQ,GAAG,cAAA;EACzB;AAEM,MAAMC,gBAAgB,GAAG;AAC9B,EAAA,CAACC,QAAQ,CAACC,OAAO,GAAG,gBAAgB;AACpC,EAAA,CAACD,QAAQ,CAACE,SAAS,GAAG,gBAAgB;EACtC,CAACF,QAAQ,CAACG,QAAQ,GAAG,gBAAA;;;;;"}
@@ -1,31 +1,31 @@
1
1
  'use strict';
2
2
 
3
- require('../../../common/theme.js');
4
- require('../../../common/direction.js');
5
- var control = require('../../../common/propsValues/control.js');
6
- require('../../../common/propsValues/breakpoint.js');
7
- var size = require('../../../common/propsValues/size.js');
8
- require('../../../common/propsValues/typography.js');
9
- require('../../../common/propsValues/width.js');
10
- var type = require('../../../common/propsValues/type.js');
11
- require('../../../common/propsValues/dateMode.js');
12
- require('../../../common/propsValues/monthFormat.js');
13
- require('../../../common/propsValues/position.js');
14
- require('../../../common/propsValues/layouts.js');
15
- require('../../../common/propsValues/status.js');
16
- require('../../../common/propsValues/sentiment.js');
17
- require('../../../common/propsValues/profileType.js');
18
- require('../../../common/propsValues/variant.js');
19
- require('../../../common/propsValues/scroll.js');
20
- require('../../../common/propsValues/markdownNodeType.js');
21
- require('../../../common/fileType.js');
3
+ require('../../common/theme.js');
4
+ require('../../common/direction.js');
5
+ var control = require('../../common/propsValues/control.js');
6
+ require('../../common/propsValues/breakpoint.js');
7
+ var size = require('../../common/propsValues/size.js');
8
+ require('../../common/propsValues/typography.js');
9
+ require('../../common/propsValues/width.js');
10
+ var type = require('../../common/propsValues/type.js');
11
+ require('../../common/propsValues/dateMode.js');
12
+ require('../../common/propsValues/monthFormat.js');
13
+ require('../../common/propsValues/position.js');
14
+ require('../../common/propsValues/layouts.js');
15
+ require('../../common/propsValues/status.js');
16
+ require('../../common/propsValues/sentiment.js');
17
+ require('../../common/propsValues/profileType.js');
18
+ require('../../common/propsValues/variant.js');
19
+ require('../../common/propsValues/scroll.js');
20
+ require('../../common/propsValues/markdownNodeType.js');
21
+ require('../../common/fileType.js');
22
22
  require('@transferwise/icons');
23
23
  require('clsx');
24
24
  require('react');
25
25
  require('react-intl');
26
- require('../../../common/closeButton/CloseButton.messages.js');
26
+ require('../../common/closeButton/CloseButton.messages.js');
27
27
  require('react/jsx-runtime');
28
- var logActionRequired = require('../../../utilities/logActionRequired.js');
28
+ var logActionRequired = require('../../utilities/logActionRequired.js');
29
29
 
30
30
  const deprecatedTypeMap = {
31
31
  [type.Type.PRIMARY]: control.ControlType.ACCENT,
@@ -0,0 +1 @@
1
+ {"version":3,"file":"legacyUtils.js","sources":["../../../src/button/legacyUtils/legacyUtils.ts"],"sourcesContent":["import { ControlType, Priority, Size, Type } from '../../common';\nimport { logActionRequired, logActionRequiredIf } from '../../utilities';\n\nconst deprecatedTypeMap: Record<Type, ControlType> = {\n [Type.PRIMARY]: ControlType.ACCENT,\n [Type.SECONDARY]: ControlType.ACCENT,\n [Type.LINK]: ControlType.ACCENT,\n [Type.PAY]: ControlType.POSITIVE,\n [Type.DANGER]: ControlType.NEGATIVE,\n};\n\ntype OldTypeKeys = Type.DANGER | Type.LINK | Type.SECONDARY;\nconst oldTypePriorityMap: Record<OldTypeKeys, Priority> = {\n [Type.DANGER]: Priority.SECONDARY,\n [Type.LINK]: Priority.TERTIARY,\n [Type.SECONDARY]: Priority.SECONDARY,\n};\n\nconst deprecatedTypeMapMessage = {\n [Type.DANGER]: 'Type.NEGATIVE',\n [Type.LINK]: 'ControlType.ACCENT with priority Priority.TERTIARY',\n [Type.PAY]: 'ControlType.POSITIVE',\n [Type.PRIMARY]: 'ControlType.ACCENT',\n [Type.SECONDARY]: 'ControlType.ACCENT with priority Priority.SECONDARY',\n};\n\nconst deprecatedTypes = Object.keys(deprecatedTypeMap);\n\ntype EstablishNewTypeType = (\n originalType: Type | (string & Record<never, never>) | null,\n) => `${ControlType}` | string | null;\n\nexport const establishNewType: EstablishNewTypeType = (originalType) =>\n originalType && originalType in deprecatedTypeMap\n ? deprecatedTypeMap[originalType as Type]\n : originalType;\n\ntype EstablishNewPriorityType = (\n originalPriority?: Priority | (string & Record<never, never>) | null,\n originalType?: OldTypeKeys | (string & Record<never, never>) | null,\n) => `${ControlType}` | string | null | undefined;\n\nexport const establishNewPriority: EstablishNewPriorityType = (originalPriority, originalType) => {\n const type = originalType ? establishNewType(originalType) : '';\n\n // The old SECONDARY and LINK types now map to priorities. If they're still using one of\n // these old types, ignore whatever priority they've passed and use this instead.\n if (originalType && originalType in oldTypePriorityMap) {\n return oldTypePriorityMap[originalType as OldTypeKeys];\n }\n // Only ControlType.ACCENT supports tertiary styles\n if (originalPriority === Priority.TERTIARY && type !== ControlType.ACCENT) {\n return Priority.SECONDARY;\n }\n return originalPriority;\n};\n\ntype DeprecatedTypeMapMessageType = keyof typeof deprecatedTypeMapMessage;\ntype LogDeprecationNoticesType = (params: {\n size?: `${Size}`;\n type?: DeprecatedTypeMapMessageType | (string & Record<never, never>) | null;\n}) => void;\nexport const logDeprecationNotices: LogDeprecationNoticesType = ({ size, type }) => {\n logActionRequiredIf(\n 'Button has deprecated the `Size.EXTRA_SMALL` value for the `size` prop. Please use Size.SMALL instead.',\n size === Size.EXTRA_SMALL,\n );\n\n if (type && deprecatedTypes.includes(type) && type in deprecatedTypeMapMessage) {\n logActionRequired(\n `Button has deprecated the ${type} value for the \\`type\\` prop. Please update to ${deprecatedTypeMapMessage[type as DeprecatedTypeMapMessageType]}.`,\n );\n }\n};\n"],"names":["deprecatedTypeMap","Type","PRIMARY","ControlType","ACCENT","SECONDARY","LINK","PAY","POSITIVE","DANGER","NEGATIVE","oldTypePriorityMap","Priority","TERTIARY","deprecatedTypeMapMessage","deprecatedTypes","Object","keys","establishNewType","originalType","establishNewPriority","originalPriority","type","logDeprecationNotices","size","logActionRequiredIf","Size","EXTRA_SMALL","includes","logActionRequired"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,MAAMA,iBAAiB,GAA8B;AACnD,EAAA,CAACC,SAAI,CAACC,OAAO,GAAGC,mBAAW,CAACC,MAAM;AAClC,EAAA,CAACH,SAAI,CAACI,SAAS,GAAGF,mBAAW,CAACC,MAAM;AACpC,EAAA,CAACH,SAAI,CAACK,IAAI,GAAGH,mBAAW,CAACC,MAAM;AAC/B,EAAA,CAACH,SAAI,CAACM,GAAG,GAAGJ,mBAAW,CAACK,QAAQ;AAChC,EAAA,CAACP,SAAI,CAACQ,MAAM,GAAGN,mBAAW,CAACO,QAAAA;CAC5B,CAAA;AAGD,MAAMC,kBAAkB,GAAkC;AACxD,EAAA,CAACV,SAAI,CAACQ,MAAM,GAAGG,gBAAQ,CAACP,SAAS;AACjC,EAAA,CAACJ,SAAI,CAACK,IAAI,GAAGM,gBAAQ,CAACC,QAAQ;AAC9B,EAAA,CAACZ,SAAI,CAACI,SAAS,GAAGO,gBAAQ,CAACP,SAAAA;CAC5B,CAAA;AAED,MAAMS,wBAAwB,GAAG;AAC/B,EAAA,CAACb,SAAI,CAAC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R,wBAAwB,CAACQ,IAAoC,CAAC,CAAA,CAAA,CAAG,CACrJ,CAAA;AACH,GAAA;AACF;;;;;;"}
@@ -1,29 +1,29 @@
1
- import '../../../common/theme.mjs';
2
- import '../../../common/direction.mjs';
3
- import { ControlType, Priority } from '../../../common/propsValues/control.mjs';
4
- import '../../../common/propsValues/breakpoint.mjs';
5
- import { Size } from '../../../common/propsValues/size.mjs';
6
- import '../../../common/propsValues/typography.mjs';
7
- import '../../../common/propsValues/width.mjs';
8
- import { Type } from '../../../common/propsValues/type.mjs';
9
- import '../../../common/propsValues/dateMode.mjs';
10
- import '../../../common/propsValues/monthFormat.mjs';
11
- import '../../../common/propsValues/position.mjs';
12
- import '../../../common/propsValues/layouts.mjs';
13
- import '../../../common/propsValues/status.mjs';
14
- import '../../../common/propsValues/sentiment.mjs';
15
- import '../../../common/propsValues/profileType.mjs';
16
- import '../../../common/propsValues/variant.mjs';
17
- import '../../../common/propsValues/scroll.mjs';
18
- import '../../../common/propsValues/markdownNodeType.mjs';
19
- import '../../../common/fileType.mjs';
1
+ import '../../common/theme.mjs';
2
+ import '../../common/direction.mjs';
3
+ import { ControlType, Priority } from '../../common/propsValues/control.mjs';
4
+ import '../../common/propsValues/breakpoint.mjs';
5
+ import { Size } from '../../common/propsValues/size.mjs';
6
+ import '../../common/propsValues/typography.mjs';
7
+ import '../../common/propsValues/width.mjs';
8
+ import { Type } from '../../common/propsValues/type.mjs';
9
+ import '../../common/propsValues/dateMode.mjs';
10
+ import '../../common/propsValues/monthFormat.mjs';
11
+ import '../../common/propsValues/position.mjs';
12
+ import '../../common/propsValues/layouts.mjs';
13
+ import '../../common/propsValues/status.mjs';
14
+ import '../../common/propsValues/sentiment.mjs';
15
+ import '../../common/propsValues/profileType.mjs';
16
+ import '../../common/propsValues/variant.mjs';
17
+ import '../../common/propsValues/scroll.mjs';
18
+ import '../../common/propsValues/markdownNodeType.mjs';
19
+ import '../../common/fileType.mjs';
20
20
  import '@transferwise/icons';
21
21
  import 'clsx';
22
22
  import 'react';
23
23
  import 'react-intl';
24
- import '../../../common/closeButton/CloseButton.messages.mjs';
24
+ import '../../common/closeButton/CloseButton.messages.mjs';
25
25
  import 'react/jsx-runtime';
26
- import { logActionRequiredIf, logActionRequired } from '../../../utilities/logActionRequired.mjs';
26
+ import { logActionRequiredIf, logActionRequired } from '../../utilities/logActionRequired.mjs';
27
27
 
28
28
  const deprecatedTypeMap = {
29
29
  [Type.PRIMARY]: ControlType.ACCENT,
@@ -0,0 +1 @@
1
+ {"version":3,"file":"legacyUtils.mjs","sources":["../../../src/button/legacyUtils/legacyUtils.ts"],"sourcesContent":["import { ControlType, Priority, Size, Type } from '../../common';\nimport { logActionRequired, logActionRequiredIf } from '../../utilities';\n\nconst deprecatedTypeMap: Record<Type, ControlType> = {\n [Type.PRIMARY]: ControlType.ACCENT,\n [Type.SECONDARY]: ControlType.ACCENT,\n [Type.LINK]: ControlType.ACCENT,\n [Type.PAY]: ControlType.POSITIVE,\n [Type.DANGER]: ControlType.NEGATIVE,\n};\n\ntype OldTypeKeys = Type.DANGER | Type.LINK | Type.SECONDARY;\nconst oldTypePriorityMap: Record<OldTypeKeys, Priority> = {\n [Type.DANGER]: Priority.SECONDARY,\n [Type.LINK]: Priority.TERTIARY,\n [Type.SECONDARY]: Priority.SECONDARY,\n};\n\nconst deprecatedTypeMapMessage = {\n [Type.DANGER]: 'Type.NEGATIVE',\n [Type.LINK]: 'ControlType.ACCENT with priority Priority.TERTIARY',\n [Type.PAY]: 'ControlType.POSITIVE',\n [Type.PRIMARY]: 'ControlType.ACCENT',\n [Type.SECONDARY]: 'ControlType.ACCENT with priority Priority.SECONDARY',\n};\n\nconst deprecatedTypes = Object.keys(deprecatedTypeMap);\n\ntype EstablishNewTypeType = (\n originalType: Type | (string & Record<never, never>) | null,\n) => `${ControlType}` | string | null;\n\nexport const establishNewType: EstablishNewTypeType = (originalType) =>\n originalType && originalType in deprecatedTypeMap\n ? deprecatedTypeMap[originalType as Type]\n : originalType;\n\ntype EstablishNewPriorityType = (\n originalPriority?: Priority | (string & Record<never, never>) | null,\n originalType?: OldTypeKeys | (string & Record<never, never>) | null,\n) => `${ControlType}` | string | null | undefined;\n\nexport const establishNewPriority: EstablishNewPriorityType = (originalPriority, originalType) => {\n const type = originalType ? establishNewType(originalType) : '';\n\n // The old SECONDARY and LINK types now map to priorities. If they're still using one of\n // these old types, ignore whatever priority they've passed and use this instead.\n if (originalType && originalType in oldTypePriorityMap) {\n return oldTypePriorityMap[originalType as OldTypeKeys];\n }\n // Only ControlType.ACCENT supports tertiary styles\n if (originalPriority === Priority.TERTIARY && type !== ControlType.ACCENT) {\n return Priority.SECONDARY;\n }\n return originalPriority;\n};\n\ntype DeprecatedTypeMapMessageType = keyof typeof deprecatedTypeMapMessage;\ntype LogDeprecationNoticesType = (params: {\n size?: `${Size}`;\n type?: DeprecatedTypeMapMessageType | (string & Record<never, never>) | null;\n}) => void;\nexport const logDeprecationNotices: LogDeprecationNoticesType = ({ size, type }) => {\n logActionRequiredIf(\n 'Button has deprecated the `Size.EXTRA_SMALL` value for the `size` prop. Please use Size.SMALL instead.',\n size === Size.EXTRA_SMALL,\n );\n\n if (type && deprecatedTypes.includes(type) && type in deprecatedTypeMapMessage) {\n logActionRequired(\n `Button has deprecated the ${type} value for the \\`type\\` prop. Please update to ${deprecatedTypeMapMessage[type as DeprecatedTypeMapMessageType]}.`,\n );\n }\n};\n"],"names":["deprecatedTypeMap","Type","PRIMARY","ControlType","ACCENT","SECONDARY","LINK","PAY","POSITIVE","DANGER","NEGATIVE","oldTypePriorityMap","Priority","TERTIARY","deprecatedTypeMapMessage","deprecatedTypes","Object","keys","establishNewType","originalType","establishNewPriority","originalPriority","type","logDeprecationNotices","size","logActionRequiredIf","Size","EXTRA_SMALL","includes","logActionRequired"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,MAAMA,iBAAiB,GAA8B;AACnD,EAAA,CAACC,IAAI,CAACC,OAAO,GAAGC,WAAW,C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ACQ,YAA2B,CAAC,CAAA;AACxD,GAAA;AACA;EACA,IAAIE,gBAAgB,KAAKT,QAAQ,CAACC,QAAQ,IAAIS,IAAI,KAAKnB,WAAW,CAACC,MAAM,EAAE;IACzE,OAAOQ,QAAQ,CAACP,SAAS,CAAA;AAC3B,GAAA;AACA,EAAA,OAAOgB,gBAAgB,CAAA;AACzB,EAAC;AAOM,MAAME,qBAAqB,GAA8BA,CAAC;EAAEC,IAAI;AAAEF,EAAAA,IAAAA;AAAM,CAAA,KAAI;EACjFG,mBAAmB,CACjB,wGAAwG,EACxGD,IAAI,KAAKE,IAAI,CAACC,WAAW,CAC1B,CAAA;AAED,EAAA,IAAIL,IAAI,IAAIP,eAAe,CAACa,QAAQ,CAACN,IAAI,CAAC,IAAIA,IAAI,IAAIR,wBAAwB,EAAE;IAC9Ee,iBAAiB,CACf,6BAA6BP,IAAI,CAAA,+CAAA,EAAkDR,wBAAwB,CAACQ,IAAoC,CAAC,CAAA,CAAA,CAAG,CACrJ,CAAA;AACH,GAAA;AACF;;;;"}
@@ -3,7 +3,7 @@
3
3
  var clsx = require('clsx');
4
4
  var React = require('react');
5
5
  var Body = require('../body/Body.js');
6
- var classMap = require('../button/LegacyButton/classMap.js');
6
+ var classMap = require('../button/classMap.js');
7
7
  require('../common/theme.js');
8
8
  require('../common/direction.js');
9
9
  var control = require('../common/propsValues/control.js');