@transferwise/components 0.0.0-experimental-a12c97e → 0.0.0-experimental-e1870f3

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 (52) hide show
  1. package/build/flowNavigation/animatedLabel/AnimatedLabel.js +2 -2
  2. package/build/flowNavigation/animatedLabel/AnimatedLabel.js.map +1 -1
  3. package/build/flowNavigation/animatedLabel/AnimatedLabel.mjs +2 -2
  4. package/build/flowNavigation/animatedLabel/AnimatedLabel.mjs.map +1 -1
  5. package/build/index.js +2 -2
  6. package/build/index.mjs +1 -1
  7. package/build/{legacylistItem → listItem}/List.js +3 -2
  8. package/build/listItem/List.js.map +1 -0
  9. package/build/{legacylistItem → listItem}/List.mjs +3 -2
  10. package/build/listItem/List.mjs.map +1 -0
  11. package/build/switch/Switch.js.map +1 -1
  12. package/build/switch/Switch.mjs.map +1 -1
  13. package/build/types/index.d.ts +4 -4
  14. package/build/types/index.d.ts.map +1 -1
  15. package/build/types/legacylistItem/index.d.ts +0 -2
  16. package/build/types/legacylistItem/index.d.ts.map +1 -1
  17. package/build/types/listItem/List.d.ts +7 -0
  18. package/build/types/listItem/List.d.ts.map +1 -0
  19. package/build/types/listItem/index.d.ts +2 -0
  20. package/build/types/listItem/index.d.ts.map +1 -1
  21. package/build/types/switch/Switch.d.ts +1 -1
  22. package/build/types/switch/Switch.d.ts.map +1 -1
  23. package/package.json +3 -3
  24. package/src/flowNavigation/animatedLabel/AnimatedLabel.tsx +1 -1
  25. package/src/index.ts +9 -4
  26. package/src/legacylistItem/LegacyListItem.story.tsx +2 -2
  27. package/src/legacylistItem/LegacyListItem.tests.story.tsx +2 -1
  28. package/src/legacylistItem/index.ts +0 -2
  29. package/src/listItem/AdditionalInfo/ListItemAdditionalInfo.story.tsx +8 -58
  30. package/src/listItem/AvatarLayout/ListItemAvatarLayout.story.tsx +5 -7
  31. package/src/listItem/AvatarView/ListItemAvatarView.story.tsx +8 -25
  32. package/src/listItem/Button/ListItemButton.story.tsx +46 -103
  33. package/src/listItem/Checkbox/ListItemCheckbox.story.tsx +0 -18
  34. package/src/listItem/IconButton/ListItemIconButton.story.tsx +8 -21
  35. package/src/listItem/List.tsx +11 -0
  36. package/src/listItem/Navigation/ListItemNavigation.story.tsx +2 -5
  37. package/src/listItem/Prompt/ListItemPrompt.story.tsx +7 -7
  38. package/src/listItem/Radio/ListItemRadio.story.tsx +0 -10
  39. package/src/listItem/Switch/ListItemSwitch.story.tsx +3 -10
  40. package/src/listItem/_stories/ListItem.scenarios.story.tsx +30 -13
  41. package/src/listItem/_stories/ListItem.story.tsx +142 -206
  42. package/src/listItem/_stories/ListItem.variants.test.story.tsx +5 -4
  43. package/src/listItem/index.ts +3 -0
  44. package/src/switch/Switch.tsx +1 -1
  45. package/build/legacylistItem/List.js.map +0 -1
  46. package/build/legacylistItem/List.mjs.map +0 -1
  47. package/build/types/legacylistItem/List.d.ts +0 -6
  48. package/build/types/legacylistItem/List.d.ts.map +0 -1
  49. package/build/types/listItem/_stories/helpers.d.ts +0 -27
  50. package/build/types/listItem/_stories/helpers.d.ts.map +0 -1
  51. package/src/legacylistItem/List.tsx +0 -10
  52. package/src/listItem/_stories/helpers.tsx +0 -53
@@ -23,13 +23,6 @@ const meta: Meta<ListItemRadioProps> = {
23
23
  checked: false,
24
24
  onChange: fn(),
25
25
  },
26
- argTypes: {
27
- onChange: {
28
- table: {
29
- type: { summary: '(value: string | number) => void' },
30
- },
31
- },
32
- },
33
26
  } satisfies Meta<ListItemRadioProps>;
34
27
 
35
28
  export default meta;
@@ -55,9 +48,6 @@ export const Playground: Story = {
55
48
  * Radio controls follow the native HTML behaviour and can be grouped using the `name` prop.
56
49
  */
57
50
  export const RadioGroup: Story = {
58
- parameters: {
59
- controls: { disable: true },
60
- },
61
51
  render: function Render() {
62
52
  const [selectedValue, setSelectedValue] = useState('2');
63
53
 
@@ -8,6 +8,7 @@ import {
8
8
  import type { ListItemSwitchProps } from './ListItemSwitch';
9
9
  import { fn } from 'storybook/test';
10
10
  import { lorem10, lorem5 } from '../../test-utils';
11
+ import { List } from '../List';
11
12
 
12
13
  const meta: Meta<ListItemSwitchProps> = {
13
14
  component: ListItem.Switch,
@@ -25,11 +26,6 @@ const meta: Meta<ListItemSwitchProps> = {
25
26
  checked: {
26
27
  control: 'boolean',
27
28
  },
28
- onClick: {
29
- table: {
30
- type: { summary: '(event?: MouseEvent<HTMLButtonElement>) => void' },
31
- },
32
- },
33
29
  },
34
30
  } satisfies Meta<ListItemSwitchProps>;
35
31
 
@@ -53,12 +49,9 @@ export const Playground: Story = {
53
49
  };
54
50
 
55
51
  export const States: Story = {
56
- parameters: {
57
- controls: { disable: true },
58
- },
59
52
  render: (args) => {
60
53
  return (
61
- <ol className="list-unstyled">
54
+ <List as="ol">
62
55
  <ListItem
63
56
  title={lorem5}
64
57
  subtitle={lorem10}
@@ -71,7 +64,7 @@ export const States: Story = {
71
64
  media={MEDIA.avatarSingle}
72
65
  control={<ListItem.Switch {...args} />}
73
66
  />
74
- </ol>
67
+ </List>
75
68
  );
76
69
  },
77
70
  };
@@ -12,7 +12,6 @@ import SnackbarProvider from '../../snackbar/SnackbarProvider';
12
12
  import Tooltip from '../../tooltip';
13
13
  import { Position } from '../../common';
14
14
  import { ListItem, type Props as ItemProps } from '../ListItem';
15
- import { storySourceWithoutNoise } from './helpers';
16
15
  import {
17
16
  SB_LIST_ITEM_ADDITIONAL_INFO as INFO,
18
17
  SB_LIST_ITEM_CONTROLS as CONTROLS,
@@ -20,6 +19,36 @@ import {
20
19
  SB_LIST_ITEM_PROMPTS as PROMPTS,
21
20
  } from './subcomponents';
22
21
 
22
+ /**
23
+ * Recent storybook versions render the full source including all story parameters which
24
+ * creates noise, this simple workaround only shows the render function.
25
+ * This is a workaround for the issue.
26
+ * @see https://github.com/storybookjs/storybook/issues/22281
27
+ */
28
+ const storySourceWithoutNoise = (config: Story): Story => {
29
+ const newConfig: Story = {
30
+ ...config,
31
+ parameters: {
32
+ ...config.parameters,
33
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
34
+ docs: {
35
+ ...config.parameters?.docs,
36
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
37
+ source: {
38
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
39
+ ...config.parameters?.docs?.source,
40
+ type: 'code' as const,
41
+ transform: (code: string) =>
42
+ // eslint-disable-next-line regexp/no-super-linear-backtracking
43
+ code.replace(/storySourceWithoutNoise\(\{\s+render\s?:\s+(.*)\}\)$/gms, '$1'),
44
+ },
45
+ },
46
+ },
47
+ };
48
+
49
+ return newConfig;
50
+ };
51
+
23
52
  export default {
24
53
  component: ListItem,
25
54
  title: 'Content/ListItem/common scenarios',
@@ -54,9 +83,6 @@ type Story = StoryObj<ItemProps>;
54
83
  * or `<ListItem.Prompt>`.
55
84
  */
56
85
  export const WithModals: Story = storySourceWithoutNoise({
57
- parameters: {
58
- controls: { disable: true },
59
- },
60
86
  render: function WithModals(listItemProps) {
61
87
  const [isModalOpen, setIsModalOpen] = useState(false);
62
88
 
@@ -105,9 +131,6 @@ export const WithModals: Story = storySourceWithoutNoise({
105
131
  * The control or inline buttons can trigger a [Popover](?path=/docs/dialogs-popover--docs).
106
132
  */
107
133
  export const WithPopover: Story = {
108
- parameters: {
109
- controls: { disable: true },
110
- },
111
134
  render: (listItemProps) => {
112
135
  return (
113
136
  <ListItem
@@ -129,9 +152,6 @@ export const WithPopover: Story = {
129
152
  * The control or inline buttons can trigger a [Tooltip](?path=/docs/dialogs-tooltip--docs).
130
153
  */
131
154
  export const WithTooltip: Story = {
132
- parameters: {
133
- controls: { disable: true },
134
- },
135
155
  render: (listItemProps) => {
136
156
  return (
137
157
  <ListItem
@@ -156,9 +176,6 @@ export const WithTooltip: Story = {
156
176
  * which may not be suitable or sufficient for your needs.
157
177
  */
158
178
  export const CopyAndPasteWithSnackbar: Story = storySourceWithoutNoise({
159
- parameters: {
160
- controls: { disable: true },
161
- },
162
179
  render: function CopyAndPaste() {
163
180
  const title = 'Artie Choke';
164
181
  const subtitle = 'Account holder';
@@ -10,20 +10,7 @@ import {
10
10
  SB_LIST_ITEM_PROMPTS as PROMPTS,
11
11
  SB_LIST_ITEM_MEDIA as MEDIA,
12
12
  } from './subcomponents';
13
- import { disableControls, storySourceWithoutNoise, withoutKey } from './helpers';
14
- import Link from '../../link';
15
-
16
- const hideControls = disableControls([
17
- 'additionalInfo',
18
- 'control',
19
- 'prompt',
20
- 'media',
21
- 'className',
22
- 'id',
23
- 'role',
24
- 'aria-labelledby',
25
- 'as',
26
- ]);
13
+ import { List } from '../List';
27
14
 
28
15
  /**
29
16
  * List Items let users review or select options from a dynamic list.<br />
@@ -256,9 +243,9 @@ export const Playground: StoryObj<PreviewStoryArgs> = {
256
243
  const [props, previewProps] = getPropsForPreview(args);
257
244
 
258
245
  return (
259
- <ol className="list-unstyled">
246
+ <List key={args.disabled ? 'disabled' : 'enabled'} as="ol">
260
247
  <ListItem {...props} {...previewProps} />
261
- </ol>
248
+ </List>
262
249
  );
263
250
  },
264
251
  argTypes: previewArgTypes,
@@ -271,17 +258,16 @@ export const Playground: StoryObj<PreviewStoryArgs> = {
271
258
  previewAdditionalInfoFull: 'non-interactive',
272
259
  previewAdditionalInfoPartial: 'non-interactive',
273
260
  },
274
- decorators: [withoutKey],
275
261
  };
276
262
 
277
263
  /**
278
264
  * ListItem uses container queries under the hood, which means its layout self-adjusts based on
279
265
  * 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 />
266
+ * containers under `320px`, those between `321px and 399px`, and finally everything including
267
+ * and above `400px`. <br />
282
268
  * This also supports high levels of zoom for assistive tech users.
283
269
  */
284
- export const Responsiveness: StoryObj<PreviewStoryArgs> = {
270
+ export const Responsiveness: Story = {
285
271
  parameters: {
286
272
  docs: {
287
273
  canvas: {
@@ -289,32 +275,42 @@ export const Responsiveness: StoryObj<PreviewStoryArgs> = {
289
275
  },
290
276
  },
291
277
  },
292
- argTypes: {
293
- ...hideControls(),
294
- ...previewArgTypes,
295
- },
296
- args: {
297
- subtitle: lorem10,
298
- previewInteractivity: 'fully-interactive',
299
- previewPrompt: 'interactive',
300
- previewMedia: 'image',
301
- previewControlFull: 'Button',
302
- previewControlPartial: 'Button',
303
- previewAdditionalInfoFull: 'non-interactive',
304
- previewAdditionalInfoPartial: 'non-interactive',
305
- },
306
- decorators: [withoutKey],
307
278
  render: (args) => {
308
- const [props, previewProps] = getPropsForPreview(args);
309
-
310
279
  return (
311
280
  <ol
312
281
  className="list-unstyled"
313
282
  style={{ display: 'grid', gridTemplateColumns: '290px 350px 381px', gap: 16 }}
314
283
  >
315
- <ListItem {...props} {...previewProps} />
316
- <ListItem {...props} {...previewProps} />
317
- <ListItem {...props} {...previewProps} />
284
+ <div style={{ width: '290px' }}>
285
+ <ListItem
286
+ {...args}
287
+ subtitle={lorem10}
288
+ additionalInfo={ADDITIONAL_INFO.nonInteractive}
289
+ control={CONTROLS.button}
290
+ media={MEDIA.image}
291
+ prompt={PROMPTS.interactive}
292
+ />
293
+ </div>
294
+ <div style={{ width: '350px' }}>
295
+ <ListItem
296
+ {...args}
297
+ subtitle={lorem10}
298
+ additionalInfo={ADDITIONAL_INFO.nonInteractive}
299
+ control={CONTROLS.button}
300
+ media={MEDIA.image}
301
+ prompt={PROMPTS.interactive}
302
+ />
303
+ </div>
304
+ <div style={{ width: '381px' }}>
305
+ <ListItem
306
+ {...args}
307
+ subtitle={lorem10}
308
+ additionalInfo={<div />}
309
+ control={CONTROLS.button}
310
+ media={MEDIA.image}
311
+ prompt={PROMPTS.interactive}
312
+ />
313
+ </div>
318
314
  </ol>
319
315
  );
320
316
  },
@@ -333,7 +329,7 @@ export const Responsiveness: StoryObj<PreviewStoryArgs> = {
333
329
  * **NB:** This behaviour is slightly different on mobile platforms as they have more control over
334
330
  * layout calculations.
335
331
  */
336
- export const ContentRatio: StoryObj<PreviewStoryArgs> = {
332
+ export const ContentRatio: Story = {
337
333
  parameters: {
338
334
  docs: {
339
335
  canvas: {
@@ -342,56 +338,45 @@ export const ContentRatio: StoryObj<PreviewStoryArgs> = {
342
338
  },
343
339
  },
344
340
  args: {
345
- valueColumnWidth: 70,
346
- subtitle: lorem5,
347
341
  valueTitle: `${lorem5} ${lorem5}`,
348
342
  valueSubtitle: lorem5,
349
- previewInteractivity: 'fully-interactive',
350
- previewPrompt: 'interactive',
351
- previewMedia: 'image',
352
- previewControlFull: 'Button',
353
- previewControlPartial: 'Button',
354
- previewAdditionalInfoFull: 'non-interactive',
355
- previewAdditionalInfoPartial: 'non-interactive',
356
- as: 'div',
357
- },
358
- argTypes: {
359
- ...hideControls(['disabled', 'spotlight']),
360
- ...previewArgTypes,
343
+ valueColumnWidth: 70,
361
344
  },
362
345
  render: (args) => {
363
- const [props, previewProps] = getPropsForPreview(args);
364
-
365
- return <ListItem {...props} {...previewProps} />;
346
+ return (
347
+ <ListItem
348
+ {...args}
349
+ subtitle={lorem5}
350
+ additionalInfo={ADDITIONAL_INFO.nonInteractive}
351
+ control={CONTROLS.button}
352
+ media={MEDIA.image}
353
+ prompt={PROMPTS.interactive}
354
+ />
355
+ );
366
356
  },
367
357
  };
368
358
 
369
359
  /**
370
360
  * List item supports default and inverted title and description to allow for further flexibility
371
- * in the component. No other content elements are affected by this prop.
361
+ * in the component.
372
362
  *
373
363
  * Refer to the [design documentation](https://wise.design/components/list-item#content-hierarchy) for more details.
374
364
  */
375
- export const ContentHierarchy: StoryObj<PreviewStoryArgs> = {
365
+ export const ContentHierarchy: Story = {
376
366
  args: {
377
367
  inverted: true,
378
- previewInteractivity: 'fully-interactive',
379
- previewPrompt: 'interactive',
380
- previewMedia: 'image',
381
- previewControlFull: 'Button',
382
- previewControlPartial: 'Button',
383
- previewAdditionalInfoFull: 'non-interactive',
384
- previewAdditionalInfoPartial: 'non-interactive',
385
- as: 'div',
386
- },
387
- argTypes: {
388
- ...hideControls(['valueColumnWidth', 'disabled']),
389
- ...previewArgTypes,
390
368
  },
391
369
  render: (args) => {
392
- const [props, previewProps] = getPropsForPreview(args);
393
-
394
- return <ListItem {...props} {...previewProps} />;
370
+ return (
371
+ <ListItem
372
+ {...args}
373
+ subtitle={lorem10}
374
+ additionalInfo={ADDITIONAL_INFO.nonInteractive}
375
+ control={CONTROLS.button}
376
+ media={MEDIA.image}
377
+ prompt={PROMPTS.interactive}
378
+ />
379
+ );
395
380
  },
396
381
  };
397
382
 
@@ -400,29 +385,28 @@ export const ContentHierarchy: StoryObj<PreviewStoryArgs> = {
400
385
  *
401
386
  * Refer to the [design documentation](https://wise.design/components/list-item#spotlight) for more details.
402
387
  */
403
- export const Spotlight: StoryObj<PreviewStoryArgs> = {
404
- argTypes: {
405
- ...hideControls(['spotlight', 'valueColumnWidth']),
406
- ...previewArgTypes,
407
- },
408
- args: {
409
- subtitle: lorem10,
410
- previewInteractivity: 'fully-interactive',
411
- previewPrompt: 'interactive',
412
- previewMedia: 'image',
413
- previewControlFull: 'Button',
414
- previewControlPartial: 'Button',
415
- previewAdditionalInfoFull: 'non-interactive',
416
- previewAdditionalInfoPartial: 'non-interactive',
417
- },
418
- decorators: [withoutKey],
388
+ export const Spotlight: Story = {
419
389
  render: (args) => {
420
- const [props, previewProps] = getPropsForPreview(args);
421
-
422
390
  return (
423
391
  <ol className="list-unstyled">
424
- <ListItem {...props} {...previewProps} spotlight="inactive" />
425
- <ListItem {...props} {...previewProps} spotlight="active" />
392
+ <ListItem
393
+ {...args}
394
+ subtitle={lorem10}
395
+ additionalInfo={ADDITIONAL_INFO.nonInteractive}
396
+ control={CONTROLS.button}
397
+ media={MEDIA.image}
398
+ prompt={PROMPTS.interactive}
399
+ spotlight="inactive"
400
+ />
401
+ <ListItem
402
+ {...args}
403
+ subtitle={lorem10}
404
+ additionalInfo={ADDITIONAL_INFO.nonInteractive}
405
+ control={CONTROLS.button}
406
+ media={MEDIA.image}
407
+ prompt={PROMPTS.interactive}
408
+ spotlight="active"
409
+ />
426
410
  </ol>
427
411
  );
428
412
  },
@@ -445,116 +429,74 @@ export const Spotlight: StoryObj<PreviewStoryArgs> = {
445
429
  *
446
430
  * Please refer to the [design documentation](https://wise.design/components/list-item#interaction) for more details.
447
431
  */
448
- export const Interactivity: StoryObj<PreviewStoryArgs> = storySourceWithoutNoise({
449
- argTypes: {
450
- ...hideControls([
451
- 'title',
452
- 'subtitle',
453
- 'valueTitle',
454
- 'valueSubtitle',
455
- 'valueColumnWidth',
456
- 'inverted',
457
- ]),
458
- },
459
- args: {
460
- subtitle: lorem10,
461
- },
462
- decorators: [withoutKey],
463
- render: function Render(args) {
432
+ export const Interactivity: Story = {
433
+ render: function Render() {
464
434
  const [clicked, setClicked] = useState(0);
465
435
 
466
- const renderPrompt = () => (
467
- <ListItem.Prompt sentiment="positive">
468
- Finally, there is a prompt{' '}
469
- <Link href="https://wise.com" target="_blank" rel="noreferrer">
470
- referencing some details
471
- </Link>{' '}
472
- for your convenience.
473
- </ListItem.Prompt>
474
- );
475
-
476
- const renderInteractiveInfo = () => (
477
- <ListItem.AdditionalInfo
478
- action={{
479
- label: 'Details about the subject.',
480
- href: 'https://wise.com',
481
- target: '_blank',
482
- }}
483
- >
484
- Which is augmented with additional info.
485
- </ListItem.AdditionalInfo>
486
- );
487
-
488
- const renderStaticInfo = () => (
489
- <ListItem.AdditionalInfo>Which is augmented with additional info.</ListItem.AdditionalInfo>
490
- );
491
-
492
436
  return (
493
437
  <>
494
438
  <label>Count: {clicked}</label>
495
- <ol className="list-unstyled">
496
- <ListItem
497
- {...args}
498
- title="Fully interactive"
499
- control={
500
- <ListItem.Button
501
- priority="secondary-neutral"
502
- onClick={() => setClicked((current) => current + 1)}
503
- >
504
- as Button
505
- </ListItem.Button>
506
- }
507
- additionalInfo={renderStaticInfo()}
508
- prompt={renderPrompt()}
509
- />
510
- <ListItem
511
- {...args}
512
- title="Partially interactive"
513
- control={
514
- <ListItem.Button
515
- priority="secondary-neutral"
516
- partiallyInteractive
517
- onClick={() => setClicked((current) => current + 1)}
518
- >
519
- as Button
520
- </ListItem.Button>
521
- }
522
- additionalInfo={renderInteractiveInfo()}
523
- prompt={renderPrompt()}
524
- />
525
- <ListItem
526
- {...args}
527
- title="Fully interactive"
528
- control={
529
- <ListItem.IconButton
530
- aria-label="Add something to me"
531
- onClick={() => setClicked((current) => current + 1)}
532
- >
533
- <Plus />
534
- </ListItem.IconButton>
535
- }
536
- additionalInfo={renderStaticInfo()}
537
- prompt={renderPrompt()}
538
- />
539
- <ListItem
540
- {...args}
541
- title="Partially interactive"
542
- control={
543
- <ListItem.IconButton
544
- partiallyInteractive
545
- onClick={() => setClicked((current) => current + 1)}
546
- >
547
- <Plus />
548
- </ListItem.IconButton>
549
- }
550
- additionalInfo={renderInteractiveInfo()}
551
- prompt={renderPrompt()}
552
- />
553
- </ol>
439
+ <ListItem
440
+ title="Fully interactive"
441
+ subtitle={lorem10}
442
+ additionalInfo={ADDITIONAL_INFO.nonInteractive}
443
+ control={
444
+ <ListItem.Button
445
+ priority="secondary-neutral"
446
+ onClick={() => setClicked((current) => current + 1)}
447
+ >
448
+ as Button
449
+ </ListItem.Button>
450
+ }
451
+ prompt={PROMPTS.interactive}
452
+ />
453
+ <ListItem
454
+ title="Partially interactive"
455
+ subtitle={lorem10}
456
+ additionalInfo={ADDITIONAL_INFO.interactive}
457
+ control={
458
+ <ListItem.Button
459
+ priority="secondary-neutral"
460
+ partiallyInteractive
461
+ onClick={() => setClicked((current) => current + 1)}
462
+ >
463
+ as Button
464
+ </ListItem.Button>
465
+ }
466
+ prompt={PROMPTS.interactive}
467
+ />
468
+ <ListItem
469
+ title="Fully interactive"
470
+ subtitle={lorem10}
471
+ additionalInfo={ADDITIONAL_INFO.nonInteractive}
472
+ control={
473
+ <ListItem.IconButton
474
+ aria-label="Add something to me"
475
+ onClick={() => setClicked((current) => current + 1)}
476
+ >
477
+ <Plus />
478
+ </ListItem.IconButton>
479
+ }
480
+ prompt={PROMPTS.interactive}
481
+ />
482
+ <ListItem
483
+ title="Partially interactive"
484
+ subtitle={lorem10}
485
+ additionalInfo={ADDITIONAL_INFO.interactive}
486
+ control={
487
+ <ListItem.IconButton
488
+ partiallyInteractive
489
+ onClick={() => setClicked((current) => current + 1)}
490
+ >
491
+ <Plus />
492
+ </ListItem.IconButton>
493
+ }
494
+ prompt={PROMPTS.interactive}
495
+ />
554
496
  </>
555
497
  );
556
498
  },
557
- });
499
+ };
558
500
 
559
501
  /**
560
502
  * While most disabled states will show as grayed out, the navigation control switches from chevron
@@ -571,11 +513,9 @@ export const Disabled: Story = {
571
513
  sourceState: 'hidden',
572
514
  },
573
515
  },
574
- controls: { disable: true },
575
- knobs: { disable: true },
576
516
  },
577
- render: (args) => (
578
- <ol className="list-unstyled">
517
+ render: () => (
518
+ <div>
579
519
  <ListItem
580
520
  disabled
581
521
  media={
@@ -729,7 +669,7 @@ export const Disabled: Story = {
729
669
  </ListItem.Button>
730
670
  }
731
671
  />
732
- </ol>
672
+ </div>
733
673
  ),
734
674
  };
735
675
 
@@ -742,9 +682,6 @@ export const Disabled: Story = {
742
682
  * Please refer to the [design documentation](https://wise.design/components/list-item#content) for more details.
743
683
  */
744
684
  export const StylingLabels: Story = {
745
- argTypes: {
746
- ...hideControls(['spotlight', 'valueColumnWidth']),
747
- },
748
685
  args: {
749
686
  title: lorem5,
750
687
  subtitle: lorem10,
@@ -752,7 +689,6 @@ export const StylingLabels: Story = {
752
689
  control: CONTROLS.iconButton,
753
690
  prompt: PROMPTS.interactive,
754
691
  },
755
- decorators: [withoutKey],
756
692
  render: function Render(args) {
757
693
  return (
758
694
  <ol className="list-unstyled">
@@ -9,6 +9,7 @@ import {
9
9
  SB_LIST_ITEM_PROMPTS as PROMPTS,
10
10
  type SB_ListItem_ControlType as ControlType,
11
11
  } from './subcomponents';
12
+ import { List } from '../List';
12
13
 
13
14
  export default {
14
15
  component: ListItem,
@@ -143,7 +144,7 @@ const generateVariantsForControl = (controlType: ControlType): Story => {
143
144
  return storyConfig(
144
145
  {
145
146
  render: () => (
146
- <ol className="list-unstyled">
147
+ <List as="ol">
147
148
  {variants.map((variant, variantIndex) => (
148
149
  <ListItem
149
150
  key={`${controlType}-${variantIndex}-${Math.random()}`}
@@ -151,7 +152,7 @@ const generateVariantsForControl = (controlType: ControlType): Story => {
151
152
  {...variant}
152
153
  />
153
154
  ))}
154
- </ol>
155
+ </List>
155
156
  ),
156
157
  },
157
158
  { variants: ['default', 'dark', 'bright-green', 'forest-green', 'rtl'] },
@@ -177,7 +178,7 @@ export const Switch = generateVariantsForControl('switch');
177
178
 
178
179
  export const ButtonControlLabel: Story = {
179
180
  render: () => (
180
- <ol className="list-unstyled">
181
+ <List as="ol">
181
182
  <ListItem
182
183
  title="Fully interactive button."
183
184
  subtitle="It uses default content hierarchy."
@@ -261,6 +262,6 @@ export const ButtonControlLabel: Story = {
261
262
  control={CONTROLS.buttonAsLink}
262
263
  prompt={PROMPTS.nonInteractive}
263
264
  />
264
- </ol>
265
+ </List>
265
266
  ),
266
267
  };
@@ -12,3 +12,6 @@ export type { ListItemRadioProps } from './Radio';
12
12
  export type { ListItemSwitchProps } from './Switch';
13
13
 
14
14
  export { default } from './ListItem';
15
+
16
+ export { List } from './List';
17
+ export type { ListProps } from './List';
@@ -20,7 +20,7 @@ export type SwitchProps = CommonProps & {
20
20
  /** ID to apply to the switch container */
21
21
  id?: string;
22
22
  /** Function called when the switch is toggled */
23
- onClick: (event?: MouseEvent<HTMLButtonElement>) => void;
23
+ onClick: (event?: MouseEvent<HTMLSpanElement>) => void;
24
24
  };
25
25
 
26
26
  const Switch = (props: SwitchProps) => {
@@ -1 +0,0 @@
1
- {"version":3,"file":"List.js","sources":["../../src/legacylistItem/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;AAAQ,CAAa,EAAA;AACrD,EAAA,oBAAOC,cAAA,CAAA,IAAA,EAAA;AAAIF,IAAAA,SAAS,EAAEG,SAAI,CAACH,SAAS,EAAE,eAAe,CAAE;AAAAC,IAAAA,QAAA,EAAEA;AAAQ,GAAK,CAAC;AACzE;;;;"}