@transferwise/components 46.166.0 → 46.167.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/CardContainer/CardContainer.js +34 -0
- package/build/CardContainer/CardContainer.js.map +1 -0
- package/build/CardContainer/CardContainer.mjs +30 -0
- package/build/CardContainer/CardContainer.mjs.map +1 -0
- package/build/CardWidget/CardWidget.js +98 -0
- package/build/CardWidget/CardWidget.js.map +1 -0
- package/build/CardWidget/CardWidget.mjs +94 -0
- package/build/CardWidget/CardWidget.mjs.map +1 -0
- package/build/CardWidget/CardWidgetAction.js +73 -0
- package/build/CardWidget/CardWidgetAction.js.map +1 -0
- package/build/CardWidget/CardWidgetAction.mjs +68 -0
- package/build/CardWidget/CardWidgetAction.mjs.map +1 -0
- package/build/ListItem/ListItem.js +2 -0
- package/build/ListItem/ListItem.js.map +1 -1
- package/build/ListItem/ListItem.mjs +2 -0
- package/build/ListItem/ListItem.mjs.map +1 -1
- package/build/index.js +4 -0
- package/build/index.js.map +1 -1
- package/build/index.mjs +2 -0
- package/build/index.mjs.map +1 -1
- package/build/main.css +194 -0
- package/build/styles/CardContainer/CardContainer.css +108 -0
- package/build/styles/CardWidget/CardWidget.css +78 -0
- package/build/styles/ListItem/ListItem.css +8 -0
- package/build/styles/main.css +194 -0
- package/build/types/Body/Body.d.ts +2 -2
- package/build/types/CardContainer/CardContainer.d.ts +8 -0
- package/build/types/CardContainer/CardContainer.d.ts.map +1 -0
- package/build/types/CardContainer/CardContainer.types.d.ts +55 -0
- package/build/types/CardContainer/CardContainer.types.d.ts.map +1 -0
- package/build/types/CardContainer/_stories/helpers.d.ts +3 -0
- package/build/types/CardContainer/_stories/helpers.d.ts.map +1 -0
- package/build/types/CardContainer/index.d.ts +3 -0
- package/build/types/CardContainer/index.d.ts.map +1 -0
- package/build/types/CardWidget/CardWidget.d.ts +10 -0
- package/build/types/CardWidget/CardWidget.d.ts.map +1 -0
- package/build/types/CardWidget/CardWidget.types.d.ts +55 -0
- package/build/types/CardWidget/CardWidget.types.d.ts.map +1 -0
- package/build/types/CardWidget/CardWidgetAction.d.ts +54 -0
- package/build/types/CardWidget/CardWidgetAction.d.ts.map +1 -0
- package/build/types/CardWidget/index.d.ts +4 -0
- package/build/types/CardWidget/index.d.ts.map +1 -0
- package/build/types/IconButton/IconButton.d.ts +1 -1
- package/build/types/ListItem/ListItem.d.ts +1 -1
- package/build/types/ListItem/ListItem.d.ts.map +1 -1
- package/build/types/MoneyInput/MoneyInput.d.ts +1 -1
- package/build/types/MoneyInput/MoneyInput.d.ts.map +1 -1
- package/build/types/Title/Title.d.ts +2 -2
- package/build/types/Upload/Steps/UploadImageStep/UploadImageStep.d.ts +1 -1
- package/build/types/UploadInput/UploadItem/UploadItemLink.d.ts +1 -1
- package/build/types/index.d.ts +4 -0
- package/build/types/index.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/CardContainer/CardContainer.css +108 -0
- package/src/CardContainer/CardContainer.less +171 -0
- package/src/CardContainer/CardContainer.test.tsx +150 -0
- package/src/CardContainer/CardContainer.tsx +51 -0
- package/src/CardContainer/CardContainer.types.ts +62 -0
- package/src/CardContainer/_stories/CardContainer.story.tsx +167 -0
- package/src/CardContainer/_stories/CardContainer.test.story.tsx +103 -0
- package/src/CardContainer/_stories/helpers.tsx +50 -0
- package/src/CardContainer/index.ts +6 -0
- package/src/CardWidget/CardWidget.css +78 -0
- package/src/CardWidget/CardWidget.less +107 -0
- package/src/CardWidget/CardWidget.test.tsx +221 -0
- package/src/CardWidget/CardWidget.tsx +78 -0
- package/src/CardWidget/CardWidget.types.ts +63 -0
- package/src/CardWidget/CardWidgetAction.tsx +128 -0
- package/src/CardWidget/_stories/CardWidget.story.tsx +238 -0
- package/src/CardWidget/_stories/CardWidget.test.story.tsx +350 -0
- package/src/CardWidget/index.ts +3 -0
- package/src/ListItem/ListItem.css +8 -0
- package/src/ListItem/ListItem.less +8 -0
- package/src/ListItem/ListItem.test.tsx +20 -0
- package/src/ListItem/ListItem.tsx +3 -1
- package/src/ListItem/_stories/ListItem.layout.test.story.tsx +1 -1
- package/src/ListItem/_stories/ListItem.story.tsx +1 -1
- package/src/Prompt/CriticalBanner/_stories/CriticalBanner.docs.mdx +122 -0
- package/src/Prompt/CriticalBanner/_stories/CriticalBanner.story.tsx +0 -2
- package/src/index.ts +13 -0
- package/src/main.css +194 -0
- package/src/main.less +2 -0
- package/src/FlowNavigation/_stories/FlowNavigation.CriticalBanner.docs.mdx +0 -66
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var clsx = require('clsx');
|
|
6
|
+
var React = require('react');
|
|
7
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
8
|
+
|
|
9
|
+
const CardContainer = /*#__PURE__*/React.forwardRef(({
|
|
10
|
+
spotlight,
|
|
11
|
+
padding = 'md',
|
|
12
|
+
interactive = false,
|
|
13
|
+
children,
|
|
14
|
+
as: Element = 'div',
|
|
15
|
+
className,
|
|
16
|
+
...props
|
|
17
|
+
}, ref) => {
|
|
18
|
+
return /*#__PURE__*/jsxRuntime.jsxs(Element, {
|
|
19
|
+
ref: ref,
|
|
20
|
+
className: clsx.clsx('wds-card-container', spotlight && `wds-card-container--${spotlight}`, padding === 'none' && 'wds-card-container--padding-none', interactive && 'wds-card-container--interactive', className),
|
|
21
|
+
...props,
|
|
22
|
+
children: [children, spotlight === 'inactive' && /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
23
|
+
"aria-hidden": "true",
|
|
24
|
+
className: "wds-card-container__border",
|
|
25
|
+
children: /*#__PURE__*/jsxRuntime.jsx("svg", {
|
|
26
|
+
children: /*#__PURE__*/jsxRuntime.jsx("rect", {})
|
|
27
|
+
})
|
|
28
|
+
})]
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
CardContainer.displayName = 'CardContainer';
|
|
32
|
+
|
|
33
|
+
exports.default = CardContainer;
|
|
34
|
+
//# sourceMappingURL=CardContainer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CardContainer.js","sources":["../../src/CardContainer/CardContainer.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { forwardRef } from 'react';\n\nimport type { CardContainerProps } from './CardContainer.types';\n\n/**\n * A bounded surface that groups related content. It has no slots of its own: children are stacked\n * with no gap between them. For a card with a title and actions, use `CardWidget`.\n */\nconst CardContainer = forwardRef<HTMLElement, CardContainerProps>(\n (\n {\n spotlight,\n padding = 'md',\n interactive = false,\n children,\n as: Element = 'div',\n className,\n ...props\n },\n ref,\n ) => {\n return (\n <Element\n ref={ref as React.Ref<HTMLElement & HTMLDivElement>}\n className={clsx(\n 'wds-card-container',\n spotlight && `wds-card-container--${spotlight}`,\n padding === 'none' && 'wds-card-container--padding-none',\n interactive && 'wds-card-container--interactive',\n className,\n )}\n {...props}\n >\n {children}\n\n {spotlight === 'inactive' && (\n <span aria-hidden=\"true\" className=\"wds-card-container__border\">\n <svg>\n <rect />\n </svg>\n </span>\n )}\n </Element>\n );\n },\n);\n\nCardContainer.displayName = 'CardContainer';\n\nexport default CardContainer;\n"],"names":["CardContainer","forwardRef","spotlight","padding","interactive","children","as","Element","className","props","ref","_jsxs","clsx","_jsx","displayName"],"mappings":";;;;;;;;AASA,MAAMA,aAAa,gBAAGC,gBAAU,CAC9B,CACE;EACEC,SAAS;AACTC,EAAAA,OAAO,GAAG,IAAI;AACdC,EAAAA,WAAW,GAAG,KAAK;EACnBC,QAAQ;EACRC,EAAE,EAAEC,OAAO,GAAG,KAAK;EACnBC,SAAS;EACT,GAAGC;AAAK,CACT,EACDC,GAAG,KACD;EACF,oBACEC,eAAA,CAACJ,OAAO,EAAA;AACNG,IAAAA,GAAG,EAAEA,GAA+C;IACpDF,SAAS,EAAEI,SAAI,CACb,oBAAoB,EACpBV,SAAS,IAAI,CAAA,oBAAA,EAAuBA,SAAS,CAAA,CAAE,EAC/CC,OAAO,KAAK,MAAM,IAAI,kCAAkC,EACxDC,WAAW,IAAI,iCAAiC,EAChDI,SAAS,CACT;AAAA,IAAA,GACEC,KAAK;AAAAJ,IAAAA,QAAA,GAERA,QAAQ,EAERH,SAAS,KAAK,UAAU,iBACvBW,cAAA,CAAA,MAAA,EAAA;AAAM,MAAA,aAAA,EAAY,MAAM;AAACL,MAAAA,SAAS,EAAC,4BAA4B;AAAAH,MAAAA,QAAA,eAC7DQ,cAAA,CAAA,KAAA,EAAA;QAAAR,QAAA,eACEQ,cAAA,CAAA,MAAA,EAAA,EAAK;OACF;AACP,KAAM,CACP;AAAA,GACM,CAAC;AAEd,CAAC;AAGHb,aAAa,CAACc,WAAW,GAAG,eAAe;;"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { clsx } from 'clsx';
|
|
2
|
+
import { forwardRef } from 'react';
|
|
3
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
4
|
+
|
|
5
|
+
const CardContainer = /*#__PURE__*/forwardRef(({
|
|
6
|
+
spotlight,
|
|
7
|
+
padding = 'md',
|
|
8
|
+
interactive = false,
|
|
9
|
+
children,
|
|
10
|
+
as: Element = 'div',
|
|
11
|
+
className,
|
|
12
|
+
...props
|
|
13
|
+
}, ref) => {
|
|
14
|
+
return /*#__PURE__*/jsxs(Element, {
|
|
15
|
+
ref: ref,
|
|
16
|
+
className: clsx('wds-card-container', spotlight && `wds-card-container--${spotlight}`, padding === 'none' && 'wds-card-container--padding-none', interactive && 'wds-card-container--interactive', className),
|
|
17
|
+
...props,
|
|
18
|
+
children: [children, spotlight === 'inactive' && /*#__PURE__*/jsx("span", {
|
|
19
|
+
"aria-hidden": "true",
|
|
20
|
+
className: "wds-card-container__border",
|
|
21
|
+
children: /*#__PURE__*/jsx("svg", {
|
|
22
|
+
children: /*#__PURE__*/jsx("rect", {})
|
|
23
|
+
})
|
|
24
|
+
})]
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
CardContainer.displayName = 'CardContainer';
|
|
28
|
+
|
|
29
|
+
export { CardContainer as default };
|
|
30
|
+
//# sourceMappingURL=CardContainer.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CardContainer.mjs","sources":["../../src/CardContainer/CardContainer.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { forwardRef } from 'react';\n\nimport type { CardContainerProps } from './CardContainer.types';\n\n/**\n * A bounded surface that groups related content. It has no slots of its own: children are stacked\n * with no gap between them. For a card with a title and actions, use `CardWidget`.\n */\nconst CardContainer = forwardRef<HTMLElement, CardContainerProps>(\n (\n {\n spotlight,\n padding = 'md',\n interactive = false,\n children,\n as: Element = 'div',\n className,\n ...props\n },\n ref,\n ) => {\n return (\n <Element\n ref={ref as React.Ref<HTMLElement & HTMLDivElement>}\n className={clsx(\n 'wds-card-container',\n spotlight && `wds-card-container--${spotlight}`,\n padding === 'none' && 'wds-card-container--padding-none',\n interactive && 'wds-card-container--interactive',\n className,\n )}\n {...props}\n >\n {children}\n\n {spotlight === 'inactive' && (\n <span aria-hidden=\"true\" className=\"wds-card-container__border\">\n <svg>\n <rect />\n </svg>\n </span>\n )}\n </Element>\n );\n },\n);\n\nCardContainer.displayName = 'CardContainer';\n\nexport default CardContainer;\n"],"names":["CardContainer","forwardRef","spotlight","padding","interactive","children","as","Element","className","props","ref","_jsxs","clsx","_jsx","displayName"],"mappings":";;;;AASA,MAAMA,aAAa,gBAAGC,UAAU,CAC9B,CACE;EACEC,SAAS;AACTC,EAAAA,OAAO,GAAG,IAAI;AACdC,EAAAA,WAAW,GAAG,KAAK;EACnBC,QAAQ;EACRC,EAAE,EAAEC,OAAO,GAAG,KAAK;EACnBC,SAAS;EACT,GAAGC;AAAK,CACT,EACDC,GAAG,KACD;EACF,oBACEC,IAAA,CAACJ,OAAO,EAAA;AACNG,IAAAA,GAAG,EAAEA,GAA+C;IACpDF,SAAS,EAAEI,IAAI,CACb,oBAAoB,EACpBV,SAAS,IAAI,CAAA,oBAAA,EAAuBA,SAAS,CAAA,CAAE,EAC/CC,OAAO,KAAK,MAAM,IAAI,kCAAkC,EACxDC,WAAW,IAAI,iCAAiC,EAChDI,SAAS,CACT;AAAA,IAAA,GACEC,KAAK;AAAAJ,IAAAA,QAAA,GAERA,QAAQ,EAERH,SAAS,KAAK,UAAU,iBACvBW,GAAA,CAAA,MAAA,EAAA;AAAM,MAAA,aAAA,EAAY,MAAM;AAACL,MAAAA,SAAS,EAAC,4BAA4B;AAAAH,MAAAA,QAAA,eAC7DQ,GAAA,CAAA,KAAA,EAAA;QAAAR,QAAA,eACEQ,GAAA,CAAA,MAAA,EAAA,EAAK;OACF;AACP,KAAM,CACP;AAAA,GACM,CAAC;AAEd,CAAC;AAGHb,aAAa,CAACc,WAAW,GAAG,eAAe;;"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var icons = require('@transferwise/icons');
|
|
6
|
+
var clsx = require('clsx');
|
|
7
|
+
var React = require('react');
|
|
8
|
+
var CardContainer = require('../CardContainer/CardContainer.js');
|
|
9
|
+
require('../common/theme.js');
|
|
10
|
+
require('../common/direction.js');
|
|
11
|
+
require('@transferwise/neptune-tokens');
|
|
12
|
+
require('../common/PropsValues/control.js');
|
|
13
|
+
require('../common/PropsValues/size.js');
|
|
14
|
+
var typography = require('../common/PropsValues/typography.js');
|
|
15
|
+
require('../common/PropsValues/width.js');
|
|
16
|
+
require('../common/PropsValues/type.js');
|
|
17
|
+
require('../common/PropsValues/dateMode.js');
|
|
18
|
+
require('../common/PropsValues/monthFormat.js');
|
|
19
|
+
require('../common/PropsValues/position.js');
|
|
20
|
+
require('../common/PropsValues/layouts.js');
|
|
21
|
+
require('../common/PropsValues/status.js');
|
|
22
|
+
require('../common/PropsValues/sentiment.js');
|
|
23
|
+
require('../common/PropsValues/profileType.js');
|
|
24
|
+
require('../common/PropsValues/variant.js');
|
|
25
|
+
require('../common/PropsValues/scroll.js');
|
|
26
|
+
require('../common/PropsValues/markdownNodeType.js');
|
|
27
|
+
require('../common/fileType.js');
|
|
28
|
+
require('@transferwise/formatting');
|
|
29
|
+
require('react-intl');
|
|
30
|
+
require('../common/CloseButton/CloseButton.messages.js');
|
|
31
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
32
|
+
var Link = require('../Link/Link.js');
|
|
33
|
+
var Title = require('../Title/Title.js');
|
|
34
|
+
var CardWidgetAction = require('./CardWidgetAction.js');
|
|
35
|
+
|
|
36
|
+
const renderAction = (action, slot) => CardWidgetAction.isCardWidgetActionButton(action) ? /*#__PURE__*/jsxRuntime.jsx(CardWidgetAction.default, {
|
|
37
|
+
action: action,
|
|
38
|
+
slot: slot
|
|
39
|
+
}) : action;
|
|
40
|
+
const CardWidgetHeaderComponent = ({
|
|
41
|
+
title,
|
|
42
|
+
as = 'h3',
|
|
43
|
+
titleAction,
|
|
44
|
+
action,
|
|
45
|
+
actionSecondary
|
|
46
|
+
}) => /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
47
|
+
className: "wds-card-widget__header",
|
|
48
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(Title.default, {
|
|
49
|
+
as: as,
|
|
50
|
+
type: typography.Typography.TITLE_GROUP,
|
|
51
|
+
className: "wds-card-widget__title",
|
|
52
|
+
children: titleAction ? /*#__PURE__*/jsxRuntime.jsxs(Link.default, {
|
|
53
|
+
href: titleAction.href,
|
|
54
|
+
target: titleAction.target,
|
|
55
|
+
className: "wds-card-widget__title-link",
|
|
56
|
+
onClick: titleAction.onClick,
|
|
57
|
+
children: [title, /*#__PURE__*/jsxRuntime.jsxs("span", {
|
|
58
|
+
className: "wds-card-widget__title-chevron",
|
|
59
|
+
"aria-hidden": true,
|
|
60
|
+
children: ['\u2060', /*#__PURE__*/jsxRuntime.jsx(icons.ChevronEnd, {
|
|
61
|
+
size: 16
|
|
62
|
+
})]
|
|
63
|
+
})]
|
|
64
|
+
}) : title
|
|
65
|
+
}), (action || actionSecondary) && /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
66
|
+
className: "wds-card-widget__actions",
|
|
67
|
+
children: [actionSecondary && renderAction(actionSecondary, 'actionSecondary'), action && renderAction(action, 'action')]
|
|
68
|
+
})]
|
|
69
|
+
});
|
|
70
|
+
/**
|
|
71
|
+
* A `CardContainer` with an optional header — a title, a title link and up to two actions — above
|
|
72
|
+
* its content. The card shows as hovered or pressed while the title link is, and as hovered while
|
|
73
|
+
* the link has keyboard focus. Hovering or pressing the rest of the card, or its actions, leaves it
|
|
74
|
+
* at rest.
|
|
75
|
+
*/
|
|
76
|
+
const CardWidget = /*#__PURE__*/React.forwardRef(({
|
|
77
|
+
header,
|
|
78
|
+
children,
|
|
79
|
+
className,
|
|
80
|
+
...props
|
|
81
|
+
}, ref) => /*#__PURE__*/jsxRuntime.jsxs(CardContainer.default, {
|
|
82
|
+
ref: ref,
|
|
83
|
+
className: clsx.clsx('wds-card-widget', header && 'wds-card-widget--with-header', className),
|
|
84
|
+
...props,
|
|
85
|
+
// The widget's states follow its title link alone, so the card's own are left off.
|
|
86
|
+
interactive: false,
|
|
87
|
+
padding: "md",
|
|
88
|
+
children: [header && /*#__PURE__*/jsxRuntime.jsx(CardWidgetHeaderComponent, {
|
|
89
|
+
...header
|
|
90
|
+
}), children != null && /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
91
|
+
className: "wds-card-widget__content",
|
|
92
|
+
children: children
|
|
93
|
+
})]
|
|
94
|
+
}));
|
|
95
|
+
CardWidget.displayName = 'CardWidget';
|
|
96
|
+
|
|
97
|
+
exports.default = CardWidget;
|
|
98
|
+
//# sourceMappingURL=CardWidget.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CardWidget.js","sources":["../../src/CardWidget/CardWidget.tsx"],"sourcesContent":["import { ChevronEnd } from '@transferwise/icons';\nimport { clsx } from 'clsx';\nimport { forwardRef } from 'react';\n\nimport CardContainer from '../CardContainer';\nimport { Typography } from '../common';\nimport Link from '../Link';\nimport Title from '../Title';\nimport type { CardWidgetHeader, CardWidgetProps } from './CardWidget.types';\nimport CardWidgetAction, {\n isCardWidgetActionButton,\n type CardWidgetActionSlot,\n} from './CardWidgetAction';\n\nconst renderAction = (action: CardWidgetHeader['action'], slot: CardWidgetActionSlot) =>\n isCardWidgetActionButton(action) ? <CardWidgetAction action={action} slot={slot} /> : action;\n\nconst CardWidgetHeaderComponent = ({\n title,\n as = 'h3',\n titleAction,\n action,\n actionSecondary,\n}: CardWidgetHeader) => (\n <div className=\"wds-card-widget__header\">\n <Title as={as} type={Typography.TITLE_GROUP} className=\"wds-card-widget__title\">\n {titleAction ? (\n <Link\n href={titleAction.href}\n target={titleAction.target}\n className=\"wds-card-widget__title-link\"\n onClick={titleAction.onClick}\n >\n {title}\n {/* The word joiner keeps the chevron on the title's last line instead of wrapping alone. */}\n <span className=\"wds-card-widget__title-chevron\" aria-hidden>\n {'\\u2060'}\n <ChevronEnd size={16} />\n </span>\n </Link>\n ) : (\n title\n )}\n </Title>\n {(action || actionSecondary) && (\n <div className=\"wds-card-widget__actions\">\n {actionSecondary && renderAction(actionSecondary, 'actionSecondary')}\n {action && renderAction(action, 'action')}\n </div>\n )}\n </div>\n);\n\n/**\n * A `CardContainer` with an optional header — a title, a title link and up to two actions — above\n * its content. The card shows as hovered or pressed while the title link is, and as hovered while\n * the link has keyboard focus. Hovering or pressing the rest of the card, or its actions, leaves it\n * at rest.\n */\nconst CardWidget = forwardRef<HTMLElement, CardWidgetProps>(\n ({ header, children, className, ...props }, ref) => (\n <CardContainer\n ref={ref}\n className={clsx('wds-card-widget', header && 'wds-card-widget--with-header', className)}\n {...props}\n // The widget's states follow its title link alone, so the card's own are left off.\n interactive={false}\n padding=\"md\"\n >\n {header && <CardWidgetHeaderComponent {...header} />}\n {children != null && <div className=\"wds-card-widget__content\">{children}</div>}\n </CardContainer>\n ),\n);\n\nCardWidget.displayName = 'CardWidget';\n\nexport default CardWidget;\n"],"names":["renderAction","action","slot","isCardWidgetActionButton","_jsx","CardWidgetAction","CardWidgetHeaderComponent","title","as","titleAction","actionSecondary","_jsxs","className","children","Title","type","Typography","TITLE_GROUP","Link","href","target","onClick","ChevronEnd","size","CardWidget","forwardRef","header","props","ref","CardContainer","clsx","interactive","padding","displayName"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAcA,MAAMA,YAAY,GAAGA,CAACC,MAAkC,EAAEC,IAA0B,KAClFC,yCAAwB,CAACF,MAAM,CAAC,gBAAGG,cAAA,CAACC,wBAAgB,EAAA;AAACJ,EAAAA,MAAM,EAAEA,MAAO;AAACC,EAAAA,IAAI,EAAEA;AAAK,CAAA,CAAG,GAAGD,MAAM;AAE9F,MAAMK,yBAAyB,GAAGA,CAAC;EACjCC,KAAK;AACLC,EAAAA,EAAE,GAAG,IAAI;EACTC,WAAW;EACXR,MAAM;AACNS,EAAAA;AAAe,CACE,kBACjBC,eAAA,CAAA,KAAA,EAAA;AAAKC,EAAAA,SAAS,EAAC,yBAAyB;EAAAC,QAAA,EAAA,cACtCT,cAAA,CAACU,aAAK,EAAA;AAACN,IAAAA,EAAE,EAAEA,EAAG;IAACO,IAAI,EAAEC,qBAAU,CAACC,WAAY;AAACL,IAAAA,SAAS,EAAC,wBAAwB;AAAAC,IAAAA,QAAA,EAC5EJ,WAAW,gBACVE,eAAA,CAACO,YAAI,EAAA;MACHC,IAAI,EAAEV,WAAW,CAACU,IAAK;MACvBC,MAAM,EAAEX,WAAW,CAACW,MAAO;AAC3BR,MAAAA,SAAS,EAAC,6BAA6B;MACvCS,OAAO,EAAEZ,WAAW,CAACY,OAAQ;MAAAR,QAAA,EAAA,CAE5BN,KAAK,eAENI,eAAA,CAAA,MAAA,EAAA;AAAMC,QAAAA,SAAS,EAAC,gCAAgC;QAAC,aAAA,EAAA,IAAW;AAAAC,QAAAA,QAAA,EAAA,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} from 'react';
|
|
4
|
+
import CardContainer from '../CardContainer/CardContainer.mjs';
|
|
5
|
+
import '../common/theme.mjs';
|
|
6
|
+
import '../common/direction.mjs';
|
|
7
|
+
import '@transferwise/neptune-tokens';
|
|
8
|
+
import '../common/PropsValues/control.mjs';
|
|
9
|
+
import '../common/PropsValues/size.mjs';
|
|
10
|
+
import { Typography } from '../common/PropsValues/typography.mjs';
|
|
11
|
+
import '../common/PropsValues/width.mjs';
|
|
12
|
+
import '../common/PropsValues/type.mjs';
|
|
13
|
+
import '../common/PropsValues/dateMode.mjs';
|
|
14
|
+
import '../common/PropsValues/monthFormat.mjs';
|
|
15
|
+
import '../common/PropsValues/position.mjs';
|
|
16
|
+
import '../common/PropsValues/layouts.mjs';
|
|
17
|
+
import '../common/PropsValues/status.mjs';
|
|
18
|
+
import '../common/PropsValues/sentiment.mjs';
|
|
19
|
+
import '../common/PropsValues/profileType.mjs';
|
|
20
|
+
import '../common/PropsValues/variant.mjs';
|
|
21
|
+
import '../common/PropsValues/scroll.mjs';
|
|
22
|
+
import '../common/PropsValues/markdownNodeType.mjs';
|
|
23
|
+
import '../common/fileType.mjs';
|
|
24
|
+
import '@transferwise/formatting';
|
|
25
|
+
import 'react-intl';
|
|
26
|
+
import '../common/CloseButton/CloseButton.messages.mjs';
|
|
27
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
28
|
+
import Link from '../Link/Link.mjs';
|
|
29
|
+
import Title from '../Title/Title.mjs';
|
|
30
|
+
import CardWidgetAction, { isCardWidgetActionButton } from './CardWidgetAction.mjs';
|
|
31
|
+
|
|
32
|
+
const renderAction = (action, slot) => isCardWidgetActionButton(action) ? /*#__PURE__*/jsx(CardWidgetAction, {
|
|
33
|
+
action: action,
|
|
34
|
+
slot: slot
|
|
35
|
+
}) : action;
|
|
36
|
+
const CardWidgetHeaderComponent = ({
|
|
37
|
+
title,
|
|
38
|
+
as = 'h3',
|
|
39
|
+
titleAction,
|
|
40
|
+
action,
|
|
41
|
+
actionSecondary
|
|
42
|
+
}) => /*#__PURE__*/jsxs("div", {
|
|
43
|
+
className: "wds-card-widget__header",
|
|
44
|
+
children: [/*#__PURE__*/jsx(Title, {
|
|
45
|
+
as: as,
|
|
46
|
+
type: Typography.TITLE_GROUP,
|
|
47
|
+
className: "wds-card-widget__title",
|
|
48
|
+
children: titleAction ? /*#__PURE__*/jsxs(Link, {
|
|
49
|
+
href: titleAction.href,
|
|
50
|
+
target: titleAction.target,
|
|
51
|
+
className: "wds-card-widget__title-link",
|
|
52
|
+
onClick: titleAction.onClick,
|
|
53
|
+
children: [title, /*#__PURE__*/jsxs("span", {
|
|
54
|
+
className: "wds-card-widget__title-chevron",
|
|
55
|
+
"aria-hidden": true,
|
|
56
|
+
children: ['\u2060', /*#__PURE__*/jsx(ChevronEnd, {
|
|
57
|
+
size: 16
|
|
58
|
+
})]
|
|
59
|
+
})]
|
|
60
|
+
}) : title
|
|
61
|
+
}), (action || actionSecondary) && /*#__PURE__*/jsxs("div", {
|
|
62
|
+
className: "wds-card-widget__actions",
|
|
63
|
+
children: [actionSecondary && renderAction(actionSecondary, 'actionSecondary'), action && renderAction(action, 'action')]
|
|
64
|
+
})]
|
|
65
|
+
});
|
|
66
|
+
/**
|
|
67
|
+
* A `CardContainer` with an optional header — a title, a title link and up to two actions — above
|
|
68
|
+
* its content. The card shows as hovered or pressed while the title link is, and as hovered while
|
|
69
|
+
* the link has keyboard focus. Hovering or pressing the rest of the card, or its actions, leaves it
|
|
70
|
+
* at rest.
|
|
71
|
+
*/
|
|
72
|
+
const CardWidget = /*#__PURE__*/forwardRef(({
|
|
73
|
+
header,
|
|
74
|
+
children,
|
|
75
|
+
className,
|
|
76
|
+
...props
|
|
77
|
+
}, ref) => /*#__PURE__*/jsxs(CardContainer, {
|
|
78
|
+
ref: ref,
|
|
79
|
+
className: clsx('wds-card-widget', header && 'wds-card-widget--with-header', className),
|
|
80
|
+
...props,
|
|
81
|
+
// The widget's states follow its title link alone, so the card's own are left off.
|
|
82
|
+
interactive: false,
|
|
83
|
+
padding: "md",
|
|
84
|
+
children: [header && /*#__PURE__*/jsx(CardWidgetHeaderComponent, {
|
|
85
|
+
...header
|
|
86
|
+
}), children != null && /*#__PURE__*/jsx("div", {
|
|
87
|
+
className: "wds-card-widget__content",
|
|
88
|
+
children: children
|
|
89
|
+
})]
|
|
90
|
+
}));
|
|
91
|
+
CardWidget.displayName = 'CardWidget';
|
|
92
|
+
|
|
93
|
+
export { CardWidget as default };
|
|
94
|
+
//# sourceMappingURL=CardWidget.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CardWidget.mjs","sources":["../../src/CardWidget/CardWidget.tsx"],"sourcesContent":["import { ChevronEnd } from '@transferwise/icons';\nimport { clsx } from 'clsx';\nimport { forwardRef } from 'react';\n\nimport CardContainer from '../CardContainer';\nimport { Typography } from '../common';\nimport Link from '../Link';\nimport Title from '../Title';\nimport type { CardWidgetHeader, CardWidgetProps } from './CardWidget.types';\nimport CardWidgetAction, {\n isCardWidgetActionButton,\n type CardWidgetActionSlot,\n} from './CardWidgetAction';\n\nconst renderAction = (action: CardWidgetHeader['action'], slot: CardWidgetActionSlot) =>\n isCardWidgetActionButton(action) ? <CardWidgetAction action={action} slot={slot} /> : action;\n\nconst CardWidgetHeaderComponent = ({\n title,\n as = 'h3',\n titleAction,\n action,\n actionSecondary,\n}: CardWidgetHeader) => (\n <div className=\"wds-card-widget__header\">\n <Title as={as} type={Typography.TITLE_GROUP} className=\"wds-card-widget__title\">\n {titleAction ? (\n <Link\n href={titleAction.href}\n target={titleAction.target}\n className=\"wds-card-widget__title-link\"\n onClick={titleAction.onClick}\n >\n {title}\n {/* The word joiner keeps the chevron on the title's last line instead of wrapping alone. */}\n <span className=\"wds-card-widget__title-chevron\" aria-hidden>\n {'\\u2060'}\n <ChevronEnd size={16} />\n </span>\n </Link>\n ) : (\n title\n )}\n </Title>\n {(action || actionSecondary) && (\n <div className=\"wds-card-widget__actions\">\n {actionSecondary && renderAction(actionSecondary, 'actionSecondary')}\n {action && renderAction(action, 'action')}\n </div>\n )}\n </div>\n);\n\n/**\n * A `CardContainer` with an optional header — a title, a title link and up to two actions — above\n * its content. The card shows as hovered or pressed while the title link is, and as hovered while\n * the link has keyboard focus. Hovering or pressing the rest of the card, or its actions, leaves it\n * at rest.\n */\nconst CardWidget = forwardRef<HTMLElement, CardWidgetProps>(\n ({ header, children, className, ...props }, ref) => (\n <CardContainer\n ref={ref}\n className={clsx('wds-card-widget', header && 'wds-card-widget--with-header', className)}\n {...props}\n // The widget's states follow its title link alone, so the card's own are left off.\n interactive={false}\n padding=\"md\"\n >\n {header && <CardWidgetHeaderComponent {...header} />}\n {children != null && <div className=\"wds-card-widget__content\">{children}</div>}\n </CardContainer>\n ),\n);\n\nCardWidget.displayName = 'CardWidget';\n\nexport default CardWidget;\n"],"names":["renderAction","action","slot","isCardWidgetActionButton","_jsx","CardWidgetAction","CardWidgetHeaderComponent","title","as","titleAction","actionSecondary","_jsxs","className","children","Title","type","Typography","TITLE_GROUP","Link","href","target","onClick","ChevronEnd","size","CardWidget","forwardRef","header","props","ref","CardContainer","clsx","interactive","padding","displayName"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAcA,MAAMA,YAAY,GAAGA,CAACC,MAAkC,EAAEC,IAA0B,KAClFC,wBAAwB,CAACF,MAAM,CAAC,gBAAGG,GAAA,CAACC,gBAAgB,EAAA;AAACJ,EAAAA,MAAM,EAAEA,MAAO;AAACC,EAAAA,IAAI,EAAEA;AAAK,CAAA,CAAG,GAAGD,MAAM;AAE9F,MAAMK,yBAAyB,GAAGA,CAAC;EACjCC,KAAK;AACLC,EAAAA,EAAE,GAAG,IAAI;EACTC,WAAW;EACXR,MAAM;AACNS,EAAAA;AAAe,CACE,kBACjBC,IAAA,CAAA,KAAA,EAAA;AAAKC,EAAAA,SAAS,EAAC,yBAAyB;EAAAC,QAAA,EAAA,cACtCT,GAAA,CAACU,KAAK,EAAA;AA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AE,KAAM;AACnBC,EAAAA,OAAO,EAAC,IAAI;AAAAnB,EAAAA,QAAA,EAAA,CAEXa,MAAM,iBAAItB,GAAA,CAACE,yBAAyB,EAAA;IAAA,GAAKoB;AAAM,GAAC,CAAG,EACnDb,QAAQ,IAAI,IAAI,iBAAIT,GAAA,CAAA,KAAA,EAAA;AAAKQ,IAAAA,SAAS,EAAC,0BAA0B;AAAAC,IAAAA,QAAA,EAAEA;AAAQ,GAAM,CAAC;AAAA,CAClE,CAChB;AAGHW,UAAU,CAACS,WAAW,GAAG,YAAY;;"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var React = require('react');
|
|
6
|
+
var Button_resolver = require('../Button/Button.resolver.js');
|
|
7
|
+
var IconButton = require('../IconButton/IconButton.js');
|
|
8
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
9
|
+
|
|
10
|
+
const BUTTON_PRIORITY = {
|
|
11
|
+
action: 'secondary',
|
|
12
|
+
actionSecondary: 'secondary-neutral'
|
|
13
|
+
};
|
|
14
|
+
const ICON_BUTTON_PRIORITY = {
|
|
15
|
+
action: 'secondary',
|
|
16
|
+
actionSecondary: 'tertiary'
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Tells a `CardWidgetActionButton` object apart from any other node passed to an action slot.
|
|
20
|
+
* Every button action has a `label` or an `icon`, which no React element, portal or array does.
|
|
21
|
+
*/
|
|
22
|
+
const isCardWidgetActionButton = value => typeof value === 'object' && value !== null && ! /*#__PURE__*/React.isValidElement(value) && !Array.isArray(value) && ('label' in value || 'icon' in value);
|
|
23
|
+
/** Renders a `CardWidgetActionButton` at the emphasis of the slot it was passed to. */
|
|
24
|
+
const CardWidgetAction = function CardWidgetAction({
|
|
25
|
+
action: {
|
|
26
|
+
label,
|
|
27
|
+
icon,
|
|
28
|
+
'aria-label': ariaLabel,
|
|
29
|
+
'data-testid': dataTestId,
|
|
30
|
+
href,
|
|
31
|
+
target,
|
|
32
|
+
onClick,
|
|
33
|
+
disabled
|
|
34
|
+
},
|
|
35
|
+
slot
|
|
36
|
+
}) {
|
|
37
|
+
if (label === undefined) {
|
|
38
|
+
return /*#__PURE__*/jsxRuntime.jsx(IconButton.default, {
|
|
39
|
+
size: 32,
|
|
40
|
+
priority: ICON_BUTTON_PRIORITY[slot],
|
|
41
|
+
"aria-label": ariaLabel,
|
|
42
|
+
href: href,
|
|
43
|
+
target: target,
|
|
44
|
+
disabled: disabled,
|
|
45
|
+
"data-testid": dataTestId,
|
|
46
|
+
onClick: onClick,
|
|
47
|
+
children: icon
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
return /*#__PURE__*/jsxRuntime.jsx(Button_resolver.default, {
|
|
51
|
+
v2: true,
|
|
52
|
+
size: "sm",
|
|
53
|
+
priority: BUTTON_PRIORITY[slot],
|
|
54
|
+
"aria-label": ariaLabel,
|
|
55
|
+
href: href,
|
|
56
|
+
target: target,
|
|
57
|
+
disabled: disabled,
|
|
58
|
+
addonEnd: icon ? {
|
|
59
|
+
type: 'icon',
|
|
60
|
+
value: icon
|
|
61
|
+
} : undefined
|
|
62
|
+
// The v2 resolver drops `Button`'s own `button` default, so an action would submit a form.
|
|
63
|
+
,
|
|
64
|
+
type: "button",
|
|
65
|
+
"data-testid": dataTestId,
|
|
66
|
+
onClick: onClick,
|
|
67
|
+
children: label
|
|
68
|
+
});
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
exports.default = CardWidgetAction;
|
|
72
|
+
exports.isCardWidgetActionButton = isCardWidgetActionButton;
|
|
73
|
+
//# sourceMappingURL=CardWidgetAction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CardWidgetAction.js","sources":["../../src/CardWidget/CardWidgetAction.tsx"],"sourcesContent":["import { isValidElement, type MouseEventHandler, type ReactNode } from 'react';\n\nimport Button from '../Button';\nimport type { ButtonPriority, ButtonProps } from '../Button/Button.types';\nimport IconButton, { type IconButtonProps } from '../IconButton';\n\n/** The action slot a `CardWidgetActionButton` was passed to, which is what determines its emphasis. */\nexport type CardWidgetActionSlot = 'action' | 'actionSecondary';\n\ntype CardWidgetActionButtonBase = Pick<ButtonProps, 'href' | 'target' | 'disabled'> & {\n /**\n * `HTMLElement` rather than a narrower target, because an action is a `button` or an `a`\n * depending on whether `href` is set.\n * @default undefined\n */\n onClick?: MouseEventHandler<HTMLElement>;\n\n /**\n * Rendered after `label`, or as the only content of an unlabelled action.\n * Size it yourself — 16px is expected in both cases.\n * @default undefined\n */\n icon?: ReactNode;\n 'data-testid'?: string;\n};\n\n/** An action with a visible label, rendered as a small button. */\ntype CardWidgetLabelledActionButton = CardWidgetActionButtonBase & {\n /** Non-rendering values are excluded, so an unlabelled action has to meet the icon-only rules. */\n label: Exclude<ButtonProps['children'], null | undefined | boolean>;\n /** @default undefined */\n 'aria-label'?: string;\n};\n\n/**\n * An action with no visible label, rendered as a 32px icon button. The icon is\n * the only thing on screen and `aria-label` is the only accessible name, so\n * both are required.\n */\ntype CardWidgetIconActionButton = CardWidgetActionButtonBase & {\n label?: never;\n icon: ReactNode;\n 'aria-label': string;\n};\n\n/**\n * An action the `CardWidget` header renders as a button. With a `label` it is a small `Button`; without\n * one, a 32px `IconButton`, which requires both an `icon` and an `aria-label`. Emphasis is not\n * part of the object — it comes from the slot the action is passed to.\n */\nexport type CardWidgetActionButton = CardWidgetLabelledActionButton | CardWidgetIconActionButton;\n\nconst BUTTON_PRIORITY = {\n action: 'secondary',\n actionSecondary: 'secondary-neutral',\n} as const satisfies Record<CardWidgetActionSlot, ButtonPriority>;\n\nconst ICON_BUTTON_PRIORITY = {\n action: 'secondary',\n actionSecondary: 'tertiary',\n} as const satisfies Record<CardWidgetActionSlot, IconButtonProps['priority']>;\n\n/**\n * Tells a `CardWidgetActionButton` object apart from any other node passed to an action slot.\n * Every button action has a `label` or an `icon`, which no React element, portal or array does.\n */\nexport const isCardWidgetActionButton = (value: unknown): value is CardWidgetActionButton =>\n typeof value === 'object' &&\n value !== null &&\n !isValidElement(value) &&\n !Array.isArray(value) &&\n ('label' in value || 'icon' in value);\n\n/** Renders a `CardWidgetActionButton` at the emphasis of the slot it was passed to. */\nconst CardWidgetAction = function CardWidgetAction({\n action: {\n label,\n icon,\n 'aria-label': ariaLabel,\n 'data-testid': dataTestId,\n href,\n target,\n onClick,\n disabled,\n },\n slot,\n}: {\n action: CardWidgetActionButton;\n slot: CardWidgetActionSlot;\n}) {\n if (label === undefined) {\n return (\n <IconButton\n size={32}\n priority={ICON_BUTTON_PRIORITY[slot]}\n aria-label={ariaLabel}\n href={href}\n target={target}\n disabled={disabled}\n data-testid={dataTestId}\n onClick={onClick}\n >\n {icon}\n </IconButton>\n );\n }\n\n return (\n <Button\n v2\n size=\"sm\"\n priority={BUTTON_PRIORITY[slot]}\n aria-label={ariaLabel}\n href={href}\n target={target}\n disabled={disabled}\n addonEnd={icon ? { type: 'icon', value: icon } : undefined}\n // The v2 resolver drops `Button`'s own `button` default, so an action would submit a form.\n type=\"button\"\n data-testid={dataTestId}\n onClick={onClick}\n >\n {label}\n </Button>\n );\n};\n\nexport default CardWidgetAction;\n"],"names":["BUTTON_PRIORITY","action","actionSecondary","ICON_BUTTON_PRIORITY","isCardWidgetActionButton","value","isValidElement","Array","isArray","CardWidgetAction","label","icon","ariaLabel","dataTestId","href","target","onClick","disabled","slot","undefined","_jsx","IconButton","size","priority","children","Button","v2","addonEnd","type"],"mappings":";;;;;;;;;AAoDA,MAAMA,eAAe,GAAG;AACtBC,EAAAA,MAAM,EAAE,WAAW;AACnBC,EAAAA,eAAe,EAAE;CAC8C;AAEjE,MAAMC,oBAAoB,GAAG;AAC3BF,EAAAA,MAAM,EAAE,WAAW;AACnBC,EAAAA,eAAe,EAAE;CAC2D;AAE9E;;;AAGG;AACI,MAAME,wBAAwB,GAAIC,KAAc,IACrD,OAAOA,KAAK,KAAK,QAA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GQ;AACjD;AAAA;AACAS,IAAAA,IAAI,EAAC,QAAQ;AACb,IAAA,aAAA,EAAaf,UAAW;AACxBG,IAAAA,OAAO,EAAEA,OAAQ;AAAAQ,IAAAA,QAAA,EAEhBd;AAAK,GACA,CAAC;AAEb;;;"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { isValidElement } from 'react';
|
|
2
|
+
import Button from '../Button/Button.resolver.mjs';
|
|
3
|
+
import IconButton from '../IconButton/IconButton.mjs';
|
|
4
|
+
import { jsx } from 'react/jsx-runtime';
|
|
5
|
+
|
|
6
|
+
const BUTTON_PRIORITY = {
|
|
7
|
+
action: 'secondary',
|
|
8
|
+
actionSecondary: 'secondary-neutral'
|
|
9
|
+
};
|
|
10
|
+
const ICON_BUTTON_PRIORITY = {
|
|
11
|
+
action: 'secondary',
|
|
12
|
+
actionSecondary: 'tertiary'
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Tells a `CardWidgetActionButton` object apart from any other node passed to an action slot.
|
|
16
|
+
* Every button action has a `label` or an `icon`, which no React element, portal or array does.
|
|
17
|
+
*/
|
|
18
|
+
const isCardWidgetActionButton = value => typeof value === 'object' && value !== null && ! /*#__PURE__*/isValidElement(value) && !Array.isArray(value) && ('label' in value || 'icon' in value);
|
|
19
|
+
/** Renders a `CardWidgetActionButton` at the emphasis of the slot it was passed to. */
|
|
20
|
+
const CardWidgetAction = function CardWidgetAction({
|
|
21
|
+
action: {
|
|
22
|
+
label,
|
|
23
|
+
icon,
|
|
24
|
+
'aria-label': ariaLabel,
|
|
25
|
+
'data-testid': dataTestId,
|
|
26
|
+
href,
|
|
27
|
+
target,
|
|
28
|
+
onClick,
|
|
29
|
+
disabled
|
|
30
|
+
},
|
|
31
|
+
slot
|
|
32
|
+
}) {
|
|
33
|
+
if (label === undefined) {
|
|
34
|
+
return /*#__PURE__*/jsx(IconButton, {
|
|
35
|
+
size: 32,
|
|
36
|
+
priority: ICON_BUTTON_PRIORITY[slot],
|
|
37
|
+
"aria-label": ariaLabel,
|
|
38
|
+
href: href,
|
|
39
|
+
target: target,
|
|
40
|
+
disabled: disabled,
|
|
41
|
+
"data-testid": dataTestId,
|
|
42
|
+
onClick: onClick,
|
|
43
|
+
children: icon
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
return /*#__PURE__*/jsx(Button, {
|
|
47
|
+
v2: true,
|
|
48
|
+
size: "sm",
|
|
49
|
+
priority: BUTTON_PRIORITY[slot],
|
|
50
|
+
"aria-label": ariaLabel,
|
|
51
|
+
href: href,
|
|
52
|
+
target: target,
|
|
53
|
+
disabled: disabled,
|
|
54
|
+
addonEnd: icon ? {
|
|
55
|
+
type: 'icon',
|
|
56
|
+
value: icon
|
|
57
|
+
} : undefined
|
|
58
|
+
// The v2 resolver drops `Button`'s own `button` default, so an action would submit a form.
|
|
59
|
+
,
|
|
60
|
+
type: "button",
|
|
61
|
+
"data-testid": dataTestId,
|
|
62
|
+
onClick: onClick,
|
|
63
|
+
children: label
|
|
64
|
+
});
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
export { CardWidgetAction as default, isCardWidgetActionButton };
|
|
68
|
+
//# sourceMappingURL=CardWidgetAction.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CardWidgetAction.mjs","sources":["../../src/CardWidget/CardWidgetAction.tsx"],"sourcesContent":["import { isValidElement, type MouseEventHandler, type ReactNode } from 'react';\n\nimport Button from '../Button';\nimport type { ButtonPriority, ButtonProps } from '../Button/Button.types';\nimport IconButton, { type IconButtonProps } from '../IconButton';\n\n/** The action slot a `CardWidgetActionButton` was passed to, which is what determines its emphasis. */\nexport type CardWidgetActionSlot = 'action' | 'actionSecondary';\n\ntype CardWidgetActionButtonBase = Pick<ButtonProps, 'href' | 'target' | 'disabled'> & {\n /**\n * `HTMLElement` rather than a narrower target, because an action is a `button` or an `a`\n * depending on whether `href` is set.\n * @default undefined\n */\n onClick?: MouseEventHandler<HTMLElement>;\n\n /**\n * Rendered after `label`, or as the only content of an unlabelled action.\n * Size it yourself — 16px is expected in both cases.\n * @default undefined\n */\n icon?: ReactNode;\n 'data-testid'?: string;\n};\n\n/** An action with a visible label, rendered as a small button. */\ntype CardWidgetLabelledActionButton = CardWidgetActionButtonBase & {\n /** Non-rendering values are excluded, so an unlabelled action has to meet the icon-only rules. */\n label: Exclude<ButtonProps['children'], null | undefined | boolean>;\n /** @default undefined */\n 'aria-label'?: string;\n};\n\n/**\n * An action with no visible label, rendered as a 32px icon button. The icon is\n * the only thing on screen and `aria-label` is the only accessible name, so\n * both are required.\n */\ntype CardWidgetIconActionButton = CardWidgetActionButtonBase & {\n label?: never;\n icon: ReactNode;\n 'aria-label': string;\n};\n\n/**\n * An action the `CardWidget` header renders as a button. With a `label` it is a small `Button`; without\n * one, a 32px `IconButton`, which requires both an `icon` and an `aria-label`. Emphasis is not\n * part of the object — it comes from the slot the action is passed to.\n */\nexport type CardWidgetActionButton = CardWidgetLabelledActionButton | CardWidgetIconActionButton;\n\nconst BUTTON_PRIORITY = {\n action: 'secondary',\n actionSecondary: 'secondary-neutral',\n} as const satisfies Record<CardWidgetActionSlot, ButtonPriority>;\n\nconst ICON_BUTTON_PRIORITY = {\n action: 'secondary',\n actionSecondary: 'tertiary',\n} as const satisfies Record<CardWidgetActionSlot, IconButtonProps['priority']>;\n\n/**\n * Tells a `CardWidgetActionButton` object apart from any other node passed to an action slot.\n * Every button action has a `label` or an `icon`, which no React element, portal or array does.\n */\nexport const isCardWidgetActionButton = (value: unknown): value is CardWidgetActionButton =>\n typeof value === 'object' &&\n value !== null &&\n !isValidElement(value) &&\n !Array.isArray(value) &&\n ('label' in value || 'icon' in value);\n\n/** Renders a `CardWidgetActionButton` at the emphasis of the slot it was passed to. */\nconst CardWidgetAction = function CardWidgetAction({\n action: {\n label,\n icon,\n 'aria-label': ariaLabel,\n 'data-testid': dataTestId,\n href,\n target,\n onClick,\n disabled,\n },\n slot,\n}: {\n action: CardWidgetActionButton;\n slot: CardWidgetActionSlot;\n}) {\n if (label === undefined) {\n return (\n <IconButton\n size={32}\n priority={ICON_BUTTON_PRIORITY[slot]}\n aria-label={ariaLabel}\n href={href}\n target={target}\n disabled={disabled}\n data-testid={dataTestId}\n onClick={onClick}\n >\n {icon}\n </IconButton>\n );\n }\n\n return (\n <Button\n v2\n size=\"sm\"\n priority={BUTTON_PRIORITY[slot]}\n aria-label={ariaLabel}\n href={href}\n target={target}\n disabled={disabled}\n addonEnd={icon ? { type: 'icon', value: icon } : undefined}\n // The v2 resolver drops `Button`'s own `button` default, so an action would submit a form.\n type=\"button\"\n data-testid={dataTestId}\n onClick={onClick}\n >\n {label}\n </Button>\n );\n};\n\nexport default CardWidgetAction;\n"],"names":["BUTTON_PRIORITY","action","actionSecondary","ICON_BUTTON_PRIORITY","isCardWidgetActionButton","value","isValidElement","Array","isArray","CardWidgetAction","label","icon","ariaLabel","dataTestId","href","target","onClick","disabled","slot","undefined","_jsx","IconButton","size","priority","children","Button","v2","addonEnd","type"],"mappings":";;;;;AAoDA,MAAMA,eAAe,GAAG;AACtBC,EAAAA,MAAM,EAAE,WAAW;AACnBC,EAAAA,eAAe,EAAE;CAC8C;AAEjE,MAAMC,oBAAoB,GAAG;AAC3BF,EAAAA,MAAM,EAAE,WAAW;AACnBC,EAAAA,eAAe,EAAE;CAC2D;AAE9E;;;AAGG;AACI,MAAME,wBAAwB,GAAIC,KAAc,IACrD,OAAOA,KAAK,KAAK,QAAQ,IACzBA,KAAK,KAAK,IAAI,IACd,eAACC,cAAc,CAACD,KAAK,CAAC,IACtB,CAACE,KAAK,CAACC,OAAO,CAACH,KAAK,CAAC,KACpB,OAAO,IAAIA,KAAK,IAAI,MAAM,IAAIA,KAAK;AAEtC;AACA,MAAMI,gBAAgB,GAAG,SAASA,gBAAgBA,CAAC;AACjDR,EAAAA,MAAM,EAAE;IACNS,KAAK;IACLC,IAAI;AACJ,IAAA,YAAY,EAAEC,SAAS;AACvB,IAAA,aAAa,EAAEC,UAAU;IACzBC,IAAI;IACJC,MAAM;IACNC,OAAO;AACPC,IAAAA;GACD;AACDC,EAAAA;AAAI,CAIL,EAAA;EACC,IAAIR,KAAK,KAAKS,SAAS,EAAE;IACvB,oBACEC,GAAA,CAACC,UAAU,EAAA;AACTC,MAAAA,IAAI,EAAE,EAAG;AACTC,MAAAA,QAAQ,EAAEpB,oBAAoB,CAACe,IAAI,CAAE;AACrC,MAAA,YAAA,EAAYN,SAAU;AACtBE,MAAAA,IAAI,EAAEA,IAAK;AACXC,MAAAA,MAAM,EAAEA,MAAO;AACfE,MAAAA,QAAQ,EAAEA,QAAS;AACnB,MAAA,aAAA,EAAaJ,UAAW;AACxBG,MAAAA,OAAO,EAAEA,OAAQ;AAAAQ,MAAAA,QAAA,EAEhBb;AAAI,KACK,CAAC;AAEjB,EAAA;EAEA,oBACES,GAAA,CAACK,MAAM,EAAA;IACLC,EAAE,EAAA,IAAA;AACFJ,IAAAA,IAAI,EAAC,IAAI;AACTC,IAAAA,QAAQ,EAAEvB,eAAe,CAACkB,IAAI,CAAE;AAChC,IAAA,YAAA,EAAYN,SAAU;AACtBE,IAAAA,IAAI,EAAEA,IAAK;AACXC,IAAAA,MAAM,EAAEA,MAAO;AACfE,IAAAA,QAAQ,EAAEA,QAAS;IACnBU,QAAQ,EAAEhB,IAAI,GAAG;AAAEiB,MAAAA,IAAI,EAAE,MAAM;AAAEvB,MAAAA,KAAK,EAAEM;AAAI,KAAE,GAAGQ;AACjD;AAAA;AACAS,IAAAA,IAAI,EAAC,QAAQ;AACb,IAAA,aAAA,EAAaf,UAAW;AACxBG,IAAAA,OAAO,EAAEA,OAAQ;AAAAQ,IAAAA,QAAA,EAEhBd;AAAK,GACA,CAAC;AAEb;;"}
|
|
@@ -154,6 +154,8 @@ const ListItem = ({
|
|
|
154
154
|
'wds-list-item-interactive': isFullyInteractive,
|
|
155
155
|
'wds-list-item-partially-interactive': isPartiallyInteractive,
|
|
156
156
|
[`wds-list-item-spotlight wds-list-item-spotlight-${spotlight}`]: isFullyInteractive && !!spotlight,
|
|
157
|
+
'wds-list-item-paddingY-8': paddingY === 8,
|
|
158
|
+
'wds-list-item-paddingY-16': paddingY === 16,
|
|
157
159
|
'wds-list-item-paddingY-24': paddingY === 24,
|
|
158
160
|
disabled: disabled && !isPartiallyInteractive,
|
|
159
161
|
'disabled--has-prompt-reason': !disabledPromptMessage && disabled && !isPartiallyInteractive
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ListItem.js","sources":["../../src/ListItem/ListItem.tsx"],"sourcesContent":["import {\n useContext,\n useId,\n useMemo,\n useState,\n type PropsWithChildren,\n type ReactNode,\n} from 'react';\nimport { Sentiment, Typography } from '../common';\nimport Body from '../Body';\nimport { AdditionalInfo } from './AdditionalInfo';\nimport { IconButton, type ListItemIconButtonProps } from './IconButton';\nimport { Checkbox, type ListItemCheckboxProps } from './Checkbox';\nimport { Navigation, type ListItemNavigationProps } from './Navigation';\nimport { clsx } from 'clsx';\nimport { Button, type ListItemButtonProps } from './Button';\nimport { Radio, type ListItemRadioProps } from './Radio';\nimport { Switch, type ListItemSwitchProps } from './Switch';\nimport { AvatarLayout } from './AvatarLayout';\nimport { AvatarView } from './AvatarView';\nimport { Image } from './Image';\nimport { Prompt } from './Prompt';\nimport { PrimitiveAnchor, type PrimitiveAnchorProps } from '../Primitives';\nimport {\n ListItemContext,\n type ListItemContextData,\n type ListItemMediaSize,\n} from './ListItemContext';\n\nexport type ListItemTypes =\n 'non-interactive' | 'navigation' | 'radio' | 'checkbox' | 'switch' | 'button' | 'icon-button';\n\nexport type ListItemControlProps =\n | ListItemNavigationProps\n | ListItemCheckboxProps\n | ListItemButtonProps\n | ListItemIconButtonProps\n | ListItemRadioProps\n | ListItemSwitchProps;\n\nexport type ListItemProps = {\n /** @default 'li' */\n as?: 'li' | 'div';\n /**\n * Swaps vertical hierarchy of title and subtitle and their corresponding right values.\n */\n inverted?: boolean;\n /**\n * Disables the control and renders the ListItem in greyscale and with slightly decreased opacity.\n */\n disabled?: boolean;\n /**\n * If set, it'll extend the `disabled` state, overriding existing or injecting uniquely styled prompt with the message provided via this prop. <br />\n * **NB:** This message cannot house more than **1** link or inline button.<br />\n * **NB:** It must be used together with `disabled` prop and will be disregarded otherwise.\n */\n disabledPromptMessage?: ReactNode;\n /**\n * Highlights the list item as an action to be taken or already taken. <br />\n */\n spotlight?: 'active' | 'inactive';\n /**\n * Vertical padding of the list item, in pixels.\n * @default 12\n */\n paddingY?: 12 | 24;\n title: ReactNode;\n subtitle?: ReactNode;\n /**\n * Requires `<ListItem.AdditionalInfo />` component as a sole child. <br />\n * Can be only rendered if `subtitle` is also provided.\n */\n additionalInfo?: ReactNode;\n valueTitle?: ReactNode;\n valueSubtitle?: ReactNode;\n /**\n * Requires one of the following as a sole child: <br />\n * `<ListItem.AvatarView />`,\n * `<ListItem.AvatarLayout />` or\n * `<ListItem.Image />`\n */\n media?: ReactNode;\n /**\n * Requires one of the following as a sole child: <br/>\n * `<ListItem.Button />`, <br/>\n * `<ListItem.Checkbox />`, <br/>\n * `<ListItem.IconButton />`, <br/>\n * `<ListItem.Navigation />`, <br/>\n * `<ListItem.Radio />`, or\n * `<ListItem.Switch />`\n * @default null\n */\n control?: ReactNode;\n /**\n * Requires `<ListItem.Prompt />` component as a sole child.\n */\n prompt?: ReactNode;\n className?: string;\n /**\n * A number between `0–100` which resolves to a `fr` value of a `grid-template-columns` declaration. E.g. `valueColumnWidth={25}` will result in a `75fr 25fr`. <br />\n * Controls the width ratio of left side content (title and subtitle) to the right side content.\n */\n valueColumnWidth?: number;\n id?: string;\n};\n\n/**\n * @see [Design documentation](https://docs.wise.design/components/list-item)\n * @see [Storybook documentation](https://storybook.wise.design/?path=/docs/content-listitem--docs)\n */\nexport const ListItem = ({\n as: ListItemElement = 'li',\n title,\n subtitle,\n additionalInfo,\n prompt,\n inverted,\n media,\n spotlight,\n paddingY = 12,\n valueTitle,\n valueSubtitle,\n control = null,\n disabled,\n disabledPromptMessage,\n className,\n valueColumnWidth,\n id,\n}: ListItemProps) => {\n const idPrefix = useId();\n const [controlProps, setControlProps] = useState<ListItemControlProps>({});\n const [controlType, setControlType] = useState<ListItemTypes>('non-interactive');\n const [mediaSize, setMediaSize] = useState<ListItemMediaSize | undefined>();\n\n const ids: ListItemContextData['ids'] = {\n title: `${idPrefix}_title`,\n ...(subtitle ? { subtitle: `${idPrefix}_subtitle` } : {}),\n ...(valueTitle ? { valueTitle: `${idPrefix}_value-title` } : {}),\n ...(valueSubtitle ? { valueSubtitle: `${idPrefix}_value-subtitle` } : {}),\n control: `${idPrefix}_control`,\n ...(prompt || (disabled && disabledPromptMessage) ? { prompt: `${idPrefix}_prompt` } : {}),\n ...(additionalInfo ? { additionalInfo: `${idPrefix}_additional-info` } : {}),\n };\n\n const isPartiallyInteractive = Boolean(\n (controlType === 'button' || controlType === 'icon-button') &&\n (controlProps as ListItemButtonProps | ListItemIconButtonProps)?.partiallyInteractive,\n );\n const isFullyInteractive = controlType !== 'non-interactive' && !isPartiallyInteractive;\n const isButtonAsLink =\n (controlType === 'button' || controlType === 'icon-button') &&\n Boolean((controlProps as ListItemButtonProps | ListItemIconButtonProps)?.href);\n const isNavigationIndicatorHidden =\n controlType === 'navigation' &&\n Boolean((controlProps as ListItemNavigationProps)?.hideIndicator);\n\n const titlesAndValues = [\n inverted ? ids.subtitle : ids.title,\n inverted ? ids.title : ids.subtitle,\n inverted ? ids.valueSubtitle : ids.valueTitle,\n inverted ? ids.valueTitle : ids.valueSubtitle,\n ].join(' ');\n const additionalInfoPrompt = [ids.additionalInfo, ids.prompt].filter(Boolean).join(' ');\n\n const describedByIds = useMemo(() => {\n return isFullyInteractive && !isButtonAsLink\n ? additionalInfoPrompt\n : `${titlesAndValues} ${additionalInfoPrompt}`;\n }, [additionalInfoPrompt, isButtonAsLink, isFullyInteractive, titlesAndValues]);\n const listItemContext = useMemo(\n () => ({\n setControlType,\n setControlProps,\n setMediaSize,\n ids,\n props: { disabled, inverted, disabledPromptMessage },\n mediaSize,\n isPartiallyInteractive,\n describedByIds,\n }),\n [describedByIds, mediaSize, disabled, inverted, disabledPromptMessage, isPartiallyInteractive],\n );\n const gridColumnsStyle = {\n '--wds-list-item-body-left': valueColumnWidth ? `${100 - valueColumnWidth}fr` : '50fr',\n '--wds-list-item-body-right': valueColumnWidth ? `${valueColumnWidth}fr` : '50fr',\n } as React.CSSProperties;\n\n const getFeatureClassName = () => {\n const partials = [];\n const hasMedia = Boolean(media);\n const hasVisibleControl = Boolean(control) && !isNavigationIndicatorHidden;\n const hasInfo = Boolean(additionalInfo);\n const hasPrompt = Boolean(prompt) || (disabled && Boolean(disabledPromptMessage));\n\n /* eslint-disable functional/immutable-data */\n if (hasMedia && hasVisibleControl) {\n partials.push('wds-list-item-hasMedia-hasControl');\n }\n\n if (hasMedia && !hasVisibleControl) {\n partials.push('wds-list-item-hasMedia-noControl');\n }\n\n if (!hasMedia && hasVisibleControl) {\n partials.push('wds-list-item-noMedia-hasControl');\n }\n\n if (!hasMedia && !hasVisibleControl) {\n partials.push('wds-list-item-noMedia-noControl');\n }\n\n if (hasInfo && hasPrompt) {\n partials.push('wds-list-item-hasInfo-hasPrompt');\n }\n if (hasInfo && !hasPrompt) {\n partials.push('wds-list-item-hasInfo-noPrompt');\n }\n if (!hasInfo && hasPrompt) {\n partials.push('wds-list-item-noInfo-hasPrompt');\n }\n if (!hasInfo && !hasPrompt) {\n partials.push('wds-list-item-noInfo-noPrompt');\n }\n /* eslint-enable functional/immutable-data */\n\n return partials.join(' ');\n };\n\n return (\n <ListItemContext.Provider value={listItemContext}>\n <ListItemElement\n className={clsx(\n 'wds-list-item',\n `wds-list-item-${controlType}`,\n getFeatureClassName(),\n {\n 'wds-list-item-interactive': isFullyInteractive,\n 'wds-list-item-partially-interactive': isPartiallyInteractive,\n [`wds-list-item-spotlight wds-list-item-spotlight-${spotlight}`]:\n isFullyInteractive && !!spotlight,\n 'wds-list-item-paddingY-24': paddingY === 24,\n disabled: disabled && !isPartiallyInteractive,\n 'disabled--has-prompt-reason':\n !disabledPromptMessage && disabled && !isPartiallyInteractive,\n },\n className,\n )}\n id={id}\n aria-disabled={disabled}\n style={\n {\n '--wds-list-item-value-min-height': mediaSize ? `${mediaSize}px` : undefined,\n } as React.CSSProperties\n }\n >\n {isFullyInteractive && spotlight === 'inactive' && (\n <svg aria-hidden=\"true\" className=\"wds-list-item-spotlight__border\">\n <rect />\n </svg>\n )}\n\n <View\n {...{\n isPartiallyInteractive,\n subtitle,\n additionalInfo,\n disabled,\n disabledPromptMessage,\n prompt,\n controlType,\n controlProps,\n }}\n className={getFeatureClassName()}\n >\n {media && <div className=\"wds-list-item-media\">{media}</div>}\n\n {/* Title + Subtitle + Values - Group */}\n <div\n className=\"wds-list-item-body\"\n style={valueColumnWidth ? gridColumnsStyle : undefined}\n >\n {/* Title + Subtitle + Values - Group */}\n <span className=\"wds-list-item-titles\">\n {(() => {\n const titles = [\n <Body\n key={ids.title}\n id={ids.title}\n type={Typography.BODY_LARGE_BOLD}\n className=\"wds-list-item-title\"\n >\n {title}\n </Body>,\n ];\n if (subtitle) {\n titles.push(\n <Body key={ids.subtitle} id={ids.subtitle} className=\"wds-list-item-subtitle\">\n {subtitle}\n </Body>,\n );\n }\n return inverted ? [...titles].reverse() : titles;\n })()}\n </span>\n\n {(valueTitle || valueSubtitle) && (\n <span\n className={clsx('wds-list-item-value', {\n 'flex-column': valueTitle !== undefined || valueSubtitle !== undefined,\n })}\n >\n {(() => {\n const values = [];\n if (valueTitle) {\n values.push(\n <Body\n key={ids.valueTitle}\n id={ids.valueTitle}\n type={Typography.BODY_LARGE_BOLD}\n className=\"wds-list-item-title-value\"\n >\n {valueTitle}\n </Body>,\n );\n }\n if (valueSubtitle) {\n values.push(\n <Body\n key={ids.valueSubtitle}\n id={ids.valueSubtitle}\n className=\"wds-list-item-subtitle-value\"\n >\n {valueSubtitle}\n </Body>,\n );\n }\n return inverted ? [...values].reverse() : values;\n })()}\n </span>\n )}\n </div>\n\n {control === null ? null : (\n <Body\n className={clsx('wds-list-item-control-wrapper', {\n 'wds-list-item-button-control': controlType === 'button',\n 'wds-list-item-button-control--hasPrompt':\n controlType === 'button' && Boolean(prompt),\n })}\n style={\n {\n '--wds-list-item-control-wrapper-height': mediaSize ? `${mediaSize}px` : 'auto',\n } as React.CSSProperties\n }\n >\n {control}\n </Body>\n )}\n </View>\n </ListItemElement>\n </ListItemContext.Provider>\n );\n};\n\ntype ViewProps = PropsWithChildren<{\n isPartiallyInteractive: boolean;\n controlType?: ListItemTypes;\n controlProps?: ListItemControlProps;\n}> &\n Pick<\n ListItemProps,\n 'subtitle' | 'additionalInfo' | 'prompt' | 'disabled' | 'disabledPromptMessage' | 'className'\n >;\n\nfunction View({\n children,\n additionalInfo,\n prompt,\n disabled,\n disabledPromptMessage,\n isPartiallyInteractive,\n controlType = 'non-interactive',\n controlProps,\n className = '',\n}: ViewProps) {\n const { ids, describedByIds } = useContext<ListItemContextData>(ListItemContext);\n const isLinkControl = ['navigation'].includes(controlType);\n\n const isHrefProvided = isLinkControl && !!(controlProps as ListItemNavigationProps)?.href;\n\n const renderExtras = () => {\n const resolvedPrompt =\n disabled && disabledPromptMessage && !prompt ? (\n <Prompt sentiment={Sentiment.NEUTRAL}>{disabledPromptMessage}</Prompt>\n ) : (\n prompt\n );\n\n return (\n <>\n {additionalInfo}\n {resolvedPrompt}\n </>\n );\n };\n\n if (isLinkControl && isHrefProvided) {\n return (\n // for link instances of .Navigation, .IconButton, .Button\n <div className={clsx('wds-list-item-gridWrapper', className)}>\n <PrimitiveAnchor\n aria-describedby={describedByIds}\n href={(controlProps as ListItemNavigationProps)?.href}\n target={(controlProps as ListItemNavigationProps)?.target}\n className={clsx('wds-list-item-view', {\n 'wds-list-item-control': controlType === 'navigation',\n fullyInteractive: !isPartiallyInteractive,\n })}\n disabled={disabled}\n onClick={(controlProps as PrimitiveAnchorProps | undefined)?.onClick}\n >\n {children}\n </PrimitiveAnchor>\n\n {renderExtras()}\n </div>\n );\n }\n\n if (isPartiallyInteractive || controlType === 'non-interactive') {\n return (\n <div className={clsx('wds-list-item-gridWrapper', className)}>\n <div className=\"wds-list-item-view\">{children}</div>\n\n {renderExtras()}\n </div>\n );\n }\n\n // for form control instances of .Radio, .Checkbox, .Switch, .Button, .Navigation etc\n // Radio cannot be wrapped in a <fieldset> element to announce it as a group.\n const InputWrapper = controlType === 'radio' ? 'div' : 'fieldset';\n return (\n <InputWrapper className={clsx('wds-list-item-gridWrapper', className)}>\n <label\n htmlFor={ids.control}\n className={clsx('wds-list-item-view', {\n clickable: !disabled,\n fullyInteractive: !isPartiallyInteractive,\n })}\n >\n {children}\n </label>\n\n {renderExtras()}\n </InputWrapper>\n );\n}\n\nListItem.Image = Image;\nListItem.AvatarView = AvatarView;\nListItem.AvatarLayout = AvatarLayout;\nListItem.AdditionalInfo = AdditionalInfo;\nListItem.Checkbox = Checkbox;\nListItem.Radio = Radio;\nListItem.IconButton = IconButton;\nListItem.Navigation = Navigation;\nListItem.Button = Button;\nListItem.Switch = Switch;\nListItem.Prompt = Prompt;\n\nexport default ListItem;\n"],"names":["ListItem","as","ListItemElement","title","subtitle","additionalInfo","prompt","inverted","media","spotlight","paddingY","valueTitle","valueSubtitle","control","disabled","disabledPromptMessage","className","valueColumnWidth","id","idPrefix","useId","controlProps","setControlProps","useState","controlType","setControlType","mediaSize","setMediaSize","ids","isPartiallyInteractive","Boolean","partiallyInteractive","isFullyInteractive","isButtonAsLink","href","isNavigationIndicatorHidden","hideIndicator","titlesAndValues","join","additionalInfoPrompt","filter","describedByIds","useMemo","listItemContext","props","gridColumnsStyle","getFeatureClassName","partials","hasMedia","hasVisibleControl","hasInfo","hasPrompt","push","_jsx","ListItemContext","Provider","value","children","_jsxs","clsx","style","undefined","View","titles","Body","type","Typography","BODY_LARGE_BOLD","reverse","values","useContext","isLinkControl","includes","isHrefProvided","renderExtras","resolvedPrompt","Prompt","sentiment","Sentiment","NEUTRAL","_Fragment","PrimitiveAnchor","target","fullyInteractive","onClick","InputWrapper","htmlFor","clickable","Image","AvatarView","AvatarLayout","AdditionalInfo","Checkbox","Radio","IconButton","Navigation","Button","Switch"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8GO,MAAMA,QAAQ,GAAGA,CAAC;EACvBC,EAAE,EAAEC,eAAe,GAAG,IAAI;EAC1BC,KAAK;EACLC,QAAQ;EACRC,cAAc;EACdC,MAAM;EACNC,QAAQ;EACRC,KAAK;EACLC,SAAS;AACTC,EAAAA,QAAQ,GAAG,EAAE;EACbC,UAAU;EACVC,aAAa;AACbC,EAAAA,OAAO,GAAG,IAAI;EACdC,QAAQ;EACRC,qBAAqB;EACrBC,SAAS;EACTC,gBAAgB;AAChBC,EAAAA;AAAE,CACY,KAAI;AAClB,EAAA,MAAMC,QAAQ,GAAGC,WAAK,EAAE;EACxB,MAAM,CAACC,YAAY,EAAEC,eAAe,CAAC,GAAGC,cAAQ,CAAuB,EAAE,CAAC;EAC1E,MAAM,CAACC,WAAW,EAAEC,cAAc,CAAC,GAAGF,cAAQ,CAAgB,iBAAiB,CAAC;EAChF,MAAM,CAACG,SAAS,EAAEC,YAAY,CAAC,GAAGJ,cAAQ,EAAiC;AAE3E,EAAA,MAAMK,GAAG,GAA+B;IACtCzB,KAAK,EAAE,CAAA,EAAGgB,QAAQ,CAAA,MAAA,CAAQ;AAC1B,IAAA,IAAIf,QAAQ,GAAG;MAAEA,QAAQ,EAAE,GAAGe,QAAQ,CAAA,SAAA;KAAa,GAAG,EAAE,CAAC;AACzD,IAAA,IAAIR,UAAU,GAAG;MAAEA,UAAU,EAAE,GAAGQ,QAAQ,CAAA,YAAA;KAAgB,GAAG,EAAE,CAAC;AAChE,IAAA,IAAIP,aAAa,GAAG;MAAEA,aAAa,EAAE,GAAGO,QAAQ,CAAA,eAAA;KAAmB,GAAG,EAAE,CAAC;IACzEN,OAAO,EAAE,CAAA,EAAGM,QAAQ,CAAA,QAAA,CAAU;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CAACiG,MAAM,GAAGA,qBAAM;AACxBjG,QAAQ,CAAC4E,MAAM,GAAGA,qBAAM;;;"}
|
|
1
|
+
{"version":3,"file":"ListItem.js","sources":["../../src/ListItem/ListItem.tsx"],"sourcesContent":["import {\n useContext,\n useId,\n useMemo,\n useState,\n type PropsWithChildren,\n type ReactNode,\n} from 'react';\nimport { Sentiment, Typography } from '../common';\nimport Body from '../Body';\nimport { AdditionalInfo } from './AdditionalInfo';\nimport { IconButton, type ListItemIconButtonProps } from './IconButton';\nimport { Checkbox, type ListItemCheckboxProps } from './Checkbox';\nimport { Navigation, type ListItemNavigationProps } from './Navigation';\nimport { clsx } from 'clsx';\nimport { Button, type ListItemButtonProps } from './Button';\nimport { Radio, type ListItemRadioProps } from './Radio';\nimport { Switch, type ListItemSwitchProps } from './Switch';\nimport { AvatarLayout } from './AvatarLayout';\nimport { AvatarView } from './AvatarView';\nimport { Image } from './Image';\nimport { Prompt } from './Prompt';\nimport { PrimitiveAnchor, type PrimitiveAnchorProps } from '../Primitives';\nimport {\n ListItemContext,\n type ListItemContextData,\n type ListItemMediaSize,\n} from './ListItemContext';\n\nexport type ListItemTypes =\n 'non-interactive' | 'navigation' | 'radio' | 'checkbox' | 'switch' | 'button' | 'icon-button';\n\nexport type ListItemControlProps =\n | ListItemNavigationProps\n | ListItemCheckboxProps\n | ListItemButtonProps\n | ListItemIconButtonProps\n | ListItemRadioProps\n | ListItemSwitchProps;\n\nexport type ListItemProps = {\n /** @default 'li' */\n as?: 'li' | 'div';\n /**\n * Swaps vertical hierarchy of title and subtitle and their corresponding right values.\n */\n inverted?: boolean;\n /**\n * Disables the control and renders the ListItem in greyscale and with slightly decreased opacity.\n */\n disabled?: boolean;\n /**\n * If set, it'll extend the `disabled` state, overriding existing or injecting uniquely styled prompt with the message provided via this prop. <br />\n * **NB:** This message cannot house more than **1** link or inline button.<br />\n * **NB:** It must be used together with `disabled` prop and will be disregarded otherwise.\n */\n disabledPromptMessage?: ReactNode;\n /**\n * Highlights the list item as an action to be taken or already taken. <br />\n */\n spotlight?: 'active' | 'inactive';\n /**\n * Vertical padding of the list item, in pixels.\n * @default 12\n */\n paddingY?: 8 | 12 | 16 | 24;\n title: ReactNode;\n subtitle?: ReactNode;\n /**\n * Requires `<ListItem.AdditionalInfo />` component as a sole child. <br />\n * Can be only rendered if `subtitle` is also provided.\n */\n additionalInfo?: ReactNode;\n valueTitle?: ReactNode;\n valueSubtitle?: ReactNode;\n /**\n * Requires one of the following as a sole child: <br />\n * `<ListItem.AvatarView />`,\n * `<ListItem.AvatarLayout />` or\n * `<ListItem.Image />`\n */\n media?: ReactNode;\n /**\n * Requires one of the following as a sole child: <br/>\n * `<ListItem.Button />`, <br/>\n * `<ListItem.Checkbox />`, <br/>\n * `<ListItem.IconButton />`, <br/>\n * `<ListItem.Navigation />`, <br/>\n * `<ListItem.Radio />`, or\n * `<ListItem.Switch />`\n * @default null\n */\n control?: ReactNode;\n /**\n * Requires `<ListItem.Prompt />` component as a sole child.\n */\n prompt?: ReactNode;\n className?: string;\n /**\n * A number between `0–100` which resolves to a `fr` value of a `grid-template-columns` declaration. E.g. `valueColumnWidth={25}` will result in a `75fr 25fr`. <br />\n * Controls the width ratio of left side content (title and subtitle) to the right side content.\n */\n valueColumnWidth?: number;\n id?: string;\n};\n\n/**\n * @see [Design documentation](https://docs.wise.design/components/list-item)\n * @see [Storybook documentation](https://storybook.wise.design/?path=/docs/content-listitem--docs)\n */\nexport const ListItem = ({\n as: ListItemElement = 'li',\n title,\n subtitle,\n additionalInfo,\n prompt,\n inverted,\n media,\n spotlight,\n paddingY = 12,\n valueTitle,\n valueSubtitle,\n control = null,\n disabled,\n disabledPromptMessage,\n className,\n valueColumnWidth,\n id,\n}: ListItemProps) => {\n const idPrefix = useId();\n const [controlProps, setControlProps] = useState<ListItemControlProps>({});\n const [controlType, setControlType] = useState<ListItemTypes>('non-interactive');\n const [mediaSize, setMediaSize] = useState<ListItemMediaSize | undefined>();\n\n const ids: ListItemContextData['ids'] = {\n title: `${idPrefix}_title`,\n ...(subtitle ? { subtitle: `${idPrefix}_subtitle` } : {}),\n ...(valueTitle ? { valueTitle: `${idPrefix}_value-title` } : {}),\n ...(valueSubtitle ? { valueSubtitle: `${idPrefix}_value-subtitle` } : {}),\n control: `${idPrefix}_control`,\n ...(prompt || (disabled && disabledPromptMessage) ? { prompt: `${idPrefix}_prompt` } : {}),\n ...(additionalInfo ? { additionalInfo: `${idPrefix}_additional-info` } : {}),\n };\n\n const isPartiallyInteractive = Boolean(\n (controlType === 'button' || controlType === 'icon-button') &&\n (controlProps as ListItemButtonProps | ListItemIconButtonProps)?.partiallyInteractive,\n );\n const isFullyInteractive = controlType !== 'non-interactive' && !isPartiallyInteractive;\n const isButtonAsLink =\n (controlType === 'button' || controlType === 'icon-button') &&\n Boolean((controlProps as ListItemButtonProps | ListItemIconButtonProps)?.href);\n const isNavigationIndicatorHidden =\n controlType === 'navigation' &&\n Boolean((controlProps as ListItemNavigationProps)?.hideIndicator);\n\n const titlesAndValues = [\n inverted ? ids.subtitle : ids.title,\n inverted ? ids.title : ids.subtitle,\n inverted ? ids.valueSubtitle : ids.valueTitle,\n inverted ? ids.valueTitle : ids.valueSubtitle,\n ].join(' ');\n const additionalInfoPrompt = [ids.additionalInfo, ids.prompt].filter(Boolean).join(' ');\n\n const describedByIds = useMemo(() => {\n return isFullyInteractive && !isButtonAsLink\n ? additionalInfoPrompt\n : `${titlesAndValues} ${additionalInfoPrompt}`;\n }, [additionalInfoPrompt, isButtonAsLink, isFullyInteractive, titlesAndValues]);\n const listItemContext = useMemo(\n () => ({\n setControlType,\n setControlProps,\n setMediaSize,\n ids,\n props: { disabled, inverted, disabledPromptMessage },\n mediaSize,\n isPartiallyInteractive,\n describedByIds,\n }),\n [describedByIds, mediaSize, disabled, inverted, disabledPromptMessage, isPartiallyInteractive],\n );\n const gridColumnsStyle = {\n '--wds-list-item-body-left': valueColumnWidth ? `${100 - valueColumnWidth}fr` : '50fr',\n '--wds-list-item-body-right': valueColumnWidth ? `${valueColumnWidth}fr` : '50fr',\n } as React.CSSProperties;\n\n const getFeatureClassName = () => {\n const partials = [];\n const hasMedia = Boolean(media);\n const hasVisibleControl = Boolean(control) && !isNavigationIndicatorHidden;\n const hasInfo = Boolean(additionalInfo);\n const hasPrompt = Boolean(prompt) || (disabled && Boolean(disabledPromptMessage));\n\n /* eslint-disable functional/immutable-data */\n if (hasMedia && hasVisibleControl) {\n partials.push('wds-list-item-hasMedia-hasControl');\n }\n\n if (hasMedia && !hasVisibleControl) {\n partials.push('wds-list-item-hasMedia-noControl');\n }\n\n if (!hasMedia && hasVisibleControl) {\n partials.push('wds-list-item-noMedia-hasControl');\n }\n\n if (!hasMedia && !hasVisibleControl) {\n partials.push('wds-list-item-noMedia-noControl');\n }\n\n if (hasInfo && hasPrompt) {\n partials.push('wds-list-item-hasInfo-hasPrompt');\n }\n if (hasInfo && !hasPrompt) {\n partials.push('wds-list-item-hasInfo-noPrompt');\n }\n if (!hasInfo && hasPrompt) {\n partials.push('wds-list-item-noInfo-hasPrompt');\n }\n if (!hasInfo && !hasPrompt) {\n partials.push('wds-list-item-noInfo-noPrompt');\n }\n /* eslint-enable functional/immutable-data */\n\n return partials.join(' ');\n };\n\n return (\n <ListItemContext.Provider value={listItemContext}>\n <ListItemElement\n className={clsx(\n 'wds-list-item',\n `wds-list-item-${controlType}`,\n getFeatureClassName(),\n {\n 'wds-list-item-interactive': isFullyInteractive,\n 'wds-list-item-partially-interactive': isPartiallyInteractive,\n [`wds-list-item-spotlight wds-list-item-spotlight-${spotlight}`]:\n isFullyInteractive && !!spotlight,\n 'wds-list-item-paddingY-8': paddingY === 8,\n 'wds-list-item-paddingY-16': paddingY === 16,\n 'wds-list-item-paddingY-24': paddingY === 24,\n disabled: disabled && !isPartiallyInteractive,\n 'disabled--has-prompt-reason':\n !disabledPromptMessage && disabled && !isPartiallyInteractive,\n },\n className,\n )}\n id={id}\n aria-disabled={disabled}\n style={\n {\n '--wds-list-item-value-min-height': mediaSize ? `${mediaSize}px` : undefined,\n } as React.CSSProperties\n }\n >\n {isFullyInteractive && spotlight === 'inactive' && (\n <svg aria-hidden=\"true\" className=\"wds-list-item-spotlight__border\">\n <rect />\n </svg>\n )}\n\n <View\n {...{\n isPartiallyInteractive,\n subtitle,\n additionalInfo,\n disabled,\n disabledPromptMessage,\n prompt,\n controlType,\n controlProps,\n }}\n className={getFeatureClassName()}\n >\n {media && <div className=\"wds-list-item-media\">{media}</div>}\n\n {/* Title + Subtitle + Values - Group */}\n <div\n className=\"wds-list-item-body\"\n style={valueColumnWidth ? gridColumnsStyle : undefined}\n >\n {/* Title + Subtitle + Values - Group */}\n <span className=\"wds-list-item-titles\">\n {(() => {\n const titles = [\n <Body\n key={ids.title}\n id={ids.title}\n type={Typography.BODY_LARGE_BOLD}\n className=\"wds-list-item-title\"\n >\n {title}\n </Body>,\n ];\n if (subtitle) {\n titles.push(\n <Body key={ids.subtitle} id={ids.subtitle} className=\"wds-list-item-subtitle\">\n {subtitle}\n </Body>,\n );\n }\n return inverted ? [...titles].reverse() : titles;\n })()}\n </span>\n\n {(valueTitle || valueSubtitle) && (\n <span\n className={clsx('wds-list-item-value', {\n 'flex-column': valueTitle !== undefined || valueSubtitle !== undefined,\n })}\n >\n {(() => {\n const values = [];\n if (valueTitle) {\n values.push(\n <Body\n key={ids.valueTitle}\n id={ids.valueTitle}\n type={Typography.BODY_LARGE_BOLD}\n className=\"wds-list-item-title-value\"\n >\n {valueTitle}\n </Body>,\n );\n }\n if (valueSubtitle) {\n values.push(\n <Body\n key={ids.valueSubtitle}\n id={ids.valueSubtitle}\n className=\"wds-list-item-subtitle-value\"\n >\n {valueSubtitle}\n </Body>,\n );\n }\n return inverted ? [...values].reverse() : values;\n })()}\n </span>\n )}\n </div>\n\n {control === null ? null : (\n <Body\n className={clsx('wds-list-item-control-wrapper', {\n 'wds-list-item-button-control': controlType === 'button',\n 'wds-list-item-button-control--hasPrompt':\n controlType === 'button' && Boolean(prompt),\n })}\n style={\n {\n '--wds-list-item-control-wrapper-height': mediaSize ? `${mediaSize}px` : 'auto',\n } as React.CSSProperties\n }\n >\n {control}\n </Body>\n )}\n </View>\n </ListItemElement>\n </ListItemContext.Provider>\n );\n};\n\ntype ViewProps = PropsWithChildren<{\n isPartiallyInteractive: boolean;\n controlType?: ListItemTypes;\n controlProps?: ListItemControlProps;\n}> &\n Pick<\n ListItemProps,\n 'subtitle' | 'additionalInfo' | 'prompt' | 'disabled' | 'disabledPromptMessage' | 'className'\n >;\n\nfunction View({\n children,\n additionalInfo,\n prompt,\n disabled,\n disabledPromptMessage,\n isPartiallyInteractive,\n controlType = 'non-interactive',\n controlProps,\n className = '',\n}: ViewProps) {\n const { ids, describedByIds } = useContext<ListItemContextData>(ListItemContext);\n const isLinkControl = ['navigation'].includes(controlType);\n\n const isHrefProvided = isLinkControl && !!(controlProps as ListItemNavigationProps)?.href;\n\n const renderExtras = () => {\n const resolvedPrompt =\n disabled && disabledPromptMessage && !prompt ? (\n <Prompt sentiment={Sentiment.NEUTRAL}>{disabledPromptMessage}</Prompt>\n ) : (\n prompt\n );\n\n return (\n <>\n {additionalInfo}\n {resolvedPrompt}\n </>\n );\n };\n\n if (isLinkControl && isHrefProvided) {\n return (\n // for link instances of .Navigation, .IconButton, .Button\n <div className={clsx('wds-list-item-gridWrapper', className)}>\n <PrimitiveAnchor\n aria-describedby={describedByIds}\n href={(controlProps as ListItemNavigationProps)?.href}\n target={(controlProps as ListItemNavigationProps)?.target}\n className={clsx('wds-list-item-view', {\n 'wds-list-item-control': controlType === 'navigation',\n fullyInteractive: !isPartiallyInteractive,\n })}\n disabled={disabled}\n onClick={(controlProps as PrimitiveAnchorProps | undefined)?.onClick}\n >\n {children}\n </PrimitiveAnchor>\n\n {renderExtras()}\n </div>\n );\n }\n\n if (isPartiallyInteractive || controlType === 'non-interactive') {\n return (\n <div className={clsx('wds-list-item-gridWrapper', className)}>\n <div className=\"wds-list-item-view\">{children}</div>\n\n {renderExtras()}\n </div>\n );\n }\n\n // for form control instances of .Radio, .Checkbox, .Switch, .Button, .Navigation etc\n // Radio cannot be wrapped in a <fieldset> element to announce it as a group.\n const InputWrapper = controlType === 'radio' ? 'div' : 'fieldset';\n return (\n <InputWrapper className={clsx('wds-list-item-gridWrapper', className)}>\n <label\n htmlFor={ids.control}\n className={clsx('wds-list-item-view', {\n clickable: !disabled,\n fullyInteractive: !isPartiallyInteractive,\n })}\n >\n {children}\n </label>\n\n {renderExtras()}\n </InputWrapper>\n );\n}\n\nListItem.Image = Image;\nListItem.AvatarView = AvatarView;\nListItem.AvatarLayout = AvatarLayout;\nListItem.AdditionalInfo = AdditionalInfo;\nListItem.Checkbox = Checkbox;\nListItem.Radio = Radio;\nListItem.IconButton = IconButton;\nListItem.Navigation = Navigation;\nListItem.Button = Button;\nListItem.Switch = Switch;\nListItem.Prompt = Prompt;\n\nexport default ListItem;\n"],"names":["ListItem","as","ListItemElement","title","subtitle","additionalInfo","prompt","inverted","media","spotlight","paddingY","valueTitle","valueSubtitle","control","disabled","disabledPromptMessage","className","valueColumnWidth","id","idPrefix","useId","controlProps","setControlProps","useState","controlType","setControlType","mediaSize","setMediaSize","ids","isPartiallyInteractive","Boolean","partiallyInteractive","isFullyInteractive","isButtonAsLink","href","isNavigationIndicatorHidden","hideIndicator","titlesAndValues","join","additionalInfoPrompt","filter","describedByIds","useMemo","listItemContext","props","gridColumnsStyle","getFeatureClassName","partials","hasMedia","hasVisibleControl","hasInfo","hasPrompt","push","_jsx","ListItemContext","Provider","value","children","_jsxs","clsx","style","undefined","View","titles","Body","type","Typography","BODY_LARGE_BOLD","reverse","values","useContext","isLinkControl","includes","isHrefProvided","renderExtras","resolvedPrompt","Prompt","sentiment","Sentiment","NEUTRAL","_Fragment","PrimitiveAnchor","target","fullyInteractive","onClick","InputWrapper","htmlFor","clickable","Image","AvatarView","AvatarLayout","AdditionalInfo","Checkbox","Radio","IconButton","Navigation","Button","Switch"],"mappings":";;;;;;;;;;;;;;;;;;;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