@transferwise/components 0.0.0-experimental-b80ad21 → 0.0.0-experimental-f17f6cb

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 (37) hide show
  1. package/build/avatarView/AvatarView.js +0 -1
  2. package/build/avatarView/AvatarView.js.map +1 -1
  3. package/build/avatarView/AvatarView.mjs +0 -1
  4. package/build/avatarView/AvatarView.mjs.map +1 -1
  5. package/build/index.js +0 -4
  6. package/build/index.js.map +1 -1
  7. package/build/index.mjs +0 -2
  8. package/build/index.mjs.map +1 -1
  9. package/build/main.css +6 -4
  10. package/build/prompt/InlinePrompt/InlinePrompt.js.map +1 -1
  11. package/build/prompt/InlinePrompt/InlinePrompt.mjs.map +1 -1
  12. package/build/styles/avatarView/AvatarView.css +5 -3
  13. package/build/styles/button/Button.css +1 -1
  14. package/build/styles/main.css +6 -4
  15. package/build/types/avatarView/AvatarView.d.ts.map +1 -1
  16. package/build/types/index.d.ts +0 -4
  17. package/build/types/index.d.ts.map +1 -1
  18. package/build/types/prompt/InlinePrompt/InlinePrompt.d.ts +1 -3
  19. package/build/types/prompt/InlinePrompt/InlinePrompt.d.ts.map +1 -1
  20. package/package.json +3 -3
  21. package/src/avatarLayout/AvatarLayout.story.tsx +58 -1
  22. package/src/avatarView/AvatarView.css +5 -3
  23. package/src/avatarView/AvatarView.less +9 -5
  24. package/src/avatarView/AvatarView.story.tsx +112 -1
  25. package/src/avatarView/AvatarView.tsx +6 -5
  26. package/src/button/Button.css +1 -1
  27. package/src/button/Button.less +1 -1
  28. package/src/button/Button.story.tsx +29 -114
  29. package/src/button/Button.tests.story.tsx +189 -0
  30. package/src/index.ts +0 -4
  31. package/src/main.css +6 -4
  32. package/src/{tokens/tokens.story.tsx → neptune-css/NeptuneCSS.story.tsx} +2 -2
  33. package/src/prompt/InlinePrompt/InlinePrompt.story.tsx +1 -2
  34. package/src/prompt/InlinePrompt/InlinePrompt.tsx +1 -3
  35. package/src/provider/theme/ThemeProvider.story.tsx +1 -1
  36. package/src/sentimentSurface/SentimentSurface.story.tsx +54 -85
  37. package/src/sentimentSurface/SentimentSurface.tests.story.tsx +2 -2
@@ -6,9 +6,10 @@ import Header from '../header';
6
6
  import Link from '../link';
7
7
  import IconButton from '../iconButton';
8
8
  import StatusIcon from '../statusIcon';
9
- import AvatarView from '../avatarView';
10
9
  import SentimentSurface from './SentimentSurface';
11
10
  import type { Sentiment, Emphasis } from './SentimentSurface.types';
11
+ import AvatarView from '../avatarView';
12
+ import AvatarLayout from '../avatarLayout';
12
13
 
13
14
  const withComponentGrid = (Story: () => JSX.Element) => (
14
15
  <div
@@ -31,7 +32,7 @@ const withComponentGrid = (Story: () => JSX.Element) => (
31
32
  */
32
33
  const meta: Meta<typeof SentimentSurface> = {
33
34
  component: SentimentSurface,
34
- title: 'Foundations/SentimentSurface',
35
+ title: 'Content/SentimentSurface',
35
36
  argTypes: {
36
37
  sentiment: {
37
38
  control: 'select',
@@ -229,12 +230,12 @@ export const EmphasisLevels: Story = {
229
230
 
230
231
  /**
231
232
  * By default, `SentimentSurface` exposes the tokens as CSS custom properties and also applies
232
- * the base styles for `background-color` and `color`. However, you can choose to expose said
233
- * properties without rendering them, by setting the `hasBaseStyles` prop to `false`.
234
- * This is useful when you want to create custom components that adapt to the sentiment context
235
- * without applying default styles.
233
+ * the base styles for `background-color` and `color`.
234
+ * However, you can choose to only expose the CSS custom properties by setting the `hasBaseStyles`
235
+ * prop to `false`. This is useful when you want to create custom components that adapt to the
236
+ * sentiment context without applying default styles.
236
237
  */
237
- export const RenderingBaseStyles: Story = {
238
+ export const BaseStyles: Story = {
238
239
  render: (args) => (
239
240
  <>
240
241
  <SentimentSurface
@@ -244,8 +245,8 @@ export const RenderingBaseStyles: Story = {
244
245
  <div className="p-a-2">This example exposes and applies the tokens.</div>
245
246
  </SentimentSurface>
246
247
  <SentimentSurface
247
- sentiment="success"
248
248
  hasBaseStyles={false}
249
+ sentiment="success"
249
250
  style={{ border: `1px dashed var(--color-sentiment-content-primary)` }}
250
251
  >
251
252
  <div className="p-a-2">This example only exposes the tokens without applying them.</div>
@@ -263,21 +264,6 @@ export const RenderingBaseStyles: Story = {
263
264
  ),
264
265
  parameters: {
265
266
  controls: { disable: true },
266
- docs: {
267
- source: {
268
- // Storybook strips out props that are set to false, so we need to hack it back in :/
269
- transform: async (source: string) => {
270
- if (source.includes('hasBaseStyles')) {
271
- return source;
272
- }
273
-
274
- return source.replace(
275
- /(<\/SentimentSurface>\s+<SentimentSurface(\s+)sentiment="success")/g,
276
- '$1$2hasBaseStyles={false}',
277
- );
278
- },
279
- },
280
- },
281
267
  },
282
268
  decorators: [withComponentGrid],
283
269
  };
@@ -364,12 +350,6 @@ export const NestingSurfaces: Story = {
364
350
  parameters: {
365
351
  controls: { disable: true },
366
352
  },
367
- /**
368
- * As agreed with the design team, this story is temporarily hidden from the public view until we
369
- * have proper discussion and documentation around when and how to use nested SentimentSurfaces.
370
- * This is to prevent misuse and confusion among consumers.
371
- */
372
- tags: ['!dev', '!autodocs'],
373
353
  render: (args) => {
374
354
  return (
375
355
  <SentimentSurface sentiment="success" emphasis="base" className="p-a-1">
@@ -386,7 +366,7 @@ export const NestingSurfaces: Story = {
386
366
  };
387
367
 
388
368
  /**
389
- * Some DS components (namely `Button`, `Link`, `StatusIcon`, `IconButton`, `AvatarView`, and `AvatarLayout`) automatically adapt to the sentiment context when used within a `SentimentSurface`.
369
+ * Some DS components (namely `Button`, `StatusIcon`, and `IconButton`) automatically adapt to the sentiment context when used within a `SentimentSurface`.
390
370
  */
391
371
  export const SentimentAwareComponents: Story = {
392
372
  name: 'Sentiment-aware Components',
@@ -399,70 +379,59 @@ export const SentimentAwareComponents: Story = {
399
379
  },
400
380
  },
401
381
  render: function Render(args) {
402
- const BODY = [
403
- <Body key="body">
404
- This text and its <Link href="#">inline links</Link> should use sentiment-matched colour.
405
- </Body>,
406
- <Button key="button1" v2 priority="primary" size="sm">
407
- Primary
408
- </Button>,
409
- <Button key="button2" v2 priority="secondary" size="sm">
410
- Secondary
411
- </Button>,
412
- <IconButton key="iconButton" size={32}>
413
- <Defrost />
414
- </IconButton>,
415
- <AvatarView key="avatar" size={32}>
416
- <Bank />
417
- </AvatarView>,
418
- <AvatarView key="avatar-initials" size={32} profileName="John Doe" />,
419
- ];
420
- const STATUS_SUCCESS = <StatusIcon size={32} sentiment="success" />;
421
- const STATUS_NEGATIVE = <StatusIcon size={32} sentiment="negative" />;
422
- const AVATAR_SUCCESS = (
423
- <AvatarView
424
- size={32}
425
- imgSrc="../avatar-rectangle-fox.webp"
426
- badge={{ status: 'success' }}
427
- interactive
428
- />
429
- );
430
- const AVATAR_NEGATIVE = (
431
- <AvatarView
432
- size={32}
433
- imgSrc="../avatar-rectangle-fox.webp"
434
- badge={{ status: 'negative' }}
435
- interactive
436
- />
382
+ const inner = (
383
+ <div className="p-a-2 m-b-2 sentimentAwareComponent">
384
+ <Body>
385
+ This text and its <Link href="#">inline links</Link> should use sentiment-matched colour.
386
+ </Body>
387
+ <IconButton size={32}>
388
+ <Defrost />
389
+ </IconButton>
390
+ <StatusIcon size={32} sentiment="positive" />
391
+ <Button v2 priority="primary" size="sm">
392
+ Primary
393
+ </Button>
394
+ <Button v2 priority="secondary" size="sm">
395
+ Secondary
396
+ </Button>
397
+ <AvatarView size={32}>
398
+ <Bank />
399
+ </AvatarView>
400
+ <AvatarView size={32} interactive>
401
+ <Bank />
402
+ </AvatarView>
403
+ <AvatarView size={32} profileName="John Doe" />
404
+ <AvatarView size={32} profileName="John Doe" interactive />
405
+ <AvatarView size={32} imgSrc="../avatar-rectangle-fox.webp" badge={{ status: 'warning' }} />
406
+ <AvatarView
407
+ size={32}
408
+ imgSrc="../avatar-rectangle-fox.webp"
409
+ badge={{ status: 'warning' }}
410
+ interactive
411
+ />
412
+ <AvatarLayout size={32} avatars={[{ asset: <Bank /> }, { profileName: 'John Doe' }]} />
413
+ </div>
437
414
  );
438
415
 
439
416
  return (
440
417
  <>
441
- <Header level="group" title="Plain container" />
442
- <div className="p-a-2 m-b-2 sentimentAwareComponent">
443
- {BODY}
444
- {AVATAR_SUCCESS}
445
- {AVATAR_NEGATIVE}
446
- {STATUS_SUCCESS}
447
- {STATUS_NEGATIVE}
448
- </div>
418
+ <Header level="group" title="No sentiment surface" />
419
+ {inner}
449
420
 
450
421
  <Header level="group" title="Success sentiment surface" />
451
- <SentimentSurface sentiment="success">
452
- <div className="p-a-2 m-b-2 sentimentAwareComponent">
453
- {BODY}
454
- {AVATAR_SUCCESS}
455
- {STATUS_SUCCESS}
456
- </div>
422
+ <SentimentSurface sentiment="success">{inner}</SentimentSurface>
423
+
424
+ <Header level="group" title="Success Elevated sentiment surface" />
425
+ <SentimentSurface sentiment="success" emphasis="elevated">
426
+ {inner}
457
427
  </SentimentSurface>
458
428
 
459
429
  <Header level="group" title="Negative sentiment surface" />
460
- <SentimentSurface sentiment="negative">
461
- <div className="p-a-2 m-b-2 sentimentAwareComponent">
462
- {BODY}
463
- {AVATAR_NEGATIVE}
464
- {STATUS_NEGATIVE}
465
- </div>
430
+ <SentimentSurface sentiment="negative">{inner}</SentimentSurface>
431
+
432
+ <Header level="group" title="Negative Elevated sentiment surface" />
433
+ <SentimentSurface sentiment="negative" emphasis="elevated">
434
+ {inner}
466
435
  </SentimentSurface>
467
436
  </>
468
437
  );
@@ -1,7 +1,7 @@
1
1
  import { Meta, StoryObj } from '@storybook/react-webpack5';
2
2
  import { ThemeProvider, type Theming } from '@wise/components-theming';
3
- import Button from '../button';
4
3
  import SentimentSurface from './SentimentSurface';
4
+ import Button from '../button';
5
5
  import type { Sentiment, Emphasis } from './SentimentSurface.types';
6
6
 
7
7
  const sentiments: Sentiment[] = ['negative', 'success', 'proposition', 'warning', 'neutral'];
@@ -21,7 +21,7 @@ const screenModes: Theming['screenMode'][] = ['light', 'dark'];
21
21
 
22
22
  export default {
23
23
  component: SentimentSurface,
24
- title: 'Foundations/SentimentSurface/Tests',
24
+ title: 'Content/SentimentSurface/Tests',
25
25
  tags: ['!autodocs'],
26
26
  } satisfies Meta<typeof SentimentSurface>;
27
27