@transferwise/components 46.97.0 → 46.97.2

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 (87) hide show
  1. package/build/alert/Alert.js.map +1 -1
  2. package/build/alert/Alert.mjs.map +1 -1
  3. package/build/avatarWrapper/AvatarWrapper.js.map +1 -1
  4. package/build/avatarWrapper/AvatarWrapper.mjs.map +1 -1
  5. package/build/common/propsValues/sentiment.js +1 -0
  6. package/build/common/propsValues/sentiment.js.map +1 -1
  7. package/build/common/propsValues/sentiment.mjs +1 -0
  8. package/build/common/propsValues/sentiment.mjs.map +1 -1
  9. package/build/flowNavigation/animatedLabel/AnimatedLabel.js +1 -1
  10. package/build/flowNavigation/animatedLabel/AnimatedLabel.js.map +1 -1
  11. package/build/flowNavigation/animatedLabel/AnimatedLabel.mjs +1 -1
  12. package/build/flowNavigation/animatedLabel/AnimatedLabel.mjs.map +1 -1
  13. package/build/index.js +4 -3
  14. package/build/index.js.map +1 -1
  15. package/build/index.mjs +2 -2
  16. package/build/{listItem/ListItem.js → legacylistItem/LegacyListItem.js} +3 -3
  17. package/build/legacylistItem/LegacyListItem.js.map +1 -0
  18. package/build/{listItem/ListItem.mjs → legacylistItem/LegacyListItem.mjs} +3 -3
  19. package/build/legacylistItem/LegacyListItem.mjs.map +1 -0
  20. package/build/legacylistItem/List.js.map +1 -0
  21. package/build/legacylistItem/List.mjs.map +1 -0
  22. package/build/main.css +60 -4
  23. package/build/statusIcon/StatusIcon.js +2 -2
  24. package/build/statusIcon/StatusIcon.js.map +1 -1
  25. package/build/statusIcon/StatusIcon.mjs +2 -2
  26. package/build/statusIcon/StatusIcon.mjs.map +1 -1
  27. package/build/styles/inputs/Input.css +28 -2
  28. package/build/styles/inputs/TextArea.css +28 -2
  29. package/build/styles/main.css +60 -4
  30. package/build/styles/popover/Popover.css +28 -2
  31. package/build/title/Title.js.map +1 -1
  32. package/build/title/Title.mjs.map +1 -1
  33. package/build/types/alert/Alert.d.ts +2 -2
  34. package/build/types/alert/Alert.d.ts.map +1 -1
  35. package/build/types/avatarWrapper/AvatarWrapper.d.ts +2 -2
  36. package/build/types/avatarWrapper/AvatarWrapper.d.ts.map +1 -1
  37. package/build/types/common/propsValues/sentiment.d.ts.map +1 -1
  38. package/build/types/index.d.ts +2 -2
  39. package/build/types/index.d.ts.map +1 -1
  40. package/build/types/{listItem/ListItem.d.ts → legacylistItem/LegacyListItem.d.ts} +4 -4
  41. package/build/types/legacylistItem/LegacyListItem.d.ts.map +1 -0
  42. package/build/types/legacylistItem/List.d.ts.map +1 -0
  43. package/build/types/legacylistItem/index.d.ts +5 -0
  44. package/build/types/legacylistItem/index.d.ts.map +1 -0
  45. package/build/types/statusIcon/StatusIcon.d.ts +3 -2
  46. package/build/types/statusIcon/StatusIcon.d.ts.map +1 -1
  47. package/build/types/title/Title.d.ts.map +1 -1
  48. package/package.json +3 -3
  49. package/src/alert/Alert.story.tsx +5 -3
  50. package/src/alert/Alert.tsx +11 -2
  51. package/src/avatarWrapper/AvatarWrapper.story.tsx +2 -2
  52. package/src/avatarWrapper/AvatarWrapper.tsx +3 -2
  53. package/src/common/propsValues/sentiment.ts +1 -0
  54. package/src/flowNavigation/animatedLabel/AnimatedLabel.tsx +1 -1
  55. package/src/index.ts +2 -2
  56. package/src/inputs/Input.css +28 -2
  57. package/src/inputs/TextArea.css +28 -2
  58. package/src/{listItem/ListItem.tests.story.tsx → legacylistItem/LegacyListItem.tests.story.tsx} +2 -2
  59. package/src/{listItem/ListItem.tsx → legacylistItem/LegacyListItem.tsx} +3 -3
  60. package/src/legacylistItem/index.ts +4 -0
  61. package/src/main.css +60 -4
  62. package/src/main.less +1 -1
  63. package/src/popover/Popover.css +28 -2
  64. package/src/statusIcon/StatusIcon.docs.mdx +1 -1
  65. package/src/statusIcon/StatusIcon.spec.tsx +10 -4
  66. package/src/statusIcon/StatusIcon.story.tsx +10 -5
  67. package/src/statusIcon/StatusIcon.tsx +6 -4
  68. package/src/title/Title.test.story.tsx +19 -12
  69. package/src/title/Title.tsx +1 -0
  70. package/build/listItem/List.js.map +0 -1
  71. package/build/listItem/List.mjs.map +0 -1
  72. package/build/listItem/ListItem.js.map +0 -1
  73. package/build/listItem/ListItem.mjs.map +0 -1
  74. package/build/types/listItem/List.d.ts.map +0 -1
  75. package/build/types/listItem/ListItem.d.ts.map +0 -1
  76. package/build/types/listItem/index.d.ts +0 -5
  77. package/build/types/listItem/index.d.ts.map +0 -1
  78. package/src/listItem/index.ts +0 -4
  79. /package/build/{listItem → legacylistItem}/List.js +0 -0
  80. /package/build/{listItem → legacylistItem}/List.mjs +0 -0
  81. /package/build/styles/{listItem/ListItem.css → legacylistItem/LegacyListItem.css} +0 -0
  82. /package/build/types/{listItem → legacylistItem}/List.d.ts +0 -0
  83. /package/src/{listItem/ListItem.css → legacylistItem/LegacyListItem.css} +0 -0
  84. /package/src/{listItem/ListItem.less → legacylistItem/LegacyListItem.less} +0 -0
  85. /package/src/{listItem/ListItem.spec.tsx → legacylistItem/LegacyListItem.spec.tsx} +0 -0
  86. /package/src/{listItem/ListItem.story.tsx → legacylistItem/LegacyListItem.story.tsx} +0 -0
  87. /package/src/{listItem → legacylistItem}/List.tsx +0 -0
@@ -1,6 +1,6 @@
1
1
  import { Meta, StoryObj } from '@storybook/react';
2
2
 
3
- import { ProfileType, Sentiment } from '../common';
3
+ import { ProfileType, Sentiment, Status } from '../common';
4
4
 
5
5
  import AvatarWrapper from './AvatarWrapper';
6
6
 
@@ -96,7 +96,7 @@ export const All: Story = {
96
96
  </div>
97
97
  Default
98
98
  <div>
99
- <AvatarWrapper badgeStatusIcon={Sentiment.PENDING} avatarProps={avatarProps} />
99
+ <AvatarWrapper badgeStatusIcon={Status.PENDING} avatarProps={avatarProps} />
100
100
  </div>
101
101
  </div>
102
102
  </div>
@@ -10,6 +10,7 @@ import {
10
10
  Size,
11
11
  Sentiment,
12
12
  getInitials,
13
+ Status,
13
14
  } from '../common';
14
15
  import StatusIcon from '../statusIcon/StatusIcon';
15
16
 
@@ -17,7 +18,7 @@ interface OptionalBadgeProps extends Omit<BadgeProps, 'badge'> {
17
18
  url?: string;
18
19
  ariaLabel?: string;
19
20
  altText?: string;
20
- statusIcon?: Sentiment;
21
+ statusIcon?: Sentiment | Status.PENDING;
21
22
  }
22
23
 
23
24
  const OptionalBadge = ({
@@ -66,7 +67,7 @@ export type AvatarWrapperProps = {
66
67
  | {
67
68
  badgeUrl?: never;
68
69
  badgeAltText?: never;
69
- badgeStatusIcon: Sentiment;
70
+ badgeStatusIcon: Sentiment | Status.PENDING;
70
71
  }
71
72
  | {
72
73
  badgeUrl?: never;
@@ -3,6 +3,7 @@ export enum Sentiment {
3
3
  NEUTRAL = 'neutral',
4
4
  POSITIVE = 'positive',
5
5
  WARNING = 'warning',
6
+ // remove when all instances of Sentiment.PENDING have been updated to Status.PENDING
6
7
  PENDING = 'pending',
7
8
 
8
9
  /**
@@ -6,7 +6,7 @@ import BottomSheet from '../../common/bottomSheet';
6
6
  import Option from '../../common/Option';
7
7
  import { Check, ChevronDown } from '@transferwise/icons';
8
8
  import { OverlayIdContext, OverlayIdProvider } from '../../provider/overlay/OverlayIdProvider';
9
- import { List } from '../../listItem';
9
+ import { List } from '../../legacylistItem';
10
10
 
11
11
  export interface AnimatedLabelProps {
12
12
  activeLabel: number;
package/src/index.ts CHANGED
@@ -51,7 +51,7 @@ export type {
51
51
  export type { TextAreaProps } from './inputs/TextArea';
52
52
  export type { InstructionsListProps } from './instructionsList';
53
53
  export type { LabelProps, LabelOptionalProps, LabelDescriptionProps } from './label/Label';
54
- export type { ListProps, ListItemProps } from './listItem';
54
+ export type { ListProps, LegacyListItemProps } from './legacylistItem';
55
55
  export type { LoaderProps } from './loader';
56
56
  export type { MarkdownProps } from './markdown';
57
57
  export type { ModalProps } from './modal';
@@ -167,7 +167,7 @@ export { TextArea } from './inputs/TextArea';
167
167
  export { default as InstructionsList } from './instructionsList';
168
168
  export { Label } from './label/Label';
169
169
  export { default as Link } from './link';
170
- export { List, default as ListItem } from './listItem';
170
+ export { List, default as ListItem, default as LegacyListItem } from './legacylistItem';
171
171
  export { default as Loader } from './loader';
172
172
  export { default as Logo } from './logo';
173
173
  export { default as Markdown } from './markdown';
@@ -71,8 +71,6 @@
71
71
  line-height: 1.2;
72
72
  line-height: var(--line-height-title);
73
73
  letter-spacing: 0;
74
- -webkit-hyphens: auto;
75
- hyphens: auto;
76
74
  margin-bottom: 0;
77
75
  margin-bottom: initial;
78
76
  font-size: 1.375rem;
@@ -83,6 +81,34 @@
83
81
  line-height: 125%;
84
82
  height: 72px !important;
85
83
  height: var(--size-72) !important;
84
+ }@supports (hyphenate-limit-chars: 1) {
85
+ .np-form-control--size-lg {
86
+ -webkit-hyphens: auto;
87
+ hyphens: auto;
88
+ hyphenate-limit-chars: 7 3;
89
+ }
90
+ @media (min-width: 768px) {
91
+ .np-form-control--size-lg {
92
+ hyphenate-limit-chars: 8 3;
93
+ }
94
+ }
95
+ @media (min-width: 992px) {
96
+ .np-form-control--size-lg {
97
+ hyphenate-limit-chars: 10 4 3;
98
+ }
99
+ }
100
+ }@supports (not (hyphenate-limit-chars: 1)) and (-webkit-hyphenate-limit-before: 1) {
101
+ .np-form-control--size-lg {
102
+ -webkit-hyphens: auto;
103
+ hyphens: auto;
104
+ -webkit-hyphenate-limit-before: 3;
105
+ -webkit-hyphenate-limit-after: 3;
106
+ }
107
+ @media (min-width: 992px) {
108
+ .np-form-control--size-lg {
109
+ -webkit-hyphenate-limit-before: 4;
110
+ }
111
+ }
86
112
  }.np-form-control--size-lg + p,
87
113
  .np-form-control--size-lg + ul:not(.list-unstyled),
88
114
  .np-form-control--size-lg + ol:not(.list-unstyled) {
@@ -71,8 +71,6 @@
71
71
  line-height: 1.2;
72
72
  line-height: var(--line-height-title);
73
73
  letter-spacing: 0;
74
- -webkit-hyphens: auto;
75
- hyphens: auto;
76
74
  margin-bottom: 0;
77
75
  margin-bottom: initial;
78
76
  font-size: 1.375rem;
@@ -83,6 +81,34 @@
83
81
  line-height: 125%;
84
82
  height: 72px !important;
85
83
  height: var(--size-72) !important;
84
+ }@supports (hyphenate-limit-chars: 1) {
85
+ .np-form-control--size-lg {
86
+ -webkit-hyphens: auto;
87
+ hyphens: auto;
88
+ hyphenate-limit-chars: 7 3;
89
+ }
90
+ @media (min-width: 768px) {
91
+ .np-form-control--size-lg {
92
+ hyphenate-limit-chars: 8 3;
93
+ }
94
+ }
95
+ @media (min-width: 992px) {
96
+ .np-form-control--size-lg {
97
+ hyphenate-limit-chars: 10 4 3;
98
+ }
99
+ }
100
+ }@supports (not (hyphenate-limit-chars: 1)) and (-webkit-hyphenate-limit-before: 1) {
101
+ .np-form-control--size-lg {
102
+ -webkit-hyphens: auto;
103
+ hyphens: auto;
104
+ -webkit-hyphenate-limit-before: 3;
105
+ -webkit-hyphenate-limit-after: 3;
106
+ }
107
+ @media (min-width: 992px) {
108
+ .np-form-control--size-lg {
109
+ -webkit-hyphenate-limit-before: 4;
110
+ }
111
+ }
86
112
  }.np-form-control--size-lg + p,
87
113
  .np-form-control--size-lg + ul:not(.list-unstyled),
88
114
  .np-form-control--size-lg + ol:not(.list-unstyled) {
@@ -1,7 +1,7 @@
1
1
  import { FastFlag } from '@transferwise/icons';
2
2
  import Button from '../button';
3
3
  import AvatarView from '../avatarView';
4
- import ListItem, { List, type ListItemProps } from '.';
4
+ import ListItem, { List, type LegacyListItemProps } from '.';
5
5
 
6
6
  export default {
7
7
  component: ListItem,
@@ -9,7 +9,7 @@ export default {
9
9
  };
10
10
 
11
11
  export const LongText = () => {
12
- const sharedProps: Partial<ListItemProps> = {
12
+ const sharedProps: Partial<LegacyListItemProps> = {
13
13
  media: <AvatarView profileName="Super Pepa" badge={{ icon: <FastFlag /> }} />,
14
14
  action: (
15
15
  <Button v2 size="sm" onClick={() => {}}>
@@ -3,7 +3,7 @@ import { ElementType, FC, ReactNode } from 'react';
3
3
 
4
4
  import Body from '../body/Body';
5
5
 
6
- export type ListItemProps = {
6
+ export type LegacyListItemProps = {
7
7
  title: ReactNode;
8
8
  value: ReactNode;
9
9
  media?: ReactNode;
@@ -13,7 +13,7 @@ export type ListItemProps = {
13
13
  as?: ElementType;
14
14
  };
15
15
 
16
- const ListItem: FC<ListItemProps> = ({
16
+ const LegacyListItem: FC<LegacyListItemProps> = ({
17
17
  media,
18
18
  action,
19
19
  className,
@@ -50,4 +50,4 @@ const ListItem: FC<ListItemProps> = ({
50
50
  );
51
51
  };
52
52
 
53
- export default ListItem;
53
+ export default LegacyListItem;
@@ -0,0 +1,4 @@
1
+ export { List } from './List';
2
+ export type { ListProps } from './List';
3
+ export { default } from './LegacyListItem';
4
+ export type { LegacyListItemProps } from './LegacyListItem';
package/src/main.css CHANGED
@@ -2585,8 +2585,6 @@ html:not([dir="rtl"]) .np-flow-navigation--sm .np-flow-navigation__stepper {
2585
2585
  line-height: 1.2;
2586
2586
  line-height: var(--line-height-title);
2587
2587
  letter-spacing: 0;
2588
- -webkit-hyphens: auto;
2589
- hyphens: auto;
2590
2588
  margin-bottom: 0;
2591
2589
  margin-bottom: initial;
2592
2590
  font-size: 1.375rem;
@@ -2598,6 +2596,36 @@ html:not([dir="rtl"]) .np-flow-navigation--sm .np-flow-navigation__stepper {
2598
2596
  height: 72px !important;
2599
2597
  height: var(--size-72) !important;
2600
2598
  }
2599
+ @supports (hyphenate-limit-chars: 1) {
2600
+ .np-form-control--size-lg {
2601
+ -webkit-hyphens: auto;
2602
+ hyphens: auto;
2603
+ hyphenate-limit-chars: 7 3;
2604
+ }
2605
+ @media (min-width: 768px) {
2606
+ .np-form-control--size-lg {
2607
+ hyphenate-limit-chars: 8 3;
2608
+ }
2609
+ }
2610
+ @media (min-width: 992px) {
2611
+ .np-form-control--size-lg {
2612
+ hyphenate-limit-chars: 10 4 3;
2613
+ }
2614
+ }
2615
+ }
2616
+ @supports (not (hyphenate-limit-chars: 1)) and (-webkit-hyphenate-limit-before: 1) {
2617
+ .np-form-control--size-lg {
2618
+ -webkit-hyphens: auto;
2619
+ hyphens: auto;
2620
+ -webkit-hyphenate-limit-before: 3;
2621
+ -webkit-hyphenate-limit-after: 3;
2622
+ }
2623
+ @media (min-width: 992px) {
2624
+ .np-form-control--size-lg {
2625
+ -webkit-hyphenate-limit-before: 4;
2626
+ }
2627
+ }
2628
+ }
2601
2629
  .np-form-control--size-lg + p,
2602
2630
  .np-form-control--size-lg + ul:not(.list-unstyled),
2603
2631
  .np-form-control--size-lg + ol:not(.list-unstyled) {
@@ -4023,8 +4051,6 @@ html:not([dir="rtl"]) .np-navigation-option {
4023
4051
  line-height: 1.2;
4024
4052
  line-height: var(--line-height-title);
4025
4053
  letter-spacing: 0;
4026
- -webkit-hyphens: auto;
4027
- hyphens: auto;
4028
4054
  margin-bottom: 0;
4029
4055
  margin-bottom: initial;
4030
4056
  font-weight: 600;
@@ -4034,6 +4060,36 @@ html:not([dir="rtl"]) .np-navigation-option {
4034
4060
  letter-spacing: -0.02em;
4035
4061
  line-height: 122%;
4036
4062
  }
4063
+ @supports (hyphenate-limit-chars: 1) {
4064
+ .np-popover__container.np-bottom-sheet .np-popover__title {
4065
+ -webkit-hyphens: auto;
4066
+ hyphens: auto;
4067
+ hyphenate-limit-chars: 7 3;
4068
+ }
4069
+ @media (min-width: 768px) {
4070
+ .np-popover__container.np-bottom-sheet .np-popover__title {
4071
+ hyphenate-limit-chars: 8 3;
4072
+ }
4073
+ }
4074
+ @media (min-width: 992px) {
4075
+ .np-popover__container.np-bottom-sheet .np-popover__title {
4076
+ hyphenate-limit-chars: 10 4 3;
4077
+ }
4078
+ }
4079
+ }
4080
+ @supports (not (hyphenate-limit-chars: 1)) and (-webkit-hyphenate-limit-before: 1) {
4081
+ .np-popover__container.np-bottom-sheet .np-popover__title {
4082
+ -webkit-hyphens: auto;
4083
+ hyphens: auto;
4084
+ -webkit-hyphenate-limit-before: 3;
4085
+ -webkit-hyphenate-limit-after: 3;
4086
+ }
4087
+ @media (min-width: 992px) {
4088
+ .np-popover__container.np-bottom-sheet .np-popover__title {
4089
+ -webkit-hyphenate-limit-before: 4;
4090
+ }
4091
+ }
4092
+ }
4037
4093
  .np-popover__container.np-bottom-sheet .np-popover__title + p,
4038
4094
  .np-popover__container.np-bottom-sheet .np-popover__title + ul:not(.list-unstyled),
4039
4095
  .np-popover__container.np-bottom-sheet .np-popover__title + ol:not(.list-unstyled) {
package/src/main.less CHANGED
@@ -77,7 +77,7 @@
77
77
  @import "./uploadInput/uploadItem/UploadItem.less";
78
78
  @import "./progress/Progress.less";
79
79
  @import "./progressBar/ProgressBar.less";
80
- @import "./listItem/ListItem.less";
80
+ @import "./legacylistItem/LegacyListItem.less";
81
81
 
82
82
  // List all less files in src in alphabetical order: find -s src -type f -name '*.less' ! -name 'main.less'
83
83
  // Make sure you are not referencing main.less itself in this file!
@@ -24,8 +24,6 @@
24
24
  line-height: 1.2;
25
25
  line-height: var(--line-height-title);
26
26
  letter-spacing: 0;
27
- -webkit-hyphens: auto;
28
- hyphens: auto;
29
27
  margin-bottom: 0;
30
28
  margin-bottom: initial;
31
29
  font-weight: 600;
@@ -34,6 +32,34 @@
34
32
  font-size: var(--font-size-26);
35
33
  letter-spacing: -0.02em;
36
34
  line-height: 122%;
35
+ }@supports (hyphenate-limit-chars: 1) {
36
+ .np-popover__container.np-bottom-sheet .np-popover__title {
37
+ -webkit-hyphens: auto;
38
+ hyphens: auto;
39
+ hyphenate-limit-chars: 7 3;
40
+ }
41
+ @media (min-width: 768px) {
42
+ .np-popover__container.np-bottom-sheet .np-popover__title {
43
+ hyphenate-limit-chars: 8 3;
44
+ }
45
+ }
46
+ @media (min-width: 992px) {
47
+ .np-popover__container.np-bottom-sheet .np-popover__title {
48
+ hyphenate-limit-chars: 10 4 3;
49
+ }
50
+ }
51
+ }@supports (not (hyphenate-limit-chars: 1)) and (-webkit-hyphenate-limit-before: 1) {
52
+ .np-popover__container.np-bottom-sheet .np-popover__title {
53
+ -webkit-hyphens: auto;
54
+ hyphens: auto;
55
+ -webkit-hyphenate-limit-before: 3;
56
+ -webkit-hyphenate-limit-after: 3;
57
+ }
58
+ @media (min-width: 992px) {
59
+ .np-popover__container.np-bottom-sheet .np-popover__title {
60
+ -webkit-hyphenate-limit-before: 4;
61
+ }
62
+ }
37
63
  }.np-popover__container.np-bottom-sheet .np-popover__title + p,
38
64
  .np-popover__container.np-bottom-sheet .np-popover__title + ul:not(.list-unstyled),
39
65
  .np-popover__container.np-bottom-sheet .np-popover__title + ol:not(.list-unstyled) {
@@ -10,7 +10,7 @@ By default, the component offers accessible names for all the icons, to ensure t
10
10
  Sentiment.NEGATIVE -> 'Error:'
11
11
  Sentiment.POSITIVE -> 'Success:'
12
12
  Sentiment.WARNING -> 'Warning:'
13
- Sentiment.PENDING -> 'Pending:'
13
+ Status.PENDING -> 'Pending:'
14
14
  Sentiment.NEUTRAL -> 'Information:'
15
15
 
16
16
  // deprecated
@@ -1,7 +1,8 @@
1
- import { Sentiment, Size } from '../common';
1
+ import { Sentiment, Size, Status } from '../common';
2
2
  import { render, cleanup, screen, mockMatchMedia } from '../test-utils';
3
3
 
4
4
  import StatusIcon, { type StatusIconProps } from '.';
5
+ import { StatusIconSentiment } from './StatusIcon';
5
6
 
6
7
  mockMatchMedia();
7
8
 
@@ -29,12 +30,13 @@ describe('StatusIcon', () => {
29
30
  [Sentiment.NEGATIVE, Sentiment.NEGATIVE],
30
31
  [Sentiment.NEUTRAL, Sentiment.NEUTRAL],
31
32
  [Sentiment.PENDING, Sentiment.PENDING],
33
+ [Status.PENDING, Status.PENDING],
32
34
  [Sentiment.POSITIVE, Sentiment.POSITIVE],
33
35
  [Sentiment.WARNING, Sentiment.WARNING],
34
36
  ])(
35
37
  "if prop 'sentiment' equals '%s' is passed, renders the status icon with class '%s'",
36
38
  (sentiment, expectedClass) => {
37
- renderStatusIcon({ sentiment });
39
+ renderStatusIcon({ sentiment: sentiment as StatusIconSentiment });
38
40
 
39
41
  expect(screen.getByTestId('status-icon')).toHaveClass(expectedClass);
40
42
  cleanup();
@@ -48,6 +50,10 @@ describe('StatusIcon', () => {
48
50
 
49
51
  renderStatusIcon({ sentiment: Sentiment.PENDING });
50
52
  expect(screen.getByTestId('clock-borderless-icon')).toHaveClass('dark');
53
+ cleanup();
54
+
55
+ renderStatusIcon({ sentiment: Status.PENDING });
56
+ expect(screen.getByTestId('clock-borderless-icon')).toHaveClass('dark');
51
57
  });
52
58
 
53
59
  it("'positive', 'negative', and 'neutral' sentiments generate 'light' colored icons", () => {
@@ -68,13 +74,13 @@ describe('StatusIcon', () => {
68
74
  ['Error', Sentiment.NEGATIVE],
69
75
  ['Success', Sentiment.POSITIVE],
70
76
  ['Warning', Sentiment.WARNING],
71
- ['Pending', Sentiment.PENDING],
77
+ ['Pending', Status.PENDING],
72
78
  ['Information', Sentiment.NEUTRAL],
73
79
  ['Error', Sentiment.ERROR],
74
80
  ['Information', Sentiment.INFO],
75
81
  ['Success', Sentiment.SUCCESS],
76
82
  ])("should set '%s' as an accessible name for the '%s' sentiment", (label, sentiment) => {
77
- renderStatusIcon({ sentiment });
83
+ renderStatusIcon({ sentiment: sentiment as StatusIconSentiment });
78
84
 
79
85
  expect(screen.getByLabelText(`${label}:`)).toBeInTheDocument();
80
86
  });
@@ -1,8 +1,8 @@
1
1
  import { Meta, StoryObj } from '@storybook/react';
2
2
 
3
- import { Sentiment, Size } from '../common';
3
+ import { Sentiment, Size, Status } from '../common';
4
4
 
5
- import StatusIcon from './StatusIcon';
5
+ import StatusIcon, { StatusIconSentiment } from './StatusIcon';
6
6
  import { storyConfig } from '../test-utils';
7
7
 
8
8
  export default {
@@ -42,6 +42,7 @@ export const Variants = storyConfig(
42
42
  Sentiment.WARNING,
43
43
  Sentiment.NEUTRAL,
44
44
  Sentiment.PENDING,
45
+ Status.PENDING,
45
46
  ].map((sentiment) => {
46
47
  return (
47
48
  <span
@@ -55,7 +56,9 @@ export const Variants = storyConfig(
55
56
  }}
56
57
  >
57
58
  {([16, 24, 32, 40, 48, 56, 72] as const).map((size) => {
58
- return <StatusIcon key={size} size={size} sentiment={sentiment} />;
59
+ return (
60
+ <StatusIcon key={size} size={size} sentiment={sentiment as StatusIconSentiment} />
61
+ );
59
62
  })}
60
63
  </span>
61
64
  );
@@ -74,7 +77,7 @@ export const LegacySizes: Story = {
74
77
  Sentiment.NEGATIVE,
75
78
  Sentiment.NEUTRAL,
76
79
  Sentiment.WARNING,
77
- Sentiment.PENDING,
80
+ Status.PENDING,
78
81
  ].map((sentiment) => {
79
82
  return (
80
83
  <span
@@ -88,7 +91,9 @@ export const LegacySizes: Story = {
88
91
  }}
89
92
  >
90
93
  {([Size.SMALL, Size.MEDIUM, Size.LARGE] as const).map((size) => {
91
- return <StatusIcon key={size} size={size} sentiment={sentiment} />;
94
+ return (
95
+ <StatusIcon key={size} size={size} sentiment={sentiment as StatusIconSentiment} />
96
+ );
92
97
  })}
93
98
  </span>
94
99
  );
@@ -2,7 +2,7 @@ import { Info, Alert, Cross, Check, ClockBorderless } from '@transferwise/icons'
2
2
  import { clsx } from 'clsx';
3
3
  import { useIntl } from 'react-intl';
4
4
 
5
- import { SizeSmall, SizeMedium, SizeLarge, Sentiment, Size, Breakpoint } from '../common';
5
+ import { SizeSmall, SizeMedium, SizeLarge, Sentiment, Size, Breakpoint, Status } from '../common';
6
6
  import Circle, { CircleProps } from '../common/circle';
7
7
  import { useMedia } from '../common/hooks/useMedia';
8
8
 
@@ -13,8 +13,10 @@ import messages from './StatusIcon.messages';
13
13
  */
14
14
  type LegacySizes = SizeSmall | SizeMedium | SizeLarge;
15
15
 
16
+ export type StatusIconSentiment = Sentiment | Status.PENDING;
17
+
16
18
  export type StatusIconProps = {
17
- sentiment?: `${Sentiment}`;
19
+ sentiment?: `${StatusIconSentiment}`;
18
20
  size?: LegacySizes | 16 | 24 | 32 | 40 | 48 | 56 | 72;
19
21
  /**
20
22
  * Override for the sentiment's-derived, default, accessible
@@ -34,7 +36,7 @@ const StatusIcon = ({ sentiment = 'neutral', size: sizeProp = 40, iconLabel }: S
34
36
  const intl = useIntl();
35
37
 
36
38
  const iconMetaBySentiment: Record<
37
- `${Sentiment}`,
39
+ `${Sentiment}` | Status.PENDING,
38
40
  {
39
41
  Icon: React.ElementType;
40
42
  defaultIconLabel: string;
@@ -52,7 +54,7 @@ const StatusIcon = ({ sentiment = 'neutral', size: sizeProp = 40, iconLabel }: S
52
54
  Icon: Alert,
53
55
  defaultIconLabel: intl.formatMessage(messages.warningLabel),
54
56
  },
55
- [Sentiment.PENDING]: {
57
+ [Status.PENDING]: {
56
58
  Icon: ClockBorderless,
57
59
  defaultIconLabel: intl.formatMessage(messages.pendingLabel),
58
60
  },
@@ -1,5 +1,4 @@
1
1
  import { Typography } from '../common/propsValues/typography';
2
- import Modal from '../modal';
3
2
  import { lorem1000 } from '../test-utils';
4
3
 
5
4
  import Title from './Title';
@@ -7,19 +6,27 @@ import Title from './Title';
7
6
  export default {
8
7
  component: Title,
9
8
  title: 'Typography/Title/Tests',
9
+ args: {
10
+ children: lorem1000.replaceAll(' ', ''),
11
+ },
12
+ argTypes: {
13
+ as: {
14
+ table: {
15
+ disable: true,
16
+ },
17
+ },
18
+ type: {
19
+ table: {
20
+ disable: true,
21
+ },
22
+ },
23
+ },
10
24
  };
11
25
 
12
- export const Hyphenation = () => {
26
+ export const Hyphenation = ({ children }: { children: string }) => {
13
27
  return (
14
- <Modal
15
- open
16
- body={
17
- <Title type={Typography.TITLE_SCREEN} style={{ maxWidth: '600px' }}>
18
- This Screen Title is mostly one very long word and it hyphenates{' '}
19
- {lorem1000.replaceAll(' ', '')}
20
- </Title>
21
- }
22
- onClose={() => {}}
23
- />
28
+ <Title type={Typography.TITLE_SCREEN} style={{ maxWidth: '600px', wordWrap: 'break-word' }}>
29
+ {` ${children}`}
30
+ </Title>
24
31
  );
25
32
  };
@@ -28,6 +28,7 @@ type Props = LabelHTMLAttributes<HTMLHeadingElement | HTMLSpanElement | HTMLLabe
28
28
  function Title({ as, type = DEFAULT_TYPE, className, ...props }: Props) {
29
29
  const mapping = titleTypeMapping[type];
30
30
  const isTypeSupported = mapping !== undefined;
31
+
31
32
  if (isTypeSupported) {
32
33
  const HeaderTag = as ?? mapping;
33
34
  return <HeaderTag {...props} className={clsx(`np-text-${type}`, className)} />;
@@ -1 +0,0 @@
1
- {"version":3,"file":"List.js","sources":["../../src/listItem/List.tsx"],"sourcesContent":["import { clsx } from 'clsx';\n\nexport interface ListProps {\n className?: string;\n children?: React.ReactNode;\n}\n\nexport function List({ className, children }: ListProps) {\n return <ul className={clsx(className, 'list-unstyled')}>{children}</ul>;\n}\n"],"names":["List","className","children","_jsx","clsx"],"mappings":";;;;;SAOgBA,IAAIA,CAAC;EAAEC,SAAS;AAAEC,EAAAA,QAAAA;AAAqB,CAAA,EAAA;AACrD,EAAA,oBAAOC,cAAA,CAAA,IAAA,EAAA;AAAIF,IAAAA,SAAS,EAAEG,SAAI,CAACH,SAAS,EAAE,eAAe,CAAE;AAAAC,IAAAA,QAAA,EAAEA,QAAAA;AAAQ,GAAK,CAAC,CAAA;AACzE;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"List.mjs","sources":["../../src/listItem/List.tsx"],"sourcesContent":["import { clsx } from 'clsx';\n\nexport interface ListProps {\n className?: string;\n children?: React.ReactNode;\n}\n\nexport function List({ className, children }: ListProps) {\n return <ul className={clsx(className, 'list-unstyled')}>{children}</ul>;\n}\n"],"names":["List","className","children","_jsx","clsx"],"mappings":";;;SAOgBA,IAAIA,CAAC;EAAEC,SAAS;AAAEC,EAAAA,QAAAA;AAAqB,CAAA,EAAA;AACrD,EAAA,oBAAOC,GAAA,CAAA,IAAA,EAAA;AAAIF,IAAAA,SAAS,EAAEG,IAAI,CAACH,SAAS,EAAE,eAAe,CAAE;AAAAC,IAAAA,QAAA,EAAEA,QAAAA;AAAQ,GAAK,CAAC,CAAA;AACzE;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"ListItem.js","sources":["../../src/listItem/ListItem.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { ElementType, FC, ReactNode } from 'react';\n\nimport Body from '../body/Body';\n\nexport type ListItemProps = {\n title: ReactNode;\n value: ReactNode;\n media?: ReactNode;\n action?: ReactNode;\n className?: string;\n isContainerAligned?: boolean;\n as?: ElementType;\n};\n\nconst ListItem: FC<ListItemProps> = ({\n media,\n action,\n className,\n title,\n value,\n isContainerAligned,\n as = 'li',\n ...rest\n}) => {\n const Element = as;\n\n return (\n <Element\n className={clsx('np-list-item d-flex align-items-center p-y-2', className, {\n 'p-x-2': !isContainerAligned,\n })}\n {...rest}\n >\n {media}\n\n <div className={clsx('d-flex flex-column', { 'p-l-2': !!media, 'p-r-2': !!action })}>\n <Body type=\"body-default\" className=\"text-secondary m-b-0\">\n {title}\n </Body>\n {value && (\n <Body type=\"body-large\" className=\"text-primary text-overflow-wrap m-b-0\">\n {value}\n </Body>\n )}\n </div>\n\n {action ? <div className=\"np-list-item__action m-l-auto\">{action}</div> : null}\n </Element>\n );\n};\n\nexport default ListItem;\n"],"names":["ListItem","media","action","className","title","value","isContainerAligned","as","rest","Element","_jsxs","clsx","children","_jsx","Body","type"],"mappings":";;;;;;;;AAeMA,MAAAA,QAAQ,GAAsBA,CAAC;EACnCC,KAAK;EACLC,MAAM;EACNC,SAAS;EACTC,KAAK;EACLC,KAAK;EACLC,kBAAkB;AAClBC,EAAAA,EAAE,GAAG,IAAI;EACT,GAAGC,IAAAA;AACJ,CAAA,KAAI;EACH,MAAMC,OAAO,GAAGF,EAAE,CAAA;EAElB,oBACEG,eAAA,CAACD,OAAO,EAAA;AACNN,IAAAA,SAAS,EAAEQ,SAAI,CAAC,8CAA8C,EAAER,SAAS,EAAE;AACzE,MAAA,OAAO,EAAE,CAACG,kBAAAA;AACX,KAAA,CAAE;AAAA,IAAA,GACCE,IAAI;IAAAI,QAAA,EAAA,CAEPX,KAAK,eAENS,eAAA,CAAA,KAAA,EAAA;AAAKP,MAAAA,SAAS,EAAEQ,SAAI,CAAC,oBAAoB,EAAE;QAAE,OAAO,EAAE,CAAC,CAACV,KAAK;QAAE,OAAO,EAAE,CAAC,CAACC,MAAAA;AAAM,OAAE,CAAE;MAAAU,QAAA,EAAA,cAClFC,cAAA,CAACC,YAAI,EAAA;AAACC,QAAAA,IAAI,EAAC,cAAc;AAACZ,QAAAA,SAAS,EAAC,sBAAsB;AAAAS,QAAAA,QAAA,EACvDR,KAAAA;AAAK,OACF,CACN,EAACC,KAAK,iBACJQ,cAAA,CAACC,YAAI,EAAA;AAACC,QAAAA,IAAI,EAAC,YAAY;AAACZ,QAAAA,SAAS,EAAC,uCAAuC;AAAAS,QAAAA,QAAA,EACtEP,KAAAA;AAAK,OACF,CACP,CAAA;AAAA,KACE,CAEL,EAACH,MAAM,gBAAGW,cAAA,CAAA,KAAA,EAAA;AAAKV,MAAAA,SAAS,EAAC,+BAA+B;AAAAS,MAAAA,QAAA,EAAEV,MAAAA;KAAY,CAAC,GAAG,IAAI,CAAA;AAAA,GACvE,CAAC,CAAA;AAEd;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"ListItem.mjs","sources":["../../src/listItem/ListItem.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { ElementType, FC, ReactNode } from 'react';\n\nimport Body from '../body/Body';\n\nexport type ListItemProps = {\n title: ReactNode;\n value: ReactNode;\n media?: ReactNode;\n action?: ReactNode;\n className?: string;\n isContainerAligned?: boolean;\n as?: ElementType;\n};\n\nconst ListItem: FC<ListItemProps> = ({\n media,\n action,\n className,\n title,\n value,\n isContainerAligned,\n as = 'li',\n ...rest\n}) => {\n const Element = as;\n\n return (\n <Element\n className={clsx('np-list-item d-flex align-items-center p-y-2', className, {\n 'p-x-2': !isContainerAligned,\n })}\n {...rest}\n >\n {media}\n\n <div className={clsx('d-flex flex-column', { 'p-l-2': !!media, 'p-r-2': !!action })}>\n <Body type=\"body-default\" className=\"text-secondary m-b-0\">\n {title}\n </Body>\n {value && (\n <Body type=\"body-large\" className=\"text-primary text-overflow-wrap m-b-0\">\n {value}\n </Body>\n )}\n </div>\n\n {action ? <div className=\"np-list-item__action m-l-auto\">{action}</div> : null}\n </Element>\n );\n};\n\nexport default ListItem;\n"],"names":["ListItem","media","action","className","title","value","isContainerAligned","as","rest","Element","_jsxs","clsx","children","_jsx","Body","type"],"mappings":";;;;AAeMA,MAAAA,QAAQ,GAAsBA,CAAC;EACnCC,KAAK;EACLC,MAAM;EACNC,SAAS;EACTC,KAAK;EACLC,KAAK;EACLC,kBAAkB;AAClBC,EAAAA,EAAE,GAAG,IAAI;EACT,GAAGC,IAAAA;AACJ,CAAA,KAAI;EACH,MAAMC,OAAO,GAAGF,EAAE,CAAA;EAElB,oBACEG,IAAA,CAACD,OAAO,EAAA;AACNN,IAAAA,SAAS,EAAEQ,IAAI,CAAC,8CAA8C,EAAER,SAAS,EAAE;AACzE,MAAA,OAAO,EAAE,CAACG,kBAAAA;AACX,KAAA,CAAE;AAAA,IAAA,GACCE,IAAI;IAAAI,QAAA,EAAA,CAEPX,KAAK,eAENS,IAAA,CAAA,KAAA,EAAA;AAAKP,MAAAA,SAAS,EAAEQ,IAAI,CAAC,oBAAoB,EAAE;QAAE,OAAO,EAAE,CAAC,CAACV,KAAK;QAAE,OAAO,EAAE,CAAC,CAACC,MAAAA;AAAM,OAAE,CAAE;MAAAU,QAAA,EAAA,cAClFC,GAAA,CAACC,IAAI,EAAA;AAACC,QAAAA,IAAI,EAAC,cAAc;AAACZ,QAAAA,SAAS,EAAC,sBAAsB;AAAAS,QAAAA,QAAA,EACvDR,KAAAA;AAAK,OACF,CACN,EAACC,KAAK,iBACJQ,GAAA,CAACC,IAAI,EAAA;AAACC,QAAAA,IAAI,EAAC,YAAY;AAACZ,QAAAA,SAAS,EAAC,uCAAuC;AAAAS,QAAAA,QAAA,EACtEP,KAAAA;AAAK,OACF,CACP,CAAA;AAAA,KACE,CAEL,EAACH,MAAM,gBAAGW,GAAA,CAAA,KAAA,EAAA;AAAKV,MAAAA,SAAS,EAAC,+BAA+B;AAAAS,MAAAA,QAAA,EAAEV,MAAAA;KAAY,CAAC,GAAG,IAAI,CAAA;AAAA,GACvE,CAAC,CAAA;AAEd;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"List.d.ts","sourceRoot":"","sources":["../../../src/listItem/List.tsx"],"names":[],"mappings":"AAEA,MAAM,WAAW,SAAS;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAED,wBAAgB,IAAI,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE,SAAS,+BAEtD"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"ListItem.d.ts","sourceRoot":"","sources":["../../../src/listItem/ListItem.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAInD,MAAM,MAAM,aAAa,GAAG;IAC1B,KAAK,EAAE,SAAS,CAAC;IACjB,KAAK,EAAE,SAAS,CAAC;IACjB,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,EAAE,CAAC,EAAE,WAAW,CAAC;CAClB,CAAC;AAEF,QAAA,MAAM,QAAQ,EAAE,EAAE,CAAC,aAAa,CAmC/B,CAAC;AAEF,eAAe,QAAQ,CAAC"}
@@ -1,5 +0,0 @@
1
- export { List } from './List';
2
- export type { ListProps } from './List';
3
- export { default } from './ListItem';
4
- export type { ListItemProps } from './ListItem';
5
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/listItem/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,YAAY,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,YAAY,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC"}
@@ -1,4 +0,0 @@
1
- export { List } from './List';
2
- export type { ListProps } from './List';
3
- export { default } from './ListItem';
4
- export type { ListItemProps } from './ListItem';
File without changes
File without changes
File without changes