@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.
- package/build/avatarView/AvatarView.js +0 -1
- package/build/avatarView/AvatarView.js.map +1 -1
- package/build/avatarView/AvatarView.mjs +0 -1
- package/build/avatarView/AvatarView.mjs.map +1 -1
- package/build/index.js +0 -4
- package/build/index.js.map +1 -1
- package/build/index.mjs +0 -2
- package/build/index.mjs.map +1 -1
- package/build/main.css +6 -4
- package/build/prompt/InlinePrompt/InlinePrompt.js.map +1 -1
- package/build/prompt/InlinePrompt/InlinePrompt.mjs.map +1 -1
- package/build/styles/avatarView/AvatarView.css +5 -3
- package/build/styles/button/Button.css +1 -1
- package/build/styles/main.css +6 -4
- package/build/types/avatarView/AvatarView.d.ts.map +1 -1
- package/build/types/index.d.ts +0 -4
- package/build/types/index.d.ts.map +1 -1
- package/build/types/prompt/InlinePrompt/InlinePrompt.d.ts +1 -3
- package/build/types/prompt/InlinePrompt/InlinePrompt.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/avatarLayout/AvatarLayout.story.tsx +58 -1
- package/src/avatarView/AvatarView.css +5 -3
- package/src/avatarView/AvatarView.less +9 -5
- package/src/avatarView/AvatarView.story.tsx +112 -1
- package/src/avatarView/AvatarView.tsx +6 -5
- package/src/button/Button.css +1 -1
- package/src/button/Button.less +1 -1
- package/src/button/Button.story.tsx +29 -114
- package/src/button/Button.tests.story.tsx +189 -0
- package/src/index.ts +0 -4
- package/src/main.css +6 -4
- package/src/{tokens/tokens.story.tsx → neptune-css/NeptuneCSS.story.tsx} +2 -2
- package/src/prompt/InlinePrompt/InlinePrompt.story.tsx +1 -2
- package/src/prompt/InlinePrompt/InlinePrompt.tsx +1 -3
- package/src/provider/theme/ThemeProvider.story.tsx +1 -1
- package/src/sentimentSurface/SentimentSurface.story.tsx +54 -85
- package/src/sentimentSurface/SentimentSurface.tests.story.tsx +2 -2
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
Leaf,
|
|
11
11
|
Plane,
|
|
12
12
|
PlusCircle,
|
|
13
|
+
GiftBox,
|
|
13
14
|
QrCode,
|
|
14
15
|
Rewards,
|
|
15
16
|
Target,
|
|
@@ -17,16 +18,23 @@ import {
|
|
|
17
18
|
Transport,
|
|
18
19
|
Wallet,
|
|
19
20
|
Water,
|
|
21
|
+
Bank,
|
|
20
22
|
} from '@transferwise/icons';
|
|
21
|
-
import AvatarView, { AvatarViewProps } from '.';
|
|
22
23
|
import { Flag } from '@wise/art';
|
|
24
|
+
import AvatarView, { AvatarViewProps } from '.';
|
|
23
25
|
import { getBrandColorFromSeed, getInitials, ProfileType } from '../common';
|
|
24
26
|
import Display from '../display';
|
|
25
27
|
import Body from '../body';
|
|
28
|
+
import SentimentSurface from '../sentimentSurface';
|
|
26
29
|
|
|
27
30
|
export default {
|
|
28
31
|
title: 'Content/AvatarView',
|
|
29
32
|
component: AvatarView,
|
|
33
|
+
parameters: {
|
|
34
|
+
docs: {
|
|
35
|
+
toc: true,
|
|
36
|
+
},
|
|
37
|
+
},
|
|
30
38
|
} satisfies Meta<typeof AvatarView>;
|
|
31
39
|
|
|
32
40
|
type Story = StoryObj<typeof AvatarView>;
|
|
@@ -35,6 +43,20 @@ const profileName1 = 'Wolter White';
|
|
|
35
43
|
const profileName2 = 'Tyler Durden';
|
|
36
44
|
const sizes: AvatarViewProps['size'][] = [16, 24, 32, 40, 48, 56, 72];
|
|
37
45
|
|
|
46
|
+
const withComponentGrid = (Story: () => JSX.Element) => (
|
|
47
|
+
<div
|
|
48
|
+
style={{
|
|
49
|
+
width: '100%',
|
|
50
|
+
display: 'flex',
|
|
51
|
+
flexDirection: 'column',
|
|
52
|
+
gap: '1rem',
|
|
53
|
+
maxWidth: '800px',
|
|
54
|
+
}}
|
|
55
|
+
>
|
|
56
|
+
<Story />
|
|
57
|
+
</div>
|
|
58
|
+
);
|
|
59
|
+
|
|
38
60
|
export const Selected: Story = {
|
|
39
61
|
render: () => {
|
|
40
62
|
return (
|
|
@@ -439,6 +461,95 @@ export const ProfileBrokenImageFallback: Story = {
|
|
|
439
461
|
},
|
|
440
462
|
};
|
|
441
463
|
|
|
464
|
+
/**
|
|
465
|
+
* `AvatarView` is sentiment-aware and will automatically adjust its colours if wrapped inside the
|
|
466
|
+
* [SentimentSurface](?path=/docs/content-sentimentsurface--docs) component.
|
|
467
|
+
*/
|
|
468
|
+
export const SentimentAwareness: Story = {
|
|
469
|
+
parameters: {
|
|
470
|
+
docs: {
|
|
471
|
+
canvas: {
|
|
472
|
+
sourceState: 'hidden',
|
|
473
|
+
},
|
|
474
|
+
source: { type: 'code' },
|
|
475
|
+
},
|
|
476
|
+
},
|
|
477
|
+
render: () => {
|
|
478
|
+
return (
|
|
479
|
+
<>
|
|
480
|
+
{(['success', 'warning', 'negative', 'neutral', 'proposition'] as const).map((sentiment) =>
|
|
481
|
+
(['base', 'elevated'] as const).map((emphasis) => (
|
|
482
|
+
<SentimentSurface
|
|
483
|
+
key={`${sentiment}-${emphasis}`}
|
|
484
|
+
sentiment={sentiment}
|
|
485
|
+
emphasis={emphasis}
|
|
486
|
+
className="p-a-1 d-flex"
|
|
487
|
+
style={{ gap: 'var(--size-16)' }}
|
|
488
|
+
>
|
|
489
|
+
<AvatarView size={32}>
|
|
490
|
+
<Bank />
|
|
491
|
+
</AvatarView>
|
|
492
|
+
<AvatarView size={32} profileName="John Doe" />
|
|
493
|
+
<AvatarView size={32}>
|
|
494
|
+
<Flag code="JPY" intrinsicSize={32} />
|
|
495
|
+
</AvatarView>
|
|
496
|
+
<AvatarView size={32} interactive>
|
|
497
|
+
<Bank />
|
|
498
|
+
</AvatarView>
|
|
499
|
+
<AvatarView size={32} selected>
|
|
500
|
+
<Bank />
|
|
501
|
+
</AvatarView>
|
|
502
|
+
<AvatarView size={32} selected interactive>
|
|
503
|
+
<Bank />
|
|
504
|
+
</AvatarView>
|
|
505
|
+
|
|
506
|
+
{sentiment === 'proposition' ? (
|
|
507
|
+
<AvatarView
|
|
508
|
+
size={32}
|
|
509
|
+
badge={{
|
|
510
|
+
asset: (
|
|
511
|
+
<div
|
|
512
|
+
className="d-flex align-items-center justify-content-center"
|
|
513
|
+
style={{
|
|
514
|
+
backgroundColor: 'var(--color-sentiment-interactive-primary)',
|
|
515
|
+
color: 'var(--color-sentiment-interactive-control)',
|
|
516
|
+
width: '100%',
|
|
517
|
+
height: '100%',
|
|
518
|
+
}}
|
|
519
|
+
>
|
|
520
|
+
<GiftBox />
|
|
521
|
+
</div>
|
|
522
|
+
),
|
|
523
|
+
}}
|
|
524
|
+
>
|
|
525
|
+
<Bank />
|
|
526
|
+
</AvatarView>
|
|
527
|
+
) : (
|
|
528
|
+
<AvatarView size={32} badge={{ status: sentiment }}>
|
|
529
|
+
<Bank />
|
|
530
|
+
</AvatarView>
|
|
531
|
+
)}
|
|
532
|
+
<AvatarView size={32} badge={{ type: 'reference' }}>
|
|
533
|
+
<Bank />
|
|
534
|
+
</AvatarView>
|
|
535
|
+
<AvatarView size={32} badge={{ type: 'action' }}>
|
|
536
|
+
<Bank />
|
|
537
|
+
</AvatarView>
|
|
538
|
+
<AvatarView size={32} badge={{ type: 'notification' }}>
|
|
539
|
+
<Bank />
|
|
540
|
+
</AvatarView>
|
|
541
|
+
<AvatarView size={32} badge={{ type: 'online' }}>
|
|
542
|
+
<Bank />
|
|
543
|
+
</AvatarView>
|
|
544
|
+
</SentimentSurface>
|
|
545
|
+
)),
|
|
546
|
+
)}
|
|
547
|
+
</>
|
|
548
|
+
);
|
|
549
|
+
},
|
|
550
|
+
decorators: [withComponentGrid],
|
|
551
|
+
};
|
|
552
|
+
|
|
442
553
|
export const EdgeInstaces: Story = {
|
|
443
554
|
render: () => {
|
|
444
555
|
const css = `.custom-variant {
|
|
@@ -106,7 +106,7 @@ const MAP_SELECTED_BORDER_WIDTH = {
|
|
|
106
106
|
};
|
|
107
107
|
|
|
108
108
|
/** Certain sizes of AvatarView has a custom offset for badge */
|
|
109
|
-
const MAP_BADGE_POSITION = {
|
|
109
|
+
const MAP_BADGE_POSITION: Partial<Record<NonNullable<Props['size']>, number>> = {
|
|
110
110
|
24: -6,
|
|
111
111
|
32: -4,
|
|
112
112
|
};
|
|
@@ -155,10 +155,11 @@ function Badges({
|
|
|
155
155
|
<BadgeAssets {...(selected ? { status: 'positive' } : badgeAssets)} size={badgeSize} />
|
|
156
156
|
)
|
|
157
157
|
}
|
|
158
|
-
style={
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
158
|
+
style={
|
|
159
|
+
{
|
|
160
|
+
'--badge-content-position': `${MAP_BADGE_POSITION[size] ?? 0}px`,
|
|
161
|
+
} as React.CSSProperties
|
|
162
|
+
}
|
|
162
163
|
>
|
|
163
164
|
{children}
|
|
164
165
|
</Badge>
|
package/src/button/Button.css
CHANGED
|
@@ -113,7 +113,7 @@
|
|
|
113
113
|
--Button-color-active: var(--Button-secondary-neutral-color);
|
|
114
114
|
}
|
|
115
115
|
.wds-Button--secondary-neutral .wds-Button-icon--end {
|
|
116
|
-
color: var(--
|
|
116
|
+
color: var(--Button-secondary-color);
|
|
117
117
|
}
|
|
118
118
|
.wds-Button--tertiary {
|
|
119
119
|
--Button-background: var(--Button-tertiary-background);
|
package/src/button/Button.less
CHANGED
|
@@ -696,116 +696,6 @@ export const WithAvatars: StoryObj<PreviewStoryArgs> = {
|
|
|
696
696
|
decorators: [withComponentGrid()],
|
|
697
697
|
};
|
|
698
698
|
|
|
699
|
-
const buttonPriorities = ['primary', 'secondary', 'secondary-neutral', 'tertiary'] as const;
|
|
700
|
-
const buttonSizes = ['sm', 'md', 'lg'] as const;
|
|
701
|
-
|
|
702
|
-
export const AllVariants = storyConfig(
|
|
703
|
-
{
|
|
704
|
-
tags: ['!autodocs'],
|
|
705
|
-
parameters: {
|
|
706
|
-
padding: '0',
|
|
707
|
-
},
|
|
708
|
-
render: () => (
|
|
709
|
-
<div
|
|
710
|
-
className="button-variants"
|
|
711
|
-
style={{ display: 'flex', flexWrap: 'wrap', gap: '16px', maxWidth: '1200px' }}
|
|
712
|
-
>
|
|
713
|
-
{buttonPriorities.map((priority) =>
|
|
714
|
-
buttonSizes.map((size) => (
|
|
715
|
-
<div
|
|
716
|
-
key={`${priority}-default-${size}`}
|
|
717
|
-
style={{ flex: '1 0 30%', marginBottom: '16px', justifyContent: 'space-between' }}
|
|
718
|
-
>
|
|
719
|
-
<Button
|
|
720
|
-
v2
|
|
721
|
-
priority={priority as ButtonPriority}
|
|
722
|
-
size={size}
|
|
723
|
-
addonStart={{ type: 'avatar', value: [{ asset: <Freeze /> }] }}
|
|
724
|
-
addonEnd={{ type: 'icon', value: <ArrowRight /> }}
|
|
725
|
-
block
|
|
726
|
-
>
|
|
727
|
-
{`${priority} default ${size}`}
|
|
728
|
-
</Button>
|
|
729
|
-
<Button
|
|
730
|
-
className="m-t-1 m-b-1"
|
|
731
|
-
v2
|
|
732
|
-
priority={priority as ButtonPriority}
|
|
733
|
-
size={size}
|
|
734
|
-
addonStart={{
|
|
735
|
-
type: 'avatar',
|
|
736
|
-
value: [{ asset: <Freeze /> }, { asset: <Freeze /> }],
|
|
737
|
-
}}
|
|
738
|
-
addonEnd={{ type: 'icon', value: <ArrowRight /> }}
|
|
739
|
-
block
|
|
740
|
-
disabled
|
|
741
|
-
>
|
|
742
|
-
{`${priority} default ${size} Disabled`}
|
|
743
|
-
</Button>
|
|
744
|
-
<Button
|
|
745
|
-
v2
|
|
746
|
-
priority={priority as ButtonPriority}
|
|
747
|
-
size={size}
|
|
748
|
-
addonStart={{ type: 'avatar', value: [{ asset: <Freeze /> }] }}
|
|
749
|
-
addonEnd={{ type: 'icon', value: <ArrowRight /> }}
|
|
750
|
-
block
|
|
751
|
-
loading
|
|
752
|
-
>
|
|
753
|
-
{`${priority} default ${size} Loading`}
|
|
754
|
-
</Button>
|
|
755
|
-
</div>
|
|
756
|
-
)),
|
|
757
|
-
)}
|
|
758
|
-
{['primary', 'secondary'].map((priority) =>
|
|
759
|
-
buttonSizes.map((size) => (
|
|
760
|
-
<div
|
|
761
|
-
key={`${priority}-negative-${size}`}
|
|
762
|
-
style={{ flex: '1 0 30%', marginBottom: '16px', justifyContent: 'space-between' }}
|
|
763
|
-
>
|
|
764
|
-
<Button
|
|
765
|
-
v2
|
|
766
|
-
sentiment="negative"
|
|
767
|
-
priority={priority as ButtonPriority}
|
|
768
|
-
size={size}
|
|
769
|
-
addonEnd={{ type: 'icon', value: <ChevronRight /> }}
|
|
770
|
-
addonStart={{ type: 'avatar', value: [{ asset: <Freeze /> }] }}
|
|
771
|
-
block
|
|
772
|
-
>
|
|
773
|
-
{`${priority} negative ${size}`}
|
|
774
|
-
</Button>
|
|
775
|
-
<Button
|
|
776
|
-
className="m-t-1 m-b-1"
|
|
777
|
-
v2
|
|
778
|
-
sentiment="negative"
|
|
779
|
-
priority={priority as ButtonPriority}
|
|
780
|
-
size={size}
|
|
781
|
-
addonEnd={{ type: 'icon', value: <ChevronRight /> }}
|
|
782
|
-
addonStart={{ type: 'avatar', value: [{ asset: <Freeze /> }] }}
|
|
783
|
-
block
|
|
784
|
-
disabled
|
|
785
|
-
>
|
|
786
|
-
{`${priority} negative ${size} Disabled`}
|
|
787
|
-
</Button>
|
|
788
|
-
<Button
|
|
789
|
-
v2
|
|
790
|
-
sentiment="negative"
|
|
791
|
-
priority={priority as ButtonPriority}
|
|
792
|
-
size={size}
|
|
793
|
-
addonEnd={{ type: 'icon', value: <ChevronRight /> }}
|
|
794
|
-
addonStart={{ type: 'avatar', value: [{ asset: <Freeze /> }] }}
|
|
795
|
-
block
|
|
796
|
-
loading
|
|
797
|
-
>
|
|
798
|
-
{`${priority} negative ${size} Loading`}
|
|
799
|
-
</Button>
|
|
800
|
-
</div>
|
|
801
|
-
)),
|
|
802
|
-
)}
|
|
803
|
-
</div>
|
|
804
|
-
),
|
|
805
|
-
},
|
|
806
|
-
{ variants: ['default', 'dark', 'bright-green', 'forest-green', 'rtl'] },
|
|
807
|
-
);
|
|
808
|
-
|
|
809
699
|
/**
|
|
810
700
|
* **NB:** The button doesn't know how long its label is, how many words it consists of and
|
|
811
701
|
* how zoomed in it is. That is likely to lead to scenarios in which the text will overflow
|
|
@@ -926,14 +816,39 @@ export const SentimentAwareness: Story = {
|
|
|
926
816
|
className="p-a-1 d-flex align-items-center"
|
|
927
817
|
style={{ gap: 'var(--size-8)' }}
|
|
928
818
|
>
|
|
929
|
-
<Button
|
|
930
|
-
|
|
819
|
+
<Button
|
|
820
|
+
v2
|
|
821
|
+
size="md"
|
|
822
|
+
addonEnd={{ type: 'icon', value: <ChevronRight /> }}
|
|
823
|
+
addonStart={{ type: 'avatar', value: [{ asset: <Freeze /> }] }}
|
|
824
|
+
>
|
|
825
|
+
Primary
|
|
826
|
+
</Button>
|
|
827
|
+
<Button
|
|
828
|
+
v2
|
|
829
|
+
size="md"
|
|
830
|
+
priority="secondary"
|
|
831
|
+
addonEnd={{ type: 'icon', value: <ChevronRight /> }}
|
|
832
|
+
addonStart={{ type: 'avatar', value: [{ asset: <Freeze /> }] }}
|
|
833
|
+
>
|
|
931
834
|
Secondary
|
|
932
835
|
</Button>
|
|
933
|
-
<Button
|
|
836
|
+
<Button
|
|
837
|
+
v2
|
|
838
|
+
size="md"
|
|
839
|
+
priority="secondary-neutral"
|
|
840
|
+
addonEnd={{ type: 'icon', value: <ChevronRight /> }}
|
|
841
|
+
addonStart={{ type: 'avatar', value: [{ asset: <Freeze /> }] }}
|
|
842
|
+
>
|
|
934
843
|
Secondary Neutral
|
|
935
844
|
</Button>
|
|
936
|
-
<Button
|
|
845
|
+
<Button
|
|
846
|
+
v2
|
|
847
|
+
size="md"
|
|
848
|
+
disabled
|
|
849
|
+
addonEnd={{ type: 'icon', value: <ChevronRight /> }}
|
|
850
|
+
addonStart={{ type: 'avatar', value: [{ asset: <Freeze /> }] }}
|
|
851
|
+
>
|
|
937
852
|
Disabled
|
|
938
853
|
</Button>
|
|
939
854
|
</SentimentSurface>
|
|
@@ -2,6 +2,10 @@ import { Meta } from '@storybook/react-webpack5';
|
|
|
2
2
|
import Button from './Button.resolver';
|
|
3
3
|
import { expect, userEvent, within } from 'storybook/test';
|
|
4
4
|
import { storyConfig } from '../test-utils';
|
|
5
|
+
import { ButtonPriority } from './Button.types';
|
|
6
|
+
import { ArrowRight, ChevronRight, Freeze } from '@transferwise/icons';
|
|
7
|
+
import SentimentSurface from '../sentimentSurface';
|
|
8
|
+
import { Flag } from '@wise/art';
|
|
5
9
|
|
|
6
10
|
const meta: Meta<typeof Button> = {
|
|
7
11
|
component: Button,
|
|
@@ -25,3 +29,188 @@ FocusTertiary.play = async ({ canvasElement }) => {
|
|
|
25
29
|
const buttonElement: HTMLButtonElement = canvas.getByRole('button');
|
|
26
30
|
await expect(buttonElement).toHaveFocus();
|
|
27
31
|
};
|
|
32
|
+
|
|
33
|
+
const buttonPriorities = ['primary', 'secondary', 'secondary-neutral', 'tertiary'] as const;
|
|
34
|
+
const buttonSizes = ['sm', 'md', 'lg'] as const;
|
|
35
|
+
export const AllVariants = storyConfig(
|
|
36
|
+
{
|
|
37
|
+
tags: ['!autodocs'],
|
|
38
|
+
parameters: {
|
|
39
|
+
padding: '0',
|
|
40
|
+
},
|
|
41
|
+
render: () => (
|
|
42
|
+
<div
|
|
43
|
+
className="button-variants"
|
|
44
|
+
style={{ display: 'flex', flexWrap: 'wrap', gap: '16px', maxWidth: '1200px' }}
|
|
45
|
+
>
|
|
46
|
+
{buttonPriorities.map((priority) =>
|
|
47
|
+
buttonSizes.map((size) => (
|
|
48
|
+
<div
|
|
49
|
+
key={`${priority}-default-${size}`}
|
|
50
|
+
style={{ flex: '1 0 30%', marginBottom: '16px', justifyContent: 'space-between' }}
|
|
51
|
+
>
|
|
52
|
+
<Button
|
|
53
|
+
v2
|
|
54
|
+
priority={priority as ButtonPriority}
|
|
55
|
+
size={size}
|
|
56
|
+
addonStart={{ type: 'avatar', value: [{ asset: <Freeze /> }] }}
|
|
57
|
+
addonEnd={{ type: 'icon', value: <ArrowRight /> }}
|
|
58
|
+
block
|
|
59
|
+
>
|
|
60
|
+
{`${priority} default ${size}`}
|
|
61
|
+
</Button>
|
|
62
|
+
<Button
|
|
63
|
+
className="m-t-1 m-b-1"
|
|
64
|
+
v2
|
|
65
|
+
priority={priority as ButtonPriority}
|
|
66
|
+
size={size}
|
|
67
|
+
addonStart={{
|
|
68
|
+
type: 'avatar',
|
|
69
|
+
value: [{ asset: <Freeze /> }, { asset: <Freeze /> }],
|
|
70
|
+
}}
|
|
71
|
+
addonEnd={{ type: 'icon', value: <ArrowRight /> }}
|
|
72
|
+
block
|
|
73
|
+
disabled
|
|
74
|
+
>
|
|
75
|
+
{`${priority} default ${size} Disabled`}
|
|
76
|
+
</Button>
|
|
77
|
+
<Button
|
|
78
|
+
v2
|
|
79
|
+
priority={priority as ButtonPriority}
|
|
80
|
+
size={size}
|
|
81
|
+
addonStart={{ type: 'avatar', value: [{ asset: <Freeze /> }] }}
|
|
82
|
+
addonEnd={{ type: 'icon', value: <ArrowRight /> }}
|
|
83
|
+
block
|
|
84
|
+
loading
|
|
85
|
+
>
|
|
86
|
+
{`${priority} default ${size} Loading`}
|
|
87
|
+
</Button>
|
|
88
|
+
</div>
|
|
89
|
+
)),
|
|
90
|
+
)}
|
|
91
|
+
{['primary', 'secondary'].map((priority) =>
|
|
92
|
+
buttonSizes.map((size) => (
|
|
93
|
+
<div
|
|
94
|
+
key={`${priority}-negative-${size}`}
|
|
95
|
+
style={{ flex: '1 0 30%', marginBottom: '16px', justifyContent: 'space-between' }}
|
|
96
|
+
>
|
|
97
|
+
<Button
|
|
98
|
+
v2
|
|
99
|
+
sentiment="negative"
|
|
100
|
+
priority={priority as ButtonPriority}
|
|
101
|
+
size={size}
|
|
102
|
+
addonEnd={{ type: 'icon', value: <ChevronRight /> }}
|
|
103
|
+
addonStart={{ type: 'avatar', value: [{ asset: <Freeze /> }] }}
|
|
104
|
+
block
|
|
105
|
+
>
|
|
106
|
+
{`${priority} negative ${size}`}
|
|
107
|
+
</Button>
|
|
108
|
+
<Button
|
|
109
|
+
className="m-t-1 m-b-1"
|
|
110
|
+
v2
|
|
111
|
+
sentiment="negative"
|
|
112
|
+
priority={priority as ButtonPriority}
|
|
113
|
+
size={size}
|
|
114
|
+
addonEnd={{ type: 'icon', value: <ChevronRight /> }}
|
|
115
|
+
addonStart={{ type: 'avatar', value: [{ asset: <Freeze /> }] }}
|
|
116
|
+
block
|
|
117
|
+
disabled
|
|
118
|
+
>
|
|
119
|
+
{`${priority} negative ${size} Disabled`}
|
|
120
|
+
</Button>
|
|
121
|
+
<Button
|
|
122
|
+
v2
|
|
123
|
+
sentiment="negative"
|
|
124
|
+
priority={priority as ButtonPriority}
|
|
125
|
+
size={size}
|
|
126
|
+
addonEnd={{ type: 'icon', value: <ChevronRight /> }}
|
|
127
|
+
addonStart={{ type: 'avatar', value: [{ asset: <Freeze /> }] }}
|
|
128
|
+
block
|
|
129
|
+
loading
|
|
130
|
+
>
|
|
131
|
+
{`${priority} negative ${size} Loading`}
|
|
132
|
+
</Button>
|
|
133
|
+
</div>
|
|
134
|
+
)),
|
|
135
|
+
)}
|
|
136
|
+
</div>
|
|
137
|
+
),
|
|
138
|
+
},
|
|
139
|
+
{ variants: ['default', 'dark', 'bright-green', 'forest-green', 'rtl'] },
|
|
140
|
+
);
|
|
141
|
+
|
|
142
|
+
export const SentimentAwareness = storyConfig(
|
|
143
|
+
{
|
|
144
|
+
render: () => {
|
|
145
|
+
const PERMUTATIONS = {
|
|
146
|
+
emphasis: ['base', 'elevated'] as const,
|
|
147
|
+
sentiment: ['success', 'warning', 'negative', 'neutral', 'proposition'] as const,
|
|
148
|
+
disabled: [false, true] as const,
|
|
149
|
+
others: [
|
|
150
|
+
{
|
|
151
|
+
addonStart: { type: 'avatar' as const, value: [{ asset: <Freeze /> }] },
|
|
152
|
+
addonEnd: { type: 'icon' as const, value: <ChevronRight /> },
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
addonStart: { type: 'avatar' as const, value: [{ profileName: 'John Doe' }] },
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
addonStart: {
|
|
159
|
+
type: 'avatar' as const,
|
|
160
|
+
value: [
|
|
161
|
+
{
|
|
162
|
+
asset: <Flag code="gb" />,
|
|
163
|
+
},
|
|
164
|
+
{ asset: <Freeze /> },
|
|
165
|
+
],
|
|
166
|
+
},
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
loading: true,
|
|
170
|
+
},
|
|
171
|
+
],
|
|
172
|
+
priority: ['primary', 'secondary', 'secondary-neutral'] as const,
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
return (
|
|
176
|
+
<>
|
|
177
|
+
{PERMUTATIONS.emphasis.map((emphasis) =>
|
|
178
|
+
PERMUTATIONS.sentiment.map((sentiment) => (
|
|
179
|
+
<SentimentSurface
|
|
180
|
+
key={`${emphasis}-${sentiment}`}
|
|
181
|
+
sentiment={sentiment}
|
|
182
|
+
emphasis={emphasis}
|
|
183
|
+
style={{
|
|
184
|
+
padding: 'var(--size-8)',
|
|
185
|
+
display: 'grid',
|
|
186
|
+
gridTemplateColumns: 'repeat(3, min-content)',
|
|
187
|
+
gap: 'var(--size-8)',
|
|
188
|
+
}}
|
|
189
|
+
>
|
|
190
|
+
{PERMUTATIONS.disabled.map((disabled) =>
|
|
191
|
+
PERMUTATIONS.others.map((media, mediaVariant) =>
|
|
192
|
+
PERMUTATIONS.priority.map((priority) => (
|
|
193
|
+
<div key={`${emphasis}-${sentiment}-${disabled}-${priority}-${mediaVariant}`}>
|
|
194
|
+
<Button v2 size="md" disabled={disabled} priority={priority} {...media}>
|
|
195
|
+
{priority}
|
|
196
|
+
</Button>
|
|
197
|
+
</div>
|
|
198
|
+
)),
|
|
199
|
+
),
|
|
200
|
+
)}
|
|
201
|
+
</SentimentSurface>
|
|
202
|
+
)),
|
|
203
|
+
)}
|
|
204
|
+
</>
|
|
205
|
+
);
|
|
206
|
+
},
|
|
207
|
+
decorators: [
|
|
208
|
+
(Story: React.ComponentType) => (
|
|
209
|
+
<div style={{ display: 'flex', flexDirection: 'column', gap: '16px' }}>
|
|
210
|
+
<Story />
|
|
211
|
+
</div>
|
|
212
|
+
),
|
|
213
|
+
],
|
|
214
|
+
},
|
|
215
|
+
{},
|
|
216
|
+
);
|
package/src/index.ts
CHANGED
|
@@ -35,7 +35,6 @@ export type { HeaderProps } from './header';
|
|
|
35
35
|
export type { EmphasisProps } from './emphasis';
|
|
36
36
|
export type { FieldProps } from './field/Field';
|
|
37
37
|
export type { InfoProps } from './info';
|
|
38
|
-
export type { InlinePromptProps } from './prompt';
|
|
39
38
|
export type { InputWithDisplayFormatProps } from './inputWithDisplayFormat';
|
|
40
39
|
export type { InputProps } from './inputs/Input';
|
|
41
40
|
export type { InputGroupProps } from './inputs/InputGroup';
|
|
@@ -90,7 +89,6 @@ export type { SnackbarContextType } from './snackbar/SnackbarContext';
|
|
|
90
89
|
export type { StatusIconProps } from './statusIcon';
|
|
91
90
|
export type { StickyProps } from './sticky';
|
|
92
91
|
export type { SummaryProps } from './summary';
|
|
93
|
-
export type { SentimentSurfaceProps } from './sentimentSurface';
|
|
94
92
|
export type { SwitchProps } from './switch';
|
|
95
93
|
export type { SwitchOptionProps } from './switchOption';
|
|
96
94
|
export type { TabItem, TabsProps } from './tabs';
|
|
@@ -171,7 +169,6 @@ export { default as Header } from './header';
|
|
|
171
169
|
export { default as Image } from './image';
|
|
172
170
|
export { default as Info } from './info';
|
|
173
171
|
export { default as InlineAlert } from './inlineAlert';
|
|
174
|
-
export { InlinePrompt } from './prompt';
|
|
175
172
|
export { default as InputWithDisplayFormat } from './inputWithDisplayFormat';
|
|
176
173
|
export { Input } from './inputs/Input';
|
|
177
174
|
export { InputGroup } from './inputs/InputGroup';
|
|
@@ -212,7 +209,6 @@ export { default as ResponsivePanel } from './common/responsivePanel';
|
|
|
212
209
|
export { default as Section } from './section';
|
|
213
210
|
export { default as SegmentedControl } from './segmentedControl';
|
|
214
211
|
export { default as Select } from './select';
|
|
215
|
-
export { default as SentimentSurface } from './sentimentSurface';
|
|
216
212
|
export { default as SlidingPanel } from './slidingPanel';
|
|
217
213
|
export { default as SnackbarPortal } from './snackbar/Snackbar';
|
|
218
214
|
export { SnackbarConsumer, SnackbarContext } from './snackbar/SnackbarContext';
|
package/src/main.css
CHANGED
|
@@ -962,18 +962,20 @@
|
|
|
962
962
|
}
|
|
963
963
|
.np-avatar-view .np-avatar-view-content {
|
|
964
964
|
color: #37517e;
|
|
965
|
-
color: var(--color-content-primary);
|
|
965
|
+
color: var(--color-sentiment-content-primary, var(--color-content-primary));
|
|
966
966
|
}
|
|
967
967
|
.np-avatar-view-interactive {
|
|
968
968
|
cursor: pointer;
|
|
969
969
|
}
|
|
970
970
|
.np-avatar-view-interactive .np-circle {
|
|
971
971
|
background-color: rgba(134,167,189,0.10196);
|
|
972
|
-
background-color: var(--color-background-neutral);
|
|
973
|
-
color: var(--color-interactive-primary);
|
|
972
|
+
background-color: var(--color-sentiment-interactive-secondary-neutral, var(--color-background-neutral));
|
|
973
|
+
color: var(--color-sentiment-content-primary, var(--color-interactive-primary));
|
|
974
974
|
}
|
|
975
975
|
.np-avatar-view-non-interactive .np-circle {
|
|
976
976
|
background-color: transparent;
|
|
977
|
+
background-color: var(--color-sentiment-background-surface, transparent);
|
|
978
|
+
--circle-border-color: var(--color-sentiment-content-primary, var(--color-border-neutral));
|
|
977
979
|
}
|
|
978
980
|
.np-avatar-view-non-interactive .np-avatar-view-content .wds-flag {
|
|
979
981
|
box-shadow: none;
|
|
@@ -1308,7 +1310,7 @@
|
|
|
1308
1310
|
--Button-color-active: var(--Button-secondary-neutral-color);
|
|
1309
1311
|
}
|
|
1310
1312
|
.wds-Button--secondary-neutral .wds-Button-icon--end {
|
|
1311
|
-
color: var(--
|
|
1313
|
+
color: var(--Button-secondary-color);
|
|
1312
1314
|
}
|
|
1313
1315
|
.wds-Button--tertiary {
|
|
1314
1316
|
--Button-background: var(--Button-tertiary-background);
|
|
@@ -36,9 +36,7 @@ export type InlinePromptProps = {
|
|
|
36
36
|
|
|
37
37
|
/**
|
|
38
38
|
* Inline prompts appear alongside a specific component on the screen. They help the user stay
|
|
39
|
-
* informed, fix something, or get more out of what they're doing.
|
|
40
|
-
*
|
|
41
|
-
* **NB:** It should be used in favour of `InlineAlert` which will be soon deprecated.
|
|
39
|
+
* informed, fix something, or get more out of what they're doing.
|
|
42
40
|
*/
|
|
43
41
|
export const InlinePrompt = ({
|
|
44
42
|
sentiment = Sentiment.POSITIVE,
|
|
@@ -22,7 +22,7 @@ function ThemeProvider(props: ThemeProviderProps) {
|
|
|
22
22
|
|
|
23
23
|
export default {
|
|
24
24
|
component: ThemeProvider,
|
|
25
|
-
title: '
|
|
25
|
+
title: 'Other/ThemeProvider',
|
|
26
26
|
} satisfies Meta<typeof ThemeProvider>;
|
|
27
27
|
|
|
28
28
|
type Story = StoryObj<typeof ThemeProvider>;
|