@transferwise/components 46.95.2 → 46.96.0
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 +18 -6
- package/build/alert/Alert.js.map +1 -1
- package/build/alert/Alert.mjs +18 -6
- package/build/alert/Alert.mjs.map +1 -1
- package/build/link/Link.js +32 -4
- package/build/link/Link.js.map +1 -1
- package/build/link/Link.mjs +32 -4
- package/build/link/Link.mjs.map +1 -1
- package/build/main.css +2 -16
- package/build/nudge/Nudge.js +8 -4
- package/build/nudge/Nudge.js.map +1 -1
- package/build/nudge/Nudge.mjs +8 -4
- package/build/nudge/Nudge.mjs.map +1 -1
- package/build/promoCard/PromoCardIndicator.js +6 -5
- package/build/promoCard/PromoCardIndicator.js.map +1 -1
- package/build/promoCard/PromoCardIndicator.mjs +6 -5
- package/build/promoCard/PromoCardIndicator.mjs.map +1 -1
- package/build/styles/link/Link.css +2 -1
- package/build/styles/main.css +2 -16
- package/build/styles/stepper/Stepper.css +0 -7
- package/build/styles/summary/Summary.css +0 -4
- package/build/summary/Summary.js +8 -4
- package/build/summary/Summary.js.map +1 -1
- package/build/summary/Summary.mjs +8 -4
- package/build/summary/Summary.mjs.map +1 -1
- package/build/types/alert/Alert.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/nudge/Nudge.d.ts +2 -2
- package/build/types/nudge/Nudge.d.ts.map +1 -1
- package/build/types/summary/Summary.d.ts +2 -2
- package/build/types/summary/Summary.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/alert/Alert.tsx +27 -10
- package/src/dateLookup/DateLookup.less +0 -1
- package/src/decision/Decision.spec.tsx +2 -2
- package/src/decision/Decision.story.tsx +10 -46
- package/src/flowNavigation/FlowNavigation.spec.js +3 -7
- package/src/flowNavigation/__snapshots__/FlowNavigation.spec.js.snap +8 -4
- package/src/link/Link.css +2 -1
- package/src/link/Link.less +1 -1
- package/src/link/Link.spec.tsx +32 -1
- package/src/link/Link.story.tsx +12 -0
- package/src/link/Link.tsx +17 -6
- package/src/main.css +2 -16
- package/src/navigationOption/NavigationOption.story.tsx +30 -53
- package/src/nudge/Nudge.tsx +15 -3
- package/src/overlayHeader/OverlayHeader.spec.tsx +5 -8
- package/src/overlayHeader/__snapshots__/OverlayHeader.spec.tsx.snap +4 -2
- package/src/promoCard/PromoCard.spec.tsx +3 -1
- package/src/promoCard/PromoCardIndicator.tsx +5 -5
- package/src/stepper/Stepper.css +0 -7
- package/src/stepper/Stepper.less +0 -8
- package/src/summary/Summary.css +0 -4
- package/src/summary/Summary.less +0 -2
- package/src/summary/Summary.tsx +14 -3
- package/src/tile/Tile.story.tsx +2 -6
- package/build/common/action/Action.js +0 -53
- package/build/common/action/Action.js.map +0 -1
- package/build/common/action/Action.mjs +0 -51
- package/build/common/action/Action.mjs.map +0 -1
- package/build/types/common/action/Action.d.ts +0 -18
- package/build/types/common/action/Action.d.ts.map +0 -1
- package/src/common/action/Action.tsx +0 -74
package/src/summary/Summary.less
CHANGED
package/src/summary/Summary.tsx
CHANGED
|
@@ -21,7 +21,8 @@ import Info, { InfoProps } from '../info';
|
|
|
21
21
|
import StatusIcon from '../statusIcon';
|
|
22
22
|
|
|
23
23
|
import messages from './Summary.messages';
|
|
24
|
-
import
|
|
24
|
+
import Link from '../link';
|
|
25
|
+
import type { AlertAction } from '../alert';
|
|
25
26
|
|
|
26
27
|
const BadgeIcons = {
|
|
27
28
|
[Status.DONE]: CheckCircleIcon,
|
|
@@ -43,7 +44,7 @@ export interface Props {
|
|
|
43
44
|
/**
|
|
44
45
|
* Action displayed at the bottom of the Summary
|
|
45
46
|
*/
|
|
46
|
-
action?:
|
|
47
|
+
action?: AlertAction;
|
|
47
48
|
/**
|
|
48
49
|
* Decides which html element should wrap the Summary
|
|
49
50
|
*/
|
|
@@ -168,7 +169,17 @@ const Summary = ({
|
|
|
168
169
|
{description}
|
|
169
170
|
</Body>
|
|
170
171
|
)}
|
|
171
|
-
{action &&
|
|
172
|
+
{action && (
|
|
173
|
+
<Link
|
|
174
|
+
href={action.href}
|
|
175
|
+
target={action.target}
|
|
176
|
+
className="np-summary__action"
|
|
177
|
+
aria-label={action['aria-label']}
|
|
178
|
+
onClick={action.onClick}
|
|
179
|
+
>
|
|
180
|
+
{action.text}
|
|
181
|
+
</Link>
|
|
182
|
+
)}
|
|
172
183
|
</div>
|
|
173
184
|
{info && (
|
|
174
185
|
<Info
|
package/src/tile/Tile.story.tsx
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { action } from '@storybook/addon-actions';
|
|
2
2
|
import { text, boolean } from '@storybook/addon-knobs';
|
|
3
3
|
|
|
4
|
-
import Avatar from '../avatar';
|
|
5
4
|
import { Size } from '../common';
|
|
6
5
|
|
|
7
6
|
import Tile from '.';
|
|
7
|
+
import AvatarView from '../avatarView';
|
|
8
8
|
|
|
9
9
|
export default {
|
|
10
10
|
component: Tile,
|
|
@@ -41,11 +41,7 @@ export const Basic = () => {
|
|
|
41
41
|
description={description}
|
|
42
42
|
disabled={disabled}
|
|
43
43
|
href="#href1"
|
|
44
|
-
media={
|
|
45
|
-
<Avatar size="md" type="initials">
|
|
46
|
-
HM
|
|
47
|
-
</Avatar>
|
|
48
|
-
}
|
|
44
|
+
media={<AvatarView profileName="Henry Morris" />}
|
|
49
45
|
size={medium ? Size.MEDIUM : Size.SMALL}
|
|
50
46
|
title={title}
|
|
51
47
|
onClick={action('onClick')}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var clsx = require('clsx');
|
|
4
|
-
var Link = require('../../link/Link.js');
|
|
5
|
-
var typography = require('../propsValues/typography.js');
|
|
6
|
-
var control = require('../propsValues/control.js');
|
|
7
|
-
var Button_resolver = require('../../button/Button.resolver.js');
|
|
8
|
-
var jsxRuntime = require('react/jsx-runtime');
|
|
9
|
-
|
|
10
|
-
function Action({
|
|
11
|
-
action,
|
|
12
|
-
className,
|
|
13
|
-
variant = 'button',
|
|
14
|
-
sentiment = 'default',
|
|
15
|
-
priority = control.Priority.SECONDARY
|
|
16
|
-
}) {
|
|
17
|
-
if ('href' in action) {
|
|
18
|
-
return /*#__PURE__*/jsxRuntime.jsx(Link.default, {
|
|
19
|
-
href: action.href,
|
|
20
|
-
className: className,
|
|
21
|
-
"aria-label": action['aria-label'],
|
|
22
|
-
target: action.target,
|
|
23
|
-
type: typography.Typography.LINK_LARGE,
|
|
24
|
-
onClick: action.onClick,
|
|
25
|
-
children: action.text
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
switch (variant) {
|
|
29
|
-
case 'action-button':
|
|
30
|
-
return /*#__PURE__*/jsxRuntime.jsx(Button_resolver.default, {
|
|
31
|
-
v2: true,
|
|
32
|
-
size: "sm",
|
|
33
|
-
sentiment: sentiment,
|
|
34
|
-
"aria-label": action['aria-label'],
|
|
35
|
-
priority: priority,
|
|
36
|
-
className: clsx.clsx(className),
|
|
37
|
-
onClick: action.onClick,
|
|
38
|
-
children: action.text
|
|
39
|
-
});
|
|
40
|
-
case 'button':
|
|
41
|
-
default:
|
|
42
|
-
return /*#__PURE__*/jsxRuntime.jsx("button", {
|
|
43
|
-
type: "button",
|
|
44
|
-
"aria-label": action['aria-label'],
|
|
45
|
-
className: clsx.clsx('btn-unstyled np-text-link-large', className),
|
|
46
|
-
onClick: action.onClick,
|
|
47
|
-
children: action.text
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
exports.Action = Action;
|
|
53
|
-
//# sourceMappingURL=Action.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Action.js","sources":["../../../src/common/action/Action.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport Link from '../../link';\nimport { Typography } from '../propsValues/typography';\nimport { Priority } from '../propsValues/control';\nimport Button from '../../button';\nimport { ButtonPriority, ButtonSentiment } from '../../button/Button.types';\n\nexport type ActionOptions = {\n 'aria-label'?: string;\n href?: string;\n target?: string;\n text: React.ReactNode;\n onClick?: () => void;\n};\n\ntype Props = {\n action: ActionOptions;\n className?: string;\n variant?: 'button' | 'action-button';\n sentiment?: ButtonSentiment;\n priority?: ButtonPriority;\n};\n\nexport function Action({\n action,\n className,\n variant = 'button',\n sentiment = 'default',\n priority = Priority.SECONDARY,\n}: Props) {\n if ('href' in action) {\n return (\n <Link\n href={action.href}\n className={className}\n aria-label={action['aria-label']}\n target={action.target}\n type={Typography.LINK_LARGE}\n onClick={action.onClick}\n >\n {action.text}\n </Link>\n );\n }\n\n switch (variant) {\n case 'action-button':\n return (\n <Button\n v2\n size=\"sm\"\n sentiment={sentiment}\n aria-label={action['aria-label']}\n priority={priority}\n className={clsx(className)}\n onClick={action.onClick}\n >\n {action.text}\n </Button>\n );\n case 'button':\n default:\n return (\n <button\n type=\"button\"\n aria-label={action['aria-label']}\n className={clsx('btn-unstyled np-text-link-large', className)}\n onClick={action.onClick}\n >\n {action.text}\n </button>\n );\n }\n}\n"],"names":["Action","action","className","variant","sentiment","priority","Priority","SECONDARY","_jsx","Link","href","target","type","Typography","LINK_LARGE","onClick","children","text","Button","v2","size","clsx"],"mappings":";;;;;;;;;AAuBM,SAAUA,MAAMA,CAAC;EACrBC,MAAM;EACNC,SAAS;AACTC,EAAAA,OAAO,GAAG,QAAQ;AAClBC,EAAAA,SAAS,GAAG,SAAS;EACrBC,QAAQ,GAAGC,gBAAQ,CAACC,SAAAA;AACd,CAAA,EAAA;EACN,IAAI,MAAM,IAAIN,MAAM,EAAE;IACpB,oBACEO,cAAA,CAACC,YAAI,EAAA;MACHC,IAAI,EAAET,MAAM,CAACS,IAAK;AAClBR,MAAAA,SAAS,EAAEA,SAAU;MACrB,YAAYD,EAAAA,MAAM,CAAC,YAAY,CAAE;MACjCU,MAAM,EAAEV,MAAM,CAACU,MAAO;MACtBC,IAAI,EAAEC,qBAAU,CAACC,UAAW;MAC5BC,OAAO,EAAEd,MAAM,CAACc,OAAQ;MAAAC,QAAA,EAEvBf,MAAM,CAACgB,IAAAA;AAAI,KACR,CAAC,CAAA;AAEX,GAAA;AAEA,EAAA,QAAQd,OAAO;AACb,IAAA,KAAK,eAAe;MAClB,oBACEK,cAAA,CAACU,uBAAM,EAAA;QACLC,EAAE,EAAA,IAAA;AACFC,QAAAA,IAAI,EAAC,IAAI;AACThB,QAAAA,SAAS,EAAEA,SAAU;QACrB,YAAYH,EAAAA,MAAM,CAAC,YAAY,CAAE;AACjCI,QAAAA,QAAQ,EAAEA,QAAS;AACnBH,QAAAA,SAAS,EAAEmB,SAAI,CAACnB,SAAS,CAAE;QAC3Ba,OAAO,EAAEd,MAAM,CAACc,OAAQ;QAAAC,QAAA,EAEvBf,MAAM,CAACgB,IAAAA;AAAI,OACN,CAAC,CAAA;AAEb,IAAA,KAAK,QAAQ,CAAA;AACb,IAAA;AACE,MAAA,oBACET,cAAA,CAAA,QAAA,EAAA;AACEI,QAAAA,IAAI,EAAC,QAAQ;QACb,YAAYX,EAAAA,MAAM,CAAC,YAAY,CAAE;AACjCC,QAAAA,SAAS,EAAEmB,SAAI,CAAC,iCAAiC,EAAEnB,SAAS,CAAE;QAC9Da,OAAO,EAAEd,MAAM,CAACc,OAAQ;QAAAC,QAAA,EAEvBf,MAAM,CAACgB,IAAAA;AAAI,OACN,CAAC,CAAA;AAEf,GAAA;AACF;;;;"}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { clsx } from 'clsx';
|
|
2
|
-
import Link from '../../link/Link.mjs';
|
|
3
|
-
import { Typography } from '../propsValues/typography.mjs';
|
|
4
|
-
import { Priority } from '../propsValues/control.mjs';
|
|
5
|
-
import Button from '../../button/Button.resolver.mjs';
|
|
6
|
-
import { jsx } from 'react/jsx-runtime';
|
|
7
|
-
|
|
8
|
-
function Action({
|
|
9
|
-
action,
|
|
10
|
-
className,
|
|
11
|
-
variant = 'button',
|
|
12
|
-
sentiment = 'default',
|
|
13
|
-
priority = Priority.SECONDARY
|
|
14
|
-
}) {
|
|
15
|
-
if ('href' in action) {
|
|
16
|
-
return /*#__PURE__*/jsx(Link, {
|
|
17
|
-
href: action.href,
|
|
18
|
-
className: className,
|
|
19
|
-
"aria-label": action['aria-label'],
|
|
20
|
-
target: action.target,
|
|
21
|
-
type: Typography.LINK_LARGE,
|
|
22
|
-
onClick: action.onClick,
|
|
23
|
-
children: action.text
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
switch (variant) {
|
|
27
|
-
case 'action-button':
|
|
28
|
-
return /*#__PURE__*/jsx(Button, {
|
|
29
|
-
v2: true,
|
|
30
|
-
size: "sm",
|
|
31
|
-
sentiment: sentiment,
|
|
32
|
-
"aria-label": action['aria-label'],
|
|
33
|
-
priority: priority,
|
|
34
|
-
className: clsx(className),
|
|
35
|
-
onClick: action.onClick,
|
|
36
|
-
children: action.text
|
|
37
|
-
});
|
|
38
|
-
case 'button':
|
|
39
|
-
default:
|
|
40
|
-
return /*#__PURE__*/jsx("button", {
|
|
41
|
-
type: "button",
|
|
42
|
-
"aria-label": action['aria-label'],
|
|
43
|
-
className: clsx('btn-unstyled np-text-link-large', className),
|
|
44
|
-
onClick: action.onClick,
|
|
45
|
-
children: action.text
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
export { Action };
|
|
51
|
-
//# sourceMappingURL=Action.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Action.mjs","sources":["../../../src/common/action/Action.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport Link from '../../link';\nimport { Typography } from '../propsValues/typography';\nimport { Priority } from '../propsValues/control';\nimport Button from '../../button';\nimport { ButtonPriority, ButtonSentiment } from '../../button/Button.types';\n\nexport type ActionOptions = {\n 'aria-label'?: string;\n href?: string;\n target?: string;\n text: React.ReactNode;\n onClick?: () => void;\n};\n\ntype Props = {\n action: ActionOptions;\n className?: string;\n variant?: 'button' | 'action-button';\n sentiment?: ButtonSentiment;\n priority?: ButtonPriority;\n};\n\nexport function Action({\n action,\n className,\n variant = 'button',\n sentiment = 'default',\n priority = Priority.SECONDARY,\n}: Props) {\n if ('href' in action) {\n return (\n <Link\n href={action.href}\n className={className}\n aria-label={action['aria-label']}\n target={action.target}\n type={Typography.LINK_LARGE}\n onClick={action.onClick}\n >\n {action.text}\n </Link>\n );\n }\n\n switch (variant) {\n case 'action-button':\n return (\n <Button\n v2\n size=\"sm\"\n sentiment={sentiment}\n aria-label={action['aria-label']}\n priority={priority}\n className={clsx(className)}\n onClick={action.onClick}\n >\n {action.text}\n </Button>\n );\n case 'button':\n default:\n return (\n <button\n type=\"button\"\n aria-label={action['aria-label']}\n className={clsx('btn-unstyled np-text-link-large', className)}\n onClick={action.onClick}\n >\n {action.text}\n </button>\n );\n }\n}\n"],"names":["Action","action","className","variant","sentiment","priority","Priority","SECONDARY","_jsx","Link","href","target","type","Typography","LINK_LARGE","onClick","children","text","Button","v2","size","clsx"],"mappings":";;;;;;;AAuBM,SAAUA,MAAMA,CAAC;EACrBC,MAAM;EACNC,SAAS;AACTC,EAAAA,OAAO,GAAG,QAAQ;AAClBC,EAAAA,SAAS,GAAG,SAAS;EACrBC,QAAQ,GAAGC,QAAQ,CAACC,SAAAA;AACd,CAAA,EAAA;EACN,IAAI,MAAM,IAAIN,MAAM,EAAE;IACpB,oBACEO,GAAA,CAACC,IAAI,EAAA;MACHC,IAAI,EAAET,MAAM,CAACS,IAAK;AAClBR,MAAAA,SAAS,EAAEA,SAAU;MACrB,YAAYD,EAAAA,MAAM,CAAC,YAAY,CAAE;MACjCU,MAAM,EAAEV,MAAM,CAACU,MAAO;MACtBC,IAAI,EAAEC,UAAU,CAACC,UAAW;MAC5BC,OAAO,EAAEd,MAAM,CAACc,OAAQ;MAAAC,QAAA,EAEvBf,MAAM,CAACgB,IAAAA;AAAI,KACR,CAAC,CAAA;AAEX,GAAA;AAEA,EAAA,QAAQd,OAAO;AACb,IAAA,KAAK,eAAe;MAClB,oBACEK,GAAA,CAACU,MAAM,EAAA;QACLC,EAAE,EAAA,IAAA;AACFC,QAAAA,IAAI,EAAC,IAAI;AACThB,QAAAA,SAAS,EAAEA,SAAU;QACrB,YAAYH,EAAAA,MAAM,CAAC,YAAY,CAAE;AACjCI,QAAAA,QAAQ,EAAEA,QAAS;AACnBH,QAAAA,SAAS,EAAEmB,IAAI,CAACnB,SAAS,CAAE;QAC3Ba,OAAO,EAAEd,MAAM,CAACc,OAAQ;QAAAC,QAAA,EAEvBf,MAAM,CAACgB,IAAAA;AAAI,OACN,CAAC,CAAA;AAEb,IAAA,KAAK,QAAQ,CAAA;AACb,IAAA;AACE,MAAA,oBACET,GAAA,CAAA,QAAA,EAAA;AACEI,QAAAA,IAAI,EAAC,QAAQ;QACb,YAAYX,EAAAA,MAAM,CAAC,YAAY,CAAE;AACjCC,QAAAA,SAAS,EAAEmB,IAAI,CAAC,iCAAiC,EAAEnB,SAAS,CAAE;QAC9Da,OAAO,EAAEd,MAAM,CAACc,OAAQ;QAAAC,QAAA,EAEvBf,MAAM,CAACgB,IAAAA;AAAI,OACN,CAAC,CAAA;AAEf,GAAA;AACF;;;;"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { ButtonPriority, ButtonSentiment } from '../../button/Button.types';
|
|
2
|
-
export type ActionOptions = {
|
|
3
|
-
'aria-label'?: string;
|
|
4
|
-
href?: string;
|
|
5
|
-
target?: string;
|
|
6
|
-
text: React.ReactNode;
|
|
7
|
-
onClick?: () => void;
|
|
8
|
-
};
|
|
9
|
-
type Props = {
|
|
10
|
-
action: ActionOptions;
|
|
11
|
-
className?: string;
|
|
12
|
-
variant?: 'button' | 'action-button';
|
|
13
|
-
sentiment?: ButtonSentiment;
|
|
14
|
-
priority?: ButtonPriority;
|
|
15
|
-
};
|
|
16
|
-
export declare function Action({ action, className, variant, sentiment, priority, }: Props): import("react").JSX.Element;
|
|
17
|
-
export {};
|
|
18
|
-
//# sourceMappingURL=Action.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Action.d.ts","sourceRoot":"","sources":["../../../../src/common/action/Action.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAE5E,MAAM,MAAM,aAAa,GAAG;IAC1B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,KAAK,CAAC,SAAS,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB,CAAC;AAEF,KAAK,KAAK,GAAG;IACX,MAAM,EAAE,aAAa,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,QAAQ,GAAG,eAAe,CAAC;IACrC,SAAS,CAAC,EAAE,eAAe,CAAC;IAC5B,QAAQ,CAAC,EAAE,cAAc,CAAC;CAC3B,CAAC;AAEF,wBAAgB,MAAM,CAAC,EACrB,MAAM,EACN,SAAS,EACT,OAAkB,EAClB,SAAqB,EACrB,QAA6B,GAC9B,EAAE,KAAK,+BA4CP"}
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import { clsx } from 'clsx';
|
|
2
|
-
import Link from '../../link';
|
|
3
|
-
import { Typography } from '../propsValues/typography';
|
|
4
|
-
import { Priority } from '../propsValues/control';
|
|
5
|
-
import Button from '../../button';
|
|
6
|
-
import { ButtonPriority, ButtonSentiment } from '../../button/Button.types';
|
|
7
|
-
|
|
8
|
-
export type ActionOptions = {
|
|
9
|
-
'aria-label'?: string;
|
|
10
|
-
href?: string;
|
|
11
|
-
target?: string;
|
|
12
|
-
text: React.ReactNode;
|
|
13
|
-
onClick?: () => void;
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
type Props = {
|
|
17
|
-
action: ActionOptions;
|
|
18
|
-
className?: string;
|
|
19
|
-
variant?: 'button' | 'action-button';
|
|
20
|
-
sentiment?: ButtonSentiment;
|
|
21
|
-
priority?: ButtonPriority;
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
export function Action({
|
|
25
|
-
action,
|
|
26
|
-
className,
|
|
27
|
-
variant = 'button',
|
|
28
|
-
sentiment = 'default',
|
|
29
|
-
priority = Priority.SECONDARY,
|
|
30
|
-
}: Props) {
|
|
31
|
-
if ('href' in action) {
|
|
32
|
-
return (
|
|
33
|
-
<Link
|
|
34
|
-
href={action.href}
|
|
35
|
-
className={className}
|
|
36
|
-
aria-label={action['aria-label']}
|
|
37
|
-
target={action.target}
|
|
38
|
-
type={Typography.LINK_LARGE}
|
|
39
|
-
onClick={action.onClick}
|
|
40
|
-
>
|
|
41
|
-
{action.text}
|
|
42
|
-
</Link>
|
|
43
|
-
);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
switch (variant) {
|
|
47
|
-
case 'action-button':
|
|
48
|
-
return (
|
|
49
|
-
<Button
|
|
50
|
-
v2
|
|
51
|
-
size="sm"
|
|
52
|
-
sentiment={sentiment}
|
|
53
|
-
aria-label={action['aria-label']}
|
|
54
|
-
priority={priority}
|
|
55
|
-
className={clsx(className)}
|
|
56
|
-
onClick={action.onClick}
|
|
57
|
-
>
|
|
58
|
-
{action.text}
|
|
59
|
-
</Button>
|
|
60
|
-
);
|
|
61
|
-
case 'button':
|
|
62
|
-
default:
|
|
63
|
-
return (
|
|
64
|
-
<button
|
|
65
|
-
type="button"
|
|
66
|
-
aria-label={action['aria-label']}
|
|
67
|
-
className={clsx('btn-unstyled np-text-link-large', className)}
|
|
68
|
-
onClick={action.onClick}
|
|
69
|
-
>
|
|
70
|
-
{action.text}
|
|
71
|
-
</button>
|
|
72
|
-
);
|
|
73
|
-
}
|
|
74
|
-
}
|