@transferwise/components 0.0.0-experimental-28eac06 → 0.0.0-experimental-9b6d886
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/alert/Alert.js +17 -17
- package/build/alert/Alert.js.map +1 -1
- package/build/alert/Alert.mjs +14 -14
- package/build/alert/Alert.mjs.map +1 -1
- package/build/avatarLayout/AvatarLayout.js +2 -9
- package/build/avatarLayout/AvatarLayout.js.map +1 -1
- package/build/avatarLayout/AvatarLayout.mjs +2 -9
- package/build/avatarLayout/AvatarLayout.mjs.map +1 -1
- package/build/button/Button.js +79 -86
- package/build/button/Button.js.map +1 -1
- package/build/button/Button.mjs +80 -87
- package/build/button/Button.mjs.map +1 -1
- package/build/circularButton/CircularButton.js.map +1 -1
- package/build/circularButton/CircularButton.mjs.map +1 -1
- package/build/common/action/Action.js +15 -26
- package/build/common/action/Action.js.map +1 -1
- package/build/common/action/Action.mjs +15 -26
- package/build/common/action/Action.mjs.map +1 -1
- package/build/common/propsValues/sentiment.js +0 -1
- package/build/common/propsValues/sentiment.js.map +1 -1
- package/build/common/propsValues/sentiment.mjs +0 -1
- package/build/common/propsValues/sentiment.mjs.map +1 -1
- package/build/criticalBanner/CriticalCommsBanner.js +73 -10
- package/build/criticalBanner/CriticalCommsBanner.js.map +1 -1
- package/build/criticalBanner/CriticalCommsBanner.mjs +74 -11
- package/build/criticalBanner/CriticalCommsBanner.mjs.map +1 -1
- package/build/header/Header.js +2 -2
- package/build/header/Header.js.map +1 -1
- package/build/header/Header.mjs +1 -1
- package/build/i18n/en.json +0 -1
- package/build/i18n/en.json.js +0 -1
- package/build/i18n/en.json.js.map +1 -1
- package/build/i18n/en.json.mjs +0 -1
- package/build/i18n/en.json.mjs.map +1 -1
- package/build/i18n/ja.json +1 -0
- package/build/i18n/ja.json.js +1 -0
- package/build/i18n/ja.json.js.map +1 -1
- package/build/i18n/ja.json.mjs +1 -0
- package/build/i18n/ja.json.mjs.map +1 -1
- package/build/i18n/pt.json +1 -0
- package/build/i18n/pt.json.js +1 -0
- package/build/i18n/pt.json.js.map +1 -1
- package/build/i18n/pt.json.mjs +1 -0
- package/build/i18n/pt.json.mjs.map +1 -1
- package/build/i18n/ru.json +1 -0
- package/build/i18n/ru.json.js +1 -0
- package/build/i18n/ru.json.js.map +1 -1
- package/build/i18n/ru.json.mjs +1 -0
- package/build/i18n/ru.json.mjs.map +1 -1
- package/build/i18n/zh-HK.json +1 -0
- package/build/i18n/zh-HK.json.js +1 -0
- package/build/i18n/zh-HK.json.js.map +1 -1
- package/build/i18n/zh-HK.json.mjs +1 -0
- package/build/i18n/zh-HK.json.mjs.map +1 -1
- package/build/index.js +2 -2
- package/build/index.mjs +1 -1
- package/build/link/Link.js +3 -8
- package/build/link/Link.js.map +1 -1
- package/build/link/Link.mjs +3 -8
- package/build/link/Link.mjs.map +1 -1
- package/build/main.css +70 -267
- package/build/primitives/PrimitiveAnchor/src/PrimitiveAnchor.js +4 -2
- package/build/primitives/PrimitiveAnchor/src/PrimitiveAnchor.js.map +1 -1
- package/build/primitives/PrimitiveAnchor/src/PrimitiveAnchor.mjs +4 -2
- package/build/primitives/PrimitiveAnchor/src/PrimitiveAnchor.mjs.map +1 -1
- package/build/primitives/PrimitiveButton/src/PrimitiveButton.js +5 -3
- package/build/primitives/PrimitiveButton/src/PrimitiveButton.js.map +1 -1
- package/build/primitives/PrimitiveButton/src/PrimitiveButton.mjs +5 -3
- package/build/primitives/PrimitiveButton/src/PrimitiveButton.mjs.map +1 -1
- package/build/select/Select.js +2 -2
- package/build/select/Select.js.map +1 -1
- package/build/select/Select.mjs +1 -1
- package/build/statusIcon/StatusIcon.js +1 -5
- package/build/statusIcon/StatusIcon.js.map +1 -1
- package/build/statusIcon/StatusIcon.messages.js +0 -3
- package/build/statusIcon/StatusIcon.messages.js.map +1 -1
- package/build/statusIcon/StatusIcon.messages.mjs +0 -3
- package/build/statusIcon/StatusIcon.messages.mjs.map +1 -1
- package/build/statusIcon/StatusIcon.mjs +1 -5
- package/build/statusIcon/StatusIcon.mjs.map +1 -1
- package/build/styles/avatarLayout/AvatarLayout.css +0 -11
- package/build/styles/button/Button.css +15 -230
- package/build/styles/criticalBanner/CriticalCommsBanner.css +73 -21
- package/build/styles/main.css +70 -267
- package/build/types/alert/Alert.d.ts +4 -3
- package/build/types/alert/Alert.d.ts.map +1 -1
- package/build/types/avatarLayout/AvatarLayout.d.ts.map +1 -1
- package/build/types/button/Button.d.ts +23 -2
- package/build/types/button/Button.d.ts.map +1 -1
- package/build/types/button/index.d.ts +2 -2
- package/build/types/button/index.d.ts.map +1 -1
- package/build/types/circularButton/CircularButton.d.ts.map +1 -1
- package/build/types/common/action/Action.d.ts +2 -5
- package/build/types/common/action/Action.d.ts.map +1 -1
- package/build/types/common/propsValues/sentiment.d.ts +0 -1
- package/build/types/common/propsValues/sentiment.d.ts.map +1 -1
- package/build/types/criticalBanner/CriticalCommsBanner.d.ts.map +1 -1
- package/build/types/index.d.ts +1 -0
- package/build/types/index.d.ts.map +1 -1
- package/build/types/link/Link.d.ts +2 -2
- package/build/types/link/Link.d.ts.map +1 -1
- package/build/types/primitives/PrimitiveAnchor/src/PrimitiveAnchor.d.ts.map +1 -1
- package/build/types/primitives/PrimitiveAnchor/src/PrimitiveAnchor.types.d.ts +2 -6
- package/build/types/primitives/PrimitiveAnchor/src/PrimitiveAnchor.types.d.ts.map +1 -1
- package/build/types/primitives/PrimitiveButton/src/PrimitiveButton.d.ts.map +1 -1
- package/build/types/statusIcon/StatusIcon.d.ts.map +1 -1
- package/build/types/statusIcon/StatusIcon.messages.d.ts +0 -5
- package/build/types/statusIcon/StatusIcon.messages.d.ts.map +1 -1
- package/build/types/test-utils/index.d.ts +0 -2
- package/build/types/test-utils/index.d.ts.map +1 -1
- package/build/types/test-utils/story-config.d.ts +1 -1
- package/build/types/test-utils/story-config.d.ts.map +1 -1
- package/build/upload/steps/completeStep/completeStep.js +2 -2
- package/build/upload/steps/completeStep/completeStep.js.map +1 -1
- package/build/upload/steps/completeStep/completeStep.mjs +1 -1
- package/build/upload/steps/processingStep/processingStep.js +2 -2
- package/build/upload/steps/processingStep/processingStep.js.map +1 -1
- package/build/upload/steps/processingStep/processingStep.mjs +1 -1
- package/build/uploadInput/UploadInput.js +3 -3
- package/build/uploadInput/UploadInput.js.map +1 -1
- package/build/uploadInput/UploadInput.mjs +1 -1
- package/package.json +3 -3
- package/src/alert/Alert.spec.tsx +30 -0
- package/src/alert/Alert.story.tsx +1 -34
- package/src/alert/Alert.tests.story.tsx +1 -1
- package/src/alert/Alert.tsx +15 -20
- package/src/avatarLayout/AvatarLayout.css +0 -11
- package/src/avatarLayout/AvatarLayout.less +1 -18
- package/src/avatarLayout/AvatarLayout.tsx +2 -10
- package/src/button/Button.css +15 -230
- package/src/button/Button.less +14 -242
- package/src/button/Button.spec.tsx +226 -215
- package/src/button/Button.story.tsx +134 -761
- package/src/button/Button.tsx +132 -103
- package/src/button/__snapshots__/Button.spec.tsx.snap +309 -0
- package/src/button/index.ts +3 -2
- package/src/circularButton/CircularButton.tsx +0 -1
- package/src/common/action/Action.tsx +22 -40
- package/src/common/propsValues/sentiment.ts +0 -1
- package/src/criticalBanner/CriticalCommsBanner.css +73 -21
- package/src/criticalBanner/CriticalCommsBanner.less +70 -24
- package/src/criticalBanner/CriticalCommsBanner.story.tsx +4 -26
- package/src/criticalBanner/CriticalCommsBanner.tsx +50 -8
- package/src/field/Field.story.tsx +1 -1
- package/src/flowNavigation/__snapshots__/FlowNavigation.spec.js.snap +2 -1
- package/src/i18n/en.json +0 -1
- package/src/i18n/ja.json +1 -0
- package/src/i18n/pt.json +1 -0
- package/src/i18n/ru.json +1 -0
- package/src/i18n/zh-HK.json +1 -0
- package/src/index.ts +1 -0
- package/src/inputs/SelectInput.story.tsx +1 -1
- package/src/label/Label.story.tsx +1 -1
- package/src/link/Link.tsx +6 -15
- package/src/main.css +70 -267
- package/src/main.less +0 -1
- package/src/primitives/PrimitiveAnchor/src/PrimitiveAnchor.tsx +8 -2
- package/src/primitives/PrimitiveAnchor/src/PrimitiveAnchor.types.ts +2 -7
- package/src/primitives/PrimitiveAnchor/test/PrimitiveAnchor.spec.tsx +3 -1
- package/src/primitives/PrimitiveButton/src/PrimitiveButton.tsx +12 -4
- package/src/primitives/PrimitiveButton/test/PrimitiveButton.spec.tsx +13 -16
- package/src/radio/Radio.spec.tsx +73 -0
- package/src/radio/Radio.story.tsx +22 -52
- package/src/radioGroup/RadioGroup.spec.tsx +91 -0
- package/src/radioGroup/RadioGroup.story.tsx +3 -5
- package/src/statusIcon/StatusIcon.less +0 -1
- package/src/statusIcon/StatusIcon.messages.ts +0 -6
- package/src/statusIcon/StatusIcon.tsx +1 -8
- package/src/test-utils/Parameters.d.ts +1 -9
- package/src/test-utils/story-config.ts +1 -10
- package/build/button/Button.resolver.js +0 -74
- package/build/button/Button.resolver.js.map +0 -1
- package/build/button/Button.resolver.mjs +0 -72
- package/build/button/Button.resolver.mjs.map +0 -1
- package/build/button/LegacyButton.js +0 -114
- package/build/button/LegacyButton.js.map +0 -1
- package/build/button/LegacyButton.mjs +0 -112
- package/build/button/LegacyButton.mjs.map +0 -1
- package/build/styles/button/Button.vars.css +0 -46
- package/build/styles/button/LegacyButton.css +0 -23
- package/build/types/button/Button.resolver.d.ts +0 -35
- package/build/types/button/Button.resolver.d.ts.map +0 -1
- package/build/types/button/Button.types.d.ts +0 -70
- package/build/types/button/Button.types.d.ts.map +0 -1
- package/build/types/button/LegacyButton.d.ts +0 -44
- package/build/types/button/LegacyButton.d.ts.map +0 -1
- package/src/button/Button.accessibility.docs.mdx +0 -103
- package/src/button/Button.resolver.tsx +0 -73
- package/src/button/Button.tests.story.tsx +0 -27
- package/src/button/Button.types.ts +0 -92
- package/src/button/Button.vars.css +0 -46
- package/src/button/Button.vars.less +0 -55
- package/src/button/LegacyButton.css +0 -23
- package/src/button/LegacyButton.less +0 -24
- package/src/button/LegacyButton.spec.tsx +0 -147
- package/src/button/LegacyButton.story.tsx +0 -228
- package/src/button/LegacyButton.tsx +0 -177
- package/src/radio/Radio.rtl.spec.tsx +0 -24
- package/src/radio/Radio.spec.js +0 -76
- package/src/radio/__snapshots__/Radio.rtl.spec.tsx.snap +0 -49
- package/src/radioGroup/RadioGroup.rtl.spec.tsx +0 -30
- package/src/radioGroup/RadioGroup.spec.js +0 -90
|
@@ -1,790 +1,163 @@
|
|
|
1
1
|
import { Meta, StoryObj } from '@storybook/react';
|
|
2
|
-
import { fn } from '@storybook/test';
|
|
3
|
-
import { Freeze, ArrowRight, ChevronRight } from '@transferwise/icons';
|
|
4
|
-
import { Flag } from '@wise/art';
|
|
5
|
-
import Button from './Button.resolver';
|
|
6
|
-
import type { ButtonProps, ButtonPriority } from './Button.types';
|
|
7
|
-
import { storyConfig } from '../test-utils';
|
|
8
|
-
|
|
9
|
-
const withContainer = (Story: any) => (
|
|
10
|
-
<div style={{ display: 'flex', justifyContent: 'center' }}>
|
|
11
|
-
<Story />
|
|
12
|
-
</div>
|
|
13
|
-
);
|
|
2
|
+
import { userEvent, within, fn } from '@storybook/test';
|
|
14
3
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
* @decorator
|
|
18
|
-
*/
|
|
19
|
-
const withComponentGrid =
|
|
20
|
-
(maxWidth = 'auto') =>
|
|
21
|
-
(Story: any) => (
|
|
22
|
-
<div
|
|
23
|
-
style={{
|
|
24
|
-
width: '100%',
|
|
25
|
-
placeItems: 'center',
|
|
26
|
-
justifyContent: 'center',
|
|
27
|
-
display: 'flex',
|
|
28
|
-
flexWrap: 'wrap',
|
|
29
|
-
gap: '2rem',
|
|
30
|
-
maxWidth,
|
|
31
|
-
}}
|
|
32
|
-
>
|
|
33
|
-
<Story />
|
|
34
|
-
</div>
|
|
35
|
-
);
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Not all stories need access to all controls as it causes unnecessary UI noise.
|
|
39
|
-
*/
|
|
40
|
-
const hideControls = (args: string[]) => {
|
|
41
|
-
const hidden = [
|
|
42
|
-
'addonStart',
|
|
43
|
-
'addonEnd',
|
|
44
|
-
'onClick',
|
|
45
|
-
'onBlur',
|
|
46
|
-
'onFocus',
|
|
47
|
-
'onKeyDown',
|
|
48
|
-
'onMouseEnter',
|
|
49
|
-
'onMouseLeave',
|
|
50
|
-
...args,
|
|
51
|
-
];
|
|
52
|
-
|
|
53
|
-
return Object.fromEntries(hidden.map((item) => [item, { table: { disable: true } }]));
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* Convenience controls for previewing rich markup,
|
|
58
|
-
* not otherwise possible via Storybook
|
|
59
|
-
*/
|
|
60
|
-
type PreviewStoryArgs = Parameters<typeof Button>[0] & {
|
|
61
|
-
previewAddonStart: boolean | ButtonProps['addonStart'];
|
|
62
|
-
previewAddonEnd: boolean | ButtonProps['addonEnd'];
|
|
63
|
-
};
|
|
64
|
-
const previewArgTypes = {
|
|
65
|
-
previewAddonStart: {
|
|
66
|
-
control: 'select',
|
|
67
|
-
options: [
|
|
68
|
-
'undefined',
|
|
69
|
-
'icon',
|
|
70
|
-
'avatar: flag',
|
|
71
|
-
'avatar: initials',
|
|
72
|
-
'avatar: icon',
|
|
73
|
-
'avatar: image',
|
|
74
|
-
'avatar: double',
|
|
75
|
-
],
|
|
76
|
-
name: 'Preview with `addonStart`',
|
|
77
|
-
mapping: {
|
|
78
|
-
undefined,
|
|
79
|
-
icon: {
|
|
80
|
-
type: 'icon',
|
|
81
|
-
value: <Freeze />,
|
|
82
|
-
},
|
|
83
|
-
'avatar: flag': {
|
|
84
|
-
type: 'avatar',
|
|
85
|
-
value: [{ asset: <Flag code="pl" /> }],
|
|
86
|
-
},
|
|
87
|
-
'avatar: initials': {
|
|
88
|
-
type: 'avatar',
|
|
89
|
-
value: [{ profileName: 'Jay Jay' }],
|
|
90
|
-
},
|
|
91
|
-
'avatar: icon': {
|
|
92
|
-
type: 'avatar',
|
|
93
|
-
value: [{ asset: <Freeze /> }],
|
|
94
|
-
},
|
|
95
|
-
'avatar: image': {
|
|
96
|
-
type: 'avatar',
|
|
97
|
-
value: [{ imgSrc: '../avatar-square-dude.webp' }],
|
|
98
|
-
},
|
|
99
|
-
'avatar: double': {
|
|
100
|
-
type: 'avatar',
|
|
101
|
-
value: [{ asset: <Flag code="gb" /> }, { imgSrc: '../avatar-square-dude.webp' }],
|
|
102
|
-
},
|
|
103
|
-
},
|
|
104
|
-
table: {
|
|
105
|
-
category: 'Preview options',
|
|
106
|
-
type: {
|
|
107
|
-
summary: undefined,
|
|
108
|
-
},
|
|
109
|
-
},
|
|
110
|
-
description:
|
|
111
|
-
'**NB:** The `lg` button does not support any addons. `md` button accepts either icons or avatars, while `sm` is restricted to icons only.',
|
|
112
|
-
},
|
|
113
|
-
previewAddonEnd: {
|
|
114
|
-
control: 'boolean',
|
|
115
|
-
name: 'Preview with `addonEnd`',
|
|
116
|
-
mapping: {
|
|
117
|
-
true: { type: 'icon', value: <ArrowRight /> },
|
|
118
|
-
},
|
|
119
|
-
description:
|
|
120
|
-
'**NB:** The `lg` button does not support any addons. `md` and `sm` allow for the use of icons only.',
|
|
121
|
-
table: {
|
|
122
|
-
category: 'Preview options',
|
|
123
|
-
type: {
|
|
124
|
-
summary: undefined,
|
|
125
|
-
},
|
|
126
|
-
},
|
|
127
|
-
},
|
|
128
|
-
} as const;
|
|
129
|
-
|
|
130
|
-
const getPropsForPreview = (args: PreviewStoryArgs) => {
|
|
131
|
-
const { previewAddonStart, previewAddonEnd, ...props } = args as {
|
|
132
|
-
previewAddonStart: ButtonProps['addonStart'];
|
|
133
|
-
previewAddonEnd: ButtonProps['addonEnd'];
|
|
134
|
-
props: typeof Button;
|
|
135
|
-
};
|
|
4
|
+
import { ControlType, Priority } from '../common';
|
|
5
|
+
import { storyConfig } from '../test-utils';
|
|
136
6
|
|
|
137
|
-
|
|
138
|
-
props,
|
|
139
|
-
{
|
|
140
|
-
addonStart: previewAddonStart,
|
|
141
|
-
addonEnd: previewAddonEnd,
|
|
142
|
-
},
|
|
143
|
-
];
|
|
144
|
-
};
|
|
7
|
+
import Button from './Button';
|
|
145
8
|
|
|
146
|
-
|
|
147
|
-
* The stories below document the new Button API, which requires `v2` prop to function. <br />For more details please refer to the [release notes](https://transferwise.atlassian.net/wiki/spaces/DS/pages/3542158737/Button+Updates+New+sizes+Loader+and+Cue) and the [design spec](https://wise.design/components/button). <br />
|
|
148
|
-
* You can still find the old Button documentation under [Legacy Button](?path=/docs/actions-button-legacy--docs)
|
|
149
|
-
*
|
|
150
|
-
*
|
|
151
|
-
*/
|
|
152
|
-
const meta: Meta<typeof Button> = {
|
|
9
|
+
export default {
|
|
153
10
|
component: Button,
|
|
154
11
|
title: 'Actions/Button',
|
|
155
|
-
argTypes: {
|
|
156
|
-
v2: {
|
|
157
|
-
table: {
|
|
158
|
-
readonly: true,
|
|
159
|
-
},
|
|
160
|
-
description: 'If set, toggles the new Button API',
|
|
161
|
-
},
|
|
162
|
-
size: {
|
|
163
|
-
type: {
|
|
164
|
-
name: 'enum',
|
|
165
|
-
value: ['lg', 'md', 'sm'],
|
|
166
|
-
},
|
|
167
|
-
table: {
|
|
168
|
-
type: {
|
|
169
|
-
summary: 'ButtonSize',
|
|
170
|
-
},
|
|
171
|
-
},
|
|
172
|
-
},
|
|
173
|
-
priority: {
|
|
174
|
-
type: {
|
|
175
|
-
name: 'enum',
|
|
176
|
-
value: ['primary', 'secondary', 'tertiary', 'minimal'],
|
|
177
|
-
},
|
|
178
|
-
table: {
|
|
179
|
-
type: {
|
|
180
|
-
summary: 'ButtonPriority',
|
|
181
|
-
},
|
|
182
|
-
defaultValue: { summary: '"primary"' },
|
|
183
|
-
},
|
|
184
|
-
},
|
|
185
|
-
sentiment: {
|
|
186
|
-
type: {
|
|
187
|
-
name: 'enum',
|
|
188
|
-
value: ['default', 'negative'],
|
|
189
|
-
},
|
|
190
|
-
table: {
|
|
191
|
-
type: {
|
|
192
|
-
summary: 'ButtonSentiment',
|
|
193
|
-
},
|
|
194
|
-
},
|
|
195
|
-
},
|
|
196
|
-
disabled: {
|
|
197
|
-
description: 'Toggles the disabled state',
|
|
198
|
-
table: {
|
|
199
|
-
defaultValue: { summary: 'false' },
|
|
200
|
-
},
|
|
201
|
-
},
|
|
202
|
-
loading: {
|
|
203
|
-
description: 'Toggles the loading state',
|
|
204
|
-
table: {
|
|
205
|
-
defaultValue: { summary: 'false' },
|
|
206
|
-
},
|
|
207
|
-
},
|
|
208
|
-
block: {
|
|
209
|
-
table: {
|
|
210
|
-
defaultValue: { summary: 'false' },
|
|
211
|
-
},
|
|
212
|
-
},
|
|
213
|
-
href: {
|
|
214
|
-
type: {
|
|
215
|
-
name: 'string',
|
|
216
|
-
},
|
|
217
|
-
description: 'If set, the component will render as an HTML anchor.',
|
|
218
|
-
},
|
|
219
|
-
target: {
|
|
220
|
-
type: {
|
|
221
|
-
name: 'string',
|
|
222
|
-
},
|
|
223
|
-
table: {
|
|
224
|
-
type: {
|
|
225
|
-
summary: 'string',
|
|
226
|
-
},
|
|
227
|
-
},
|
|
228
|
-
},
|
|
229
|
-
addonStart: {
|
|
230
|
-
control: 'object',
|
|
231
|
-
},
|
|
232
|
-
addonEnd: {
|
|
233
|
-
control: 'object',
|
|
234
|
-
},
|
|
235
|
-
type: {
|
|
236
|
-
control: 'text',
|
|
237
|
-
table: {
|
|
238
|
-
type: {
|
|
239
|
-
summary: 'string',
|
|
240
|
-
},
|
|
241
|
-
},
|
|
242
|
-
description: "Native HTML button's `type` attribute",
|
|
243
|
-
},
|
|
244
|
-
htmlType: {
|
|
245
|
-
table: {
|
|
246
|
-
disable: true,
|
|
247
|
-
},
|
|
248
|
-
},
|
|
249
|
-
},
|
|
250
12
|
args: {
|
|
251
|
-
v2: true,
|
|
252
|
-
size: undefined,
|
|
253
|
-
priority: undefined,
|
|
254
|
-
sentiment: undefined,
|
|
255
|
-
disabled: false,
|
|
256
|
-
loading: false,
|
|
257
|
-
block: false,
|
|
258
|
-
href: undefined,
|
|
259
|
-
target: undefined,
|
|
260
|
-
as: undefined,
|
|
261
|
-
type: undefined,
|
|
262
|
-
addonStart: undefined,
|
|
263
|
-
addonEnd: undefined,
|
|
264
|
-
className: undefined,
|
|
265
13
|
children: 'Button text',
|
|
14
|
+
loading: false,
|
|
266
15
|
onClick: fn(),
|
|
267
|
-
},
|
|
268
|
-
tags: ['autodocs'],
|
|
269
|
-
decorators: [withContainer],
|
|
270
|
-
parameters: {
|
|
271
|
-
docs: {
|
|
272
|
-
toc: true,
|
|
273
|
-
},
|
|
274
|
-
},
|
|
275
|
-
};
|
|
276
|
-
|
|
277
|
-
export default meta;
|
|
278
|
-
|
|
279
|
-
type Story = StoryObj<typeof Button>;
|
|
280
|
-
|
|
281
|
-
export const Playground: StoryObj<PreviewStoryArgs> = {
|
|
282
|
-
render: function Render(args: PreviewStoryArgs) {
|
|
283
|
-
const [props, previewProps] = getPropsForPreview(args);
|
|
284
|
-
|
|
285
|
-
return <Button {...props} {...previewProps} v2 />;
|
|
286
|
-
},
|
|
287
|
-
args: {
|
|
288
16
|
onBlur: fn(),
|
|
289
17
|
onFocus: fn(),
|
|
290
|
-
onKeyDown: fn(),
|
|
291
|
-
onMouseEnter: fn(),
|
|
292
|
-
onMouseLeave: fn(),
|
|
293
|
-
previewAddonStart: false,
|
|
294
|
-
previewAddonEnd: false,
|
|
295
18
|
},
|
|
296
19
|
argTypes: {
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
onMouseEnter: { table: { disable: true } },
|
|
302
|
-
onMouseLeave: { table: { disable: true } },
|
|
303
|
-
...previewArgTypes,
|
|
304
|
-
},
|
|
305
|
-
};
|
|
306
|
-
|
|
307
|
-
/**
|
|
308
|
-
* There are two different types of button – default and negative – designed to emphasise the nature of the action. <br />
|
|
309
|
-
* **NB:** Sentiment only applies to `primary` and `secondary` priorities. <br />
|
|
310
|
-
* [Design documentation](https://wise.design/components/button#types)
|
|
311
|
-
*/
|
|
312
|
-
export const Sentiment: StoryObj<PreviewStoryArgs> = {
|
|
313
|
-
render: function Render(args: PreviewStoryArgs) {
|
|
314
|
-
const [props, previewProps] = getPropsForPreview(args);
|
|
315
|
-
|
|
316
|
-
return (
|
|
317
|
-
<>
|
|
318
|
-
<Button {...props} {...previewProps} v2>
|
|
319
|
-
Default Sentiment
|
|
320
|
-
</Button>
|
|
321
|
-
<Button {...props} {...previewProps} v2 sentiment="negative">
|
|
322
|
-
Negative Sentiment
|
|
323
|
-
</Button>
|
|
324
|
-
<Button {...props} {...previewProps} v2 priority="secondary">
|
|
325
|
-
Default Sentiment
|
|
326
|
-
</Button>
|
|
327
|
-
<Button {...props} {...previewProps} v2 priority="secondary" sentiment="negative">
|
|
328
|
-
Negative Sentiment
|
|
329
|
-
</Button>
|
|
330
|
-
</>
|
|
331
|
-
);
|
|
332
|
-
},
|
|
333
|
-
argTypes: {
|
|
334
|
-
...hideControls(['sentiment', 'priority', 'block', 'href', 'target', 'as', 'children']),
|
|
335
|
-
...previewArgTypes,
|
|
336
|
-
},
|
|
337
|
-
args: {
|
|
338
|
-
previewAddonStart: false,
|
|
339
|
-
previewAddonEnd: false,
|
|
340
|
-
},
|
|
341
|
-
decorators: [withComponentGrid('30rem')],
|
|
342
|
-
};
|
|
343
|
-
|
|
344
|
-
/**
|
|
345
|
-
* Priorities set a visual hierarchy amongst the buttons displayed on the
|
|
346
|
-
* screen to help more important buttons to take precedence over others. <br />
|
|
347
|
-
* [Design documentation](https://wise.design/components/button#priorities)
|
|
348
|
-
*/
|
|
349
|
-
export const Priority: StoryObj<PreviewStoryArgs> = {
|
|
350
|
-
render: function Render(args: PreviewStoryArgs) {
|
|
351
|
-
const [props, previewProps] = getPropsForPreview(args);
|
|
352
|
-
|
|
353
|
-
return (
|
|
354
|
-
<>
|
|
355
|
-
<Button {...props} {...previewProps} v2>
|
|
356
|
-
Primary Priority (default)
|
|
357
|
-
</Button>
|
|
358
|
-
<Button {...props} {...previewProps} v2 priority="secondary">
|
|
359
|
-
Secondary Priority
|
|
360
|
-
</Button>
|
|
361
|
-
<Button {...props} {...previewProps} v2 priority="tertiary">
|
|
362
|
-
Tertiary Priority
|
|
363
|
-
</Button>
|
|
364
|
-
<Button {...props} {...previewProps} v2 priority="minimal">
|
|
365
|
-
Minimal Priority
|
|
366
|
-
</Button>
|
|
367
|
-
</>
|
|
368
|
-
);
|
|
369
|
-
},
|
|
370
|
-
argTypes: {
|
|
371
|
-
...hideControls(['priority', 'block', 'href', 'target', 'as', 'children']),
|
|
372
|
-
...previewArgTypes,
|
|
373
|
-
},
|
|
374
|
-
args: {
|
|
375
|
-
previewAddonStart: false,
|
|
376
|
-
previewAddonEnd: false,
|
|
377
|
-
},
|
|
378
|
-
decorators: [withComponentGrid()],
|
|
379
|
-
};
|
|
380
|
-
|
|
381
|
-
/**
|
|
382
|
-
* There are three different button sizes – small (`sm`), medium (`md`) and large (`lg`) – each used for different purposes. <br />
|
|
383
|
-
* [Design documentation](https://wise.design/components/button#sizes)
|
|
384
|
-
*/
|
|
385
|
-
export const Size: StoryObj<PreviewStoryArgs> = {
|
|
386
|
-
render: function Render(args: PreviewStoryArgs) {
|
|
387
|
-
const [props, previewProps] = getPropsForPreview(args);
|
|
388
|
-
|
|
389
|
-
return (
|
|
390
|
-
<>
|
|
391
|
-
<Button {...props} {...previewProps}>
|
|
392
|
-
Large button (default)
|
|
393
|
-
</Button>
|
|
394
|
-
<Button {...props} {...previewProps} size="md">
|
|
395
|
-
Medium button
|
|
396
|
-
</Button>
|
|
397
|
-
<Button {...props} {...previewProps} size="sm">
|
|
398
|
-
Small button
|
|
399
|
-
</Button>
|
|
400
|
-
</>
|
|
401
|
-
);
|
|
402
|
-
},
|
|
403
|
-
argTypes: {
|
|
404
|
-
...hideControls(['size', 'block', 'href', 'target', 'as', 'children']),
|
|
405
|
-
...previewArgTypes,
|
|
406
|
-
},
|
|
407
|
-
args: {
|
|
408
|
-
previewAddonStart: false,
|
|
409
|
-
previewAddonEnd: false,
|
|
410
|
-
},
|
|
411
|
-
decorators: [withComponentGrid()],
|
|
412
|
-
};
|
|
413
|
-
|
|
414
|
-
/**
|
|
415
|
-
* A Button rendered as an anchor element.
|
|
416
|
-
*/
|
|
417
|
-
export const AsAnchor: StoryObj<PreviewStoryArgs> = {
|
|
418
|
-
render: function Render(args: PreviewStoryArgs) {
|
|
419
|
-
const [props, previewProps] = getPropsForPreview(args);
|
|
420
|
-
|
|
421
|
-
return (
|
|
422
|
-
<Button {...props} {...previewProps}>
|
|
423
|
-
Button as anchor
|
|
424
|
-
</Button>
|
|
425
|
-
);
|
|
426
|
-
},
|
|
427
|
-
argTypes: {
|
|
428
|
-
...hideControls(['block']),
|
|
429
|
-
...previewArgTypes,
|
|
430
|
-
},
|
|
431
|
-
args: {
|
|
432
|
-
as: 'a',
|
|
433
|
-
href: 'https://wise.com',
|
|
434
|
-
previewAddonStart: false,
|
|
435
|
-
previewAddonEnd: false,
|
|
436
|
-
onClick: undefined,
|
|
437
|
-
},
|
|
438
|
-
};
|
|
439
|
-
|
|
440
|
-
export const Disabled: StoryObj<PreviewStoryArgs> = {
|
|
441
|
-
render: function Render(args: PreviewStoryArgs) {
|
|
442
|
-
const [props, previewProps] = getPropsForPreview(args);
|
|
443
|
-
|
|
444
|
-
return (
|
|
445
|
-
<Button {...props} {...previewProps}>
|
|
446
|
-
Disabled button
|
|
447
|
-
</Button>
|
|
448
|
-
);
|
|
449
|
-
},
|
|
450
|
-
argTypes: {
|
|
451
|
-
...hideControls(['block']),
|
|
452
|
-
...previewArgTypes,
|
|
453
|
-
},
|
|
454
|
-
args: {
|
|
455
|
-
disabled: true,
|
|
456
|
-
previewAddonStart: false,
|
|
457
|
-
previewAddonEnd: false,
|
|
458
|
-
},
|
|
459
|
-
};
|
|
460
|
-
|
|
461
|
-
export const Loading: StoryObj<PreviewStoryArgs> = {
|
|
462
|
-
render: function Render(args: PreviewStoryArgs) {
|
|
463
|
-
const [props, previewProps] = getPropsForPreview(args);
|
|
464
|
-
|
|
465
|
-
return (
|
|
466
|
-
<Button {...props} {...previewProps}>
|
|
467
|
-
Button as anchor
|
|
468
|
-
</Button>
|
|
469
|
-
);
|
|
470
|
-
},
|
|
471
|
-
argTypes: {
|
|
472
|
-
...hideControls(['block']),
|
|
473
|
-
...previewArgTypes,
|
|
474
|
-
},
|
|
475
|
-
args: {
|
|
476
|
-
loading: true,
|
|
477
|
-
previewAddonStart: false,
|
|
478
|
-
previewAddonEnd: false,
|
|
479
|
-
},
|
|
480
|
-
};
|
|
481
|
-
|
|
482
|
-
/**
|
|
483
|
-
* A Button that takes up the full width of its container (`display: block`).
|
|
484
|
-
*/
|
|
485
|
-
export const DisplayBlock: StoryObj<PreviewStoryArgs> = {
|
|
486
|
-
render: function Render(args: PreviewStoryArgs) {
|
|
487
|
-
const [props, previewProps] = getPropsForPreview(args);
|
|
488
|
-
|
|
489
|
-
return (
|
|
490
|
-
<Button {...props} {...previewProps}>
|
|
491
|
-
Full-width button
|
|
492
|
-
</Button>
|
|
493
|
-
);
|
|
494
|
-
},
|
|
495
|
-
argTypes: {
|
|
496
|
-
...hideControls(['href', 'target', 'priority', 'sentiment', 'as', 'disabled', 'children']),
|
|
497
|
-
...previewArgTypes,
|
|
498
|
-
},
|
|
499
|
-
args: {
|
|
500
|
-
block: true,
|
|
501
|
-
previewAddonStart: false,
|
|
502
|
-
previewAddonEnd: false,
|
|
503
|
-
},
|
|
504
|
-
};
|
|
505
|
-
|
|
506
|
-
/**
|
|
507
|
-
* Icons are only supported for `sm` and `md` size Buttons. <br />
|
|
508
|
-
* [Design documentation](https://wise.design/components/button#accessories)
|
|
509
|
-
*/
|
|
510
|
-
export const WithIcons: StoryObj<PreviewStoryArgs> = {
|
|
511
|
-
render: function Render(args: PreviewStoryArgs) {
|
|
512
|
-
const [props] = getPropsForPreview(args);
|
|
513
|
-
|
|
514
|
-
return (
|
|
515
|
-
<>
|
|
516
|
-
<Button {...props} v2 addonStart={{ type: 'icon', value: <Freeze /> }}>
|
|
517
|
-
With start icon
|
|
518
|
-
</Button>
|
|
519
|
-
|
|
520
|
-
<Button {...props} v2 addonEnd={{ type: 'icon', value: <ArrowRight /> }}>
|
|
521
|
-
With end icon
|
|
522
|
-
</Button>
|
|
523
|
-
|
|
524
|
-
<Button
|
|
525
|
-
{...props}
|
|
526
|
-
v2
|
|
527
|
-
addonStart={{ type: 'icon', value: <Freeze /> }}
|
|
528
|
-
addonEnd={{ type: 'icon', value: <ArrowRight /> }}
|
|
529
|
-
>
|
|
530
|
-
With both icons
|
|
531
|
-
</Button>
|
|
532
|
-
</>
|
|
533
|
-
);
|
|
534
|
-
},
|
|
535
|
-
argTypes: {
|
|
536
|
-
...hideControls(['href', 'target', 'priority', 'sentiment', 'as', 'disabled', 'children']),
|
|
537
|
-
},
|
|
538
|
-
args: {
|
|
539
|
-
size: 'md',
|
|
540
|
-
},
|
|
541
|
-
parameters: {
|
|
542
|
-
docs: {
|
|
543
|
-
source: {
|
|
544
|
-
code: `
|
|
545
|
-
<>
|
|
546
|
-
<Button v2 size="md" addonStart={{ type: 'icon', value: <Freeze /> }}>
|
|
547
|
-
With start icon
|
|
548
|
-
</Button>
|
|
549
|
-
|
|
550
|
-
<Button v2 size="md" addonEnd={{ type: 'icon', value: <ArrowRight /> }}>
|
|
551
|
-
With end icon
|
|
552
|
-
</Button>
|
|
553
|
-
|
|
554
|
-
<Button v2 size="md" addonStart={{ type: 'icon', value: <Freeze /> }} addonEnd={{ type: 'icon', value: <ArrowRight /> }}>
|
|
555
|
-
With both icons
|
|
556
|
-
</Button>
|
|
557
|
-
</>
|
|
558
|
-
`,
|
|
20
|
+
as: {
|
|
21
|
+
type: {
|
|
22
|
+
name: 'enum',
|
|
23
|
+
value: ['button', 'a'],
|
|
559
24
|
},
|
|
560
25
|
},
|
|
561
26
|
},
|
|
562
|
-
|
|
563
|
-
}
|
|
564
|
-
|
|
565
|
-
/**
|
|
566
|
-
* Avatars are only supported for `md` size Buttons. <br />
|
|
567
|
-
* [Design documentation](https://wise.design/components/button#accessories)
|
|
568
|
-
*/
|
|
569
|
-
export const WithAvatars: StoryObj<PreviewStoryArgs> = {
|
|
570
|
-
render: function Render(args: PreviewStoryArgs) {
|
|
571
|
-
const [props] = getPropsForPreview(args);
|
|
572
|
-
|
|
573
|
-
return (
|
|
574
|
-
<>
|
|
575
|
-
<Button {...props} v2 addonStart={{ type: 'avatar', value: [{ asset: <Freeze /> }] }}>
|
|
576
|
-
With single avatar
|
|
577
|
-
</Button>
|
|
578
|
-
|
|
579
|
-
<Button
|
|
580
|
-
{...props}
|
|
581
|
-
v2
|
|
582
|
-
addonStart={{
|
|
583
|
-
type: 'avatar',
|
|
584
|
-
value: [{ asset: <Flag code="br" /> }, { asset: <Flag code="jp" /> }],
|
|
585
|
-
}}
|
|
586
|
-
>
|
|
587
|
-
With double avatar
|
|
588
|
-
</Button>
|
|
589
|
-
|
|
590
|
-
<Button {...props} v2 addonStart={{ type: 'avatar', value: [{ profileName: 'John Doe' }] }}>
|
|
591
|
-
With initials
|
|
592
|
-
</Button>
|
|
593
|
-
|
|
594
|
-
<Button
|
|
595
|
-
{...props}
|
|
596
|
-
v2
|
|
597
|
-
addonStart={{ type: 'avatar', value: [{ imgSrc: '../avatar-square-dude.webp' }] }}
|
|
598
|
-
>
|
|
599
|
-
With an image
|
|
600
|
-
</Button>
|
|
601
|
-
</>
|
|
602
|
-
);
|
|
603
|
-
},
|
|
604
|
-
argTypes: hideControls(['href', 'target', 'priority', 'sentiment', 'as', 'disabled', 'children']),
|
|
605
|
-
args: {
|
|
606
|
-
size: 'md',
|
|
607
|
-
},
|
|
608
|
-
parameters: {
|
|
609
|
-
docs: {
|
|
610
|
-
source: {
|
|
611
|
-
code: `
|
|
612
|
-
<>
|
|
613
|
-
<Button
|
|
614
|
-
v2
|
|
615
|
-
size="md"
|
|
616
|
-
addonStart={{
|
|
617
|
-
type: 'avatar',
|
|
618
|
-
value: [{ asset: <Freeze /> }]
|
|
619
|
-
}}
|
|
620
|
-
>
|
|
621
|
-
With single avatar
|
|
622
|
-
</Button>
|
|
27
|
+
tags: ['autodocs'],
|
|
28
|
+
} satisfies Meta<typeof Button>;
|
|
623
29
|
|
|
624
|
-
|
|
625
|
-
v2
|
|
626
|
-
size="md"
|
|
627
|
-
addonStart={{
|
|
628
|
-
type: 'avatar',
|
|
629
|
-
value: [{ asset: <Flag code="br" /> }, { asset: <Flag code="jp" /> }]
|
|
630
|
-
}}
|
|
631
|
-
>
|
|
632
|
-
With double avatar
|
|
633
|
-
</Button>
|
|
30
|
+
type Story = StoryObj<typeof Button>;
|
|
634
31
|
|
|
635
|
-
|
|
636
|
-
v2
|
|
637
|
-
size="md"
|
|
638
|
-
addonStart={{
|
|
639
|
-
type: 'avatar',
|
|
640
|
-
value: [{ profileName: 'John Doe' }]
|
|
641
|
-
}}
|
|
642
|
-
>
|
|
643
|
-
With initials
|
|
644
|
-
</Button>
|
|
32
|
+
export const Basic: Story = {};
|
|
645
33
|
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
value: [{ imgSrc: '../avatar-square-dude.webp' }]
|
|
652
|
-
}}
|
|
653
|
-
>
|
|
654
|
-
With image Avatar
|
|
655
|
-
</Button>
|
|
656
|
-
</>
|
|
657
|
-
`,
|
|
34
|
+
export const Focused = storyConfig<Story>(
|
|
35
|
+
{
|
|
36
|
+
parameters: {
|
|
37
|
+
chromatic: {
|
|
38
|
+
delay: 1000,
|
|
658
39
|
},
|
|
659
40
|
},
|
|
41
|
+
play: async ({ canvasElement }) => {
|
|
42
|
+
const canvas = within(canvasElement);
|
|
43
|
+
await userEvent.click(canvas.getByRole('button'));
|
|
44
|
+
},
|
|
660
45
|
},
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
const buttonSizes = ['sm', 'md', 'lg'] as const;
|
|
46
|
+
{
|
|
47
|
+
variants: ['dark'],
|
|
48
|
+
},
|
|
49
|
+
);
|
|
666
50
|
|
|
667
|
-
export const
|
|
51
|
+
export const Variants = storyConfig<Story>(
|
|
668
52
|
{
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
{buttonPriorities.map((priority) =>
|
|
679
|
-
buttonSizes.map((size) => (
|
|
680
|
-
<div
|
|
681
|
-
key={`${priority}-default-${size}`}
|
|
682
|
-
style={{ flex: '1 0 30%', marginBottom: '16px', justifyContent: 'space-between' }}
|
|
683
|
-
>
|
|
684
|
-
<Button
|
|
685
|
-
v2
|
|
686
|
-
priority={priority as ButtonPriority}
|
|
687
|
-
size={size}
|
|
688
|
-
addonStart={{ type: 'avatar', value: [{ asset: <Freeze /> }] }}
|
|
689
|
-
addonEnd={{ type: 'icon', value: <ArrowRight /> }}
|
|
690
|
-
block
|
|
691
|
-
href="https://wise.com"
|
|
692
|
-
target="_blank"
|
|
693
|
-
>
|
|
694
|
-
{`${priority} default ${size}`}
|
|
695
|
-
</Button>
|
|
696
|
-
<Button
|
|
697
|
-
className="m-t-1 m-b-1"
|
|
698
|
-
v2
|
|
699
|
-
priority={priority as ButtonPriority}
|
|
700
|
-
size={size}
|
|
701
|
-
addonStart={{
|
|
702
|
-
type: 'avatar',
|
|
703
|
-
value: [{ asset: <Freeze /> }, { asset: <Freeze /> }],
|
|
704
|
-
}}
|
|
705
|
-
addonEnd={{ type: 'icon', value: <ArrowRight /> }}
|
|
706
|
-
block
|
|
707
|
-
disabled
|
|
708
|
-
>
|
|
709
|
-
{`${priority} default ${size} Disabled`}
|
|
710
|
-
</Button>
|
|
711
|
-
<Button
|
|
712
|
-
v2
|
|
713
|
-
priority={priority as ButtonPriority}
|
|
714
|
-
size={size}
|
|
715
|
-
addonStart={{ type: 'avatar', value: [{ asset: <Freeze /> }] }}
|
|
716
|
-
addonEnd={{ type: 'icon', value: <ArrowRight /> }}
|
|
717
|
-
block
|
|
718
|
-
loading
|
|
719
|
-
>
|
|
720
|
-
{`${priority} default ${size} Loading`}
|
|
721
|
-
</Button>
|
|
53
|
+
render: (args) => {
|
|
54
|
+
return (
|
|
55
|
+
<>
|
|
56
|
+
<div className="m-b-2">
|
|
57
|
+
<div className="title-4 m-b-1">Accent</div>
|
|
58
|
+
<div className="d-flex flex-wrap" style={{ gap: 'var(--size-16)' }}>
|
|
59
|
+
<Button {...args} priority={Priority.PRIMARY} type={ControlType.ACCENT} />
|
|
60
|
+
<Button {...args} priority={Priority.SECONDARY} type={ControlType.ACCENT} />
|
|
61
|
+
<Button {...args} priority={Priority.TERTIARY} type={ControlType.ACCENT} />
|
|
722
62
|
</div>
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
style={{ flex: '1 0 30%', marginBottom: '16px', justifyContent: 'space-between' }}
|
|
730
|
-
>
|
|
731
|
-
<Button
|
|
732
|
-
v2
|
|
733
|
-
sentiment="negative"
|
|
734
|
-
priority={priority as ButtonPriority}
|
|
735
|
-
size={size}
|
|
736
|
-
addonEnd={{ type: 'icon', value: <ChevronRight /> }}
|
|
737
|
-
addonStart={{ type: 'avatar', value: [{ asset: <Freeze /> }] }}
|
|
738
|
-
block
|
|
739
|
-
href="https://wise.com"
|
|
740
|
-
target="_blank"
|
|
741
|
-
>
|
|
742
|
-
{`${priority} negative ${size}`}
|
|
743
|
-
</Button>
|
|
744
|
-
<Button
|
|
745
|
-
className="m-t-1 m-b-1"
|
|
746
|
-
v2
|
|
747
|
-
sentiment="negative"
|
|
748
|
-
priority={priority as ButtonPriority}
|
|
749
|
-
size={size}
|
|
750
|
-
addonEnd={{ type: 'icon', value: <ChevronRight /> }}
|
|
751
|
-
addonStart={{ type: 'avatar', value: [{ asset: <Freeze /> }] }}
|
|
752
|
-
block
|
|
753
|
-
disabled
|
|
754
|
-
>
|
|
755
|
-
{`${priority} negative ${size} Disabled`}
|
|
756
|
-
</Button>
|
|
757
|
-
<Button
|
|
758
|
-
v2
|
|
759
|
-
sentiment="negative"
|
|
760
|
-
priority={priority as ButtonPriority}
|
|
761
|
-
size={size}
|
|
762
|
-
addonEnd={{ type: 'icon', value: <ChevronRight /> }}
|
|
763
|
-
addonStart={{ type: 'avatar', value: [{ asset: <Freeze /> }] }}
|
|
764
|
-
block
|
|
765
|
-
loading
|
|
766
|
-
>
|
|
767
|
-
{`${priority} negative ${size} Loading`}
|
|
768
|
-
</Button>
|
|
63
|
+
</div>
|
|
64
|
+
<div className="m-b-2">
|
|
65
|
+
<div className="title-4 m-b-1">Positive</div>
|
|
66
|
+
<div className="d-flex flex-wrap" style={{ gap: 'var(--size-16)' }}>
|
|
67
|
+
<Button {...args} priority={Priority.PRIMARY} type={ControlType.POSITIVE} />
|
|
68
|
+
<Button {...args} priority={Priority.SECONDARY} type={ControlType.POSITIVE} />
|
|
769
69
|
</div>
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
70
|
+
</div>
|
|
71
|
+
<div className="m-b-2">
|
|
72
|
+
<div className="title-4 m-b-1">Negative</div>
|
|
73
|
+
<div className="d-flex flex-wrap" style={{ gap: 'var(--size-16)' }}>
|
|
74
|
+
<Button {...args} priority={Priority.PRIMARY} type={ControlType.NEGATIVE} />
|
|
75
|
+
<Button {...args} priority={Priority.SECONDARY} type={ControlType.NEGATIVE} />
|
|
76
|
+
</div>
|
|
77
|
+
</div>
|
|
78
|
+
<div className="m-b-2">
|
|
79
|
+
<div className="title-4 m-b-1">Disabled</div>
|
|
80
|
+
<div className="d-flex flex-wrap" style={{ gap: 'var(--size-16)' }}>
|
|
81
|
+
<Button {...args} priority={Priority.PRIMARY} disabled />
|
|
82
|
+
<Button {...args} priority={Priority.SECONDARY} disabled />
|
|
83
|
+
<Button {...args} priority={Priority.TERTIARY} disabled />
|
|
84
|
+
</div>
|
|
85
|
+
</div>
|
|
86
|
+
</>
|
|
87
|
+
);
|
|
88
|
+
},
|
|
774
89
|
},
|
|
775
|
-
{ variants: ['default', 'dark', '
|
|
90
|
+
{ variants: ['default', 'dark', 'rtl'] },
|
|
776
91
|
);
|
|
777
92
|
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
93
|
+
/**
|
|
94
|
+
* The purpose of the `loading` mode is to convey a message to the
|
|
95
|
+
* user that some asynchronous process has been triggered, likely
|
|
96
|
+
* in response to their previous action.
|
|
97
|
+
*
|
|
98
|
+
* Although it carries some similarities with the `disabled` mode
|
|
99
|
+
* (users cannot activate a loading button), it's not hidden from
|
|
100
|
+
* the keyboard and assistive tech users (users can focus on it,
|
|
101
|
+
* and it's announced by screen readers), and is also much more
|
|
102
|
+
* accessible to sighted users due to its default, high contrast.
|
|
103
|
+
*/
|
|
104
|
+
export const Loading = storyConfig<Story>(
|
|
105
|
+
{
|
|
106
|
+
render: (args) => {
|
|
107
|
+
return (
|
|
108
|
+
<div className="d-flex flex-wrap" style={{ gap: 'var(--size-16)' }}>
|
|
109
|
+
<Button {...args} loading priority={Priority.PRIMARY} />
|
|
110
|
+
<Button {...args} loading priority={Priority.SECONDARY} />
|
|
111
|
+
<Button {...args} loading priority={Priority.TERTIARY} />
|
|
112
|
+
<Button {...args} loading priority={Priority.PRIMARY} type={ControlType.NEGATIVE} />
|
|
113
|
+
<Button {...args} loading priority={Priority.SECONDARY} type={ControlType.NEGATIVE} />
|
|
114
|
+
</div>
|
|
115
|
+
);
|
|
116
|
+
},
|
|
117
|
+
args: {
|
|
118
|
+
loading: true,
|
|
119
|
+
},
|
|
120
|
+
},
|
|
121
|
+
{ variants: ['default', 'dark', 'rtl'] },
|
|
122
|
+
);
|
|
123
|
+
|
|
124
|
+
export const SocialMedia = storyConfig<Story>(
|
|
125
|
+
{
|
|
126
|
+
render: () => {
|
|
127
|
+
return (
|
|
128
|
+
<>
|
|
129
|
+
<div className="m-b-2">
|
|
130
|
+
<button type="button" className="btn btn-google">
|
|
131
|
+
Login with Google
|
|
132
|
+
</button>
|
|
133
|
+
</div>
|
|
134
|
+
<div className="m-b-2">
|
|
135
|
+
<button type="button" className="btn btn-facebook">
|
|
136
|
+
Login with Facebook
|
|
137
|
+
</button>
|
|
138
|
+
</div>
|
|
139
|
+
<div className="m-b-2">
|
|
140
|
+
<button type="button" className="btn btn-lg btn-facebook">
|
|
141
|
+
Large Button
|
|
142
|
+
</button>
|
|
143
|
+
</div>
|
|
144
|
+
<div className="m-b-2">
|
|
145
|
+
<button type="button" className="btn btn-block btn-facebook">
|
|
146
|
+
Block Button
|
|
147
|
+
</button>
|
|
148
|
+
</div>
|
|
149
|
+
<div className="m-b-2">
|
|
150
|
+
<button type="button" className="btn btn-lg btn-block btn-facebook">
|
|
151
|
+
Large Block Button
|
|
152
|
+
</button>
|
|
153
|
+
</div>
|
|
154
|
+
</>
|
|
155
|
+
);
|
|
156
|
+
},
|
|
157
|
+
},
|
|
158
|
+
{ variants: ['default', 'dark', 'rtl'] },
|
|
159
|
+
);
|
|
160
|
+
|
|
161
|
+
export const SocialMediaMobile = storyConfig<Story>(SocialMedia, {
|
|
162
|
+
variants: ['default', 'dark', 'rtl', 'mobile'],
|
|
163
|
+
});
|