@transferwise/components 0.0.0-experimental-15e023f → 0.0.0-experimental-971af43
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/badge/BadgeAssets.js +1 -2
- package/build/badge/BadgeAssets.js.map +1 -1
- package/build/badge/BadgeAssets.mjs +1 -2
- package/build/badge/BadgeAssets.mjs.map +1 -1
- package/build/types/badge/BadgeAssets.d.ts.map +1 -1
- package/package.json +12 -6
- package/src/alert/Alert.story.tsx +33 -1
- package/src/avatarView/AvatarView.story.tsx +1 -1
- package/src/avatarView/AvatarView.test.story.tsx +1 -108
- package/src/badge/BadgeAssets.tsx +0 -2
- package/src/button/_stories/Button.story.tsx +9 -0
- package/src/section/Section.story.tsx +2 -8
- package/src/statusIcon/StatusIcon.test.tsx +0 -2
|
@@ -50,8 +50,7 @@ function BadgeAssets({
|
|
|
50
50
|
size: size,
|
|
51
51
|
fixedSize: true,
|
|
52
52
|
style: {
|
|
53
|
-
backgroundColor: type === 'action' ? 'var(--color-interactive-accent)' : 'var(--color-background-neutral)'
|
|
54
|
-
color: type === 'action' ? 'var(--color-interactive-control)' : 'var(--color-content-primary)'
|
|
53
|
+
backgroundColor: type === 'action' ? 'var(--color-interactive-accent)' : 'var(--color-background-neutral)'
|
|
55
54
|
},
|
|
56
55
|
children: icon ?? /*#__PURE__*/jsxRuntime.jsx(icons.Plus, {})
|
|
57
56
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BadgeAssets.js","sources":["../../src/badge/BadgeAssets.tsx"],"sourcesContent":["import { Plus } from '@transferwise/icons';\nimport { Flag } from '@wise/art';\nimport StatusIcon, { StatusIconProps } from '../statusIcon';\nimport Circle from '../common/circle';\nimport Image from '../image';\n\nexport type Props = {\n status?: StatusIconProps['sentiment'];\n flagCode?: string;\n imgSrc?: string;\n icon?: React.ReactNode;\n type?: 'action' | 'reference' | 'notification' | 'online';\n size?: 16 | 24;\n};\n\n/**\n * Common pre-built badge variants.\n */\nexport default function BadgeAssets({\n status,\n flagCode,\n imgSrc,\n icon = null,\n type = 'action',\n size,\n}: Props) {\n if (status) {\n return <StatusIcon sentiment={status} size={size} />;\n }\n if (flagCode) {\n return (\n <Circle size={size} fixedSize enableBorder>\n <Flag code={flagCode} intrinsicSize={size} />\n </Circle>\n );\n }\n if (imgSrc) {\n return (\n <Circle size={size} fixedSize enableBorder>\n <Image src={imgSrc} alt=\"\" />\n </Circle>\n );\n }\n if (['action', 'reference'].includes(type)) {\n return (\n <Circle\n size={size}\n fixedSize\n style={{\n backgroundColor:\n type === 'action'\n ? 'var(--color-interactive-accent)'\n : 'var(--color-background-neutral)',\n
|
|
1
|
+
{"version":3,"file":"BadgeAssets.js","sources":["../../src/badge/BadgeAssets.tsx"],"sourcesContent":["import { Plus } from '@transferwise/icons';\nimport { Flag } from '@wise/art';\nimport StatusIcon, { StatusIconProps } from '../statusIcon';\nimport Circle from '../common/circle';\nimport Image from '../image';\n\nexport type Props = {\n status?: StatusIconProps['sentiment'];\n flagCode?: string;\n imgSrc?: string;\n icon?: React.ReactNode;\n type?: 'action' | 'reference' | 'notification' | 'online';\n size?: 16 | 24;\n};\n\n/**\n * Common pre-built badge variants.\n */\nexport default function BadgeAssets({\n status,\n flagCode,\n imgSrc,\n icon = null,\n type = 'action',\n size,\n}: Props) {\n if (status) {\n return <StatusIcon sentiment={status} size={size} />;\n }\n if (flagCode) {\n return (\n <Circle size={size} fixedSize enableBorder>\n <Flag code={flagCode} intrinsicSize={size} />\n </Circle>\n );\n }\n if (imgSrc) {\n return (\n <Circle size={size} fixedSize enableBorder>\n <Image src={imgSrc} alt=\"\" />\n </Circle>\n );\n }\n if (['action', 'reference'].includes(type)) {\n return (\n <Circle\n size={size}\n fixedSize\n style={{\n backgroundColor:\n type === 'action'\n ? 'var(--color-interactive-accent)'\n : 'var(--color-background-neutral)',\n }}\n >\n {icon ?? <Plus />}\n </Circle>\n );\n }\n return null;\n}\n"],"names":["BadgeAssets","status","flagCode","imgSrc","icon","type","size","_jsx","StatusIcon","sentiment","Circle","fixedSize","enableBorder","children","Flag","code","intrinsicSize","Image","src","alt","includes","style","backgroundColor","Plus"],"mappings":";;;;;;;;;;;AAkBc,SAAUA,WAAWA,CAAC;EAClCC,MAAM;EACNC,QAAQ;EACRC,MAAM;AACNC,EAAAA,IAAI,GAAG,IAAI;AACXC,EAAAA,IAAI,GAAG,QAAQ;AACfC,EAAAA;AAAI,CACE,EAAA;AACN,EAAA,IAAIL,MAAM,EAAE;IACV,oBAAOM,cAAA,CAACC,kBAAU,EAAA;AAACC,MAAAA,SAAS,EAAER,MAAO;AAACK,MAAAA,IAAI,EAAEA;AAAK,MAAG;AACtD,EAAA;AACA,EAAA,IAAIJ,QAAQ,EAAE;IACZ,oBACEK,cAAA,CAACG,cAAM,EAAA;AAACJ,MAAAA,IAAI,EAAEA,IAAK;MAACK,SAAS,EAAA,IAAA;MAACC,YAAY,EAAA,IAAA;MAAAC,QAAA,eACxCN,cAAA,CAACO,QAAI,EAAA;AAACC,QAAAA,IAAI,EAAEb,QAAS;AAACc,QAAAA,aAAa,EAAEV;OAAK;AAC5C,KAAQ,CAAC;AAEb,EAAA;AACA,EAAA,IAAIH,MAAM,EAAE;IACV,oBACEI,cAAA,CAACG,cAAM,EAAA;AAACJ,MAAAA,IAAI,EAAEA,IAAK;MAACK,SAAS,EAAA,IAAA;MAACC,YAAY,EAAA,IAAA;MAAAC,QAAA,eACxCN,cAAA,CAACU,aAAK,EAAA;AAACC,QAAAA,GAAG,EAAEf,MAAO;AAACgB,QAAAA,GAAG,EAAC;OAAE;AAC5B,KAAQ,CAAC;AAEb,EAAA;EACA,IAAI,CAAC,QAAQ,EAAE,WAAW,CAAC,CAACC,QAAQ,CAACf,IAAI,CAAC,EAAE;IAC1C,oBACEE,cAAA,CAACG,cAAM,EAAA;AACLJ,MAAAA,IAAI,EAAEA,IAAK;MACXK,SAAS,EAAA,IAAA;AACTU,MAAAA,KAAK,EAAE;AACLC,QAAAA,eAAe,EACbjB,IAAI,KAAK,QAAQ,GACb,iCAAiC,GACjC;OACN;AAAAQ,MAAAA,QAAA,EAEDT,IAAI,iBAAIG,cAAA,CAACgB,UAAI,EAAA;AAAG,KACX,CAAC;AAEb,EAAA;AACA,EAAA,OAAO,IAAI;AACb;;;;"}
|
|
@@ -46,8 +46,7 @@ function BadgeAssets({
|
|
|
46
46
|
size: size,
|
|
47
47
|
fixedSize: true,
|
|
48
48
|
style: {
|
|
49
|
-
backgroundColor: type === 'action' ? 'var(--color-interactive-accent)' : 'var(--color-background-neutral)'
|
|
50
|
-
color: type === 'action' ? 'var(--color-interactive-control)' : 'var(--color-content-primary)'
|
|
49
|
+
backgroundColor: type === 'action' ? 'var(--color-interactive-accent)' : 'var(--color-background-neutral)'
|
|
51
50
|
},
|
|
52
51
|
children: icon ?? /*#__PURE__*/jsx(Plus, {})
|
|
53
52
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BadgeAssets.mjs","sources":["../../src/badge/BadgeAssets.tsx"],"sourcesContent":["import { Plus } from '@transferwise/icons';\nimport { Flag } from '@wise/art';\nimport StatusIcon, { StatusIconProps } from '../statusIcon';\nimport Circle from '../common/circle';\nimport Image from '../image';\n\nexport type Props = {\n status?: StatusIconProps['sentiment'];\n flagCode?: string;\n imgSrc?: string;\n icon?: React.ReactNode;\n type?: 'action' | 'reference' | 'notification' | 'online';\n size?: 16 | 24;\n};\n\n/**\n * Common pre-built badge variants.\n */\nexport default function BadgeAssets({\n status,\n flagCode,\n imgSrc,\n icon = null,\n type = 'action',\n size,\n}: Props) {\n if (status) {\n return <StatusIcon sentiment={status} size={size} />;\n }\n if (flagCode) {\n return (\n <Circle size={size} fixedSize enableBorder>\n <Flag code={flagCode} intrinsicSize={size} />\n </Circle>\n );\n }\n if (imgSrc) {\n return (\n <Circle size={size} fixedSize enableBorder>\n <Image src={imgSrc} alt=\"\" />\n </Circle>\n );\n }\n if (['action', 'reference'].includes(type)) {\n return (\n <Circle\n size={size}\n fixedSize\n style={{\n backgroundColor:\n type === 'action'\n ? 'var(--color-interactive-accent)'\n : 'var(--color-background-neutral)',\n
|
|
1
|
+
{"version":3,"file":"BadgeAssets.mjs","sources":["../../src/badge/BadgeAssets.tsx"],"sourcesContent":["import { Plus } from '@transferwise/icons';\nimport { Flag } from '@wise/art';\nimport StatusIcon, { StatusIconProps } from '../statusIcon';\nimport Circle from '../common/circle';\nimport Image from '../image';\n\nexport type Props = {\n status?: StatusIconProps['sentiment'];\n flagCode?: string;\n imgSrc?: string;\n icon?: React.ReactNode;\n type?: 'action' | 'reference' | 'notification' | 'online';\n size?: 16 | 24;\n};\n\n/**\n * Common pre-built badge variants.\n */\nexport default function BadgeAssets({\n status,\n flagCode,\n imgSrc,\n icon = null,\n type = 'action',\n size,\n}: Props) {\n if (status) {\n return <StatusIcon sentiment={status} size={size} />;\n }\n if (flagCode) {\n return (\n <Circle size={size} fixedSize enableBorder>\n <Flag code={flagCode} intrinsicSize={size} />\n </Circle>\n );\n }\n if (imgSrc) {\n return (\n <Circle size={size} fixedSize enableBorder>\n <Image src={imgSrc} alt=\"\" />\n </Circle>\n );\n }\n if (['action', 'reference'].includes(type)) {\n return (\n <Circle\n size={size}\n fixedSize\n style={{\n backgroundColor:\n type === 'action'\n ? 'var(--color-interactive-accent)'\n : 'var(--color-background-neutral)',\n }}\n >\n {icon ?? <Plus />}\n </Circle>\n );\n }\n return null;\n}\n"],"names":["BadgeAssets","status","flagCode","imgSrc","icon","type","size","_jsx","StatusIcon","sentiment","Circle","fixedSize","enableBorder","children","Flag","code","intrinsicSize","Image","src","alt","includes","style","backgroundColor","Plus"],"mappings":";;;;;;;AAkBc,SAAUA,WAAWA,CAAC;EAClCC,MAAM;EACNC,QAAQ;EACRC,MAAM;AACNC,EAAAA,IAAI,GAAG,IAAI;AACXC,EAAAA,IAAI,GAAG,QAAQ;AACfC,EAAAA;AAAI,CACE,EAAA;AACN,EAAA,IAAIL,MAAM,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": "@transferwise/components",
|
|
3
|
-
"version": "0.0.0-experimental-
|
|
3
|
+
"version": "0.0.0-experimental-971af43",
|
|
4
4
|
"description": "Neptune React components",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -43,7 +43,11 @@
|
|
|
43
43
|
"@babel/preset-env": "^7.29.2",
|
|
44
44
|
"@babel/preset-react": "^7.28.5",
|
|
45
45
|
"@babel/preset-typescript": "^7.28.5",
|
|
46
|
+
"@codemirror/autocomplete": "^6.20.1",
|
|
47
|
+
"@codemirror/lang-javascript": "^6.2.5",
|
|
48
|
+
"@codemirror/language": "^6.12.3",
|
|
46
49
|
"@formatjs/cli": "^6.14.1",
|
|
50
|
+
"@lezer/highlight": "^1.2.3",
|
|
47
51
|
"@rollup/plugin-babel": "^6.1.0",
|
|
48
52
|
"@rollup/plugin-json": "^6.1.0",
|
|
49
53
|
"@rollup/plugin-node-resolve": "^16.0.3",
|
|
@@ -69,6 +73,7 @@
|
|
|
69
73
|
"@types/react": "^18.3.28",
|
|
70
74
|
"@types/react-dom": "^18.3.7",
|
|
71
75
|
"@types/react-transition-group": "4.4.12",
|
|
76
|
+
"@uiw/react-codemirror": "^4.25.9",
|
|
72
77
|
"@wise/art": "^2.26.0",
|
|
73
78
|
"@wise/eslint-config": "^13.3.0",
|
|
74
79
|
"babel-plugin-formatjs": "^10.5.41",
|
|
@@ -81,15 +86,16 @@
|
|
|
81
86
|
"jsdom-testing-mocks": "^1.16.0",
|
|
82
87
|
"lodash.times": "^4.3.2",
|
|
83
88
|
"react-intl": "^7.1.14",
|
|
89
|
+
"react-live": "^4.1.8",
|
|
84
90
|
"rollup": "^4.60.1",
|
|
85
91
|
"rollup-preserve-directives": "^1.1.3",
|
|
86
92
|
"storybook": "^10.3.4",
|
|
87
93
|
"storybook-addon-tag-badges": "^3.1.0",
|
|
88
94
|
"storybook-addon-test-codegen": "^3.0.1",
|
|
89
|
-
"@transferwise/less-config": "3.1.2",
|
|
90
|
-
"@transferwise/neptune-css": "14.27.1",
|
|
91
95
|
"@wise/components-theming": "1.10.1",
|
|
92
|
-
"@
|
|
96
|
+
"@transferwise/neptune-css": "14.27.1",
|
|
97
|
+
"@wise/wds-configs": "0.0.0",
|
|
98
|
+
"@transferwise/less-config": "3.1.2"
|
|
93
99
|
},
|
|
94
100
|
"peerDependencies": {
|
|
95
101
|
"@transferwise/icons": "^3 || ^4",
|
|
@@ -107,6 +113,7 @@
|
|
|
107
113
|
"@react-aria/focus": "^3.21.5",
|
|
108
114
|
"@react-aria/overlays": "^3.31.2",
|
|
109
115
|
"@transferwise/formatting": "^2.14.0",
|
|
116
|
+
"@transferwise/neptune-tokens": "^8.20.3",
|
|
110
117
|
"@transferwise/neptune-validation": "^3.3.3",
|
|
111
118
|
"clsx": "^2.1.1",
|
|
112
119
|
"commonmark": "^0.31.2",
|
|
@@ -116,8 +123,7 @@
|
|
|
116
123
|
"lodash.debounce": "^4.0.8",
|
|
117
124
|
"merge-props": "^6.0.0",
|
|
118
125
|
"react-transition-group": "^4.4.5",
|
|
119
|
-
"virtua": "^0.48.8"
|
|
120
|
-
"@transferwise/neptune-tokens": "^8.20.3"
|
|
126
|
+
"virtua": "^0.48.8"
|
|
121
127
|
},
|
|
122
128
|
"publishConfig": {
|
|
123
129
|
"access": "public",
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { useState } from 'react';
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
2
|
import { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
3
3
|
import { action } from 'storybook/actions';
|
|
4
4
|
import { ClockBorderless } from '@transferwise/icons';
|
|
5
|
+
import { createSandboxStory } from '../../.storybook/components/sandbox/SandboxEditor';
|
|
5
6
|
|
|
6
7
|
import { lorem40 } from '../test-utils';
|
|
7
8
|
import { Sentiment, Status } from '../common';
|
|
@@ -48,6 +49,37 @@ type Story = StoryObj<typeof Alert>;
|
|
|
48
49
|
|
|
49
50
|
export const Basic: Story = {};
|
|
50
51
|
|
|
52
|
+
export const Sandbox = createSandboxStory({
|
|
53
|
+
noInline: true,
|
|
54
|
+
code: `const App = () => {
|
|
55
|
+
const [dismissed, setDismissed] = React.useState(false);
|
|
56
|
+
|
|
57
|
+
if (dismissed) {
|
|
58
|
+
return (
|
|
59
|
+
<button onClick={() => setDismissed(false)}>
|
|
60
|
+
Show alert again
|
|
61
|
+
</button>
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
return (
|
|
66
|
+
<Alert
|
|
67
|
+
action={{
|
|
68
|
+
'aria-label': 'Learn more',
|
|
69
|
+
text: 'Learn more',
|
|
70
|
+
href: '#',
|
|
71
|
+
}}
|
|
72
|
+
message="Payments sent to your bank details **today** might not arrive in time for the holidays."
|
|
73
|
+
onDismiss={() => setDismissed(true)}
|
|
74
|
+
type="positive"
|
|
75
|
+
/>
|
|
76
|
+
);
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
render(<App />);`,
|
|
80
|
+
scope: { Alert, React },
|
|
81
|
+
});
|
|
82
|
+
|
|
51
83
|
export const Variants: Story = {
|
|
52
84
|
render: ({ message }) => {
|
|
53
85
|
const variants = [
|
|
@@ -207,7 +207,7 @@ export const Badge: Story = {
|
|
|
207
207
|
className="d-flex align-items-center justify-content-center"
|
|
208
208
|
style={{
|
|
209
209
|
backgroundColor: 'var(--color-bright-pink)',
|
|
210
|
-
color: 'var(--color-
|
|
210
|
+
color: 'var(--color-interactive-primary)',
|
|
211
211
|
width: '100%',
|
|
212
212
|
height: '100%',
|
|
213
213
|
}}
|
|
@@ -1,18 +1,8 @@
|
|
|
1
1
|
import { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
2
|
-
import {
|
|
3
|
-
Camera,
|
|
4
|
-
Convert,
|
|
5
|
-
FastFlag,
|
|
6
|
-
Graph,
|
|
7
|
-
Leaf,
|
|
8
|
-
Money,
|
|
9
|
-
PlusCircle,
|
|
10
|
-
Rewards,
|
|
11
|
-
} from '@transferwise/icons';
|
|
2
|
+
import { Graph, Money, PlusCircle, Rewards } from '@transferwise/icons';
|
|
12
3
|
import AvatarView from '.';
|
|
13
4
|
import { getBrandColorFromSeed, getInitials, ProfileType } from '../common';
|
|
14
5
|
import Display from '../display';
|
|
15
|
-
import { withVariantConfig } from '../../.storybook/helpers';
|
|
16
6
|
|
|
17
7
|
const meta: Meta<typeof AvatarView> = {
|
|
18
8
|
component: AvatarView,
|
|
@@ -122,100 +112,3 @@ export const ProfileBrokenImageFallback: Story = {
|
|
|
122
112
|
);
|
|
123
113
|
},
|
|
124
114
|
};
|
|
125
|
-
|
|
126
|
-
/** Badge types across default and dark themes to verify icon color visibility. */
|
|
127
|
-
export const BadgeVariants: Story = {
|
|
128
|
-
render: function Render() {
|
|
129
|
-
return (
|
|
130
|
-
<div style={{ display: 'flex', flexDirection: 'column', gap: '16px' }}>
|
|
131
|
-
<div style={{ display: 'flex', gap: '12px', alignItems: 'center' }}>
|
|
132
|
-
<AvatarView size={32} badge={{ type: 'action' }}>
|
|
133
|
-
<Money />
|
|
134
|
-
</AvatarView>
|
|
135
|
-
<AvatarView size={48} badge={{ type: 'action' }}>
|
|
136
|
-
<Money />
|
|
137
|
-
</AvatarView>
|
|
138
|
-
<AvatarView size={32} badge={{ type: 'action', icon: <Camera /> }}>
|
|
139
|
-
<Money />
|
|
140
|
-
</AvatarView>
|
|
141
|
-
<AvatarView
|
|
142
|
-
size={48}
|
|
143
|
-
imgSrc="../avatar-square-dude.webp"
|
|
144
|
-
badge={{ type: 'action', icon: <Camera /> }}
|
|
145
|
-
/>
|
|
146
|
-
</div>
|
|
147
|
-
<div style={{ display: 'flex', gap: '12px', alignItems: 'center' }}>
|
|
148
|
-
<AvatarView size={32} badge={{ type: 'reference' }}>
|
|
149
|
-
<Money />
|
|
150
|
-
</AvatarView>
|
|
151
|
-
<AvatarView size={48} badge={{ type: 'reference' }}>
|
|
152
|
-
<Money />
|
|
153
|
-
</AvatarView>
|
|
154
|
-
<AvatarView size={32} badge={{ type: 'reference', icon: <Convert /> }}>
|
|
155
|
-
<Money />
|
|
156
|
-
</AvatarView>
|
|
157
|
-
<AvatarView
|
|
158
|
-
size={48}
|
|
159
|
-
imgSrc="../avatar-square-dude.webp"
|
|
160
|
-
badge={{ type: 'reference', icon: <Convert /> }}
|
|
161
|
-
/>
|
|
162
|
-
</div>
|
|
163
|
-
<div style={{ display: 'flex', gap: '12px', alignItems: 'center' }}>
|
|
164
|
-
<AvatarView size={32} badge={{ icon: <FastFlag /> }}>
|
|
165
|
-
<Money />
|
|
166
|
-
</AvatarView>
|
|
167
|
-
<AvatarView size={48} badge={{ icon: <FastFlag /> }}>
|
|
168
|
-
<Money />
|
|
169
|
-
</AvatarView>
|
|
170
|
-
<AvatarView size={32} badge={{ status: 'warning' }}>
|
|
171
|
-
<Money />
|
|
172
|
-
</AvatarView>
|
|
173
|
-
<AvatarView size={48} badge={{ status: 'negative' }}>
|
|
174
|
-
<Money />
|
|
175
|
-
</AvatarView>
|
|
176
|
-
</div>
|
|
177
|
-
<div style={{ display: 'flex', gap: '12px', alignItems: 'center' }}>
|
|
178
|
-
<AvatarView
|
|
179
|
-
size={32}
|
|
180
|
-
imgSrc="../avatar-square-dude.webp"
|
|
181
|
-
badge={{
|
|
182
|
-
asset: (
|
|
183
|
-
<div
|
|
184
|
-
className="d-flex align-items-center justify-content-center"
|
|
185
|
-
style={{
|
|
186
|
-
backgroundColor: 'var(--color-bright-pink)',
|
|
187
|
-
color: 'var(--color-dark-maroon)',
|
|
188
|
-
width: '100%',
|
|
189
|
-
height: '100%',
|
|
190
|
-
}}
|
|
191
|
-
>
|
|
192
|
-
<Leaf />
|
|
193
|
-
</div>
|
|
194
|
-
),
|
|
195
|
-
}}
|
|
196
|
-
/>
|
|
197
|
-
<AvatarView
|
|
198
|
-
size={48}
|
|
199
|
-
imgSrc="../avatar-square-dude.webp"
|
|
200
|
-
badge={{
|
|
201
|
-
asset: (
|
|
202
|
-
<div
|
|
203
|
-
className="d-flex align-items-center justify-content-center"
|
|
204
|
-
style={{
|
|
205
|
-
backgroundColor: 'var(--color-bright-pink)',
|
|
206
|
-
color: 'var(--color-dark-maroon)',
|
|
207
|
-
width: '100%',
|
|
208
|
-
height: '100%',
|
|
209
|
-
}}
|
|
210
|
-
>
|
|
211
|
-
<Leaf />
|
|
212
|
-
</div>
|
|
213
|
-
),
|
|
214
|
-
}}
|
|
215
|
-
/>
|
|
216
|
-
</div>
|
|
217
|
-
</div>
|
|
218
|
-
);
|
|
219
|
-
},
|
|
220
|
-
...withVariantConfig(['default', 'dark']),
|
|
221
|
-
};
|
|
@@ -51,8 +51,6 @@ export default function BadgeAssets({
|
|
|
51
51
|
type === 'action'
|
|
52
52
|
? 'var(--color-interactive-accent)'
|
|
53
53
|
: 'var(--color-background-neutral)',
|
|
54
|
-
color:
|
|
55
|
-
type === 'action' ? 'var(--color-interactive-control)' : 'var(--color-content-primary)',
|
|
56
54
|
}}
|
|
57
55
|
>
|
|
58
56
|
{icon ?? <Plus />}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
2
2
|
import { fn } from 'storybook/test';
|
|
3
3
|
import { Freeze, ArrowRight, ChevronRight } from '@transferwise/icons';
|
|
4
|
+
import { createSandboxStory } from '../../../.storybook/components/sandbox/SandboxEditor';
|
|
5
|
+
import { globalScope } from '../../../.storybook/components/sandbox/sandboxScope';
|
|
4
6
|
import { Flag } from '@wise/art';
|
|
5
7
|
import { lorem10, lorem20 } from '../../test-utils';
|
|
6
8
|
import SentimentSurface from '../../sentimentSurface';
|
|
@@ -317,6 +319,13 @@ export const Playground: StoryObj<PreviewStoryArgs> = {
|
|
|
317
319
|
},
|
|
318
320
|
};
|
|
319
321
|
|
|
322
|
+
export const Sandbox = createSandboxStory({
|
|
323
|
+
code: `<Button v2 size="md" onClick={() => alert('clicked')}>
|
|
324
|
+
Click me
|
|
325
|
+
</Button>`,
|
|
326
|
+
scope: { ...globalScope, Freeze, ArrowRight },
|
|
327
|
+
});
|
|
328
|
+
|
|
320
329
|
/**
|
|
321
330
|
* There are two different types of button – default and negative – designed to emphasise the nature of the action. <br />
|
|
322
331
|
* **NB:** Sentiment only applies to `primary` and `secondary` priorities. <br />
|
|
@@ -108,14 +108,8 @@ export const WithListItems = () => {
|
|
|
108
108
|
return (
|
|
109
109
|
<Section>
|
|
110
110
|
<Header title="Section with list items" />
|
|
111
|
-
<ListItem
|
|
112
|
-
|
|
113
|
-
control={<ListItem.Navigation onClick={() => action('Item 1')} />}
|
|
114
|
-
/>
|
|
115
|
-
<ListItem
|
|
116
|
-
title="Item 2"
|
|
117
|
-
control={<ListItem.Navigation onClick={() => action('Item 2')} />}
|
|
118
|
-
/>
|
|
111
|
+
<ListItem title="Item 1" control={<ListItem.Navigation onClick={() => action('Item 1')} />} />
|
|
112
|
+
<ListItem title="Item 2" control={<ListItem.Navigation onClick={() => action('Item 2')} />} />
|
|
119
113
|
</Section>
|
|
120
114
|
);
|
|
121
115
|
};
|
|
@@ -42,7 +42,6 @@ describe('StatusIcon', () => {
|
|
|
42
42
|
},
|
|
43
43
|
);
|
|
44
44
|
|
|
45
|
-
|
|
46
45
|
it.each([
|
|
47
46
|
[Sentiment.WARNING, 'alert-icon'],
|
|
48
47
|
[Sentiment.PENDING, 'clock-borderless-icon'],
|
|
@@ -61,7 +60,6 @@ describe('StatusIcon', () => {
|
|
|
61
60
|
},
|
|
62
61
|
);
|
|
63
62
|
|
|
64
|
-
|
|
65
63
|
describe('accessible name', () => {
|
|
66
64
|
it.each([
|
|
67
65
|
['Error', Sentiment.NEGATIVE],
|