@transferwise/components 46.106.0 → 46.108.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (152) hide show
  1. package/build/actionOption/ActionOption.js.map +1 -1
  2. package/build/actionOption/ActionOption.mjs.map +1 -1
  3. package/build/checkboxOption/CheckboxOption.js.map +1 -1
  4. package/build/checkboxOption/CheckboxOption.mjs.map +1 -1
  5. package/build/header/Header.js +1 -0
  6. package/build/header/Header.js.map +1 -1
  7. package/build/header/Header.mjs +1 -0
  8. package/build/header/Header.mjs.map +1 -1
  9. package/build/legacylistItem/LegacyListItem.js.map +1 -1
  10. package/build/legacylistItem/LegacyListItem.mjs.map +1 -1
  11. package/build/link/Link.js +6 -2
  12. package/build/link/Link.js.map +1 -1
  13. package/build/link/Link.mjs +6 -2
  14. package/build/link/Link.mjs.map +1 -1
  15. package/build/listItem/ListItem.js +28 -16
  16. package/build/listItem/ListItem.js.map +1 -1
  17. package/build/listItem/ListItem.mjs +28 -16
  18. package/build/listItem/ListItem.mjs.map +1 -1
  19. package/build/listItem/ListItemContext.js.map +1 -1
  20. package/build/listItem/ListItemContext.mjs.map +1 -1
  21. package/build/listItem/Navigation/ListItemNavigation.js +1 -3
  22. package/build/listItem/Navigation/ListItemNavigation.js.map +1 -1
  23. package/build/listItem/Navigation/ListItemNavigation.mjs +2 -4
  24. package/build/listItem/Navigation/ListItemNavigation.mjs.map +1 -1
  25. package/build/listItem/Prompt/InlinePrompt/InlinePrompt.js +74 -0
  26. package/build/listItem/Prompt/InlinePrompt/InlinePrompt.js.map +1 -0
  27. package/build/listItem/Prompt/InlinePrompt/InlinePrompt.mjs +72 -0
  28. package/build/listItem/Prompt/InlinePrompt/InlinePrompt.mjs.map +1 -0
  29. package/build/listItem/Prompt/ListItemPrompt.js +10 -15
  30. package/build/listItem/Prompt/ListItemPrompt.js.map +1 -1
  31. package/build/listItem/Prompt/ListItemPrompt.mjs +11 -16
  32. package/build/listItem/Prompt/ListItemPrompt.mjs.map +1 -1
  33. package/build/main.css +122 -81
  34. package/build/navigationOption/NavigationOption.js.map +1 -1
  35. package/build/navigationOption/NavigationOption.mjs.map +1 -1
  36. package/build/navigationOptionsList/NavigationOptionsList.js.map +1 -1
  37. package/build/navigationOptionsList/NavigationOptionsList.mjs.map +1 -1
  38. package/build/radioOption/RadioOption.js.map +1 -1
  39. package/build/radioOption/RadioOption.mjs.map +1 -1
  40. package/build/styles/link/Link.css +7 -0
  41. package/build/styles/listItem/ListItem.css +115 -81
  42. package/build/styles/listItem/ListItem.grid.css +11 -3
  43. package/build/styles/listItem/ListItem.vars.css +0 -0
  44. package/build/styles/listItem/Prompt/InlinePrompt/InlinePrompt.css +153 -0
  45. package/build/styles/listItem/Prompt/ListItemPrompt.css +72 -72
  46. package/build/styles/main.css +122 -81
  47. package/build/summary/Summary.js +8 -0
  48. package/build/summary/Summary.js.map +1 -1
  49. package/build/summary/Summary.mjs +8 -0
  50. package/build/summary/Summary.mjs.map +1 -1
  51. package/build/switchOption/SwitchOption.js +8 -0
  52. package/build/switchOption/SwitchOption.js.map +1 -1
  53. package/build/switchOption/SwitchOption.mjs +8 -0
  54. package/build/switchOption/SwitchOption.mjs.map +1 -1
  55. package/build/types/actionOption/ActionOption.d.ts +8 -0
  56. package/build/types/actionOption/ActionOption.d.ts.map +1 -1
  57. package/build/types/checkboxOption/CheckboxOption.d.ts +8 -0
  58. package/build/types/checkboxOption/CheckboxOption.d.ts.map +1 -1
  59. package/build/types/header/Header.d.ts +1 -0
  60. package/build/types/header/Header.d.ts.map +1 -1
  61. package/build/types/legacylistItem/LegacyListItem.d.ts +8 -0
  62. package/build/types/legacylistItem/LegacyListItem.d.ts.map +1 -1
  63. package/build/types/link/Link.d.ts +1 -1
  64. package/build/types/link/Link.d.ts.map +1 -1
  65. package/build/types/listItem/ListItem.d.ts +10 -1
  66. package/build/types/listItem/ListItem.d.ts.map +1 -1
  67. package/build/types/listItem/ListItemContext.d.ts +2 -1
  68. package/build/types/listItem/ListItemContext.d.ts.map +1 -1
  69. package/build/types/listItem/Navigation/ListItemNavigation.d.ts.map +1 -1
  70. package/build/types/listItem/Prompt/InlinePrompt/InlinePrompt.d.ts +15 -0
  71. package/build/types/listItem/Prompt/InlinePrompt/InlinePrompt.d.ts.map +1 -0
  72. package/build/types/listItem/Prompt/InlinePrompt/index.d.ts +3 -0
  73. package/build/types/listItem/Prompt/InlinePrompt/index.d.ts.map +1 -0
  74. package/build/types/listItem/Prompt/ListItemPrompt.d.ts +4 -6
  75. package/build/types/listItem/Prompt/ListItemPrompt.d.ts.map +1 -1
  76. package/build/types/listItem/_stories/helpers.d.ts +1 -1
  77. package/build/types/listItem/_stories/helpers.d.ts.map +1 -1
  78. package/build/types/listItem/_stories/subcomponents.d.ts +4 -0
  79. package/build/types/listItem/_stories/subcomponents.d.ts.map +1 -1
  80. package/build/types/listItem/_stories/variants/helpers.d.ts.map +1 -1
  81. package/build/types/listItem/constants.d.ts +16 -0
  82. package/build/types/listItem/constants.d.ts.map +1 -0
  83. package/build/types/listItem/useListItemControl.d.ts +1 -1
  84. package/build/types/navigationOption/NavigationOption.d.ts +8 -0
  85. package/build/types/navigationOption/NavigationOption.d.ts.map +1 -1
  86. package/build/types/navigationOptionsList/NavigationOptionsList.d.ts +9 -0
  87. package/build/types/navigationOptionsList/NavigationOptionsList.d.ts.map +1 -1
  88. package/build/types/radioOption/RadioOption.d.ts +8 -0
  89. package/build/types/radioOption/RadioOption.d.ts.map +1 -1
  90. package/build/types/summary/Summary.d.ts +8 -0
  91. package/build/types/summary/Summary.d.ts.map +1 -1
  92. package/build/types/switchOption/SwitchOption.d.ts +8 -0
  93. package/build/types/switchOption/SwitchOption.d.ts.map +1 -1
  94. package/package.json +2 -2
  95. package/src/actionOption/ActionOption.story.tsx +4 -0
  96. package/src/actionOption/ActionOption.tsx +8 -0
  97. package/src/checkboxOption/CheckboxOption.story.tsx +4 -0
  98. package/src/checkboxOption/CheckboxOption.tsx +8 -0
  99. package/src/header/Header.story.tsx +14 -0
  100. package/src/header/Header.tsx +2 -0
  101. package/src/legacylistItem/LegacyListItem.story.tsx +4 -0
  102. package/src/legacylistItem/LegacyListItem.tsx +8 -0
  103. package/src/link/Link.css +7 -0
  104. package/src/link/Link.less +8 -0
  105. package/src/link/Link.spec.tsx +28 -0
  106. package/src/link/Link.story.tsx +72 -16
  107. package/src/link/Link.tsx +5 -1
  108. package/src/listItem/ListItem.css +115 -81
  109. package/src/listItem/ListItem.grid.css +11 -3
  110. package/src/listItem/ListItem.grid.less +14 -4
  111. package/src/listItem/ListItem.less +35 -8
  112. package/src/listItem/ListItem.spec.tsx +37 -1
  113. package/src/listItem/ListItem.tsx +47 -21
  114. package/src/listItem/ListItem.vars.css +0 -0
  115. package/src/listItem/ListItem.vars.less +11 -0
  116. package/src/listItem/ListItemContext.tsx +2 -1
  117. package/src/listItem/Navigation/ListItemNavigation.spec.tsx +1 -10
  118. package/src/listItem/Navigation/ListItemNavigation.story.tsx +0 -22
  119. package/src/listItem/Navigation/ListItemNavigation.tsx +2 -3
  120. package/src/listItem/Prompt/InlinePrompt/InlinePrompt.css +153 -0
  121. package/src/listItem/Prompt/InlinePrompt/InlinePrompt.less +162 -0
  122. package/src/listItem/Prompt/InlinePrompt/InlinePrompt.spec.tsx +66 -0
  123. package/src/listItem/Prompt/InlinePrompt/InlinePrompt.tsx +56 -0
  124. package/src/listItem/Prompt/InlinePrompt/index.ts +2 -0
  125. package/src/listItem/Prompt/ListItemPrompt.css +72 -72
  126. package/src/listItem/Prompt/ListItemPrompt.less +2 -130
  127. package/src/listItem/Prompt/ListItemPrompt.spec.tsx +36 -0
  128. package/src/listItem/Prompt/ListItemPrompt.story.tsx +4 -2
  129. package/src/listItem/Prompt/ListItemPrompt.tsx +14 -14
  130. package/src/listItem/_stories/ListItem.disabled.story.tsx +433 -0
  131. package/src/listItem/_stories/ListItem.layout.test.story.tsx +10 -155
  132. package/src/listItem/_stories/ListItem.scenarios.story.tsx +4 -25
  133. package/src/listItem/_stories/ListItem.story.tsx +17 -187
  134. package/src/listItem/_stories/helpers.tsx +23 -6
  135. package/src/listItem/_stories/subcomponents.tsx +19 -2
  136. package/src/listItem/_stories/variants/ListItem.medium.test.story.tsx +1 -1
  137. package/src/listItem/_stories/variants/ListItem.neutral.test.story.tsx +55 -0
  138. package/src/listItem/_stories/variants/ListItem.small.test.story.tsx +1 -1
  139. package/src/listItem/_stories/variants/helpers.tsx +28 -1
  140. package/src/listItem/constants.ts +15 -0
  141. package/src/main.css +122 -81
  142. package/src/navigationOption/NavigationOption.story.tsx +4 -1
  143. package/src/navigationOption/NavigationOption.tsx +8 -0
  144. package/src/navigationOptionsList/NavigationOptionsList.story.tsx +4 -0
  145. package/src/navigationOptionsList/NavigationOptionsList.tsx +9 -0
  146. package/src/radioOption/RadioOption.story.tsx +4 -0
  147. package/src/radioOption/RadioOption.tsx +8 -0
  148. package/src/summary/Summary.story.tsx +4 -0
  149. package/src/summary/Summary.tsx +8 -0
  150. package/src/switchOption/SwitchOption.story.tsx +4 -1
  151. package/src/switchOption/SwitchOption.tsx +8 -0
  152. package/src/table/Table.story.tsx +1 -1
@@ -3,8 +3,10 @@ import { Meta, StoryObj } from '@storybook/react-webpack5';
3
3
  import { MultiCurrency, Plus } from '@transferwise/icons';
4
4
  import { lorem5, lorem10 } from '../../test-utils';
5
5
  import Emphasis from '../../emphasis';
6
+ import Link from '../../link';
6
7
  import List from '../../list';
7
8
  import { ListItem, type ListItemProps } from '../ListItem';
9
+ import { LISTITEM_CQ } from '../constants';
8
10
  import {
9
11
  SB_LIST_ITEM_CONTROLS as CONTROLS,
10
12
  SB_LIST_ITEM_ADDITIONAL_INFO as ADDITIONAL_INFO,
@@ -12,7 +14,6 @@ import {
12
14
  SB_LIST_ITEM_MEDIA as MEDIA,
13
15
  } from './subcomponents';
14
16
  import { disableControls, storySourceWithoutNoise, withoutKey } from './helpers';
15
- import Link from '../../link';
16
17
 
17
18
  const hideControls = disableControls([
18
19
  'additionalInfo',
@@ -46,7 +47,6 @@ export default {
46
47
  'ListItem.Image': ListItem.Image,
47
48
  },
48
49
  title: 'Content/ListItem',
49
- tags: ['early-access'],
50
50
  parameters: {
51
51
  docs: {
52
52
  toc: true,
@@ -58,6 +58,7 @@ export default {
58
58
  valueTitle: '100 GBP',
59
59
  valueSubtitle: '100 USD',
60
60
  disabled: false,
61
+ disabledPromptMessage: undefined,
61
62
  spotlight: undefined,
62
63
  inverted: false,
63
64
  valueColumnWidth: undefined,
@@ -274,19 +275,15 @@ export const Playground: StoryObj<PreviewStoryArgs> = {
274
275
  decorators: [withoutKey],
275
276
  };
276
277
 
277
- /**
278
- * ListItem uses container queries under the hood, which means its layout self-adjusts based on
279
- * the available space. At the 100% zoom level, these breakpoints correspond to
280
- * containers under `290px`, those between `291px and 380px`, and finally everything including
281
- * and above `381px`. <br />
282
- * This also supports high levels of zoom for assistive tech users.
283
- */
284
278
  export const Responsiveness: StoryObj<PreviewStoryArgs> = {
285
279
  parameters: {
286
280
  docs: {
287
281
  canvas: {
288
282
  sourceState: 'hidden',
289
283
  },
284
+ description: {
285
+ story: `ListItem uses container queries under the hood, which means its layout self-adjusts based on the available space. At the 100% zoom level, these breakpoints correspond to containers under \`${LISTITEM_CQ.MIN}px\`, those between \`${LISTITEM_CQ.MIN + 1}px and ${LISTITEM_CQ.MAX}px\`, and finally everything including and above \`${LISTITEM_CQ.MAX + 1}px\`.\n\nThis also supports high levels of zoom for assistive tech users.`,
286
+ },
290
287
  },
291
288
  },
292
289
  argTypes: {
@@ -311,7 +308,17 @@ export const Responsiveness: StoryObj<PreviewStoryArgs> = {
311
308
  <List
312
309
  as="ol"
313
310
  className="list-unstyled"
314
- style={{ display: 'grid', gridTemplateColumns: '290px 350px 381px', gap: 16 }}
311
+ style={{
312
+ display: 'grid',
313
+ gridTemplateColumns: [
314
+ LISTITEM_CQ.MIN,
315
+ Math.round((LISTITEM_CQ.MAX - LISTITEM_CQ.MIN) / 2 + LISTITEM_CQ.MIN),
316
+ 510,
317
+ ]
318
+ .map((width) => `${width}px`)
319
+ .join(' '),
320
+ gap: 16,
321
+ }}
315
322
  >
316
323
  <ListItem {...props} {...previewProps} />
317
324
  <ListItem {...props} {...previewProps} />
@@ -558,183 +565,6 @@ export const Interactivity: StoryObj<PreviewStoryArgs> = storySourceWithoutNoise
558
565
  },
559
566
  });
560
567
 
561
- /**
562
- * While most disabled states will show as grayed out, the navigation control switches from chevron
563
- * to a new icon for improved user experience and accessibility. <br />
564
- * For the same reason, only the control part of the List Item is dimmed, while all the content
565
- * retains high contrast and interactivity.
566
- *
567
- * Please refer to the [design documentation](https://wise.design/components/list-item#accessibility:~:text=-,Disabled%20states,-) for more details
568
- */
569
- export const Disabled: Story = {
570
- parameters: {
571
- docs: {
572
- canvas: {
573
- sourceState: 'hidden',
574
- },
575
- },
576
- controls: { disable: true },
577
- knobs: { disable: true },
578
- },
579
- render: (args) => (
580
- <List>
581
- <ListItem
582
- disabled
583
- media={
584
- <ListItem.AvatarView>
585
- <MultiCurrency />
586
- </ListItem.AvatarView>
587
- }
588
- title="Navigation"
589
- subtitle={lorem5}
590
- control={<ListItem.Navigation onClick={() => {}} />}
591
- />
592
- <ListItem
593
- disabled
594
- media={
595
- <ListItem.AvatarView>
596
- <MultiCurrency />
597
- </ListItem.AvatarView>
598
- }
599
- title="Button secondary neutral"
600
- subtitle={lorem5}
601
- control={<ListItem.Button priority="secondary-neutral">Secondary Neutral</ListItem.Button>}
602
- />
603
- <ListItem
604
- disabled
605
- media={
606
- <ListItem.AvatarView>
607
- <MultiCurrency />
608
- </ListItem.AvatarView>
609
- }
610
- title="Button primary"
611
- subtitle={lorem5}
612
- control={<ListItem.Button priority="primary">Primary</ListItem.Button>}
613
- />
614
- <ListItem
615
- disabled
616
- media={
617
- <ListItem.AvatarView>
618
- <MultiCurrency />
619
- </ListItem.AvatarView>
620
- }
621
- title="Button tertiary"
622
- subtitle={lorem5}
623
- control={<ListItem.Button priority="tertiary">Tertiary</ListItem.Button>}
624
- />
625
- <ListItem
626
- disabled
627
- media={
628
- <ListItem.AvatarView>
629
- <MultiCurrency />
630
- </ListItem.AvatarView>
631
- }
632
- title="Icon Button"
633
- subtitle={lorem5}
634
- control={
635
- <ListItem.IconButton>
636
- <Plus />
637
- </ListItem.IconButton>
638
- }
639
- />
640
- <ListItem
641
- disabled
642
- media={
643
- <ListItem.AvatarView>
644
- <MultiCurrency />
645
- </ListItem.AvatarView>
646
- }
647
- title="Checkbox"
648
- subtitle={lorem5}
649
- control={<ListItem.Checkbox />}
650
- />
651
- <ListItem
652
- disabled
653
- media={
654
- <ListItem.AvatarView>
655
- <MultiCurrency />
656
- </ListItem.AvatarView>
657
- }
658
- title="Checkbox checked"
659
- subtitle={lorem5}
660
- control={<ListItem.Checkbox checked />}
661
- />
662
- <ListItem
663
- disabled
664
- media={
665
- <ListItem.AvatarView>
666
- <MultiCurrency />
667
- </ListItem.AvatarView>
668
- }
669
- title="Checkbox indeterminate"
670
- subtitle={lorem5}
671
- control={<ListItem.Checkbox indeterminate />}
672
- />
673
- <ListItem
674
- disabled
675
- media={
676
- <ListItem.AvatarView>
677
- <MultiCurrency />
678
- </ListItem.AvatarView>
679
- }
680
- title="Switch on"
681
- subtitle={lorem5}
682
- control={<ListItem.Switch checked onClick={() => {}} />}
683
- />
684
- <ListItem
685
- disabled
686
- media={
687
- <ListItem.AvatarView>
688
- <MultiCurrency />
689
- </ListItem.AvatarView>
690
- }
691
- title="Switch off"
692
- subtitle={lorem5}
693
- control={<ListItem.Switch onClick={() => {}} />}
694
- />
695
- <ListItem
696
- disabled
697
- media={
698
- <ListItem.AvatarView>
699
- <MultiCurrency />
700
- </ListItem.AvatarView>
701
- }
702
- title="Switch off"
703
- subtitle={lorem5}
704
- control={<ListItem.Radio name="radio" checked />}
705
- />
706
- <ListItem
707
- disabled
708
- media={
709
- <ListItem.AvatarView>
710
- <MultiCurrency />
711
- </ListItem.AvatarView>
712
- }
713
- title="Switch off"
714
- subtitle={lorem5}
715
- control={<ListItem.Radio name="radios" />}
716
- />
717
- <ListItem
718
- disabled
719
- media={
720
- <ListItem.AvatarView>
721
- <MultiCurrency />
722
- </ListItem.AvatarView>
723
- }
724
- title="Switch off"
725
- subtitle={lorem5}
726
- additionalInfo={ADDITIONAL_INFO.interactive}
727
- prompt={PROMPTS.interactive}
728
- control={
729
- <ListItem.Button partiallyInteractive onClick={() => {}}>
730
- Click me
731
- </ListItem.Button>
732
- }
733
- />
734
- </List>
735
- ),
736
- };
737
-
738
568
  /**
739
569
  * For backwards compatibility, all of the ListItem's content elements accept `ReactNode`.
740
570
  * That said, most of them should be fed with plain text only. The exception is `valueTitle`
@@ -1,5 +1,6 @@
1
1
  import { StoryObj, type Decorator } from '@storybook/react-webpack5';
2
2
  import type { ListItemProps } from '../ListItem';
3
+ import { LISTITEM_CQ } from '../constants';
3
4
 
4
5
  type Story = StoryObj<ListItemProps>;
5
6
 
@@ -42,6 +43,7 @@ export const withoutKey: Decorator = (Story, { args }) => {
42
43
  const key = [
43
44
  args.previewInteractivity,
44
45
  args?.disabled ? 'disabled' : 'enabled',
46
+ args?.disabledPromptMessage ? 'withReason' : 'withoutReason',
45
47
  args?.inverted ? 'desc' : 'asc',
46
48
  ].join('-');
47
49
 
@@ -49,12 +51,27 @@ export const withoutKey: Decorator = (Story, { args }) => {
49
51
  };
50
52
 
51
53
  export const withSizedContainer =
52
- (width: number): Decorator =>
53
- (Story, { args }) => (
54
- <div style={{ width, border: '1px dashed #ccc', padding: '8px' }}>
55
- <Story />
56
- </div>
57
- );
54
+ (size: 'small' | 'medium' | 'large' | number = 'large', border = true): Decorator =>
55
+ (Story, { args }) => {
56
+ const width =
57
+ typeof size === 'number'
58
+ ? size
59
+ : {
60
+ small: LISTITEM_CQ.MIN,
61
+ medium: Math.round((LISTITEM_CQ.MAX - LISTITEM_CQ.MIN) / 2 + LISTITEM_CQ.MIN),
62
+ large: LISTITEM_CQ.MAX + 1,
63
+ }[size];
64
+ return (
65
+ <div
66
+ style={{
67
+ width,
68
+ border: border ? '1px dashed #ccc' : undefined,
69
+ }}
70
+ >
71
+ <Story />
72
+ </div>
73
+ );
74
+ };
58
75
 
59
76
  /**
60
77
  * Not all stories need access to all controls as it causes unnecessary UI noise.
@@ -1,9 +1,10 @@
1
1
  import { ReactNode } from 'react';
2
2
  import { Edit, Briefcase, Plane } from '@transferwise/icons';
3
- import { ListItem } from '../ListItem';
4
3
  import { fn } from 'storybook/test';
5
- import Link from '../../link';
6
4
  import { Flag } from '@wise/art';
5
+ import { lorem20 } from '../../test-utils';
6
+ import Link from '../../link';
7
+ import { ListItem } from '../ListItem';
7
8
 
8
9
  export type SB_ListItem_ControlType =
9
10
  | 'non-interactive'
@@ -30,6 +31,17 @@ export const SB_LIST_ITEM_TEXT = {
30
31
  subtitle: 'And it also has a subtitle',
31
32
  valueTitle: '100 GBP',
32
33
  valueSubtitle: '200 USD',
34
+ longTitle: `This is a long title. ${lorem20}`,
35
+ longSubtitle: `And it also has a long subtitle. ${lorem20}`,
36
+ longValueTitle: (
37
+ <>
38
+ This value title
39
+ <br />
40
+ is made to span
41
+ <br />
42
+ across few lines
43
+ </>
44
+ ),
33
45
  };
34
46
 
35
47
  export const SB_LIST_ITEM_CONTROLS: Record<SB_ListItem_ControlType, ReactNode> = {
@@ -132,6 +144,11 @@ export const SB_LIST_ITEM_MEDIA = {
132
144
  src="https://wise.com/public-resources/assets/spend/card-asset/medium/v2/personal_green_wise_2023_active.svg"
133
145
  />
134
146
  ),
147
+ avatarFlag: (
148
+ <ListItem.AvatarView>
149
+ <Flag code="de" />
150
+ </ListItem.AvatarView>
151
+ ),
135
152
  avatarSingle: (
136
153
  <ListItem.AvatarView>
137
154
  <Briefcase />
@@ -12,7 +12,7 @@ export default {
12
12
  actions: { disable: true },
13
13
  knobs: { disable: true },
14
14
  },
15
- decorators: [withSizedContainer(350)],
15
+ decorators: [withSizedContainer('medium')],
16
16
  } satisfies Meta<ListItemProps>;
17
17
 
18
18
  export const Button = generateVariantsForControl('button');
@@ -0,0 +1,55 @@
1
+ import { Meta, StoryObj } from '@storybook/react-webpack5';
2
+ import List from '../../../list';
3
+ import { ListItem, type ListItemProps } from '../../ListItem';
4
+ import {
5
+ SB_LIST_ITEM_ADDITIONAL_INFO as INFO,
6
+ SB_LIST_ITEM_CONTROLS as CONTROLS,
7
+ SB_LIST_ITEM_MEDIA as MEDIA,
8
+ SB_LIST_ITEM_PROMPTS as PROMPT,
9
+ SB_LIST_ITEM_TEXT as TEXT,
10
+ SB_ListItem_ControlType as ControlType,
11
+ } from '../subcomponents';
12
+
13
+ export default {
14
+ component: ListItem,
15
+ title: 'Content/ListItem/tests/variants/surface: neutral',
16
+ tags: ['!autodocs'],
17
+ parameters: {
18
+ controls: { disable: true },
19
+ actions: { disable: true },
20
+ knobs: { disable: true },
21
+ padding: '0',
22
+ },
23
+ decorators: [
24
+ (Story) => (
25
+ <div
26
+ style={{
27
+ backgroundColor: 'var(--color-background-neutral)',
28
+ padding: 80,
29
+ minHeight: '100%',
30
+ }}
31
+ >
32
+ <Story />
33
+ </div>
34
+ ),
35
+ ],
36
+ } satisfies Meta<ListItemProps>;
37
+
38
+ type Story = StoryObj<ListItemProps>;
39
+
40
+ export const OnNeutralBackdrop: Story = {
41
+ render: () => (
42
+ <List>
43
+ <ListItem
44
+ title={TEXT.title}
45
+ subtitle={TEXT.subtitle}
46
+ valueTitle={TEXT.valueTitle}
47
+ valueSubtitle={TEXT.valueSubtitle}
48
+ additionalInfo={INFO.nonInteractive}
49
+ control={CONTROLS.button}
50
+ prompt={PROMPT.nonInteractive}
51
+ media={MEDIA.avatarDouble}
52
+ />
53
+ </List>
54
+ ),
55
+ };
@@ -12,7 +12,7 @@ export default {
12
12
  actions: { disable: true },
13
13
  knobs: { disable: true },
14
14
  },
15
- decorators: [withSizedContainer(275)],
15
+ decorators: [withSizedContainer('small')],
16
16
  } satisfies Meta<ListItemProps>;
17
17
 
18
18
  export const Button = generateVariantsForControl('button');
@@ -14,7 +14,8 @@ import {
14
14
  type Story = StoryObj<ListItemProps>;
15
15
  type VariantPartial = { title: string } & Partial<ListItemProps>;
16
16
 
17
- const { title, subtitle, valueTitle, valueSubtitle } = TEXT;
17
+ const { title, subtitle, valueTitle, valueSubtitle, longTitle, longSubtitle, longValueTitle } =
18
+ TEXT;
18
19
  const prompt = PROMPT.nonInteractive;
19
20
  const media = MEDIA.avatarSingle;
20
21
 
@@ -32,18 +33,36 @@ export const generateVariantsForControl = (
32
33
  const additionalInfo = isInteractive ? INFO.interactive : INFO.nonInteractive;
33
34
  const instances = [
34
35
  { title },
36
+ { title: longTitle },
35
37
  { title, valueTitle },
38
+ { title, valueTitle: longValueTitle },
39
+ { title: longTitle, valueTitle },
36
40
  { title, subtitle },
41
+ { title, subtitle: longSubtitle },
37
42
  { title, additionalInfo },
38
43
  { title, valueTitle, valueSubtitle },
44
+ { title, valueTitle: longValueTitle, valueSubtitle },
39
45
  { title, subtitle, inverted: true },
40
46
  { title, subtitle, valueTitle },
41
47
  { title, subtitle, valueTitle, inverted: true },
42
48
  { title, subtitle, valueTitle, valueSubtitle },
49
+ {
50
+ title: longTitle,
51
+ subtitle: longSubtitle,
52
+ valueTitle,
53
+ valueSubtitle,
54
+ additionalInfo: INFO.nonInteractive,
55
+ },
43
56
  { title, subtitle, valueTitle, valueSubtitle, inverted: true },
44
57
  { media, title },
58
+ { media, title: longTitle },
45
59
  { media, title, valueTitle },
60
+ { media, title: longTitle, valueTitle },
61
+ { media, title: longTitle, valueSubtitle },
62
+ { media, title, valueTitle: longValueTitle },
63
+ { media, title, valueTitle: longValueTitle, valueSubtitle },
46
64
  { media, title, subtitle },
65
+ { media, title: longTitle, subtitle },
47
66
  { media, title, valueTitle, valueSubtitle },
48
67
  { media, title, valueTitle },
49
68
  { media, title, valueSubtitle },
@@ -55,6 +74,14 @@ export const generateVariantsForControl = (
55
74
  isInteractive ? { media, title, subtitle, additionalInfo: INFO.interactive } : null,
56
75
  { media, title, subtitle, additionalInfo, valueTitle },
57
76
  { media, title, subtitle, additionalInfo, valueTitle, valueSubtitle },
77
+ {
78
+ media,
79
+ title: longTitle,
80
+ subtitle: longSubtitle,
81
+ valueTitle,
82
+ valueSubtitle,
83
+ additionalInfo: INFO.nonInteractive,
84
+ },
58
85
  { media, title, subtitle, additionalInfo, valueTitle, valueSubtitle, prompt },
59
86
  {
60
87
  media,
@@ -0,0 +1,15 @@
1
+ /**
2
+ * List item has 3 unique layouts managed through container queries:
3
+ * 1. width <= cq-min
4
+ * 2. cq-min < width <= cq-max
5
+ * 3. width > cq-max
6
+ *
7
+ * ⚠️ NB: These values must be kept in sync with:
8
+ * `packages/components/src/listItem/ListItem.vars.less`
9
+ *
10
+ * @see https://storybook.wise.design/?path=/story/content-listitem--responsiveness
11
+ */
12
+ export const LISTITEM_CQ = {
13
+ MIN: 240,
14
+ MAX: 308,
15
+ } as const;