@transferwise/components 0.0.0-experimental-4533565 → 0.0.0-experimental-da1781d

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 (127) hide show
  1. package/build/flowNavigation/animatedLabel/AnimatedLabel.js +1 -1
  2. package/build/flowNavigation/animatedLabel/AnimatedLabel.js.map +1 -1
  3. package/build/flowNavigation/animatedLabel/AnimatedLabel.mjs +1 -1
  4. package/build/flowNavigation/animatedLabel/AnimatedLabel.mjs.map +1 -1
  5. package/build/index.js +3 -3
  6. package/build/index.mjs +2 -2
  7. package/build/{listItem/ListItem.js → legacylistItem/LegacyListItem.js} +3 -3
  8. package/build/legacylistItem/LegacyListItem.js.map +1 -0
  9. package/build/{listItem/ListItem.mjs → legacylistItem/LegacyListItem.mjs} +3 -3
  10. package/build/legacylistItem/LegacyListItem.mjs.map +1 -0
  11. package/build/legacylistItem/List.js.map +1 -0
  12. package/build/legacylistItem/List.mjs.map +1 -0
  13. package/build/main.css +60 -57
  14. package/build/phoneNumberInput/PhoneNumberInput.js +1 -1
  15. package/build/phoneNumberInput/PhoneNumberInput.js.map +1 -1
  16. package/build/phoneNumberInput/PhoneNumberInput.mjs +1 -1
  17. package/build/phoneNumberInput/PhoneNumberInput.mjs.map +1 -1
  18. package/build/phoneNumberInput/utils/isValidPhoneNumber/isValidPhoneNumber.js +2 -2
  19. package/build/phoneNumberInput/utils/isValidPhoneNumber/isValidPhoneNumber.js.map +1 -1
  20. package/build/phoneNumberInput/utils/isValidPhoneNumber/isValidPhoneNumber.mjs +2 -2
  21. package/build/phoneNumberInput/utils/isValidPhoneNumber/isValidPhoneNumber.mjs.map +1 -1
  22. package/build/styles/legacylistItem/LegacyListItem.css +6 -0
  23. package/build/styles/listItem/ListItem.css +185 -3
  24. package/build/styles/main.css +60 -57
  25. package/build/styles/switch/Switch.css +3 -0
  26. package/build/types/index.d.ts +3 -3
  27. package/build/types/index.d.ts.map +1 -1
  28. package/build/types/legacylistItem/LegacyListItem.d.ts +13 -0
  29. package/build/types/legacylistItem/LegacyListItem.d.ts.map +1 -0
  30. package/build/types/legacylistItem/List.d.ts.map +1 -0
  31. package/build/types/legacylistItem/index.d.ts +5 -0
  32. package/build/types/legacylistItem/index.d.ts.map +1 -0
  33. package/build/types/listItem/ListItem.d.ts +38 -8
  34. package/build/types/listItem/ListItem.d.ts.map +1 -1
  35. package/build/types/listItem/ListItemAdditionalInfo.d.ts +9 -0
  36. package/build/types/listItem/ListItemAdditionalInfo.d.ts.map +1 -0
  37. package/build/types/listItem/ListItemButton.d.ts +4 -0
  38. package/build/types/listItem/ListItemButton.d.ts.map +1 -0
  39. package/build/types/listItem/ListItemCheckbox.d.ts +4 -0
  40. package/build/types/listItem/ListItemCheckbox.d.ts.map +1 -0
  41. package/build/types/listItem/ListItemIconButton.d.ts +7 -0
  42. package/build/types/listItem/ListItemIconButton.d.ts.map +1 -0
  43. package/build/types/listItem/ListItemMedia.d.ts +19 -0
  44. package/build/types/listItem/ListItemMedia.d.ts.map +1 -0
  45. package/build/types/listItem/ListItemNavigation.d.ts +4 -0
  46. package/build/types/listItem/ListItemNavigation.d.ts.map +1 -0
  47. package/build/types/{item/ItemSwitch.d.ts → listItem/ListItemSwitch.d.ts} +1 -1
  48. package/build/types/listItem/ListItemSwitch.d.ts.map +1 -0
  49. package/build/types/listItem/index.d.ts +4 -3
  50. package/build/types/listItem/index.d.ts.map +1 -1
  51. package/build/types/{item → listItem}/prompt/Prompt.d.ts +3 -3
  52. package/build/types/listItem/prompt/Prompt.d.ts.map +1 -0
  53. package/build/types/listItem/useItemControl.d.ts +5 -0
  54. package/build/types/listItem/useItemControl.d.ts.map +1 -0
  55. package/build/types/phoneNumberInput/utils/isValidPhoneNumber/isValidPhoneNumber.d.ts +2 -2
  56. package/build/types/phoneNumberInput/utils/isValidPhoneNumber/isValidPhoneNumber.d.ts.map +1 -1
  57. package/package.json +3 -3
  58. package/src/flowNavigation/animatedLabel/AnimatedLabel.tsx +1 -1
  59. package/src/index.ts +3 -3
  60. package/src/legacylistItem/LegacyListItem.css +6 -0
  61. package/src/legacylistItem/LegacyListItem.less +7 -0
  62. package/src/legacylistItem/LegacyListItem.story.tsx +120 -0
  63. package/src/{listItem/ListItem.tests.story.tsx → legacylistItem/LegacyListItem.tests.story.tsx} +7 -7
  64. package/src/legacylistItem/LegacyListItem.tsx +53 -0
  65. package/src/legacylistItem/index.ts +4 -0
  66. package/src/listItem/ListItem.css +185 -3
  67. package/src/listItem/ListItem.less +180 -5
  68. package/src/listItem/ListItem.story.tsx +250 -97
  69. package/src/listItem/ListItem.tsx +167 -37
  70. package/src/{item/ItemAdditionalInfo.tsx → listItem/ListItemAdditionalInfo.tsx} +5 -5
  71. package/src/{item/ItemButton.spec.tsx → listItem/ListItemButton.spec.tsx} +4 -4
  72. package/src/{item/ItemButton.tsx → listItem/ListItemButton.tsx} +2 -2
  73. package/src/{item/ItemCheckbox.tsx → listItem/ListItemCheckbox.tsx} +5 -2
  74. package/src/{item/ItemIconButton.tsx → listItem/ListItemIconButton.tsx} +2 -2
  75. package/src/{item/ItemMedia.tsx → listItem/ListItemMedia.tsx} +9 -9
  76. package/src/{item/ItemNavigation.tsx → listItem/ListItemNavigation.tsx} +2 -2
  77. package/src/listItem/index.ts +9 -3
  78. package/src/{item → listItem}/prompt/Prompt.spec.tsx +12 -12
  79. package/src/{item → listItem}/prompt/Prompt.story.tsx +27 -27
  80. package/src/{item → listItem}/prompt/Prompt.tsx +4 -4
  81. package/src/listItem/useItemControl.tsx +12 -0
  82. package/src/main.css +60 -57
  83. package/src/main.less +2 -2
  84. package/src/phoneNumberInput/PhoneNumberInput.spec.tsx +4 -4
  85. package/src/phoneNumberInput/PhoneNumberInput.story.tsx +22 -0
  86. package/src/phoneNumberInput/PhoneNumberInput.tsx +1 -1
  87. package/src/phoneNumberInput/utils/isValidPhoneNumber/isValidPhoneNumber.ts +4 -3
  88. package/src/switch/Switch.css +3 -0
  89. package/src/switch/Switch.less +1 -0
  90. package/build/listItem/List.js.map +0 -1
  91. package/build/listItem/List.mjs.map +0 -1
  92. package/build/listItem/ListItem.js.map +0 -1
  93. package/build/listItem/ListItem.mjs.map +0 -1
  94. package/build/styles/item/Item.css +0 -188
  95. package/build/types/item/Item.d.ts +0 -43
  96. package/build/types/item/Item.d.ts.map +0 -1
  97. package/build/types/item/ItemAdditionalInfo.d.ts +0 -9
  98. package/build/types/item/ItemAdditionalInfo.d.ts.map +0 -1
  99. package/build/types/item/ItemButton.d.ts +0 -4
  100. package/build/types/item/ItemButton.d.ts.map +0 -1
  101. package/build/types/item/ItemCheckbox.d.ts +0 -4
  102. package/build/types/item/ItemCheckbox.d.ts.map +0 -1
  103. package/build/types/item/ItemIconButton.d.ts +0 -7
  104. package/build/types/item/ItemIconButton.d.ts.map +0 -1
  105. package/build/types/item/ItemMedia.d.ts +0 -19
  106. package/build/types/item/ItemMedia.d.ts.map +0 -1
  107. package/build/types/item/ItemNavigation.d.ts +0 -4
  108. package/build/types/item/ItemNavigation.d.ts.map +0 -1
  109. package/build/types/item/ItemSwitch.d.ts.map +0 -1
  110. package/build/types/item/index.d.ts +0 -6
  111. package/build/types/item/index.d.ts.map +0 -1
  112. package/build/types/item/prompt/Prompt.d.ts.map +0 -1
  113. package/build/types/item/useItemControl.d.ts +0 -5
  114. package/build/types/item/useItemControl.d.ts.map +0 -1
  115. package/build/types/listItem/List.d.ts.map +0 -1
  116. package/src/item/Item.css +0 -188
  117. package/src/item/Item.less +0 -182
  118. package/src/item/Item.story.tsx +0 -273
  119. package/src/item/Item.tsx +0 -181
  120. package/src/item/index.ts +0 -6
  121. package/src/item/useItemControl.tsx +0 -12
  122. /package/build/{listItem → legacylistItem}/List.js +0 -0
  123. /package/build/{listItem → legacylistItem}/List.mjs +0 -0
  124. /package/build/types/{listItem → legacylistItem}/List.d.ts +0 -0
  125. /package/src/{listItem/ListItem.spec.tsx → legacylistItem/LegacyListItem.spec.tsx} +0 -0
  126. /package/src/{listItem → legacylistItem}/List.tsx +0 -0
  127. /package/src/{item/ItemSwitch.tsx → listItem/ListItemSwitch.tsx} +0 -0
@@ -2,11 +2,11 @@ import { default as IconButtonComp, IconButtonProps } from '../iconButton';
2
2
  import { useItemControl } from './useItemControl';
3
3
  import { ReactNode } from 'react';
4
4
 
5
- export type ItemIconButtonProps = Pick<IconButtonProps, 'onClick' | 'href' | 'target'> & {
5
+ export type ListItemIconButtonProps = Pick<IconButtonProps, 'onClick' | 'href' | 'target'> & {
6
6
  children: ReactNode;
7
7
  };
8
8
 
9
- export const IconButton = function (props: ItemIconButtonProps) {
9
+ export const IconButton = function (props: ListItemIconButtonProps) {
10
10
  const { baseItemProps } = useItemControl('icon-button');
11
11
 
12
12
  return <IconButtonComp {...props} size={32} disabled={baseItemProps.disabled} />;
@@ -5,31 +5,31 @@ import { clsx } from 'clsx';
5
5
 
6
6
  type SizeProp = { size?: 32 | 40 | 48 | 56 | 72 };
7
7
 
8
- export type ItemAvatarViewProps = Omit<AvatarViewProps, 'size' | 'interactive'> & SizeProp;
8
+ export type ListItemAvatarViewProps = Omit<AvatarViewProps, 'size' | 'interactive'> & SizeProp;
9
9
 
10
- export const AvatarView = ({ className, size = 48, ...props }: ItemAvatarViewProps) => {
10
+ export const AvatarView = ({ className, size = 48, ...props }: ListItemAvatarViewProps) => {
11
11
  return (
12
12
  <AvatarViewComp
13
13
  {...props}
14
14
  size={size}
15
- className={clsx('np-item-media-avatar-view', className)}
15
+ className={clsx('wds-list-item-media-avatar-view', className)}
16
16
  />
17
17
  );
18
18
  };
19
19
 
20
- export type ItemAvatarLayoutProps = Omit<AvatarLayoutProps, 'size' | 'interactive'> & SizeProp;
20
+ export type ListItemAvatarLayoutProps = Omit<AvatarLayoutProps, 'size' | 'interactive'> & SizeProp;
21
21
 
22
- export const AvatarLayout = ({ className, size = 48, ...props }: ItemAvatarLayoutProps) => {
22
+ export const AvatarLayout = ({ className, size = 48, ...props }: ListItemAvatarLayoutProps) => {
23
23
  return (
24
24
  <AvatarLayoutComp
25
25
  {...props}
26
26
  size={size}
27
- className={clsx('np-item-media-avatar-layout', className)}
27
+ className={clsx('wds-list-item-media-avatar-layout', className)}
28
28
  />
29
29
  );
30
30
  };
31
31
 
32
- export type ItemImageProps = Omit<ImageProps, 'stretch' | 'shrink' | 'id' | 'alt'> &
32
+ export type ListItemImageProps = Omit<ImageProps, 'stretch' | 'shrink' | 'id' | 'alt'> &
33
33
  SizeProp & {
34
34
  alt?: string;
35
35
  };
@@ -37,10 +37,10 @@ export type ItemImageProps = Omit<ImageProps, 'stretch' | 'shrink' | 'id' | 'alt
37
37
  /**
38
38
  * TODO: mention that image is for rare cases not for DS illustrations, they discouraged
39
39
  */
40
- export const Image = ({ alt = '', size = 48, ...props }: ItemImageProps) => {
40
+ export const Image = ({ alt = '', size = 48, ...props }: ListItemImageProps) => {
41
41
  return (
42
42
  <div
43
- className={clsx('np-item-media-image')}
43
+ className={clsx('wds-list-item-media-image')}
44
44
  style={{
45
45
  // @ts-expect-error CSS custom props allowed
46
46
  '--item-media-image-size': `${size}px`,
@@ -2,9 +2,9 @@ import { ChevronRight, BillSplit as Disabled } from '@transferwise/icons';
2
2
  import { ButtonProps } from '../button/Button.types';
3
3
  import { useItemControl } from './useItemControl';
4
4
 
5
- export type ItemNavigationProps = Pick<ButtonProps, 'onClick' | 'href'>;
5
+ export type ListItemNavigationProps = Pick<ButtonProps, 'onClick' | 'href'>;
6
6
 
7
- export const Navigation = function Navigation({ onClick }: ItemNavigationProps) {
7
+ export const Navigation = function Navigation({ onClick }: ListItemNavigationProps) {
8
8
  const { baseItemProps } = useItemControl('navigation');
9
9
 
10
10
  return baseItemProps.disabled ? <Disabled size={24} /> : <ChevronRight size={24} />;
@@ -1,4 +1,10 @@
1
- export { List } from './List';
2
- export type { ListProps } from './List';
1
+ export type { Props as ListItemProps } from './ListItem';
2
+ export type { ListItemAdditionalInfoProps } from './ListItemAdditionalInfo';
3
+ export type { ListItemCheckboxProps } from './ListItemCheckbox';
4
+ export type {
5
+ ListItemImageProps,
6
+ ListItemAvatarViewProps,
7
+ ListItemAvatarLayoutProps,
8
+ } from './ListItemMedia';
9
+
3
10
  export { default } from './ListItem';
4
- export type { ListItemProps } from './ListItem';
@@ -1,19 +1,19 @@
1
1
  import { render, screen, mockMatchMedia } from '../../test-utils';
2
- import { ItemPrompt } from './Prompt';
2
+ import { Prompt } from './Prompt';
3
3
  import { Sentiment } from '../../common';
4
4
 
5
5
  mockMatchMedia();
6
6
 
7
- describe('ItemPrompt', () => {
7
+ describe('ListItem.Prompt', () => {
8
8
  it('renders the aria-label when provided', () => {
9
9
  const ariaLabel = 'Test aria-label';
10
10
  render(
11
- <ItemPrompt
11
+ <Prompt
12
12
  type={Sentiment.POSITIVE}
13
13
  action={{ 'aria-label': ariaLabel, href: 'https://example.com' }}
14
14
  >
15
15
  Positive prompt
16
- </ItemPrompt>,
16
+ </Prompt>,
17
17
  );
18
18
 
19
19
  expect(screen.getByLabelText(ariaLabel)).toBeInTheDocument();
@@ -21,12 +21,12 @@ describe('ItemPrompt', () => {
21
21
 
22
22
  it('applies the interactive class when href is provided', () => {
23
23
  render(
24
- <ItemPrompt
24
+ <Prompt
25
25
  type={Sentiment.POSITIVE}
26
26
  action={{ href: 'https://example.com', 'aria-label': 'Interactive link' }}
27
27
  >
28
28
  Interactive link
29
- </ItemPrompt>,
29
+ </Prompt>,
30
30
  );
31
31
 
32
32
  expect(screen.getByRole('link')).toHaveClass('np-prompt-interactive');
@@ -34,32 +34,32 @@ describe('ItemPrompt', () => {
34
34
 
35
35
  it('applies the interactive class when onClick is provided', () => {
36
36
  render(
37
- <ItemPrompt
37
+ <Prompt
38
38
  type={Sentiment.POSITIVE}
39
39
  action={{ onClick: jest.fn(), 'aria-label': 'Interactive button' }}
40
40
  >
41
41
  Interactive button
42
- </ItemPrompt>,
42
+ </Prompt>,
43
43
  );
44
44
 
45
45
  expect(screen.getByRole('button')).toHaveClass('np-prompt-interactive');
46
46
  });
47
47
 
48
48
  it('does not apply the interactive class when no action is provided', () => {
49
- render(<ItemPrompt type={Sentiment.POSITIVE}>Non-interactive prompt</ItemPrompt>);
49
+ render(<Prompt type={Sentiment.POSITIVE}>Non-interactive prompt</Prompt>);
50
50
 
51
51
  expect(screen.getByText('Non-interactive prompt')).not.toHaveClass('np-prompt-interactive');
52
52
  });
53
53
 
54
54
  it('renders the children content', () => {
55
- render(<ItemPrompt type={Sentiment.POSITIVE}>This is a child prompt</ItemPrompt>);
55
+ render(<Prompt type={Sentiment.POSITIVE}>This is a child prompt</Prompt>);
56
56
 
57
57
  expect(screen.getByText('This is a child prompt')).toBeInTheDocument();
58
58
  });
59
59
 
60
60
  it('spreads additional props to the wrapper element', () => {
61
61
  render(
62
- <ItemPrompt
62
+ <Prompt
63
63
  type={Sentiment.POSITIVE}
64
64
  action={{
65
65
  href: 'https://example.com',
@@ -68,7 +68,7 @@ describe('ItemPrompt', () => {
68
68
  }}
69
69
  >
70
70
  Custom props prompt
71
- </ItemPrompt>,
71
+ </Prompt>,
72
72
  );
73
73
 
74
74
  const link = screen.getByRole('link');
@@ -1,12 +1,12 @@
1
1
  import Link from '../../link';
2
2
  import { Sentiment } from '../../common';
3
- import { ItemPrompt, ItemPromptProps } from './Prompt';
3
+ import { Prompt, ListItemPromptProps } from './Prompt';
4
4
  import { lorem40 } from '../../test-utils';
5
5
  import { StoryObj } from '@storybook/react';
6
6
 
7
7
  export default {
8
- component: ItemPrompt,
9
- title: 'Content/Item/Prompt',
8
+ component: Prompt,
9
+ title: 'Content/ListItem/Prompt',
10
10
  args: {
11
11
  type: Sentiment.NEGATIVE,
12
12
  children: 'You have done a terrible thing',
@@ -40,7 +40,7 @@ export default {
40
40
  };
41
41
 
42
42
  type CustomStory = StoryObj<
43
- ItemPromptProps & {
43
+ ListItemPromptProps & {
44
44
  interactivity?: 'none' | 'full-anchor' | 'full-button' | 'link';
45
45
  }
46
46
  >;
@@ -59,7 +59,7 @@ export const Basic: CustomStory = {
59
59
  render: ({ interactivity, ...args }) => {
60
60
  return (
61
61
  <div>
62
- <ItemPrompt
62
+ <Prompt
63
63
  type={args.type}
64
64
  action={
65
65
  interactivity === 'full-anchor'
@@ -74,7 +74,7 @@ export const Basic: CustomStory = {
74
74
  }
75
75
  >
76
76
  {args.children} {interactivity === 'link' && <Link href="www.wise.com">with a link</Link>}
77
- </ItemPrompt>
77
+ </Prompt>
78
78
  </div>
79
79
  );
80
80
  },
@@ -84,37 +84,37 @@ export const Variants = () => {
84
84
  return (
85
85
  <>
86
86
  <div className="m-b-2">
87
- <ItemPrompt type={Sentiment.POSITIVE}>
87
+ <Prompt type={Sentiment.POSITIVE}>
88
88
  Positive prompt <Link href="www.wise.com">with a link to amazing content</Link>
89
- </ItemPrompt>
89
+ </Prompt>
90
90
  </div>
91
91
  <div className="m-b-2">
92
- <ItemPrompt type={Sentiment.NEGATIVE}>
92
+ <Prompt type={Sentiment.NEGATIVE}>
93
93
  Negative prompt <Link href="www.wise.com">with a link to amazing content</Link>
94
- </ItemPrompt>
94
+ </Prompt>
95
95
  </div>
96
96
  <div className="m-b-2">
97
- <ItemPrompt type={Sentiment.NEUTRAL}>
97
+ <Prompt type={Sentiment.NEUTRAL}>
98
98
  Neutral prompt <Link href="www.wise.com">with a link to amazing content</Link>
99
- </ItemPrompt>
99
+ </Prompt>
100
100
  </div>
101
101
  <div className="m-b-2">
102
- <ItemPrompt type={Sentiment.WARNING}>
102
+ <Prompt type={Sentiment.WARNING}>
103
103
  Warning prompt <Link href="www.wise.com">with a link to amazing content</Link>
104
- </ItemPrompt>
104
+ </Prompt>
105
105
  </div>
106
106
  <div className="m-b-2">
107
- <ItemPrompt type="discount">
107
+ <Prompt type="discount">
108
108
  Discount prompt <Link href="www.wise.com">with a link to amazing content</Link>
109
- </ItemPrompt>
109
+ </Prompt>
110
110
  </div>
111
111
  <div className="m-b-2">
112
- <ItemPrompt type="savings">
112
+ <Prompt type="savings">
113
113
  Savings prompt <Link href="www.wise.com">with a link to amazing content</Link>
114
- </ItemPrompt>
114
+ </Prompt>
115
115
  </div>
116
116
  <div className="m-b-2">
117
- <ItemPrompt
117
+ <Prompt
118
118
  type="discount"
119
119
  action={{
120
120
  href: 'www.wise.com',
@@ -123,10 +123,10 @@ export const Variants = () => {
123
123
  }}
124
124
  >
125
125
  The whole prompt is secretly clickable
126
- </ItemPrompt>
126
+ </Prompt>
127
127
  </div>
128
128
  <div className="m-b-2">
129
- <ItemPrompt
129
+ <Prompt
130
130
  type="negative"
131
131
  action={{
132
132
  href: 'www.wise.com',
@@ -135,10 +135,10 @@ export const Variants = () => {
135
135
  }}
136
136
  >
137
137
  The whole prompt is secretly clickable as an anchor tag
138
- </ItemPrompt>
138
+ </Prompt>
139
139
  </div>
140
140
  <div className="m-b-2">
141
- <ItemPrompt
141
+ <Prompt
142
142
  type="warning"
143
143
  action={{
144
144
  onClick: () => {
@@ -148,10 +148,10 @@ export const Variants = () => {
148
148
  }}
149
149
  >
150
150
  The whole prompt is secretly clickable as a button
151
- </ItemPrompt>
151
+ </Prompt>
152
152
  </div>
153
153
  <div className="m-b-2">
154
- <ItemPrompt
154
+ <Prompt
155
155
  type="neutral"
156
156
  action={{
157
157
  href: 'www.wise.com',
@@ -160,10 +160,10 @@ export const Variants = () => {
160
160
  }}
161
161
  >
162
162
  The whole prompt is secretly clickable
163
- </ItemPrompt>
163
+ </Prompt>
164
164
  </div>
165
165
  <div className="m-b-2" style={{ maxWidth: '300px' }}>
166
- <ItemPrompt type="warning">The prompt has very long text that wraps {lorem40}</ItemPrompt>
166
+ <Prompt type="warning">The prompt has very long text that wraps {lorem40}</Prompt>
167
167
  </div>
168
168
  </>
169
169
  );
@@ -5,7 +5,7 @@ import { clsx } from 'clsx';
5
5
  import { LinkProps } from '../../link';
6
6
  import Body from '../../body';
7
7
 
8
- export type ItemPromptProps = {
8
+ export type ListItemPromptProps = {
9
9
  type:
10
10
  | `${Sentiment.POSITIVE | Sentiment.NEGATIVE | Sentiment.NEUTRAL | Sentiment.WARNING}`
11
11
  | 'discount'
@@ -14,7 +14,7 @@ export type ItemPromptProps = {
14
14
  action?: Pick<LinkProps, 'href' | 'target' | 'onClick'> & { 'aria-label'?: string };
15
15
  };
16
16
 
17
- export const ItemPrompt = ({ type, children, action }: ItemPromptProps) => {
17
+ export const Prompt = ({ type, children, action }: ListItemPromptProps) => {
18
18
  const Wrapper = action?.href ? 'a' : action?.onClick ? 'button' : 'span';
19
19
 
20
20
  const icon =
@@ -29,7 +29,7 @@ export const ItemPrompt = ({ type, children, action }: ItemPromptProps) => {
29
29
  return (
30
30
  <Wrapper
31
31
  className={clsx(
32
- 'np-item-prompt',
32
+ 'wds-list-item-prompt',
33
33
  type,
34
34
  (action?.href || action?.onClick) && 'np-prompt-interactive',
35
35
  )}
@@ -41,4 +41,4 @@ export const ItemPrompt = ({ type, children, action }: ItemPromptProps) => {
41
41
  );
42
42
  };
43
43
 
44
- export default ItemPrompt;
44
+ export default Prompt;
@@ -0,0 +1,12 @@
1
+ import { useContext, useEffect } from 'react';
2
+ import { ListItemContext, ListItemContextData, ListItemTypes } from './ListItem';
3
+
4
+ export function useItemControl(controlType: ListItemTypes) {
5
+ const { setControlType, props: baseItemProps } = useContext<ListItemContextData>(ListItemContext);
6
+
7
+ useEffect(() => {
8
+ setControlType(controlType);
9
+ }, [controlType, setControlType]);
10
+
11
+ return { baseItemProps };
12
+ }
package/src/main.css CHANGED
@@ -2648,7 +2648,7 @@ html:not([dir="rtl"]) .np-flow-navigation--sm .np-flow-navigation__stepper {
2648
2648
  border-radius: 9999px !important;
2649
2649
  border-radius: var(--radius-full) !important;
2650
2650
  }
2651
- .np-item {
2651
+ .wds-list-item {
2652
2652
  padding: 16px;
2653
2653
  padding: var(--size-16);
2654
2654
  border-radius: 24px;
@@ -2658,63 +2658,63 @@ html:not([dir="rtl"]) .np-flow-navigation--sm .np-flow-navigation__stepper {
2658
2658
  gap: 16px;
2659
2659
  gap: var(--size-16);
2660
2660
  }
2661
- .np-item-interactive {
2661
+ .wds-list-item-interactive {
2662
2662
  cursor: pointer;
2663
2663
  }
2664
- .np-item-interactive:hover {
2664
+ .wds-list-item-interactive:hover {
2665
2665
  background-color: var(--color-background-screen-hover);
2666
2666
  }
2667
- .np-item-interactive:active {
2667
+ .wds-list-item-interactive:active {
2668
2668
  background-color: var(--color-background-screen-active);
2669
2669
  }
2670
- .np-item-media-image {
2670
+ .wds-list-item-media-image {
2671
2671
  width: var(--item-media-image-size);
2672
2672
  height: var(--item-media-image-size);
2673
2673
  }
2674
- .np-item-body {
2674
+ .wds-list-item-body {
2675
2675
  width: 100%;
2676
2676
  }
2677
- .np-item-title {
2677
+ .wds-list-item-title {
2678
2678
  color: #37517e;
2679
2679
  color: var(--color-content-primary);
2680
2680
  }
2681
- .np-item-additional-info {
2681
+ .wds-list-item-additional-info {
2682
2682
  color: #768e9c;
2683
2683
  color: var(--color-content-tertiary);
2684
2684
  }
2685
- .np-item-value {
2685
+ .wds-list-item-value {
2686
2686
  flex: 0 0 auto;
2687
2687
  }
2688
- .np-item-control {
2688
+ .wds-list-item-control {
2689
2689
  flex: 0 0 auto;
2690
2690
  }
2691
- .np-item-spotlight-active {
2691
+ .wds-list-item-spotlight-active {
2692
2692
  background-color: rgba(134,167,189,0.10196);
2693
2693
  background-color: var(--color-background-neutral);
2694
2694
  }
2695
- .np-item-spotlight-active:hover {
2695
+ .wds-list-item-spotlight-active:hover {
2696
2696
  background-color: var(--color-background-neutral-hover);
2697
2697
  }
2698
- .np-item-spotlight-active:active {
2698
+ .wds-list-item-spotlight-active:active {
2699
2699
  background-color: var(--color-background-neutral-active);
2700
2700
  }
2701
- .np-item-spotlight-inactive {
2701
+ .wds-list-item-spotlight-inactive {
2702
2702
  background-color: rgba(134, 167, 189, 0.025);
2703
2703
  border: 1px dashed rgba(0,0,0,0.10196);
2704
2704
  border: 1px dashed var(--color-border-neutral);
2705
2705
  }
2706
2706
  @supports (color: color-mix(in lch, red, blue)) {
2707
- .np-item-spotlight-inactive {
2707
+ .wds-list-item-spotlight-inactive {
2708
2708
  background-color: color-mix(in srgb, var(--color-background-neutral) 25%, transparent);
2709
2709
  }
2710
2710
  }
2711
- .np-item-spotlight-inactive:hover {
2711
+ .wds-list-item-spotlight-inactive:hover {
2712
2712
  background-color: color-mix(in srgb, var(--color-background-neutral-hover) 25%, transparent);
2713
2713
  }
2714
- .np-item-spotlight-inactive:active {
2714
+ .wds-list-item-spotlight-inactive:active {
2715
2715
  background-color: color-mix(in srgb, var(--color-background-neutral-active) 25%, transparent);
2716
2716
  }
2717
- .np-item-prompt {
2717
+ .wds-list-item-prompt {
2718
2718
  display: inline-flex;
2719
2719
  padding-top: calc(8px / 2);
2720
2720
  padding-top: calc(var(--padding-x-small) / 2);
@@ -2729,7 +2729,7 @@ html:not([dir="rtl"]) .np-flow-navigation--sm .np-flow-navigation__stepper {
2729
2729
  word-break: break-word;
2730
2730
  word-wrap: break-word;
2731
2731
  }
2732
- .np-item-prompt .np-prompt-icon {
2732
+ .wds-list-item-prompt .np-prompt-icon {
2733
2733
  padding-right: calc(12px / 2);
2734
2734
  padding-right: calc(var(--size-12) / 2);
2735
2735
  padding-top: calc(4px - 1px);
@@ -2737,103 +2737,103 @@ html:not([dir="rtl"]) .np-flow-navigation--sm .np-flow-navigation__stepper {
2737
2737
  padding-bottom: calc(4px - 1px);
2738
2738
  padding-bottom: calc(var(--size-4) - 1px);
2739
2739
  }
2740
- .np-item-prompt .np-prompt-icon .tw-icon-tags,
2741
- .np-item-prompt .np-prompt-icon .tw-icon-confetti {
2740
+ .wds-list-item-prompt .np-prompt-icon .tw-icon-tags,
2741
+ .wds-list-item-prompt .np-prompt-icon .tw-icon-confetti {
2742
2742
  color: var(--color-sentiment-positive-primary);
2743
2743
  }
2744
- .np-item-prompt a {
2744
+ .wds-list-item-prompt a {
2745
2745
  text-underline-offset: calc(4px / 2);
2746
2746
  text-underline-offset: calc(var(--size-4) / 2);
2747
2747
  }
2748
- .np-item-prompt.np-prompt-interactive {
2748
+ .wds-list-item-prompt.np-prompt-interactive {
2749
2749
  -webkit-text-decoration: none;
2750
2750
  text-decoration: none;
2751
2751
  cursor: pointer;
2752
2752
  border: none;
2753
2753
  }
2754
- .np-item-prompt.negative {
2754
+ .wds-list-item-prompt.negative {
2755
2755
  background-color: var(--color-sentiment-negative-secondary);
2756
2756
  color: var(--color-sentiment-negative-primary);
2757
2757
  }
2758
- .np-item-prompt.negative a {
2758
+ .wds-list-item-prompt.negative a {
2759
2759
  color: var(--color-sentiment-negative-primary);
2760
2760
  }
2761
- .np-item-prompt.negative a:hover {
2761
+ .wds-list-item-prompt.negative a:hover {
2762
2762
  color: var(--color-sentiment-negative-primary-hover);
2763
2763
  }
2764
- .np-item-prompt.negative a:active {
2764
+ .wds-list-item-prompt.negative a:active {
2765
2765
  color: var(--color-sentiment-negative-primary-active);
2766
2766
  }
2767
- .np-prompt-interactive.np-item-prompt.negative:hover {
2767
+ .np-prompt-interactive.wds-list-item-prompt.negative:hover {
2768
2768
  background-color: color-mix(in srgb, var(--color-sentiment-negative-secondary) 95%, var(--color-sentiment-negative-primary));
2769
2769
  }
2770
- .np-prompt-interactive.np-item-prompt.negative:active {
2770
+ .np-prompt-interactive.wds-list-item-prompt.negative:active {
2771
2771
  background-color: color-mix(in srgb, var(--color-sentiment-negative-secondary) 90%, var(--color-sentiment-negative-primary));
2772
2772
  }
2773
- .np-item-prompt.positive,
2774
- .np-item-prompt.discount,
2775
- .np-item-prompt.savings {
2773
+ .wds-list-item-prompt.positive,
2774
+ .wds-list-item-prompt.discount,
2775
+ .wds-list-item-prompt.savings {
2776
2776
  background-color: var(--color-sentiment-positive-secondary);
2777
2777
  color: var(--color-sentiment-positive-primary);
2778
2778
  }
2779
- .np-item-prompt.positive a,
2780
- .np-item-prompt.discount a,
2781
- .np-item-prompt.savings a {
2779
+ .wds-list-item-prompt.positive a,
2780
+ .wds-list-item-prompt.discount a,
2781
+ .wds-list-item-prompt.savings a {
2782
2782
  color: var(--color-sentiment-positive-primary);
2783
2783
  }
2784
- .np-item-prompt.positive a:hover,
2785
- .np-item-prompt.discount a:hover,
2786
- .np-item-prompt.savings a:hover {
2784
+ .wds-list-item-prompt.positive a:hover,
2785
+ .wds-list-item-prompt.discount a:hover,
2786
+ .wds-list-item-prompt.savings a:hover {
2787
2787
  color: var(--color-sentiment-positive-primary-hover);
2788
2788
  }
2789
- .np-item-prompt.positive a:active,
2790
- .np-item-prompt.discount a:active,
2791
- .np-item-prompt.savings a:active {
2789
+ .wds-list-item-prompt.positive a:active,
2790
+ .wds-list-item-prompt.discount a:active,
2791
+ .wds-list-item-prompt.savings a:active {
2792
2792
  color: var(--color-sentiment-positive-primary-active);
2793
2793
  }
2794
- .np-prompt-interactive.np-item-prompt.positive:hover,
2795
- .np-prompt-interactive.np-item-prompt.discount:hover,
2796
- .np-prompt-interactive.np-item-prompt.savings:hover {
2794
+ .np-prompt-interactive.wds-list-item-prompt.positive:hover,
2795
+ .np-prompt-interactive.wds-list-item-prompt.discount:hover,
2796
+ .np-prompt-interactive.wds-list-item-prompt.savings:hover {
2797
2797
  background-color: color-mix(in srgb, var(--color-sentiment-positive-secondary) 95%, var(--color-sentiment-positive-primary));
2798
2798
  }
2799
- .np-prompt-interactive.np-item-prompt.positive:active,
2800
- .np-prompt-interactive.np-item-prompt.discount:active,
2801
- .np-prompt-interactive.np-item-prompt.savings:active {
2799
+ .np-prompt-interactive.wds-list-item-prompt.positive:active,
2800
+ .np-prompt-interactive.wds-list-item-prompt.discount:active,
2801
+ .np-prompt-interactive.wds-list-item-prompt.savings:active {
2802
2802
  background-color: color-mix(in srgb, var(--color-sentiment-positive-secondary) 90%, var(--color-sentiment-positive-primary));
2803
2803
  }
2804
- .np-item-prompt.neutral {
2804
+ .wds-list-item-prompt.neutral {
2805
2805
  background-color: rgba(134,167,189,0.10196);
2806
2806
  background-color: var(--color-background-neutral);
2807
2807
  color: #37517e;
2808
2808
  color: var(--color-content-primary);
2809
2809
  }
2810
- .np-item-prompt.neutral a {
2810
+ .wds-list-item-prompt.neutral a {
2811
2811
  color: #37517e;
2812
2812
  color: var(--color-content-primary);
2813
2813
  }
2814
- .np-prompt-interactive.np-item-prompt.neutral:hover {
2814
+ .np-prompt-interactive.wds-list-item-prompt.neutral:hover {
2815
2815
  background-color: var(--color-background-neutral-hover);
2816
2816
  }
2817
- .np-prompt-interactive.np-item-prompt.neutral:active {
2817
+ .np-prompt-interactive.wds-list-item-prompt.neutral:active {
2818
2818
  background-color: var(--color-background-neutral-active);
2819
2819
  }
2820
- .np-item-prompt.warning {
2820
+ .wds-list-item-prompt.warning {
2821
2821
  background-color: var(--color-sentiment-warning-secondary);
2822
2822
  color: var(--color-sentiment-warning-content);
2823
2823
  }
2824
- .np-item-prompt.warning a {
2824
+ .wds-list-item-prompt.warning a {
2825
2825
  color: var(--color-sentiment-warning-content);
2826
2826
  }
2827
- .np-item-prompt.warning a:hover {
2827
+ .wds-list-item-prompt.warning a:hover {
2828
2828
  color: var(--color-sentiment-warning-content-hover);
2829
2829
  }
2830
- .np-item-prompt.warning a:active {
2830
+ .wds-list-item-prompt.warning a:active {
2831
2831
  color: var(--color-sentiment-warning-content-active);
2832
2832
  }
2833
- .np-prompt-interactive.np-item-prompt.warning:hover {
2833
+ .np-prompt-interactive.wds-list-item-prompt.warning:hover {
2834
2834
  background-color: color-mix(in srgb, var(--color-sentiment-warning-secondary) 90%, var(--color-sentiment-warning-primary));
2835
2835
  }
2836
- .np-prompt-interactive.np-item-prompt.warning:active {
2836
+ .np-prompt-interactive.wds-list-item-prompt.warning:active {
2837
2837
  background-color: color-mix(in srgb, var(--color-sentiment-warning-secondary) 80%, var(--color-sentiment-warning-primary));
2838
2838
  }
2839
2839
  .np-field-control {
@@ -5353,6 +5353,9 @@ html:not([dir="rtl"]) .np-navigation-option {
5353
5353
  width: 50px;
5354
5354
  padding: 2px;
5355
5355
  border-radius: 16px;
5356
+ -webkit-user-select: none;
5357
+ -moz-user-select: none;
5358
+ user-select: none;
5356
5359
  }
5357
5360
  .np-switch:focus {
5358
5361
  outline: none;
package/src/main.less CHANGED
@@ -39,7 +39,7 @@
39
39
  @import "./image/Image.less";
40
40
  @import "./info/Info.less";
41
41
  @import "./inputs/Input.less";
42
- @import "./item/Item.less";
42
+ @import "./listItem/ListItem.less";
43
43
  @import "./field/Field.less";
44
44
  @import "./inputs/InputGroup.less";
45
45
  @import "./inputs/SelectInput.less";
@@ -78,7 +78,7 @@
78
78
  @import "./uploadInput/uploadItem/UploadItem.less";
79
79
  @import "./progress/Progress.less";
80
80
  @import "./progressBar/ProgressBar.less";
81
- @import "./listItem/ListItem.less";
81
+ @import "./legacylistItem/LegacyListItem.less";
82
82
 
83
83
  // List all less files in src in alphabetical order: find -s src -type f -name '*.less' ! -name 'main.less'
84
84
  // Make sure you are not referencing main.less itself in this file!
@@ -159,11 +159,11 @@ describe('PhoneNumberInput', () => {
159
159
  });
160
160
  });
161
161
 
162
- describe('when an invalid model is supplied', () => {
163
- it('should not re-explode model', () => {
162
+ describe('when an partial model is supplied (with a matching prefix)', () => {
163
+ it('should set the select to the matching prefix and put the rest of the number in the suffix', () => {
164
164
  customRender({ initialValue: '+123' });
165
- expect(getPrefixEl()).toHaveTextContent('+44');
166
- expect(getInputEl()).toHaveValue('');
165
+ expect(getPrefixEl()).toHaveTextContent('+1');
166
+ expect(getInputEl()).toHaveValue('23');
167
167
  });
168
168
  });
169
169
  });